@servicetitan/anvil2 1.46.3 → 1.46.4

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 (48) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/{Calendar-Cn0fOgog.js → Calendar-BqOvsaby.js} +148 -148
  3. package/dist/{Calendar-Cn0fOgog.js.map → Calendar-BqOvsaby.js.map} +1 -1
  4. package/dist/Calendar.js +1 -1
  5. package/dist/{DateField-qHdgwSlB.js → DateField-DLqKbCcm.js} +2 -2
  6. package/dist/{DateField-qHdgwSlB.js.map → DateField-DLqKbCcm.js.map} +1 -1
  7. package/dist/DateField.js +1 -1
  8. package/dist/{DateFieldRange-GNpWV70g.js → DateFieldRange-DI-iF-sd.js} +3 -3
  9. package/dist/{DateFieldRange-GNpWV70g.js.map → DateFieldRange-DI-iF-sd.js.map} +1 -1
  10. package/dist/DateFieldRange.js +1 -1
  11. package/dist/{DateFieldSingle-B9caNibj.js → DateFieldSingle-BXakaSIE.js} +3 -3
  12. package/dist/{DateFieldSingle-B9caNibj.js.map → DateFieldSingle-BXakaSIE.js.map} +1 -1
  13. package/dist/DateFieldSingle.js +1 -1
  14. package/dist/{Dialog-BHFLnFNQ.js → Dialog-xsgqM6e1.js} +10 -17
  15. package/dist/Dialog-xsgqM6e1.js.map +1 -0
  16. package/dist/Dialog.js +1 -1
  17. package/dist/DndSort.js +46 -6
  18. package/dist/DndSort.js.map +1 -1
  19. package/dist/{Drawer-BDA7Sjj9.js → Drawer-DpN7wUNy.js} +11 -18
  20. package/dist/Drawer-DpN7wUNy.js.map +1 -0
  21. package/dist/Drawer.js +1 -1
  22. package/dist/{Page-BfH2mGSt.js → Page-CRuqAlNu.js} +2 -2
  23. package/dist/{Page-BfH2mGSt.js.map → Page-CRuqAlNu.js.map} +1 -1
  24. package/dist/Page.js +1 -1
  25. package/dist/{Toolbar-BXGTrR6o.js → Toolbar-DNErV9v8.js} +5 -5
  26. package/dist/{Toolbar-BXGTrR6o.js.map → Toolbar-DNErV9v8.js.map} +1 -1
  27. package/dist/Toolbar.js +1 -1
  28. package/dist/beta.js +1 -1
  29. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  30. package/dist/components/Dialog/internal/useInitialFocus.d.ts +15 -0
  31. package/dist/components/DndSort/internal/DndSortOverlay.d.ts +1 -1
  32. package/dist/components/NumberField/NumberField.d.ts +2 -2
  33. package/dist/components/Radio/Radio.d.ts +1 -1
  34. package/dist/index.js +7 -7
  35. package/dist/internal/components/index.d.ts +1 -0
  36. package/dist/internal/hooks/index.d.ts +2 -2
  37. package/dist/internal/hooks/usePlatform/index.d.ts +1 -1
  38. package/dist/internal/index.d.ts +5 -0
  39. package/dist/internal/types/argTypes.d.ts +154 -0
  40. package/dist/internal/types/index.d.ts +1 -0
  41. package/dist/{useKeyboardFocusables-ek2mYel-.js → useInitialFocus-CAFMgbJG.js} +27 -2
  42. package/dist/useInitialFocus-CAFMgbJG.js.map +1 -0
  43. package/dist/{utils-CnKBdBNm.js → utils-Dh3aegV3.js} +2 -2
  44. package/dist/{utils-CnKBdBNm.js.map → utils-Dh3aegV3.js.map} +1 -1
  45. package/package.json +1 -1
  46. package/dist/Dialog-BHFLnFNQ.js.map +0 -1
  47. package/dist/Drawer-BDA7Sjj9.js.map +0 -1
  48. package/dist/useKeyboardFocusables-ek2mYel-.js.map +0 -1
package/dist/Toolbar.js CHANGED
@@ -1,2 +1,2 @@
1
- export { T as Toolbar, a as ToolbarButton, c as ToolbarButtonLink, b as ToolbarButtonToggle, e as ToolbarControlGroup, g as ToolbarElement, f as ToolbarSearchField, d as ToolbarSelect, T as default } from './Toolbar-BXGTrR6o.js';
1
+ export { T as Toolbar, a as ToolbarButton, c as ToolbarButtonLink, b as ToolbarButtonToggle, e as ToolbarControlGroup, g as ToolbarElement, f as ToolbarSearchField, d as ToolbarSelect, T as default } from './Toolbar-DNErV9v8.js';
2
2
  //# sourceMappingURL=Toolbar.js.map
package/dist/beta.js CHANGED
@@ -1,2 +1,2 @@
1
- export { T as Toolbar, a as ToolbarButton, c as ToolbarButtonLink, b as ToolbarButtonToggle, e as ToolbarControlGroup, g as ToolbarElement, f as ToolbarSearchField, d as ToolbarSelect } from './Toolbar-BXGTrR6o.js';
1
+ export { T as Toolbar, a as ToolbarButton, c as ToolbarButtonLink, b as ToolbarButtonToggle, e as ToolbarControlGroup, g as ToolbarElement, f as ToolbarSearchField, d as ToolbarSelect } from './Toolbar-DNErV9v8.js';
2
2
  //# sourceMappingURL=beta.js.map
@@ -58,7 +58,7 @@ export declare const Checkbox: import('react').ForwardRefExoticComponent<Omit<Co
58
58
  * <Checkbox label="Music" />
59
59
  * </CheckboxGroup>
60
60
  */
61
- Group: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref"> & import('..').LayoutUtilProps & Omit<import('../../internal/types').FieldLabelProps, "labelProps"> & {
61
+ Group: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref"> & import('..').LayoutUtilProps & Omit<import('../../internal').FieldLabelProps, "labelProps"> & {
62
62
  required?: boolean;
63
63
  legend: string | import('react').ReactElement;
64
64
  } & import('react').RefAttributes<HTMLFieldSetElement>>;
@@ -0,0 +1,15 @@
1
+ import { RefObject } from 'react';
2
+ import { FocusableElement } from 'tabbable';
3
+ export type InitialFocusOptions = {
4
+ /**
5
+ * Function to pick the initial focus target, given an array of focusable elements
6
+ */
7
+ computeFocus?: (focusables: FocusableElement[]) => FocusableElement;
8
+ };
9
+ /**
10
+ * Hook to set initial focus for a dialog (e.g. Dialog, Drawer) when it is opened.
11
+ * @param dialogRef - Ref to the dialog element
12
+ * @param options - Options for the hook
13
+ * @param options.computeFocus - Function to pick the initial focus target, given an array of focusable elements
14
+ */
15
+ export declare const useInitialFocus: (dialogRef: RefObject<HTMLDialogElement>, { computeFocus }: InitialFocusOptions) => void;
@@ -2,4 +2,4 @@
2
2
  * Component for rendering previews as items are dragged.
3
3
  * The preview is determined by the rendering function stored in context.
4
4
  */
5
- export default function DndSortOverlay(): import("react/jsx-runtime").JSX.Element | null;
5
+ export default function DndSortOverlay(): import("react/jsx-runtime").JSX.Element;
@@ -25,8 +25,8 @@ export type NumberFieldProps = Omit<ComponentPropsWithoutRef<"input">, "size" |
25
25
  onBlur?: (event: React.FocusEvent) => void;
26
26
  hideControls?: boolean;
27
27
  } & DataTrackingId;
