@orcestr/ui 0.0.3 → 0.1.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 (184) hide show
  1. package/dist/components/Alert/Alert.d.ts +5 -4
  2. package/dist/components/Alert/Alert.d.ts.map +1 -1
  3. package/dist/components/Alert/Alert.js +5 -2
  4. package/dist/components/AppShell/AppShell.d.ts +13 -0
  5. package/dist/components/AppShell/AppShell.d.ts.map +1 -1
  6. package/dist/components/AppShell/AppShell.js +14 -9
  7. package/dist/components/AppSidebar/AppSidebar.d.ts +36 -0
  8. package/dist/components/AppSidebar/AppSidebar.d.ts.map +1 -0
  9. package/dist/components/AppSidebar/AppSidebar.js +117 -0
  10. package/dist/components/Badge/Badge.d.ts +8 -6
  11. package/dist/components/Badge/Badge.d.ts.map +1 -1
  12. package/dist/components/Badge/Badge.js +4 -4
  13. package/dist/components/BadgeSelectMenu/BadgeSelectMenu.d.ts +22 -0
  14. package/dist/components/BadgeSelectMenu/BadgeSelectMenu.d.ts.map +1 -0
  15. package/dist/components/BadgeSelectMenu/BadgeSelectMenu.js +50 -0
  16. package/dist/components/Box/Box.d.ts +2 -0
  17. package/dist/components/Box/Box.d.ts.map +1 -1
  18. package/dist/components/Box/Box.js +15 -2
  19. package/dist/components/Button/Button.d.ts +7 -3
  20. package/dist/components/Button/Button.d.ts.map +1 -1
  21. package/dist/components/Button/Button.js +23 -3
  22. package/dist/components/Card/Card.d.ts +26 -0
  23. package/dist/components/Card/Card.d.ts.map +1 -0
  24. package/dist/components/Card/Card.js +25 -0
  25. package/dist/components/Checkbox/Checkbox.d.ts +6 -2
  26. package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
  27. package/dist/components/Checkbox/Checkbox.js +13 -4
  28. package/dist/components/Collapse/Collapse.d.ts.map +1 -1
  29. package/dist/components/Collapse/Collapse.js +5 -25
  30. package/dist/components/CommandPalette/CommandPalette.d.ts.map +1 -1
  31. package/dist/components/CommandPalette/CommandPalette.js +10 -9
  32. package/dist/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
  33. package/dist/components/ConfirmDialog/ConfirmDialog.js +5 -2
  34. package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
  35. package/dist/components/ContextMenu/ContextMenu.js +2 -2
  36. package/dist/components/CopyButton/CopyButton.d.ts +24 -0
  37. package/dist/components/CopyButton/CopyButton.d.ts.map +1 -0
  38. package/dist/components/CopyButton/CopyButton.js +81 -0
  39. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  40. package/dist/components/DatePicker/DatePicker.js +9 -1
  41. package/dist/components/Dialog/Dialog.d.ts +69 -1
  42. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  43. package/dist/components/Dialog/Dialog.js +48 -1
  44. package/dist/components/Drawer/Drawer.d.ts +2 -1
  45. package/dist/components/Drawer/Drawer.d.ts.map +1 -1
  46. package/dist/components/Drawer/Drawer.js +4 -4
  47. package/dist/components/EntityPicker/EntityPicker.d.ts +2 -1
  48. package/dist/components/EntityPicker/EntityPicker.d.ts.map +1 -1
  49. package/dist/components/EntityPicker/EntityPicker.js +2 -2
  50. package/dist/components/Flex/Flex.d.ts +5 -1
  51. package/dist/components/Flex/Flex.d.ts.map +1 -1
  52. package/dist/components/Flex/Flex.js +16 -3
  53. package/dist/components/Grid/Grid.d.ts +9 -2
  54. package/dist/components/Grid/Grid.d.ts.map +1 -1
  55. package/dist/components/Grid/Grid.js +22 -1
  56. package/dist/components/IconButton/IconButton.d.ts +19 -7
  57. package/dist/components/IconButton/IconButton.d.ts.map +1 -1
  58. package/dist/components/IconButton/IconButton.js +40 -5
  59. package/dist/components/IconTextButton/IconTextButton.d.ts +20 -0
  60. package/dist/components/IconTextButton/IconTextButton.d.ts.map +1 -0
  61. package/dist/components/IconTextButton/IconTextButton.js +24 -0
  62. package/dist/components/InlineEdit/InlineEdit.d.ts +63 -0
  63. package/dist/components/InlineEdit/InlineEdit.d.ts.map +1 -0
  64. package/dist/components/InlineEdit/InlineEdit.js +98 -0
  65. package/dist/components/LinkButton/LinkButton.d.ts +25 -0
  66. package/dist/components/LinkButton/LinkButton.d.ts.map +1 -0
  67. package/dist/components/LinkButton/LinkButton.js +12 -0
  68. package/dist/components/Modal/Modal.d.ts +29 -6
  69. package/dist/components/Modal/Modal.d.ts.map +1 -1
  70. package/dist/components/Modal/Modal.js +37 -13
  71. package/dist/components/Overlay/OverlayProvider.d.ts +1 -0
  72. package/dist/components/Overlay/OverlayProvider.d.ts.map +1 -1
  73. package/dist/components/Overlay/OverlayProvider.js +18 -1
  74. package/dist/components/PaginatedCombobox/PaginatedCombobox.d.ts +2 -1
  75. package/dist/components/PaginatedCombobox/PaginatedCombobox.d.ts.map +1 -1
  76. package/dist/components/PaginatedCombobox/PaginatedCombobox.js +3 -3
  77. package/dist/components/Popover/Popover.d.ts +37 -3
  78. package/dist/components/Popover/Popover.d.ts.map +1 -1
  79. package/dist/components/Popover/Popover.js +56 -9
  80. package/dist/components/ScrollArea/ScrollArea.d.ts +4 -0
  81. package/dist/components/ScrollArea/ScrollArea.d.ts.map +1 -1
  82. package/dist/components/ScrollArea/ScrollArea.js +30 -4
  83. package/dist/components/Section/Section.d.ts +2 -0
  84. package/dist/components/Section/Section.d.ts.map +1 -1
  85. package/dist/components/SegmentedControl/SegmentedControl.d.ts +24 -1
  86. package/dist/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  87. package/dist/components/SegmentedControl/SegmentedControl.js +28 -2
  88. package/dist/components/Select/Select.d.ts +36 -4
  89. package/dist/components/Select/Select.d.ts.map +1 -1
  90. package/dist/components/Select/Select.js +70 -3
  91. package/dist/components/Separator/Separator.d.ts +3 -1
  92. package/dist/components/Separator/Separator.d.ts.map +1 -1
  93. package/dist/components/Separator/Separator.js +4 -2
  94. package/dist/components/SpecialModal/SpecialModal.d.ts +43 -0
  95. package/dist/components/SpecialModal/SpecialModal.d.ts.map +1 -0
  96. package/dist/components/SpecialModal/SpecialModal.js +34 -0
  97. package/dist/components/Spinner/Spinner.d.ts +3 -1
  98. package/dist/components/Spinner/Spinner.d.ts.map +1 -1
  99. package/dist/components/Spinner/Spinner.js +2 -2
  100. package/dist/components/State/State.d.ts +8 -1
  101. package/dist/components/State/State.d.ts.map +1 -1
  102. package/dist/components/State/State.js +2 -2
  103. package/dist/components/Switch/Switch.d.ts +2 -0
  104. package/dist/components/Switch/Switch.d.ts.map +1 -1
  105. package/dist/components/Switch/Switch.js +2 -1
  106. package/dist/components/Table/Table.d.ts +64 -0
  107. package/dist/components/Table/Table.d.ts.map +1 -0
  108. package/dist/components/Table/Table.js +38 -0
  109. package/dist/components/Tabs/Tabs.d.ts +33 -2
  110. package/dist/components/Tabs/Tabs.d.ts.map +1 -1
  111. package/dist/components/Tabs/Tabs.js +201 -5
  112. package/dist/components/Text/Text.d.ts +13 -3
  113. package/dist/components/Text/Text.d.ts.map +1 -1
  114. package/dist/components/Text/Text.js +16 -3
  115. package/dist/components/TextArea/TextArea.d.ts.map +1 -1
  116. package/dist/components/TextArea/TextArea.js +1 -1
  117. package/dist/components/TextField/TextField.d.ts.map +1 -1
  118. package/dist/components/TextField/TextField.js +1 -1
  119. package/dist/components/Toast/Toast.d.ts +1 -4
  120. package/dist/components/Toast/Toast.d.ts.map +1 -1
  121. package/dist/components/Toast/Toast.js +72 -37
  122. package/dist/components/Tooltip/Tooltip.d.ts +11 -3
  123. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  124. package/dist/components/Tooltip/Tooltip.js +58 -9
  125. package/dist/example/CodePreview.d.ts +2 -1
  126. package/dist/example/CodePreview.d.ts.map +1 -1
  127. package/dist/example/CodePreview.js +16 -51
  128. package/dist/example/ExampleActionsSection.d.ts.map +1 -1
  129. package/dist/example/ExampleActionsSection.js +3 -3
  130. package/dist/example/ExampleApplicationSection.d.ts +7 -0
  131. package/dist/example/ExampleApplicationSection.d.ts.map +1 -0
  132. package/dist/example/ExampleApplicationSection.js +88 -0
  133. package/dist/example/ExampleBasicsSections.d.ts +1 -1
  134. package/dist/example/ExampleBasicsSections.d.ts.map +1 -1
  135. package/dist/example/ExampleBasicsSections.js +15 -13
  136. package/dist/example/ExampleDataSection.d.ts.map +1 -1
  137. package/dist/example/ExampleDataSection.js +31 -30
  138. package/dist/example/ExampleFieldsSection.d.ts.map +1 -1
  139. package/dist/example/ExampleFieldsSection.js +51 -3
  140. package/dist/example/ExampleFoundationsSection.js +1 -1
  141. package/dist/example/ExampleOverlays.d.ts.map +1 -1
  142. package/dist/example/ExampleOverlays.js +7 -2
  143. package/dist/example/ExampleOverlaysSection.d.ts.map +1 -1
  144. package/dist/example/ExampleOverlaysSection.js +20 -30
  145. package/dist/example/ExampleSelectionSection.d.ts +3 -1
  146. package/dist/example/ExampleSelectionSection.d.ts.map +1 -1
  147. package/dist/example/ExampleSelectionSection.js +10 -3
  148. package/dist/example/ExampleStateSection.d.ts +3 -0
  149. package/dist/example/ExampleStateSection.d.ts.map +1 -1
  150. package/dist/example/ExampleStateSection.js +65 -9
  151. package/dist/example/ExampleThemePlayground.d.ts +84 -54
  152. package/dist/example/ExampleThemePlayground.d.ts.map +1 -1
  153. package/dist/example/ExampleThemePlayground.js +129 -63
  154. package/dist/example/UiExamplePage.d.ts.map +1 -1
  155. package/dist/example/UiExamplePage.js +39 -19
  156. package/dist/example/codeSamples.d.ts +8 -1
  157. package/dist/example/codeSamples.d.ts.map +1 -1
  158. package/dist/example/codeSamples.js +590 -119
  159. package/dist/example/exampleData.d.ts.map +1 -1
  160. package/dist/example/exampleData.js +18 -10
  161. package/dist/example/styles.css +277 -146
  162. package/dist/hooks/useFloatingPosition.js +1 -1
  163. package/dist/hooks/usePresence.d.ts.map +1 -1
  164. package/dist/hooks/usePresence.js +9 -7
  165. package/dist/index.d.ts +9 -1
  166. package/dist/index.d.ts.map +1 -1
  167. package/dist/index.js +9 -1
  168. package/dist/styles/orcestr-ui.css +3002 -872
  169. package/dist/theme/ThemeProvider.d.ts.map +1 -1
  170. package/dist/theme/ThemeProvider.js +109 -53
  171. package/dist/theme/defaultTheme.d.ts.map +1 -1
  172. package/dist/theme/defaultTheme.js +356 -223
  173. package/dist/theme/systemProps.d.ts +48 -28
  174. package/dist/theme/systemProps.d.ts.map +1 -1
  175. package/dist/theme/systemProps.js +103 -1
  176. package/dist/theme/themeTypes.d.ts +44 -35
  177. package/dist/theme/themeTypes.d.ts.map +1 -1
  178. package/dist/utils/slot.d.ts +11 -0
  179. package/dist/utils/slot.d.ts.map +1 -0
  180. package/dist/utils/slot.js +18 -0
  181. package/package.json +4 -1
  182. package/dist/components/Workflow/Workflow.d.ts +0 -82
  183. package/dist/components/Workflow/Workflow.d.ts.map +0 -1
  184. package/dist/components/Workflow/Workflow.js +0 -73
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, } from 'react';
3
+ import { splitSystemProps } from '../../theme/systemProps';
4
+ import { cn } from '../../utils/cn';
5
+ import { renderSlot } from '../../utils/slot';
6
+ export const Card = forwardRef(function Card({ as, className, style, size = 2, v = 'ghost', interactive = false, asChild = false, testId, children, ...props }, ref) {
7
+ const Component = as ?? 'div';
8
+ const { systemStyle, restProps } = splitSystemProps(props);
9
+ const commonProps = {
10
+ className: cn('oui-card', className),
11
+ 'data-size': size,
12
+ 'data-variant': v,
13
+ 'data-interactive': interactive ? 'true' : undefined,
14
+ 'data-testid': testId,
15
+ style: { ...systemStyle, ...style },
16
+ ...restProps,
17
+ };
18
+ if (asChild) {
19
+ return renderSlot(children, {
20
+ ...commonProps,
21
+ ref: ref,
22
+ });
23
+ }
24
+ return (_jsx(Component, { ref: ref, ...commonProps, children: children }));
25
+ });
@@ -1,10 +1,14 @@
1
1
  import { type InputHTMLAttributes, type ReactNode } from 'react';
