@cimpress-ui/react 1.23.0 → 1.25.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 (129) hide show
  1. package/dist/commonjs/components/app-header/side-nav.d.ts +1 -9
  2. package/dist/commonjs/components/app-header/side-nav.d.ts.map +1 -1
  3. package/dist/commonjs/components/app-header/side-nav.js +3 -3
  4. package/dist/commonjs/components/app-header/side-nav.js.map +1 -1
  5. package/dist/commonjs/components/checkbox/checkbox.d.ts.map +1 -1
  6. package/dist/commonjs/components/checkbox/checkbox.js +1 -1
  7. package/dist/commonjs/components/checkbox/checkbox.js.map +1 -1
  8. package/dist/commonjs/components/code/code.d.ts +14 -0
  9. package/dist/commonjs/components/code/code.d.ts.map +1 -0
  10. package/dist/commonjs/components/code/code.js +22 -0
  11. package/dist/commonjs/components/code/code.js.map +1 -0
  12. package/dist/commonjs/components/code-block/code-block.d.ts +13 -0
  13. package/dist/commonjs/components/code-block/code-block.d.ts.map +1 -0
  14. package/dist/commonjs/components/code-block/code-block.js +50 -0
  15. package/dist/commonjs/components/code-block/code-block.js.map +1 -0
  16. package/dist/commonjs/components/combo-box/combo-box.d.ts +1 -0
  17. package/dist/commonjs/components/combo-box/combo-box.d.ts.map +1 -1
  18. package/dist/commonjs/components/combo-box/combo-box.js +23 -5
  19. package/dist/commonjs/components/combo-box/combo-box.js.map +1 -1
  20. package/dist/commonjs/components/internal/checkbox-indicator/checkbox-indicator.js +2 -4
  21. package/dist/commonjs/components/internal/checkbox-indicator/checkbox-indicator.js.map +1 -1
  22. package/dist/commonjs/components/internal/collapsible-list/collapsible-list.js.map +1 -1
  23. package/dist/commonjs/components/menu/menu.d.ts +14 -1
  24. package/dist/commonjs/components/menu/menu.d.ts.map +1 -1
  25. package/dist/commonjs/components/menu/menu.js +16 -2
  26. package/dist/commonjs/components/menu/menu.js.map +1 -1
  27. package/dist/commonjs/components/select/select.d.ts +1 -1
  28. package/dist/commonjs/components/select/select.d.ts.map +1 -1
  29. package/dist/commonjs/components/select/select.js +3 -2
  30. package/dist/commonjs/components/select/select.js.map +1 -1
  31. package/dist/commonjs/components/slider/slider.d.ts +15 -7
  32. package/dist/commonjs/components/slider/slider.d.ts.map +1 -1
  33. package/dist/commonjs/components/slider/slider.js +18 -20
  34. package/dist/commonjs/components/slider/slider.js.map +1 -1
  35. package/dist/commonjs/components/tag-field/tag-field.js +1 -1
  36. package/dist/commonjs/components/tag-field/tag-field.js.map +1 -1
  37. package/dist/commonjs/components/toast/toast-queue.d.ts +9 -7
  38. package/dist/commonjs/components/toast/toast-queue.d.ts.map +1 -1
  39. package/dist/commonjs/components/toast/toast-queue.js +6 -5
  40. package/dist/commonjs/components/toast/toast-queue.js.map +1 -1
  41. package/dist/commonjs/components/toast/toast-region.d.ts +1 -1
  42. package/dist/commonjs/components/toast/toast-region.d.ts.map +1 -1
  43. package/dist/commonjs/components/toast/toast-region.js +3 -3
  44. package/dist/commonjs/components/toast/toast-region.js.map +1 -1
  45. package/dist/commonjs/components/toast/toast.js +3 -3
  46. package/dist/commonjs/components/toast/toast.js.map +1 -1
  47. package/dist/commonjs/components/toast/types.d.ts +1 -1
  48. package/dist/commonjs/components/toast/types.d.ts.map +1 -1
  49. package/dist/commonjs/components/toast/types.js.map +1 -1
  50. package/dist/commonjs/components/typography/list.d.ts +31 -0
  51. package/dist/commonjs/components/typography/list.d.ts.map +1 -0
  52. package/dist/commonjs/components/typography/list.js +39 -0
  53. package/dist/commonjs/components/typography/list.js.map +1 -0
  54. package/dist/commonjs/i18n/messages/en-US.d.ts.map +1 -1
  55. package/dist/commonjs/i18n/messages/en-US.js +1 -0
  56. package/dist/commonjs/i18n/messages/en-US.js.map +1 -1
  57. package/dist/commonjs/i18n/messages/types.d.ts +6 -0
  58. package/dist/commonjs/i18n/messages/types.d.ts.map +1 -1
  59. package/dist/commonjs/i18n/messages/types.js.map +1 -1
  60. package/dist/commonjs/index.d.ts +6 -3
  61. package/dist/commonjs/index.d.ts.map +1 -1
  62. package/dist/commonjs/index.js +7 -4
  63. package/dist/commonjs/index.js.map +1 -1
  64. package/dist/esm/components/app-header/side-nav.d.ts +1 -9
  65. package/dist/esm/components/app-header/side-nav.d.ts.map +1 -1
  66. package/dist/esm/components/app-header/side-nav.js +3 -3
  67. package/dist/esm/components/app-header/side-nav.js.map +1 -1
  68. package/dist/esm/components/checkbox/checkbox.d.ts.map +1 -1
  69. package/dist/esm/components/checkbox/checkbox.js +1 -1
  70. package/dist/esm/components/checkbox/checkbox.js.map +1 -1
  71. package/dist/esm/components/code/code.d.ts +14 -0
  72. package/dist/esm/components/code/code.d.ts.map +1 -0
  73. package/dist/esm/components/code/code.js +16 -0
  74. package/dist/esm/components/code/code.js.map +1 -0
  75. package/dist/esm/components/code-block/code-block.d.ts +13 -0
  76. package/dist/esm/components/code-block/code-block.d.ts.map +1 -0
  77. package/dist/esm/components/code-block/code-block.js +44 -0
  78. package/dist/esm/components/code-block/code-block.js.map +1 -0
  79. package/dist/esm/components/combo-box/combo-box.d.ts +1 -0
  80. package/dist/esm/components/combo-box/combo-box.d.ts.map +1 -1
  81. package/dist/esm/components/combo-box/combo-box.js +24 -6
  82. package/dist/esm/components/combo-box/combo-box.js.map +1 -1
  83. package/dist/esm/components/internal/checkbox-indicator/checkbox-indicator.js +2 -4
  84. package/dist/esm/components/internal/checkbox-indicator/checkbox-indicator.js.map +1 -1
  85. package/dist/esm/components/internal/collapsible-list/collapsible-list.js.map +1 -1
  86. package/dist/esm/components/menu/menu.d.ts +14 -1
  87. package/dist/esm/components/menu/menu.d.ts.map +1 -1
  88. package/dist/esm/components/menu/menu.js +17 -4
  89. package/dist/esm/components/menu/menu.js.map +1 -1
  90. package/dist/esm/components/select/select.d.ts +1 -1
  91. package/dist/esm/components/select/select.d.ts.map +1 -1
  92. package/dist/esm/components/select/select.js +4 -3
  93. package/dist/esm/components/select/select.js.map +1 -1
  94. package/dist/esm/components/slider/slider.d.ts +15 -7
  95. package/dist/esm/components/slider/slider.d.ts.map +1 -1
  96. package/dist/esm/components/slider/slider.js +17 -19
  97. package/dist/esm/components/slider/slider.js.map +1 -1
  98. package/dist/esm/components/tag-field/tag-field.js +1 -1
  99. package/dist/esm/components/tag-field/tag-field.js.map +1 -1
  100. package/dist/esm/components/toast/toast-queue.d.ts +9 -7
  101. package/dist/esm/components/toast/toast-queue.d.ts.map +1 -1
  102. package/dist/esm/components/toast/toast-queue.js +5 -4
  103. package/dist/esm/components/toast/toast-queue.js.map +1 -1
  104. package/dist/esm/components/toast/toast-region.d.ts +1 -1
  105. package/dist/esm/components/toast/toast-region.d.ts.map +1 -1
  106. package/dist/esm/components/toast/toast-region.js +3 -3
  107. package/dist/esm/components/toast/toast-region.js.map +1 -1
  108. package/dist/esm/components/toast/toast.js +2 -2
  109. package/dist/esm/components/toast/toast.js.map +1 -1
  110. package/dist/esm/components/toast/types.d.ts +1 -1
  111. package/dist/esm/components/toast/types.d.ts.map +1 -1
  112. package/dist/esm/components/toast/types.js.map +1 -1
  113. package/dist/esm/components/typography/list.d.ts +31 -0
  114. package/dist/esm/components/typography/list.d.ts.map +1 -0
  115. package/dist/esm/components/typography/list.js +31 -0
  116. package/dist/esm/components/typography/list.js.map +1 -0
  117. package/dist/esm/i18n/messages/en-US.d.ts.map +1 -1
  118. package/dist/esm/i18n/messages/en-US.js +1 -0
  119. package/dist/esm/i18n/messages/en-US.js.map +1 -1
  120. package/dist/esm/i18n/messages/types.d.ts +6 -0
  121. package/dist/esm/i18n/messages/types.d.ts.map +1 -1
  122. package/dist/esm/i18n/messages/types.js.map +1 -1
  123. package/dist/esm/index.d.ts +6 -3
  124. package/dist/esm/index.d.ts.map +1 -1
  125. package/dist/esm/index.js +5 -2
  126. package/dist/esm/index.js.map +1 -1
  127. package/dist-styles/core.css +1 -1
  128. package/dist-styles/styles.css +1 -1
  129. package/package.json +6 -6
@@ -4,16 +4,8 @@ export interface UNSTABLE_SideNavProps {
4
4
  children: ReactNode;
5
5
  isOpen?: boolean;
6
6
  onOpenChange?: (isOpen: boolean) => void;
7
- /**
8
- * Determines how the side nav is displayed and behaves.
9
- * - `overlay`: The side nav slides in as an overlay on top of the main content. This is used when all available screen space is needed for the main content.
10
- * - `fixed`: The side nav is fixed to the side and includes an expand button to toggle between a compact icon-only view and an expanded view showing labels. On smaller screens, it slides in as an overlay.
11
- *
12
- * @default 'fixed'
13
- */
14
- variant?: 'overlay' | 'fixed';
15
7
  }
