@manakind/ui-core 0.30.1 → 0.32.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.
@@ -87,6 +87,13 @@
87
87
  }
88
88
  }
89
89
 
90
+ &.ds-badge--caps {
91
+ text-transform: uppercase;
92
+ letter-spacing: var(--ds-text-caps-letter-spacing);
93
+ font-family: var(--ds-text-caps-font-family);
94
+ font-weight: var(--ds-text-caps-font-weight);
95
+ }
96
+
90
97
  &.ds-badge--solid {
91
98
  background-color: var(--ds-badge-solid-bg);
92
99
  color: var(--ds-badge-solid-text);
@@ -79,6 +79,12 @@ export type BadgeProps = Omit<ComponentProps<typeof ark.span>, 'asChild'> & Badg
79
79
  * digits the shape stops being a circle anyway.
80
80
  */
81
81
  shape?: BadgeShape;
82
+ /**
83
+ * Set the label as a small-caps label: uppercase, in the product's label
84
+ * face, weight and tracking, the same style as `Text`'s `caps`. For a
85
+ * category or tag rather than a count.
86
+ */
87
+ caps?: boolean;
82
88
  };
83
89
  export type BadgeAppearance = NonNullable<BadgeProps['appearance']>;
84
90
  /**
@@ -104,6 +110,6 @@ export type BadgeAppearance = NonNullable<BadgeProps['appearance']>;
104
110
  * Reads as "Completed" wide, collapses to the glyph when the container
105
111
  * shrinks, and announces the same name at every width.
106
112
  */
