@snacky/ui 0.3.2 → 0.3.4

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/CHANGELOG.md ADDED
@@ -0,0 +1,77 @@
1
+ # Changelog
2
+
3
+ How `@snacky/ui` got to its current state. The README documents what the
4
+ package *is*; this documents how it got there, including the mistakes, so the
5
+ verification claims in the README can be taken at face value.
6
+
7
+ ## Icon set replaced with the real Figma artwork (0.3.0)
8
+
9
+ The package originally shipped a hand-drawn "starter" icon set: roughly 30
10
+ generic 24x24 glyphs with a 1.5px stroke, written from memory and explicitly
11
+ documented as not pixel-faithful to Figma.
12
+
13
+ That was replaced by all 42 Outline + 10 Solid icons exported from Figma's own
14
+ `Icon-outline` (node `55:2062`) and `Icon-solid` (`8772:5851`) component sets.
15
+ Two structural surprises came out of it:
16
+
17
+ - The icons are **filled outline shapes**, not stroked paths. The weight is
18
+ baked into each shape, so there is no `strokeWidth` to set.
19
+ - The set is **not uniform**. Icons are authored at 16, 20 or 24 units
20
+ depending on where they are used, so each carries its own viewBox instead of
21
+ being scaled from a single size.
22
+
23
+ Three icons are named for what they actually draw rather than their Figma
24
+ property value, confirmed by rendering the exported geometry: Figma's `cod` is
25
+ a delivery truck (`truck`), `list` is a right chevron (`chevronRight`), and the
26
+ two `password` states are a crossed-out and an open eye (`eyeOff` / `eye`).
27
+
28
+ `src/icons/outline.tsx` and `solid.tsx` are now generated from
29
+ `assets/icons/icons.json` by `scripts/generate-icons.js`, the same source that
30
+ generates the Compose package's `SnackyIcons.kt`, so the two platforms cannot
31
+ drift apart. Parity was verified by diffing every path, viewBox and fill-rule
32
+ in both generated outputs against the source: 52/52 exact on each side.
33
+
34
+ ### Attribution gap (0.3.0 and 0.3.1, both unpublished)
35
+
36
+ Those two versions shipped the Flaticon artwork with no attribution at all,
37
+ inside an MIT package. CC BY 4.0 permits the redistribution but requires the
38
+ credit to travel with the work. Both versions were unpublished from npm and
39
+ 0.3.2 shipped the attribution embedded in the generated icon sources (using
40
+ `/*!` so minifiers keep it), verified to survive the bundler into
41
+ `dist/index.js`, plus a `NOTICE` file in the published tarball.
42
+
43
+ ## Component verification pass
44
+
45
+ The first pass of every component was built from `components.json`'s spec
46
+ values and `code.tsx` samples alone. Those are real token values, but
47
+ `code.tsx` is an *illustrative* usage sample, not the site's actual rendered
48
+ implementation - and that first pass was never checked against how the site
49
+ really renders each component.
50
+
51
+ Real mismatches slipped through as a result: Button's icon slot, Toggle's true
52
+ dimensions, Checkbox's checkmark color, Radio's dot size, Tab's gap,
53
+ ProductCard's cart-button size, and List's status colors, among others.
54
+
55
+ Every component was then diffed against `index.html`'s own `PG[id].impl`
56
+ strings - the React-createElement code that powers the site's Live Preview
57
+ panels - field by field: padding, colors, font, line-height, and
58
+ hover/pressed/disabled states. That implementation is treated as authoritative
59
+ where `components.json`'s prose spec disagrees with it.
60
+
61
+ `List` and `Header` were additionally cross-checked directly against their
62
+ Figma component sets, and both agreed with the verified implementation.
63
+
64
+ `BottomSheet` and `Section` have not had this treatment yet.
65
+
66
+ ## Other fixes worth recording
67
+
68
+ - **ProductImage sizing (0.3.1).** The component builds its class name as
69
+ `--${usage}`, but the stylesheet spelled the first two rules `--card` and
70
+ `--details` instead of `--product-card` and `--product-details`. Those two
71
+ usages - the 128px card image and the 200px detail image, the two most common
72
+ ones - matched no rule at all and rendered completely unsized.
73
+ - **Unstyled-components trap (0.3.3).** The README's usage snippet said
74
+ `import '@snacky/ui'` would pull in the stylesheet "as a side effect". It does
75
+ not: tsup extracts the CSS to a standalone `dist/index.css` and never
76
+ re-injects it into the JS entry, so anyone following the snippet verbatim got
77
+ unstyled components. The correct import is `@snacky/ui/styles.css`.
package/README.md CHANGED
@@ -15,7 +15,8 @@ npm install @snacky/ui
15
15
  ```
16
16
 
17
17
  Published at [npmjs.com/package/@snacky/ui](https://www.npmjs.com/package/@snacky/ui).
18
- To build from source instead (e.g. to work on the components themselves):
18
+ To build from source instead (e.g. to work on the components themselves), clone
19
+ [the repo](https://github.com/rezatresnas/snacky-design-system) and, from its root:
19
20
 
20
21
  ```bash
