@cimpress-ui/react 1.6.0 → 1.7.1

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 (121) hide show
  1. package/dist/commonjs/components/app-header/app-header.d.ts +1 -0
  2. package/dist/commonjs/components/app-header/app-header.d.ts.map +1 -1
  3. package/dist/commonjs/components/app-header/app-header.js +2 -2
  4. package/dist/commonjs/components/app-header/app-header.js.map +1 -1
  5. package/dist/commonjs/components/app-header/nav-button.d.ts +8 -0
  6. package/dist/commonjs/components/app-header/nav-button.d.ts.map +1 -0
  7. package/dist/commonjs/components/app-header/nav-button.js +18 -0
  8. package/dist/commonjs/components/app-header/nav-button.js.map +1 -0
  9. package/dist/commonjs/components/app-header/side-nav.d.ts +34 -0
  10. package/dist/commonjs/components/app-header/side-nav.d.ts.map +1 -0
  11. package/dist/commonjs/components/app-header/side-nav.js +35 -0
  12. package/dist/commonjs/components/app-header/side-nav.js.map +1 -0
  13. package/dist/commonjs/components/app-shell/app-shell.d.ts +10 -0
  14. package/dist/commonjs/components/app-shell/app-shell.d.ts.map +1 -0
  15. package/dist/commonjs/components/app-shell/app-shell.js +16 -0
  16. package/dist/commonjs/components/app-shell/app-shell.js.map +1 -0
  17. package/dist/commonjs/components/drawer/drawer.d.ts +6 -1
  18. package/dist/commonjs/components/drawer/drawer.d.ts.map +1 -1
  19. package/dist/commonjs/components/drawer/drawer.js +2 -2
  20. package/dist/commonjs/components/drawer/drawer.js.map +1 -1
  21. package/dist/commonjs/components/hidden/hidden.d.ts +7 -0
  22. package/dist/commonjs/components/hidden/hidden.d.ts.map +1 -0
  23. package/dist/commonjs/components/hidden/hidden.js +19 -0
  24. package/dist/commonjs/components/hidden/hidden.js.map +1 -0
  25. package/dist/commonjs/components/number-field/number-field.d.ts +1 -1
  26. package/dist/commonjs/components/number-field/number-field.d.ts.map +1 -1
  27. package/dist/commonjs/components/number-field/number-field.js.map +1 -1
  28. package/dist/commonjs/components/text-inputs/text-area.d.ts +11 -1
  29. package/dist/commonjs/components/text-inputs/text-area.d.ts.map +1 -1
  30. package/dist/commonjs/components/text-inputs/text-area.js +5 -1
  31. package/dist/commonjs/components/text-inputs/text-area.js.map +1 -1
  32. package/dist/commonjs/components/text-inputs/text-field.d.ts +11 -1
  33. package/dist/commonjs/components/text-inputs/text-field.d.ts.map +1 -1
  34. package/dist/commonjs/components/text-inputs/text-field.js +10 -5
  35. package/dist/commonjs/components/text-inputs/text-field.js.map +1 -1
  36. package/dist/commonjs/components/tooltip/tooltip.d.ts +2 -0
  37. package/dist/commonjs/components/tooltip/tooltip.d.ts.map +1 -1
  38. package/dist/commonjs/components/tooltip/tooltip.js +2 -2
  39. package/dist/commonjs/components/tooltip/tooltip.js.map +1 -1
  40. package/dist/commonjs/icons/index.d.ts +1 -0
  41. package/dist/commonjs/icons/index.d.ts.map +1 -1
  42. package/dist/commonjs/icons/index.js +3 -1
  43. package/dist/commonjs/icons/index.js.map +1 -1
  44. package/dist/commonjs/icons/unstable-expand.d.ts +8 -0
  45. package/dist/commonjs/icons/unstable-expand.d.ts.map +1 -0
  46. package/dist/commonjs/icons/unstable-expand.js +24 -0
  47. package/dist/commonjs/icons/unstable-expand.js.map +1 -0
  48. package/dist/commonjs/index.d.ts +4 -0
  49. package/dist/commonjs/index.d.ts.map +1 -1
  50. package/dist/commonjs/index.js +4 -0
  51. package/dist/commonjs/index.js.map +1 -1
  52. package/dist/commonjs/utils/use-is-mobile.d.ts +2 -0
  53. package/dist/commonjs/utils/use-is-mobile.d.ts.map +1 -0
  54. package/dist/commonjs/utils/use-is-mobile.js +9 -0
  55. package/dist/commonjs/utils/use-is-mobile.js.map +1 -0
  56. package/dist/commonjs/with-style-props.d.ts +1 -1
  57. package/dist/commonjs/with-style-props.d.ts.map +1 -1
  58. package/dist/commonjs/with-style-props.js +3 -1
  59. package/dist/commonjs/with-style-props.js.map +1 -1
  60. package/dist/esm/components/app-header/app-header.d.ts +1 -0
  61. package/dist/esm/components/app-header/app-header.d.ts.map +1 -1
  62. package/dist/esm/components/app-header/app-header.js +2 -2
  63. package/dist/esm/components/app-header/app-header.js.map +1 -1
  64. package/dist/esm/components/app-header/nav-button.d.ts +8 -0
  65. package/dist/esm/components/app-header/nav-button.d.ts.map +1 -0
  66. package/dist/esm/components/app-header/nav-button.js +12 -0
  67. package/dist/esm/components/app-header/nav-button.js.map +1 -0
  68. package/dist/esm/components/app-header/side-nav.d.ts +34 -0
  69. package/dist/esm/components/app-header/side-nav.d.ts.map +1 -0
  70. package/dist/esm/components/app-header/side-nav.js +29 -0
  71. package/dist/esm/components/app-header/side-nav.js.map +1 -0
  72. package/dist/esm/components/app-shell/app-shell.d.ts +10 -0
  73. package/dist/esm/components/app-shell/app-shell.d.ts.map +1 -0
  74. package/dist/esm/components/app-shell/app-shell.js +9 -0
  75. package/dist/esm/components/app-shell/app-shell.js.map +1 -0
  76. package/dist/esm/components/drawer/drawer.d.ts +6 -1
  77. package/dist/esm/components/drawer/drawer.d.ts.map +1 -1
  78. package/dist/esm/components/drawer/drawer.js +2 -2
  79. package/dist/esm/components/drawer/drawer.js.map +1 -1
  80. package/dist/esm/components/hidden/hidden.d.ts +7 -0
  81. package/dist/esm/components/hidden/hidden.d.ts.map +1 -0
  82. package/dist/esm/components/hidden/hidden.js +13 -0
  83. package/dist/esm/components/hidden/hidden.js.map +1 -0
  84. package/dist/esm/components/number-field/number-field.d.ts +1 -1
  85. package/dist/esm/components/number-field/number-field.d.ts.map +1 -1
  86. package/dist/esm/components/number-field/number-field.js.map +1 -1
  87. package/dist/esm/components/text-inputs/text-area.d.ts +11 -1
  88. package/dist/esm/components/text-inputs/text-area.d.ts.map +1 -1
  89. package/dist/esm/components/text-inputs/text-area.js +6 -2
  90. package/dist/esm/components/text-inputs/text-area.js.map +1 -1
  91. package/dist/esm/components/text-inputs/text-field.d.ts +11 -1
  92. package/dist/esm/components/text-inputs/text-field.d.ts.map +1 -1
  93. package/dist/esm/components/text-inputs/text-field.js +11 -6
  94. package/dist/esm/components/text-inputs/text-field.js.map +1 -1
  95. package/dist/esm/components/tooltip/tooltip.d.ts +2 -0
  96. package/dist/esm/components/tooltip/tooltip.d.ts.map +1 -1
  97. package/dist/esm/components/tooltip/tooltip.js +2 -2
  98. package/dist/esm/components/tooltip/tooltip.js.map +1 -1
  99. package/dist/esm/icons/index.d.ts +1 -0
  100. package/dist/esm/icons/index.d.ts.map +1 -1
  101. package/dist/esm/icons/index.js +1 -0
  102. package/dist/esm/icons/index.js.map +1 -1
  103. package/dist/esm/icons/unstable-expand.d.ts +8 -0
  104. package/dist/esm/icons/unstable-expand.d.ts.map +1 -0
  105. package/dist/esm/icons/unstable-expand.js +19 -0
  106. package/dist/esm/icons/unstable-expand.js.map +1 -0
  107. package/dist/esm/index.d.ts +4 -0
  108. package/dist/esm/index.d.ts.map +1 -1
  109. package/dist/esm/index.js +4 -0
  110. package/dist/esm/index.js.map +1 -1
  111. package/dist/esm/utils/use-is-mobile.d.ts +2 -0
  112. package/dist/esm/utils/use-is-mobile.d.ts.map +1 -0
  113. package/dist/esm/utils/use-is-mobile.js +6 -0
  114. package/dist/esm/utils/use-is-mobile.js.map +1 -0
  115. package/dist/esm/with-style-props.d.ts +1 -1
  116. package/dist/esm/with-style-props.d.ts.map +1 -1
  117. package/dist/esm/with-style-props.js +3 -1
  118. package/dist/esm/with-style-props.js.map +1 -1
  119. package/dist-styles/core.css +1 -1
  120. package/dist-styles/styles.css +1 -1
  121. package/package.json +5 -5
