@servicetitan/anvil2 1.27.2 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/dist/AnvilProvider-C7Li86-d.js +16 -0
  3. package/dist/AnvilProvider-C7Li86-d.js.map +1 -0
  4. package/dist/AnvilProvider.js +1 -1
  5. package/dist/{Combobox-DnTI2I3L.js → Combobox-DCrEfyl2.js} +2209 -228
  6. package/dist/Combobox-DCrEfyl2.js.map +1 -0
  7. package/dist/Combobox.css +443 -69
  8. package/dist/Combobox.js +1 -1
  9. package/dist/DateField-4jR9NvbC.js +1109 -0
  10. package/dist/DateField-4jR9NvbC.js.map +1 -0
  11. package/dist/DateField.js +1 -1
  12. package/dist/{Dialog-DQ9QXB5D.js → Dialog-CL3bfZuB.js} +2 -2
  13. package/dist/{Dialog-DQ9QXB5D.js.map → Dialog-CL3bfZuB.js.map} +1 -1
  14. package/dist/{Dialog-Kh2tcVWz-DqcNnouf.js → Dialog-CYBt_JdP-CmF0MUHL.js} +80 -51
  15. package/dist/Dialog-CYBt_JdP-CmF0MUHL.js.map +1 -0
  16. package/dist/Dialog.js +1 -1
  17. package/dist/Drawer-8nHrKktU.js +66 -0
  18. package/dist/Drawer-8nHrKktU.js.map +1 -0
  19. package/dist/{Drawer-C6fpnRDX.js → Drawer-UQlX-LQG-BSCnMRad.js} +97 -130
  20. package/dist/Drawer-UQlX-LQG-BSCnMRad.js.map +1 -0
  21. package/dist/{Drawer.css → Drawer-UQlX-LQG.css} +26 -25
  22. package/dist/Drawer.js +1 -1
  23. package/dist/{AnvilProvider-DNJk1Ait.js → HammerProvider-DuxhW0gv-C2voN5ro.js} +26 -15
  24. package/dist/HammerProvider-DuxhW0gv-C2voN5ro.js.map +1 -0
  25. package/dist/InputMask-B8N8PP1W-DlUKpMR4.js +323 -0
  26. package/dist/InputMask-B8N8PP1W-DlUKpMR4.js.map +1 -0
  27. package/dist/{InputMask-Ceh574pv.js → InputMask-jsL7rSOk.js} +2 -2
  28. package/dist/{InputMask-Ceh574pv.js.map → InputMask-jsL7rSOk.js.map} +1 -1
  29. package/dist/InputMask.js +1 -1
  30. package/dist/{Label-DWF2pXeG-1BhzVgZG.js → Label-CUVr-jvI-BXhER5eQ.js} +3 -3
  31. package/dist/{Label-DWF2pXeG-1BhzVgZG.js.map → Label-CUVr-jvI-BXhER5eQ.js.map} +1 -1
  32. package/dist/Menu-CsfX8-_z.js +1091 -0
  33. package/dist/Menu-CsfX8-_z.js.map +1 -0
  34. package/dist/Menu.css +116 -1
  35. package/dist/Menu.js +1 -1
  36. package/dist/{Page-BGkLs3bR.js → Page-vKi5JkDS.js} +70 -54
  37. package/dist/Page-vKi5JkDS.js.map +1 -0
  38. package/dist/Page.css +103 -70
  39. package/dist/Page.js +1 -1
  40. package/dist/{Popover-DzEc_Muv.js → Popover-OFlyW8gN.js} +2 -2
  41. package/dist/{Popover-DzEc_Muv.js.map → Popover-OFlyW8gN.js.map} +1 -1
  42. package/dist/{Popover-QKZtjN4_-CETYlWwq.js → Popover-tu_N1aS6-CSLR1Xzc.js} +351 -12
  43. package/dist/Popover-tu_N1aS6-CSLR1Xzc.js.map +1 -0
  44. package/dist/{Popover-QKZtjN4_.css → Popover-tu_N1aS6.css} +53 -1
  45. package/dist/Popover.js +1 -1
  46. package/dist/{ProgressBar-cKtBso7j-3CDyBaAN.js → ProgressBar-DQ1lsFk2-Ci4eqzM0.js} +3 -3
  47. package/dist/{ProgressBar-cKtBso7j-3CDyBaAN.js.map → ProgressBar-DQ1lsFk2-Ci4eqzM0.js.map} +1 -1
  48. package/dist/{ProgressBar-IItIByYc.js → ProgressBar-gVRLaKPz.js} +2 -2
  49. package/dist/{ProgressBar-IItIByYc.js.map → ProgressBar-gVRLaKPz.js.map} +1 -1
  50. package/dist/ProgressBar.js +1 -1
  51. package/dist/{SearchField-CWb0kaV8.js → SearchField-C-4icPUa.js} +2 -2
  52. package/dist/{SearchField-CWb0kaV8.js.map → SearchField-C-4icPUa.js.map} +1 -1
  53. package/dist/SearchField.js +1 -1
  54. package/dist/{TextField-D53XNiCi-C6_A5VRq.js → TextField-B8LHWOoC-DSV9zY-z.js} +2 -2
  55. package/dist/{TextField-D53XNiCi-C6_A5VRq.js.map → TextField-B8LHWOoC-DSV9zY-z.js.map} +1 -1
  56. package/dist/{TextField-s92xHzb3.js → TextField-DgxJO1a7.js} +2 -2
  57. package/dist/{TextField-s92xHzb3.js.map → TextField-DgxJO1a7.js.map} +1 -1
  58. package/dist/TextField.js +1 -1
  59. package/dist/{Textarea-B61wNIFr.js → Textarea-B-Dv2RXs.js} +2 -2
  60. package/dist/{Textarea-B61wNIFr.js.map → Textarea-B-Dv2RXs.js.map} +1 -1
  61. package/dist/Textarea.js +1 -1
  62. package/dist/Toast.js +1 -1
  63. package/dist/{Toolbar-Cge6Nznj.js → Toolbar-7BeCY61H.js} +2 -2
  64. package/dist/{Toolbar-Cge6Nznj.js.map → Toolbar-7BeCY61H.js.map} +1 -1
  65. package/dist/Toolbar.js +1 -1
  66. package/dist/{Tooltip-89FIvMG0.js → Tooltip-BVBq-KxK.js} +2 -2
  67. package/dist/{Tooltip-89FIvMG0.js.map → Tooltip-BVBq-KxK.js.map} +1 -1
  68. package/dist/{Tooltip-DgM8NSPm-CRIQbuTm.js → Tooltip-C8sCGmKM-CLrDofvy.js} +222 -22
  69. package/dist/Tooltip-C8sCGmKM-CLrDofvy.js.map +1 -0
  70. package/dist/{Tooltip-DgM8NSPm.css → Tooltip-C8sCGmKM.css} +43 -1
  71. package/dist/Tooltip.js +1 -1
  72. package/dist/components/Dialog/Dialog.d.ts +1 -0
  73. package/dist/components/Drawer/Drawer.d.ts +1 -0
  74. package/dist/components/Page/Page.d.ts +4 -1
  75. package/dist/floating-ui.react-4AwURJA3.js +5989 -0
  76. package/dist/floating-ui.react-4AwURJA3.js.map +1 -0
  77. package/dist/{useKeyboardFocusables-CwVMAe5C-CIHqixNA.js → index.esm-CunAFnrh.js} +11 -59
  78. package/dist/index.esm-CunAFnrh.js.map +1 -0
  79. package/dist/index.js +16 -16
  80. package/dist/supportsPopover-8aJR37cf-8aJR37cf.js +6 -0
  81. package/dist/supportsPopover-8aJR37cf-8aJR37cf.js.map +1 -0
  82. package/dist/{toast-CHld8RKY.js → toast-CbokOkfo.js} +6 -2
  83. package/dist/toast-CbokOkfo.js.map +1 -0
  84. package/dist/useKeyboardFocusables-CwVMAe5C-DtjYOAmt.js +61 -0
  85. package/dist/useKeyboardFocusables-CwVMAe5C-DtjYOAmt.js.map +1 -0
  86. package/package.json +3 -3
  87. package/dist/AnvilProvider-DNJk1Ait.js.map +0 -1
  88. package/dist/Combobox-DnTI2I3L.js.map +0 -1
  89. package/dist/DateField-DocC46Mw.js +0 -565
  90. package/dist/DateField-DocC46Mw.js.map +0 -1
  91. package/dist/Dialog-Kh2tcVWz-DqcNnouf.js.map +0 -1
  92. package/dist/Drawer-C6fpnRDX.js.map +0 -1
  93. package/dist/InputMask-DQXw5qvG-BH4P-Woc.js +0 -195
  94. package/dist/InputMask-DQXw5qvG-BH4P-Woc.js.map +0 -1
  95. package/dist/Menu-D8SDm9s9.js +0 -706
  96. package/dist/Menu-D8SDm9s9.js.map +0 -1
  97. package/dist/Page-BGkLs3bR.js.map +0 -1
  98. package/dist/Popover-QKZtjN4_-CETYlWwq.js.map +0 -1
  99. package/dist/Tooltip-DgM8NSPm-CRIQbuTm.js.map +0 -1
  100. package/dist/floating-ui.react-P5949bpO.js +0 -28
  101. package/dist/floating-ui.react-P5949bpO.js.map +0 -1
  102. package/dist/floating-ui.react-dom-D912oS4K.js +0 -1841
  103. package/dist/floating-ui.react-dom-D912oS4K.js.map +0 -1
  104. package/dist/toast-CHld8RKY.js.map +0 -1
  105. package/dist/useKeyboardFocusables-CwVMAe5C-CIHqixNA.js.map +0 -1
  106. /package/dist/{Dialog-Kh2tcVWz.css → Dialog-CYBt_JdP.css} +0 -0
  107. /package/dist/{Label-DWF2pXeG.css → Label-CUVr-jvI.css} +0 -0
  108. /package/dist/{ProgressBar-cKtBso7j.css → ProgressBar-DQ1lsFk2.css} +0 -0
@@ -1,40 +1,38 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { forwardRef, createContext, useRef, useState, useId, useCallback, useEffect, useMemo, useContext } from 'react';
3
- import { useTrackingId } from './useTrackingId.js';
2
+ import { forwardRef, createContext, useRef, useState, useEffect, useMemo, useContext } from 'react';
4
3
  import { c as cx } from './index-tZvMCc77.js';
5
4
  import { S as SvgClose } from './close-DZj38AEh.js';
6
5
  import { T as Text } from './Text-C2n3GDdC-rz_AelM0.js';
7
6
  import { B as Button } from './Button-Ce--YZ9L-Csh0Zzuf.js';
8
7
  import { u as useMergeRefs } from './useMergeRefs-Bde85AWI-Bde85AWI.js';
9
- import { u as useKeyboardFocusables } from './useKeyboardFocusables-CwVMAe5C-CIHqixNA.js';
10
- import { c as childrenToString } from './childrenToString-Bz9MqbHb-Bz9MqbHb.js';
8
+ import { u as useKeyboardFocusables } from './useKeyboardFocusables-CwVMAe5C-DtjYOAmt.js';
11
9
 
12
- import './Drawer.css';const drawer = "_drawer_1gqlt_3";
13
- const container = "_container_1gqlt_28";
14
- const content = "_content_1gqlt_41";
15
- const header = "_header_1gqlt_48";
16
- const footer = "_footer_1gqlt_72";
17
- const remove = "_remove_1gqlt_90";
18
- const large = "_large_1gqlt_99";
19
- const sticky = "_sticky_1gqlt_102";
10
+ import './Drawer-UQlX-LQG.css';const drawer = "_drawer_pysn1_3";
11
+ const container = "_container_pysn1_29";
12
+ const content = "_content_pysn1_42";
13
+ const header = "_header_pysn1_49";
14
+ const footer = "_footer_pysn1_73";
15
+ const remove = "_remove_pysn1_91";
16
+ const large = "_large_pysn1_100";
17
+ const sticky = "_sticky_pysn1_103";
20
18
  const styles = {
21
19
  drawer: drawer,
22
- "close-drawer": "_close-drawer_1gqlt_1",
23
- "open-drawer": "_open-drawer_1gqlt_1",
24
- "open-backdrop": "_open-backdrop_1gqlt_1",
20
+ "close-drawer": "_close-drawer_pysn1_1",
21
+ "open-drawer": "_open-drawer_pysn1_1",
22
+ "open-backdrop": "_open-backdrop_pysn1_1",
25
23
  container: container,
26
24
  content: content,
27
25
  header: header,
28
- "close-container": "_close-container_1gqlt_65",
26
+ "close-container": "_close-container_pysn1_66",
29
27
  footer: footer,
30
28
  remove: remove,
31
- "close-backdrop": "_close-backdrop_1gqlt_1",
29
+ "close-backdrop": "_close-backdrop_pysn1_1",
32
30
  large: large,
33
31
  sticky: sticky,
34
- "close-button": "_close-button_1gqlt_108"
32
+ "close-button": "_close-button_pysn1_109"
35
33
  };
36
34
 
