@manakind/ui-core 0.31.0 → 0.33.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.
@@ -118,6 +118,12 @@
118
118
  color: var(--ds-badge-outline-text);
119
119
  }
120
120
 
121
+ &.ds-badge--neutral {
122
+ background-color: transparent;
123
+ border-color: var(--ds-badge-neutral-border);
124
+ color: var(--ds-badge-neutral-text);
125
+ }
126
+
121
127
  &.ds-badge--info {
122
128
  background-color: var(--ds-badge-info-bg);
123
129
  color: var(--ds-badge-info-text);
@@ -2,7 +2,7 @@ import { ark } from '@ark-ui/react/factory';
2
2
  import type { ComponentProps } from 'react';
3
3
  import { type IconSource } from '../icon';
4
4
  import './badge.css';
5
- export type BadgeVariant = 'solid' | 'muted' | 'outline' | 'info' | 'success' | 'warning' | 'danger';
5
+ export type BadgeVariant = 'solid' | 'muted' | 'outline' | 'neutral' | 'info' | 'success' | 'warning' | 'danger';
6
6
  export type BadgeShape = 'pill' | 'circle';
7
7
  /**
8
8
  * `compact` hides the label, so it may only be used with a glyph to replace it
@@ -30,8 +30,9 @@ type BadgeLook = {
30
30
  * Visual treatment.
31
31
  *
32
32
  * `solid` is the emphatic one — use it sparingly, at most once in a view.
33
- * `muted` and `outline` are the neutral workhorses. `info`, `success`,
34
- * `warning`, and `danger` are tinted status treatments.
33
+ * `muted` and `outline` are the neutral workhorses. `neutral` is
34
+ * outline's edge in the body text colour, for a settled state. `info`,
35
+ * `success`, `warning`, and `danger` are tinted status treatments.
35
36
  */
36
37
  variant?: BadgeVariant;
37
38
  /**
@@ -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,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;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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"]}
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;AAoG3B;;;;;;;;;;;;;;;;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 | 'neutral'\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. `neutral` is\n * outline's edge in the body text colour, for a settled state. `info`,\n * `success`, `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"]}
@@ -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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manakind/ui-core",
3
- "version": "0.31.0",
3
+ "version": "0.33.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.29.0",
399
+ "@manakind/manuia-tokens": "0.31.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",