16
- export declare function UNSTABLE_SideNav({ children, isOpen, onOpenChange, variant }: UNSTABLE_SideNavProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function UNSTABLE_SideNav({ children, isOpen, onOpenChange }: UNSTABLE_SideNavProps): import("react/jsx-runtime").JSX.Element;
17
9
  export interface UNSTABLE_SideNavListProps {
18
10
  children: ReactNode;
19
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"side-nav.d.ts","sourceRoot":"","sources":["../../../../src/components/app-header/side-nav.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AASlE,OAAO,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAK5D,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;CAC/B;AAED,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,OAAiB,EAAE,EAAE,qBAAqB,2CA6B5G;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE,yBAAyB,2CAE3E;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAA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AQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,6BAA6B,2CAazG;AAED,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,2BAA2B,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,gCAAgC,2CAehG"}
@@ -17,10 +17,10 @@ const hidden_js_1 = require("../hidden/hidden.js");
17
17
  const tooltip_js_1 = require("../tooltip/tooltip.js");
18
18
  const text_js_1 = require("../typography/text.js");
19
19
  const SideNavContext = (0, react_1.createContext)({ isOpen: false });
20
- function UNSTABLE_SideNav({ children, isOpen, onOpenChange, variant = 'fixed' }) {
20
+ function UNSTABLE_SideNav({ children, isOpen, onOpenChange }) {
21
21
  const isMobile = (0, use_is_mobile_js_1.useIsMobile)();
22
- const drawer = (isMobile || variant === 'overlay') && ((0, jsx_runtime_1.jsx)(drawer_js_1.Drawer, { UNSTABLE_placement: "start", isOpen: isOpen, onOpenChange: onOpenChange, "aria-label": "Side navigation", children: (0, jsx_runtime_1.jsx)(drawer_js_1.DrawerBody, { children: children }) }));
23
- return ((0, jsx_runtime_1.jsxs)(SideNavContext.Provider, { value: { isOpen: isOpen ?? false }, children: [drawer, variant === 'fixed' && ((0, jsx_runtime_1.jsx)(hidden_js_1.UNSTABLE_Hidden, { hide: { sm: true, md: false }, children: (0, jsx_runtime_1.jsxs)("div", { className: "cim-side-nav", "data-expanded": isOpen, children: [(0, jsx_runtime_1.jsx)("div", { className: "cim-side-nav-header", children: (0, jsx_runtime_1.jsx)(icon_button_js_1.IconButton, { variant: "tertiary", icon: isOpen ? (0, jsx_runtime_1.jsx)(index_js_1.IconPushLeft, {}) : (0, jsx_runtime_1.jsx)(index_js_1.IconPushRight, {}), "aria-label": "Expand sidebar", onPress: () => onOpenChange?.(!isOpen) }) }), (0, jsx_runtime_1.jsx)("div", { className: "cim-side-nav-list-container", children: children })] }) }))] }));
22
+ const drawer = isMobile && ((0, jsx_runtime_1.jsx)(drawer_js_1.Drawer, { UNSTABLE_placement: "start", isOpen: isOpen, onOpenChange: onOpenChange, "aria-label": "Side navigation", children: (0, jsx_runtime_1.jsx)(drawer_js_1.DrawerBody, { children: children }) }));
23
+ return ((0, jsx_runtime_1.jsxs)(SideNavContext.Provider, { value: { isOpen: isOpen ?? false }, children: [drawer, (0, jsx_runtime_1.jsx)(hidden_js_1.UNSTABLE_Hidden, { hide: { sm: true, md: false }, children: (0, jsx_runtime_1.jsxs)("div", { className: "cim-side-nav", "data-expanded": isOpen, children: [(0, jsx_runtime_1.jsx)("div", { className: "cim-side-nav-header", children: (0, jsx_runtime_1.jsx)(icon_button_js_1.IconButton, { variant: "tertiary", icon: isOpen ? (0, jsx_runtime_1.jsx)(index_js_1.IconPushLeft, {}) : (0, jsx_runtime_1.jsx)(index_js_1.IconPushRight, {}), "aria-label": "Expand sidebar", onPress: () => onOpenChange?.(!isOpen) }) }), (0, jsx_runtime_1.jsx)("div", { className: "cim-side-nav-list-container", children: children })] }) })] }));
24
24
  }
25
25
  function UNSTABLE_SideNavList({ children }) {
26
26
  return (0, jsx_runtime_1.jsx)("div", { className: "cim-side-nav-list", children: children });
@@ -1 +1 @@
1
- {"version":3,"file":"side-nav.js","sourceRoot":"","sources":["../../../../src/components/app-header/side-nav.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AA8Bb,4CA6BC;AAMD,oDAEC;AASD,4DAaC;AAOD,kEAeC;;AA7GD,iCAAkE;AAClE,iEAAwD;AACxD,mDAAmE;AACnE,qGAA2F;AAC3F,mEAA2D;AAC3D,6DAAsD;AACtD,mDAAyD;AACzD,mDAAsD;AACtD,sDAAgD;AAEhD,mDAA6C;AAE7C,MAAM,cAAc,GAAG,IAAA,qBAAa,EAAsB,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAgB7E,SAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,MAAM,EA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,EAAE,GAAG,IAAA,kBAAU,EAAC,cAAc,CAAC,CAAC;IAE9C,OAAO,CACL,uBAAC,oBAAO,IAAC,KAAK,EAAE,IAAA,8DAA0B,EAAC,QAAQ,CAAC,EAAE,SAAS,EAAC,OAAO,EAAC,UAAU,EAAE,MAAM,YACxF,wBAAC,4BAAO,IAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,wBAAwB,iBAAc,QAAQ,mBAAiB,MAAM,aACjG,IAAI,EACL,uBAAC,cAAI,IAAC,EAAE,EAAC,MAAM,EAAC,OAAO,EAAC,QAAQ,EAAC,gBAAgB,EAAC,8BAA8B,YAC7E,QAAQ,GACJ,IACC,GACF,CACX,CAAC;AACJ,CAAC;AAOD,SAAgB,2BAA2B,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAoC;IAC/F,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,kBAAU,EAAC,cAAc,CAAC,CAAC;IAE9C,OAAO,CACL,iCAAK,SAAS,EAAC,2BAA2B,mBAAgB,MAAM,aAC7D,KAAK,IAAI,CACR,gCAAK,SAAS,EAAC,kCAAkC,YAC/C,uBAAC,cAAI,IAAC,EAAE,EAAC,GAAG,EAAC,OAAO,EAAC,gBAAgB,EAAC,IAAI,EAAC,QAAQ,EAAC,gBAAgB,EAAC,wCAAwC,YAC1G,KAAK,GACD,GACH,CACP,EACA,QAAQ,IACL,CACP,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { createContext, useContext, type ReactNode } from 'react';\nimport { Link as RACLink } from 'react-aria-components';\nimport { IconPushLeft, IconPushRight } from '../../icons/index.js';\nimport { stringLikeChildrenToString } from '../../utils/string-like-children-to-string.js';\nimport { useIsMobile } from '../../utils/use-is-mobile.js';\nimport { IconButton } from '../button/icon-button.js';\nimport { Drawer, DrawerBody } from '../drawer/drawer.js';\nimport { UNSTABLE_Hidden } from '../hidden/hidden.js';\nimport { Tooltip } from '../tooltip/tooltip.js';\nimport type { Href, StringLikeChildren } from '../types.js';\nimport { Text } from '../typography/text.js';\n\nconst SideNavContext = createContext<{ isOpen: boolean }>({ isOpen: false });\n\nexport interface UNSTABLE_SideNavProps {\n children: ReactNode;\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n /**\n * Determines how the side nav is displayed and behaves.\n * - `overlay`: The side nav slides in as an overlay on top of the main content. This is used when all available screen space is needed for the main content.\n * - `fixed`: The side nav is fixed to the side and includes an expand button to toggle between a compact icon-only view and an expanded view showing labels. On smaller screens, it slides in as an overlay.\n *\n * @default 'fixed'\n */\n variant?: 'overlay' | 'fixed';\n}\n\nexport function UNSTABLE_SideNav({ children, isOpen, onOpenChange, variant = 'fixed' }: UNSTABLE_SideNavProps) {\n const isMobile = useIsMobile();\n\n const drawer = (isMobile || variant === 'overlay') && (\n <Drawer UNSTABLE_placement=\"start\" isOpen={isOpen} onOpenChange={onOpenChange} aria-label=\"Side navigation\">\n <DrawerBody>{children}</DrawerBody>\n </Drawer>\n );\n\n return (\n <SideNavContext.Provider value={{ isOpen: isOpen ?? false }}>\n {drawer}\n {variant === 'fixed' && (\n <UNSTABLE_Hidden hide={{ sm: true, md: false }}>\n <div className=\"cim-side-nav\" data-expanded={isOpen}>\n <div className=\"cim-side-nav-header\">\n <IconButton\n variant=\"tertiary\"\n icon={isOpen ? <IconPushLeft /> : <IconPushRight />}\n aria-label=\"Expand sidebar\"\n onPress={() => onOpenChange?.(!isOpen)}\n />\n </div>\n <div className=\"cim-side-nav-list-container\">{children}</div>\n </div>\n </UNSTABLE_Hidden>\n )}\n </SideNavContext.Provider>\n );\n}\n\nexport interface UNSTABLE_SideNavListProps {\n children: ReactNode;\n}\n\nexport function UNSTABLE_SideNavList({ children }: UNSTABLE_SideNavListProps) {\n return <div className=\"cim-side-nav-list\">{children}</div>;\n}\n\nexport interface UNSTABLE_SideNavListItemProps {\n children: StringLikeChildren;\n href: Href;\n isActive?: boolean;\n icon?: ReactNode;\n}\n\nexport function UNSTABLE_SideNavListItem({ children, href, isActive, icon }: UNSTABLE_SideNavListItemProps) {\n const { isOpen } = useContext(SideNavContext);\n\n return (\n <Tooltip label={stringLikeChildrenToString(children)} placement=\"right\" isDisabled={isOpen}>\n <RACLink href={href} className=\"cim-side-nav-list-item\" data-active={isActive} data-expanded={isOpen}>\n {icon}\n <Text as=\"span\" variant=\"medium\" UNSAFE_className=\"cim-side-nav-list-item-label\">\n {children}\n </Text>\n </RACLink>\n </Tooltip>\n );\n}\n\nexport interface UNSTABLE_SideNavListSectionProps {\n children: ReactNode;\n label?: string;\n}\n\nexport function UNSTABLE_SideNavListSection({ children, label }: UNSTABLE_SideNavListSectionProps) {\n const { isOpen } = useContext(SideNavContext);\n\n return (\n <div className=\"cim-side-nav-list-section\" data-expanded={isOpen}>\n {label && (\n <div className=\"cim-side-nav-list-section-header\">\n <Text as=\"p\" variant=\"small-semibold\" tone=\"subtle\" UNSAFE_className=\"cim-side-nav-list-section-header-label\">\n {label}\n </Text>\n </div>\n )}\n {children}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"side-nav.js","sourceRoot":"","sources":["../../../../src/components/app-header/side-nav.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAsBb,4CA2BC;AAMD,oDAEC;AASD,4DAaC;AAOD,kEAeC;;AAnGD,iCAAkE;AAClE,iEAAwD;AACxD,mDAAmE;AACnE,qGAA2F;AAC3F,mEAA2D;AAC3D,6DAAsD;AACtD,mDAAyD;AACzD,mDAAsD;AACtD,sDAAgD;AAEhD,mDAA6C;AAE7C,MAAM,cAAc,GAAG,IAAA,qBAAa,EAAsB,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAQ7E,SAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAyB;IACxF,MAAM,QAAQ,GAAG,IAAA,8BAAW,GAAE,CAAC;IAE/B,MAAM,MAAM,GAAG,QAAQ,IAAI,CACzB,uBAAC,kBAAM,IAAC,kBAAkB,EAAC,OAAO,EA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iBAAc,QAAQ,mBAAiB,MAAM,aACjG,IAAI,EACL,uBAAC,cAAI,IAAC,EAAE,EAAC,MAAM,EAAC,OAAO,EAAC,QAAQ,EAAC,gBAAgB,EAAC,8BAA8B,YAC7E,QAAQ,GACJ,IACC,GACF,CACX,CAAC;AACJ,CAAC;AAOD,SAAgB,2BAA2B,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAoC;IAC/F,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,kBAAU,EAAC,cAAc,CAAC,CAAC;IAE9C,OAAO,CACL,iCAAK,SAAS,EAAC,2BAA2B,mBAAgB,MAAM,aAC7D,KAAK,IAAI,CACR,gCAAK,SAAS,EAAC,kCAAkC,YAC/C,uBAAC,cAAI,IAAC,EAAE,EAAC,GAAG,EAAC,OAAO,EAAC,gBAAgB,EAAC,IAAI,EAAC,QAAQ,EAAC,gBAAgB,EAAC,wCAAwC,YAC1G,KAAK,GACD,GACH,CACP,EACA,QAAQ,IACL,CACP,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { createContext, useContext, type ReactNode } from 'react';\nimport { Link as RACLink } from 'react-aria-components';\nimport { IconPushLeft, IconPushRight } from '../../icons/index.js';\nimport { stringLikeChildrenToString } from '../../utils/string-like-children-to-string.js';\nimport { useIsMobile } from '../../utils/use-is-mobile.js';\nimport { IconButton } from '../button/icon-button.js';\nimport { Drawer, DrawerBody } from '../drawer/drawer.js';\nimport { UNSTABLE_Hidden } from '../hidden/hidden.js';\nimport { Tooltip } from '../tooltip/tooltip.js';\nimport type { Href, StringLikeChildren } from '../types.js';\nimport { Text } from '../typography/text.js';\n\nconst SideNavContext = createContext<{ isOpen: boolean }>({ isOpen: false });\n\nexport interface UNSTABLE_SideNavProps {\n children: ReactNode;\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n}\n\nexport function UNSTABLE_SideNav({ children, isOpen, onOpenChange }: UNSTABLE_SideNavProps) {\n const isMobile = useIsMobile();\n\n const drawer = isMobile && (\n <Drawer UNSTABLE_placement=\"start\" isOpen={isOpen} onOpenChange={onOpenChange} aria-label=\"Side navigation\">\n <DrawerBody>{children}</DrawerBody>\n </Drawer>\n );\n\n return (\n <SideNavContext.Provider value={{ isOpen: isOpen ?? false }}>\n {drawer}\n <UNSTABLE_Hidden hide={{ sm: true, md: false }}>\n <div className=\"cim-side-nav\" data-expanded={isOpen}>\n <div className=\"cim-side-nav-header\">\n <IconButton\n variant=\"tertiary\"\n icon={isOpen ? <IconPushLeft /> : <IconPushRight />}\n aria-label=\"Expand sidebar\"\n onPress={() => onOpenChange?.(!isOpen)}\n />\n </div>\n <div className=\"cim-side-nav-list-container\">{children}</div>\n </div>\n </UNSTABLE_Hidden>\n </SideNavContext.Provider>\n );\n}\n\nexport interface UNSTABLE_SideNavListProps {\n children: ReactNode;\n}\n\nexport function UNSTABLE_SideNavList({ children }: UNSTABLE_SideNavListProps) {\n return <div className=\"cim-side-nav-list\">{children}</div>;\n}\n\nexport interface UNSTABLE_SideNavListItemProps {\n children: StringLikeChildren;\n href: Href;\n isActive?: boolean;\n icon?: ReactNode;\n}\n\nexport function UNSTABLE_SideNavListItem({ children, href, isActive, icon }: UNSTABLE_SideNavListItemProps) {\n const { isOpen } = useContext(SideNavContext);\n\n return (\n <Tooltip label={stringLikeChildrenToString(children)} placement=\"right\" isDisabled={isOpen}>\n <RACLink href={href} className=\"cim-side-nav-list-item\" data-active={isActive} data-expanded={isOpen}>\n {icon}\n <Text as=\"span\" variant=\"medium\" UNSAFE_className=\"cim-side-nav-list-item-label\">\n {children}\n </Text>\n </RACLink>\n </Tooltip>\n );\n}\n\nexport interface UNSTABLE_SideNavListSectionProps {\n children: ReactNode;\n label?: string;\n}\n\nexport function UNSTABLE_SideNavListSection({ children, label }: UNSTABLE_SideNavListSectionProps) {\n const { isOpen } = useContext(SideNavContext);\n\n return (\n <div className=\"cim-side-nav-list-section\" data-expanded={isOpen}>\n {label && (\n <div className=\"cim-side-nav-list-section-header\">\n <Text as=\"p\" variant=\"small-semibold\" tone=\"subtle\" UNSAFE_className=\"cim-side-nav-list-section-header-label\">\n {label}\n </Text>\n </div>\n )}\n {children}\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/checkbox/checkbox.tsx"],"names":[],"mappings":"AAIA,OAAO,EAA2B,KAAK,aAAa,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKxG,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtF,MAAM,WAAW,aACf,SACE,WAAW,EACX,iBAAiB,EACjB,IAAI,CACF,gBAAgB,EACd,UAAU,GACV,YAAY,GACZ,iBAAiB,GACjB,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,MAAM,GACN,MAAM,GACN,OAAO,GACP,iBAAiB,GACjB,WAAW,CACd;IACH,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B;AAmCD;;;;GAIG;AACH,QAAA,MAAM,SAAS,iKAAmD,CAAC;AAEnE,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/checkbox/checkbox.tsx"],"names":[],"mappings":"AAIA,OAAO,EAA2B,KAAK,aAAa,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKxG,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtF,MAAM,WAAW,aACf,SACE,WAAW,EACX,iBAAiB,EACjB,IAAI,CACF,gBAAgB,EACd,UAAU,GACV,YAAY,GACZ,iBAAiB,GACjB,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,MAAM,GACN,MAAM,GACN,OAAO,GACP,iBAAiB,GACjB,WAAW,CACd;IACH,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B;AAuCD;;;;GAIG;AACH,QAAA,MAAM,SAAS,iKAAmD,CAAC;AAEnE,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,CAAC"}
@@ -20,7 +20,7 @@ function Checkbox({ children, UNSAFE_className, UNSAFE_style, ...props }, ref) {
20
20
  console.warn('Checkbox requires one of children / aria-label / aria-labelledby for accessibility');
21
21
  }
22
22
  }, [children, ariaLabel, ariaLabelledBy]);
23
- return ((0, jsx_runtime_1.jsx)(react_aria_components_1.Checkbox, { ...props, ref: ref, className: (0, clsx_1.default)('cim-checkbox', 'cim-checkbox-indicator-wrapper', UNSAFE_className), style: UNSAFE_style, children: ({ isIndeterminate, isSelected }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(checkbox_indicator_js_1.CheckboxIndicator, { isIndeterminate: isIndeterminate, isSelected: isSelected }), children && ((0, jsx_runtime_1.jsx)(text_js_1.Text, { as: "span", variant: "medium", children: children }))] })) }));
23
+ return ((0, jsx_runtime_1.jsx)(react_aria_components_1.Checkbox, { ...props, ref: ref, className: (0, clsx_1.default)('cim-checkbox', UNSAFE_className), style: UNSAFE_style, children: ({ isIndeterminate, isSelected, isDisabled, isReadOnly, isInvalid, isHovered, isPressed, isFocusVisible }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(checkbox_indicator_js_1.CheckboxIndicator, { isIndeterminate: isIndeterminate, isSelected: isSelected, isDisabled: isDisabled, isReadOnly: isReadOnly, isInvalid: isInvalid, isHovered: isHovered, isPressed: isPressed, isFocusVisible: isFocusVisible }), children && ((0, jsx_runtime_1.jsx)(text_js_1.Text, { as: "span", variant: "medium", children: children }))] })) }));
24
24
  }