2
- export type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> & {
2
+ export type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'checked'> & {
3
3
  label?: ReactNode;
4
+ checked?: boolean | 'indeterminate';
5
+ onCheckedChange?: (checked: boolean) => void;
4
6
  testId?: string;
5
7
  };
6
- export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "type"> & {
8
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "checked"> & {
7
9
  label?: ReactNode;
10
+ checked?: boolean | "indeterminate";
11
+ onCheckedChange?: (checked: boolean) => void;
8
12
  testId?: string;
9
13
  } & import("react").RefAttributes<HTMLInputElement>>;
10
14
  //# sourceMappingURL=Checkbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIH,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAKf,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,GAAG;IAC9E,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,QAAQ;YAJT,SAAS;aACR,MAAM;oDA+ClB,CAAC"}
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAMf,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG;IAC1F,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC;IACpC,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,QAAQ;YANT,SAAS;cACP,OAAO,GAAG,eAAe;sBACjB,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI;aACnC,MAAM;oDA2DlB,CAAC"}
@@ -1,15 +1,24 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { forwardRef, useState, } from 'react';
4
- import { LuCheck } from 'react-icons/lu';
3
+ import { forwardRef, useEffect, useRef, useState, } from 'react';
4
+ import { LuCheck, LuMinus } from 'react-icons/lu';
5
5
  import { cn } from '../../utils/cn';
6
- export const Checkbox = forwardRef(function Checkbox({ className, label, children, checked, defaultChecked, disabled, onChange, testId, ...props }, ref) {
6
+ import { composeRefs } from '../../utils/composeRefs';
7
+ export const Checkbox = forwardRef(function Checkbox({ className, label, children, checked, defaultChecked, disabled, onChange, onCheckedChange, testId, dangerouslySetInnerHTML: _dangerouslySetInnerHTML, ...props }, ref) {
8
+ const inputRef = useRef(null);
7
9
  const [internalChecked, setInternalChecked] = useState(Boolean(defaultChecked));
8
10
  const actualChecked = checked ?? internalChecked;
11
+ const inputChecked = actualChecked === 'indeterminate' ? false : actualChecked;
9
12
  const handleChange = (event) => {
10
13
  if (checked === undefined)
11
14
  setInternalChecked(event.target.checked);
12
15
  onChange?.(event);
16
+ onCheckedChange?.(event.target.checked);
13
17
  };
14
- return (_jsxs("label", { className: cn('oui-checkbox', className), "data-checked": actualChecked ? 'true' : undefined, "data-disabled": disabled ? 'true' : undefined, "data-testid": testId, children: [_jsx("input", { ref: ref, type: 'checkbox', checked: actualChecked, disabled: disabled, onChange: handleChange, ...props }), _jsx("span", { className: 'oui-checkbox-box', children: _jsx(LuCheck, { size: 13 }) }), label || children ? _jsx("span", { children: label ?? children }) : null] }));
18
+ useEffect(() => {
19
+ if (!inputRef.current)
20
+ return;
21
+ inputRef.current.indeterminate = actualChecked === 'indeterminate';
22
+ }, [actualChecked]);
23
+ return (_jsxs("label", { className: cn('oui-checkbox', className), "data-checked": actualChecked === true ? 'true' : undefined, "data-indeterminate": actualChecked === 'indeterminate' ? 'true' : undefined, "data-disabled": disabled ? 'true' : undefined, "data-testid": testId, children: [_jsx("input", { ref: composeRefs(inputRef, ref), type: 'checkbox', checked: inputChecked, disabled: disabled, onChange: handleChange, ...props }), _jsxs("span", { className: 'oui-checkbox-box', children: [_jsx(LuCheck, { className: 'oui-checkbox-check', size: 13 }), _jsx(LuMinus, { className: 'oui-checkbox-minus', size: 13 })] }), label || children ? _jsx("span", { children: label ?? children }) : null] }));
15
24
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Collapse.d.ts","sourceRoot":"","sources":["../../../src/components/Collapse/Collapse.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKH,KAAK,aAAa,EAClB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAIf,MAAM,MAAM,aAAa,GAAG;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,EACrB,IAAI,EACJ,QAAQ,EACR,OAAc,EACd,SAAS,EACT,KAAK,EACL,MAAM,GACT,EAAE,aAAa,2CAyCf"}
1
+ {"version":3,"file":"Collapse.d.ts","sourceRoot":"","sources":["../../../src/components/Collapse/Collapse.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,aAAa,EAAE,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAIzD,MAAM,MAAM,aAAa,GAAG;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,EACrB,IAAI,EACJ,QAAQ,EACR,OAAc,EACd,SAAS,EACT,KAAK,EACL,MAAM,GACT,EAAE,aAAa,2CAoBf"}
@@ -1,33 +1,13 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useCallback, useLayoutEffect, useRef, useState, } from 'react';
3
+ import {} from 'react';
4
4
  import { cn } from '../../utils/cn';
5
5
  export function Collapse({ open, children, animate = true, className, style, testId, }) {
6
- const contentRef = useRef(null);
7
- const [contentHeight, setContentHeight] = useState(null);
8
- const measure = useCallback(() => {
9
- const element = contentRef.current;
10
- if (!element)
11
- return;
12
- const nextHeight = element.scrollHeight;
13
- setContentHeight((current) => (current === nextHeight ? current : nextHeight));
14
- }, []);
15
- useLayoutEffect(() => {
16
- measure();
17
- }, [children, measure, open]);
18
- useLayoutEffect(() => {
19
- const element = contentRef.current;
20
- if (!element || typeof ResizeObserver === 'undefined')
21
- return;
22
- const observer = new ResizeObserver(() => measure());
23
- observer.observe(element);
24
- return () => observer.disconnect();
25
- }, [measure]);
26
- return (_jsx("div", { className: cn('oui-collapse', className), "data-state": open ? 'open' : 'closed', "data-testid": testId, style: {
27
- height: open ? (contentHeight ?? undefined) : 0,
6
+ return (_jsx("div", { className: cn('oui-collapse', className), "data-state": open ? 'open' : 'closed', "data-animate": animate ? 'true' : 'false', "data-testid": testId, style: {
7
+ gridTemplateRows: open ? '1fr' : '0fr',
28
8
  transition: animate
29
- ? 'height 220ms cubic-bezier(0.22, 1, 0.36, 1)'
9
+ ? 'grid-template-rows 220ms cubic-bezier(0.22, 1, 0.36, 1)'
30
10
  : 'none',
31
11
  ...style,
32
- }, children: _jsx("div", { ref: contentRef, className: 'oui-collapse-content', children: children }) }));
12
+ }, children: _jsx("div", { className: 'oui-collapse-content', children: children }) }));
33
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPalette.tsx"],"names":[],"mappings":"AAEA,OAAO,EAQH,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAIf,OAAO,EAGH,KAAK,iBAAiB,EACzB,MAAM,uBAAuB,CAAC;AAO/B,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAQF,wBAAgB,cAAc,CAAC,EAC3B,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,WAAgB,EAChB,QAAQ,EACR,KAAK,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,WAAW,EACX,gBAAqB,EACrB,MAAM,GACT,EAAE;IACC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACzC,WAAW,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAChD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,2CA2QA"}
1
+ {"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPalette.tsx"],"names":[],"mappings":"AAEA,OAAO,EAQH,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAIf,OAAO,EAGH,KAAK,iBAAiB,EACzB,MAAM,uBAAuB,CAAC;AAQ/B,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAQF,wBAAgB,cAAc,CAAC,EAC3B,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,WAAgB,EAChB,QAAQ,EACR,KAAK,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,WAAW,EACX,gBAAqB,EACrB,MAAM,GACT,EAAE;IACC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACzC,WAAW,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAChD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,2CAuRA"}
@@ -1,12 +1,13 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useCallback, useEffect, useId, useMemo, useRef, useState, } from 'react';
4
- import { LuSearch } from 'react-icons/lu';
4
+ import { LuSearch, LuX } from 'react-icons/lu';
5
5
  import { useOrcestrUiLocale } from '../../locale/LocaleProvider';
6
6
  import { actionItemSearchText, isActionItemDisabled, } from '../Action/ActionTypes';
7
7
  import { ActionConfirmModal } from '../Action/ActionConfirmModal';
8
8
  import { Collapse } from '../Collapse/Collapse';
9
9
  import { Modal } from '../Modal/Modal';
10
+ import { IconButton } from '../IconButton/IconButton';
10
11
  import { Spinner } from '../Spinner/Spinner';
11
12
  import { TextField } from '../TextField/TextField';
12
13
  export function CommandPalette({ open, onOpenChange, items, recentItems = [], onSelect, title, description, placeholder, emptyText, recentTitle, globalOpenEvents = [], testId, }) {
@@ -145,18 +146,18 @@ export function CommandPalette({ open, onOpenChange, items, recentItems = [], on
145
146
  setQuery('');
146
147
  }
147
148
  };
148
- return (_jsxs(_Fragment, { children: [_jsx(Modal, { open: open, onOpenChange: (next) => {
149
+ return (_jsxs(_Fragment, { children: [_jsxs(Modal, { open: open, onOpenChange: (next) => {
149
150
  if (next)
150
151
  onOpenChange(true);
151
152
  else
152
153
  close();
153
- }, title: actualTitle, description: actualDescription, maxWidth: 520, testId: testId, children: _jsxs("div", { className: 'oui-command-palette', "data-testid": testId ? `${testId}-panel` : undefined, onKeyDown: handleKeyDown, children: [_jsx(TextField, { autoFocus: true, className: 'oui-command-palette-search', leftSlot: _jsx(LuSearch, { size: 16 }), placeholder: actualPlaceholder, value: query, role: 'combobox', "aria-autocomplete": 'list', "aria-controls": listboxId, "aria-expanded": open, "aria-activedescendant": selectedItem
154
- ? commandOptionId(listboxId, actualSelectedIndex)
155
- : undefined, onChange: (event) => setQuery(event.target.value) }), _jsx("div", { ref: optionsRef, id: listboxId, className: 'oui-command-palette-results', role: 'listbox', "aria-label": copy.common.commandPaletteResults, children: _jsx(Collapse, { open: true, className: 'oui-command-palette-collapse', children: groups.length > 0 ? (groups.map((groupData) => (_jsxs("div", { className: 'oui-command-palette-group', children: [_jsx("div", { className: 'oui-command-palette-group-title', "data-recent": groupData.recent ? 'true' : undefined, children: groupData.group }), _jsx("div", { className: 'oui-command-palette-items', children: groupData.items.map((item) => {
156
- const index = options.indexOf(item);
157
- const selected = index === actualSelectedIndex;
158
- return (_jsxs("button", { id: commandOptionId(listboxId, index), type: 'button', role: 'option', "aria-selected": selected, className: 'oui-command-palette-item', "data-selected": selected ? 'true' : undefined, "data-loading": item.loading ? 'true' : undefined, "data-tone": item.tone, "data-oui-command-index": index, "aria-busy": item.loading ? 'true' : undefined, disabled: isActionItemDisabled(item), onMouseEnter: () => setSelectedIndex(index), onClick: () => selectItem(item), children: [item.icon || item.loading ? (_jsx("span", { className: 'oui-command-palette-item-icon', children: item.loading ? _jsx(Spinner, { size: 1 }) : item.icon })) : null, _jsxs("span", { className: 'oui-command-palette-item-main', children: [_jsx("span", { className: 'oui-command-palette-item-label', children: item.label }), item.description ? (_jsx("span", { className: 'oui-command-palette-item-description', children: item.description })) : null] }), item.shortcut ? (_jsx("span", { className: 'oui-command-palette-shortcut', children: item.shortcut })) : null] }, `${groupData.group}-${item.key}`));
159
- }) })] }, groupData.group)))) : (_jsx("div", { className: 'oui-command-palette-empty', children: actualEmptyText })) }) })] }) }), _jsx(ActionConfirmModal, { item: confirmItem, open: confirmItem !== null, onCancel: () => setConfirmItem(null), onConfirm: () => {
154
+ }, maxWidth: 520, testId: testId, children: [_jsxs(Modal.Header, { children: [_jsxs("div", { className: 'oui-modal-title-wrap', children: [_jsx("h2", { className: 'oui-modal-title', children: actualTitle }), _jsx("p", { className: 'oui-modal-description', children: actualDescription })] }), _jsx(IconButton, { v: 'ghost', icon: _jsx(LuX, { size: 18 }), "aria-label": copy.common.close, onClick: close })] }), _jsx(Modal.Body, { children: _jsxs("div", { className: 'oui-command-palette', "data-testid": testId ? `${testId}-panel` : undefined, onKeyDown: handleKeyDown, children: [_jsx(TextField, { autoFocus: true, className: 'oui-command-palette-search', leftSlot: _jsx(LuSearch, { size: 16 }), placeholder: actualPlaceholder, value: query, role: 'combobox', "aria-autocomplete": 'list', "aria-controls": listboxId, "aria-expanded": open, "aria-activedescendant": selectedItem
155
+ ? commandOptionId(listboxId, actualSelectedIndex)
156
+ : undefined, onChange: (event) => setQuery(event.target.value) }), _jsx("div", { ref: optionsRef, id: listboxId, className: 'oui-command-palette-results', role: 'listbox', "aria-label": copy.common.commandPaletteResults, children: _jsx(Collapse, { open: true, className: 'oui-command-palette-collapse', children: groups.length > 0 ? (groups.map((groupData) => (_jsxs("div", { className: 'oui-command-palette-group', children: [_jsx("div", { className: 'oui-command-palette-group-title', "data-recent": groupData.recent ? 'true' : undefined, children: groupData.group }), _jsx("div", { className: 'oui-command-palette-items', children: groupData.items.map((item) => {
157
+ const index = options.indexOf(item);
158
+ const selected = index === actualSelectedIndex;
159
+ return (_jsxs("button", { id: commandOptionId(listboxId, index), type: 'button', role: 'option', "aria-selected": selected, className: 'oui-command-palette-item', "data-selected": selected ? 'true' : undefined, "data-loading": item.loading ? 'true' : undefined, "data-tone": item.tone, "data-oui-command-index": index, "aria-busy": item.loading ? 'true' : undefined, disabled: isActionItemDisabled(item), onMouseEnter: () => setSelectedIndex(index), onClick: () => selectItem(item), children: [item.icon || item.loading ? (_jsx("span", { className: 'oui-command-palette-item-icon', children: item.loading ? _jsx(Spinner, { size: 1 }) : item.icon })) : null, _jsxs("span", { className: 'oui-command-palette-item-main', children: [_jsx("span", { className: 'oui-command-palette-item-label', children: item.label }), item.description ? (_jsx("span", { className: 'oui-command-palette-item-description', children: item.description })) : null] }), item.shortcut ? (_jsx("span", { className: 'oui-command-palette-shortcut', children: item.shortcut })) : null] }, `${groupData.group}-${item.key}`));
160
+ }) })] }, groupData.group)))) : (_jsx("div", { className: 'oui-command-palette-empty', children: actualEmptyText })) }) })] }) })] }), _jsx(ActionConfirmModal, { item: confirmItem, open: confirmItem !== null, onCancel: () => setConfirmItem(null), onConfirm: () => {
160
161
  confirmItem?.onSelect?.();
161
162
  if (confirmItem)
162
163
  onSelect(confirmItem.key);
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmDialog.d.ts","sourceRoot":"","sources":["../../../src/components/ConfirmDialog/ConfirmDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MA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B,EAChB,OAAe,EACf,eAAuB,EACvB,cAAsB,EACtB,mBAAmB,EACnB,QAAc,EACd,MAAM,EACN,SAAS,EACT,QAAQ,GACX,EAAE,kBAAkB,2CA0EpB"}
@@ -1,7 +1,10 @@
1
1
  'use client';
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { LuX } from 'react-icons/lu';
3
4
  import { useOrcestrUiLocale } from '../../locale/LocaleProvider';
4
5
  import { Button } from '../Button/Button';
6
+ import { Flex } from '../Flex/Flex';
7
+ import { IconButton } from '../IconButton/IconButton';
5
8
  import { Modal } from '../Modal/Modal';
6
9
  import { Text } from '../Text/Text';
7
10
  export function ConfirmDialog({ open, onOpenChange, title, description, message, children, confirmLabel, cancelLabel, tone = 'neutral', loading = false, confirmDisabled = false, cancelDisabled = false, closeOnOverlayClick, maxWidth = 420, testId, onConfirm, onCancel, }) {
@@ -21,5 +24,5 @@ export function ConfirmDialog({ open, onOpenChange, title, description, message,
21
24
  return;
22
25
  }
23
26
  cancel();
24
- }, title: title, description: description, maxWidth: maxWidth, closeOnOverlayClick: closeOnOverlayClick ?? canClose, testId: testId, footer: (_jsxs(_Fragment, { children: [_jsx(Button, { v: 'surface', onClick: cancel, disabled: !canClose, testId: testId ? `${testId}-cancel` : undefined, children: actualCancelLabel }), _jsx(Button, { tone: tone, loading: loading, disabled: confirmDisabled, onClick: onConfirm, testId: testId ? `${testId}-confirm` : undefined, children: actualConfirmLabel })] })), children: [message ? (_jsx(Text, { as: 'p', tone: 'muted', lh: 1.5, children: message })) : null, children] }));
27
+ }, maxWidth: maxWidth, closeOnOverlayClick: closeOnOverlayClick ?? canClose, testId: testId, children: [title || description ? (_jsxs(Modal.Header, { children: [_jsxs("div", { className: 'oui-modal-title-wrap', children: [title ? _jsx("h2", { className: 'oui-modal-title', children: title }) : null, description ? (_jsx("p", { className: 'oui-modal-description', children: description })) : null] }), _jsx(IconButton, { v: 'ghost', icon: _jsx(LuX, { size: 18 }), "aria-label": copy.common.close, disabled: !canClose, onClick: cancel })] })) : null, _jsxs(Modal.Body, { children: [message ? (_jsx(Text, { as: 'p', tone: 'muted', lh: 1.5, children: message })) : null, children] }), _jsx(Modal.Footer, { children: _jsxs(Flex, { g: 2, j: 'e', w: '100%', children: [_jsx(Button, { v: 'surface', onClick: cancel, disabled: !canClose, testId: testId ? `${testId}-cancel` : undefined, children: actualCancelLabel }), _jsx(Button, { tone: tone, loading: loading, disabled: confirmDisabled, onClick: onConfirm, testId: testId ? `${testId}-confirm` : undefined, children: actualConfirmLabel })] }) })] }));
25
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../src/components/ContextMenu/ContextMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,UAAU,EACf,KAAK,YAAY,EACpB,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAK3C,wBAAgB,WAAW,CAAC,EACxB,QAAQ,EACR,KAAK,EACL,SAAS,EACT,MAAM,GACT,EAAE;IACC,QAAQ,EAAE,YAAY,CAAC;QAAC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;KAAC,CAAC,CAAC;IACtE,KAAK,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,2CA6EA"}
1
+ {"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../src/components/ContextMenu/ContextMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,UAAU,EACf,KAAK,YAAY,EACpB,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAS3C,wBAAgB,WAAW,CAAC,EACxB,QAAQ,EACR,KAAK,EACL,SAAS,EACT,MAAM,GACT,EAAE;IACC,QAAQ,EAAE,YAAY,CAAC;QAAC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;KAAC,CAAC,CAAC;IACtE,KAAK,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,2CAiFA"}
@@ -4,7 +4,7 @@ import { cloneElement, useCallback, useEffect, useRef, useState, } from 'react';
4
4
  import { cn } from '../../utils/cn';
5
5
  import { ActionConfirmModal } from '../Action/ActionConfirmModal';
6
6
  import { isActionItemDisabled } from '../Action/ActionTypes';
7
- import { useOverlayContext, useOverlayLayerIndex } from '../Overlay/OverlayProvider';
7
+ import { overlayLayerZIndex, useOverlayContext, useOverlayLayerIndex, } from '../Overlay/OverlayProvider';
8
8
  import { Portal } from '../Portal/Portal';
9
9
  import { Spinner } from '../Spinner/Spinner';
10
10
  export function ContextMenu({ children, items, className, testId, }) {
@@ -47,7 +47,7 @@ export function ContextMenu({ children, items, className, testId, }) {
47
47
  return (_jsxs(_Fragment, { children: [trigger, point ? (_jsx(Portal, { children: _jsx("div", { ref: layerRef, className: cn('oui-popover-content oui-menu oui-action-menu-content oui-context-menu-content', className), "data-state": 'opening', "data-layer": 'dropdown', "data-testid": testId, style: {
48
48
  left: point.x,
49
49
  top: point.y,
50
- zIndex: overlay.zIndex.dropdown + layerIndex * 10,
50
+ zIndex: overlayLayerZIndex(overlay.zIndex, 'dropdown', layerIndex),
51
51
  }, onClick: (event) => event.stopPropagation(), children: _jsx(ContextMenuContent, { items: items, close: close, requestConfirmation: setConfirmItem, testId: testId ? `${testId}-list` : undefined }) }) })) : null, _jsx(ActionConfirmModal, { item: confirmItem, open: confirmItem !== null, onCancel: () => setConfirmItem(null), onConfirm: () => {
52
52
  confirmItem?.onSelect?.();
53
53
  setConfirmItem(null);
@@ -0,0 +1,24 @@
1
+ import { type ButtonProps } from '../Button/Button';
2
+ import { type IconButtonProps } from '../IconButton/IconButton';
3
+ export type CopyButtonProps = Omit<ButtonProps, 'children' | 'leftIcon' | 'loading' | 'onClick'> & {
4
+ text: string;
5
+ label?: string;
6
+ copiedLabel?: string;
7
+ successMessage?: string;
8
+ errorMessage?: string;
9
+ resetMs?: number;
10
+ onCopied?: () => void;
11
+ onCopyError?: (error: unknown) => void;
12
+ };
13
+ export type CopyIconButtonProps = Omit<IconButtonProps, 'children' | 'icon' | 'loading' | 'onClick'> & {
14
+ text: string;
15
+ label?: string;
16
+ successMessage?: string;
17
+ errorMessage?: string;
18
+ resetMs?: number;
19
+ onCopied?: () => void;
20
+ onCopyError?: (error: unknown) => void;
21
+ };
22
+ export declare function CopyButton({ text, label, copiedLabel, successMessage, errorMessage, resetMs, onCopied, onCopyError, className, disabled, ...props }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function CopyIconButton({ text, label, successMessage, errorMessage, resetMs, onCopied, onCopyError, className, disabled, ...props }: CopyIconButtonProps): import("react/jsx-runtime").JSX.Element;
24
+ //# sourceMappingURL=CopyButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopyButton.d.ts","sourceRoot":"","sources":["../../../src/components/CopyButton/CopyButton.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAS,KAAK,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,0BAA0B,CAAC;AAG1E,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC,GAAG;IAC/F,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC,GAAG;IACnG,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACvB,IAAI,EACJ,KAAc,EACd,WAAsB,EACtB,cAAyB,EACzB,YAA4B,EAC5B,OAAc,EACd,QAAQ,EACR,WAAW,EACX,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACX,EAAE,eAAe,2CAsBjB;AAED,wBAAgB,cAAc,CAAC,EAC3B,IAAI,EACJ,KAAc,EACd,cAAyB,EACzB,YAA4B,EAC5B,OAAc,EACd,QAAQ,EACR,WAAW,EACX,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACX,EAAE,mBAAmB,2CAqBrB"}
@@ -0,0 +1,81 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useEffect, useRef, useState } from 'react';
4
+ import { LuCheck, LuCopy } from 'react-icons/lu';
5
+ import { cn } from '../../utils/cn';
6
+ import { Button } from '../Button/Button';
7
+ import { IconButton } from '../IconButton/IconButton';
8
+ import { useToast } from '../Toast/Toast';
9
+ export function CopyButton({ text, label = 'Copy', copiedLabel = 'Copied', successMessage = 'Copied', errorMessage = 'Copy failed', resetMs = 1400, onCopied, onCopyError, className, disabled, ...props }) {
10
+ const { copied, pending, copy } = useCopyAction({
11
+ text,
12
+ successMessage,
13
+ errorMessage,
14
+ resetMs,
15
+ onCopied,
16
+ onCopyError,
17
+ });
18
+ return (_jsx(Button, { ...props, className: cn('oui-copy-button', className), disabled: disabled || pending, loading: pending, leftIcon: copied ? _jsx(LuCheck, { size: 15 }) : _jsx(LuCopy, { size: 15 }), onClick: copy, children: copied ? copiedLabel : label }));
19
+ }
20
+ export function CopyIconButton({ text, label = 'Copy', successMessage = 'Copied', errorMessage = 'Copy failed', resetMs = 1400, onCopied, onCopyError, className, disabled, ...props }) {
21
+ const { copied, pending, copy } = useCopyAction({
22
+ text,
23
+ successMessage,
24
+ errorMessage,
25
+ resetMs,
26
+ onCopied,
27
+ onCopyError,
28
+ });
29
+ return (_jsx(IconButton, { ...props, className: cn('oui-copy-icon-button', className), disabled: disabled || pending, loading: pending, icon: copied ? _jsx(LuCheck, { size: 15 }) : _jsx(LuCopy, { size: 15 }), "aria-label": label, onClick: copy }));
30
+ }
31
+ function useCopyAction({ text, successMessage, errorMessage, resetMs, onCopied, onCopyError, }) {
32
+ const toast = useToast();
33
+ const timerRef = useRef(null);
34
+ const [pending, setPending] = useState(false);
35
+ const [copied, setCopied] = useState(false);
36
+ useEffect(() => () => {
37
+ if (timerRef.current !== null)
38
+ window.clearTimeout(timerRef.current);
39
+ }, []);
40
+ async function copy(event) {
41
+ event.stopPropagation();
42
+ setPending(true);
43
+ try {
44
+ await writeClipboardText(text);
45
+ setCopied(true);
46
+ onCopied?.();
47
+ if (successMessage)
48
+ toast.success(successMessage);
49
+ if (timerRef.current !== null)
50
+ window.clearTimeout(timerRef.current);
51
+ timerRef.current = window.setTimeout(() => setCopied(false), resetMs);
52
+ }
53
+ catch (error) {
54
+ onCopyError?.(error);
55
+ if (errorMessage)
56
+ toast.error(errorMessage);
57
+ }
58
+ finally {
59
+ setPending(false);
60
+ }
61
+ }
62
+ return { copied, pending, copy };
63
+ }
64
+ async function writeClipboardText(text) {
65
+ if (navigator.clipboard?.writeText) {
66
+ await navigator.clipboard.writeText(text);
67
+ return;
68
+ }
69
+ const field = document.createElement('textarea');
70
+ field.value = text;
71
+ field.setAttribute('readonly', '');
72
+ field.style.position = 'fixed';
73
+ field.style.top = '-9999px';
74
+ field.style.left = '-9999px';
75
+ document.body.append(field);
76
+ field.select();
77
+ const copied = document.execCommand('copy');
78
+ field.remove();
79
+ if (!copied)
80
+ throw new Error('Clipboard copy failed');
81
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAQxD,OAAO,EAQH,KAAK,sBAAsB,EAC9B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,eAAe,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACvB,KAAK,EACL,aAAa,EACb,GAAG,EACH,GAAG,EACH,YAAY,EACZ,WAAW,EACX,SAAgB,EAChB,QAAgB,EAChB,QAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,MAAM,EACN,MAAM,GACT,EAAE,eAAe,2CAiIjB"}
1
+ {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAqC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAQzE,OAAO,EAQH,KAAK,sBAAsB,EAC9B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,eAAe,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACvB,KAAK,EACL,aAAa,EACb,GAAG,EACH,GAAG,EACH,YAAY,EACZ,WAAW,EACX,SAAgB,EAChB,QAAgB,EAChB,QAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,MAAM,EACN,MAAM,GACT,EAAE,eAAe,2CA2IjB"}
@@ -26,13 +26,21 @@ export function DatePicker({ value, onValueChange, min, max, disabledDate, place
26
26
  onValueChange(clampDate(nextValue, min, max));
27
27
  setOpen(false);
28
28
  };
29
+ const openCalendar = (event) => {
30
+ event.preventDefault();
31
+ event.stopPropagation();
32
+ if (disabled || readOnly)
33
+ return;
34
+ setCursorMonth(monthCursorForDate(value));
35
+ setOpen(true);
36
+ };
29
37
  return (_jsx(Popover, { open: open, onOpenChange: (nextOpen) => {
30
38
  if (readOnly && nextOpen)
31
39
  return;
32
40
  if (nextOpen)
33
41
  setCursorMonth(monthCursorForDate(value));
34
42
  setOpen(nextOpen);
35
- }, disabled: disabled || readOnly, matchTriggerWidth: false, sideOffset: 6, testId: testId ? `${testId}-popover` : undefined, trigger: _jsx(TextField, { value: displayValue, placeholder: placeholder, readOnly: true, disabled: disabled, clearable: clearable && Boolean(value) && !readOnly, testId: testId, "aria-label": openCalendarLabel ?? copy.common.openCalendar, onClear: () => onValueChange(''), rightSlot: _jsx("span", { className: 'oui-date-picker-trigger', "aria-hidden": true, children: _jsx(LuCalendarDays, { size: 16 }) }) }), className: 'oui-date-picker-popover', children: _jsxs("div", { className: 'oui-date-picker-panel', children: [_jsxs("div", { className: 'oui-date-picker-head', children: [_jsx(IconButton, { size: 1, v: 'ghost', type: 'button', icon: _jsx(LuChevronLeft, { size: 16 }), "aria-label": previousMonthLabel ?? copy.common.previous, onClick: () => setCursorMonth((current) => shiftMonth(current, -1)) }), _jsx("strong", { children: formatMonthLabel(cursorMonth, actualLocale) }), _jsx(IconButton, { size: 1, v: 'ghost', type: 'button', icon: _jsx(LuChevronRight, { size: 16 }), "aria-label": nextMonthLabel ?? copy.common.next, onClick: () => setCursorMonth((current) => shiftMonth(current, 1)) })] }), _jsx("div", { className: 'oui-date-picker-weekdays', children: weekdays.map((weekday) => (_jsx("span", { children: weekday }, weekday))) }), _jsx("div", { className: 'oui-date-picker-grid', children: monthState.weeks.flatMap((week) => week.map((day) => (_jsx("button", { type: 'button', className: 'oui-date-picker-day', "data-outside": day.outsideMonth ? 'true' : undefined, "data-selected": day.selected ? 'true' : undefined, "data-today": day.today ? 'true' : undefined, disabled: day.disabled, "aria-pressed": day.selected, onClick: () => selectDate(day.date), children: day.day }, day.date)))) }), _jsxs("div", { className: 'oui-date-picker-foot', children: [_jsx(Button, { size: 1, v: 'ghost', type: 'button', onClick: () => selectDate(clampDate(new Date().toISOString().slice(0, 10), min, max)), children: todayLabel ?? copy.dates.today }), clearable ? (_jsx(Button, { size: 1, v: 'ghost', type: 'button', disabled: !value, onClick: () => {
43
+ }, disabled: disabled || readOnly, matchTriggerWidth: false, sideOffset: 6, testId: testId ? `${testId}-popover` : undefined, trigger: _jsx(TextField, { value: displayValue, placeholder: placeholder, readOnly: true, disabled: disabled, clearable: clearable && Boolean(value) && !readOnly, testId: testId, "aria-label": openCalendarLabel ?? copy.common.openCalendar, onClear: () => onValueChange(''), rightSlot: _jsx("button", { type: 'button', className: 'oui-date-picker-trigger', "aria-label": openCalendarLabel ?? copy.common.openCalendar, disabled: disabled || readOnly, onClick: openCalendar, children: _jsx(LuCalendarDays, { size: 16 }) }) }), className: 'oui-date-picker-popover', children: _jsxs("div", { className: 'oui-date-picker-panel', children: [_jsxs("div", { className: 'oui-date-picker-head', children: [_jsx(IconButton, { size: 1, v: 'ghost', type: 'button', icon: _jsx(LuChevronLeft, { size: 16 }), "aria-label": previousMonthLabel ?? copy.common.previous, onClick: () => setCursorMonth((current) => shiftMonth(current, -1)) }), _jsx("strong", { children: formatMonthLabel(cursorMonth, actualLocale) }), _jsx(IconButton, { size: 1, v: 'ghost', type: 'button', icon: _jsx(LuChevronRight, { size: 16 }), "aria-label": nextMonthLabel ?? copy.common.next, onClick: () => setCursorMonth((current) => shiftMonth(current, 1)) })] }), _jsx("div", { className: 'oui-date-picker-weekdays', children: weekdays.map((weekday) => (_jsx("span", { children: weekday }, weekday))) }), _jsx("div", { className: 'oui-date-picker-grid', children: monthState.weeks.flatMap((week) => week.map((day) => (_jsx("button", { type: 'button', className: 'oui-date-picker-day', "data-outside": day.outsideMonth ? 'true' : undefined, "data-selected": day.selected ? 'true' : undefined, "data-today": day.today ? 'true' : undefined, disabled: day.disabled, "aria-pressed": day.selected, onClick: () => selectDate(day.date), children: day.day }, day.date)))) }), _jsxs("div", { className: 'oui-date-picker-foot', children: [_jsx(Button, { size: 1, v: 'ghost', type: 'button', onClick: () => selectDate(clampDate(new Date().toISOString().slice(0, 10), min, max)), children: todayLabel ?? copy.dates.today }), clearable ? (_jsx(Button, { size: 1, v: 'ghost', type: 'button', disabled: !value, onClick: () => {
36
44
  onValueChange('');
37
45
  setOpen(false);
38
46
  }, children: copy.common.clear })) : null] })] }) }));
@@ -1,2 +1,70 @@
1
- export { Modal as Dialog, type ModalProps as DialogProps } from '../Modal/Modal';
1
+ import { type CSSProperties, type KeyboardEventHandler, type ReactNode } from 'react';
2
+ import { type ModalProps } from '../Modal/Modal';
3
+ import { type SystemProps } from '../../theme/systemProps';
4
+ export type DialogProps = ModalProps;
5
+ export declare const Dialog: (({ open, onOpenChange, children, maxWidth, minHeight, overlayColor, overlayOpacity, overlayBlur, borderColor, radius, shadow, animationDuration, animation, overlayClassName, overlayStyle, className, contentClassName, contentStyle, onKeyDown, onOpenAutoFocus, closeOnOverlayClick, ariaLabel, ariaLabelledBy, ariaDescribedBy, testId, }: ModalProps) => import("react/jsx-runtime").JSX.Element | null) & {
6
+ Header: ({ children, className, style }: {
7
+ children: ReactNode;
8
+ className?: string;
9
+ style?: CSSProperties;
10
+ }) => import("react/jsx-runtime").JSX.Element;
11
+ Body: ({ children, className, style }: {
12
+ children: ReactNode;
13
+ className?: string;
14
+ style?: CSSProperties;
15
+ }) => import("react/jsx-runtime").JSX.Element;
16
+ Footer: ({ children, className, style }: {
17
+ children: ReactNode;
18
+ className?: string;
19
+ style?: CSSProperties;
20
+ }) => import("react/jsx-runtime").JSX.Element;
21
+ Close: ({ onClick, ...props }: import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
22
+ asChild?: false;
23
+ }) => import("react/jsx-runtime").JSX.Element;
24
+ } & {
25
+ Root: typeof DialogRoot;
26
+ Content: typeof DialogContent;
27
+ Title: typeof DialogTitle;
28
+ Description: typeof DialogDescription;
29
+ Close: typeof DialogClose;
30
+ };
31
+ type DialogRootProps = {
32
+ open: boolean;
33
+ onOpenChange: (open: boolean) => void;
34
+ children: ReactNode;
35
+ };
36
+ declare function DialogRoot({ open, onOpenChange, children }: DialogRootProps): import("react/jsx-runtime").JSX.Element;
37
+ type DialogContentProps = Omit<ModalProps, 'open' | 'onOpenChange' | 'children' | 'ariaLabelledBy' | 'ariaDescribedBy'> & {
38
+ children: ReactNode;
39
+ className?: string;
40
+ style?: CSSProperties;
41
+ onKeyDown?: KeyboardEventHandler<HTMLDivElement>;
42
+ onOpenAutoFocus?: (event: {
43
+ preventDefault: () => void;
44
+ }) => void;
45
+ onEscapeKeyDown?: (event: {
46
+ preventDefault: () => void;
47
+ }) => void;
48
+ };
49
+ declare function DialogContent({ children, className, style, ...props }: DialogContentProps): import("react/jsx-runtime").JSX.Element | null;
50
+ type DialogTitleProps = {
51
+ children: ReactNode;
52
+ } & SystemProps & {
53
+ className?: string;
54
+ style?: CSSProperties;
55
+ };
56
+ declare function DialogTitle({ children, className, style, ...props }: DialogTitleProps): import("react/jsx-runtime").JSX.Element;
57
+ type DialogDescriptionProps = {
58
+ children: ReactNode;
59
+ size?: number | string;
60
+ } & SystemProps & {
61
+ className?: string;
62
+ style?: CSSProperties;
63
+ };
64
+ declare function DialogDescription({ children, className, style, size: _size, ...props }: DialogDescriptionProps): import("react/jsx-runtime").JSX.Element;
65
+ type DialogCloseProps = {
66
+ children: ReactNode;
67
+ };
68
+ declare function DialogClose({ children }: DialogCloseProps): import("react/jsx-runtime").JSX.Element;
69
+ export {};
2
70
  //# sourceMappingURL=Dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.t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,IAAI,CAAC;CACnE,CAAC;AAEF,iBAAS,aAAa,CAAC,EAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,EAAC,EAAE,kBAAkB,kDA2BhF;AAED,KAAK,gBAAgB,GAAG;IACpB,QAAQ,EAAE,SAAS,CAAC;CACvB,GAAG,WAAW,GAAG;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,iBAAS,WAAW,CAAC,EAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,EAAC,EAAE,gBAAgB,2CAa5E;AAED,KAAK,sBAAsB,GAAG;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B,GAAG,WAAW,GAAG;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,iBAAS,iBAAiB,CAAC,EACvB,QAAQ,EACR,SAAS,EACT,KAAK,EACL,IAAI,EAAE,KAAK,EACX,GAAG,KAAK,EACX,EAAE,sBAAsB,2CAaxB;AAED,KAAK,gBAAgB,GAAG;IACpB,QAAQ,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,iBAAS,WAAW,CAAC,EAAC,QAAQ,EAAC,EAAE,gBAAgB,2CAehD"}
@@ -1 +1,48 @@
1
- export { Modal as Dialog } from '../Modal/Modal';
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createContext, useContext, useId, } from 'react';
4
+ import { Modal } from '../Modal/Modal';
5
+ import { splitSystemProps } from '../../theme/systemProps';
6
+ import { cn } from '../../utils/cn';
7
+ export const Dialog = Object.assign(Modal, {
8
+ Root: DialogRoot,
9
+ Content: DialogContent,
10
+ Title: DialogTitle,
11
+ Description: DialogDescription,
12
+ Close: DialogClose,
13
+ });
14
+ const DialogContext = createContext(null);
15
+ function DialogRoot({ open, onOpenChange, children }) {
16
+ return (_jsx(DialogContext.Provider, { value: { open, onOpenChange }, children: children }));
17
+ }
18
+ function DialogContent({ children, className, style, ...props }) {
19
+ const context = useContext(DialogContext);
20
+ const titleId = useId();
21
+ const descriptionId = useId();
22
+ if (!context)
23
+ return null;
24
+ return (_jsx(DialogContext.Provider, { value: {
25
+ ...context,
26
+ titleId,
27
+ descriptionId,
28
+ }, children: _jsx(Modal, { ...props, open: context.open, onOpenChange: context.onOpenChange, ariaLabelledBy: titleId, ariaDescribedBy: descriptionId, contentClassName: className, contentStyle: style, children: children }) }));
29
+ }
30
+ function DialogTitle({ children, className, style, ...props }) {
31
+ const context = useContext(DialogContext);
32
+ const { systemStyle, restProps } = splitSystemProps(props);
33
+ return (_jsx("h2", { id: context?.titleId, className: cn('oui-modal-title', className), style: { ...systemStyle, ...style }, ...restProps, children: children }));
34
+ }
35
+ function DialogDescription({ children, className, style, size: _size, ...props }) {
36
+ const context = useContext(DialogContext);
37
+ const { systemStyle, restProps } = splitSystemProps(props);
38
+ return (_jsx("p", { id: context?.descriptionId, className: cn('oui-modal-description', className), style: { ...systemStyle, ...style }, ...restProps, children: children }));
39
+ }
40
+ function DialogClose({ children }) {
41
+ const context = useContext(DialogContext);
42
+ return (_jsx("span", { onClick: () => context?.onOpenChange(false), onKeyDown: (event) => {
43
+ if (event.key === 'Enter' || event.key === ' ') {
44
+ event.preventDefault();
45
+ context?.onOpenChange(false);
46
+ }
47
+ }, children: children }));
48
+ }
@@ -21,10 +21,11 @@ export type DrawerProps = {
21
21
  panelClassName?: string;
22
22
  bodyClassName?: string;
23
23
  backdropClassName?: string;
24
+ portalContainer?: HTMLElement | null;
24
25
  style?: CSSProperties;
25
26
  panelStyle?: CSSProperties;
26
27
  backdropStyle?: CSSProperties;
27
28
  testId?: string;
28
29
  };
29
- export declare function Drawer({ open, defaultOpen, onOpenChange, side, size, title, description, children, footer, modal, trapFocus, lockScroll, closeOnBackdropClick, closeOnEscape, showBackdrop, showCloseButton, className, panelClassName, bodyClassName, backdropClassName, style, panelStyle, backdropStyle, testId, }: DrawerProps): import("react/jsx-runtime").JSX.Element | null;
30
+ export declare function Drawer({ open, defaultOpen, onOpenChange, side, size, title, description, children, footer, modal, trapFocus, lockScroll, closeOnBackdropClick, closeOnEscape, showBackdrop, showCloseButton, className, panelClassName, bodyClassName, backdropClassName, portalContainer, style, panelStyle, backdropStyle, testId, }: DrawerProps): import("react/jsx-runtime").JSX.Element | null;
30
31
  //# sourceMappingURL=Drawer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,aAAa,EAClB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAiBf,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAE7D,MAAM,MAAM,WAAW,GAAG;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EA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,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,MAAM,CAAC,EACnB,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,IAAc,EACd,IAAI,EACJ,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,KAAY,EACZ,SAAiB,EACjB,UAAkB,EAClB,oBAA2B,EAC3B,aAAoB,EACpB,YAAoB,EACpB,eAAsB,EACtB,SAAS,EACT,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,KAAK,EACL,UAAU,EACV,aAAa,EACb,MAAM,GACT,EAAE,WAAW,kDAqHb"}
@@ -9,9 +9,9 @@ import { useOrcestrUiLocale } from '../../locale/LocaleProvider';
9
9
  import { OrcestrThemeContext } from '../../theme/useTheme';
10
10
  import { cn } from '../../utils/cn';
11
11
  import { IconButton } from '../IconButton/IconButton';
12
- import { lockOverlayScroll, useOverlayContext, useOverlayLayerIndex, } from '../Overlay/OverlayProvider';
12
+ import { lockOverlayScroll, overlayLayerZIndex, useOverlayContext, useOverlayLayerIndex, } from '../Overlay/OverlayProvider';
13
13
  import { Portal } from '../Portal/Portal';
14
- export function Drawer({ open, defaultOpen, onOpenChange, side = 'right', size, title, description, children, footer, modal = true, trapFocus = modal, lockScroll = modal, closeOnBackdropClick = true, closeOnEscape = true, showBackdrop = modal, showCloseButton = true, className, panelClassName, bodyClassName, backdropClassName, style, panelStyle, backdropStyle, testId, }) {
14
+ export function Drawer({ open, defaultOpen, onOpenChange, side = 'right', size, title, description, children, footer, modal = true, trapFocus = modal, lockScroll = modal, closeOnBackdropClick = true, closeOnEscape = true, showBackdrop = modal, showCloseButton = true, className, panelClassName, bodyClassName, backdropClassName, portalContainer, style, panelStyle, backdropStyle, testId, }) {
15
15
  const { copy } = useOrcestrUiLocale();
16
16
  const themeContext = useContext(OrcestrThemeContext);
17
17
  const overlay = useOverlayContext();
@@ -22,7 +22,7 @@ export function Drawer({ open, defaultOpen, onOpenChange, side = 'right', size,
22
22
  const ease = themeContext?.theme.motion.ease ?? 'cubic-bezier(0.22, 1, 0.36, 1)';
23
23
  const { present, state } = usePresence(isOpen, durationMs);
24
24
  const layerIndex = useOverlayLayerIndex(present);
25
- const zIndex = overlay.zIndex.modal + layerIndex * 20;
25
+ const zIndex = overlayLayerZIndex(overlay.zIndex, 'modal', layerIndex);
26
26
  const panelRef = useRef(null);
27
27
  const titleId = useId();
28
28
  const descriptionId = useId();
@@ -54,7 +54,7 @@ export function Drawer({ open, defaultOpen, onOpenChange, side = 'right', size,
54
54
  }, [lockScroll, present]);
55
55
  if (!present)
56
56
  return null;
57
- return (_jsx(Portal, { children: _jsxs("div", { className: cn('oui-drawer-layer', className), "data-state": state, "data-side": side, "data-modal": modal ? 'true' : undefined, "data-testid": testId, style: drawerStyle, children: [showBackdrop ? (_jsx("button", { type: 'button', "aria-label": copy.common.close, className: cn('oui-drawer-backdrop', backdropClassName), "data-state": state, "data-testid": testId ? `${testId}-backdrop` : undefined, style: backdropStyle, onClick: () => {
57
+ return (_jsx(Portal, { container: portalContainer, children: _jsxs("div", { className: cn('oui-drawer-layer', className), "data-state": state, "data-side": side, "data-modal": modal ? 'true' : undefined, "data-testid": testId, style: drawerStyle, children: [showBackdrop ? (_jsx("button", { type: 'button', "aria-label": copy.common.close, className: cn('oui-drawer-backdrop', backdropClassName), "data-state": state, "data-testid": testId ? `${testId}-backdrop` : undefined, style: backdropStyle, onClick: () => {
58
58
  if (closeOnBackdropClick)
59
59
  setOpen(false);
60
60
  } })) : null, _jsxs("div", { ref: panelRef, role: modal ? 'dialog' : 'complementary', "aria-modal": modal ? 'true' : undefined, "aria-labelledby": title ? titleId : undefined, "aria-describedby": description ? descriptionId : undefined, className: cn('oui-drawer-panel', panelClassName), "data-state": state, "data-side": side, "data-testid": testId ? `${testId}-panel` : undefined, style: panelStyle, children: [title || description || showCloseButton ? (_jsxs("div", { className: 'oui-drawer-header', children: [_jsxs("div", { className: 'oui-drawer-title-wrap', children: [title ? (_jsx("h2", { id: titleId, className: 'oui-drawer-title', children: title })) : null, description ? (_jsx("p", { id: descriptionId, className: 'oui-drawer-description', children: description })) : null] }), showCloseButton ? (_jsx(IconButton, { v: 'ghost', icon: _jsx(LuX, { size: 18 }), "aria-label": copy.common.close, onClick: () => setOpen(false) })) : null] })) : null, _jsx("div", { className: cn('oui-drawer-body', bodyClassName), children: children }), footer ? _jsx("div", { className: 'oui-drawer-footer', children: footer }) : null] })] }) }));
@@ -27,6 +27,7 @@ export type EntityPickerProps<T> = {
27
27
  disabled?: boolean;
28
28
  clearable?: boolean;
29
29
  showChevron?: boolean;
30
+ trigger?: ReactNode;
30
31
  size?: UiSize;
31
32
  maxHeight?: number;
32
33
  closeOnSelect?: boolean;
@@ -37,5 +38,5 @@ export type EntityPickerProps<T> = {
37
38
  debounceMs?: number;
38
39
  testId?: string;
39
40
  };
40
- export declare function EntityPicker<T>({ loadPage, getEntityId, renderEntity, renderValue, value, onValueChange, placeholder, emptyText, loadingText, errorText, retryLabel, disabled, clearable, showChevron, size, maxHeight, closeOnSelect, isEntitySelected, createAction, optionAction, resetKey, debounceMs, testId, }: EntityPickerProps<T>): import("react/jsx-runtime").JSX.Element;
41
+ export declare function EntityPicker<T>({ loadPage, getEntityId, renderEntity, renderValue, value, onValueChange, placeholder, emptyText, loadingText, errorText, retryLabel, disabled, clearable, showChevron, trigger, size, maxHeight, closeOnSelect, isEntitySelected, createAction, optionAction, resetKey, debounceMs, testId, }: EntityPickerProps<T>): import("react/jsx-runtime").JSX.Element;
41
42
  //# sourceMappingURL=EntityPicker.d.ts.map