@manakind/ui-core 0.28.1 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -41,7 +41,7 @@ import '@manakind/ui-core/css/button';
41
41
  import { Button } from '@manakind/ui-core';
42
42
 
43
43
  export function Save() {
44
- return <Button variant="solid">Save</Button>;
44
+ return <Button variant="primary">Save</Button>;
45
45
  }
46
46
  ```
47
47
 
@@ -62,7 +62,7 @@ separately, so an app can load only what it renders.
62
62
  | `@manakind/ui-core/avatar` | `Avatar` + `initialsOf` |
63
63
  | `@manakind/ui-core/badge` | `Badge` |
64
64
  | `@manakind/ui-core/breadcrumb` | `Breadcrumb` |
65
- | `@manakind/ui-core/button` | `Button` + `IconButton` |
65
+ | `@manakind/ui-core/button` | `Button` + `IconButton`; loading retains keyboard focus and blocks activation/form submission |
66
66
  | `@manakind/ui-core/calendar` | `Calendar` |
67
67
  | `@manakind/ui-core/card` | `Card`, `CardHeader`, `CardTitle`, `CardLink`, `CardDescription`, `CardContent`, `CardFooter` |
68
68
  | `@manakind/ui-core/dialog` | `Dialog` + `DialogClose` |
@@ -115,7 +115,8 @@
115
115
  * `aria-disabled` keeps the button in the tab order while it does
116
116
  * nothing, so focus is not dropped from a control that becomes unavailable
117
117
  * while it is focused (the last step of a stepper, a sort that is already
118
- * applied). It looks the same as `disabled`; the consumer guards the click.
118
+ * applied). It looks the same as `disabled`; the consumer guards a manually
119
+ * set state. Loading sets it and guards activation in the component.
119
120
  */
120
121
  &:disabled,
121
122
  &[aria-disabled="true"] {
@@ -123,6 +124,11 @@
123
124
  cursor: not-allowed;
124
125
  }
125
126
 
127
+ /* Element opacity would also fade the focus ring below its measured contrast. */
128
+ &[aria-disabled="true"]:focus-visible {
129
+ opacity: initial;
130
+ }
131
+
126
132
  &.ds-button--loading {
127
133
  position: relative;
128
134
  color: transparent;
@@ -38,7 +38,7 @@ interface ButtonOwnProps {
38
38
  type ArkButtonProps = Omit<ComponentProps<typeof ark.button>, 'asChild'>;
39
39
  interface ButtonAsButtonProps extends ButtonOwnProps, ArkButtonProps {
40
40
  asChild?: false;
41
- /** Show loading spinner and disable interaction. */
41
+ /** Show a spinner and block activation while keeping keyboard focus. */
42
42
  loading?: boolean;
43
43
  }
44
44
  /**
@@ -73,13 +73,15 @@ export type ButtonProps = ButtonAsButtonProps | ButtonAsChildProps;
73
73
  /**
74
74
  * Shared base button for the Manakind design system.
75
75
  *
76
- * Built on Ark UI for keyboard navigation, focus management, and disabled
77
- * state handling. Styled exclusively against the `--ds-button-*` token
76
+ * Uses Ark UI's element factory and native button keyboard behavior, with
77
+ * loading interaction handled here. Styled against the `--ds-*` token
78
78
  * contract; the consuming product is responsible for providing those values
79
79
  * via its tokens package (e.g. `@manakind/manuia-tokens/css/theme`).
80
80
  *
81
81
  * For an icon-only button (no visible label), use `IconButton` instead —
82
82
  * it enforces an `aria-label` at the type level.
83
+ * Loading uses `aria-disabled` and `aria-busy` with blocked activation so focus
84
+ * stays on the control. An explicit `disabled` still uses native disabling.
83
85
  *
84
86
  * For an action that navigates, pass `asChild` and a link as the only child.
85
87
  * The link is what renders, so it keeps what a link does: open in a new tab,
@@ -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,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,cAAc,CAAC;AAGtB,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,CAAC;AAC5E,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,UAAU,cAAc;IACtB,4BAA4B;IAC5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,6 +4,7 @@ import { cloneElement, Fragment, isValidElement, } from 'react';
4
4
  import { Icon } from '../icon/icon';
5
5
  import './button.css';
6
6
  import { cx } from '../cx';
7
+ import { guardLoadingClick, guardLoadingKey } from './loading-interaction';
7
8
  function ButtonContent({ loading, leadingIcon, trailingIcon, children }) {
8
9
  return (_jsxs(_Fragment, { children: [loading && _jsx("span", { className: "ds-button__spinner", "aria-hidden": "true" }), leadingIcon && (_jsx(Icon, { source: leadingIcon, size: "sm", decorative: true, className: "ds-button__icon ds-button__icon--leading" })), _jsx("span", { className: "ds-button__label", children: children }), trailingIcon && (_jsx(Icon, { source: trailingIcon, size: "sm", decorative: true, className: "ds-button__icon ds-button__icon--trailing" }))] }));
9
10
  }
@@ -19,19 +20,21 @@ function ButtonAsChild({ variant, size, fullWidth, align, leadingIcon, trailingI
19
20
  className: cx(classesFor({ variant, size, fullWidth, align }, className), children.props.className),
20
21
  }, content);
21
22
  }
22
- function ButtonAsButton({ variant, size, fullWidth, align, loading = false, disabled, leadingIcon, trailingIcon, className, children, ...props }) {
23
- return (_jsx(ark.button, { disabled: disabled || loading, className: cx(classesFor({ variant, size, fullWidth, align }, className), loading && 'ds-button--loading'), ...props, children: _jsx(ButtonContent, { loading: loading, leadingIcon: leadingIcon, trailingIcon: trailingIcon, children: children }) }));
23
+ function ButtonAsButton({ variant, size, fullWidth, align, loading = false, disabled, onClickCapture, onKeyDownCapture, onKeyUpCapture, leadingIcon, trailingIcon, className, children, ...props }) {
24
+ return (_jsx(ark.button, { className: cx(classesFor({ variant, size, fullWidth, align }, className), loading && 'ds-button--loading'), ...props, disabled: disabled, "aria-disabled": loading || props['aria-disabled'], "aria-busy": loading || props['aria-busy'], onClickCapture: guardLoadingClick(loading, onClickCapture), onKeyDownCapture: guardLoadingKey(loading, props['aria-haspopup'], onKeyDownCapture), onKeyUpCapture: guardLoadingKey(loading, props['aria-haspopup'], onKeyUpCapture), children: _jsx(ButtonContent, { loading: loading, leadingIcon: leadingIcon, trailingIcon: trailingIcon, children: children }) }));
24
25
  }
25
26
  /**
26
27
  * Shared base button for the Manakind design system.
27
28
  *
28
- * Built on Ark UI for keyboard navigation, focus management, and disabled
29
- * state handling. Styled exclusively against the `--ds-button-*` token
29
+ * Uses Ark UI's element factory and native button keyboard behavior, with
30
+ * loading interaction handled here. Styled against the `--ds-*` token
30
31
  * contract; the consuming product is responsible for providing those values
31
32
  * via its tokens package (e.g. `@manakind/manuia-tokens/css/theme`).
32
33
  *
33
34
  * For an icon-only button (no visible label), use `IconButton` instead —
34
35
  * it enforces an `aria-label` at the type level.
36
+ * Loading uses `aria-disabled` and `aria-busy` with blocked activation so focus
37
+ * stays on the control. An explicit `disabled` still uses native disabling.
35
38
  *
36
39
  * For an action that navigates, pass `asChild` and a link as the only child.
37
40
  * The link is what renders, so it keeps what a link does: open in a new tab,
@@ -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;AA8E3B,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,EAAC,IAAI,EACT,UAAU,QACV,SAAS,EAAC,0CAA0C,GACpD,CACH,EACD,eAAM,SAAS,EAAC,kBAAkB,YAAE,QAAQ,GAAQ,EACnD,YAAY,IAAI,CACf,KAAC,IAAI,IACH,MAAM,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X,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACY;IACpB,OAAO,CACL,KAAC,GAAG,CAAC,MAAM,IACT,QAAQ,EAAE,QAAQ,IAAI,OAAO,EAC7B,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,YAET,KAAC,aAAa,IAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,YAClF,QAAQ,GACK,GACL,CACd,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;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';\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 loading spinner and disable interaction. */\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 leadingIcon,\n trailingIcon,\n className,\n children,\n ...props\n}: ButtonAsButtonProps) {\n return (\n <ark.button\n disabled={disabled || loading}\n className={cx(\n classesFor({ variant, size, fullWidth, align }, className),\n loading && 'ds-button--loading',\n )}\n {...props}\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 * Built on Ark UI for keyboard navigation, focus management, and disabled\n * state handling. Styled exclusively against the `--ds-button-*` 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 *\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,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,EAAC,IAAI,EACT,UAAU,QACV,SAAS,EAAC,0CAA0C,GACpD,CACH,EACD,eAAM,SAAS,EAAC,kBAAkB,YAAE,QAAQ,GAAQ,EACnD,YAAY,IAAI,CACf,KAAC,IAAI,IACH,MAAM,EAAE,YAAY,EACpB,IAAI,EAAC,IAAI,EACT,UAAU,QACV,SAAS,EAAC,2CAA2C,GACrD,CACH,IACA,CACJ,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CACjB,EAAE,OAAO,GAAG,SAAS,EAAE,IAAI,GAAG,IAAI,EAAE,SAAS,GAAG,KAAK,EAAE,KAAK,GAAG,QAAQ,EAAkB,EACzF,SAAkB;IAElB,OAAO,EAAE,CACP,WAAW,EACX,cAAc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,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"]}
@@ -20,7 +20,7 @@ export interface IconButtonProps extends Omit<ComponentProps<typeof ark.button>,
20
20
  * same size from `md` up.
21
21
  */
22
22
  size?: ButtonSize;
23
- /** Show loading spinner and disable interaction. */
23
+ /** Show a spinner and block activation while keeping keyboard focus. */
24
24
  loading?: boolean;
25
25
  /**
26
26
  * The caption shown on hover and keyboard focus. Defaults to `aria-label`;
@@ -39,6 +39,8 @@ export interface IconButtonProps extends Omit<ComponentProps<typeof ark.button>,
39
39
  * is that `aria-label` is required at the type level — an icon-only
40
40
  * button has no visible text to derive an accessible name from — and that
41
41
  * it shows that name as a tooltip, since the glyph alone may not say it.
42
+ * Loading keeps keyboard focus with `aria-disabled` and `aria-busy`, blocking
43
+ * activation; an explicit `disabled` still uses native disabling.
42
44
  */
43
- export declare function IconButton({ icon, variant, size, loading, disabled, className, tooltip, ...props }: IconButtonProps): import("react/jsx-runtime").JSX.Element;
45
+ export declare function IconButton({ icon, variant, size, loading, disabled, onClickCapture, onKeyDownCapture, onKeyUpCapture, className, tooltip, ...props }: IconButtonProps): import("react/jsx-runtime").JSX.Element;
44
46
  //# sourceMappingURL=icon-button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../src/button/icon-button.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,cAAc,CAAC;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,cAAc,CAAC;AAGtB,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC;IAChG,kDAAkD;IAClD,IAAI,EAAE,UAAU,CAAC;IACjB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,OAAmB,EACnB,IAAW,EACX,OAAe,EACf,QAAQ,EACR,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACT,EAAE,eAAe,2CAoBjB"}
1
+ {"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../src/button/icon-button.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,cAAc,CAAC;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,cAAc,CAAC;AAItB,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC;IAChG,kDAAkD;IAClD,IAAI,EAAE,UAAU,CAAC;IACjB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,wEAAwE;IACxE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,OAAmB,EACnB,IAAW,EACX,OAAe,EACf,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACT,EAAE,eAAe,2CAyBjB"}
@@ -4,6 +4,7 @@ import { Icon } from '../icon/icon';
4
4
  import { Tooltip } from '../tooltip/tooltip';
5
5
  import './button.css';
6
6
  import { cx } from '../cx';
7
+ import { guardLoadingClick, guardLoadingKey } from './loading-interaction';
7
8
  /**
8
9
  * Square, icon-only button for the Manakind design system.
9
10
  *
@@ -13,8 +14,10 @@ import { cx } from '../cx';
13
14
  * is that `aria-label` is required at the type level — an icon-only
14
15
  * button has no visible text to derive an accessible name from — and that
15
16
  * it shows that name as a tooltip, since the glyph alone may not say it.
17
+ * Loading keeps keyboard focus with `aria-disabled` and `aria-busy`, blocking
18
+ * activation; an explicit `disabled` still uses native disabling.
16
19
  */
17
- export function IconButton({ icon, variant = 'primary', size = 'md', loading = false, disabled, className, tooltip, ...props }) {
18
- return (_jsx(Tooltip, { content: tooltip ?? props['aria-label'], kind: "label", children: _jsxs(ark.button, { disabled: disabled || loading, className: cx('ds-button', 'ds-button--icon-only', `ds-button--${variant}`, `ds-button--${size}`, loading && 'ds-button--loading', className), ...props, children: [loading && _jsx("span", { className: "ds-button__spinner", "aria-hidden": "true" }), _jsx(Icon, { source: icon, size: size, decorative: true, className: "ds-button__icon" })] }) }));
20
+ export function IconButton({ icon, variant = 'primary', size = 'md', loading = false, disabled, onClickCapture, onKeyDownCapture, onKeyUpCapture, className, tooltip, ...props }) {
21
+ return (_jsx(Tooltip, { content: tooltip ?? props['aria-label'], kind: "label", children: _jsxs(ark.button, { className: cx('ds-button', 'ds-button--icon-only', `ds-button--${variant}`, `ds-button--${size}`, loading && 'ds-button--loading', className), ...props, disabled: disabled, "aria-disabled": loading || props['aria-disabled'], "aria-busy": loading || props['aria-busy'], onClickCapture: guardLoadingClick(loading, onClickCapture), onKeyDownCapture: guardLoadingKey(loading, props['aria-haspopup'], onKeyDownCapture), onKeyUpCapture: guardLoadingKey(loading, props['aria-haspopup'], onKeyUpCapture), children: [loading && _jsx("span", { className: "ds-button__spinner", "aria-hidden": "true" }), _jsx(Icon, { source: icon, size: size, decorative: true, className: "ds-button__icon" })] }) }));
19
22
  }
20
23
  //# sourceMappingURL=icon-button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"icon-button.js","sourceRoot":"","sources":["../../src/button/icon-button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AA+B3B;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,IAAI,EACJ,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,IAAI,EACX,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACQ;IAChB,OAAO,CACL,KAAC,OAAO,IAAC,OAAO,EAAE,OAAO,IAAI,KAAK,CAAC,YAAY,CAAC,EAAE,IAAI,EAAC,OAAO,YAC5D,MAAC,GAAG,CAAC,MAAM,IACT,QAAQ,EAAE,QAAQ,IAAI,OAAO,EAC7B,SAAS,EAAE,EAAE,CACX,WAAW,EACX,sBAAsB,EACtB,cAAc,OAAO,EAAE,EACvB,cAAc,IAAI,EAAE,EACpB,OAAO,IAAI,oBAAoB,EAC/B,SAAS,CACV,KACG,KAAK,aAER,OAAO,IAAI,eAAM,SAAS,EAAC,oBAAoB,iBAAa,MAAM,GAAG,EACtE,KAAC,IAAI,IAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,QAAC,SAAS,EAAC,iBAAiB,GAAG,IAC9D,GACL,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { ark } from '@ark-ui/react/factory';\nimport type { ComponentProps } from 'react';\nimport { Icon, type IconSource } from '../icon/icon';\nimport { Tooltip } from '../tooltip/tooltip';\nimport type { ButtonSize, ButtonVariant } from './button';\nimport './button.css';\nimport { cx } from '../cx';\n\nexport interface IconButtonProps\n extends Omit<ComponentProps<typeof ark.button>, 'children' | 'aria-label' | 'asChild' | 'title'> {\n /** Decorative icon rendered inside the button. */\n icon: IconSource;\n /**\n * Accessible label announced by assistive tech. Required because the\n * button has no visible text content to derive a name from.\n */\n 'aria-label': string;\n /** Visual style variant. Shared with {@link Button}. */\n variant?: ButtonVariant;\n /**\n * Size preset. The icon is the label, so it takes the icon scale's step of\n * the same name (16 / 24 / 32px) and the circle keeps the same inset around\n * it (32 / 40 / 48px). The circle is taller than a text `Button` of the\n * same size from `md` up.\n */\n size?: ButtonSize;\n /** Show loading spinner and disable interaction. */\n loading?: boolean;\n /**\n * The caption shown on hover and keyboard focus. Defaults to `aria-label`;\n * pass a shorter one when the label carries the item's name for a screen\n * reader (\"Edit Run 10k\") and the caption only needs the verb (\"Edit\").\n * There is no `title`: the browser's own caption would show beside this one.\n */\n tooltip?: string;\n}\n\n/**\n * Square, icon-only button for the Manakind design system.\n *\n * Shares the full visual contract with `Button` (same variants, sizes,\n * focus ring, disabled + loading behavior) by reusing the `ds-button`\n * class plus a `ds-button--icon-only` modifier. The only API difference\n * is that `aria-label` is required at the type level — an icon-only\n * button has no visible text to derive an accessible name from — and that\n * it shows that name as a tooltip, since the glyph alone may not say it.\n */\nexport function IconButton({\n icon,\n variant = 'primary',\n size = 'md',\n loading = false,\n disabled,\n className,\n tooltip,\n ...props\n}: IconButtonProps) {\n return (\n <Tooltip content={tooltip ?? props['aria-label']} kind=\"label\">\n <ark.button\n disabled={disabled || loading}\n className={cx(\n 'ds-button',\n 'ds-button--icon-only',\n `ds-button--${variant}`,\n `ds-button--${size}`,\n loading && 'ds-button--loading',\n className,\n )}\n {...props}\n >\n {loading && <span className=\"ds-button__spinner\" aria-hidden=\"true\" />}\n <Icon source={icon} size={size} decorative className=\"ds-button__icon\" />\n </ark.button>\n </Tooltip>\n );\n}\n"]}
1
+ {"version":3,"file":"icon-button.js","sourceRoot":"","sources":["../../src/button/icon-button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA+B3E;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,IAAI,EACJ,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,IAAI,EACX,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACQ;IAChB,OAAO,CACL,KAAC,OAAO,IAAC,OAAO,EAAE,OAAO,IAAI,KAAK,CAAC,YAAY,CAAC,EAAE,IAAI,EAAC,OAAO,YAC5D,MAAC,GAAG,CAAC,MAAM,IACT,SAAS,EAAE,EAAE,CACX,WAAW,EACX,sBAAsB,EACtB,cAAc,OAAO,EAAE,EACvB,cAAc,IAAI,EAAE,EACpB,OAAO,IAAI,oBAAoB,EAC/B,SAAS,CACV,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,aAE/E,OAAO,IAAI,eAAM,SAAS,EAAC,oBAAoB,iBAAa,MAAM,GAAG,EACtE,KAAC,IAAI,IAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,QAAC,SAAS,EAAC,iBAAiB,GAAG,IAC9D,GACL,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { ark } from '@ark-ui/react/factory';\nimport type { ComponentProps } from 'react';\nimport { Icon, type IconSource } from '../icon/icon';\nimport { Tooltip } from '../tooltip/tooltip';\nimport type { ButtonSize, ButtonVariant } from './button';\nimport './button.css';\nimport { cx } from '../cx';\nimport { guardLoadingClick, guardLoadingKey } from './loading-interaction';\n\nexport interface IconButtonProps\n extends Omit<ComponentProps<typeof ark.button>, 'children' | 'aria-label' | 'asChild' | 'title'> {\n /** Decorative icon rendered inside the button. */\n icon: IconSource;\n /**\n * Accessible label announced by assistive tech. Required because the\n * button has no visible text content to derive a name from.\n */\n 'aria-label': string;\n /** Visual style variant. Shared with {@link Button}. */\n variant?: ButtonVariant;\n /**\n * Size preset. The icon is the label, so it takes the icon scale's step of\n * the same name (16 / 24 / 32px) and the circle keeps the same inset around\n * it (32 / 40 / 48px). The circle is taller than a text `Button` of the\n * same size from `md` up.\n */\n size?: ButtonSize;\n /** Show a spinner and block activation while keeping keyboard focus. */\n loading?: boolean;\n /**\n * The caption shown on hover and keyboard focus. Defaults to `aria-label`;\n * pass a shorter one when the label carries the item's name for a screen\n * reader (\"Edit Run 10k\") and the caption only needs the verb (\"Edit\").\n * There is no `title`: the browser's own caption would show beside this one.\n */\n tooltip?: string;\n}\n\n/**\n * Square, icon-only button for the Manakind design system.\n *\n * Shares the full visual contract with `Button` (same variants, sizes,\n * focus ring, disabled + loading behavior) by reusing the `ds-button`\n * class plus a `ds-button--icon-only` modifier. The only API difference\n * is that `aria-label` is required at the type level — an icon-only\n * button has no visible text to derive an accessible name from — and that\n * it shows that name as a tooltip, since the glyph alone may not say it.\n * Loading keeps keyboard focus with `aria-disabled` and `aria-busy`, blocking\n * activation; an explicit `disabled` still uses native disabling.\n */\nexport function IconButton({\n icon,\n variant = 'primary',\n size = 'md',\n loading = false,\n disabled,\n onClickCapture,\n onKeyDownCapture,\n onKeyUpCapture,\n className,\n tooltip,\n ...props\n}: IconButtonProps) {\n return (\n <Tooltip content={tooltip ?? props['aria-label']} kind=\"label\">\n <ark.button\n className={cx(\n 'ds-button',\n 'ds-button--icon-only',\n `ds-button--${variant}`,\n `ds-button--${size}`,\n loading && 'ds-button--loading',\n className,\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 {loading && <span className=\"ds-button__spinner\" aria-hidden=\"true\" />}\n <Icon source={icon} size={size} decorative className=\"ds-button__icon\" />\n </ark.button>\n </Tooltip>\n );\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import type { AriaAttributes, KeyboardEventHandler, MouseEventHandler } from 'react';
2
+ /** Stop activation in capture, before consumer click handlers and the form's default action. */
3
+ export declare function guardLoadingClick(loading: boolean, handler: MouseEventHandler<HTMLButtonElement> | undefined): MouseEventHandler<HTMLButtonElement> | undefined;
4
+ /** Cancel activation before composed triggers dispatch their keyboard actions. */
5
+ export declare function guardLoadingKey(loading: boolean, popup: AriaAttributes['aria-haspopup'], handler: KeyboardEventHandler<HTMLButtonElement> | undefined): KeyboardEventHandler<HTMLButtonElement> | undefined;
6
+ //# sourceMappingURL=loading-interaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loading-interaction.d.ts","sourceRoot":"","sources":["../../src/button/loading-interaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAErF,gGAAgG;AAChG,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,SAAS,GACxD,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAMlD;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,cAAc,CAAC,eAAe,CAAC,EACtC,OAAO,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,GAAG,SAAS,GAC3D,oBAAoB,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAerD"}
@@ -0,0 +1,26 @@
1
+ /** Stop activation in capture, before consumer click handlers and the form's default action. */
2
+ export function guardLoadingClick(loading, handler) {
3
+ if (!loading)
4
+ return handler;
5
+ return (event) => {
6
+ event.preventDefault();
7
+ event.stopPropagation();
8
+ };
9
+ }
10
+ /** Cancel activation before composed triggers dispatch their keyboard actions. */
11
+ export function guardLoadingKey(loading, popup, handler) {
12
+ if (!loading)
13
+ return handler;
14
+ const hasPopup = Boolean(popup && popup !== 'false');
15
+ return (event) => {
16
+ if (event.key === 'Enter' ||
17
+ event.key === ' ' ||
18
+ (hasPopup && (event.key === 'ArrowDown' || event.key === 'ArrowUp'))) {
19
+ event.preventDefault();
20
+ event.stopPropagation();
21
+ return;
22
+ }
23
+ handler?.(event);
24
+ };
25
+ }
26
+ //# sourceMappingURL=loading-interaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loading-interaction.js","sourceRoot":"","sources":["../../src/button/loading-interaction.ts"],"names":[],"mappings":"AAEA,gGAAgG;AAChG,MAAM,UAAU,iBAAiB,CAC/B,OAAgB,EAChB,OAAyD;IAEzD,IAAI,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC;IAC7B,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,KAAK,CAAC,eAAe,EAAE,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,eAAe,CAC7B,OAAgB,EAChB,KAAsC,EACtC,OAA4D;IAE5D,IAAI,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC;IAC7B,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,KAAK,OAAO,CAAC,CAAC;IACrD,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,IACE,KAAK,CAAC,GAAG,KAAK,OAAO;YACrB,KAAK,CAAC,GAAG,KAAK,GAAG;YACjB,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,WAAW,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,EACpE,CAAC;YACD,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC,eAAe,EAAE,CAAC;YACxB,OAAO;QACT,CAAC;QACD,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { AriaAttributes, KeyboardEventHandler, MouseEventHandler } from 'react';\n\n/** Stop activation in capture, before consumer click handlers and the form's default action. */\nexport function guardLoadingClick(\n loading: boolean,\n handler: MouseEventHandler<HTMLButtonElement> | undefined,\n): MouseEventHandler<HTMLButtonElement> | undefined {\n if (!loading) return handler;\n return (event) => {\n event.preventDefault();\n event.stopPropagation();\n };\n}\n\n/** Cancel activation before composed triggers dispatch their keyboard actions. */\nexport function guardLoadingKey(\n loading: boolean,\n popup: AriaAttributes['aria-haspopup'],\n handler: KeyboardEventHandler<HTMLButtonElement> | undefined,\n): KeyboardEventHandler<HTMLButtonElement> | undefined {\n if (!loading) return handler;\n const hasPopup = Boolean(popup && popup !== 'false');\n return (event) => {\n if (\n event.key === 'Enter' ||\n event.key === ' ' ||\n (hasPopup && (event.key === 'ArrowDown' || event.key === 'ArrowUp'))\n ) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n handler?.(event);\n };\n}\n"]}
@@ -24,6 +24,16 @@
24
24
  bottom: var(--_sticky-inset);
25
25
  }
26
26
 
27
+ /*
28
+ * The app's header fills the inset the chrome's offset keeps clear of,
29
+ * so a bar or a side panel under it starts where it ends.
30
+ */
31
+ &.ds-sticky--header {
32
+ display: grid;
33
+ align-content: center;
34
+ min-block-size: var(--ds-sticky-offset-top);
35
+ }
36
+
27
37
  &.ds-sticky--top.ds-sticky--offset {
28
38
  --_sticky-inset: var(--ds-sticky-offset-top);
29
39
  }
@@ -30,6 +30,12 @@ export interface StickyProps extends ComponentProps<typeof ark.div> {
30
30
  scroll?: boolean;
31
31
  /** What it paints behind itself. Defaults to `none`. */
32
32
  surface?: StickySurface;
33
+ /**
34
+ * The app's header itself: at least as tall as `--ds-sticky-offset-top`,
35
+ * where every offset bar and side panel under it starts, with its content
36
+ * centred in that height. Takes no `offset`.
37
+ */
38
+ header?: boolean;
33
39
  }
34
40
  /**
35
41
  * An element that holds to an edge of the viewport while the page scrolls
@@ -41,7 +47,7 @@ export interface StickyProps extends ComponentProps<typeof ark.div> {
41
47
  * settles into its own place when the page ends, with nothing to clear.
42
48
  * Sits on the `sticky` stacking layer, above the page's raised controls
43
49
  * and below every overlay. Renders a `div`; pass `asChild` to stick your
44
- * own element (`<Sticky asChild><header>…</header></Sticky>`).
50
+ * own element (`<Sticky asChild header><header>…</header></Sticky>`).
45
51
  */
46
- export declare function Sticky({ edge, offset, from, scroll, surface, className, children, ...props }: StickyProps): import("react/jsx-runtime").JSX.Element;
52
+ export declare function Sticky({ edge, offset, from, scroll, surface, header, className, children, ...props }: StickyProps): import("react/jsx-runtime").JSX.Element;
47
53
  //# sourceMappingURL=sticky.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sticky.d.ts","sourceRoot":"","sources":["../../src/sticky/sticky.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,kFAAkF;AAClF,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzD,MAAM,WAAW,WAAY,SAAQ,cAAc,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC;IACjE,+CAA+C;IAC/C,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qFAAqF;IACrF,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;OAGG;IACH,MAAM,CAA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AW,2CAkBb"}
@@ -12,9 +12,9 @@ import { cx } from '../cx';
12
12
  * settles into its own place when the page ends, with nothing to clear.
13
13
  * Sits on the `sticky` stacking layer, above the page's raised controls
14
14
  * and below every overlay. Renders a `div`; pass `asChild` to stick your
15
- * own element (`<Sticky asChild><header>…</header></Sticky>`).
15
+ * own element (`<Sticky asChild header><header>…</header></Sticky>`).
16
16
  */
17
- export function Sticky({ edge = 'top', offset = false, from, scroll = false, surface = 'none', className, children, ...props }) {
18
- return (_jsx(ark.div, { className: cx('ds-sticky', `ds-sticky--${edge}`, offset && 'ds-sticky--offset', from && `ds-sticky--from-${from}`, scroll && 'ds-sticky--scroll', surface !== 'none' && `ds-sticky--surface-${surface}`, className), ...props, children: children }));
17
+ export function Sticky({ edge = 'top', offset = false, from, scroll = false, surface = 'none', header = false, className, children, ...props }) {
18
+ return (_jsx(ark.div, { className: cx('ds-sticky', `ds-sticky--${edge}`, offset && 'ds-sticky--offset', from && `ds-sticky--from-${from}`, scroll && 'ds-sticky--scroll', surface !== 'none' && `ds-sticky--surface-${surface}`, header && 'ds-sticky--header', className), ...props, children: children }));
19
19
  }
20
20
  //# sourceMappingURL=sticky.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sticky.js","sourceRoot":"","sources":["../../src/sticky/sticky.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAmC3B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,MAAM,CAAC,EACrB,IAAI,GAAG,KAAK,EACZ,MAAM,GAAG,KAAK,EACd,IAAI,EACJ,MAAM,GAAG,KAAK,EACd,OAAO,GAAG,MAAM,EAChB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACI;IACZ,OAAO,CACL,KAAC,GAAG,CAAC,GAAG,IACN,SAAS,EAAE,EAAE,CACX,WAAW,EACX,cAAc,IAAI,EAAE,EACpB,MAAM,IAAI,mBAAmB,EAC7B,IAAI,IAAI,mBAAmB,IAAI,EAAE,EACjC,MAAM,IAAI,mBAAmB,EAC7B,OAAO,KAAK,MAAM,IAAI,sBAAsB,OAAO,EAAE,EACrD,SAAS,CACV,KACG,KAAK,YAER,QAAQ,GACD,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { ark } from '@ark-ui/react/factory';\nimport type { ComponentProps } from 'react';\nimport './sticky.css';\nimport { cx } from '../cx';\nimport type { Breakpoint } from '../layout/layout';\n\n/** The viewport edge a sticky element holds to while the page scrolls past it. */\nexport type StickyEdge = 'top' | 'bottom';\n\n/**\n * What a sticky element paints behind itself. `none` leaves the children\n * to draw their own surface (a card); `canvas` paints the page's canvas so\n * content scrolling under it is covered, with the bar's block inset;\n * `raised` is the chrome's surface with a hairline and shadow on the side\n * facing the page.\n */\nexport type StickySurface = 'none' | 'canvas' | 'raised';\n\nexport interface StickyProps extends ComponentProps<typeof ark.div> {\n /** The edge it holds to. Defaults to `top`. */\n edge?: StickyEdge;\n /**\n * Keep clear of the app's chrome: under the header at the top\n * (`--ds-sticky-offset-top`), above the viewport's edge at the bottom\n * (`--ds-sticky-offset-bottom`). Off by default, for the header itself.\n */\n offset?: boolean;\n /** Stick only from this viewport step up; stay in the flow on narrower viewports. */\n from?: Breakpoint;\n /**\n * Scroll inside its own box when taller than the room it holds, instead\n * of pushing past the viewport: a pinned aside longer than the screen.\n */\n scroll?: boolean;\n /** What it paints behind itself. Defaults to `none`. */\n surface?: StickySurface;\n}\n\n/**\n * An element that holds to an edge of the viewport while the page scrolls\n * past it: the app's header, a filter row under it, a bar of bulk actions\n * at the foot of a list, an aside pinned beside a long form.\n *\n * Sticky, never fixed, so it stays in the page's flow and column: a bottom\n * bar at the end of a page floats above the rows while they scroll and\n * settles into its own place when the page ends, with nothing to clear.\n * Sits on the `sticky` stacking layer, above the page's raised controls\n * and below every overlay. Renders a `div`; pass `asChild` to stick your\n * own element (`<Sticky asChild><header>…</header></Sticky>`).\n */\nexport function Sticky({\n edge = 'top',\n offset = false,\n from,\n scroll = false,\n surface = 'none',\n className,\n children,\n ...props\n}: StickyProps) {\n return (\n <ark.div\n className={cx(\n 'ds-sticky',\n `ds-sticky--${edge}`,\n offset && 'ds-sticky--offset',\n from && `ds-sticky--from-${from}`,\n scroll && 'ds-sticky--scroll',\n surface !== 'none' && `ds-sticky--surface-${surface}`,\n className,\n )}\n {...props}\n >\n {children}\n </ark.div>\n );\n}\n"]}
1
+ {"version":3,"file":"sticky.js","sourceRoot":"","sources":["../../src/sticky/sticky.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAyC3B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,MAAM,CAAC,EACrB,IAAI,GAAG,KAAK,EACZ,MAAM,GAAG,KAAK,EACd,IAAI,EACJ,MAAM,GAAG,KAAK,EACd,OAAO,GAAG,MAAM,EAChB,MAAM,GAAG,KAAK,EACd,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACI;IACZ,OAAO,CACL,KAAC,GAAG,CAAC,GAAG,IACN,SAAS,EAAE,EAAE,CACX,WAAW,EACX,cAAc,IAAI,EAAE,EACpB,MAAM,IAAI,mBAAmB,EAC7B,IAAI,IAAI,mBAAmB,IAAI,EAAE,EACjC,MAAM,IAAI,mBAAmB,EAC7B,OAAO,KAAK,MAAM,IAAI,sBAAsB,OAAO,EAAE,EACrD,MAAM,IAAI,mBAAmB,EAC7B,SAAS,CACV,KACG,KAAK,YAER,QAAQ,GACD,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { ark } from '@ark-ui/react/factory';\nimport type { ComponentProps } from 'react';\nimport './sticky.css';\nimport { cx } from '../cx';\nimport type { Breakpoint } from '../layout/layout';\n\n/** The viewport edge a sticky element holds to while the page scrolls past it. */\nexport type StickyEdge = 'top' | 'bottom';\n\n/**\n * What a sticky element paints behind itself. `none` leaves the children\n * to draw their own surface (a card); `canvas` paints the page's canvas so\n * content scrolling under it is covered, with the bar's block inset;\n * `raised` is the chrome's surface with a hairline and shadow on the side\n * facing the page.\n */\nexport type StickySurface = 'none' | 'canvas' | 'raised';\n\nexport interface StickyProps extends ComponentProps<typeof ark.div> {\n /** The edge it holds to. Defaults to `top`. */\n edge?: StickyEdge;\n /**\n * Keep clear of the app's chrome: under the header at the top\n * (`--ds-sticky-offset-top`), above the viewport's edge at the bottom\n * (`--ds-sticky-offset-bottom`). Off by default, for the header itself.\n */\n offset?: boolean;\n /** Stick only from this viewport step up; stay in the flow on narrower viewports. */\n from?: Breakpoint;\n /**\n * Scroll inside its own box when taller than the room it holds, instead\n * of pushing past the viewport: a pinned aside longer than the screen.\n */\n scroll?: boolean;\n /** What it paints behind itself. Defaults to `none`. */\n surface?: StickySurface;\n /**\n * The app's header itself: at least as tall as `--ds-sticky-offset-top`,\n * where every offset bar and side panel under it starts, with its content\n * centred in that height. Takes no `offset`.\n */\n header?: boolean;\n}\n\n/**\n * An element that holds to an edge of the viewport while the page scrolls\n * past it: the app's header, a filter row under it, a bar of bulk actions\n * at the foot of a list, an aside pinned beside a long form.\n *\n * Sticky, never fixed, so it stays in the page's flow and column: a bottom\n * bar at the end of a page floats above the rows while they scroll and\n * settles into its own place when the page ends, with nothing to clear.\n * Sits on the `sticky` stacking layer, above the page's raised controls\n * and below every overlay. Renders a `div`; pass `asChild` to stick your\n * own element (`<Sticky asChild header><header>…</header></Sticky>`).\n */\nexport function Sticky({\n edge = 'top',\n offset = false,\n from,\n scroll = false,\n surface = 'none',\n header = false,\n className,\n children,\n ...props\n}: StickyProps) {\n return (\n <ark.div\n className={cx(\n 'ds-sticky',\n `ds-sticky--${edge}`,\n offset && 'ds-sticky--offset',\n from && `ds-sticky--from-${from}`,\n scroll && 'ds-sticky--scroll',\n surface !== 'none' && `ds-sticky--surface-${surface}`,\n header && 'ds-sticky--header',\n className,\n )}\n {...props}\n >\n {children}\n </ark.div>\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manakind/ui-core",
3
- "version": "0.28.1",
3
+ "version": "0.29.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {