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.
| @@ -1,10 +1,8 @@ | ||
| 1 | 1 | # Codabar |
| 2 | 2 | |
| 3 | Codabar is an old barcode type that can encode numbers and a number of special characters (`–`, `$`, `:`, `/`, `+`, `.`). | |
| 3 | Codabar _(also known as Code 2 of 7, USD-4, or NW-7)_ is a linear barcode format developed in 1972. While considered legacy technology, it's still commonly used in libraries, blood banks, and some logistics applications. It can encode numbers and specific special characters (`–`, `$`, `:`, `/`, `+`, `.`). | |
| 4 | 4 | |
| 5 | You can set start and stop characters to `A`, `B`, `C` or `D` but if no start and stop character is defined `A` will be used. | |
| 6 | ||
| 7 | ## Example | |
| 5 | ## Basic Usage | |
| 8 | 6 | |
| 9 | 7 | ```ts |
| 10 | 8 | import { barcode } from '@stacksjs/qrx' |
| @@ -16,6 +14,10 @@ barcode('#barcode', '1234567890', { | ||
| 16 | 14 | |
| 17 | 15 |  |
| 18 | 16 | |
| 17 | ## Start/Stop Characters | |
| 18 | ||
| 19 | You can specify start and stop characters (`A`, `B`, `C`, or `D`). If not specified, `A` is used by default: | |
| 20 | ||
| 19 | 21 | ```ts |
| 20 | 22 | import { barcode } from '@stacksjs/qrx' |
| 21 | 23 | |
| @@ -25,3 +27,128 @@ barcode('#barcode', 'C1234567890D', { | ||
| 25 | 27 | ``` |
| 26 | 28 | |
| 27 | 29 |  |
| 30 | ||
| 31 | ## Character Set | |
| 32 | ||
| 33 | Codabar supports: | |
| 34 | - Numbers (0-9) | |
| 35 | - Special characters: `-`, `$`, `:`, `/`, `+`, `.` | |
| 36 | - Start/Stop characters: `A`, `B`, `C`, `D` | |
| 37 | ||
| 38 | ## Advanced Options | |
| 39 | ||
| 40 | ```ts | |
| 41 | import { barcode } from '@stacksjs/qrx' | |
| 42 | ||
| 43 | barcode('#barcode', 'A1234-5678.90B', { | |
| 44 | format: 'codabar', | |
| 45 | width: 2, | |
| 46 | height: 100, | |
| 47 | displayValue: true, | |
| 48 | font: 'monospace', | |
| 49 | fontSize: 20, | |
| 50 | textAlign: 'center', | |
| 51 | textPosition: 'bottom', | |
| 52 | textMargin: 2, | |
| 53 | background: '#ffffff', | |
| 54 | lineColor: '#000000' | |
| 55 | }) | |
| 56 | ``` | |
| 57 | ||
| 58 | [!NOTE] Image needed: Advanced options example | |
| 59 | ||
| 60 | ## Common Applications | |
| 61 | ||
| 62 | 1. **Blood Banks** | |
| 63 | ```ts | |
| 64 | barcode('#barcode', 'A1234567B', { format: 'codabar' }) // Blood type labeling | |
| 65 | ``` | |
| 66 | ||
| 67 | 2. **Libraries** | |
| 68 | ```ts | |
| 69 | barcode('#barcode', 'A123-456+789B', { format: 'codabar' }) // Book tracking | |
| 70 | ``` | |
| 71 | ||
| 72 | 3. **Photo Labs** | |
| 73 | ```ts | |
| 74 | barcode('#barcode', 'C12345/678D', { format: 'codabar' }) // Photo processing | |
| 75 | ``` | |
| 76 | ||
| 77 | [!NOTE] Image needed: Real-world application examples | |
| 78 | ||
| 79 | ## Error Handling | |
| 80 | ||
| 81 | ```ts | |
| 82 | import { barcode } from '@stacksjs/qrx' | |
| 83 | ||
| 84 | barcode('#barcode', 'A123456B', { | |
| 85 | format: 'codabar', | |
| 86 | valid: (valid) => { | |
| 87 | if (!valid) { | |
| 88 | console.error('Invalid Codabar') | |
| 89 | // Handle invalid input | |
| 90 | } | |
| 91 | } | |
| 92 | }) | |
| 93 | ``` | |
| 94 | ||
| 95 | ## Best Practices | |
| 96 | ||
| 97 | 1. **Start/Stop Characters** | |
| 98 | - Always use matching pairs (AA, BB, CC, DD) | |
| 99 | - Be consistent across system | |
| 100 | - Consider scanner configuration | |
| 101 | ||
| 102 | 2. **Data Validation** | |
| 103 | ```ts | |
| 104 | // Valid examples | |
| 105 | barcode('#barcode', 'A1234-5678B') // Numbers and hyphen | |
| 106 | barcode('#barcode', 'C1234:5678D') // Numbers and colon | |
| 107 | barcode('#barcode', 'A12.34+56/78A') // Multiple special chars | |
| 108 | ``` | |
| 109 | ||
| 110 | 3. **Print Quality** | |
| 111 | - Maintain adequate quiet zones | |
| 112 | - Test with target scanners | |
| 113 | - Verify contrast ratios | |
| 114 | ||
| 115 | ## Technical Specifications | |
| 116 | ||
| 117 | - Variable length format | |
| 118 | - Self-checking capability | |
| 119 | - No check digit (but can be added) | |
| 120 | - Bi-directional reading | |
| 121 | - Wide/narrow bar ratio: 1:2.25 to 1:3 | |
| 122 | ||
| 123 | [!NOTE] Image needed: Technical specifications diagram | |
| 124 | ||
| 125 | ## Legacy System Integration | |
| 126 | ||
| 127 | ```ts | |
| 128 | // Old system format | |
| 129 | barcode('#barcode', 'A1234B') | |
| 130 | ||
| 131 | // Modern alternative (Code 128) | |
| 132 | barcode('#barcode', '1234', { format: 'CODE128' }) | |
| 133 | ``` | |
| 134 | ||
| 135 | [!NOTE] Image needed: Comparison with modern formats | |
| 136 | ||
| 137 | ## Advantages & Limitations | |
| 138 | ||
| 139 | ### Advantages | |
| 140 | ||
| 141 | - Simple structure | |
| 142 | - Self-checking | |
| 143 | - Bi-directional reading | |
| 144 | - Special character support | |
| 145 | - Wide hardware support | |
| 146 | ||
| 147 | ### Limitations | |
| 148 | ||
| 149 | - Low data density | |
| 150 | - No built-in check digit | |
| 151 | - Limited character set | |
| 152 | - Older technology | |
| 153 | ||
| 154 | [!NOTE] Image needed: Advantages/limitations comparison chart | |