@cimpress-ui/react 1.24.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.
- package/dist/commonjs/components/app-header/side-nav.d.ts +1 -9
- package/dist/commonjs/components/app-header/side-nav.d.ts.map +1 -1
- package/dist/commonjs/components/app-header/side-nav.js +3 -3
- package/dist/commonjs/components/app-header/side-nav.js.map +1 -1
- package/dist/commonjs/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/commonjs/components/checkbox/checkbox.js +1 -1
- package/dist/commonjs/components/checkbox/checkbox.js.map +1 -1
- package/dist/commonjs/components/combo-box/combo-box.d.ts +1 -0
- package/dist/commonjs/components/combo-box/combo-box.d.ts.map +1 -1
- package/dist/commonjs/components/combo-box/combo-box.js +23 -5
- package/dist/commonjs/components/combo-box/combo-box.js.map +1 -1
- package/dist/commonjs/components/internal/checkbox-indicator/checkbox-indicator.js +2 -4
- package/dist/commonjs/components/internal/checkbox-indicator/checkbox-indicator.js.map +1 -1
- package/dist/commonjs/components/internal/collapsible-list/collapsible-list.js.map +1 -1
- package/dist/commonjs/components/menu/menu.d.ts +14 -1
- package/dist/commonjs/components/menu/menu.d.ts.map +1 -1
- package/dist/commonjs/components/menu/menu.js +16 -2
- package/dist/commonjs/components/menu/menu.js.map +1 -1
- package/dist/commonjs/components/select/select.d.ts +1 -1
- package/dist/commonjs/components/select/select.d.ts.map +1 -1
- package/dist/commonjs/components/select/select.js +3 -2
- package/dist/commonjs/components/select/select.js.map +1 -1
- package/dist/commonjs/components/tag-field/tag-field.js +1 -1
- package/dist/commonjs/components/tag-field/tag-field.js.map +1 -1
- package/dist/commonjs/components/toast/toast-queue.d.ts +9 -7
- package/dist/commonjs/components/toast/toast-queue.d.ts.map +1 -1
- package/dist/commonjs/components/toast/toast-queue.js +6 -5
- package/dist/commonjs/components/toast/toast-queue.js.map +1 -1
- package/dist/commonjs/components/toast/toast-region.d.ts +1 -1
- package/dist/commonjs/components/toast/toast-region.d.ts.map +1 -1
- package/dist/commonjs/components/toast/toast-region.js +3 -3
- package/dist/commonjs/components/toast/toast-region.js.map +1 -1
- package/dist/commonjs/components/toast/toast.js +3 -3
- package/dist/commonjs/components/toast/toast.js.map +1 -1
- package/dist/commonjs/components/toast/types.d.ts +1 -1
- package/dist/commonjs/components/toast/types.d.ts.map +1 -1
- package/dist/commonjs/components/toast/types.js.map +1 -1
- package/dist/commonjs/components/typography/list.d.ts +31 -0
- package/dist/commonjs/components/typography/list.d.ts.map +1 -0
- package/dist/commonjs/components/typography/list.js +39 -0
- package/dist/commonjs/components/typography/list.js.map +1 -0
- package/dist/commonjs/index.d.ts +4 -3
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +5 -4
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/components/app-header/side-nav.d.ts +1 -9
- package/dist/esm/components/app-header/side-nav.d.ts.map +1 -1
- package/dist/esm/components/app-header/side-nav.js +3 -3
- package/dist/esm/components/app-header/side-nav.js.map +1 -1
- package/dist/esm/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/esm/components/checkbox/checkbox.js +1 -1
- package/dist/esm/components/checkbox/checkbox.js.map +1 -1
- package/dist/esm/components/combo-box/combo-box.d.ts +1 -0
- package/dist/esm/components/combo-box/combo-box.d.ts.map +1 -1
- package/dist/esm/components/combo-box/combo-box.js +24 -6
- package/dist/esm/components/combo-box/combo-box.js.map +1 -1
- package/dist/esm/components/internal/checkbox-indicator/checkbox-indicator.js +2 -4
- package/dist/esm/components/internal/checkbox-indicator/checkbox-indicator.js.map +1 -1
- package/dist/esm/components/internal/collapsible-list/collapsible-list.js.map +1 -1
- package/dist/esm/components/menu/menu.d.ts +14 -1
- package/dist/esm/components/menu/menu.d.ts.map +1 -1
- package/dist/esm/components/menu/menu.js +17 -4
- package/dist/esm/components/menu/menu.js.map +1 -1
- package/dist/esm/components/select/select.d.ts +1 -1
- package/dist/esm/components/select/select.d.ts.map +1 -1
- package/dist/esm/components/select/select.js +4 -3
- package/dist/esm/components/select/select.js.map +1 -1
- package/dist/esm/components/tag-field/tag-field.js +1 -1
- package/dist/esm/components/tag-field/tag-field.js.map +1 -1
- package/dist/esm/components/toast/toast-queue.d.ts +9 -7
- package/dist/esm/components/toast/toast-queue.d.ts.map +1 -1
- package/dist/esm/components/toast/toast-queue.js +5 -4
- package/dist/esm/components/toast/toast-queue.js.map +1 -1
- package/dist/esm/components/toast/toast-region.d.ts +1 -1
- package/dist/esm/components/toast/toast-region.d.ts.map +1 -1
- package/dist/esm/components/toast/toast-region.js +3 -3
- package/dist/esm/components/toast/toast-region.js.map +1 -1
- package/dist/esm/components/toast/toast.js +2 -2
- package/dist/esm/components/toast/toast.js.map +1 -1
- package/dist/esm/components/toast/types.d.ts +1 -1
- package/dist/esm/components/toast/types.d.ts.map +1 -1
- package/dist/esm/components/toast/types.js.map +1 -1
- package/dist/esm/components/typography/list.d.ts +31 -0
- package/dist/esm/components/typography/list.d.ts.map +1 -0
- package/dist/esm/components/typography/list.js +31 -0
- package/dist/esm/components/typography/list.js.map +1 -0
- package/dist/esm/index.d.ts +4 -3
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -2
- package/dist/esm/index.js.map +1 -1
- package/dist-styles/core.css +1 -1
- package/dist-styles/styles.css +1 -1
- 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
|
|
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;
|
|
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;CAC1C;AAED,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,qBAAqB,2CA2BzF;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,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,wBAAgB,wBAAwB,CAAC,EAAE,QAAQ,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
|
|
20
|
+
function UNSTABLE_SideNav({ children, isOpen, onOpenChange }) {
|
|
21
21
|
const isMobile = (0, use_is_mobile_js_1.useIsMobile)();
|
|
22
|
-
const drawer =
|
|
23
|
-
return ((0, jsx_runtime_1.jsxs)(SideNavContext.Provider, { value: { isOpen: isOpen ?? false }, children: [drawer,
|
|
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;;;
|
|
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,O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BAAwB,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;
|
|
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',
|
|
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.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,GA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AE,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"]}
|
|
@@ -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;
|
|
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;AAW/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,G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,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
|
|
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.
|
|
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,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;AAsDF,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,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,C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AC;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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,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":";;;;;
|
|
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
|
|
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;
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAuC,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AACpH,OAAO,EAIL,KAAK,SAAS,IAAI,YAAY,EAE9B,KAAK,aAAa,IAAI,gBAAgB,EAEtC,KAAK,gBAAgB,IAAI,mBAAmB,EAE5C,KAAK,gBAAgB,IAAI,mBAAmB,EAG7C,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAK7G,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,gBAAgB;IAC/B,mIAAmI;IACnI,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ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IAC1E,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,2CAA2C;IAC3C,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,gDAAgD;AAChD,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,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
|
-
|
|
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
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.js","sourceRoot":"","sources":["../../../../src/components/menu/menu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AAkCb,4BAEC;AAkBD,oBAcC;AAaD,kCAaC;AAiBD,4BA+BC;;AA5ID,gDAAwB;AAExB,iEAY+B;AAC/B,mDAAqD;AACrD,mEAA4D;AAC5D,gGAAyF;AACzF,0FAAmF;AAEnF,qDAAmD;AAOnD;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,KAAoB;IAC3C,OAA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CAAC;AAED,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ReactNode, UIEventHandler } from 'react';\nimport {\n Collection as RACCollection,\n Header as RACHeader,\n Menu as RACMenu,\n type MenuProps as RACMenuProps,\n MenuItem as RACMenuItem,\n type MenuItemProps as RACMenuItemProps,\n MenuSection as RACMenuSection,\n type MenuSectionProps as RACMenuSectionProps,\n MenuTrigger as RACMenuTrigger,\n type MenuTriggerProps as RACMenuTriggerProps,\n Text as RACText,\n} from 'react-aria-components';\nimport { IconCheckBold } from '../../icons/index.js';\nimport { isProduction } from '../../utils/is-production.js';\nimport { CheckboxIndicator } from '../internal/checkbox-indicator/checkbox-indicator.js';\nimport { CollapsibleList } from '../internal/collapsible-list/collapsible-list.js';\nimport type { CollectionItem, CollectionProps, Key, NavigationProps, StringLikeChildren } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface MenuRootProps extends Pick<RACMenuTriggerProps, 'onOpenChange' | 'isOpen' | 'defaultOpen'> {\n /** The menu trigger with its associated menu. Provide the trigger as the first child, and the menu as the second child. */\n children: ReactNode;\n}\n\n/**\n * 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.\n *\n * See [menu usage guidelines](https://ui.cimpress.io/components/menu/).\n */\nexport function MenuRoot(props: MenuRootProps) {\n return <RACMenuTrigger {...props} />;\n}\n\nMenuRoot.displayName = 'MenuRoot';\n\nexport interface MenuProps<T extends CollectionItem = CollectionItem>\n extends CollectionProps<T>, Pick<RACMenuProps<T>, 'selectedKeys' | 'onSelectionChange' | 'selectionMode'> {\n /**\n * The alignment of the menu overlay relative to its trigger.\n * @default 'start'\n */\n align?: 'start' | 'end';\n /** Handler that is called when an item is selected. When using `onAction`, all items must have an `id` prop defined. */\n onAction?: (key: Key) => void;\n /** Handler that is called when the list of items is scrolled. */\n onScroll?: UIEventHandler<HTMLDivElement>;\n}\n\n/** Displays a collapsible list of options and actions that users can choose from. */\nexport function Menu<T extends CollectionItem>({ align = 'start', ...props }: MenuProps<T>) {\n if (!isProduction() && props.items != null && typeof props.children !== 'function') {\n console.warn('`Menu` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <CollapsibleList\n placement={`bottom ${align}`}\n offset={5} // 1px border + 4px actual offset\n maxHeight={315}\n >\n <RACMenu {...props} className=\"cim-menu\" />\n </CollapsibleList>\n );\n}\n\nMenu.displayName = 'Menu';\n\nexport interface MenuSectionProps<T extends CollectionItem = CollectionItem>\n extends CollectionProps<T>, Pick<RACMenuSectionProps<T>, 'selectedKeys' | 'onSelectionChange' | 'selectionMode'> {\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 `Menu` into a section. */\nexport function MenuSection<T extends CollectionItem>({ title, children, items, ...props }: MenuSectionProps<T>) {\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`MenuSection` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACMenuSection {...props} className=\"cim-menu-section\">\n <RACHeader className={clsx('cim-menu-section-header', textStyle({ variant: 'small-semibold', tone: 'subtle' }))}>\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACMenuSection>\n );\n}\n\nMenuSection.displayName = 'MenuSection';\n\nexport interface MenuItemProps\n extends NavigationProps, Pick<RACMenuItemProps, 'isDisabled' | 'onAction' | 'onHoverStart' | 'onHoverEnd'> {\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 /** Additional description for the menu item. */\n description?: string;\n /** An icon representing the menu item. */\n icon?: ReactNode;\n}\n\n/** Renders a single list item within `Menu`. */\nexport function MenuItem({ children, description, icon, ...props }: MenuItemProps) {\n const textValue =\n typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');\n\n return (\n <RACMenuItem {...props} className=\"cim-menu-item cim-checkbox-indicator-wrapper\" textValue={textValue}>\n {({ isDisabled, isSelected, selectionMode }) => (\n <>\n {selectionMode === 'single' && <IconCheckBold UNSAFE_className=\"cim-menu-item-selection-indicator\" />}\n {selectionMode === 'multiple' && <CheckboxIndicator isSelected={isSelected} />}\n\n {icon}\n\n <div className=\"cim-menu-item-text\">\n <RACText slot=\"label\" className={textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'base' })}>\n {children}\n </RACText>\n\n {description && (\n <RACText\n slot=\"description\"\n className={textStyle({ variant: 'small', tone: isDisabled ? 'muted' : 'subtle' })}\n >\n {description}\n </RACText>\n )}\n </div>\n </>\n )}\n </RACMenuItem>\n );\n}\n\nMenuItem.displayName = 'MenuItem';\n"]}
|
|
1
|
+
{"version":3,"file":"menu.js","sourceRoot":"","sources":["../../../../src/components/menu/menu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AAqCb,4BAEC;AAcD,kCASC;AAkBD,oBAiBC;AAaD,kCAaC;AAiBD,4BAiCC;;AA3KD,gDAAwB;AACxB,iCAAoH;AACpH,iEAa+B;AAC/B,mDAAuE;AACvE,mEAA4D;AAC5D,gGAAyF;AACzF,0FAAmF;AAEnF,qDAAmD;AAEnD,MAAM,cAAc,GAAG,IAAA,qBAAa,EAAC,KAAK,CAAC,CAAC;AAO5C;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,KAAoB;IAC3C,OAAO,uBAAC,mCAAc,OAAK,KAAK,GAAI,CAAC;AACvC,CAAC;AAED,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;AAOlC;;;;GAIG;AACH,SAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAoB;IAClE,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,gBAAQ,CAAC,OAAO,CAAC,QAAQ,CAAmB,CAAC;IAErE,OAAO,CACL,wBAAC,sCAAiB,OAAK,KAAK,EAAE,KAAK,EAAE,CAAC,aACnC,OAAQ,EACT,uBAAC,cAAc,CAA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C,MAAM,EAAE,CAAC,YACjG,QAAQ,GACD,EAET,WAAW,IAAI,CACd,uBAAC,4BAAO,IACN,IAAI,EAAC,aAAa,EAClB,SAAS,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,YAEhF,WAAW,GACJ,CACX,IACG,EAEL,UAAU,IAAI,uBAAC,2BAAgB,IAAC,IAAI,EAAE,EAAE,EAAE,gBAAgB,EAAC,iCAAiC,GAAG,IAC/F,CACJ,GACW,CACf,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { Children, createContext, useContext, type ReactElement, type ReactNode, type UIEventHandler } from 'react';\nimport {\n Collection as RACCollection,\n Header as RACHeader,\n Menu as RACMenu,\n type MenuProps as RACMenuProps,\n MenuItem as RACMenuItem,\n type MenuItemProps as RACMenuItemProps,\n MenuSection as RACMenuSection,\n type MenuSectionProps as RACMenuSectionProps,\n MenuTrigger as RACMenuTrigger,\n type MenuTriggerProps as RACMenuTriggerProps,\n SubmenuTrigger as RACSubmenuTrigger,\n Text as RACText,\n} from 'react-aria-components';\nimport { IconCheckBold, IconChevronRight } from '../../icons/index.js';\nimport { isProduction } from '../../utils/is-production.js';\nimport { CheckboxIndicator } from '../internal/checkbox-indicator/checkbox-indicator.js';\nimport { CollapsibleList } from '../internal/collapsible-list/collapsible-list.js';\nimport type { CollectionItem, CollectionProps, Key, NavigationProps, StringLikeChildren } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nconst SubmenuContext = createContext(false);\n\nexport interface MenuRootProps extends Pick<RACMenuTriggerProps, 'onOpenChange' | 'isOpen' | 'defaultOpen'> {\n /** The menu trigger with its associated menu. Provide the trigger as the first child, and the menu as the second child. */\n children: ReactNode;\n}\n\n/**\n * 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.\n *\n * See [menu usage guidelines](https://ui.cimpress.io/components/menu/).\n */\nexport function MenuRoot(props: MenuRootProps) {\n return <RACMenuTrigger {...props} />;\n}\n\nMenuRoot.displayName = 'MenuRoot';\n\nexport interface SubmenuRootProps {\n /** The submenu trigger with its associated menu. Provide the item trigger as the first child, and the menu as the second child. */\n children: ReactElement[];\n}\n\n/**\n * 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.\n *\n * See [menu usage guidelines](https://ui.cimpress.io/components/menu/).\n */\nexport function SubmenuRoot({ children, ...props }: SubmenuRootProps) {\n const [trigger, menu] = Children.toArray(children) as ReactElement[];\n\n return (\n <RACSubmenuTrigger {...props} delay={0}>\n {trigger!}\n <SubmenuContext.Provider value={true}>{menu!}</SubmenuContext.Provider>\n </RACSubmenuTrigger>\n );\n}\n\nSubmenuRoot.displayName = 'SubmenuRoot';\n\nexport interface MenuProps<T extends CollectionItem = CollectionItem>\n extends CollectionProps<T>, Pick<RACMenuProps<T>, 'selectedKeys' | 'onSelectionChange' | 'selectionMode'> {\n /**\n * The alignment of the menu overlay relative to its trigger.\n * @default 'start'\n */\n align?: 'start' | 'end';\n /** Handler that is called when an item is selected. When using `onAction`, all items must have an `id` prop defined. */\n onAction?: (key: Key) => void;\n /** Handler that is called when the list of items is scrolled. */\n onScroll?: UIEventHandler<HTMLDivElement>;\n}\n\n/** Displays a collapsible list of options and actions that users can choose from. */\nexport function Menu<T extends CollectionItem>({ align = 'start', ...props }: MenuProps<T>) {\n if (!isProduction() && props.items != null && typeof props.children !== 'function') {\n console.warn('`Menu` requires `children` to be a function when using `items` prop');\n }\n\n const isSubmenu = useContext(SubmenuContext);\n\n return (\n <CollapsibleList\n placement={isSubmenu ? 'end top' : `bottom ${align}`}\n offset={isSubmenu ? -1 : 5} // 1px border + 4px actual offset\n crossOffset={isSubmenu ? -8 : undefined}\n maxHeight={315}\n >\n <RACMenu {...props} className=\"cim-menu\" />\n </CollapsibleList>\n );\n}\n\nMenu.displayName = 'Menu';\n\nexport interface MenuSectionProps<T extends CollectionItem = CollectionItem>\n extends CollectionProps<T>, Pick<RACMenuSectionProps<T>, 'selectedKeys' | 'onSelectionChange' | 'selectionMode'> {\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 `Menu` into a section. */\nexport function MenuSection<T extends CollectionItem>({ title, children, items, ...props }: MenuSectionProps<T>) {\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`MenuSection` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACMenuSection {...props} className=\"cim-menu-section\">\n <RACHeader className={clsx('cim-menu-section-header', textStyle({ variant: 'small-semibold', tone: 'subtle' }))}>\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACMenuSection>\n );\n}\n\nMenuSection.displayName = 'MenuSection';\n\nexport interface MenuItemProps\n extends NavigationProps, Pick<RACMenuItemProps, 'isDisabled' | 'onAction' | 'onHoverStart' | 'onHoverEnd'> {\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 /** Additional description for the menu item. */\n description?: string;\n /** An icon representing the menu item. */\n icon?: ReactNode;\n}\n\n/** Renders a single list item within `Menu`. */\nexport function MenuItem({ children, description, icon, ...props }: MenuItemProps) {\n const textValue =\n typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');\n\n return (\n <RACMenuItem {...props} className=\"cim-menu-item\" textValue={textValue}>\n {({ isDisabled, isSelected, selectionMode, hasSubmenu }) => (\n <>\n {selectionMode === 'single' && <IconCheckBold UNSAFE_className=\"cim-menu-item-selection-indicator\" />}\n {selectionMode === 'multiple' && <CheckboxIndicator isSelected={isSelected} isDisabled={isDisabled} />}\n\n {icon}\n\n <div className=\"cim-menu-item-text\">\n <RACText slot=\"label\" className={textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'base' })}>\n {children}\n </RACText>\n\n {description && (\n <RACText\n slot=\"description\"\n className={textStyle({ variant: 'small', tone: isDisabled ? 'muted' : 'subtle' })}\n >\n {description}\n </RACText>\n )}\n </div>\n\n {hasSubmenu && <IconChevronRight size={24} UNSAFE_className=\"cim-menu-item-submenu-indicator\" />}\n </>\n )}\n </RACMenuItem>\n );\n}\n\nMenuItem.displayName = 'MenuItem';\n"]}
|
|
@@ -31,7 +31,7 @@ export interface SelectProps<T extends CollectionItem = CollectionItem, M extend
|
|
|
31
31
|
* How the selected value is displayed.
|
|
32
32
|
* @default 'text'
|
|
33
33
|
*/
|
|
34
|
-
UNSTABLE_valueDisplay?: 'text' | 'tags';
|
|
34
|
+
UNSTABLE_valueDisplay?: 'text' | 'tags' | 'count';
|
|
35
35
|
/**
|
|
36
36
|
* Whether the list of options should be filterable.
|
|
37
37
|
* @default false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../src/components/select/select.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAQL,KAAK,gBAAgB,IAAI,mBAAmB,EAO5C,KAAK,WAAW,IAAI,cAAc,EAMnC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../src/components/select/select.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAQL,KAAK,gBAAgB,IAAI,mBAAmB,EAO5C,KAAK,WAAW,IAAI,cAAc,EAMnC,MAAM,uBAAuB,CAAC;AAgB/B,OAAO,KAAK,EACV,QAAQ,EACR,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,WAAW,EACX,UAAU,EACV,GAAG,EACH,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAKrB,MA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6EAA6E;IAC7E,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CAelH;yBAfe,aAAa"}
|
|
@@ -20,6 +20,7 @@ const is_production_js_1 = require("../../utils/is-production.js");
|
|
|
20
20
|
const string_like_children_to_string_js_1 = require("../../utils/string-like-children-to-string.js");
|
|
21
21
|
const use_production_warning_js_1 = require("../../utils/use-production-warning.js");
|
|
22
22
|
const with_style_props_js_1 = require("../../with-style-props.js");
|
|
23
|
+
const checkbox_indicator_js_1 = require("../internal/checkbox-indicator/checkbox-indicator.js");
|
|
23
24
|
const collapsible_list_js_1 = require("../internal/collapsible-list/collapsible-list.js");
|
|
24
25
|
const form_field_js_1 = require("../internal/form-field/form-field.js");
|
|
25
26
|
const x_button_js_1 = require("../internal/x-button/x-button.js");
|
|
@@ -77,7 +78,7 @@ const SelectButton = (0, forward_ref_js_1.forwardRef)(({ valueDisplay, isClearab
|
|
|
77
78
|
const triggerRef = (0, react_1.useRef)(null);
|
|
78
79
|
const collectionMessages = (0, index_js_1.useLocalizedMessages)('UNSTABLE_collection');
|
|
79
80
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "cim-select-button", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Button, { ref: (0, utils_1.mergeRefs)(ref, triggerRef), className: "cim-select-button-trigger" }), (0, jsx_runtime_1.jsx)(react_aria_components_1.SelectValue, { className: (0, clsx_1.default)('cim-select-button-value', (0, utils_js_1.textStyle)({ variant: 'body', alignment: 'start' })), children: ({ selectedText, defaultChildren, isPlaceholder, state }) => {
|
|
80
|
-
if (valueDisplay === 'tags' && state.selectedItems.length > 0) {
|
|
81
|
+
if ((valueDisplay === 'tags' && state.selectedItems.length > 0) || valueDisplay === 'count') {
|
|
81
82
|
return ((0, jsx_runtime_1.jsx)(text_js_1.Text, { as: "span", variant: "body", tone: "subtle", children: collectionMessages.format('itemsSelected', { selectedItemCount: state.selectedItems.length }) }));
|
|
82
83
|
}
|
|
83
84
|
return isPlaceholder ? defaultChildren : selectedText;
|
|
@@ -148,7 +149,7 @@ exports.Select = _Select;
|
|
|
148
149
|
/** Renders a single list item within `Select`. */
|
|
149
150
|
function SelectItem({ children, ...props }) {
|
|
150
151
|
const textValue = (0, string_like_children_to_string_js_1.stringLikeChildrenToString)(children);
|
|
151
|
-
return ((0, jsx_runtime_1.jsx)(react_aria_components_1.ListBoxItem, { ...props, className: "cim-select-item", textValue: textValue, children: ({ isDisabled }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(index_js_2.
|
|
152
|
+
return ((0, jsx_runtime_1.jsx)(react_aria_components_1.ListBoxItem, { ...props, className: "cim-select-item", 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_2.IconCheckBold, {}), selectionMode === 'multiple' && (0, jsx_runtime_1.jsx)(checkbox_indicator_js_1.CheckboxIndicator, { isSelected: isSelected, isDisabled: isDisabled }), (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 })] })) }));
|
|
152
153
|
}
|
|
153
154
|
SelectItem.displayName = 'SelectItem';
|
|
154
155
|
/** Groups list items within `Select` into a section. */
|