25
25
  /**
26
26
  * Allows users to mark an item as selected. Can be used standalone, or as part of `CheckboxGroup`.
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox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use client';\n\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\nimport { Checkbox as RACCheckbox, type CheckboxProps as RACCheckboxProps } from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { CheckboxIndicator } from '../internal/checkbox-indicator/checkbox-indicator.js';\nimport type { AriaLabelingProps, CommonProps, StringLikeChildren } from '../types.js';\nimport { Text } from '../typography/text.js';\n\nexport interface CheckboxProps\n extends\n CommonProps,\n AriaLabelingProps,\n Pick<\n RACCheckboxProps,\n | 'onChange'\n | 'isSelected'\n | 'isIndeterminate'\n | 'isDisabled'\n | 'isReadOnly'\n | 'isRequired'\n | 'isInvalid'\n | 'form'\n | 'name'\n | 'value'\n | 'defaultSelected'\n | 'autoFocus'\n > {\n /** The label rendered next to the checkbox. */\n children?: StringLikeChildren;\n}\n\nfunction Checkbox(\n { children, UNSAFE_className, UNSAFE_style, ...props }: CheckboxProps,\n ref: ForwardedRef<HTMLLabelElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!children && !ariaLabel && !ariaLabelledBy) {\n console.warn('Checkbox requires one of children / aria-label / aria-labelledby for accessibility');\n }\n }, [children, ariaLabel, ariaLabelledBy]);\n\n return (\n <RACCheckbox\n {...props}\n ref={ref}\n className={clsx('cim-checkbox', 'cim-checkbox-indicator-wrapper', UNSAFE_className)}\n style={UNSAFE_style}\n >\n {({ isIndeterminate, isSelected }) => (\n <>\n <CheckboxIndicator isIndeterminate={isIndeterminate} isSelected={isSelected} />\n {children && (\n <Text as=\"span\" variant=\"medium\">\n {children}\n </Text>\n )}\n </>\n )}\n </RACCheckbox>\n );\n}\n\n/**\n * Allows users to mark an item as selected. Can be used standalone, or as part of `CheckboxGroup`.\n *\n * See [checkbox usage guidelines](https://ui.cimpress.io/components/checkbox/).\n */\nconst _Checkbox = withStyleProps(forwardRef(Checkbox), 'Checkbox');\n\nexport { _Checkbox as Checkbox };\n"]}
1
+ {"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../../src/components/checkbox/checkbox.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,gDAAwB;AAExB,iEAAwG;AACxG,yDAAkD;AAClD,qFAA6E;AAC7E,mEAA2D;AAC3D,gGAAyF;AAEzF,mDAA6C;AAyB7C,SAAS,QAAQ,CACf,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAiB,EACrE,GAAmC;IAEnC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAE7E,IAAA,gDAAoB,EAAC,GAAG,EAAE;QACxB,IAAI,CAAC,QAAQ,IAAI,CAAC,SAAS,IAAI,CAAC,cAAc,EAAE,CAAC;YAC/C,OAAO,CAAC,IAAI,CAAC,oFAAoF,CAAC,CAAC;QACrG,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;IAE1C,OAAO,CACL,uBAAC,gCAAW,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAA,cAAI,EAAC,cAAc,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,YACrG,CAAC,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,CAC7G,6DACE,uBAAC,yCAAiB,IAChB,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,GAC9B,EACD,QAAQ,IAAI,CACX,uBAAC,cAAI,IAAC,EAAE,EAAC,MAAM,EAAC,OAAO,EAAC,QAAQ,YAC7B,QAAQ,GACJ,CACR,IACA,CACJ,GACW,CACf,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,SAAS,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAC;AAE7C,6BAAQ","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\nimport { Checkbox as RACCheckbox, type CheckboxProps as RACCheckboxProps } from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { CheckboxIndicator } from '../internal/checkbox-indicator/checkbox-indicator.js';\nimport type { AriaLabelingProps, CommonProps, StringLikeChildren } from '../types.js';\nimport { Text } from '../typography/text.js';\n\nexport interface CheckboxProps\n extends\n CommonProps,\n AriaLabelingProps,\n Pick<\n RACCheckboxProps,\n | 'onChange'\n | 'isSelected'\n | 'isIndeterminate'\n | 'isDisabled'\n | 'isReadOnly'\n | 'isRequired'\n | 'isInvalid'\n | 'form'\n | 'name'\n | 'value'\n | 'defaultSelected'\n | 'autoFocus'\n > {\n /** The label rendered next to the checkbox. */\n children?: StringLikeChildren;\n}\n\nfunction Checkbox(\n { children, UNSAFE_className, UNSAFE_style, ...props }: CheckboxProps,\n ref: ForwardedRef<HTMLLabelElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!children && !ariaLabel && !ariaLabelledBy) {\n console.warn('Checkbox requires one of children / aria-label / aria-labelledby for accessibility');\n }\n }, [children, ariaLabel, ariaLabelledBy]);\n\n return (\n <RACCheckbox {...props} ref={ref} className={clsx('cim-checkbox', UNSAFE_className)} style={UNSAFE_style}>\n {({ isIndeterminate, isSelected, isDisabled, isReadOnly, isInvalid, isHovered, isPressed, isFocusVisible }) => (\n <>\n <CheckboxIndicator\n isIndeterminate={isIndeterminate}\n isSelected={isSelected}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isInvalid={isInvalid}\n isHovered={isHovered}\n isPressed={isPressed}\n isFocusVisible={isFocusVisible}\n />\n {children && (\n <Text as=\"span\" variant=\"medium\">\n {children}\n </Text>\n )}\n </>\n )}\n </RACCheckbox>\n );\n}\n\n/**\n * Allows users to mark an item as selected. Can be used standalone, or as part of `CheckboxGroup`.\n *\n * See [checkbox usage guidelines](https://ui.cimpress.io/components/checkbox/).\n */\nconst _Checkbox = withStyleProps(forwardRef(Checkbox), 'Checkbox');\n\nexport { _Checkbox as Checkbox };\n"]}
@@ -0,0 +1,14 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { CommonProps } from '../types.js';
3
+ export interface CodeProps extends CommonProps {
4
+ /** The inline code content to display. */
5
+ children: ReactNode;
6
+ }
7
+ /**
8
+ * Displays short, inline code snippets.
9
+ *
10
+ * See [code usage guidelines](https://ui.cimpress.io/components/code).
11
+ */
12
+ declare const _Code: (props: CodeProps & import("react").RefAttributes<HTMLElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
13
+ export { _Code as Code };
14
+ //# sourceMappingURL=code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../../../src/components/code/code.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,SAAU,SAAQ,WAAW;IAC5C,0CAA0C;IAC1C,QAAQ,EAAE,SAAS,CAAC;CACrB;AAUD;;;;GAIG;AACH,QAAA,MAAM,KAAK,wJAA2C,CAAC;AACvD,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC"}
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.Code = void 0;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const clsx_1 = __importDefault(require("clsx"));
10
+ const forward_ref_js_1 = require("../../forward-ref.js");
11
+ const with_style_props_js_1 = require("../../with-style-props.js");
12
+ function Code({ children, UNSAFE_className, UNSAFE_style, ...props }, ref) {
13
+ return ((0, jsx_runtime_1.jsx)("code", { ...props, ref: ref, className: (0, clsx_1.default)('cim-code', UNSAFE_className), style: UNSAFE_style, children: children }));
14
+ }
15
+ /**
16
+ * Displays short, inline code snippets.
17
+ *
18
+ * See [code usage guidelines](https://ui.cimpress.io/components/code).
19
+ */
20
+ const _Code = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.forwardRef)(Code), 'Code');
21
+ exports.Code = _Code;
22
+ //# sourceMappingURL=code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code.js","sourceRoot":"","sources":["../../../../src/components/code/code.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,gDAAwB;AAExB,yDAAkD;AAClD,mEAA2D;AAQ3D,SAAS,IAAI,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAa,EAAE,GAA8B;IAC7G,OAAO,CACL,oCAAU,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAA,cAAI,EAAC,UAAU,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,YAC1F,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,KAAK,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;AACrC,qBAAI","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ForwardedRef, ReactNode } from 'react';\nimport { forwardRef } from '../../forward-ref.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport type { CommonProps } from '../types.js';\n\nexport interface CodeProps extends CommonProps {\n /** The inline code content to display. */\n children: ReactNode;\n}\n\nfunction Code({ children, UNSAFE_className, UNSAFE_style, ...props }: CodeProps, ref: ForwardedRef<HTMLElement>) {\n return (\n <code {...props} ref={ref} className={clsx('cim-code', UNSAFE_className)} style={UNSAFE_style}>\n {children}\n </code>\n );\n}\n\n/**\n * Displays short, inline code snippets.\n *\n * See [code usage guidelines](https://ui.cimpress.io/components/code).\n */\nconst _Code = withStyleProps(forwardRef(Code), 'Code');\nexport { _Code as Code };\n"]}
@@ -0,0 +1,13 @@
1
+ import type { CommonProps } from '../types.js';
2
+ export interface CodeBlockProps extends CommonProps {
3
+ /** The code content to display. */
4
+ code: string;
5
+ }
6
+ /**
7
+ * Displays preformatted code content in a styled container.
8
+ *
9
+ * See [code block usage guidelines](https://ui.cimpress.io/components/code-block).
10
+ */
11
+ declare const _CodeBlock: (props: CodeBlockProps & import("react").RefAttributes<HTMLDivElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
12
+ export { _CodeBlock as CodeBlock };
13
+ //# sourceMappingURL=code-block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../../../../src/components/code-block/code-block.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;CACd;AAqDD;;;;GAIG;AACH,QAAA,MAAM,UAAU,gKAAqD,CAAC;AACtE,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC"}
@@ -0,0 +1,50 @@
1
+ 'use client';
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.CodeBlock = void 0;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const focus_1 = require("@react-aria/focus");
10
+ const utils_1 = require("@react-aria/utils");
11
+ const clsx_1 = __importDefault(require("clsx"));
12
+ const react_1 = require("react");
13
+ const forward_ref_js_1 = require("../../forward-ref.js");
14
+ const with_style_props_js_1 = require("../../with-style-props.js");
15
+ function CodeBlock({ code, UNSAFE_className, UNSAFE_style, ...props }, ref) {
16
+ // Most of the scrollable logic is copied from `FocusableContainer`, but the scrollable element is a child of the container, not the container itself.
17
+ const [isScrollable, setIsScrollable] = (0, react_1.useState)(false);
18
+ const scrollableRef = (0, react_1.useRef)(null);
19
+ const { focusProps, isFocusVisible } = (0, focus_1.useFocusRing)();
20
+ (0, utils_1.useLayoutEffect)(() => {
21
+ const scrollableElement = scrollableRef.current;
22
+ const isSSR = typeof window === 'undefined';
23
+ let scrollableResizeObserver;
24
+ if (scrollableElement && !isSSR) {
25
+ scrollableResizeObserver = new window.ResizeObserver((entries) => {
26
+ if (entries[0]) {
27
+ const { target } = entries[0];
28
+ const isScrollableHorizontal = target.scrollWidth > target.clientWidth;
29
+ const isScrollableVertical = target.scrollHeight > target.clientHeight;
30
+ setIsScrollable(isScrollableHorizontal || isScrollableVertical);
31
+ }
32
+ });
33
+ scrollableResizeObserver.observe(scrollableElement);
34
+ }
35
+ return () => {
36
+ if (scrollableElement && scrollableResizeObserver) {
37
+ scrollableResizeObserver.unobserve(scrollableElement);
38
+ }
39
+ };
40
+ }, [scrollableRef]);
41
+ return ((0, jsx_runtime_1.jsx)("div", { ...props, ref: ref, className: (0, clsx_1.default)('cim-code-block', UNSAFE_className), style: UNSAFE_style, "data-focus-visible": isFocusVisible || undefined, children: (0, jsx_runtime_1.jsx)("pre", { ...focusProps, ref: scrollableRef, tabIndex: isScrollable ? 0 : -1, children: (0, jsx_runtime_1.jsx)("code", { children: code }) }) }));
42
+ }
43
+ /**
44
+ * Displays preformatted code content in a styled container.
45
+ *
46
+ * See [code block usage guidelines](https://ui.cimpress.io/components/code-block).
47
+ */
48
+ const _CodeBlock = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.forwardRef)(CodeBlock), 'CodeBlock');
49
+ exports.CodeBlock = _CodeBlock;
50
+ //# sourceMappingURL=code-block.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-block.js","sourceRoot":"","sources":["../../../../src/components/code-block/code-block.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,6CAAiD;AACjD,6CAAoD;AACpD,gDAAwB;AACxB,iCAA4D;AAC5D,yDAAkD;AAClD,mEAA2D;AAQ3D,SAAS,SAAS,CAChB,EAAE,IAAI,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAkB,EAClE,GAAiC;IAEjC,sJAAsJ;IACtJ,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IACxD,MAAM,aAAa,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IACnD,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IAEtD,IAAA,uBAAe,EAAC,GAAG,EAAE;QACnB,MAAM,iBAAiB,GAAG,aAAa,CAAC,OAAO,CAAC;QAChD,MAAM,KAAK,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;QAE5C,IAAI,wBAAoD,CAAC;QAEzD,IAAI,iBAAiB,IAAI,CAAC,KAAK,EAAE,CAAC;YAChC,wBAAwB,GAAG,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC/D,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;oBACf,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;oBAC9B,MAAM,sBAAsB,GAAG,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;oBACvE,MAAM,oBAAoB,GAAG,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;oBAEvE,eAAe,CAAC,sBAAsB,IAAI,oBAAoB,CAAC,CAAC;gBAClE,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,wBAAwB,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,GAAG,EAAE;YACV,IAAI,iBAAiB,IAAI,wBAAwB,EAAE,CAAC;gBAClD,wBAAwB,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;YACxD,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO,CACL,mCACM,KAAK,EACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,cAAI,EAAC,gBAAgB,EAAE,gBAAgB,CAAC,EACnD,KAAK,EAAE,YAAY,wBACC,cAAc,IAAI,SAAS,YAE/C,mCAAS,UAAU,EAAE,GAAG,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YACtE,2CAAO,IAAI,GAAQ,GACf,GACF,CACP,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC;AAC/C,+BAAS","sourcesContent":["'use client';\n\nimport { useFocusRing } from '@react-aria/focus';\nimport { useLayoutEffect } from '@react-aria/utils';\nimport clsx from 'clsx';\nimport { useRef, useState, type ForwardedRef } from 'react';\nimport { forwardRef } from '../../forward-ref.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport type { CommonProps } from '../types.js';\n\nexport interface CodeBlockProps extends CommonProps {\n /** The code content to display. */\n code: string;\n}\n\nfunction CodeBlock(\n { code, UNSAFE_className, UNSAFE_style, ...props }: CodeBlockProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n // Most of the scrollable logic is copied from `FocusableContainer`, but the scrollable element is a child of the container, not the container itself.\n const [isScrollable, setIsScrollable] = useState(false);\n const scrollableRef = useRef<HTMLPreElement>(null);\n const { focusProps, isFocusVisible } = useFocusRing();\n\n useLayoutEffect(() => {\n const scrollableElement = scrollableRef.current;\n const isSSR = typeof window === 'undefined';\n\n let scrollableResizeObserver: ResizeObserver | undefined;\n\n if (scrollableElement && !isSSR) {\n scrollableResizeObserver = new window.ResizeObserver((entries) => {\n if (entries[0]) {\n const { target } = entries[0];\n const isScrollableHorizontal = target.scrollWidth > target.clientWidth;\n const isScrollableVertical = target.scrollHeight > target.clientHeight;\n\n setIsScrollable(isScrollableHorizontal || isScrollableVertical);\n }\n });\n\n scrollableResizeObserver.observe(scrollableElement);\n }\n\n return () => {\n if (scrollableElement && scrollableResizeObserver) {\n scrollableResizeObserver.unobserve(scrollableElement);\n }\n };\n }, [scrollableRef]);\n\n return (\n <div\n {...props}\n ref={ref}\n className={clsx('cim-code-block', UNSAFE_className)}\n style={UNSAFE_style}\n data-focus-visible={isFocusVisible || undefined}\n >\n <pre {...focusProps} ref={scrollableRef} tabIndex={isScrollable ? 0 : -1}>\n <code>{code}</code>\n </pre>\n </div>\n );\n}\n\n/**\n * Displays preformatted code content in a styled container.\n *\n * See [code block usage guidelines](https://ui.cimpress.io/components/code-block).\n */\nconst _CodeBlock = withStyleProps(forwardRef(CodeBlock), 'CodeBlock');\nexport { _CodeBlock as CodeBlock };\n"]}
@@ -22,6 +22,7 @@ export interface ComboBoxProps<T extends CollectionItem = CollectionItem> extend
22
22
  isVirtualized?: boolean;
