@jirawatpyk/aura-tokens 4.6.1 → 4.7.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/aura.css CHANGED
@@ -1,4 +1,4 @@
1
- /* AURA v4.6.1 — GENERATED by scripts/build-tokens.js from tokens.json. Do not edit by hand. */
1
+ /* AURA v4.7.1 — GENERATED by scripts/build-tokens.js from tokens.json. Do not edit by hand. */
2
2
  /* Fonts: load aura-fonts.css (or the <link> tags in README) separately, so a blocked Google Fonts never breaks this file. */
3
3
 
4
4
  :root, [data-theme="light"] {
@@ -98,6 +98,7 @@
98
98
  --aura-button-primary-bg: var(--aura-zinc-900);
99
99
  --aura-button-primary-fg: var(--aura-zinc-0);
100
100
  --aura-button-primary-bg-hover: var(--aura-zinc-800);
101
+ --aura-button-secondary-border: var(--aura-zinc-450);
101
102
  --aura-button-creative-bg: var(--aura-white);
102
103
  --aura-button-creative-border: var(--aura-zinc-900);
103
104
  --aura-card-border: var(--aura-zinc-200);
@@ -149,6 +150,7 @@
149
150
  --aura-button-primary-bg: var(--aura-zinc-0);
150
151
  --aura-button-primary-fg: var(--aura-zinc-900);
151
152
  --aura-button-primary-bg-hover: var(--aura-zinc-200);
153
+ --aura-button-secondary-border: var(--aura-zinc-500);
152
154
  --aura-shadow-overlay: 0 16px 48px rgba(0,0,0,0.56), 0 2px 8px rgba(0,0,0,0.32);
153
155
  --aura-shadow-creative: 4px 4px 0px #a78bfa;
154
156
  --aura-shadow-creative-hover: 6px 6px 0px #a78bfa;
@@ -198,6 +200,7 @@
198
200
  --aura-button-primary-bg: var(--aura-zinc-0);
199
201
  --aura-button-primary-fg: var(--aura-zinc-900);
200
202
  --aura-button-primary-bg-hover: var(--aura-zinc-200);
203
+ --aura-button-secondary-border: var(--aura-zinc-500);
201
204
  --aura-shadow-overlay: 0 16px 48px rgba(0,0,0,0.56), 0 2px 8px rgba(0,0,0,0.32);
202
205
  --aura-shadow-creative: 4px 4px 0px #a78bfa;
203
206
  --aura-shadow-creative-hover: 6px 6px 0px #a78bfa;
@@ -240,28 +240,65 @@ window.Aura = (() => {
240
240
 
241
241
  // src/Button.tsx
242
242
  var React3 = __toESM(require_react(), 1);
243
- var Button = React3.forwardRef(function Button2(props, ref) {
243
+ function ButtonLink(props, ref) {
244
244
  const variant = props.variant || "primary";
245
- const loading = !!props.loading;
246
- const rest = omit(props, ["variant", "className", "children", "type", "icon", "iconRight", "loading", "onClick"]);
245
+ const disabled = !!props.disabled;
246
+ const rest = omit(props, [
247
+ "variant",
248
+ "className",
249
+ "children",
250
+ "icon",
251
+ "iconRight",
252
+ "disabled",
253
+ "linkComponent",
254
+ "href"
255
+ ]);
256
+ const Tag3 = !disabled && props.linkComponent ? props.linkComponent : "a";
247
257
  return /* @__PURE__ */ React3.createElement(
248
- "button",
258
+ Tag3,
249
259
  {
250
260
  ...rest,
251
261
  ref,
252
- type: props.type || "button",
253
- className: cx("aura-btn", "aura-btn--" + variant, loading && "is-loading", props.className),
254
- "aria-busy": loading || void 0,
255
- "aria-disabled": loading || void 0,
256
- onClick: loading ? function(e) {
257
- e.preventDefault();
258
- } : props.onClick
262
+ href: disabled ? void 0 : props.href,
263
+ role: disabled ? "link" : void 0,
264
+ "aria-disabled": disabled || void 0,
265
+ tabIndex: disabled ? -1 : props.tabIndex,
266
+ className: cx("aura-btn", "aura-btn--" + variant, props.className),
267
+ onClick: disabled ? void 0 : props.onClick
259
268
  },
260
- loading ? /* @__PURE__ */ React3.createElement(Icon, { name: "loader-circle", className: "aura-spin" }) : props.icon ? /* @__PURE__ */ React3.createElement(Icon, { name: props.icon }) : null,
269
+ props.icon ? /* @__PURE__ */ React3.createElement(Icon, { name: props.icon }) : null,
261
270
  props.children,
262
- props.iconRight && !loading ? /* @__PURE__ */ React3.createElement(Icon, { name: props.iconRight }) : null
271
+ props.iconRight ? /* @__PURE__ */ React3.createElement(Icon, { name: props.iconRight }) : null
263
272
  );
264
- });
273
+ }
274
+ var Button = React3.forwardRef(
275
+ function Button2(all, ref) {
276
+ if (typeof all.href === "string") {
277
+ return ButtonLink(all, ref);
278
+ }
279
+ const props = all;
280
+ const variant = props.variant || "primary";
281
+ const loading = !!props.loading;
282
+ const rest = omit(props, ["variant", "className", "children", "type", "icon", "iconRight", "loading", "onClick"]);
283
+ return /* @__PURE__ */ React3.createElement(
284
+ "button",
285
+ {
286
+ ...rest,
287
+ ref,
288
+ type: props.type || "button",
289
+ className: cx("aura-btn", "aura-btn--" + variant, loading && "is-loading", props.className),
290
+ "aria-busy": loading || void 0,
291
+ "aria-disabled": loading || void 0,
292
+ onClick: loading ? function(e) {
293
+ e.preventDefault();
294
+ } : props.onClick
295
+ },
296
+ loading ? /* @__PURE__ */ React3.createElement(Icon, { name: "loader-circle", className: "aura-spin" }) : props.icon ? /* @__PURE__ */ React3.createElement(Icon, { name: props.icon }) : null,
297
+ props.children,
298
+ props.iconRight && !loading ? /* @__PURE__ */ React3.createElement(Icon, { name: props.iconRight }) : null
299
+ );
300
+ }
301
+ );
265
302
 
266
303
  // src/IconButton.tsx
267
304
  var React4 = __toESM(require_react(), 1);
@@ -26,7 +26,8 @@
26
26
  transition-timing-function: var(--aura-ease);
27
27
  }
28
28
  .aura-btn:active { transform: scale(0.98); }
29
- .aura-btn:disabled { opacity: var(--aura-disabled-opacity); pointer-events: none; }
29
+ .aura-btn:disabled, a.aura-btn[aria-disabled='true'] { opacity: var(--aura-disabled-opacity); pointer-events: none; }
30
+ a.aura-btn { text-decoration: none; }
30
31
  .aura-btn.is-loading { cursor: progress; }
31
32
  .aura-btn.is-loading:active { transform: none; }
32
33
 
@@ -40,7 +41,7 @@
40
41
  .aura-btn--primary { background: var(--aura-button-primary-bg); color: var(--aura-button-primary-fg); }
41
42
  .aura-btn--primary:hover { background: var(--aura-button-primary-bg-hover); }
42
43
 
43
- .aura-btn--secondary { border: 1px solid var(--aura-border-default); color: var(--aura-fg-primary); }
44
+ .aura-btn--secondary { border: 1px solid var(--aura-button-secondary-border); color: var(--aura-fg-primary); }
44
45
  .aura-btn--secondary:hover { background: var(--aura-bg-surface-hover); }
45
46
 
46
47
  .aura-btn--creative {
@@ -13,6 +13,22 @@ export interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElem
13
13
  /** Shows a spinner in place of the leading icon, sets aria-busy and swallows clicks. Keeps the label and width. */
14
14
  loading?: boolean;
15
15
  }
16
+ /** A link that looks like a Button: give `Button` an `href` and it renders an `<a>` (navigation, not actions). */
17
+ export interface ButtonLinkProps extends Omit<React$1.AnchorHTMLAttributes<HTMLAnchorElement>, "children"> {
18
+ /** Where the link goes. With `href`, Button renders an `<a>` and its ref is the `<a>`. */
19
+ href: string;
20
+ /** Visual variant. Default `primary`. */
21
+ variant?: "primary" | "secondary" | "creative";
22
+ /** Label text — say where it goes ("View Orders"), not "Click here". */
23
+ children: React$1.ReactNode;
24
+ icon?: IconName;
25
+ /** Trailing icon, e.g. `arrow-right`, or `external-link` with `target="_blank"`. */
26
+ iconRight?: IconName;
27
+ /** Looks unavailable and can't be followed: no href, `aria-disabled`, out of the Tab order. */
28
+ disabled?: boolean;
29
+ /** A router's link to render instead of `<a>`, e.g. `Link` from `next/link` (client-side navigation). It gets `href`, `className`, the children and the ref. */
30
+ linkComponent?: React$1.ElementType;
31
+ }
16
32
  export interface DataTableColumn {
17
33
  /** Key into each row object. */
18
34
  key: string;
@@ -779,8 +795,15 @@ export declare const ICONS: Record<IconName, IconShape[]>;
779
795
  export declare const Icon: React$1.ForwardRefExoticComponent<IconProps & React$1.RefAttributes<SVGSVGElement>>;
780
796
  /** Every icon name the bundle carries. */
781
797
  export declare const iconNames: IconName[];
782
- /** AURA pill button. Enterprise (`primary`, `secondary`) for product UI; `creative` for marketing moments only. */
783
- export declare const Button: React$1.ForwardRefExoticComponent<ButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
798
+ /** Button with an `href` is a link; without, a button. Two call signatures so each gets the right props and ref. */
799
+ export interface ButtonComponent {
800
+ (props: ButtonLinkProps & React$1.RefAttributes<HTMLAnchorElement>): React$1.ReactElement | null;
801
+ (props: ButtonProps & React$1.RefAttributes<HTMLButtonElement>): React$1.ReactElement | null;
802
+ displayName?: string;
803
+ }
804
+ /** AURA pill button. Enterprise (`primary`, `secondary`) for product UI; `creative` for marketing moments only.
805
+ * With `href` it renders a link that looks the same (`<a>`, or your router's link via `linkComponent`). */
806
+ export declare const Button: ButtonComponent;
784
807
  export declare const IconButton: React$1.ForwardRefExoticComponent<IconButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
785
808
  /** Popover list anchored to an element, rendered in a portal. */
786
809
  export declare const Menu: React$1.ForwardRefExoticComponent<MenuProps & React$1.RefAttributes<HTMLDivElement>>;
@@ -146,12 +146,14 @@ semantic/fg-positive,color,dark,{primitive/lime/300},"Rising-and-good numbers (S
146
146
  component/button-primary-bg,color,light,{primitive/zinc/900},"Component: Enterprise (primary) button fill — ink in light, white in dark, as the Storybook story renders it (tokens.json pins it to the light value, which disappears on the dark surface).",ALL_FILLS
147
147
  component/button-primary-fg,color,light,{primitive/zinc/0},Component: primary button label on aura-button-primary-bg (17.7:1 both themes).,ALL_FILLS
148
148
  component/button-primary-bg-hover,color,light,{primitive/zinc/800},"Component: primary button hover. Light zinc-800 is the source value; dark zinc-200 is an ADDED value (the source has none — its zinc-800 hover hides the dark label at 1.19:1). Label 14.9:1 light, 14.0:1 dark.",ALL_FILLS
149
+ component/button-secondary-border,color,light,{primitive/zinc/450},"Component: secondary button (and secondary Button links) 1px edge. ≥3:1 on aura-bg-surface and -canvas in both themes (zinc-450 light 3.1–3.3:1, zinc-500 dark 3.7–4.1:1), so the pill is visible without its label. ADDED 4.7.1 (was aura-border-default, ~1.3:1).",ALL_FILLS
149
150
  component/button-creative-bg,color,light,{primitive/white},Component: Creative button fill (white in every theme). Label in aura-ink.,ALL_FILLS
150
151
  component/button-creative-border,color,light,{primitive/zinc/900},Component: Creative button 2px border.,ALL_FILLS
151
152
  component/card-border,color,light,{primitive/zinc/200},Component: card outline (light value; use aura-border-default where the card must follow theme).,ALL_FILLS
152
153
  component/button-primary-bg,color,dark,{primitive/zinc/0},"Component: Enterprise (primary) button fill — ink in light, white in dark, as the Storybook story renders it (tokens.json pins it to the light value, which disappears on the dark surface).",ALL_FILLS
153
154
  component/button-primary-fg,color,dark,{primitive/zinc/900},Component: primary button label on aura-button-primary-bg (17.7:1 both themes).,ALL_FILLS
154
155
  component/button-primary-bg-hover,color,dark,{primitive/zinc/200},"Component: primary button hover. Light zinc-800 is the source value; dark zinc-200 is an ADDED value (the source has none — its zinc-800 hover hides the dark label at 1.19:1). Label 14.9:1 light, 14.0:1 dark.",ALL_FILLS
156
+ component/button-secondary-border,color,dark,{primitive/zinc/500},"Component: secondary button (and secondary Button links) 1px edge. ≥3:1 on aura-bg-surface and -canvas in both themes (zinc-450 light 3.1–3.3:1, zinc-500 dark 3.7–4.1:1), so the pill is visible without its label. ADDED 4.7.1 (was aura-border-default, ~1.3:1).",ALL_FILLS
155
157
  component/button-creative-bg,color,dark,{primitive/white},Component: Creative button fill (white in every theme). Label in aura-ink.,ALL_FILLS
156
158
  component/button-creative-border,color,dark,{primitive/zinc/900},Component: Creative button 2px border.,ALL_FILLS
157
159
  component/card-border,color,dark,{primitive/zinc/200},Component: card outline (light value; use aura-border-default where the card must follow theme).,ALL_FILLS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jirawatpyk/aura-tokens",
3
- "version": "4.6.1",
3
+ "version": "4.7.1",
4
4
  "description": "AURA Design System — tokens (CSS variables, Tailwind preset, Figma variables), theme contrast checks and token lint.",
5
5
  "main": "tailwind.tokens.cjs",
6
6
  "types": "components/index.d.ts",
@@ -54,6 +54,7 @@ pairs.push(['on-texture', 'mesh-from', TEXT], ['on-texture', 'mesh-to', TEXT]);
54
54
  for (const bg of ['bg-surface', 'bg-canvas', 'bg-input', 'bg-selected']) pairs.push(['border-control', bg, UI]);
55
55
  for (const bg of ['bg-surface', 'bg-canvas', 'bg-surface-hover', 'bg-selected']) pairs.push(['focus-ring', bg, UI]);
56
56
  pairs.push(['border-danger', 'bg-input', UI]);
57
+ for (const bg of ['bg-surface', 'bg-canvas']) pairs.push(['button-secondary-border', bg, UI]);
57
58
 
58
59
  const results = [], fails = [];
59
60
  for (const theme of ['light', 'dark']) for (const [fg, bg, min] of pairs) {
package/tokens.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.6.1",
2
+ "version": "4.7.1",
3
3
  "meta": {
4
4
  "name": "AURA Design System",
5
5
  "tier": "3-tier",
@@ -177,6 +177,7 @@
177
177
  "button-primary-bg": "{primitive.zinc.900}",
178
178
  "button-primary-fg": "{primitive.zinc.0}",
179
179
  "button-primary-bg-hover": "{primitive.zinc.800}",
180
+ "button-secondary-border": "{primitive.zinc.450}",
180
181
  "button-creative-bg": "{primitive.white}",
181
182
  "button-creative-border": "{primitive.zinc.900}",
182
183
  "card-border": "{primitive.zinc.200}"
@@ -185,6 +186,7 @@
185
186
  "button-primary-bg": "{primitive.zinc.0}",
186
187
  "button-primary-fg": "{primitive.zinc.900}",
187
188
  "button-primary-bg-hover": "{primitive.zinc.200}",
189
+ "button-secondary-border": "{primitive.zinc.500}",
188
190
  "button-creative-bg": "{primitive.white}",
189
191
  "button-creative-border": "{primitive.zinc.900}",
190
192
  "card-border": "{primitive.zinc.200}"
@@ -479,6 +481,7 @@
479
481
  "container-narrow": "Narrow container for forms and reading. ADDED 4.2.",
480
482
  "cal-cell": "Calendar day cell (DatePicker). 40px on touch screens via media query. ADDED 4.2.",
481
483
  "popover-max-height": "Max height of Combobox listbox and DatePicker popover lists. ADDED 4.2.",
482
- "fg-positive": "Rising-and-good numbers (Stat change, positive deltas) on aura-bg-surface / -canvas. Never on lime fills. ADDED 4.3."
484
+ "fg-positive": "Rising-and-good numbers (Stat change, positive deltas) on aura-bg-surface / -canvas. Never on lime fills. ADDED 4.3.",
485
+ "button-secondary-border": "Component: secondary button (and secondary Button links) 1px edge. ≥3:1 on aura-bg-surface and -canvas in both themes (zinc-450 light 3.1–3.3:1, zinc-500 dark 3.7–4.1:1), so the pill is visible without its label. ADDED 4.7.1 (was aura-border-default, ~1.3:1)."
483
486
  }
484
487
  }