@snacky/ui 0.7.2 → 0.8.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/CHANGELOG.md CHANGED
@@ -4,6 +4,43 @@ How `@snacky/ui` got to its current state. The README documents what the
4
4
  package *is*; this documents how it got there, including the mistakes, so the
5
5
  verification claims in the README can be taken at face value.
6
6
 
7
+ ## VariantBadge renamed to InfoBadge, with an icon slot (0.8.0)
8
+
9
+ The badge that renders `Variant: 75 Grams` turned out to have a second use in
10
+ Figma: `Points: 20,000` in the Home header. Identical in every respect -
11
+ 32 tall, 8px padding, `bg-surface-highlight` on a `primary-500` stroke,
12
+ `radius/field` - except for a leading icon.
13
+
14
+ Two things came out of that. First, the name was wrong: `variant` described
15
+ one use of the pattern, not the pattern, and a third use (`Berat: 500g`,
16
+ `Stok: 12`) would have had nowhere to go. It is now `InfoBadge`, named for the
17
+ shape of the information - a static, non-interactive `Label: Value` chip.
18
+ Second, the icon is a slot rather than a second component, because nothing
19
+ else differs between the two; Figma models them as `Property 2=variant` /
20
+ `Property 2=points`, which is a naming axis, not a structural one.
21
+
22
+ Worth recording as evidence, since "is this really a component?" keeps coming
23
+ up in this repo: the points version was **not** a one-off. Searching the
24
+ `Customer App - English` page's full node dump turned up seven copies of the
25
+ same 116x32 structure - one named `Points info`, six named `Frame 1064` -
26
+ hand-copied across different screens rather than instanced. That is the same
27
+ shape as the `Stepper` case (19 hand-drawn copies under two frame names), and
28
+ the same conclusion: a repeated hand-drawn pattern is a missing component, not
29
+ app composition.
30
+
31
+ `VariantBadge` and `VariantBadgeProps` still export as `@deprecated` aliases,
32
+ so existing code keeps working.
33
+
34
+ One inconsistency was caught while verifying: compose-ui tinted the icon slot
35
+ `icon-brand` (per Figma) but react-ui did not, so anyone copying the
36
+ documented snippet would have got `#333`. The playground was hiding it by
37
+ passing an explicit colour that the docs never mention. The tint now lives in
38
+ `.snacky-info-badge__icon` itself, and the playground passes no colour, so it
39
+ exercises the same path a consumer gets.
40
+
41
+ The 12x12 icon sits below the icon sizing scale (`size/icon/sm` is 16), so it
42
+ stays a raw value on both platforms, with a comment saying why.
43
+
7
44
  ## ImagePlaceholder added, a non-Figma utility (0.7.0)
8
45
 
9
46
  Every image prop (`ProductCard.imageUrl`, `ProductImage.src`, `Avatar.src`,
@@ -145,3 +182,27 @@ unverified - see the README's Verification status.
145
182
  control). Confirmed via computed styles in the Live Preview iframe, not
146
183
  just visually: the icon span and its inner SVG both resolve to exactly
147
184
  20x20 with Size=Small selected.
185
+ - **That same fix used raw pixel values instead of the existing semantic
186
+ size tokens (0.7.3).** `tokens.json` already has `size.icon.md` (20px) and
187
+ `size.icon.lg` (24px), generated as `--size-icon-md`/`--size-icon-lg` in
188
+ react-ui and `SnackySize.Icon.md`/`.lg` in compose-ui - 0.7.2 hardcoded
189
+ `20px`/`24px` and `20.dp`/`24.dp` instead of reaching for them, caught right
190
+ after shipping. Swapped both platforms over to the token references; the
191
+ computed pixel values are unchanged (re-verified: still exactly 20px at
192
+ Small, now genuinely resolving through `--size-icon-md` rather than a
193
+ literal that happens to match it).
194
+ - **Button's icon slot overlapped the label on any hug-width button (0.7.4).**
195
+ The icon is absolutely positioned (out of flow, per Figma's own "Slot Usage"
196
+ guideline), so it never reserved space for itself - the button's auto width
197
+ came from the label alone, and the icon rendered on top of it (`Add to cart`
198
+ read as the cart icon glyph covering the `A`, `dd to cart` visible after it).
199
+ Never caught before because no preview or story had ever passed an `icon`
200
+ prop to a real, narrow (hug-width) `Button` instance - confirmed directly
201
+ against Figma's "With Icon" example, which shows icon and label side by
202
+ side with a clear gap, never overlapping. Fixed by adding a
203
+ `.snacky-btn--with-icon` modifier that reserves exactly the icon's own
204
+ space (its `spacing-8` start inset + its size + a `gap-text-icon` gap) as
205
+ left padding, so the (still centered) label starts right after the icon
206
+ instead of on top of it. Ported the same fix to compose-ui's `SnackyButton`
207
+ (via `contentPadding`'s `start` value). Verified visually at both sizes: a
208
+ clean gap between icon and label, no overlap, `Add to cart` fully legible.
package/dist/index.cjs CHANGED
@@ -39,6 +39,7 @@ __export(index_exports, {
39
39
  IconButton: () => IconButton,
40
40
  Illustration: () => Illustration,
41
41
  ImagePlaceholder: () => ImagePlaceholder,
42
+ InfoBadge: () => InfoBadge,
42
43
  NavBar: () => NavBar,
43
44
  NotificationBadge: () => NotificationBadge,
44
45
  NotificationListItem: () => NotificationListItem,
@@ -113,6 +114,7 @@ var Button = (0, import_react.forwardRef)(function Button2({ variant = "primary"
113
114
  `snacky-btn--${variant}`,
114
115
  size === "small" && "snacky-btn--small",
115
116
  danger && "snacky-btn--danger",
117
+ icon3 != null && "snacky-btn--with-icon",
116
118
  className
117
119
  ),
118
120
  ...rest,
@@ -844,9 +846,13 @@ function DiscountTag({ label, className }) {
844
846
  function SoldOutBadge({ className }) {
845
847
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: cx("snacky-soldout-badge", className), children: "Sold Out" });
846
848
  }
847
- function VariantBadge({ label, className }) {
848
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: cx("snacky-variant-badge", className), children: label });
849
+ function InfoBadge({ label, icon: icon3, className }) {
850
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: cx("snacky-info-badge", className), children: [
851
+ icon3 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "snacky-info-badge__icon", children: icon3 }),
852
+ label
853
+ ] });
849
854
  }
855
+ var VariantBadge = InfoBadge;
850
856
 
851
857
  // src/components/Callout/Callout.tsx
852
858
  var import_jsx_runtime22 = require("react/jsx-runtime");
@@ -1312,6 +1318,7 @@ function ImagePlaceholder({ width, height, className }) {
1312
1318
  IconButton,
1313
1319
  Illustration,
1314
1320
  ImagePlaceholder,
1321
+ InfoBadge,
1315
1322
  NavBar,
1316
1323
  NotificationBadge,
1317
1324
  NotificationListItem,