23
23
  /** Handler that is called when the list of items is scrolled. */
24
24
  onScroll?: UIEventHandler<HTMLDivElement>;
25
+ UNSTABLE_isClearable?: boolean;
25
26
  }
26
27
  /** The imperative API exposed by the `ComboBox` component. */
27
28
  export interface ComboBoxApi {
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box.d.ts","sourceRoot":"","sources":["../../../../src/components/combo-box/combo-box.tsx"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,cAAc,EAIpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAeL,KAAK,aAAa,IAAI,gBAAgB,EACtC,KAAK,gBAAgB,IAAI,mBAAmB,EAE7C,MAAM,uBAAuB,CAAC;AAU/B,OAAO,KAAK,EACV,QAAQ,EACR,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,WAAW,EACX,yBAAyB,EACzB,GAAG,EACH,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAWrB,gFAAgF;AAChF,MAAM,WAAW,uBAAuB;IACtC,wCAAwC;IACxC,WAAW,EAAE,GAAG,GAAG,IAAI,CAAC;IACxB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,CACtE,SACE,WAAW,EACX,yBAAyB,CAAC,uBAAuB,CAAC,EAClD,eAAe,CAAC,CAAC,CAAC,EAClB,qBAAqB,EACrB,QAAQ,CAAC,WAAW,CAAC,EACrB,IAAI,CACF,gBAAgB,CAAC,CAAC,CAAC,EACjB,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,mBAAmB,GACnB,WAAW,GACX,eAAe,GACf,SAAS,GACT,QAAQ,GACR,cAAc,CACjB;IACH,iEAAiE;IACjE,WAAW,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IACzB,iEAAiE;IACjE,kBAAkB,CAAC,EAAE,GAAG,CAAC;IACzB,yDAAyD;IACzD,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9C;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iEAAiE;IACjE,QAAQ,CAA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IAAI,CAAC;IAClB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAgHD;;;;GAIG;AACH,QAAA,MAAM,SAAS,GAnHG,CAAC,SAAS,cAAc,iKAmHwB,CAAC;AAEnE,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,CAAC;AAsFjC,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,cAAc,CAAE,SAAQ,IAAI,CACvE,mBAAmB,CAAC,CAAC,CAAC,EACtB,YAAY,GAAG,cAAc,GAAG,YAAY,CAC7C;IACC,0EAA0E;IAC1E,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,2CAA2C;IAC3C,QAAQ,EAAE,kBAAkB,CAAC;CAC9B;AAED,oDAAoD;AACpD,wBAAgB,YAAY,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CAiBlG;yBAjBe,YAAY;;;AAqB5B,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,cAAc,CAAE,SAAQ,eAAe,CAAC,CAAC,CAAC;IACxF,6EAA6E;IAC7E,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,0DAA0D;AAC1D,wBAAgB,eAAe,CAAC,CAAC,SAAS,cAAc,EAAE,EACxD,KAAK,EACL,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,CAAC,CAAC,2CAezB;yBApBe,eAAe"}
@@ -20,6 +20,7 @@ const use_production_warning_js_1 = require("../../utils/use-production-warning.
20
20
  const with_style_props_js_1 = require("../../with-style-props.js");
21
21
  const collapsible_list_js_1 = require("../internal/collapsible-list/collapsible-list.js");
22
22
  const form_field_js_1 = require("../internal/form-field/form-field.js");
23
+ const x_button_js_1 = require("../internal/x-button/x-button.js");
23
24
  const spinner_js_1 = require("../spinner/spinner.js");
24
25
  const utils_js_1 = require("../typography/utils.js");
25
26
  const VIRTUAL_LAYOUT_OPTIONS = {
@@ -29,7 +30,7 @@ const VIRTUAL_LAYOUT_OPTIONS = {
29
30
  padding: 0,
30
31
  gap: 0,
31
32
  };
32
- function ComboBox({ label, description, error, items, children, placeholder, UNSAFE_className, UNSAFE_style, isReadOnly, onScroll, isVirtualized = false, UNSTABLE_isLoading: isLoading, UNSTABLE_onLoadMore: onLoadMore, apiRef, selectedKey, defaultSelectedKey, onSelectionChange, validate, ...props }, ref) {
33
+ function ComboBox({ label, description, error, items, children, placeholder, UNSAFE_className, UNSAFE_style, isReadOnly, onScroll, isVirtualized = false, UNSTABLE_isLoading: isLoading, UNSTABLE_onLoadMore: onLoadMore, UNSTABLE_isClearable: isClearable = false, apiRef, selectedKey, defaultSelectedKey, onSelectionChange, validate, ...props }, ref) {
33
34
  const inputRef = (0, react_1.useRef)(null);
34
35
  const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
35
36
  (0, use_production_warning_js_1.useProductionWarning)(() => {
@@ -44,12 +45,13 @@ function ComboBox({ label, description, error, items, children, placeholder, UNS
44
45
  focus: () => inputRef.current?.focus(),
45
46
  select: () => inputRef.current?.select(),
46
47
  }), []);
48
+ const isFieldClearable = isClearable && !props.isDisabled && !isReadOnly;
47
49
  const listBox = ((0, jsx_runtime_1.jsx)(ComboBoxList, { items: items, isLoading: isLoading, onLoadMore: onLoadMore, onScroll: onScroll, children: children }));
48
50
  return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.ComboBox, { ...props, ref: ref, className: (0, clsx_1.default)('cim-combo-box', UNSAFE_className), style: UNSAFE_style, selectionMode: "single", value: selectedKey, defaultValue: defaultSelectedKey, onChange: onSelectionChange, menuTrigger: "focus", isReadOnly: isReadOnly, "data-readonly": isReadOnly ? true : undefined, validate: validate
49
51
  ? ({ inputValue, value }) => {
50
52
  return validate({ inputValue, selectedKey: value });
51
53
  }
52
- : undefined, children: [(0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), (0, jsx_runtime_1.jsxs)(react_aria_components_1.Group, { className: "cim-combo-box-input-group", children: [(0, jsx_runtime_1.jsx)(ComboBoxInput, { inputRef: inputRef, isReadOnly: isReadOnly, placeholder: placeholder }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Button, { className: "cim-combo-box-button", children: (0, jsx_runtime_1.jsx)(index_js_2.IconChevronDown, {}) })] }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldError, { children: error }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description }), (0, jsx_runtime_1.jsx)(collapsible_list_js_1.CollapsibleList, { offset: 5, maxHeight: 315, children: isVirtualized ? ((0, jsx_runtime_1.jsx)(react_aria_components_1.Virtualizer, { layout: react_aria_components_1.ListLayout, layoutOptions: VIRTUAL_LAYOUT_OPTIONS, children: listBox })) : (listBox) })] }));
54
+ : undefined, children: [(0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), (0, jsx_runtime_1.jsxs)(react_aria_components_1.Group, { className: "cim-combo-box-input-group", children: [(0, jsx_runtime_1.jsx)(ComboBoxInput, { inputRef: inputRef, isReadOnly: isReadOnly, placeholder: placeholder, isClearable: isFieldClearable }), isFieldClearable && (0, jsx_runtime_1.jsx)(ComboBoxClearButton, {}), (0, jsx_runtime_1.jsx)(react_aria_components_1.Button, { className: "cim-combo-box-button", children: (0, jsx_runtime_1.jsx)(index_js_2.IconChevronDown, {}) })] }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldError, { children: error }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description }), (0, jsx_runtime_1.jsx)(collapsible_list_js_1.CollapsibleList, { offset: 5, maxHeight: 315, children: isVirtualized ? ((0, jsx_runtime_1.jsx)(react_aria_components_1.Virtualizer, { layout: react_aria_components_1.ListLayout, layoutOptions: VIRTUAL_LAYOUT_OPTIONS, children: listBox })) : (listBox) })] }));
53
55
  }