@@ -0,0 +1,34 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { Href } from '../types.js';
3
+ export interface UNSTABLE_SideNavProps {
4
+ children: ReactNode;
5
+ isOpen?: boolean;
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
+ }
16
+ export declare function UNSTABLE_SideNav({ children, isOpen, onOpenChange, variant }: UNSTABLE_SideNavProps): import("react/jsx-runtime").JSX.Element;
17
+ export interface UNSTABLE_SideNavListProps {
18
+ children: ReactNode;
19
+ }
20
+ export declare function UNSTABLE_SideNavList({ children }: UNSTABLE_SideNavListProps): import("react/jsx-runtime").JSX.Element;
21
+ interface UNSTABLE_SideNavListItem {
22
+ label: string;
23
+ href: Href;
24
+ isActive?: boolean;
25
+ icon?: ReactNode;
26
+ }
27
+ export declare function UNSTABLE_SideNavListItem({ label, href, isActive, icon }: UNSTABLE_SideNavListItem): import("react/jsx-runtime").JSX.Element;
28
+ export interface UNSTABLE_SideNavListSectionProps {
29
+ children: ReactNode;
30
+ label?: string;
31
+ }
32
+ export declare function UNSTABLE_SideNavListSection({ children, label }: UNSTABLE_SideNavListSectionProps): import("react/jsx-runtime").JSX.Element;
33
+ export {};
34
+ //# sourceMappingURL=side-nav.d.ts.map
@@ -0,0 +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;AAQlE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAKxC,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,UAAU,wBAAwB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,wBAAgB,wBAAwB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,wBAAwB,2CAajG;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"}
@@ -0,0 +1,29 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { createContext, useContext } from 'react';
4
+ import { Link as RACLink } from 'react-aria-components';
5
+ import { UNSTABLE_IconExpand } from '../../icons/index.js';
6
+ import { useIsMobile } from '../../utils/use-is-mobile.js';
7
+ import { IconButton } from '../button/icon-button.js';
8
+ import { Drawer, DrawerBody } from '../drawer/drawer.js';
9
+ import { UNSTABLE_Hidden } from '../hidden/hidden.js';
10
+ import { Tooltip } from '../tooltip/tooltip.js';
11
+ import { Text } from '../typography/text.js';
12
+ const SideNavContext = createContext({ isOpen: false });
13
+ export function UNSTABLE_SideNav({ children, isOpen, onOpenChange, variant = 'fixed' }) {
14
+ const isMobile = useIsMobile();
15
+ const drawer = (isMobile || variant === 'overlay') && (_jsx(Drawer, { UNSTABLE_placement: "start", isOpen: isOpen, onOpenChange: onOpenChange, "aria-label": "Side navigation", children: _jsx(DrawerBody, { children: children }) }));
16
+ return (_jsxs(SideNavContext.Provider, { value: { isOpen: isOpen ?? false }, children: [drawer, variant === 'fixed' && (_jsx(UNSTABLE_Hidden, { hide: { sm: true, md: false }, children: _jsxs("div", { className: "cim-side-nav", "data-expanded": isOpen, children: [_jsx("div", { className: "cim-side-nav-header", children: _jsx(IconButton, { variant: "tertiary", icon: _jsx(UNSTABLE_IconExpand, { UNSAFE_style: isOpen ? { transform: 'rotate(180deg)' } : {} }), "aria-label": "Expand sidebar", onPress: () => onOpenChange?.(!isOpen) }) }), _jsx("div", { className: "cim-side-nav-list-container", children: children })] }) }))] }));
17
+ }
18
+ export function UNSTABLE_SideNavList({ children }) {
19
+ return _jsx("div", { className: "cim-side-nav-list", children: children });
20
+ }
21
+ export function UNSTABLE_SideNavListItem({ label, href, isActive, icon }) {
22
+ const { isOpen } = useContext(SideNavContext);
23
+ return (_jsx(Tooltip, { label: label, placement: "right", isDisabled: isOpen, children: _jsxs(RACLink, { href: href, className: "cim-side-nav-list-item", "data-active": isActive, "data-expanded": isOpen, children: [icon, _jsx(Text, { as: "span", variant: "medium", UNSAFE_className: "cim-side-nav-list-item-label", children: label })] }) }));
24
+ }
25
+ export function UNSTABLE_SideNavListSection({ children, label }) {
26
+ const { isOpen } = useContext(SideNavContext);
27
+ return (_jsxs("div", { className: "cim-side-nav-list-section", "data-expanded": isOpen, children: [label && (_jsx("div", { className: "cim-side-nav-list-section-header", children: _jsx(Text, { as: "p", variant: "small-semibold", tone: "subtle", UNSAFE_className: "cim-side-nav-list-section-header-label", children: label }) })), children] }));
28
+ }
29
+ //# sourceMappingURL=side-nav.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"side-nav.js","sourceRoot":"","sources":["../../../../src/components/app-header/side-nav.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,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AQ,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 { UNSTABLE_IconExpand } from '../../icons/index.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 } 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={<UNSTABLE_IconExpand UNSAFE_style={isOpen ? { transform: 'rotate(180deg)' } : {}} />}\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\ninterface UNSTABLE_SideNavListItem {\n label: string;\n href: Href;\n isActive?: boolean;\n icon?: ReactNode;\n}\n\nexport function UNSTABLE_SideNavListItem({ label, href, isActive, icon }: UNSTABLE_SideNavListItem) {\n const { isOpen } = useContext(SideNavContext);\n\n return (\n <Tooltip label={label} 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 {label}\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"]}
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface UNSTABLE_AppShellProps {
3
+ children: ReactNode;
4
+ }
5
+ export declare function UNSTABLE_AppShell({ children }: UNSTABLE_AppShellProps): import("react/jsx-runtime").JSX.Element;
6
+ export interface UNSTABLE_AppShellBodyProps {
7
+ children: ReactNode;
8
+ }
9
+ export declare function UNSTABLE_AppShellBody({ children }: UNSTABLE_AppShellBodyProps): import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=app-shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-shell.d.ts","sourceRoot":"","sources":["../../../../src/components/app-shell/app-shell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,EAAE,sBAAsB,2CAErE;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,EAAE,0BAA0B,2CAE7E"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import clsx from 'clsx';
3
+ export function UNSTABLE_AppShell({ children }) {
4
+ return _jsx("div", { className: clsx('cim-app-shell'), children: children });
5
+ }
6
+ export function UNSTABLE_AppShellBody({ children }) {
7
+ return _jsx("div", { className: "cim-app-shell-main", children: children });
8
+ }
9
+ //# sourceMappingURL=app-shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-shell.js","sourceRoot":"","sources":["../../../../src/components/app-shell/app-shell.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAOxB,MAAM,UAAU,iBAAiB,CAAC,EAAE,QAAQ,EAA0B;IACpE,OAAO,cAAK,SAAS,EAAE,IAAI,CAAC,eAAe,CAAC,YAAG,QAAQ,GAAO,CAAC;AACjE,CAAC;AAMD,MAAM,UAAU,qBAAqB,CAAC,EAAE,QAAQ,EAA8B;IAC5E,OAAO,cAAK,SAAS,EAAC,oBAAoB,YAAE,QAAQ,GAAO,CAAC;AAC9D,CAAC","sourcesContent":["import clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\nexport interface UNSTABLE_AppShellProps {\n children: ReactNode;\n}\n\nexport function UNSTABLE_AppShell({ children }: UNSTABLE_AppShellProps) {\n return <div className={clsx('cim-app-shell')}>{children}</div>;\n}\n\nexport interface UNSTABLE_AppShellBodyProps {\n children: ReactNode;\n}\n\nexport function UNSTABLE_AppShellBody({ children }: UNSTABLE_AppShellBodyProps) {\n return <div className=\"cim-app-shell-main\">{children}</div>;\n}\n"]}
@@ -26,7 +26,7 @@ export interface DrawerProps extends CommonProps, AriaLabelingProps {
26
26
  /** The contents of the drawer. A function may be provided to access a function to close the drawer. */
27
27
  children: ReactNode | ((renderProps: DrawerRenderProps) => ReactNode);
28
28
  /** The title of the drawer. */
29
- title: string;
29
+ title?: string;
30
30
  /**
31
31
  * The size of the drawer. This prop is ignored on small devices - drawers on small devices will always take up all available width.
32
32
  * @default 'small'
@@ -53,6 +53,11 @@ export interface DrawerProps extends CommonProps, AriaLabelingProps {
53
53
  * If using `DrawerRoot`, this prop has no effect - provide `onOpenChange` to `DrawerRoot` instead.
54
54
  */
55
55
  onOpenChange?: (isOpen: boolean) => void;
56
+ /**
57
+ * The placement of the drawer.
58
+ * @default 'end'
59
+ */
60
+ UNSTABLE_placement?: 'start' | 'end';
56
61
  }