107
- export declare function Badge({ variant, shape, appearance, labelClassName, icon, compact, className, children, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
113
+ export declare function Badge({ variant, shape, appearance, labelClassName, icon, compact, caps, className, children, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
108
114
  export {};
109
115
  //# sourceMappingURL=badge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/badge/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAA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tB,GACD;IAAE,cAAc,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAEnC,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,GACvE,YAAY,GACZ,SAAS,GACT,eAAe,GAAG;IAChB;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEJ,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;AAoBpE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,KAAK,CAAC,EACpB,OAAiB,EACjB,KAAc,EACd,UAAqB,EACrB,cAAc,EACd,IAAI,EACJ,OAAe,EACf,IAAY,EACZ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,UAAU,2CAyCZ"}
@@ -43,7 +43,7 @@ import { cx } from '../cx';
43
43
  * Reads as "Completed" wide, collapses to the glyph when the container
44
44
  * shrinks, and announces the same name at every width.
45
45
  */
46
- export function Badge({ variant = 'muted', shape = 'pill', appearance = 'filled', labelClassName, icon, compact = false, className, children, ...props }) {
46
+ export function Badge({ variant = 'muted', shape = 'pill', appearance = 'filled', labelClassName, icon, compact = false, caps = false, className, children, ...props }) {
47
47
  /*
48
48
  * ARIA prohibits `aria-label` on a role-less `span` (it resolves to
49
49
  * `role="generic"`), so the label is not reliably announced — axe reports
@@ -60,6 +60,6 @@ export function Badge({ variant = 'muted', shape = 'pill', appearance = 'filled'
60
60
  * collapsed against one. A text-only badge keeps its bare-text DOM.
61
61
  */
62
62
  const label = icon ? (_jsx("span", { className: cx('ds-badge__label', labelClassName), children: children })) : (children);
63
- return (_jsxs(ark.span, { role: labelled ? 'img' : undefined, className: cx('ds-badge', `ds-badge--${variant}`, `ds-badge--${shape}`, appearance === 'plain' && 'ds-badge--plain', compact && 'ds-badge--compact', className), ...props, children: [icon && _jsx(Icon, { source: icon, size: "sm", decorative: true }), label] }));
63
+ return (_jsxs(ark.span, { role: labelled ? 'img' : undefined, className: cx('ds-badge', `ds-badge--${variant}`, `ds-badge--${shape}`, appearance === 'plain' && 'ds-badge--plain', compact && 'ds-badge--compact', caps && 'ds-badge--caps', className), ...props, children: [icon && _jsx(Icon, { source: icon, size: "sm", decorative: true }), label] }));
64
64
  }
65
65
  //# sourceMappingURL=badge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/badge/badge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAmB,MAAM,SAAS,CAAC;AAChD,OAAO,aAAa,CAAC;AACrB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AA4F3B;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,KAAK,CAAC,EACpB,OAAO,GAAG,OAAO,EACjB,KAAK,GAAG,MAAM,EACd,UAAU,GAAG,QAAQ,EACrB,cAAc,EACd,IAAI,EACJ,OAAO,GAAG,KAAK,EACf,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACG;IACX;;;;;;;;;OASG;IACH,MAAM,QAAQ,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,SAAS,IAAI,KAAK,CAAC,iBAAiB,CAAC,KAAK,SAAS,CAAC;IAE7F;;;OAGG;IACH,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CACnB,eAAM,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,cAAc,CAAC,YAAG,QAAQ,GAAQ,CAC1E,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,CAAC;IAEF,OAAO,CACL,MAAC,GAAG,CAAC,IAAI,IACP,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EAClC,SAAS,EAAE,EAAE,CACX,UAAU,EACV,aAAa,OAAO,EAAE,EACtB,aAAa,KAAK,EAAE,EACpB,UAAU,KAAK,OAAO,IAAI,iBAAiB,EAC3C,OAAO,IAAI,mBAAmB,EAC9B,SAAS,CACV,KACG,KAAK,aAER,IAAI,IAAI,KAAC,IAAI,IAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,SAAG,EACnD,KAAK,IACG,CACZ,CAAC;AACJ,CAAC","sourcesContent":["import { ark } from '@ark-ui/react/factory';\nimport type { ComponentProps } from 'react';\nimport { Icon, type IconSource } from '../icon';\nimport './badge.css';\nimport { cx } from '../cx';\n\nexport type BadgeVariant =\n | 'solid'\n | 'muted'\n | 'outline'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger';\n\nexport type BadgeShape = 'pill' | 'circle';\n\n/**\n * `compact` hides the label, so it may only be used with a glyph to replace it\n * and a name to announce — otherwise the badge is a bare colour chip, and\n * colour alone is never a signal.\n *\n * Expressed as a discriminated union so the pairing is a compile error rather\n * than a convention, mirroring `IconProps`' label/decorative union.\n */\ntype BadgeCompact =\n | { compact: true; icon: IconSource; 'aria-label': string }\n | { compact?: false | undefined; icon?: IconSource };\n\n/**\n * `plain` drops the fill, so a variant's text must read on the surface behind\n * it. Every variant's does except `solid`, whose text colour is made for its\n * own dark fill and disappears without it, so that pairing is a compile error.\n */\ntype BadgeLook =\n | {\n /**\n * Visual treatment.\n *\n * `solid` is the emphatic one — use it sparingly, at most once in a view.\n * `muted` and `outline` are the neutral workhorses. `info`, `success`,\n * `warning`, and `danger` are tinted status treatments.\n */\n variant?: BadgeVariant;\n /**\n * `filled` (default) draws the variant's fill and border. `plain` drops\n * both and keeps the variant's colour on the glyph and label, for a\n * status that sits inside a busier composition and should not add a\n * chip of its own. Its text is then measured against the surface\n * behind it, not against a tint.\n */\n appearance?: 'filled';\n }\n | { variant?: Exclude<BadgeVariant, 'solid'>; appearance: 'plain' };\n\n/**\n * `labelClassName` lets a composition hide the label (a container query, say),\n * so the badge must then carry its own name: without `aria-label` a hidden\n * label leaves the badge unnamed, since the glyph is always decorative.\n * Required here the same way `compact` requires it.\n */\ntype BadgeLabelClass =\n | {\n /**\n * Your own class on the label wrapper, so a composition can style the\n * label — for instance hide it from a container query when space runs\n * out — without selecting `ui-core`'s classes. The wrapper exists only\n * when there is an `icon`, so a label can never be hidden without a glyph\n * left in its place: colour alone is never the signal.\n */\n labelClassName: string;\n 'aria-label': string;\n }\n | { labelClassName?: undefined };\n\nexport type BadgeProps = Omit<ComponentProps<typeof ark.span>, 'asChild'> &\n BadgeCompact &\n BadgeLook &\n BadgeLabelClass & {\n /**\n * `pill` is the default. `circle` is for counts: a true circle at one or two\n * digits, and a fixed-height lozenge beyond that.\n *\n * The height is pinned on purpose — see the note in `badge.css`. An earlier\n * `aspect-ratio` grew a three-digit count in both directions, which made the\n * badge taller than its row and broke the nested radius of any track it sat\n * in.\n *\n * Only use it for short numerics. Words in a circle wrap badly, and past two\n * digits the shape stops being a circle anyway.\n */\n shape?: BadgeShape;\n };\n\nexport type BadgeAppearance = NonNullable<BadgeProps['appearance']>;\n\n/*\n * `icon` and `compact` are declared on `BadgeCompact` above rather than here,\n * so their docs live with the union that constrains them:\n *\n * icon — glyph before the label, supplied by the product so this package\n * never imports an icon set. Always decorative; the label beside\n * it says the same thing, and when the label is collapsed the\n * badge's own `aria-label` carries the name. Announcing both would\n * read the status twice.\n *\n * compact — collapse to the glyph alone: square geometry, no visible label.\n * Requires `icon` and `aria-label`, enforced by the union.\n *\n * For a badge that should collapse only when space runs out, leave `compact`\n * off, pass a `labelClassName`, and hide that class from a container query —\n * GoalCard's status badge is the worked example.\n */\n\n/**\n * Small inline label for counts, states, and categories.\n *\n * Renders a `span`, so a badge is decorative text by default. If the badge\n * carries meaning that is not repeated in nearby text — a count, a status —\n * give it an `aria-label` so it is announced usefully rather than as a bare\n * number. Labelling it also switches it to `role=\"img\"`, because `aria-label`\n * on a role-less `span` is prohibited and would not be announced.\n *\n * A badge is not a button. If it needs to be clickable, put it inside one.\n *\n * Colour alone must never be the only signal a badge carries. Pair a status\n * variant with text (or an `aria-label`) that says the same thing.\n *\n * @example Status that survives a narrow card\n * ```tsx\n * <Badge variant=\"success\" icon={CheckIcon} aria-label=\"Completed\">\n * Completed\n * </Badge>\n * ```\n * Reads as \"Completed\" wide, collapses to the glyph when the container\n * shrinks, and announces the same name at every width.\n */\nexport function Badge({\n variant = 'muted',\n shape = 'pill',\n appearance = 'filled',\n labelClassName,\n icon,\n compact = false,\n className,\n children,\n ...props\n}: BadgeProps) {\n /*\n * ARIA prohibits `aria-label` on a role-less `span` (it resolves to\n * `role=\"generic\"`), so the label is not reliably announced — axe reports\n * `aria-prohibited-attr`. Since the whole point of the label is to replace\n * the bare text, `role=\"img\"` is the honest role: it makes the element a\n * single labelled node and the label becomes its accessible name.\n *\n * Only applied when a label is actually present. An unlabelled badge is\n * decorative text and should stay a plain `span`.\n */\n const labelled = props['aria-label'] !== undefined || props['aria-labelledby'] !== undefined;\n\n /*\n * Wrapped only when there is a glyph, because the wrapper exists to be\n * collapsed against one. A text-only badge keeps its bare-text DOM.\n */\n const label = icon ? (\n <span className={cx('ds-badge__label', labelClassName)}>{children}</span>\n ) : (\n children\n );\n\n return (\n <ark.span\n role={labelled ? 'img' : undefined}\n className={cx(\n 'ds-badge',\n `ds-badge--${variant}`,\n `ds-badge--${shape}`,\n appearance === 'plain' && 'ds-badge--plain',\n compact && 'ds-badge--compact',\n className,\n )}\n {...props}\n >\n {icon && <Icon source={icon} size=\"sm\" decorative />}\n {label}\n </ark.span>\n );\n}\n"]}
1
+ {"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/badge/badge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAmB,MAAM,SAAS,CAAC;AAChD,OAAO,aAAa,CAAC;AACrB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAkG3B;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,KAAK,CAAC,EACpB,OAAO,GAAG,OAAO,EACjB,KAAK,GAAG,MAAM,EACd,UAAU,GAAG,QAAQ,EACrB,cAAc,EACd,IAAI,EACJ,OAAO,GAAG,KAAK,EACf,IAAI,GAAG,KAAK,EACZ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACG;IACX;;;;;;;;;OASG;IACH,MAAM,QAAQ,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,SAAS,IAAI,KAAK,CAAC,iBAAiB,CAAC,KAAK,SAAS,CAAC;IAE7F;;;OAGG;IACH,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CACnB,eAAM,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,cAAc,CAAC,YAAG,QAAQ,GAAQ,CAC1E,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,CAAC;IAEF,OAAO,CACL,MAAC,GAAG,CAAC,IAAI,IACP,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EAClC,SAAS,EAAE,EAAE,CACX,UAAU,EACV,aAAa,OAAO,EAAE,EACtB,aAAa,KAAK,EAAE,EACpB,UAAU,KAAK,OAAO,IAAI,iBAAiB,EAC3C,OAAO,IAAI,mBAAmB,EAC9B,IAAI,IAAI,gBAAgB,EACxB,SAAS,CACV,KACG,KAAK,aAER,IAAI,IAAI,KAAC,IAAI,IAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,SAAG,EACnD,KAAK,IACG,CACZ,CAAC;AACJ,CAAC","sourcesContent":["import { ark } from '@ark-ui/react/factory';\nimport type { ComponentProps } from 'react';\nimport { Icon, type IconSource } from '../icon';\nimport './badge.css';\nimport { cx } from '../cx';\n\nexport type BadgeVariant =\n | 'solid'\n | 'muted'\n | 'outline'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger';\n\nexport type BadgeShape = 'pill' | 'circle';\n\n/**\n * `compact` hides the label, so it may only be used with a glyph to replace it\n * and a name to announce — otherwise the badge is a bare colour chip, and\n * colour alone is never a signal.\n *\n * Expressed as a discriminated union so the pairing is a compile error rather\n * than a convention, mirroring `IconProps`' label/decorative union.\n */\ntype BadgeCompact =\n | { compact: true; icon: IconSource; 'aria-label': string }\n | { compact?: false | undefined; icon?: IconSource };\n\n/**\n * `plain` drops the fill, so a variant's text must read on the surface behind\n * it. Every variant's does except `solid`, whose text colour is made for its\n * own dark fill and disappears without it, so that pairing is a compile error.\n */\ntype BadgeLook =\n | {\n /**\n * Visual treatment.\n *\n * `solid` is the emphatic one — use it sparingly, at most once in a view.\n * `muted` and `outline` are the neutral workhorses. `info`, `success`,\n * `warning`, and `danger` are tinted status treatments.\n */\n variant?: BadgeVariant;\n /**\n * `filled` (default) draws the variant's fill and border. `plain` drops\n * both and keeps the variant's colour on the glyph and label, for a\n * status that sits inside a busier composition and should not add a\n * chip of its own. Its text is then measured against the surface\n * behind it, not against a tint.\n */\n appearance?: 'filled';\n }\n | { variant?: Exclude<BadgeVariant, 'solid'>; appearance: 'plain' };\n\n/**\n * `labelClassName` lets a composition hide the label (a container query, say),\n * so the badge must then carry its own name: without `aria-label` a hidden\n * label leaves the badge unnamed, since the glyph is always decorative.\n * Required here the same way `compact` requires it.\n */\ntype BadgeLabelClass =\n | {\n /**\n * Your own class on the label wrapper, so a composition can style the\n * label — for instance hide it from a container query when space runs\n * out — without selecting `ui-core`'s classes. The wrapper exists only\n * when there is an `icon`, so a label can never be hidden without a glyph\n * left in its place: colour alone is never the signal.\n */\n labelClassName: string;\n 'aria-label': string;\n }\n | { labelClassName?: undefined };\n\nexport type BadgeProps = Omit<ComponentProps<typeof ark.span>, 'asChild'> &\n BadgeCompact &\n BadgeLook &\n BadgeLabelClass & {\n /**\n * `pill` is the default. `circle` is for counts: a true circle at one or two\n * digits, and a fixed-height lozenge beyond that.\n *\n * The height is pinned on purpose — see the note in `badge.css`. An earlier\n * `aspect-ratio` grew a three-digit count in both directions, which made the\n * badge taller than its row and broke the nested radius of any track it sat\n * in.\n *\n * Only use it for short numerics. Words in a circle wrap badly, and past two\n * digits the shape stops being a circle anyway.\n */\n shape?: BadgeShape;\n /**\n * Set the label as a small-caps label: uppercase, in the product's label\n * face, weight and tracking, the same style as `Text`'s `caps`. For a\n * category or tag rather than a count.\n */\n caps?: boolean;\n };\n\nexport type BadgeAppearance = NonNullable<BadgeProps['appearance']>;\n\n/*\n * `icon` and `compact` are declared on `BadgeCompact` above rather than here,\n * so their docs live with the union that constrains them:\n *\n * icon — glyph before the label, supplied by the product so this package\n * never imports an icon set. Always decorative; the label beside\n * it says the same thing, and when the label is collapsed the\n * badge's own `aria-label` carries the name. Announcing both would\n * read the status twice.\n *\n * compact — collapse to the glyph alone: square geometry, no visible label.\n * Requires `icon` and `aria-label`, enforced by the union.\n *\n * For a badge that should collapse only when space runs out, leave `compact`\n * off, pass a `labelClassName`, and hide that class from a container query —\n * GoalCard's status badge is the worked example.\n */\n\n/**\n * Small inline label for counts, states, and categories.\n *\n * Renders a `span`, so a badge is decorative text by default. If the badge\n * carries meaning that is not repeated in nearby text — a count, a status —\n * give it an `aria-label` so it is announced usefully rather than as a bare\n * number. Labelling it also switches it to `role=\"img\"`, because `aria-label`\n * on a role-less `span` is prohibited and would not be announced.\n *\n * A badge is not a button. If it needs to be clickable, put it inside one.\n *\n * Colour alone must never be the only signal a badge carries. Pair a status\n * variant with text (or an `aria-label`) that says the same thing.\n *\n * @example Status that survives a narrow card\n * ```tsx\n * <Badge variant=\"success\" icon={CheckIcon} aria-label=\"Completed\">\n * Completed\n * </Badge>\n * ```\n * Reads as \"Completed\" wide, collapses to the glyph when the container\n * shrinks, and announces the same name at every width.\n */\nexport function Badge({\n variant = 'muted',\n shape = 'pill',\n appearance = 'filled',\n labelClassName,\n icon,\n compact = false,\n caps = false,\n className,\n children,\n ...props\n}: BadgeProps) {\n /*\n * ARIA prohibits `aria-label` on a role-less `span` (it resolves to\n * `role=\"generic\"`), so the label is not reliably announced — axe reports\n * `aria-prohibited-attr`. Since the whole point of the label is to replace\n * the bare text, `role=\"img\"` is the honest role: it makes the element a\n * single labelled node and the label becomes its accessible name.\n *\n * Only applied when a label is actually present. An unlabelled badge is\n * decorative text and should stay a plain `span`.\n */\n const labelled = props['aria-label'] !== undefined || props['aria-labelledby'] !== undefined;\n\n /*\n * Wrapped only when there is a glyph, because the wrapper exists to be\n * collapsed against one. A text-only badge keeps its bare-text DOM.\n */\n const label = icon ? (\n <span className={cx('ds-badge__label', labelClassName)}>{children}</span>\n ) : (\n children\n );\n\n return (\n <ark.span\n role={labelled ? 'img' : undefined}\n className={cx(\n 'ds-badge',\n `ds-badge--${variant}`,\n `ds-badge--${shape}`,\n appearance === 'plain' && 'ds-badge--plain',\n compact && 'ds-badge--compact',\n caps && 'ds-badge--caps',\n className,\n )}\n {...props}\n >\n {icon && <Icon source={icon} size=\"sm\" decorative />}\n {label}\n </ark.span>\n );\n}\n"]}
@@ -93,6 +93,10 @@ export type ButtonProps = ButtonAsButtonProps | ButtonAsChildProps;
93
93
  * <a href="/goals/new">Add Goal</a>
94
94
  * </Button>
95
95
  * ```
96
+ *
97
+ * For a toggle — a filter that is on or off — pass `aria-pressed` and switch
98
+ * the variant with it: `primary` when on, `secondary` when off. Keep the
99
+ * label the same in both states, and pass `type="button"` inside a form.
96
100
  */
97
101
  export declare function Button(props: ButtonProps): import("react/jsx-runtime").JSX.Element;
98
102
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EACL,KAAK,cAAc,EAInB,KAAK,YAAY,EACjB,KAAK,SAA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C,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IACrE,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAqHnE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,2CAExC"}
@@ -46,6 +46,10 @@ function ButtonAsButton({ variant, size, fullWidth, align, loading = false, disa
46
46
  * <a href="/goals/new">Add Goal</a>
47
47
  * </Button>
48
48
  * ```
49
+ *
50
+ * For a toggle — a filter that is on or off — pass `aria-pressed` and switch
51
+ * the variant with it: `primary` when on, `secondary` when off. Keep the
52
+ * label the same in both states, and pass `type="button"` inside a form.
49
53
  */
50
54
  export function Button(props) {
51
55
  return props.asChild ? _jsx(ButtonAsChild, { ...props }) : _jsx(ButtonAsButton, { ...props });
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAEL,YAAY,EACZ,QAAQ,EACR,cAAc,GAGf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AACrD,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA8E3E,SAAS,aAAa,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAsB;IACzF,OAAO,CACL,8BACG,OAAO,IAAI,eAAM,SAAS,EAAC,oBAAoB,iBAAa,MAAM,GAAG,EACrE,WAAW,IAAI,CACd,KAAC,IAAI,IACH,MAAM,EAAE,WAAW,EACnB,IAAI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B;KACF,EACD,OAAO,CACR,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,EACtB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,KAAK,EACL,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACY;IACpB,OAAO,CACL,KAAC,GAAG,CAAC,MAAM,IACT,SAAS,EAAE,EAAE,CACX,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,SAAS,CAAC,EAC1D,OAAO,IAAI,oBAAoB,CAChC,KACG,KAAK,EACT,QAAQ,EAAE,QAAQ,mBACH,OAAO,IAAI,KAAK,CAAC,eAAe,CAAC,eACrC,OAAO,IAAI,KAAK,CAAC,WAAW,CAAC,EACxC,cAAc,EAAE,iBAAiB,CAAC,OAAO,EAAE,cAAc,CAAC,EAC1D,gBAAgB,EAAE,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,eAAe,CAAC,EAAE,gBAAgB,CAAC,EACpF,cAAc,EAAE,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,eAAe,CAAC,EAAE,cAAc,CAAC,YAEhF,KAAC,aAAa,IAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,YAClF,QAAQ,GACK,GACL,CACd,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAC,aAAa,OAAK,KAAK,GAAI,CAAC,CAAC,CAAC,KAAC,cAAc,OAAK,KAAK,GAAI,CAAC;AACtF,CAAC","sourcesContent":["import { ark } from '@ark-ui/react/factory';\nimport {\n type ComponentProps,\n cloneElement,\n Fragment,\n isValidElement,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { Icon, type IconSource } from '../icon/icon';\nimport './button.css';\nimport { cx } from '../cx';\nimport { guardLoadingClick, guardLoadingKey } from './loading-interaction';\n\nexport type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'danger';\nexport type ButtonSize = 'sm' | 'md' | 'lg';\n\ninterface ButtonOwnProps {\n /** Visual style variant. */\n variant?: ButtonVariant;\n /** Size preset. */\n size?: ButtonSize;\n /**\n * Decorative icon rendered before the label.\n *\n * The icon sits beside text, so it is always the `sm` step of the icon\n * scale whatever the button size, and it inherits the button's text\n * color via `currentColor`. The icon is\n * always rendered as decorative — the accessible name comes from the\n * button's children.\n */\n leadingIcon?: IconSource;\n /**\n * Decorative icon rendered after the label. Same rendering contract as\n * {@link ButtonOwnProps.leadingIcon}.\n */\n trailingIcon?: IconSource;\n /** Whether the button takes the whole width of its row: a form's submit, a card's one action. */\n fullWidth?: boolean;\n /**\n * Where the label sits when the button is wider than its content: centred\n * by default, or at the start, with a trailing icon kept at the end, for a\n * trigger that reads as a field (a picker). Inline rather than a named\n * union: `check:variant-parity` would ask the native Button, which has no\n * label alignment, to export the same name.\n */\n align?: 'center' | 'start';\n}\n\ntype ArkButtonProps = Omit<ComponentProps<typeof ark.button>, 'asChild'>;\n\ninterface ButtonAsButtonProps extends ButtonOwnProps, ArkButtonProps {\n asChild?: false;\n /** Show a spinner and block activation while keeping keyboard focus. */\n loading?: boolean;\n}\n\n/**\n * With `asChild` the child is the control, so everything that belongs to the\n * control goes on the child: `href`, handlers, `ref`, ARIA. Button adds its\n * look and nothing else, which is why no other prop is accepted here.\n *\n * A link has no disabled state: `disabled` is not an attribute of `<a>`, and\n * an anchor with an `href` stays reachable and clickable whatever it looks\n * like. So neither `disabled` nor `loading` exists. Render a `Button`, or no\n * control at all, when the destination is unavailable.\n */\ninterface ButtonAsChildProps extends ButtonOwnProps {\n /**\n * Render the single child element instead of a `<button>`, styled as this\n * button.\n */\n asChild: true;\n /**\n * The one element rendered as the control. Its own children become the\n * label. A component works if it passes `className` and `children` on to\n * the element it renders, as a router's link does.\n */\n children: ReactElement<{ className?: string; children?: ReactNode }>;\n /** Extra class names appended after the `ds-button` modifiers. */\n className?: string;\n}\n\nexport type ButtonProps = ButtonAsButtonProps | ButtonAsChildProps;\n\ninterface ButtonContentProps extends Pick<ButtonOwnProps, 'leadingIcon' | 'trailingIcon'> {\n loading: boolean;\n children: ReactNode;\n}\n\nfunction ButtonContent({ loading, leadingIcon, trailingIcon, children }: ButtonContentProps) {\n return (\n <>\n {loading && <span className=\"ds-button__spinner\" aria-hidden=\"true\" />}\n {leadingIcon && (\n <Icon\n source={leadingIcon}\n size=\"sm\"\n decorative\n className=\"ds-button__icon ds-button__icon--leading\"\n />\n )}\n <span className=\"ds-button__label\">{children}</span>\n {trailingIcon && (\n <Icon\n source={trailingIcon}\n size=\"sm\"\n decorative\n className=\"ds-button__icon ds-button__icon--trailing\"\n />\n )}\n </>\n );\n}\n\nfunction classesFor(\n { variant = 'primary', size = 'md', fullWidth = false, align = 'center' }: ButtonOwnProps,\n className?: string,\n) {\n return cx(\n 'ds-button',\n `ds-button--${variant}`,\n `ds-button--${size}`,\n fullWidth && 'ds-button--full-width',\n align !== 'center' && `ds-button--align-${align}`,\n className,\n );\n}\n\nfunction ButtonAsChild({\n variant,\n size,\n fullWidth,\n align,\n leadingIcon,\n trailingIcon,\n className,\n children,\n}: ButtonAsChildProps) {\n if (!isValidElement(children) || children.type === Fragment) {\n throw new Error(\n 'Button asChild needs exactly one element as its child, such as <a> or a router link.',\n );\n }\n\n const content = (\n <ButtonContent loading={false} leadingIcon={leadingIcon} trailingIcon={trailingIcon}>\n {children.props.children}\n </ButtonContent>\n );\n\n return cloneElement(\n children,\n {\n className: cx(\n classesFor({ variant, size, fullWidth, align }, className),\n children.props.className,\n ),\n },\n content,\n );\n}\n\nfunction ButtonAsButton({\n variant,\n size,\n fullWidth,\n align,\n loading = false,\n disabled,\n onClickCapture,\n onKeyDownCapture,\n onKeyUpCapture,\n leadingIcon,\n trailingIcon,\n className,\n children,\n ...props\n}: ButtonAsButtonProps) {\n return (\n <ark.button\n className={cx(\n classesFor({ variant, size, fullWidth, align }, className),\n loading && 'ds-button--loading',\n )}\n {...props}\n disabled={disabled}\n aria-disabled={loading || props['aria-disabled']}\n aria-busy={loading || props['aria-busy']}\n onClickCapture={guardLoadingClick(loading, onClickCapture)}\n onKeyDownCapture={guardLoadingKey(loading, props['aria-haspopup'], onKeyDownCapture)}\n onKeyUpCapture={guardLoadingKey(loading, props['aria-haspopup'], onKeyUpCapture)}\n >\n <ButtonContent loading={loading} leadingIcon={leadingIcon} trailingIcon={trailingIcon}>\n {children}\n </ButtonContent>\n </ark.button>\n );\n}\n\n/**\n * Shared base button for the Manakind design system.\n *\n * Uses Ark UI's element factory and native button keyboard behavior, with\n * loading interaction handled here. Styled against the `--ds-*` token\n * contract; the consuming product is responsible for providing those values\n * via its tokens package (e.g. `@manakind/manuia-tokens/css/theme`).\n *\n * For an icon-only button (no visible label), use `IconButton` instead —\n * it enforces an `aria-label` at the type level.\n * Loading uses `aria-disabled` and `aria-busy` with blocked activation so focus\n * stays on the control. An explicit `disabled` still uses native disabling.\n *\n * For an action that navigates, pass `asChild` and a link as the only child.\n * The link is what renders, so it keeps what a link does: open in a new tab,\n * copy its address, the router's prefetch. Its `href`, handlers and `ref`\n * stay on the link.\n *\n * ```tsx\n * <Button asChild leadingIcon={PlusCircle}>\n * <a href=\"/goals/new\">Add Goal</a>\n * </Button>\n * ```\n */\nexport function Button(props: ButtonProps) {\n return props.asChild ? <ButtonAsChild {...props} /> : <ButtonAsButton {...props} />;\n}\n"]}
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAEL,YAAY,EACZ,QAAQ,EACR,cAAc,GAGf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAA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,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,YAClF,QAAQ,GACK,GACL,CACd,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAC,aAAa,OAAK,KAAK,GAAI,CAAC,CAAC,CAAC,KAAC,cAAc,OAAK,KAAK,GAAI,CAAC;AACtF,CAAC","sourcesContent":["import { ark } from '@ark-ui/react/factory';\nimport {\n type ComponentProps,\n cloneElement,\n Fragment,\n isValidElement,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { Icon, type IconSource } from '../icon/icon';\nimport './button.css';\nimport { cx } from '../cx';\nimport { guardLoadingClick, guardLoadingKey } from './loading-interaction';\n\nexport type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'danger';\nexport type ButtonSize = 'sm' | 'md' | 'lg';\n\ninterface ButtonOwnProps {\n /** Visual style variant. */\n variant?: ButtonVariant;\n /** Size preset. */\n size?: ButtonSize;\n /**\n * Decorative icon rendered before the label.\n *\n * The icon sits beside text, so it is always the `sm` step of the icon\n * scale whatever the button size, and it inherits the button's text\n * color via `currentColor`. The icon is\n * always rendered as decorative — the accessible name comes from the\n * button's children.\n */\n leadingIcon?: IconSource;\n /**\n * Decorative icon rendered after the label. Same rendering contract as\n * {@link ButtonOwnProps.leadingIcon}.\n */\n trailingIcon?: IconSource;\n /** Whether the button takes the whole width of its row: a form's submit, a card's one action. */\n fullWidth?: boolean;\n /**\n * Where the label sits when the button is wider than its content: centred\n * by default, or at the start, with a trailing icon kept at the end, for a\n * trigger that reads as a field (a picker). Inline rather than a named\n * union: `check:variant-parity` would ask the native Button, which has no\n * label alignment, to export the same name.\n */\n align?: 'center' | 'start';\n}\n\ntype ArkButtonProps = Omit<ComponentProps<typeof ark.button>, 'asChild'>;\n\ninterface ButtonAsButtonProps extends ButtonOwnProps, ArkButtonProps {\n asChild?: false;\n /** Show a spinner and block activation while keeping keyboard focus. */\n loading?: boolean;\n}\n\n/**\n * With `asChild` the child is the control, so everything that belongs to the\n * control goes on the child: `href`, handlers, `ref`, ARIA. Button adds its\n * look and nothing else, which is why no other prop is accepted here.\n *\n * A link has no disabled state: `disabled` is not an attribute of `<a>`, and\n * an anchor with an `href` stays reachable and clickable whatever it looks\n * like. So neither `disabled` nor `loading` exists. Render a `Button`, or no\n * control at all, when the destination is unavailable.\n */\ninterface ButtonAsChildProps extends ButtonOwnProps {\n /**\n * Render the single child element instead of a `<button>`, styled as this\n * button.\n */\n asChild: true;\n /**\n * The one element rendered as the control. Its own children become the\n * label. A component works if it passes `className` and `children` on to\n * the element it renders, as a router's link does.\n */\n children: ReactElement<{ className?: string; children?: ReactNode }>;\n /** Extra class names appended after the `ds-button` modifiers. */\n className?: string;\n}\n\nexport type ButtonProps = ButtonAsButtonProps | ButtonAsChildProps;\n\ninterface ButtonContentProps extends Pick<ButtonOwnProps, 'leadingIcon' | 'trailingIcon'> {\n loading: boolean;\n children: ReactNode;\n}\n\nfunction ButtonContent({ loading, leadingIcon, trailingIcon, children }: ButtonContentProps) {\n return (\n <>\n {loading && <span className=\"ds-button__spinner\" aria-hidden=\"true\" />}\n {leadingIcon && (\n <Icon\n source={leadingIcon}\n size=\"sm\"\n decorative\n className=\"ds-button__icon ds-button__icon--leading\"\n />\n )}\n <span className=\"ds-button__label\">{children}</span>\n {trailingIcon && (\n <Icon\n source={trailingIcon}\n size=\"sm\"\n decorative\n className=\"ds-button__icon ds-button__icon--trailing\"\n />\n )}\n </>\n );\n}\n\nfunction classesFor(\n { variant = 'primary', size = 'md', fullWidth = false, align = 'center' }: ButtonOwnProps,\n className?: string,\n) {\n return cx(\n 'ds-button',\n `ds-button--${variant}`,\n `ds-button--${size}`,\n fullWidth && 'ds-button--full-width',\n align !== 'center' && `ds-button--align-${align}`,\n className,\n );\n}\n\nfunction ButtonAsChild({\n variant,\n size,\n fullWidth,\n align,\n leadingIcon,\n trailingIcon,\n className,\n children,\n}: ButtonAsChildProps) {\n if (!isValidElement(children) || children.type === Fragment) {\n throw new Error(\n 'Button asChild needs exactly one element as its child, such as <a> or a router link.',\n );\n }\n\n const content = (\n <ButtonContent loading={false} leadingIcon={leadingIcon} trailingIcon={trailingIcon}>\n {children.props.children}\n </ButtonContent>\n );\n\n return cloneElement(\n children,\n {\n className: cx(\n classesFor({ variant, size, fullWidth, align }, className),\n children.props.className,\n ),\n },\n content,\n );\n}\n\nfunction ButtonAsButton({\n variant,\n size,\n fullWidth,\n align,\n loading = false,\n disabled,\n onClickCapture,\n onKeyDownCapture,\n onKeyUpCapture,\n leadingIcon,\n trailingIcon,\n className,\n children,\n ...props\n}: ButtonAsButtonProps) {\n return (\n <ark.button\n className={cx(\n classesFor({ variant, size, fullWidth, align }, className),\n loading && 'ds-button--loading',\n )}\n {...props}\n disabled={disabled}\n aria-disabled={loading || props['aria-disabled']}\n aria-busy={loading || props['aria-busy']}\n onClickCapture={guardLoadingClick(loading, onClickCapture)}\n onKeyDownCapture={guardLoadingKey(loading, props['aria-haspopup'], onKeyDownCapture)}\n onKeyUpCapture={guardLoadingKey(loading, props['aria-haspopup'], onKeyUpCapture)}\n >\n <ButtonContent loading={loading} leadingIcon={leadingIcon} trailingIcon={trailingIcon}>\n {children}\n </ButtonContent>\n </ark.button>\n );\n}\n\n/**\n * Shared base button for the Manakind design system.\n *\n * Uses Ark UI's element factory and native button keyboard behavior, with\n * loading interaction handled here. Styled against the `--ds-*` token\n * contract; the consuming product is responsible for providing those values\n * via its tokens package (e.g. `@manakind/manuia-tokens/css/theme`).\n *\n * For an icon-only button (no visible label), use `IconButton` instead —\n * it enforces an `aria-label` at the type level.\n * Loading uses `aria-disabled` and `aria-busy` with blocked activation so focus\n * stays on the control. An explicit `disabled` still uses native disabling.\n *\n * For an action that navigates, pass `asChild` and a link as the only child.\n * The link is what renders, so it keeps what a link does: open in a new tab,\n * copy its address, the router's prefetch. Its `href`, handlers and `ref`\n * stay on the link.\n *\n * ```tsx\n * <Button asChild leadingIcon={PlusCircle}>\n * <a href=\"/goals/new\">Add Goal</a>\n * </Button>\n * ```\n *\n * For a toggle — a filter that is on or off — pass `aria-pressed` and switch\n * the variant with it: `primary` when on, `secondary` when off. Keep the\n * label the same in both states, and pass `type=\"button\"` inside a form.\n */\nexport function Button(props: ButtonProps) {\n return props.asChild ? <ButtonAsChild {...props} /> : <ButtonAsButton {...props} />;\n}\n"]}
@@ -5,7 +5,16 @@
5
5
  align-items: center;
6
6
  justify-content: center;
7
7
  gap: var(--ds-empty-state-gap);
8
+ box-sizing: border-box;
8
9
  padding-block: var(--ds-empty-state-padding-block);
10
+ padding-inline: var(--ds-empty-state-padding-inline);
11
+ /*
12
+ * The box is the layout kit's dashed surface, drawn at the product's
13
+ * width: zero leaves an empty state boxless, as Manuia and ShipTight
14
+ * draw it.
15
+ */
16
+ border: var(--ds-empty-state-border-width) dashed var(--ds-layout-surface-border);
17
+ border-radius: var(--ds-layout-surface-radius);
9
18
  text-align: center;
10
19
  color: var(--ds-empty-state-text);
11
20
  overflow-wrap: anywhere;
@@ -19,8 +19,9 @@ export interface EmptyStateProps extends Omit<ComponentProps<'div'>, 'title'> {
19
19
  *
20
20
  * A title, an optional description and an optional action, centred in a
21
21
  * block of inset so the emptiness reads as intended rather than as a failed
22
- * render. Styled by the `--ds-empty-state-*` keys; the type comes from the
23
- * text contract.
22
+ * render. Styled by the `--ds-empty-state-*` keys, which also set whether it
23
+ * sits in a dashed box (the office) or on its inset alone; the type comes from
24
+ * the text contract.
24
25
  */
25
26
  export declare function EmptyState({ title, description, icon, className, children, ...props }: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
26
27
  //# sourceMappingURL=empty-state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../src/empty-state/empty-state.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,mBAAmB,CAAC;AAE3B,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAC3E,8DAA8D;IAC9D,KAAK,EAAE,SAAS,CAAC;IACjB,uEAAuE;IACvE,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,2CASjB"}
1
+ {"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../src/empty-state/empty-state.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,mBAAmB,CAAC;AAE3B,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAC3E,8DAA8D;IAC9D,KAAK,EAAE,SAAS,CAAC;IACjB,uEAAuE;IACvE,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,2CASjB"}
@@ -7,8 +7,9 @@ import { Icon } from '../icon/icon';
7
7
  *
8
8
  * A title, an optional description and an optional action, centred in a
9
9
  * block of inset so the emptiness reads as intended rather than as a failed
10
- * render. Styled by the `--ds-empty-state-*` keys; the type comes from the
11
- * text contract.
10
+ * render. Styled by the `--ds-empty-state-*` keys, which also set whether it
11
+ * sits in a dashed box (the office) or on its inset alone; the type comes from
12
+ * the text contract.
12
13
  */
13
14
  export function EmptyState({ title, description, icon, className, children, ...props }) {
14
15
  return (_jsxs("div", { className: cx('ds-empty-state', className), ...props, children: [icon ? _jsx(Icon, { source: icon, size: "lg", tone: "muted", decorative: true }) : null, _jsx("p", { className: "ds-empty-state__title", children: title }), description ? _jsx("p", { className: "ds-empty-state__description", children: description }) : null, children ? _jsx("div", { className: "ds-empty-state__actions", children: children }) : null] }));
@@ -1 +1 @@
1
- {"version":3,"file":"empty-state.js","sourceRoot":"","sources":["../../src/empty-state/empty-state.tsx"],"names":[],"mappings":";AACA,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAgBrD;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACQ;IAChB,OAAO,CACL,eAAK,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,KAAM,KAAK,aACvD,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAC,UAAU,SAAG,CAAC,CAAC,CAAC,IAAI,EACvE,YAAG,SAAS,EAAC,uBAAuB,YAAE,KAAK,GAAK,EAC/C,WAAW,CAAC,CAAC,CAAC,YAAG,SAAS,EAAC,6BAA6B,YAAE,WAAW,GAAK,CAAC,CAAC,CAAC,IAAI,EACjF,QAAQ,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,yBAAyB,YAAE,QAAQ,GAAO,CAAC,CAAC,CAAC,IAAI,IACxE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import type { ComponentProps, ReactNode } from 'react';\nimport './empty-state.css';\nimport { cx } from '../cx';\nimport { Icon, type IconSource } from '../icon/icon';\n\nexport interface EmptyStateProps extends Omit<ComponentProps<'div'>, 'title'> {\n /** The one line that says what is missing: \"No goals yet\". */\n title: ReactNode;\n /** What to do about it, or why it is empty. Muted, under the title. */\n description?: ReactNode;\n /**\n * A glyph above the title, decorative: the title says the same thing. An\n * `IconSource`, since `ui-core` ships no icons of its own.\n */\n icon?: IconSource;\n /** The way out, typically one button, rendered under the text. */\n children?: ReactNode;\n}\n\n/**\n * The centred column a region shows when it has nothing to list.\n *\n * A title, an optional description and an optional action, centred in a\n * block of inset so the emptiness reads as intended rather than as a failed\n * render. Styled by the `--ds-empty-state-*` keys; the type comes from the\n * text contract.\n */\nexport function EmptyState({\n title,\n description,\n icon,\n className,\n children,\n ...props\n}: EmptyStateProps) {\n return (\n <div className={cx('ds-empty-state', className)} {...props}>\n {icon ? <Icon source={icon} size=\"lg\" tone=\"muted\" decorative /> : null}\n <p className=\"ds-empty-state__title\">{title}</p>\n {description ? <p className=\"ds-empty-state__description\">{description}</p> : null}\n {children ? <div className=\"ds-empty-state__actions\">{children}</div> : null}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"empty-state.js","sourceRoot":"","sources":["../../src/empty-state/empty-state.tsx"],"names":[],"mappings":";AACA,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAgBrD;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACQ;IAChB,OAAO,CACL,eAAK,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,KAAM,KAAK,aACvD,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAC,UAAU,SAAG,CAAC,CAAC,CAAC,IAAI,EACvE,YAAG,SAAS,EAAC,uBAAuB,YAAE,KAAK,GAAK,EAC/C,WAAW,CAAC,CAAC,CAAC,YAAG,SAAS,EAAC,6BAA6B,YAAE,WAAW,GAAK,CAAC,CAAC,CAAC,IAAI,EACjF,QAAQ,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,yBAAyB,YAAE,QAAQ,GAAO,CAAC,CAAC,CAAC,IAAI,IACxE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import type { ComponentProps, ReactNode } from 'react';\nimport './empty-state.css';\nimport { cx } from '../cx';\nimport { Icon, type IconSource } from '../icon/icon';\n\nexport interface EmptyStateProps extends Omit<ComponentProps<'div'>, 'title'> {\n /** The one line that says what is missing: \"No goals yet\". */\n title: ReactNode;\n /** What to do about it, or why it is empty. Muted, under the title. */\n description?: ReactNode;\n /**\n * A glyph above the title, decorative: the title says the same thing. An\n * `IconSource`, since `ui-core` ships no icons of its own.\n */\n icon?: IconSource;\n /** The way out, typically one button, rendered under the text. */\n children?: ReactNode;\n}\n\n/**\n * The centred column a region shows when it has nothing to list.\n *\n * A title, an optional description and an optional action, centred in a\n * block of inset so the emptiness reads as intended rather than as a failed\n * render. Styled by the `--ds-empty-state-*` keys, which also set whether it\n * sits in a dashed box (the office) or on its inset alone; the type comes from\n * the text contract.\n */\nexport function EmptyState({\n title,\n description,\n icon,\n className,\n children,\n ...props\n}: EmptyStateProps) {\n return (\n <div className={cx('ds-empty-state', className)} {...props}>\n {icon ? <Icon source={icon} size=\"lg\" tone=\"muted\" decorative /> : null}\n <p className=\"ds-empty-state__title\">{title}</p>\n {description ? <p className=\"ds-empty-state__description\">{description}</p> : null}\n {children ? <div className=\"ds-empty-state__actions\">{children}</div> : null}\n </div>\n );\n}\n"]}
@@ -1,3 +1,3 @@
1
- export type { PageActionsProps, PageDescriptionProps, PageHeaderProps, PageLayoutProps, PageTitleProps, } from './page-layout';
2
- export { PageActions, PageDescription, PageHeader, PageLayout, PageTitle } from './page-layout';
1
+ export type { PageActionsProps, PageDescriptionProps, PageEyebrowProps, PageHeaderProps, PageLayoutProps, PageTitleProps, } from './page-layout';
2
+ export { PageActions, PageDescription, PageEyebrow, PageHeader, PageLayout, PageTitle, } from './page-layout';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/page-layout/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/page-layout/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,WAAW,EACX,eAAe,EACf,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAS,GACV,MAAM,eAAe,CAAC"}
@@ -1,2 +1,2 @@
1
- export { PageActions, PageDescription, PageHeader, PageLayout, PageTitle } from './page-layout';
1
+ export { PageActions, PageDescription, PageEyebrow, PageHeader, PageLayout, PageTitle, } from './page-layout';
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/page-layout/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export type {\n PageActionsProps,\n PageDescriptionProps,\n PageHeaderProps,\n PageLayoutProps,\n PageTitleProps,\n} from './page-layout';\nexport { PageActions, PageDescription, PageHeader, PageLayout, PageTitle } from './page-layout';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/page-layout/index.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,WAAW,EACX,eAAe,EACf,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAS,GACV,MAAM,eAAe,CAAC","sourcesContent":["export type {\n PageActionsProps,\n PageDescriptionProps,\n PageEyebrowProps,\n PageHeaderProps,\n PageLayoutProps,\n PageTitleProps,\n} from './page-layout';\nexport {\n PageActions,\n PageDescription,\n PageEyebrow,\n PageHeader,\n PageLayout,\n PageTitle,\n} from './page-layout';\n"]}
@@ -76,6 +76,22 @@
76
76
  align-self: start;
77
77
  justify-content: flex-end;
78
78
  }
79
+
80
+ & .ds-page__eyebrow {
81
+ grid-column: 1;
82
+ grid-row: 1;
83
+ }
84
+
85
+ /* An eyebrow takes the first row; the title moves under it and the actions span both. */
86
+ &:has(> .ds-page__eyebrow) {
87
+ & .ds-page__title {
88
+ grid-row: 2;
89
+ }
90
+
91
+ & .ds-page__actions {
92
+ grid-row: 1 / span 2;
93
+ }
94
+ }
79
95
  }
80
96
  }
81
97
  }
@@ -23,11 +23,18 @@ export interface PageLayoutProps extends ComponentProps<typeof ark.div> {
23
23
  export declare function PageLayout({ size, className, children, ...props }: PageLayoutProps): import("react/jsx-runtime").JSX.Element;
24
24
  export type PageHeaderProps = ComponentProps<typeof ark.header>;
25
25
  /**
26
- * The top of a page: its {@link PageTitle}, an optional {@link PageDescription}
27
- * and optional {@link PageActions}. The title and description stack; the
28
- * actions sit beside them from `md` up and under them on a narrower viewport.
26
+ * The top of a page: an optional {@link PageEyebrow}, its {@link PageTitle},
27
+ * an optional {@link PageDescription} and optional {@link PageActions}. The
28
+ * eyebrow, title and description stack; the actions sit beside them from `md`
29
+ * up and under them on a narrower viewport.
29
30
  */
30
31
  export declare function PageHeader({ className, children, ...props }: PageHeaderProps): import("react/jsx-runtime").JSX.Element;
32
+ export type PageEyebrowProps = Omit<TextProps, 'caps' | 'size' | 'tone'>;
33
+ /**
34
+ * A small-caps label above the title naming where the page sits ("Innovation
35
+ * Intelligence" over "Reports"). Comes first in the header, before the title.
36
+ */
37
+ export declare function PageEyebrow({ className, children, ...props }: PageEyebrowProps): import("react/jsx-runtime").JSX.Element;
31
38
  export type PageTitleProps = Omit<HeadingProps, 'level'>;
32
39
  /**
33
40
  * The page's one `h1`. Takes a `ref` for focus management after a route
@@ -1 +1 @@
1
- {"version":3,"file":"page-layout.d.ts","sourceRoot":"","sources":["../../src/page-layout/page-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAW,KAAK,YAAY,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhF,MAAM,WAAW,eAAgB,SAAQ,cAAc,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC;IACrE;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,EAAE,IAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAMzF;AAED,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;AAEhE;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EA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C;AAEhE;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAM5E;AAED,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;AAEzE;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAM9E;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CAM1E;AAED,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAE7C,6CAA6C;AAC7C,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,2CAMtF;AAED,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;AAE9D,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAM9E"}
@@ -17,13 +17,21 @@ export function PageLayout({ size = 'xl', className, children, ...props }) {
17
17
  return (_jsx(ark.div, { className: cx('ds-page', `ds-page--${size}`, className), ...props, children: children }));
18
18
  }
19
19
  /**
20
- * The top of a page: its {@link PageTitle}, an optional {@link PageDescription}
21
- * and optional {@link PageActions}. The title and description stack; the
22
- * actions sit beside them from `md` up and under them on a narrower viewport.
20
+ * The top of a page: an optional {@link PageEyebrow}, its {@link PageTitle},
21
+ * an optional {@link PageDescription} and optional {@link PageActions}. The
22
+ * eyebrow, title and description stack; the actions sit beside them from `md`
23
+ * up and under them on a narrower viewport.
23
24
  */
24
25
  export function PageHeader({ className, children, ...props }) {
25
26
  return (_jsx(ark.header, { className: cx('ds-page__header', className), ...props, children: children }));
26
27
  }
28
+ /**
29
+ * A small-caps label above the title naming where the page sits ("Innovation
30
+ * Intelligence" over "Reports"). Comes first in the header, before the title.
31
+ */
32
+ export function PageEyebrow({ className, children, ...props }) {
33
+ return (_jsx(Text, { caps: true, size: "xs", tone: "muted", className: cx('ds-page__eyebrow', className), ...props, children: children }));
34
+ }
27
35
  /**
28
36
  * The page's one `h1`. Takes a `ref` for focus management after a route
29
37
  * change or a removal, like any heading.
@@ -1 +1 @@
1
- {"version":3,"file":"page-layout.js","sourceRoot":"","sources":["../../src/page-layout/page-layout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,OAAO,EAAqB,IAAI,EAAkB,MAAM,cAAc,CAAC;AAUhF;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAmB;IACxF,OAAO,CACL,KAAC,GAAG,CAAC,GAAG,IAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,YAAY,IAAI,EAAE,EAAE,SAAS,CAAC,KAAM,KAAK,YACxE,QAAQ,GACD,CACX,CAAC;AACJ,CAAC;AAID;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAmB;IAC3E,OAAO,CACL,KAAC,GAAG,CAAC,MAAM,IAAC,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,KAAM,KAAK,YAC/D,QAAQ,GACE,CACd,CAAC;AACJ,CAAC;AAID;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAkB;IACzE,OAAO,CACL,KAAC,OAAO,IAAC,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,KAAM,KAAK,YACrE,QAAQ,GACD,CACX,CAAC;AACJ,CAAC;AAID,6CAA6C;AAC7C,MAAM,UAAU,eAAe,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAwB;IACrF,OAAO,CACL,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,KAAM,KAAK,YAC3E,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC;AAID,sEAAsE;AACtE,MAAM,UAAU,WAAW,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAoB;IAC7E,OAAO,CACL,KAAC,GAAG,CAAC,GAAG,IAAC,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC,KAAM,KAAK,YAC7D,QAAQ,GACD,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { ark } from '@ark-ui/react/factory';\nimport type { ComponentProps } from 'react';\nimport './page-layout.css';\nimport { cx } from '../cx';\nimport type { ContentWidth } from '../layout/layout';\nimport { Heading, type HeadingProps, Text, type TextProps } from '../text/text';\n\nexport interface PageLayoutProps extends ComponentProps<typeof ark.div> {\n /**\n * Where the page's content stops growing. Defaults to `xl`, a full page; a\n * settings page or a reading page is `lg`.\n */\n size?: ContentWidth;\n}\n\n/**\n * The template every page composes: a centred column with the page's inset\n * and the rhythm between its regions.\n *\n * Children are the page's regions, usually a {@link PageHeader} and then\n * {@link Section}s, separated by `--ds-page-gap`. The inset from the viewport\n * is `--ds-page-padding-inline` and `--ds-page-padding-block`. Renders a\n * `div`; pass `asChild` to make the page a landmark\n * (`<PageLayout asChild><main>…</main></PageLayout>`).\n */\nexport function PageLayout({ size = 'xl', className, children, ...props }: PageLayoutProps) {\n return (\n <ark.div className={cx('ds-page', `ds-page--${size}`, className)} {...props}>\n {children}\n </ark.div>\n );\n}\n\nexport type PageHeaderProps = ComponentProps<typeof ark.header>;\n\n/**\n * The top of a page: its {@link PageTitle}, an optional {@link PageDescription}\n * and optional {@link PageActions}. The title and description stack; the\n * actions sit beside them from `md` up and under them on a narrower viewport.\n */\nexport function PageHeader({ className, children, ...props }: PageHeaderProps) {\n return (\n <ark.header className={cx('ds-page__header', className)} {...props}>\n {children}\n </ark.header>\n );\n}\n\nexport type PageTitleProps = Omit<HeadingProps, 'level'>;\n\n/**\n * The page's one `h1`. Takes a `ref` for focus management after a route\n * change or a removal, like any heading.\n */\nexport function PageTitle({ className, children, ...props }: PageTitleProps) {\n return (\n <Heading level={1} className={cx('ds-page__title', className)} {...props}>\n {children}\n </Heading>\n );\n}\n\nexport type PageDescriptionProps = TextProps;\n\n/** Muted supporting copy under the title. */\nexport function PageDescription({ className, children, ...props }: PageDescriptionProps) {\n return (\n <Text tone=\"muted\" className={cx('ds-page__description', className)} {...props}>\n {children}\n </Text>\n );\n}\n\nexport type PageActionsProps = ComponentProps<typeof ark.div>;\n\n/** The page's primary controls, a wrapping row aligned to the end. */\nexport function PageActions({ className, children, ...props }: PageActionsProps) {\n return (\n <ark.div className={cx('ds-page__actions', className)} {...props}>\n {children}\n </ark.div>\n );\n}\n"]}
1
+ {"version":3,"file":"page-layout.js","sourceRoot":"","sources":["../../src/page-layout/page-layout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,OAAO,EAAqB,IAAI,EAAkB,MAAM,cAAc,CAAC;AAUhF;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,E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K,YAC3E,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC;AAID,sEAAsE;AACtE,MAAM,UAAU,WAAW,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAoB;IAC7E,OAAO,CACL,KAAC,GAAG,CAAC,GAAG,IAAC,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC,KAAM,KAAK,YAC7D,QAAQ,GACD,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { ark } from '@ark-ui/react/factory';\nimport type { ComponentProps } from 'react';\nimport './page-layout.css';\nimport { cx } from '../cx';\nimport type { ContentWidth } from '../layout/layout';\nimport { Heading, type HeadingProps, Text, type TextProps } from '../text/text';\n\nexport interface PageLayoutProps extends ComponentProps<typeof ark.div> {\n /**\n * Where the page's content stops growing. Defaults to `xl`, a full page; a\n * settings page or a reading page is `lg`.\n */\n size?: ContentWidth;\n}\n\n/**\n * The template every page composes: a centred column with the page's inset\n * and the rhythm between its regions.\n *\n * Children are the page's regions, usually a {@link PageHeader} and then\n * {@link Section}s, separated by `--ds-page-gap`. The inset from the viewport\n * is `--ds-page-padding-inline` and `--ds-page-padding-block`. Renders a\n * `div`; pass `asChild` to make the page a landmark\n * (`<PageLayout asChild><main>…</main></PageLayout>`).\n */\nexport function PageLayout({ size = 'xl', className, children, ...props }: PageLayoutProps) {\n return (\n <ark.div className={cx('ds-page', `ds-page--${size}`, className)} {...props}>\n {children}\n </ark.div>\n );\n}\n\nexport type PageHeaderProps = ComponentProps<typeof ark.header>;\n\n/**\n * The top of a page: an optional {@link PageEyebrow}, its {@link PageTitle},\n * an optional {@link PageDescription} and optional {@link PageActions}. The\n * eyebrow, title and description stack; the actions sit beside them from `md`\n * up and under them on a narrower viewport.\n */\nexport function PageHeader({ className, children, ...props }: PageHeaderProps) {\n return (\n <ark.header className={cx('ds-page__header', className)} {...props}>\n {children}\n </ark.header>\n );\n}\n\nexport type PageEyebrowProps = Omit<TextProps, 'caps' | 'size' | 'tone'>;\n\n/**\n * A small-caps label above the title naming where the page sits (\"Innovation\n * Intelligence\" over \"Reports\"). Comes first in the header, before the title.\n */\nexport function PageEyebrow({ className, children, ...props }: PageEyebrowProps) {\n return (\n <Text caps size=\"xs\" tone=\"muted\" className={cx('ds-page__eyebrow', className)} {...props}>\n {children}\n </Text>\n );\n}\n\nexport type PageTitleProps = Omit<HeadingProps, 'level'>;\n\n/**\n * The page's one `h1`. Takes a `ref` for focus management after a route\n * change or a removal, like any heading.\n */\nexport function PageTitle({ className, children, ...props }: PageTitleProps) {\n return (\n <Heading level={1} className={cx('ds-page__title', className)} {...props}>\n {children}\n </Heading>\n );\n}\n\nexport type PageDescriptionProps = TextProps;\n\n/** Muted supporting copy under the title. */\nexport function PageDescription({ className, children, ...props }: PageDescriptionProps) {\n return (\n <Text tone=\"muted\" className={cx('ds-page__description', className)} {...props}>\n {children}\n </Text>\n );\n}\n\nexport type PageActionsProps = ComponentProps<typeof ark.div>;\n\n/** The page's primary controls, a wrapping row aligned to the end. */\nexport function PageActions({ className, children, ...props }: PageActionsProps) {\n return (\n <ark.div className={cx('ds-page__actions', className)} {...props}>\n {children}\n </ark.div>\n );\n}\n"]}
@@ -14,6 +14,14 @@
14
14
  line-height: var(--ds-text-heading-line-height);
15
15
  }
16
16
 
17
+ /* Before the weight classes, so an explicit `weight` still wins. */
18
+ &.ds-text--caps {
19
+ text-transform: uppercase;
20
+ letter-spacing: var(--ds-text-caps-letter-spacing);
21
+ font-family: var(--ds-text-caps-font-family);
22
+ font-weight: var(--ds-text-caps-font-weight);
23
+ }
24
+
17
25
  &.ds-text--size-xs {
18
26
  font-size: var(--ds-text-size-xs-font-size);
19
27
  line-height: var(--ds-text-size-xs-line-height);
@@ -111,11 +119,6 @@
111
119
  text-align: end;
112
120
  }
113
121
 
114
- &.ds-text--caps {
115
- text-transform: uppercase;
116
- letter-spacing: var(--ds-text-caps-letter-spacing);
117
- }
118
-
119
122
  &.ds-text--mono {
120
123
  font-family: var(--ds-text-mono-font-family);
121
124
  }
@@ -48,9 +48,9 @@ export interface TextProps extends ComponentProps<typeof ark.p>, TextStyleProps
48
48
  /** Element to render. Defaults to `p`. */
49
49
  as?: TextTag;
50
50
  /**
51
- * Small-caps label: uppercase, semibold, letter-spaced, for a short word
52
- * that names the value beside it ("Target", "Rating"). Reads the product's
53
- * label tracking; pair it with `size="xs"` or `sm`.
51
+ * Small-caps label: uppercase and letter-spaced, for a short word that
52
+ * names the value beside it ("Target", "Rating"). Its face, weight and
53
+ * tracking are the product's label style; pair it with `size="xs"` or `sm`.
54
54
  */
55
55
  caps?: boolean;
56
56
  }
package/dist/text/text.js CHANGED
@@ -32,7 +32,7 @@ export function Text({ as, size = 'md', weight, tone = 'default', align, truncat
32
32
  const Component = (as ? ark[as] : ark.p);
33
33
  return (_jsx(Component, { className: textClasses(cx('ds-text--body', caps && 'ds-text--caps', as && MONO_TAGS.has(as) && 'ds-text--mono'), {
34
34
  size,
35
- weight: weight ?? (caps ? 'semibold' : undefined),
35
+ weight,
36
36
  tone,
37
37
  align,
38
38
  truncate,
@@ -1 +1 @@
1
- {"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/text/text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,YAAY,CAAC;AACpB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AA+D3B,SAAS,WAAW,CAClB,KAAa,EACb,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAkB,EAC/F,SAAkB;IAElB,OAAO,EAAE,CACP,SAAS,EACT,KAAK,EACL,IAAI,IAAI,iBAAiB,IAAI,EAAE,EAC/B,MAAM,IAAI,mBAAmB,MAAM,EAAE,EACrC,IAAI,IAAI,IAAI,KAAK,SAAS,IAAI,iBAAiB,IAAI,EAAE,EACrD,KAAK,IAAI,kBAAkB,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AS,CAAC;YACjD,IAAI;YACJ,KAAK;YACL,QAAQ;YACR,OAAO;YACP,cAAc;YACd,aAAa;SACd,EACD,SAAS,CACV,EACD,KAAK,EAAE,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,KACjC,KAAK,YAER,QAAQ,GACC,CACb,CAAC;AACJ,CAAC;AAID,uFAAuF;AACvF,MAAM,aAAa,GAAmC;IACpD,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;CACR,CAAC;AAWF;;;;;;;;GAQG;AACH,MAAM,UAAU,OAAO,CAAC,EACtB,KAAK,EACL,IAAI,EACJ,MAAM,EACN,IAAI,GAAG,SAAS,EAChB,KAAK,EACL,QAAQ,EACR,OAAO,EACP,cAAc,EACd,aAAa,EACb,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACK;IACb,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;IACnC,OAAO,CACL,KAAC,SAAS,IACR,SAAS,EAAE,WAAW,CACpB,kBAAkB,EAClB;YACE,IAAI,EAAE,IAAI,IAAI,aAAa,CAAC,KAAK,CAAC;YAClC,MAAM;YACN,IAAI;YACJ,KAAK;YACL,QAAQ;YACR,OAAO;YACP,cAAc;YACd,aAAa;SACd,EACD,SAAS,CACV,EACD,KAAK,EAAE,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,KACjC,KAAK,YAER,QAAQ,GACC,CACb,CAAC;AACJ,CAAC","sourcesContent":["import { ark } from '@ark-ui/react/factory';\nimport type { ComponentProps, CSSProperties } from 'react';\nimport './text.css';\nimport { cx } from '../cx';\n\n/** The type scale's steps, from the 14px floor up. */\nexport type TextSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';\n\nexport type TextWeight = 'regular' | 'medium' | 'semibold' | 'bold';\n\n/**\n * What the text is for, which decides its colour. `default` and `muted` are\n * the two text roles; the four statuses are for a line of text that reports\n * one, such as a validation message or a result; `accent` is the strong\n * primary colour, for a short label the brand lends its colour to.\n */\nexport type TextTone = 'default' | 'muted' | 'success' | 'warning' | 'danger' | 'info' | 'accent';\n\nexport type TextAlign = 'start' | 'center' | 'end';\n\n/**\n * The elements `Text` renders: the ones whose attributes are a paragraph's.\n * Deliberately a union rather than `ElementType`: the implementation indexes\n * the Ark factory, which hands any key to `createElement` as a tag name, so\n * a component reference would be stringified and thrown. An element with\n * attributes of its own (`label` with `htmlFor`, `time` with `dateTime`, an\n * `output`) goes through `asChild`, which keeps that element's own props.\n * `code` and `kbd` take the monospace face.\n */\nexport type TextTag =\n | 'p'\n | 'span'\n | 'div'\n | 'strong'\n | 'em'\n | 'small'\n | 'li'\n | 'dt'\n | 'dd'\n | 'figcaption'\n | 'code'\n | 'kbd';\n\nexport interface TextStyleProps {\n /** Step of the type scale. Defaults to `md`, body text. */\n size?: TextSize;\n /** Font weight. Defaults to the element's own (`regular` for body text). */\n weight?: TextWeight;\n /** Colour by purpose. Defaults to `default`. */\n tone?: TextTone;\n /** Horizontal alignment. Defaults to the writing direction's start. */\n align?: TextAlign;\n /**\n * Clip the text with an ellipsis: `true` after one line, or a number of\n * lines. The text is clipped by its own box rather than kept from wrapping,\n * so a long word still breaks instead of pushing past the edge.\n */\n truncate?: boolean | number;\n /** Digits of equal width, so figures in a column or a count that ticks line up. */\n tabular?: boolean;\n /** Keep the line breaks the text was written with: a description, a reflection, a note. */\n preserveBreaks?: boolean;\n /** A line through the text: a milestone reached, a move no longer on the list. */\n strikethrough?: boolean;\n}\n\nfunction textClasses(\n block: string,\n { size, weight, tone, align, truncate, tabular, preserveBreaks, strikethrough }: TextStyleProps,\n className?: string,\n) {\n return cx(\n 'ds-text',\n block,\n size && `ds-text--size-${size}`,\n weight && `ds-text--weight-${weight}`,\n tone && tone !== 'default' && `ds-text--tone-${tone}`,\n align && `ds-text--align-${align}`,\n truncate ? 'ds-text--truncate' : false,\n tabular && 'ds-text--tabular',\n preserveBreaks && 'ds-text--preserve-breaks',\n strikethrough && 'ds-text--strikethrough',\n className,\n );\n}\n\nconst MONO_TAGS: ReadonlySet<TextTag> = new Set(['code', 'kbd']);\n\n/**\n * The line count as the private property `text.css` clamps to. Always written\n * when truncating, `1` for `true`: custom properties inherit, so a truncated\n * Text inside a three-line one would otherwise clamp to three.\n */\nfunction truncateStyle(truncate: boolean | number | undefined, style?: CSSProperties) {\n if (!truncate) return style;\n return { '--_text-lines': truncate === true ? 1 : truncate, ...style } as CSSProperties;\n}\n\nexport interface TextProps extends ComponentProps<typeof ark.p>, TextStyleProps {\n /** Element to render. Defaults to `p`. */\n as?: TextTag;\n /**\n * Small-caps label: uppercase, semibold, letter-spaced, for a short word\n * that names the value beside it (\"Target\", \"Rating\"). Reads the product's\n * label tracking; pair it with `size=\"xs\"` or `sm`.\n */\n caps?: boolean;\n}\n\n/**\n * A run of text on the type scale.\n *\n * Body copy, a description, a caption, a label: every piece of text a product\n * writes outside a component with its own text slot. Size, weight and colour\n * come from the `--ds-text-*` contract, so a product tunes its type once in\n * tokens rather than per element. Renders a `p`; pick another tag with `as`,\n * or pass `asChild` to style an element of your own.\n */\nexport function Text({\n as,\n size = 'md',\n weight,\n tone = 'default',\n align,\n truncate,\n tabular,\n preserveBreaks,\n strikethrough,\n caps = false,\n className,\n style,\n children,\n ...props\n}: TextProps) {\n // Every factory member has the same props apart from its element's ref\n // type; the cast settles the union on `p`, the default, which is why `as`\n // is a closed list of plain text elements rather than any tag.\n const Component = (as ? ark[as] : ark.p) as typeof ark.p;\n return (\n <Component\n className={textClasses(\n cx('ds-text--body', caps && 'ds-text--caps', as && MONO_TAGS.has(as) && 'ds-text--mono'),\n {\n size,\n weight: weight ?? (caps ? 'semibold' : undefined),\n tone,\n align,\n truncate,\n tabular,\n preserveBreaks,\n strikethrough,\n },\n className,\n )}\n style={truncateStyle(truncate, style)}\n {...props}\n >\n {children}\n </Component>\n );\n}\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/** The size each level takes when `size` is not given: a plain ramp down the scale. */\nconst HEADING_SIZES: Record<HeadingLevel, TextSize> = {\n 1: '4xl',\n 2: '3xl',\n 3: '2xl',\n 4: 'xl',\n 5: 'lg',\n 6: 'md',\n};\n\nexport interface HeadingProps extends ComponentProps<typeof ark.h2>, TextStyleProps {\n /**\n * The heading element to render, which is its place in the document\n * outline. Pick the level the outline needs, never the level whose default\n * size looks right; `size` changes the look on its own.\n */\n level: HeadingLevel;\n}\n\n/**\n * A heading on the type scale.\n *\n * The level is the outline; the size is the look, and defaults from the\n * level so a page's `h1` is `4xl` and a card's `h3` is `2xl` without a\n * decision. Headings take the heading weight and tight line height from the\n * contract. Pass `asChild` to style a heading element of your own, say one\n * a library renders.\n */\nexport function Heading({\n level,\n size,\n weight,\n tone = 'default',\n align,\n truncate,\n tabular,\n preserveBreaks,\n strikethrough,\n className,\n style,\n children,\n ...props\n}: HeadingProps) {\n const Component = ark[`h${level}`];\n return (\n <Component\n className={textClasses(\n 'ds-text--heading',\n {\n size: size ?? HEADING_SIZES[level],\n weight,\n tone,\n align,\n truncate,\n tabular,\n preserveBreaks,\n strikethrough,\n },\n className,\n )}\n style={truncateStyle(truncate, style)}\n {...props}\n >\n {children}\n </Component>\n );\n}\n"]}
1
+ {"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/text/text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,YAAY,CAAC;AACpB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AA+D3B,SAAS,WAAW,CAClB,KAAa,EACb,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAkB,EAC/F,SAAkB;IAElB,OAAO,EAAE,CACP,SAA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Ae,EAAE,EAAE,IAAI,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,eAAe,CAAC,EACxF;YACE,IAAI;YACJ,MAAM;YACN,IAAI;YACJ,KAAK;YACL,QAAQ;YACR,OAAO;YACP,cAAc;YACd,aAAa;SACd,EACD,SAAS,CACV,EACD,KAAK,EAAE,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,KACjC,KAAK,YAER,QAAQ,GACC,CACb,CAAC;AACJ,CAAC;AAID,uFAAuF;AACvF,MAAM,aAAa,GAAmC;IACpD,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;CACR,CAAC;AAWF;;;;;;;;GAQG;AACH,MAAM,UAAU,OAAO,CAAC,EACtB,KAAK,EACL,IAAI,EACJ,MAAM,EACN,IAAI,GAAG,SAAS,EAChB,KAAK,EACL,QAAQ,EACR,OAAO,EACP,cAAc,EACd,aAAa,EACb,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACK;IACb,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;IACnC,OAAO,CACL,KAAC,SAAS,IACR,SAAS,EAAE,WAAW,CACpB,kBAAkB,EAClB;YACE,IAAI,EAAE,IAAI,IAAI,aAAa,CAAC,KAAK,CAAC;YAClC,MAAM;YACN,IAAI;YACJ,KAAK;YACL,QAAQ;YACR,OAAO;YACP,cAAc;YACd,aAAa;SACd,EACD,SAAS,CACV,EACD,KAAK,EAAE,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,KACjC,KAAK,YAER,QAAQ,GACC,CACb,CAAC;AACJ,CAAC","sourcesContent":["import { ark } from '@ark-ui/react/factory';\nimport type { ComponentProps, CSSProperties } from 'react';\nimport './text.css';\nimport { cx } from '../cx';\n\n/** The type scale's steps, from the 14px floor up. */\nexport type TextSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';\n\nexport type TextWeight = 'regular' | 'medium' | 'semibold' | 'bold';\n\n/**\n * What the text is for, which decides its colour. `default` and `muted` are\n * the two text roles; the four statuses are for a line of text that reports\n * one, such as a validation message or a result; `accent` is the strong\n * primary colour, for a short label the brand lends its colour to.\n */\nexport type TextTone = 'default' | 'muted' | 'success' | 'warning' | 'danger' | 'info' | 'accent';\n\nexport type TextAlign = 'start' | 'center' | 'end';\n\n/**\n * The elements `Text` renders: the ones whose attributes are a paragraph's.\n * Deliberately a union rather than `ElementType`: the implementation indexes\n * the Ark factory, which hands any key to `createElement` as a tag name, so\n * a component reference would be stringified and thrown. An element with\n * attributes of its own (`label` with `htmlFor`, `time` with `dateTime`, an\n * `output`) goes through `asChild`, which keeps that element's own props.\n * `code` and `kbd` take the monospace face.\n */\nexport type TextTag =\n | 'p'\n | 'span'\n | 'div'\n | 'strong'\n | 'em'\n | 'small'\n | 'li'\n | 'dt'\n | 'dd'\n | 'figcaption'\n | 'code'\n | 'kbd';\n\nexport interface TextStyleProps {\n /** Step of the type scale. Defaults to `md`, body text. */\n size?: TextSize;\n /** Font weight. Defaults to the element's own (`regular` for body text). */\n weight?: TextWeight;\n /** Colour by purpose. Defaults to `default`. */\n tone?: TextTone;\n /** Horizontal alignment. Defaults to the writing direction's start. */\n align?: TextAlign;\n /**\n * Clip the text with an ellipsis: `true` after one line, or a number of\n * lines. The text is clipped by its own box rather than kept from wrapping,\n * so a long word still breaks instead of pushing past the edge.\n */\n truncate?: boolean | number;\n /** Digits of equal width, so figures in a column or a count that ticks line up. */\n tabular?: boolean;\n /** Keep the line breaks the text was written with: a description, a reflection, a note. */\n preserveBreaks?: boolean;\n /** A line through the text: a milestone reached, a move no longer on the list. */\n strikethrough?: boolean;\n}\n\nfunction textClasses(\n block: string,\n { size, weight, tone, align, truncate, tabular, preserveBreaks, strikethrough }: TextStyleProps,\n className?: string,\n) {\n return cx(\n 'ds-text',\n block,\n size && `ds-text--size-${size}`,\n weight && `ds-text--weight-${weight}`,\n tone && tone !== 'default' && `ds-text--tone-${tone}`,\n align && `ds-text--align-${align}`,\n truncate ? 'ds-text--truncate' : false,\n tabular && 'ds-text--tabular',\n preserveBreaks && 'ds-text--preserve-breaks',\n strikethrough && 'ds-text--strikethrough',\n className,\n );\n}\n\nconst MONO_TAGS: ReadonlySet<TextTag> = new Set(['code', 'kbd']);\n\n/**\n * The line count as the private property `text.css` clamps to. Always written\n * when truncating, `1` for `true`: custom properties inherit, so a truncated\n * Text inside a three-line one would otherwise clamp to three.\n */\nfunction truncateStyle(truncate: boolean | number | undefined, style?: CSSProperties) {\n if (!truncate) return style;\n return { '--_text-lines': truncate === true ? 1 : truncate, ...style } as CSSProperties;\n}\n\nexport interface TextProps extends ComponentProps<typeof ark.p>, TextStyleProps {\n /** Element to render. Defaults to `p`. */\n as?: TextTag;\n /**\n * Small-caps label: uppercase and letter-spaced, for a short word that\n * names the value beside it (\"Target\", \"Rating\"). Its face, weight and\n * tracking are the product's label style; pair it with `size=\"xs\"` or `sm`.\n */\n caps?: boolean;\n}\n\n/**\n * A run of text on the type scale.\n *\n * Body copy, a description, a caption, a label: every piece of text a product\n * writes outside a component with its own text slot. Size, weight and colour\n * come from the `--ds-text-*` contract, so a product tunes its type once in\n * tokens rather than per element. Renders a `p`; pick another tag with `as`,\n * or pass `asChild` to style an element of your own.\n */\nexport function Text({\n as,\n size = 'md',\n weight,\n tone = 'default',\n align,\n truncate,\n tabular,\n preserveBreaks,\n strikethrough,\n caps = false,\n className,\n style,\n children,\n ...props\n}: TextProps) {\n // Every factory member has the same props apart from its element's ref\n // type; the cast settles the union on `p`, the default, which is why `as`\n // is a closed list of plain text elements rather than any tag.\n const Component = (as ? ark[as] : ark.p) as typeof ark.p;\n return (\n <Component\n className={textClasses(\n cx('ds-text--body', caps && 'ds-text--caps', as && MONO_TAGS.has(as) && 'ds-text--mono'),\n {\n size,\n weight,\n tone,\n align,\n truncate,\n tabular,\n preserveBreaks,\n strikethrough,\n },\n className,\n )}\n style={truncateStyle(truncate, style)}\n {...props}\n >\n {children}\n </Component>\n );\n}\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/** The size each level takes when `size` is not given: a plain ramp down the scale. */\nconst HEADING_SIZES: Record<HeadingLevel, TextSize> = {\n 1: '4xl',\n 2: '3xl',\n 3: '2xl',\n 4: 'xl',\n 5: 'lg',\n 6: 'md',\n};\n\nexport interface HeadingProps extends ComponentProps<typeof ark.h2>, TextStyleProps {\n /**\n * The heading element to render, which is its place in the document\n * outline. Pick the level the outline needs, never the level whose default\n * size looks right; `size` changes the look on its own.\n */\n level: HeadingLevel;\n}\n\n/**\n * A heading on the type scale.\n *\n * The level is the outline; the size is the look, and defaults from the\n * level so a page's `h1` is `4xl` and a card's `h3` is `2xl` without a\n * decision. Headings take the heading weight and tight line height from the\n * contract. Pass `asChild` to style a heading element of your own, say one\n * a library renders.\n */\nexport function Heading({\n level,\n size,\n weight,\n tone = 'default',\n align,\n truncate,\n tabular,\n preserveBreaks,\n strikethrough,\n className,\n style,\n children,\n ...props\n}: HeadingProps) {\n const Component = ark[`h${level}`];\n return (\n <Component\n className={textClasses(\n 'ds-text--heading',\n {\n size: size ?? HEADING_SIZES[level],\n weight,\n tone,\n align,\n truncate,\n tabular,\n preserveBreaks,\n strikethrough,\n },\n className,\n )}\n style={truncateStyle(truncate, style)}\n {...props}\n >\n {children}\n </Component>\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manakind/ui-core",
3
- "version": "0.30.1",
3
+ "version": "0.32.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -396,7 +396,7 @@
396
396
  },
397
397
  "devDependencies": {
398
398
  "@manakind/ds-config": "*",
399
- "@manakind/manuia-tokens": "0.28.0",
399
+ "@manakind/manuia-tokens": "0.30.0",
400
400
  "@testing-library/jest-dom": "^6.9.1",
401
401
  "@testing-library/react": "^16.3.2",
402
402
  "@testing-library/user-event": "^14.6.1",