54
56
  /**
55
57
  * Allows users to filter a collapsible list and select one item from it.
@@ -58,12 +60,28 @@ function ComboBox({ label, description, error, items, children, placeholder, UNS
58
60
  */
59
61
  const _ComboBox = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.forwardRef)(ComboBox), 'ComboBox');
60
62
  exports.ComboBox = _ComboBox;
61
- function ComboBoxInput({ inputRef, isReadOnly, placeholder, }) {
63
+ function ComboBoxClearButton() {
64
+ const comboBoxState = (0, react_1.useContext)(react_aria_components_1.ComboBoxStateContext);
65
+ const inputValue = comboBoxState?.inputValue;
66
+ if (!comboBoxState || inputValue === '') {
67
+ return null;
68
+ }
69
+ return ((0, jsx_runtime_1.jsx)(x_button_js_1.XButton, { onPress: () => {
70
+ comboBoxState?.setValue(null);
71
+ }, iconType: "circled", "aria-label": "Clear selection",
72
+ // Prevent this button from acting as a trigger for opening/closing the ComboBox
73
+ slot: null, excludeFromTabOrder: true }));
74
+ }
75
+ function ComboBoxInput({ inputRef, isReadOnly, placeholder, isClearable, }) {
62
76
  const comboBoxState = (0, react_1.useContext)(react_aria_components_1.ComboBoxStateContext);
63
77
  return ((0, jsx_runtime_1.jsx)(react_aria_components_1.Input, { ref: inputRef, className: (0, clsx_1.default)('cim-combo-box-input', (0, utils_js_1.textStyle)({ variant: 'body' })),
64
78
  // Ensure the popover opens when the input is clicked.
65
79
  // By default, React Aria only opens the popover when the input is focused.
66
- onClick: () => !isReadOnly && comboBoxState.open(), placeholder: placeholder }));
80
+ onClick: () => !isReadOnly && comboBoxState.open(), placeholder: placeholder, onKeyDown: (e) => {
81
+ if (e.key === 'Escape' && !comboBoxState?.isOpen && isClearable) {
82
+ comboBoxState?.setValue(null);
83
+ }
84
+ } }));
67
85
  }
68
86
  function ComboBoxList({ items, children, isLoading, onLoadMore, onScroll, }) {
69
87
  const comboBoxState = (0, react_1.useContext)(react_aria_components_1.ComboBoxStateContext);
@@ -74,7 +92,7 @@ function ComboBoxList({ items, children, isLoading, onLoadMore, onScroll, }) {
74
92
  /** Renders a single list item within `ComboBox`. */
75
93
  function ComboBoxItem({ children, ...props }) {
76
94
  const textValue = typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');
77
- return ((0, jsx_runtime_1.jsx)(react_aria_components_1.ListBoxItem, { ...props, className: "cim-combo-box-item", textValue: textValue, children: ({ isDisabled }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(index_js_2.IconCheck, {}), (0, jsx_runtime_1.jsx)(react_aria_components_1.Text, { slot: "label", className: (0, utils_js_1.textStyle)({ variant: 'body', tone: isDisabled ? 'muted' : 'base' }), children: children })] })) }));
95
+ return ((0, jsx_runtime_1.jsx)(react_aria_components_1.ListBoxItem, { ...props, className: "cim-combo-box-item", textValue: textValue, children: ({ isDisabled }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(index_js_2.IconCheckBold, {}), (0, jsx_runtime_1.jsx)(react_aria_components_1.Text, { slot: "label", className: (0, utils_js_1.textStyle)({ variant: 'body', tone: isDisabled ? 'muted' : 'base' }), children: children })] })) }));
78
96
  }
79
97
  ComboBoxItem.displayName = 'ComboBoxItem';
