@servicetitan/anvil2 1.27.0 → 1.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/{Alert-BmiMaHHl-C4TKrNF3.js → Alert-CRv6t4jJ-g1uOIz5i.js} +3 -3
- package/dist/{Alert-BmiMaHHl-C4TKrNF3.js.map → Alert-CRv6t4jJ-g1uOIz5i.js.map} +1 -1
- package/dist/{Alert-DhJoO6si.js → Alert-DPNaYO2Q.js} +2 -2
- package/dist/{Alert-DhJoO6si.js.map → Alert-DPNaYO2Q.js.map} +1 -1
- package/dist/Alert.js +1 -1
- package/dist/{Announcement-DDIsOYU0.js → Announcement-CJmTMhbr.js} +2 -2
- package/dist/{Announcement-DDIsOYU0.js.map → Announcement-CJmTMhbr.js.map} +1 -1
- package/dist/Announcement.js +1 -1
- package/dist/{Button-B2ruRsLb.js → Button-3sLNiaQN.js} +2 -2
- package/dist/{Button-B2ruRsLb.js.map → Button-3sLNiaQN.js.map} +1 -1
- package/dist/{Button-BHwg8Uip-DPU6y8-l.js → Button-Ce--YZ9L-Csh0Zzuf.js} +21 -21
- package/dist/{Button-BHwg8Uip-DPU6y8-l.js.map → Button-Ce--YZ9L-Csh0Zzuf.js.map} +1 -1
- package/dist/{Button-BHwg8Uip.css → Button-Ce--YZ9L.css} +47 -45
- package/dist/Button.js +1 -1
- package/dist/{ButtonCompound-DQ9LGk2K.js → ButtonCompound-CGci3MbQ.js} +2 -2
- package/dist/{ButtonCompound-DQ9LGk2K.js.map → ButtonCompound-CGci3MbQ.js.map} +1 -1
- package/dist/ButtonCompound.js +1 -1
- package/dist/{ButtonLink-CjxVUldA.js → ButtonLink-DcFTS_ob.js} +2 -2
- package/dist/{ButtonLink-CjxVUldA.js.map → ButtonLink-DcFTS_ob.js.map} +1 -1
- package/dist/ButtonLink.js +1 -1
- package/dist/{ButtonToggle-9HqVrCoP-DsNu__N0.js → ButtonToggle-BYwKq0iP-B4gHrxUt.js} +2 -2
- package/dist/{ButtonToggle-9HqVrCoP-DsNu__N0.js.map → ButtonToggle-BYwKq0iP-B4gHrxUt.js.map} +1 -1
- package/dist/{ButtonToggle-DYKdmH_u.js → ButtonToggle-CEHlQT_K.js} +2 -2
- package/dist/{ButtonToggle-DYKdmH_u.js.map → ButtonToggle-CEHlQT_K.js.map} +1 -1
- package/dist/ButtonToggle.js +1 -1
- package/dist/{Calendar-Z_nAtpoV-B0uWpOrw.js → Calendar-9iYMS0Iw-D_XWYjOE.js} +3 -3
- package/dist/{Calendar-Z_nAtpoV-B0uWpOrw.js.map → Calendar-9iYMS0Iw-D_XWYjOE.js.map} +1 -1
- package/dist/{Calendar-Dg_yoWxL.js → Calendar-CFsWEulW.js} +2 -2
- package/dist/{Calendar-Dg_yoWxL.js.map → Calendar-CFsWEulW.js.map} +1 -1
- package/dist/Calendar.js +1 -1
- package/dist/{Combobox-kxTlPBj5.js → Combobox-DnTI2I3L.js} +4 -4
- package/dist/{Combobox-kxTlPBj5.js.map → Combobox-DnTI2I3L.js.map} +1 -1
- package/dist/Combobox.js +1 -1
- package/dist/DateField-DocC46Mw.js +565 -0
- package/dist/DateField-DocC46Mw.js.map +1 -0
- package/dist/DateField.js +1 -1
- package/dist/{Dialog-BVG0m6dn.js → Dialog-DQ9QXB5D.js} +2 -2
- package/dist/{Dialog-BVG0m6dn.js.map → Dialog-DQ9QXB5D.js.map} +1 -1
- package/dist/{Dialog-6g0s0fvb-DdwUwOVg.js → Dialog-Kh2tcVWz-DqcNnouf.js} +52 -51
- package/dist/Dialog-Kh2tcVWz-DqcNnouf.js.map +1 -0
- package/dist/Dialog.js +1 -1
- package/dist/{Drawer-DQSLhTtO.js → Drawer-C6fpnRDX.js} +59 -55
- package/dist/Drawer-C6fpnRDX.js.map +1 -0
- package/dist/Drawer.css +25 -26
- package/dist/Drawer.js +1 -1
- package/dist/{EditCard-CrlcI07q.js → EditCard-Nwz2BjY0.js} +2 -2
- package/dist/{EditCard-CrlcI07q.js.map → EditCard-Nwz2BjY0.js.map} +1 -1
- package/dist/EditCard.js +1 -1
- package/dist/{Grid-kKviwk2y.js → Grid-DaeLjn0g.js} +35 -3
- package/dist/Grid-DaeLjn0g.js.map +1 -0
- package/dist/Grid.js +1 -1
- package/dist/{InputMask-DgkoDKtz.js → InputMask-Ceh574pv.js} +2 -2
- package/dist/{InputMask-DgkoDKtz.js.map → InputMask-Ceh574pv.js.map} +1 -1
- package/dist/InputMask-DQXw5qvG-BH4P-Woc.js +195 -0
- package/dist/InputMask-DQXw5qvG-BH4P-Woc.js.map +1 -0
- package/dist/InputMask.js +1 -1
- package/dist/{Label-Cmah7p_s-DYYyQxMK.js → Label-DWF2pXeG-1BhzVgZG.js} +3 -3
- package/dist/{Label-Cmah7p_s-DYYyQxMK.js.map → Label-DWF2pXeG-1BhzVgZG.js.map} +1 -1
- package/dist/{Menu-1N6kdaVX.js → Menu-D8SDm9s9.js} +3 -3
- package/dist/{Menu-1N6kdaVX.js.map → Menu-D8SDm9s9.js.map} +1 -1
- package/dist/Menu.js +1 -1
- package/dist/{Page-DUA2NqcR.js → Page-BGkLs3bR.js} +8 -9
- package/dist/Page-BGkLs3bR.js.map +1 -0
- package/dist/Page.js +1 -1
- package/dist/{Popover-Cbmy9jrU.js → Popover-DzEc_Muv.js} +2 -2
- package/dist/{Popover-Cbmy9jrU.js.map → Popover-DzEc_Muv.js.map} +1 -1
- package/dist/{Popover-Bv4sIKvC-CCbvaK8b.js → Popover-QKZtjN4_-CETYlWwq.js} +32 -39
- package/dist/Popover-QKZtjN4_-CETYlWwq.js.map +1 -0
- package/dist/Popover.js +1 -1
- package/dist/{ProgressBar-Cbt2k-7d.js → ProgressBar-IItIByYc.js} +2 -2
- package/dist/{ProgressBar-Cbt2k-7d.js.map → ProgressBar-IItIByYc.js.map} +1 -1
- package/dist/{ProgressBar-chBw0MyR-cnNzXxPv.js → ProgressBar-cKtBso7j-3CDyBaAN.js} +3 -3
- package/dist/{ProgressBar-chBw0MyR-cnNzXxPv.js.map → ProgressBar-cKtBso7j-3CDyBaAN.js.map} +1 -1
- package/dist/ProgressBar.js +1 -1
- package/dist/{Stepper-CAuH-6cR.js → Stepper-c7C22LVq.js} +2 -2
- package/dist/{Stepper-CAuH-6cR.js.map → Stepper-c7C22LVq.js.map} +1 -1
- package/dist/Stepper.js +1 -1
- package/dist/{TextField-CODjlcrt-CsYFQwcu.js → TextField-D53XNiCi-C6_A5VRq.js} +2 -2
- package/dist/{TextField-CODjlcrt-CsYFQwcu.js.map → TextField-D53XNiCi-C6_A5VRq.js.map} +1 -1
- package/dist/{TextField-A_NHddzb.js → TextField-s92xHzb3.js} +2 -2
- package/dist/{TextField-A_NHddzb.js.map → TextField-s92xHzb3.js.map} +1 -1
- package/dist/TextField.js +1 -1
- package/dist/{Textarea-BtVSVQSa.js → Textarea-B61wNIFr.js} +2 -2
- package/dist/{Textarea-BtVSVQSa.js.map → Textarea-B61wNIFr.js.map} +1 -1
- package/dist/Textarea.js +1 -1
- package/dist/Toast.js +1 -1
- package/dist/{Toolbar-ULYSDfhw.js → Toolbar-Cge6Nznj.js} +24 -15
- package/dist/Toolbar-Cge6Nznj.js.map +1 -0
- package/dist/Toolbar.css +18 -18
- package/dist/Toolbar.js +1 -1
- package/dist/{Tooltip-DeaFnid1.js → Tooltip-89FIvMG0.js} +2 -2
- package/dist/{Tooltip-DeaFnid1.js.map → Tooltip-89FIvMG0.js.map} +1 -1
- package/dist/{Tooltip-gkNXkPsE-CnvZcZY3.js → Tooltip-DgM8NSPm-CRIQbuTm.js} +3 -3
- package/dist/{Tooltip-gkNXkPsE-CnvZcZY3.js.map → Tooltip-DgM8NSPm-CRIQbuTm.js.map} +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/components/Dialog/Dialog.d.ts +0 -1
- package/dist/components/Drawer/Drawer.d.ts +0 -1
- package/dist/components/Grid/Grid.d.ts +5 -2
- package/dist/index.js +24 -24
- package/dist/more_vert-C_lJSyxt.js +6 -0
- package/dist/more_vert-C_lJSyxt.js.map +1 -0
- package/dist/{toast-C-xc_Azo.js → toast-CHld8RKY.js} +4 -4
- package/dist/{toast-C-xc_Azo.js.map → toast-CHld8RKY.js.map} +1 -1
- package/dist/{useKeyboardFocusables-BYoElaOi-T7ncq79D.js → useKeyboardFocusables-CwVMAe5C-CIHqixNA.js} +11 -2
- package/dist/{useKeyboardFocusables-BYoElaOi-T7ncq79D.js.map → useKeyboardFocusables-CwVMAe5C-CIHqixNA.js.map} +1 -1
- package/package.json +3 -3
- package/dist/DateField-CaDuuTnX.js +0 -579
- package/dist/DateField-CaDuuTnX.js.map +0 -1
- package/dist/Dialog-6g0s0fvb-DdwUwOVg.js.map +0 -1
- package/dist/Drawer-DQSLhTtO.js.map +0 -1
- package/dist/Grid-kKviwk2y.js.map +0 -1
- package/dist/InputMask-mcs9lD4F-BuCF93Le.js +0 -320
- package/dist/InputMask-mcs9lD4F-BuCF93Le.js.map +0 -1
- package/dist/Page-DUA2NqcR.js.map +0 -1
- package/dist/Popover-Bv4sIKvC-CCbvaK8b.js.map +0 -1
- package/dist/Toolbar-ULYSDfhw.js.map +0 -1
- /package/dist/{Alert-BmiMaHHl.css → Alert-CRv6t4jJ.css} +0 -0
- /package/dist/{Calendar-Z_nAtpoV.css → Calendar-9iYMS0Iw.css} +0 -0
- /package/dist/{Dialog-6g0s0fvb.css → Dialog-Kh2tcVWz.css} +0 -0
- /package/dist/{Label-Cmah7p_s.css → Label-DWF2pXeG.css} +0 -0
- /package/dist/{Popover-Bv4sIKvC.css → Popover-QKZtjN4_.css} +0 -0
- /package/dist/{ProgressBar-chBw0MyR.css → ProgressBar-cKtBso7j.css} +0 -0
- /package/dist/{Tooltip-gkNXkPsE.css → Tooltip-DgM8NSPm.css} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog-
|
|
1
|
+
{"version":3,"file":"Dialog-DQ9QXB5D.js","sources":["../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import {\n Dialog as CoreDialog,\n DialogHeader as CoreDialogHeader,\n DialogFooter as CoreDialogFooter,\n DialogContent as CoreDialogContent,\n DialogCancelButton as CoreDialogCancelButton,\n DialogProps as CoreDialogProps,\n DialogHeaderProps as CoreDialogHeaderProps,\n DialogFooterProps as CoreDialogFooterProps,\n DialogContentProps as CoreDialogContentProps,\n DialogCancelButtonProps as CoreDialogCancelButtonProps,\n childrenToString,\n} from \"@servicetitan/hammer-react\";\nimport { Ref, forwardRef } from \"react\";\nimport { useTrackingId } from \"../../hooks/useTrackingId\";\nimport { DataTrackingId } from \"../../types/DataTrackingId\";\n\nexport type DialogProps = CoreDialogProps;\nexport type DialogHeaderProps = CoreDialogHeaderProps & DataTrackingId;\nexport type DialogFooterProps = CoreDialogFooterProps;\nexport type DialogContentProps = CoreDialogContentProps;\nexport type DialogCancelButtonProps = CoreDialogCancelButtonProps &\n DataTrackingId;\n\nconst DialogElement = forwardRef(\n (props: DialogProps, ref: Ref<HTMLDialogElement>) => {\n return <CoreDialog ref={ref} {...props} />;\n },\n);\n\nexport const DialogHeader = forwardRef(\n (props: DialogHeaderProps, ref: Ref<HTMLDivElement>) => {\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 return (\n <CoreDialogHeader ref={ref} data-tracking-id={trackingId} {...props} />\n );\n },\n);\nexport const DialogFooter = forwardRef(\n (props: DialogFooterProps, ref: Ref<HTMLDivElement>) => {\n return <CoreDialogFooter ref={ref} {...props} />;\n },\n);\nexport const DialogContent = forwardRef(\n (props: DialogContentProps, ref: Ref<HTMLDivElement>) => {\n return <CoreDialogContent ref={ref} {...props} />;\n },\n);\nexport const DialogCancelButton = forwardRef(\n (props: DialogCancelButtonProps, ref: Ref<HTMLButtonElement>) => {\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 return (\n <CoreDialogCancelButton\n ref={ref}\n data-tracking-id={trackingId}\n {...props}\n />\n );\n },\n);\n\nexport const Dialog = Object.assign(DialogElement, {\n Header: DialogHeader,\n Footer: DialogFooter,\n Content: DialogContent,\n CancelButton: DialogCancelButton,\n});\n"],"names":["CoreDialog","CoreDialogHeader","CoreDialogFooter","CoreDialogContent","CoreDialogCancelButton"],"mappings":";;;;;;AAwBA,MAAM,aAAgB,GAAA,UAAA;AAAA,EACpB,CAAC,OAAoB,GAAgC,KAAA;AACnD,IAAA,uBAAQ,GAAA,CAAAA,QAAA,EAAA,EAAW,GAAW,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA;AAE5C,CAAA;AAEO,MAAM,YAAe,GAAA,UAAA;AAAA,EAC1B,CAAC,OAA0B,GAA6B,KAAA;AACtD,IAAA,MAAM,IAAO,GAAA;AAAA,MACX,QAAA,EAAU,gBAAiB,CAAA,KAAA,CAAM,QAAQ;AAAA,KAC3C;AAEA,IAAA,MAAM,aAAa,aAAc,CAAA;AAAA,MAC/B,IAAM,EAAA,QAAA;AAAA,MACN,IAAA;AAAA,MACA,WAAa,EAAA,CAAC,CAAC,KAAA,CAAM,kBAAkB;AAAA,KACxC,CAAA;AACD,IAAA,2BACGC,cAAiB,EAAA,EAAA,GAAA,EAAU,kBAAkB,EAAA,UAAA,EAAa,GAAG,KAAO,EAAA,CAAA;AAAA;AAG3E;AACO,MAAM,YAAe,GAAA,UAAA;AAAA,EAC1B,CAAC,OAA0B,GAA6B,KAAA;AACtD,IAAA,uBAAQ,GAAA,CAAAC,cAAA,EAAA,EAAiB,GAAW,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA;AAElD;AACO,MAAM,aAAgB,GAAA,UAAA;AAAA,EAC3B,CAAC,OAA2B,GAA6B,KAAA;AACvD,IAAA,uBAAQ,GAAA,CAAAC,eAAA,EAAA,EAAkB,GAAW,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA;AAEnD;AACO,MAAM,kBAAqB,GAAA,UAAA;AAAA,EAChC,CAAC,OAAgC,GAAgC,KAAA;AAC/D,IAAA,MAAM,IAAO,GAAA;AAAA,MACX,OAAO,KAAM,CAAA,KAAA;AAAA,MACb,YAAY,KAAM,CAAA,UAAA;AAAA,MAClB,MAAM,KAAM,CAAA,IAAA;AAAA,MACZ,MAAM,KAAM,CAAA;AAAA,KACd;AAEA,IAAA,MAAM,aAAa,aAAc,CAAA;AAAA,MAC/B,IAAM,EAAA,oBAAA;AAAA,MACN,IAAA;AAAA,MACA,WAAa,EAAA,CAAC,CAAC,KAAA,CAAM,kBAAkB;AAAA,KACxC,CAAA;AACD,IACE,uBAAA,GAAA;AAAA,MAACC,oBAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,kBAAkB,EAAA,UAAA;AAAA,QACjB,GAAG;AAAA;AAAA,KACN;AAAA;AAGN;AAEa,MAAA,MAAA,GAAS,MAAO,CAAA,MAAA,CAAO,aAAe,EAAA;AAAA,EACjD,MAAQ,EAAA,YAAA;AAAA,EACR,MAAQ,EAAA,YAAA;AAAA,EACR,OAAS,EAAA,aAAA;AAAA,EACT,YAAc,EAAA;AAChB,CAAC;;;;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef, createContext, useRef, useState, useId,
|
|
2
|
+
import { forwardRef, createContext, useRef, useState, useId, useCallback, useEffect, useContext } from 'react';
|
|
3
3
|
import { c as cx } from './index-tZvMCc77.js';
|
|
4
4
|
import { S as SvgClose } from './close-DZj38AEh.js';
|
|
5
5
|
import { T as Text } from './Text-C2n3GDdC-rz_AelM0.js';
|
|
6
|
-
import { B as Button } from './Button-
|
|
7
|
-
import { u as useKeyboardFocusables } from './useKeyboardFocusables-
|
|
6
|
+
import { B as Button } from './Button-Ce--YZ9L-Csh0Zzuf.js';
|
|
7
|
+
import { u as useKeyboardFocusables } from './useKeyboardFocusables-CwVMAe5C-CIHqixNA.js';
|
|
8
8
|
import { u as useMergeRefs } from './useMergeRefs-Bde85AWI-Bde85AWI.js';
|
|
9
9
|
|
|
10
|
-
import './Dialog-
|
|
10
|
+
import './Dialog-Kh2tcVWz.css';const dialog = "_dialog_jetrx_3";
|
|
11
11
|
const container = "_container_jetrx_23";
|
|
12
12
|
const content = "_content_jetrx_36";
|
|
13
13
|
const header = "_header_jetrx_43";
|
|
@@ -69,7 +69,6 @@ const DialogHeader = forwardRef(
|
|
|
69
69
|
size: "small",
|
|
70
70
|
appearance: "ghost",
|
|
71
71
|
"aria-label": "Close dialog",
|
|
72
|
-
"data-anv": "dialog-header-close-button",
|
|
73
72
|
icon: SvgClose
|
|
74
73
|
}
|
|
75
74
|
) })
|
|
@@ -134,36 +133,36 @@ const DialogElement = forwardRef(
|
|
|
134
133
|
disableCloseOnEscape = false,
|
|
135
134
|
disableCloseOnClickOutside = false,
|
|
136
135
|
size,
|
|
137
|
-
enableScrollChaining,
|
|
138
136
|
...rest
|
|
139
137
|
} = props;
|
|
138
|
+
const openRef = useRef(open);
|
|
140
139
|
const elRef = useRef(null);
|
|
141
140
|
const contentRef = useRef(null);
|
|
141
|
+
const bodyRef = useRef(null);
|
|
142
142
|
const [hasOpenPopover, setHasOpenPopover] = useState(false);
|
|
143
143
|
const id = useId();
|
|
144
144
|
const DialogClassNames = cx([styles["dialog"]], className, {
|
|
145
145
|
[styles["fullscreen"]]: fullScreen,
|
|
146
146
|
[styles["large"]]: size === "large"
|
|
147
147
|
});
|
|
148
|
-
const { focusables } = useKeyboardFocusables(
|
|
148
|
+
const { focusables } = useKeyboardFocusables(elRef, {
|
|
149
149
|
observeChange: true
|
|
150
150
|
});
|
|
151
|
-
|
|
152
|
-
if (
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
151
|
+
const removeBodyClass = useCallback(() => {
|
|
152
|
+
if (bodyRef.current) {
|
|
153
|
+
const dialogsOpen = bodyRef.current.dataset.dialogsOpen ? bodyRef.current.dataset.dialogsOpen.split(" ") : [];
|
|
154
|
+
const newdialogsOpen = dialogsOpen.filter((item) => item !== id);
|
|
155
|
+
if (newdialogsOpen.length === 0) {
|
|
156
|
+
bodyRef.current.removeAttribute("data-dialogs-open");
|
|
157
|
+
bodyRef.current?.classList.remove("dialog-open");
|
|
158
|
+
} else {
|
|
159
|
+
bodyRef.current.dataset.dialogsOpen = newdialogsOpen.join(" ");
|
|
159
160
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return () => document.getRootNode().removeEventListener("wheel", scrollHandler);
|
|
166
|
-
}, [enableScrollChaining, open]);
|
|
161
|
+
}
|
|
162
|
+
}, [id]);
|
|
163
|
+
useEffect(() => {
|
|
164
|
+
return () => removeBodyClass();
|
|
165
|
+
}, []);
|
|
167
166
|
useEffect(() => {
|
|
168
167
|
if (typeof document === "undefined" || disableCloseOnClickOutside) return;
|
|
169
168
|
const onClickOutsideHandler = (e) => {
|
|
@@ -174,32 +173,42 @@ const DialogElement = forwardRef(
|
|
|
174
173
|
};
|
|
175
174
|
document.addEventListener("click", onClickOutsideHandler);
|
|
176
175
|
return () => document.removeEventListener("click", onClickOutsideHandler);
|
|
177
|
-
}, [disableCloseOnClickOutside, onClose, hasOpenPopover]);
|
|
178
|
-
const initial = useRef(true);
|
|
176
|
+
}, [disableCloseOnClickOutside, onClose, onOpenChange, hasOpenPopover]);
|
|
179
177
|
useEffect(() => {
|
|
180
|
-
if (initial.current) {
|
|
181
|
-
initial.current = false;
|
|
182
|
-
} else {
|
|
183
|
-
onOpenChange?.(open);
|
|
184
|
-
}
|
|
185
178
|
if (open) {
|
|
186
|
-
|
|
187
|
-
|
|
179
|
+
if (!bodyRef.current) {
|
|
180
|
+
const body = document.body ?? elRef.current?.closest("body");
|
|
181
|
+
body && (bodyRef.current = body);
|
|
182
|
+
}
|
|
183
|
+
if (bodyRef.current) {
|
|
184
|
+
const dialogsOpen = bodyRef.current.dataset.dialogsOpen ? bodyRef.current.dataset.dialogsOpen.split(" ") : [];
|
|
185
|
+
if (!dialogsOpen.includes(id)) {
|
|
186
|
+
if (openRef.current !== open) {
|
|
187
|
+
onOpenChange?.(true);
|
|
188
|
+
openRef.current = open;
|
|
189
|
+
}
|
|
190
|
+
onOpen?.();
|
|
191
|
+
elRef.current?.showModal();
|
|
192
|
+
dialogsOpen.push(id);
|
|
193
|
+
bodyRef.current.dataset.dialogsOpen = dialogsOpen.join(" ");
|
|
194
|
+
}
|
|
195
|
+
const hasFocus = elRef.current?.querySelector(":focus");
|
|
196
|
+
setTimeout(() => {
|
|
197
|
+
!hasFocus && focusables && focusables.length > 0 && focusables[0].focus();
|
|
198
|
+
}, 1);
|
|
199
|
+
bodyRef.current?.classList.add("dialog-open");
|
|
200
|
+
}
|
|
188
201
|
return;
|
|
189
202
|
}
|
|
190
203
|
setTimeout(() => {
|
|
204
|
+
if (openRef.current !== open) {
|
|
205
|
+
onOpenChange?.(false);
|
|
206
|
+
openRef.current = open;
|
|
207
|
+
}
|
|
191
208
|
elRef.current?.close();
|
|
209
|
+
removeBodyClass();
|
|
192
210
|
}, 1);
|
|
193
|
-
}, [id, onOpen, onOpenChange, open]);
|
|
194
|
-
useEffect(() => {
|
|
195
|
-
if (!open) return;
|
|
196
|
-
if (!focusables) return;
|
|
197
|
-
if (focusables[0]?.dataset.anv === "dialog-header-close-button" && focusables[1]) {
|
|
198
|
-
focusables[1].focus();
|
|
199
|
-
} else {
|
|
200
|
-
focusables[0]?.focus();
|
|
201
|
-
}
|
|
202
|
-
}, [open, focusables]);
|
|
211
|
+
}, [focusables, id, onOpen, onOpenChange, open, removeBodyClass]);
|
|
203
212
|
const onKeyDownHandler = (e) => {
|
|
204
213
|
onKeyDown?.(e);
|
|
205
214
|
if (e.code === "Escape") {
|
|
@@ -240,15 +249,7 @@ const DialogElement = forwardRef(
|
|
|
240
249
|
DialogContext.Provider,
|
|
241
250
|
{
|
|
242
251
|
value: { close, ref: elRef, hasOpenPopover, setHasOpenPopover },
|
|
243
|
-
children: /* @__PURE__ */ jsx(
|
|
244
|
-
"section",
|
|
245
|
-
{
|
|
246
|
-
ref: contentRef,
|
|
247
|
-
className: styles["container"],
|
|
248
|
-
"data-open": open,
|
|
249
|
-
children
|
|
250
|
-
}
|
|
251
|
-
)
|
|
252
|
+
children: /* @__PURE__ */ jsx("section", { ref: contentRef, className: styles["container"], children })
|
|
252
253
|
}
|
|
253
254
|
)
|
|
254
255
|
}
|
|
@@ -274,4 +275,4 @@ const Dialog = Object.assign(DialogElement, {
|
|
|
274
275
|
});
|
|
275
276
|
|
|
276
277
|
export { Dialog as D, DialogHeader as a, DialogFooter as b, DialogContent as c, DialogCancelButton as d, DialogContext as e };
|
|
277
|
-
//# sourceMappingURL=Dialog-
|
|
278
|
+
//# sourceMappingURL=Dialog-Kh2tcVWz-DqcNnouf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog-Kh2tcVWz-DqcNnouf.js","sources":["../../hammer-react/dist/Dialog-Kh2tcVWz.js"],"sourcesContent":["import { jsx, jsxs } from 'react/jsx-runtime';\nimport { forwardRef, createContext, useRef, useState, useId, useCallback, useEffect, 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 useKeyboardFocusables } from './useKeyboardFocusables-CwVMAe5C.js';\nimport { u as useMergeRefs } from './useMergeRefs-Bde85AWI.js';\n\nimport './Dialog.css';const dialog = \"_dialog_jetrx_3\";\nconst container = \"_container_jetrx_23\";\nconst content = \"_content_jetrx_36\";\nconst header = \"_header_jetrx_43\";\nconst footer = \"_footer_jetrx_63\";\nconst large = \"_large_jetrx_100\";\nconst fullscreen = \"_fullscreen_jetrx_100\";\nconst sticky = \"_sticky_jetrx_121\";\nconst styles = {\n\tdialog: dialog,\n\t\"close-dialog\": \"_close-dialog_jetrx_1\",\n\tcontainer: container,\n\tcontent: content,\n\theader: header,\n\t\"close-container\": \"_close-container_jetrx_56\",\n\tfooter: footer,\n\tlarge: large,\n\tfullscreen: fullscreen,\n\tsticky: sticky,\n\t\"close-button\": \"_close-button_jetrx_127\"\n};\n\nconst DialogCancelButton = forwardRef((props, ref) => {\n const { onClick, ...rest } = props;\n const { close } = useDialogContext();\n const onClickHandler = (e) => {\n onClick?.(e);\n close();\n };\n return /* @__PURE__ */ jsx(\n Button,\n {\n \"aria-label\": \"Close dialog\",\n \"data-anv\": \"dialog-cancel-button\",\n onClick: onClickHandler,\n ref,\n ...rest\n }\n );\n});\nDialogCancelButton.displayName = \"DialogCancelButton\";\n\nconst DialogHeader = forwardRef(\n (props, ref) => {\n const { children, className, ...rest } = props;\n const headerClassNames = cx(className, styles[\"header\"]);\n return /* @__PURE__ */ jsxs(\n \"header\",\n {\n className: headerClassNames,\n \"data-anv\": \"dialog-header\",\n ref,\n ...rest,\n children: [\n /* @__PURE__ */ jsx(Text, { variant: \"headline\", el: \"h1\", children }),\n /* @__PURE__ */ jsx(\"span\", { className: styles[\"close-container\"], children: /* @__PURE__ */ jsx(\n DialogCancelButton,\n {\n className: styles[\"close-button\"],\n size: \"small\",\n appearance: \"ghost\",\n \"aria-label\": \"Close dialog\",\n icon: Close\n }\n ) })\n ]\n }\n );\n }\n);\nDialogHeader.displayName = \"DialogHeader\";\n\nconst DialogFooter = forwardRef(\n (props, ref) => {\n const { children, className, sticky = false, ...rest } = props;\n const footerClassNames = cx(styles[\"footer\"], className, {\n [styles[\"sticky\"]]: sticky\n });\n return /* @__PURE__ */ jsx(\n \"footer\",\n {\n className: footerClassNames,\n \"data-anv\": \"dialog-footer\",\n ref,\n ...rest,\n children\n }\n );\n }\n);\nDialogFooter.displayName = \"DialogFooter\";\n\nconst DialogContent = forwardRef(\n (props, ref) => {\n const { children, className, ...rest } = props;\n const contentClassNames = cx(styles[\"content\"], className);\n return /* @__PURE__ */ jsx(\n \"div\",\n {\n className: contentClassNames,\n \"data-anv\": \"dialog-content\",\n ref,\n ...rest,\n children\n }\n );\n }\n);\nDialogContent.displayName = \"DialogContent\";\n\nconst DialogContext = createContext(null);\nconst DialogElement = forwardRef(\n (props, ref) => {\n const {\n className,\n open = false,\n children,\n onOpen,\n onOpenChange,\n onClose,\n onCancel,\n onKeyDown,\n fullScreen = false,\n disableCloseOnEscape = false,\n disableCloseOnClickOutside = false,\n size,\n ...rest\n } = props;\n const openRef = useRef(open);\n const elRef = useRef(null);\n const contentRef = useRef(null);\n const bodyRef = useRef(null);\n const [hasOpenPopover, setHasOpenPopover] = useState(false);\n const id = useId();\n const DialogClassNames = cx([styles[\"dialog\"]], className, {\n [styles[\"fullscreen\"]]: fullScreen,\n [styles[\"large\"]]: size === \"large\"\n });\n const { focusables } = useKeyboardFocusables(elRef, {\n observeChange: true\n });\n const removeBodyClass = useCallback(() => {\n if (bodyRef.current) {\n const dialogsOpen = bodyRef.current.dataset.dialogsOpen ? bodyRef.current.dataset.dialogsOpen.split(\" \") : [];\n const newdialogsOpen = dialogsOpen.filter((item) => item !== id);\n if (newdialogsOpen.length === 0) {\n bodyRef.current.removeAttribute(\"data-dialogs-open\");\n bodyRef.current?.classList.remove(\"dialog-open\");\n } else {\n bodyRef.current.dataset.dialogsOpen = newdialogsOpen.join(\" \");\n }\n }\n }, [id]);\n useEffect(() => {\n return () => removeBodyClass();\n }, []);\n useEffect(() => {\n if (typeof document === \"undefined\" || disableCloseOnClickOutside) return;\n const onClickOutsideHandler = (e) => {\n if (hasOpenPopover) return;\n if (e.composedPath()[0] === elRef.current) {\n onClose?.();\n }\n };\n document.addEventListener(\"click\", onClickOutsideHandler);\n return () => document.removeEventListener(\"click\", onClickOutsideHandler);\n }, [disableCloseOnClickOutside, onClose, onOpenChange, hasOpenPopover]);\n useEffect(() => {\n if (open) {\n if (!bodyRef.current) {\n const body = document.body ?? elRef.current?.closest(\"body\");\n body && (bodyRef.current = body);\n }\n if (bodyRef.current) {\n const dialogsOpen = bodyRef.current.dataset.dialogsOpen ? bodyRef.current.dataset.dialogsOpen.split(\" \") : [];\n if (!dialogsOpen.includes(id)) {\n if (openRef.current !== open) {\n onOpenChange?.(true);\n openRef.current = open;\n }\n onOpen?.();\n elRef.current?.showModal();\n dialogsOpen.push(id);\n bodyRef.current.dataset.dialogsOpen = dialogsOpen.join(\" \");\n }\n const hasFocus = elRef.current?.querySelector(\":focus\");\n setTimeout(() => {\n !hasFocus && focusables && focusables.length > 0 && focusables[0].focus();\n }, 1);\n bodyRef.current?.classList.add(\"dialog-open\");\n }\n return;\n }\n setTimeout(() => {\n if (openRef.current !== open) {\n onOpenChange?.(false);\n openRef.current = open;\n }\n elRef.current?.close();\n removeBodyClass();\n }, 1);\n }, [focusables, id, onOpen, onOpenChange, open, removeBodyClass]);\n const onKeyDownHandler = (e) => {\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 if (e.code === \"Tab\") {\n if (e.shiftKey && e.target === focusables?.[0]) {\n e.preventDefault();\n focusables[focusables.length - 1]?.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 const close = useCallback(() => {\n onClose?.();\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: DialogClassNames,\n \"data-anv\": \"dialog\",\n ref: useMergeRefs([ref, elRef]),\n onKeyDown: onKeyDownHandler,\n ...rest,\n children: /* @__PURE__ */ jsx(\n DialogContext.Provider,\n {\n value: { close, ref: elRef, hasOpenPopover, setHasOpenPopover },\n children: /* @__PURE__ */ jsx(\"section\", { ref: contentRef, className: styles[\"container\"], children })\n }\n )\n }\n )\n );\n }\n);\nfunction 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}\nDialogElement.displayName = \"Dialog\";\nconst Dialog = Object.assign(DialogElement, {\n Header: DialogHeader,\n Footer: DialogFooter,\n Content: DialogContent,\n CancelButton: DialogCancelButton\n});\n\nexport { Dialog as D, DialogContext as a, DialogCancelButton as b, DialogContent as c, DialogFooter as d, DialogHeader as e };\n//# sourceMappingURL=Dialog-Kh2tcVWz.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,KAAK,GAAG,kBAAkB;AAChC,MAAM,UAAU,GAAG,uBAAuB;AAC1C,MAAM,MAAM,GAAG,mBAAmB;AAClC,MAAM,MAAM,GAAG;AACf,CAAC,MAAM,EAAE,MAAM;AACf,CAAC,cAAc,EAAE,uBAAuB;AACxC,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,KAAK,EAAE,KAAK;AACb,CAAC,UAAU,EAAE,UAAU;AACvB,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,cAA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CAAC,CAAC;AACjB,IAAI;AACJ;AACA;AACA,sBAAsB,GAAG;AACzB,QAAQ,QAAQ;AAChB,QAAQ;AACR,UAAU,SAAS,EAAE,gBAAgB;AACrC,UAAU,UAAU,EAAE,QAAQ;AAC9B,UAAU,GAAG,EAAE,YAAY,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACzC,UAAU,SAAS,EAAE,gBAAgB;AACrC,UAAU,GAAG,IAAI;AACjB,UAAU,QAAQ,kBAAkB,GAAG;AACvC,YAAY,aAAa,CAAC,QAAQ;AAClC,YAAY;AACZ,cAAc,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE;AAC7E,cAAc,QAAQ,kBAAkB,GAAG,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE;AACpH;AACA;AACA;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;;;;"}
|
package/dist/Dialog.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { D as Dialog, d as DialogCancelButton, c as DialogContent, b as DialogFooter, a as DialogHeader, D as default } from './Dialog-
|
|
1
|
+
export { D as Dialog, d as DialogCancelButton, c as DialogContent, b as DialogFooter, a as DialogHeader, D as default } from './Dialog-DQ9QXB5D.js';
|
|
2
2
|
//# sourceMappingURL=Dialog.js.map
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef, createContext, useRef, useState, useEffect, useMemo, useContext } from 'react';
|
|
2
|
+
import { forwardRef, createContext, useRef, useState, useId, useCallback, useEffect, useMemo, useContext } from 'react';
|
|
3
3
|
import { useTrackingId } from './useTrackingId.js';
|
|
4
4
|
import { c as cx } from './index-tZvMCc77.js';
|
|
5
5
|
import { S as SvgClose } from './close-DZj38AEh.js';
|
|
6
6
|
import { T as Text } from './Text-C2n3GDdC-rz_AelM0.js';
|
|
7
|
-
import { B as Button } from './Button-
|
|
7
|
+
import { B as Button } from './Button-Ce--YZ9L-Csh0Zzuf.js';
|
|
8
8
|
import { u as useMergeRefs } from './useMergeRefs-Bde85AWI-Bde85AWI.js';
|
|
9
|
-
import { u as useKeyboardFocusables } from './useKeyboardFocusables-
|
|
9
|
+
import { u as useKeyboardFocusables } from './useKeyboardFocusables-CwVMAe5C-CIHqixNA.js';
|
|
10
10
|
import { c as childrenToString } from './childrenToString-Bz9MqbHb-Bz9MqbHb.js';
|
|
11
11
|
|
|
12
|
-
import './Drawer.css';const drawer = "
|
|
13
|
-
const container = "
|
|
14
|
-
const content = "
|
|
15
|
-
const header = "
|
|
16
|
-
const footer = "
|
|
17
|
-
const remove = "
|
|
18
|
-
const large = "
|
|
19
|
-
const sticky = "
|
|
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";
|
|
20
20
|
const styles = {
|
|
21
21
|
drawer: drawer,
|
|
22
|
-
"close-drawer": "_close-
|
|
23
|
-
"open-drawer": "_open-
|
|
24
|
-
"open-backdrop": "_open-
|
|
22
|
+
"close-drawer": "_close-drawer_1gqlt_1",
|
|
23
|
+
"open-drawer": "_open-drawer_1gqlt_1",
|
|
24
|
+
"open-backdrop": "_open-backdrop_1gqlt_1",
|
|
25
25
|
container: container,
|
|
26
26
|
content: content,
|
|
27
27
|
header: header,
|
|
28
|
-
"close-container": "_close-
|
|
28
|
+
"close-container": "_close-container_1gqlt_65",
|
|
29
29
|
footer: footer,
|
|
30
30
|
remove: remove,
|
|
31
|
-
"close-backdrop": "_close-
|
|
31
|
+
"close-backdrop": "_close-backdrop_1gqlt_1",
|
|
32
32
|
large: large,
|
|
33
33
|
sticky: sticky,
|
|
34
|
-
"close-button": "_close-
|
|
34
|
+
"close-button": "_close-button_1gqlt_108"
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
const DrawerCancelButton$1 = forwardRef((props, ref) => {
|
|
@@ -128,59 +128,70 @@ const DrawerElement$1 = forwardRef(
|
|
|
128
128
|
disableCloseOnEscape = false,
|
|
129
129
|
disableCloseOnClickOutside = false,
|
|
130
130
|
size = "medium",
|
|
131
|
-
enableScrollChaining,
|
|
132
131
|
...rest
|
|
133
132
|
} = props;
|
|
134
133
|
const elRef = useRef(null);
|
|
135
134
|
const contentRef = useRef(null);
|
|
135
|
+
const bodyRef = useRef(null);
|
|
136
136
|
const combinedRef = useMergeRefs([elRef, ref]);
|
|
137
137
|
const [remove, setRemove] = useState(false);
|
|
138
|
+
const id = useId();
|
|
138
139
|
const DrawerClassNames = cx([styles.drawer], className, {
|
|
139
140
|
[styles.remove]: remove,
|
|
140
141
|
[styles.large]: size === "large"
|
|
141
142
|
});
|
|
142
|
-
const { focusables } = useKeyboardFocusables(contentRef, {
|
|
143
|
+
const { focusables, updateFocusables } = useKeyboardFocusables(contentRef, {
|
|
143
144
|
observeChange: false
|
|
144
145
|
});
|
|
145
146
|
const firstFocusable = focusables?.[0];
|
|
146
147
|
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]);
|
|
147
160
|
useEffect(() => {
|
|
148
161
|
if (open) {
|
|
149
162
|
onOpen?.();
|
|
150
163
|
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
|
+
}
|
|
151
183
|
return;
|
|
152
184
|
}
|
|
153
185
|
setRemove(true);
|
|
154
186
|
setTimeout(() => {
|
|
155
187
|
elRef.current?.close();
|
|
188
|
+
removeBodyClass();
|
|
156
189
|
setRemove(false);
|
|
157
190
|
}, 200);
|
|
158
|
-
}, [onOpen, open]);
|
|
191
|
+
}, [id, onOpen, open, removeBodyClass]);
|
|
159
192
|
useEffect(() => {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if (focusables[0]?.dataset.anv === "drawer-header-close-button" && focusables[1]) {
|
|
163
|
-
focusables[1].focus();
|
|
164
|
-
} else {
|
|
165
|
-
focusables[0]?.focus();
|
|
166
|
-
}
|
|
167
|
-
}, [open, focusables]);
|
|
168
|
-
useEffect(() => {
|
|
169
|
-
if (!open || enableScrollChaining) return;
|
|
170
|
-
const scrollHandler = (e) => {
|
|
171
|
-
const content = contentRef.current;
|
|
172
|
-
const target = e.target;
|
|
173
|
-
const isOverflowing = elRef.current && elRef.current.scrollHeight > elRef.current.clientHeight;
|
|
174
|
-
if (!isOverflowing || !content?.contains(target)) {
|
|
175
|
-
e.preventDefault();
|
|
176
|
-
}
|
|
177
|
-
return;
|
|
178
|
-
};
|
|
179
|
-
document.addEventListener("wheel", scrollHandler, {
|
|
180
|
-
passive: false
|
|
181
|
-
});
|
|
182
|
-
return () => document.getRootNode().removeEventListener("wheel", scrollHandler);
|
|
183
|
-
}, [enableScrollChaining, open]);
|
|
193
|
+
return () => removeBodyClass();
|
|
194
|
+
}, [removeBodyClass]);
|
|
184
195
|
const onCancelHandler = (e) => {
|
|
185
196
|
e.preventDefault();
|
|
186
197
|
if (disableCloseOnEscape) return;
|
|
@@ -214,12 +225,13 @@ const DrawerElement$1 = forwardRef(
|
|
|
214
225
|
const close = () => {
|
|
215
226
|
setRemove(true);
|
|
216
227
|
setTimeout(() => {
|
|
228
|
+
removeBodyClass();
|
|
217
229
|
elRef.current?.close();
|
|
218
230
|
onClose?.();
|
|
219
231
|
}, 200);
|
|
220
232
|
};
|
|
221
233
|
return { close };
|
|
222
|
-
}, [onClose]);
|
|
234
|
+
}, [onClose, removeBodyClass]);
|
|
223
235
|
return (
|
|
224
236
|
// dialog element does seem to be interactive on MDN guideline
|
|
225
237
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
@@ -233,15 +245,7 @@ const DrawerElement$1 = forwardRef(
|
|
|
233
245
|
onClick: onClickHandler,
|
|
234
246
|
onKeyDown: onKeyDownHandler,
|
|
235
247
|
...rest,
|
|
236
|
-
children: /* @__PURE__ */ jsx(DrawerContext.Provider, { value, children: /* @__PURE__ */ jsx(
|
|
237
|
-
"section",
|
|
238
|
-
{
|
|
239
|
-
ref: contentRef,
|
|
240
|
-
className: styles.container,
|
|
241
|
-
"data-open": open,
|
|
242
|
-
children
|
|
243
|
-
}
|
|
244
|
-
) })
|
|
248
|
+
children: /* @__PURE__ */ jsx(DrawerContext.Provider, { value, children: /* @__PURE__ */ jsx("section", { ref: contentRef, className: styles.container, children }) })
|
|
245
249
|
}
|
|
246
250
|
)
|
|
247
251
|
);
|
|
@@ -323,4 +327,4 @@ const Drawer = Object.assign(DrawerElement, {
|
|
|
323
327
|
});
|
|
324
328
|
|
|
325
329
|
export { Drawer as D, DrawerCancelButton as a, DrawerFooter as b, DrawerHeader as c, DrawerContent as d };
|
|
326
|
-
//# sourceMappingURL=Drawer-
|
|
330
|
+
//# sourceMappingURL=Drawer-C6fpnRDX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Drawer-C6fpnRDX.js","sources":["../../hammer-react/dist/Drawer-CrXiK2w0.js","../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import { jsx, jsxs } from 'react/jsx-runtime';\nimport { forwardRef, createContext, useRef, useState, useId, useCallback, 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_1gqlt_3\";\nconst container = \"_container_1gqlt_28\";\nconst content = \"_content_1gqlt_41\";\nconst header = \"_header_1gqlt_48\";\nconst footer = \"_footer_1gqlt_72\";\nconst remove = \"_remove_1gqlt_90\";\nconst large = \"_large_1gqlt_99\";\nconst sticky = \"_sticky_1gqlt_102\";\nconst styles = {\n\tdrawer: drawer,\n\t\"close-drawer\": \"_close-drawer_1gqlt_1\",\n\t\"open-drawer\": \"_open-drawer_1gqlt_1\",\n\t\"open-backdrop\": \"_open-backdrop_1gqlt_1\",\n\tcontainer: container,\n\tcontent: content,\n\theader: header,\n\t\"close-container\": \"_close-container_1gqlt_65\",\n\tfooter: footer,\n\tremove: remove,\n\t\"close-backdrop\": \"_close-backdrop_1gqlt_1\",\n\tlarge: large,\n\tsticky: sticky,\n\t\"close-button\": \"_close-button_1gqlt_108\"\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 ...rest\n } = props;\n const elRef = useRef(null);\n const contentRef = useRef(null);\n const bodyRef = useRef(null);\n const combinedRef = useMergeRefs([elRef, ref]);\n const [remove, setRemove] = useState(false);\n const id = useId();\n const DrawerClassNames = cx([styles.drawer], className, {\n [styles.remove]: remove,\n [styles.large]: size === \"large\"\n });\n const { focusables, updateFocusables } = useKeyboardFocusables(contentRef, {\n observeChange: false\n });\n const firstFocusable = focusables?.[0];\n const lastFocusable = focusables?.[focusables.length - 1];\n const removeBodyClass = useCallback(() => {\n if (bodyRef.current) {\n const drawersOpen = bodyRef.current.dataset.drawersOpen ? bodyRef.current.dataset.drawersOpen.split(\" \") : [];\n const newDrawersOpen = drawersOpen.filter((item) => item !== id);\n if (newDrawersOpen.length === 0) {\n bodyRef.current.removeAttribute(\"data-drawers-open\");\n bodyRef.current?.classList.remove(\"drawer-open\");\n } else {\n bodyRef.current.dataset.drawersOpen = newDrawersOpen.join(\" \");\n }\n }\n }, [id]);\n useEffect(() => {\n if (open) {\n onOpen?.();\n elRef.current?.showModal();\n if (!bodyRef.current) {\n const body = elRef.current?.closest(\"body\");\n body && (bodyRef.current = body);\n }\n updateFocusables();\n if (focusables) {\n if (focusables[0]?.dataset.anv === \"drawer-header-close-button\" && focusables[1]) {\n focusables[1].focus();\n } else {\n focusables[0]?.focus();\n }\n }\n bodyRef.current?.classList.add(\"drawer-open\");\n if (bodyRef.current) {\n const drawersOpen = bodyRef.current.dataset.drawersOpen ? bodyRef.current.dataset.drawersOpen.split(\" \") : [];\n if (drawersOpen.includes(id)) return;\n drawersOpen.push(id);\n bodyRef.current.dataset.drawersOpen = drawersOpen.join(\" \");\n }\n return;\n }\n setRemove(true);\n setTimeout(() => {\n elRef.current?.close();\n removeBodyClass();\n setRemove(false);\n }, 200);\n }, [id, onOpen, open, removeBodyClass]);\n useEffect(() => {\n return () => removeBodyClass();\n }, [removeBodyClass]);\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 removeBodyClass();\n elRef.current?.close();\n onClose?.();\n }, 200);\n };\n return { close };\n }, [onClose, removeBodyClass]);\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(\"section\", { ref: contentRef, className: styles.container, children }) })\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-CrXiK2w0.js.map\n","import {\n DrawerProps as CoreDrawerProps,\n Drawer as CoreDrawer,\n DrawerCancelButtonProps as CoreDrawerCancelButtonProps,\n DrawerCancelButton as CoreDrawerCancelButton,\n DrawerFooterProps as CoreDrawerFooterProps,\n DrawerFooter as CoreDrawerFooter,\n DrawerHeaderProps as CoreDrawerHeaderProps,\n DrawerHeader as CoreDrawerHeader,\n DrawerContentProps as CoreDrawerContentProps,\n DrawerContent as CoreDrawerContent,\n childrenToString,\n} from \"@servicetitan/hammer-react\";\nimport { Ref, forwardRef } from \"react\";\nimport { useTrackingId } from \"../../hooks/useTrackingId\";\nimport { DataTrackingId } from \"../../types/DataTrackingId\";\n\nexport type DrawerProps = CoreDrawerProps;\nexport type DrawerCancelButtonProps = CoreDrawerCancelButtonProps &\n DataTrackingId;\nexport type DrawerFooterProps = CoreDrawerFooterProps;\nexport type DrawerHeaderProps = CoreDrawerHeaderProps & DataTrackingId;\nexport type DrawerContentProps = CoreDrawerContentProps;\n\nconst DrawerElement = forwardRef(\n (props: DrawerProps, ref: Ref<HTMLDialogElement>) => {\n return <CoreDrawer ref={ref} {...props} />;\n },\n);\n\nexport const DrawerCancelButton = forwardRef(\n (props: DrawerCancelButtonProps, ref: Ref<HTMLButtonElement>) => {\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 return (\n <CoreDrawerCancelButton\n ref={ref}\n data-tracking-id={trackingId}\n {...props}\n />\n );\n },\n);\n\nexport const DrawerFooter = forwardRef(\n (props: DrawerFooterProps, ref: Ref<HTMLDivElement>) => {\n return <CoreDrawerFooter ref={ref} {...props} />;\n },\n);\n\nexport const DrawerHeader = forwardRef(\n (props: DrawerHeaderProps, ref: Ref<HTMLDivElement>) => {\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 return (\n <CoreDrawerHeader ref={ref} data-tracking-id={trackingId} {...props} />\n );\n },\n);\n\nexport const DrawerContent = forwardRef(\n (props: DrawerContentProps, ref: Ref<HTMLDivElement>) => {\n return <CoreDrawerContent ref={ref} {...props} />;\n },\n);\n\nexport const Drawer = Object.assign(DrawerElement, {\n Header: DrawerHeader,\n Footer: DrawerFooter,\n Content: DrawerContent,\n CancelButton: DrawerCancelButton,\n});\n"],"names":["DrawerCancelButton","DrawerHeader","Close","DrawerFooter","DrawerContent","DrawerElement","Drawer","CoreDrawer","CoreDrawerCancelButton","CoreDrawerFooter","CoreDrawerHeader","CoreDrawerContent"],"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,iBAAiB;AAC/B,MAAM,MAAM,GAAG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AM,aAAa,aAAc,CAAA;AAAA,MAC/B,IAAM,EAAA,cAAA;AAAA,MACN,IAAA;AAAA,MACA,WAAa,EAAA,CAAC,CAAC,KAAA,CAAM,kBAAkB;AAAA,KACxC,CAAA;AACD,IAAA,2BACGC,cAAiB,EAAA,EAAA,GAAA,EAAU,kBAAkB,EAAA,UAAA,EAAa,GAAG,KAAO,EAAA,CAAA;AAAA;AAG3E;AAEO,MAAM,aAAgB,GAAA,UAAA;AAAA,EAC3B,CAAC,OAA2B,GAA6B,KAAA;AACvD,IAAA,uBAAQ,GAAA,CAAAC,eAAA,EAAA,EAAkB,GAAW,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA;AAEnD;AAEa,MAAA,MAAA,GAAS,MAAO,CAAA,MAAA,CAAO,aAAe,EAAA;AAAA,EACjD,MAAQ,EAAA,YAAA;AAAA,EACR,MAAQ,EAAA,YAAA;AAAA,EACR,OAAS,EAAA,aAAA;AAAA,EACT,YAAc,EAAA;AAChB,CAAC;;;;"}
|
package/dist/Drawer.css
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
@layer starter, reset, base, state, application;
|
|
4
4
|
@layer base {
|
|
5
|
-
.
|
|
5
|
+
._drawer_1gqlt_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-
|
|
11
|
+
animation: _close-drawer_1gqlt_1 2s forwards;
|
|
12
12
|
transition: width 200ms;
|
|
13
13
|
width: 35rem;
|
|
14
14
|
height: 100%;
|
|
@@ -19,16 +19,15 @@
|
|
|
19
19
|
margin-block-end: 0;
|
|
20
20
|
max-height: 100dvh;
|
|
21
21
|
margin-inline-end: 0;
|
|
22
|
-
overscroll-behavior: contain;
|
|
23
22
|
--xpos: 10rem;
|
|
24
23
|
}
|
|
25
|
-
.
|
|
26
|
-
animation: _open-
|
|
24
|
+
._drawer_1gqlt_3[open] {
|
|
25
|
+
animation: _open-drawer_1gqlt_1 300ms forwards;
|
|
27
26
|
}
|
|
28
|
-
.
|
|
29
|
-
animation: _open-
|
|
27
|
+
._drawer_1gqlt_3[open]::backdrop {
|
|
28
|
+
animation: _open-backdrop_1gqlt_1 200ms forwards;
|
|
30
29
|
}
|
|
31
|
-
.
|
|
30
|
+
._drawer_1gqlt_3 ._container_1gqlt_28 {
|
|
32
31
|
font-family: var(--font-family-base, "Nunito Sans", sans-serif);
|
|
33
32
|
font-size: 100%;
|
|
34
33
|
color: var(--foreground-color, #141414);
|
|
@@ -41,14 +40,14 @@
|
|
|
41
40
|
gap: 1.5rem;
|
|
42
41
|
min-height: 100%;
|
|
43
42
|
}
|
|
44
|
-
.
|
|
43
|
+
._drawer_1gqlt_3 ._container_1gqlt_28 ._content_1gqlt_41 {
|
|
45
44
|
flex-grow: 1;
|
|
46
45
|
padding-block-start: 0.25rem;
|
|
47
46
|
padding-block-end: 0.25rem;
|
|
48
47
|
font-size: 1rem;
|
|
49
48
|
isolation: isolate;
|
|
50
49
|
}
|
|
51
|
-
.
|
|
50
|
+
._header_1gqlt_48 {
|
|
52
51
|
position: sticky;
|
|
53
52
|
inset-block-start: 0;
|
|
54
53
|
display: flex;
|
|
@@ -61,18 +60,18 @@
|
|
|
61
60
|
font-size: 1rem;
|
|
62
61
|
z-index: 1;
|
|
63
62
|
}
|
|
64
|
-
.
|
|
63
|
+
._header_1gqlt_48 h1 {
|
|
65
64
|
margin-block: 0;
|
|
66
65
|
margin-inline: 0;
|
|
67
66
|
}
|
|
68
|
-
.
|
|
67
|
+
._header_1gqlt_48 ._close-container_1gqlt_65 {
|
|
69
68
|
display: flex;
|
|
70
69
|
justify-content: center;
|
|
71
70
|
align-items: center;
|
|
72
71
|
width: 1.5625rem;
|
|
73
72
|
height: 1.5625rem;
|
|
74
73
|
}
|
|
75
|
-
.
|
|
74
|
+
._footer_1gqlt_72 {
|
|
76
75
|
display: flex;
|
|
77
76
|
gap: 0.75rem;
|
|
78
77
|
justify-content: flex-end;
|
|
@@ -86,36 +85,36 @@
|
|
|
86
85
|
}
|
|
87
86
|
@layer state {
|
|
88
87
|
@media (prefers-reduced-motion: reduce) {
|
|
89
|
-
.
|
|
88
|
+
._drawer_1gqlt_3 {
|
|
90
89
|
--xpos: 0;
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
|
-
.
|
|
94
|
-
animation: _close-
|
|
92
|
+
._drawer_1gqlt_3._remove_1gqlt_90[open] {
|
|
93
|
+
animation: _close-drawer_1gqlt_1 300ms forwards;
|
|
95
94
|
}
|
|
96
|
-
.
|
|
97
|
-
animation: _close-
|
|
95
|
+
._drawer_1gqlt_3._remove_1gqlt_90[open]::backdrop {
|
|
96
|
+
animation: _close-backdrop_1gqlt_1 200ms forwards;
|
|
98
97
|
}
|
|
99
|
-
.
|
|
98
|
+
._drawer_1gqlt_3::backdrop {
|
|
100
99
|
background: #040404;
|
|
101
100
|
}
|
|
102
|
-
.
|
|
101
|
+
._drawer_1gqlt_3._large_1gqlt_99 {
|
|
103
102
|
width: 48rem;
|
|
104
103
|
}
|
|
105
|
-
.
|
|
104
|
+
._drawer_1gqlt_3 ._footer_1gqlt_72._sticky_1gqlt_102 {
|
|
106
105
|
position: sticky;
|
|
107
106
|
inset-block-end: 0;
|
|
108
107
|
}
|
|
109
108
|
}
|
|
110
109
|
@layer application {
|
|
111
|
-
.
|
|
110
|
+
._drawer_1gqlt_3 ._header_1gqlt_48 ._close-button_1gqlt_108 {
|
|
112
111
|
color: var(--foreground-color, #141414);
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
114
|
.drawer-open {
|
|
116
115
|
overflow: hidden;
|
|
117
116
|
}
|
|
118
|
-
@keyframes _open-
|
|
117
|
+
@keyframes _open-drawer_1gqlt_1 {
|
|
119
118
|
from {
|
|
120
119
|
opacity: 0;
|
|
121
120
|
transform: translateX(var(--xpos));
|
|
@@ -125,7 +124,7 @@
|
|
|
125
124
|
transform: translateX(0%);
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
|
-
@keyframes _close-
|
|
127
|
+
@keyframes _close-drawer_1gqlt_1 {
|
|
129
128
|
from {
|
|
130
129
|
opacity: 1;
|
|
131
130
|
transform: translateX(0%);
|
|
@@ -135,7 +134,7 @@
|
|
|
135
134
|
transform: translateX(var(--xpos));
|
|
136
135
|
}
|
|
137
136
|
}
|
|
138
|
-
@keyframes _open-
|
|
137
|
+
@keyframes _open-backdrop_1gqlt_1 {
|
|
139
138
|
from {
|
|
140
139
|
opacity: 0;
|
|
141
140
|
}
|
|
@@ -143,7 +142,7 @@
|
|
|
143
142
|
opacity: 0.6;
|
|
144
143
|
}
|
|
145
144
|
}
|
|
146
|
-
@keyframes _close-
|
|
145
|
+
@keyframes _close-backdrop_1gqlt_1 {
|
|
147
146
|
from {
|
|
148
147
|
opacity: 0.6;
|
|
149
148
|
}
|
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-
|
|
1
|
+
export { D as Drawer, a as DrawerCancelButton, d as DrawerContent, b as DrawerFooter, c as DrawerHeader, D as default } from './Drawer-C6fpnRDX.js';
|
|
2
2
|
//# sourceMappingURL=Drawer.js.map
|
|
@@ -5,7 +5,7 @@ import { c as cx } from './index-tZvMCc77.js';
|
|
|
5
5
|
import { C as Card } from './Card-js75vKLt-Bk6ujopM.js';
|
|
6
6
|
import { T as Text } from './Text-C2n3GDdC-rz_AelM0.js';
|
|
7
7
|
import { I as Icon } from './Icon-DbHA5GV1-DwO2aGkj.js';
|
|
8
|
-
import { B as Button } from './Button-
|
|
8
|
+
import { B as Button } from './Button-Ce--YZ9L-Csh0Zzuf.js';
|
|
9
9
|
import { S as SvgCheck } from './check-Cf67OWrZ.js';
|
|
10
10
|
import { u as useLayoutPropsUtil } from './useLayoutPropsUtil-C6qizVc6-BkgAan7h.js';
|
|
11
11
|
|
|
@@ -116,4 +116,4 @@ const EditCard = forwardRef(
|
|
|
116
116
|
);
|
|
117
117
|
|
|
118
118
|
export { EditCard as E };
|
|
119
|
-
//# sourceMappingURL=EditCard-
|
|
119
|
+
//# sourceMappingURL=EditCard-Nwz2BjY0.js.map
|