@servicetitan/anvil2 1.46.7 → 1.46.8
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 +10 -0
- package/dist/{Drawer-C1KtNoLu.js → Drawer-yG7C8Owv.js} +11 -11
- package/dist/{Drawer-C1KtNoLu.js.map → Drawer-yG7C8Owv.js.map} +1 -1
- package/dist/Drawer.css +37 -40
- package/dist/Drawer.js +1 -1
- package/dist/{NumberField-DWPAy1eG.js → NumberField-DDjOcEFm.js} +14 -2
- package/dist/NumberField-DDjOcEFm.js.map +1 -0
- package/dist/NumberField.js +1 -1
- package/dist/{Tab-CzNx3IdF.js → Tab-BQ5tMHlN.js} +2 -2
- package/dist/Tab-BQ5tMHlN.js.map +1 -0
- package/dist/Tab.js +1 -1
- package/dist/{Toolbar-B2zhlyBz.js → Toolbar-CNgCvoy1.js} +2 -2
- package/dist/{Toolbar-B2zhlyBz.js.map → Toolbar-CNgCvoy1.js.map} +1 -1
- package/dist/Toolbar.js +1 -1
- package/dist/beta.js +1 -1
- package/dist/index.js +3 -3
- package/package.json +4 -7
- package/dist/NumberField-DWPAy1eG.js.map +0 -1
- package/dist/Tab-CzNx3IdF.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @servicetitan/anvil2
|
|
2
2
|
|
|
3
|
+
## 1.46.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1589](https://github.com/servicetitan/hammer/pull/1589) [`fc8b30c`](https://github.com/servicetitan/hammer/commit/fc8b30cc6a8cb7ec99f9630e9ba9d9a4e5af5e4b) Thanks [@w-a-t-s-o-n](https://github.com/w-a-t-s-o-n)! - [NumberField] Fix typing "-" in controlled field
|
|
8
|
+
|
|
9
|
+
- [#1581](https://github.com/servicetitan/hammer/pull/1581) [`3daa6f6`](https://github.com/servicetitan/hammer/commit/3daa6f67670bcdb5e978ad083056db4d29892b16) Thanks [@rgdelato](https://github.com/rgdelato)! - [Drawer] Update scrolling container to fix closing on scrollbar click
|
|
10
|
+
|
|
11
|
+
- [#1592](https://github.com/servicetitan/hammer/pull/1592) [`3df1040`](https://github.com/servicetitan/hammer/commit/3df1040566f627a937f2f7f7e889c3c2bcfb230a) Thanks [@rgdelato](https://github.com/rgdelato)! - [Tab] Update `Tab.Panel` to forward `style` prop
|
|
12
|
+
|
|
3
13
|
## 1.46.7
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -12,25 +12,25 @@ import { u as useDialogTransitionStates, a as useKeyboardFocusables, b as useDia
|
|
|
12
12
|
import { u as useMergeRefs } from './useMergeRefs-Dfmtq9cI.js';
|
|
13
13
|
import { a as useOnClickOutside } from './useOnClickOutside-C5AZE_I6.js';
|
|
14
14
|
|
|
15
|
-
import './Drawer.css';const drawer = "
|
|
16
|
-
const container = "
|
|
17
|
-
const content = "
|
|
18
|
-
const header = "
|
|
19
|
-
const footer = "
|
|
20
|
-
const remove = "
|
|
21
|
-
const large = "
|
|
22
|
-
const sticky = "
|
|
15
|
+
import './Drawer.css';const drawer = "_drawer_1enz7_2";
|
|
16
|
+
const container = "_container_1enz7_29";
|
|
17
|
+
const content = "_content_1enz7_41";
|
|
18
|
+
const header = "_header_1enz7_47";
|
|
19
|
+
const footer = "_footer_1enz7_70";
|
|
20
|
+
const remove = "_remove_1enz7_87";
|
|
21
|
+
const large = "_large_1enz7_96";
|
|
22
|
+
const sticky = "_sticky_1enz7_99";
|
|
23
23
|
const styles = {
|
|
24
24
|
drawer: drawer,
|
|
25
25
|
container: container,
|
|
26
26
|
content: content,
|
|
27
27
|
header: header,
|
|
28
|
-
"close-container": "_close-
|
|
28
|
+
"close-container": "_close-container_1enz7_63",
|
|
29
29
|
footer: footer,
|
|
30
30
|
remove: remove,
|
|
31
31
|
large: large,
|
|
32
32
|
sticky: sticky,
|
|
33
|
-
"close-button": "_close-
|
|
33
|
+
"close-button": "_close-button_1enz7_105"
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
function useDrawerContext() {
|
|
@@ -367,4 +367,4 @@ const Drawer = Object.assign(DrawerElement, {
|
|
|
367
367
|
});
|
|
368
368
|
|
|
369
369
|
export { Drawer as D, DrawerCancelButton as a, DrawerFooter as b, DrawerHeader as c, DrawerContent as d };
|
|
370
|
-
//# sourceMappingURL=Drawer-
|
|
370
|
+
//# sourceMappingURL=Drawer-yG7C8Owv.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer-C1KtNoLu.js","sources":["../src/components/Drawer/internal/useDrawerContext.ts","../src/components/Drawer/DrawerCancelButton.tsx","../src/components/Drawer/DrawerHeader.tsx","../src/components/Drawer/DrawerFooter.tsx","../src/components/Drawer/DrawerContent.tsx","../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import { useContext } from \"react\";\nimport { DrawerContext } from \"./DrawerContext\";\n\n/**\n * Hook to access the drawer context.\n *\n * @returns The drawer context containing close function and ref\n * @throws Error if used outside of a DrawerContextProvider\n */\nexport function useDrawerContext() {\n const context = useContext(DrawerContext);\n if (!context) {\n throw new Error(\n \"useDrawerContext must be used within a DrawerContextProvider\",\n );\n }\n return context;\n}\n","import { MouseEvent, forwardRef } from \"react\";\nimport { Button, ButtonProps } from \"../Button\";\nimport { DataTrackingId } from \"../../types\";\nimport { childrenToString } from \"../../internal/functions\";\nimport { useTrackingId } from \"../../hooks\";\nimport { useDrawerContext } from \"./internal/useDrawerContext\";\n\n/**\n * Props for the DrawerCancelButton component\n * @extends ButtonProps\n */\nexport type DrawerCancelButtonProps = ButtonProps & DataTrackingId;\n\n/**\n * A button component that automatically closes the drawer when clicked.\n *\n * Features:\n * - Automatically closes the drawer when clicked\n * - Extends Button component functionality\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard button props\n * - Proper focus management\n * - Can be used anywhere within the drawer context\n *\n * @example\n * <DrawerCancelButton appearance=\"ghost\" size=\"small\">\n * Cancel\n * </DrawerCancelButton>\n */\nexport const DrawerCancelButton = forwardRef<\n HTMLButtonElement,\n DrawerCancelButtonProps\n>((props, ref) => {\n const { onClick, ...rest } = props;\n const { close } = useDrawerContext();\n const data = {\n children: childrenToString(props.children),\n appearance: props.appearance,\n size: props.size,\n type: props.type,\n };\n\n const trackingId = useTrackingId({\n name: \"DrawerCancelButton\",\n data,\n hasOverride: !!props[\"data-tracking-id\"],\n });\n\n const onClickHandler = (e: MouseEvent<HTMLButtonElement>) => {\n onClick?.(e);\n close();\n };\n return (\n <Button\n aria-label=\"Close drawer\"\n data-anv=\"drawer-cancel-button\"\n data-tracking-id={trackingId}\n onClick={onClickHandler}\n ref={ref}\n {...rest}\n />\n );\n});\n\nDrawerCancelButton.displayName = \"DrawerCancelButton\";\n","import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport Close from \"@servicetitan/hammer-icon/mdi/round/close.svg\";\nimport styles from \"./Drawer.module.scss\";\nimport { Text } from \"../Text\";\nimport { DrawerCancelButton } from \"./DrawerCancelButton\";\nimport cx from \"classnames\";\nimport { DataTrackingId } from \"../../types\";\nimport { childrenToString } from \"../../internal/functions\";\nimport { useTrackingId } from \"../../hooks\";\n\n/**\n * Props for the DrawerHeader component\n * @extends ComponentPropsWithoutRef<\"header\">\n */\nexport type DrawerHeaderProps = ComponentPropsWithoutRef<\"header\"> &\n DataTrackingId;\n\n/**\n * Header component for the drawer that displays a title and close button.\n *\n * Features:\n * - Displays the drawer title as a headline\n * - Includes an accessible close button\n * - Sticky positioning at the top of the drawer\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Automatic close functionality\n *\n * @example\n * <Drawer.Header>Settings</Drawer.Header>\n */\nexport const DrawerHeader = forwardRef<HTMLHeadElement, DrawerHeaderProps>(\n (props, ref) => {\n const { className, children } = props;\n const data = {\n children: childrenToString(props.children),\n };\n\n const trackingId = useTrackingId({\n name: \"DrawerHeader\",\n data,\n hasOverride: !!props[\"data-tracking-id\"],\n });\n\n const drawerHeaderClasses = cx(styles.header, className);\n\n return (\n <header\n className={drawerHeaderClasses}\n data-anv=\"drawer-header\"\n data-tracking-id={trackingId}\n ref={ref}\n >\n <Text variant=\"headline\" el=\"h1\">\n {children}\n </Text>\n <span className={styles[\"close-container\"]}>\n <DrawerCancelButton\n className={styles[\"close-button\"]}\n size=\"small\"\n appearance=\"ghost\"\n aria-label=\"Close drawer\"\n data-anv=\"drawer-header-close-button\"\n icon={Close}\n />\n </span>\n </header>\n );\n },\n);\n\nDrawerHeader.displayName = \"DrawerHeader\";\n","import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport styles from \"./Drawer.module.scss\";\nimport cx from \"classnames\";\n\n/**\n * Props for the DrawerFooter component\n * @extends ComponentPropsWithoutRef<\"footer\">\n */\nexport type DrawerFooterProps = ComponentPropsWithoutRef<\"footer\"> & {\n /**\n * When true, the footer will stick to the bottom of the drawer.\n * @default false\n */\n sticky?: boolean;\n};\n\n/**\n * Footer component for the drawer that displays action buttons and controls.\n *\n * Features:\n * - Flexible layout for action buttons and controls\n * - Optional sticky positioning at the bottom\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard footer element props\n * - Responsive design that adapts to content\n *\n * @example\n * <Drawer.Footer sticky>\n * <Button onClick={handleSave}>Save</Button>\n * <Button onClick={handleCancel}>Cancel</Button>\n * </Drawer.Footer>\n */\nexport const DrawerFooter = forwardRef<HTMLElement, DrawerFooterProps>(\n (props, ref) => {\n const { className, children, sticky = false, ...rest } = props;\n const drawerFooterClasses = cx(styles.footer, className, {\n [styles[\"sticky\"]]: sticky,\n });\n\n return (\n <footer\n className={drawerFooterClasses}\n data-anv=\"drawer-footer\"\n ref={ref}\n {...rest}\n >\n {children}\n </footer>\n );\n },\n);\n\nDrawerFooter.displayName = \"DrawerFooter\";\n","import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport styles from \"./Drawer.module.scss\";\nimport cx from \"classnames\";\n\n/**\n * Props for the DrawerContent component\n * @extends ComponentPropsWithoutRef<\"div\">\n */\nexport type DrawerContentProps = ComponentPropsWithoutRef<\"div\">;\n\n/**\n * Content container for the drawer that holds the main content area.\n *\n * Features:\n * - Flexible content area with proper spacing\n * - Scrollable content when needed\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard div element props\n * - Responsive design that adapts to content\n * - Proper focus management\n *\n * @example\n * <Drawer.Content>\n * <p>This is the main content of the drawer.</p>\n * <p>It can contain any type of content.</p>\n * </Drawer.Content>\n */\nexport const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(\n (props, ref) => {\n const { className, children, ...rest } = props;\n const drawerContentClasses = cx(styles.content, className);\n\n return (\n <div\n className={drawerContentClasses}\n data-anv=\"drawer-content\"\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\n\nDrawerContent.displayName = \"DrawerContent\";\n","import styles from \"./Drawer.module.scss\";\nimport {\n ComponentPropsWithoutRef,\n forwardRef,\n useRef,\n useId,\n useCallback,\n SyntheticEvent,\n KeyboardEvent,\n useMemo,\n} from \"react\";\nimport { DrawerHeader } from \"./DrawerHeader\";\nimport { DrawerFooter } from \"./DrawerFooter\";\nimport { DrawerContent } from \"./DrawerContent\";\nimport { DrawerCancelButton } from \"./DrawerCancelButton\";\nimport {\n OpenCloseTransitionStateEffects,\n useDialogScrollLock,\n useDialogTransitionStates,\n useKeyboardFocusables,\n useOnClickOutside,\n} from \"../../internal/hooks\";\nimport { DisableCloseOnEscapeOrClickProps, Size } from \"../../types\";\nimport { useMergeRefs } from \"../../hooks\";\nimport cx from \"classnames\";\nimport { ToastProvider } from \"../Toast/internal/ToastProvider\";\nimport { ToasterPopover } from \"../Toast/internal/ToasterPopover\";\nimport { ToasterContent } from \"../Toast/internal/Toaster\";\nimport { DrawerContext } from \"./internal/DrawerContext\";\nimport { FocusableElement } from \"tabbable\";\nimport { useInitialFocus } from \"../Dialog/internal/useInitialFocus\";\n\n/**\n * Props for the Drawer component\n * @extends ComponentPropsWithoutRef<\"dialog\">\n * @extends DialogTransitionStateEffects\n * @extends DisableCloseOnEscapeOrClickProps\n */\nexport type DrawerProps = ComponentPropsWithoutRef<\"dialog\"> &\n OpenCloseTransitionStateEffects &\n DisableCloseOnEscapeOrClickProps & {\n /**\n * The size of the drawer.\n * @default \"medium\"\n */\n size?: Extract<Size, \"medium\" | \"large\">;\n /**\n * Controls whether the drawer is open or closed.\n * @default false\n */\n open?: boolean;\n /**\n * Callback function called after the drawer is animated closed.\n */\n onClose?: () => void;\n /**\n * Callback function called when the drawer opens.\n * @deprecated Use onOpenAnimationStart or onOpenAnimationComplete instead\n */\n onOpen?: () => void;\n /**\n * Callback when clicking outside the drawer\n */\n onClickOutside?: (e: globalThis.MouseEvent) => void;\n /**\n * Enables scroll chaining behavior.\n * @link https://developer.mozilla.org/en-US/docs/Glossary/Scroll_chaining\n */\n enableScrollChaining?: boolean;\n };\n\nconst DrawerElement = forwardRef<HTMLDialogElement, DrawerProps>(\n (props, ref) => {\n const {\n className,\n open = false,\n children,\n onOpen,\n onClose,\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars --\n onCancel is destructured so that it is not passed to the dialog in ...rest\n */\n onCancel,\n onKeyDown,\n disableCloseOnEscape = false,\n onClickOutside,\n disableCloseOnClickOutside = false,\n size = \"medium\",\n enableScrollChaining,\n onOpenAnimationStart,\n onOpenAnimationComplete,\n onCloseAnimationStart,\n onCloseAnimationComplete,\n ...rest\n } = props;\n\n const elRef = useRef<HTMLDialogElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const toasterRef = useRef<HTMLDivElement>(null);\n const combinedRef = useMergeRefs([elRef, ref]);\n const id = useId();\n\n const { state, isOpenOrOpening } = useDialogTransitionStates(elRef, open, {\n onOpenAnimationStart: useCallback(() => {\n onOpenAnimationStart?.();\n }, [onOpenAnimationStart]),\n onOpenAnimationComplete: useCallback(() => {\n onOpenAnimationComplete?.();\n onOpen?.(); // DEPRECATED\n }, [onOpen, onOpenAnimationComplete]),\n onCloseAnimationStart: useCallback(() => {\n onCloseAnimationStart?.();\n }, [onCloseAnimationStart]),\n onCloseAnimationComplete: useCallback(() => {\n onCloseAnimationComplete?.();\n }, [onCloseAnimationComplete]),\n });\n\n const classNames = cx([styles.drawer], className, {\n [styles.remove]: state === \"closing\",\n [styles.large]: size === \"large\",\n });\n\n const { focusables } = useKeyboardFocusables(contentRef, {\n observeChange: false,\n });\n const firstFocusable = focusables?.[0];\n const lastFocusable = focusables?.[focusables.length - 1];\n\n useDialogScrollLock({\n open: isOpenOrOpening,\n id,\n enableScrollChaining,\n elementRef: elRef,\n });\n\n const computeFocus = useCallback((focusables: FocusableElement[]) => {\n return (\n focusables.find(\n (focusable) => focusable.dataset.anv !== \"drawer-header-close-button\",\n ) || focusables[0]\n );\n }, []);\n\n useInitialFocus(elRef, {\n computeFocus,\n });\n\n const onCancelHandler = (e: SyntheticEvent<HTMLDialogElement>) => {\n e.preventDefault();\n\n if (disableCloseOnEscape) return;\n onClose?.();\n };\n\n useOnClickOutside({\n onOutsidePress: (e) => {\n if (!open) return;\n onClickOutside?.(e);\n },\n targets: [\n contentRef.current as HTMLElement,\n toasterRef.current as HTMLElement,\n ],\n onClose: () => {\n if (disableCloseOnClickOutside || !open) return;\n onClose?.();\n },\n });\n\n const onKeyDownHandler = (e: KeyboardEvent<HTMLDialogElement>) => {\n onKeyDown?.(e);\n if (e.code === \"Tab\") {\n if (e.shiftKey && e.target === firstFocusable) {\n e.preventDefault();\n (lastFocusable as HTMLElement)?.focus();\n return;\n }\n if (e.target === lastFocusable && !e.shiftKey) {\n e.preventDefault();\n (firstFocusable as HTMLElement)?.focus();\n return;\n }\n }\n };\n\n const contextValue = useMemo(() => {\n return { close: () => onClose?.() };\n }, [onClose]);\n\n return (\n // dialog element does seem to be interactive on MDN guideline\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n <dialog\n className={classNames}\n data-anv=\"drawer\"\n data-anv-scroll-chaining={enableScrollChaining}\n data-anv-transition-state={state}\n ref={combinedRef}\n onCancel={onCancelHandler}\n onKeyDown={onKeyDownHandler}\n {...rest}\n >\n <ToastProvider isDialogToaster={isOpenOrOpening}>\n <ToasterPopover>\n <ToasterContent id=\"drawer-toaster\" ref={toasterRef} />\n </ToasterPopover>\n </ToastProvider>\n <DrawerContext.Provider value={contextValue}>\n <section\n ref={contentRef}\n className={styles.container}\n data-open={isOpenOrOpening}\n >\n {children}\n </section>\n </DrawerContext.Provider>\n </dialog>\n );\n },\n);\nDrawerElement.displayName = \"Drawer\";\n\n/**\n * A slide-out drawer component that provides a modal-like experience from the side of the screen.\n *\n * Features:\n * - Slide-in animation from the side of the screen\n * - Keyboard navigation with focus trapping\n * - Escape key and click outside to close\n * - Configurable size variants (medium, large)\n * - Built-in toast support for notifications\n * - Automatic scroll locking when open\n * - Accessible with proper ARIA attributes\n * - Compound component structure with Header, Footer, Content, and CancelButton\n * - Transition state callbacks for animation control\n * - Optional scroll chaining support\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Drawer open={isOpen} onClose={handleClose} size=\"medium\">\n * <Drawer.Header>Settings</Drawer.Header>\n * <Drawer.Content>Drawer content goes here</Drawer.Content>\n * <Drawer.Footer>\n * <Button onClick={handleSave}>Save</Button>\n * <Drawer.CancelButton>Cancel</Drawer.CancelButton>\n * </Drawer.Footer>\n * </Drawer>\n */\nexport const Drawer = Object.assign(DrawerElement, {\n /**\n * Header component for the drawer that displays a title and close button.\n *\n * Features:\n * - Displays the drawer title as a headline\n * - Includes an accessible close button\n * - Sticky positioning at the top of the drawer\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Automatic close functionality\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Drawer.Header>Settings</Drawer.Header>\n */\n Header: DrawerHeader,\n /**\n * Footer component for the drawer that displays action buttons and controls.\n *\n * Features:\n * - Flexible layout for action buttons and controls\n * - Optional sticky positioning at the bottom\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard footer element props\n * - Responsive design that adapts to content\n *\n * @example\n * <Drawer.Footer sticky>\n * <Button onClick={handleSave}>Save</Button>\n * <Drawer.CancelButton>Cancel</Drawer.CancelButton>\n * </Drawer.Footer>\n */\n Footer: DrawerFooter,\n /**\n * Content container for the drawer that holds the main content area.\n *\n * Features:\n * - Flexible content area with proper spacing\n * - Scrollable content when needed\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard div element props\n * - Responsive design that adapts to content\n * - Proper focus management\n *\n * @example\n * <Drawer.Content>\n * <p>This is the main content of the drawer.</p>\n * <p>It can contain any type of content.</p>\n * </Drawer.Content>\n */\n Content: DrawerContent,\n /**\n * A button component that automatically closes the drawer when clicked.\n *\n * Features:\n * - Automatically closes the drawer when clicked\n * - Extends Button component functionality\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard button props\n * - Proper focus management\n * - Can be used anywhere within the drawer context\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Drawer.CancelButton appearance=\"ghost\" size=\"small\">\n * Cancel\n * </Drawer.CancelButton>\n */\n CancelButton: DrawerCancelButton,\n});\n"],"names":["Close","focusables"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASO,SAAS,gBAAA,GAAmB;AACjC,EAAA,MAAM,OAAA,GAAU,WAAW,aAAa,CAAA;AACxC,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KACF;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT;;ACaO,MAAM,kBAAA,GAAqB,UAAA,CAGhC,CAAC,KAAA,EAAO,GAAA,KAAQ;AAChB,EAAA,MAAM,EAAE,OAAA,EAAS,GAAG,IAAA,EAAK,GAAI,KAAA;AAC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,CAAO,aAAA,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBjD,MAAA,EAAQ,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBR,MAAA,EAAQ,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBR,OAAA,EAAS,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBT,YAAA,EAAc;AAChB,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Drawer-yG7C8Owv.js","sources":["../src/components/Drawer/internal/useDrawerContext.ts","../src/components/Drawer/DrawerCancelButton.tsx","../src/components/Drawer/DrawerHeader.tsx","../src/components/Drawer/DrawerFooter.tsx","../src/components/Drawer/DrawerContent.tsx","../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import { useContext } from \"react\";\nimport { DrawerContext } from \"./DrawerContext\";\n\n/**\n * Hook to access the drawer context.\n *\n * @returns The drawer context containing close function and ref\n * @throws Error if used outside of a DrawerContextProvider\n */\nexport function useDrawerContext() {\n const context = useContext(DrawerContext);\n if (!context) {\n throw new Error(\n \"useDrawerContext must be used within a DrawerContextProvider\",\n );\n }\n return context;\n}\n","import { MouseEvent, forwardRef } from \"react\";\nimport { Button, ButtonProps } from \"../Button\";\nimport { DataTrackingId } from \"../../types\";\nimport { childrenToString } from \"../../internal/functions\";\nimport { useTrackingId } from \"../../hooks\";\nimport { useDrawerContext } from \"./internal/useDrawerContext\";\n\n/**\n * Props for the DrawerCancelButton component\n * @extends ButtonProps\n */\nexport type DrawerCancelButtonProps = ButtonProps & DataTrackingId;\n\n/**\n * A button component that automatically closes the drawer when clicked.\n *\n * Features:\n * - Automatically closes the drawer when clicked\n * - Extends Button component functionality\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard button props\n * - Proper focus management\n * - Can be used anywhere within the drawer context\n *\n * @example\n * <DrawerCancelButton appearance=\"ghost\" size=\"small\">\n * Cancel\n * </DrawerCancelButton>\n */\nexport const DrawerCancelButton = forwardRef<\n HTMLButtonElement,\n DrawerCancelButtonProps\n>((props, ref) => {\n const { onClick, ...rest } = props;\n const { close } = useDrawerContext();\n const data = {\n children: childrenToString(props.children),\n appearance: props.appearance,\n size: props.size,\n type: props.type,\n };\n\n const trackingId = useTrackingId({\n name: \"DrawerCancelButton\",\n data,\n hasOverride: !!props[\"data-tracking-id\"],\n });\n\n const onClickHandler = (e: MouseEvent<HTMLButtonElement>) => {\n onClick?.(e);\n close();\n };\n return (\n <Button\n aria-label=\"Close drawer\"\n data-anv=\"drawer-cancel-button\"\n data-tracking-id={trackingId}\n onClick={onClickHandler}\n ref={ref}\n {...rest}\n />\n );\n});\n\nDrawerCancelButton.displayName = \"DrawerCancelButton\";\n","import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport Close from \"@servicetitan/hammer-icon/mdi/round/close.svg\";\nimport styles from \"./Drawer.module.scss\";\nimport { Text } from \"../Text\";\nimport { DrawerCancelButton } from \"./DrawerCancelButton\";\nimport cx from \"classnames\";\nimport { DataTrackingId } from \"../../types\";\nimport { childrenToString } from \"../../internal/functions\";\nimport { useTrackingId } from \"../../hooks\";\n\n/**\n * Props for the DrawerHeader component\n * @extends ComponentPropsWithoutRef<\"header\">\n */\nexport type DrawerHeaderProps = ComponentPropsWithoutRef<\"header\"> &\n DataTrackingId;\n\n/**\n * Header component for the drawer that displays a title and close button.\n *\n * Features:\n * - Displays the drawer title as a headline\n * - Includes an accessible close button\n * - Sticky positioning at the top of the drawer\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Automatic close functionality\n *\n * @example\n * <Drawer.Header>Settings</Drawer.Header>\n */\nexport const DrawerHeader = forwardRef<HTMLHeadElement, DrawerHeaderProps>(\n (props, ref) => {\n const { className, children } = props;\n const data = {\n children: childrenToString(props.children),\n };\n\n const trackingId = useTrackingId({\n name: \"DrawerHeader\",\n data,\n hasOverride: !!props[\"data-tracking-id\"],\n });\n\n const drawerHeaderClasses = cx(styles.header, className);\n\n return (\n <header\n className={drawerHeaderClasses}\n data-anv=\"drawer-header\"\n data-tracking-id={trackingId}\n ref={ref}\n >\n <Text variant=\"headline\" el=\"h1\">\n {children}\n </Text>\n <span className={styles[\"close-container\"]}>\n <DrawerCancelButton\n className={styles[\"close-button\"]}\n size=\"small\"\n appearance=\"ghost\"\n aria-label=\"Close drawer\"\n data-anv=\"drawer-header-close-button\"\n icon={Close}\n />\n </span>\n </header>\n );\n },\n);\n\nDrawerHeader.displayName = \"DrawerHeader\";\n","import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport styles from \"./Drawer.module.scss\";\nimport cx from \"classnames\";\n\n/**\n * Props for the DrawerFooter component\n * @extends ComponentPropsWithoutRef<\"footer\">\n */\nexport type DrawerFooterProps = ComponentPropsWithoutRef<\"footer\"> & {\n /**\n * When true, the footer will stick to the bottom of the drawer.\n * @default false\n */\n sticky?: boolean;\n};\n\n/**\n * Footer component for the drawer that displays action buttons and controls.\n *\n * Features:\n * - Flexible layout for action buttons and controls\n * - Optional sticky positioning at the bottom\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard footer element props\n * - Responsive design that adapts to content\n *\n * @example\n * <Drawer.Footer sticky>\n * <Button onClick={handleSave}>Save</Button>\n * <Button onClick={handleCancel}>Cancel</Button>\n * </Drawer.Footer>\n */\nexport const DrawerFooter = forwardRef<HTMLElement, DrawerFooterProps>(\n (props, ref) => {\n const { className, children, sticky = false, ...rest } = props;\n const drawerFooterClasses = cx(styles.footer, className, {\n [styles[\"sticky\"]]: sticky,\n });\n\n return (\n <footer\n className={drawerFooterClasses}\n data-anv=\"drawer-footer\"\n ref={ref}\n {...rest}\n >\n {children}\n </footer>\n );\n },\n);\n\nDrawerFooter.displayName = \"DrawerFooter\";\n","import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport styles from \"./Drawer.module.scss\";\nimport cx from \"classnames\";\n\n/**\n * Props for the DrawerContent component\n * @extends ComponentPropsWithoutRef<\"div\">\n */\nexport type DrawerContentProps = ComponentPropsWithoutRef<\"div\">;\n\n/**\n * Content container for the drawer that holds the main content area.\n *\n * Features:\n * - Flexible content area with proper spacing\n * - Scrollable content when needed\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard div element props\n * - Responsive design that adapts to content\n * - Proper focus management\n *\n * @example\n * <Drawer.Content>\n * <p>This is the main content of the drawer.</p>\n * <p>It can contain any type of content.</p>\n * </Drawer.Content>\n */\nexport const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(\n (props, ref) => {\n const { className, children, ...rest } = props;\n const drawerContentClasses = cx(styles.content, className);\n\n return (\n <div\n className={drawerContentClasses}\n data-anv=\"drawer-content\"\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\n\nDrawerContent.displayName = \"DrawerContent\";\n","import styles from \"./Drawer.module.scss\";\nimport {\n ComponentPropsWithoutRef,\n forwardRef,\n useRef,\n useId,\n useCallback,\n SyntheticEvent,\n KeyboardEvent,\n useMemo,\n} from \"react\";\nimport { DrawerHeader } from \"./DrawerHeader\";\nimport { DrawerFooter } from \"./DrawerFooter\";\nimport { DrawerContent } from \"./DrawerContent\";\nimport { DrawerCancelButton } from \"./DrawerCancelButton\";\nimport {\n OpenCloseTransitionStateEffects,\n useDialogScrollLock,\n useDialogTransitionStates,\n useKeyboardFocusables,\n useOnClickOutside,\n} from \"../../internal/hooks\";\nimport { DisableCloseOnEscapeOrClickProps, Size } from \"../../types\";\nimport { useMergeRefs } from \"../../hooks\";\nimport cx from \"classnames\";\nimport { ToastProvider } from \"../Toast/internal/ToastProvider\";\nimport { ToasterPopover } from \"../Toast/internal/ToasterPopover\";\nimport { ToasterContent } from \"../Toast/internal/Toaster\";\nimport { DrawerContext } from \"./internal/DrawerContext\";\nimport { FocusableElement } from \"tabbable\";\nimport { useInitialFocus } from \"../Dialog/internal/useInitialFocus\";\n\n/**\n * Props for the Drawer component\n * @extends ComponentPropsWithoutRef<\"dialog\">\n * @extends DialogTransitionStateEffects\n * @extends DisableCloseOnEscapeOrClickProps\n */\nexport type DrawerProps = ComponentPropsWithoutRef<\"dialog\"> &\n OpenCloseTransitionStateEffects &\n DisableCloseOnEscapeOrClickProps & {\n /**\n * The size of the drawer.\n * @default \"medium\"\n */\n size?: Extract<Size, \"medium\" | \"large\">;\n /**\n * Controls whether the drawer is open or closed.\n * @default false\n */\n open?: boolean;\n /**\n * Callback function called after the drawer is animated closed.\n */\n onClose?: () => void;\n /**\n * Callback function called when the drawer opens.\n * @deprecated Use onOpenAnimationStart or onOpenAnimationComplete instead\n */\n onOpen?: () => void;\n /**\n * Callback when clicking outside the drawer\n */\n onClickOutside?: (e: globalThis.MouseEvent) => void;\n /**\n * Enables scroll chaining behavior.\n * @link https://developer.mozilla.org/en-US/docs/Glossary/Scroll_chaining\n */\n enableScrollChaining?: boolean;\n };\n\nconst DrawerElement = forwardRef<HTMLDialogElement, DrawerProps>(\n (props, ref) => {\n const {\n className,\n open = false,\n children,\n onOpen,\n onClose,\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars --\n onCancel is destructured so that it is not passed to the dialog in ...rest\n */\n onCancel,\n onKeyDown,\n disableCloseOnEscape = false,\n onClickOutside,\n disableCloseOnClickOutside = false,\n size = \"medium\",\n enableScrollChaining,\n onOpenAnimationStart,\n onOpenAnimationComplete,\n onCloseAnimationStart,\n onCloseAnimationComplete,\n ...rest\n } = props;\n\n const elRef = useRef<HTMLDialogElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const toasterRef = useRef<HTMLDivElement>(null);\n const combinedRef = useMergeRefs([elRef, ref]);\n const id = useId();\n\n const { state, isOpenOrOpening } = useDialogTransitionStates(elRef, open, {\n onOpenAnimationStart: useCallback(() => {\n onOpenAnimationStart?.();\n }, [onOpenAnimationStart]),\n onOpenAnimationComplete: useCallback(() => {\n onOpenAnimationComplete?.();\n onOpen?.(); // DEPRECATED\n }, [onOpen, onOpenAnimationComplete]),\n onCloseAnimationStart: useCallback(() => {\n onCloseAnimationStart?.();\n }, [onCloseAnimationStart]),\n onCloseAnimationComplete: useCallback(() => {\n onCloseAnimationComplete?.();\n }, [onCloseAnimationComplete]),\n });\n\n const classNames = cx([styles.drawer], className, {\n [styles.remove]: state === \"closing\",\n [styles.large]: size === \"large\",\n });\n\n const { focusables } = useKeyboardFocusables(contentRef, {\n observeChange: false,\n });\n const firstFocusable = focusables?.[0];\n const lastFocusable = focusables?.[focusables.length - 1];\n\n useDialogScrollLock({\n open: isOpenOrOpening,\n id,\n enableScrollChaining,\n elementRef: elRef,\n });\n\n const computeFocus = useCallback((focusables: FocusableElement[]) => {\n return (\n focusables.find(\n (focusable) => focusable.dataset.anv !== \"drawer-header-close-button\",\n ) || focusables[0]\n );\n }, []);\n\n useInitialFocus(elRef, {\n computeFocus,\n });\n\n const onCancelHandler = (e: SyntheticEvent<HTMLDialogElement>) => {\n e.preventDefault();\n\n if (disableCloseOnEscape) return;\n onClose?.();\n };\n\n useOnClickOutside({\n onOutsidePress: (e) => {\n if (!open) return;\n onClickOutside?.(e);\n },\n targets: [\n contentRef.current as HTMLElement,\n toasterRef.current as HTMLElement,\n ],\n onClose: () => {\n if (disableCloseOnClickOutside || !open) return;\n onClose?.();\n },\n });\n\n const onKeyDownHandler = (e: KeyboardEvent<HTMLDialogElement>) => {\n onKeyDown?.(e);\n if (e.code === \"Tab\") {\n if (e.shiftKey && e.target === firstFocusable) {\n e.preventDefault();\n (lastFocusable as HTMLElement)?.focus();\n return;\n }\n if (e.target === lastFocusable && !e.shiftKey) {\n e.preventDefault();\n (firstFocusable as HTMLElement)?.focus();\n return;\n }\n }\n };\n\n const contextValue = useMemo(() => {\n return { close: () => onClose?.() };\n }, [onClose]);\n\n return (\n // dialog element does seem to be interactive on MDN guideline\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n <dialog\n className={classNames}\n data-anv=\"drawer\"\n data-anv-scroll-chaining={enableScrollChaining}\n data-anv-transition-state={state}\n ref={combinedRef}\n onCancel={onCancelHandler}\n onKeyDown={onKeyDownHandler}\n {...rest}\n >\n <ToastProvider isDialogToaster={isOpenOrOpening}>\n <ToasterPopover>\n <ToasterContent id=\"drawer-toaster\" ref={toasterRef} />\n </ToasterPopover>\n </ToastProvider>\n <DrawerContext.Provider value={contextValue}>\n <section\n ref={contentRef}\n className={styles.container}\n data-open={isOpenOrOpening}\n >\n {children}\n </section>\n </DrawerContext.Provider>\n </dialog>\n );\n },\n);\nDrawerElement.displayName = \"Drawer\";\n\n/**\n * A slide-out drawer component that provides a modal-like experience from the side of the screen.\n *\n * Features:\n * - Slide-in animation from the side of the screen\n * - Keyboard navigation with focus trapping\n * - Escape key and click outside to close\n * - Configurable size variants (medium, large)\n * - Built-in toast support for notifications\n * - Automatic scroll locking when open\n * - Accessible with proper ARIA attributes\n * - Compound component structure with Header, Footer, Content, and CancelButton\n * - Transition state callbacks for animation control\n * - Optional scroll chaining support\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Drawer open={isOpen} onClose={handleClose} size=\"medium\">\n * <Drawer.Header>Settings</Drawer.Header>\n * <Drawer.Content>Drawer content goes here</Drawer.Content>\n * <Drawer.Footer>\n * <Button onClick={handleSave}>Save</Button>\n * <Drawer.CancelButton>Cancel</Drawer.CancelButton>\n * </Drawer.Footer>\n * </Drawer>\n */\nexport const Drawer = Object.assign(DrawerElement, {\n /**\n * Header component for the drawer that displays a title and close button.\n *\n * Features:\n * - Displays the drawer title as a headline\n * - Includes an accessible close button\n * - Sticky positioning at the top of the drawer\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Automatic close functionality\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Drawer.Header>Settings</Drawer.Header>\n */\n Header: DrawerHeader,\n /**\n * Footer component for the drawer that displays action buttons and controls.\n *\n * Features:\n * - Flexible layout for action buttons and controls\n * - Optional sticky positioning at the bottom\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard footer element props\n * - Responsive design that adapts to content\n *\n * @example\n * <Drawer.Footer sticky>\n * <Button onClick={handleSave}>Save</Button>\n * <Drawer.CancelButton>Cancel</Drawer.CancelButton>\n * </Drawer.Footer>\n */\n Footer: DrawerFooter,\n /**\n * Content container for the drawer that holds the main content area.\n *\n * Features:\n * - Flexible content area with proper spacing\n * - Scrollable content when needed\n * - Proper semantic HTML structure\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard div element props\n * - Responsive design that adapts to content\n * - Proper focus management\n *\n * @example\n * <Drawer.Content>\n * <p>This is the main content of the drawer.</p>\n * <p>It can contain any type of content.</p>\n * </Drawer.Content>\n */\n Content: DrawerContent,\n /**\n * A button component that automatically closes the drawer when clicked.\n *\n * Features:\n * - Automatically closes the drawer when clicked\n * - Extends Button component functionality\n * - Accessible with proper ARIA attributes\n * - Consistent styling with the design system\n * - Supports all standard button props\n * - Proper focus management\n * - Can be used anywhere within the drawer context\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Drawer.CancelButton appearance=\"ghost\" size=\"small\">\n * Cancel\n * </Drawer.CancelButton>\n */\n CancelButton: DrawerCancelButton,\n});\n"],"names":["Close","focusables"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASO,SAAS,gBAAA,GAAmB;AACjC,EAAA,MAAM,OAAA,GAAU,WAAW,aAA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,SAAA;AAAA,cAAA;AAAA,gBACC,GAAA,EAAK,UAAA;AAAA,gBACL,WAAW,MAAA,CAAO,SAAA;AAAA,gBAClB,WAAA,EAAW,eAAA;AAAA,gBAEV;AAAA;AAAA,aACH,EACF;AAAA;AAAA;AAAA;AACF;AAAA,EAEJ;AACF,CAAA;AACA,aAAA,CAAc,WAAA,GAAc,QAAA;AA4BrB,MAAM,MAAA,GAAS,MAAA,CAAO,MAAA,CAAO,aAAA,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBjD,MAAA,EAAQ,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBR,MAAA,EAAQ,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBR,OAAA,EAAS,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBT,YAAA,EAAc;AAChB,CAAC;;;;"}
|
package/dist/Drawer.css
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
@layer starter, reset, base, state, application;
|
|
2
2
|
@layer base {
|
|
3
|
-
.
|
|
3
|
+
._drawer_1enz7_2 {
|
|
4
4
|
border: none;
|
|
5
5
|
background: transparent;
|
|
6
6
|
padding-block: 0;
|
|
7
7
|
padding-inline: 0;
|
|
8
8
|
outline: none;
|
|
9
|
-
animation: _close-
|
|
9
|
+
animation: _close-drawer_1enz7_1 2s forwards;
|
|
10
10
|
transition: width 200ms;
|
|
11
11
|
width: 35rem;
|
|
12
12
|
height: 100%;
|
|
@@ -17,96 +17,93 @@
|
|
|
17
17
|
margin-block-end: 0;
|
|
18
18
|
max-height: 100dvh;
|
|
19
19
|
margin-inline-end: 0;
|
|
20
|
-
|
|
20
|
+
overflow: visible;
|
|
21
21
|
--xpos: 10rem;
|
|
22
|
+
--drawer-padding: 1.5rem;
|
|
22
23
|
}
|
|
23
|
-
.
|
|
24
|
-
animation: _open-
|
|
24
|
+
._drawer_1enz7_2[open] {
|
|
25
|
+
animation: _open-drawer_1enz7_1 300ms forwards;
|
|
25
26
|
}
|
|
26
|
-
.
|
|
27
|
-
animation: _open-
|
|
27
|
+
._drawer_1enz7_2[open]::backdrop {
|
|
28
|
+
animation: _open-backdrop_1enz7_1 200ms forwards;
|
|
28
29
|
}
|
|
29
|
-
.
|
|
30
|
+
._drawer_1enz7_2 ._container_1enz7_29 {
|
|
30
31
|
font-family: var(--font-family-base, "Nunito Sans", sans-serif);
|
|
31
32
|
font-size: 100%;
|
|
32
33
|
color: var(--foreground-color, #141414);
|
|
33
34
|
display: flex;
|
|
34
35
|
box-sizing: border-box;
|
|
35
|
-
padding-block: 1.5rem;
|
|
36
|
-
padding-inline: 1.5rem;
|
|
37
36
|
flex-direction: column;
|
|
38
37
|
background-color: inherit;
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
height: 100%;
|
|
39
|
+
overflow: auto;
|
|
40
|
+
overscroll-behavior: contain;
|
|
41
41
|
}
|
|
42
|
-
.
|
|
42
|
+
._drawer_1enz7_2 ._container_1enz7_29 ._content_1enz7_41 {
|
|
43
43
|
flex-grow: 1;
|
|
44
|
-
padding-block-start: 0.25rem;
|
|
45
|
-
padding-block-end: 0.25rem;
|
|
46
44
|
font-size: 1rem;
|
|
45
|
+
padding: var(--drawer-padding);
|
|
47
46
|
isolation: isolate;
|
|
48
47
|
}
|
|
49
|
-
.
|
|
48
|
+
._header_1enz7_47 {
|
|
50
49
|
position: sticky;
|
|
51
50
|
inset-block-start: 0;
|
|
52
51
|
display: flex;
|
|
53
52
|
justify-content: space-between;
|
|
54
|
-
padding-block:
|
|
55
|
-
padding-
|
|
56
|
-
|
|
57
|
-
margin-inline: -1.5rem;
|
|
53
|
+
padding-block-start: var(--drawer-padding);
|
|
54
|
+
padding-block-end: 0.25rem;
|
|
55
|
+
padding-inline: var(--drawer-padding);
|
|
58
56
|
background-color: inherit;
|
|
59
57
|
font-size: 1rem;
|
|
60
58
|
z-index: 1;
|
|
61
59
|
}
|
|
62
|
-
.
|
|
60
|
+
._header_1enz7_47 h1 {
|
|
63
61
|
margin-block: 0;
|
|
64
62
|
margin-inline: 0;
|
|
65
63
|
}
|
|
66
|
-
.
|
|
64
|
+
._header_1enz7_47 ._close-container_1enz7_63 {
|
|
67
65
|
display: flex;
|
|
68
66
|
justify-content: center;
|
|
69
67
|
align-items: center;
|
|
70
68
|
width: 1.5625rem;
|
|
71
69
|
height: 1.5625rem;
|
|
72
70
|
}
|
|
73
|
-
.
|
|
71
|
+
._footer_1enz7_70 {
|
|
74
72
|
display: flex;
|
|
75
73
|
gap: 0.75rem;
|
|
76
74
|
justify-content: flex-end;
|
|
77
|
-
padding-block:
|
|
78
|
-
padding-
|
|
79
|
-
|
|
80
|
-
margin-inline: -1.5rem;
|
|
75
|
+
padding-block-start: 0.25rem;
|
|
76
|
+
padding-block-end: var(--drawer-padding);
|
|
77
|
+
padding-inline: var(--drawer-padding);
|
|
81
78
|
background-color: inherit;
|
|
82
79
|
flex-wrap: wrap;
|
|
83
80
|
}
|
|
84
81
|
}
|
|
85
82
|
@layer state {
|
|
86
83
|
@media (prefers-reduced-motion: reduce) {
|
|
87
|
-
.
|
|
84
|
+
._drawer_1enz7_2 {
|
|
88
85
|
--xpos: 0;
|
|
89
86
|
}
|
|
90
87
|
}
|
|
91
|
-
.
|
|
92
|
-
animation: _close-
|
|
88
|
+
._drawer_1enz7_2._remove_1enz7_87[open] {
|
|
89
|
+
animation: _close-drawer_1enz7_1 300ms forwards;
|
|
93
90
|
}
|
|
94
|
-
.
|
|
95
|
-
animation: _close-
|
|
91
|
+
._drawer_1enz7_2._remove_1enz7_87[open]::backdrop {
|
|
92
|
+
animation: _close-backdrop_1enz7_1 200ms forwards;
|
|
96
93
|
}
|
|
97
|
-
.
|
|
94
|
+
._drawer_1enz7_2::backdrop {
|
|
98
95
|
background: #040404;
|
|
99
96
|
}
|
|
100
|
-
.
|
|
97
|
+
._drawer_1enz7_2._large_1enz7_96 {
|
|
101
98
|
width: 48rem;
|
|
102
99
|
}
|
|
103
|
-
.
|
|
100
|
+
._drawer_1enz7_2 ._footer_1enz7_70._sticky_1enz7_99 {
|
|
104
101
|
position: sticky;
|
|
105
102
|
inset-block-end: 0;
|
|
106
103
|
}
|
|
107
104
|
}
|
|
108
105
|
@layer application {
|
|
109
|
-
.
|
|
106
|
+
._drawer_1enz7_2 ._header_1enz7_47 ._close-button_1enz7_105 {
|
|
110
107
|
color: var(--foreground-color, #141414);
|
|
111
108
|
}
|
|
112
109
|
}
|
|
@@ -114,7 +111,7 @@
|
|
|
114
111
|
overflow: hidden;
|
|
115
112
|
}
|
|
116
113
|
|
|
117
|
-
@keyframes _open-
|
|
114
|
+
@keyframes _open-drawer_1enz7_1 {
|
|
118
115
|
from {
|
|
119
116
|
opacity: 0;
|
|
120
117
|
transform: translateX(var(--xpos));
|
|
@@ -124,7 +121,7 @@
|
|
|
124
121
|
transform: translateX(0%);
|
|
125
122
|
}
|
|
126
123
|
}
|
|
127
|
-
@keyframes _close-
|
|
124
|
+
@keyframes _close-drawer_1enz7_1 {
|
|
128
125
|
from {
|
|
129
126
|
opacity: 1;
|
|
130
127
|
transform: translateX(0%);
|
|
@@ -134,7 +131,7 @@
|
|
|
134
131
|
transform: translateX(var(--xpos));
|
|
135
132
|
}
|
|
136
133
|
}
|
|
137
|
-
@keyframes _open-
|
|
134
|
+
@keyframes _open-backdrop_1enz7_1 {
|
|
138
135
|
from {
|
|
139
136
|
opacity: 0;
|
|
140
137
|
}
|
|
@@ -142,7 +139,7 @@
|
|
|
142
139
|
opacity: 0.6;
|
|
143
140
|
}
|
|
144
141
|
}
|
|
145
|
-
@keyframes _close-
|
|
142
|
+
@keyframes _close-backdrop_1enz7_1 {
|
|
146
143
|
from {
|
|
147
144
|
opacity: 0.6;
|
|
148
145
|
}
|
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-yG7C8Owv.js';
|
|
2
2
|
//# sourceMappingURL=Drawer.js.map
|
|
@@ -1195,16 +1195,28 @@ const useNumberField = (config) => {
|
|
|
1195
1195
|
[minimumFractionDigits, maximumFractionDigits]
|
|
1196
1196
|
);
|
|
1197
1197
|
const options = maskitoNumberOptionsGenerator(params);
|
|
1198
|
+
const [isBeginningNegativeEntry, setIsBeginningNegativeEntry] = useState(false);
|
|
1198
1199
|
const [inputValue, setInputValue] = useOptionallyControlledState({
|
|
1199
1200
|
controlledValue: convertValueProp(config.value, { maskitoParams: params }),
|
|
1200
1201
|
defaultValue: convertValueProp(config.defaultValue, { maskitoParams: params }) ?? null,
|
|
1201
1202
|
onChange: (value) => {
|
|
1203
|
+
if (value === "-") {
|
|
1204
|
+
setIsBeginningNegativeEntry(true);
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
setIsBeginningNegativeEntry(false);
|
|
1202
1208
|
if (value === null) return config.onChange?.(null);
|
|
1203
1209
|
const parsedValue = maskitoParseNumber(value, params);
|
|
1204
1210
|
const nanSafeValue = isNaN(parsedValue) ? null : parsedValue;
|
|
1205
1211
|
config.onChange?.(nanSafeValue);
|
|
1206
1212
|
}
|
|
1207
1213
|
});
|
|
1214
|
+
const previousInputValue = usePrevious(inputValue, inputValue);
|
|
1215
|
+
useEffect(() => {
|
|
1216
|
+
if (isBeginningNegativeEntry && previousInputValue !== inputValue) {
|
|
1217
|
+
setIsBeginningNegativeEntry(false);
|
|
1218
|
+
}
|
|
1219
|
+
}, [isBeginningNegativeEntry, inputValue, previousInputValue]);
|
|
1208
1220
|
useEffect(() => {
|
|
1209
1221
|
if (previousMinimumFractionDigits === minimumFractionDigits) return;
|
|
1210
1222
|
setInputValue((previous) => {
|
|
@@ -1301,7 +1313,7 @@ const useNumberField = (config) => {
|
|
|
1301
1313
|
value: computedValue?.toNumber() ?? null,
|
|
1302
1314
|
inputRef: combinedInputRef,
|
|
1303
1315
|
inputProps: {
|
|
1304
|
-
value: inputValue ?? "",
|
|
1316
|
+
value: isBeginningNegativeEntry ? "-" : inputValue ?? "",
|
|
1305
1317
|
onChange: handleInputChange,
|
|
1306
1318
|
inputMode,
|
|
1307
1319
|
"aria-valuenow": computedValue?.toNumber() ?? void 0,
|
|
@@ -1562,4 +1574,4 @@ const NumberField = forwardRef(
|
|
|
1562
1574
|
NumberField.displayName = "NumberField";
|
|
1563
1575
|
|
|
1564
1576
|
export { NumberField as N };
|
|
1565
|
-
//# sourceMappingURL=NumberField-
|
|
1577
|
+
//# sourceMappingURL=NumberField-DDjOcEFm.js.map
|