80
98
  /** Groups list items within `ComboBox` into a section. */
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box.js","sourceRoot":"","sources":["../../../../src/components/combo-box/combo-box.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AA+Rb,oCAiBC;AAYD,0CAoBC;;AA9UD,gDAAwB;AACxB,iCAOe;AACf,2CAA8C;AAC9C,iEAkB+B;AAC/B,yDAAkD;AAClD,kDAA2D;AAC3D,mDAAkE;AAClE,mEAA4D;AAC5D,qFAA6E;AAC7E,mEAA2D;AAC3D,0FAAmF;AACnF,wEAA4G;AAC5G,sDAAgD;AAWhD,qDAAmD;AAEnD,MA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,cAAc,CAAC;AAS1C,0DAA0D;AAC1D,SAAgB,eAAe,CAA2B,EACxD,KAAK,EACL,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACgB;IACxB,IAAI,CAAC,IAAA,+BAAY,GAAE,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACvE,OAAO,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAC;IACjG,CAAC;IAED,OAAO,CACL,wBAAC,sCAAiB,OAAK,KAAK,EAAE,SAAS,EAAC,uBAAuB,aAC7D,uBAAC,8BAAS,IACR,SAAS,EAAE,IAAA,cAAI,EAAC,8BAA8B,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,YAExG,KAAK,GACI,EACZ,uBAAC,kCAAa,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiB,IACrC,CACrB,CAAC;AACJ,CAAC;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport {\n type ForwardedRef,\n type MutableRefObject,\n type UIEventHandler,\n useContext,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { usePreventScroll } from 'react-aria';\nimport {\n Button as RACButton,\n Collection as RACCollection,\n ComboBox as RACComboBox,\n ComboBoxStateContext as RACComboBoxStateContext,\n Group as RACGroup,\n Header as RACHeader,\n Input as RACInput,\n ListBox as RACListBox,\n ListBoxLoadMoreItem as RACListBoxLoadMoreItem,\n ListBoxItem as RACListBoxItem,\n ListBoxSection as RACListBoxSection,\n ListLayout as RACListLayout,\n type ListLayoutOptions as RACListLayoutOptions,\n Text as RACText,\n type ComboBoxProps as RACComboBoxProps,\n type ListBoxItemProps as RACListBoxItemProps,\n Virtualizer as RACVirtualizer,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { IconCheck, IconChevronDown } from '../../icons/index.js';\nimport { isProduction } from '../../utils/is-production.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { CollapsibleList } from '../internal/collapsible-list/collapsible-list.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport { Spinner } from '../spinner/spinner.js';\nimport type {\n ApiProps,\n AsyncItemLoadingProps,\n CollectionItem,\n CollectionProps,\n CommonProps,\n FieldWithPlaceholderProps,\n Key,\n StringLikeChildren,\n} from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nconst VIRTUAL_LAYOUT_OPTIONS: RACListLayoutOptions = {\n estimatedRowHeight: 40,\n estimatedHeadingHeight: 32,\n loaderHeight: 40,\n padding: 0,\n gap: 0,\n};\n\n/** Represents the state of the `ComboBox` component for validation purposes. */\nexport interface ComboBoxValidationValue {\n /** The selected key in the ComboBox. */\n selectedKey: Key | null;\n /** The value of the ComboBox input. */\n inputValue: string;\n}\n\nexport interface ComboBoxProps<T extends CollectionItem = CollectionItem>\n extends\n CommonProps,\n FieldWithPlaceholderProps<ComboBoxValidationValue>,\n CollectionProps<T>,\n AsyncItemLoadingProps,\n ApiProps<ComboBoxApi>,\n Pick<\n RACComboBoxProps<T>,\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'inputValue'\n | 'defaultInputValue'\n | 'autoFocus'\n | 'onInputChange'\n | 'onFocus'\n | 'onBlur'\n | 'onOpenChange'\n > {\n /** The currently selected key in the collection (controlled). */\n selectedKey?: Key | null;\n /** The initial selected key in the collection (uncontrolled). */\n defaultSelectedKey?: Key;\n /** Handler that is called when the selection changes. */\n onSelectionChange?: (key: Key | null) => void;\n /**\n * Whether the list of options should be virtualized. Use this as a performance optimization for large lists.\n * @default false\n */\n isVirtualized?: boolean;\n /** Handler that is called when the list of items is scrolled. */\n onScroll?: UIEventHandler<HTMLDivElement>;\n}\n\n/** The imperative API exposed by the `ComboBox` component. */\nexport interface ComboBoxApi {\n /** Focuses the input field and opens the list of items. */\n focus: () => void;\n /** Selects the contents of the input field. */\n select: () => void;\n}\n\nfunction ComboBox<T extends CollectionItem>(\n {\n label,\n description,\n error,\n items,\n children,\n placeholder,\n UNSAFE_className,\n UNSAFE_style,\n isReadOnly,\n onScroll,\n isVirtualized = false,\n UNSTABLE_isLoading: isLoading,\n UNSTABLE_onLoadMore: onLoadMore,\n apiRef,\n selectedKey,\n defaultSelectedKey,\n onSelectionChange,\n validate,\n ...props\n }: ComboBoxProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const inputRef = useRef<HTMLInputElement>(null);\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('ComboBox requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`ComboBox` requires `children` to be a function when using `items` prop');\n }\n\n useImperativeHandle(\n apiRef,\n () => ({\n focus: () => inputRef.current?.focus(),\n select: () => inputRef.current?.select(),\n }),\n [],\n );\n\n const listBox = (\n <ComboBoxList<T> items={items} isLoading={isLoading} onLoadMore={onLoadMore} onScroll={onScroll}>\n {children}\n </ComboBoxList>\n );\n\n return (\n <RACComboBox\n {...props}\n ref={ref}\n className={clsx('cim-combo-box', UNSAFE_className)}\n style={UNSAFE_style}\n selectionMode=\"single\"\n value={selectedKey}\n defaultValue={defaultSelectedKey}\n onChange={onSelectionChange}\n menuTrigger=\"focus\"\n isReadOnly={isReadOnly}\n data-readonly={isReadOnly ? true : undefined}\n validate={\n validate\n ? ({ inputValue, value }) => {\n return validate({ inputValue, selectedKey: value });\n }\n : undefined\n }\n >\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-combo-box-input-group\">\n <ComboBoxInput inputRef={inputRef} isReadOnly={isReadOnly} placeholder={placeholder} />\n <RACButton className=\"cim-combo-box-button\">\n <IconChevronDown />\n </RACButton>\n </RACGroup>\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <CollapsibleList\n offset={5} // 1px border + 4px actual offset\n maxHeight={315}\n >\n {isVirtualized ? (\n <RACVirtualizer layout={RACListLayout} layoutOptions={VIRTUAL_LAYOUT_OPTIONS}>\n {listBox}\n </RACVirtualizer>\n ) : (\n listBox\n )}\n </CollapsibleList>\n </RACComboBox>\n );\n}\n\n/**\n * Allows users to filter a collapsible list and select one item from it.\n *\n * See [combo box usage guidelines](https://ui.cimpress.io/components/combo-box)\n */\nconst _ComboBox = withStyleProps(forwardRef(ComboBox), 'ComboBox');\n\nexport { _ComboBox as ComboBox };\n\nfunction ComboBoxInput({\n inputRef,\n isReadOnly,\n placeholder,\n}: {\n inputRef: MutableRefObject<HTMLInputElement | null>;\n isReadOnly: boolean | undefined;\n placeholder: string | undefined;\n}) {\n const comboBoxState = useContext(RACComboBoxStateContext);\n\n return (\n <RACInput\n ref={inputRef}\n className={clsx('cim-combo-box-input', textStyle({ variant: 'body' }))}\n // Ensure the popover opens when the input is clicked.\n // By default, React Aria only opens the popover when the input is focused.\n onClick={() => !isReadOnly && comboBoxState!.open()}\n placeholder={placeholder}\n />\n );\n}\n\nfunction ComboBoxList<T extends CollectionItem = CollectionItem>({\n items,\n children,\n isLoading,\n onLoadMore,\n onScroll,\n}: Pick<ComboBoxProps<T>, 'items' | 'children' | 'onScroll'> & {\n isLoading: ComboBoxProps['UNSTABLE_isLoading'];\n onLoadMore: ComboBoxProps['UNSTABLE_onLoadMore'];\n}) {\n const comboBoxState = useContext(RACComboBoxStateContext);\n const collectionMessages = useLocalizedMessages('UNSTABLE_collection');\n\n usePreventScroll({ isDisabled: !comboBoxState?.isOpen });\n\n return (\n <RACListBox\n className=\"cim-combo-box-listbox\"\n onScroll={onScroll}\n renderEmptyState={() =>\n isLoading ? <Spinner aria-label={collectionMessages.format('loading')} size=\"small\" marginY={8} /> : null\n }\n >\n <RACCollection items={items}>{children}</RACCollection>\n <RACListBoxLoadMoreItem onLoadMore={onLoadMore} isLoading={isLoading}>\n <Spinner aria-label={collectionMessages.format('loadingMore')} size=\"small\" marginY={8} />\n </RACListBoxLoadMoreItem>\n </RACListBox>\n );\n}\n\nexport interface ComboBoxItemProps<T extends CollectionItem> extends Pick<\n RACListBoxItemProps<T>,\n 'isDisabled' | 'onHoverStart' | 'onHoverEnd'\n> {\n /** The ID of the item. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the label. */\n children: StringLikeChildren;\n}\n\n/** Renders a single list item within `ComboBox`. */\nexport function ComboBoxItem<T extends CollectionItem>({ children, ...props }: ComboBoxItemProps<T>) {\n const textValue =\n typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');\n\n return (\n <RACListBoxItem {...props} className=\"cim-combo-box-item\" textValue={textValue}>\n {({ isDisabled }) => (\n <>\n <IconCheck />\n\n <RACText slot=\"label\" className={textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'base' })}>\n {children}\n </RACText>\n </>\n )}\n </RACListBoxItem>\n );\n}\n\nComboBoxItem.displayName = 'ComboBoxItem';\n\nexport interface ComboBoxSectionProps<T extends CollectionItem> extends CollectionProps<T> {\n /** The ID of the section. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the section title. */\n title: string;\n}\n\n/** Groups list items within `ComboBox` into a section. */\nexport function ComboBoxSection<T extends CollectionItem>({\n title,\n children,\n items,\n ...props\n}: ComboBoxSectionProps<T>) {\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`ComboBoxSection` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACListBoxSection {...props} className=\"cim-combo-box-section\">\n <RACHeader\n className={clsx('cim-combo-box-section-header', textStyle({ variant: 'small-semibold', tone: 'subtle' }))}\n >\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACListBoxSection>\n );\n}\n\nComboBoxSection.displayName = 'ComboBoxSection';\n"]}
1
+ {"version":3,"file":"combo-box.js","sourceRoot":"","sources":["../../../../src/components/combo-box/combo-box.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AAwUb,oCAiBC;AAYD,0CAoBC;;AAvXD,gDAAwB;AACxB,iCAOe;AACf,2CAA8C;AAC9C,iEAkB+B;AAC/B,yDAAkD;AAClD,kDAA2D;AAC3D,mDAAsE;AACtE,mEAA4D;AAC5D,qFAA6E;AAC7E,mEAA2D;AAC3D,0FAAmF;AACnF,wEAA4G;AAC5G,kEAA2D;AAC3D,sDAAgD;AAWhD,qDAAmD;AAEnD,MAAM,sBAAsB,GAAyB;IACnD,kBAAkB,EAAE,EAAE;IACtB,sBAAsB,EAAE,EAAE;IAC1B,YAAY,EAAE,EAAE;IAChB,OAAO,EAAE,CAAC;IACV,GAAG,EAAE,CAAC;CACP,CAAC;AAuDF,SAAS,QAAQ,CACf,EACE,KAAK,EACL,WAAW,EACX,KAAK,EACL,KAAK,EACL,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,aAAa,GAAG,KAAK,EACrB,kBAAkB,EAAE,SAAS,EAC7B,mBAAmB,EAAE,UAAU,EAC/B,oBAAoB,EAAE,WAAW,GAAG,KAAK,EACzC,MAAM,EACN,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,GAAG,KAAK,EACS,EACnB,GAAiC;IAEjC,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAmB,IAAI,CAAC,CAAC;IAEhD,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAE7E,IAAA,gDAAoB,EAAC,GAAG,EAAE;QACxB,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,IAAI,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CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,YACjG,QAAQ,GACD,IACT,CACJ,GACc,CAClB,CAAC;AACJ,CAAC;AAED,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAS1C,0DAA0D;AAC1D,SAAgB,eAAe,CAA2B,EACxD,KAAK,EACL,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACgB;IACxB,IAAI,CAAC,IAAA,+BAAY,GAAE,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACvE,OAAO,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAC;IACjG,CAAC;IAED,OAAO,CACL,wBAAC,sCAAiB,OAAK,KAAK,EAAE,SAAS,EAAC,uBAAuB,aAC7D,uBAAC,8BAAS,IACR,SAAS,EAAE,IAAA,cAAI,EAAC,8BAA8B,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,YAExG,KAAK,GACI,EACZ,uBAAC,kCAAa,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiB,IACrC,CACrB,CAAC;AACJ,CAAC;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport {\n type ForwardedRef,\n type MutableRefObject,\n type UIEventHandler,\n useContext,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { usePreventScroll } from 'react-aria';\nimport {\n Button as RACButton,\n Collection as RACCollection,\n ComboBox as RACComboBox,\n ComboBoxStateContext as RACComboBoxStateContext,\n Group as RACGroup,\n Header as RACHeader,\n Input as RACInput,\n ListBox as RACListBox,\n ListBoxLoadMoreItem as RACListBoxLoadMoreItem,\n ListBoxItem as RACListBoxItem,\n ListBoxSection as RACListBoxSection,\n ListLayout as RACListLayout,\n type ListLayoutOptions as RACListLayoutOptions,\n Text as RACText,\n type ComboBoxProps as RACComboBoxProps,\n type ListBoxItemProps as RACListBoxItemProps,\n Virtualizer as RACVirtualizer,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { IconCheckBold, IconChevronDown } from '../../icons/index.js';\nimport { isProduction } from '../../utils/is-production.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { CollapsibleList } from '../internal/collapsible-list/collapsible-list.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport { XButton } from '../internal/x-button/x-button.js';\nimport { Spinner } from '../spinner/spinner.js';\nimport type {\n ApiProps,\n AsyncItemLoadingProps,\n CollectionItem,\n CollectionProps,\n CommonProps,\n FieldWithPlaceholderProps,\n Key,\n StringLikeChildren,\n} from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nconst VIRTUAL_LAYOUT_OPTIONS: RACListLayoutOptions = {\n estimatedRowHeight: 40,\n estimatedHeadingHeight: 32,\n loaderHeight: 40,\n padding: 0,\n gap: 0,\n};\n\n/** Represents the state of the `ComboBox` component for validation purposes. */\nexport interface ComboBoxValidationValue {\n /** The selected key in the ComboBox. */\n selectedKey: Key | null;\n /** The value of the ComboBox input. */\n inputValue: string;\n}\n\nexport interface ComboBoxProps<T extends CollectionItem = CollectionItem>\n extends\n CommonProps,\n FieldWithPlaceholderProps<ComboBoxValidationValue>,\n CollectionProps<T>,\n AsyncItemLoadingProps,\n ApiProps<ComboBoxApi>,\n Pick<\n RACComboBoxProps<T>,\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'inputValue'\n | 'defaultInputValue'\n | 'autoFocus'\n | 'onInputChange'\n | 'onFocus'\n | 'onBlur'\n | 'onOpenChange'\n > {\n /** The currently selected key in the collection (controlled). */\n selectedKey?: Key | null;\n /** The initial selected key in the collection (uncontrolled). */\n defaultSelectedKey?: Key;\n /** Handler that is called when the selection changes. */\n onSelectionChange?: (key: Key | null) => void;\n /**\n * Whether the list of options should be virtualized. Use this as a performance optimization for large lists.\n * @default false\n */\n isVirtualized?: boolean;\n /** Handler that is called when the list of items is scrolled. */\n onScroll?: UIEventHandler<HTMLDivElement>;\n UNSTABLE_isClearable?: boolean;\n}\n\n/** The imperative API exposed by the `ComboBox` component. */\nexport interface ComboBoxApi {\n /** Focuses the input field and opens the list of items. */\n focus: () => void;\n /** Selects the contents of the input field. */\n select: () => void;\n}\n\nfunction ComboBox<T extends CollectionItem>(\n {\n label,\n description,\n error,\n items,\n children,\n placeholder,\n UNSAFE_className,\n UNSAFE_style,\n isReadOnly,\n onScroll,\n isVirtualized = false,\n UNSTABLE_isLoading: isLoading,\n UNSTABLE_onLoadMore: onLoadMore,\n UNSTABLE_isClearable: isClearable = false,\n apiRef,\n selectedKey,\n defaultSelectedKey,\n onSelectionChange,\n validate,\n ...props\n }: ComboBoxProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const inputRef = useRef<HTMLInputElement>(null);\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('ComboBox requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`ComboBox` requires `children` to be a function when using `items` prop');\n }\n\n useImperativeHandle(\n apiRef,\n () => ({\n focus: () => inputRef.current?.focus(),\n select: () => inputRef.current?.select(),\n }),\n [],\n );\n\n const isFieldClearable = isClearable && !props.isDisabled && !isReadOnly;\n\n const listBox = (\n <ComboBoxList<T> items={items} isLoading={isLoading} onLoadMore={onLoadMore} onScroll={onScroll}>\n {children}\n </ComboBoxList>\n );\n\n return (\n <RACComboBox\n {...props}\n ref={ref}\n className={clsx('cim-combo-box', UNSAFE_className)}\n style={UNSAFE_style}\n selectionMode=\"single\"\n value={selectedKey}\n defaultValue={defaultSelectedKey}\n onChange={onSelectionChange}\n menuTrigger=\"focus\"\n isReadOnly={isReadOnly}\n data-readonly={isReadOnly ? true : undefined}\n validate={\n validate\n ? ({ inputValue, value }) => {\n return validate({ inputValue, selectedKey: value });\n }\n : undefined\n }\n >\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-combo-box-input-group\">\n <ComboBoxInput\n inputRef={inputRef}\n isReadOnly={isReadOnly}\n placeholder={placeholder}\n isClearable={isFieldClearable}\n />\n {isFieldClearable && <ComboBoxClearButton />}\n <RACButton className=\"cim-combo-box-button\">\n <IconChevronDown />\n </RACButton>\n </RACGroup>\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <CollapsibleList\n offset={5} // 1px border + 4px actual offset\n maxHeight={315}\n >\n {isVirtualized ? (\n <RACVirtualizer layout={RACListLayout} layoutOptions={VIRTUAL_LAYOUT_OPTIONS}>\n {listBox}\n </RACVirtualizer>\n ) : (\n listBox\n )}\n </CollapsibleList>\n </RACComboBox>\n );\n}\n\n/**\n * Allows users to filter a collapsible list and select one item from it.\n *\n * See [combo box usage guidelines](https://ui.cimpress.io/components/combo-box)\n */\nconst _ComboBox = withStyleProps(forwardRef(ComboBox), 'ComboBox');\n\nexport { _ComboBox as ComboBox };\n\nfunction ComboBoxClearButton() {\n const comboBoxState = useContext(RACComboBoxStateContext);\n const inputValue = comboBoxState?.inputValue;\n\n if (!comboBoxState || inputValue === '') {\n return null;\n }\n\n return (\n <XButton\n onPress={() => {\n comboBoxState?.setValue(null);\n }}\n iconType=\"circled\"\n // TODO: i18n once stabilized\n aria-label=\"Clear selection\"\n // Prevent this button from acting as a trigger for opening/closing the ComboBox\n slot={null}\n excludeFromTabOrder\n />\n );\n}\n\nfunction ComboBoxInput({\n inputRef,\n isReadOnly,\n placeholder,\n isClearable,\n}: {\n inputRef: MutableRefObject<HTMLInputElement | null>;\n isReadOnly: boolean | undefined;\n placeholder: string | undefined;\n isClearable: boolean;\n}) {\n const comboBoxState = useContext(RACComboBoxStateContext);\n\n return (\n <RACInput\n ref={inputRef}\n className={clsx('cim-combo-box-input', textStyle({ variant: 'body' }))}\n // Ensure the popover opens when the input is clicked.\n // By default, React Aria only opens the popover when the input is focused.\n onClick={() => !isReadOnly && comboBoxState!.open()}\n placeholder={placeholder}\n onKeyDown={(e) => {\n if (e.key === 'Escape' && !comboBoxState?.isOpen && isClearable) {\n comboBoxState?.setValue(null);\n }\n }}\n />\n );\n}\n\nfunction ComboBoxList<T extends CollectionItem = CollectionItem>({\n items,\n children,\n isLoading,\n onLoadMore,\n onScroll,\n}: Pick<ComboBoxProps<T>, 'items' | 'children' | 'onScroll'> & {\n isLoading: ComboBoxProps['UNSTABLE_isLoading'];\n onLoadMore: ComboBoxProps['UNSTABLE_onLoadMore'];\n}) {\n const comboBoxState = useContext(RACComboBoxStateContext);\n const collectionMessages = useLocalizedMessages('UNSTABLE_collection');\n\n usePreventScroll({ isDisabled: !comboBoxState?.isOpen });\n\n return (\n <RACListBox\n className=\"cim-combo-box-listbox\"\n onScroll={onScroll}\n renderEmptyState={() =>\n isLoading ? <Spinner aria-label={collectionMessages.format('loading')} size=\"small\" marginY={8} /> : null\n }\n >\n <RACCollection items={items}>{children}</RACCollection>\n <RACListBoxLoadMoreItem onLoadMore={onLoadMore} isLoading={isLoading}>\n <Spinner aria-label={collectionMessages.format('loadingMore')} size=\"small\" marginY={8} />\n </RACListBoxLoadMoreItem>\n </RACListBox>\n );\n}\n\nexport interface ComboBoxItemProps<T extends CollectionItem> extends Pick<\n RACListBoxItemProps<T>,\n 'isDisabled' | 'onHoverStart' | 'onHoverEnd'\n> {\n /** The ID of the item. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the label. */\n children: StringLikeChildren;\n}\n\n/** Renders a single list item within `ComboBox`. */\nexport function ComboBoxItem<T extends CollectionItem>({ children, ...props }: ComboBoxItemProps<T>) {\n const textValue =\n typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');\n\n return (\n <RACListBoxItem {...props} className=\"cim-combo-box-item\" textValue={textValue}>\n {({ isDisabled }) => (\n <>\n <IconCheckBold />\n\n <RACText slot=\"label\" className={textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'base' })}>\n {children}\n </RACText>\n </>\n )}\n </RACListBoxItem>\n );\n}\n\nComboBoxItem.displayName = 'ComboBoxItem';\n\nexport interface ComboBoxSectionProps<T extends CollectionItem> extends CollectionProps<T> {\n /** The ID of the section. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the section title. */\n title: string;\n}\n\n/** Groups list items within `ComboBox` into a section. */\nexport function ComboBoxSection<T extends CollectionItem>({\n title,\n children,\n items,\n ...props\n}: ComboBoxSectionProps<T>) {\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`ComboBoxSection` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACListBoxSection {...props} className=\"cim-combo-box-section\">\n <RACHeader\n className={clsx('cim-combo-box-section-header', textStyle({ variant: 'small-semibold', tone: 'subtle' }))}\n >\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACListBoxSection>\n );\n}\n\nComboBoxSection.displayName = 'ComboBoxSection';\n"]}
@@ -7,15 +7,13 @@ exports.CheckboxIndicator = CheckboxIndicator;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const clsx_1 = __importDefault(require("clsx"));
9
9
  const index_js_1 = require("../../../icons/index.js");
10
- // TODO: refactor so that state is accepted through props/context instead of a parent className
11
10
  /**
12
11
  * Displays a non-interactive, purely visual checkbox indicator.
13
- * Requires adding a `cim-checkbox-indicator-wrapper` className to the parent element.
14
12
  *
15
13
  * @internal
16
14
  */
17
- function CheckboxIndicator({ isSelected, isIndeterminate, UNSAFE_className, UNSAFE_style, ...props }) {
18
- return ((0, jsx_runtime_1.jsx)("div", { ...props, className: (0, clsx_1.default)('cim-checkbox-indicator', UNSAFE_className), style: UNSAFE_style, "data-selected": isSelected, "aria-hidden": true, children: (0, jsx_runtime_1.jsx)("div", { className: "cim-checkbox-indicator-icon", children: isIndeterminate ? (0, jsx_runtime_1.jsx)(index_js_1.IconSubtractBold, {}) : (0, jsx_runtime_1.jsx)(index_js_1.IconCheckBold, {}) }) }));
15
+ function CheckboxIndicator({ isSelected, isIndeterminate, isDisabled, isReadOnly, isInvalid, isHovered, isPressed, isFocusVisible, UNSAFE_className, UNSAFE_style, ...props }) {
16
+ return ((0, jsx_runtime_1.jsx)("div", { ...props, className: (0, clsx_1.default)('cim-checkbox-indicator', UNSAFE_className), style: UNSAFE_style, "data-selected": isSelected || undefined, "data-indeterminate": isIndeterminate || undefined, "data-disabled": isDisabled || undefined, "data-readonly": isReadOnly || undefined, "data-invalid": isInvalid || undefined, "data-hovered": isHovered || undefined, "data-pressed": isPressed || undefined, "data-focus-visible": isFocusVisible || undefined, "aria-hidden": true, children: (0, jsx_runtime_1.jsx)("div", { className: "cim-checkbox-indicator-icon", children: isIndeterminate ? (0, jsx_runtime_1.jsx)(index_js_1.IconSubtractBold, {}) : (0, jsx_runtime_1.jsx)(index_js_1.IconCheckBold, {}) }) }));
19
17
  }
20
18
  CheckboxIndicator.displayName = 'CheckboxIndicator';
21
19
  //# sourceMappingURL=checkbox-indicator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox-indicator.js","sourceRoot":"","sources":["../../../../../src/components/internal/checkbox-indicator/checkbox-indicator.tsx"],"names":[],"mappings":";;;;;AAcA,8CAkBC;;AAhCD,gDAAwB;AAExB,sDAA0E;AAK1E,+FAA+F;AAC/F;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,EAChC,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,GAAG,KAAK,EACe;IACvB,OAAO,CACL,mCACM,KAAK,EACT,SAAS,EAAE,IAAA,cAAI,EAAC,wBAAwB,EAAE,gBAAgB,CAAC,EAC3D,KAAK,EAAE,YAAY,mBACJ,UAAU,iCAGzB,gCAAK,SAAS,EAAC,6BAA6B,YAAE,eAAe,CAAC,CAAC,CAAC,uBAAC,2BAAgB,KAAG,CAAC,CAAC,CAAC,uBAAC,wBAAa,KAAG,GAAO,GAC3G,CACP,CAAC;AACJ,CAAC;AAED,iBAAiB,CAAC,WAAW,GAAG,mBAAmB,CAAC","sourcesContent":["import clsx from 'clsx';\nimport type { CheckboxProps as RACCheckboxProps } from 'react-aria-components';\nimport { IconCheckBold, IconSubtractBold } from '../../../icons/index.js';\nimport type { CommonProps } from '../../types.js';\n\ninterface CheckboxIndicatorProps extends CommonProps, Pick<RACCheckboxProps, 'isSelected' | 'isIndeterminate'> {}\n\n// TODO: refactor so that state is accepted through props/context instead of a parent className\n/**\n * Displays a non-interactive, purely visual checkbox indicator.\n * Requires adding a `cim-checkbox-indicator-wrapper` className to the parent element.\n *\n * @internal\n */\nexport function CheckboxIndicator({\n isSelected,\n isIndeterminate,\n UNSAFE_className,\n UNSAFE_style,\n ...props\n}: CheckboxIndicatorProps) {\n return (\n <div\n {...props}\n className={clsx('cim-checkbox-indicator', UNSAFE_className)}\n style={UNSAFE_style}\n data-selected={isSelected}\n aria-hidden\n >\n <div className=\"cim-checkbox-indicator-icon\">{isIndeterminate ? <IconSubtractBold /> : <IconCheckBold />}</div>\n </div>\n );\n}\n\nCheckboxIndicator.displayName = 'CheckboxIndicator';\n"]}
1
+ {"version":3,"file":"checkbox-indicator.js","sourceRoot":"","sources":["../../../../../src/components/internal/checkbox-indicator/checkbox-indicator.tsx"],"names":[],"mappings":";;;;;AAoBA,8CA+BC;;AAnDD,gDAAwB;AACxB,sDAA0E;AAc1E;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,EAChC,UAAU,EACV,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,GAAG,KAAK,EACe;IACvB,OAAO,CACL,mCACM,KAAK,EACT,SAAS,EAAE,IAAA,cAAI,EAAC,wBAAwB,EAAE,gBAAgB,CAAC,EAC3D,KAAK,EAAE,YAAY,mBACJ,UAAU,IAAI,SAAS,wBAClB,eAAe,IAAI,SAAS,mBACjC,UAAU,IAAI,SAAS,mBACvB,UAAU,IAAI,SAAS,kBACxB,SAAS,IAAI,SAAS,kBACtB,SAAS,IAAI,SAAS,kBACtB,SAAS,IAAI,SAAS,wBAChB,cAAc,IAAI,SAAS,iCAG/C,gCAAK,SAAS,EAAC,6BAA6B,YAAE,eAAe,CAAC,CAAC,CAAC,uBAAC,2BAAgB,KAAG,CAAC,CAAC,CAAC,uBAAC,wBAAa,KAAG,GAAO,GAC3G,CACP,CAAC;AACJ,CAAC;AAED,iBAAiB,CAAC,WAAW,GAAG,mBAAmB,CAAC","sourcesContent":["import clsx from 'clsx';\nimport { IconCheckBold, IconSubtractBold } from '../../../icons/index.js';\nimport type { CommonProps } from '../../types.js';\n\ninterface CheckboxIndicatorProps extends CommonProps {\n isSelected?: boolean;\n isIndeterminate?: boolean;\n isDisabled?: boolean;\n isReadOnly?: boolean;\n isInvalid?: boolean;\n isHovered?: boolean;\n isPressed?: boolean;\n isFocusVisible?: boolean;\n}\n\n/**\n * Displays a non-interactive, purely visual checkbox indicator.\n *\n * @internal\n */\nexport function CheckboxIndicator({\n isSelected,\n isIndeterminate,\n isDisabled,\n isReadOnly,\n isInvalid,\n isHovered,\n isPressed,\n isFocusVisible,\n UNSAFE_className,\n UNSAFE_style,\n ...props\n}: CheckboxIndicatorProps) {\n return (\n <div\n {...props}\n className={clsx('cim-checkbox-indicator', UNSAFE_className)}\n style={UNSAFE_style}\n data-selected={isSelected || undefined}\n data-indeterminate={isIndeterminate || undefined}\n data-disabled={isDisabled || undefined}\n data-readonly={isReadOnly || undefined}\n data-invalid={isInvalid || undefined}\n data-hovered={isHovered || undefined}\n data-pressed={isPressed || undefined}\n data-focus-visible={isFocusVisible || undefined}\n aria-hidden\n >\n <div className=\"cim-checkbox-indicator-icon\">{isIndeterminate ? <IconSubtractBold /> : <IconCheckBold />}</div>\n </div>\n );\n}\n\nCheckboxIndicator.displayName = 'CheckboxIndicator';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"collapsible-list.js","sourceRoot":"","sources":["../../../../../src/components/internal/collapsible-list/collapsible-list.tsx"],"names":[],"mappings":";;;;AAAA,iDAAiD;AACjD,iCAAmC;AACnC,iEAAoG;AAOpG;;;;GAIG;AACU,QAAA,eAAe,GAAG,IAAA,kBAAU,EAAuC,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAC/G,uBAAC,+BAAU,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAC,sBAAsB,EAAC,gBAAgB,EAAE,EAAE,yCACnF,QAAQ,GACE,CACd,CAAC,CAAC;AAEH,uBAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport { forwardRef } from 'react';\nimport { Popover as RACPopover, type PopoverProps as RACPopoverProps } from 'react-aria-components';\n\ninterface CollapsibleListProps extends Pick<\n RACPopoverProps,\n 'placement' | 'offset' | 'maxHeight' | 'children' | 'triggerRef' | 'isNonModal'\n> {}\n\n/**\n * Displays a collapsible list activated via a trigger element.\n *\n * @internal\n */\nexport const CollapsibleList = forwardRef<HTMLDivElement, CollapsibleListProps>(({ children, ...props }, ref) => (\n <RACPopover {...props} ref={ref} className=\"cim-collapsible-list\" containerPadding={16} data-cim-style-root>\n {children}\n </RACPopover>\n));\n\nCollapsibleList.displayName = 'CollapsibleList';\n"]}
1
+ {"version":3,"file":"collapsible-list.js","sourceRoot":"","sources":["../../../../../src/components/internal/collapsible-list/collapsible-list.tsx"],"names":[],"mappings":";;;;AAAA,iDAAiD;AACjD,iCAAmC;AACnC,iEAAoG;AAOpG;;;;GAIG;AACU,QAAA,eAAe,GAAG,IAAA,kBAAU,EAAuC,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAC/G,uBAAC,+BAAU,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAC,sBAAsB,EAAC,gBAAgB,EAAE,EAAE,yCACnF,QAAQ,GACE,CACd,CAAC,CAAC;AAEH,uBAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport { forwardRef } from 'react';\nimport { Popover as RACPopover, type PopoverProps as RACPopoverProps } from 'react-aria-components';\n\ninterface CollapsibleListProps extends Pick<\n RACPopoverProps,\n 'placement' | 'offset' | 'crossOffset' | 'maxHeight' | 'children' | 'triggerRef' | 'isNonModal'\n> {}\n\n/**\n * Displays a collapsible list activated via a trigger element.\n *\n * @internal\n */\nexport const CollapsibleList = forwardRef<HTMLDivElement, CollapsibleListProps>(({ children, ...props }, ref) => (\n <RACPopover {...props} ref={ref} className=\"cim-collapsible-list\" containerPadding={16} data-cim-style-root>\n {children}\n </RACPopover>\n));\n\nCollapsibleList.displayName = 'CollapsibleList';\n"]}
@@ -1,4 +1,4 @@
1
- import type { ReactNode, UIEventHandler } from 'react';
1
+ import { type ReactElement, type ReactNode, type UIEventHandler } from 'react';
2
2
  import { type MenuProps as RACMenuProps, type MenuItemProps as RACMenuItemProps, type MenuSectionProps as RACMenuSectionProps, type MenuTriggerProps as RACMenuTriggerProps } from 'react-aria-components';
3
3
  import type { CollectionItem, CollectionProps, Key, NavigationProps, StringLikeChildren } from '../types.js';
4
4
  export interface MenuRootProps extends Pick<RACMenuTriggerProps, 'onOpenChange' | 'isOpen' | 'defaultOpen'> {
@@ -14,6 +14,19 @@ export declare function MenuRoot(props: MenuRootProps): import("react/jsx-runtim
14
14
  export declare namespace MenuRoot {
15
15
  var displayName: string;
16
16
  }
17
+ export interface SubmenuRootProps {
18
+ /** The submenu trigger with its associated menu. Provide the item trigger as the first child, and the menu as the second child. */
19
+ children: ReactElement[];
20
+ }
21
+ /**
22
+ * Encapsulates a submenu trigger and its associated menu. The trigger must be a `MenuItem`, and the menu will be displayed when the trigger is hovered or focused.
23
+ *
24
+ * See [menu usage guidelines](https://ui.cimpress.io/components/menu/).
25
+ */
26
+ export declare function SubmenuRoot({ children, ...props }: SubmenuRootProps): import("react/jsx-runtime").JSX.Element;
27
+ export declare namespace SubmenuRoot {
28
+ var displayName: string;
29
+ }
17
30
  export interface MenuProps<T extends CollectionItem = CollectionItem> extends CollectionProps<T>, Pick<RACMenuProps<T>, 'selectedKeys' | 'onSelectionChange' | 'selectionMode'> {
18
31
  /**
19
32
  * The alignment of the menu overlay relative to its trigger.
@@ -1 +1 @@
1
- {"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAIL,KAAK,SAAS,IAAI,YAAY,EAE9B,KAAK,aAAa,IAAI,gBAAgB,EAEtC,KAAK,gBAAgB,IAAI,mBAAmB,EAE5C,KAAK,gBAAgB,IAAI,mBAAmB,EAE7C,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAG7G,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,mBAAmB,EAAE,cAAc,GAAG,QAAQ,GAAG,aAAa,CAAC;IACzG,2HAA2H;IAC3H,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAE5C;yBAFe,QAAQ;;;AAMxB,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,CAClE,SAAQ,eAAe,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC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E,WAAW,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,2CAiChF;yBAjCe,QAAQ"}
@@ -5,17 +5,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.MenuRoot = MenuRoot;
8
+ exports.SubmenuRoot = SubmenuRoot;
8
9
  exports.Menu = Menu;
9
10
  exports.MenuSection = MenuSection;
10
11
  exports.MenuItem = MenuItem;
11
12
  const jsx_runtime_1 = require("react/jsx-runtime");
12
13
  const clsx_1 = __importDefault(require("clsx"));
14
+ const react_1 = require("react");
13
15
  const react_aria_components_1 = require("react-aria-components");
14
16
  const index_js_1 = require("../../icons/index.js");
15
17
  const is_production_js_1 = require("../../utils/is-production.js");
16
18
  const checkbox_indicator_js_1 = require("../internal/checkbox-indicator/checkbox-indicator.js");
17
19
  const collapsible_list_js_1 = require("../internal/collapsible-list/collapsible-list.js");
18
20
  const utils_js_1 = require("../typography/utils.js");
21
+ const SubmenuContext = (0, react_1.createContext)(false);
19
22
  /**
20
23
  * Encapsulates a menu trigger and its associated menu. The trigger can be any Cimpress UI button, and the menu will be displayed when the trigger is activated.
21
24
  *
@@ -25,12 +28,23 @@ function MenuRoot(props) {
25
28
  return (0, jsx_runtime_1.jsx)(react_aria_components_1.MenuTrigger, { ...props });
26
29
  }
27
30
  MenuRoot.displayName = 'MenuRoot';
31
+ /**
32
+ * Encapsulates a submenu trigger and its associated menu. The trigger must be a `MenuItem`, and the menu will be displayed when the trigger is hovered or focused.
33
+ *
34
+ * See [menu usage guidelines](https://ui.cimpress.io/components/menu/).
35
+ */
36
+ function SubmenuRoot({ children, ...props }) {
37
+ const [trigger, menu] = react_1.Children.toArray(children);
38
+ return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.SubmenuTrigger, { ...props, delay: 0, children: [trigger, (0, jsx_runtime_1.jsx)(SubmenuContext.Provider, { value: true, children: menu })] }));
39
+ }
40
+ SubmenuRoot.displayName = 'SubmenuRoot';
28
41
  /** Displays a collapsible list of options and actions that users can choose from. */
29
42
  function Menu({ align = 'start', ...props }) {
30
43
  if (!(0, is_production_js_1.isProduction)() && props.items != null && typeof props.children !== 'function') {
31
44
  console.warn('`Menu` requires `children` to be a function when using `items` prop');
32
45
  }
33
- return ((0, jsx_runtime_1.jsx)(collapsible_list_js_1.CollapsibleList, { placement: `bottom ${align}`, offset: 5, maxHeight: 315, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.Menu, { ...props, className: "cim-menu" }) }));
46
+ const isSubmenu = (0, react_1.useContext)(SubmenuContext);
47
+ return ((0, jsx_runtime_1.jsx)(collapsible_list_js_1.CollapsibleList, { placement: isSubmenu ? 'end top' : `bottom ${align}`, offset: isSubmenu ? -1 : 5, crossOffset: isSubmenu ? -8 : undefined, maxHeight: 315, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.Menu, { ...props, className: "cim-menu" }) }));
34
48
  }
35
49
  Menu.displayName = 'Menu';
36
50
  /** Groups list items within `Menu` into a section. */
@@ -44,7 +58,7 @@ MenuSection.displayName = 'MenuSection';
44
58
  /** Renders a single list item within `Menu`. */
45
59
  function MenuItem({ children, description, icon, ...props }) {
46
60
  const textValue = typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');
47
- return ((0, jsx_runtime_1.jsx)(react_aria_components_1.MenuItem, { ...props, className: "cim-menu-item cim-checkbox-indicator-wrapper", textValue: textValue, children: ({ isDisabled, isSelected, selectionMode }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [selectionMode === 'single' && (0, jsx_runtime_1.jsx)(index_js_1.IconCheckBold, { UNSAFE_className: "cim-menu-item-selection-indicator" }), selectionMode === 'multiple' && (0, jsx_runtime_1.jsx)(checkbox_indicator_js_1.CheckboxIndicator, { isSelected: isSelected }), icon, (0, jsx_runtime_1.jsxs)("div", { className: "cim-menu-item-text", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Text, { slot: "label", className: (0, utils_js_1.textStyle)({ variant: 'body', tone: isDisabled ? 'muted' : 'base' }), children: children }), description && ((0, jsx_runtime_1.jsx)(react_aria_components_1.Text, { slot: "description", className: (0, utils_js_1.textStyle)({ variant: 'small', tone: isDisabled ? 'muted' : 'subtle' }), children: description }))] })] })) }));
61
+ return ((0, jsx_runtime_1.jsx)(react_aria_components_1.MenuItem, { ...props, className: "cim-menu-item", textValue: textValue, children: ({ isDisabled, isSelected, selectionMode, hasSubmenu }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [selectionMode === 'single' && (0, jsx_runtime_1.jsx)(index_js_1.IconCheckBold, { UNSAFE_className: "cim-menu-item-selection-indicator" }), selectionMode === 'multiple' && (0, jsx_runtime_1.jsx)(checkbox_indicator_js_1.CheckboxIndicator, { isSelected: isSelected, isDisabled: isDisabled }), icon, (0, jsx_runtime_1.jsxs)("div", { className: "cim-menu-item-text", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Text, { slot: "label", className: (0, utils_js_1.textStyle)({ variant: 'body', tone: isDisabled ? 'muted' : 'base' }), children: children }), description && ((0, jsx_runtime_1.jsx)(react_aria_components_1.Text, { slot: "description", className: (0, utils_js_1.textStyle)({ variant: 'small', tone: isDisabled ? 'muted' : 'subtle' }), children: description }))] }), hasSubmenu && (0, jsx_runtime_1.jsx)(index_js_1.IconChevronRight, { size: 24, UNSAFE_className: "cim-menu-item-submenu-indicator" })] })) }));
48
62
  }
49
63
  MenuItem.displayName = 'MenuItem';
50
64
  //# sourceMappingURL=menu.js.map