57
62
  /**
58
63
  * Displays an overlay element which blocks interaction with outside elements.
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAYrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGlE,MAAM,WAAW,eAAe;IAC9B,iIAAiI;IACjI,QAAQ,EAAE,SAAS,CAAC;IACpB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,OAAO,CAAC;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AAO,yGAA+B,CAAC;AAE7C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC;AAE7B,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,uCAAuC;AACvC,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAEhD;yBAFe,UAAU;;;AAM1B,MAAM,WAAW,kBAAkB;IACjC,sDAAsD;IACtD,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,uCAAuC;AACvC,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,2CAMvE;yBANe,aAAa"}
@@ -15,7 +15,7 @@ export function DrawerRoot(props) {
15
15
  return _jsx(RACDialogTrigger, { ...props });
16
16
  }
17
17
  DrawerRoot.displayName = 'DrawerRoot';
18
- function Drawer({ children, title, size = 'small', UNSAFE_className, UNSAFE_style, isDismissible = true, isOpen, defaultOpen, onOpenChange, ...props }, ref) {
18
+ function Drawer({ children, title, size = 'small', UNSAFE_className, UNSAFE_style, isDismissible = true, isOpen, defaultOpen, onOpenChange, UNSTABLE_placement: placement = 'end', ...props }, ref) {
19
19
  const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
20
20
  useProductionWarning(() => {
21
21
  if (!title && !ariaLabel && !ariaLabelledBy) {
@@ -23,7 +23,7 @@ function Drawer({ children, title, size = 'small', UNSAFE_className, UNSAFE_styl
23
23
  }
24
24
  }, [title, ariaLabel, ariaLabelledBy]);
25
25
  const messages = useLocalizedMessages('common');
26
- return (_jsx(RACModalOverlay, { className: "cim-drawer-overlay", isDismissable: isDismissible, isKeyboardDismissDisabled: !isDismissible, isOpen: isOpen, defaultOpen: defaultOpen, onOpenChange: onOpenChange, "data-cim-style-root": true, children: _jsx(RACModal, { className: clsx('cim-drawer', UNSAFE_className), style: UNSAFE_style, "data-size": size, children: _jsx(RACDialog, { ...props, ref: ref, className: "cim-drawer-dialog", children: (renderProps) => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "cim-drawer-header", children: [title && (_jsx(RACHeading, { slot: "title", className: clsx('cim-drawer-title', textStyle({ variant: 'title-5', tone: 'base' })), children: title })), isDismissible && _jsx(XButton, { "aria-label": messages.format('dismiss'), slot: "close" })] }), typeof children === 'function' ? children(renderProps) : children] })) }) }) }));
26
+ return (_jsx(RACModalOverlay, { className: "cim-drawer-overlay", isDismissable: isDismissible, isKeyboardDismissDisabled: !isDismissible, isOpen: isOpen, defaultOpen: defaultOpen, onOpenChange: onOpenChange, "data-cim-style-root": true, "data-placement": placement, children: _jsx(RACModal, { className: clsx('cim-drawer', UNSAFE_className), style: UNSAFE_style, "data-size": size, "data-placement": placement, children: _jsx(RACDialog, { ...props, ref: ref, className: "cim-drawer-dialog", children: (renderProps) => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "cim-drawer-header", children: [title && (_jsx(RACHeading, { slot: "title", className: clsx('cim-drawer-title', textStyle({ variant: 'title-5', tone: 'base' })), children: title })), isDismissible && _jsx(XButton, { "aria-label": messages.format('dismiss'), slot: "close" })] }), typeof children === 'function' ? children(renderProps) : children] })) }) }) }));
27
27
  }
28
28
  /**
29
29
  * Displays an overlay element which blocks interaction with outside elements.
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,MAAM,IAAI,SAAS,EACnB,aAAa,IAAI,gBAAgB,EACjC,OAAO,IAAI,UAAU,EACrB,KAAK,IAAI,QAAQ,EACjB,YAAY,IAAI,eAAe,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uC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C1D,CAAC,WAAW,EAAE,EAAE,CAAC,CAChB,8BACE,eAAK,SAAS,EAAC,mBAAmB,aAC/B,KAAK,IAAI,CACR,KAAC,UAAU,IACT,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,YAEnF,KAAK,GACK,CACd,EACA,aAAa,IAAI,KAAC,OAAO,kBAAa,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,IAAI,EAAC,OAAO,GAAG,IAC9E,EACL,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,IACjE,CACJ,GACS,GACH,GACK,CACnB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAE7C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC;AAO7B,uCAAuC;AACvC,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,OAAO,iBAAS,KAAK,EAAE,SAAS,EAAC,iBAAiB,GAAG,CAAC;AACxD,CAAC;AAED,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AAOtC,uCAAuC;AACvC,MAAM,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAsB;IACtE,OAAO,CACL,iBAAS,KAAK,EAAE,SAAS,EAAC,oBAAoB,YAC3C,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ForwardedRef, ReactNode } from 'react';\nimport {\n Dialog as RACDialog,\n DialogTrigger as RACDialogTrigger,\n Heading as RACHeading,\n Modal as RACModal,\n ModalOverlay as RACModalOverlay,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { XButton } from '../internal/x-button/x-button.js';\nimport type { AriaLabelingProps, CommonProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface DrawerRootProps {\n /** The drawer trigger with its associated drawer. Provide the trigger as the first child, and the drawer as the second child. */\n children: ReactNode;\n /** Whether the drawer is open (controlled). */\n isOpen?: boolean;\n /** Whether the drawer is open by default (uncontrolled). */\n defaultOpen?: boolean;\n /** Handler that is called when the drawer's open state changes. */\n onOpenChange?: (isOpen: boolean) => void;\n}\n\n/**\n * Encapsulates a drawer trigger and its associated drawer.\n * The trigger can be any Cimpress UI button, and the drawer will be displayed when the trigger is activated.\n */\nexport function DrawerRoot(props: DrawerRootProps) {\n return <RACDialogTrigger {...props} />;\n}\n\nDrawerRoot.displayName = 'DrawerRoot';\n\nexport interface DrawerRenderProps {\n /** Closes the drawer when called. */\n close: () => void;\n}\n\nexport interface DrawerProps extends CommonProps, AriaLabelingProps {\n /** The contents of the drawer. A function may be provided to access a function to close the drawer. */\n children: ReactNode | ((renderProps: DrawerRenderProps) => ReactNode);\n /** The title of the drawer. */\n title: string;\n /**\n * The size of the drawer. This prop is ignored on small devices - drawers on small devices will always take up all available width.\n * @default 'small'\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Whether the drawer can be closed by clicking the close button, clicking outside of the drawer, or pressing the Escape key.\n * When `false`, the drawer can only be closed programmatically.\n * @default true\n */\n isDismissible?: boolean;\n /**\n * Whether the drawer is open (controlled).\n * If using `DrawerRoot`, this prop has no effect - provide `isOpen` to `DrawerRoot` instead.\n */\n isOpen?: boolean;\n /**\n * Whether the drawer is open by default (uncontrolled).\n * If using `DrawerRoot`, this prop has no effect - provide `defaultOpen` to `DrawerRoot` instead.\n */\n defaultOpen?: boolean;\n /**\n * Handler that is called when the drawer's open state changes.\n * If using `DrawerRoot`, this prop has no effect - provide `onOpenChange` to `DrawerRoot` instead.\n */\n onOpenChange?: (isOpen: boolean) => void;\n}\n\nfunction Drawer(\n {\n children,\n title,\n size = 'small',\n UNSAFE_className,\n UNSAFE_style,\n isDismissible = true,\n isOpen,\n defaultOpen,\n onOpenChange,\n ...props\n }: DrawerProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!title && !ariaLabel && !ariaLabelledBy) {\n console.warn('Drawer requires one of title / aria-label / aria-labelledby for accessibility');\n }\n }, [title, ariaLabel, ariaLabelledBy]);\n\n const messages = useLocalizedMessages('common');\n\n return (\n <RACModalOverlay\n className=\"cim-drawer-overlay\"\n isDismissable={isDismissible}\n isKeyboardDismissDisabled={!isDismissible}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n data-cim-style-root\n >\n <RACModal className={clsx('cim-drawer', UNSAFE_className)} style={UNSAFE_style} data-size={size}>\n <RACDialog {...props} ref={ref} className=\"cim-drawer-dialog\">\n {(renderProps) => (\n <>\n <div className=\"cim-drawer-header\">\n {title && (\n <RACHeading\n slot=\"title\"\n className={clsx('cim-drawer-title', textStyle({ variant: 'title-5', tone: 'base' }))}\n >\n {title}\n </RACHeading>\n )}\n {isDismissible && <XButton aria-label={messages.format('dismiss')} slot=\"close\" />}\n </div>\n {typeof children === 'function' ? children(renderProps) : children}\n </>\n )}\n </RACDialog>\n </RACModal>\n </RACModalOverlay>\n );\n}\n\n/**\n * Displays an overlay element which blocks interaction with outside elements.\n *\n * See [drawer usage guidelines](https://ui.cimpress.io/components/drawer/).\n */\nconst _Drawer = forwardRef(Drawer, 'Drawer');\n\nexport { _Drawer as Drawer };\n\nexport interface DrawerBodyProps {\n /** The content to render within the drawer. */\n children: ReactNode;\n}\n\n/** Renders content within `Drawer`. */\nexport function DrawerBody(props: DrawerBodyProps) {\n return <div {...props} className=\"cim-drawer-body\" />;\n}\n\nDrawerBody.displayName = 'DrawerBody';\n\nexport interface DrawerActionsProps {\n /** Actions that should be available in the drawer. */\n children: ReactNode;\n}\n\n/** Renders actions within `Drawer`. */\nexport function DrawerActions({ children, ...props }: DrawerActionsProps) {\n return (\n <div {...props} className=\"cim-drawer-actions\">\n {children}\n </div>\n );\n}\n\nDrawerActions.displayName = 'DrawerActions';\n"]}
1
+ {"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,MAAM,IAAI,SAAS,EACnB,aAAa,IAAI,gBAAgB,EACjC,OAAO,IAAI,UAAU,EACrB,KAAK,IAAI,QAAQ,EACjB,YAAY,IAAI,eAAe,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAanD;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,OAAO,KAAC,gBAAgB,OAAK,KAAK,GAAI,CAAC;AACzC,CAAC;AAED,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AA6CtC,SAAS,MAAM,CACb,EACE,QAAQ,EACR,KAAK,EACL,IAAI,GAAG,OAAO,EACd,gBAAgB,EAChB,YAAY,EACZ,aAAa,GAAG,IAAI,EACpB,MAAM,EACN,WAAW,EACX,YAAY,EACZ,kBAAkB,EAAE,SAAS,GAAG,KAAK,EACrC,GAAG,KAAK,EACI,EACd,GAA8B;IAE9B,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAi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,IACjE,CACJ,GACS,GACH,GACK,CACnB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAE7C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC;AAO7B,uCAAuC;AACvC,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,OAAO,iBAAS,KAAK,EAAE,SAAS,EAAC,iBAAiB,GAAG,CAAC;AACxD,CAAC;AAED,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AAOtC,uCAAuC;AACvC,MAAM,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAsB;IACtE,OAAO,CACL,iBAAS,KAAK,EAAE,SAAS,EAAC,oBAAoB,YAC3C,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ForwardedRef, ReactNode } from 'react';\nimport {\n Dialog as RACDialog,\n DialogTrigger as RACDialogTrigger,\n Heading as RACHeading,\n Modal as RACModal,\n ModalOverlay as RACModalOverlay,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { XButton } from '../internal/x-button/x-button.js';\nimport type { AriaLabelingProps, CommonProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface DrawerRootProps {\n /** The drawer trigger with its associated drawer. Provide the trigger as the first child, and the drawer as the second child. */\n children: ReactNode;\n /** Whether the drawer is open (controlled). */\n isOpen?: boolean;\n /** Whether the drawer is open by default (uncontrolled). */\n defaultOpen?: boolean;\n /** Handler that is called when the drawer's open state changes. */\n onOpenChange?: (isOpen: boolean) => void;\n}\n\n/**\n * Encapsulates a drawer trigger and its associated drawer.\n * The trigger can be any Cimpress UI button, and the drawer will be displayed when the trigger is activated.\n */\nexport function DrawerRoot(props: DrawerRootProps) {\n return <RACDialogTrigger {...props} />;\n}\n\nDrawerRoot.displayName = 'DrawerRoot';\n\nexport interface DrawerRenderProps {\n /** Closes the drawer when called. */\n close: () => void;\n}\n\nexport interface DrawerProps extends CommonProps, AriaLabelingProps {\n /** The contents of the drawer. A function may be provided to access a function to close the drawer. */\n children: ReactNode | ((renderProps: DrawerRenderProps) => ReactNode);\n /** The title of the drawer. */\n title?: string;\n /**\n * The size of the drawer. This prop is ignored on small devices - drawers on small devices will always take up all available width.\n * @default 'small'\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Whether the drawer can be closed by clicking the close button, clicking outside of the drawer, or pressing the Escape key.\n * When `false`, the drawer can only be closed programmatically.\n * @default true\n */\n isDismissible?: boolean;\n /**\n * Whether the drawer is open (controlled).\n * If using `DrawerRoot`, this prop has no effect - provide `isOpen` to `DrawerRoot` instead.\n */\n isOpen?: boolean;\n /**\n * Whether the drawer is open by default (uncontrolled).\n * If using `DrawerRoot`, this prop has no effect - provide `defaultOpen` to `DrawerRoot` instead.\n */\n defaultOpen?: boolean;\n /**\n * Handler that is called when the drawer's open state changes.\n * If using `DrawerRoot`, this prop has no effect - provide `onOpenChange` to `DrawerRoot` instead.\n */\n onOpenChange?: (isOpen: boolean) => void;\n /**\n * The placement of the drawer.\n * @default 'end'\n */\n UNSTABLE_placement?: 'start' | 'end';\n}\n\nfunction Drawer(\n {\n children,\n title,\n size = 'small',\n UNSAFE_className,\n UNSAFE_style,\n isDismissible = true,\n isOpen,\n defaultOpen,\n onOpenChange,\n UNSTABLE_placement: placement = 'end',\n ...props\n }: DrawerProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!title && !ariaLabel && !ariaLabelledBy) {\n console.warn('Drawer requires one of title / aria-label / aria-labelledby for accessibility');\n }\n }, [title, ariaLabel, ariaLabelledBy]);\n\n const messages = useLocalizedMessages('common');\n\n return (\n <RACModalOverlay\n className=\"cim-drawer-overlay\"\n isDismissable={isDismissible}\n isKeyboardDismissDisabled={!isDismissible}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n data-cim-style-root\n data-placement={placement}\n >\n <RACModal\n className={clsx('cim-drawer', UNSAFE_className)}\n style={UNSAFE_style}\n data-size={size}\n data-placement={placement}\n >\n <RACDialog {...props} ref={ref} className=\"cim-drawer-dialog\">\n {(renderProps) => (\n <>\n <div className=\"cim-drawer-header\">\n {title && (\n <RACHeading\n slot=\"title\"\n className={clsx('cim-drawer-title', textStyle({ variant: 'title-5', tone: 'base' }))}\n >\n {title}\n </RACHeading>\n )}\n {isDismissible && <XButton aria-label={messages.format('dismiss')} slot=\"close\" />}\n </div>\n {typeof children === 'function' ? children(renderProps) : children}\n </>\n )}\n </RACDialog>\n </RACModal>\n </RACModalOverlay>\n );\n}\n\n/**\n * Displays an overlay element which blocks interaction with outside elements.\n *\n * See [drawer usage guidelines](https://ui.cimpress.io/components/drawer/).\n */\nconst _Drawer = forwardRef(Drawer, 'Drawer');\n\nexport { _Drawer as Drawer };\n\nexport interface DrawerBodyProps {\n /** The content to render within the drawer. */\n children: ReactNode;\n}\n\n/** Renders content within `Drawer`. */\nexport function DrawerBody(props: DrawerBodyProps) {\n return <div {...props} className=\"cim-drawer-body\" />;\n}\n\nDrawerBody.displayName = 'DrawerBody';\n\nexport interface DrawerActionsProps {\n /** Actions that should be available in the drawer. */\n children: ReactNode;\n}\n\n/** Renders actions within `Drawer`. */\nexport function DrawerActions({ children, ...props }: DrawerActionsProps) {\n return (\n <div {...props} className=\"cim-drawer-actions\">\n {children}\n </div>\n );\n}\n\nDrawerActions.displayName = 'DrawerActions';\n"]}
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { Responsive } from '../spacing/types.js';
3
+ export declare function UNSTABLE_Hidden({ children, hide }: {
4
+ children: ReactNode;
5
+ hide: Responsive<boolean>;
6
+ }): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=hidden.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hidden.d.ts","sourceRoot":"","sources":["../../../../src/components/hidden/hidden.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;CAAE,2CAiBrG"}
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import clsx from 'clsx';
3
+ export function UNSTABLE_Hidden({ children, hide }) {
4
+ const hiddenDataAttributes = typeof hide === 'object'
5
+ ? Object.fromEntries(Object.entries(hide).map(([breakpoint, value]) => {
6
+ return [`data-hidden-${breakpoint}`, value];
7
+ }))
8
+ : {
9
+ 'data-hidden-sm': hide,
10
+ };
11
+ return (_jsx("div", { className: clsx('cim-hidden'), ...hiddenDataAttributes, children: children }));
12
+ }
13
+ //# sourceMappingURL=hidden.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hidden.js","sourceRoot":"","sources":["../../../../src/components/hidden/hidden.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,MAAM,UAAU,eAAe,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAsD;IACpG,MAAM,oBAAoB,GACxB,OAAO,IAAI,KAAK,QAAQ;QACtB,CAAC,CAAC,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE;YAC/C,OAAO,CAAC,eAAe,UAAU,EAAE,EAAE,KAAK,CAAC,CAAC;QAC9C,CAAC,CAAC,CACH;QACH,CAAC,CAAC;YACE,gBAAgB,EAAE,IAAI;SACvB,CAAC;IAER,OAAO,CACL,cAAK,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,KAAM,oBAAoB,YACzD,QAAQ,GACL,CACP,CAAC;AACJ,CAAC","sourcesContent":["import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport type { Responsive } from '../spacing/types.js';\n\nexport function UNSTABLE_Hidden({ children, hide }: { children: ReactNode; hide: Responsive<boolean> }) {\n const hiddenDataAttributes =\n typeof hide === 'object'\n ? Object.fromEntries(\n Object.entries(hide).map(([breakpoint, value]) => {\n return [`data-hidden-${breakpoint}`, value];\n }),\n )\n : {\n 'data-hidden-sm': hide,\n };\n\n return (\n <div className={clsx('cim-hidden')} {...hiddenDataAttributes}>\n {children}\n </div>\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { type NumberFieldProps as RACNumberFieldProps } from 'react-aria-components';
2
2
  import type { CommonProps, FieldWithPlaceholderProps } from '../types.js';
