@snacky/ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 rezatresnas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # @snacky/ui
2
+
3
+ React implementation of the Snacky App design system - generated from the
4
+ source of truth at `../../index.html` (via `tokens.json` / `components.json`),
5
+ pixel-accurate to Figma (file key `4Uh4Y1fPQXu2hwq0vEXHXd`).
6
+
7
+ This exists so AI coding tools (and humans) building new Snacky features can
8
+ **import** these components directly instead of regenerating similar-looking
9
+ markup from scratch every time.
10
+
11
+ ## Install
12
+
13
+ Not yet published - link it locally from an app in this monorepo, or `npm pack`
14
+ and install the tarball:
15
+
16
+ ```bash
17
+ cd packages/react-ui
18
+ npm install
19
+ npm run build
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ```tsx
25
+ import '@snacky/ui'; // pulls in theme/tokens.css as a side effect
26
+ import { Button, TextField, Checkbox } from '@snacky/ui';
27
+
28
+ function SignupForm() {
29
+ const [email, setEmail] = useState('');
30
+ const [agreed, setAgreed] = useState(false);
31
+
32
+ return (
33
+ <form>
34
+ <TextField label="Email" value={email} onChange={setEmail} placeholder="you@example.com" />
35
+ <Checkbox label="I agree to the terms" checked={agreed} onChange={setAgreed} />
36
+ <Button type="submit" disabled={!agreed}>Sign up</Button>
37
+ </form>
38
+ );
39
+ }
40
+ ```
41
+
42
+ ## What's here
43
+
44
+ All 22 documented components, each matching its `code.tsx` sample's prop
45
+ shape from `components.json` (padding, colors, radius, states - all sourced
46
+ directly from the design tokens, not eyeballed):
47
+
48
+ Button, IconButton/UploadButton, Input family (TextField, SearchField,
49
+ OtpField, CopyField, ChatInput, AddressResult), Chips (ProductChip/FilterChip),
50
+ RadioOption, Checkbox, Toggle, NavBar, TabRow, Header, Banner family, Badge family,
51
+ Callout, List (OrderListItem/NotificationListItem), Accordion, BottomSheet
52
+ (the shared Modal shell), Section (the shared content-block shell), Avatar,
53
+ Illustration, ProductImage, ProductCard.
54
+
55
+ ## Verification status
56
+
57
+ The first pass of every component was built from `components.json`'s `s`
58
+ (spec) values and `code.tsx` samples alone - those are real token values, but
59
+ `code.tsx` is an *illustrative* usage sample, not the site's actual rendered
60
+ implementation. That first pass was **not** checked against how the site
61
+ itself actually renders each component, and several real mismatches slipped
62
+ through as a result (Button's icon slot, Toggle's true dimensions, Checkbox's
63
+ checkmark color, Radio's dot size, Tab's gap, ProductCard's cart-button size,
64
+ List's status colors, and more).
65
+
66
+ Every component has since been diffed against `index.html`'s own `PG[id].impl`
67
+ strings - the actual React-createElement code that powers the site's "Live
68
+ Preview" panels, extracted and compared field-by-field (padding, colors,
69
+ font, line-height, hover/pressed/disabled states) - and corrected to match.
70
+ This is the authoritative source in this repo; `components.json`'s prose spec
71
+ text occasionally disagrees with it (e.g. Checkbox's checkmark is documented
72
+ as "white" but the verified implementation uses `#333333`) and the verified
73
+ implementation wins in every such case.
74
+
75
+ `List`'s `OrderListItem`/`NotificationListItem` were additionally cross-checked
76
+ directly against their Figma component set (page "List", component `List`,
77
+ `Property 1=order|notification` x `Property 2=<status>`) - the node tree
78
+ (fills, strokes, padding, gap, type styles) matches the verified `PG.list.impl`
79
+ implementation exactly, so both sources agree: 56x56 thumbnail frame (`#f4f4f5`
80
+ background, not a token - a literal value distinct from any generated surface
81
+ color), a per-status summary card (`itemsSummary` + bold `total`, a bordered
82
+ COD chip on `processCod`, a `paymentDeadline` banner on `waiting`, a right-
83
+ aligned primary Button - "Track Shipment" / "Buy Again" - on
84
+ shipped/received/cancelled), and a title+message notification row with a
85
+ `1px solid var(--border-main)` border on every state, not just unread.
86
+
87
+ `Header` was added later, directly from Figma rather than retrofitted from
88
+ an existing implementation: inspected the `Header` component set (page
89
+ "Header", variants `Icon=Back|Close|None` x `Right Action=True|False`) node
90
+ tree for exact spec values (16px/8px padding, 40x40px circular icon buttons,
91
+ Poppins Bold 16px/36px title), verified against a live smoke-test render for
92
+ all 4 variants (structure, computed styles, click handlers), and confirmed
93
+ the `PG.header.impl` string added to the site itself matches the same spec.
94
+
95
+ **One deliberate deviation, not an oversight:** `NavBar` items use `flex:1`
96
+ to fill the container width, where the site's own demo hardcodes `72x72`
97
+ per item - because that demo is only ever shown at a fixed 360px frame. A
98
+ production nav bar needs to fill whatever width the real device is, so the
99
+ flexible layout was kept on purpose.
100
+
101
+ ## Known gaps - read before relying on these
102
+
103
+ - **Icons** (`SnackyIcons.outline.*` / `SnackyIcons.solid.*`): only a starter
104
+ set is included (~30 outline, 3 solid), covering what's needed for a typical
105
+ form. The full documented set (41 outline + 10 solid) needs to be exported
106
+ from Figma's real icon components - the same way this whole design system
107
+ was built (`get_screenshot`/`download_assets` via the `figma-use` skill) -
108
+ and dropped into `src/icons/`. The starter set was hand-drawn as generic,
109
+ conventional UI glyphs; it does **not** claim pixel-fidelity to Figma.
110
+ - **Illustration** ships no artwork - pass your own hosted `src`.
111
+ - **Modal/Section**: the design system documents ~9 Modal "variants" and ~13
112
+ Section "variants", but each is really the *same* shell component
113
+ (`BottomSheet` / `Section`) with different `children` - so that's what's
114
+ exported, matching every `code.tsx` sample exactly, rather than 22 near-
115
+ duplicate components. These two shells have not yet been diffed field-by-
116
+ field against `PG.modal`/`PG.section` the way the rest of the package has -
117
+ treat their exact padding/gap values as reasonable-but-unverified.
118
+
119
+ ## Keeping this in sync
120
+
121
+ If `index.html`'s component data (the `C` object) changes:
122
+
123
+ ```bash
124
+ node ../../scripts/generate-agent-files.js # regenerates tokens.json / components.json
125
+ node ../../scripts/generate-react-tokens.js # regenerates src/theme/tokens.css / tokens.ts
126
+ ```
127
+
128
+ Then re-check any component whose spec changed against its file here -
129
+ token/color/spacing changes propagate automatically via the regenerated CSS
130
+ variables, but structural changes (new variant, new prop) need a manual edit.