also looking at this
chore(deps): update dependency react to 19.2.7
#2137
222 files
+16350
-1825
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -100,15 +100,17 @@ barcode('#barcode') | ||
| 100 | 100 | ## Common Applications |
| 101 | 101 | |
| 102 | 102 | 1. Retail Products |
| 103 | - Standard retail products | |
| 104 | - Point of sale scanning | |
| 105 | - Inventory management | |
| 103 | - Standard retail products | |
| 104 | - Point of sale scanning | |
| 105 | - Inventory management | |
| 106 | ||
| 106 | 107 | 2. Books (ISBN) |
| 107 | - Prefix: 978 or 979 | |
| 108 | - Used with EAN-5 for price | |
| 108 | - Prefix: 978 or 979 | |
| 109 | - Used with EAN-5 for price | |
| 110 | ||
| 109 | 111 | 3. Periodicals (ISSN) |
| 110 | - Prefix: 977 | |
| 111 | - Used with EAN-2 for issue numbers | |
| 112 | - Prefix: 977 | |
| 113 | - Used with EAN-2 for issue numbers | |
| 112 | 114 | |
| 113 | 115 | [!NOTE] Image needed: Real-world application examples |
| 114 | 116 | |
| @@ -59,37 +59,40 @@ barcode('#barcode', '53', { | ||
| 59 | 59 | ## Common Applications |
| 60 | 60 | |
| 61 | 61 | 1. Magazine Issues |
| 62 | - ```ts | |
| 63 | // Issue 12 of a magazine | |
| 64 | barcode('#barcode', '12', { format: 'EAN2' }) | |
| 65 | ``` | |
| 62 | ```ts | |
| 63 | // Issue 12 of a magazine | |
| 64 | barcode('#barcode', '12', { format: 'EAN2' }) | |
| 65 | ``` | |
| 66 | ||
| 66 | 67 | 2. Newspaper Editions |
| 67 | - ```ts | |
| 68 | // Sunday edition (01) | |
| 69 | barcode('#barcode', '01', { format: 'EAN2' }) | |
| 70 | ``` | |
| 68 | ```ts | |
| 69 | // Sunday edition (01) | |
| 70 | barcode('#barcode', '01', { format: 'EAN2' }) | |
| 71 | ``` | |
| 72 | ||
| 71 | 73 | 3. Version Indicators |
| 72 | - ```ts | |
| 73 | // Version 2.0 | |
| 74 | barcode('#barcode', '20', { format: 'EAN2' }) | |
| 75 | ``` | |
| 74 | ```ts | |
| 75 | // Version 2.0 | |
| 76 | barcode('#barcode', '20', { format: 'EAN2' }) | |
| 77 | ``` | |
| 76 | 78 | |
| 77 | 79 | [!NOTE] Image needed: Real-world application examples |
| 78 | 80 | |
| 79 | 81 | ## Positioning Guidelines |
| 80 | 82 | |
| 81 | 83 | 1. Standard Placement |
| 82 | - Right-aligned with main barcode | |
| 83 | - Specific gap width (9-12 modules) | |
| 84 | - Baseline alignment with main barcode | |
| 84 | - Right-aligned with main barcode | |
| 85 | - Specific gap width (9-12 modules) | |
| 86 | - Baseline alignment with main barcode | |
| 87 | ||
| 85 | 88 | 2. Height Considerations |
| 86 | - ```ts | |
| 87 | // Typically taller than main barcode | |
| 88 | barcode('#barcode', '53', { | |
| 89 | format: 'EAN2', | |
| 90 | height: 85 // Compared to standard 70 | |
| 91 | }) | |
| 92 | ``` | |
| 89 | ```ts | |
| 90 | // Typically taller than main barcode | |
| 91 | barcode('#barcode', '53', { | |
| 92 | format: 'EAN2', | |
| 93 | height: 85 // Compared to standard 70 | |
| 94 | }) | |
| 95 | ``` | |
| 93 | 96 | |
| 94 | 97 | [!NOTE] Image needed: Positioning and alignment diagram |
| 95 | 98 | |
| @@ -112,14 +115,15 @@ barcode('#barcode', '53', { | ||
| 112 | 115 | ## Best Practices |
| 113 | 116 | |
| 114 | 117 | 1. Usage Guidelines |
| 115 | - Always use with main barcode | |
| 116 | - Maintain standard spacing | |
| 117 | - Use consistent height ratio | |
| 118 | - Validate 2-digit input | |
| 119 | - Consider scanner compatibility | |
| 118 | - Always use with main barcode | |
| 119 | - Maintain standard spacing | |
| 120 | - Use consistent height ratio | |
| 121 | - Validate 2-digit input | |
| 122 | - Consider scanner compatibility | |
| 123 | ||
| 120 | 124 | 2. Common Patterns |
| 121 | - 00-09: Daily publications | |
| 122 | - 10-99: Weekly/monthly publications | |
| 125 | - 00-09: _Daily publications_ | |
| 126 | - 10-99: _Weekly/monthly publications_ | |
| 123 | 127 | |
| 124 | 128 | ## Technical Notes |
| 125 | 129 | |
| @@ -58,19 +58,21 @@ barcode('#barcode', '54495', { | ||
| 58 | 58 | ## Common Applications |
| 59 | 59 | |
| 60 | 60 | 1. **Book Pricing** |
| 61 | - Currency indicator (0-7: GBP, 8: USD, 9: AUD) | |
| 62 | - Price value | |
| 61 | - Currency indicator (0-7: GBP, 8: USD, 9: AUD) | |
| 62 | - Price value | |
| 63 | ||
| 63 | 64 | 2. **Magazine Pricing** |
| 64 | - Issue number | |
| 65 | - Price information | |
| 65 | - Issue number | |
| 66 | - Price information | |
| 67 | ||
| 66 | 68 | 3. **Currency Encoding** Example codes: |
| 67 | - ```ts | |
| 68 | // £5.99 in GBP | |
| 69 | barcode('#barcode', '05991', { format: 'EAN5' }) | |
| 69 | ```ts | |
| 70 | // £5.99 in GBP | |
| 71 | barcode('#barcode', '05991', { format: 'EAN5' }) | |
| 70 | 72 | |
| 71 | // $15.95 in USD | |
| 72 | barcode('#barcode', '81595', { format: 'EAN5' }) | |
| 73 | ``` | |
| 73 | // $15.95 in USD | |
| 74 | barcode('#barcode', '81595', { format: 'EAN5' }) | |
| 75 | ``` | |
| 74 | 76 | |
| 75 | 77 | [!NOTE] Image needed: Currency encoding examples |
| 76 | 78 | |
| @@ -80,14 +82,15 @@ barcode('#barcode', '54495', { | ||
| 80 | 82 | - Right-aligned with main barcode |
| 81 | 83 | - Standard gap between main barcode |
| 82 | 84 | - Same baseline alignment |
| 85 | ||
| 83 | 86 | 2. **Height Options** |
| 84 | - ```ts | |
| 85 | // Taller than main barcode | |
| 86 | barcode('#barcode', '54495', { | |
| 87 | format: 'EAN5', | |
| 88 | height: 85 // Compared to standard 70 | |
| 89 | }) | |
| 90 | ``` | |
| 87 | ```ts | |
| 88 | // Taller than main barcode | |
| 89 | barcode('#barcode', '54495', { | |
| 90 | format: 'EAN5', | |
| 91 | height: 85 // Compared to standard 70 | |
| 92 | }) | |
| 93 | ``` | |
| 91 | 94 | |
| 92 | 95 | [!NOTE] Image needed: Positioning visualization |
| 93 | 96 | |
| @@ -117,10 +120,10 @@ barcode('#barcode', '54495', { | ||
| 117 | 120 | |
| 118 | 121 | ## Technical Notes |
| 119 | 122 | |
| 120 | 1. No check digit used | |
| 121 | 2. Must be 5 digits exactly | |
| 122 | 3. Cannot be used standalone | |
| 123 | 4. Scanner must support add-ons | |
| 124 | 5. Standard right-alignment required | |
| 123 | - No check digit used | |
| 124 | - Must be 5 digits exactly | |
| 125 | - Cannot be used standalone | |
| 126 | - Scanner must support add-ons | |
| 127 | - Standard right-alignment required | |
| 125 | 128 | |
| 126 | 129 | [!NOTE] Image needed: Technical specifications diagram |
| @@ -85,13 +85,14 @@ barcode('#barcode') | ||
| 85 | 85 | ## Common Applications |
| 86 | 86 | |
| 87 | 87 | 1. Small Products |
| 88 | - Confectionery | |
| 89 | - Cosmetics | |
| 90 | - Small electronics | |
| 88 | - Confectionery | |
| 89 | - Cosmetics | |
| 90 | - Small electronics | |
| 91 | ||
| 91 | 92 | 2. Space-Limited Packaging |
| 92 | - Travel-size products | |
| 93 | - Small containers | |
| 94 | - Limited label space | |
| 93 | - Travel-size products | |
| 94 | - Small containers | |
| 95 | - Limited label space | |
| 95 | 96 | |
| 96 | 97 | [!NOTE] Image needed: Real-world application examples |
| 97 | 98 | |
| @@ -0,0 +1,195 @@ | ||
| 1 | # UPC-A | |
| 2 | ||
| 3 | UPC-A (Universal Product Code) is the standard barcode format for retail products in North America. It consists of 12 digits and is technically a subset of EAN-13 (with a leading zero). | |
| 4 | ||
| 5 | ## Basic Usage | |
| 6 | ||
| 7 | ```ts | |
| 8 | import { barcode } from '@stacksjs/qrx' | |
| 9 | ||
| 10 | barcode('#barcode', '123456789012', { format: 'UPC' }) | |
| 11 | ``` | |
| 12 | ||
| 13 | [!NOTE] Image needed: Basic UPC-A barcode example | |
| 14 | ||
| 15 | ## Structure | |
| 16 | ||
| 17 | A UPC-A barcode consists of: | |
| 18 | ||
| 19 | - First digit: Number system digit | |
| 20 | - Next 5 digits: Manufacturer code | |
| 21 | - Next 5 digits: Product code | |
| 22 | - Last digit: Check digit (automatically calculated) | |
| 23 | ||
| 24 | ## Auto Check Digit | |
| 25 | ||
| 26 | The check digit is automatically calculated if omitted: | |
| 27 | ||
| 28 | ```ts | |
| 29 | import { barcode } from '@stacksjs/qrx' | |
| 30 | ||
| 31 | // These generate the same barcode | |
| 32 | barcode('#barcode', '12345678901', { format: 'UPC' }) // Auto-calculates check digit | |
| 33 | barcode('#barcode', '123456789012', { format: 'UPC' }) // Manual check digit | |
| 34 | ``` | |
| 35 | ||
| 36 | ## Flat Mode | |
| 37 | ||
| 38 | Remove guard bars for special applications: | |
| 39 | ||
| 40 | ```ts | |
| 41 | import { barcode } from '@stacksjs/qrx' | |
| 42 | ||
| 43 | barcode('#barcode', '123456789012', { | |
| 44 | format: 'UPC', | |
| 45 | flat: true | |
| 46 | }) | |
| 47 | ``` | |
| 48 | ||
| 49 | [!NOTE] Image needed: UPC-A flat mode example | |
| 50 | ||
| 51 | ## Advanced Options | |
| 52 | ||
| 53 | ```ts | |
| 54 | import { barcode } from '@stacksjs/qrx' | |
| 55 | ||
| 56 | barcode('#barcode', '123456789012', { | |
| 57 | format: 'UPC', | |
| 58 | width: 2, | |
| 59 | height: 100, | |
| 60 | displayValue: true, | |
| 61 | font: 'OCRB', | |
| 62 | fontSize: 18, | |
| 63 | textMargin: 0, | |
| 64 | flat: false, | |
| 65 | guardHeight: 15 // Height of guard bars | |
| 66 | }) | |
| 67 | ``` | |
| 68 | ||
| 69 | ## Guarded Encoding | |
| 70 | ||
| 71 | The standard way of printing UPC-A with guard bars: | |
| 72 | ||
| 73 | ```ts | |
| 74 | import { barcode } from '@stacksjs/qrx' | |
| 75 | ||
| 76 | barcode('#barcode', '123456789012', { | |
| 77 | format: 'UPC', | |
| 78 | guardHeight: 15 | |
| 79 | }) | |
| 80 | ``` | |
| 81 | ||
| 82 | [!NOTE] Image needed: Example showing guard bars | |
| 83 | ||
| 84 | ## Add-on Support | |
| 85 | ||
| 86 | Combine with EAN-2 or EAN-5 supplemental barcodes: | |
| 87 | ||
| 88 | ```ts | |
| 89 | import { barcode } from '@stacksjs/qrx' | |
| 90 | ||
| 91 | barcode('#barcode') | |
| 92 | .UPC('123456789012') | |
| 93 | .blank(20) | |
| 94 | .EAN5('12345', { | |
| 95 | height: 85, | |
| 96 | textPosition: 'top' | |
| 97 | }) | |
| 98 | .render() | |
| 99 | ``` | |
| 100 | ||
| 101 | [!NOTE] Image needed: UPC-A with add-on example | |
| 102 | ||
| 103 | ## Number System Digits | |
| 104 | ||
| 105 | The first digit has special meaning: | |
| 106 | ||
| 107 | - 0: Regular UPC codes | |
| 108 | - 1: Reserved | |
| 109 | - 2: Weight items marked at the store | |
| 110 | - 3: National Drug Code/Health Related | |
| 111 | - 4: Non-food items with no code format restrictions | |
| 112 | - 5: Coupons | |
| 113 | - 6: Reserved | |
| 114 | - 7: Regular UPC codes | |
| 115 | - 8: Reserved | |
| 116 | - 9: Reserved | |
| 117 | ||
| 118 | ```ts | |
| 119 | // Example of a pharmaceutical product | |
| 120 | barcode('#barcode', '312345678912', { format: 'UPC' }) | |
| 121 | ||
| 122 | // Example of a weighted item | |
| 123 | barcode('#barcode', '212345678912', { format: 'UPC' }) | |
| 124 | ``` | |
| 125 | ||
| 126 | ## Error Handling | |
| 127 | ||
| 128 | ```ts | |
| 129 | import { barcode } from '@stacksjs/qrx' | |
| 130 | ||
| 131 | barcode('#barcode', '123456789012', { | |
| 132 | format: 'UPC', | |
| 133 | valid: (valid) => { | |
| 134 | if (!valid) { | |
| 135 | console.error('Invalid UPC-A') | |
| 136 | // Handle invalid input | |
| 137 | } | |
| 138 | } | |
| 139 | }) | |
| 140 | ``` | |
| 141 | ||
| 142 | ## Best Practices | |
| 143 | ||
| 144 | 1. **Input Validation** | |
| 145 | - Validate length (11-12 digits) | |
| 146 | - Verify number system digit | |
| 147 | - Check manufacturer code validity | |
| 148 | ||
| 149 | 2. **Printing Guidelines** | |
| 150 | - Minimum size requirements | |
| 151 | - Quiet zone specifications | |
| 152 | - Print quality standards | |
| 153 | ||
| 154 | 3. **Scanner Compatibility** | |
| 155 | - Test with multiple scanners | |
| 156 | - Verify add-on compatibility | |
| 157 | - Check guard bar recognition | |
| 158 | ||
| 159 | ## Technical Notes | |
| 160 | ||
| 161 | 1. **Size Requirements** | |
| 162 | - Nominal size: 37.29mm × 25.91mm | |
| 163 | - Magnification range: 80% to 200% | |
| 164 | - Minimum bar width: 0.264mm | |
| 165 | - Minimum quiet zone: 9mm | |
| 166 | ||
| 167 | 2. **Conversion to EAN-13** | |
| 168 | ```ts | |
| 169 | // UPC-A | |
| 170 | barcode('#barcode', '123456789012', { format: 'UPC' }) | |
| 171 | ||
| 172 | // Equivalent EAN-13 | |
| 173 | barcode('#barcode', '0123456789012', { format: 'EAN13' }) | |
| 174 | ``` | |
| 175 | ||
| 176 | [!NOTE] Image needed: Technical specifications diagram | |
| 177 | ||
| 178 | ## Common Applications | |
| 179 | ||
| 180 | 1. **Retail Products** | |
| 181 | - Consumer goods | |
| 182 | - Point of sale scanning | |
| 183 | - Inventory management | |
| 184 | ||
| 185 | 2. **Grocery Items** | |
| 186 | - Fixed weight products | |
| 187 | - Variable weight items | |
| 188 | - In-store marked items | |
| 189 | ||
| 190 | 3. **Healthcare Products** | |
| 191 | - Pharmaceuticals | |
| 192 | - Medical supplies | |
| 193 | - Health-related items | |
| 194 | ||
| 195 | [!NOTE] Image needed: Real-world application examples | |
| @@ -0,0 +1,168 @@ | ||
| 1 | # UPC-E | |
| 2 | ||
| 3 | UPC-E is a zero-suppressed version of UPC-A, designed for smaller packages. It's also known as "zero compressed" UPC because it reduces a 12-digit UPC-A code into 8 digits by suppressing trailing zeros. | |
| 4 | ||
| 5 | ## Basic Usage | |
| 6 | ||
| 7 | ```ts | |
| 8 | import { barcode } from '@stacksjs/qrx' | |
| 9 | ||
| 10 | barcode('#barcode', '01234565', { format: 'UPCE' }) | |
| 11 | ``` | |
| 12 | ||
| 13 | [!NOTE] Image needed: Basic UPC-E barcode example | |
| 14 | ||
| 15 | ## Structure | |
| 16 | ||
| 17 | UPC-E has special compression rules: | |
| 18 | ||
| 19 | - First digit must be 0 or 1 | |
| 20 | - Last digit is a check digit | |
| 21 | - Middle 6 digits follow compression patterns | |
| 22 | ||
| 23 | ## Compression Patterns | |
| 24 | ||
| 25 | UPC-E compresses UPC-A codes that end in zeros. The compression patterns are: | |
| 26 | ||
| 27 | | UPC-E | Expands to (UPC-A) | Pattern | | |
| 28 | |-----------|---------------------|------------| | |
| 29 | | 0123400 | 012340000000 | XX000-00YYY | | |
| 30 | | 0123400 | 012300000004 | XX100-00YYY | | |
| 31 | | 0123400 | 012200000003 | XX200-00YYY | | |
| 32 | | 0123400 | 012300000000 | XXX00-000Y | | |
| 33 | | 0123400 | 012340000000 | XXXX0-0000 | | |
| 34 | | 0123400 | 012345000000 | XXXXX-0005 | | |
| 35 | | 0123400 | 012345600000 | XXXXX-0006 | | |
| 36 | | 0123400 | 012345700000 | XXXXX-0007 | | |
| 37 | | 0123400 | 012345800000 | XXXXX-0008 | | |
| 38 | | 0123400 | 012345900000 | XXXXX-0009 | | |
| 39 | ||
| 40 | ## Basic Encoding | |
| 41 | ||
| 42 | ```ts | |
| 43 | import { barcode } from '@stacksjs/qrx' | |
| 44 | ||
| 45 | // Direct UPC-E number | |
| 46 | barcode('#barcode', '01234565', { format: 'UPCE' }) | |
| 47 | ||
| 48 | // With number system and check digit | |
| 49 | barcode('#barcode', '01234565', { format: 'UPCE' }) | |
| 50 | ``` | |
| 51 | ||
| 52 | ## Advanced Options | |
| 53 | ||
| 54 | ```ts | |
| 55 | import { barcode } from '@stacksjs/qrx' | |
| 56 | ||
| 57 | barcode('#barcode', '01234565', { | |
| 58 | format: 'UPCE', | |
| 59 | width: 2, | |
| 60 | height: 100, | |
| 61 | displayValue: true, | |
| 62 | font: 'OCRB', | |
| 63 | fontSize: 18, | |
| 64 | textMargin: 0, | |
| 65 | flat: false, | |
| 66 | guardHeight: 15 | |
| 67 | }) | |
| 68 | ``` | |
| 69 | ||
| 70 | ## Conversion Examples | |
| 71 | ||
| 72 | ```ts | |
| 73 | import { barcode } from '@stacksjs/qrx' | |
| 74 | ||
| 75 | // These UPC-A numbers compress to the same UPC-E | |
| 76 | barcode('#barcode', '01200000345', { format: 'UPCE' }) // -> 01234565 | |
| 77 | barcode('#barcode', '01234500005', { format: 'UPCE' }) // -> 01234565 | |
| 78 | ``` | |
| 79 | ||
| 80 | [!NOTE] Image needed: Conversion visualization | |
| 81 | ||
| 82 | ## Add-on Support | |
| 83 | ||
| 84 | ```ts | |
| 85 | import { barcode } from '@stacksjs/qrx' | |
| 86 | ||
| 87 | barcode('#barcode') | |
| 88 | .UPCE('01234565') | |
| 89 | .blank(20) | |
| 90 | .EAN2('12', { | |
| 91 | height: 85, | |
| 92 | textPosition: 'top' | |
| 93 | }) | |
| 94 | .render() | |
| 95 | ``` | |
| 96 | ||
| 97 | [!NOTE] Image needed: UPC-E with add-on example | |
| 98 | ||
| 99 | ## Error Handling | |
| 100 | ||
| 101 | ```ts | |
| 102 | import { barcode } from '@stacksjs/qrx' | |
| 103 | ||
| 104 | barcode('#barcode', '01234565', { | |
| 105 | format: 'UPCE', | |
| 106 | valid: (valid) => { | |
| 107 | if (!valid) { | |
| 108 | console.error('Invalid UPC-E') | |
| 109 | // Handle invalid input | |
| 110 | } | |
| 111 | } | |
| 112 | }) | |
| 113 | ``` | |
| 114 | ||
| 115 | ## Best Practices | |
| 116 | ||
| 117 | 1. **Validation Rules** | |
| 118 | - First digit must be 0 or 1 | |
| 119 | - Must follow compression patterns | |
| 120 | - Check digit must be valid | |
| 121 | - Total length must be 6 or 8 digits | |
| 122 | ||
| 123 | 2. **Printing Guidelines** | |
| 124 | - Maintain minimum size requirements | |
| 125 | - Ensure quiet zones | |
| 126 | - Use OCR-B font | |
| 127 | - Test scanner compatibility | |
| 128 | ||
| 129 | ## Technical Notes | |
| 130 | ||
| 131 | 1. **Size Specifications** | |
| 132 | - Nominal size: 22.11mm × 25.91mm | |
| 133 | - Magnification: 80% to 200% | |
| 134 | - Minimum bar width: 0.264mm | |
| 135 | - Quiet zones: 7x module width | |
| 136 | ||
| 137 | 2. **Conversion Guidelines** | |
| 138 | - Not all UPC-A codes can be compressed | |
| 139 | - Only specific patterns are valid | |
| 140 | - Maintain original UPC-A for reference | |
| 141 | ||
| 142 | [!NOTE] Image needed: Technical specifications diagram | |
| 143 | ||
| 144 | ## Comparison with UPC-A | |
| 145 | ||
| 146 | ```ts | |
| 147 | // UPC-A original | |
| 148 | barcode('#barcode', '012000003456', { format: 'UPC' }) | |
| 149 | ||
| 150 | // UPC-E compressed equivalent | |
| 151 | barcode('#barcode', '01234565', { format: 'UPCE' }) | |
| 152 | ``` | |
| 153 | ||
| 154 | [!NOTE] Image needed: Side-by-side comparison of UPC-A and UPC-E | |
| 155 | ||
| 156 | ## Common Applications | |
| 157 | ||
| 158 | 1. **Small Packages** | |
| 159 | - Travel-size products | |
| 160 | - Small cosmetics | |
| 161 | - Limited label space | |
| 162 | ||
| 163 | 2. **Special Products** | |
| 164 | - Zero-suppressed items | |
| 165 | - Space-constrained labels | |
| 166 | - Small retail items | |
| 167 | ||
| 168 | [!NOTE] Image needed: Real-world application examples | |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | # EAN & UPC Barcodes |
| 2 | 2 | |
| 3 | EAN (European Article Number) and UPC (Universal Product Code) are standardized barcodes used worldwide for retail products. These barcode systems are managed by GS1 and are crucial for product identification in retail environments. | |
| 3 | EAN _(European Article Number)_ and UPC _(Universal Product Code)_ are standardized barcodes used worldwide for retail products. These barcode systems are managed by GS1 and are crucial for product identification in retail environments. | |
| 4 | 4 | |
| 5 | 5 | ## Supported Formats |
| 6 | 6 | |