3
- export interface NumberFieldProps extends CommonProps, FieldWithPlaceholderProps<number>, Pick<RACNumberFieldProps, 'isDisabled' | 'isRequired' | 'isInvalid' | 'isReadOnly' | 'autoFocus' | 'minValue' | 'maxValue' | 'step' | 'formatOptions' | 'onFocus' | 'onBlur'> {
3
+ export interface NumberFieldProps extends CommonProps, FieldWithPlaceholderProps<number>, Pick<RACNumberFieldProps, 'isDisabled' | 'isRequired' | 'isInvalid' | 'isReadOnly' | 'autoFocus' | 'minValue' | 'maxValue' | 'step' | 'formatOptions' | 'onFocus' | 'onBlur' | 'onKeyDown'> {
4
4
  /** The current value (controlled). A `null` value means an empty field. */
5
5
  value?: number | null;
6
6
  /** The default value (uncontrolled). A `null` value means an empty field. */
@@ -1 +1 @@
1
- {"version":3,"file":"number-field.d.ts","sourceRoot":"","sources":["../../../../src/components/number-field/number-field.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,gBAAgB,IAAI,mBAAmB,EAE7C,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAG1E,MAAM,WAAW,gBACf,SAAQ,WAAW,EACjB,yBAAyB,CAAC,MAAM,CAAC,EACjC,IAAI,CACF,mBAAmB,EACjB,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,WAAW,GACX,UAAU,GACV,UAAU,GACV,MAAM,GACN,eAAe,GACf,SAAS,GACT,QAAQ,CACX;IACH,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC3C;AAwED;;;;GAIG;AACH,QAAA,MAAM,YAAY,kKAAyD,CAAC;AAE5E,OAAO,EAAE,YAAY,IAAI,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"number-field.d.ts","sourceRoot":"","sources":["../../../../src/components/number-field/number-field.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,gBAAgB,IAAI,mBAAmB,EAE7C,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAG1E,MAAM,WAAW,gBACf,SAAQ,WAAW,EACjB,yBAAyB,CAAC,MAAM,CAAC,EACjC,IAAI,CACF,mBAAmB,EACjB,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,WAAW,GACX,UAAU,GACV,UAAU,GACV,MAAM,GACN,eAAe,GACf,SAAS,GACT,QAAQ,GACR,WAAW,CACd;IACH,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC3C;AAwED;;;;GAIG;AACH,QAAA,MAAM,YAAY,kKAAyD,CAAC;AAE5E,OAAO,EAAE,YAAY,IAAI,WAAW,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"number-field.js","sourceRoot":"","sources":["../../../../src/components/number-field/number-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,KAAK,IAAI,QAAQ,EACjB,WAAW,IAAI,cAAc,EAE7B,KAAK,IAAI,QAAQ,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAE5G,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AA2BnD,SAAS,WAAW,CAClB,EACE,KAAK,EACL,WAAW,EACX,KAAK,EAAE,YAAY,EACnB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,GAAG,KAAK,EACS,EACnB,GAAiC;IAEjC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,KA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AAC,UAAU,IACT,IAAI,EAAC,WAAW,EAChB,IAAI,EAAE,KAAC,YAAY,KAAG,gBACV,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,EACxC,OAAO,EAAC,UAAU,EAClB,IAAI,EAAC,OAAO,GACZ,EACF,cAAK,SAAS,EAAC,oCAAoC,GAAG,EACtD,KAAC,UAAU,IACT,IAAI,EAAC,WAAW,EAChB,IAAI,EAAE,KAAC,OAAO,KAAG,gBACL,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,EACxC,OAAO,EAAC,UAAU,EAClB,IAAI,EAAC,OAAO,GACZ,IACE,IACG,EACX,KAAC,cAAc,cAAE,YAAY,GAAkB,EAC/C,KAAC,oBAAoB,cAAE,WAAW,GAAwB,IAC3C,CAClB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,YAAY,GAAG,cAAc,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC;AAE5E,OAAO,EAAE,YAAY,IAAI,WAAW,EAAE,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\nimport {\n Input as RACInput,\n NumberField as RACNumberField,\n type NumberFieldProps as RACNumberFieldProps,\n Group as RACGroup,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { IconAdd, IconSubtract } from '../../icons/index.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { IconButton } from '../button/icon-button.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport type { CommonProps, FieldWithPlaceholderProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface NumberFieldProps\n extends CommonProps,\n FieldWithPlaceholderProps<number>,\n Pick<\n RACNumberFieldProps,\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'autoFocus'\n | 'minValue'\n | 'maxValue'\n | 'step'\n | 'formatOptions'\n | 'onFocus'\n | 'onBlur'\n > {\n /** The current value (controlled). A `null` value means an empty field. */\n value?: number | null;\n /** The default value (uncontrolled). A `null` value means an empty field. */\n defaultValue?: number | null;\n /** Handler that is called when the value changes. A `null` value means an empty field. */\n onChange?: (value: number | null) => void;\n}\n\nfunction NumberField(\n {\n label,\n description,\n error: errorMessage,\n placeholder,\n UNSAFE_className,\n UNSAFE_style,\n value,\n defaultValue,\n onChange,\n ...props\n }: NumberFieldProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('NumberField requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n const messages = useLocalizedMessages('numberField');\n\n return (\n <RACNumberField\n {...props}\n ref={ref}\n className={clsx('cim-number-field', UNSAFE_className)}\n style={UNSAFE_style}\n // NumberField uses `NaN` to signify an empty value, which is unintuitive\n // https://github.com/adobe/react-spectrum/issues/5524\n // https://github.com/adobe/react-spectrum/issues/6971\n value={value === null ? Number.NaN : value}\n defaultValue={defaultValue === null ? Number.NaN : defaultValue}\n onChange={onChange ? (value) => onChange(Number.isNaN(value) ? null : value) : undefined}\n >\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-number-field-input-group\">\n <RACInput\n className={clsx('cim-number-field-input', textStyle({ variant: 'body' }))}\n placeholder={placeholder}\n />\n <div className=\"cim-number-field-spinner\">\n <IconButton\n slot=\"decrement\"\n icon={<IconSubtract />}\n aria-label={messages.format('decrement')}\n variant=\"tertiary\"\n size=\"small\"\n />\n <div className=\"cim-number-field-spinner-separator\" />\n <IconButton\n slot=\"increment\"\n icon={<IconAdd />}\n aria-label={messages.format('increment')}\n variant=\"tertiary\"\n size=\"small\"\n />\n </div>\n </RACGroup>\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n </RACNumberField>\n );\n}\n\n/**\n * Allows users to edit a number with a keyboard or increment/decrement buttons.\n *\n * See [number field usage guidelines](https://ui.cimpress.io/components/number-field/).\n */\nconst _NumberField = withStyleProps(forwardRef(NumberField), 'NumberField');\n\nexport { _NumberField as NumberField };\n"]}
1
+ {"version":3,"file":"number-field.js","sourceRoot":"","sources":["../../../../src/components/number-field/number-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,KAAK,IAAI,QAAQ,EACjB,WAAW,IAAI,cAAc,EAE7B,KAAK,IAAI,QAAQ,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAE5G,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AA4BnD,SAAS,WAAW,CAClB,EACE,KAAK,EACL,WAAW,EACX,KAAK,EAAE,YAAY,EACnB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,GAAG,KAAK,EACS,EACnB,GAAiC;IAEjC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,G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aACvC,KAAC,UAAU,IACT,IAAI,EAAC,WAAW,EAChB,IAAI,EAAE,KAAC,YAAY,KAAG,gBACV,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,EACxC,OAAO,EAAC,UAAU,EAClB,IAAI,EAAC,OAAO,GACZ,EACF,cAAK,SAAS,EAAC,oCAAoC,GAAG,EACtD,KAAC,UAAU,IACT,IAAI,EAAC,WAAW,EAChB,IAAI,EAAE,KAAC,OAAO,KAAG,gBACL,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,EACxC,OAAO,EAAC,UAAU,EAClB,IAAI,EAAC,OAAO,GACZ,IACE,IACG,EACX,KAAC,cAAc,cAAE,YAAY,GAAkB,EAC/C,KAAC,oBAAoB,cAAE,WAAW,GAAwB,IAC3C,CAClB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,YAAY,GAAG,cAAc,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC;AAE5E,OAAO,EAAE,YAAY,IAAI,WAAW,EAAE,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\nimport {\n Input as RACInput,\n NumberField as RACNumberField,\n type NumberFieldProps as RACNumberFieldProps,\n Group as RACGroup,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { IconAdd, IconSubtract } from '../../icons/index.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { IconButton } from '../button/icon-button.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport type { CommonProps, FieldWithPlaceholderProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface NumberFieldProps\n extends CommonProps,\n FieldWithPlaceholderProps<number>,\n Pick<\n RACNumberFieldProps,\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'autoFocus'\n | 'minValue'\n | 'maxValue'\n | 'step'\n | 'formatOptions'\n | 'onFocus'\n | 'onBlur'\n | 'onKeyDown'\n > {\n /** The current value (controlled). A `null` value means an empty field. */\n value?: number | null;\n /** The default value (uncontrolled). A `null` value means an empty field. */\n defaultValue?: number | null;\n /** Handler that is called when the value changes. A `null` value means an empty field. */\n onChange?: (value: number | null) => void;\n}\n\nfunction NumberField(\n {\n label,\n description,\n error: errorMessage,\n placeholder,\n UNSAFE_className,\n UNSAFE_style,\n value,\n defaultValue,\n onChange,\n ...props\n }: NumberFieldProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('NumberField requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n const messages = useLocalizedMessages('numberField');\n\n return (\n <RACNumberField\n {...props}\n ref={ref}\n className={clsx('cim-number-field', UNSAFE_className)}\n style={UNSAFE_style}\n // NumberField uses `NaN` to signify an empty value, which is unintuitive\n // https://github.com/adobe/react-spectrum/issues/5524\n // https://github.com/adobe/react-spectrum/issues/6971\n value={value === null ? Number.NaN : value}\n defaultValue={defaultValue === null ? Number.NaN : defaultValue}\n onChange={onChange ? (value) => onChange(Number.isNaN(value) ? null : value) : undefined}\n >\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-number-field-input-group\">\n <RACInput\n className={clsx('cim-number-field-input', textStyle({ variant: 'body' }))}\n placeholder={placeholder}\n />\n <div className=\"cim-number-field-spinner\">\n <IconButton\n slot=\"decrement\"\n icon={<IconSubtract />}\n aria-label={messages.format('decrement')}\n variant=\"tertiary\"\n size=\"small\"\n />\n <div className=\"cim-number-field-spinner-separator\" />\n <IconButton\n slot=\"increment\"\n icon={<IconAdd />}\n aria-label={messages.format('increment')}\n variant=\"tertiary\"\n size=\"small\"\n />\n </div>\n </RACGroup>\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n </RACNumberField>\n );\n}\n\n/**\n * Allows users to edit a number with a keyboard or increment/decrement buttons.\n *\n * See [number field usage guidelines](https://ui.cimpress.io/components/number-field/).\n */\nconst _NumberField = withStyleProps(forwardRef(NumberField), 'NumberField');\n\nexport { _NumberField as NumberField };\n"]}
@@ -1,6 +1,16 @@
1
+ import { type RefObject } from 'react';
1
2
  import { type TextAreaProps as RACTextAreaProps, type TextFieldProps as RACTextFieldProps } from 'react-aria-components';
2
3
  import type { CommonProps, FieldWithPlaceholderProps } from '../types.js';
3
- export interface TextAreaProps extends CommonProps, FieldWithPlaceholderProps<string>, Pick<RACTextFieldProps, 'value' | 'defaultValue' | 'onChange' | 'isDisabled' | 'isRequired' | 'isInvalid' | 'isReadOnly' | 'type' | 'autoFocus' | 'autoComplete' | 'inputMode' | 'minLength' | 'maxLength' | 'onFocus' | 'onBlur'>, Pick<RACTextAreaProps, 'autoCapitalize' | 'autoCorrect' | 'rows' | 'spellCheck' | 'wrap'> {
4
+ export interface TextAreaProps extends CommonProps, FieldWithPlaceholderProps<string>, Pick<RACTextFieldProps, 'value' | 'defaultValue' | 'onChange' | 'isDisabled' | 'isRequired' | 'isInvalid' | 'isReadOnly' | 'type' | 'autoFocus' | 'autoComplete' | 'inputMode' | 'minLength' | 'maxLength' | 'onFocus' | 'onBlur' | 'onKeyDown'>, Pick<RACTextAreaProps, 'autoCapitalize' | 'autoCorrect' | 'rows' | 'spellCheck' | 'wrap'> {
5
+ /** A React ref that allows access to the imperative API of this component. */
6
+ apiRef?: RefObject<TextAreaApi | null>;
7
+ }
8
+ /** The imperative API exposed by the `TextArea` component. */
9
+ export interface TextAreaApi {
10
+ /** Focuses the text area. */
11
+ focus: () => void;
12
+ /** Selects the contents of the text area. */
13
+ select: () => void;
4
14
  }
5
15
  /**
6
16
  * Allows users to enter multiple lines of text with a keyboard.
@@ -1 +1 @@
1
- {"version":3,"file":"text-area.d.ts","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-area.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,aAAa,IAAI,gBAAgB,EACtC,KAAK,cAAc,IAAI,iBAAiB,EAEzC,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAG1E,MAAM,WAAW,aACf,SAAQ,WAAW,EACjB,yBAAyB,CAAC,MAAM,CAAC,EACjC,IAAI,CACF,iBAAiB,EACf,OAAO,GACP,cAAc,GACd,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,MAAM,GACN,WAAW,GACX,cAAc,GACd,WAAW,GACX,WAAW,GACX,WAAW,GACX,SAAS,GACT,QAAQ,CACX,EACD,IAAI,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,aAAa,GAAG,MAAM,GAAG,YAAY,GAAG,MAAM,CAAC;CAAG;AAwDhG;;;;GAIG;AACH,QAAA,MAAM,SAAS,+JAAmD,CAAC;AAEnE,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"text-area.d.ts","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-area.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAkD,MAAM,OAAO,CAAC;AACvF,OAAO,EAGL,KAAK,aAAa,IAAI,gBAAgB,EACtC,KAAK,cAAc,IAAI,iBAAiB,EAEzC,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAG1E,MAAM,WAAW,aACf,SAAQ,WAAW,EACjB,yBAAyB,CAAC,MAAM,CAAC,EACjC,IAAI,CACF,iBAAiB,EACf,OAAO,GACP,cAAc,GACd,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,MAAM,GACN,WAAW,GACX,cAAc,GACd,WAAW,GACX,WAAW,GACX,WAAW,GACX,SAAS,GACT,QAAQ,GACR,WAAW,CACd,EACD,IAAI,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,aAAa,GAAG,MAAM,GAAG,YAAY,GAAG,MAAM,CAAC;IAC3F,8EAA8E;IAC9E,MAAM,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CACxC;AAED,8DAA8D;AAC9D,MAAM,WAAW,WAAW;IAC1B,6BAA6B;IAC7B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,6CAA6C;IAC7C,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAkED;;;;GAIG;AACH,QAAA,MAAM,SAAS,+JAAmD,CAAC;AAEnE,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,CAAC"}
@@ -1,14 +1,14 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import clsx from 'clsx';
4
- import { useRef } from 'react';
4
+ import { useRef, useImperativeHandle } from 'react';
5
5
  import { TextArea as RACTextArea, TextField as RACTextField, Group as RACGroup, } from 'react-aria-components';
6
6
  import { forwardRef } from '../../forward-ref.js';
7
7
  import { useProductionWarning } from '../../utils/use-production-warning.js';
8
8
  import { withStyleProps } from '../../with-style-props.js';
9
9
  import { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';
10
10
  import { textStyle } from '../typography/utils.js';
11
- function TextArea({ label, description, error: errorMessage, placeholder, autoCapitalize, autoCorrect, rows, spellCheck, wrap, UNSAFE_className, UNSAFE_style, ...props }, ref) {
11
+ function TextArea({ label, description, error: errorMessage, placeholder, autoCapitalize, autoCorrect, rows, spellCheck, wrap, UNSAFE_className, UNSAFE_style, apiRef, ...props }, ref) {
12
12
  const textAreaRef = useRef(null);
13
13
  const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
14
14
  useProductionWarning(() => {
@@ -16,6 +16,10 @@ function TextArea({ label, description, error: errorMessage, placeholder, autoCa
16
16
  console.warn('TextArea requires one of label / aria-label / aria-labelledby for accessibility');
17
17
  }
18
18
  }, [label, ariaLabel, ariaLabelledBy]);
19
+ useImperativeHandle(apiRef, () => ({
20
+ focus: () => textAreaRef.current?.focus(),
21
+ select: () => textAreaRef.current?.select(),
22
+ }), []);
19
23
  return (_jsx(RACTextField, { ...props, ref: ref, className: clsx('cim-text-area', UNSAFE_className), style: UNSAFE_style, children: ({ isDisabled, isRequired }) => (_jsxs(_Fragment, { children: [_jsx(FormFieldLabel, { isRequired: isRequired, isDisabled: isDisabled, children: label }), _jsx(RACGroup, { className: "cim-text-area-input-group", onClick: () => textAreaRef.current?.focus(), children: _jsx(RACTextArea, { ref: textAreaRef, className: clsx('cim-text-area-input', textStyle({ variant: 'body' })), placeholder: placeholder, autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, rows: rows, spellCheck: spellCheck, wrap: wrap }) }), _jsx(FormFieldError, { children: errorMessage }), _jsx(FormFieldDescription, { children: description })] })) }));
20
24
  }
21
25
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"text-area.js","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-area.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAqB,MAAM,OAAO,CAAC;AAClD,OAAO,EACL,QAAQ,IAAI,WAAW,EACvB,SAAS,IAAI,YAAY,EAGzB,KAAK,IAAI,QAAQ,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EA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MAAM,EAAE,CAAC,CAAC,EACtE,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,GACV,GACO,EACX,KAAC,cAAc,cAAE,YAAY,GAAkB,EAC/C,KAAC,oBAAoB,cAAE,WAAW,GAAwB,IACzD,CACJ,GACY,CAChB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,SAAS,GAAG,cAAc,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAC;AAEnE,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { useRef, type ForwardedRef } from 'react';\nimport {\n TextArea as RACTextArea,\n TextField as RACTextField,\n type TextAreaProps as RACTextAreaProps,\n type TextFieldProps as RACTextFieldProps,\n Group as RACGroup,\n} 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 { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport type { CommonProps, FieldWithPlaceholderProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface TextAreaProps\n extends CommonProps,\n FieldWithPlaceholderProps<string>,\n Pick<\n RACTextFieldProps,\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'type'\n | 'autoFocus'\n | 'autoComplete'\n | 'inputMode'\n | 'minLength'\n | 'maxLength'\n | 'onFocus'\n | 'onBlur'\n >,\n Pick<RACTextAreaProps, 'autoCapitalize' | 'autoCorrect' | 'rows' | 'spellCheck' | 'wrap'> {}\n\nfunction TextArea(\n {\n label,\n description,\n error: errorMessage,\n placeholder,\n autoCapitalize,\n autoCorrect,\n rows,\n spellCheck,\n wrap,\n UNSAFE_className,\n UNSAFE_style,\n ...props\n }: TextAreaProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const textAreaRef = useRef<HTMLTextAreaElement>(null);\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('TextArea requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n return (\n <RACTextField {...props} ref={ref} className={clsx('cim-text-area', UNSAFE_className)} style={UNSAFE_style}>\n {({ isDisabled, isRequired }) => (\n <>\n <FormFieldLabel isRequired={isRequired} isDisabled={isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-text-area-input-group\" onClick={() => textAreaRef.current?.focus()}>\n <RACTextArea\n ref={textAreaRef}\n className={clsx('cim-text-area-input', textStyle({ variant: 'body' }))}\n placeholder={placeholder}\n autoCapitalize={autoCapitalize}\n autoCorrect={autoCorrect}\n rows={rows}\n spellCheck={spellCheck}\n wrap={wrap}\n />\n </RACGroup>\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n </>\n )}\n </RACTextField>\n );\n}\n\n/**\n * Allows users to enter multiple lines of text with a keyboard.\n *\n * See [text area usage guidelines](https://ui.cimpress.io/components/text-area/).\n */\nconst _TextArea = withStyleProps(forwardRef(TextArea), 'TextArea');\n\nexport { _TextArea as TextArea };\n"]}
1
+ {"version":3,"file":"text-area.js","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-area.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAkB,MAAM,EAAqB,mBAAmB,EAAE,MAAM,OAAO,CAAC;AACvF,OAAO,EACL,QAAQ,IAAI,WAAW,EACvB,SAAS,IAAI,YAAY,EAGzB,KAAK,IAAI,Q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,IAAI,CAAC,eAAe,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,YACvG,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAC/B,8BACE,KAAC,cAAc,IAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,YAC3D,KAAK,GACS,EACjB,KAAC,QAAQ,IAAC,SAAS,EAAC,2BAA2B,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE,YACzF,KAAC,WAAW,IACV,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,IAAI,CAAC,qBAAqB,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,EACtE,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,GACV,GACO,EACX,KAAC,cAAc,cAAE,YAAY,GAAkB,EAC/C,KAAC,oBAAoB,cAAE,WAAW,GAAwB,IACzD,CACJ,GACY,CAChB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,SAAS,GAAG,cAAc,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAC;AAEnE,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { type RefObject, useRef, type ForwardedRef, useImperativeHandle } from 'react';\nimport {\n TextArea as RACTextArea,\n TextField as RACTextField,\n type TextAreaProps as RACTextAreaProps,\n type TextFieldProps as RACTextFieldProps,\n Group as RACGroup,\n} 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 { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport type { CommonProps, FieldWithPlaceholderProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface TextAreaProps\n extends CommonProps,\n FieldWithPlaceholderProps<string>,\n Pick<\n RACTextFieldProps,\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'type'\n | 'autoFocus'\n | 'autoComplete'\n | 'inputMode'\n | 'minLength'\n | 'maxLength'\n | 'onFocus'\n | 'onBlur'\n | 'onKeyDown'\n >,\n Pick<RACTextAreaProps, 'autoCapitalize' | 'autoCorrect' | 'rows' | 'spellCheck' | 'wrap'> {\n /** A React ref that allows access to the imperative API of this component. */\n apiRef?: RefObject<TextAreaApi | null>;\n}\n\n/** The imperative API exposed by the `TextArea` component. */\nexport interface TextAreaApi {\n /** Focuses the text area. */\n focus: () => void;\n /** Selects the contents of the text area. */\n select: () => void;\n}\n\nfunction TextArea(\n {\n label,\n description,\n error: errorMessage,\n placeholder,\n autoCapitalize,\n autoCorrect,\n rows,\n spellCheck,\n wrap,\n UNSAFE_className,\n UNSAFE_style,\n apiRef,\n ...props\n }: TextAreaProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const textAreaRef = useRef<HTMLTextAreaElement>(null);\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('TextArea requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n useImperativeHandle(\n apiRef,\n () => ({\n focus: () => textAreaRef.current?.focus(),\n select: () => textAreaRef.current?.select(),\n }),\n [],\n );\n\n return (\n <RACTextField {...props} ref={ref} className={clsx('cim-text-area', UNSAFE_className)} style={UNSAFE_style}>\n {({ isDisabled, isRequired }) => (\n <>\n <FormFieldLabel isRequired={isRequired} isDisabled={isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-text-area-input-group\" onClick={() => textAreaRef.current?.focus()}>\n <RACTextArea\n ref={textAreaRef}\n className={clsx('cim-text-area-input', textStyle({ variant: 'body' }))}\n placeholder={placeholder}\n autoCapitalize={autoCapitalize}\n autoCorrect={autoCorrect}\n rows={rows}\n spellCheck={spellCheck}\n wrap={wrap}\n />\n </RACGroup>\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n </>\n )}\n </RACTextField>\n );\n}\n\n/**\n * Allows users to enter multiple lines of text with a keyboard.\n *\n * See [text area usage guidelines](https://ui.cimpress.io/components/text-area/).\n */\nconst _TextArea = withStyleProps(forwardRef(TextArea), 'TextArea');\n\nexport { _TextArea as TextArea };\n"]}
@@ -1,11 +1,21 @@
1
+ import { type RefObject } from 'react';
1
2
  import { type TextFieldProps as RACTextFieldProps } from 'react-aria-components';
2
3
  import type { AffixProps, CommonProps, FieldWithPlaceholderProps } from '../types.js';
3
- export interface TextFieldProps extends CommonProps, FieldWithPlaceholderProps<string>, AffixProps, Pick<RACTextFieldProps, 'value' | 'defaultValue' | 'onChange' | 'isDisabled' | 'isRequired' | 'isInvalid' | 'isReadOnly' | 'type' | 'autoFocus' | 'autoComplete' | 'inputMode' | 'minLength' | 'maxLength' | 'pattern' | 'onFocus' | 'onBlur'> {
4
+ export interface TextFieldProps extends CommonProps, FieldWithPlaceholderProps<string>, AffixProps, Pick<RACTextFieldProps, 'value' | 'defaultValue' | 'onChange' | 'isDisabled' | 'isRequired' | 'isInvalid' | 'isReadOnly' | 'type' | 'autoFocus' | 'autoComplete' | 'inputMode' | 'minLength' | 'maxLength' | 'pattern' | 'onFocus' | 'onBlur' | 'onKeyDown'> {
4
5
  /**
5
6
  * Whether to render a button that can be used to clear the text field.
6
7
  * @default false
7
8
  */
8
9
  isClearable?: boolean;
10
+ /** A React ref that allows access to the imperative API of this component. */
11
+ apiRef?: RefObject<TextFieldApi | null>;
12
+ }
13
+ /** The imperative API exposed by the `TextField` component. */
14
+ export interface TextFieldApi {
15
+ /** Focuses the input field. */
16
+ focus: () => void;
17
+ /** Selects the contents of the input field. */
18
+ select: () => void;
9
19
  }
10
20
  /**
11
21
  * Allows users to enter a single line of text with a keyboard.
@@ -1 +1 @@
1
- {"version":3,"file":"text-field.d.ts","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-field.tsx"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,cAAc,IAAI,iBAAiB,EAIzC,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGtF,MAAM,WAAW,cACf,SAAQ,WAAW,EACjB,yBAAyB,CAAC,MAAM,CAAC,EACjC,UAAU,EACV,IAAI,CACF,iBAAiB,EACf,OAAO,GACP,cAAc,GACd,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,MAAM,GACN,WAAW,GACX,cAAc,GACd,WAAW,GACX,WAAW,GACX,WAAW,GACX,SAAS,GACT,SAAS,GACT,QAAQ,CACX;IACH;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAqHD;;;;GAIG;AACH,QAAA,MAAM,UAAU,gKAAqD,CAAC;AAEtE,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"text-field.d.ts","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-field.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAyC,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAC;AAC3G,OAAO,EACL,KAAK,cAAc,IAAI,iBAAiB,EAIzC,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGtF,MAAM,WAAW,cACf,SAAQ,WAAW,EACjB,yBAAyB,CAAC,MAAM,CAAC,EACjC,UAAU,EACV,IAAI,CACF,iBAAiB,EACf,OAAO,GACP,cAAc,GACd,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,MAAM,GACN,WAAW,GACX,cAAc,GACd,WAAW,GACX,WAAW,GACX,WAAW,GACX,SAAS,GACT,SAAS,GACT,QAAQ,GACR,WAAW,CACd;IACH;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;CACzC;AAED,+DAA+D;AAC/D,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAmID;;;;GAIG;AACH,QAAA,MAAM,UAAU,gKAAqD,CAAC;AAEtE,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC"}
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { useId } from '@react-aria/utils';
4
4
  import { useControlledState } from '@react-stately/utils';
5
5
  import clsx from 'clsx';
6
- import { useRef } from 'react';
6
+ import { useImperativeHandle, useRef } from 'react';
7
7
  import { Group as RACGroup, Input as RACInput, TextField as RACTextField, } from 'react-aria-components';
8
8
  import { forwardRef } from '../../forward-ref.js';
9
9
  import { useLocalizedMessages } from '../../i18n/localization-provider.js';
@@ -12,18 +12,23 @@ import { withStyleProps } from '../../with-style-props.js';
12
12
  import { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';
13
13
  import { XButton } from '../internal/x-button/x-button.js';
14
14
  import { textStyle } from '../typography/utils.js';
15
- function TextField({ label, description, error: errorMessage, placeholder, prefix, suffix, UNSAFE_className, UNSAFE_style, isClearable = false, value: consumerValue, defaultValue: consumerDefaultValue, onChange, ...props }, ref) {
15
+ function TextField({ label, description, error: errorMessage, placeholder, prefix, suffix, UNSAFE_className, UNSAFE_style, isClearable = false, value: consumerValue, defaultValue: consumerDefaultValue, onChange, apiRef, ...props }, ref) {
16
16
  const { isDisabled, isReadOnly } = props;
17
17
  const inputRef = useRef(null);
18
18
  const [value, setValue] = useControlledState(consumerValue, consumerDefaultValue ?? '', onChange);
19
19
  const messages = useLocalizedMessages('common');
20
20
  const clearDescriptionId = useId();
21
+ useImperativeHandle(apiRef, () => ({
22
+ focus: () => inputRef.current?.focus(),
23
+ select: () => inputRef.current?.select(),
24
+ }), []);
21
25
  const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
26
+ const isFieldClearable = isClearable && !isDisabled && !isReadOnly;
22
27
  function onKeyDown(e) {
23
- if (isDisabled || isReadOnly) {
28
+ if (!isFieldClearable) {
24
29
  return;
25
30
  }
26
- if (e.key === 'Escape' && isClearable) {
31
+ if (e.key === 'Escape') {
27
32
  e.preventDefault();
28
33
  setValue('');
29
34
  }
@@ -33,9 +38,9 @@ function TextField({ label, description, error: errorMessage, placeholder, prefi
33
38
  console.warn('TextField requires one of label / aria-label / aria-labelledby for accessibility');
34
39
  }
35
40
  }, [label, ariaLabel, ariaLabelledBy]);
36
- return (_jsx(RACTextField, { ...props, ref: ref, className: clsx('cim-text-field', UNSAFE_className), style: UNSAFE_style, value: value, onChange: setValue, "aria-describedby": [props['aria-describedby'], isClearable ? clearDescriptionId : undefined]
41
+ return (_jsx(RACTextField, { ...props, ref: ref, className: clsx('cim-text-field', UNSAFE_className), style: UNSAFE_style, value: value, onChange: setValue, "aria-describedby": [props['aria-describedby'], isFieldClearable ? clearDescriptionId : undefined]
37
42
  .filter(Boolean)
38
- .join(' '), children: ({ isDisabled, isRequired }) => (_jsxs(_Fragment, { children: [_jsx(FormFieldLabel, { isRequired: isRequired, isDisabled: isDisabled, children: label }), _jsxs(RACGroup, { className: "cim-text-field-input-group", onClick: () => inputRef.current?.focus(), children: [prefix && (_jsx("div", { className: clsx('cim-text-field-affix', textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' })), "aria-hidden": true, children: prefix })), _jsx(RACInput, { ref: inputRef, className: clsx('cim-text-field-input', textStyle({ variant: 'body' })), placeholder: placeholder, onKeyDown: onKeyDown }), isClearable && value !== '' && !isDisabled && !isReadOnly && (_jsx(XButton, { slot: null, UNSAFE_className: "cim-text-field-clear", "aria-label": messages.format('clearValue'), onPress: () => setValue(''), iconType: "circled", excludeFromTabOrder: true })), suffix && (_jsx("div", { className: clsx('cim-text-field-affix', textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' })), "aria-hidden": true, children: suffix }))] }), _jsx(FormFieldError, { children: errorMessage }), _jsx(FormFieldDescription, { children: description }), _jsx("p", { id: clearDescriptionId, className: "cim-text-field-clear-description", hidden: true, children: messages.format('clearValueDescription') })] })) }));
43
+ .join(' '), children: ({ isDisabled, isRequired }) => (_jsxs(_Fragment, { children: [_jsx(FormFieldLabel, { isRequired: isRequired, isDisabled: isDisabled, children: label }), _jsxs(RACGroup, { className: "cim-text-field-input-group", onClick: () => inputRef.current?.focus(), children: [prefix && (_jsx("div", { className: clsx('cim-text-field-affix', textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' })), "aria-hidden": true, children: prefix })), _jsx(RACInput, { ref: inputRef, className: clsx('cim-text-field-input', textStyle({ variant: 'body' })), placeholder: placeholder, onKeyDown: onKeyDown }), isFieldClearable && value !== '' && (_jsx(XButton, { slot: null, UNSAFE_className: "cim-text-field-clear", "aria-label": messages.format('clearValue'), onPress: () => setValue(''), iconType: "circled", excludeFromTabOrder: true })), suffix && (_jsx("div", { className: clsx('cim-text-field-affix', textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' })), "aria-hidden": true, children: suffix }))] }), _jsx(FormFieldError, { children: errorMessage }), _jsx(FormFieldDescription, { children: description }), isFieldClearable && (_jsx("p", { id: clearDescriptionId, className: "cim-text-field-clear-description", hidden: true, children: messages.format('clearValueDescription') }))] })) }));
39
44
  }
40
45
  /**
41
46
  * Allows users to enter a single line of text with a keyboard.
@@ -1 +1 @@
1
- {"version":3,"file":"text-field.js","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAyC,MAAM,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAEL,KAAK,IAAI,QAAQ,EACjB,KAAK,IAAI,QAAQ,EACjB,SAAS,IAAI,YAAY,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC5G,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAgCnD,SAAS,SAAS,CAChB,EACE,KAAK,EACL,WAAW,EACX,KAAK,EAAE,YAAY,EACnB,WAAW,EACX,MAAM,EACN,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,WAAW,GAAG,KAAK,EACnB,KAAK,EAAE,aAAa,EACpB,YAAY,EAAE,oBAAoB,EAClC,QAAQ,EACR,GAAG,KAAK,EACO,EACjB,GAAiC;IAEjC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IACzC,MAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC,CAA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1D,YAAG,EAAE,EAAE,kBAAkB,EAAE,SAAS,EAAC,kCAAkC,EAAC,MAAM,kBAC3E,QAAQ,CAAC,MAAM,CAAC,uBAAuB,CAAC,GACvC,IACH,CACJ,GACY,CAChB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC;AAEtE,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC","sourcesContent":["'use client';\n\nimport { useId } from '@react-aria/utils';\nimport { useControlledState } from '@react-stately/utils';\nimport clsx from 'clsx';\nimport { type ForwardedRef, type KeyboardEvent, useRef } from 'react';\nimport {\n type TextFieldProps as RACTextFieldProps,\n Group as RACGroup,\n Input as RACInput,\n TextField as RACTextField,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/localization-provider.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport { XButton } from '../internal/x-button/x-button.js';\nimport type { AffixProps, CommonProps, FieldWithPlaceholderProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface TextFieldProps\n extends CommonProps,\n FieldWithPlaceholderProps<string>,\n AffixProps,\n Pick<\n RACTextFieldProps,\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'type'\n | 'autoFocus'\n | 'autoComplete'\n | 'inputMode'\n | 'minLength'\n | 'maxLength'\n | 'pattern'\n | 'onFocus'\n | 'onBlur'\n > {\n /**\n * Whether to render a button that can be used to clear the text field.\n * @default false\n */\n isClearable?: boolean;\n}\n\nfunction TextField(\n {\n label,\n description,\n error: errorMessage,\n placeholder,\n prefix,\n suffix,\n UNSAFE_className,\n UNSAFE_style,\n isClearable = false,\n value: consumerValue,\n defaultValue: consumerDefaultValue,\n onChange,\n ...props\n }: TextFieldProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const { isDisabled, isReadOnly } = props;\n const inputRef = useRef<HTMLInputElement>(null);\n const [value, setValue] = useControlledState(consumerValue, consumerDefaultValue ?? '', onChange);\n const messages = useLocalizedMessages('common');\n const clearDescriptionId = useId();\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n function onKeyDown(e: KeyboardEvent) {\n if (isDisabled || isReadOnly) {\n return;\n }\n\n if (e.key === 'Escape' && isClearable) {\n e.preventDefault();\n\n setValue('');\n }\n }\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('TextField requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n return (\n <RACTextField\n {...props}\n ref={ref}\n className={clsx('cim-text-field', UNSAFE_className)}\n style={UNSAFE_style}\n value={value}\n onChange={setValue}\n aria-describedby={[props['aria-describedby'], isClearable ? clearDescriptionId : undefined]\n .filter(Boolean)\n .join(' ')}\n >\n {({ isDisabled, isRequired }) => (\n <>\n <FormFieldLabel isRequired={isRequired} isDisabled={isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-text-field-input-group\" onClick={() => inputRef.current?.focus()}>\n {prefix && (\n <div\n className={clsx(\n 'cim-text-field-affix',\n textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' }),\n )}\n aria-hidden\n >\n {prefix}\n </div>\n )}\n\n <RACInput\n ref={inputRef}\n className={clsx('cim-text-field-input', textStyle({ variant: 'body' }))}\n placeholder={placeholder}\n onKeyDown={onKeyDown}\n />\n\n {isClearable && value !== '' && !isDisabled && !isReadOnly && (\n <XButton\n slot={null}\n UNSAFE_className=\"cim-text-field-clear\"\n aria-label={messages.format('clearValue')}\n onPress={() => setValue('')}\n iconType=\"circled\"\n excludeFromTabOrder\n />\n )}\n\n {suffix && (\n <div\n className={clsx(\n 'cim-text-field-affix',\n textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' }),\n )}\n aria-hidden\n >\n {suffix}\n </div>\n )}\n </RACGroup>\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <p id={clearDescriptionId} className=\"cim-text-field-clear-description\" hidden>\n {messages.format('clearValueDescription')}\n </p>\n </>\n )}\n </RACTextField>\n );\n}\n\n/**\n * Allows users to enter a single line of text with a keyboard.\n *\n * See [text field usage guidelines](https://ui.cimpress.io/components/text-field/).\n */\nconst _TextField = withStyleProps(forwardRef(TextField), 'TextField');\n\nexport { _TextField as TextField };\n"]}
1
+ {"version":3,"file":"text-field.js","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAyD,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3G,OAAO,EAEL,KAAK,IAAI,QAAQ,EACjB,KAAK,IAAI,QAAQ,EACjB,SAAS,IAAI,YAAY,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC5G,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAE3D,OAAO,EAAE,SAAS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EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,EACvE,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,GACpB,EAED,gBAAgB,IAAI,KAAK,KAAK,EAAE,IAAI,CACnC,KAAC,OAAO,IACN,IAAI,EAAE,IAAI,EACV,gBAAgB,EAAC,sBAAsB,gBAC3B,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,EACzC,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAC3B,QAAQ,EAAC,SAAS,EAClB,mBAAmB,SACnB,CACH,EAEA,MAAM,IAAI,CACT,cACE,SAAS,EAAE,IAAI,CACb,sBAAsB,EACtB,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CACtE,iCAGA,MAAM,GACH,CACP,IACQ,EACX,KAAC,cAAc,cAAE,YAAY,GAAkB,EAC/C,KAAC,oBAAoB,cAAE,WAAW,GAAwB,EACzD,gBAAgB,IAAI,CACnB,YAAG,EAAE,EAAE,kBAAkB,EAAE,SAAS,EAAC,kCAAkC,EAAC,MAAM,kBAC3E,QAAQ,CAAC,MAAM,CAAC,uBAAuB,CAAC,GACvC,CACL,IACA,CACJ,GACY,CAChB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC;AAEtE,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC","sourcesContent":["'use client';\n\nimport { useId } from '@react-aria/utils';\nimport { useControlledState } from '@react-stately/utils';\nimport clsx from 'clsx';\nimport { type ForwardedRef, type KeyboardEvent, type RefObject, useImperativeHandle, useRef } from 'react';\nimport {\n type TextFieldProps as RACTextFieldProps,\n Group as RACGroup,\n Input as RACInput,\n TextField as RACTextField,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/localization-provider.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport { XButton } from '../internal/x-button/x-button.js';\nimport type { AffixProps, CommonProps, FieldWithPlaceholderProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface TextFieldProps\n extends CommonProps,\n FieldWithPlaceholderProps<string>,\n AffixProps,\n Pick<\n RACTextFieldProps,\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'type'\n | 'autoFocus'\n | 'autoComplete'\n | 'inputMode'\n | 'minLength'\n | 'maxLength'\n | 'pattern'\n | 'onFocus'\n | 'onBlur'\n | 'onKeyDown'\n > {\n /**\n * Whether to render a button that can be used to clear the text field.\n * @default false\n */\n isClearable?: boolean;\n /** A React ref that allows access to the imperative API of this component. */\n apiRef?: RefObject<TextFieldApi | null>;\n}\n\n/** The imperative API exposed by the `TextField` component. */\nexport interface TextFieldApi {\n /** Focuses the input field. */\n focus: () => void;\n /** Selects the contents of the input field. */\n select: () => void;\n}\n\nfunction TextField(\n {\n label,\n description,\n error: errorMessage,\n placeholder,\n prefix,\n suffix,\n UNSAFE_className,\n UNSAFE_style,\n isClearable = false,\n value: consumerValue,\n defaultValue: consumerDefaultValue,\n onChange,\n apiRef,\n ...props\n }: TextFieldProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const { isDisabled, isReadOnly } = props;\n const inputRef = useRef<HTMLInputElement>(null);\n const [value, setValue] = useControlledState(consumerValue, consumerDefaultValue ?? '', onChange);\n const messages = useLocalizedMessages('common');\n const clearDescriptionId = useId();\n\n useImperativeHandle(\n apiRef,\n () => ({\n focus: () => inputRef.current?.focus(),\n select: () => inputRef.current?.select(),\n }),\n [],\n );\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n const isFieldClearable = isClearable && !isDisabled && !isReadOnly;\n\n function onKeyDown(e: KeyboardEvent) {\n if (!isFieldClearable) {\n return;\n }\n\n if (e.key === 'Escape') {\n e.preventDefault();\n\n setValue('');\n }\n }\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('TextField requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n return (\n <RACTextField\n {...props}\n ref={ref}\n className={clsx('cim-text-field', UNSAFE_className)}\n style={UNSAFE_style}\n value={value}\n onChange={setValue}\n aria-describedby={[props['aria-describedby'], isFieldClearable ? clearDescriptionId : undefined]\n .filter(Boolean)\n .join(' ')}\n >\n {({ isDisabled, isRequired }) => (\n <>\n <FormFieldLabel isRequired={isRequired} isDisabled={isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-text-field-input-group\" onClick={() => inputRef.current?.focus()}>\n {prefix && (\n <div\n className={clsx(\n 'cim-text-field-affix',\n textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' }),\n )}\n aria-hidden\n >\n {prefix}\n </div>\n )}\n\n <RACInput\n ref={inputRef}\n className={clsx('cim-text-field-input', textStyle({ variant: 'body' }))}\n placeholder={placeholder}\n onKeyDown={onKeyDown}\n />\n\n {isFieldClearable && value !== '' && (\n <XButton\n slot={null}\n UNSAFE_className=\"cim-text-field-clear\"\n aria-label={messages.format('clearValue')}\n onPress={() => setValue('')}\n iconType=\"circled\"\n excludeFromTabOrder\n />\n )}\n\n {suffix && (\n <div\n className={clsx(\n 'cim-text-field-affix',\n textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' }),\n )}\n aria-hidden\n >\n {suffix}\n </div>\n )}\n </RACGroup>\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n {isFieldClearable && (\n <p id={clearDescriptionId} className=\"cim-text-field-clear-description\" hidden>\n {messages.format('clearValueDescription')}\n </p>\n )}\n </>\n )}\n </RACTextField>\n );\n}\n\n/**\n * Allows users to enter a single line of text with a keyboard.\n *\n * See [text field usage guidelines](https://ui.cimpress.io/components/text-field/).\n */\nconst _TextField = withStyleProps(forwardRef(TextField), 'TextField');\n\nexport { _TextField as TextField };\n"]}
@@ -8,6 +8,8 @@ export interface TooltipProps extends Omit<CommonProps, 'id'>, Pick<RACTooltipPr
8
8
  label: string;
