eidos-ui 4.1.0 → 4.2.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/dist/chip/index.cjs +2 -2
- package/dist/chip/index.js +1 -1
- package/dist/{chunk-SONL2RCW.js → chunk-2LSQGDRH.js} +5 -5
- package/dist/{chunk-SOS4K7VC.js → chunk-45XFUEYG.js} +2 -2
- package/dist/{chunk-AWPJH3UB.js → chunk-4MURW4H3.js} +2 -2
- package/dist/{chunk-2WDL2ZVP.js → chunk-5TRO6CYR.js} +10 -4
- package/dist/chunk-5TRO6CYR.js.map +1 -0
- package/dist/{chunk-SJPCBRKR.cjs → chunk-5YTPZN6X.cjs} +3 -3
- package/dist/{chunk-SJPCBRKR.cjs.map → chunk-5YTPZN6X.cjs.map} +1 -1
- package/dist/{chunk-FSX7DDLO.js → chunk-A7K53LDB.js} +19 -11
- package/dist/chunk-A7K53LDB.js.map +1 -0
- package/dist/{chunk-D2PXPX56.js → chunk-AMVA62UC.js} +4 -4
- package/dist/{chunk-43DJ3GGR.js → chunk-CEVMMYJ5.js} +2 -2
- package/dist/{chunk-DCUIT7SI.js → chunk-CIDHX2EW.js} +2 -2
- package/dist/{chunk-MKQVDEHI.cjs → chunk-CPRNLW4M.cjs} +13 -16
- package/dist/chunk-CPRNLW4M.cjs.map +1 -0
- package/dist/{chunk-6JYXGRJ3.cjs → chunk-EAUTJAKV.cjs} +3 -3
- package/dist/{chunk-6JYXGRJ3.cjs.map → chunk-EAUTJAKV.cjs.map} +1 -1
- package/dist/{chunk-OERK3T7E.js → chunk-ECP5J27K.js} +13 -16
- package/dist/chunk-ECP5J27K.js.map +1 -0
- package/dist/{chunk-5HRVHEHE.cjs → chunk-EJS22Y4B.cjs} +3 -3
- package/dist/{chunk-5HRVHEHE.cjs.map → chunk-EJS22Y4B.cjs.map} +1 -1
- package/dist/{chunk-HKLLKNRQ.cjs → chunk-EM4WYYFN.cjs} +3 -3
- package/dist/{chunk-HKLLKNRQ.cjs.map → chunk-EM4WYYFN.cjs.map} +1 -1
- package/dist/{chunk-Z3OEYDNI.js → chunk-EUQQG5WH.js} +2 -2
- package/dist/{chunk-FFYPSLQV.js → chunk-F2FGZFWF.js} +8 -8
- package/dist/{chunk-FAGQGGT3.js → chunk-GVLQQGI3.js} +2 -2
- package/dist/{chunk-YHSCUPP6.cjs → chunk-J2GJGXGH.cjs} +23 -15
- package/dist/chunk-J2GJGXGH.cjs.map +1 -0
- package/dist/{chunk-LXRNFQEI.js → chunk-JJJXVJUW.js} +3 -3
- package/dist/{chunk-UTOTOWPS.js → chunk-LPSRS5GI.js} +3 -3
- package/dist/{chunk-3QBMSZSE.cjs → chunk-NLTNIQG7.cjs} +3 -3
- package/dist/{chunk-3QBMSZSE.cjs.map → chunk-NLTNIQG7.cjs.map} +1 -1
- package/dist/{chunk-MUMTPMWD.cjs → chunk-NNNMXVHI.cjs} +3 -3
- package/dist/{chunk-MUMTPMWD.cjs.map → chunk-NNNMXVHI.cjs.map} +1 -1
- package/dist/{chunk-57BVERWD.js → chunk-NODLZFCN.js} +3 -3
- package/dist/{chunk-DHOBGYRD.js → chunk-NQ2IY4A2.js} +3 -3
- package/dist/{chunk-SJKD3WCV.cjs → chunk-S3IZPWYP.cjs} +5 -5
- package/dist/{chunk-SJKD3WCV.cjs.map → chunk-S3IZPWYP.cjs.map} +1 -1
- package/dist/{chunk-GRKC4PIX.cjs → chunk-SHGRJX7B.cjs} +3 -3
- package/dist/{chunk-GRKC4PIX.cjs.map → chunk-SHGRJX7B.cjs.map} +1 -1
- package/dist/{chunk-VGMRIXW4.cjs → chunk-STVAB7FD.cjs} +25 -25
- package/dist/{chunk-VGMRIXW4.cjs.map → chunk-STVAB7FD.cjs.map} +1 -1
- package/dist/{chunk-BPVOQLCA.cjs → chunk-TFCOF5FC.cjs} +2 -2
- package/dist/chunk-TFCOF5FC.cjs.map +1 -0
- package/dist/{chunk-IJW6YCJB.cjs → chunk-TTFZKWPH.cjs} +5 -5
- package/dist/{chunk-IJW6YCJB.cjs.map → chunk-TTFZKWPH.cjs.map} +1 -1
- package/dist/{chunk-7VMF6LIC.cjs → chunk-TUNG4IDW.cjs} +9 -9
- package/dist/{chunk-7VMF6LIC.cjs.map → chunk-TUNG4IDW.cjs.map} +1 -1
- package/dist/{chunk-JO4NDJRA.cjs → chunk-U4B6C7OP.cjs} +6 -6
- package/dist/{chunk-JO4NDJRA.cjs.map → chunk-U4B6C7OP.cjs.map} +1 -1
- package/dist/{chunk-ADB7QRX5.cjs → chunk-U4MV7P4A.cjs} +5 -5
- package/dist/{chunk-ADB7QRX5.cjs.map → chunk-U4MV7P4A.cjs.map} +1 -1
- package/dist/{chunk-IBT535UH.js → chunk-UAAQVIZQ.js} +2 -2
- package/dist/chunk-UAAQVIZQ.js.map +1 -0
- package/dist/{chunk-VPN7AR7T.cjs → chunk-USGEUG2O.cjs} +4 -4
- package/dist/{chunk-VPN7AR7T.cjs.map → chunk-USGEUG2O.cjs.map} +1 -1
- package/dist/{chunk-TOLNPD7S.js → chunk-VA23PQTA.js} +2 -2
- package/dist/{chunk-BKUZF7CW.cjs → chunk-VY7DTPO3.cjs} +21 -15
- package/dist/chunk-VY7DTPO3.cjs.map +1 -0
- package/dist/{chunk-K6VEUJLY.cjs → chunk-YEBWP7FD.cjs} +18 -18
- package/dist/{chunk-K6VEUJLY.cjs.map → chunk-YEBWP7FD.cjs.map} +1 -1
- package/dist/{chunk-YYA5SWXD.js → chunk-ZBK4KYKJ.js} +2 -2
- package/dist/color-picker/index.cjs +3 -3
- package/dist/color-picker/index.js +2 -2
- package/dist/combobox/index.cjs +3 -3
- package/dist/combobox/index.js +2 -2
- package/dist/context-menu/index.cjs +4 -4
- package/dist/context-menu/index.js +3 -3
- package/dist/conversation/index.cjs +5 -5
- package/dist/conversation/index.js +4 -4
- package/dist/data-grid/index.cjs +10 -10
- package/dist/data-grid/index.js +9 -9
- package/dist/date-picker/index.cjs +4 -4
- package/dist/date-picker/index.js +3 -3
- package/dist/dropdown/index.cjs +2 -2
- package/dist/dropdown/index.d.cts +10 -0
- package/dist/dropdown/index.d.ts +10 -0
- package/dist/dropdown/index.js +1 -1
- package/dist/fonts.css +1 -32
- package/dist/index.cjs +20 -20
- package/dist/index.css +1 -10647
- package/dist/index.js +19 -19
- package/dist/menu/index.cjs +3 -3
- package/dist/menu/index.js +2 -2
- package/dist/page-layout/index.cjs +5 -5
- package/dist/page-layout/index.js +4 -4
- package/dist/pagination/index.cjs +4 -4
- package/dist/pagination/index.js +3 -3
- package/dist/select/index.cjs +3 -3
- package/dist/select/index.js +2 -2
- package/dist/split-button/index.cjs +4 -4
- package/dist/split-button/index.js +3 -3
- package/dist/split-chip/index.cjs +3 -3
- package/dist/split-chip/index.js +2 -2
- package/dist/table/index.cjs +9 -9
- package/dist/table/index.js +8 -8
- package/dist/tag-input/index.cjs +4 -4
- package/dist/tag-input/index.js +3 -3
- package/dist/theme-editor/index.cjs +5 -5
- package/dist/theme-editor/index.js +4 -4
- package/dist/toolbar/index.cjs +4 -4
- package/dist/toolbar/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-2WDL2ZVP.js.map +0 -1
- package/dist/chunk-BKUZF7CW.cjs.map +0 -1
- package/dist/chunk-BPVOQLCA.cjs.map +0 -1
- package/dist/chunk-FSX7DDLO.js.map +0 -1
- package/dist/chunk-IBT535UH.js.map +0 -1
- package/dist/chunk-MKQVDEHI.cjs.map +0 -1
- package/dist/chunk-OERK3T7E.js.map +0 -1
- package/dist/chunk-YHSCUPP6.cjs.map +0 -1
- /package/dist/{chunk-SONL2RCW.js.map → chunk-2LSQGDRH.js.map} +0 -0
- /package/dist/{chunk-SOS4K7VC.js.map → chunk-45XFUEYG.js.map} +0 -0
- /package/dist/{chunk-AWPJH3UB.js.map → chunk-4MURW4H3.js.map} +0 -0
- /package/dist/{chunk-D2PXPX56.js.map → chunk-AMVA62UC.js.map} +0 -0
- /package/dist/{chunk-43DJ3GGR.js.map → chunk-CEVMMYJ5.js.map} +0 -0
- /package/dist/{chunk-DCUIT7SI.js.map → chunk-CIDHX2EW.js.map} +0 -0
- /package/dist/{chunk-Z3OEYDNI.js.map → chunk-EUQQG5WH.js.map} +0 -0
- /package/dist/{chunk-FFYPSLQV.js.map → chunk-F2FGZFWF.js.map} +0 -0
- /package/dist/{chunk-FAGQGGT3.js.map → chunk-GVLQQGI3.js.map} +0 -0
- /package/dist/{chunk-LXRNFQEI.js.map → chunk-JJJXVJUW.js.map} +0 -0
- /package/dist/{chunk-UTOTOWPS.js.map → chunk-LPSRS5GI.js.map} +0 -0
- /package/dist/{chunk-57BVERWD.js.map → chunk-NODLZFCN.js.map} +0 -0
- /package/dist/{chunk-DHOBGYRD.js.map → chunk-NQ2IY4A2.js.map} +0 -0
- /package/dist/{chunk-TOLNPD7S.js.map → chunk-VA23PQTA.js.map} +0 -0
- /package/dist/{chunk-YYA5SWXD.js.map → chunk-ZBK4KYKJ.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Dropdown/Dropdown.context.types.ts","../src/components/Dropdown/Dropdown.context.tsx","../src/components/Dropdown/Dropdown.hooks.ts","../src/components/Dropdown/Dropdown.component.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nexport interface DropdownContextValue {\n level: number;\n}\n\nexport const DropdownContext = createContext<DropdownContextValue>({ level: 0 });\n","import React from 'react';\nimport { DropdownContext } from './Dropdown.context.types';\n\nexport const DropdownProvider: React.FC<{ children: React.ReactNode; level?: number }> = ({\n children,\n level = 0,\n}) => {\n return <DropdownContext.Provider value={{ level }}>{children}</DropdownContext.Provider>;\n};\n","import { useContext } from 'react';\nimport { DropdownContext } from './Dropdown.context.types';\n\nexport const useDropdownContext = () => {\n return useContext(DropdownContext);\n};\n","import React, { useState, useRef, useCallback, useEffect } from 'react';\nimport { createPortal } from 'react-dom';\nimport { devWarn, useIsClient } from '../../utils';\nimport type { DropdownProps, DropdownState } from './Dropdown.types';\nimport { DropdownProvider } from './Dropdown.context';\nimport { useDropdownContext } from './Dropdown.hooks';\n\n// The gutter `calculateOptimalPosition` keeps between the panel and each\n// viewport edge. `calculateDynamicSizing` derives the panel's size cap from\n// the same constant so the two cannot drift apart.\nconst VIEWPORT_GAP = 8;\n\nconst DropdownInternal: React.FC<DropdownProps> = ({\n trigger,\n content,\n placement: preferredPlacement = 'bottom',\n align = 'start',\n delay = 0,\n disabled = false,\n defaultOpen = false,\n open,\n onOpenChange,\n triggerClassName = '',\n contentClassName = '',\n role,\n closeOnClickOutside = true,\n closeOnEscape = true,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n autoWidth = true,\n fullWidth = false,\n triggerRef: externalTriggerRef,\n isNested = false,\n dropdownLevel,\n dropdownGroup,\n}) => {\n const context = useDropdownContext();\n const actualLevel = dropdownLevel !== undefined ? dropdownLevel : context.level;\n // `defaultOpen` makes the portal reachable on the first render, which cannot\n // happen on a server - see `useIsClient`.\n const isClient = useIsClient();\n const [dropdownState, setDropdownState] = useState<DropdownState>({\n isVisible: defaultOpen,\n isPositioned: false,\n position: { top: 0, left: 0, placement: preferredPlacement },\n });\n\n // ── Controlled / uncontrolled open state ──────────────────────────────────\n //\n // `dropdownState.isVisible` stays the *uncontrolled* value and is kept in\n // step even while controlled, so removing `open` later leaves coherent state.\n // Everything downstream reads `isVisible` below, never the field directly.\n //\n // `DropdownState` is exported from the package root, so it keeps its shape:\n // splitting `isVisible` out of it would be a breaking type change for a\n // consumer who imports it, in exchange for nothing a reader of this file\n // needs.\n const isControlled = open !== undefined;\n const isVisible = isControlled ? open : dropdownState.isVisible;\n\n const wasControlled = useRef(isControlled);\n if (wasControlled.current !== isControlled) {\n devWarn(\n 'dropdown-controlled-switch',\n 'Dropdown: `open` switched between controlled and uncontrolled. Pick one for the lifetime of the component - the dropdown keeps its own state as a fallback, so switching makes it jump to whatever that happens to be.',\n );\n wasControlled.current = isControlled;\n }\n\n /**\n * The single place the open state changes. Every route - trigger click,\n * click-outside, Escape, a group sibling, the `delay` timer - goes through\n * here, so a controlled consumer sees all of them and cannot desync.\n */\n const setOpen = useCallback(\n (next: boolean) => {\n setDropdownState((prev) => ({ ...prev, isVisible: next, isPositioned: false }));\n onOpenChange?.(next);\n },\n [onOpenChange],\n );\n\n // A controlled caller can flip `open` without going through `setOpen`, which\n // would leave `isPositioned` true from the previous open and paint the panel\n // at its old coordinates for a frame. Re-arm the positioning pass from the\n // transition itself.\n useEffect(() => {\n if (!isVisible) {\n setDropdownState((prev) => (prev.isPositioned ? { ...prev, isPositioned: false } : prev));\n }\n }, [isVisible]);\n\n // A pending `delay` timer outlives a controlled close otherwise, and reopens\n // the panel a moment after the consumer closed it.\n useEffect(() => {\n if (!isVisible && timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = undefined;\n }\n }, [isVisible]);\n const triggerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const timeoutRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const animationFrameRef = useRef<number | undefined>(undefined);\n const isScrollingRef = useRef(false);\n\n // The element to actually measure/anchor against. When a consumer passes\n // `triggerRef`, that's an explicit statement of \"this is what I want the\n // dropdown positioned relative to\" - it must win over the internal wrapper\n // div, not just inform sizing. Consumers occasionally need `trigger` to be\n // a small anchor node (e.g. a 0-height span) sitting inside a larger,\n // variable-content field (chips, wrapped text); anchoring position to the\n // wrapper instead of that field silently drifts as soon as the field's\n // internal layout changes, since the wrapper only ever contains `trigger`\n // itself, never the field around it.\n const getTriggerElement = useCallback(\n (): HTMLElement | null => externalTriggerRef?.current ?? triggerRef.current,\n [externalTriggerRef],\n );\n\n const calculateDynamicSizing = useCallback(\n // Only the width is read, so the parameter is the narrowest shape that\n // satisfies it rather than a `DOMRect`. The caller used to fall back to\n // `new DOMRect()`, which is a browser-only global evaluated *during\n // render* - it was the first thing to throw when an open dropdown was\n // server-rendered, before `document.body` ever got a chance to.\n (triggerRect: { width: number } | null) => {\n // Shrink the panel to its content by default. This prevents the\n // position:fixed element from expanding to viewport width when children\n // use `width:100%` or `flex:1`. `minWidth` (set below) still wins when\n // the trigger is wider than the content, as CSS min-width overrides width.\n const styles: Record<string, string | number> = { width: 'max-content' };\n\n // The panel must also be *sized* to fit, not only positioned to fit:\n // `calculateOptimalPosition` clamps coordinates, which is no help once\n // the content itself is wider than the screen. Measured on a 375px\n // viewport: DatePicker's panel rendered 507px wide, its right edge 140px\n // off-screen no matter where it was anchored. `clientWidth/Height` is\n // used rather than `window.innerWidth/Height` so a classic scrollbar is\n // excluded and the cap can never exceed what the position clamp assumed.\n const availableWidth = Math.max(0, document.documentElement.clientWidth - 2 * VIEWPORT_GAP);\n const availableHeight = Math.max(0, document.documentElement.clientHeight - 2 * VIEWPORT_GAP);\n const capToViewport = (requested: number | string | undefined, available: number) => {\n // `none`/`auto` mean \"no *consumer* cap\" - they must not mean \"may run\n // off the screen\", so they still resolve to the viewport bound.\n if (requested === undefined || requested === 'none' || requested === 'auto')\n return `${available}px`;\n const value = typeof requested === 'number' ? `${requested}px` : requested;\n return `min(${value}, ${available}px)`;\n };\n\n if (autoWidth && triggerRect && (externalTriggerRef?.current || triggerRef.current)) {\n const triggerWidth = triggerRect.width;\n styles.minWidth = triggerWidth;\n }\n\n if (minWidth !== undefined) {\n styles.minWidth = typeof minWidth === 'number' ? `${minWidth}px` : minWidth;\n }\n styles.maxWidth = capToViewport(maxWidth, availableWidth);\n if (minHeight !== undefined) {\n styles.minHeight = typeof minHeight === 'number' ? `${minHeight}px` : minHeight;\n }\n\n const hasHeightConstraint = minHeight !== undefined || maxHeight !== undefined;\n if (hasHeightConstraint) {\n // The height cap lives only inside the constrained branch: applying it\n // unconditionally would turn every dropdown into a scroll container,\n // which clips descendant paint and outward focus rings on both axes.\n styles.maxHeight = capToViewport(maxHeight, availableHeight);\n styles.overflowY = 'auto';\n } else {\n styles.overflowY = 'visible';\n }\n\n return styles;\n },\n [autoWidth, externalTriggerRef, minWidth, maxWidth, minHeight, maxHeight],\n );\n\n const calculateOptimalPosition = useCallback(\n (triggerRect: DOMRect, contentRect: DOMRect) => {\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n const gap = VIEWPORT_GAP;\n\n let placement: 'top' | 'bottom' | 'left' | 'right' = preferredPlacement;\n let top = 0;\n let left = 0;\n\n // Helpers for cross-axis alignment\n const alignedLeft = (() => {\n switch (align) {\n case 'end':\n return triggerRect.right - contentRect.width;\n case 'center':\n return triggerRect.left + (triggerRect.width - contentRect.width) / 2;\n default:\n return triggerRect.left; // \"start\"\n }\n })();\n const alignedTop = (() => {\n switch (align) {\n case 'end':\n return triggerRect.bottom - contentRect.height;\n case 'center':\n return triggerRect.top + (triggerRect.height - contentRect.height) / 2;\n default:\n return triggerRect.top; // \"start\"\n }\n })();\n\n switch (preferredPlacement) {\n case 'top':\n top = triggerRect.top - contentRect.height - gap;\n left = alignedLeft;\n break;\n case 'bottom':\n top = triggerRect.bottom + gap;\n left = alignedLeft;\n break;\n case 'left':\n top = alignedTop;\n left = triggerRect.left - contentRect.width - gap;\n break;\n case 'right':\n top = alignedTop;\n left = triggerRect.right + gap;\n break;\n }\n\n if (placement === 'top' && top < gap) {\n placement = 'bottom';\n top = triggerRect.bottom + gap;\n } else if (placement === 'bottom' && top + contentRect.height > viewportHeight - gap) {\n placement = 'top';\n top = triggerRect.top - contentRect.height - gap;\n } else if (placement === 'left' && left < gap) {\n placement = 'right';\n left = triggerRect.right + gap;\n } else if (placement === 'right' && left + contentRect.width > viewportWidth - gap) {\n placement = 'left';\n left = triggerRect.left - contentRect.width - gap;\n }\n\n // Always clamp to both viewport edges - not just the near one - regardless\n // of whether an explicit min/max size was passed. `autoWidth` consumers\n // (Combobox, Select, TagInput suggestions, Menu, ...) never set\n // minWidth/maxWidth, so gating this on those props left the far edge\n // (right/bottom) completely unclamped and let content overflow the\n // viewport whenever it rendered wider/taller than its trigger.\n top = Math.max(gap, Math.min(top, viewportHeight - contentRect.height - gap));\n\n left = Math.max(gap, Math.min(left, viewportWidth - contentRect.width - gap));\n\n return { top, left, placement };\n },\n [preferredPlacement, align],\n );\n\n const handleScroll = useCallback(() => {\n if (!isVisible || !dropdownState.isPositioned || isScrollingRef.current) return;\n\n isScrollingRef.current = true;\n\n animationFrameRef.current = requestAnimationFrame(() => {\n const triggerElement = getTriggerElement();\n if (triggerElement && contentRef.current) {\n const triggerRect = triggerElement.getBoundingClientRect();\n const contentRect = contentRef.current.getBoundingClientRect();\n\n const { top, left, placement } = calculateOptimalPosition(triggerRect, contentRect);\n\n setDropdownState((prev) => ({\n ...prev,\n position: { top, left, placement },\n }));\n }\n\n isScrollingRef.current = false;\n });\n }, [isVisible, dropdownState.isPositioned, calculateOptimalPosition, getTriggerElement]);\n\n const handleTriggerClick = useCallback(() => {\n if (disabled) return;\n\n if (isVisible) {\n setOpen(false);\n } else {\n if (dropdownGroup) {\n const siblingDropdowns = document.querySelectorAll(\n `[data-dropdown-group=\"${dropdownGroup}\"][data-dropdown-content]`,\n );\n siblingDropdowns.forEach((dropdown) => {\n const dropdownElement = dropdown as HTMLElement;\n\n dropdownElement.dispatchEvent(new CustomEvent('closeSibling'));\n });\n }\n\n if (delay > 0) {\n timeoutRef.current = setTimeout(() => setOpen(true), delay);\n } else {\n setOpen(true);\n }\n }\n }, [disabled, isVisible, delay, dropdownGroup, setOpen]);\n\n useEffect(() => {\n const handleCloseSibling = () => {\n if (isVisible) setOpen(false);\n };\n\n const currentContentRef = contentRef.current;\n if (currentContentRef) {\n currentContentRef.addEventListener('closeSibling', handleCloseSibling);\n }\n\n return () => {\n if (currentContentRef) {\n currentContentRef.removeEventListener('closeSibling', handleCloseSibling);\n }\n };\n }, [isVisible, setOpen]);\n\n const handleClickOutside = useCallback(\n (event: MouseEvent) => {\n if (!closeOnClickOutside || !isVisible) return;\n\n const target = event.target as Node;\n\n if (contentRef.current?.contains(target)) {\n return;\n }\n\n if (getTriggerElement()?.contains(target)) {\n return;\n }\n\n const allDropdowns = document.querySelectorAll('[data-dropdown-content]');\n for (const dropdown of allDropdowns) {\n if (dropdown === contentRef.current) continue;\n\n if (dropdown.contains(target)) {\n const clickedDropdownLevel = parseInt(\n dropdown.getAttribute('data-dropdown-level') || '0',\n );\n\n if (clickedDropdownLevel > actualLevel) {\n return;\n }\n }\n }\n\n setOpen(false);\n },\n [closeOnClickOutside, isVisible, actualLevel, getTriggerElement, setOpen],\n );\n\n const handleEscapeKey = useCallback(\n (event: KeyboardEvent) => {\n if (closeOnEscape && event.key === 'Escape' && isVisible) {\n setOpen(false);\n }\n },\n [closeOnEscape, isVisible, setOpen],\n );\n\n useEffect(() => {\n const triggerElement = getTriggerElement();\n if (isVisible && !dropdownState.isPositioned && contentRef.current && triggerElement) {\n const triggerRect = triggerElement.getBoundingClientRect();\n const contentRect = contentRef.current.getBoundingClientRect();\n\n const { top, left, placement } = calculateOptimalPosition(triggerRect, contentRect);\n\n setDropdownState((prev) => ({\n ...prev,\n position: { top, left, placement },\n isPositioned: true,\n }));\n }\n }, [\n isVisible,\n dropdownState.isPositioned,\n calculateOptimalPosition,\n getTriggerElement,\n // Load-bearing, not incidental. With `defaultOpen` the panel is \"visible\"\n // from the first render, but the portal is deferred one render for SSR\n // safety - so this effect's first run finds `contentRef.current` still\n // null, measures nothing, and without `isClient` in the deps it would never\n // run again. The panel then stays `visibility: hidden` forever: mounted,\n // unpositioned, invisible. Caught by `OpensOnMountWithDefaultOpen`.\n isClient,\n ]);\n\n useEffect(() => {\n const handleResize = () => {\n const triggerElement = getTriggerElement();\n if (isVisible && dropdownState.isPositioned && contentRef.current && triggerElement) {\n const triggerRect = triggerElement.getBoundingClientRect();\n const contentRect = contentRef.current.getBoundingClientRect();\n\n const { top, left, placement } = calculateOptimalPosition(triggerRect, contentRect);\n\n setDropdownState((prev) => ({\n ...prev,\n position: { top, left, placement },\n }));\n }\n };\n\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, [isVisible, dropdownState.isPositioned, calculateOptimalPosition, getTriggerElement]);\n\n useEffect(() => {\n if (isVisible) {\n // Capture phase on `document`, which is the only way to see scrolling in\n // an arbitrary ancestor: `scroll` does not bubble from an element, so the\n // previous listeners on `window` and `document.body` only ever fired for\n // the page itself. Any other scroll container - `PageLayout`'s\n // `&__content` is the layout's scrollport, so this is every dropdown\n // inside it - moved the trigger while the portaled, `position: fixed`\n // content stayed at its original viewport coordinates.\n document.addEventListener('scroll', handleScroll, { capture: true, passive: true });\n }\n\n return () => {\n document.removeEventListener('scroll', handleScroll, { capture: true });\n };\n }, [isVisible, handleScroll]);\n\n useEffect(() => {\n if (isVisible) {\n document.addEventListener('mousedown', handleClickOutside);\n document.addEventListener('keydown', handleEscapeKey);\n }\n\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n document.removeEventListener('keydown', handleEscapeKey);\n };\n }, [isVisible, handleClickOutside, handleEscapeKey]);\n\n useEffect(() => {\n return () => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n if (animationFrameRef.current) {\n cancelAnimationFrame(animationFrameRef.current);\n }\n };\n }, []);\n\n return (\n <>\n {/*\n A positioning and click-capturing wrapper, and nothing more - it\n deliberately carries no `role` and no `tabIndex`.\n\n It used to be `role=\"button\" tabIndex={-1}`, which was wrong in both\n directions at once. `tabIndex={-1}` with no key handler meant the\n wrapper was never keyboard-operable, so the button role it advertised\n could not be activated by anyone using a keyboard - it promised a\n control that did not exist. Meanwhile, because `trigger` is virtually\n always a real control (Select and Combobox pass an `<input>`, Menu and\n SplitButton a `<button>`, ...), the role wrapped an interactive element\n in another interactive element: invalid ARIA, flagged by axe as\n `nested-interactive`, and announced by screen readers as a button\n inside a button. One attribute did this across every component built\n on Dropdown - Select, Combobox, Menu, Popover, ContextMenu,\n ColorPicker and TagInput - 212 violations in a single axe run.\n\n Semantics belong to whatever is passed as `trigger`, which is the only\n element that can actually own them. A consumer passing a\n non-interactive node should pass a `<button>` instead; it was never\n keyboard-accessible under the old markup either.\n */}\n <div\n ref={triggerRef}\n onClick={handleTriggerClick}\n className={`eidos-dropdown-trigger ${fullWidth ? 'eidos-dropdown-trigger--full-width' : ''} ${triggerClassName}`}\n >\n {trigger}\n </div>\n {isClient &&\n isVisible &&\n createPortal(\n <div\n ref={contentRef}\n data-dropdown-content\n data-dropdown-level={actualLevel}\n data-dropdown-group={dropdownGroup || ''}\n className={`eidos-dropdown-content eidos-dropdown-content--${dropdownState.position.placement} ${isNested ? 'eidos-dropdown-content--nested' : ''} ${dropdownState.isPositioned ? 'eidos-dropdown-content--positioned' : ''} ${contentClassName || ''}`}\n style={{\n top: dropdownState.position.top,\n left: dropdownState.position.left,\n ...calculateDynamicSizing(getTriggerElement()?.getBoundingClientRect() ?? null),\n }}\n // No default role: see the `role` prop's note in `Dropdown.types`.\n // This was `role=\"menu\"` unconditionally, which made a menu out of\n // every `Select` listbox, date picker and toolbar panel in the\n // library.\n role={role}\n >\n {content}\n </div>,\n document.body,\n )}\n </>\n );\n};\n\nexport const Dropdown: React.FC<DropdownProps> = (props) => {\n const context = useDropdownContext();\n const nextLevel = props.dropdownLevel !== undefined ? props.dropdownLevel : context.level + 1;\n\n return (\n <DropdownProvider level={nextLevel}>\n <DropdownInternal {...props} />\n </DropdownProvider>\n );\n};\n\nDropdown.displayName = 'Dropdown';\n"],"mappings":";;;;;;AAAA,SAAS,qBAAqB;AAMvB,IAAM,kBAAkB,cAAoC,EAAE,OAAO,EAAE,CAAC;;;ACCtE;AAJF,IAAM,mBAA4E,CAAC;AAAA,EACxF;AAAA,EACA,QAAQ;AACV,MAAM;AACJ,SAAO,oBAAC,gBAAgB,UAAhB,EAAyB,OAAO,EAAE,MAAM,GAAI,UAAS;AAC/D;;;ACRA,SAAS,kBAAkB;AAGpB,IAAM,qBAAqB,MAAM;AACtC,SAAO,WAAW,eAAe;AACnC;;;ACLA,SAAgB,UAAU,QAAQ,aAAa,iBAAiB;AAChE,SAAS,oBAAoB;AA0czB,mBAuBE,OAAAA,MAvBF;AAjcJ,IAAM,eA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EAAE;AAAA,UACrP,OAAO;AAAA,YACL,KAAK,cAAc,SAAS;AAAA,YAC5B,MAAM,cAAc,SAAS;AAAA,YAC7B,GAAG,uBAAuB,kBAAkB,GAAG,sBAAsB,KAAK,IAAI;AAAA,UAChF;AAAA,UAKA;AAAA,UAEC;AAAA;AAAA,MACH;AAAA,MACA,SAAS;AAAA,IACX;AAAA,KACJ;AAEJ;AAEO,IAAM,WAAoC,CAAC,UAAU;AAC1D,QAAM,UAAU,mBAAmB;AACnC,QAAM,YAAY,MAAM,kBAAkB,SAAY,MAAM,gBAAgB,QAAQ,QAAQ;AAE5F,SACE,gBAAAA,KAAC,oBAAiB,OAAO,WACvB,0BAAAA,KAAC,oBAAkB,GAAG,OAAO,GAC/B;AAEJ;AAEA,SAAS,cAAc;","names":["jsx"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkUSGEUG2Ocjs = require('./chunk-USGEUG2O.cjs');
|
|
4
4
|
|
|
5
5
|
// src/components/ContextMenu/ContextMenu.component.tsx
|
|
6
6
|
var _react = require('react');
|
|
@@ -92,7 +92,7 @@ var ContextMenu = ({
|
|
|
92
92
|
top: position.y,
|
|
93
93
|
left: position.x
|
|
94
94
|
},
|
|
95
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
95
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUSGEUG2Ocjs.MenuPanel, { items, onItemClick: handleItemClick })
|
|
96
96
|
}
|
|
97
97
|
),
|
|
98
98
|
document.body
|
|
@@ -103,4 +103,4 @@ var ContextMenu = ({
|
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
exports.ContextMenu = ContextMenu;
|
|
106
|
-
//# sourceMappingURL=chunk-
|
|
106
|
+
//# sourceMappingURL=chunk-EJS22Y4B.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/eidos-ui/eidos-ui/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/eidos-ui/eidos-ui/dist/chunk-EJS22Y4B.cjs","../src/components/ContextMenu/ContextMenu.component.tsx"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACJA,8BAAgE;AAChE,qCAA6B;AAkHzB,+CAAA;AAnFG,IAAM,YAAA,EAA0C,CAAC;AAAA,EACtD,KAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA,EAAW,KAAA;AAAA,EACX,UAAA,EAAY;AACd,CAAA,EAAA,GAAM;AACJ,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,EAAA,EAAI,6BAAA,KAAc,CAAA;AAC1C,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,EAAA,EAAI,6BAAA,EAAyB,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,EAAE,CAAC,CAAA;AACrE,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,EAAA,EAAI,6BAAA,KAAc,CAAA;AACtD,EAAA,MAAM,QAAA,EAAU,2BAAA,IAA2B,CAAA;AAE3C,EAAA,MAAM,MAAA,EAAQ,gCAAA,CAAY,EAAA,GAAM;AAC9B,IAAA,SAAA,CAAU,KAAK,CAAA;AACf,IAAA,eAAA,CAAgB,KAAK,CAAA;AAAA,EACvB,CAAA,EAAG,CAAC,CAAC,CAAA;AAGL,EAAA,8BAAA,CAAU,EAAA,GAAM;AACd,IAAA,GAAA,CAAI,CAAC,OAAA,GAAU,CAAC,OAAA,CAAQ,OAAA,EAAS,MAAA;AAEjC,IAAA,MAAM,KAAA,EAAO,OAAA,CAAQ,OAAA;AACrB,IAAA,MAAM,EAAE,KAAA,EAAO,OAAO,EAAA,EAAI,IAAA,CAAK,qBAAA,CAAsB,CAAA;AACrD,IAAA,MAAM,GAAA,EAAK,MAAA,CAAO,UAAA;AAClB,IAAA,MAAM,GAAA,EAAK,MAAA,CAAO,WAAA;AAClB,IAAA,MAAM,IAAA,EAAM,CAAA;AAEZ,IAAA,MAAM,SAAA,EAAW,IAAA,CAAK,GAAA,CAAI,QAAA,CAAS,CAAA,EAAG,GAAA,EAAK,MAAA,EAAQ,GAAG,CAAA;AACtD,IAAA,MAAM,SAAA,EAAW,IAAA,CAAK,GAAA,CAAI,QAAA,CAAS,CAAA,EAAG,GAAA,EAAK,OAAA,EAAS,GAAG,CAAA;AAEvD,IAAA,IAAA,CAAK,KAAA,CAAM,KAAA,EAAO,CAAA,EAAA;AACD,IAAA;AACD,IAAA;AACG,EAAA;AAGL,EAAA;AACD,IAAA;AAEP,IAAA;AACQ,MAAA;AACJ,QAAA;AACR,MAAA;AACF,IAAA;AAES,IAAA;AACI,IAAA;AACG,EAAA;AAGF,EAAA;AACD,IAAA;AAEP,IAAA;AACU,MAAA;AAChB,IAAA;AAEM,IAAA;AAEG,IAAA;AACF,IAAA;AACM,IAAA;AACF,MAAA;AACF,MAAA;AACT,IAAA;AACgB,EAAA;AAEZ,EAAA;AACU,IAAA;AACG,IAAA;AACC,IAAA;AACJ,IAAA;AACE,IAAA;AACG,IAAA;AACrB,EAAA;AAEM,EAAA;AACiB,IAAA;AACb,MAAA;AACR,IAAA;AACM,IAAA;AACR,EAAA;AAGE,EAAA;AACE,oBAAA;AAAC,MAAA;AAAA,MAAA;AACa,QAAA;AACG,QAAA;AAEd,QAAA;AAAA,MAAA;AACH,IAAA;AAGE,IAAA;AACE,sBAAA;AAAC,QAAA;AAAA,QAAA;AACM,UAAA;AACM,UAAA;AACT,YAAA;AACA,YAAA;AAEQ,UAAA;AAEH,UAAA;AACA,YAAA;AACC,YAAA;AACR,UAAA;AAEA,UAAA;AAAuD,QAAA;AACzD,MAAA;AACS,MAAA;AACX,IAAA;AACJ,EAAA;AAEJ;AD3CuB;AACA;AACA;AACA","file":"/home/runner/work/eidos-ui/eidos-ui/dist/chunk-EJS22Y4B.cjs","sourcesContent":[null,"import React, { useState, useEffect, useRef, useCallback } from 'react';\nimport { createPortal } from 'react-dom';\nimport { MenuPanel } from '../Menu';\nimport type { MenuItem } from '../Menu';\nimport type { ContextMenuProps } from './ContextMenu.types';\n\ninterface MenuPosition {\n x: number;\n y: number;\n}\n\n/**\n * ContextMenu - wraps any content and attaches a right-click (or long-press)\n * triggered menu positioned at the cursor.\n *\n * The browser's native context menu is suppressed when `disabled` is false.\n * The menu closes on: click outside, item selection, Escape, and scroll.\n *\n * @example\n * ```tsx\n * <ContextMenu\n * items={[\n * { type: 'item', id: 'copy', label: 'Copy', icon: Copy, onClick: () => copy() },\n * { type: 'item', id: 'cut', label: 'Cut', icon: Scissors, onClick: () => cut() },\n * { type: 'separator', id: 'sep1' },\n * { type: 'item', id: 'delete', label: 'Delete', icon: Trash2, onClick: () => remove(), disabled: true },\n * ]}\n * >\n * <div className=\"canvas-area\">...</div>\n * </ContextMenu>\n * ```\n */\nexport const ContextMenu: React.FC<ContextMenuProps> = ({\n items,\n children,\n disabled = false,\n className = '',\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n const [position, setPosition] = useState<MenuPosition>({ x: 0, y: 0 });\n const [isPositioned, setIsPositioned] = useState(false);\n const menuRef = useRef<HTMLDivElement>(null);\n\n const close = useCallback(() => {\n setIsOpen(false);\n setIsPositioned(false);\n }, []);\n\n // Measure the menu panel after it renders and clamp to viewport edges.\n useEffect(() => {\n if (!isOpen || !menuRef.current) return;\n\n const menu = menuRef.current;\n const { width, height } = menu.getBoundingClientRect();\n const vw = window.innerWidth;\n const vh = window.innerHeight;\n const GAP = 4; // px clearance from viewport edge\n\n const clampedX = Math.min(position.x, vw - width - GAP);\n const clampedY = Math.min(position.y, vh - height - GAP);\n\n menu.style.left = `${Math.max(GAP, clampedX)}px`;\n menu.style.top = `${Math.max(GAP, clampedY)}px`;\n setIsPositioned(true);\n }, [isOpen, position]);\n\n // Close on click outside.\n useEffect(() => {\n if (!isOpen) return;\n\n const handleMouseDown = (e: MouseEvent) => {\n if (menuRef.current && !menuRef.current.contains(e.target as Node)) {\n close();\n }\n };\n\n document.addEventListener('mousedown', handleMouseDown);\n return () => document.removeEventListener('mousedown', handleMouseDown);\n }, [isOpen, close]);\n\n // Close on Escape or scroll.\n useEffect(() => {\n if (!isOpen) return;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape') close();\n };\n\n const handleScroll = () => close();\n\n document.addEventListener('keydown', handleKeyDown);\n window.addEventListener('scroll', handleScroll, true); // capture: catches nested scrollers\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n window.removeEventListener('scroll', handleScroll, true);\n };\n }, [isOpen, close]);\n\n const handleContextMenu = (e: React.MouseEvent) => {\n if (disabled) return;\n e.preventDefault();\n e.stopPropagation();\n setIsOpen(true);\n setIsPositioned(false);\n setPosition({ x: e.clientX, y: e.clientY });\n };\n\n const handleItemClick = useCallback(\n (_item: MenuItem) => {\n close();\n },\n [close],\n );\n\n return (\n <>\n <div\n className={['eidos-context-menu-target', className].filter(Boolean).join(' ')}\n onContextMenu={handleContextMenu}\n >\n {children}\n </div>\n\n {isOpen &&\n createPortal(\n <div\n ref={menuRef}\n className={[\n 'eidos-context-menu-panel',\n isPositioned && 'eidos-context-menu-panel--positioned',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n top: position.y,\n left: position.x,\n }}\n >\n <MenuPanel items={items} onItemClick={handleItemClick} />\n </div>,\n document.body,\n )}\n </>\n );\n};\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkKF2OGUADcjs = require('./chunk-KF2OGUAD.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkCPRNLW4Mcjs = require('./chunk-CPRNLW4M.cjs');
|
|
7
7
|
|
|
8
8
|
// src/components/Combobox/Combobox.component.tsx
|
|
9
9
|
var _react = require('react');
|
|
@@ -405,7 +405,7 @@ var Combobox = ({
|
|
|
405
405
|
}
|
|
406
406
|
),
|
|
407
407
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
408
|
-
|
|
408
|
+
_chunkCPRNLW4Mcjs.Dropdown,
|
|
409
409
|
{
|
|
410
410
|
open: isOpen,
|
|
411
411
|
onOpenChange: setIsOpen,
|
|
@@ -442,4 +442,4 @@ Combobox.displayName = "Combobox";
|
|
|
442
442
|
|
|
443
443
|
|
|
444
444
|
exports.Combobox = Combobox;
|
|
445
|
-
//# sourceMappingURL=chunk-
|
|
445
|
+
//# sourceMappingURL=chunk-EM4WYYFN.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/eidos-ui/eidos-ui/dist/chunk-HKLLKNRQ.cjs","../src/components/Combobox/Combobox.component.tsx"],"names":["label"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACPA,8BAAgF;AAChF,2CAA4D;AA0chD,+CAAA;AA3bL,IAAM,SAAA,EAAoC,CAAC;AAAA,EAChD,QAAA,EAAU,CAAC,CAAA;AAAA,EACX,KAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA,EAAc,wBAAA;AAAA,EACd,QAAA,EAAU,KAAA;AAAA,EACV,YAAA,EAAc,iBAAA;AAAA,EACd,UAAA,EAAY,kBAAA;AAAA,EACZ,cAAA,EAAgB,KAAA;AAAA,EAChB,UAAA,EAAY,IAAA;AAAA,EACZ,SAAA,EAAW,KAAA;AAAA,EACX,KAAA,EAAO,IAAA;AAAA,EACP,KAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,UAAA,EAAY,KAAA;AAAA,EACZ,UAAA,EAAY,EAAA;AAAA,EACZ,UAAA,EAAY,OAAA;AAAA,EACZ;AACF,CAAA,EAAA,GAAM;AACJ,EAAA,MAAM,IAAA,EAAM,0BAAA,CAAM;AAKlB,EAAA,MAAM,aAAA,EAAe,2BAAA,IAA2B,CAAA;AAGhD,EAAA,MAAM,mBAA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X,YAAA;AACA,YAAA;AACA,YAAA;AACS,YAAA;AACT,YAAA;AACW,YAAA;AACD,YAAA;AACV,YAAA;AACa,YAAA;AACG,YAAA;AAGkB,YAAA;AAE7B,YAAA;AACU,YAAA;AAIc,YAAA;AACc,YAAA;AACzB,YAAA;AAIyB,YAAA;AACM,YAAA;AAA4B,UAAA;AAC/E,QAAA;AAUA,wBAAA;AAAC,UAAA;AAAA,UAAA;AACO,YAAA;AACQ,YAAA;AAIW,YAAA;AAEvB,YAAA;AAAC,cAAA;AAAA,cAAA;AACW,gBAAA;AACA,gBAAA;AACL,gBAAA;AACgB,gBAAA;AAGgB,gBAAA;AAEpC,gBAAA;AAAA,cAAA;AACH,YAAA;AAEU,YAAA;AACD,YAAA;AACF,YAAA;AACY,YAAA;AACN,YAAA;AAAA,UAAA;AACjB,QAAA;AACF,MAAA;AAEmC,MAAA;AAEjB,MAAA;AACS,wBAAA;AACtB,QAAA;AACH,MAAA;AAEJ,IAAA;AAAA,EAAA;AAEJ;AAEuB;ADxL0C;AACA;AACA;AACA","file":"/home/runner/work/eidos-ui/eidos-ui/dist/chunk-HKLLKNRQ.cjs","sourcesContent":[null,"import React, { useState, useCallback, useRef, useEffect, useMemo, useId } from 'react';\nimport { Check, ChevronDown, X, Loader2, CircleAlert } from 'lucide-react';\nimport { Input } from '../Input/Input.component';\nimport { Dropdown } from '../Dropdown/Dropdown.component';\n\nimport type { ComboboxProps, ComboboxOption } from './Combobox.types';\nimport './Combobox.scss';\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\ntype OptionEntry =\n | { type: 'group'; group: string; key: string }\n | { type: 'option'; option: ComboboxOption; index: number; key: string };\n\n// ─── Component ───────────────────────────────────────────────────────────────\n\nexport const Combobox: React.FC<ComboboxProps> = ({\n options = [],\n value,\n defaultValue,\n onChange,\n onSearch,\n placeholder = 'Search or select…',\n loading = false,\n loadingText = 'Searching…',\n emptyText = 'No results found',\n allowFreeText = false,\n clearable = true,\n disabled = false,\n size = 'md',\n label,\n error,\n hint,\n fullWidth = false,\n className = '',\n maxHeight = '300px',\n renderOption,\n}) => {\n const uid = useId();\n\n // ─── Refs ─────────────────────────────────────────────────────────────────\n\n /** Entire combobox wrapper - used for click-outside detection */\n const containerRef = useRef<HTMLDivElement>(null);\n\n /** The trigger wrapper div - passed to Dropdown as externalTriggerRef for width */\n const comboboxTriggerRef = useRef<HTMLDivElement>(null);\n\n /** The 0-height span that IS the Dropdown trigger element - programmatically clicked to open */\n\n /** Native input element */\n const inputRef = useRef<HTMLInputElement>(null);\n\n /** Focusable option divs for scroll-into-view */\n const optionRefs = useRef<(HTMLDivElement | null)[]>([]);\n\n /**\n * Synchronous open-state flag.\n * React state updates are async; reading this ref inside event handlers\n * gives us the true current value without waiting for a re-render.\n */\n const isOpenRef = useRef(false);\n\n // ─── State ────────────────────────────────────────────────────────────────\n\n const isControlled = value !== undefined;\n\n const getInitialInputValue = (): string => {\n const seed = isControlled ? value : defaultValue;\n if (!seed) return '';\n const match = options.find((o) => o.value === seed);\n return match ? match.label : allowFreeText ? seed : '';\n };\n\n const getInitialCommittedValue = (): string => {\n return isControlled ? (value ?? '') : (defaultValue ?? '');\n };\n\n const [inputValue, _setInputValue] = useState<string>(getInitialInputValue);\n const inputValueRef = useRef<string>(inputValue);\n const setInputValue = useCallback((v: string) => {\n inputValueRef.current = v;\n _setInputValue(v);\n }, []);\n\n const [committedValue, _setCommittedValue] = useState<string>(getInitialCommittedValue);\n const committedValueRef = useRef<string>(committedValue);\n const setCommittedValue = useCallback((v: string) => {\n committedValueRef.current = v;\n _setCommittedValue(v);\n }, []);\n\n const [isOpen, setIsOpen] = useState(false);\n const [focusedIndex, setFocusedIndex] = useState(-1);\n\n // ─── Sync controlled value ────────────────────────────────────────────────\n\n useEffect(() => {\n if (!isControlled) return;\n const v = value ?? '';\n const match = options.find((o) => o.value === v);\n const label = match ? match.label : allowFreeText ? v : '';\n setInputValue(label);\n setCommittedValue(v);\n }, [value, isControlled, options, allowFreeText, setInputValue, setCommittedValue]);\n\n // ─── Derived: filtered options ────────────────────────────────────────────\n\n const filteredOptions = useMemo<ComboboxOption[]>(() => {\n const q = inputValue.toLowerCase();\n if (!q) return options;\n return options.filter((o) => o.label.toLowerCase().includes(q));\n }, [options, inputValue]);\n\n // Reset focused index when the filtered set changes\n useEffect(() => {\n setFocusedIndex(-1);\n }, [filteredOptions]);\n\n // Keep optionRefs array in sync with filteredOptions length\n useEffect(() => {\n optionRefs.current = optionRefs.current.slice(0, filteredOptions.length);\n }, [filteredOptions.length]);\n\n // ─── Derived: option entries (with group headers) ─────────────────────────\n\n const optionEntries = useMemo<OptionEntry[]>(() => {\n const entries: OptionEntry[] = [];\n const hasGroups = filteredOptions.some((o) => o.group);\n\n if (!hasGroups) {\n filteredOptions.forEach((option, index) => {\n entries.push({ type: 'option', option, index, key: option.id });\n });\n return entries;\n }\n\n // Build ordered group map while preserving insertion order\n const groupMap = new Map<string | null, ComboboxOption[]>();\n for (const option of filteredOptions) {\n const g = option.group ?? null;\n if (!groupMap.has(g)) groupMap.set(g, []);\n groupMap.get(g)!.push(option);\n }\n\n let optionIndex = 0;\n for (const [group, opts] of groupMap.entries()) {\n if (group !== null) {\n entries.push({ type: 'group', group, key: `group-${group}` });\n }\n for (const option of opts) {\n entries.push({ type: 'option', option, index: optionIndex++, key: option.id });\n }\n }\n\n return entries;\n }, [filteredOptions]);\n\n // ─── Open / Close helpers ─────────────────────────────────────────────────\n\n /**\n * Open the dropdown by programmatically clicking the 0-height span trigger.\n * The click bubbles to div.eidos-dropdown-trigger → Dropdown.handleTriggerClick → opens.\n *\n * We set isOpenRef AFTER the synthetic click so that the Dropdown's toggle\n * handler fires while isOpenRef is still false (allowing it to open).\n */\n const openDropdown = useCallback(() => {\n if (isOpenRef.current || disabled) return;\n // This used to synthesise a click on a hidden zero-height `span` so it would\n // bubble to the dropdown's trigger wrapper, because the overlay kept its\n // open state private and a click was the only way to change it.\n isOpenRef.current = true;\n setIsOpen(true);\n }, [disabled]);\n\n /**\n * Close the dropdown, optionally reverting `inputValue` to the last committed\n * value. This used to close it by remounting the whole subtree through a\n * changing `key`.\n */\n const closeDropdown = useCallback(\n (revertInput = false) => {\n isOpenRef.current = false;\n setIsOpen(false);\n setFocusedIndex(-1);\n\n if (revertInput) {\n const match = options.find((o) => o.value === committedValueRef.current);\n setInputValue(match ? match.label : allowFreeText ? committedValueRef.current : '');\n }\n },\n [options, allowFreeText, setInputValue],\n );\n\n // ─── Click-outside detection ──────────────────────────────────────────────\n\n useEffect(() => {\n const handleMouseDown = (e: MouseEvent) => {\n if (!isOpenRef.current) return;\n // defaultPrevented is set by the listbox's onMouseDown - means the user\n // clicked an option in the portal, not truly outside the combobox.\n if (e.defaultPrevented) return;\n if (containerRef.current?.contains(e.target as Node)) return;\n\n // Focus leaving to a non-focusable target: validate and close\n isOpenRef.current = false;\n setIsOpen(false);\n setFocusedIndex(-1);\n\n const current = inputValueRef.current;\n const committed = committedValueRef.current;\n\n if (!allowFreeText) {\n const match = options.find((o) => o.label.toLowerCase() === current.toLowerCase());\n if (match) {\n if (match.value !== committed) {\n setCommittedValue(match.value);\n onChange?.(match.value);\n setInputValue(match.label);\n }\n } else {\n const revertMatch = options.find((o) => o.value === committed);\n setInputValue(revertMatch ? revertMatch.label : '');\n }\n } else {\n if (current !== committed) {\n setCommittedValue(current);\n onChange?.(current);\n }\n }\n };\n\n document.addEventListener('mousedown', handleMouseDown);\n return () => document.removeEventListener('mousedown', handleMouseDown);\n }, [allowFreeText, options, onChange, setCommittedValue, setInputValue]);\n\n // ─── Input handlers ───────────────────────────────────────────────────────\n\n const handleFocus = useCallback(() => {\n openDropdown();\n }, [openDropdown]);\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const query = e.target.value;\n setInputValue(query);\n onSearch?.(query);\n if (!isOpenRef.current) openDropdown();\n },\n [setInputValue, onSearch, openDropdown],\n );\n\n /**\n * On blur, validate the typed value against options.\n * A 0ms defer ensures a click on a posIcon button (X / chevron) inside the\n * Input completes its onClick before we run close logic, so we can check\n * document.activeElement reliably.\n */\n const handleBlur = useCallback(() => {\n setTimeout(() => {\n // If focus came back inside the container (e.g., posIcon button clicked),\n // don't close or validate yet.\n if (containerRef.current?.contains(document.activeElement)) return;\n\n // Read both refs *inside* the deferred callback, never captured at blur\n // time - that's the whole reason they're kept in sync by the setters.\n // Anything can run in the gap this 0ms defer opens, including the click\n // that caused the blur: a controlled consumer clearing `value` from\n // another control (e.g. DataGrid's \"Clear filters\", which resets every\n // quick filter at once) updates the refs via the sync effect, and stale\n // captured values would then resurrect the label that was just cleared.\n const current = inputValueRef.current;\n const committed = committedValueRef.current;\n\n // Close\n isOpenRef.current = false;\n setIsOpen(false);\n setFocusedIndex(-1);\n\n // Validate\n if (!allowFreeText) {\n const match = options.find((o) => o.label.toLowerCase() === current.toLowerCase());\n if (match) {\n if (match.value !== committed) {\n setCommittedValue(match.value);\n onChange?.(match.value);\n setInputValue(match.label);\n } else {\n // Normalize the display label (fix casing)\n setInputValue(match.label);\n }\n } else {\n // No match - revert to last committed value\n const revertMatch = options.find((o) => o.value === committed);\n setInputValue(revertMatch ? revertMatch.label : '');\n }\n } else {\n // allowFreeText: commit whatever the user typed\n if (current !== committed) {\n setCommittedValue(current);\n onChange?.(current);\n }\n }\n }, 0);\n }, [allowFreeText, options, onChange, setCommittedValue, setInputValue]);\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (disabled) return;\n\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n if (!isOpenRef.current) {\n openDropdown();\n setFocusedIndex(0);\n } else {\n setFocusedIndex((prev) => {\n const next = prev < filteredOptions.length - 1 ? prev + 1 : 0;\n setTimeout(\n () =>\n optionRefs.current[next]?.scrollIntoView({\n block: 'nearest',\n behavior: 'smooth',\n }),\n 0,\n );\n return next;\n });\n }\n break;\n\n case 'ArrowUp':\n e.preventDefault();\n if (!isOpenRef.current) {\n openDropdown();\n setFocusedIndex(filteredOptions.length - 1);\n } else {\n setFocusedIndex((prev) => {\n const next = prev > 0 ? prev - 1 : filteredOptions.length - 1;\n setTimeout(\n () =>\n optionRefs.current[next]?.scrollIntoView({\n block: 'nearest',\n behavior: 'smooth',\n }),\n 0,\n );\n return next;\n });\n }\n break;\n\n case 'Enter':\n e.preventDefault();\n if (isOpenRef.current && focusedIndex >= 0 && focusedIndex < filteredOptions.length) {\n handleOptionSelect(filteredOptions[focusedIndex]);\n } else if (allowFreeText && inputValue.trim()) {\n const trimmed = inputValue.trim();\n setCommittedValue(trimmed);\n onChange?.(trimmed);\n closeDropdown();\n }\n break;\n\n case 'Escape':\n e.preventDefault();\n if (isOpenRef.current) {\n closeDropdown(true /* revert */);\n }\n break;\n\n default:\n break;\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n disabled,\n filteredOptions,\n focusedIndex,\n allowFreeText,\n inputValue,\n onChange,\n openDropdown,\n closeDropdown,\n setCommittedValue,\n ],\n );\n\n // ─── Option selection ─────────────────────────────────────────────────────\n\n const handleOptionSelect = useCallback(\n (option: ComboboxOption) => {\n if (option.disabled) return;\n setInputValue(option.label);\n setCommittedValue(option.value);\n onChange?.(option.value);\n closeDropdown();\n // Return focus to the input so the user can continue interacting\n inputRef.current?.focus();\n },\n [onChange, closeDropdown, setInputValue, setCommittedValue],\n );\n\n // ─── Clear ────────────────────────────────────────────────────────────────\n\n const handleClearClick = useCallback(() => {\n setInputValue('');\n setCommittedValue('');\n onChange?.('');\n // Re-focus input so the user can immediately start typing again\n inputRef.current?.focus();\n }, [onChange, setInputValue, setCommittedValue]);\n\n // ─── Chevron toggle ───────────────────────────────────────────────────────\n\n const handleChevronClick = useCallback(() => {\n if (isOpenRef.current) {\n closeDropdown();\n } else {\n openDropdown();\n }\n }, [closeDropdown, openDropdown]);\n\n // ─── Render: individual option ────────────────────────────────────────────\n\n const renderOptionItem = useCallback(\n (option: ComboboxOption, index: number): React.ReactNode => {\n const isSelected = option.value === committedValue;\n const isFocused = index === focusedIndex;\n\n const classes = [\n 'eidos-combobox-option',\n isSelected && 'eidos-combobox-option--selected',\n isFocused && 'eidos-combobox-option--focused',\n option.disabled && 'eidos-combobox-option--disabled',\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <div\n key={option.id}\n ref={(el) => {\n optionRefs.current[index] = el;\n }}\n className={classes}\n onClick={() => handleOptionSelect(option)}\n onMouseEnter={() => !option.disabled && setFocusedIndex(index)}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={option.disabled}\n id={`${uid}-option-${index}`}\n >\n {renderOption ? (\n renderOption(option)\n ) : (\n <>\n <Check\n className={`eidos-combobox-option-icon${\n !isSelected ? ' eidos-combobox-option-icon--hidden' : ''\n }`}\n />\n <span className=\"eidos-combobox-option-label\">{option.label}</span>\n {option.description && (\n <span className=\"eidos-combobox-option-description\">{option.description}</span>\n )}\n </>\n )}\n </div>\n );\n },\n [committedValue, focusedIndex, handleOptionSelect, renderOption, uid],\n );\n\n // ─── Render: dropdown content ─────────────────────────────────────────────\n\n const dropdownContent = useMemo(() => {\n if (loading) {\n return (\n <div className=\"eidos-combobox-loading\">\n <Loader2 className=\"eidos-combobox-loading-icon\" />\n <span>{loadingText}</span>\n </div>\n );\n }\n\n if (filteredOptions.length === 0) {\n return <div className=\"eidos-combobox-empty\">{emptyText}</div>;\n }\n\n return optionEntries.map((entry) => {\n if (entry.type === 'group') {\n return (\n <div key={entry.key} className=\"eidos-combobox-option-group-label\">\n {entry.group}\n </div>\n );\n }\n return renderOptionItem(entry.option, entry.index);\n });\n }, [loading, loadingText, filteredOptions.length, emptyText, optionEntries, renderOptionItem]);\n\n // ─── posIcon / posIconButton wiring ───────────────────────────────────────\n\n const hasClearableValue = clearable && !!inputValue;\n const posIcon = hasClearableValue ? X : ChevronDown;\n const posIconClick = hasClearableValue ? handleClearClick : handleChevronClick;\n\n // ─── CSS classes ──────────────────────────────────────────────────────────\n\n const containerClasses = [\n 'eidos-combobox',\n fullWidth && 'eidos-combobox--full-width',\n error && 'eidos-combobox--error',\n disabled && 'eidos-combobox--disabled',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const maxHeightValue = typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight;\n\n // ─── Render ───────────────────────────────────────────────────────────────\n\n return (\n // No ARIA on this wrapper.\n //\n // It carried `aria-expanded` and `aria-haspopup` while having no role at\n // all, which is invalid - both are only meaningful on an element whose\n // role supports them. They belong on the input, which is the combobox.\n <div ref={containerRef} className={containerClasses}>\n <div ref={comboboxTriggerRef} className=\"eidos-combobox-trigger\">\n {/*\n The Input is a direct child of eidos-combobox-trigger.\n It is NOT inside the Dropdown trigger div, so clicking it\n never bubbles to Dropdown.handleTriggerClick and never\n accidentally toggles the dropdown closed mid-edit.\n */}\n <Input\n ref={inputRef}\n value={inputValue}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled}\n size={size}\n fullWidth\n label={label}\n clearable={false} // we render our own clear via posIcon\n isSelect={false}\n posIcon={posIcon}\n posIconButton\n onPosIconClick={posIconClick}\n // The same button does two jobs depending on state, so the name\n // has to follow the icon - \"Clear\" on a chevron would be a lie.\n posIconLabel={hasClearableValue ? 'Clear selection' : 'Show options'}\n // The ARIA 1.2 combobox pattern: the input *is* the combobox.\n role=\"combobox\"\n aria-expanded={isOpen}\n // `Combobox` renders its own error message rather than passing\n // `error` down, so it does not inherit `Input`'s wiring and has to\n // associate the message itself (SC 3.3.1).\n aria-invalid={error ? true : undefined}\n aria-describedby={error ? `${uid}-error` : undefined}\n aria-autocomplete=\"list\"\n // Only while the listbox exists. `aria-controls` pointing at an id\n // that is not in the document is invalid, and that is what shipped\n // - the listbox only renders once the dropdown opens.\n aria-controls={isOpen ? `${uid}-listbox` : undefined}\n aria-activedescendant={focusedIndex >= 0 ? `${uid}-option-${focusedIndex}` : undefined}\n />\n\n {/*\n The Dropdown trigger is a 0-height span placed AFTER the Input\n in the normal document flow. Its getBoundingClientRect sits at\n exactly the bottom edge of the Input, giving the Dropdown correct\n placement without any click-toggle collision with the Input above.\n closeOnClickOutside and closeOnEscape are disabled because we own\n those interactions in our mousedown listener and onKeyDown handler.\n */}\n <Dropdown\n open={isOpen}\n onOpenChange={setIsOpen}\n // Positioning comes from `triggerRef` below; this span is only here\n // because a trigger is required. It used to carry a ref so that\n // `openDropdown` could click it.\n trigger={<span className=\"eidos-combobox-dropdown-anchor\" aria-hidden=\"true\" />}\n content={\n <div\n id={`${uid}-listbox`}\n className=\"eidos-combobox-options\"\n role=\"listbox\"\n aria-label={label ?? 'Options'}\n // Prevent the input from blurring when the user clicks an option,\n // and mark this event so the click-outside handler ignores it.\n onMouseDown={(e) => e.preventDefault()}\n >\n {dropdownContent}\n </div>\n }\n triggerRef={comboboxTriggerRef as React.RefObject<HTMLElement | null>}\n maxHeight={maxHeightValue}\n autoWidth\n closeOnClickOutside={false}\n closeOnEscape={false}\n />\n </div>\n\n {hint && !error && <span className=\"eidos-combobox-hint\">{hint}</span>}\n {error && (\n <span id={`${uid}-error`} className=\"eidos-combobox-error-message\">\n <CircleAlert className=\"eidos-combobox-error-icon\" />\n {error}\n </span>\n )}\n </div>\n );\n};\n\nCombobox.displayName = 'Combobox';\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/eidos-ui/eidos-ui/dist/chunk-EM4WYYFN.cjs","../src/components/Combobox/Combobox.component.tsx"],"names":["label"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACPA,8BAAgF;AAChF,2CAA4D;AA0chD,+CAAA;AA3bL,IAAM,SAAA,EAAoC,CAAC;AAAA,EAChD,QAAA,EAAU,CAAC,CAAA;AAAA,EACX,KAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA,EAAc,wBAAA;AAAA,EACd,QAAA,EAAU,KAAA;AAAA,EACV,YAA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BAAA;AACrB,MAAA;AAEJ,IAAA;AAEkC,IAAA;AACV,MAAA;AACxB,IAAA;AAEoC,IAAA;AACN,MAAA;AAEO,QAAA;AAInC,MAAA;AACiD,MAAA;AAClD,IAAA;AAC0D,EAAA;AAIpB,EAAA;AACD,EAAA;AACoB,EAAA;AAInC,EAAA;AACvB,IAAA;AACa,IAAA;AACJ,IAAA;AACG,IAAA;AACZ,IAAA;AAGS,EAAA;AAE+C,EAAA;AAI1D,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMqC,oBAAA;AACH,sBAAA;AAO5B,wBAAA;AAAC,UAAA;AAAA,UAAA;AACM,YAAA;AACE,YAAA;AACG,YAAA;AACD,YAAA;AACD,YAAA;AACG,YAAA;AACX,YAAA;AACA,YAAA;AACA,YAAA;AACS,YAAA;AACT,YAAA;AACW,YAAA;AACD,YAAA;AACV,YAAA;AACa,YAAA;AACG,YAAA;AAGkB,YAAA;AAE7B,YAAA;AACU,YAAA;AAIc,YAAA;AACc,YAAA;AACzB,YAAA;AAIyB,YAAA;AACM,YAAA;AAA4B,UAAA;AAC/E,QAAA;AAUA,wBAAA;AAAC,UAAA;AAAA,UAAA;AACO,YAAA;AACQ,YAAA;AAIW,YAAA;AAEvB,YAAA;AAAC,cAAA;AAAA,cAAA;AACW,gBAAA;AACA,gBAAA;AACL,gBAAA;AACgB,gBAAA;AAGgB,gBAAA;AAEpC,gBAAA;AAAA,cAAA;AACH,YAAA;AAEU,YAAA;AACD,YAAA;AACF,YAAA;AACY,YAAA;AACN,YAAA;AAAA,UAAA;AACjB,QAAA;AACF,MAAA;AAEmC,MAAA;AAEjB,MAAA;AACS,wBAAA;AACtB,QAAA;AACH,MAAA;AAEJ,IAAA;AAAA,EAAA;AAEJ;AAEuB;ADxL0C;AACA;AACA;AACA","file":"/home/runner/work/eidos-ui/eidos-ui/dist/chunk-EM4WYYFN.cjs","sourcesContent":[null,"import React, { useState, useCallback, useRef, useEffect, useMemo, useId } from 'react';\nimport { Check, ChevronDown, X, Loader2, CircleAlert } from 'lucide-react';\nimport { Input } from '../Input/Input.component';\nimport { Dropdown } from '../Dropdown/Dropdown.component';\n\nimport type { ComboboxProps, ComboboxOption } from './Combobox.types';\nimport './Combobox.scss';\n\n// ─── Types ───────────────────────────────────────────────────────────────────\n\ntype OptionEntry =\n | { type: 'group'; group: string; key: string }\n | { type: 'option'; option: ComboboxOption; index: number; key: string };\n\n// ─── Component ───────────────────────────────────────────────────────────────\n\nexport const Combobox: React.FC<ComboboxProps> = ({\n options = [],\n value,\n defaultValue,\n onChange,\n onSearch,\n placeholder = 'Search or select…',\n loading = false,\n loadingText = 'Searching…',\n emptyText = 'No results found',\n allowFreeText = false,\n clearable = true,\n disabled = false,\n size = 'md',\n label,\n error,\n hint,\n fullWidth = false,\n className = '',\n maxHeight = '300px',\n renderOption,\n}) => {\n const uid = useId();\n\n // ─── Refs ─────────────────────────────────────────────────────────────────\n\n /** Entire combobox wrapper - used for click-outside detection */\n const containerRef = useRef<HTMLDivElement>(null);\n\n /** The trigger wrapper div - passed to Dropdown as externalTriggerRef for width */\n const comboboxTriggerRef = useRef<HTMLDivElement>(null);\n\n /** The 0-height span that IS the Dropdown trigger element - programmatically clicked to open */\n\n /** Native input element */\n const inputRef = useRef<HTMLInputElement>(null);\n\n /** Focusable option divs for scroll-into-view */\n const optionRefs = useRef<(HTMLDivElement | null)[]>([]);\n\n /**\n * Synchronous open-state flag.\n * React state updates are async; reading this ref inside event handlers\n * gives us the true current value without waiting for a re-render.\n */\n const isOpenRef = useRef(false);\n\n // ─── State ────────────────────────────────────────────────────────────────\n\n const isControlled = value !== undefined;\n\n const getInitialInputValue = (): string => {\n const seed = isControlled ? value : defaultValue;\n if (!seed) return '';\n const match = options.find((o) => o.value === seed);\n return match ? match.label : allowFreeText ? seed : '';\n };\n\n const getInitialCommittedValue = (): string => {\n return isControlled ? (value ?? '') : (defaultValue ?? '');\n };\n\n const [inputValue, _setInputValue] = useState<string>(getInitialInputValue);\n const inputValueRef = useRef<string>(inputValue);\n const setInputValue = useCallback((v: string) => {\n inputValueRef.current = v;\n _setInputValue(v);\n }, []);\n\n const [committedValue, _setCommittedValue] = useState<string>(getInitialCommittedValue);\n const committedValueRef = useRef<string>(committedValue);\n const setCommittedValue = useCallback((v: string) => {\n committedValueRef.current = v;\n _setCommittedValue(v);\n }, []);\n\n const [isOpen, setIsOpen] = useState(false);\n const [focusedIndex, setFocusedIndex] = useState(-1);\n\n // ─── Sync controlled value ────────────────────────────────────────────────\n\n useEffect(() => {\n if (!isControlled) return;\n const v = value ?? '';\n const match = options.find((o) => o.value === v);\n const label = match ? match.label : allowFreeText ? v : '';\n setInputValue(label);\n setCommittedValue(v);\n }, [value, isControlled, options, allowFreeText, setInputValue, setCommittedValue]);\n\n // ─── Derived: filtered options ────────────────────────────────────────────\n\n const filteredOptions = useMemo<ComboboxOption[]>(() => {\n const q = inputValue.toLowerCase();\n if (!q) return options;\n return options.filter((o) => o.label.toLowerCase().includes(q));\n }, [options, inputValue]);\n\n // Reset focused index when the filtered set changes\n useEffect(() => {\n setFocusedIndex(-1);\n }, [filteredOptions]);\n\n // Keep optionRefs array in sync with filteredOptions length\n useEffect(() => {\n optionRefs.current = optionRefs.current.slice(0, filteredOptions.length);\n }, [filteredOptions.length]);\n\n // ─── Derived: option entries (with group headers) ─────────────────────────\n\n const optionEntries = useMemo<OptionEntry[]>(() => {\n const entries: OptionEntry[] = [];\n const hasGroups = filteredOptions.some((o) => o.group);\n\n if (!hasGroups) {\n filteredOptions.forEach((option, index) => {\n entries.push({ type: 'option', option, index, key: option.id });\n });\n return entries;\n }\n\n // Build ordered group map while preserving insertion order\n const groupMap = new Map<string | null, ComboboxOption[]>();\n for (const option of filteredOptions) {\n const g = option.group ?? null;\n if (!groupMap.has(g)) groupMap.set(g, []);\n groupMap.get(g)!.push(option);\n }\n\n let optionIndex = 0;\n for (const [group, opts] of groupMap.entries()) {\n if (group !== null) {\n entries.push({ type: 'group', group, key: `group-${group}` });\n }\n for (const option of opts) {\n entries.push({ type: 'option', option, index: optionIndex++, key: option.id });\n }\n }\n\n return entries;\n }, [filteredOptions]);\n\n // ─── Open / Close helpers ─────────────────────────────────────────────────\n\n /**\n * Open the dropdown by programmatically clicking the 0-height span trigger.\n * The click bubbles to div.eidos-dropdown-trigger → Dropdown.handleTriggerClick → opens.\n *\n * We set isOpenRef AFTER the synthetic click so that the Dropdown's toggle\n * handler fires while isOpenRef is still false (allowing it to open).\n */\n const openDropdown = useCallback(() => {\n if (isOpenRef.current || disabled) return;\n // This used to synthesise a click on a hidden zero-height `span` so it would\n // bubble to the dropdown's trigger wrapper, because the overlay kept its\n // open state private and a click was the only way to change it.\n isOpenRef.current = true;\n setIsOpen(true);\n }, [disabled]);\n\n /**\n * Close the dropdown, optionally reverting `inputValue` to the last committed\n * value. This used to close it by remounting the whole subtree through a\n * changing `key`.\n */\n const closeDropdown = useCallback(\n (revertInput = false) => {\n isOpenRef.current = false;\n setIsOpen(false);\n setFocusedIndex(-1);\n\n if (revertInput) {\n const match = options.find((o) => o.value === committedValueRef.current);\n setInputValue(match ? match.label : allowFreeText ? committedValueRef.current : '');\n }\n },\n [options, allowFreeText, setInputValue],\n );\n\n // ─── Click-outside detection ──────────────────────────────────────────────\n\n useEffect(() => {\n const handleMouseDown = (e: MouseEvent) => {\n if (!isOpenRef.current) return;\n // defaultPrevented is set by the listbox's onMouseDown - means the user\n // clicked an option in the portal, not truly outside the combobox.\n if (e.defaultPrevented) return;\n if (containerRef.current?.contains(e.target as Node)) return;\n\n // Focus leaving to a non-focusable target: validate and close\n isOpenRef.current = false;\n setIsOpen(false);\n setFocusedIndex(-1);\n\n const current = inputValueRef.current;\n const committed = committedValueRef.current;\n\n if (!allowFreeText) {\n const match = options.find((o) => o.label.toLowerCase() === current.toLowerCase());\n if (match) {\n if (match.value !== committed) {\n setCommittedValue(match.value);\n onChange?.(match.value);\n setInputValue(match.label);\n }\n } else {\n const revertMatch = options.find((o) => o.value === committed);\n setInputValue(revertMatch ? revertMatch.label : '');\n }\n } else {\n if (current !== committed) {\n setCommittedValue(current);\n onChange?.(current);\n }\n }\n };\n\n document.addEventListener('mousedown', handleMouseDown);\n return () => document.removeEventListener('mousedown', handleMouseDown);\n }, [allowFreeText, options, onChange, setCommittedValue, setInputValue]);\n\n // ─── Input handlers ───────────────────────────────────────────────────────\n\n const handleFocus = useCallback(() => {\n openDropdown();\n }, [openDropdown]);\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const query = e.target.value;\n setInputValue(query);\n onSearch?.(query);\n if (!isOpenRef.current) openDropdown();\n },\n [setInputValue, onSearch, openDropdown],\n );\n\n /**\n * On blur, validate the typed value against options.\n * A 0ms defer ensures a click on a posIcon button (X / chevron) inside the\n * Input completes its onClick before we run close logic, so we can check\n * document.activeElement reliably.\n */\n const handleBlur = useCallback(() => {\n setTimeout(() => {\n // If focus came back inside the container (e.g., posIcon button clicked),\n // don't close or validate yet.\n if (containerRef.current?.contains(document.activeElement)) return;\n\n // Read both refs *inside* the deferred callback, never captured at blur\n // time - that's the whole reason they're kept in sync by the setters.\n // Anything can run in the gap this 0ms defer opens, including the click\n // that caused the blur: a controlled consumer clearing `value` from\n // another control (e.g. DataGrid's \"Clear filters\", which resets every\n // quick filter at once) updates the refs via the sync effect, and stale\n // captured values would then resurrect the label that was just cleared.\n const current = inputValueRef.current;\n const committed = committedValueRef.current;\n\n // Close\n isOpenRef.current = false;\n setIsOpen(false);\n setFocusedIndex(-1);\n\n // Validate\n if (!allowFreeText) {\n const match = options.find((o) => o.label.toLowerCase() === current.toLowerCase());\n if (match) {\n if (match.value !== committed) {\n setCommittedValue(match.value);\n onChange?.(match.value);\n setInputValue(match.label);\n } else {\n // Normalize the display label (fix casing)\n setInputValue(match.label);\n }\n } else {\n // No match - revert to last committed value\n const revertMatch = options.find((o) => o.value === committed);\n setInputValue(revertMatch ? revertMatch.label : '');\n }\n } else {\n // allowFreeText: commit whatever the user typed\n if (current !== committed) {\n setCommittedValue(current);\n onChange?.(current);\n }\n }\n }, 0);\n }, [allowFreeText, options, onChange, setCommittedValue, setInputValue]);\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (disabled) return;\n\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n if (!isOpenRef.current) {\n openDropdown();\n setFocusedIndex(0);\n } else {\n setFocusedIndex((prev) => {\n const next = prev < filteredOptions.length - 1 ? prev + 1 : 0;\n setTimeout(\n () =>\n optionRefs.current[next]?.scrollIntoView({\n block: 'nearest',\n behavior: 'smooth',\n }),\n 0,\n );\n return next;\n });\n }\n break;\n\n case 'ArrowUp':\n e.preventDefault();\n if (!isOpenRef.current) {\n openDropdown();\n setFocusedIndex(filteredOptions.length - 1);\n } else {\n setFocusedIndex((prev) => {\n const next = prev > 0 ? prev - 1 : filteredOptions.length - 1;\n setTimeout(\n () =>\n optionRefs.current[next]?.scrollIntoView({\n block: 'nearest',\n behavior: 'smooth',\n }),\n 0,\n );\n return next;\n });\n }\n break;\n\n case 'Enter':\n e.preventDefault();\n if (isOpenRef.current && focusedIndex >= 0 && focusedIndex < filteredOptions.length) {\n handleOptionSelect(filteredOptions[focusedIndex]);\n } else if (allowFreeText && inputValue.trim()) {\n const trimmed = inputValue.trim();\n setCommittedValue(trimmed);\n onChange?.(trimmed);\n closeDropdown();\n }\n break;\n\n case 'Escape':\n e.preventDefault();\n if (isOpenRef.current) {\n closeDropdown(true /* revert */);\n }\n break;\n\n default:\n break;\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n disabled,\n filteredOptions,\n focusedIndex,\n allowFreeText,\n inputValue,\n onChange,\n openDropdown,\n closeDropdown,\n setCommittedValue,\n ],\n );\n\n // ─── Option selection ─────────────────────────────────────────────────────\n\n const handleOptionSelect = useCallback(\n (option: ComboboxOption) => {\n if (option.disabled) return;\n setInputValue(option.label);\n setCommittedValue(option.value);\n onChange?.(option.value);\n closeDropdown();\n // Return focus to the input so the user can continue interacting\n inputRef.current?.focus();\n },\n [onChange, closeDropdown, setInputValue, setCommittedValue],\n );\n\n // ─── Clear ────────────────────────────────────────────────────────────────\n\n const handleClearClick = useCallback(() => {\n setInputValue('');\n setCommittedValue('');\n onChange?.('');\n // Re-focus input so the user can immediately start typing again\n inputRef.current?.focus();\n }, [onChange, setInputValue, setCommittedValue]);\n\n // ─── Chevron toggle ───────────────────────────────────────────────────────\n\n const handleChevronClick = useCallback(() => {\n if (isOpenRef.current) {\n closeDropdown();\n } else {\n openDropdown();\n }\n }, [closeDropdown, openDropdown]);\n\n // ─── Render: individual option ────────────────────────────────────────────\n\n const renderOptionItem = useCallback(\n (option: ComboboxOption, index: number): React.ReactNode => {\n const isSelected = option.value === committedValue;\n const isFocused = index === focusedIndex;\n\n const classes = [\n 'eidos-combobox-option',\n isSelected && 'eidos-combobox-option--selected',\n isFocused && 'eidos-combobox-option--focused',\n option.disabled && 'eidos-combobox-option--disabled',\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <div\n key={option.id}\n ref={(el) => {\n optionRefs.current[index] = el;\n }}\n className={classes}\n onClick={() => handleOptionSelect(option)}\n onMouseEnter={() => !option.disabled && setFocusedIndex(index)}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={option.disabled}\n id={`${uid}-option-${index}`}\n >\n {renderOption ? (\n renderOption(option)\n ) : (\n <>\n <Check\n className={`eidos-combobox-option-icon${\n !isSelected ? ' eidos-combobox-option-icon--hidden' : ''\n }`}\n />\n <span className=\"eidos-combobox-option-label\">{option.label}</span>\n {option.description && (\n <span className=\"eidos-combobox-option-description\">{option.description}</span>\n )}\n </>\n )}\n </div>\n );\n },\n [committedValue, focusedIndex, handleOptionSelect, renderOption, uid],\n );\n\n // ─── Render: dropdown content ─────────────────────────────────────────────\n\n const dropdownContent = useMemo(() => {\n if (loading) {\n return (\n <div className=\"eidos-combobox-loading\">\n <Loader2 className=\"eidos-combobox-loading-icon\" />\n <span>{loadingText}</span>\n </div>\n );\n }\n\n if (filteredOptions.length === 0) {\n return <div className=\"eidos-combobox-empty\">{emptyText}</div>;\n }\n\n return optionEntries.map((entry) => {\n if (entry.type === 'group') {\n return (\n <div key={entry.key} className=\"eidos-combobox-option-group-label\">\n {entry.group}\n </div>\n );\n }\n return renderOptionItem(entry.option, entry.index);\n });\n }, [loading, loadingText, filteredOptions.length, emptyText, optionEntries, renderOptionItem]);\n\n // ─── posIcon / posIconButton wiring ───────────────────────────────────────\n\n const hasClearableValue = clearable && !!inputValue;\n const posIcon = hasClearableValue ? X : ChevronDown;\n const posIconClick = hasClearableValue ? handleClearClick : handleChevronClick;\n\n // ─── CSS classes ──────────────────────────────────────────────────────────\n\n const containerClasses = [\n 'eidos-combobox',\n fullWidth && 'eidos-combobox--full-width',\n error && 'eidos-combobox--error',\n disabled && 'eidos-combobox--disabled',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const maxHeightValue = typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight;\n\n // ─── Render ───────────────────────────────────────────────────────────────\n\n return (\n // No ARIA on this wrapper.\n //\n // It carried `aria-expanded` and `aria-haspopup` while having no role at\n // all, which is invalid - both are only meaningful on an element whose\n // role supports them. They belong on the input, which is the combobox.\n <div ref={containerRef} className={containerClasses}>\n <div ref={comboboxTriggerRef} className=\"eidos-combobox-trigger\">\n {/*\n The Input is a direct child of eidos-combobox-trigger.\n It is NOT inside the Dropdown trigger div, so clicking it\n never bubbles to Dropdown.handleTriggerClick and never\n accidentally toggles the dropdown closed mid-edit.\n */}\n <Input\n ref={inputRef}\n value={inputValue}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled}\n size={size}\n fullWidth\n label={label}\n clearable={false} // we render our own clear via posIcon\n isSelect={false}\n posIcon={posIcon}\n posIconButton\n onPosIconClick={posIconClick}\n // The same button does two jobs depending on state, so the name\n // has to follow the icon - \"Clear\" on a chevron would be a lie.\n posIconLabel={hasClearableValue ? 'Clear selection' : 'Show options'}\n // The ARIA 1.2 combobox pattern: the input *is* the combobox.\n role=\"combobox\"\n aria-expanded={isOpen}\n // `Combobox` renders its own error message rather than passing\n // `error` down, so it does not inherit `Input`'s wiring and has to\n // associate the message itself (SC 3.3.1).\n aria-invalid={error ? true : undefined}\n aria-describedby={error ? `${uid}-error` : undefined}\n aria-autocomplete=\"list\"\n // Only while the listbox exists. `aria-controls` pointing at an id\n // that is not in the document is invalid, and that is what shipped\n // - the listbox only renders once the dropdown opens.\n aria-controls={isOpen ? `${uid}-listbox` : undefined}\n aria-activedescendant={focusedIndex >= 0 ? `${uid}-option-${focusedIndex}` : undefined}\n />\n\n {/*\n The Dropdown trigger is a 0-height span placed AFTER the Input\n in the normal document flow. Its getBoundingClientRect sits at\n exactly the bottom edge of the Input, giving the Dropdown correct\n placement without any click-toggle collision with the Input above.\n closeOnClickOutside and closeOnEscape are disabled because we own\n those interactions in our mousedown listener and onKeyDown handler.\n */}\n <Dropdown\n open={isOpen}\n onOpenChange={setIsOpen}\n // Positioning comes from `triggerRef` below; this span is only here\n // because a trigger is required. It used to carry a ref so that\n // `openDropdown` could click it.\n trigger={<span className=\"eidos-combobox-dropdown-anchor\" aria-hidden=\"true\" />}\n content={\n <div\n id={`${uid}-listbox`}\n className=\"eidos-combobox-options\"\n role=\"listbox\"\n aria-label={label ?? 'Options'}\n // Prevent the input from blurring when the user clicks an option,\n // and mark this event so the click-outside handler ignores it.\n onMouseDown={(e) => e.preventDefault()}\n >\n {dropdownContent}\n </div>\n }\n triggerRef={comboboxTriggerRef as React.RefObject<HTMLElement | null>}\n maxHeight={maxHeightValue}\n autoWidth\n closeOnClickOutside={false}\n closeOnEscape={false}\n />\n </div>\n\n {hint && !error && <span className=\"eidos-combobox-hint\">{hint}</span>}\n {error && (\n <span id={`${uid}-error`} className=\"eidos-combobox-error-message\">\n <CircleAlert className=\"eidos-combobox-error-icon\" />\n {error}\n </span>\n )}\n </div>\n );\n};\n\nCombobox.displayName = 'Combobox';\n"]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-GE3QCXT7.js";
|
|
4
4
|
import {
|
|
5
5
|
Dropdown
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ECP5J27K.js";
|
|
7
7
|
|
|
8
8
|
// src/components/Combobox/Combobox.component.tsx
|
|
9
9
|
import { useState, useCallback, useRef, useEffect, useMemo, useId } from "react";
|
|
@@ -442,4 +442,4 @@ Combobox.displayName = "Combobox";
|
|
|
442
442
|
export {
|
|
443
443
|
Combobox
|
|
444
444
|
};
|
|
445
|
-
//# sourceMappingURL=chunk-
|
|
445
|
+
//# sourceMappingURL=chunk-EUQQG5WH.js.map
|
|
@@ -11,25 +11,25 @@ import {
|
|
|
11
11
|
useSensors,
|
|
12
12
|
useSortable,
|
|
13
13
|
verticalListSortingStrategy
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-AMVA62UC.js";
|
|
15
15
|
import {
|
|
16
16
|
SegmentedControl
|
|
17
17
|
} from "./chunk-BHZ76J2K.js";
|
|
18
18
|
import {
|
|
19
19
|
SplitButton
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-LPSRS5GI.js";
|
|
21
21
|
import {
|
|
22
22
|
Pagination
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-GVLQQGI3.js";
|
|
24
24
|
import {
|
|
25
25
|
Select
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-5TRO6CYR.js";
|
|
27
27
|
import {
|
|
28
28
|
Checkbox
|
|
29
29
|
} from "./chunk-DGXHR6FV.js";
|
|
30
30
|
import {
|
|
31
31
|
Combobox
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-EUQQG5WH.js";
|
|
33
33
|
import {
|
|
34
34
|
Input
|
|
35
35
|
} from "./chunk-GE3QCXT7.js";
|
|
@@ -41,10 +41,10 @@ import {
|
|
|
41
41
|
} from "./chunk-3TUCQAYL.js";
|
|
42
42
|
import {
|
|
43
43
|
Menu
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-VA23PQTA.js";
|
|
45
45
|
import {
|
|
46
46
|
Dropdown
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-ECP5J27K.js";
|
|
48
48
|
import {
|
|
49
49
|
Button
|
|
50
50
|
} from "./chunk-GHUEVNNU.js";
|
|
@@ -1725,4 +1725,4 @@ var DataGrid = Object.assign(DataGridInner, { displayName: "DataGrid" });
|
|
|
1725
1725
|
export {
|
|
1726
1726
|
DataGrid
|
|
1727
1727
|
};
|
|
1728
|
-
//# sourceMappingURL=chunk-
|
|
1728
|
+
//# sourceMappingURL=chunk-F2FGZFWF.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Select
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5TRO6CYR.js";
|
|
4
4
|
import {
|
|
5
5
|
Button
|
|
6
6
|
} from "./chunk-GHUEVNNU.js";
|
|
@@ -209,4 +209,4 @@ Pagination.displayName = "Pagination";
|
|
|
209
209
|
export {
|
|
210
210
|
Pagination
|
|
211
211
|
};
|
|
212
|
-
//# sourceMappingURL=chunk-
|
|
212
|
+
//# sourceMappingURL=chunk-GVLQQGI3.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkVY7DTPO3cjs = require('./chunk-VY7DTPO3.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkKF2OGUADcjs = require('./chunk-KF2OGUAD.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkCPRNLW4Mcjs = require('./chunk-CPRNLW4M.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _chunkNSA7ASZ7cjs = require('./chunk-NSA7ASZ7.cjs');
|
|
@@ -530,19 +530,23 @@ var Calendar = ({
|
|
|
530
530
|
}, []);
|
|
531
531
|
const handleMonthSelect = _react.useCallback.call(void 0,
|
|
532
532
|
(value) => {
|
|
533
|
-
if (typeof value
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
533
|
+
if (typeof value !== "string") return;
|
|
534
|
+
const month = Number.parseInt(value, 10);
|
|
535
|
+
if (!Number.isFinite(month)) return;
|
|
536
|
+
const newDate = currentDate.month(month);
|
|
537
|
+
if (!newDate.isValid()) return;
|
|
538
|
+
onMonthChange(newDate);
|
|
537
539
|
},
|
|
538
540
|
[currentDate, onMonthChange]
|
|
539
541
|
);
|
|
540
542
|
const handleYearSelect = _react.useCallback.call(void 0,
|
|
541
543
|
(value) => {
|
|
542
|
-
if (typeof value
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
544
|
+
if (typeof value !== "string") return;
|
|
545
|
+
const year = Number.parseInt(value, 10);
|
|
546
|
+
if (!Number.isFinite(year)) return;
|
|
547
|
+
const newDate = currentDate.year(year);
|
|
548
|
+
if (!newDate.isValid()) return;
|
|
549
|
+
onMonthChange(newDate);
|
|
546
550
|
},
|
|
547
551
|
[currentDate, onMonthChange]
|
|
548
552
|
);
|
|
@@ -645,12 +649,13 @@ var Calendar = ({
|
|
|
645
649
|
}
|
|
646
650
|
),
|
|
647
651
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "eidos-calendar-selectors", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
648
|
-
|
|
652
|
+
_chunkVY7DTPO3cjs.Select,
|
|
649
653
|
{
|
|
650
654
|
options: yearOptions,
|
|
651
655
|
value: currentDate.year().toString(),
|
|
652
656
|
onChange: handleYearSelect,
|
|
653
657
|
clearable: false,
|
|
658
|
+
fullWidth: true,
|
|
654
659
|
inputProps: { "aria-label": "Year" },
|
|
655
660
|
dropdownProps: {
|
|
656
661
|
dropdownGroup: "calendar-navigation"
|
|
@@ -678,12 +683,13 @@ var Calendar = ({
|
|
|
678
683
|
),
|
|
679
684
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "eidos-calendar-selectors", children: [
|
|
680
685
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
681
|
-
|
|
686
|
+
_chunkVY7DTPO3cjs.Select,
|
|
682
687
|
{
|
|
683
688
|
options: monthOptions,
|
|
684
689
|
value: currentDate.month().toString(),
|
|
685
690
|
onChange: handleMonthSelect,
|
|
686
691
|
clearable: false,
|
|
692
|
+
fullWidth: true,
|
|
687
693
|
inputProps: { "aria-label": "Month" },
|
|
688
694
|
dropdownProps: {
|
|
689
695
|
dropdownGroup: "calendar-navigation"
|
|
@@ -691,12 +697,13 @@ var Calendar = ({
|
|
|
691
697
|
}
|
|
692
698
|
),
|
|
693
699
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
694
|
-
|
|
700
|
+
_chunkVY7DTPO3cjs.Select,
|
|
695
701
|
{
|
|
696
702
|
options: yearOptions,
|
|
697
703
|
value: currentDate.year().toString(),
|
|
698
704
|
onChange: handleYearSelect,
|
|
699
705
|
clearable: false,
|
|
706
|
+
fullWidth: true,
|
|
700
707
|
inputProps: { "aria-label": "Year" },
|
|
701
708
|
dropdownProps: {
|
|
702
709
|
dropdownGroup: "calendar-navigation"
|
|
@@ -932,6 +939,7 @@ var DatePicker = ({
|
|
|
932
939
|
);
|
|
933
940
|
const handleCalendarMonthChange = _react.useCallback.call(void 0,
|
|
934
941
|
(index, newDate) => {
|
|
942
|
+
if (!newDate.isValid()) return;
|
|
935
943
|
if (!independentCalendars) {
|
|
936
944
|
const anchor = newDate.subtract(index, "month");
|
|
937
945
|
setCalendarDates(
|
|
@@ -1362,7 +1370,7 @@ var DatePicker = ({
|
|
|
1362
1370
|
{
|
|
1363
1371
|
className: `eidos-date-picker-container${fullWidth ? ` eidos-date-picker-container--full-width` : ""} ${className}`.trim(),
|
|
1364
1372
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1365
|
-
|
|
1373
|
+
_chunkCPRNLW4Mcjs.Dropdown,
|
|
1366
1374
|
{
|
|
1367
1375
|
open: isOpen,
|
|
1368
1376
|
onOpenChange: setIsOpen,
|
|
@@ -1388,4 +1396,4 @@ DatePicker.displayName = "DatePicker";
|
|
|
1388
1396
|
|
|
1389
1397
|
|
|
1390
1398
|
exports.Calendar = Calendar; exports.TimeInput = TimeInput; exports.DatePicker = DatePicker;
|
|
1391
|
-
//# sourceMappingURL=chunk-
|
|
1399
|
+
//# sourceMappingURL=chunk-J2GJGXGH.cjs.map
|