@ahrowe/ui 0.38.0 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs-types/common/datePicker/components/datePickerMonth/datePickerMonth.types.d.ts +6 -6
- package/dist/cjs-types/common/datePicker/dateFunctions.d.ts +10 -19
- package/dist/cjs-types/common/datePicker/datePicker.types.d.ts +20 -14
- package/dist/cjs-types/common/datePicker/index.d.ts +1 -0
- package/dist/cjs-types/common/popover/popover.types.d.ts +5 -0
- package/dist/cjs-types/common/utils/day.d.ts +16 -0
- package/dist/cjs-types/index.d.ts +1 -1
- package/dist/esm/common/datePicker/components/datePickerMonth/datePickerMonth.mjs +1 -1
- package/dist/esm/common/datePicker/components/datePickerMonth/datePickerMonth.mjs.map +1 -1
- package/dist/esm/common/datePicker/dateFunctions.mjs +1 -1
- package/dist/esm/common/datePicker/dateFunctions.mjs.map +1 -1
- package/dist/esm/common/datePicker/datePicker.mjs +1 -1
- package/dist/esm/common/datePicker/datePicker.mjs.map +1 -1
- package/dist/esm/common/hooks/useFocusBoundary.mjs +1 -1
- package/dist/esm/common/hooks/useFocusBoundary.mjs.map +1 -1
- package/dist/esm/common/popover/popover.mjs +1 -1
- package/dist/esm/common/popover/popover.mjs.map +1 -1
- package/dist/esm/common/popover/popover.types.mjs.map +1 -1
- package/dist/esm/common/utils/day.mjs +2 -0
- package/dist/esm/common/utils/day.mjs.map +1 -0
- package/dist/esm/index.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/types/common/datePicker/components/datePickerMonth/datePickerMonth.types.d.ts +6 -6
- package/dist/types/common/datePicker/dateFunctions.d.ts +10 -19
- package/dist/types/common/datePicker/datePicker.types.d.ts +20 -14
- package/dist/types/common/datePicker/index.d.ts +1 -0
- package/dist/types/common/popover/popover.types.d.ts +5 -0
- package/dist/types/common/utils/day.d.ts +16 -0
- package/dist/types/index.d.ts +1 -1
- package/docs/CLAUDE.md +5 -1
- package/docs/DatePicker.md +72 -45
- package/docs/FormValidator.md +3 -3
- package/docs/Popover.md +15 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.mjs","names":[],"sources":["../../../../package/common/popover/popover.tsx"],"sourcesContent":["import { useRef, useEffect, useState, useCallback } from 'react';\nimport cx from 'classnames';\nimport BodyEnd from 'components/common/bodyEnd';\n\nimport styles from './popover.module.pcss';\nimport sheetStyles from '../styles/sheet.module.pcss';\nimport SheetBackdrop from '../sheetBackdrop';\nimport { usePopoverPosition } from './usePopoverPosition';\nimport { useFocusBoundary, tabbablesIn } from '../hooks/useFocusBoundary';\nimport { useSheet } from '../hooks/useSheet';\nimport { useOverlay } from '../hooks/useOverlay';\nimport { useComponentDefaults, usePresentationDefault } from '../configProvider';\nimport { Presentation } from '../configProvider/presentation.types';\nimport { PopoverPlacement, PopoverAlign, PopoverTrigger, type PopoverProps } from './popover.types';\n\nfunction Popover(props: PopoverProps) {\n const {\n children = null,\n content = null,\n placement = PopoverPlacement.Bottom,\n align = PopoverAlign.Center,\n trigger = PopoverTrigger.Click,\n isOpen,\n defaultOpen = false,\n onOpenChange = () => {},\n offset = 10,\n withArrow = true,\n closeOnOutsideClick = true,\n closeOnEscape = true,\n openDelay = 100,\n closeDelay = 120,\n disabled = false,\n focusOnOpen = 'keyboard',\n closeOnTriggerClick = true,\n width = 'auto',\n constrainWidth = true,\n presentation: presentationProp,\n className,\n style,\n classNames,\n styles: slotStyles,\n ...rest\n } = useComponentDefaults('Popover', props);\n const triggerRef = useRef<HTMLDivElement>(null);\n const floatingRef = useRef<HTMLDivElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const arrowRef = useRef<HTMLDivElement>(null);\n const hoverTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n // Set from a capture handler on the panel, which React fires for its whole\n // React subtree — including children that portal elsewhere in the DOM, such as\n // a Dropdown's list inside a DatePicker's calendar. A DOM `contains` check\n // cannot see those, and without this the panel closes when one is used.\n const panelInteractedRef = useRef(false);\n // Whether the open that is running came from the keyboard, which is what the\n // default `focusOnOpen` follows and what `onOpenChange` reports. A click raised\n // by Enter or Space reports `detail === 0`, where a pointer press counts the\n // clicks; an open with no trigger event at all, such as a panel that appears\n // while the user types, leaves this false.\n const openedByKeyboardRef = useRef(false);\n function markPanelInteraction() {\n panelInteractedRef.current = true;\n }\n\n const isControlled = isOpen !== undefined;\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const open = isControlled ? isOpen : internalOpen;\n\n // Keep the outside-click/Escape listeners pointed at the latest setter without re-subscribing.\n const onOpenChangeRef = useRef(onOpenChange);\n useEffect(() => {\n onOpenChangeRef.current = onOpenChange;\n });\n\n const setOpen = useCallback(\n (next: boolean, fromKeyboard = false) => {\n if (disabled && next) return;\n if (next) openedByKeyboardRef.current = fromKeyboard;\n if (!isControlled) setInternalOpen(next);\n onOpenChangeRef.current(next, { fromKeyboard });\n },\n [disabled, isControlled],\n );\n\n // Explicit prop → this component's global default → the app-wide one → anchored.\n const appPresentation = usePresentationDefault();\n const presentation = presentationProp ?? appPresentation ?? Presentation.Default;\n const { isSheet: sheetPresentation, sheetStyle } = useSheet(presentation);\n // Hover and focus are pointer affordances that open something small next to what caused them;\n // a sheet is a deliberate, screen-owning open. Only a click asks for one.\n const isSheet = sheetPresentation && trigger === PopoverTrigger.Click;\n\n // A sheet isn't anchored to anything, so there's nothing to track, flip or clamp.\n usePopoverPosition({\n isOpen: !!open && !isSheet,\n placement,\n align,\n offset,\n triggerRef,\n floatingRef,\n panelRef,\n arrowRef: withArrow ? arrowRef : { current: null },\n matchTriggerWidth: width === 'trigger',\n });\n\n // Registered for as long as it's open, not just as a sheet: this is what puts the popover on\n // the overlay stack, so an enclosing Modal knows something sits above it and neither drags\n // focus out of this (portaled, so outside the modal's panel) panel nor closes itself on the\n // Escape meant for this. Focus isn't trapped: a Popover is deliberately non-modal, and it\n // already moves focus into the panel on open by itself.\n useOverlay({\n isActive: !!open,\n containerRef: panelRef,\n onEscape: closeOnEscape\n ? () => {\n // Hand focus back to the trigger when it currently sits inside the panel.\n if (floatingRef.current?.contains(document.activeElement)) {\n (tabbablesIn(triggerRef.current)[0] ?? triggerRef.current)?.focus();\n }\n setOpen(false, true);\n }\n : undefined,\n trapFocus: false,\n lockScroll: isSheet,\n });\n\n const { restoreFocusToTrigger, focusAfterTrigger } = useFocusBoundary({\n triggerRef,\n contentRef: floatingRef,\n });\n\n // The panel is portaled to the end of the DOM, so Tab never flows into it naturally. When we\n // manage focus (click trigger + focusable content), move focus in on open and, on Tab out of\n // either end, close and continue focus as if the panel sat right after the trigger.\n useEffect(() => {\n if (!open) {\n openedByKeyboardRef.current = false;\n return;\n }\n const takeFocus = focusOnOpen === true || (focusOnOpen === 'keyboard' && openedByKeyboardRef.current);\n if (!takeFocus || trigger !== PopoverTrigger.Click) return;\n const focusables = tabbablesIn(panelRef.current);\n if (focusables.length === 0) return;\n // Only claim the dialog role when we're actually managing focus for real content.\n floatingRef.current?.setAttribute('role', 'dialog');\n focusables[0].focus();\n }, [open, trigger, focusOnOpen]);\n\n function handleFloatingKeyDown(event: React.KeyboardEvent) {\n if (event.key !== 'Tab' || trigger !== PopoverTrigger.Click) return;\n const focusables = tabbablesIn(panelRef.current);\n if (focusables.length === 0) return;\n const active = document.activeElement;\n if (!event.shiftKey && active === focusables[focusables.length - 1]) {\n event.preventDefault();\n focusAfterTrigger();\n setOpen(false, true);\n } else if (event.shiftKey && active === focusables[0]) {\n event.preventDefault();\n restoreFocusToTrigger();\n setOpen(false, true);\n }\n }\n\n // Outside click. Registered only while open and only for the relevant trigger mode; Escape is\n // handled by `useOverlay` above, which scopes it to the innermost open layer.\n useEffect(() => {\n if (!open) return;\n\n function onMouseUp(event: MouseEvent) {\n // Read and clear: the flag describes this one event, and the panel's React\n // handler has already run by the time this does.\n const inPanelSubtree = panelInteractedRef.current;\n panelInteractedRef.current = false;\n const target = event.target as Node;\n const inPanel = floatingRef.current?.contains(target);\n const inTrigger = triggerRef.current?.contains(target);\n if (!inPanelSubtree && !inPanel && !inTrigger) setOpen(false);\n }\n // Keyboard counterpart to the outside click: once focus leaves both the trigger\n // and the (portaled) panel — e.g. tabbing on to the next element — close.\n function onFocusIn(event: FocusEvent) {\n const inPanelSubtree = panelInteractedRef.current;\n panelInteractedRef.current = false;\n const target = event.target as Node;\n const inPanel = floatingRef.current?.contains(target);\n const inTrigger = triggerRef.current?.contains(target);\n if (!inPanelSubtree && !inPanel && !inTrigger) setOpen(false, true);\n }\n\n if (closeOnOutsideClick && trigger !== PopoverTrigger.Hover) {\n window.addEventListener('mouseup', onMouseUp);\n document.addEventListener('focusin', onFocusIn);\n }\n return () => {\n window.removeEventListener('mouseup', onMouseUp);\n document.removeEventListener('focusin', onFocusIn);\n };\n }, [open, closeOnOutsideClick, trigger, setOpen]);\n\n useEffect(() => () => clearTimeout(hoverTimer.current), []);\n\n function scheduleHover(next: boolean) {\n clearTimeout(hoverTimer.current);\n hoverTimer.current = setTimeout(() => setOpen(next), next ? openDelay : closeDelay);\n }\n\n // Opening from the keyboard without the trigger having to be a button that\n // happens to toggle on Enter: the arrow keys are what the menu-button pattern\n // asks for, and what a consumer reaches for first.\n function handleTriggerKeyDown(event: React.KeyboardEvent) {\n if (open || (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')) return;\n event.preventDefault();\n setOpen(true, true);\n }\n\n const triggerHandlers =\n trigger === PopoverTrigger.Click\n ? {\n onClick: (event: React.MouseEvent) => {\n // A field that opens a picker keeps it open when clicked again, so\n // that placing the caret in the field does not close the panel.\n if (open && !closeOnTriggerClick) return;\n setOpen(!open, event.detail === 0);\n },\n onKeyDown: handleTriggerKeyDown,\n }\n : trigger === PopoverTrigger.Hover\n ? { onMouseEnter: () => scheduleHover(true), onMouseLeave: () => scheduleHover(false) }\n : { onFocus: () => setOpen(true), onBlur: () => setOpen(false) };\n\n const floatingHoverHandlers =\n trigger === PopoverTrigger.Hover\n ? { onMouseEnter: () => scheduleHover(true), onMouseLeave: () => scheduleHover(false) }\n : {};\n\n return (\n <div\n {...rest}\n className={cx(styles.popover, className, classNames?.root)}\n style={{ ...style, ...slotStyles?.root }}\n >\n <div\n ref={triggerRef}\n className={cx(styles.popoverTrigger, classNames?.trigger)}\n style={slotStyles?.trigger}\n {...triggerHandlers}\n >\n {children}\n </div>\n {open && (\n <BodyEnd>\n {isSheet && (\n <SheetBackdrop\n onClose={() => {\n if (closeOnOutsideClick) setOpen(false);\n }}\n className={classNames?.backdrop}\n style={slotStyles?.backdrop}\n />\n )}\n <div\n ref={floatingRef}\n className={cx(isSheet ? sheetStyles.sheet : styles.popoverFloating, classNames?.floating)}\n style={{ ...(isSheet ? sheetStyle : undefined), ...slotStyles?.floating }}\n data-placement={placement}\n onKeyDown={handleFloatingKeyDown}\n onMouseUpCapture={markPanelInteraction}\n onFocusCapture={markPanelInteraction}\n {...floatingHoverHandlers}\n >\n <div\n ref={panelRef}\n className={cx(\n styles.popoverPanel,\n constrainWidth && styles.popoverPanelConstrained,\n isSheet && sheetStyles.sheetPanel,\n classNames?.panel,\n )}\n style={slotStyles?.panel}\n >\n {content}\n </div>\n {withArrow && !isSheet && (\n <div ref={arrowRef} className={cx(styles.popoverArrow, classNames?.arrow)} style={slotStyles?.arrow} />\n )}\n </div>\n </BodyEnd>\n )}\n </div>\n );\n}\n\nexport default Popover;\n"],"mappings":"u4BAeA,SAAS,EAAQ,EAAqB,CACpC,GAAM,CACJ,WAAW,KACX,UAAU,KACV,YAAY,EAAiB,OAC7B,QAAQ,GAAa,OACrB,UAAU,EAAe,MACzB,SACA,cAAc,GACd,mBAAqB,CAAC,EACtB,UAAS,GACT,YAAY,GACZ,sBAAsB,GACtB,iBAAgB,GAChB,aAAY,IACZ,cAAa,IACb,WAAW,GACX,cAAc,WACd,uBAAsB,GACtB,QAAQ,OACR,iBAAiB,GACjB,aAAc,EACd,YACA,QACA,aACA,OAAQ,EACR,GAAG,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,MAAD,CACE,IAAK,EACL,UAAW,EAAG,EAAU,EAAY,MAAQ,EAAO,gBAAiB,GAAY,QAAQ,EACxF,MAAO,CAAE,GAAI,EAAU,GAAa,IAAA,GAAY,GAAG,GAAY,QAAS,EACxE,iBAAgB,EAChB,UAAW,GACX,iBAAkB,EAClB,eAAgB,EAChB,GAAI,GARN,SAAA,CAUE,EAAC,MAAD,CACE,IAAK,EACL,UAAW,EACT,EAAO,aACP,GAAkB,EAAO,wBACzB,GAAW,EAAY,WACvB,GAAY,KACd,EACA,MAAO,GAAY,MAElB,SAAA,CACE,CAAA,EACJ,GAAa,CAAC,GACb,EAAC,MAAD,CAAK,IAAK,EAAU,UAAW,EAAG,EAAO,aAAc,GAAY,KAAK,EAAG,MAAO,GAAY,KAAQ,CAAA,CAErG,CACE,CAAA,CAAA,CAAA,CAAA,CAER,GAET"}
|
|
1
|
+
{"version":3,"file":"popover.mjs","names":[],"sources":["../../../../package/common/popover/popover.tsx"],"sourcesContent":["import { useRef, useEffect, useState, useCallback, type RefObject } from 'react';\nimport cx from 'classnames';\nimport BodyEnd from 'components/common/bodyEnd';\n\nimport styles from './popover.module.pcss';\nimport sheetStyles from '../styles/sheet.module.pcss';\nimport SheetBackdrop from '../sheetBackdrop';\nimport { usePopoverPosition } from './usePopoverPosition';\nimport { useFocusBoundary, tabbablesIn } from '../hooks/useFocusBoundary';\nimport { useSheet } from '../hooks/useSheet';\nimport { useOverlay } from '../hooks/useOverlay';\nimport { useComponentDefaults, usePresentationDefault } from '../configProvider';\nimport { Presentation } from '../configProvider/presentation.types';\nimport { PopoverPlacement, PopoverAlign, PopoverTrigger, type PopoverProps } from './popover.types';\n\n/**\n * How long after its click an anchored popover still counts as opened by it: long enough for the\n * render the click causes, short enough that an old keypress does not decide a later open.\n */\nconst ACTIVATION_WINDOW_MS = 1000;\n\nfunction toReference(\n anchor: HTMLElement | null | undefined,\n triggerRef: RefObject<HTMLElement | null>,\n): RefObject<HTMLElement | null> {\n return anchor ? { current: anchor } : triggerRef;\n}\n\nfunction Popover(props: PopoverProps) {\n const {\n children = null,\n anchor,\n content = null,\n placement = PopoverPlacement.Bottom,\n align = PopoverAlign.Center,\n trigger = PopoverTrigger.Click,\n isOpen,\n defaultOpen = false,\n onOpenChange = () => {},\n offset = 10,\n withArrow = true,\n closeOnOutsideClick = true,\n closeOnEscape = true,\n openDelay = 100,\n closeDelay = 120,\n disabled = false,\n focusOnOpen = 'keyboard',\n closeOnTriggerClick = true,\n width = 'auto',\n constrainWidth = true,\n presentation: presentationProp,\n className,\n style,\n classNames,\n styles: slotStyles,\n ...rest\n } = useComponentDefaults('Popover', props);\n const triggerRef = useRef<HTMLDivElement>(null);\n const floatingRef = useRef<HTMLDivElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const arrowRef = useRef<HTMLDivElement>(null);\n const hoverTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n // Set from a capture handler on the panel, which React fires for its whole\n // React subtree — including children that portal elsewhere in the DOM, such as\n // a Dropdown's list inside a DatePicker's calendar. A DOM `contains` check\n // cannot see those, and without this the panel closes when one is used.\n const panelInteractedRef = useRef(false);\n // Whether the open that is running came from the keyboard, which is what the\n // default `focusOnOpen` follows and what `onOpenChange` reports. A click raised\n // by Enter or Space reports `detail === 0`, where a pointer press counts the\n // clicks; an open with no trigger event at all, such as a panel that appears\n // while the user types, leaves this false.\n const openedByKeyboardRef = useRef(false);\n function markPanelInteraction() {\n panelInteractedRef.current = true;\n }\n\n // What the panel is placed against, and where the focus goes back to. A new object exactly when\n // `anchor` changes, which is what restarts the position tracking for the new element: state, not\n // a memo, because a memo React chose to drop would restart it for no reason.\n const [reference, setReference] = useState(() => ({ anchor, ref: toReference(anchor, triggerRef) }));\n if (reference.anchor !== anchor) setReference({ anchor, ref: toReference(anchor, triggerRef) });\n const referenceRef = reference.ref;\n\n // An anchored popover is opened by its consumer through `isOpen`, so none of the key handling\n // below sees how. The click that caused it does: Enter and Space raise one with `detail === 0`,\n // the same test the trigger uses. Not `:focus-visible`, which a text field matches after a\n // mouse click too, and which stays on a keyboard-focused button that is then clicked.\n const activationRef = useRef<{ target: Node; keyboard: boolean; time: number } | null>(null);\n const anchored = anchor !== undefined;\n useEffect(() => {\n if (!anchored) return;\n function onClick(event: MouseEvent) {\n activationRef.current = { target: event.target as Node, keyboard: event.detail === 0, time: performance.now() };\n }\n // Capturing, so it is recorded before the consumer's own handler opens the panel.\n document.addEventListener('click', onClick, true);\n return () => document.removeEventListener('click', onClick, true);\n }, [anchored]);\n\n const isControlled = isOpen !== undefined;\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const open = isControlled ? isOpen : internalOpen;\n\n // Keep the outside-click/Escape listeners pointed at the latest setter without re-subscribing.\n const onOpenChangeRef = useRef(onOpenChange);\n useEffect(() => {\n onOpenChangeRef.current = onOpenChange;\n });\n\n const setOpen = useCallback(\n (next: boolean, fromKeyboard = false) => {\n if (disabled && next) return;\n if (next) openedByKeyboardRef.current = fromKeyboard;\n if (!isControlled) setInternalOpen(next);\n onOpenChangeRef.current(next, { fromKeyboard });\n },\n [disabled, isControlled],\n );\n\n // Explicit prop → this component's global default → the app-wide one → anchored.\n const appPresentation = usePresentationDefault();\n const presentation = presentationProp ?? appPresentation ?? Presentation.Default;\n const { isSheet: sheetPresentation, sheetStyle } = useSheet(presentation);\n // Hover and focus are pointer affordances that open something small next to what caused them;\n // a sheet is a deliberate, screen-owning open. Only a click asks for one.\n const isSheet = sheetPresentation && trigger === PopoverTrigger.Click;\n\n // A sheet isn't anchored to anything, so there's nothing to track, flip or clamp.\n usePopoverPosition({\n isOpen: !!open && !isSheet,\n placement,\n align,\n offset,\n triggerRef: referenceRef,\n floatingRef,\n panelRef,\n arrowRef: withArrow ? arrowRef : { current: null },\n matchTriggerWidth: width === 'trigger',\n });\n\n // Registered for as long as it's open, not just as a sheet: this is what puts the popover on\n // the overlay stack, so an enclosing Modal knows something sits above it and neither drags\n // focus out of this (portaled, so outside the modal's panel) panel nor closes itself on the\n // Escape meant for this. Focus isn't trapped: a Popover is deliberately non-modal, and it\n // already moves focus into the panel on open by itself.\n const { restoreFocusToTrigger, focusAfterTrigger } = useFocusBoundary({\n triggerRef: referenceRef,\n contentRef: floatingRef,\n });\n\n useOverlay({\n isActive: !!open,\n containerRef: panelRef,\n onEscape: closeOnEscape\n ? () => {\n // Hand focus back to the trigger when it currently sits inside the panel.\n if (floatingRef.current?.contains(document.activeElement)) restoreFocusToTrigger();\n setOpen(false, true);\n }\n : undefined,\n trapFocus: false,\n lockScroll: isSheet,\n });\n\n // The panel is portaled to the end of the DOM, so Tab never flows into it naturally. When we\n // manage focus (click trigger + focusable content), move focus in on open and, on Tab out of\n // either end, close and continue focus as if the panel sat right after the trigger.\n useEffect(() => {\n if (!open) {\n openedByKeyboardRef.current = false;\n return;\n }\n const activation = activationRef.current;\n activationRef.current = null;\n const anchorKeyed =\n !!anchor &&\n !!activation?.keyboard &&\n anchor.contains(activation.target) &&\n performance.now() - activation.time < ACTIVATION_WINDOW_MS;\n const takeFocus =\n focusOnOpen === true || (focusOnOpen === 'keyboard' && (openedByKeyboardRef.current || anchorKeyed));\n if (!takeFocus || trigger !== PopoverTrigger.Click) return;\n const focusables = tabbablesIn(panelRef.current);\n if (focusables.length === 0) return;\n // Only claim the dialog role when we're actually managing focus for real content.\n floatingRef.current?.setAttribute('role', 'dialog');\n focusables[0].focus();\n }, [open, trigger, focusOnOpen, anchor]);\n\n function handleFloatingKeyDown(event: React.KeyboardEvent) {\n if (event.key !== 'Tab' || trigger !== PopoverTrigger.Click) return;\n const focusables = tabbablesIn(panelRef.current);\n if (focusables.length === 0) return;\n const active = document.activeElement;\n if (!event.shiftKey && active === focusables[focusables.length - 1]) {\n event.preventDefault();\n focusAfterTrigger();\n setOpen(false, true);\n } else if (event.shiftKey && active === focusables[0]) {\n event.preventDefault();\n restoreFocusToTrigger();\n setOpen(false, true);\n }\n }\n\n // Outside click. Registered only while open and only for the relevant trigger mode; Escape is\n // handled by `useOverlay` above, which scopes it to the innermost open layer.\n useEffect(() => {\n if (!open) return;\n // Focus that landed in the panel before these listeners existed (ours on open, or content\n // that focuses itself on mount) set the flag with nothing to clear it, and the first\n // click outside was swallowed.\n panelInteractedRef.current = false;\n\n function onMouseUp(event: MouseEvent) {\n // Read and clear: the flag describes this one event, and the panel's React\n // handler has already run by the time this does.\n const inPanelSubtree = panelInteractedRef.current;\n panelInteractedRef.current = false;\n const target = event.target as Node;\n const inPanel = floatingRef.current?.contains(target);\n // Both: with an anchor, `children` still toggle the panel, and a press on them is theirs.\n const inTrigger = triggerRef.current?.contains(target) || referenceRef.current?.contains(target);\n if (!inPanelSubtree && !inPanel && !inTrigger) setOpen(false);\n }\n // Keyboard counterpart to the outside click: once focus leaves both the trigger\n // and the (portaled) panel — e.g. tabbing on to the next element — close.\n function onFocusIn(event: FocusEvent) {\n const inPanelSubtree = panelInteractedRef.current;\n panelInteractedRef.current = false;\n const target = event.target as Node;\n const inPanel = floatingRef.current?.contains(target);\n const inTrigger = triggerRef.current?.contains(target) || referenceRef.current?.contains(target);\n if (!inPanelSubtree && !inPanel && !inTrigger) setOpen(false, true);\n }\n\n if (closeOnOutsideClick && trigger !== PopoverTrigger.Hover) {\n window.addEventListener('mouseup', onMouseUp);\n document.addEventListener('focusin', onFocusIn);\n }\n return () => {\n window.removeEventListener('mouseup', onMouseUp);\n document.removeEventListener('focusin', onFocusIn);\n };\n }, [open, closeOnOutsideClick, trigger, setOpen, referenceRef]);\n\n useEffect(() => () => clearTimeout(hoverTimer.current), []);\n\n function scheduleHover(next: boolean) {\n clearTimeout(hoverTimer.current);\n hoverTimer.current = setTimeout(() => setOpen(next), next ? openDelay : closeDelay);\n }\n\n // Opening from the keyboard without the trigger having to be a button that\n // happens to toggle on Enter: the arrow keys are what the menu-button pattern\n // asks for, and what a consumer reaches for first.\n function handleTriggerKeyDown(event: React.KeyboardEvent) {\n if (open || (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')) return;\n event.preventDefault();\n setOpen(true, true);\n }\n\n const triggerHandlers =\n trigger === PopoverTrigger.Click\n ? {\n onClick: (event: React.MouseEvent) => {\n // A field that opens a picker keeps it open when clicked again, so\n // that placing the caret in the field does not close the panel.\n if (open && !closeOnTriggerClick) return;\n setOpen(!open, event.detail === 0);\n },\n onKeyDown: handleTriggerKeyDown,\n }\n : trigger === PopoverTrigger.Hover\n ? { onMouseEnter: () => scheduleHover(true), onMouseLeave: () => scheduleHover(false) }\n : { onFocus: () => setOpen(true), onBlur: () => setOpen(false) };\n\n const floatingHoverHandlers =\n trigger === PopoverTrigger.Hover\n ? { onMouseEnter: () => scheduleHover(true), onMouseLeave: () => scheduleHover(false) }\n : {};\n\n return (\n <div\n {...rest}\n className={cx(styles.popover, className, classNames?.root)}\n style={{ ...style, ...slotStyles?.root }}\n >\n <div\n ref={triggerRef}\n className={cx(styles.popoverTrigger, classNames?.trigger)}\n style={slotStyles?.trigger}\n {...triggerHandlers}\n >\n {children}\n </div>\n {open && (\n <BodyEnd>\n {isSheet && (\n <SheetBackdrop\n onClose={() => {\n if (closeOnOutsideClick) setOpen(false);\n }}\n className={classNames?.backdrop}\n style={slotStyles?.backdrop}\n />\n )}\n <div\n ref={floatingRef}\n className={cx(isSheet ? sheetStyles.sheet : styles.popoverFloating, classNames?.floating)}\n style={{ ...(isSheet ? sheetStyle : undefined), ...slotStyles?.floating }}\n data-placement={placement}\n onKeyDown={handleFloatingKeyDown}\n onMouseUpCapture={markPanelInteraction}\n onFocusCapture={markPanelInteraction}\n {...floatingHoverHandlers}\n >\n <div\n ref={panelRef}\n className={cx(\n styles.popoverPanel,\n constrainWidth && styles.popoverPanelConstrained,\n isSheet && sheetStyles.sheetPanel,\n classNames?.panel,\n )}\n style={slotStyles?.panel}\n >\n {content}\n </div>\n {withArrow && !isSheet && (\n <div ref={arrowRef} className={cx(styles.popoverArrow, classNames?.arrow)} style={slotStyles?.arrow} />\n )}\n </div>\n </BodyEnd>\n )}\n </div>\n );\n}\n\nexport default Pop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W,EAAG,EAAU,EAAY,MAAQ,EAAO,gBAAiB,GAAY,QAAQ,EACxF,MAAO,CAAE,GAAI,EAAU,GAAa,IAAA,GAAY,GAAG,GAAY,QAAS,EACxE,iBAAgB,EAChB,UAAW,EACX,iBAAkB,EAClB,eAAgB,EAChB,GAAI,GARN,SAAA,CAUE,EAAC,MAAD,CACE,IAAK,EACL,UAAW,EACT,EAAO,aACP,IAAkB,EAAO,wBACzB,GAAW,EAAY,WACvB,GAAY,KACd,EACA,MAAO,GAAY,MAElB,SAAA,CACE,CAAA,EACJ,GAAa,CAAC,GACb,EAAC,MAAD,CAAK,IAAK,EAAU,UAAW,EAAG,EAAO,aAAc,GAAY,KAAK,EAAG,MAAO,GAAY,KAAQ,CAAA,CAErG,CACE,CAAA,CAAA,CAAA,CAAA,CAER,GAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.types.mjs","names":[],"sources":["../../../../package/common/popover/popover.types.ts"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\nimport type { Presentation } from '../configProvider/presentation.types';\n\n/** Preferred side of the trigger the panel opens on. Flips to the opposite side when there's no room. */\nexport enum PopoverPlacement {\n Top = 'top',\n Bottom = 'bottom',\n Left = 'left',\n Right = 'right',\n}\n\n/** Alignment along the trigger's cross axis (horizontal for top/bottom, vertical for left/right). */\nexport enum PopoverAlign {\n Start = 'start',\n Center = 'center',\n End = 'end',\n}\n\n/** What opens the popover. */\nexport enum PopoverTrigger {\n Click = 'click',\n Hover = 'hover',\n Focus = 'focus',\n}\n\nexport type PopoverSlots = 'root' | 'trigger' | 'floating' | 'panel' | 'arrow' | 'backdrop';\n\nexport interface PopoverProps extends Omit<HtmlProps, 'content'> {\n /** The trigger element. */\n children?: ReactNode;\n /** The popover body. */\n content?: ReactNode;\n /** Preferred side (default `Bottom`). */\n placement?: PopoverPlacement;\n /** Cross-axis alignment (default `Center`). */\n align?: PopoverAlign;\n /** What opens the popover (default `Click`). */\n trigger?: PopoverTrigger;\n /** Controlled open state. Omit for uncontrolled. */\n isOpen?: boolean;\n /** Initial open state when uncontrolled (default `false`). */\n defaultOpen?: boolean;\n /**\n * Fires whenever the popover wants to open or close. `fromKeyboard` says\n * whether a key caused it, which is what a menu needs in order to put the\n * focus on an entry only when the pointer was not what opened it.\n */\n onOpenChange?: (isOpen: boolean, meta: { fromKeyboard: boolean }) => void;\n /** Gap in px between trigger and panel (default `10`). */\n offset?: number;\n /** Render the arrow pointing at the trigger (default `true`). */\n withArrow?: boolean;\n /** Close when clicking outside the panel (default `true`). */\n closeOnOutsideClick?: boolean;\n /** Close when pressing Escape (default `true`). */\n closeOnEscape?: boolean;\n /** Delay in ms before a hover-triggered popover opens (default `100`). */\n openDelay?: number;\n /** Delay in ms before a hover-triggered popover closes (default `120`). */\n closeDelay?: number;\n /** Prevent the popover from opening. */\n disabled?: boolean;\n /**\n * Move focus into the panel when it opens, and claim `role=\"dialog\"` with it.\n * `'keyboard'` (the default) does it only when the open came from the\n * keyboard: the panel is portaled to the end of the document, so Tab never\n * reaches it on its own, while a click leaves the focus where the pointer\n * already put it. `true` always, `false` never.\n */\n focusOnOpen?: boolean | 'keyboard';\n /**\n * Whether clicking the trigger while the panel is open closes it (default\n * `true`). A menu button should toggle; a text field that opens a picker\n * should not, or clicking into it to place the caret would close the panel.\n */\n closeOnTriggerClick?: boolean;\n /**\n * `'trigger'` gives the panel at least the trigger's width, for a list that\n * should line up with the field it belongs to. `'auto'` (the default) lets it\n * size to its own content.\n */\n width?: 'auto' | 'trigger';\n /**\n * Cap the panel at a readable measure (default `true`). Off for a panel with\n * its own width, a calendar or a media grid.\n */\n constrainWidth?: boolean;\n /** Where the panel opens: anchored to the trigger (`Default`), pinned to the bottom of the\n * screen, or the latter only on a small touch screen. Only a `Click` trigger presents as a\n * sheet. */\n presentation?: Presentation;\n\n className?: string;\n style?: CSSProperties;\n classNames?: SlotClassNames<PopoverSlots>;\n styles?: SlotStyles<PopoverSlots>;\n}\n"],"mappings":"aAKA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,IAAA,MACA,EAAA,OAAA,SACA,EAAA,KAAA,OACA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA,EAGY,EAAL,SAAA,EAAA,OACL,GAAA,MAAA,QACA,EAAA,OAAA,SACA,EAAA,IAAA,OACF,EAAA,CAAA,CAAA,EAGY,EAAL,SAAA,EAAA,OACL,GAAA,MAAA,QACA,EAAA,MAAA,QACA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"popover.types.mjs","names":[],"sources":["../../../../package/common/popover/popover.types.ts"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\nimport type { Presentation } from '../configProvider/presentation.types';\n\n/** Preferred side of the trigger the panel opens on. Flips to the opposite side when there's no room. */\nexport enum PopoverPlacement {\n Top = 'top',\n Bottom = 'bottom',\n Left = 'left',\n Right = 'right',\n}\n\n/** Alignment along the trigger's cross axis (horizontal for top/bottom, vertical for left/right). */\nexport enum PopoverAlign {\n Start = 'start',\n Center = 'center',\n End = 'end',\n}\n\n/** What opens the popover. */\nexport enum PopoverTrigger {\n Click = 'click',\n Hover = 'hover',\n Focus = 'focus',\n}\n\nexport type PopoverSlots = 'root' | 'trigger' | 'floating' | 'panel' | 'arrow' | 'backdrop';\n\nexport interface PopoverProps extends Omit<HtmlProps, 'content'> {\n /** The trigger element. */\n children?: ReactNode;\n /**\n * Place the panel against this element instead of `children`, for one Popover does not wrap.\n * Open it with `isOpen`; `null` falls back to `children`.\n */\n anchor?: HTMLElement | null;\n /** The popover body. */\n content?: ReactNode;\n /** Preferred side (default `Bottom`). */\n placement?: PopoverPlacement;\n /** Cross-axis alignment (default `Center`). */\n align?: PopoverAlign;\n /** What opens the popover (default `Click`). */\n trigger?: PopoverTrigger;\n /** Controlled open state. Omit for uncontrolled. */\n isOpen?: boolean;\n /** Initial open state when uncontrolled (default `false`). */\n defaultOpen?: boolean;\n /**\n * Fires whenever the popover wants to open or close. `fromKeyboard` says\n * whether a key caused it, which is what a menu needs in order to put the\n * focus on an entry only when the pointer was not what opened it.\n */\n onOpenChange?: (isOpen: boolean, meta: { fromKeyboard: boolean }) => void;\n /** Gap in px between trigger and panel (default `10`). */\n offset?: number;\n /** Render the arrow pointing at the trigger (default `true`). */\n withArrow?: boolean;\n /** Close when clicking outside the panel (default `true`). */\n closeOnOutsideClick?: boolean;\n /** Close when pressing Escape (default `true`). */\n closeOnEscape?: boolean;\n /** Delay in ms before a hover-triggered popover opens (default `100`). */\n openDelay?: number;\n /** Delay in ms before a hover-triggered popover closes (default `120`). */\n closeDelay?: number;\n /** Prevent the popover from opening. */\n disabled?: boolean;\n /**\n * Move focus into the panel when it opens, and claim `role=\"dialog\"` with it.\n * `'keyboard'` (the default) does it only when the open came from the\n * keyboard: the panel is portaled to the end of the document, so Tab never\n * reaches it on its own, while a click leaves the focus where the pointer\n * already put it. `true` always, `false` never.\n */\n focusOnOpen?: boolean | 'keyboard';\n /**\n * Whether clicking the trigger while the panel is open closes it (default\n * `true`). A menu button should toggle; a text field that opens a picker\n * should not, or clicking into it to place the caret would close the panel.\n */\n closeOnTriggerClick?: boolean;\n /**\n * `'trigger'` gives the panel at least the trigger's width, for a list that\n * should line up with the field it belongs to. `'auto'` (the default) lets it\n * size to its own content.\n */\n width?: 'auto' | 'trigger';\n /**\n * Cap the panel at a readable measure (default `true`). Off for a panel with\n * its own width, a calendar or a media grid.\n */\n constrainWidth?: boolean;\n /** Where the panel opens: anchored to the trigger (`Default`), pinned to the bottom of the\n * screen, or the latter only on a small touch screen. Only a `Click` trigger presents as a\n * sheet. */\n presentation?: Presentation;\n\n className?: string;\n style?: CSSProperties;\n classNames?: SlotClassNames<PopoverSlots>;\n styles?: SlotStyles<PopoverSlots>;\n}\n"],"mappings":"aAKA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,IAAA,MACA,EAAA,OAAA,SACA,EAAA,KAAA,OACA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA,EAGY,EAAL,SAAA,EAAA,OACL,GAAA,MAAA,QACA,EAAA,OAAA,SACA,EAAA,IAAA,OACF,EAAA,CAAA,CAAA,EAGY,EAAL,SAAA,EAAA,OACL,GAAA,MAAA,QACA,EAAA,MAAA,QACA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";var e=/^(\d{4})-(\d{2})-(\d{2})$/;function t({year:e,month:t}){let n=new Date(0);return n.setUTCFullYear(e,t,0),n.getUTCDate()}function n(n){if(typeof n!=`string`)return null;let r=e.exec(n);if(!r)return null;let i=Number(r[1]),a=Number(r[2]),o=Number(r[3]);return a<1||a>12||o<1||o>t({year:i,month:a})?null:{year:i,month:a,day:o}}function r(e){return n(e)?e:null}function i({year:e,month:t,day:n}){return`${String(e).padStart(4,`0`)}-${String(t).padStart(2,`0`)}-${String(n).padStart(2,`0`)}`}function a(e){return Number.isNaN(e.getTime())?``:i({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()})}function o(e){let t=n(e);if(!t)return new Date(NaN);let r=new Date(2e3,0,1);return r.setFullYear(t.year,t.month-1,t.day),r}export{r as asDay,a as dateToDay,o as dayToDate,t as daysInMonth,i as formatDay,n as parseDay};
|
|
2
|
+
//# sourceMappingURL=day.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"day.mjs","names":[],"sources":["../../../../package/common/utils/day.ts"],"sourcesContent":["// A day is a `'YYYY-MM-DD'` string, the value of `<input type=\"date\">`: no time and no time zone,\n// so it is the same day for everyone. A `Date` is a moment and cannot be one.\n//\n// Dates are built with `setFullYear` rather than the `Date` constructor or `Date.UTC`, which read\n// the years 0 to 99 as 1900 to 1999.\n\nexport interface DayParts {\n year: number;\n /** 1 to 12. */\n month: number;\n day: number;\n}\n\nconst DAY = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\nexport function daysInMonth({ year, month }: Pick<DayParts, 'year' | 'month'>): number {\n const date = new Date(0);\n date.setUTCFullYear(year, month, 0);\n return date.getUTCDate();\n}\n\n/** The parts of a `'YYYY-MM-DD'` string, or `null` for anything else, 31 February included. */\nexport function parseDay(value: unknown): DayParts | null {\n if (typeof value !== 'string') return null;\n const match = DAY.exec(value);\n if (!match) return null;\n const year = Number(match[1]);\n const month = Number(match[2]);\n const day = Number(match[3]);\n if (month < 1 || month > 12 || day < 1 || day > daysInMonth({ year, month })) return null;\n return { year, month, day };\n}\n\n/** `value` itself when it is a `'YYYY-MM-DD'` day that exists, otherwise `null`. */\nexport function asDay(value: unknown): string | null {\n return parseDay(value) ? (value as string) : null;\n}\n\nexport function formatDay({ year, month, day }: DayParts): string {\n return `${String(year).padStart(4, '0')}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;\n}\n\n/** The day `date` falls on in the browser's time zone, as `'YYYY-MM-DD'`; `''` for an Invalid Date. */\nexport function dateToDay(date: Date): string {\n if (Number.isNaN(date.getTime())) return '';\n return formatDay({ year: date.getFullYear(), month: date.getMonth() + 1, day: date.getDate() });\n}\n\n/** The first moment of a `'YYYY-MM-DD'` day in the browser's time zone. An Invalid Date for anything else. */\nexport function dayToDate(day: string): Date {\n const parts = parseDay(day);\n if (!parts) return new Date(NaN);\n const date = new Date(2000, 0, 1);\n date.setFullYear(parts.year, parts.month - 1, parts.day);\n return date;\n}\n"],"mappings":"aAaA,IAAM,EAAM,4BAEZ,SAAgB,EAAY,CAAE,OAAM,SAAmD,CACrF,IAAM,EAAO,IAAI,KAAK,CAAC,EAEvB,OADA,EAAK,eAAe,EAAM,EAAO,CAAC,EAC3B,EAAK,WAAW,CACzB,CAGA,SAAgB,EAAS,EAAiC,CACxD,GAAI,OAAO,GAAU,SAAU,OAAO,KACtC,IAAM,EAAQ,EAAI,KAAK,CAAK,EAC5B,GAAI,CAAC,EAAO,OAAO,KACnB,IAAM,EAAO,OAAO,EAAM,EAAE,EACtB,EAAQ,OAAO,EAAM,EAAE,EACvB,EAAM,OAAO,EAAM,EAAE,EAE3B,OADI,EAAQ,GAAK,EAAQ,IAAM,EAAM,GAAK,EAAM,EAAY,CAAE,OAAM,OAAM,CAAC,EAAU,KAC9E,CAAE,OAAM,QAAO,KAAI,CAC5B,CAGA,SAAgB,EAAM,EAA+B,CACnD,OAAO,EAAS,CAAK,EAAK,EAAmB,IAC/C,CAEA,SAAgB,EAAU,CAAE,OAAM,QAAO,OAAyB,CAChE,MAAO,GAAG,OAAO,CAAI,CAAC,CAAC,SAAS,EAAG,GAAG,EAAE,GAAG,OAAO,CAAK,CAAC,CAAC,SAAS,EAAG,GAAG,EAAE,GAAG,OAAO,CAAG,CAAC,CAAC,SAAS,EAAG,GAAG,GAC1G,CAGA,SAAgB,EAAU,EAAoB,CAE5C,OADI,OAAO,MAAM,EAAK,QAAQ,CAAC,EAAU,GAClC,EAAU,CAAE,KAAM,EAAK,YAAY,EAAG,MAAO,EAAK,SAAS,EAAI,EAAG,IAAK,EAAK,QAAQ,CAAE,CAAC,CAChG,CAGA,SAAgB,EAAU,EAAmB,CAC3C,IAAM,EAAQ,EAAS,CAAG,EAC1B,GAAI,CAAC,EAAO,OAAO,IAAI,KAAK,GAAG,EAC/B,IAAM,EAAO,IAAI,KAAK,IAAM,EAAG,CAAC,EAEhC,OADA,EAAK,YAAY,EAAM,KAAM,EAAM,MAAQ,EAAG,EAAM,GAAG,EAChD,CACT"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{AccordionStyleType as e}from"./common/accordion/accordion.types.mjs";import t from"./common/configProvider/configProvider.mjs";import{useComponentDefaults as n}from"./common/configProvider/useComponentDefaults.mjs";import{useLabels as r}from"./common/configProvider/useLabels.mjs";import{usePresentationDefault as i}from"./common/configProvider/usePresentationDefault.mjs";import{Presentation as a}from"./common/configProvider/presentation.types.mjs";import o from"./common/accordion/accordion.mjs";import s from"./common/loading/spinnerLoading/index.mjs";import{ButtonSize as c,ButtonStyleType as l,ButtonType as u}from"./common/button/button.types.mjs";import d from"./common/ripple/ripple.mjs";import f from"./common/button/button.mjs";import p from"./common/actionButtons/actionButtons.mjs";import m from"./common/interactableDiv/index.mjs";import h from"./common/actionIcon/actionIcon.mjs";import{AlertStyleType as g}from"./common/alert/alert.types.mjs";import _ from"./common/alert/alert.mjs";import v from"./common/animatedLogo/animatedLogo.mjs";import{AnimatedTextUnit as y,AnimatedTextVariant as b}from"./common/animatedText/animatedText.types.mjs";import x from"./common/animatedText/animatedText.mjs";import{BadgePosition as S,BadgeStyleType as C}from"./common/badge/badge.types.mjs";import w from"./common/badge/badge.mjs";import T from"./common/avatar/avatar.mjs";import E from"./common/avatar/avatarGroup.mjs";import D from"./common/bodyEnd/bodyEnd.mjs";import{PopoverAlign as O,PopoverPlacement as k,PopoverTrigger as A}from"./common/popover/popover.types.mjs";import{tabbablesIn as j}from"./common/hooks/useFocusBoundary.mjs";import M from"./common/hooks/useMediaQuery.mjs";import N from"./common/hooks/useCoarsePointer.mjs";import{useVisualViewportSize as P}from"./common/hooks/useVisualViewportSize.mjs";import{useOverlay as F}from"./common/hooks/useOverlay.mjs";import I from"./common/popover/popover.mjs";import L from"./common/breadcrumb/breadcrumb.mjs";import{ButtonGroupOrientation as R}from"./common/buttonGroup/buttonGroup.types.mjs";import z from"./common/buttonGroup/buttonGroup.mjs";import{CardStyleType as B}from"./common/card/card.types.mjs";import V from"./common/card/Card.mjs";import H from"./common/card/CardHeader.mjs";import U from"./common/card/CardMedia.mjs";import W from"./common/card/CardContent.mjs";import G from"./common/card/CardActions.mjs";import K from"./common/carousel/carousel.mjs";import q from"./common/checkbox/checkbox.mjs";import{ChipStyleType as J}from"./common/chip/chip.types.mjs";import Y from"./common/chip/chip.mjs";import X from"./common/chip/chipContainer.mjs";import Z from"./common/tooltip/tooltip.mjs";import{InputIconPosition as Q,InputType as $}from"./common/input/input.types.mjs";import ee from"./common/input/input.mjs";import te from"./common/colorPicker/colorPicker.mjs";import{useScrollEdges as ne}from"./common/hooks/useScrollEdges.mjs";import re from"./common/modal/modal.mjs";import ie,{formatHotkey as ae}from"./common/hooks/useHotkeys.mjs";import{isMenuAction as oe,isMenuHeading as se,isMenuSeparator as ce}from"./common/menu/menu.types.mjs";import le from"./common/commandPalette/commandPalette.mjs";import ue from"./common/confirmModal/confirmModal.mjs";import de from"./common/hooks/useClipboard.mjs";import fe from"./common/copyButton/copyButton.mjs";import{getLocale as pe,mapLocale as me,setLocale as he}from"./services/localization.mjs";import ge from"./common/dropdown/dropdown.mjs";import _e from"./common/datePicker/datePicker.mjs";import{DividerOrientation as ve,DividerTextPosition as ye}from"./common/divider/divider.types.mjs";import be from"./common/divider/divider.mjs";import xe from"./common/drawer/drawer.mjs";import{DropZoneReturnType as Se,DropZoneStatus as Ce}from"./common/dropZone/dropZone.types.mjs";import we from"./common/dropZone/dropZone.mjs";import Te from"./common/emptyState/emptyState.mjs";import{useSwipeDismiss as Ee}from"./common/hooks/useSwipeDismiss.mjs";import{showToast as De}from"./common/toast/toastService.mjs";import Oe from"./common/toast/toastProvider.mjs";import ke from"./common/errorBoundary/errorBoundary.mjs";import Ae from"./common/fab/fab.mjs";import je from"./common/flip/flip.mjs";import{DoorSwing as Me,OpeningKind as Ne,PlanIssueKind as Pe,PlanUnitSystem as Fe,WallType as Ie}from"./common/floorPlan/floorPlan.types.mjs";import{MIN_OPENING_WIDTH as Le,MIN_WALL_LENGTH as Re}from"./common/floorPlan/floorPlan.geometry.mjs";import{DEFAULT_WALL_ATTRS as ze,addOpening as Be,addRect as Ve,addWall as He,cleanupPlan as Ue,detachWall as We,dissolveNode as Ge,mergeNodes as Ke,moveNode as qe,removeOpening as Je,removeWall as Ye,scalePlan as Xe,splitWall as Ze,transformPlan as Qe,updateOpening as $e,validatePlan as et,wallLength as tt,weldShortWalls as nt}from"./common/floorPlan/floorPlan.graph.mjs";import{MIN_FLOOR_HEIGHT as rt,addFloor as it,duplicateFloor as at,emptyFloor as ot,emptyFloorPlan as st,floorBelow as ct,floorBounds as lt,floorIndex as ut,getFloor as dt,moveFloor as ft,removeFloor as pt,renameFloor as mt,setFloor as ht,setFloorHeight as gt,updateFloor as _t}from"./common/floorPlan/floorPlan.plan.mjs";import{deriveFaces as vt,nodeDegrees as yt}from"./common/floorPlan/floorPlan.faces.mjs";import{commitDerivation as bt,derivePlan as xt,pruneUnmatchedRooms as St,roomAtPoint as Ct}from"./common/floorPlan/floorPlan.rooms.mjs";import{buildWallPaths as wt,openingGeometry as Tt,wallCentrelineSpans as Et}from"./common/floorPlan/floorPlan.path.mjs";import{HIT_PX as Dt,HIT_PX_COARSE as Ot,hitTest as kt,selectionsEqual as At,worldTolerances as jt}from"./common/floorPlan/floorPlan.hit.mjs";import{DEFAULT_SNAP_OPTIONS as Mt,SnapKind as Nt,clientToWorld as Pt,resolveSnap as Ft,screenScale as It}from"./common/floorPlan/floorPlan.snap.mjs";import{PLAN_FORMAT_VERSION as Lt,planFromJson as Rt,planToJson as zt}from"./common/floorPlan/floorPlan.json.mjs";import{buildPlanMesh as Bt}from"./common/floorPlan/floorPlan.mesh.mjs";import{planFromLegacySvg as Vt}from"./common/floorPlan/legacySvg.mjs";import Ht from"./common/iconPicker/iconPicker.mjs";import Ut from"./common/idleManager/idleManager.mjs";import Wt from"./common/inputDropdown/inputDropdown.mjs";import Gt from"./common/kanbanBoard/KanbanColumn.mjs";import Kt from"./common/kanbanBoard/KanbanBoard.mjs";import qt from"./common/searchInput/searchInput.mjs";import Jt from"./common/klipyPicker/klipyPicker.mjs";import Yt from"./common/menu/menu.mjs";import{menuHotkeys as Xt}from"./common/menu/menuHotkeys.mjs";import Zt from"./common/multiSelect/multiSelect.mjs";import Qt from"./common/numberInput/index.mjs";import $t from"./common/optionPicker/optionPicker.mjs";import{OtpInputCharset as en}from"./common/otpInput/otpInput.types.mjs";import tn from"./common/otpInput/otpInput.mjs";import nn from"./common/overscroll/overscroll.mjs";import rn from"./common/pagination/pagination.mjs";import an from"./common/progressBar/progressBar.mjs";import{RadioGroupOrientation as on}from"./common/radioGroup/radioGroup.types.mjs";import sn from"./common/radioGroup/radioGroup.mjs";import cn from"./common/rating/rating.mjs";import ln from"./common/revealLens/revealLens.mjs";import un from"./common/roomDrawer/roomDrawer.mjs";import dn from"./common/roomViewer/roomViewer.mjs";import{ScrollFadeAxis as fn}from"./common/scrollFade/scrollFade.types.mjs";import pn from"./common/scrollFade/scrollFade.mjs";import mn from"./common/scrollbarProvider/index.mjs";import{SectionHeaderSize as hn}from"./common/sectionHeader/sectionHeader.types.mjs";import gn from"./common/sectionHeader/sectionHeader.mjs";import{SkeletonAnimation as _n,SkeletonVariant as vn}from"./common/skeleton/skeleton.types.mjs";import yn from"./common/skeleton/skeleton.mjs";import bn from"./common/slider/slider.mjs";import xn from"./common/splitButton/splitButton.mjs";import{StepperAlignment as Sn,StepperCollapse as Cn,StepperLabelPlacement as wn,StepperStyleType as Tn}from"./common/stepper/stepper.types.mjs";import En from"./common/stepper/stepper.mjs";import Dn from"./common/sticky/sticky.mjs";import On from"./common/switch/switch.mjs";import kn from"./common/tabHeader/tabHeader.mjs";import An from"./common/textarea/textarea.mjs";import{defaultTheme as jn}from"./common/themeProvider/defaultTheme.mjs";import Mn from"./common/themeProvider/themeProvider.mjs";import{lightTheme as Nn}from"./common/themeProvider/lightTheme.mjs";import{useTheme as Pn}from"./common/themeProvider/useTheme.mjs";import Fn,{TiltGroupContext as In,useTiltGroup as Ln}from"./common/tiltGroup/tiltGroup.mjs";import{defaultTiltEasing as Rn}from"./common/tilt/tiltMath.mjs";import zn from"./common/tilt/tilt.mjs";import Bn from"./common/timeInput/timeInput.mjs";import{TimelineAlignment as Vn,TimelineItemStatus as Hn}from"./common/timeline/timeline.types.mjs";import Un from"./common/timeline/timeline.mjs";import Wn from"./common/timer/timer.mjs";import Gn from"./common/virtualList/virtualList.mjs";import{flattenTree as Kn}from"./common/tree/flattenTree.mjs";import qn from"./common/tree/tree.mjs";import{WeatherType as Jn}from"./common/weatherIcon/weatherIcon.types.mjs";import Yn from"./common/weatherIcon/weatherIcon.mjs";import Xn from"./common/wizard/wizard.mjs";import Zn from"./services/formValidation/FormValidatorGroupWithForm.mjs";import Qn from"./services/formValidation/validatableComponent.mjs";import{useFormValidatorGroup as $n}from"./services/formValidation/useFormValidatorGroup.mjs";import{FormValidator as er,Validators as tr,useFormValidator as nr}from"./services/formValidation/index.mjs";import{hasEightPasswordChars as rr,hasOnePasswordDigit as ir,hasOnePasswordLetter as ar,isBic as or,isDate as sr,isEmail as cr,isISODate as lr,isNumber as ur,isPassword as dr,isURL as fr}from"@ahrowe/form-validation";export{o as Accordion,e as AccordionStyleType,p as ActionButtons,h as ActionIcon,_ as Alert,g as AlertStyleType,v as AnimatedLogo,x as AnimatedText,y as AnimatedTextUnit,b as AnimatedTextVariant,T as Avatar,E as AvatarGroup,w as Badge,S as BadgePosition,C as BadgeStyleType,D as BodyEnd,L as Breadcrumb,f as Button,z as ButtonGroup,R as ButtonGroupOrientation,c as ButtonSize,l as ButtonStyleType,u as ButtonType,V as Card,G as CardActions,W as CardContent,H as CardHeader,U as CardMedia,B as CardStyleType,K as Carousel,q as Checkbox,Y as Chip,X as ChipContainer,J as ChipStyleType,te as ColorPicker,le as CommandPalette,t as ConfigProvider,ue as ConfirmModal,fe as CopyButton,Mt as DEFAULT_SNAP_OPTIONS,ze as DEFAULT_WALL_ATTRS,_e as DatePicker,be as Divider,ve as DividerOrientation,ye as DividerTextPosition,Me as DoorSwing,xe as Drawer,we as DropZone,Se as DropZoneReturnType,Ce as DropZoneStatus,ge as Dropdown,Te as EmptyState,ke as ErrorBoundary,Ae as Fab,je as Flip,er as FormValidator,Zn as FormValidatorGroup,Dt as HIT_PX,Ot as HIT_PX_COARSE,Ht as IconPicker,Ut as IdleManager,ee as Input,Wt as InputDropdown,Q as InputIconPosition,$ as InputType,m as InteractableDiv,Kt as KanbanBoard,Gt as KanbanColumn,Jt as KlipyPicker,rt as MIN_FLOOR_HEIGHT,Le as MIN_OPENING_WIDTH,Re as MIN_WALL_LENGTH,Yt as Menu,re as Modal,Zt as MultiSelect,Qt as NumberInput,Ne as OpeningKind,$t as OptionPicker,tn as OtpInput,en as OtpInputCharset,nn as Overscroll,Lt as PLAN_FORMAT_VERSION,rn as Pagination,Pe as PlanIssueKind,Fe as PlanUnitSystem,I as Popover,O as PopoverAlign,k as PopoverPlacement,A as PopoverTrigger,a as Presentation,an as ProgressBar,sn as RadioGroup,on as RadioGroupOrientation,cn as Rating,ln as RevealLens,d as Ripple,un as RoomDrawer,dn as RoomViewer,pn as ScrollFade,fn as ScrollFadeAxis,mn as ScrollbarProvider,qt as SearchInput,gn as SectionHeader,hn as SectionHeaderSize,yn as Skeleton,_n as SkeletonAnimation,vn as SkeletonVariant,bn as Slider,Nt as SnapKind,s as SpinnerLoading,xn as SplitButton,En as Stepper,Sn as StepperAlignment,Cn as StepperCollapse,wn as StepperLabelPlacement,Tn as StepperStyleType,Dn as Sticky,On as Switch,kn as TabHeader,An as Textarea,Mn as ThemeProvider,zn as Tilt,Fn as TiltGroup,In as TiltGroupContext,Bn as TimeInput,Un as Timeline,Vn as TimelineAlignment,Hn as TimelineItemStatus,Wn as Timer,Oe as ToastProvider,Z as Tooltip,qn as Tree,Qn as ValidatableComponent,tr as Validators,Gn as VirtualList,Ie as WallType,Yn as WeatherIcon,Jn as WeatherType,Xn as Wizard,it as addFloor,Be as addOpening,Ve as addRect,He as addWall,Bt as buildPlanMesh,wt as buildWallPaths,Ue as cleanupPlan,Pt as clientToWorld,bt as commitDerivation,jn as defaultTheme,Rn as defaultTiltEasing,vt as deriveFaces,xt as derivePlan,We as detachWall,Ge as dissolveNode,at as duplicateFloor,ot as emptyFloor,st as emptyFloorPlan,Kn as flattenTree,ct as floorBelow,lt as floorBounds,ut as floorIndex,ae as formatHotkey,dt as getFloor,pe as getLocale,rr as hasEightPasswordChars,ir as hasOnePasswordDigit,ar as hasOnePasswordLetter,kt as hitTest,or as isBic,sr as isDate,cr as isEmail,lr as isISODate,oe as isMenuAction,se as isMenuHeading,ce as isMenuSeparator,ur as isNumber,dr as isPassword,fr as isURL,Nn as lightTheme,me as mapLocale,Xt as menuHotkeys,Ke as mergeNodes,ft as moveFloor,qe as moveNode,yt as nodeDegrees,Tt as openingGeometry,Rt as planFromJson,Vt as planFromLegacySvg,zt as planToJson,St as pruneUnmatchedRooms,pt as removeFloor,Je as removeOpening,Ye as removeWall,mt as renameFloor,Ft as resolveSnap,Ct as roomAtPoint,Xe as scalePlan,It as screenScale,At as selectionsEqual,ht as setFloor,gt as setFloorHeight,he as setLocale,De as showToast,Ze as splitWall,j as tabbablesIn,Qe as transformPlan,_t as updateFloor,$e as updateOpening,de as useClipboard,N as useCoarsePointer,n as useComponentDefaults,nr as useFormValidator,$n as useFormValidatorGroup,ie as useHotkeys,r as useLabels,M as useMediaQuery,F as useOverlay,i as usePresentationDefault,ne as useScrollEdges,Ee as useSwipeDismiss,Pn as useTheme,Ln as useTiltGroup,P as useVisualViewportSize,et as validatePlan,Et as wallCentrelineSpans,tt as wallLength,nt as weldShortWalls,jt as worldTolerances};
|
|
1
|
+
"use client";import{AccordionStyleType as e}from"./common/accordion/accordion.types.mjs";import t from"./common/configProvider/configProvider.mjs";import{useComponentDefaults as n}from"./common/configProvider/useComponentDefaults.mjs";import{useLabels as r}from"./common/configProvider/useLabels.mjs";import{usePresentationDefault as i}from"./common/configProvider/usePresentationDefault.mjs";import{Presentation as a}from"./common/configProvider/presentation.types.mjs";import o from"./common/accordion/accordion.mjs";import s from"./common/loading/spinnerLoading/index.mjs";import{ButtonSize as c,ButtonStyleType as l,ButtonType as u}from"./common/button/button.types.mjs";import d from"./common/ripple/ripple.mjs";import f from"./common/button/button.mjs";import p from"./common/actionButtons/actionButtons.mjs";import m from"./common/interactableDiv/index.mjs";import h from"./common/actionIcon/actionIcon.mjs";import{AlertStyleType as g}from"./common/alert/alert.types.mjs";import _ from"./common/alert/alert.mjs";import v from"./common/animatedLogo/animatedLogo.mjs";import{AnimatedTextUnit as y,AnimatedTextVariant as b}from"./common/animatedText/animatedText.types.mjs";import x from"./common/animatedText/animatedText.mjs";import{BadgePosition as S,BadgeStyleType as C}from"./common/badge/badge.types.mjs";import w from"./common/badge/badge.mjs";import T from"./common/avatar/avatar.mjs";import E from"./common/avatar/avatarGroup.mjs";import D from"./common/bodyEnd/bodyEnd.mjs";import{PopoverAlign as O,PopoverPlacement as k,PopoverTrigger as A}from"./common/popover/popover.types.mjs";import{tabbablesIn as j}from"./common/hooks/useFocusBoundary.mjs";import M from"./common/hooks/useMediaQuery.mjs";import N from"./common/hooks/useCoarsePointer.mjs";import{useVisualViewportSize as P}from"./common/hooks/useVisualViewportSize.mjs";import{useOverlay as F}from"./common/hooks/useOverlay.mjs";import I from"./common/popover/popover.mjs";import L from"./common/breadcrumb/breadcrumb.mjs";import{ButtonGroupOrientation as R}from"./common/buttonGroup/buttonGroup.types.mjs";import z from"./common/buttonGroup/buttonGroup.mjs";import{CardStyleType as B}from"./common/card/card.types.mjs";import V from"./common/card/Card.mjs";import H from"./common/card/CardHeader.mjs";import U from"./common/card/CardMedia.mjs";import W from"./common/card/CardContent.mjs";import G from"./common/card/CardActions.mjs";import K from"./common/carousel/carousel.mjs";import q from"./common/checkbox/checkbox.mjs";import{ChipStyleType as J}from"./common/chip/chip.types.mjs";import Y from"./common/chip/chip.mjs";import X from"./common/chip/chipContainer.mjs";import Z from"./common/tooltip/tooltip.mjs";import{InputIconPosition as Q,InputType as $}from"./common/input/input.types.mjs";import ee from"./common/input/input.mjs";import te from"./common/colorPicker/colorPicker.mjs";import{useScrollEdges as ne}from"./common/hooks/useScrollEdges.mjs";import re from"./common/modal/modal.mjs";import ie,{formatHotkey as ae}from"./common/hooks/useHotkeys.mjs";import{isMenuAction as oe,isMenuHeading as se,isMenuSeparator as ce}from"./common/menu/menu.types.mjs";import le from"./common/commandPalette/commandPalette.mjs";import ue from"./common/confirmModal/confirmModal.mjs";import de from"./common/hooks/useClipboard.mjs";import fe from"./common/copyButton/copyButton.mjs";import{getLocale as pe,mapLocale as me,setLocale as he}from"./services/localization.mjs";import{dateToDay as ge,dayToDate as _e}from"./common/utils/day.mjs";import ve from"./common/dropdown/dropdown.mjs";import ye from"./common/datePicker/datePicker.mjs";import{DividerOrientation as be,DividerTextPosition as xe}from"./common/divider/divider.types.mjs";import Se from"./common/divider/divider.mjs";import Ce from"./common/drawer/drawer.mjs";import{DropZoneReturnType as we,DropZoneStatus as Te}from"./common/dropZone/dropZone.types.mjs";import Ee from"./common/dropZone/dropZone.mjs";import De from"./common/emptyState/emptyState.mjs";import{useSwipeDismiss as Oe}from"./common/hooks/useSwipeDismiss.mjs";import{showToast as ke}from"./common/toast/toastService.mjs";import Ae from"./common/toast/toastProvider.mjs";import je from"./common/errorBoundary/errorBoundary.mjs";import Me from"./common/fab/fab.mjs";import Ne from"./common/flip/flip.mjs";import{DoorSwing as Pe,OpeningKind as Fe,PlanIssueKind as Ie,PlanUnitSystem as Le,WallType as Re}from"./common/floorPlan/floorPlan.types.mjs";import{MIN_OPENING_WIDTH as ze,MIN_WALL_LENGTH as Be}from"./common/floorPlan/floorPlan.geometry.mjs";import{DEFAULT_WALL_ATTRS as Ve,addOpening as He,addRect as Ue,addWall as We,cleanupPlan as Ge,detachWall as Ke,dissolveNode as qe,mergeNodes as Je,moveNode as Ye,removeOpening as Xe,removeWall as Ze,scalePlan as Qe,splitWall as $e,transformPlan as et,updateOpening as tt,validatePlan as nt,wallLength as rt,weldShortWalls as it}from"./common/floorPlan/floorPlan.graph.mjs";import{MIN_FLOOR_HEIGHT as at,addFloor as ot,duplicateFloor as st,emptyFloor as ct,emptyFloorPlan as lt,floorBelow as ut,floorBounds as dt,floorIndex as ft,getFloor as pt,moveFloor as mt,removeFloor as ht,renameFloor as gt,setFloor as _t,setFloorHeight as vt,updateFloor as yt}from"./common/floorPlan/floorPlan.plan.mjs";import{deriveFaces as bt,nodeDegrees as xt}from"./common/floorPlan/floorPlan.faces.mjs";import{commitDerivation as St,derivePlan as Ct,pruneUnmatchedRooms as wt,roomAtPoint as Tt}from"./common/floorPlan/floorPlan.rooms.mjs";import{buildWallPaths as Et,openingGeometry as Dt,wallCentrelineSpans as Ot}from"./common/floorPlan/floorPlan.path.mjs";import{HIT_PX as kt,HIT_PX_COARSE as At,hitTest as jt,selectionsEqual as Mt,worldTolerances as Nt}from"./common/floorPlan/floorPlan.hit.mjs";import{DEFAULT_SNAP_OPTIONS as Pt,SnapKind as Ft,clientToWorld as It,resolveSnap as Lt,screenScale as Rt}from"./common/floorPlan/floorPlan.snap.mjs";import{PLAN_FORMAT_VERSION as zt,planFromJson as Bt,planToJson as Vt}from"./common/floorPlan/floorPlan.json.mjs";import{buildPlanMesh as Ht}from"./common/floorPlan/floorPlan.mesh.mjs";import{planFromLegacySvg as Ut}from"./common/floorPlan/legacySvg.mjs";import Wt from"./common/iconPicker/iconPicker.mjs";import Gt from"./common/idleManager/idleManager.mjs";import Kt from"./common/inputDropdown/inputDropdown.mjs";import qt from"./common/kanbanBoard/KanbanColumn.mjs";import Jt from"./common/kanbanBoard/KanbanBoard.mjs";import Yt from"./common/searchInput/searchInput.mjs";import Xt from"./common/klipyPicker/klipyPicker.mjs";import Zt from"./common/menu/menu.mjs";import{menuHotkeys as Qt}from"./common/menu/menuHotkeys.mjs";import $t from"./common/multiSelect/multiSelect.mjs";import en from"./common/numberInput/index.mjs";import tn from"./common/optionPicker/optionPicker.mjs";import{OtpInputCharset as nn}from"./common/otpInput/otpInput.types.mjs";import rn from"./common/otpInput/otpInput.mjs";import an from"./common/overscroll/overscroll.mjs";import on from"./common/pagination/pagination.mjs";import sn from"./common/progressBar/progressBar.mjs";import{RadioGroupOrientation as cn}from"./common/radioGroup/radioGroup.types.mjs";import ln from"./common/radioGroup/radioGroup.mjs";import un from"./common/rating/rating.mjs";import dn from"./common/revealLens/revealLens.mjs";import fn from"./common/roomDrawer/roomDrawer.mjs";import pn from"./common/roomViewer/roomViewer.mjs";import{ScrollFadeAxis as mn}from"./common/scrollFade/scrollFade.types.mjs";import hn from"./common/scrollFade/scrollFade.mjs";import gn from"./common/scrollbarProvider/index.mjs";import{SectionHeaderSize as _n}from"./common/sectionHeader/sectionHeader.types.mjs";import vn from"./common/sectionHeader/sectionHeader.mjs";import{SkeletonAnimation as yn,SkeletonVariant as bn}from"./common/skeleton/skeleton.types.mjs";import xn from"./common/skeleton/skeleton.mjs";import Sn from"./common/slider/slider.mjs";import Cn from"./common/splitButton/splitButton.mjs";import{StepperAlignment as wn,StepperCollapse as Tn,StepperLabelPlacement as En,StepperStyleType as Dn}from"./common/stepper/stepper.types.mjs";import On from"./common/stepper/stepper.mjs";import kn from"./common/sticky/sticky.mjs";import An from"./common/switch/switch.mjs";import jn from"./common/tabHeader/tabHeader.mjs";import Mn from"./common/textarea/textarea.mjs";import{defaultTheme as Nn}from"./common/themeProvider/defaultTheme.mjs";import Pn from"./common/themeProvider/themeProvider.mjs";import{lightTheme as Fn}from"./common/themeProvider/lightTheme.mjs";import{useTheme as In}from"./common/themeProvider/useTheme.mjs";import Ln,{TiltGroupContext as Rn,useTiltGroup as zn}from"./common/tiltGroup/tiltGroup.mjs";import{defaultTiltEasing as Bn}from"./common/tilt/tiltMath.mjs";import Vn from"./common/tilt/tilt.mjs";import Hn from"./common/timeInput/timeInput.mjs";import{TimelineAlignment as Un,TimelineItemStatus as Wn}from"./common/timeline/timeline.types.mjs";import Gn from"./common/timeline/timeline.mjs";import Kn from"./common/timer/timer.mjs";import qn from"./common/virtualList/virtualList.mjs";import{flattenTree as Jn}from"./common/tree/flattenTree.mjs";import Yn from"./common/tree/tree.mjs";import{WeatherType as Xn}from"./common/weatherIcon/weatherIcon.types.mjs";import Zn from"./common/weatherIcon/weatherIcon.mjs";import Qn from"./common/wizard/wizard.mjs";import $n from"./services/formValidation/FormValidatorGroupWithForm.mjs";import er from"./services/formValidation/validatableComponent.mjs";import{useFormValidatorGroup as tr}from"./services/formValidation/useFormValidatorGroup.mjs";import{FormValidator as nr,Validators as rr,useFormValidator as ir}from"./services/formValidation/index.mjs";import{hasEightPasswordChars as ar,hasOnePasswordDigit as or,hasOnePasswordLetter as sr,isBic as cr,isDate as lr,isDay as ur,isEmail as dr,isISODate as fr,isNumber as pr,isPassword as mr,isURL as hr}from"@ahrowe/form-validation";export{o as Accordion,e as AccordionStyleType,p as ActionButtons,h as ActionIcon,_ as Alert,g as AlertStyleType,v as AnimatedLogo,x as AnimatedText,y as AnimatedTextUnit,b as AnimatedTextVariant,T as Avatar,E as AvatarGroup,w as Badge,S as BadgePosition,C as BadgeStyleType,D as BodyEnd,L as Breadcrumb,f as Button,z as ButtonGroup,R as ButtonGroupOrientation,c as ButtonSize,l as ButtonStyleType,u as ButtonType,V as Card,G as CardActions,W as CardContent,H as CardHeader,U as CardMedia,B as CardStyleType,K as Carousel,q as Checkbox,Y as Chip,X as ChipContainer,J as ChipStyleType,te as ColorPicker,le as CommandPalette,t as ConfigProvider,ue as ConfirmModal,fe as CopyButton,Pt as DEFAULT_SNAP_OPTIONS,Ve as DEFAULT_WALL_ATTRS,ye as DatePicker,Se as Divider,be as DividerOrientation,xe as DividerTextPosition,Pe as DoorSwing,Ce as Drawer,Ee as DropZone,we as DropZoneReturnType,Te as DropZoneStatus,ve as Dropdown,De as EmptyState,je as ErrorBoundary,Me as Fab,Ne as Flip,nr as FormValidator,$n as FormValidatorGroup,kt as HIT_PX,At as HIT_PX_COARSE,Wt as IconPicker,Gt as IdleManager,ee as Input,Kt as InputDropdown,Q as InputIconPosition,$ as InputType,m as InteractableDiv,Jt as KanbanBoard,qt as KanbanColumn,Xt as KlipyPicker,at as MIN_FLOOR_HEIGHT,ze as MIN_OPENING_WIDTH,Be as MIN_WALL_LENGTH,Zt as Menu,re as Modal,$t as MultiSelect,en as NumberInput,Fe as OpeningKind,tn as OptionPicker,rn as OtpInput,nn as OtpInputCharset,an as Overscroll,zt as PLAN_FORMAT_VERSION,on as Pagination,Ie as PlanIssueKind,Le as PlanUnitSystem,I as Popover,O as PopoverAlign,k as PopoverPlacement,A as PopoverTrigger,a as Presentation,sn as ProgressBar,ln as RadioGroup,cn as RadioGroupOrientation,un as Rating,dn as RevealLens,d as Ripple,fn as RoomDrawer,pn as RoomViewer,hn as ScrollFade,mn as ScrollFadeAxis,gn as ScrollbarProvider,Yt as SearchInput,vn as SectionHeader,_n as SectionHeaderSize,xn as Skeleton,yn as SkeletonAnimation,bn as SkeletonVariant,Sn as Slider,Ft as SnapKind,s as SpinnerLoading,Cn as SplitButton,On as Stepper,wn as StepperAlignment,Tn as StepperCollapse,En as StepperLabelPlacement,Dn as StepperStyleType,kn as Sticky,An as Switch,jn as TabHeader,Mn as Textarea,Pn as ThemeProvider,Vn as Tilt,Ln as TiltGroup,Rn as TiltGroupContext,Hn as TimeInput,Gn as Timeline,Un as TimelineAlignment,Wn as TimelineItemStatus,Kn as Timer,Ae as ToastProvider,Z as Tooltip,Yn as Tree,er as ValidatableComponent,rr as Validators,qn as VirtualList,Re as WallType,Zn as WeatherIcon,Xn as WeatherType,Qn as Wizard,ot as addFloor,He as addOpening,Ue as addRect,We as addWall,Ht as buildPlanMesh,Et as buildWallPaths,Ge as cleanupPlan,It as clientToWorld,St as commitDerivation,ge as dateToDay,_e as dayToDate,Nn as defaultTheme,Bn as defaultTiltEasing,bt as deriveFaces,Ct as derivePlan,Ke as detachWall,qe as dissolveNode,st as duplicateFloor,ct as emptyFloor,lt as emptyFloorPlan,Jn as flattenTree,ut as floorBelow,dt as floorBounds,ft as floorIndex,ae as formatHotkey,pt as getFloor,pe as getLocale,ar as hasEightPasswordChars,or as hasOnePasswordDigit,sr as hasOnePasswordLetter,jt as hitTest,cr as isBic,lr as isDate,ur as isDay,dr as isEmail,fr as isISODate,oe as isMenuAction,se as isMenuHeading,ce as isMenuSeparator,pr as isNumber,mr as isPassword,hr as isURL,Fn as lightTheme,me as mapLocale,Qt as menuHotkeys,Je as mergeNodes,mt as moveFloor,Ye as moveNode,xt as nodeDegrees,Dt as openingGeometry,Bt as planFromJson,Ut as planFromLegacySvg,Vt as planToJson,wt as pruneUnmatchedRooms,ht as removeFloor,Xe as removeOpening,Ze as removeWall,gt as renameFloor,Lt as resolveSnap,Tt as roomAtPoint,Qe as scalePlan,Rt as screenScale,Mt as selectionsEqual,_t as setFloor,vt as setFloorHeight,he as setLocale,ke as showToast,$e as splitWall,j as tabbablesIn,et as transformPlan,yt as updateFloor,tt as updateOpening,de as useClipboard,N as useCoarsePointer,n as useComponentDefaults,ir as useFormValidator,tr as useFormValidatorGroup,ie as useHotkeys,r as useLabels,M as useMediaQuery,F as useOverlay,i as usePresentationDefault,ne as useScrollEdges,Oe as useSwipeDismiss,In as useTheme,zn as useTiltGroup,P as useVisualViewportSize,nt as validatePlan,Ot as wallCentrelineSpans,rt as wallLength,it as weldShortWalls,Nt as worldTolerances};
|