28
- export declare const NumberField: import('react').ForwardRefExoticComponent<Omit<Omit<import('react').DetailedHTMLProps<import('react').InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "size" | "value" | "onBlur" | "onFocus" | "onChange" | "defaultValue" | "prefix" | "inputMode" | "type"> & LayoutUtilProps & Pick<import('../../internal/components').LabelProps, "required" | "moreInfo"> & {
29
- labelProps?: Omit<import('../../internal/components').LabelProps, "children" | "moreInfo" | "required" | "id" | "htmlFor">;
28
+ export declare const NumberField: import('react').ForwardRefExoticComponent<Omit<Omit<import('react').DetailedHTMLProps<import('react').InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "size" | "value" | "onBlur" | "onFocus" | "onChange" | "defaultValue" | "prefix" | "inputMode" | "type"> & LayoutUtilProps & Pick<import('../../internal').LabelProps, "required" | "moreInfo"> & {
29
+ labelProps?: Omit<import('../../internal').LabelProps, "children" | "moreInfo" | "required" | "id" | "htmlFor">;
30
30
  } & {
31
31
  error?: ReactElement | string | boolean;
32
32
  label?: string;
@@ -87,7 +87,7 @@ export declare const Radio: import('react').ForwardRefExoticComponent<Omit<CoreR
87
87
  * <Radio label="No" value="no" />
88
88
  * </RadioGroup>
89
89
  */
90
- Group: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref"> & import('..').LayoutUtilProps & Omit<import('../../internal/types').FieldLabelProps, "labelProps"> & {
90
+ Group: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref"> & import('..').LayoutUtilProps & Omit<import('../../internal').FieldLabelProps, "labelProps"> & {
91
91
  required?: boolean;
92
92
  legend?: string | import('react').ReactElement;
93
93
  } & import('react').RefAttributes<HTMLFieldSetElement>>;
package/dist/index.js CHANGED
@@ -9,23 +9,23 @@ import { B as Button } from './Button-VNQQgZ45.js';
9
9
  export { B as ButtonCompound } from './ButtonCompound-BbPK-Xjj.js';
10
10
  import { B as ButtonLink } from './ButtonLink-CqR1F5Wn.js';
11
11
  import { B as ButtonToggle } from './ButtonToggle-PCeSG-5D.js';
12
- export { C as Calendar, f as CalendarMonth, e as CalendarMonthButton, d as CalendarNext, a as CalendarNow, c as CalendarPrev, b as CalendarYearButton } from './Calendar-Cn0fOgog.js';
12
+ export { C as Calendar, f as CalendarMonth, e as CalendarMonthButton, d as CalendarNext, a as CalendarNow, c as CalendarPrev, b as CalendarYearButton } from './Calendar-BqOvsaby.js';
13
13
  export { C as Card } from './Card-vTYeSkxt.js';
14
14
  export { C as Checkbox } from './Checkbox-DAODkzN3.js';
15
15
  export { C as CheckboxGroup } from './Checkbox-C5PX8wur.js';
16
16
  export { C as Chip } from './Chip-DLU13qe-.js';
17
17
  export { C as Combobox, c as ComboboxContent, a as ComboboxElement, i as ComboboxEmpty, e as ComboboxItem, f as ComboboxItemAddNew, d as ComboboxList, g as ComboboxSearchField, b as ComboboxSelect, h as ComboboxSelectTrigger } from './Combobox-DO8cIvRQ.js';
18
18
  export { u as useInfiniteCombobox } from './useInfiniteCombobox-WcRgC9p6.js';
19
- export { D as DateField } from './DateField-qHdgwSlB.js';
20
- export { D as DateFieldRange } from './DateFieldRange-GNpWV70g.js';
21
- export { D as DateFieldSingle } from './DateFieldSingle-B9caNibj.js';
19
+ export { D as DateField } from './DateField-DLqKbCcm.js';
20
+ export { D as DateFieldRange } from './DateFieldRange-DI-iF-sd.js';
21
+ export { D as DateFieldSingle } from './DateFieldSingle-BXakaSIE.js';
22
22
  export { D as DateFieldYearless } from './DateFieldYearless-BmeKGaDc.js';
23
23
  export { D as DaysOfTheWeek } from './DaysOfTheWeek-DPH13VCK.js';
24
24
  export { D as Details, b as DetailsContent, a as DetailsSummary } from './Details-CF8DImjw.js';
25
- export { D as Dialog, a as DialogCancelButton, b as DialogContent, c as DialogFooter, d as DialogHeader } from './Dialog-BHFLnFNQ.js';
25
+ export { D as Dialog, a as DialogCancelButton, b as DialogContent, c as DialogFooter, d as DialogHeader } from './Dialog-xsgqM6e1.js';
26
26
  export { D as Divider } from './Divider-DJe8kLf2.js';
27
27
  export { D as Dnd } from './index-DrM3iid4.js';
28
- export { D as Drawer, a as DrawerCancelButton, d as DrawerContent, b as DrawerFooter, c as DrawerHeader } from './Drawer-BDA7Sjj9.js';
28
+ export { D as Drawer, a as DrawerCancelButton, d as DrawerContent, b as DrawerFooter, c as DrawerHeader } from './Drawer-DpN7wUNy.js';
29
29
  export { E as EditCard } from './EditCard-CZzL0nx7.js';
30
30
  export { F as FieldLabel } from './FieldLabel-Bgl3iu13.js';
31
31
  export { F as FieldMessage } from './FieldMessage-B7uQ8vmr.js';
@@ -42,7 +42,7 @@ export { L as ListView, a as ListViewOption, b as ListViewOptionCell } from './L
42
42
  export { M as Menu, a as MenuItem } from './Menu-DUZqzpwg.js';
43
43
  export { N as NumberField } from './NumberField-DWPAy1eG.js';
44
44
  export { Overflow, OverflowText } from './Overflow.js';
45
- export { P as Page } from './Page-BfH2mGSt.js';
45
+ export { P as Page } from './Page-CRuqAlNu.js';
46
46
  export { P as Pagination } from './Pagination-B_G9QcHf.js';
47
47
  import { P as Popover } from './Popover-v8R920kj.js';
48
48
  export { a as PopoverButton, b as PopoverClose, c as PopoverContent, d as PopoverTrigger } from './Popover-v8R920kj.js';
@@ -1,3 +1,4 @@
1
1
  export * from './Helper';
2
2
  export * from './Shadow';
3
3
  export * from './Label';
4
+ export * from './YearSelector';
@@ -8,8 +8,8 @@ export * from './useLayoutPropsUtil';
8
8
  export * from './useNumberField';
9
9
  export * from './useOnClickOutside';
10
10
  export * from './useOpenCloseTransitionStates';
11
- export * from './useOptionallyControlledState/useOptionallyControlledState';
12
- export * from './usePlatform/usePlatform';
11
+ export * from './useOptionallyControlledState';
12
+ export * from './usePlatform';
13
13
  export * from './usePopoverCloseDelayWorkaround';
14
14
  export * from './usePopoverSupport';
15
15
  export * from './usePopoverTransitionStates';
@@ -1 +1 @@
1
- export { usePlatform } from './usePlatform';
1
+ export * from './usePlatform';
@@ -0,0 +1,5 @@
1
+ export * from './components';
2
+ export * from './functions';
3
+ export * from './hooks';
4
+ export * from './types';
5
+ export * from './utils';
@@ -0,0 +1,154 @@
1
+ export declare const argTypesLayoutProps: {
2
+ alignContent: {
3
+ table: {
4
+ category: string;
5
+ };
6
+ };
7
+ alignItems: {
8
+ table: {
9
+ category: string;
10
+ };
11
+ };
12
+ alignSelf: {
13
+ table: {
14
+ category: string;
15
+ };
16
+ };
17
+ columnGap: {
18
+ table: {
19
+ category: string;
20
+ };
21
+ };
22
+ flex: {
23
+ table: {
24
+ category: string;
25
+ };
26
+ };
27
+ flexBasis: {
28
+ table: {
29
+ category: string;
30
+ };
31
+ };
32
+ flexDirection: {
33
+ table: {
34
+ category: string;
35
+ };
36
+ };
37
+ flexGrow: {
38
+ table: {
39
+ category: string;
40
+ };
41
+ };
42
+ flexShrink: {
43
+ table: {
44
+ category: string;
45
+ };
46
+ };
47
+ gap: {
48
+ table: {
49
+ category: string;
50
+ };
51
+ };
52
+ gridArea: {
53
+ table: {
54
+ category: string;
55
+ };
56
+ };
57
+ gridColumn: {
58
+ table: {
59
+ category: string;
60
+ };
61
+ };
62
+ gridColumnEnd: {
63
+ table: {
64
+ category: string;
65
+ };
66
+ };
67
+ gridColumnStart: {
68
+ table: {
69
+ category: string;
70
+ };
71
+ };
72
+ gridRow: {
73
+ table: {
74
+ category: string;
75
+ };
76
+ };
77
+ gridRowEnd: {
78
+ table: {
79
+ category: string;
80
+ };
81
+ };
82
+ gridRowStart: {
83
+ table: {
84
+ category: string;
85
+ };
86
+ };
87
+ justifyContent: {
88
+ table: {
89
+ category: string;
90
+ };
91
+ };
92
+ justifyItems: {
93
+ table: {
94
+ category: string;
95
+ };
96
+ };
97
+ justifySelf: {
98
+ table: {
99
+ category: string;
100
+ };
101
+ };
102
+ order: {
103
+ table: {
104
+ category: string;
105
+ };
106
+ };
107
+ placeContent: {
108
+ table: {
109
+ category: string;
110
+ };
111
+ };
112
+ placeItems: {
113
+ table: {
114
+ category: string;
115
+ };
116
+ };
117
+ placeSelf: {
118
+ table: {
119
+ category: string;
120
+ };
121
+ };
122
+ rowGap: {
123
+ table: {
124
+ category: string;
125
+ };
126
+ };
127
+ };
128
+ export declare const argTypesResponsiveSizes: {
129
+ sm: {
130
+ table: {
131
+ category: string;
132
+ };
133
+ };
134
+ md: {
135
+ table: {
136
+ category: string;
137
+ };
138
+ };
139
+ lg: {
140
+ table: {
141
+ category: string;
142
+ };
143
+ };
144
+ xl: {
145
+ table: {
146
+ category: string;
147
+ };
148
+ };
149
+ xxl: {
150
+ table: {
151
+ category: string;
152
+ };
153
+ };
154
+ };
@@ -1 +1,2 @@
1
+ export * from './argTypes.ts';
1
2
  export * from './props.ts';
@@ -101,5 +101,30 @@ const useKeyboardFocusables = (element, options = {
101
101
  return { focusables };
102
102
  };
103
103
 
104
- export { useKeyboardFocusables as a, useDialogScrollLock as b, useDialogTransitionStates as u };
105
- //# sourceMappingURL=useKeyboardFocusables-ek2mYel-.js.map
104
+ const useInitialFocus = (dialogRef, { computeFocus }) => {
105
+ useEffect(() => {
106
+ if (!dialogRef.current) {
107
+ return () => {
108
+ };
109
+ }
110
+ const observer = new MutationObserver((mutations) => {
111
+ mutations.forEach((mutation) => {
112
+ if (mutation.attributeName === "open" && mutation.target === dialogRef.current && mutation.target instanceof HTMLDialogElement && mutation.target.open === true) {
113
+ const focusables = tabbable(dialogRef.current);
114
+ const target = computeFocus?.(focusables) || focusables[0];
115
+ target?.focus();
116
+ }
117
+ });
118
+ });
119
+ observer.observe(dialogRef.current, {
120
+ attributes: true,
121
+ attributeFilter: ["open"]
122
+ });
123
+ return () => {
124
+ observer.disconnect();
125
+ };
126
+ }, [dialogRef, computeFocus]);
127
+ };
128
+
129
+ export { useKeyboardFocusables as a, useDialogScrollLock as b, useInitialFocus as c, useDialogTransitionStates as u };
130
+ //# sourceMappingURL=useInitialFocus-CAFMgbJG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInitialFocus-CAFMgbJG.js","sources":["../src/internal/hooks/useDialogScrollLock/useDialogScrollLock.ts","../src/internal/hooks/useDialogTransitionStates/useDialogTransitionStates.ts","../src/internal/hooks/useKeyboardFocusables/useKeyboardFocusables.ts","../src/components/Dialog/internal/useInitialFocus.ts"],"sourcesContent":["import { useEffect } from \"react\";\n\nconst ATTRIBUTE_NAME_LIST = \"data-anv-dialogs\";\nconst ATTRIBUTE_NAME_BOOL = \"data-anv-dialogs-open\";\n\n/**\n * Props for the useDialogScrollLock hook\n * @property {boolean} open - Whether the dialog is open\n * @property {string} id - Unique identifier for the dialog\n * @property {boolean} [enableScrollChaining] - Whether to enable scroll chaining\n * @property {React.RefObject<HTMLElement>} elementRef - Reference to the dialog element\n */\nexport interface UseDialogScrollLockProps {\n /**\n * Whether the dialog is open\n */\n open: boolean;\n /**\n * Unique identifier for the dialog\n */\n id: string;\n /**\n * Whether to enable scroll chaining\n */\n enableScrollChaining?: boolean;\n /**\n * Reference to the dialog element\n */\n elementRef: React.RefObject<HTMLElement>;\n}\n\n/**\n * Custom hook for managing dialog scroll lock in shadow DOM environments.\n *\n * Features:\n * - Manages scroll lock state for dialogs in shadow DOM\n * - Tracks multiple open dialogs with unique IDs\n * - Prevents scroll chaining when dialogs are open\n * - Automatically cleans up scroll lock on unmount\n * - Supports enabling/disabling scroll chaining\n * - Uses data attributes to track dialog state\n *\n * @param props - Configuration object containing dialog state and element reference\n * @returns void\n */\nexport const useDialogScrollLock = ({\n open,\n id,\n enableScrollChaining,\n elementRef,\n}: UseDialogScrollLockProps) => {\n useEffect(() => {\n if (enableScrollChaining) return () => {};\n const root = elementRef.current?.getRootNode();\n if (!(root instanceof ShadowRoot)) return () => {};\n\n const updateDialogAttributes = (shouldAdd: boolean) => {\n const currentDialogs =\n root.host\n .getAttribute(ATTRIBUTE_NAME_LIST)\n ?.split(\" \")\n .filter(Boolean) ?? [];\n\n const newDialogs = new Set(currentDialogs);\n if (shouldAdd) {\n newDialogs.add(id);\n } else {\n newDialogs.delete(id);\n }\n\n const dialogList = Array.from(newDialogs);\n root.host.setAttribute(ATTRIBUTE_NAME_LIST, dialogList.join(\" \"));\n\n if (dialogList.length > 0) {\n root.host.setAttribute(ATTRIBUTE_NAME_BOOL, \"true\");\n } else {\n root.host.removeAttribute(ATTRIBUTE_NAME_BOOL);\n }\n };\n\n updateDialogAttributes(open);\n\n return () => {\n updateDialogAttributes(false);\n };\n }, [open, id, enableScrollChaining, elementRef]);\n};\n","import { RefObject } from \"react\";\nimport {\n useOpenCloseTransitionStates,\n type OpenCloseTransitionStateEffects,\n} from \"../useOpenCloseTransitionStates\";\n\n/**\n * Effects configuration for dialog transition states\n * @property {() => void} [onOpenAnimationStart] - Callback when opening animation starts\n * @property {() => void} [onCloseAnimationStart] - Callback when closing animation starts\n * @property {() => void} [onOpenAnimationComplete] - Callback when opening animation completes\n * @property {() => void} [onCloseAnimationComplete] - Callback when closing animation completes\n */\n\n/**\n * Custom hook for managing dialog transition states and animations.\n *\n * Features:\n * - Manages dialog open/close transition states\n * - Handles animation timing based on CSS animation duration\n * - Provides callbacks for animation lifecycle events\n * - Supports controlled dialog state management\n * - Automatically handles showModal() and close() calls\n * - Provides utility flags for open/closed states\n *\n * @param ref - The ref to the dialog element\n * @param openProp - The open prop controlling dialog visibility\n * @param options - Additional, optional options including callbacks for animation start, complete, and initialization\n * @returns Object containing dialog state, control functions, and utility flags\n */\n\n/**\n * Effects configuration for dialog transition states\n * @param openProp - The open prop controlling dialog visibility\n * @param options - The effects configuration\n * @returns The dialog transition state\n */\nexport const useDialogTransitionStates = (\n ref: RefObject<HTMLDialogElement>,\n openProp: boolean | undefined,\n options: OpenCloseTransitionStateEffects = {},\n) => {\n const { onOpenAnimationStart, onCloseAnimationComplete } = options;\n return useOpenCloseTransitionStates(openProp, {\n ...options,\n onOpenAnimationStart: () => {\n if (!ref.current) return;\n ref.current.showModal();\n onOpenAnimationStart?.();\n },\n onCloseAnimationComplete: () => {\n if (!ref.current) return;\n ref.current.close();\n onCloseAnimationComplete?.();\n },\n durationMs: () => {\n if (!ref.current || !window) return 0;\n const duration = window.getComputedStyle(ref.current).animationDuration;\n return parseFloat(duration) * 1000;\n },\n });\n};\n","import { RefObject, useEffect, useRef, useState } from \"react\";\nimport { FocusableElement, tabbable } from \"tabbable\";\n\n/**\n * Options for the useKeyboardFocusables hook\n */\ntype OptionProps =\n | {\n /**\n * Disable mutation observer\n */\n observeChange: false;\n }\n | {\n /**\n * Enable mutation observer with optional configuration\n */\n observeChange: true;\n /**\n * Observe attribute changes\n */\n attributes?: boolean;\n /**\n * Observe text content changes\n */\n characterData?: boolean;\n /**\n * Observe child element changes\n */\n childList?: boolean;\n /**\n * Observe descendant changes\n */\n subtree?: boolean;\n };\n\n/**\n * Custom hook for tracking keyboard focusable elements within a container.\n *\n * Features:\n * - Tracks all keyboard focusable elements within a target container\n * - Supports both ref objects and direct element references\n * - Optional mutation observer for real-time updates\n * - Debounced updates to prevent excessive re-renders\n * - Configurable mutation observer options\n * - Manual update function for immediate refresh\n * - Uses tabbable library for accurate focusable detection\n * - Automatically cleans up mutation observer\n *\n * @param element - Target element or ref to monitor for focusable elements\n * @param options - Configuration options for mutation observer behavior\n * @returns Object containing current focusable elements and update function\n */\nexport const useKeyboardFocusables = (\n element: RefObject<HTMLElement> | HTMLElement | undefined,\n options: OptionProps = {\n observeChange: true,\n attributes: true,\n characterData: true,\n childList: true,\n subtree: true,\n },\n) => {\n const [focusables, setFocusables] = useState<FocusableElement[] | null>(null);\n const observerRef = useRef<MutationObserver>();\n\n useEffect(() => {\n const target = element instanceof HTMLElement ? element : element?.current;\n if (!target) return;\n if (!options.observeChange && !focusables) {\n setFocusables(tabbable(target as Element));\n return;\n }\n\n const mutationCallback = () => {\n const targetArr = tabbable(target as Element);\n if (targetArr.length === 0) return;\n setFocusables(targetArr);\n };\n\n const observer = new MutationObserver(mutationCallback);\n observerRef.current = observer;\n observer.observe(target, {\n childList: true, // Observe changes to child elements\n subtree: true, // Observe changes to descendants of the target\n attributes: true, // Observe changes to attributes\n characterData: true, // Observe changes to text content\n });\n return () => {\n observer.disconnect();\n };\n }, [element, options, focusables]);\n\n return { focusables };\n};\n","import { RefObject, useEffect } from \"react\";\nimport { FocusableElement, tabbable } from \"tabbable\";\n\nexport type InitialFocusOptions = {\n /**\n * Function to pick the initial focus target, given an array of focusable elements\n */\n computeFocus?: (focusables: FocusableElement[]) => FocusableElement;\n};\n\n/**\n * Hook to set initial focus for a dialog (e.g. Dialog, Drawer) when it is opened.\n * @param dialogRef - Ref to the dialog element\n * @param options - Options for the hook\n * @param options.computeFocus - Function to pick the initial focus target, given an array of focusable elements\n */\nexport const useInitialFocus = (\n /**\n * Ref to the dialog element\n */\n dialogRef: RefObject<HTMLDialogElement>,\n { computeFocus }: InitialFocusOptions,\n) => {\n useEffect(() => {\n if (!dialogRef.current) {\n return () => {};\n }\n // Create a MutationObserver to check if dialogRef.current is open or closed\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n if (\n mutation.attributeName === \"open\" &&\n mutation.target === dialogRef.current &&\n mutation.target instanceof HTMLDialogElement &&\n mutation.target.open === true\n ) {\n const focusables = tabbable(dialogRef.current);\n const target = computeFocus?.(focusables) || focusables[0];\n target?.focus();\n }\n });\n });\n observer.observe(dialogRef.current, {\n attributes: true,\n attributeFilter: [\"open\"],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,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,UAAU,OAAA,EAAS;AACtB,MAAA,OAAO,MAAM;AAAA,MAAC,CAAA;AAAA,IAChB;AAEA,IAAA,MAAM,QAAA,GAAW,IAAI,gBAAA,CAAiB,CAAC,SAAA,KAAc;AACnD,MAAA,SAAA,CAAU,OAAA,CAAQ,CAAC,QAAA,KAAa;AAC9B,QAAA,IACE,QAAA,CAAS,aAAA,KAAkB,MAAA,IAC3B,QAAA,CAAS,MAAA,KAAW,SAAA,CAAU,OAAA,IAC9B,QAAA,CAAS,MAAA,YAAkB,iBAAA,IAC3B,QAAA,CAAS,MAAA,CAAO,SAAS,IAAA,EACzB;AACA,UAAA,MAAM,UAAA,GAAa,QAAA,CAAS,SAAA,CAAU,OAAO,CAAA;AAC7C,UAAA,MAAM,MAAA,GAAS,YAAA,GAAe,UAAU,CAAA,IAAK,WAAW,CAAC,CAAA;AACzD,UAAA,MAAA,EAAQ,KAAA,EAAM;AAAA,QAChB;AAAA,MACF,CAAC,CAAA;AAAA,IACH,CAAC,CAAA;AACD,IAAA,QAAA,CAAS,OAAA,CAAQ,UAAU,OAAA,EAAS;AAAA,MAClC,UAAA,EAAY,IAAA;AAAA,MACZ,eAAA,EAAiB,CAAC,MAAM;AAAA,KACzB,CAAA;AACD,IAAA,OAAO,MAAM;AACX,MAAA,QAAA,CAAS,UAAA,EAAW;AAAA,IACtB,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,SAAA,EAAW,YAAY,CAAC,CAAA;AAC9B;;;;"}
@@ -1,4 +1,4 @@
1
- import { D as DateTime } from './Calendar-Cn0fOgog.js';
1
+ import { D as DateTime } from './Calendar-BqOvsaby.js';
2
2
 
3
3
  const DateModeToFormatMap = {
4
4
  "mm/dd/yyyy": "MM/dd/yyyy",
@@ -47,4 +47,4 @@ function validateDate({
47
47
  }
48
48
 
49
49
  export { DateModeToPlaceholderMap as D, DateModeToFormatMap as a, convertStringToDate as c, validateDate as v };
50
- //# sourceMappingURL=utils-CnKBdBNm.js.map
50
+ //# sourceMappingURL=utils-Dh3aegV3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-CnKBdBNm.js","sources":["../src/components/DateFieldSingle/internal/constants.ts","../src/components/DateFieldSingle/internal/utils.ts"],"sourcesContent":["import { DateMode } from \"../types\";\n\nexport const DateModeToFormatMap: Record<DateMode, string> = {\n \"mm/dd/yyyy\": \"MM/dd/yyyy\",\n \"dd/mm/yyyy\": \"dd/MM/yyyy\",\n \"yyyy/mm/dd\": \"yyyy/MM/dd\",\n};\n\nexport const DateModeToPlaceholderMap: Record<DateMode, string> = {\n \"dd/mm/yyyy\": \"__/__/____\",\n \"mm/dd/yyyy\": \"__/__/____\",\n \"yyyy/mm/dd\": \"____/__/__\",\n};\n","import { DateTime } from \"luxon\";\n\nexport function convertStringToDate(\n v: string | null | undefined,\n): DateTime | null | undefined {\n if (v === undefined || v === null) {\n return v;\n }\n const date = DateTime.fromISO(v, { setZone: true, zone: \"utc\" }).startOf(\n \"day\",\n );\n if (date.isValid) {\n return date;\n }\n return null;\n}\nexport function validateDate({\n date,\n constraints,\n}: {\n date: DateTime | null;\n constraints: {\n required?: boolean;\n unavailable?: {\n dates?: DateTime[];\n daysOfWeek?: number[];\n };\n minDate?: DateTime;\n maxDate?: DateTime;\n };\n}) {\n const { required, unavailable, minDate, maxDate } = constraints;\n if (!date) {\n return required ? false : true;\n }\n if (unavailable?.dates?.some((d) => d.equals(date))) {\n return false;\n }\n if (unavailable?.daysOfWeek?.includes(date.weekday)) {\n return false;\n }\n if (minDate && date < minDate) {\n return false;\n }\n if (maxDate && date > maxDate) {\n return false;\n }\n return true;\n}\n"],"names":[],"mappings":";;AAEO,MAAM,mBAAA,GAAgD;AAAA,EAC3D,YAAA,EAAc,YAAA;AAAA,EACd,YAAA,EAAc,YAAA;AAAA,EACd,YAAA,EAAc;AAChB;AAEO,MAAM,wBAAA,GAAqD;AAAA,EAChE,YAAA,EAAc,YAAA;AAAA,EACd,YAAA,EAAc,YAAA;AAAA,EACd,YAAA,EAAc;AAChB;;ACVO,SAAS,oBACd,CAAA,EAC6B;AAC7B,EAAA,IAAI,CAAA,KAAM,MAAA,IAAa,CAAA,KAAM,IAAA,EAAM;AACjC,IAAA,OAAO,CAAA;AAAA,EACT;AACA,EAAA,MAAM,IAAA,GAAO,QAAA,CAAS,OAAA,CAAQ,CAAA,EAAG,EAAE,SAAS,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,CAAA,CAAE,OAAA;AAAA,IAC/D;AAAA,GACF;AACA,EAAA,IAAI,KAAK,OAAA,EAAS;AAChB,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,OAAO,IAAA;AACT;AACO,SAAS,YAAA,CAAa;AAAA,EAC3B,IAAA;AAAA,EACA;AACF,CAAA,EAWG;AACD,EAAA,MAAM,EAAE,QAAA,EAAU,WAAA,EAAa,OAAA,EAAS,SAAQ,GAAI,WAAA;AACpD,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA,OAAO,WAAW,KAAA,GAAQ,IAAA;AAAA,EAC5B;AACA,EAAA,IAAI,WAAA,EAAa,OAAO,IAAA,CAAK,CAAC,MAAM,CAAA,CAAE,MAAA,CAAO,IAAI,CAAC,CAAA,EAAG;AACnD,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,WAAA,EAAa,UAAA,EAAY,QAAA,CAAS,IAAA,CAAK,OAAO,CAAA,EAAG;AACnD,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,OAAA,IAAW,OAAO,OAAA,EAAS;AAC7B,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,OAAA,IAAW,OAAO,OAAA,EAAS;AAC7B,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,OAAO,IAAA;AACT;;;;"}
1
+ {"version":3,"file":"utils-Dh3aegV3.js","sources":["../src/components/DateFieldSingle/internal/constants.ts","../src/components/DateFieldSingle/internal/utils.ts"],"sourcesContent":["import { DateMode } from \"../types\";\n\nexport const DateModeToFormatMap: Record<DateMode, string> = {\n \"mm/dd/yyyy\": \"MM/dd/yyyy\",\n \"dd/mm/yyyy\": \"dd/MM/yyyy\",\n \"yyyy/mm/dd\": \"yyyy/MM/dd\",\n};\n\nexport const DateModeToPlaceholderMap: Record<DateMode, string> = {\n \"dd/mm/yyyy\": \"__/__/____\",\n \"mm/dd/yyyy\": \"__/__/____\",\n \"yyyy/mm/dd\": \"____/__/__\",\n};\n","import { DateTime } from \"luxon\";\n\nexport function convertStringToDate(\n v: string | null | undefined,\n): DateTime | null | undefined {\n if (v === undefined || v === null) {\n return v;\n }\n const date = DateTime.fromISO(v, { setZone: true, zone: \"utc\" }).startOf(\n \"day\",\n );\n if (date.isValid) {\n return date;\n }\n return null;\n}\nexport function validateDate({\n date,\n constraints,\n}: {\n date: DateTime | null;\n constraints: {\n required?: boolean;\n unavailable?: {\n dates?: DateTime[];\n daysOfWeek?: number[];\n };\n minDate?: DateTime;\n maxDate?: DateTime;\n };\n}) {\n const { required, unavailable, minDate, maxDate } = constraints;\n if (!date) {\n return required ? false : true;\n }\n if (unavailable?.dates?.some((d) => d.equals(date))) {\n return false;\n }\n if (unavailable?.daysOfWeek?.includes(date.weekday)) {\n return false;\n }\n if (minDate && date < minDate) {\n return false;\n }\n if (maxDate && date > maxDate) {\n return false;\n }\n return true;\n}\n"],"names":[],"mappings":";;AAEO,MAAM,mBAAA,GAAgD;AAAA,EAC3D,YAAA,EAAc,YAAA;AAAA,EACd,YAAA,EAAc,YAAA;AAAA,EACd,YAAA,EAAc;AAChB;AAEO,MAAM,wBAAA,GAAqD;AAAA,EAChE,YAAA,EAAc,YAAA;AAAA,EACd,YAAA,EAAc,YAAA;AAAA,EACd,YAAA,EAAc;AAChB;;ACVO,SAAS,oBACd,CAAA,EAC6B;AAC7B,EAAA,IAAI,CAAA,KAAM,MAAA,IAAa,CAAA,KAAM,IAAA,EAAM;AACjC,IAAA,OAAO,CAAA;AAAA,EACT;AACA,EAAA,MAAM,IAAA,GAAO,QAAA,CAAS,OAAA,CAAQ,CAAA,EAAG,EAAE,SAAS,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,CAAA,CAAE,OAAA;AAAA,IAC/D;AAAA,GACF;AACA,EAAA,IAAI,KAAK,OAAA,EAAS;AAChB,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,OAAO,IAAA;AACT;AACO,SAAS,YAAA,CAAa;AAAA,EAC3B,IAAA;AAAA,EACA;AACF,CAAA,EAWG;AACD,EAAA,MAAM,EAAE,QAAA,EAAU,WAAA,EAAa,OAAA,EAAS,SAAQ,GAAI,WAAA;AACpD,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA,OAAO,WAAW,KAAA,GAAQ,IAAA;AAAA,EAC5B;AACA,EAAA,IAAI,WAAA,EAAa,OAAO,IAAA,CAAK,CAAC,MAAM,CAAA,CAAE,MAAA,CAAO,IAAI,CAAC,CAAA,EAAG;AACnD,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,WAAA,EAAa,UAAA,EAAY,QAAA,CAAS,IAAA,CAAK,OAAO,CAAA,EAAG;AACnD,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,OAAA,IAAW,OAAO,OAAA,EAAS;AAC7B,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAI,OAAA,IAAW,OAAO,OAAA,EAAS;AAC7B,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,OAAO,IAAA;AACT;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/anvil2",
3
- "version": "1.46.3",
3
+ "version": "1.46.4",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -1 +0,0 @@
1
- {"version":3,"file":"Dialog-BHFLnFNQ.js","sources":["../src/components/Dialog/internal/useDialogContext.ts","../src/components/Dialog/DialogCancelButton.tsx","../src/components/Dialog/DialogHeader.tsx","../src/components/Dialog/DialogFooter.tsx","../src/components/Dialog/DialogContent.tsx","../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import { useContext } from \"react\";\nimport { DialogContext } from \"./DialogContext\";\n\nexport function useDialogContext() {\n const context = useContext(DialogContext);\n if (!context) {\n throw new Error(\n \"useDialogContext must be used within a DialogContextProvider\",\n );\n }\n return context;\n}\n","import { MouseEvent, forwardRef } from \"react\";\nimport { Button, ButtonProps } from \"../Button\";\nimport { useDialogContext } from \"./internal/useDialogContext\";\nimport { DataTrackingId } from \"../../types\";\nimport { useTrackingId } from \"../../hooks\";\n\n/**\n * Props for the DialogCancelButton component\n * @extends ButtonProps\n */\nexport type DialogCancelButtonProps = ButtonProps & DataTrackingId;\n\n/**\n * DialogCancelButton component for cancel/close actions in a Dialog.\n *\n * Features:\n * - Button that automatically closes the dialog when clicked\n * - Extends all Button component props and functionality\n * - Proper accessibility with close dialog semantics\n * - Automatic focus management\n * - Consistent styling with other dialog elements\n *\n * @example\n * <Dialog.CancelButton appearance=\"ghost\">Cancel</Dialog.CancelButton>\n */\nexport const DialogCancelButton = forwardRef<\n HTMLButtonElement,\n DialogCancelButtonProps\n>((props, ref) => {\n const { onClick, ...rest } = props;\n const { close } = useDialogContext();\n const data = {\n title: props.title,\n appearance: props.appearance,\n size: props.size,\n type: props.type,\n };\n\n const trackingId = useTrackingId({\n name: \"DialogCancelButton\",\n data,\n hasOverride: !!props[\"data-tracking-id\"],\n });\n const onClickHandler = (e: MouseEvent<HTMLButtonElement>) => {\n onClick?.(e);\n close();\n };\n return (\n <Button\n aria-label=\"Close dialog\"\n data-anv=\"dialog-cancel-button\"\n data-tracking-id={trackingId}\n onClick={onClickHandler}\n ref={ref}\n {...rest}\n />\n );\n});\n\nDialogCancelButton.displayName = \"DialogCancelButton\";\n","import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport Close from \"@servicetitan/hammer-icon/mdi/round/close.svg\";\nimport cx from \"classnames\";\n\nimport { Text } from \"../Text\";\nimport { DialogCancelButton } from \"./DialogCancelButton\";\n\nimport styles from \"./Dialog.module.scss\";\nimport { childrenToString } from \"../../internal/functions\";\nimport { useTrackingId } from \"../../hooks\";\nimport { DataTrackingId } from \"../../types\";\n\n/**\n * Props for the DialogHeader component\n * @extends ComponentPropsWithoutRef<\"header\">\n */\nexport type DialogHeaderProps = ComponentPropsWithoutRef<\"header\"> &\n DataTrackingId;\n\n/**\n * DialogHeader component for the header section of a Dialog.\n *\n * Features:\n * - Displays dialog title with headline typography\n * - Includes close button with proper accessibility\n * - Sticky positioning for long content\n * - Consistent spacing and styling\n * - Automatic focus management\n *\n * @example\n * <Dialog.Header>Confirm Delete</Dialog.Header>\n */\nexport const DialogHeader = forwardRef<HTMLDivElement, DialogHeaderProps>(\n (props: DialogHeaderProps, ref) => {\n const { children, className, ...rest } = props;\n const data = {\n children: childrenToString(props.children),\n };\n\n const trackingId = useTrackingId({\n name: \"Dialog\",\n data,\n hasOverride: !!props[\"data-tracking-id\"],\n });\n\n const headerClassNames = cx(className, styles[\"header\"]);\n\n return (\n <header\n className={headerClassNames}\n data-anv=\"dialog-header\"\n data-tracking-id={trackingId}\n ref={ref}\n {...rest}\n >\n <Text variant=\"headline\" el=\"h1\">\n {children}\n </Text>\n <span className={styles[\"close-container\"]}>\n <DialogCancelButton\n className={styles[\"close-button\"]}\n size=\"small\"\n appearance=\"ghost\"\n aria-label=\"Close dialog\"\n icon={Close}\n />\n </span>\n </header>\n );\n },\n);\n\nDialogHeader.displayName = \"DialogHeader\";\n","import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport cx from \"classnames\";\n\nimport styles from \"./Dialog.module.scss\";\n\n/**\n * Props for the DialogFooter component\n * @extends ComponentPropsWithoutRef<\"footer\">\n */\nexport type DialogFooterProps = ComponentPropsWithoutRef<\"footer\"> & {\n /**\n * @default false\n */\n sticky?: boolean;\n};\n\n/**\n * DialogFooter component for the footer section of a Dialog.\n *\n * Features:\n * - Container for dialog action buttons\n * - Optional sticky positioning for long content\n * - Consistent spacing and alignment\n * - Right-aligned button layout by default\n * - Flexible content area for custom layouts\n *\n * @example\n * <Dialog.Footer sticky>\n * <Dialog.CancelButton>Cancel</Dialog.CancelButton>\n * <Button appearance=\"primary\">Save</Button>\n * </Dialog.Footer>\n */\nexport const DialogFooter = forwardRef<HTMLElement, DialogFooterProps>(\n (props, ref) => {\n const { children, className, sticky = false, ...rest } = props;\n\n const footerClassNames = cx(styles[\"footer\"], className, {\n [styles[\"sticky\"]]: sticky,\n });\n\n return (\n <footer\n className={footerClassNames}\n data-anv=\"dialog-footer\"\n ref={ref}\n {...rest}\n >\n {children}\n </footer>\n );\n },\n);\n\nDialogFooter.displayName = \"DialogFooter\";\n","import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport cx from \"classnames\";\n\nimport styles from \"./Dialog.module.scss\";\n\n/**\n * Props for the DialogContent component\n * @extends ComponentPropsWithoutRef<\"div\">\n */\nexport type DialogContentProps = ComponentPropsWithoutRef<\"div\">;\n\n/**\n * DialogContent component for the main content area of a Dialog.\n *\n * Features:\n * - Main content container for dialog body\n * - Flexible height with overflow handling\n * - Consistent padding and spacing\n * - Responsive design\n * - Proper content scrolling for long content\n *\n * @example\n * <Dialog.Content>\n * <p>This is the main content of the dialog.</p>\n * </Dialog.Content>\n */\nexport const DialogContent = forwardRef<HTMLDivElement, DialogContentProps>(\n (props, ref) => {\n const { children, className, ...rest } = props;\n\n const contentClassNames = cx(styles[\"content\"], className);\n\n return (\n <div\n className={contentClassNames}\n data-anv=\"dialog-content\"\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\n\nDialogContent.displayName = \"DialogContent\";\n","import {\n ComponentPropsWithoutRef,\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n KeyboardEvent,\n} from \"react\";\nimport { DialogHeader } from \"./DialogHeader\";\nimport { DialogFooter } from \"./DialogFooter\";\nimport { DialogContent } from \"./DialogContent\";\nimport { DialogCancelButton } from \"./DialogCancelButton\";\nimport {\n OpenCloseTransitionStateEffects,\n useDialogScrollLock,\n useDialogTransitionStates,\n useKeyboardFocusables,\n useOnClickOutside,\n} from \"../../internal/hooks\";\nimport { DisableCloseOnEscapeOrClickProps, Size } from \"../../types\";\nimport { DialogContext, DialogContextProps } from \"./internal/DialogContext\";\nimport styles from \"./Dialog.module.scss\";\nimport { getActiveElement } from \"../../internal/functions\";\nimport { useMergeRefs } from \"../../hooks\";\nimport cx from \"classnames\";\n\nimport { ToastProvider } from \"../Toast/internal/ToastProvider\";\nimport { ToasterPopover } from \"../Toast/internal/ToasterPopover\";\nimport { ToasterContent } from \"../Toast/internal/Toaster\";\n\n/**\n * Props for the Dialog component\n * @extends ComponentPropsWithoutRef<\"dialog\">\n * @extends DialogTransitionStateEffects\n * @extends DisableCloseOnEscapeOrClickProps\n */\nexport type DialogProps = ComponentPropsWithoutRef<\"dialog\"> &\n OpenCloseTransitionStateEffects &\n DisableCloseOnEscapeOrClickProps & {\n /**\n * @default false\n */\n fullScreen?: boolean;\n /**\n * @default \"medium\"\n */\n size?: Extract<Size, \"medium\" | \"large\">;\n\n /**\n * @default false\n */\n open?: boolean;\n onClose?: () => void;\n /**\n * @deprecated - use onOpenAnimationStart or onOpenAnimationComplete instead\n */\n onOpen?: () => void;\n /**\n * @deprecated - use onOpenAnimationStart or onOpenAnimationComplete instead\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Callback when clicking outside the dialog\n */\n onClickOutside?: (e: globalThis.MouseEvent) => void;\n /**\n * Enables scroll chaining\n * @link https://developer.mozilla.org/en-US/docs/Glossary/Scroll_chaining\n */\n enableScrollChaining?: boolean;\n };\n\nexport const DialogElement = forwardRef<HTMLDialogElement, DialogProps>(\n (props, ref) => {\n const {\n className,\n open = false,\n children,\n onOpen,\n onOpenChange,\n onClose,\n onKeyDown,\n fullScreen = false,\n disableCloseOnEscape = false,\n onClickOutside,\n disableCloseOnClickOutside = false,\n size,\n enableScrollChaining,\n onOpenAnimationStart,\n onOpenAnimationComplete,\n onCloseAnimationStart,\n onCloseAnimationComplete,\n ...rest\n } = props;\n\n const elRef = useRef<HTMLDialogElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const toasterRef = useRef<HTMLDivElement>(null);\n const [hasOpenPopover, setHasOpenPopover] =\n useState<DialogContextProps[\"hasOpenPopover\"]>(false);\n const id = useId();\n\n const { state, isOpenOrOpening } = useDialogTransitionStates(elRef, open, {\n onOpenAnimationStart: useCallback(() => {\n onOpenAnimationStart?.();\n }, [onOpenAnimationStart]),\n onOpenAnimationComplete: useCallback(() => {\n onOpenAnimationComplete?.();\n onOpen?.(); // DEPRECATED\n }, [onOpen, onOpenAnimationComplete]),\n onCloseAnimationStart: useCallback(() => {\n onCloseAnimationStart?.();\n }, [onCloseAnimationStart]),\n onCloseAnimationComplete: useCallback(() => {\n onCloseAnimationComplete?.();\n }, [onCloseAnimationComplete]),\n });\n\n // DEPRECATED\n const initial = useRef(true);\n useEffect(() => {\n if (initial.current) {\n initial.current = false;\n } else {\n onOpenChange?.(isOpenOrOpening);\n }\n }, [id, onOpenChange, isOpenOrOpening]);\n\n const classNames = cx([styles[\"dialog\"]], className, {\n [styles[\"closing\"]]: state === \"closing\",\n [styles[\"fullscreen\"]]: fullScreen,\n [styles[\"large\"]]: size === \"large\",\n });\n\n const { focusables } = useKeyboardFocusables(contentRef, {\n observeChange: true,\n });\n\n useDialogScrollLock({\n open: isOpenOrOpening,\n id,\n enableScrollChaining,\n elementRef: elRef,\n });\n\n useOnClickOutside({\n onOutsidePress: (e) => {\n if (!open) return;\n onClickOutside?.(e);\n },\n targets: [\n contentRef.current as HTMLElement,\n toasterRef.current as HTMLElement,\n ],\n onClose: () => {\n if (disableCloseOnClickOutside || !open) return;\n onClose?.();\n },\n });\n\n useEffect(() => {\n if (!isOpenOrOpening) return;\n if (!focusables) return;\n\n const activeElement = getActiveElement(document);\n if (!activeElement) return;\n\n if (\n activeElement.dataset.anv !== \"drawer-header-close-button\" &&\n (focusables.includes(activeElement) ||\n activeElement.tagName === \"DIALOG\")\n ) {\n return;\n }\n\n if (\n focusables[0]?.dataset.anv === \"dialog-header-close-button\" &&\n focusables[1]\n ) {\n focusables[1].focus();\n } else {\n focusables[0]?.focus();\n }\n }, [isOpenOrOpening, focusables]);\n\n const onKeyDownHandler = (e: KeyboardEvent<HTMLDialogElement>) => {\n onKeyDown?.(e);\n if (e.code === \"Escape\") {\n e.preventDefault();\n if (disableCloseOnEscape) return;\n if (hasOpenPopover) return;\n onClose?.();\n return;\n }\n\n if (e.code === \"Tab\") {\n if (e.shiftKey && e.target === focusables?.[0]) {\n e.preventDefault();\n (focusables[focusables.length - 1] as HTMLElement)?.focus();\n return;\n }\n if (e.target === focusables?.[focusables.length - 1] && !e.shiftKey) {\n e.preventDefault();\n focusables[0].focus();\n return;\n }\n }\n };\n\n return (\n // dialog element does seem to be interactive on MDN guideline\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n <dialog\n className={classNames}\n data-anv=\"dialog\"\n data-anv-scroll-chaining={enableScrollChaining}\n data-anv-transition-state={state}\n ref={useMergeRefs([ref, elRef])}\n onKeyDown={onKeyDownHandler}\n {...rest}\n >\n <ToastProvider isDialogToaster={open}>\n <ToasterPopover>\n <ToasterContent id=\"dialog-toaster\" ref={toasterRef} />\n </ToasterPopover>\n </ToastProvider>\n <DialogContext.Provider\n value={{\n close: () => onClose?.(),\n ref: elRef,\n hasOpenPopover,\n setHasOpenPopover,\n }}\n >\n <section\n ref={contentRef}\n className={styles[\"container\"]}\n data-open={open}\n >\n {children}\n </section>\n </DialogContext.Provider>\n </dialog>\n );\n },\n);\n\nDialogElement.displayName = \"Dialog\";\n\n/**\n * Dialog component for creating modal dialogs and overlays.\n *\n * Features:\n * - Modal dialog with backdrop overlay\n * - Controlled and uncontrolled open state\n * - Smooth open/close animations\n * - Keyboard navigation and focus management\n * - Escape key and click outside to close\n * - Multiple size variants (medium, large, fullscreen)\n * - Scroll chaining support\n * - Toast integration for notifications\n * - Compound component pattern with Header, Footer, Content, and CancelButton sub-components\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Dialog open={isOpen} onClose={() => setIsOpen(false)}>\n * <Dialog.Header>Confirm Action</Dialog.Header>\n * <Dialog.Content>Are you sure you want to proceed?</Dialog.Content>\n * <Dialog.Footer>\n * <Dialog.CancelButton>Cancel</Dialog.CancelButton>\n * <Button appearance=\"primary\">Confirm</Button>\n * </Dialog.Footer>\n * </Dialog>\n */\nexport const Dialog = Object.assign(DialogElement, {\n /**\n * DialogHeader component for the header section of a Dialog.\n *\n * Features:\n * - Displays dialog title with headline typography\n * - Includes close button with proper accessibility\n * - Sticky positioning for long content\n * - Consistent spacing and styling\n * - Automatic focus management\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Dialog.Header>Confirm Delete</Dialog.Header>\n */\n Header: DialogHeader,\n /**\n * DialogFooter component for the footer section of a Dialog.\n *\n * Features:\n * - Container for dialog action buttons\n * - Optional sticky positioning for long content\n * - Consistent spacing and alignment\n * - Right-aligned button layout by default\n * - Flexible content area for custom layouts\n *\n * @example\n * <Dialog.Footer sticky>\n * <Dialog.CancelButton>Cancel</Dialog.CancelButton>\n * <Button appearance=\"primary\">Save</Button>\n * </Dialog.Footer>\n */\n Footer: DialogFooter,\n /**\n * DialogContent component for the main content area of a Dialog.\n *\n * Features:\n * - Main content container for dialog body\n * - Flexible height with overflow handling\n * - Consistent padding and spacing\n * - Responsive design\n * - Proper content scrolling for long content\n *\n * @example\n * <Dialog.Content>\n * <p>This is the main content of the dialog.</p>\n * </Dialog.Content>\n */\n Content: DialogContent,\n /**\n * DialogCancelButton component for cancel/close actions in a Dialog.\n *\n * Features:\n * - Button that automatically closes the dialog when clicked\n * - Extends all Button component props and functionality\n * - Proper accessibility with close dialog semantics\n * - Automatic focus management\n * - Consistent styling with other dialog elements\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Dialog.CancelButton appearance=\"ghost\">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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAejD,MAAA,EAAQ,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBR,MAAA,EAAQ,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBR,OAAA,EAAS,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeT,YAAA,EAAc;AAChB,CAAC;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Drawer-BDA7Sjj9.js","sources":["../src/components/Drawer/internal/useDrawerContext.ts","../src/components/Drawer/DrawerCancelButton.tsx","../src/components/Drawer/DrawerHeader.tsx","../src/components/Drawer/DrawerFooter.tsx","../src/components/Drawer/DrawerContent.tsx","../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import { useContext } from \"react\";\nimport { DrawerContext } from \"./DrawerContext\";\n\n/**\n * Hook to access the drawer context.\n *\n * @returns The drawer context containing close function and ref\n * @throws Error if used outside of a DrawerContextProvider\n */\nexport function useDrawerContext() {\n const context = useContext(DrawerContext);\n if (!context) {\n throw new Error(\n \"useDrawerContext must be used within a DrawerContextProvider\",\n );\n }\n return context;\n}\n","import { MouseEvent, forwardRef } from \"react\";\nimport { Button, ButtonProps } from \"../Button\";\nimport { DataTrackingId } from \"../../types\";\nimport { childrenToString } from \"../../internal/functions\";\nimport { useTrackingId } from \"../../hooks\";\nimport { useDrawerContext } from \"./internal/useDrawerContext\";\n\n/**\n * Props for the DrawerCancelButton component\n * @extends ButtonProps\n */\nexport type DrawerCancelButtonProps = ButtonProps & DataTrackingId;\n\n/**\n * A button component that automatically closes the drawer when clicked.\n *\n * Features:\n * - Automatically closes the drawer when clicked\n * - Extends Button component functionality\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard button props\n * - Proper focus management\n * - Can be used anywhere within the drawer context\n *\n * @example\n * <DrawerCancelButton appearance=\"ghost\" size=\"small\">\n * Cancel\n * </DrawerCancelButton>\n */\nexport const DrawerCancelButton = forwardRef<\n HTMLButtonElement,\n DrawerCancelButtonProps\n>((props, ref) => {\n const { onClick, ...rest } = props;\n const { close } = useDrawerContext();\n const data = {\n children: childrenToString(props.children),\n appearance: props.appearance,\n size: props.size,\n type: props.type,\n };\n\n const trackingId = useTrackingId({\n name: \"DrawerCancelButton\",\n data,\n hasOverride: !!props[\"data-tracking-id\"],\n });\n\n const onClickHandler = (e: MouseEvent<HTMLButtonElement>) => {\n onClick?.(e);\n close();\n };\n return (\n <Button\n aria-label=\"Close drawer\"\n data-anv=\"drawer-cancel-button\"\n data-tracking-id={trackingId}\n onClick={onClickHandler}\n ref={ref}\n {...rest}\n />\n );\n});\n\nDrawerCancelButton.displayName = \"DrawerCancelButton\";\n","import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport Close from \"@servicetitan/hammer-icon/mdi/round/close.svg\";\nimport styles from \"./Drawer.module.scss\";\nimport { Text } from \"../Text\";\nimport { DrawerCancelButton } from \"./DrawerCancelButton\";\nimport cx from \"classnames\";\nimport { DataTrackingId } from \"../../types\";\nimport { childrenToString } from \"../../internal/functions\";\nimport { useTrackingId } from \"../../hooks\";\n\n/**\n * Props for the DrawerHeader component\n * @extends ComponentPropsWithoutRef<\"header\">\n */\nexport type DrawerHeaderProps = ComponentPropsWithoutRef<\"header\"> &\n DataTrackingId;\n\n/**\n * Header component for the drawer that displays a title and close button.\n *\n * Features:\n * - Displays the drawer title as a headline\n * - Includes an accessible close button\n * - Sticky positioning at the top of the drawer\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Automatic close functionality\n *\n * @example\n * <Drawer.Header>Settings</Drawer.Header>\n */\nexport const DrawerHeader = forwardRef<HTMLHeadElement, DrawerHeaderProps>(\n (props, ref) => {\n const { className, children } = props;\n const data = {\n children: childrenToString(props.children),\n };\n\n const trackingId = useTrackingId({\n name: \"DrawerHeader\",\n data,\n hasOverride: !!props[\"data-tracking-id\"],\n });\n\n const drawerHeaderClasses = cx(styles.header, className);\n\n return (\n <header\n className={drawerHeaderClasses}\n data-anv=\"drawer-header\"\n data-tracking-id={trackingId}\n ref={ref}\n >\n <Text variant=\"headline\" el=\"h1\">\n {children}\n </Text>\n <span className={styles[\"close-container\"]}>\n <DrawerCancelButton\n className={styles[\"close-button\"]}\n size=\"small\"\n appearance=\"ghost\"\n aria-label=\"Close drawer\"\n data-anv=\"drawer-header-close-button\"\n icon={Close}\n />\n </span>\n </header>\n );\n },\n);\n\nDrawerHeader.displayName = \"DrawerHeader\";\n","import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport styles from \"./Drawer.module.scss\";\nimport cx from \"classnames\";\n\n/**\n * Props for the DrawerFooter component\n * @extends ComponentPropsWithoutRef<\"footer\">\n */\nexport type DrawerFooterProps = ComponentPropsWithoutRef<\"footer\"> & {\n /**\n * When true, the footer will stick to the bottom of the drawer.\n * @default false\n */\n sticky?: boolean;\n};\n\n/**\n * Footer component for the drawer that displays action buttons and controls.\n *\n * Features:\n * - Flexible layout for action buttons and controls\n * - Optional sticky positioning at the bottom\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard footer element props\n * - Responsive design that adapts to content\n *\n * @example\n * <Drawer.Footer sticky>\n * <Button onClick={handleSave}>Save</Button>\n * <Button onClick={handleCancel}>Cancel</Button>\n * </Drawer.Footer>\n */\nexport const DrawerFooter = forwardRef<HTMLElement, DrawerFooterProps>(\n (props, ref) => {\n const { className, children, sticky = false, ...rest } = props;\n const drawerFooterClasses = cx(styles.footer, className, {\n [styles[\"sticky\"]]: sticky,\n });\n\n return (\n <footer\n className={drawerFooterClasses}\n data-anv=\"drawer-footer\"\n ref={ref}\n {...rest}\n >\n {children}\n </footer>\n );\n },\n);\n\nDrawerFooter.displayName = \"DrawerFooter\";\n","import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport styles from \"./Drawer.module.scss\";\nimport cx from \"classnames\";\n\n/**\n * Props for the DrawerContent component\n * @extends ComponentPropsWithoutRef<\"div\">\n */\nexport type DrawerContentProps = ComponentPropsWithoutRef<\"div\">;\n\n/**\n * Content container for the drawer that holds the main content area.\n *\n * Features:\n * - Flexible content area with proper spacing\n * - Scrollable content when needed\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard div element props\n * - Responsive design that adapts to content\n * - Proper focus management\n *\n * @example\n * <Drawer.Content>\n * <p>This is the main content of the drawer.</p>\n * <p>It can contain any type of content.</p>\n * </Drawer.Content>\n */\nexport const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(\n (props, ref) => {\n const { className, children, ...rest } = props;\n const drawerContentClasses = cx(styles.content, className);\n\n return (\n <div\n className={drawerContentClasses}\n data-anv=\"drawer-content\"\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\n\nDrawerContent.displayName = \"DrawerContent\";\n","import styles from \"./Drawer.module.scss\";\nimport {\n ComponentPropsWithoutRef,\n forwardRef,\n useRef,\n useId,\n useCallback,\n useEffect,\n SyntheticEvent,\n KeyboardEvent,\n useMemo,\n} from \"react\";\nimport { DrawerHeader } from \"./DrawerHeader\";\nimport { DrawerFooter } from \"./DrawerFooter\";\nimport { DrawerContent } from \"./DrawerContent\";\nimport { DrawerCancelButton } from \"./DrawerCancelButton\";\nimport {\n OpenCloseTransitionStateEffects,\n useDialogScrollLock,\n useDialogTransitionStates,\n useKeyboardFocusables,\n useOnClickOutside,\n} from \"../../internal/hooks\";\nimport { DisableCloseOnEscapeOrClickProps, Size } from \"../../types\";\nimport { useMergeRefs } from \"../../hooks\";\nimport cx from \"classnames\";\nimport { getActiveElement } from \"../../internal/functions\";\nimport { ToastProvider } from \"../Toast/internal/ToastProvider\";\nimport { ToasterPopover } from \"../Toast/internal/ToasterPopover\";\nimport { ToasterContent } from \"../Toast/internal/Toaster\";\nimport { DrawerContext } from \"./internal/DrawerContext\";\n\n/**\n * Props for the Drawer component\n * @extends ComponentPropsWithoutRef<\"dialog\">\n * @extends DialogTransitionStateEffects\n * @extends DisableCloseOnEscapeOrClickProps\n */\nexport type DrawerProps = ComponentPropsWithoutRef<\"dialog\"> &\n OpenCloseTransitionStateEffects &\n DisableCloseOnEscapeOrClickProps & {\n /**\n * The size of the drawer.\n * @default \"medium\"\n */\n size?: Extract<Size, \"medium\" | \"large\">;\n /**\n * Controls whether the drawer is open or closed.\n * @default false\n */\n open?: boolean;\n /**\n * Callback function called after the drawer is animated closed.\n */\n onClose?: () => void;\n /**\n * Callback function called when the drawer opens.\n * @deprecated Use onOpenAnimationStart or onOpenAnimationComplete instead\n */\n onOpen?: () => void;\n /**\n * Callback when clicking outside the drawer\n */\n onClickOutside?: (e: globalThis.MouseEvent) => void;\n /**\n * Enables scroll chaining behavior.\n * @link https://developer.mozilla.org/en-US/docs/Glossary/Scroll_chaining\n */\n enableScrollChaining?: boolean;\n };\n\nconst DrawerElement = forwardRef<HTMLDialogElement, DrawerProps>(\n (props, ref) => {\n const {\n className,\n open = false,\n children,\n onOpen,\n onClose,\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars --\n onCancel is destructured so that it is not passed to the dialog in ...rest\n */\n onCancel,\n onKeyDown,\n disableCloseOnEscape = false,\n onClickOutside,\n disableCloseOnClickOutside = false,\n size = \"medium\",\n enableScrollChaining,\n onOpenAnimationStart,\n onOpenAnimationComplete,\n onCloseAnimationStart,\n onCloseAnimationComplete,\n ...rest\n } = props;\n\n const elRef = useRef<HTMLDialogElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const toasterRef = useRef<HTMLDivElement>(null);\n const combinedRef = useMergeRefs([elRef, ref]);\n const id = useId();\n\n const { state, isOpenOrOpening } = useDialogTransitionStates(elRef, open, {\n onOpenAnimationStart: useCallback(() => {\n onOpenAnimationStart?.();\n }, [onOpenAnimationStart]),\n onOpenAnimationComplete: useCallback(() => {\n onOpenAnimationComplete?.();\n onOpen?.(); // DEPRECATED\n }, [onOpen, onOpenAnimationComplete]),\n onCloseAnimationStart: useCallback(() => {\n onCloseAnimationStart?.();\n }, [onCloseAnimationStart]),\n onCloseAnimationComplete: useCallback(() => {\n onCloseAnimationComplete?.();\n }, [onCloseAnimationComplete]),\n });\n\n const classNames = cx([styles.drawer], className, {\n [styles.remove]: state === \"closing\",\n [styles.large]: size === \"large\",\n });\n\n const { focusables } = useKeyboardFocusables(contentRef, {\n observeChange: false,\n });\n const firstFocusable = focusables?.[0];\n const lastFocusable = focusables?.[focusables.length - 1];\n\n useDialogScrollLock({\n open: isOpenOrOpening,\n id,\n enableScrollChaining,\n elementRef: elRef,\n });\n\n useEffect(() => {\n if (!isOpenOrOpening) return;\n if (!focusables) return;\n\n const activeElement = getActiveElement(document);\n if (!activeElement) return;\n\n if (\n activeElement.dataset.anv !== \"drawer-header-close-button\" &&\n (focusables.includes(activeElement) ||\n activeElement.tagName === \"DIALOG\")\n ) {\n return;\n }\n\n if (\n focusables[0]?.dataset.anv === \"drawer-header-close-button\" &&\n focusables[1]\n ) {\n focusables[1].focus();\n } else {\n focusables[0]?.focus();\n }\n }, [isOpenOrOpening, focusables]);\n\n const onCancelHandler = (e: SyntheticEvent<HTMLDialogElement>) => {\n e.preventDefault();\n\n if (disableCloseOnEscape) return;\n onClose?.();\n };\n\n useOnClickOutside({\n onOutsidePress: (e) => {\n if (!open) return;\n onClickOutside?.(e);\n },\n targets: [\n contentRef.current as HTMLElement,\n toasterRef.current as HTMLElement,\n ],\n onClose: () => {\n if (disableCloseOnClickOutside || !open) return;\n onClose?.();\n },\n });\n\n const onKeyDownHandler = (e: KeyboardEvent<HTMLDialogElement>) => {\n onKeyDown?.(e);\n if (e.code === \"Tab\") {\n if (e.shiftKey && e.target === firstFocusable) {\n e.preventDefault();\n (lastFocusable as HTMLElement)?.focus();\n return;\n }\n if (e.target === lastFocusable && !e.shiftKey) {\n e.preventDefault();\n (firstFocusable as HTMLElement)?.focus();\n return;\n }\n }\n };\n\n const contextValue = useMemo(() => {\n return { close: () => onClose?.() };\n }, [onClose]);\n\n return (\n // dialog element does seem to be interactive on MDN guideline\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n <dialog\n className={classNames}\n data-anv=\"drawer\"\n data-anv-scroll-chaining={enableScrollChaining}\n data-anv-transition-state={state}\n ref={combinedRef}\n onCancel={onCancelHandler}\n onKeyDown={onKeyDownHandler}\n {...rest}\n >\n <ToastProvider isDialogToaster={isOpenOrOpening}>\n <ToasterPopover>\n <ToasterContent id=\"drawer-toaster\" ref={toasterRef} />\n </ToasterPopover>\n </ToastProvider>\n <DrawerContext.Provider value={contextValue}>\n <section\n ref={contentRef}\n className={styles.container}\n data-open={isOpenOrOpening}\n >\n {children}\n </section>\n </DrawerContext.Provider>\n </dialog>\n );\n },\n);\nDrawerElement.displayName = \"Drawer\";\n\n/**\n * A slide-out drawer component that provides a modal-like experience from the side of the screen.\n *\n * Features:\n * - Slide-in animation from the side of the screen\n * - Keyboard navigation with focus trapping\n * - Escape key and click outside to close\n * - Configurable size variants (medium, large)\n * - Built-in toast support for notifications\n * - Automatic scroll locking when open\n * - Accessible with proper ARIA attributes\n * - Compound component structure with Header, Footer, Content, and CancelButton\n * - Transition state callbacks for animation control\n * - Optional scroll chaining support\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Drawer open={isOpen} onClose={handleClose} size=\"medium\">\n * <Drawer.Header>Settings</Drawer.Header>\n * <Drawer.Content>Drawer content goes here</Drawer.Content>\n * <Drawer.Footer>\n * <Button onClick={handleSave}>Save</Button>\n * <Drawer.CancelButton>Cancel</Drawer.CancelButton>\n * </Drawer.Footer>\n * </Drawer>\n */\nexport const Drawer = Object.assign(DrawerElement, {\n /**\n * Header component for the drawer that displays a title and close button.\n *\n * Features:\n * - Displays the drawer title as a headline\n * - Includes an accessible close button\n * - Sticky positioning at the top of the drawer\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Automatic close functionality\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Drawer.Header>Settings</Drawer.Header>\n */\n Header: DrawerHeader,\n /**\n * Footer component for the drawer that displays action buttons and controls.\n *\n * Features:\n * - Flexible layout for action buttons and controls\n * - Optional sticky positioning at the bottom\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard footer element props\n * - Responsive design that adapts to content\n *\n * @example\n * <Drawer.Footer sticky>\n * <Button onClick={handleSave}>Save</Button>\n * <Drawer.CancelButton>Cancel</Drawer.CancelButton>\n * </Drawer.Footer>\n */\n Footer: DrawerFooter,\n /**\n * Content container for the drawer that holds the main content area.\n *\n * Features:\n * - Flexible content area with proper spacing\n * - Scrollable content when needed\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard div element props\n * - Responsive design that adapts to content\n * - Proper focus management\n *\n * @example\n * <Drawer.Content>\n * <p>This is the main content of the drawer.</p>\n * <p>It can contain any type of content.</p>\n * </Drawer.Content>\n */\n Content: DrawerContent,\n /**\n * A button component that automatically closes the drawer when clicked.\n *\n * Features:\n * - Automatically closes the drawer when clicked\n * - Extends Button component functionality\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard button props\n * - Proper focus management\n * - Can be used anywhere within the drawer context\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Drawer.CancelButton appearance=\"ghost\" size=\"small\">\n * Cancel\n * </Drawer.CancelButton>\n */\n CancelButton: DrawerCancelButton,\n});\n"],"names":["Close"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASO,SAAS,gBAAA,GAAmB;AACjC,EAAA,MAAM,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ChB,CAAC;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useKeyboardFocusables-ek2mYel-.js","sources":["../src/internal/hooks/useDialogScrollLock/useDialogScrollLock.ts","../src/internal/hooks/useDialogTransitionStates/useDialogTransitionStates.ts","../src/internal/hooks/useKeyboardFocusables/useKeyboardFocusables.ts"],"sourcesContent":["import { useEffect } from \"react\";\n\nconst ATTRIBUTE_NAME_LIST = \"data-anv-dialogs\";\nconst ATTRIBUTE_NAME_BOOL = \"data-anv-dialogs-open\";\n\n/**\n * Props for the useDialogScrollLock hook\n * @property {boolean} open - Whether the dialog is open\n * @property {string} id - Unique identifier for the dialog\n * @property {boolean} [enableScrollChaining] - Whether to enable scroll chaining\n * @property {React.RefObject<HTMLElement>} elementRef - Reference to the dialog element\n */\nexport interface UseDialogScrollLockProps {\n /**\n * Whether the dialog is open\n */\n open: boolean;\n /**\n * Unique identifier for the dialog\n */\n id: string;\n /**\n * Whether to enable scroll chaining\n */\n enableScrollChaining?: boolean;\n /**\n * Reference to the dialog element\n */\n elementRef: React.RefObject<HTMLElement>;\n}\n\n/**\n * Custom hook for managing dialog scroll lock in shadow DOM environments.\n *\n * Features:\n * - Manages scroll lock state for dialogs in shadow DOM\n * - Tracks multiple open dialogs with unique IDs\n * - Prevents scroll chaining when dialogs are open\n * - Automatically cleans up scroll lock on unmount\n * - Supports enabling/disabling scroll chaining\n * - Uses data attributes to track dialog state\n *\n * @param props - Configuration object containing dialog state and element reference\n * @returns void\n */\nexport const useDialogScrollLock = ({\n open,\n id,\n enableScrollChaining,\n elementRef,\n}: UseDialogScrollLockProps) => {\n useEffect(() => {\n if (enableScrollChaining) return () => {};\n const root = elementRef.current?.getRootNode();\n if (!(root instanceof ShadowRoot)) return () => {};\n\n const updateDialogAttributes = (shouldAdd: boolean) => {\n const currentDialogs =\n root.host\n .getAttribute(ATTRIBUTE_NAME_LIST)\n ?.split(\" \")\n .filter(Boolean) ?? [];\n\n const newDialogs = new Set(currentDialogs);\n if (shouldAdd) {\n newDialogs.add(id);\n } else {\n newDialogs.delete(id);\n }\n\n const dialogList = Array.from(newDialogs);\n root.host.setAttribute(ATTRIBUTE_NAME_LIST, dialogList.join(\" \"));\n\n if (dialogList.length > 0) {\n root.host.setAttribute(ATTRIBUTE_NAME_BOOL, \"true\");\n } else {\n root.host.removeAttribute(ATTRIBUTE_NAME_BOOL);\n }\n };\n\n updateDialogAttributes(open);\n\n return () => {\n updateDialogAttributes(false);\n };\n }, [open, id, enableScrollChaining, elementRef]);\n};\n","import { RefObject } from \"react\";\nimport {\n useOpenCloseTransitionStates,\n type OpenCloseTransitionStateEffects,\n} from \"../useOpenCloseTransitionStates\";\n\n/**\n * Effects configuration for dialog transition states\n * @property {() => void} [onOpenAnimationStart] - Callback when opening animation starts\n * @property {() => void} [onCloseAnimationStart] - Callback when closing animation starts\n * @property {() => void} [onOpenAnimationComplete] - Callback when opening animation completes\n * @property {() => void} [onCloseAnimationComplete] - Callback when closing animation completes\n */\n\n/**\n * Custom hook for managing dialog transition states and animations.\n *\n * Features:\n * - Manages dialog open/close transition states\n * - Handles animation timing based on CSS animation duration\n * - Provides callbacks for animation lifecycle events\n * - Supports controlled dialog state management\n * - Automatically handles showModal() and close() calls\n * - Provides utility flags for open/closed states\n *\n * @param ref - The ref to the dialog element\n * @param openProp - The open prop controlling dialog visibility\n * @param options - Additional, optional options including callbacks for animation start, complete, and initialization\n * @returns Object containing dialog state, control functions, and utility flags\n */\n\n/**\n * Effects configuration for dialog transition states\n * @param openProp - The open prop controlling dialog visibility\n * @param options - The effects configuration\n * @returns The dialog transition state\n */\nexport const useDialogTransitionStates = (\n ref: RefObject<HTMLDialogElement>,\n openProp: boolean | undefined,\n options: OpenCloseTransitionStateEffects = {},\n) => {\n const { onOpenAnimationStart, onCloseAnimationComplete } = options;\n return useOpenCloseTransitionStates(openProp, {\n ...options,\n onOpenAnimationStart: () => {\n if (!ref.current) return;\n ref.current.showModal();\n onOpenAnimationStart?.();\n },\n onCloseAnimationComplete: () => {\n if (!ref.current) return;\n ref.current.close();\n onCloseAnimationComplete?.();\n },\n durationMs: () => {\n if (!ref.current || !window) return 0;\n const duration = window.getComputedStyle(ref.current).animationDuration;\n return parseFloat(duration) * 1000;\n },\n });\n};\n","import { RefObject, useEffect, useRef, useState } from \"react\";\nimport { FocusableElement, tabbable } from \"tabbable\";\n\n/**\n * Options for the useKeyboardFocusables hook\n */\ntype OptionProps =\n | {\n /**\n * Disable mutation observer\n */\n observeChange: false;\n }\n | {\n /**\n * Enable mutation observer with optional configuration\n */\n observeChange: true;\n /**\n * Observe attribute changes\n */\n attributes?: boolean;\n /**\n * Observe text content changes\n */\n characterData?: boolean;\n /**\n * Observe child element changes\n */\n childList?: boolean;\n /**\n * Observe descendant changes\n */\n subtree?: boolean;\n };\n\n/**\n * Custom hook for tracking keyboard focusable elements within a container.\n *\n * Features:\n * - Tracks all keyboard focusable elements within a target container\n * - Supports both ref objects and direct element references\n * - Optional mutation observer for real-time updates\n * - Debounced updates to prevent excessive re-renders\n * - Configurable mutation observer options\n * - Manual update function for immediate refresh\n * - Uses tabbable library for accurate focusable detection\n * - Automatically cleans up mutation observer\n *\n * @param element - Target element or ref to monitor for focusable elements\n * @param options - Configuration options for mutation observer behavior\n * @returns Object containing current focusable elements and update function\n */\nexport const useKeyboardFocusables = (\n element: RefObject<HTMLElement> | HTMLElement | undefined,\n options: OptionProps = {\n observeChange: true,\n attributes: true,\n characterData: true,\n childList: true,\n subtree: true,\n },\n) => {\n const [focusables, setFocusables] = useState<FocusableElement[] | null>(null);\n const observerRef = useRef<MutationObserver>();\n\n useEffect(() => {\n const target = element instanceof HTMLElement ? element : element?.current;\n if (!target) return;\n if (!options.observeChange && !focusables) {\n setFocusables(tabbable(target as Element));\n return;\n }\n\n const mutationCallback = () => {\n const targetArr = tabbable(target as Element);\n if (targetArr.length === 0) return;\n setFocusables(targetArr);\n };\n\n const observer = new MutationObserver(mutationCallback);\n observerRef.current = observer;\n observer.observe(target, {\n childList: true, // Observe changes to child elements\n subtree: true, // Observe changes to descendants of the target\n attributes: true, // Observe changes to attributes\n characterData: true, // Observe changes to text content\n });\n return () => {\n observer.disconnect();\n };\n }, [element, options, focusables]);\n\n return { focusables };\n};\n"],"names":[],"mappings":";;;;AAEA,MAAM,mBAAA,GAAsB,kBAAA;AAC5B,MAAM,mBAAA,GAAsB,uBAAA;AA0CrB,MAAM,sBAAsB,CAAC;AAAA,EAClC,IAAA;AAAA,EACA,EAAA;AAAA,EACA,oBAAA;AAAA,EACA;AACF,CAAA,KAAgC;AAC9B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,oBAAA,SAA6B,MAAM;AAAA,IAAC,CAAA;AACxC,IAAA,MAAM,IAAA,GAAO,UAAA,CAAW,OAAA,EAAS,WAAA,EAAY;AAC7C,IAAA,IAAI,EAAE,IAAA,YAAgB,UAAA,CAAA,EAAa,OAAO,MAAM;AAAA,IAAC,CAAA;AAEjD,IAAA,MAAM,sBAAA,GAAyB,CAAC,SAAA,KAAuB;AACrD,MAAA,MAAM,cAAA,GACJ,IAAA,CAAK,IAAA,CACF,YAAA,CAAa,mBAAmB,CAAA,EAC/B,KAAA,CAAM,GAAG,CAAA,CACV,MAAA,CAAO,OAAO,CAAA,IAAK,EAAC;AAEzB,MAAA,MAAM,UAAA,GAAa,IAAI,GAAA,CAAI,cAAc,CAAA;AACzC,MAAA,IAAI,SAAA,EAAW;AACb,QAAA,UAAA,CAAW,IAAI,EAAE,CAAA;AAAA,MACnB,CAAA,MAAO;AACL,QAAA,UAAA,CAAW,OAAO,EAAE,CAAA;AAAA,MACtB;AAEA,MAAA,MAAM,UAAA,GAAa,KAAA,CAAM,IAAA,CAAK,UAAU,CAAA;AACxC,MAAA,IAAA,CAAK,KAAK,YAAA,CAAa,mBAAA,EAAqB,UAAA,CAAW,IAAA,CAAK,GAAG,CAAC,CAAA;AAEhE,MAAA,IAAI,UAAA,CAAW,SAAS,CAAA,EAAG;AACzB,QAAA,IAAA,CAAK,IA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