21
22
  cd packages/react-ui
@@ -26,7 +27,7 @@ npm run build
26
27
  ## Usage
27
28
 
28
29
  ```tsx
29
- import '@snacky/ui'; // pulls in theme/tokens.css as a side effect
30
+ import '@snacky/ui/styles.css'; // required - the compiled bundle does not inject this for you
30
31
  import { Button, TextField, Checkbox } from '@snacky/ui';
31
32
 
32
33
  function SignupForm() {
@@ -58,49 +59,26 @@ Illustration, ProductImage, ProductCard.
58
59
 
59
60
  ## Verification status
60
61
 
61
- The first pass of every component was built from `components.json`'s `s`
62
- (spec) values and `code.tsx` samples alone - those are real token values, but
63
- `code.tsx` is an *illustrative* usage sample, not the site's actual rendered
64
- implementation. That first pass was **not** checked against how the site
65
- itself actually renders each component, and several real mismatches slipped
66
- through as a result (Button's icon slot, Toggle's true dimensions, Checkbox's
67
- checkmark color, Radio's dot size, Tab's gap, ProductCard's cart-button size,
68
- List's status colors, and more).
69
-
70
- Every component has since been diffed against `index.html`'s own `PG[id].impl`
71
- strings - the actual React-createElement code that powers the site's "Live
72
- Preview" panels, extracted and compared field-by-field (padding, colors,
73
- font, line-height, hover/pressed/disabled states) - and corrected to match.
74
- This is the authoritative source in this repo; `components.json`'s prose spec
75
- text occasionally disagrees with it (e.g. Checkbox's checkmark is documented
76
- as "white" but the verified implementation uses `#333333`) and the verified
77
- implementation wins in every such case.
78
-
79
- `List`'s `OrderListItem`/`NotificationListItem` were additionally cross-checked
80
- directly against their Figma component set (page "List", component `List`,
81
- `Property 1=order|notification` x `Property 2=<status>`) - the node tree
82
- (fills, strokes, padding, gap, type styles) matches the verified `PG.list.impl`
83
- implementation exactly, so both sources agree: 56x56 thumbnail frame (`#f4f4f5`
84
- background, not a token - a literal value distinct from any generated surface
85
- color), a per-status summary card (`itemsSummary` + bold `total`, a bordered
86
- COD chip on `processCod`, a `paymentDeadline` banner on `waiting`, a right-
87
- aligned primary Button - "Track Shipment" / "Buy Again" - on
88
- shipped/received/cancelled), and a title+message notification row with a
89
- `1px solid var(--border-main)` border on every state, not just unread.
90
-
91
- `Header` was added later, directly from Figma rather than retrofitted from
92
- an existing implementation: inspected the `Header` component set (page
93
- "Header", variants `Icon=Back|Close|None` x `Right Action=True|False`) node
94
- tree for exact spec values (16px/8px padding, 40x40px circular icon buttons,
95
- Poppins Bold 16px/36px title), verified against a live smoke-test render for
96
- all 4 variants (structure, computed styles, click handlers), and confirmed
97
- the `PG.header.impl` string added to the site itself matches the same spec.
98
-
99
- **One deliberate deviation, not an oversight:** `NavBar` items use `flex:1`
100
- to fill the container width, where the site's own demo hardcodes `72x72`
101
- per item - because that demo is only ever shown at a fixed 360px frame. A
102
- production nav bar needs to fill whatever width the real device is, so the
103
- flexible layout was kept on purpose.
62
+ Every component is diffed against `index.html`'s own Live Preview
63
+ implementation - the code that actually renders the documentation site - not
64
+ just the spec values in `components.json`. Where the two disagree, the
65
+ verified implementation wins. `List` and `Header` were additionally checked
66
+ against their Figma component sets directly.
67
+
68
+ Three things worth knowing before you rely on them:
69
+
70
+ - **`NavBar` items use `flex: 1`** to fill the container, where the site's own
71
+ demo hardcodes `72x72` per item. That demo only ever renders at a fixed
72
+ 360px frame; a real nav bar has to fill the actual device width, so this is
73
+ a deliberate deviation rather than a mismatch.
74
+ - **`List`'s 56x56 thumbnail frame uses a literal `#f4f4f5`**, not a token -
75
+ it is a distinct value with no equivalent in the generated surface colors.
76
+ - **`BottomSheet` and `Section`** have not been diffed field-by-field the way
77
+ the rest of the package has. Treat their exact padding and gap values as
78
+ reasonable-but-unverified.
79
+
80
+ See [CHANGELOG.md](https://github.com/rezatresnas/snacky-design-system/blob/main/packages/react-ui/CHANGELOG.md)
81
+ for how the package got here, including the mistakes.
104
82
 
105
83
  ## Artwork credit and licensing
106
84
 
@@ -133,14 +111,37 @@ what is already in the bundle.
133
111
  shape, there is no `strokeWidth` to set), and the set is **not uniform** -