37
- const DrawerCancelButton$1 = forwardRef((props, ref) => {
35
+ const DrawerCancelButton = forwardRef((props, ref) => {
38
36
  const { onClick, ...rest } = props;
39
37
  const { close } = useDrawerContext();
40
38
  const onClickHandler = (e) => {
@@ -52,15 +50,15 @@ const DrawerCancelButton$1 = forwardRef((props, ref) => {
52
50
  }
53
51
  );
54
52
  });
55
- DrawerCancelButton$1.displayName = "DrawerCancelButton";
53
+ DrawerCancelButton.displayName = "DrawerCancelButton";
56
54
 
57
- const DrawerHeader$1 = forwardRef(
55
+ const DrawerHeader = forwardRef(
58
56
  (props, ref) => {
59
57
  const { children } = props;
60
58
  return /* @__PURE__ */ jsxs("header", { className: styles.header, "data-anv": "drawer-header", ref, children: [
61
59
  /* @__PURE__ */ jsx(Text, { variant: "headline", el: "h1", children }),
62
60
  /* @__PURE__ */ jsx("span", { className: styles["close-container"], children: /* @__PURE__ */ jsx(
63
- DrawerCancelButton$1,
61
+ DrawerCancelButton,
64
62
  {
65
63
  className: styles["close-button"],
66
64
  size: "small",
@@ -73,9 +71,9 @@ const DrawerHeader$1 = forwardRef(
73
71
  ] });
74
72
  }
75
73
  );
76
- DrawerHeader$1.displayName = "DrawerHeader";
74
+ DrawerHeader.displayName = "DrawerHeader";
77
75
 
78
- const DrawerFooter$1 = forwardRef(
76
+ const DrawerFooter = forwardRef(
79
77
  (props, ref) => {
80
78
  const { children, sticky = false, ...rest } = props;
81
79
  const DrawerFooterCX = cx(styles.footer, {
@@ -93,9 +91,9 @@ const DrawerFooter$1 = forwardRef(
93
91
  );
94
92
  }
95
93
  );
96
- DrawerFooter$1.displayName = "DrawerFooter";
94
+ DrawerFooter.displayName = "DrawerFooter";
97
95
 
98
- const DrawerContent$1 = forwardRef(
96
+ const DrawerContent = forwardRef(
99
97
  (props, ref) => {
100
98
  const { children, ...rest } = props;
101
99
  const DrawerContentCX = cx(styles.content, {});
@@ -111,10 +109,10 @@ const DrawerContent$1 = forwardRef(
111
109
  );
112
110
  }
113
111
  );
114
- DrawerContent$1.displayName = "DrawerContent";
112
+ DrawerContent.displayName = "DrawerContent";
115
113
 
116
114
  const DrawerContext = createContext(null);
117
- const DrawerElement$1 = forwardRef(
115
+ const DrawerElement = forwardRef(
118
116
  (props, ref) => {
119
117
  const {
120
118
  className,
@@ -128,70 +126,90 @@ const DrawerElement$1 = forwardRef(
128
126
  disableCloseOnEscape = false,
129
127
  disableCloseOnClickOutside = false,
130
128
  size = "medium",
129
+ enableScrollChaining,
131
130
  ...rest
132
131
  } = props;
133
132
  const elRef = useRef(null);
134
133
  const contentRef = useRef(null);
135
- const bodyRef = useRef(null);
136
134
  const combinedRef = useMergeRefs([elRef, ref]);
137
135
  const [remove, setRemove] = useState(false);
138
- const id = useId();
139
136
  const DrawerClassNames = cx([styles.drawer], className, {
140
137
  [styles.remove]: remove,
141
138
  [styles.large]: size === "large"
142
139
  });
143
- const { focusables, updateFocusables } = useKeyboardFocusables(contentRef, {
140
+ const { focusables } = useKeyboardFocusables(contentRef, {
144
141
  observeChange: false
145
142
  });
146
143
  const firstFocusable = focusables?.[0];
147
144
  const lastFocusable = focusables?.[focusables.length - 1];
148
- const removeBodyClass = useCallback(() => {
149
- if (bodyRef.current) {
150
- const drawersOpen = bodyRef.current.dataset.drawersOpen ? bodyRef.current.dataset.drawersOpen.split(" ") : [];
151
- const newDrawersOpen = drawersOpen.filter((item) => item !== id);
152
- if (newDrawersOpen.length === 0) {
153
- bodyRef.current.removeAttribute("data-drawers-open");
154
- bodyRef.current?.classList.remove("drawer-open");
155
- } else {
156
- bodyRef.current.dataset.drawersOpen = newDrawersOpen.join(" ");
157
- }
158
- }
159
- }, [id]);
160
145
  useEffect(() => {
161
146
  if (open) {
162
147
  onOpen?.();
163
148
  elRef.current?.showModal();
164
- if (!bodyRef.current) {
165
- const body = elRef.current?.closest("body");
166
- body && (bodyRef.current = body);
167
- }
168
- updateFocusables();
169
- if (focusables) {
170
- if (focusables[0]?.dataset.anv === "drawer-header-close-button" && focusables[1]) {
171
- focusables[1].focus();
172
- } else {
173
- focusables[0]?.focus();
174
- }
175
- }
176
- bodyRef.current?.classList.add("drawer-open");
177
- if (bodyRef.current) {
178
- const drawersOpen = bodyRef.current.dataset.drawersOpen ? bodyRef.current.dataset.drawersOpen.split(" ") : [];
179
- if (drawersOpen.includes(id)) return;
180
- drawersOpen.push(id);
181
- bodyRef.current.dataset.drawersOpen = drawersOpen.join(" ");
182
- }
183
149
  return;
184
150
  }
185
151
  setRemove(true);
186
152
  setTimeout(() => {
187
153
  elRef.current?.close();
188
- removeBodyClass();
189
154
  setRemove(false);
190
155
  }, 200);
191
- }, [id, onOpen, open, removeBodyClass]);
156
+ }, [onOpen, open]);
157
+ useEffect(() => {
158
+ if (!open) return;
159
+ if (!focusables) return;
160
+ if (focusables[0]?.dataset.anv === "drawer-header-close-button" && focusables[1]) {
161
+ focusables[1].focus();
162
+ } else {
163
+ focusables[0]?.focus();
164
+ }
165
+ }, [open, focusables]);
192
166
  useEffect(() => {
193
- return () => removeBodyClass();
194
- }, [removeBodyClass]);
167
+ if (!open || enableScrollChaining) return;
168
+ let blockDocumentScroll = false;
169
+ const content = contentRef.current;
170
+ const scrollHandler = (e) => {
171
+ const target = e.target;
172
+ const isShadow2 = contentRef.current?.getRootNode() instanceof ShadowRoot;
173
+ const isOverflowing = elRef.current && elRef.current.scrollHeight > elRef.current.clientHeight;
174
+ if (isShadow2) {
175
+ if (blockDocumentScroll) {
176
+ e.preventDefault();
177
+ return;
178
+ }
179
+ return;
180
+ }
181
+ if (!isOverflowing || !content?.contains(target)) {
182
+ e.preventDefault();
183
+ return;
184
+ }
185
+ return;
186
+ };
187
+ const shadowScrollHandler = (e) => {
188
+ const target = e.target;
189
+ const isTargetInsideContent = content?.contains(target);
190
+ const isOverflowing = elRef.current && elRef.current.scrollHeight > elRef.current.clientHeight;
191
+ blockDocumentScroll = !isTargetInsideContent;
192
+ if (!isOverflowing || !content?.contains(target)) {
193
+ e.preventDefault();
194
+ }
195
+ return;
196
+ };
197
+ const isShadow = content?.getRootNode() instanceof ShadowRoot;
198
+ document.addEventListener("wheel", scrollHandler, {
199
+ passive: false
200
+ });
201
+ if (isShadow) {
202
+ content?.getRootNode().addEventListener("wheel", shadowScrollHandler, {
203
+ passive: false
204
+ });
205
+ }
206
+ return () => {
207
+ document.getRootNode().removeEventListener("wheel", scrollHandler);
208
+ if (isShadow) {
209
+ content?.getRootNode().removeEventListener("wheel", shadowScrollHandler);
210
+ }
211
+ };
212
+ }, [enableScrollChaining, open]);
195
213
  const onCancelHandler = (e) => {
196
214
  e.preventDefault();
197
215
  if (disableCloseOnEscape) return;
@@ -225,13 +243,12 @@ const DrawerElement$1 = forwardRef(
225
243
  const close = () => {
226
244
  setRemove(true);
227
245
  setTimeout(() => {
228
- removeBodyClass();
229
246
  elRef.current?.close();
230
247
  onClose?.();
231
248
  }, 200);
232
249
  };
233
250
  return { close };
234
- }, [onClose, removeBodyClass]);
251
+ }, [onClose]);
235
252
  return (
236
253
  // dialog element does seem to be interactive on MDN guideline
237
254
  // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
@@ -245,7 +262,15 @@ const DrawerElement$1 = forwardRef(
245
262
  onClick: onClickHandler,
246
263
  onKeyDown: onKeyDownHandler,
247
264
  ...rest,
248
- children: /* @__PURE__ */ jsx(DrawerContext.Provider, { value, children: /* @__PURE__ */ jsx("section", { ref: contentRef, className: styles.container, children }) })
265
+ children: /* @__PURE__ */ jsx(DrawerContext.Provider, { value, children: /* @__PURE__ */ jsx(
266
+ "section",
267
+ {
268
+ ref: contentRef,
269
+ className: styles.container,
270
+ "data-open": open,
271
+ children
272
+ }
273
+ ) })
249
274
  }
250
275
  )
251
276
  );
@@ -260,65 +285,7 @@ function useDrawerContext() {
260
285
  }
261
286
  return context;
262
287
  }
263
- DrawerElement$1.displayName = "Drawer";
264
- const Drawer$1 = Object.assign(DrawerElement$1, {
265
- Header: DrawerHeader$1,
266
- Footer: DrawerFooter$1,
267
- Content: DrawerContent$1,
268
- CancelButton: DrawerCancelButton$1
269
- });
270
-
271
- const DrawerElement = forwardRef(
272
- (props, ref) => {
273
- return /* @__PURE__ */ jsx(Drawer$1, { ref, ...props });
274
- }
275
- );
276
- const DrawerCancelButton = forwardRef(
277
- (props, ref) => {
278
- const data = {
279
- children: childrenToString(props.children),
280
- appearance: props.appearance,
281
- size: props.size,
282
- type: props.type
283
- };
284
- const trackingId = useTrackingId({
285
- name: "DrawerCancelButton",
286
- data,
287
- hasOverride: !!props["data-tracking-id"]
288
- });
289
- return /* @__PURE__ */ jsx(
290
- DrawerCancelButton$1,
291
- {
292
- ref,
293
- "data-tracking-id": trackingId,
294
- ...props
295
- }
296
- );
297
- }
298
- );
299
- const DrawerFooter = forwardRef(
300
- (props, ref) => {
301
- return /* @__PURE__ */ jsx(DrawerFooter$1, { ref, ...props });
302
- }
303
- );
304
- const DrawerHeader = forwardRef(
305
- (props, ref) => {
306
- const data = {
307
- children: childrenToString(props.children)
308
- };
309
- const trackingId = useTrackingId({
310
- name: "DrawerHeader",
311
- data,
312
- hasOverride: !!props["data-tracking-id"]
313
- });
314
- return /* @__PURE__ */ jsx(DrawerHeader$1, { ref, "data-tracking-id": trackingId, ...props });
315
- }
316
- );
317
- const DrawerContent = forwardRef(
318
- (props, ref) => {
319
- return /* @__PURE__ */ jsx(DrawerContent$1, { ref, ...props });
320
- }
321
- );
288
+ DrawerElement.displayName = "Drawer";
322
289
  const Drawer = Object.assign(DrawerElement, {
323
290
  Header: DrawerHeader,
324
291
  Footer: DrawerFooter,
@@ -326,5 +293,5 @@ const Drawer = Object.assign(DrawerElement, {
326
293
  CancelButton: DrawerCancelButton
327
294
  });
328
295
 
329
- export { Drawer as D, DrawerCancelButton as a, DrawerFooter as b, DrawerHeader as c, DrawerContent as d };
330
- //# sourceMappingURL=Drawer-C6fpnRDX.js.map
296
+ export { Drawer as D, DrawerCancelButton as a, DrawerFooter as b, DrawerHeader as c, DrawerContent as d, DrawerContext as e };
297
+ //# sourceMappingURL=Drawer-UQlX-LQG-BSCnMRad.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer-UQlX-LQG-BSCnMRad.js","sources":["../../hammer-react/dist/Drawer-UQlX-LQG.js"],"sourcesContent":["import { jsx, jsxs } from 'react/jsx-runtime';\nimport { forwardRef, createContext, useRef, useState, useEffect, useMemo, useContext } from 'react';\nimport cx from 'classnames';\nimport Close from '@servicetitan/hammer-icon/mdi/round/close.svg';\nimport { T as Text } from './Text-C2n3GDdC.js';\nimport { B as Button } from './Button-Ce--YZ9L.js';\nimport { u as useMergeRefs } from './useMergeRefs-Bde85AWI.js';\nimport { u as useKeyboardFocusables } from './useKeyboardFocusables-CwVMAe5C.js';\n\nimport './Drawer.css';const drawer = \"_drawer_pysn1_3\";\nconst container = \"_container_pysn1_29\";\nconst content = \"_content_pysn1_42\";\nconst header = \"_header_pysn1_49\";\nconst footer = \"_footer_pysn1_73\";\nconst remove = \"_remove_pysn1_91\";\nconst large = \"_large_pysn1_100\";\nconst sticky = \"_sticky_pysn1_103\";\nconst styles = {\n\tdrawer: drawer,\n\t\"close-drawer\": \"_close-drawer_pysn1_1\",\n\t\"open-drawer\": \"_open-drawer_pysn1_1\",\n\t\"open-backdrop\": \"_open-backdrop_pysn1_1\",\n\tcontainer: container,\n\tcontent: content,\n\theader: header,\n\t\"close-container\": \"_close-container_pysn1_66\",\n\tfooter: footer,\n\tremove: remove,\n\t\"close-backdrop\": \"_close-backdrop_pysn1_1\",\n\tlarge: large,\n\tsticky: sticky,\n\t\"close-button\": \"_close-button_pysn1_109\"\n};\n\nconst DrawerCancelButton = forwardRef((props, ref) => {\n const { onClick, ...rest } = props;\n const { close } = useDrawerContext();\n const onClickHandler = (e) => {\n onClick?.(e);\n close();\n };\n return /* @__PURE__ */ jsx(\n Button,\n {\n \"aria-label\": \"Close drawer\",\n \"data-anv\": \"drawer-cancel-button\",\n onClick: onClickHandler,\n ref,\n ...rest\n }\n );\n});\nDrawerCancelButton.displayName = \"DrawerCancelButton\";\n\nconst DrawerHeader = forwardRef(\n (props, ref) => {\n const { children } = props;\n return /* @__PURE__ */ jsxs(\"header\", { className: styles.header, \"data-anv\": \"drawer-header\", ref, children: [\n /* @__PURE__ */ jsx(Text, { variant: \"headline\", el: \"h1\", children }),\n /* @__PURE__ */ jsx(\"span\", { className: styles[\"close-container\"], children: /* @__PURE__ */ jsx(\n DrawerCancelButton,\n {\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 ) })\n ] });\n }\n);\nDrawerHeader.displayName = \"DrawerHeader\";\n\nconst DrawerFooter = forwardRef(\n (props, ref) => {\n const { children, sticky = false, ...rest } = props;\n const DrawerFooterCX = cx(styles.footer, {\n [styles[\"sticky\"]]: sticky\n });\n return /* @__PURE__ */ jsx(\n \"footer\",\n {\n className: DrawerFooterCX,\n \"data-anv\": \"drawer-footer\",\n ref,\n ...rest,\n children\n }\n );\n }\n);\nDrawerFooter.displayName = \"DrawerFooter\";\n\nconst DrawerContent = forwardRef(\n (props, ref) => {\n const { children, ...rest } = props;\n const DrawerContentCX = cx(styles.content, {});\n return /* @__PURE__ */ jsx(\n \"div\",\n {\n className: DrawerContentCX,\n \"data-anv\": \"drawer-content\",\n ref,\n ...rest,\n children\n }\n );\n }\n);\nDrawerContent.displayName = \"DrawerContent\";\n\nconst DrawerContext = createContext(null);\nconst DrawerElement = forwardRef(\n (props, ref) => {\n const {\n className,\n open = false,\n children,\n onOpen,\n onClose,\n onCancel,\n onClick,\n onKeyDown,\n disableCloseOnEscape = false,\n disableCloseOnClickOutside = false,\n size = \"medium\",\n enableScrollChaining,\n ...rest\n } = props;\n const elRef = useRef(null);\n const contentRef = useRef(null);\n const combinedRef = useMergeRefs([elRef, ref]);\n const [remove, setRemove] = useState(false);\n const DrawerClassNames = cx([styles.drawer], className, {\n [styles.remove]: remove,\n [styles.large]: size === \"large\"\n });\n const { focusables } = useKeyboardFocusables(contentRef, {\n observeChange: false\n });\n const firstFocusable = focusables?.[0];\n const lastFocusable = focusables?.[focusables.length - 1];\n useEffect(() => {\n if (open) {\n onOpen?.();\n elRef.current?.showModal();\n return;\n }\n setRemove(true);\n setTimeout(() => {\n elRef.current?.close();\n setRemove(false);\n }, 200);\n }, [onOpen, open]);\n useEffect(() => {\n if (!open) return;\n if (!focusables) return;\n if (focusables[0]?.dataset.anv === \"drawer-header-close-button\" && focusables[1]) {\n focusables[1].focus();\n } else {\n focusables[0]?.focus();\n }\n }, [open, focusables]);\n useEffect(() => {\n if (!open || enableScrollChaining) return;\n let blockDocumentScroll = false;\n const content = contentRef.current;\n const scrollHandler = (e) => {\n const target = e.target;\n const isShadow2 = contentRef.current?.getRootNode() instanceof ShadowRoot;\n const isOverflowing = elRef.current && elRef.current.scrollHeight > elRef.current.clientHeight;\n if (isShadow2) {\n if (blockDocumentScroll) {\n e.preventDefault();\n return;\n }\n return;\n }\n if (!isOverflowing || !content?.contains(target)) {\n e.preventDefault();\n return;\n }\n return;\n };\n const shadowScrollHandler = (e) => {\n const target = e.target;\n const isTargetInsideContent = content?.contains(target);\n const isOverflowing = elRef.current && elRef.current.scrollHeight > elRef.current.clientHeight;\n blockDocumentScroll = !isTargetInsideContent;\n if (!isOverflowing || !content?.contains(target)) {\n e.preventDefault();\n }\n return;\n };\n const isShadow = content?.getRootNode() instanceof ShadowRoot;\n document.addEventListener(\"wheel\", scrollHandler, {\n passive: false\n });\n if (isShadow) {\n content?.getRootNode().addEventListener(\"wheel\", shadowScrollHandler, {\n passive: false\n });\n }\n return () => {\n document.getRootNode().removeEventListener(\"wheel\", scrollHandler);\n if (isShadow) {\n content?.getRootNode().removeEventListener(\"wheel\", shadowScrollHandler);\n }\n };\n }, [enableScrollChaining, open]);\n const onCancelHandler = (e) => {\n e.preventDefault();\n if (disableCloseOnEscape) return;\n onClose?.();\n };\n const onClickHandler = (e) => {\n onClick?.(e);\n const target = e.target;\n if (!contentRef.current?.contains(target)) {\n e.preventDefault();\n if (disableCloseOnClickOutside) return;\n onClose?.();\n }\n };\n const onKeyDownHandler = (e) => {\n onKeyDown?.(e);\n if (e.code === \"Tab\") {\n if (e.shiftKey && e.target === firstFocusable) {\n e.preventDefault();\n lastFocusable?.focus();\n return;\n }\n if (e.target === lastFocusable && !e.shiftKey) {\n e.preventDefault();\n firstFocusable?.focus();\n return;\n }\n }\n };\n const value = useMemo(() => {\n const close = () => {\n setRemove(true);\n setTimeout(() => {\n elRef.current?.close();\n onClose?.();\n }, 200);\n };\n return { close };\n }, [onClose]);\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 /* @__PURE__ */ jsx(\n \"dialog\",\n {\n className: DrawerClassNames,\n \"data-anv\": \"drawer\",\n ref: combinedRef,\n onCancel: onCancelHandler,\n onClick: onClickHandler,\n onKeyDown: onKeyDownHandler,\n ...rest,\n children: /* @__PURE__ */ jsx(DrawerContext.Provider, { value, children: /* @__PURE__ */ jsx(\n \"section\",\n {\n ref: contentRef,\n className: styles.container,\n \"data-open\": open,\n children\n }\n ) })\n }\n )\n );\n }\n);\nfunction 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}\nDrawerElement.displayName = \"Drawer\";\nconst Drawer = Object.assign(DrawerElement, {\n Header: DrawerHeader,\n Footer: DrawerFooter,\n Content: DrawerContent,\n CancelButton: DrawerCancelButton\n});\n\nexport { Drawer as D, DrawerContext as a, DrawerCancelButton as b, DrawerFooter as c, DrawerHeader as d, DrawerContent as e };\n//# sourceMappingURL=Drawer-UQlX-LQG.js.map\n"],"names":["Close"],"mappings":";;;;;;;;;AASsB,MAAM,MAAM,GAAG,iBAAiB;AACtD,MAAM,SAAS,GAAG,qBAAqB;AACvC,MAAM,OAAO,GAAG,mBAAmB;AACnC,MAAM,MAAM,GAAG,kBAAkB;AACjC,MAAM,MAAM,GAAG,kBAAkB;AACjC,MAAM,MAAM,GAAG,kBAAkB;AACjC,MAAM,KAAK,GAAG,kBAAkB;AAChC,MAAM,MAAM,GAAG,mBAAmB;AAClC,MAAM,MAAM,GAAG;AACf,CAAC,MAAM,EAAE,MAAM;AACf,CAAC,cAAc,EAAE,uBAAuB;AACxC,CAAC,aAAa,EAAE,sBAAsB;AACtC,CAAC,eAAe,EAAE,wBAAwB;AAC1C,CAAC,SAAS,EAAE,SAAS;AACrB,CAAC,OAAO,EAAE,OAAO;AACjB,CAAC,MAAM,EAAE,MAAM;AACf,CAAC,iBAAiB,EAAE,2BAA2B;AAC/C,CAAC,MAAM,EAAE,MAAM;AACf,CAAC,MAAM,EAAE,MAAM;AACf,CAAC,gBAAgB,EAAE,yBAAyB;AAC5C,CAAC,KAAK,EAAE,KAAK;AACb,CAAC,MAAM,EAAE,MAAM;AACf,CAAC,cAAc,EAAE;AACjB,CAAC;;AAEI,MAAC,kBAAkB,GAAG,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACtD,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK;AACpC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,gBAAgB,EAAE;AACtC,EAAE,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK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SAAS,EAAE,gBAAgB;AACrC,UAAU,UAAU,EAAE,QAAQ;AAC9B,UAAU,GAAG,EAAE,WAAW;AAC1B,UAAU,QAAQ,EAAE,eAAe;AACnC,UAAU,OAAO,EAAE,cAAc;AACjC,UAAU,SAAS,EAAE,gBAAgB;AACrC,UAAU,GAAG,IAAI;AACjB,UAAU,QAAQ,kBAAkB,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,QAAQ,kBAAkB,GAAG;AACtG,YAAY,SAAS;AACrB,YAAY;AACZ,cAAc,GAAG,EAAE,UAAU;AAC7B,cAAc,SAAS,EAAE,MAAM,CAAC,SAAS;AACzC,cAAc,WAAW,EAAE,IAAI;AAC/B,cAAc;AACd;AACA,WAAW,EAAE;AACb;AACA;AACA;AACA;AACA,CAAC;AACD,SAAS,gBAAgB,GAAG;AAC5B,EAAE,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,CAAC;AAC3C,EAAE,IAAI,CAAC,OAAO,EAAE;AAChB,IAAI,MAAM,IAAI,KAAK;AACnB,MAAM;AACN,KAAK;AACL;AACA,EAAE,OAAO,OAAO;AAChB;AACA,aAAa,CAAC,WAAW,GAAG,QAAQ;AAC/B,MAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE;AAC5C,EAAE,MAAM,EAAE,YAAY;AACtB,EAAE,MAAM,EAAE,YAAY;AACtB,EAAE,OAAO,EAAE,aAAa;AACxB,EAAE,YAAY,EAAE;AAChB,CAAC;;;;"}
@@ -2,13 +2,13 @@
2
2
 
3
3
  @layer starter, reset, base, state, application;
4
4
  @layer base {
5
- ._drawer_1gqlt_3 {
5
+ ._drawer_pysn1_3 {
6
6
  border: none;
7
7
  background: transparent;
8
8
  padding-block: 0;
9
9
  padding-inline: 0;
10
10
  outline: none;
11
- animation: _close-drawer_1gqlt_1 2s forwards;
11
+ animation: _close-drawer_pysn1_1 2s forwards;
12
12
  transition: width 200ms;
13
13
  width: 35rem;
14
14
  height: 100%;
@@ -19,15 +19,16 @@
19
19
  margin-block-end: 0;
20
20
  max-height: 100dvh;
21
21
  margin-inline-end: 0;
22
+ overscroll-behavior: contain;
22
23
  --xpos: 10rem;
23
24
  }
24
- ._drawer_1gqlt_3[open] {
25
- animation: _open-drawer_1gqlt_1 300ms forwards;
25
+ ._drawer_pysn1_3[open] {
26
+ animation: _open-drawer_pysn1_1 300ms forwards;
26
27
  }
27
- ._drawer_1gqlt_3[open]::backdrop {
28
- animation: _open-backdrop_1gqlt_1 200ms forwards;
28
+ ._drawer_pysn1_3[open]::backdrop {
29
+ animation: _open-backdrop_pysn1_1 200ms forwards;
29
30
  }
30
- ._drawer_1gqlt_3 ._container_1gqlt_28 {
31
+ ._drawer_pysn1_3 ._container_pysn1_29 {
31
32
  font-family: var(--font-family-base, "Nunito Sans", sans-serif);
32
33
  font-size: 100%;
33
34
  color: var(--foreground-color, #141414);
@@ -40,14 +41,14 @@
40
41
  gap: 1.5rem;
41
42
  min-height: 100%;
42
43
  }
43
- ._drawer_1gqlt_3 ._container_1gqlt_28 ._content_1gqlt_41 {
44
+ ._drawer_pysn1_3 ._container_pysn1_29 ._content_pysn1_42 {
44
45
  flex-grow: 1;
45
46
  padding-block-start: 0.25rem;
46
47
  padding-block-end: 0.25rem;
47
48
  font-size: 1rem;
48
49
  isolation: isolate;
49
50
  }
50
- ._header_1gqlt_48 {
51
+ ._header_pysn1_49 {
51
52
  position: sticky;
52
53
  inset-block-start: 0;
53
54
  display: flex;
@@ -60,18 +61,18 @@
60
61
  font-size: 1rem;
61
62
  z-index: 1;
62
63
  }
63
- ._header_1gqlt_48 h1 {
64
+ ._header_pysn1_49 h1 {
64
65
  margin-block: 0;
65
66
  margin-inline: 0;
66
67
  }
67
- ._header_1gqlt_48 ._close-container_1gqlt_65 {
68
+ ._header_pysn1_49 ._close-container_pysn1_66 {
68
69
  display: flex;
69
70
  justify-content: center;
70
71
  align-items: center;
71
72
  width: 1.5625rem;
72
73
  height: 1.5625rem;
73
74
  }
74
- ._footer_1gqlt_72 {
75
+ ._footer_pysn1_73 {
75
76
  display: flex;
76
77
  gap: 0.75rem;
77
78
  justify-content: flex-end;
@@ -85,36 +86,36 @@
85
86
  }
86
87
  @layer state {
87
88
  @media (prefers-reduced-motion: reduce) {
88
- ._drawer_1gqlt_3 {
89
+ ._drawer_pysn1_3 {
89
90
  --xpos: 0;
90
91
  }
91
92
  }
92
- ._drawer_1gqlt_3._remove_1gqlt_90[open] {
93
- animation: _close-drawer_1gqlt_1 300ms forwards;
93
+ ._drawer_pysn1_3._remove_pysn1_91[open] {
94
+ animation: _close-drawer_pysn1_1 300ms forwards;
94
95
  }
95
- ._drawer_1gqlt_3._remove_1gqlt_90[open]::backdrop {
96
- animation: _close-backdrop_1gqlt_1 200ms forwards;
96
+ ._drawer_pysn1_3._remove_pysn1_91[open]::backdrop {
97
+ animation: _close-backdrop_pysn1_1 200ms forwards;
97
98
  }
98
- ._drawer_1gqlt_3::backdrop {
99
+ ._drawer_pysn1_3::backdrop {
99
100
  background: #040404;
100
101
  }
101
- ._drawer_1gqlt_3._large_1gqlt_99 {
102
+ ._drawer_pysn1_3._large_pysn1_100 {
102
103
  width: 48rem;
103
104
  }
104
- ._drawer_1gqlt_3 ._footer_1gqlt_72._sticky_1gqlt_102 {
105
+ ._drawer_pysn1_3 ._footer_pysn1_73._sticky_pysn1_103 {
105
106
  position: sticky;
106
107
  inset-block-end: 0;
107
108
  }
108
109
  }
109
110
  @layer application {
110
- ._drawer_1gqlt_3 ._header_1gqlt_48 ._close-button_1gqlt_108 {
111
+ ._drawer_pysn1_3 ._header_pysn1_49 ._close-button_pysn1_109 {
111
112
  color: var(--foreground-color, #141414);
112
113
  }
113
114
  }
114
115
  .drawer-open {
115
116
  overflow: hidden;
116
117
  }
117
- @keyframes _open-drawer_1gqlt_1 {
118
+ @keyframes _open-drawer_pysn1_1 {
118
119
  from {
119
120
  opacity: 0;
120
121
  transform: translateX(var(--xpos));
@@ -124,7 +125,7 @@
124
125
  transform: translateX(0%);
125
126
  }
126
127
  }
127
- @keyframes _close-drawer_1gqlt_1 {
128
+ @keyframes _close-drawer_pysn1_1 {
128
129
  from {
129
130
  opacity: 1;
130
131
  transform: translateX(0%);
@@ -134,7 +135,7 @@
134
135
  transform: translateX(var(--xpos));
135
136
  }
136
137
  }
137
- @keyframes _open-backdrop_1gqlt_1 {
138
+ @keyframes _open-backdrop_pysn1_1 {
138
139
  from {
139
140
  opacity: 0;
140
141
  }
@@ -142,7 +143,7 @@
142
143
  opacity: 0.6;
143
144
  }
144
145
  }
145
- @keyframes _close-backdrop_1gqlt_1 {
146
+ @keyframes _close-backdrop_pysn1_1 {
146
147
  from {
147
148
  opacity: 0.6;
148
149
  }
package/dist/Drawer.js CHANGED
@@ -1,2 +1,2 @@
1
- export { D as Drawer, a as DrawerCancelButton, d as DrawerContent, b as DrawerFooter, c as DrawerHeader, D as default } from './Drawer-C6fpnRDX.js';
1
+ export { D as Drawer, a as DrawerCancelButton, d as DrawerContent, b as DrawerFooter, c as DrawerHeader, D as default } from './Drawer-8nHrKktU.js';
2
2
  //# sourceMappingURL=Drawer.js.map
@@ -1,7 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { T as TrackingProvider } from './TrackingProvider-BtSjkmpM.js';
3
2
  import { t as themeStyles, T as ThemeProvider } from './ThemeProvider-CioBp3gk-B6HyDICa.js';
4
- import { createContext, useMemo } from 'react';
3
+ import { createContext, useState, useMemo, useContext } from 'react';
5
4
  import { c as cx } from './index-tZvMCc77.js';
6
5
  import { u as useLayoutPropsUtil, a as useBreakpoint } from './useLayoutPropsUtil-C6qizVc6-BkgAan7h.js';
7
6
  import { a as useTranslations, L as LocalizationContext } from './LocalizationContext-UsmB5mnR-BUIYgNp2.js';
@@ -9,6 +8,16 @@ import { a as useTranslations, L as LocalizationContext } from './LocalizationCo
9
8
  const HammerProviderContext = createContext(
10
9
  {}
11
10
  );
11
+ const TooltipLegacyGroupContext = createContext(null);
12
+ const useTooltipLegacyGroup = () => {
13
+ const context = useContext(TooltipLegacyGroupContext);
14
+ if (context == null) {
15
+ throw new Error(
16
+ "Tooltip components must be wrapped in <HammerProvider /> or <TooltipGroupContext.Provider />"
17
+ );
18
+ }
19
+ return context;
20
+ };
12
21
  const HammerProvider = (props) => {
13
22
  const { layoutStyles, componentProps } = useLayoutPropsUtil(props);
14
23
  const { themeData, localizationData, children, className, style, ...rest } = componentProps;
@@ -26,8 +35,14 @@ const HammerProvider = (props) => {
26
35
  ...layoutStyles
27
36
  };
28
37
  const breakpoint = useBreakpoint();
38
+ const [disableDelayGroup, setDisableDelayGroup] = useState(false);
29
39
  const { translations: t } = useTranslations(translations);
30
40
  const localizationContextValue = useMemo(() => ({ locale, t }), [locale, t]);
41
+ const tooltipLegacyGroupContextValue = useMemo(
42
+ () => ({ disableDelayGroup: setDisableDelayGroup }),
43
+ // eslint-disable-next-line react-hooks/exhaustive-deps
44
+ [disableDelayGroup]
45
+ );
31
46
  return /* @__PURE__ */ jsx(HammerProviderContext.Provider, { value: { breakpoint }, children: /* @__PURE__ */ jsx(
32
47
  ThemeProvider,
33
48
  {
@@ -37,20 +52,16 @@ const HammerProvider = (props) => {
37
52
  mode: themeData?.mode,
38
53
  dir,
39
54
  ...rest,
40
- children: /* @__PURE__ */ jsx(LocalizationContext.Provider, { value: localizationContextValue, children })
55
+ children: /* @__PURE__ */ jsx(
56
+ TooltipLegacyGroupContext.Provider,
57
+ {
58
+ value: tooltipLegacyGroupContextValue,
59
+ children: /* @__PURE__ */ jsx(LocalizationContext.Provider, { value: localizationContextValue, children })
60
+ }
61
+ )
41
62
  }
42
63
  ) });
43
64
  };
44
65
 
45
- const AnvilProviderContext = HammerProviderContext;
46
- const AnvilProvider = ({
47
- children,
48
- trackingIdData,
49
- ...props
50
- }) => {
51
- const { scope = "ST", optOut } = trackingIdData ?? {};
52
- return /* @__PURE__ */ jsx(HammerProvider, { ...props, children: /* @__PURE__ */ jsx(TrackingProvider, { scope, optOut, children }) });
53
- };
54
-
55
- export { AnvilProvider as A, AnvilProviderContext as a };
56
- //# sourceMappingURL=AnvilProvider-DNJk1Ait.js.map
66
+ export { HammerProviderContext as H, HammerProvider as a, useTooltipLegacyGroup as u };
67
+ //# sourceMappingURL=HammerProvider-DuxhW0gv-C2voN5ro.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HammerProvider-DuxhW0gv-C2voN5ro.js","sources":["../../hammer-react/dist/HammerProvider-DuxhW0gv.js"],"sourcesContent":["import { jsx } from 'react/jsx-runtime';\nimport { t as themeStyles, T as ThemeProvider } from './ThemeProvider-CioBp3gk.js';\nimport { createContext, useState, useMemo, useContext } from 'react';\nimport cx from 'classnames';\nimport { u as useBreakpoint } from './useBreakpoint-DucsW-ug.js';\nimport { a as useTranslations, L as LocalizationContext } from './LocalizationContext-UsmB5mnR.js';\nimport { u as useLayoutPropsUtil } from './useLayoutPropsUtil-C6qizVc6.js';\n\nconst HammerProviderContext = createContext(\n {}\n);\nconst TooltipLegacyGroupContext = createContext(null);\nconst useTooltipLegacyGroup = () => {\n const context = useContext(TooltipLegacyGroupContext);\n if (context == null) {\n throw new Error(\n \"Tooltip components must be wrapped in <HammerProvider /> or <TooltipGroupContext.Provider />\"\n );\n }\n return context;\n};\nconst HammerProvider = (props) => {\n const { layoutStyles, componentProps } = useLayoutPropsUtil(props);\n const { themeData, localizationData, children, className, style, ...rest } = componentProps;\n const {\n locale = \"en\",\n dir = \"ltr\",\n translations = {}\n } = localizationData ?? {};\n const classNameCombined = cx(className, [themeStyles[\"theme-core\"]], {\n [themeStyles[\"mode-dark\"]]: themeData?.mode === \"dark\",\n [themeStyles[\"mode-light\"]]: themeData?.mode === \"light\"\n });\n const styleCombined = {\n ...style,\n ...layoutStyles\n };\n const breakpoint = useBreakpoint();\n const [disableDelayGroup, setDisableDelayGroup] = useState(false);\n const { translations: t } = useTranslations(translations);\n const localizationContextValue = useMemo(() => ({ locale, t }), [locale, t]);\n const tooltipLegacyGroupContextValue = useMemo(\n () => ({ disableDelayGroup: setDisableDelayGroup }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [disableDelayGroup]\n );\n return /* @__PURE__ */ jsx(HammerProviderContext.Provider, { value: { breakpoint }, children: /* @__PURE__ */ jsx(\n ThemeProvider,\n {\n className: classNameCombined,\n style: styleCombined,\n theme: themeData?.theme,\n mode: themeData?.mode,\n dir,\n ...rest,\n children: /* @__PURE__ */ jsx(\n TooltipLegacyGroupContext.Provider,\n {\n value: tooltipLegacyGroupContextValue,\n children: /* @__PURE__ */ jsx(LocalizationContext.Provider, { value: localizationContextValue, children })\n }\n )\n }\n ) });\n};\n\nexport { HammerProvider as H, HammerProviderContext as a, useTooltipLegacyGroup as u };\n//# sourceMappingURL=HammerProvider-DuxhW0gv.js.map\n"],"names":[],"mappings":";;;;;;;AAQK,MAAC,qBAAqB,GAAG,aAAa;AAC3C,EAAE;AACF;AACA,MAAM,yBAAyB,GAAG,aAAa,CAAC,IAAI,CAAC;AAChD,MAAC,qBAAqB,GAAG,MAAM;AACpC,EAAE,MAAM,OAAO,GAAG,UAAU,CAAC,yBAAyB,CAAC;AACvD,EAAE,IAAI,OAAO,IAAI,IAAI,EAAE;AACvB,IAAI,MAAM,IAAI,KAAK;AACnB,MAAM;AACN,KAAK;AACL;AACA,EAAE,OAAO,OAAO;AAChB;AACK,MAAC,cAAc,GAAG,CAAC,KAAK,KAAK;AAClC,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,kBAAkB,CAAC,KAAK,CAAC;AACpE,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,cAAc;AAC7F,EAAE,MAAM;AACR,IAAI,MAAM,GAAG,IAAI;AACjB,IAAI,GAAG,GAAG,KAAK;AACf,IAAI,YAAY,GAAG;AACnB,GAAG,GAAG,gBAAgB,IAAI,EAAE;AAC5B,EAAE,MAAM,iBA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