@manakind/ui-core 0.29.0 → 0.30.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.
Files changed (61) hide show
  1. package/README.md +5 -1
  2. package/dist/accordion/accordion.css +89 -0
  3. package/dist/accordion/accordion.css.d.ts +2 -0
  4. package/dist/accordion/accordion.d.ts +79 -0
  5. package/dist/accordion/accordion.d.ts.map +1 -0
  6. package/dist/accordion/accordion.js +44 -0
  7. package/dist/accordion/accordion.js.map +1 -0
  8. package/dist/accordion/index.d.ts +2 -0
  9. package/dist/accordion/index.d.ts.map +1 -0
  10. package/dist/accordion/index.js +2 -0
  11. package/dist/accordion/index.js.map +1 -0
  12. package/dist/calendar/calendar.d.ts +3 -4
  13. package/dist/calendar/calendar.d.ts.map +1 -1
  14. package/dist/calendar/calendar.js +5 -2
  15. package/dist/calendar/calendar.js.map +1 -1
  16. package/dist/checkbox/checkbox.d.ts +2 -4
  17. package/dist/checkbox/checkbox.d.ts.map +1 -1
  18. package/dist/checkbox/checkbox.js +4 -2
  19. package/dist/checkbox/checkbox.js.map +1 -1
  20. package/dist/combobox/combobox.d.ts +3 -3
  21. package/dist/combobox/combobox.d.ts.map +1 -1
  22. package/dist/combobox/combobox.js +5 -2
  23. package/dist/combobox/combobox.js.map +1 -1
  24. package/dist/dialog/dialog.d.ts +3 -4
  25. package/dist/dialog/dialog.d.ts.map +1 -1
  26. package/dist/dialog/dialog.js +4 -2
  27. package/dist/dialog/dialog.js.map +1 -1
  28. package/dist/fallback-glyphs.js +3 -3
  29. package/dist/fallback-glyphs.js.map +1 -1
  30. package/dist/icon-defaults.d.ts +45 -0
  31. package/dist/icon-defaults.d.ts.map +1 -0
  32. package/dist/icon-defaults.js +43 -0
  33. package/dist/icon-defaults.js.map +1 -0
  34. package/dist/index.d.ts +3 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +3 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/menu/action-menu.d.ts +3 -3
  39. package/dist/menu/action-menu.d.ts.map +1 -1
  40. package/dist/menu/action-menu.js +4 -2
  41. package/dist/menu/action-menu.js.map +1 -1
  42. package/dist/menu/menu.d.ts +5 -7
  43. package/dist/menu/menu.d.ts.map +1 -1
  44. package/dist/menu/menu.js +7 -3
  45. package/dist/menu/menu.js.map +1 -1
  46. package/dist/radio-group/index.d.ts +2 -0
  47. package/dist/radio-group/index.d.ts.map +1 -0
  48. package/dist/radio-group/index.js +2 -0
  49. package/dist/radio-group/index.js.map +1 -0
  50. package/dist/radio-group/radio-group.css +70 -0
  51. package/dist/radio-group/radio-group.css.d.ts +2 -0
  52. package/dist/radio-group/radio-group.d.ts +74 -0
  53. package/dist/radio-group/radio-group.d.ts.map +1 -0
  54. package/dist/radio-group/radio-group.js +57 -0
  55. package/dist/radio-group/radio-group.js.map +1 -0
  56. package/dist/select/select.d.ts +3 -3
  57. package/dist/select/select.d.ts.map +1 -1
  58. package/dist/select/select.js +5 -2
  59. package/dist/select/select.js.map +1 -1
  60. package/dist/sticky/sticky.css +3 -1
  61. package/package.json +18 -2
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,OAAO,EACL,KAAK,IAAI,aAAa,EACtB,WAAW,IAAI,mBAAmB,EAClC,YAAY,IAAI,oBAAoB,EACpC,KAAK,IAAI,aAAa,EACtB,GAAG,IAAI,WAAW,GACnB,MAAM,mBAAmB,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AAEvB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC","sourcesContent":["export * from './alert';\nexport * from './avatar';\nexport * from './badge';\nexport * from './breadcrumb';\nexport * from './button';\nexport * from './calendar';\nexport * from './card';\nexport * from './centered-layout';\nexport * from './checkbox';\nexport * from './combobox';\nexport { cx } from './cx';\nexport * from './date-input';\nexport * from './dialog';\nexport * from './divider';\nexport * from './empty-state';\nexport {\n Check as FallbackCheck,\n ChevronLeft as FallbackChevronLeft,\n ChevronRight as FallbackChevronRight,\n Cross as FallbackCross,\n Pin as FallbackPin,\n} from './fallback-glyphs';\nexport * from './field';\nexport * from './form-layout';\nexport * from './icon';\nexport * from './illustration';\nexport * from './layout';\nexport * from './link';\nexport type { LinkComponentProps } from './link-component';\nexport * from './menu';\nexport * from './page-layout';\nexport * from './popover';\nexport * from './progress';\nexport * from './reorder-control';\nexport * from './scroll-area';\nexport * from './section';\nexport * from './segment-group';\nexport * from './select';\nexport * from './show';\nexport * from './side-panel-layout';\nexport * from './skeleton';\nexport * from './slider';\nexport * from './spinner';\nexport * from './split-layout';\nexport * from './sticky';\nexport * from './switch';\nexport * from './tabs';\nexport * from './text';\nexport * from './tooltip';\nexport * from './visually-hidden';\nexport * from './wizard-layout';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,OAAO,EACL,KAAK,IAAI,aAAa,EACtB,WAAW,IAAI,mBAAmB,EAClC,YAAY,IAAI,oBAAoB,EACpC,KAAK,IAAI,aAAa,EACtB,GAAG,IAAI,WAAW,GACnB,MAAM,mBAAmB,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AAEvB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC","sourcesContent":["export * from './accordion';\nexport * from './alert';\nexport * from './avatar';\nexport * from './badge';\nexport * from './breadcrumb';\nexport * from './button';\nexport * from './calendar';\nexport * from './card';\nexport * from './centered-layout';\nexport * from './checkbox';\nexport * from './combobox';\nexport { cx } from './cx';\nexport * from './date-input';\nexport * from './dialog';\nexport * from './divider';\nexport * from './empty-state';\nexport {\n Check as FallbackCheck,\n ChevronLeft as FallbackChevronLeft,\n ChevronRight as FallbackChevronRight,\n Cross as FallbackCross,\n Pin as FallbackPin,\n} from './fallback-glyphs';\nexport * from './field';\nexport * from './form-layout';\nexport * from './icon';\nexport * from './icon-defaults';\nexport * from './illustration';\nexport * from './layout';\nexport * from './link';\nexport type { LinkComponentProps } from './link-component';\nexport * from './menu';\nexport * from './page-layout';\nexport * from './popover';\nexport * from './progress';\nexport * from './radio-group';\nexport * from './reorder-control';\nexport * from './scroll-area';\nexport * from './section';\nexport * from './segment-group';\nexport * from './select';\nexport * from './show';\nexport * from './side-panel-layout';\nexport * from './skeleton';\nexport * from './slider';\nexport * from './spinner';\nexport * from './split-layout';\nexport * from './sticky';\nexport * from './switch';\nexport * from './tabs';\nexport * from './text';\nexport * from './tooltip';\nexport * from './visually-hidden';\nexport * from './wizard-layout';\n"]}
@@ -73,8 +73,8 @@ export interface ActionMenuProps {
73
73
  */
74
74
  linkComponent?: ElementType<ActionMenuLinkProps>;
75
75
  /**
76
- * Glyph marking the `current` link. Defaults to a plain built-in check so
77
- * `@manakind/ui-core` renders on its own; products pass their own icon.
76
+ * Glyph marking the `current` link. Defaults to the `IconDefaultsProvider`'s
77
+ * `check`, or a plain built-in one.
78
78
  */
79
79
  itemIndicator?: IconSource;
80
80
  /** Controlled open state. Pair with `onOpenChange`. */
@@ -114,5 +114,5 @@ export interface ActionMenuProps {
114
114
  * The popup renders in a portal, at the same `z-index: 60` as Select's
115
115
  * listbox, and is mounted only while open, as `Menu`'s is.
116
116
  */
117
- export declare function ActionMenu({ trigger, items, onSelect, header, footer, linkComponent, itemIndicator, open, onOpenChange, className, }: ActionMenuProps): import("react/jsx-runtime").JSX.Element;
117
+ export declare function ActionMenu({ trigger, items, onSelect, header, footer, linkComponent, itemIndicator: itemIndicatorProp, open, onOpenChange, className, }: ActionMenuProps): import("react/jsx-runtime").JSX.Element;
118
118
  //# sourceMappingURL=action-menu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action-menu.d.ts","sourceRoot":"","sources":["../../src/menu/action-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAsB,MAAM,OAAO,CAAC;AAGhG,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,YAAY,CAAC;AAEpB,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;;OAIG;IACH,IAAI,CAAC,EAAE,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F;IACxF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA4CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,MAAM,EACN,MAAM,EACN,aAAmB,EACnB,aAAa,EAAE,iBAAiB,EAChC,IAAI,EACJ,YAAY,EACZ,SAAS,GACV,EAAE,eAAe,2CAmEjB"}
@@ -3,8 +3,8 @@ import { Menu as ArkMenu } from '@ark-ui/react/menu';
3
3
  import { Portal } from '@ark-ui/react/portal';
4
4
  import { useContext, useRef } from 'react';
5
5
  import { cx } from '../cx';
6
- import { Check } from '../fallback-glyphs';
7
6
  import { Icon } from '../icon/icon';
7
+ import { useIconDefaults } from '../icon-defaults';
8
8
  import { PortalContainerContext } from '../portal-container';
9
9
  import './menu.css';
10
10
  function ActionMenuRow({ item, linkComponent: LinkComponent, itemIndicator }) {
@@ -51,7 +51,9 @@ function ActionMenuRow({ item, linkComponent: LinkComponent, itemIndicator }) {
51
51
  * The popup renders in a portal, at the same `z-index: 60` as Select's
52
52
  * listbox, and is mounted only while open, as `Menu`'s is.
53
53
  */
54
- export function ActionMenu({ trigger, items, onSelect, header, footer, linkComponent = 'a', itemIndicator = Check, open, onOpenChange, className, }) {
54
+ export function ActionMenu({ trigger, items, onSelect, header, footer, linkComponent = 'a', itemIndicator: itemIndicatorProp, open, onOpenChange, className, }) {
55
+ const icons = useIconDefaults();
56
+ const itemIndicator = itemIndicatorProp ?? icons.check;
55
57
  const portalContainer = useContext(PortalContainerContext);
56
58
  const handleSelect = (details) => onSelect?.(details.value);
57
59
  const handleOpenChange = (details) => onOpenChange?.(details.open);
@@ -1 +1 @@
1
- {"version":3,"file":"action-menu.js","sourceRoot":"","sources":["../../src/menu/action-menu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE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G,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAC/B,KAAC,aAAa,IAEZ,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,IAHvB,IAAI,CAAC,KAAK,CAIf,CACH,CAAC,CAAC;IACH,MAAM,IAAI,GACR,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CACrB,IAAI,CACL,CAAC,CAAC,CAAC,CACF,MAAC,OAAO,CAAC,SAAS,eAChB,KAAC,OAAO,CAAC,cAAc,IAAC,SAAS,EAAC,iBAAiB,YAAE,MAAM,GAA0B,EACpF,IAAI,IACa,CACrB,CAAC;IAEJ,OAAO,CACL,MAAC,OAAO,CAAC,IAAI,IACX,SAAS,QACT,aAAa,QACb,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,gBAAgB,EAC9B,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,QAAQ,EAClB,iBAAiB,EAAE,iBAAiB,aAEpC,KAAC,OAAO,CAAC,OAAO,IAAC,OAAO,kBAAE,OAAO,GAAmB,EAEpD,KAAC,MAAM,IAAC,SAAS,EAAE,eAAe,YAChC,KAAC,OAAO,CAAC,UAAU,cACjB,eAAK,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,aAC7C,KAAC,OAAO,CAAC,OAAO,IAAC,SAAS,EAAC,kBAAkB,YAAE,IAAI,GAAmB,EACtE,cAAK,GAAG,EAAE,SAAS,EAAE,SAAS,EAAC,iBAAiB,eAAW,QAAQ,YAChE,MAAM,GACH,IACF,GACa,GACd,IACI,CAChB,CAAC;AACJ,CAAC","sourcesContent":["import { Menu as ArkMenu } from '@ark-ui/react/menu';\nimport { Portal } from '@ark-ui/react/portal';\nimport { type ElementType, type ReactElement, type ReactNode, useContext, useRef } from 'react';\nimport { cx } from '../cx';\nimport { Check } from '../fallback-glyphs';\nimport { Icon, type IconSource } from '../icon/icon';\nimport type { LinkComponentProps } from '../link-component';\nimport { PortalContainerContext } from '../portal-container';\nimport './menu.css';\n\nexport interface ActionMenuItem {\n /** Stable value reported by `onSelect`. */\n value: string;\n /** Text shown in the menu. Also what typeahead matches against. */\n label: string;\n /** Glyph before the label. Decorative: the label says what the item does. */\n icon?: IconSource;\n /**\n * Makes the item a link to this address, rendered through `linkComponent`.\n * Choosing it follows the link, with the keyboard too; `onSelect` still\n * reports its value.\n */\n href?: string;\n /**\n * Marks the link to the page the user is on: `aria-current=\"page\"`, and\n * the `itemIndicator` glyph after the label so the mark is not colour alone.\n */\n current?: boolean;\n /** Individually disable this item without removing it. */\n disabled?: boolean;\n /**\n * Whether choosing the item closes the menu. Defaults to `true`. Keep an\n * item open when its outcome shows in the `footer`, so a failure appears\n * where the click happened.\n */\n closeOnSelect?: boolean;\n}\n\n/**\n * The props a `linkComponent` receives. A plain `'a'` and a router's link\n * component both accept them; Ark adds the menu item's role, id, state\n * attributes and handlers on top, so the component must pass unknown props\n * and its `ref` on to the anchor it renders.\n */\nexport interface ActionMenuLinkProps extends LinkComponentProps {\n 'aria-current'?: 'page';\n}\n\nexport interface ActionMenuProps {\n /**\n * The element that opens the menu: a `<button>`, or a component that\n * passes its props and `ref` on to one, such as `IconButton` or\n * `MenuTrigger`. Ark renders it as the trigger, adding `aria-haspopup`,\n * `aria-expanded`, `aria-controls`, the open and close handlers and\n * `data-state`. Give it an accessible name that says what the menu holds,\n * such as \"Account menu\" or \"Main navigation\": the menu takes its name\n * from the trigger.\n */\n trigger: ReactElement;\n /** The actions and links, in order. */\n items: ActionMenuItem[];\n /** Fired with the item's `value` when one is chosen, a link included. */\n onSelect?: (value: string) => void;\n /**\n * Content above the items that says whose menu this is, such as the\n * signed-in user's name and email. It names the group of items for\n * assistive technology, so keep it to text and decorative elements.\n */\n header?: ReactNode;\n /**\n * A line under the items about the last action, such as \"Couldn't sign\n * out. Check your connection, then try again.\" It is announced when it\n * appears, and a press on it leaves the menu open. It is not an item and\n * sits beside the `menu` element, which may own only items, so keep it to\n * text and a decorative glyph rather than an `Alert`.\n */\n footer?: ReactNode;\n /**\n * Renders an item with an `href`. Defaults to `'a'`; pass a router's link\n * component for client-side navigation.\n */\n linkComponent?: ElementType<ActionMenuLinkProps>;\n /**\n * Glyph marking the `current` link. Defaults to a plain built-in check so\n * `@manakind/ui-core` renders on its own; products pass their own icon.\n */\n itemIndicator?: IconSource;\n /** Controlled open state. Pair with `onOpenChange`. */\n open?: boolean;\n /** Fired with the requested state whenever the menu asks to open or close. */\n onOpenChange?: (open: boolean) => void;\n /** Extra class names on the menu's popup: the frame around the items and the footer. */\n className?: string;\n}\n\ninterface ActionMenuRowProps {\n item: ActionMenuItem;\n linkComponent: ElementType<ActionMenuLinkProps>;\n itemIndicator: IconSource;\n}\n\nfunction ActionMenuRow({ item, linkComponent: LinkComponent, itemIndicator }: ActionMenuRowProps) {\n const body = (\n <>\n <span className=\"ds-menu__item-body\">\n {item.icon && (\n <Icon source={item.icon} size=\"sm\" decorative className=\"ds-menu__item-icon\" />\n )}\n <ArkMenu.ItemText>{item.label}</ArkMenu.ItemText>\n </span>\n {item.current && (\n <span className=\"ds-menu__item-indicator\">\n <Icon source={itemIndicator} size=\"sm\" decorative />\n </span>\n )}\n </>\n );\n const itemProps = {\n value: item.value,\n valueText: item.label,\n disabled: item.disabled,\n closeOnSelect: item.closeOnSelect,\n className: 'ds-menu__item',\n };\n\n if (item.href === undefined) {\n return <ArkMenu.Item {...itemProps}>{body}</ArkMenu.Item>;\n }\n return (\n <ArkMenu.Item {...itemProps} asChild>\n <LinkComponent href={item.href} aria-current={item.current ? 'page' : undefined}>\n {body}\n </LinkComponent>\n </ArkMenu.Item>\n );\n}\n\n/**\n * A menu of actions and links, opened from a trigger, built on Ark UI's\n * Menu. The counterpart of `Menu`, whose items are mutually exclusive\n * choices: here every item does something or goes somewhere.\n *\n * Ark owns the hard parts: `menu` / `menuitem` semantics, roving highlight\n * with the arrow keys, Home/End, typeahead, Escape and click outside to\n * dismiss, following a link on Enter, and focus returning to the trigger on\n * close. This wrapper contributes the `ds-menu` classes and `--ds-menu-*`\n * bindings it shares with `Menu`, a flat `items` API, and the header and\n * footer slots.\n *\n * ```tsx\n * <ActionMenu\n * trigger={<IconButton icon={MenuGlyph} variant=\"tertiary\" aria-label=\"Main navigation\" />}\n * linkComponent={Link}\n * items={[\n * { value: 'dashboard', label: 'Dashboard', href: '/dashboard', current: true },\n * { value: 'goals', label: 'Goals', href: '/goals' },\n * ]}\n * />\n * ```\n *\n * Reach for this for an account menu, a row's overflow actions, or a\n * navigation that folds into a button on a phone. A set of choices where\n * exactly one is in effect is a `Menu`; a form field is a `Select`.\n *\n * The popup renders in a portal, at the same `z-index: 60` as Select's\n * listbox, and is mounted only while open, as `Menu`'s is.\n */\nexport function ActionMenu({\n trigger,\n items,\n onSelect,\n header,\n footer,\n linkComponent = 'a',\n itemIndicator = Check,\n open,\n onOpenChange,\n className,\n}: ActionMenuProps) {\n const portalContainer = useContext(PortalContainerContext);\n const handleSelect = (details: { value: string }) => onSelect?.(details.value);\n const handleOpenChange = (details: { open: boolean }) => onOpenChange?.(details.open);\n /*\n * Enter on a link item. Zag's default dispatches a click that does not\n * bubble, which the browser follows as a document load but React never\n * sees, so a router's link component could not take it over. `click()`\n * bubbles, and the link navigates the way a pointer click would.\n */\n const navigate = (details: { node: HTMLAnchorElement }) =>\n queueMicrotask(() => details.node.click());\n /*\n * The footer sits beside the `menu` element, not in it, because a menu may\n * own only items. To Zag that makes it outside, so a press on the message\n * would dismiss the menu; this keeps it open.\n */\n const footerRef = useRef<HTMLDivElement>(null);\n const keepOpenForFooter = (event: CustomEvent<{ originalEvent: Event }>) => {\n const target = event.detail.originalEvent.target;\n if (target instanceof Node && footerRef.current?.contains(target)) event.preventDefault();\n };\n\n const rows = items.map((item) => (\n <ActionMenuRow\n key={item.value}\n item={item}\n linkComponent={linkComponent}\n itemIndicator={itemIndicator}\n />\n ));\n const list =\n header === undefined ? (\n rows\n ) : (\n <ArkMenu.ItemGroup>\n <ArkMenu.ItemGroupLabel className=\"ds-menu__header\">{header}</ArkMenu.ItemGroupLabel>\n {rows}\n </ArkMenu.ItemGroup>\n );\n\n return (\n <ArkMenu.Root\n lazyMount\n unmountOnExit\n open={open}\n onOpenChange={handleOpenChange}\n onSelect={handleSelect}\n navigate={navigate}\n onInteractOutside={keepOpenForFooter}\n >\n <ArkMenu.Trigger asChild>{trigger}</ArkMenu.Trigger>\n\n <Portal container={portalContainer}>\n <ArkMenu.Positioner>\n <div className={cx('ds-menu__popup', className)}>\n <ArkMenu.Content className=\"ds-menu__content\">{list}</ArkMenu.Content>\n <div ref={footerRef} className=\"ds-menu__footer\" aria-live=\"polite\">\n {footer}\n </div>\n </div>\n </ArkMenu.Positioner>\n </Portal>\n </ArkMenu.Root>\n );\n}\n"]}
1
+ {"version":3,"file":"action-menu.js","sourceRoot":"","sources":["../../src/menu/action-menu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAuD,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChG,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,YAAY,CAAC;AA6FpB,SAAS,aAAa,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAsB;IAC9F,MAAM,IAAI,GAAG,CACX,8BACE,gBAAM,SAAS,EAAC,oBAAoB,aACjC,IAAI,CAAC,IAAI,IAAI,CACZ,KAAC,IAAI,IAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,QAAC,SAA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AAE,IAAI,EACV,YAAY,EAAE,gBAAgB,EAC9B,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,QAAQ,EAClB,iBAAiB,EAAE,iBAAiB,aAEpC,KAAC,OAAO,CAAC,OAAO,IAAC,OAAO,kBAAE,OAAO,GAAmB,EAEpD,KAAC,MAAM,IAAC,SAAS,EAAE,eAAe,YAChC,KAAC,OAAO,CAAC,UAAU,cACjB,eAAK,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,aAC7C,KAAC,OAAO,CAAC,OAAO,IAAC,SAAS,EAAC,kBAAkB,YAAE,IAAI,GAAmB,EACtE,cAAK,GAAG,EAAE,SAAS,EAAE,SAAS,EAAC,iBAAiB,eAAW,QAAQ,YAChE,MAAM,GACH,IACF,GACa,GACd,IACI,CAChB,CAAC;AACJ,CAAC","sourcesContent":["import { Menu as ArkMenu } from '@ark-ui/react/menu';\nimport { Portal } from '@ark-ui/react/portal';\nimport { type ElementType, type ReactElement, type ReactNode, useContext, useRef } from 'react';\nimport { cx } from '../cx';\nimport { Icon, type IconSource } from '../icon/icon';\nimport { useIconDefaults } from '../icon-defaults';\nimport type { LinkComponentProps } from '../link-component';\nimport { PortalContainerContext } from '../portal-container';\nimport './menu.css';\n\nexport interface ActionMenuItem {\n /** Stable value reported by `onSelect`. */\n value: string;\n /** Text shown in the menu. Also what typeahead matches against. */\n label: string;\n /** Glyph before the label. Decorative: the label says what the item does. */\n icon?: IconSource;\n /**\n * Makes the item a link to this address, rendered through `linkComponent`.\n * Choosing it follows the link, with the keyboard too; `onSelect` still\n * reports its value.\n */\n href?: string;\n /**\n * Marks the link to the page the user is on: `aria-current=\"page\"`, and\n * the `itemIndicator` glyph after the label so the mark is not colour alone.\n */\n current?: boolean;\n /** Individually disable this item without removing it. */\n disabled?: boolean;\n /**\n * Whether choosing the item closes the menu. Defaults to `true`. Keep an\n * item open when its outcome shows in the `footer`, so a failure appears\n * where the click happened.\n */\n closeOnSelect?: boolean;\n}\n\n/**\n * The props a `linkComponent` receives. A plain `'a'` and a router's link\n * component both accept them; Ark adds the menu item's role, id, state\n * attributes and handlers on top, so the component must pass unknown props\n * and its `ref` on to the anchor it renders.\n */\nexport interface ActionMenuLinkProps extends LinkComponentProps {\n 'aria-current'?: 'page';\n}\n\nexport interface ActionMenuProps {\n /**\n * The element that opens the menu: a `<button>`, or a component that\n * passes its props and `ref` on to one, such as `IconButton` or\n * `MenuTrigger`. Ark renders it as the trigger, adding `aria-haspopup`,\n * `aria-expanded`, `aria-controls`, the open and close handlers and\n * `data-state`. Give it an accessible name that says what the menu holds,\n * such as \"Account menu\" or \"Main navigation\": the menu takes its name\n * from the trigger.\n */\n trigger: ReactElement;\n /** The actions and links, in order. */\n items: ActionMenuItem[];\n /** Fired with the item's `value` when one is chosen, a link included. */\n onSelect?: (value: string) => void;\n /**\n * Content above the items that says whose menu this is, such as the\n * signed-in user's name and email. It names the group of items for\n * assistive technology, so keep it to text and decorative elements.\n */\n header?: ReactNode;\n /**\n * A line under the items about the last action, such as \"Couldn't sign\n * out. Check your connection, then try again.\" It is announced when it\n * appears, and a press on it leaves the menu open. It is not an item and\n * sits beside the `menu` element, which may own only items, so keep it to\n * text and a decorative glyph rather than an `Alert`.\n */\n footer?: ReactNode;\n /**\n * Renders an item with an `href`. Defaults to `'a'`; pass a router's link\n * component for client-side navigation.\n */\n linkComponent?: ElementType<ActionMenuLinkProps>;\n /**\n * Glyph marking the `current` link. Defaults to the `IconDefaultsProvider`'s\n * `check`, or a plain built-in one.\n */\n itemIndicator?: IconSource;\n /** Controlled open state. Pair with `onOpenChange`. */\n open?: boolean;\n /** Fired with the requested state whenever the menu asks to open or close. */\n onOpenChange?: (open: boolean) => void;\n /** Extra class names on the menu's popup: the frame around the items and the footer. */\n className?: string;\n}\n\ninterface ActionMenuRowProps {\n item: ActionMenuItem;\n linkComponent: ElementType<ActionMenuLinkProps>;\n itemIndicator: IconSource;\n}\n\nfunction ActionMenuRow({ item, linkComponent: LinkComponent, itemIndicator }: ActionMenuRowProps) {\n const body = (\n <>\n <span className=\"ds-menu__item-body\">\n {item.icon && (\n <Icon source={item.icon} size=\"sm\" decorative className=\"ds-menu__item-icon\" />\n )}\n <ArkMenu.ItemText>{item.label}</ArkMenu.ItemText>\n </span>\n {item.current && (\n <span className=\"ds-menu__item-indicator\">\n <Icon source={itemIndicator} size=\"sm\" decorative />\n </span>\n )}\n </>\n );\n const itemProps = {\n value: item.value,\n valueText: item.label,\n disabled: item.disabled,\n closeOnSelect: item.closeOnSelect,\n className: 'ds-menu__item',\n };\n\n if (item.href === undefined) {\n return <ArkMenu.Item {...itemProps}>{body}</ArkMenu.Item>;\n }\n return (\n <ArkMenu.Item {...itemProps} asChild>\n <LinkComponent href={item.href} aria-current={item.current ? 'page' : undefined}>\n {body}\n </LinkComponent>\n </ArkMenu.Item>\n );\n}\n\n/**\n * A menu of actions and links, opened from a trigger, built on Ark UI's\n * Menu. The counterpart of `Menu`, whose items are mutually exclusive\n * choices: here every item does something or goes somewhere.\n *\n * Ark owns the hard parts: `menu` / `menuitem` semantics, roving highlight\n * with the arrow keys, Home/End, typeahead, Escape and click outside to\n * dismiss, following a link on Enter, and focus returning to the trigger on\n * close. This wrapper contributes the `ds-menu` classes and `--ds-menu-*`\n * bindings it shares with `Menu`, a flat `items` API, and the header and\n * footer slots.\n *\n * ```tsx\n * <ActionMenu\n * trigger={<IconButton icon={MenuGlyph} variant=\"tertiary\" aria-label=\"Main navigation\" />}\n * linkComponent={Link}\n * items={[\n * { value: 'dashboard', label: 'Dashboard', href: '/dashboard', current: true },\n * { value: 'goals', label: 'Goals', href: '/goals' },\n * ]}\n * />\n * ```\n *\n * Reach for this for an account menu, a row's overflow actions, or a\n * navigation that folds into a button on a phone. A set of choices where\n * exactly one is in effect is a `Menu`; a form field is a `Select`.\n *\n * The popup renders in a portal, at the same `z-index: 60` as Select's\n * listbox, and is mounted only while open, as `Menu`'s is.\n */\nexport function ActionMenu({\n trigger,\n items,\n onSelect,\n header,\n footer,\n linkComponent = 'a',\n itemIndicator: itemIndicatorProp,\n open,\n onOpenChange,\n className,\n}: ActionMenuProps) {\n const icons = useIconDefaults();\n const itemIndicator = itemIndicatorProp ?? icons.check;\n const portalContainer = useContext(PortalContainerContext);\n const handleSelect = (details: { value: string }) => onSelect?.(details.value);\n const handleOpenChange = (details: { open: boolean }) => onOpenChange?.(details.open);\n /*\n * Enter on a link item. Zag's default dispatches a click that does not\n * bubble, which the browser follows as a document load but React never\n * sees, so a router's link component could not take it over. `click()`\n * bubbles, and the link navigates the way a pointer click would.\n */\n const navigate = (details: { node: HTMLAnchorElement }) =>\n queueMicrotask(() => details.node.click());\n /*\n * The footer sits beside the `menu` element, not in it, because a menu may\n * own only items. To Zag that makes it outside, so a press on the message\n * would dismiss the menu; this keeps it open.\n */\n const footerRef = useRef<HTMLDivElement>(null);\n const keepOpenForFooter = (event: CustomEvent<{ originalEvent: Event }>) => {\n const target = event.detail.originalEvent.target;\n if (target instanceof Node && footerRef.current?.contains(target)) event.preventDefault();\n };\n\n const rows = items.map((item) => (\n <ActionMenuRow\n key={item.value}\n item={item}\n linkComponent={linkComponent}\n itemIndicator={itemIndicator}\n />\n ));\n const list =\n header === undefined ? (\n rows\n ) : (\n <ArkMenu.ItemGroup>\n <ArkMenu.ItemGroupLabel className=\"ds-menu__header\">{header}</ArkMenu.ItemGroupLabel>\n {rows}\n </ArkMenu.ItemGroup>\n );\n\n return (\n <ArkMenu.Root\n lazyMount\n unmountOnExit\n open={open}\n onOpenChange={handleOpenChange}\n onSelect={handleSelect}\n navigate={navigate}\n onInteractOutside={keepOpenForFooter}\n >\n <ArkMenu.Trigger asChild>{trigger}</ArkMenu.Trigger>\n\n <Portal container={portalContainer}>\n <ArkMenu.Positioner>\n <div className={cx('ds-menu__popup', className)}>\n <ArkMenu.Content className=\"ds-menu__content\">{list}</ArkMenu.Content>\n <div ref={footerRef} className=\"ds-menu__footer\" aria-live=\"polite\">\n {footer}\n </div>\n </div>\n </ArkMenu.Positioner>\n </Portal>\n </ArkMenu.Root>\n );\n}\n"]}
@@ -54,9 +54,7 @@ export interface MenuProps<V extends string = string> {
54
54
  /**
55
55
  * Glyph marking the checked choice.
56
56
  *
57
- * Defaults to a plain built-in check so `@manakind/ui-core` installs and
58
- * renders on its own. Products override it with their own icon set, as
59
- * they do Select's `itemIndicator`.
57
+ * Defaults to the `IconDefaultsProvider`'s `check`, or a plain built-in one.
60
58
  */
61
59
  itemIndicator?: IconSource;
62
60
  /** Extra class names on the menu's popup: the frame around the items. */
@@ -68,8 +66,8 @@ export interface MenuTriggerProps extends Omit<ComponentProps<'button'>, 'type'>
68
66
  * Select's indicator does: the trigger turns it down while closed and up
69
67
  * while open, so one glyph serves both states.
70
68
  *
71
- * Defaults to a plain built-in chevron. Products override it with their
72
- * own icon set.
69
+ * Defaults to the `IconDefaultsProvider`'s `chevronRight`, or a plain
70
+ * built-in one.
73
71
  */
74
72
  indicator?: IconSource;
75
73
  }
@@ -92,7 +90,7 @@ export interface MenuTriggerProps extends Omit<ComponentProps<'button'>, 'type'>
92
90
  * />
93
91
  * ```
94
92
  */
95
- export declare function MenuTrigger({ indicator, className, children, ...props }: MenuTriggerProps): import("react/jsx-runtime").JSX.Element;
93
+ export declare function MenuTrigger({ indicator: indicatorProp, className, children, ...props }: MenuTriggerProps): import("react/jsx-runtime").JSX.Element;
96
94
  /**
97
95
  * A menu of mutually exclusive choices, opened from a trigger and applied
98
96
  * at once, built on Ark UI's Menu.
@@ -126,5 +124,5 @@ export declare function MenuTrigger({ indicator, className, children, ...props }
126
124
  * the page or dialog it opens from. It is mounted only while open, so a list
127
125
  * of a hundred menus adds nothing to the page until one is opened.
128
126
  */
129
- export declare function Menu<V extends string = string>({ trigger, label, items, value, onValueChange, itemIndicator, className, }: MenuProps<V>): import("react/jsx-runtime").JSX.Element;
127
+ export declare function Menu<V extends string = string>({ trigger, label, items, value, onValueChange, itemIndicator: itemIndicatorProp, className, }: MenuProps<V>): import("react/jsx-runtime").JSX.Element;
130
128
  //# sourceMappingURL=menu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/menu/menu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAA2B,MAAM,OAAO,CAAC;AAGxF,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,YAAY,CAAC;AAEpB,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACjD,0EAA0E;IAC1E,KAAK,EAAE,CAAC,CAAC;IACT,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAClD;;;;;;;;;;OAUG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB;;;;OAIG;IACH,KAAK,EAAE,CAAC,CAAC;IACT;;;;OAIG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAClC;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,UAAU,CAAC;IAC3B,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC9E;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,SAAwB,E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AAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC9E;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EAAE,aAAa,EACxB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,gBAAgB,2CASlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAC9C,OAAO,EACP,KAAK,EACL,KAAK,EACL,KAAK,EACL,aAAa,EACb,aAAa,EAAE,iBAAiB,EAChC,SAAS,GACV,EAAE,SAAS,CAAC,CAAC,CAAC,2CA2Dd"}
package/dist/menu/menu.js CHANGED
@@ -3,8 +3,8 @@ import { Menu as ArkMenu } from '@ark-ui/react/menu';
3
3
  import { Portal } from '@ark-ui/react/portal';
4
4
  import { useCallback, useContext } from 'react';
5
5
  import { cx } from '../cx';
6
- import { Check, ChevronRight } from '../fallback-glyphs';
7
6
  import { Icon } from '../icon/icon';
7
+ import { useIconDefaults } from '../icon-defaults';
8
8
  import { PortalContainerContext } from '../portal-container';
9
9
  import './menu.css';
10
10
  /**
@@ -26,7 +26,9 @@ import './menu.css';
26
26
  * />
27
27
  * ```
28
28
  */
29
- export function MenuTrigger({ indicator = ChevronRight, className, children, ...props }) {
29
+ export function MenuTrigger({ indicator: indicatorProp, className, children, ...props }) {
30
+ const icons = useIconDefaults();
31
+ const indicator = indicatorProp ?? icons.chevronRight;
30
32
  return (_jsxs("button", { type: "button", className: cx('ds-menu__trigger', className), ...props, children: [children, _jsx(Icon, { source: indicator, size: "sm", decorative: true, className: "ds-menu__trigger-indicator" })] }));
31
33
  }
32
34
  /**
@@ -62,7 +64,9 @@ export function MenuTrigger({ indicator = ChevronRight, className, children, ...
62
64
  * the page or dialog it opens from. It is mounted only while open, so a list
63
65
  * of a hundred menus adds nothing to the page until one is opened.
64
66
  */
65
- export function Menu({ trigger, label, items, value, onValueChange, itemIndicator = Check, className, }) {
67
+ export function Menu({ trigger, label, items, value, onValueChange, itemIndicator: itemIndicatorProp, className, }) {
68
+ const icons = useIconDefaults();
69
+ const itemIndicator = itemIndicatorProp ?? icons.check;
66
70
  /*
67
71
  * Ark reports the value as a string; mapping it back through `items`
68
72
  * returns the caller's own type without a cast, and drops anything that is
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","sourceRoot":"","sources":["../../src/menu/menu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAA0C,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxF,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,YAAY,CAAC;AA6EpB;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,WAAW,CAAC,EAC1B,SAAS,GAAG,YAAY,EACxB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACS;IACjB,OAAO,CACL,kBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC,KAAM,KAAK,aAC1E,QAAQ,EACT,KAAC,IAAI,IAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,QAAC,SAAS,EAAC,4BAA4B,GAAG,IAChF,CACV,CA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AC,KAAK,EACjB,SAAS,EAAE,IAAI,CAAC,KAAK,EACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,SAAS,EAAC,eAAe,aAEzB,gBAAM,SAAS,EAAC,oBAAoB,aACjC,IAAI,CAAC,IAAI,IAAI,CACZ,KAAC,IAAI,IACH,MAAM,EAAE,IAAI,CAAC,IAAI,EACjB,IAAI,EAAC,IAAI,EACT,UAAU,QACV,SAAS,EAAC,oBAAoB,GAC9B,CACH,EACD,KAAC,OAAO,CAAC,QAAQ,cAAE,IAAI,CAAC,KAAK,GAAoB,IAC5C,EACP,KAAC,OAAO,CAAC,aAAa,IAAC,SAAS,EAAC,yBAAyB,YACxD,KAAC,IAAI,IAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,SAAG,GAC9B,KAnBnB,IAAI,CAAC,KAAK,CAoBG,CACrB,CAAC,IACqB,GACT,GACd,GACa,GACd,IACI,CAChB,CAAC;AACJ,CAAC","sourcesContent":["import { Menu as ArkMenu } from '@ark-ui/react/menu';\nimport { Portal } from '@ark-ui/react/portal';\nimport { type ComponentProps, type ReactElement, useCallback, useContext } from 'react';\nimport { cx } from '../cx';\nimport { Check, ChevronRight } from '../fallback-glyphs';\nimport { Icon, type IconSource } from '../icon/icon';\nimport { PortalContainerContext } from '../portal-container';\nimport './menu.css';\n\nexport interface MenuItem<V extends string = string> {\n /** Stable value reported by `onValueChange` and compared with `value`. */\n value: V;\n /** Text shown in the menu. Also what typeahead matches against. */\n label: string;\n /** Individually disable this choice without removing it. */\n disabled?: boolean;\n /**\n * Glyph before the label, supplied by the product, as on an ActionMenu\n * item: the mark a choice also carries on its trigger. Decorative; the\n * label carries the meaning.\n */\n icon?: IconSource;\n}\n\n/**\n * Generic over the value type, so a union of choices (`'draft' | 'live'`)\n * comes back out of `onValueChange` as that union rather than as `string`.\n */\nexport interface MenuProps<V extends string = string> {\n /**\n * The element that opens the menu: a `<button>`, or a component that\n * passes its props and `ref` on to one.\n *\n * Ark renders it as the trigger, adding `aria-haspopup`, `aria-expanded`,\n * `aria-controls`, the open/close handlers and `data-state` (`open` or\n * `closed`, for a product's own indicator). Its own handlers still run.\n * Give it an accessible name that says what is chosen and what pressing\n * it does, such as \"Status: In progress. Change status\": the menu takes\n * its name from the trigger.\n */\n trigger: ReactElement;\n /**\n * What the items choose between, such as \"Status\". Names the group of\n * choices for assistive technology; it is not shown.\n */\n label: string;\n /** The choices, in order. Exactly one is checked: the one matching `value`. */\n items: MenuItem<V>[];\n /**\n * The checked choice. Controlled only: the menu reports a choice through\n * `onValueChange` and shows whatever `value` says next. A value matching\n * no item leaves nothing checked.\n */\n value: V;\n /**\n * Fired when a different choice is made. Choosing the item that is already\n * checked closes the menu without firing, so a consumer that saves on\n * change never writes the same value twice.\n */\n onValueChange: (value: V) => void;\n /**\n * Glyph marking the checked choice.\n *\n * Defaults to a plain built-in check so `@manakind/ui-core` installs and\n * renders on its own. Products override it with their own icon set, as\n * they do Select's `itemIndicator`.\n */\n itemIndicator?: IconSource;\n /** Extra class names on the menu's popup: the frame around the items. */\n className?: string;\n}\n\nexport interface MenuTriggerProps extends Omit<ComponentProps<'button'>, 'type'> {\n /**\n * Glyph after the content saying it opens a menu. Must point RIGHT, as\n * Select's indicator does: the trigger turns it down while closed and up\n * while open, so one glyph serves both states.\n *\n * Defaults to a plain built-in chevron. Products override it with their\n * own icon set.\n */\n indicator?: IconSource;\n}\n\n/**\n * A quiet, compact trigger for a `Menu`: the content it is given, then a\n * chevron, with a fill on hover and while open, and the focus ring.\n *\n * For a trigger that wraps something with its own look, such as a status\n * `Badge`, where a `Button` would add a second frame and its own height. It\n * takes the size of its content and inherits its font and colour.\n *\n * ```tsx\n * <Menu\n * trigger={\n * <MenuTrigger aria-label={`Status: ${status}. Change status`}>\n * <Badge variant=\"info\" appearance=\"plain\">{status}</Badge>\n * </MenuTrigger>\n * }\n * …\n * />\n * ```\n */\nexport function MenuTrigger({\n indicator = ChevronRight,\n className,\n children,\n ...props\n}: MenuTriggerProps) {\n return (\n <button type=\"button\" className={cx('ds-menu__trigger', className)} {...props}>\n {children}\n <Icon source={indicator} size=\"sm\" decorative className=\"ds-menu__trigger-indicator\" />\n </button>\n );\n}\n\n/**\n * A menu of mutually exclusive choices, opened from a trigger and applied\n * at once, built on Ark UI's Menu.\n *\n * Ark owns the hard parts: `menu` / `menuitemradio` semantics, roving\n * highlight with the arrow keys, Home/End, typeahead, Escape and click\n * outside to dismiss, and focus returning to the trigger on close. This\n * wrapper contributes `ds-` classes, the `--ds-menu-*` bindings, and a flat\n * `items` API in place of Ark's anatomy.\n *\n * ```tsx\n * <Menu\n * trigger={<button type=\"button\" aria-label=\"Status: In Progress. Change status\">…</button>}\n * label=\"Status\"\n * items={[\n * { value: 'Not Started', label: 'Not Started' },\n * { value: 'In Progress', label: 'In Progress' },\n * { value: 'Completed', label: 'Completed' },\n * ]}\n * value={status}\n * onValueChange={setStatus}\n * />\n * ```\n *\n * Reach for this when the choice takes effect immediately, from a control\n * that is not a form field — a status badge, a sort order. A form field\n * whose value is submitted later is a `Select`.\n *\n * The popup renders in a portal, at the same `z-index: 60` as Select's\n * listbox, a step above the products' overlay layer (50), so it paints above\n * the page or dialog it opens from. It is mounted only while open, so a list\n * of a hundred menus adds nothing to the page until one is opened.\n */\nexport function Menu<V extends string = string>({\n trigger,\n label,\n items,\n value,\n onValueChange,\n itemIndicator = Check,\n className,\n}: MenuProps<V>) {\n /*\n * Ark reports the value as a string; mapping it back through `items`\n * returns the caller's own type without a cast, and drops anything that is\n * not one of the choices.\n */\n const handleValueChange = useCallback(\n (details: { value: string }) => {\n const chosen = items.find((item) => item.value === details.value);\n if (chosen && chosen.value !== value) onValueChange(chosen.value);\n },\n [items, value, onValueChange],\n );\n\n const portalContainer = useContext(PortalContainerContext);\n\n return (\n <ArkMenu.Root lazyMount unmountOnExit>\n <ArkMenu.Trigger asChild>{trigger}</ArkMenu.Trigger>\n\n <Portal container={portalContainer}>\n <ArkMenu.Positioner>\n <div className={cx('ds-menu__popup', className)}>\n <ArkMenu.Content className=\"ds-menu__content\">\n <ArkMenu.RadioItemGroup value={value} onValueChange={handleValueChange}>\n <ArkMenu.ItemGroupLabel className=\"ds-menu__label\">{label}</ArkMenu.ItemGroupLabel>\n {items.map((item) => (\n <ArkMenu.RadioItem\n key={item.value}\n value={item.value}\n valueText={item.label}\n disabled={item.disabled}\n className=\"ds-menu__item\"\n >\n <span className=\"ds-menu__item-body\">\n {item.icon && (\n <Icon\n source={item.icon}\n size=\"sm\"\n decorative\n className=\"ds-menu__item-icon\"\n />\n )}\n <ArkMenu.ItemText>{item.label}</ArkMenu.ItemText>\n </span>\n <ArkMenu.ItemIndicator className=\"ds-menu__item-indicator\">\n <Icon source={itemIndicator} size=\"sm\" decorative />\n </ArkMenu.ItemIndicator>\n </ArkMenu.RadioItem>\n ))}\n </ArkMenu.RadioItemGroup>\n </ArkMenu.Content>\n </div>\n </ArkMenu.Positioner>\n </Portal>\n </ArkMenu.Root>\n );\n}\n"]}
1
+ {"version":3,"file":"menu.js","sourceRoot":"","sources":["../../src/menu/menu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAA0C,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxF,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,YAAY,CAAC;AA2EpB;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,WAAW,CAAC,EAC1B,SAAS,EAAE,aAAa,EACxB,SAAS,EACT,QAAQ,EACR,GAAG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B,EAEpD,KAAC,MAAM,IAAC,SAAS,EAAE,eAAe,YAChC,KAAC,OAAO,CAAC,UAAU,cACjB,cAAK,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,YAC7C,KAAC,OAAO,CAAC,OAAO,IAAC,SAAS,EAAC,kBAAkB,YAC3C,MAAC,OAAO,CAAC,cAAc,IAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,iBAAiB,aACpE,KAAC,OAAO,CAAC,cAAc,IAAC,SAAS,EAAC,gBAAgB,YAAE,KAAK,GAA0B,EAClF,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,MAAC,OAAO,CAAC,SAAS,IAEhB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,SAAS,EAAE,IAAI,CAAC,KAAK,EACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,SAAS,EAAC,eAAe,aAEzB,gBAAM,SAAS,EAAC,oBAAoB,aACjC,IAAI,CAAC,IAAI,IAAI,CACZ,KAAC,IAAI,IACH,MAAM,EAAE,IAAI,CAAC,IAAI,EACjB,IAAI,EAAC,IAAI,EACT,UAAU,QACV,SAAS,EAAC,oBAAoB,GAC9B,CACH,EACD,KAAC,OAAO,CAAC,QAAQ,cAAE,IAAI,CAAC,KAAK,GAAoB,IAC5C,EACP,KAAC,OAAO,CAAC,aAAa,IAAC,SAAS,EAAC,yBAAyB,YACxD,KAAC,IAAI,IAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,SAAG,GAC9B,KAnBnB,IAAI,CAAC,KAAK,CAoBG,CACrB,CAAC,IACqB,GACT,GACd,GACa,GACd,IACI,CAChB,CAAC;AACJ,CAAC","sourcesContent":["import { Menu as ArkMenu } from '@ark-ui/react/menu';\nimport { Portal } from '@ark-ui/react/portal';\nimport { type ComponentProps, type ReactElement, useCallback, useContext } from 'react';\nimport { cx } from '../cx';\nimport { Icon, type IconSource } from '../icon/icon';\nimport { useIconDefaults } from '../icon-defaults';\nimport { PortalContainerContext } from '../portal-container';\nimport './menu.css';\n\nexport interface MenuItem<V extends string = string> {\n /** Stable value reported by `onValueChange` and compared with `value`. */\n value: V;\n /** Text shown in the menu. Also what typeahead matches against. */\n label: string;\n /** Individually disable this choice without removing it. */\n disabled?: boolean;\n /**\n * Glyph before the label, supplied by the product, as on an ActionMenu\n * item: the mark a choice also carries on its trigger. Decorative; the\n * label carries the meaning.\n */\n icon?: IconSource;\n}\n\n/**\n * Generic over the value type, so a union of choices (`'draft' | 'live'`)\n * comes back out of `onValueChange` as that union rather than as `string`.\n */\nexport interface MenuProps<V extends string = string> {\n /**\n * The element that opens the menu: a `<button>`, or a component that\n * passes its props and `ref` on to one.\n *\n * Ark renders it as the trigger, adding `aria-haspopup`, `aria-expanded`,\n * `aria-controls`, the open/close handlers and `data-state` (`open` or\n * `closed`, for a product's own indicator). Its own handlers still run.\n * Give it an accessible name that says what is chosen and what pressing\n * it does, such as \"Status: In progress. Change status\": the menu takes\n * its name from the trigger.\n */\n trigger: ReactElement;\n /**\n * What the items choose between, such as \"Status\". Names the group of\n * choices for assistive technology; it is not shown.\n */\n label: string;\n /** The choices, in order. Exactly one is checked: the one matching `value`. */\n items: MenuItem<V>[];\n /**\n * The checked choice. Controlled only: the menu reports a choice through\n * `onValueChange` and shows whatever `value` says next. A value matching\n * no item leaves nothing checked.\n */\n value: V;\n /**\n * Fired when a different choice is made. Choosing the item that is already\n * checked closes the menu without firing, so a consumer that saves on\n * change never writes the same value twice.\n */\n onValueChange: (value: V) => void;\n /**\n * Glyph marking the checked choice.\n *\n * Defaults to the `IconDefaultsProvider`'s `check`, or a plain built-in one.\n */\n itemIndicator?: IconSource;\n /** Extra class names on the menu's popup: the frame around the items. */\n className?: string;\n}\n\nexport interface MenuTriggerProps extends Omit<ComponentProps<'button'>, 'type'> {\n /**\n * Glyph after the content saying it opens a menu. Must point RIGHT, as\n * Select's indicator does: the trigger turns it down while closed and up\n * while open, so one glyph serves both states.\n *\n * Defaults to the `IconDefaultsProvider`'s `chevronRight`, or a plain\n * built-in one.\n */\n indicator?: IconSource;\n}\n\n/**\n * A quiet, compact trigger for a `Menu`: the content it is given, then a\n * chevron, with a fill on hover and while open, and the focus ring.\n *\n * For a trigger that wraps something with its own look, such as a status\n * `Badge`, where a `Button` would add a second frame and its own height. It\n * takes the size of its content and inherits its font and colour.\n *\n * ```tsx\n * <Menu\n * trigger={\n * <MenuTrigger aria-label={`Status: ${status}. Change status`}>\n * <Badge variant=\"info\" appearance=\"plain\">{status}</Badge>\n * </MenuTrigger>\n * }\n * …\n * />\n * ```\n */\nexport function MenuTrigger({\n indicator: indicatorProp,\n className,\n children,\n ...props\n}: MenuTriggerProps) {\n const icons = useIconDefaults();\n const indicator = indicatorProp ?? icons.chevronRight;\n return (\n <button type=\"button\" className={cx('ds-menu__trigger', className)} {...props}>\n {children}\n <Icon source={indicator} size=\"sm\" decorative className=\"ds-menu__trigger-indicator\" />\n </button>\n );\n}\n\n/**\n * A menu of mutually exclusive choices, opened from a trigger and applied\n * at once, built on Ark UI's Menu.\n *\n * Ark owns the hard parts: `menu` / `menuitemradio` semantics, roving\n * highlight with the arrow keys, Home/End, typeahead, Escape and click\n * outside to dismiss, and focus returning to the trigger on close. This\n * wrapper contributes `ds-` classes, the `--ds-menu-*` bindings, and a flat\n * `items` API in place of Ark's anatomy.\n *\n * ```tsx\n * <Menu\n * trigger={<button type=\"button\" aria-label=\"Status: In Progress. Change status\">…</button>}\n * label=\"Status\"\n * items={[\n * { value: 'Not Started', label: 'Not Started' },\n * { value: 'In Progress', label: 'In Progress' },\n * { value: 'Completed', label: 'Completed' },\n * ]}\n * value={status}\n * onValueChange={setStatus}\n * />\n * ```\n *\n * Reach for this when the choice takes effect immediately, from a control\n * that is not a form field — a status badge, a sort order. A form field\n * whose value is submitted later is a `Select`.\n *\n * The popup renders in a portal, at the same `z-index: 60` as Select's\n * listbox, a step above the products' overlay layer (50), so it paints above\n * the page or dialog it opens from. It is mounted only while open, so a list\n * of a hundred menus adds nothing to the page until one is opened.\n */\nexport function Menu<V extends string = string>({\n trigger,\n label,\n items,\n value,\n onValueChange,\n itemIndicator: itemIndicatorProp,\n className,\n}: MenuProps<V>) {\n const icons = useIconDefaults();\n const itemIndicator = itemIndicatorProp ?? icons.check;\n /*\n * Ark reports the value as a string; mapping it back through `items`\n * returns the caller's own type without a cast, and drops anything that is\n * not one of the choices.\n */\n const handleValueChange = useCallback(\n (details: { value: string }) => {\n const chosen = items.find((item) => item.value === details.value);\n if (chosen && chosen.value !== value) onValueChange(chosen.value);\n },\n [items, value, onValueChange],\n );\n\n const portalContainer = useContext(PortalContainerContext);\n\n return (\n <ArkMenu.Root lazyMount unmountOnExit>\n <ArkMenu.Trigger asChild>{trigger}</ArkMenu.Trigger>\n\n <Portal container={portalContainer}>\n <ArkMenu.Positioner>\n <div className={cx('ds-menu__popup', className)}>\n <ArkMenu.Content className=\"ds-menu__content\">\n <ArkMenu.RadioItemGroup value={value} onValueChange={handleValueChange}>\n <ArkMenu.ItemGroupLabel className=\"ds-menu__label\">{label}</ArkMenu.ItemGroupLabel>\n {items.map((item) => (\n <ArkMenu.RadioItem\n key={item.value}\n value={item.value}\n valueText={item.label}\n disabled={item.disabled}\n className=\"ds-menu__item\"\n >\n <span className=\"ds-menu__item-body\">\n {item.icon && (\n <Icon\n source={item.icon}\n size=\"sm\"\n decorative\n className=\"ds-menu__item-icon\"\n />\n )}\n <ArkMenu.ItemText>{item.label}</ArkMenu.ItemText>\n </span>\n <ArkMenu.ItemIndicator className=\"ds-menu__item-indicator\">\n <Icon source={itemIndicator} size=\"sm\" decorative />\n </ArkMenu.ItemIndicator>\n </ArkMenu.RadioItem>\n ))}\n </ArkMenu.RadioItemGroup>\n </ArkMenu.Content>\n </div>\n </ArkMenu.Positioner>\n </Portal>\n </ArkMenu.Root>\n );\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export { RadioGroup, type RadioGroupItem, type RadioGroupProps } from './radio-group';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/radio-group/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { RadioGroup } from './radio-group';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/radio-group/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA6C,MAAM,eAAe,CAAC","sourcesContent":["export { RadioGroup, type RadioGroupItem, type RadioGroupProps } from './radio-group';\n"]}
@@ -0,0 +1,70 @@
1
+ @layer components {
2
+ .ds-radio-group {
3
+ display: flex;
4
+ flex-direction: column;
5
+ align-items: flex-start;
6
+ gap: var(--ds-radio-group-gap);
7
+ overflow-wrap: anywhere;
8
+
9
+ & .ds-radio-group__label {
10
+ color: var(--ds-radio-group-label-text);
11
+ font-size: var(--ds-radio-group-label-font-size);
12
+ }
13
+
14
+ & .ds-radio-group__item {
15
+ display: inline-flex;
16
+ align-items: center;
17
+ gap: var(--ds-radio-group-label-gap);
18
+ max-width: 100%;
19
+ color: var(--ds-radio-group-label-text);
20
+ font-size: var(--ds-radio-group-label-font-size);
21
+ cursor: pointer;
22
+
23
+ &[data-disabled] {
24
+ cursor: not-allowed;
25
+ }
26
+ }
27
+
28
+ /*
29
+ * Checked, the circle fills with the primary and a dot in the primary's
30
+ * own text colour sits in it, as a checked Checkbox's box holds its check.
31
+ * The border stays and darkens: the fill alone need not clear 3:1.
32
+ */
33
+ & .ds-radio-group__control {
34
+ box-sizing: border-box;
35
+ position: relative;
36
+ flex-shrink: 0;
37
+ inline-size: var(--ds-radio-group-control-size);
38
+ block-size: var(--ds-radio-group-control-size);
39
+ border: 1px solid var(--ds-radio-group-control-border);
40
+ border-radius: 50%;
41
+ background-color: var(--ds-radio-group-control-bg);
42
+ transition:
43
+ background-color 150ms cubic-bezier(0, 0, 0.2, 1),
44
+ border-color 150ms cubic-bezier(0, 0, 0.2, 1);
45
+
46
+ &[data-state="checked"] {
47
+ border-color: var(--ds-radio-group-control-border-checked);
48
+ background-color: var(--ds-radio-group-control-bg-checked);
49
+
50
+ &::after {
51
+ content: "";
52
+ position: absolute;
53
+ inset: calc(var(--ds-radio-group-indicator-inset) - 1px);
54
+ border-radius: 50%;
55
+ background-color: var(--ds-radio-group-indicator-color);
56
+ }
57
+ }
58
+
59
+ /* Ark mirrors the hidden input's `:focus-visible` onto the control. */
60
+ &[data-focus-visible] {
61
+ outline: 2px solid var(--ds-radio-group-focus-ring);
62
+ outline-offset: 3px;
63
+ }
64
+
65
+ &[data-disabled] {
66
+ opacity: var(--ds-opacity-disabled);
67
+ }
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,2 @@
1
+ /* AUTOGENERATED: types for the stylesheet beside it. */
2
+ export {};
@@ -0,0 +1,74 @@
1
+ import { type ReactNode } from 'react';
2
+ import './radio-group.css';
3
+ export interface RadioGroupItem {
4
+ /** Stable value reported by `onValueChange` and compared with `value`. */
5
+ value: string;
6
+ /** Text beside the radio. The whole row is its click target. */
7
+ label: string;
8
+ /** Individually disable this choice without removing it. */
9
+ disabled?: boolean;
10
+ }
11
+ /**
12
+ * A radio group has to have a name, expressed as a union so an unnamed group
13
+ * is a compile error rather than an axe finding, as `SegmentGroup` does.
14
+ */
15
+ type RadioGroupName = {
16
+ /** Visible label, above the choices, naming the group. */
17
+ label: ReactNode;
18
+ /**
19
+ * A different accessible name when the visible label alone would not
20
+ * say what the choice is. Keep the visible words in it.
21
+ */
22
+ 'aria-label'?: string;
23
+ } | {
24
+ label?: undefined;
25
+ /** Accessible name when a heading or a section title around it already says what the choice is. */
26
+ 'aria-label': string;
27
+ };
28
+ export type RadioGroupProps = RadioGroupName & {
29
+ /** The choices, in order, one under the other. */
30
+ items: RadioGroupItem[];
31
+ /**
32
+ * Controlled value. `null` is controlled with nothing chosen; `undefined`
33
+ * leaves the component to own its value from `defaultValue` onward.
34
+ */
35
+ value?: string | null;
36
+ /** Initial value when uncontrolled. */
37
+ defaultValue?: string;
38
+ /** Fired with the newly chosen value. Choosing the chosen one again does nothing. */
39
+ onValueChange?: (value: string) => void;
40
+ /** Disable every choice. The chosen one keeps showing which is set. */
41
+ disabled?: boolean;
42
+ /** Name for native form participation through the radio inputs. */
43
+ name?: string;
44
+ /** Extra class names appended after `ds-radio-group`. */
45
+ className?: string;
46
+ };
47
+ /**
48
+ * One choice among several, as a column of radios, built on Ark UI's
49
+ * RadioGroup: a filter's period, a setting with a handful of options whose
50
+ * labels are worth reading side by side.
51
+ *
52
+ * Ark owns the behaviour: native radio inputs carry the state, the arrow keys
53
+ * move the choice and Tab leaves the group in one step. This wrapper
54
+ * contributes `ds-` classes, the `--ds-radio-group-*` bindings and a flat
55
+ * `items` API.
56
+ *
57
+ * ```tsx
58
+ * <RadioGroup
59
+ * aria-label="Scheduled in"
60
+ * items={[
61
+ * { value: 'any', label: 'Any time' },
62
+ * { value: 'this-week', label: 'This week' },
63
+ * ]}
64
+ * value={when}
65
+ * onValueChange={setWhen}
66
+ * />
67
+ * ```
68
+ *
69
+ * A few short choices seen at once in a row are a `SegmentGroup`; a long
70
+ * list, or one in a form row, is a `Select`.
71
+ */
72
+ export declare function RadioGroup({ label, items, value, defaultValue, onValueChange, disabled, name, className, 'aria-label': ariaLabel, }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
73
+ export {};
74
+ //# sourceMappingURL=radio-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../src/radio-group/radio-group.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAU,MAAM,OAAO,CAAC;AAC/C,OAAO,mBAAmB,CAAC;AAG3B,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,KAAK,cAAc,GACf;IACE,0DAA0D;IAC1D,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GACD;IACE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,mGAAmG;IACnG,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEN,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG;IAC7C,kDAAkD;IAClD,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qFAAqF;IACrF,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,KAAK,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,YAAY,EAAE,SAAS,GACxB,EAAE,eAAe,2CA0DjB"}
@@ -0,0 +1,57 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { RadioGroup as ArkRadioGroup } from '@ark-ui/react/radio-group';
3
+ import { useRef } from 'react';
4
+ import './radio-group.css';
5
+ import { cx } from '../cx';
6
+ /**
7
+ * One choice among several, as a column of radios, built on Ark UI's
8
+ * RadioGroup: a filter's period, a setting with a handful of options whose
9
+ * labels are worth reading side by side.
10
+ *
11
+ * Ark owns the behaviour: native radio inputs carry the state, the arrow keys
12
+ * move the choice and Tab leaves the group in one step. This wrapper
13
+ * contributes `ds-` classes, the `--ds-radio-group-*` bindings and a flat
14
+ * `items` API.
15
+ *
16
+ * ```tsx
17
+ * <RadioGroup
18
+ * aria-label="Scheduled in"
19
+ * items={[
20
+ * { value: 'any', label: 'Any time' },
21
+ * { value: 'this-week', label: 'This week' },
22
+ * ]}
23
+ * value={when}
24
+ * onValueChange={setWhen}
25
+ * />
26
+ * ```
27
+ *
28
+ * A few short choices seen at once in a row are a `SegmentGroup`; a long
29
+ * list, or one in a form row, is a `Select`.
30
+ */
31
+ export function RadioGroup({ label, items, value, defaultValue, onValueChange, disabled, name, className, 'aria-label': ariaLabel, }) {
32
+ const rootRef = useRef(null);
33
+ /*
34
+ * As in SegmentGroup: Ark leaves the native radios uncontrolled, so a
35
+ * controlled parent that declines a choice would leave the input checked
36
+ * while the control shows the old one. Restoring the parent's value after
37
+ * Ark has read the inputs keeps the two agreeing.
38
+ */
39
+ const handleValueChange = (details) => {
40
+ if (details.value !== null)
41
+ onValueChange?.(details.value);
42
+ if (value === undefined || !rootRef.current)
43
+ return;
44
+ for (const input of rootRef.current.querySelectorAll('input[type="radio"]')) {
45
+ input.checked = input.value === value;
46
+ }
47
+ };
48
+ /*
49
+ * Zag names the root by its label part's id, which would outrank an
50
+ * `aria-label`; with both given the visible label is plain text instead.
51
+ */
52
+ const visibleLabel = label &&
53
+ (ariaLabel ? (_jsx("span", { className: "ds-radio-group__label", children: label })) : (_jsx(ArkRadioGroup.Label, { className: "ds-radio-group__label", children: label })));
54
+ const renderItem = (item) => (_jsxs(ArkRadioGroup.Item, { value: item.value, disabled: item.disabled, className: "ds-radio-group__item", children: [_jsx(ArkRadioGroup.ItemControl, { className: "ds-radio-group__control" }), _jsx(ArkRadioGroup.ItemText, { className: "ds-radio-group__text", children: item.label }), _jsx(ArkRadioGroup.ItemHiddenInput, {})] }, item.value));
55
+ return (_jsxs(ArkRadioGroup.Root, { ref: rootRef, className: cx('ds-radio-group', className), value: value, defaultValue: defaultValue, onValueChange: handleValueChange, disabled: disabled, name: name, orientation: "vertical", "aria-label": ariaLabel, children: [visibleLabel, items.map(renderItem)] }));
56
+ }
57
+ //# sourceMappingURL=radio-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../src/radio-group/radio-group.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAkB,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAmD3B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,KAAK,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,YAAY,EAAE,SAAS,GACP;IAChB,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAE7C;;;;;OAKG;IACH,MAAM,iBAAiB,GAAG,CAAC,OAAiC,EAAE,EAAE;QAC9D,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI;YAAE,aAAa,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC3D,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,OAAO;YAAE,OAAO;QACpD,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAmB,qBAAqB,CAAC,EAAE,CAAC;YAC9F,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC;QACxC,CAAC;IACH,CAAC,CAAC;IAEF;;;OAGG;IACH,MAAM,YAAY,GAChB,KAAK;QACL,CAAC,SAAS,CAAC,CAAC,CAAC,CACX,eAAM,SAAS,EAAC,uBAAuB,YAAE,KAAK,GAAQ,CACvD,CAAC,CAAC,CAAC,CACF,KAAC,aAAa,CAAC,KAAK,IAAC,SAAS,EAAC,uBAAuB,YAAE,KAAK,GAAuB,CACrF,CAAC,CAAC;IAEL,MAAM,UAAU,GAAG,CAAC,IAAoB,EAAE,EAAE,CAAC,CAC3C,MAAC,aAAa,CAAC,IAAI,IAEjB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,SAAS,EAAC,sBAAsB,aAEhC,KAAC,aAAa,CAAC,WAAW,IAAC,SAAS,EAAC,yBAAyB,GAAG,EACjE,KAAC,aAAa,CAAC,QAAQ,IAAC,SAAS,EAAC,sBAAsB,YAAE,IAAI,CAAC,KAAK,GAA0B,EAC9F,KAAC,aAAa,CAAC,eAAe,KAAG,KAP5B,IAAI,CAAC,KAAK,CAQI,CACtB,CAAC;IAEF,OAAO,CACL,MAAC,aAAa,CAAC,IAAI,IACjB,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAC1C,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,iBAAiB,EAChC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,WAAW,EAAC,UAAU,gBACV,SAAS,aAEpB,YAAY,EACZ,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,IACH,CACtB,CAAC;AACJ,CAAC","sourcesContent":["import { RadioGroup as ArkRadioGroup } from '@ark-ui/react/radio-group';\nimport { type ReactNode, useRef } from 'react';\nimport './radio-group.css';\nimport { cx } from '../cx';\n\nexport interface RadioGroupItem {\n /** Stable value reported by `onValueChange` and compared with `value`. */\n value: string;\n /** Text beside the radio. The whole row is its click target. */\n label: string;\n /** Individually disable this choice without removing it. */\n disabled?: boolean;\n}\n\n/**\n * A radio group has to have a name, expressed as a union so an unnamed group\n * is a compile error rather than an axe finding, as `SegmentGroup` does.\n */\ntype RadioGroupName =\n | {\n /** Visible label, above the choices, naming the group. */\n label: ReactNode;\n /**\n * A different accessible name when the visible label alone would not\n * say what the choice is. Keep the visible words in it.\n */\n 'aria-label'?: string;\n }\n | {\n label?: undefined;\n /** Accessible name when a heading or a section title around it already says what the choice is. */\n 'aria-label': string;\n };\n\nexport type RadioGroupProps = RadioGroupName & {\n /** The choices, in order, one under the other. */\n items: RadioGroupItem[];\n /**\n * Controlled value. `null` is controlled with nothing chosen; `undefined`\n * leaves the component to own its value from `defaultValue` onward.\n */\n value?: string | null;\n /** Initial value when uncontrolled. */\n defaultValue?: string;\n /** Fired with the newly chosen value. Choosing the chosen one again does nothing. */\n onValueChange?: (value: string) => void;\n /** Disable every choice. The chosen one keeps showing which is set. */\n disabled?: boolean;\n /** Name for native form participation through the radio inputs. */\n name?: string;\n /** Extra class names appended after `ds-radio-group`. */\n className?: string;\n};\n\n/**\n * One choice among several, as a column of radios, built on Ark UI's\n * RadioGroup: a filter's period, a setting with a handful of options whose\n * labels are worth reading side by side.\n *\n * Ark owns the behaviour: native radio inputs carry the state, the arrow keys\n * move the choice and Tab leaves the group in one step. This wrapper\n * contributes `ds-` classes, the `--ds-radio-group-*` bindings and a flat\n * `items` API.\n *\n * ```tsx\n * <RadioGroup\n * aria-label=\"Scheduled in\"\n * items={[\n * { value: 'any', label: 'Any time' },\n * { value: 'this-week', label: 'This week' },\n * ]}\n * value={when}\n * onValueChange={setWhen}\n * />\n * ```\n *\n * A few short choices seen at once in a row are a `SegmentGroup`; a long\n * list, or one in a form row, is a `Select`.\n */\nexport function RadioGroup({\n label,\n items,\n value,\n defaultValue,\n onValueChange,\n disabled,\n name,\n className,\n 'aria-label': ariaLabel,\n}: RadioGroupProps) {\n const rootRef = useRef<HTMLDivElement>(null);\n\n /*\n * As in SegmentGroup: Ark leaves the native radios uncontrolled, so a\n * controlled parent that declines a choice would leave the input checked\n * while the control shows the old one. Restoring the parent's value after\n * Ark has read the inputs keeps the two agreeing.\n */\n const handleValueChange = (details: { value: string | null }) => {\n if (details.value !== null) onValueChange?.(details.value);\n if (value === undefined || !rootRef.current) return;\n for (const input of rootRef.current.querySelectorAll<HTMLInputElement>('input[type=\"radio\"]')) {\n input.checked = input.value === value;\n }\n };\n\n /*\n * Zag names the root by its label part's id, which would outrank an\n * `aria-label`; with both given the visible label is plain text instead.\n */\n const visibleLabel =\n label &&\n (ariaLabel ? (\n <span className=\"ds-radio-group__label\">{label}</span>\n ) : (\n <ArkRadioGroup.Label className=\"ds-radio-group__label\">{label}</ArkRadioGroup.Label>\n ));\n\n const renderItem = (item: RadioGroupItem) => (\n <ArkRadioGroup.Item\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n className=\"ds-radio-group__item\"\n >\n <ArkRadioGroup.ItemControl className=\"ds-radio-group__control\" />\n <ArkRadioGroup.ItemText className=\"ds-radio-group__text\">{item.label}</ArkRadioGroup.ItemText>\n <ArkRadioGroup.ItemHiddenInput />\n </ArkRadioGroup.Item>\n );\n\n return (\n <ArkRadioGroup.Root\n ref={rootRef}\n className={cx('ds-radio-group', className)}\n value={value}\n defaultValue={defaultValue}\n onValueChange={handleValueChange}\n disabled={disabled}\n name={name}\n orientation=\"vertical\"\n aria-label={ariaLabel}\n >\n {visibleLabel}\n {items.map(renderItem)}\n </ArkRadioGroup.Root>\n );\n}\n"]}
@@ -117,8 +117,8 @@ export interface SelectProps {
117
117
  * open, so one glyph serves both states. Pass `ChevronRight`, not a
118
118
  * `ChevronDown`: the slot turns what it is given.
119
119
  *
120
- * Defaults to a plain built-in chevron so `@manakind/ui-core` installs and
121
- * renders on its own. Products override it with their own icon set.
120
+ * Defaults to the `chevronRight` of the nearest `IconDefaultsProvider`,
121
+ * where a product puts its own icon set once, or a plain built-in chevron.
122
122
  */
123
123
  indicator?: IconSource;
124
124
  /** Glyph marking the selected option. Same defaulting rule as {@link SelectProps.indicator}. */
@@ -156,5 +156,5 @@ export interface SelectProps {
156
156
  * dialog's panel instead of `<body>`, so the modal does not hide it from
157
157
  * assistive tech.
158
158
  */
159
- export declare function Select({ items, label, placeholder, value, defaultValue, onValueChange, size, disabled, loading, loadingText, invalid, name, className, renderItem, indicator, itemIndicator, 'aria-label': ariaLabel, }: SelectProps): import("react/jsx-runtime").JSX.Element;
159
+ export declare function Select({ items, label, placeholder, value, defaultValue, onValueChange, size, disabled, loading, loadingText, invalid, name, className, renderItem, indicator: indicatorProp, itemIndicator: itemIndicatorProp, 'aria-label': ariaLabel, }: SelectProps): import("react/jsx-runtime").JSX.Element;
160
160
  //# sourceMappingURL=select.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/select/select.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAoC,MAAM,OAAO,CAAC;AACzE,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,cAAc,CAAC;AAKtB,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,MAAM,WAAW,UAAU;IACzB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,8BAA8B;IAC9B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MA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C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,SAAS,CAAC;IAC7C;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,gGAAgG;IAChG,aAAa,CAAC,EAAE,UAAU,CAAC;IAC3B,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AA+BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,KAAK,EACL,WAAW,EACX,KAAK,EACL,YAAY,EACZ,aAAa,EACb,IAAW,EACX,QAAQ,EACR,OAAe,EACf,WAAwB,EACxB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,UAAU,EACV,SAAS,EAAE,aAAa,EACxB,aAAa,EAAE,iBAAiB,EAChC,YAAY,EAAE,SAAS,GACxB,EAAE,WAAW,2CAwHb"}
@@ -6,8 +6,8 @@ import { Icon } from '../icon/icon';
6
6
  import { PortalContainerContext } from '../portal-container';
7
7
  import './select.css';
8
8
  import { cx } from '../cx';
9
- import { Check, ChevronRight } from '../fallback-glyphs';
10
9
  import { groupItems } from '../group-items';
10
+ import { useIconDefaults } from '../icon-defaults';
11
11
  function ItemContent({ item }) {
12
12
  return (_jsxs("span", { className: "ds-select__item-content", children: [item.icon && _jsx("span", { className: "ds-select__item-icon", children: item.icon }), _jsxs("span", { className: "ds-select__item-text", children: [_jsx("span", { children: item.label }), item.description && (_jsxs(_Fragment, { children: [' ', _jsx("span", { className: "ds-select__item-description", children: item.description })] }))] })] }));
13
13
  }
@@ -48,7 +48,10 @@ function chosenWithIcon(item) {
48
48
  * dialog's panel instead of `<body>`, so the modal does not hide it from
49
49
  * assistive tech.
50
50
  */
51
- export function Select({ items, label, placeholder, value, defaultValue, onValueChange, size = 'md', disabled, loading = false, loadingText = 'Loading…', invalid, name, className, renderItem, indicator = ChevronRight, itemIndicator = Check, 'aria-label': ariaLabel, }) {
51
+ export function Select({ items, label, placeholder, value, defaultValue, onValueChange, size = 'md', disabled, loading = false, loadingText = 'Loading…', invalid, name, className, renderItem, indicator: indicatorProp, itemIndicator: itemIndicatorProp, 'aria-label': ariaLabel, }) {
52
+ const icons = useIconDefaults();
53
+ const indicator = indicatorProp ?? icons.chevronRight;
54
+ const itemIndicator = itemIndicatorProp ?? icons.check;
52
55
  // The collection holds the options in drawn order, so arrows, typeahead and
53
56
  // the hidden native select all follow the list on screen.
54
57
  const groups = useMemo(() => groupItems(items), [items]);