9
9
  /** The ref for the element which the tooltip positions itself with respect to. */
10
10
  triggerRef?: RefObject<Element | null>;
11
+ /** Whether the tooltip is disabled. */
12
+ isDisabled?: boolean;
11
13
  }
12
14
  /**
13
15
  * Provides additional information about an element that is hovered or focused.
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAGL,KAAK,YAAY,IAAI,eAAe,EAErC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,MAAM,WAAW,YACf,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,EAC7B,IAAI,CAAC,eAAe,EAAE,WAAW,GAAG,QAAQ,GAAG,cAAc,CAAC;IAChE,gFAAgF;IAChF,QAAQ,EAAE,SAAS,CAAC;IACpB,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,kFAAkF;IAClF,UAAU,CAAC,EAAE,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CACxC;AAgCD;;;;GAIG;AACH,QAAA,MAAM,QAAQ,6GAAiC,CAAC;AAEhD,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAGL,KAAK,YAAY,IAAI,eAAe,EAErC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,MAAM,WAAW,YACf,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,EAC7B,IAAI,CAAC,eAAe,EAAE,WAAW,GAAG,QAAQ,GAAG,cAAc,CAAC;IAChE,gFAAgF;IAChF,QAAQ,EAAE,SAAS,CAAC;IACpB,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,kFAAkF;IAClF,UAAU,CAAC,EAAE,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IACvC,uCAAuC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAgCD;;;;GAIG;AACH,QAAA,MAAM,QAAQ,6GAAiC,CAAC;AAEhD,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,CAAC"}
@@ -4,8 +4,8 @@ import clsx from 'clsx';
4
4
  import { Tooltip as RACTooltip, OverlayArrow as RACOverlayArrow, TooltipTrigger as RACTooltipTrigger, } from 'react-aria-components';
5
5
  import { forwardRef } from '../../forward-ref.js';
6
6
  import { Text } from '../typography/text.js';
7
- function Tooltip({ children, label, isOpen, onOpenChange, UNSAFE_className, UNSAFE_style, ...props }, ref) {
8
- return (_jsxs(RACTooltipTrigger, { isOpen: isOpen, onOpenChange: onOpenChange, delay: 300, closeDelay: 300, children: [children, _jsxs(RACTooltip, { ...props, ref: ref, className: clsx('cim-tooltip', UNSAFE_className), style: UNSAFE_style, containerPadding: 16, offset: 5, arrowBoundaryOffset: 4, "data-cim-style-root": true, children: [_jsx(RACOverlayArrow, { className: "cim-tooltip-arrow", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "10", viewBox: "0 0 16 10", children: _jsx("path", { d: "M0 0H16L8.78087 9.02391C8.38054 9.52432 7.61946 9.52432 7.21913 9.02391L0 0Z" }) }) }), _jsx(Text, { as: "p", variant: "small", children: label })] })] }));
7
+ function Tooltip({ children, label, isOpen, onOpenChange, UNSAFE_className, UNSAFE_style, isDisabled, ...props }, ref) {
8
+ return (_jsxs(RACTooltipTrigger, { isOpen: isOpen, onOpenChange: onOpenChange, delay: 300, closeDelay: 300, isDisabled: isDisabled, children: [children, _jsxs(RACTooltip, { ...props, ref: ref, className: clsx('cim-tooltip', UNSAFE_className), style: UNSAFE_style, containerPadding: 16, offset: 5, arrowBoundaryOffset: 4, "data-cim-style-root": true, children: [_jsx(RACOverlayArrow, { className: "cim-tooltip-arrow", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "10", viewBox: "0 0 16 10", children: _jsx("path", { d: "M0 0H16L8.78087 9.02391C8.38054 9.52432 7.61946 9.52432 7.21913 9.02391L0 0Z" }) }) }), _jsx(Text, { as: "p", variant: "small", children: label })] })] }));
9
9
  }
10
10
  /**
11
11
  * Provides additional information about an element that is hovered or focused.