@snacky/ui 0.7.3 → 0.8.1

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,70 @@ 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
+ ## PointBalanceBanner's two halves now share the row equally (0.8.1)
8
+
9
+ `.snacky-banner-point-balance__item` (the Points group and the Balance group
10
+ either side of the hairline divider) never had a `flex` value, so each one
11
+ just hugged its own content width and both packed against the left edge.
12
+ That was invisible in the docs site's own Live Preview, which always renders
13
+ this component inside a hardcoded `width: 312` wrapper matching Figma's exact
14
+ frame size - the one width where there's barely any slack to expose the bug.
15
+ It showed up once the component was dropped into a genuinely wider container
16
+ (the Claude Design gallery's story card, auto-sized well past 312px): the
17
+ divider landed right after the first group instead of at the midpoint, and
18
+ the row's tinted, bordered background kept stretching to `width: 100%` with
19
+ nothing in the empty half but its own surface colour.
20
+
21
+ Figma's own auto-layout already has both item columns set to fill-container,
22
+ splitting the row 50/50 around the divider - confirmed directly in Figma's
23
+ dev-mode inspect view, not inferred. Added `flex: 1` to both items (`weight
24
+ (1f)` in compose-ui), so each column now grows to take an equal share of
25
+ whatever width the row fills, with its icon/label/value left-aligned inside
26
+ that half. Verified by rendering the real package at 312px (Figma spec, where
27
+ nothing changes visually - the two halves were already close to equal there),
28
+ and at 400px (matching the gallery card's rough width): the divider sits at
29
+ 49.8-49.9% of the row's width in both cases, and a "LowBalance" sibling
30
+ ("0" / "Rp 0") now measures pixel-identical to "Default" at the same
31
+ container width, which is exactly the sibling-mismatch problem `width: 100%`
32
+ was introduced to solve in 0.7.1 in the first place.
33
+
34
+ ## VariantBadge renamed to InfoBadge, with an icon slot (0.8.0)
35
+
36
+ The badge that renders `Variant: 75 Grams` turned out to have a second use in
37
+ Figma: `Points: 20,000` in the Home header. Identical in every respect -
38
+ 32 tall, 8px padding, `bg-surface-highlight` on a `primary-500` stroke,
39
+ `radius/field` - except for a leading icon.
40
+
41
+ Two things came out of that. First, the name was wrong: `variant` described
42
+ one use of the pattern, not the pattern, and a third use (`Berat: 500g`,
43
+ `Stok: 12`) would have had nowhere to go. It is now `InfoBadge`, named for the
44
+ shape of the information - a static, non-interactive `Label: Value` chip.
45
+ Second, the icon is a slot rather than a second component, because nothing
46
+ else differs between the two; Figma models them as `Property 2=variant` /
47
+ `Property 2=points`, which is a naming axis, not a structural one.
48
+
49
+ Worth recording as evidence, since "is this really a component?" keeps coming
50
+ up in this repo: the points version was **not** a one-off. Searching the
51
+ `Customer App - English` page's full node dump turned up seven copies of the
52
+ same 116x32 structure - one named `Points info`, six named `Frame 1064` -
53
+ hand-copied across different screens rather than instanced. That is the same
54
+ shape as the `Stepper` case (19 hand-drawn copies under two frame names), and
55
+ the same conclusion: a repeated hand-drawn pattern is a missing component, not
56
+ app composition.
57
+
58
+ `VariantBadge` and `VariantBadgeProps` still export as `@deprecated` aliases,
59
+ so existing code keeps working.
60
+
61
+ One inconsistency was caught while verifying: compose-ui tinted the icon slot
62
+ `icon-brand` (per Figma) but react-ui did not, so anyone copying the
63
+ documented snippet would have got `#333`. The playground was hiding it by
64
+ passing an explicit colour that the docs never mention. The tint now lives in
65
+ `.snacky-info-badge__icon` itself, and the playground passes no colour, so it
66
+ exercises the same path a consumer gets.
67
+
68
+ The 12x12 icon sits below the icon sizing scale (`size/icon/sm` is 16), so it
69
+ stays a raw value on both platforms, with a comment saying why.
70
+
7
71
  ## ImagePlaceholder added, a non-Figma utility (0.7.0)
8
72
 
9
73
  Every image prop (`ProductCard.imageUrl`, `ProductImage.src`, `Avatar.src`,
@@ -154,3 +218,18 @@ unverified - see the README's Verification status.
154
218
  computed pixel values are unchanged (re-verified: still exactly 20px at
155
219
  Small, now genuinely resolving through `--size-icon-md` rather than a
156
220
  literal that happens to match it).
221
+ - **Button's icon slot overlapped the label on any hug-width button (0.7.4).**
222
+ The icon is absolutely positioned (out of flow, per Figma's own "Slot Usage"
223
+ guideline), so it never reserved space for itself - the button's auto width
224
+ came from the label alone, and the icon rendered on top of it (`Add to cart`
225
+ read as the cart icon glyph covering the `A`, `dd to cart` visible after it).
226
+ Never caught before because no preview or story had ever passed an `icon`
227
+ prop to a real, narrow (hug-width) `Button` instance - confirmed directly
228
+ against Figma's "With Icon" example, which shows icon and label side by
229
+ side with a clear gap, never overlapping. Fixed by adding a
230
+ `.snacky-btn--with-icon` modifier that reserves exactly the icon's own
231
+ space (its `spacing-8` start inset + its size + a `gap-text-icon` gap) as
232
+ left padding, so the (still centered) label starts right after the icon
233
+ instead of on top of it. Ported the same fix to compose-ui's `SnackyButton`
234
+ (via `contentPadding`'s `start` value). Verified visually at both sizes: a
235
+ 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,