134
112
  icons are authored at 16, 20 or 24px depending on use, so each carries its
135
113
  own viewBox and defaults to that natural size.
136
- - **Illustration** ships no artwork - pass your own hosted `src`.
114
+ - **Illustration** ships no artwork - you supply the image. This is
115
+ deliberate and normal (Material, Radix and Chakra ship none either); the
116
+ component owns the documented canvas size for each variant, which is the
117
+ part that belongs in a design system. The Snacky artwork itself is modified
118
+ stock and is not ours to redistribute.
119
+
120
+ ```tsx
121
+ import { Illustration } from '@snacky/ui';
122
+
123
+ <Illustration variant="empty" src="/img/empty.svg" alt="No products found" />
124
+ ```
125
+
126
+ Variant sizes are fixed: `empty` 268x200, `createAccount` 360x240,
127
+ `welcome` 200x200, `success` 200x200, `discountReferral` 268x200. Export
128
+ your artwork at those ratios (SVG preferred) and host it wherever your app
129
+ already serves static assets.
130
+
131
+ **Where to get artwork that fits:** [Open Peeps](https://www.openpeeps.com/)
132
+ is CC0 (public domain - no attribution, no restrictions), so it is the
133
+ easiest drop-in. [unDraw](https://undraw.co/) needs no attribution and
134
+ allows commercial use, but its licence forbids redistributing the assets
135
+ "in packs", so use it in your own app rather than re-publishing it inside a
136
+ library of your own. Either way, check the licence yourself before shipping
137
+ - it is the one part of this that a component library cannot decide for you.
138
+
137
139
  - **Modal/Section**: the design system documents ~9 Modal "variants" and ~13
138
140
  Section "variants", but each is really the *same* shell component
139
141
  (`BottomSheet` / `Section`) with different `children` - so that's what's
140
142
  exported, matching every `code.tsx` sample exactly, rather than 22 near-
141
- duplicate components. These two shells have not yet been diffed field-by-
142
- field against `PG.modal`/`PG.section` the way the rest of the package has -
143
- treat their exact padding/gap values as reasonable-but-unverified.
143
+ duplicate components. (See Verification status above for the caveat on
144
+ their exact padding/gap values.)
144
145
 
145
146
  ## Keeping this in sync
146
147