@plexui/ui 0.48.0 → 0.49.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/es/components/Dialog/Dialog.js +86 -7
- package/dist/es/components/Dialog/Dialog.js.map +1 -1
- package/dist/es/components/Dialog/index.js.map +1 -1
- package/dist/es/components/Field/Field.js +2 -2
- package/dist/es/components/Field/Field.js.map +1 -1
- package/dist/es/components/FileUpload/FileUpload.js +3 -2
- package/dist/es/components/FileUpload/FileUpload.js.map +1 -1
- package/dist/es/components/Icon/index.js +2 -0
- package/dist/es/components/Icon/index.js.map +1 -1
- package/dist/es/components/Icon/svg/ZoomIn.js +5 -0
- package/dist/es/components/Icon/svg/ZoomIn.js.map +1 -0
- package/dist/es/components/Icon/svg/ZoomOut.js +5 -0
- package/dist/es/components/Icon/svg/ZoomOut.js.map +1 -0
- package/dist/es/components/Popover/Popover.js +21 -2
- package/dist/es/components/Popover/Popover.js.map +1 -1
- package/dist/es/components/Slider/Slider.js +9 -3
- package/dist/es/components/Slider/Slider.js.map +1 -1
- package/dist/es/components/Sortable/Sortable.js +2 -2
- package/dist/es/components/Sortable/Sortable.js.map +1 -1
- package/dist/es/components/Sortable/index.js.map +1 -1
- package/dist/es/components/Tabs/Tabs.js +1 -1
- package/dist/es/components/Tabs/Tabs.js.map +1 -1
- package/dist/es/lib/sortable.js +16 -4
- package/dist/es/lib/sortable.js.map +1 -1
- package/dist/types/components/Dialog/Dialog.d.ts +20 -1
- package/dist/types/components/Dialog/index.d.ts +1 -1
- package/dist/types/components/Field/Field.d.ts +12 -4
- package/dist/types/components/FileUpload/FileUpload.d.ts +11 -0
- package/dist/types/components/Icon/index.d.ts +2 -0
- package/dist/types/components/Icon/svg/ZoomIn.d.ts +6 -0
- package/dist/types/components/Icon/svg/ZoomOut.d.ts +6 -0
- package/dist/types/components/Popover/Popover.d.ts +7 -0
- package/dist/types/components/Slider/Slider.d.ts +9 -0
- package/dist/types/components/Sortable/Sortable.d.ts +13 -2
- package/dist/types/components/Sortable/index.d.ts +1 -1
- package/dist/types/lib/sortable.d.ts +3 -0
- package/package.json +2 -2
|
@@ -147,7 +147,24 @@ const Trigger = ({ children, onPointerDown, onClick, }) => {
|
|
|
147
147
|
}
|
|
148
148
|
: undefined, children: children }) }));
|
|
149
149
|
};
|
|
150
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Anchors the popover to an element that is not its trigger, such as a bar button that keeps its own action: the
|
|
152
|
+
* popover stands at it, a press on it is not outside, and focus returns to it on close. Open the popover with `open`.
|
|
153
|
+
*/
|
|
154
|
+
const Anchor = ({ element }) => {
|
|
155
|
+
const { triggerRef } = usePopoverContext();
|
|
156
|
+
const virtualRef = useMemo(() => ({ current: element }), [element]);
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
if (!element)
|
|
159
|
+
return undefined;
|
|
160
|
+
const ref = triggerRef;
|
|
161
|
+
ref.current = element;
|
|
162
|
+
return () => { if (ref.current === element)
|
|
163
|
+
ref.current = null; };
|
|
164
|
+
}, [element, triggerRef]);
|
|
165
|
+
return element ? _jsx(Popper.Anchor, { virtualRef: virtualRef }) : null;
|
|
166
|
+
};
|
|
167
|
+
const ContentImpl = ({ children, avoidCollisions, collisionPadding = 20, width, minWidth, maxWidth, side, sideOffset = 8, align, alignOffset, translucent, className, autoFocus = true, zIndex, "aria-labelledby": labelledBy, ...restProps }) => {
|
|
151
168
|
const { showOnHover, shake, contentRef, contentId, triggerRef, setOpen, open } = usePopoverContext();
|
|
152
169
|
const [contentNode, setContentNode] = useState(null);
|
|
153
170
|
const contentMergedRef = useMemo(() => mergeRefs([contentRef, setContentNode]), [contentRef]);
|
|
@@ -212,10 +229,11 @@ const ContentImpl = ({ children, avoidCollisions, collisionPadding = 20, width,
|
|
|
212
229
|
queueMicrotask(() => contentElement.focus({ preventScroll: true }));
|
|
213
230
|
}
|
|
214
231
|
}, [contentRef, showOnHover, autoFocus]);
|
|
215
|
-
return (_jsx(FocusScope, { asChild: true, loop: true, onMountAutoFocus: preventDefaultHandler, onUnmountAutoFocus: handleCloseAutoFocus, children: _jsx(DismissableLayer, { asChild: true, onPointerDownOutside: outsidePress.onPointerDownOutside, onFocusOutside: outsidePress.onFocusOutside, onDismiss: () => { interactedOutside.current = true; setOpen(false); }, onEscapeKeyDown: preventDefaultHandler, children: _jsx(Popper.Content, { id: contentId, role: "dialog", "data-state": open ? "open" : "closed", ...dataAttributes(restProps), ref: contentMergedRef, className: clsx(s.Popover, className), style: toCssVariables({
|
|
232
|
+
return (_jsx(FocusScope, { asChild: true, loop: true, onMountAutoFocus: preventDefaultHandler, onUnmountAutoFocus: handleCloseAutoFocus, children: _jsx(DismissableLayer, { asChild: true, onPointerDownOutside: outsidePress.onPointerDownOutside, onFocusOutside: outsidePress.onFocusOutside, onDismiss: () => { interactedOutside.current = true; setOpen(false); }, onEscapeKeyDown: preventDefaultHandler, children: _jsx(Popper.Content, { id: contentId, role: "dialog", "aria-labelledby": labelledBy, "data-state": open ? "open" : "closed", ...dataAttributes(restProps), ref: contentMergedRef, className: clsx(s.Popover, className), style: toCssVariables({
|
|
216
233
|
"popover-width": width,
|
|
217
234
|
"popover-min-width": minWidth,
|
|
218
235
|
"popover-max-width": maxWidth,
|
|
236
|
+
"popover-z-index": zIndex === undefined ? undefined : String(zIndex),
|
|
219
237
|
"radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
220
238
|
"radix-popover-content-available-width": "var(--radix-popper-available-width)",
|
|
221
239
|
"radix-popover-content-available-height": "var(--radix-popper-available-height)",
|
|
@@ -321,4 +339,5 @@ const Content = (props) => {
|
|
|
321
339
|
};
|
|
322
340
|
Popover.Trigger = Trigger;
|
|
323
341
|
Popover.Content = Content;
|
|
342
|
+
Popover.Anchor = Anchor;
|
|
324
343
|
//# sourceMappingURL=Popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../../src/components/Popover/Popover.tsx"],"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gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE;QAC1B,OAAO,CAAC,KAAK,CAAC,CAAA;IAChB,CAAC,CAAC,CAAA;IAEF,OAAO,CACL,KAAC,MAAM,CAAC,IAAI,IAAC,OAAO,kBAClB,KAAC,eAAe,OAAK,aAAa,EAAE,SAAS,EAAE,CAAC,CAAC,UAAU,EAAE,OAAO,kBACjE,IAAI;gBACH,CAAC,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,gBAAgB,OAAyB,KAAK,IAAzB,eAAe,CAAc,CACpD,CAAC,CAAC,CAAC,CACF,KAAC,WAAW,OAAmB,KAAK,IAAnB,SAAS,CAAc,CACzC,CAAC,GACY,GACN,CACf,CAAA;AACH,CAAC,CAAA;AAED,OAAO,CAAC,OAAO,GAAG,OAAO,CAAA;AACzB,OAAO,CAAC,OAAO,GAAG,OAAO,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { Portal, Slot } from \"radix-ui\"\nimport * as Popper from \"@radix-ui/react-popper\"\nimport { DismissableLayer } from \"@radix-ui/react-dismissable-layer\"\nimport { FocusScope, useFocusScopeBranch } from \"@radix-ui/react-focus-scope\"\nimport { useFocusGuards } from \"@radix-ui/react-focus-guards\"\nimport {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type KeyboardEventHandler,\n type MouseEventHandler,\n type PointerEventHandler,\n type ReactNode,\n} from \"react\"\nimport { mergeRefs } from \"react-merge-refs\"\nimport { FieldColumnsContext, FieldRowContext } from \"../../lib/fieldRow\"\nimport { useTimeout } from \"usehooks-ts\"\nimport { useEscCloseStack } from \"../../hooks/useEscCloseStack\"\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\nimport { dataAttributes, focusableElements, keepMovedFocus, preventDefaultHandler, toCssVariables } from \"../../lib/helpers\"\nimport { TransitionGroup } from \"../Transition\"\nimport { overlayTiming } from \"../Transition/shared\"\nimport { createPointerIntentArea, isPointInPolygon, type Polygon } from \"./pointerIntent\"\nimport { isHoverPointer } from \"../../lib/inputMode\"\nimport { useDeferredOutsidePress } from \"./deferredOutsidePress\"\nimport s from \"@plexui/styles/components/Popover/Popover.module.css\"\nimport { PopoverContext, usePopoverContext, type PopoverContextValue } from \"./usePopoverContext\"\n\nexport type PopoverProps = {\n /** Sets controlled visibility state */\n open?: boolean\n /** Callback invoked when visibility state changes */\n onOpenChange?: (nextState: boolean) => void\n showOnHover?: boolean\n hoverOpenDelay?: number\n children: React.ReactNode\n}\n\nexport const Popover = ({\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n showOnHover = false,\n hoverOpenDelay = 150,\n children,\n}: PopoverProps) => {\n const [open, setOpen] = useState<boolean>(false)\n const [shake, setShake] = useState<boolean>(false)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const openTimerRef = useRef<ReturnType<typeof setTimeout>>(undefined)\n const hoverOpenFocusedWithTab = useRef<boolean>(false)\n const isPointerInTransitRef = useRef<boolean>(false)\n const isOpen = controlledOpen ?? open\n const contentId = useId()\n\n const [temporarilyPreventClickToClose, setTemporarilyPreventClickToClose] =\n useState<boolean>(false)\n useTimeout(\n () => setTemporarilyPreventClickToClose(false),\n temporarilyPreventClickToClose ? 500 : null,\n )\n\n const latestOpenChange = useLatestValue(controlledOnOpenChange)\n\n const handleOpenChangeImpl = useLatestValue((nextState: boolean) => {\n clearTimeout(openTimerRef.current)\n\n // No-op if the state is not changing\n if (isOpen === nextState) {\n return\n }\n\n if (!nextState) {\n // clear any running shake animation on close\n setShake(false)\n\n // Check for specific hover conditions where focus should be\n // immediately restored to the trigger before closing\n if (showOnHover && hoverOpenFocusedWithTab.current) {\n triggerRef.current?.focus()\n }\n\n // Always cleanup this state\n hoverOpenFocusedWithTab.current = false\n }\n\n latestOpenChange.current?.(nextState)\n setOpen(nextState)\n\n if (showOnHover) {\n setTemporarilyPreventClickToClose(nextState)\n }\n })\n\n const handleOpenChange = useCallback(\n (nextState: boolean) => {\n handleOpenChangeImpl.current(nextState)\n },\n [handleOpenChangeImpl],\n )\n\n const handleTriggerEnter = useCallback(() => {\n openTimerRef.current = setTimeout(() => handleOpenChange(true), hoverOpenDelay)\n }, [handleOpenChange, hoverOpenDelay])\n\n const handleTriggerLeave = useCallback(() => {\n clearTimeout(openTimerRef.current)\n }, [])\n\n useEffect(() => {\n return () => {\n clearTimeout(openTimerRef.current)\n }\n }, [])\n\n const store = useMemo<PopoverContextValue>(\n () => ({\n open: isOpen,\n contentId,\n setOpen: handleOpenChange,\n shake,\n setShake,\n showOnHover,\n temporarilyPreventClickToClose,\n onTriggerEnter: handleTriggerEnter,\n onTriggerLeave: handleTriggerLeave,\n isPointerInTransitRef,\n triggerRef,\n contentRef,\n hoverOpenFocusedWithTab,\n }),\n [\n isOpen,\n contentId,\n handleOpenChange,\n shake,\n setShake,\n showOnHover,\n temporarilyPreventClickToClose,\n hoverOpenFocusedWithTab,\n isPointerInTransitRef,\n handleTriggerEnter,\n handleTriggerLeave,\n ],\n )\n\n return (\n <PopoverContext value={store}>\n <Popper.Root>\n {children}\n </Popper.Root>\n </PopoverContext>\n )\n}\n\nconst Trigger = ({\n children,\n onPointerDown,\n onClick,\n}: {\n children: React.ReactNode\n onPointerDown?: PointerEventHandler\n onClick?: MouseEventHandler\n}) => {\n const {\n open,\n contentId,\n setOpen,\n showOnHover,\n temporarilyPreventClickToClose,\n onTriggerEnter,\n onTriggerLeave,\n isPointerInTransitRef,\n triggerRef,\n contentRef,\n } = usePopoverContext()\n const hasPointerMoveOpenedRef = useRef<boolean>(false)\n\n const maybePreventClickClose = (evt: React.MouseEvent) => {\n // Don't prevent temporary close if the trigger is an anchor tag itself\n const isLink = evt.currentTarget.nodeName.toLocaleLowerCase() === \"a\"\n\n if (!isLink && temporarilyPreventClickToClose) {\n // Prevents tooltip listeners from closing\n evt.preventDefault()\n evt.stopPropagation()\n }\n }\n\n const handlePointerMove = (evt: React.PointerEvent) => {\n if (!isHoverPointer(evt)) {\n return\n }\n\n if (!hasPointerMoveOpenedRef.current && !isPointerInTransitRef.current) {\n onTriggerEnter()\n hasPointerMoveOpenedRef.current = true\n }\n }\n\n const handlePointerLeave = () => {\n if (!hasPointerMoveOpenedRef.current) {\n return\n }\n\n onTriggerLeave()\n hasPointerMoveOpenedRef.current = false\n }\n\n return (\n <Popper.Anchor asChild>\n <Slot.Root\n {...{ type: \"button\" }}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={open ? contentId : undefined}\n data-state={open ? \"open\" : \"closed\"}\n ref={triggerRef}\n onPointerDown={(evt) => {\n maybePreventClickClose(evt)\n onPointerDown?.(evt)\n }}\n onClick={(evt) => {\n maybePreventClickClose(evt)\n onClick?.(evt)\n if (!evt.defaultPrevented) setOpen(!open)\n }}\n onPointerMove={showOnHover ? handlePointerMove : undefined}\n onPointerLeave={showOnHover ? handlePointerLeave : undefined}\n onFocus={showOnHover ? () => setOpen(true) : undefined}\n onBlur={\n showOnHover\n ? () => {\n setTimeout(() => {\n // Ignore this handler if focus has moved into the popover\n if (contentRef.current?.contains(document.activeElement)) {\n return\n }\n\n setOpen(false)\n }, 50)\n }\n : undefined\n }\n >\n {children}\n </Slot.Root>\n </Popper.Anchor>\n )\n}\n\nexport type PopoverContentProps = {\n children: ReactNode\n /**\n * Whether to avoid collisions with the viewport and scroll containers.\n * @default true\n */\n avoidCollisions?: boolean\n /**\n * Distance in pixels to keep from viewport and scroll container boundaries; an object sets it per side, and a side it leaves out gets 0.\n * @default 20\n */\n collisionPadding?: Popper.PopperContentProps[\"collisionPadding\"]\n /**\n * Set the `width` of the popover, in pixels.\n * @default auto\n */\n width?: number | \"auto\"\n /**\n * Set the `min-width` of the popover, in pixels.\n * @default 300\n */\n minWidth?: number | \"auto\"\n /**\n * Set the `max-width` of the popover, in pixels.\n */\n maxWidth?: number\n /**\n * Background style for the popover\n * @default default\n */\n /**\n * The preferred side of the trigger to render against when open. Will be reversed when collisions occur.\n * @default bottom\n */\n side?: Popper.PopperContentProps[\"side\"]\n /**\n * The distance in pixels from the trigger.\n * @default 8\n */\n sideOffset?: Popper.PopperContentProps[\"sideOffset\"]\n /**\n * The preferred alignment against the trigger. May change when collisions occur.\n * @default center\n */\n align?: Popper.PopperContentProps[\"align\"]\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment options.\n * @default 0\n */\n alignOffset?: Popper.PopperContentProps[\"alignOffset\"]\n /**\n * Whether the popover surface should be translucent.\n * @default false\n */\n translucent?: boolean\n /** Additional class name to apply to the popover content, you usually don't want to set this, but ag-grid needs it to render a custom editor properly */\n className?: string\n /**\n * Auto focus the popover content when it is opened.\n * @default true\n */\n autoFocus?: boolean\n /** `data-*` attributes land on the popover */\n [dataAttribute: `data-${string}`]: unknown\n}\n\nconst ContentImpl = ({\n children,\n avoidCollisions,\n collisionPadding = 20,\n width,\n minWidth,\n maxWidth,\n side,\n sideOffset = 8,\n align,\n alignOffset,\n translucent,\n className,\n autoFocus = true,\n ...restProps\n}: PopoverContentProps) => {\n const { showOnHover, shake, contentRef, contentId, triggerRef, setOpen, open } = usePopoverContext()\n const [contentNode, setContentNode] = useState<HTMLDivElement | null>(null)\n const contentMergedRef = useMemo(() => mergeRefs([contentRef, setContentNode]), [contentRef])\n const interactedOutside = useRef(false)\n useFocusScopeBranch(contentNode)\n useFocusGuards()\n const outsidePress = useDeferredOutsidePress(() => {\n interactedOutside.current = true\n setOpen(false)\n }, triggerRef)\n const { reset: resetOutsidePress } = outsidePress\n useEffect(() => { if (!open) resetOutsidePress() }, [open, resetOutsidePress])\n const handleCloseAutoFocus = (event: Event) => {\n if (showOnHover) event.preventDefault()\n else keepMovedFocus(event)\n if (!event.defaultPrevented) {\n if (!interactedOutside.current) triggerRef.current?.focus({ preventScroll: true })\n event.preventDefault()\n }\n }\n\n const handleKeyDown: KeyboardEventHandler<HTMLDivElement> = (evt) => {\n const contentElement = contentRef.current\n\n if (\n // When the current target is our container\n contentElement &&\n evt.target === contentElement &&\n // We know that shift key tabs will lead to closing the popover (because we don't use `modal`)\n evt.key === \"Tab\" &&\n evt.shiftKey\n ) {\n // Prevent that from happening\n evt.preventDefault()\n evt.stopPropagation()\n\n // Move focus to the last focusable element, placing the user in the focus loop\n const focusable = focusableElements(contentElement)\n const lastFocusable = focusable[focusable.length - 1]\n lastFocusable?.focus()\n }\n }\n\n // Important that we send initial focus into the popover, placing it onto the container.\n // This allows focus looping to begin, as well as capturing scoped key presses.\n // We prevent Radix's default behavior of focusing an element, because this can have adverse side-effects.\n useEffect(() => {\n const contentElement = contentRef.current\n\n if (!contentElement || !autoFocus) {\n return\n }\n\n // If we're already focused within the content area, no-op.\n // This would be true if some inner component declares autoFocus\n if (contentElement?.contains(document.activeElement)) {\n return\n }\n\n // Our focus isn't in the content area - move it there.\n // NOTE: Don't automatically shift focus on hover popovers\n if (!showOnHover) {\n // In a microtask: until Radix's focus scope here has registered, a Dialog\n // around this content sends the focus straight back, and the content\n // takes that for focus moving outside and closes.\n queueMicrotask(() => contentElement.focus({ preventScroll: true }))\n }\n }, [contentRef, showOnHover, autoFocus])\n\n return (\n <FocusScope asChild loop onMountAutoFocus={preventDefaultHandler} onUnmountAutoFocus={handleCloseAutoFocus}>\n <DismissableLayer asChild\n onPointerDownOutside={outsidePress.onPointerDownOutside}\n onFocusOutside={outsidePress.onFocusOutside}\n onDismiss={() => { interactedOutside.current = true; setOpen(false) }}\n onEscapeKeyDown={preventDefaultHandler}\n >\n <Popper.Content\n id={contentId}\n role=\"dialog\"\n data-state={open ? \"open\" : \"closed\"}\n {...dataAttributes(restProps)}\n ref={contentMergedRef}\n className={clsx(s.Popover, className)}\n style={toCssVariables({\n \"popover-width\": width,\n \"popover-min-width\": minWidth,\n \"popover-max-width\": maxWidth,\n \"radix-popover-content-transform-origin\": \"var(--radix-popper-transform-origin)\",\n \"radix-popover-content-available-width\": \"var(--radix-popper-available-width)\",\n \"radix-popover-content-available-height\": \"var(--radix-popper-available-height)\",\n \"radix-popover-trigger-width\": \"var(--radix-popper-anchor-width)\",\n \"radix-popover-trigger-height\": \"var(--radix-popper-anchor-height)\",\n })}\n // data-surface={surface}\n data-animate={shake ? \"shake\" : undefined}\n data-translucent={translucent ? \"true\" : undefined}\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset ?? (align === \"center\" ? 0 : -5)}\n avoidCollisions={avoidCollisions ?? true}\n hideWhenDetached\n collisionPadding={collisionPadding}\n onKeyDown={handleKeyDown}\n >\n {/* A popup opened from a Field row is not that row: its own controls keep their usual shape and menus */}\n <FieldRowContext.Provider value={false}>\n <FieldColumnsContext.Provider value={false}>{children}</FieldColumnsContext.Provider>\n </FieldRowContext.Provider>\n </Popper.Content>\n </DismissableLayer>\n </FocusScope>\n )\n}\n\nconst ContentHoverable = (props: PopoverContentProps) => {\n const { open, setOpen, triggerRef, contentRef, isPointerInTransitRef, hoverOpenFocusedWithTab } =\n usePopoverContext()\n const [pointerGraceArea, setPointerGraceArea] = useState<Polygon | null>(null)\n\n const handleRemoveGraceArea = useCallback(() => {\n setPointerGraceArea(null)\n isPointerInTransitRef.current = false\n }, [isPointerInTransitRef])\n\n const handleCreateGraceArea = useCallback(\n (event: PointerEvent, hoverTarget: HTMLElement) => {\n if (!isHoverPointer(event)) return\n const graceArea = createPointerIntentArea(event, hoverTarget)\n setPointerGraceArea(graceArea)\n isPointerInTransitRef.current = true\n },\n [isPointerInTransitRef],\n )\n\n useEffect(() => {\n return () => handleRemoveGraceArea()\n }, [handleRemoveGraceArea])\n\n useEffect(() => {\n const trigger = triggerRef.current\n const content = contentRef.current\n\n if (!trigger || !content) {\n return\n }\n\n const handleTriggerLeave = (event: PointerEvent) => handleCreateGraceArea(event, content)\n const handleContentLeave = (event: PointerEvent) => handleCreateGraceArea(event, trigger)\n\n trigger.addEventListener(\"pointerleave\", handleTriggerLeave)\n content.addEventListener(\"pointerleave\", handleContentLeave)\n return () => {\n trigger.removeEventListener(\"pointerleave\", handleTriggerLeave)\n content.removeEventListener(\"pointerleave\", handleContentLeave)\n }\n }, [contentRef, triggerRef, handleCreateGraceArea, handleRemoveGraceArea])\n\n useEffect(() => {\n if (!pointerGraceArea) {\n return\n }\n\n const handleTrackPointerGrace = (event: PointerEvent) => {\n if (!isHoverPointer(event)) return\n const trigger = triggerRef.current\n const content = contentRef.current\n const target = event.target as HTMLElement\n const pointerPosition = { x: event.clientX, y: event.clientY }\n const hasEnteredTarget = trigger?.contains(target) || content?.contains(target)\n const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea)\n // Stop considering grace areas when the pointer runs into other control triggers\n const targetHasPopup = target.hasAttribute(\"aria-haspopup\")\n\n if (hasEnteredTarget) {\n handleRemoveGraceArea()\n } else if (isPointerOutsideGraceArea || targetHasPopup) {\n handleRemoveGraceArea()\n setOpen(false)\n }\n }\n document.addEventListener(\"pointermove\", handleTrackPointerGrace)\n return () => document.removeEventListener(\"pointermove\", handleTrackPointerGrace)\n }, [pointerGraceArea, setOpen, handleRemoveGraceArea, triggerRef, contentRef])\n\n // Hoverable doesn't place focus in the popover by default\n // If this is open, and tab is pressed, and focusableElements() has an element, prevent default behavior and focus it\n // Then set a flag (probably in context) that tells us to restore focus to the trigger on close (e.g., not execute the onCloseAutoFocus handler)\n\n useEffect(() => {\n // Closed and still leaving: Tab belongs to the page again\n if (!open) {\n return\n }\n\n const handleKeyDown = (evt: KeyboardEvent) => {\n if (!contentRef.current) {\n return\n }\n\n // Only assume forward tab is attempting to move into the popup\n if (evt.key === \"Tab\" && !evt.shiftKey) {\n const [firstFocusable] = focusableElements(contentRef.current)\n if (firstFocusable) {\n evt.preventDefault()\n firstFocusable.focus()\n hoverOpenFocusedWithTab.current = true\n document.removeEventListener(\"keydown\", handleKeyDown)\n }\n }\n }\n document.addEventListener(\"keydown\", handleKeyDown)\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown)\n }\n }, [open, contentRef, hoverOpenFocusedWithTab])\n\n return <ContentImpl {...props} />\n}\n\nconst Content = (props: PopoverContentProps) => {\n const { open, showOnHover, setOpen } = usePopoverContext()\n\n useEscCloseStack(open, () => {\n setOpen(false)\n })\n\n return (\n <Portal.Root asChild>\n <TransitionGroup {...overlayTiming} className={s.Transition} overlay>\n {open &&\n (showOnHover ? (\n <ContentHoverable key=\"popover-hover\" {...props} />\n ) : (\n <ContentImpl key=\"popover\" {...props} />\n ))}\n </TransitionGroup>\n </Portal.Root>\n )\n}\n\nPopover.Trigger = Trigger\nPopover.Content = Content\n"]}
|
|
1
|
+
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EACL,WAAW,EACX,SAAS,EACT,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GAKT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAC5H,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/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AAG,iBAAiB,EAAE,CAAA;IAE1D,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE;QAC1B,OAAO,CAAC,KAAK,CAAC,CAAA;IAChB,CAAC,CAAC,CAAA;IAEF,OAAO,CACL,KAAC,MAAM,CAAC,IAAI,IAAC,OAAO,kBAClB,KAAC,eAAe,OAAK,aAAa,EAAE,SAAS,EAAE,CAAC,CAAC,UAAU,EAAE,OAAO,kBACjE,IAAI;gBACH,CAAC,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,gBAAgB,OAAyB,KAAK,IAAzB,eAAe,CAAc,CACpD,CAAC,CAAC,CAAC,CACF,KAAC,WAAW,OAAmB,KAAK,IAAnB,SAAS,CAAc,CACzC,CAAC,GACY,GACN,CACf,CAAA;AACH,CAAC,CAAA;AAED,OAAO,CAAC,OAAO,GAAG,OAAO,CAAA;AACzB,OAAO,CAAC,OAAO,GAAG,OAAO,CAAA;AACzB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { Portal, Slot } from \"radix-ui\"\nimport * as Popper from \"@radix-ui/react-popper\"\nimport { DismissableLayer } from \"@radix-ui/react-dismissable-layer\"\nimport { FocusScope, useFocusScopeBranch } from \"@radix-ui/react-focus-scope\"\nimport { useFocusGuards } from \"@radix-ui/react-focus-guards\"\nimport {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type KeyboardEventHandler,\n type MouseEventHandler,\n type PointerEventHandler,\n type ReactNode,\n} from \"react\"\nimport { mergeRefs } from \"react-merge-refs\"\nimport { FieldColumnsContext, FieldRowContext } from \"../../lib/fieldRow\"\nimport { useTimeout } from \"usehooks-ts\"\nimport { useEscCloseStack } from \"../../hooks/useEscCloseStack\"\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\nimport { dataAttributes, focusableElements, keepMovedFocus, preventDefaultHandler, toCssVariables } from \"../../lib/helpers\"\nimport { TransitionGroup } from \"../Transition\"\nimport { overlayTiming } from \"../Transition/shared\"\nimport { createPointerIntentArea, isPointInPolygon, type Polygon } from \"./pointerIntent\"\nimport { isHoverPointer } from \"../../lib/inputMode\"\nimport { useDeferredOutsidePress } from \"./deferredOutsidePress\"\nimport s from \"@plexui/styles/components/Popover/Popover.module.css\"\nimport { PopoverContext, usePopoverContext, type PopoverContextValue } from \"./usePopoverContext\"\n\nexport type PopoverProps = {\n /** Sets controlled visibility state */\n open?: boolean\n /** Callback invoked when visibility state changes */\n onOpenChange?: (nextState: boolean) => void\n showOnHover?: boolean\n hoverOpenDelay?: number\n children: React.ReactNode\n}\n\nexport const Popover = ({\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n showOnHover = false,\n hoverOpenDelay = 150,\n children,\n}: PopoverProps) => {\n const [open, setOpen] = useState<boolean>(false)\n const [shake, setShake] = useState<boolean>(false)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const openTimerRef = useRef<ReturnType<typeof setTimeout>>(undefined)\n const hoverOpenFocusedWithTab = useRef<boolean>(false)\n const isPointerInTransitRef = useRef<boolean>(false)\n const isOpen = controlledOpen ?? open\n const contentId = useId()\n\n const [temporarilyPreventClickToClose, setTemporarilyPreventClickToClose] =\n useState<boolean>(false)\n useTimeout(\n () => setTemporarilyPreventClickToClose(false),\n temporarilyPreventClickToClose ? 500 : null,\n )\n\n const latestOpenChange = useLatestValue(controlledOnOpenChange)\n\n const handleOpenChangeImpl = useLatestValue((nextState: boolean) => {\n clearTimeout(openTimerRef.current)\n\n // No-op if the state is not changing\n if (isOpen === nextState) {\n return\n }\n\n if (!nextState) {\n // clear any running shake animation on close\n setShake(false)\n\n // Check for specific hover conditions where focus should be\n // immediately restored to the trigger before closing\n if (showOnHover && hoverOpenFocusedWithTab.current) {\n triggerRef.current?.focus()\n }\n\n // Always cleanup this state\n hoverOpenFocusedWithTab.current = false\n }\n\n latestOpenChange.current?.(nextState)\n setOpen(nextState)\n\n if (showOnHover) {\n setTemporarilyPreventClickToClose(nextState)\n }\n })\n\n const handleOpenChange = useCallback(\n (nextState: boolean) => {\n handleOpenChangeImpl.current(nextState)\n },\n [handleOpenChangeImpl],\n )\n\n const handleTriggerEnter = useCallback(() => {\n openTimerRef.current = setTimeout(() => handleOpenChange(true), hoverOpenDelay)\n }, [handleOpenChange, hoverOpenDelay])\n\n const handleTriggerLeave = useCallback(() => {\n clearTimeout(openTimerRef.current)\n }, [])\n\n useEffect(() => {\n return () => {\n clearTimeout(openTimerRef.current)\n }\n }, [])\n\n const store = useMemo<PopoverContextValue>(\n () => ({\n open: isOpen,\n contentId,\n setOpen: handleOpenChange,\n shake,\n setShake,\n showOnHover,\n temporarilyPreventClickToClose,\n onTriggerEnter: handleTriggerEnter,\n onTriggerLeave: handleTriggerLeave,\n isPointerInTransitRef,\n triggerRef,\n contentRef,\n hoverOpenFocusedWithTab,\n }),\n [\n isOpen,\n contentId,\n handleOpenChange,\n shake,\n setShake,\n showOnHover,\n temporarilyPreventClickToClose,\n hoverOpenFocusedWithTab,\n isPointerInTransitRef,\n handleTriggerEnter,\n handleTriggerLeave,\n ],\n )\n\n return (\n <PopoverContext value={store}>\n <Popper.Root>\n {children}\n </Popper.Root>\n </PopoverContext>\n )\n}\n\nconst Trigger = ({\n children,\n onPointerDown,\n onClick,\n}: {\n children: React.ReactNode\n onPointerDown?: PointerEventHandler\n onClick?: MouseEventHandler\n}) => {\n const {\n open,\n contentId,\n setOpen,\n showOnHover,\n temporarilyPreventClickToClose,\n onTriggerEnter,\n onTriggerLeave,\n isPointerInTransitRef,\n triggerRef,\n contentRef,\n } = usePopoverContext()\n const hasPointerMoveOpenedRef = useRef<boolean>(false)\n\n const maybePreventClickClose = (evt: React.MouseEvent) => {\n // Don't prevent temporary close if the trigger is an anchor tag itself\n const isLink = evt.currentTarget.nodeName.toLocaleLowerCase() === \"a\"\n\n if (!isLink && temporarilyPreventClickToClose) {\n // Prevents tooltip listeners from closing\n evt.preventDefault()\n evt.stopPropagation()\n }\n }\n\n const handlePointerMove = (evt: React.PointerEvent) => {\n if (!isHoverPointer(evt)) {\n return\n }\n\n if (!hasPointerMoveOpenedRef.current && !isPointerInTransitRef.current) {\n onTriggerEnter()\n hasPointerMoveOpenedRef.current = true\n }\n }\n\n const handlePointerLeave = () => {\n if (!hasPointerMoveOpenedRef.current) {\n return\n }\n\n onTriggerLeave()\n hasPointerMoveOpenedRef.current = false\n }\n\n return (\n <Popper.Anchor asChild>\n <Slot.Root\n {...{ type: \"button\" }}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={open ? contentId : undefined}\n data-state={open ? \"open\" : \"closed\"}\n ref={triggerRef}\n onPointerDown={(evt) => {\n maybePreventClickClose(evt)\n onPointerDown?.(evt)\n }}\n onClick={(evt) => {\n maybePreventClickClose(evt)\n onClick?.(evt)\n if (!evt.defaultPrevented) setOpen(!open)\n }}\n onPointerMove={showOnHover ? handlePointerMove : undefined}\n onPointerLeave={showOnHover ? handlePointerLeave : undefined}\n onFocus={showOnHover ? () => setOpen(true) : undefined}\n onBlur={\n showOnHover\n ? () => {\n setTimeout(() => {\n // Ignore this handler if focus has moved into the popover\n if (contentRef.current?.contains(document.activeElement)) {\n return\n }\n\n setOpen(false)\n }, 50)\n }\n : undefined\n }\n >\n {children}\n </Slot.Root>\n </Popper.Anchor>\n )\n}\n\n/**\n * Anchors the popover to an element that is not its trigger, such as a bar button that keeps its own action: the\n * popover stands at it, a press on it is not outside, and focus returns to it on close. Open the popover with `open`.\n */\nconst Anchor = ({ element }: { element: HTMLElement | null }) => {\n const { triggerRef } = usePopoverContext()\n const virtualRef = useMemo(() => ({ current: element }), [element])\n useEffect(() => {\n if (!element) return undefined\n const ref = triggerRef as { current: HTMLElement | null }\n ref.current = element\n return () => { if (ref.current === element) ref.current = null }\n }, [element, triggerRef])\n return element ? <Popper.Anchor virtualRef={virtualRef as { current: HTMLElement }} /> : null\n}\n\nexport type PopoverContentProps = {\n children: ReactNode\n /**\n * Whether to avoid collisions with the viewport and scroll containers.\n * @default true\n */\n avoidCollisions?: boolean\n /**\n * Distance in pixels to keep from viewport and scroll container boundaries; an object sets it per side, and a side it leaves out gets 0.\n * @default 20\n */\n collisionPadding?: Popper.PopperContentProps[\"collisionPadding\"]\n /**\n * Set the `width` of the popover, in pixels.\n * @default auto\n */\n width?: number | \"auto\"\n /**\n * Set the `min-width` of the popover, in pixels.\n * @default 300\n */\n minWidth?: number | \"auto\"\n /**\n * Set the `max-width` of the popover, in pixels.\n */\n maxWidth?: number\n /**\n * Background style for the popover\n * @default default\n */\n /**\n * The preferred side of the trigger to render against when open. Will be reversed when collisions occur.\n * @default bottom\n */\n side?: Popper.PopperContentProps[\"side\"]\n /**\n * The distance in pixels from the trigger.\n * @default 8\n */\n sideOffset?: Popper.PopperContentProps[\"sideOffset\"]\n /**\n * The preferred alignment against the trigger. May change when collisions occur.\n * @default center\n */\n align?: Popper.PopperContentProps[\"align\"]\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment options.\n * @default 0\n */\n alignOffset?: Popper.PopperContentProps[\"alignOffset\"]\n /**\n * Whether the popover surface should be translucent.\n * @default false\n */\n translucent?: boolean\n /** Additional class name to apply to the popover content, you usually don't want to set this, but ag-grid needs it to render a custom editor properly */\n className?: string\n /** Stack order of the popover, for one over a layer above 50, such as a dialog with its own `zIndex`. @default 50 */\n zIndex?: number\n /** The id of the element that names the popover, such as the question of a confirmation */\n \"aria-labelledby\"?: string\n /**\n * Auto focus the popover content when it is opened.\n * @default true\n */\n autoFocus?: boolean\n /** `data-*` attributes land on the popover */\n [dataAttribute: `data-${string}`]: unknown\n}\n\nconst ContentImpl = ({\n children,\n avoidCollisions,\n collisionPadding = 20,\n width,\n minWidth,\n maxWidth,\n side,\n sideOffset = 8,\n align,\n alignOffset,\n translucent,\n className,\n autoFocus = true,\n zIndex,\n \"aria-labelledby\": labelledBy,\n ...restProps\n}: PopoverContentProps) => {\n const { showOnHover, shake, contentRef, contentId, triggerRef, setOpen, open } = usePopoverContext()\n const [contentNode, setContentNode] = useState<HTMLDivElement | null>(null)\n const contentMergedRef = useMemo(() => mergeRefs([contentRef, setContentNode]), [contentRef])\n const interactedOutside = useRef(false)\n useFocusScopeBranch(contentNode)\n useFocusGuards()\n const outsidePress = useDeferredOutsidePress(() => {\n interactedOutside.current = true\n setOpen(false)\n }, triggerRef)\n const { reset: resetOutsidePress } = outsidePress\n useEffect(() => { if (!open) resetOutsidePress() }, [open, resetOutsidePress])\n const handleCloseAutoFocus = (event: Event) => {\n if (showOnHover) event.preventDefault()\n else keepMovedFocus(event)\n if (!event.defaultPrevented) {\n if (!interactedOutside.current) triggerRef.current?.focus({ preventScroll: true })\n event.preventDefault()\n }\n }\n\n const handleKeyDown: KeyboardEventHandler<HTMLDivElement> = (evt) => {\n const contentElement = contentRef.current\n\n if (\n // When the current target is our container\n contentElement &&\n evt.target === contentElement &&\n // We know that shift key tabs will lead to closing the popover (because we don't use `modal`)\n evt.key === \"Tab\" &&\n evt.shiftKey\n ) {\n // Prevent that from happening\n evt.preventDefault()\n evt.stopPropagation()\n\n // Move focus to the last focusable element, placing the user in the focus loop\n const focusable = focusableElements(contentElement)\n const lastFocusable = focusable[focusable.length - 1]\n lastFocusable?.focus()\n }\n }\n\n // Important that we send initial focus into the popover, placing it onto the container.\n // This allows focus looping to begin, as well as capturing scoped key presses.\n // We prevent Radix's default behavior of focusing an element, because this can have adverse side-effects.\n useEffect(() => {\n const contentElement = contentRef.current\n\n if (!contentElement || !autoFocus) {\n return\n }\n\n // If we're already focused within the content area, no-op.\n // This would be true if some inner component declares autoFocus\n if (contentElement?.contains(document.activeElement)) {\n return\n }\n\n // Our focus isn't in the content area - move it there.\n // NOTE: Don't automatically shift focus on hover popovers\n if (!showOnHover) {\n // In a microtask: until Radix's focus scope here has registered, a Dialog\n // around this content sends the focus straight back, and the content\n // takes that for focus moving outside and closes.\n queueMicrotask(() => contentElement.focus({ preventScroll: true }))\n }\n }, [contentRef, showOnHover, autoFocus])\n\n return (\n <FocusScope asChild loop onMountAutoFocus={preventDefaultHandler} onUnmountAutoFocus={handleCloseAutoFocus}>\n <DismissableLayer asChild\n onPointerDownOutside={outsidePress.onPointerDownOutside}\n onFocusOutside={outsidePress.onFocusOutside}\n onDismiss={() => { interactedOutside.current = true; setOpen(false) }}\n onEscapeKeyDown={preventDefaultHandler}\n >\n <Popper.Content\n id={contentId}\n role=\"dialog\"\n aria-labelledby={labelledBy}\n data-state={open ? \"open\" : \"closed\"}\n {...dataAttributes(restProps)}\n ref={contentMergedRef}\n className={clsx(s.Popover, className)}\n style={toCssVariables({\n \"popover-width\": width,\n \"popover-min-width\": minWidth,\n \"popover-max-width\": maxWidth,\n \"popover-z-index\": zIndex === undefined ? undefined : String(zIndex),\n \"radix-popover-content-transform-origin\": \"var(--radix-popper-transform-origin)\",\n \"radix-popover-content-available-width\": \"var(--radix-popper-available-width)\",\n \"radix-popover-content-available-height\": \"var(--radix-popper-available-height)\",\n \"radix-popover-trigger-width\": \"var(--radix-popper-anchor-width)\",\n \"radix-popover-trigger-height\": \"var(--radix-popper-anchor-height)\",\n })}\n // data-surface={surface}\n data-animate={shake ? \"shake\" : undefined}\n data-translucent={translucent ? \"true\" : undefined}\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset ?? (align === \"center\" ? 0 : -5)}\n avoidCollisions={avoidCollisions ?? true}\n hideWhenDetached\n collisionPadding={collisionPadding}\n onKeyDown={handleKeyDown}\n >\n {/* A popup opened from a Field row is not that row: its own controls keep their usual shape and menus */}\n <FieldRowContext.Provider value={false}>\n <FieldColumnsContext.Provider value={false}>{children}</FieldColumnsContext.Provider>\n </FieldRowContext.Provider>\n </Popper.Content>\n </DismissableLayer>\n </FocusScope>\n )\n}\n\nconst ContentHoverable = (props: PopoverContentProps) => {\n const { open, setOpen, triggerRef, contentRef, isPointerInTransitRef, hoverOpenFocusedWithTab } =\n usePopoverContext()\n const [pointerGraceArea, setPointerGraceArea] = useState<Polygon | null>(null)\n\n const handleRemoveGraceArea = useCallback(() => {\n setPointerGraceArea(null)\n isPointerInTransitRef.current = false\n }, [isPointerInTransitRef])\n\n const handleCreateGraceArea = useCallback(\n (event: PointerEvent, hoverTarget: HTMLElement) => {\n if (!isHoverPointer(event)) return\n const graceArea = createPointerIntentArea(event, hoverTarget)\n setPointerGraceArea(graceArea)\n isPointerInTransitRef.current = true\n },\n [isPointerInTransitRef],\n )\n\n useEffect(() => {\n return () => handleRemoveGraceArea()\n }, [handleRemoveGraceArea])\n\n useEffect(() => {\n const trigger = triggerRef.current\n const content = contentRef.current\n\n if (!trigger || !content) {\n return\n }\n\n const handleTriggerLeave = (event: PointerEvent) => handleCreateGraceArea(event, content)\n const handleContentLeave = (event: PointerEvent) => handleCreateGraceArea(event, trigger)\n\n trigger.addEventListener(\"pointerleave\", handleTriggerLeave)\n content.addEventListener(\"pointerleave\", handleContentLeave)\n return () => {\n trigger.removeEventListener(\"pointerleave\", handleTriggerLeave)\n content.removeEventListener(\"pointerleave\", handleContentLeave)\n }\n }, [contentRef, triggerRef, handleCreateGraceArea, handleRemoveGraceArea])\n\n useEffect(() => {\n if (!pointerGraceArea) {\n return\n }\n\n const handleTrackPointerGrace = (event: PointerEvent) => {\n if (!isHoverPointer(event)) return\n const trigger = triggerRef.current\n const content = contentRef.current\n const target = event.target as HTMLElement\n const pointerPosition = { x: event.clientX, y: event.clientY }\n const hasEnteredTarget = trigger?.contains(target) || content?.contains(target)\n const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea)\n // Stop considering grace areas when the pointer runs into other control triggers\n const targetHasPopup = target.hasAttribute(\"aria-haspopup\")\n\n if (hasEnteredTarget) {\n handleRemoveGraceArea()\n } else if (isPointerOutsideGraceArea || targetHasPopup) {\n handleRemoveGraceArea()\n setOpen(false)\n }\n }\n document.addEventListener(\"pointermove\", handleTrackPointerGrace)\n return () => document.removeEventListener(\"pointermove\", handleTrackPointerGrace)\n }, [pointerGraceArea, setOpen, handleRemoveGraceArea, triggerRef, contentRef])\n\n // Hoverable doesn't place focus in the popover by default\n // If this is open, and tab is pressed, and focusableElements() has an element, prevent default behavior and focus it\n // Then set a flag (probably in context) that tells us to restore focus to the trigger on close (e.g., not execute the onCloseAutoFocus handler)\n\n useEffect(() => {\n // Closed and still leaving: Tab belongs to the page again\n if (!open) {\n return\n }\n\n const handleKeyDown = (evt: KeyboardEvent) => {\n if (!contentRef.current) {\n return\n }\n\n // Only assume forward tab is attempting to move into the popup\n if (evt.key === \"Tab\" && !evt.shiftKey) {\n const [firstFocusable] = focusableElements(contentRef.current)\n if (firstFocusable) {\n evt.preventDefault()\n firstFocusable.focus()\n hoverOpenFocusedWithTab.current = true\n document.removeEventListener(\"keydown\", handleKeyDown)\n }\n }\n }\n document.addEventListener(\"keydown\", handleKeyDown)\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown)\n }\n }, [open, contentRef, hoverOpenFocusedWithTab])\n\n return <ContentImpl {...props} />\n}\n\nconst Content = (props: PopoverContentProps) => {\n const { open, showOnHover, setOpen } = usePopoverContext()\n\n useEscCloseStack(open, () => {\n setOpen(false)\n })\n\n return (\n <Portal.Root asChild>\n <TransitionGroup {...overlayTiming} className={s.Transition} overlay>\n {open &&\n (showOnHover ? (\n <ContentHoverable key=\"popover-hover\" {...props} />\n ) : (\n <ContentImpl key=\"popover\" {...props} />\n ))}\n </TransitionGroup>\n </Portal.Root>\n )\n}\n\nPopover.Trigger = Trigger\nPopover.Content = Content\nPopover.Anchor = Anchor\n"]}
|
|
@@ -45,7 +45,7 @@ const thumbPercentStyle = (value, min, max) => ({ "--slider-thumb-percent": Stri
|
|
|
45
45
|
*/
|
|
46
46
|
const thumbCentre = (percent, width, thumbHalf, clamped) => clamped ? clamp(percent * width, thumbHalf, width - thumbHalf) : percent * width + thumbHalf * (1 - 2 * percent);
|
|
47
47
|
export const Slider = memo((props) => {
|
|
48
|
-
const { className, onChange, min, max, step, disabled, value, onBlur, onFocus, unit, prefixUnit, label, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, marks: propMarks = [], trackColor, rangeColor, orientation = "horizontal", ref: forwardedRef, } = props;
|
|
48
|
+
const { className, onChange, min, max, step, disabled, value, onBlur, onFocus, unit, prefixUnit, label, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, marks: propMarks = [], trackColor, rangeColor, orientation = "horizontal", startAdornment, endAdornment, ref: forwardedRef, } = props;
|
|
49
49
|
const isRange = props.range === true;
|
|
50
50
|
const isVertical = orientation === "vertical";
|
|
51
51
|
// The direction Radix slides in: no `dir` is passed, so it is the one of a DirectionProvider, else left to right.
|
|
@@ -262,6 +262,12 @@ export const Slider = memo((props) => {
|
|
|
262
262
|
.map((v) => `${prefixUnit ?? ""}${v.toFixed(precision)}${unit ?? ""}`)
|
|
263
263
|
.join(" – ")
|
|
264
264
|
: "";
|
|
265
|
+
// `show && <Icon />` leaves false: no symbol, and no gutter for one. The grid takes the slider's direction, so the
|
|
266
|
+
// start symbol stays at the minimum
|
|
267
|
+
const shows = (node) => node != null && typeof node !== "boolean" && node !== "";
|
|
268
|
+
const hasStart = !isVertical && shows(startAdornment);
|
|
269
|
+
const hasEnd = !isVertical && shows(endAdornment);
|
|
270
|
+
const wrapAdorned = (container) => hasStart || hasEnd ? (_jsxs("div", { className: s.SliderAdorned, dir: direction, "data-disabled": disabled ? "" : undefined, children: [hasStart && _jsx("span", { className: s.Adornment, "data-side": "start", "aria-hidden": "true", children: startAdornment }), container, hasEnd && _jsx("span", { className: s.Adornment, "data-side": "end", "aria-hidden": "true", children: endAdornment })] })) : container;
|
|
265
271
|
return (_jsxs("div", { className: clsx(s.SliderWrap, className), "data-orientation": orientation, children: [label && (_jsxs("div", { className: s.SliderLabel, children: [_jsx("label", { htmlFor: isRange ? undefined : id, id: labelId, className: "flex-1", children: label }), !isRange && resetValue !== undefined && (_jsx(Tooltip, { content: resetTooltip, compact: true, children: _jsx(Button, { size: "2xs", variant: tabletAndUp ? "ghost" : "soft", color: "secondary", uniform: !tabletAndUp, pill: !tabletAndUp, className: s.Reset, "aria-label": resetTooltip, disabled: disabled, "data-hide": disabled || (resetValue === singleValue && !pointerDown), onClick: () => {
|
|
266
272
|
if (disabled)
|
|
267
273
|
return;
|
|
@@ -272,7 +278,7 @@ export const Slider = memo((props) => {
|
|
|
272
278
|
inputRef.current?.focus(); }, children: [prefixUnit && _jsx("span", { className: s.ValueUnit, children: prefixUnit }), _jsx("input", { id: id, className: s.ValueInput, ref: inputRef, style: { width: inputWidth }, onKeyDown: handleKeyDown, value: inputValue, type: "text", inputMode: min < 0 ? "text" : Number.isInteger(min) && Number.isInteger(max) && Number.isInteger(step) ? "numeric" : "decimal", onClick: (e) => e.stopPropagation(), onBlur: handleInputBlur, onFocus: (e) => {
|
|
273
279
|
e.currentTarget.setSelectionRange(0, e.currentTarget.value.length);
|
|
274
280
|
onFocus?.(e);
|
|
275
|
-
}, onChange: handleInputChange, disabled: disabled }), unit && _jsx("span", { className: s.ValueUnit, children: unit })] }))] })), _jsxs("div", { className: s.SliderContainer, children: [_jsxs(RadixSlider.Root, { ref: forwardedRef, className: s.Slider, onValueChange: handleValueChange, min: min, max: max, step: step, disabled: disabled, value: radixValue, orientation: orientation, minStepsBetweenThumbs: minStepsBetweenThumbs, onBlur: onBlur, onFocus: onFocus, onPointerDown: (event) => {
|
|
281
|
+
}, onChange: handleInputChange, disabled: disabled }), unit && _jsx("span", { className: s.ValueUnit, children: unit })] }))] })), wrapAdorned(_jsxs("div", { className: s.SliderContainer, children: [_jsxs(RadixSlider.Root, { ref: forwardedRef, className: s.Slider, onValueChange: handleValueChange, min: min, max: max, step: step, disabled: disabled, value: radixValue, orientation: orientation, minStepsBetweenThumbs: minStepsBetweenThumbs, onBlur: onBlur, onFocus: onFocus, onPointerDown: (event) => {
|
|
276
282
|
if (disabled)
|
|
277
283
|
return;
|
|
278
284
|
setPointerDown(true);
|
|
@@ -300,7 +306,7 @@ export const Slider = memo((props) => {
|
|
|
300
306
|
? {
|
|
301
307
|
"aria-label": `${ariaLabel} ${rangeThumbName(i, value.length)}`.trim(),
|
|
302
308
|
}
|
|
303
|
-
: {}) }, i)))) : (_jsx(RadixSlider.Thumb, { className: s.Thumb, style: thumbPercentStyle(value, min, max), ref: thumbRef, "aria-labelledby": nameId, ...(!nameId && ariaLabel ? { "aria-label": ariaLabel } : {}) }))] }), showMarks && _jsx(SliderMarks, { marks: marks, thumbRef: thumbRef, min: min, max: max })] })] }));
|
|
309
|
+
: {}) }, i)))) : (_jsx(RadixSlider.Thumb, { className: s.Thumb, style: thumbPercentStyle(value, min, max), ref: thumbRef, "aria-labelledby": nameId, ...(!nameId && ariaLabel ? { "aria-label": ariaLabel } : {}) }))] }), showMarks && _jsx(SliderMarks, { marks: marks, thumbRef: thumbRef, min: min, max: max })] }))] }));
|
|
304
310
|
});
|
|
305
311
|
Slider.displayName = "Slider";
|
|
306
312
|
// Matches the names Radix gives range thumbs on its own
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../../../src/components/Slider/Slider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,KAAK,MAAM,cAAc,CAAA;AAChC,OAAO,KAAK,MAAM,cAAc,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAKL,IAAI,EAEJ,WAAW,EACX,SAAS,EACT,KAAK,EACL,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,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E,CAAC,CAAC,WAAW,CAAA;AAC5E,CAAC,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport clamp from \"lodash/clamp\"\nimport round from \"lodash/round\"\nimport { Direction, Slider as RadixSlider } from \"radix-ui\"\nimport {\n type ChangeEventHandler,\n type ElementRef,\n type FocusEventHandler,\n type KeyboardEventHandler,\n memo,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport { useDebounceCallback, useResizeObserver } from \"usehooks-ts\"\nimport { useBreakpoint } from \"../../hooks/useBreakpoints\"\nimport { useIsMounted } from \"../../hooks/useIsMounted\"\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\nimport { usePrevious } from \"../../hooks/usePrevious\"\nimport { useStableCallback } from \"../../hooks/useStableCallback\"\nimport { toCssVariables } from \"../../lib/helpers\"\nimport { Button } from \"../Button\"\nimport { Reload } from \"../Icon\"\nimport { Tooltip } from \"../Tooltip\"\nimport s from \"@plexui/styles/components/Slider/Slider.module.css\"\n\nexport type SliderMark = {\n value: number\n label: string\n}\n\ntype SliderBaseProps = {\n /**\n * The minimum value the slider can have\n */\n min: number\n /**\n * The maximum value the slider can have\n */\n max: number\n /**\n * The step increment between slider values\n */\n step: number\n /**\n * Unit to display next to the slider value (e.g., ms, px)\n */\n unit?: string\n /**\n * Unit to display to the right of the slider value (e.g., $)\n */\n prefixUnit?: string\n /**\n * Optional label for the slider, which can be a string or React node.\n */\n label?: ReactNode\n /**\n * Accessible name for the slider when there is no visible `label`\n */\n \"aria-label\"?: string\n /**\n * Id of an element that names the slider; takes precedence over `label`\n */\n \"aria-labelledby\"?: string\n /**\n * List of marks to display below the slider track\n */\n marks?: SliderMark[]\n /**\n * Color of the slider track\n */\n trackColor?: string\n /**\n * Color of the slider progress along the track\n */\n rangeColor?: string\n className?: string\n disabled?: boolean\n /**\n * Orientation of the slider\n * @default \"horizontal\"\n */\n orientation?: \"horizontal\" | \"vertical\"\n onBlur?: FocusEventHandler<HTMLInputElement>\n onFocus?: FocusEventHandler<HTMLInputElement>\n ref?: React.Ref<ElementRef<typeof RadixSlider.Root> | null>\n}\n\ntype SingleSliderProps = SliderBaseProps & {\n /**\n * When false or omitted, the slider has a single thumb\n */\n range?: false\n /**\n * The current value of the slider\n */\n value: number\n /**\n * Callback function invoked when the slider value changes.\n */\n onChange: (value: number) => void\n /**\n * Value that will be offered as a \"reset to default\" option\n */\n resetValue?: number\n /**\n * String that will be displayed in the tooltip\n * @default Reset to default\n */\n resetTooltip?: string\n}\n\ntype RangeSliderProps = SliderBaseProps & {\n /**\n * When true, the slider supports multiple thumbs\n */\n range: true\n /**\n * Array of values, one per thumb\n */\n value: number[]\n /**\n * Callback function invoked when slider values change.\n */\n onChange: (value: number[]) => void\n /**\n * Minimum number of steps between thumbs\n */\n minStepsBetweenThumbs?: number\n}\n\nexport type SliderProps = SingleSliderProps | RangeSliderProps\n\n/**\n * A press on the track of a range moves the thumb whose value lies nearest the press, which Radix focuses only\n * once that value changes. Focusing it at once lets a phone draw the knob being pressed as the lens of glass\n * (Slider.module.css), even when the press leaves the value as it is. The thumb is the one Radix moves: the\n * pointer mapped onto min to max across the root (from the right in a right-to-left direction, which Radix\n * takes from a DirectionProvider), the nearest value, the first on a tie. A press on a thumb itself is left\n * to Radix, which focuses that thumb.\n */\nconst focusThumbToMove = (event: PointerEvent, root: HTMLElement, values: number[], min: number, max: number, vertical: boolean, rtl: boolean) => {\n const thumbs = Array.from(root.querySelectorAll<HTMLElement>('[role=\"slider\"]'))\n if (thumbs.includes(event.target as HTMLElement)) return\n const rect = root.getBoundingClientRect()\n const ratio = vertical ? (rect.bottom - event.clientY) / rect.height : (rtl ? rect.right - event.clientX : event.clientX - rect.left) / rect.width\n const pointerValue = min + ratio * (max - min)\n const distances = values.map((value) => Math.abs(value - pointerValue))\n const thumb = thumbs[distances.indexOf(Math.min(...distances))]\n if (thumb && thumb !== document.activeElement) thumb.focus({ preventScroll: true, focusVisible: false } as FocusOptions)\n}\n\n/** A knob's value from 0 to 1, by which a phone stands the knob on its value as iOS does (Slider.module.css). */\nconst thumbPercentStyle = (value: number, min: number, max: number) =>\n ({ \"--slider-thumb-percent\": String(max > min ? clamp((value - min) / (max - min), 0, 1) : 0) }) as React.CSSProperties\n\n/**\n * Where a knob's centre stands at a value (0 to 1), from the start of a track `width` wide. Radix eases the knob\n * over the whole track to keep it inside; on a phone it stands on the value and stops half its width from each\n * end, as iOS (`clamped`, Slider.module.css).\n */\nconst thumbCentre = (percent: number, width: number, thumbHalf: number, clamped: boolean) =>\n clamped ? clamp(percent * width, thumbHalf, width - thumbHalf) : percent * width + thumbHalf * (1 - 2 * percent)\n\nexport const Slider = memo((props: SliderProps) => {\n const {\n className,\n onChange,\n min,\n max,\n step,\n disabled,\n value,\n onBlur,\n onFocus,\n unit,\n prefixUnit,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n marks: propMarks = [],\n trackColor,\n rangeColor,\n orientation = \"horizontal\",\n ref: forwardedRef,\n } = props\n\n const isRange = props.range === true\n const isVertical = orientation === \"vertical\"\n // The direction Radix slides in: no `dir` is passed, so it is the one of a DirectionProvider, else left to right.\n const direction = Direction.useDirection()\n\n const id = useId()\n const labelId = `${id}-label`\n // What names the thumbs: an explicit labelledby, else the visible label\n const nameId = ariaLabelledBy ?? (label ? labelId : undefined)\n const precision = useMemo(() => String(step).split(\".\")[1]?.length ?? 0, [step])\n\n // Single-mode state for editable input\n const singleValue = isRange ? 0 : (value as number)\n const [inputValue, setInputValue] = useState<string>(\n isRange ? \"\" : String((value as number).toFixed(precision)),\n )\n const setInputValueNumber = useCallback(\n (nextValue: number) => {\n setInputValue(nextValue.toFixed(precision))\n },\n [precision],\n )\n\n // prevents input from jumping around while the user is typing\n const singleOnChange = isRange ? undefined : (onChange as (v: number) => void)\n // One debounced function for the slider's lifetime (calling the latest\n // onChange), so an immediate change can cancel the pending typed one\n const debouncedOnChange = useDebounceCallback(\n useStableCallback((nextValue: number) => {\n if (!disabled) singleOnChange?.(nextValue)\n }),\n 250,\n )\n const [pointerDown, setPointerDown] = useState(false)\n // A phone's reset is a button of its own beside the value (below)\n const tabletAndUp = useBreakpoint(\"md\")\n // A press ends where the finger lifts, even when something else takes the pointer away (a sheet that a touch\n // drags, a scroll the browser takes over): the slider's own pointerup never comes then, so the window hears the\n // lift and a lost capture ends the press too.\n const releasePress = useRef<(() => void) | null>(null)\n const endPress = useCallback(() => {\n releasePress.current?.()\n releasePress.current = null\n setPointerDown(false)\n }, [])\n useEffect(() => () => releasePress.current?.(), [])\n const [resetPending, setResetPending] = useState(false)\n // Read the controlled owner after a reset request, including a refused request.\n useEffect(() => {\n if (!resetPending) return\n setResetPending(false)\n if (!isRange) setInputValueNumber(singleValue)\n }, [resetPending, isRange, singleValue, setInputValueNumber])\n useEffect(() => () => debouncedOnChange.cancel(), [debouncedOnChange])\n useEffect(() => {\n if (!disabled) return\n debouncedOnChange.cancel()\n endPress()\n if (!isRange) setInputValueNumber(singleValue)\n }, [disabled, isRange, singleValue, setInputValueNumber, debouncedOnChange, endPress])\n const isMounted = useIsMounted()\n\n // Used to position the input over the thumb\n const inputRef = useRef<HTMLInputElement>(null)\n\n const inputWidth = getValueWidth(inputValue)\n\n // Calculate animation duration based on the distance the thumb needs to move\n // Skip custom animation for range mode — let Radix handle it\n const percent = isRange ? 0 : ((value as number) - min) / (max - min)\n const previousPercent = usePrevious(percent)\n const animationDurationMS =\n isRange || !isMounted || pointerDown\n ? 0\n : Math.max(Math.abs(percent - previousPercent) * 300, 100)\n\n // We assume that the width of the thumb does not change from render to render\n const thumbRef = useRef<HTMLDivElement>(null)\n\n // Sort marks for collision detection, again only when a value or label changes\n const marksKey = JSON.stringify(propMarks.map(({ value, label }) => [value, label]))\n const marks = useMemo<SliderMark[]>(\n () => [...propMarks].sort((a, b) => a.value - b.value),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [marksKey],\n )\n\n // Validate marks\n useEffect(() => {\n if (!marks) return\n const markValues = new Set<number>()\n for (const mark of marks) {\n if (mark.value < min || mark.value > max) {\n throw new Error(`Slider mark value ${mark.value} is out of bounds [${min}, ${max}]`)\n }\n if (markValues.has(mark.value)) {\n throw new Error(\"Slider marks must have unique values\")\n }\n markValues.add(mark.value)\n }\n }, [marks, max, min])\n\n // Update value if out of bounds (single mode only)\n const latestValue = useLatestValue(value)\n const latestOnChange = useLatestValue(onChange)\n useEffect(() => {\n if (isRange) return\n const v = latestValue.current as number\n const clamped = clamp(v, min, max)\n if (clamped !== v) {\n ;(latestOnChange.current as (v: number) => void)(clamped)\n setInputValueNumber(clamped)\n }\n }, [max, min, latestValue, latestOnChange, setInputValueNumber, isRange])\n\n useEffect(() => {\n if (isRange) return\n if (inputRef.current !== document.activeElement) {\n setInputValueNumber(value as number)\n }\n }, [value, setInputValueNumber, isRange])\n\n // Single-mode keyboard handler: a key's change replaces a pending typed one\n const handleKeyDown: KeyboardEventHandler<HTMLInputElement> = (evt) => {\n if (disabled || isRange || !singleOnChange) return\n if (evt.key === \"Home\") {\n evt.preventDefault()\n debouncedOnChange.cancel()\n singleOnChange(min)\n setInputValueNumber(min)\n }\n if (evt.key === \"End\") {\n evt.preventDefault()\n debouncedOnChange.cancel()\n singleOnChange(max)\n setInputValueNumber(max)\n }\n if (evt.key === \"ArrowUp\") {\n evt.preventDefault()\n const multiplier = evt.shiftKey ? 10 : 1\n const next = clamp(singleValue + step * multiplier, min, max)\n debouncedOnChange.cancel()\n singleOnChange(next)\n setInputValueNumber(next)\n }\n if (evt.key === \"ArrowDown\") {\n evt.preventDefault()\n const multiplier = evt.shiftKey ? 10 : 1\n const next = clamp(singleValue - step * multiplier, min, max)\n debouncedOnChange.cancel()\n singleOnChange(next)\n setInputValueNumber(next)\n }\n if (evt.key === \"Enter\" || evt.key === \"Escape\") {\n evt.preventDefault()\n evt.currentTarget.blur()\n }\n }\n\n const handleInputChange: ChangeEventHandler<HTMLInputElement> = (evt) => {\n if (disabled || isRange || !singleOnChange) return\n // Mobile decimal keyboards may use a comma. A minus is valid only below zero.\n const nextValue = evt.currentTarget.value.trim().replace(/,/g, \".\").replace(min < 0 ? /(?!^-)[^\\d.]/g : /[^\\d.]/g, \"\")\n debouncedOnChange.cancel()\n let parsed = parseFloat(nextValue || \"0\")\n if (Number.isNaN(parsed)) {\n // A lone \"-\" or \".\" is a number still being typed: nothing to report yet\n setInputValue(nextValue)\n return\n }\n parsed = clamp(parsed, min, max)\n if (step >= 1) {\n parsed = Math.floor(parsed)\n }\n debouncedOnChange(parsed)\n setInputValue(nextValue)\n }\n\n const handleInputBlur: FocusEventHandler<HTMLInputElement> = (evt) => {\n if (isRange || !singleOnChange) return\n // Blur commits the typed text, so its pending debounced change is dropped\n debouncedOnChange.cancel()\n if (disabled) {\n setInputValueNumber(singleValue)\n onBlur?.(evt)\n return\n }\n let parsed = parseFloat(evt.target.value.trim().replace(/,/g, \".\")) || 0\n if (step >= 1) {\n parsed = Math.floor(parsed)\n } else {\n parsed = round(parsed, precision)\n }\n parsed = clamp(parsed, min, max)\n if (parsed !== singleValue) {\n singleOnChange(parsed)\n }\n setInputValueNumber(parsed)\n onBlur?.(evt)\n }\n\n // Radix value/onChange wiring\n const radixValue = isRange ? (value as number[]) : [value as number]\n const handleValueChange = (values: number[]) => {\n if (disabled) return\n debouncedOnChange.cancel()\n if (isRange) (onChange as (v: number[]) => void)(values)\n else (onChange as (v: number) => void)(values[0])\n }\n\n // Single-mode props\n const resetValue = !isRange ? (props as SingleSliderProps).resetValue : undefined\n const resetTooltip = !isRange\n ? (props as SingleSliderProps).resetTooltip ?? \"Reset to default\"\n : undefined\n\n // Range-mode props\n const minStepsBetweenThumbs = isRange\n ? (props as RangeSliderProps).minStepsBetweenThumbs\n : undefined\n\n // Show marks only in horizontal orientation\n const showMarks = marks.length > 0 && !isVertical\n\n // Format range display text\n const rangeDisplayText = isRange\n ? (value as number[])\n .map((v) => `${prefixUnit ?? \"\"}${v.toFixed(precision)}${unit ?? \"\"}`)\n .join(\" – \")\n : \"\"\n\n return (\n <div\n className={clsx(s.SliderWrap, className)}\n data-orientation={orientation}\n >\n {label && (\n <div className={s.SliderLabel}>\n {/* Range mode renders no value input, so the label only names the thumbs */}\n <label htmlFor={isRange ? undefined : id} id={labelId} className=\"flex-1\">\n {label}\n </label>\n {!isRange && resetValue !== undefined && (\n <Tooltip content={resetTooltip!} compact>\n {/* A phone draws the reset as the small round gray button of the iOS 27 kit beside the row's value:\n uniform and soft, touch.css makes it the 28px circle that takes touches 44px around it. A desktop\n one is the bare glyph that shows on hover. */}\n <Button\n size=\"2xs\"\n variant={tabletAndUp ? \"ghost\" : \"soft\"}\n color=\"secondary\"\n uniform={!tabletAndUp}\n pill={!tabletAndUp}\n className={s.Reset}\n aria-label={resetTooltip}\n disabled={disabled}\n data-hide={disabled || (resetValue === singleValue && !pointerDown)}\n onClick={() => {\n if (disabled) return\n debouncedOnChange.cancel()\n singleOnChange?.(resetValue)\n setResetPending(true)\n }}\n >\n <Reload />\n </Button>\n </Tooltip>\n )}\n {isRange ? (\n <span className={s.RangeDisplay}>{rangeDisplayText}</span>\n ) : (\n <div className={s.SliderValue} onClick={() => { if (!disabled) inputRef.current?.focus() }}>\n {prefixUnit && <span className={s.ValueUnit}>{prefixUnit}</span>}\n <input\n id={id}\n className={s.ValueInput}\n ref={inputRef}\n style={{ width: inputWidth }}\n onKeyDown={handleKeyDown}\n value={inputValue}\n type=\"text\"\n inputMode={min < 0 ? \"text\" : Number.isInteger(min) && Number.isInteger(max) && Number.isInteger(step) ? \"numeric\" : \"decimal\"}\n onClick={(e) => e.stopPropagation()}\n onBlur={handleInputBlur}\n onFocus={(e) => {\n e.currentTarget.setSelectionRange(0, e.currentTarget.value.length)\n onFocus?.(e)\n }}\n onChange={handleInputChange}\n disabled={disabled}\n />\n {unit && <span className={s.ValueUnit}>{unit}</span>}\n </div>\n )}\n </div>\n )}\n <div className={s.SliderContainer}>\n <RadixSlider.Root\n ref={forwardedRef}\n className={s.Slider}\n onValueChange={handleValueChange}\n min={min}\n max={max}\n step={step}\n disabled={disabled}\n value={radixValue}\n orientation={orientation}\n minStepsBetweenThumbs={minStepsBetweenThumbs}\n onBlur={onBlur}\n onFocus={onFocus}\n onPointerDown={(event) => {\n if (disabled) return\n setPointerDown(true)\n releasePress.current?.()\n const { pointerId } = event\n const end = (lift: PointerEvent) => {\n if (lift.pointerId === pointerId) endPress()\n }\n window.addEventListener(\"pointerup\", end, true)\n window.addEventListener(\"pointercancel\", end, true)\n releasePress.current = () => {\n window.removeEventListener(\"pointerup\", end, true)\n window.removeEventListener(\"pointercancel\", end, true)\n }\n if (isRange) focusThumbToMove(event.nativeEvent, event.currentTarget, radixValue, min, max, isVertical, direction === \"rtl\")\n }}\n onPointerUp={endPress}\n onPointerCancel={endPress}\n onLostPointerCapture={endPress}\n data-pressed={pointerDown ? \"\" : undefined}\n data-range={isRange ? \"\" : undefined}\n style={toCssVariables({\n \"slider-duration\": `${animationDurationMS}ms`,\n \"slider-track-color\": trackColor,\n \"slider-range-color\": rangeColor,\n })}\n >\n <RadixSlider.Track className={s.Track}>\n <RadixSlider.Range className={s.Range} />\n </RadixSlider.Track>\n {isRange ? (\n (value as number[]).map((_, i) => (\n <RadixSlider.Thumb\n key={i}\n id={`${id}-thumb-${i}`}\n className={s.Thumb}\n style={thumbPercentStyle((value as number[])[i], min, max)}\n // The marks measure the first thumb (all thumbs are the same size)\n ref={i === 0 ? thumbRef : undefined}\n // Name plus the thumb's own Radix name (\"Minimum\" / \"Maximum\"),\n // so the endpoints stay distinguishable\n aria-labelledby={nameId ? `${nameId} ${id}-thumb-${i}` : undefined}\n // Only pass aria-label when set: an explicit undefined would\n // replace the name Radix gives the thumb\n {...(!nameId && ariaLabel\n ? {\n \"aria-label\":\n `${ariaLabel} ${rangeThumbName(i, (value as number[]).length)}`.trim(),\n }\n : {})}\n />\n ))\n ) : (\n <RadixSlider.Thumb\n className={s.Thumb}\n style={thumbPercentStyle(value as number, min, max)}\n ref={thumbRef}\n aria-labelledby={nameId}\n {...(!nameId && ariaLabel ? { \"aria-label\": ariaLabel } : {})}\n />\n )}\n </RadixSlider.Root>\n {showMarks && <SliderMarks marks={marks} thumbRef={thumbRef} min={min} max={max} />}\n </div>\n </div>\n )\n})\nSlider.displayName = \"Slider\"\n\n// Matches the names Radix gives range thumbs on its own\nconst rangeThumbName = (index: number, count: number) =>\n count === 2 ? (index === 0 ? \"Minimum\" : \"Maximum\") : count > 2 ? `Value ${index + 1} of ${count}` : \"\"\n\ntype MarksProps = {\n marks: SliderMark[]\n thumbRef: React.RefObject<HTMLDivElement | null>\n min: number\n max: number\n}\n\n// The minimum difference we enforce between marks, in pixels\nconst MINIMUM_MARK_SPACING_PX = 16\n\nconst SliderMarks = memo(({ marks, thumbRef, min, max }: MarksProps) => {\n // We seperate the container and measure divs so that our resize observer\n // does not fire when we adjust the height of the marks container.\n const marksContainerRef = useRef<HTMLDivElement>(null)\n const measureRef = useRef<HTMLDivElement>(null)\n\n // We measure the width of the slider within this component so that sliders\n // without marks do not pay a performance penalty.\n // @ts-expect-error(2322) -- bug in types: https://github.com/juliencrn/usehooks-ts/issues/663\n const { width: sliderWidth } = useResizeObserver({ ref: measureRef })\n // The knob's travel changes at the phone breakpoint (Slider.module.css), also where the width stays\n const tabletAndUp = useBreakpoint(\"md\")\n\n useLayoutEffect(() => {\n // Impossible\n if (!thumbRef.current || !marksContainerRef.current) {\n return\n }\n\n const markElements = Array.from(\n marksContainerRef.current.querySelectorAll(\"[data-mark]\"),\n ) as HTMLDivElement[]\n\n // Its layout width: a pressed knob is scaled into the lens\n const thumbHalfWidth = thumbRef.current.offsetWidth / 2\n const clamped = getComputedStyle(thumbRef.current).getPropertyValue(\"--slider-thumb-travel\").trim() === \"clamped\"\n\n // Wipe all styles so we can accurately determine the positions of the marks\n markElements.forEach((markEl) => {\n markEl.style.width = \"\"\n markEl.style.display = \"\"\n })\n\n const positionMarks = () => {\n if (!sliderWidth) {\n return\n }\n\n markElements.forEach((markEl, index) => {\n const markValue = marks[index].value\n const valuePercent = (markValue - min) / (max - min)\n const markWidth = markEl.getBoundingClientRect().width\n const markHalfWidth = markWidth / 2\n\n // Under the knob's centre at the mark's value, accounting for the width of the mark itself\n let left = thumbCentre(valuePercent, sliderWidth, thumbHalfWidth, clamped) - markHalfWidth\n\n // Clamp to the left and right bounds of the container\n left = Math.max(0, Math.min(left, sliderWidth - markWidth))\n\n markEl.style.left = `${left}px`\n })\n }\n\n const marksHaveCollisions = () => {\n for (let i = 0; i < markElements.length - 1; i++) {\n const currentRect = markElements[i].getBoundingClientRect()\n const nextRect = markElements[i + 1].getBoundingClientRect()\n\n if (currentRect.right + MINIMUM_MARK_SPACING_PX > nextRect.left) {\n return true\n }\n }\n return false\n }\n\n positionMarks()\n\n // If we have collisions, try to wrap the content\n if (marksHaveCollisions()) {\n markElements.forEach((markEl) => {\n markEl.style.width = \"min-content\"\n })\n\n positionMarks()\n\n // Hide all marks if we still have collisions\n if (marksHaveCollisions()) {\n markElements.forEach((markEl) => {\n markEl.style.display = \"none\"\n })\n }\n }\n\n const tallestHeight = Math.max(\n ...markElements.map((markEl) => markEl.getBoundingClientRect().height),\n )\n\n // Give our container a height so that we allocate space on the page\n // for the marks and push down other content when we have to wrap\n marksContainerRef.current.style.height = tallestHeight > 0 ? `${tallestHeight}px` : \"\"\n // Placed against the slider's width: the marks show, at their own height (Slider.module.css)\n if (sliderWidth) marksContainerRef.current.dataset.measured = \"\"\n }, [marks, thumbRef, marksContainerRef, min, max, sliderWidth, tabletAndUp])\n\n return (\n <div className={s.MarksContainer} ref={marksContainerRef}>\n <div ref={measureRef}>\n {marks.map((mark) => (\n <div key={mark.value} className={s.Mark} data-mark>\n <span className={s.MarkLabel}>{mark.label}</span>\n </div>\n ))}\n </div>\n </div>\n )\n})\nSliderMarks.displayName = \"SliderMarks\"\n\n/**\n * The value field is as wide as its characters at any font size: tabular digits are one `ch` each, and a sign,\n * a decimal point or a separator about half of one, so a right-aligned value sits next to its prefix unit.\n */\nconst getValueWidth = (text: string): string => {\n const digits = text.replace(/[^0-9]/g, \"\").length\n return `calc(${Math.max(digits + (text.length - digits) / 2, 1)}ch + 1px)`\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../../../src/components/Slider/Slider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,KAAK,MAAM,cAAc,CAAA;AAChC,OAAO,KAAK,MAAM,cAAc,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAKL,IAAI,EAEJ,WAAW,EACX,SAAS,EACT,KAAK,EACL,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,CAAC,MAAM,oDAAoD,CAAA;AAsHlE;;;;;;;GAOG;AACH,MAAM,gBAAgB,GAAG,CAAC,KAAmB,EAAE,IAAiB,EAAE,MAAgB,EAAE,GAAW,EAAE,GAAW,EAAE,QAAiB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K,CAEd,CACP,CAAC,GACE,GACF,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AACF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAA;AAEvC;;;GAGG;AACH,MAAM,aAAa,GAAG,CAAC,IAAY,EAAU,EAAE;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,MAAM,CAAA;IACjD,OAAO,QAAQ,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,WAAW,CAAA;AAC5E,CAAC,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport clamp from \"lodash/clamp\"\nimport round from \"lodash/round\"\nimport { Direction, Slider as RadixSlider } from \"radix-ui\"\nimport {\n type ChangeEventHandler,\n type ElementRef,\n type FocusEventHandler,\n type KeyboardEventHandler,\n memo,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport { useDebounceCallback, useResizeObserver } from \"usehooks-ts\"\nimport { useBreakpoint } from \"../../hooks/useBreakpoints\"\nimport { useIsMounted } from \"../../hooks/useIsMounted\"\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\nimport { usePrevious } from \"../../hooks/usePrevious\"\nimport { useStableCallback } from \"../../hooks/useStableCallback\"\nimport { toCssVariables } from \"../../lib/helpers\"\nimport { Button } from \"../Button\"\nimport { Reload } from \"../Icon\"\nimport { Tooltip } from \"../Tooltip\"\nimport s from \"@plexui/styles/components/Slider/Slider.module.css\"\n\nexport type SliderMark = {\n value: number\n label: string\n}\n\ntype SliderBaseProps = {\n /**\n * The minimum value the slider can have\n */\n min: number\n /**\n * The maximum value the slider can have\n */\n max: number\n /**\n * The step increment between slider values\n */\n step: number\n /**\n * Unit to display next to the slider value (e.g., ms, px)\n */\n unit?: string\n /**\n * Unit to display to the right of the slider value (e.g., $)\n */\n prefixUnit?: string\n /**\n * Optional label for the slider, which can be a string or React node.\n */\n label?: ReactNode\n /**\n * Accessible name for the slider when there is no visible `label`\n */\n \"aria-label\"?: string\n /**\n * Id of an element that names the slider; takes precedence over `label`\n */\n \"aria-labelledby\"?: string\n /**\n * List of marks to display below the slider track\n */\n marks?: SliderMark[]\n /**\n * Color of the slider track\n */\n trackColor?: string\n /**\n * Color of the slider progress along the track\n */\n rangeColor?: string\n className?: string\n disabled?: boolean\n /**\n * Orientation of the slider\n * @default \"horizontal\"\n */\n orientation?: \"horizontal\" | \"vertical\"\n /**\n * A symbol at the start of the track, for its least value: a small letter, a quieter speaker. Decorative: the label\n * names the slider. Horizontal only.\n */\n startAdornment?: ReactNode\n /**\n * A symbol at the end of the track, for its greatest value: a large letter, a louder speaker. Horizontal only.\n */\n endAdornment?: ReactNode\n onBlur?: FocusEventHandler<HTMLInputElement>\n onFocus?: FocusEventHandler<HTMLInputElement>\n ref?: React.Ref<ElementRef<typeof RadixSlider.Root> | null>\n}\n\ntype SingleSliderProps = SliderBaseProps & {\n /**\n * When false or omitted, the slider has a single thumb\n */\n range?: false\n /**\n * The current value of the slider\n */\n value: number\n /**\n * Callback function invoked when the slider value changes.\n */\n onChange: (value: number) => void\n /**\n * Value that will be offered as a \"reset to default\" option\n */\n resetValue?: number\n /**\n * String that will be displayed in the tooltip\n * @default Reset to default\n */\n resetTooltip?: string\n}\n\ntype RangeSliderProps = SliderBaseProps & {\n /**\n * When true, the slider supports multiple thumbs\n */\n range: true\n /**\n * Array of values, one per thumb\n */\n value: number[]\n /**\n * Callback function invoked when slider values change.\n */\n onChange: (value: number[]) => void\n /**\n * Minimum number of steps between thumbs\n */\n minStepsBetweenThumbs?: number\n}\n\nexport type SliderProps = SingleSliderProps | RangeSliderProps\n\n/**\n * A press on the track of a range moves the thumb whose value lies nearest the press, which Radix focuses only\n * once that value changes. Focusing it at once lets a phone draw the knob being pressed as the lens of glass\n * (Slider.module.css), even when the press leaves the value as it is. The thumb is the one Radix moves: the\n * pointer mapped onto min to max across the root (from the right in a right-to-left direction, which Radix\n * takes from a DirectionProvider), the nearest value, the first on a tie. A press on a thumb itself is left\n * to Radix, which focuses that thumb.\n */\nconst focusThumbToMove = (event: PointerEvent, root: HTMLElement, values: number[], min: number, max: number, vertical: boolean, rtl: boolean) => {\n const thumbs = Array.from(root.querySelectorAll<HTMLElement>('[role=\"slider\"]'))\n if (thumbs.includes(event.target as HTMLElement)) return\n const rect = root.getBoundingClientRect()\n const ratio = vertical ? (rect.bottom - event.clientY) / rect.height : (rtl ? rect.right - event.clientX : event.clientX - rect.left) / rect.width\n const pointerValue = min + ratio * (max - min)\n const distances = values.map((value) => Math.abs(value - pointerValue))\n const thumb = thumbs[distances.indexOf(Math.min(...distances))]\n if (thumb && thumb !== document.activeElement) thumb.focus({ preventScroll: true, focusVisible: false } as FocusOptions)\n}\n\n/** A knob's value from 0 to 1, by which a phone stands the knob on its value as iOS does (Slider.module.css). */\nconst thumbPercentStyle = (value: number, min: number, max: number) =>\n ({ \"--slider-thumb-percent\": String(max > min ? clamp((value - min) / (max - min), 0, 1) : 0) }) as React.CSSProperties\n\n/**\n * Where a knob's centre stands at a value (0 to 1), from the start of a track `width` wide. Radix eases the knob\n * over the whole track to keep it inside; on a phone it stands on the value and stops half its width from each\n * end, as iOS (`clamped`, Slider.module.css).\n */\nconst thumbCentre = (percent: number, width: number, thumbHalf: number, clamped: boolean) =>\n clamped ? clamp(percent * width, thumbHalf, width - thumbHalf) : percent * width + thumbHalf * (1 - 2 * percent)\n\nexport const Slider = memo((props: SliderProps) => {\n const {\n className,\n onChange,\n min,\n max,\n step,\n disabled,\n value,\n onBlur,\n onFocus,\n unit,\n prefixUnit,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n marks: propMarks = [],\n trackColor,\n rangeColor,\n orientation = \"horizontal\",\n startAdornment,\n endAdornment,\n ref: forwardedRef,\n } = props\n\n const isRange = props.range === true\n const isVertical = orientation === \"vertical\"\n // The direction Radix slides in: no `dir` is passed, so it is the one of a DirectionProvider, else left to right.\n const direction = Direction.useDirection()\n\n const id = useId()\n const labelId = `${id}-label`\n // What names the thumbs: an explicit labelledby, else the visible label\n const nameId = ariaLabelledBy ?? (label ? labelId : undefined)\n const precision = useMemo(() => String(step).split(\".\")[1]?.length ?? 0, [step])\n\n // Single-mode state for editable input\n const singleValue = isRange ? 0 : (value as number)\n const [inputValue, setInputValue] = useState<string>(\n isRange ? \"\" : String((value as number).toFixed(precision)),\n )\n const setInputValueNumber = useCallback(\n (nextValue: number) => {\n setInputValue(nextValue.toFixed(precision))\n },\n [precision],\n )\n\n // prevents input from jumping around while the user is typing\n const singleOnChange = isRange ? undefined : (onChange as (v: number) => void)\n // One debounced function for the slider's lifetime (calling the latest\n // onChange), so an immediate change can cancel the pending typed one\n const debouncedOnChange = useDebounceCallback(\n useStableCallback((nextValue: number) => {\n if (!disabled) singleOnChange?.(nextValue)\n }),\n 250,\n )\n const [pointerDown, setPointerDown] = useState(false)\n // A phone's reset is a button of its own beside the value (below)\n const tabletAndUp = useBreakpoint(\"md\")\n // A press ends where the finger lifts, even when something else takes the pointer away (a sheet that a touch\n // drags, a scroll the browser takes over): the slider's own pointerup never comes then, so the window hears the\n // lift and a lost capture ends the press too.\n const releasePress = useRef<(() => void) | null>(null)\n const endPress = useCallback(() => {\n releasePress.current?.()\n releasePress.current = null\n setPointerDown(false)\n }, [])\n useEffect(() => () => releasePress.current?.(), [])\n const [resetPending, setResetPending] = useState(false)\n // Read the controlled owner after a reset request, including a refused request.\n useEffect(() => {\n if (!resetPending) return\n setResetPending(false)\n if (!isRange) setInputValueNumber(singleValue)\n }, [resetPending, isRange, singleValue, setInputValueNumber])\n useEffect(() => () => debouncedOnChange.cancel(), [debouncedOnChange])\n useEffect(() => {\n if (!disabled) return\n debouncedOnChange.cancel()\n endPress()\n if (!isRange) setInputValueNumber(singleValue)\n }, [disabled, isRange, singleValue, setInputValueNumber, debouncedOnChange, endPress])\n const isMounted = useIsMounted()\n\n // Used to position the input over the thumb\n const inputRef = useRef<HTMLInputElement>(null)\n\n const inputWidth = getValueWidth(inputValue)\n\n // Calculate animation duration based on the distance the thumb needs to move\n // Skip custom animation for range mode — let Radix handle it\n const percent = isRange ? 0 : ((value as number) - min) / (max - min)\n const previousPercent = usePrevious(percent)\n const animationDurationMS =\n isRange || !isMounted || pointerDown\n ? 0\n : Math.max(Math.abs(percent - previousPercent) * 300, 100)\n\n // We assume that the width of the thumb does not change from render to render\n const thumbRef = useRef<HTMLDivElement>(null)\n\n // Sort marks for collision detection, again only when a value or label changes\n const marksKey = JSON.stringify(propMarks.map(({ value, label }) => [value, label]))\n const marks = useMemo<SliderMark[]>(\n () => [...propMarks].sort((a, b) => a.value - b.value),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [marksKey],\n )\n\n // Validate marks\n useEffect(() => {\n if (!marks) return\n const markValues = new Set<number>()\n for (const mark of marks) {\n if (mark.value < min || mark.value > max) {\n throw new Error(`Slider mark value ${mark.value} is out of bounds [${min}, ${max}]`)\n }\n if (markValues.has(mark.value)) {\n throw new Error(\"Slider marks must have unique values\")\n }\n markValues.add(mark.value)\n }\n }, [marks, max, min])\n\n // Update value if out of bounds (single mode only)\n const latestValue = useLatestValue(value)\n const latestOnChange = useLatestValue(onChange)\n useEffect(() => {\n if (isRange) return\n const v = latestValue.current as number\n const clamped = clamp(v, min, max)\n if (clamped !== v) {\n ;(latestOnChange.current as (v: number) => void)(clamped)\n setInputValueNumber(clamped)\n }\n }, [max, min, latestValue, latestOnChange, setInputValueNumber, isRange])\n\n useEffect(() => {\n if (isRange) return\n if (inputRef.current !== document.activeElement) {\n setInputValueNumber(value as number)\n }\n }, [value, setInputValueNumber, isRange])\n\n // Single-mode keyboard handler: a key's change replaces a pending typed one\n const handleKeyDown: KeyboardEventHandler<HTMLInputElement> = (evt) => {\n if (disabled || isRange || !singleOnChange) return\n if (evt.key === \"Home\") {\n evt.preventDefault()\n debouncedOnChange.cancel()\n singleOnChange(min)\n setInputValueNumber(min)\n }\n if (evt.key === \"End\") {\n evt.preventDefault()\n debouncedOnChange.cancel()\n singleOnChange(max)\n setInputValueNumber(max)\n }\n if (evt.key === \"ArrowUp\") {\n evt.preventDefault()\n const multiplier = evt.shiftKey ? 10 : 1\n const next = clamp(singleValue + step * multiplier, min, max)\n debouncedOnChange.cancel()\n singleOnChange(next)\n setInputValueNumber(next)\n }\n if (evt.key === \"ArrowDown\") {\n evt.preventDefault()\n const multiplier = evt.shiftKey ? 10 : 1\n const next = clamp(singleValue - step * multiplier, min, max)\n debouncedOnChange.cancel()\n singleOnChange(next)\n setInputValueNumber(next)\n }\n if (evt.key === \"Enter\" || evt.key === \"Escape\") {\n evt.preventDefault()\n evt.currentTarget.blur()\n }\n }\n\n const handleInputChange: ChangeEventHandler<HTMLInputElement> = (evt) => {\n if (disabled || isRange || !singleOnChange) return\n // Mobile decimal keyboards may use a comma. A minus is valid only below zero.\n const nextValue = evt.currentTarget.value.trim().replace(/,/g, \".\").replace(min < 0 ? /(?!^-)[^\\d.]/g : /[^\\d.]/g, \"\")\n debouncedOnChange.cancel()\n let parsed = parseFloat(nextValue || \"0\")\n if (Number.isNaN(parsed)) {\n // A lone \"-\" or \".\" is a number still being typed: nothing to report yet\n setInputValue(nextValue)\n return\n }\n parsed = clamp(parsed, min, max)\n if (step >= 1) {\n parsed = Math.floor(parsed)\n }\n debouncedOnChange(parsed)\n setInputValue(nextValue)\n }\n\n const handleInputBlur: FocusEventHandler<HTMLInputElement> = (evt) => {\n if (isRange || !singleOnChange) return\n // Blur commits the typed text, so its pending debounced change is dropped\n debouncedOnChange.cancel()\n if (disabled) {\n setInputValueNumber(singleValue)\n onBlur?.(evt)\n return\n }\n let parsed = parseFloat(evt.target.value.trim().replace(/,/g, \".\")) || 0\n if (step >= 1) {\n parsed = Math.floor(parsed)\n } else {\n parsed = round(parsed, precision)\n }\n parsed = clamp(parsed, min, max)\n if (parsed !== singleValue) {\n singleOnChange(parsed)\n }\n setInputValueNumber(parsed)\n onBlur?.(evt)\n }\n\n // Radix value/onChange wiring\n const radixValue = isRange ? (value as number[]) : [value as number]\n const handleValueChange = (values: number[]) => {\n if (disabled) return\n debouncedOnChange.cancel()\n if (isRange) (onChange as (v: number[]) => void)(values)\n else (onChange as (v: number) => void)(values[0])\n }\n\n // Single-mode props\n const resetValue = !isRange ? (props as SingleSliderProps).resetValue : undefined\n const resetTooltip = !isRange\n ? (props as SingleSliderProps).resetTooltip ?? \"Reset to default\"\n : undefined\n\n // Range-mode props\n const minStepsBetweenThumbs = isRange\n ? (props as RangeSliderProps).minStepsBetweenThumbs\n : undefined\n\n // Show marks only in horizontal orientation\n const showMarks = marks.length > 0 && !isVertical\n\n // Format range display text\n const rangeDisplayText = isRange\n ? (value as number[])\n .map((v) => `${prefixUnit ?? \"\"}${v.toFixed(precision)}${unit ?? \"\"}`)\n .join(\" – \")\n : \"\"\n\n // `show && <Icon />` leaves false: no symbol, and no gutter for one. The grid takes the slider's direction, so the\n // start symbol stays at the minimum\n const shows = (node: ReactNode) => node != null && typeof node !== \"boolean\" && node !== \"\"\n const hasStart = !isVertical && shows(startAdornment)\n const hasEnd = !isVertical && shows(endAdornment)\n const wrapAdorned = (container: ReactNode) =>\n hasStart || hasEnd ? (\n <div className={s.SliderAdorned} dir={direction} data-disabled={disabled ? \"\" : undefined}>\n {hasStart && <span className={s.Adornment} data-side=\"start\" aria-hidden=\"true\">{startAdornment}</span>}\n {container}\n {hasEnd && <span className={s.Adornment} data-side=\"end\" aria-hidden=\"true\">{endAdornment}</span>}\n </div>\n ) : container\n\n return (\n <div\n className={clsx(s.SliderWrap, className)}\n data-orientation={orientation}\n >\n {label && (\n <div className={s.SliderLabel}>\n {/* Range mode renders no value input, so the label only names the thumbs */}\n <label htmlFor={isRange ? undefined : id} id={labelId} className=\"flex-1\">\n {label}\n </label>\n {!isRange && resetValue !== undefined && (\n <Tooltip content={resetTooltip!} compact>\n {/* A phone draws the reset as the small round gray button of the iOS 27 kit beside the row's value:\n uniform and soft, touch.css makes it the 28px circle that takes touches 44px around it. A desktop\n one is the bare glyph that shows on hover. */}\n <Button\n size=\"2xs\"\n variant={tabletAndUp ? \"ghost\" : \"soft\"}\n color=\"secondary\"\n uniform={!tabletAndUp}\n pill={!tabletAndUp}\n className={s.Reset}\n aria-label={resetTooltip}\n disabled={disabled}\n data-hide={disabled || (resetValue === singleValue && !pointerDown)}\n onClick={() => {\n if (disabled) return\n debouncedOnChange.cancel()\n singleOnChange?.(resetValue)\n setResetPending(true)\n }}\n >\n <Reload />\n </Button>\n </Tooltip>\n )}\n {isRange ? (\n <span className={s.RangeDisplay}>{rangeDisplayText}</span>\n ) : (\n <div className={s.SliderValue} onClick={() => { if (!disabled) inputRef.current?.focus() }}>\n {prefixUnit && <span className={s.ValueUnit}>{prefixUnit}</span>}\n <input\n id={id}\n className={s.ValueInput}\n ref={inputRef}\n style={{ width: inputWidth }}\n onKeyDown={handleKeyDown}\n value={inputValue}\n type=\"text\"\n inputMode={min < 0 ? \"text\" : Number.isInteger(min) && Number.isInteger(max) && Number.isInteger(step) ? \"numeric\" : \"decimal\"}\n onClick={(e) => e.stopPropagation()}\n onBlur={handleInputBlur}\n onFocus={(e) => {\n e.currentTarget.setSelectionRange(0, e.currentTarget.value.length)\n onFocus?.(e)\n }}\n onChange={handleInputChange}\n disabled={disabled}\n />\n {unit && <span className={s.ValueUnit}>{unit}</span>}\n </div>\n )}\n </div>\n )}\n {/* With a symbol at either end the container is the middle column of a grid (Slider.module.css) */}\n {wrapAdorned(\n <div className={s.SliderContainer}>\n <RadixSlider.Root\n ref={forwardedRef}\n className={s.Slider}\n onValueChange={handleValueChange}\n min={min}\n max={max}\n step={step}\n disabled={disabled}\n value={radixValue}\n orientation={orientation}\n minStepsBetweenThumbs={minStepsBetweenThumbs}\n onBlur={onBlur}\n onFocus={onFocus}\n onPointerDown={(event) => {\n if (disabled) return\n setPointerDown(true)\n releasePress.current?.()\n const { pointerId } = event\n const end = (lift: PointerEvent) => {\n if (lift.pointerId === pointerId) endPress()\n }\n window.addEventListener(\"pointerup\", end, true)\n window.addEventListener(\"pointercancel\", end, true)\n releasePress.current = () => {\n window.removeEventListener(\"pointerup\", end, true)\n window.removeEventListener(\"pointercancel\", end, true)\n }\n if (isRange) focusThumbToMove(event.nativeEvent, event.currentTarget, radixValue, min, max, isVertical, direction === \"rtl\")\n }}\n onPointerUp={endPress}\n onPointerCancel={endPress}\n onLostPointerCapture={endPress}\n data-pressed={pointerDown ? \"\" : undefined}\n data-range={isRange ? \"\" : undefined}\n style={toCssVariables({\n \"slider-duration\": `${animationDurationMS}ms`,\n \"slider-track-color\": trackColor,\n \"slider-range-color\": rangeColor,\n })}\n >\n <RadixSlider.Track className={s.Track}>\n <RadixSlider.Range className={s.Range} />\n </RadixSlider.Track>\n {isRange ? (\n (value as number[]).map((_, i) => (\n <RadixSlider.Thumb\n key={i}\n id={`${id}-thumb-${i}`}\n className={s.Thumb}\n style={thumbPercentStyle((value as number[])[i], min, max)}\n // The marks measure the first thumb (all thumbs are the same size)\n ref={i === 0 ? thumbRef : undefined}\n // Name plus the thumb's own Radix name (\"Minimum\" / \"Maximum\"),\n // so the endpoints stay distinguishable\n aria-labelledby={nameId ? `${nameId} ${id}-thumb-${i}` : undefined}\n // Only pass aria-label when set: an explicit undefined would\n // replace the name Radix gives the thumb\n {...(!nameId && ariaLabel\n ? {\n \"aria-label\":\n `${ariaLabel} ${rangeThumbName(i, (value as number[]).length)}`.trim(),\n }\n : {})}\n />\n ))\n ) : (\n <RadixSlider.Thumb\n className={s.Thumb}\n style={thumbPercentStyle(value as number, min, max)}\n ref={thumbRef}\n aria-labelledby={nameId}\n {...(!nameId && ariaLabel ? { \"aria-label\": ariaLabel } : {})}\n />\n )}\n </RadixSlider.Root>\n {showMarks && <SliderMarks marks={marks} thumbRef={thumbRef} min={min} max={max} />}\n </div>,\n )}\n </div>\n )\n})\nSlider.displayName = \"Slider\"\n\n// Matches the names Radix gives range thumbs on its own\nconst rangeThumbName = (index: number, count: number) =>\n count === 2 ? (index === 0 ? \"Minimum\" : \"Maximum\") : count > 2 ? `Value ${index + 1} of ${count}` : \"\"\n\ntype MarksProps = {\n marks: SliderMark[]\n thumbRef: React.RefObject<HTMLDivElement | null>\n min: number\n max: number\n}\n\n// The minimum difference we enforce between marks, in pixels\nconst MINIMUM_MARK_SPACING_PX = 16\n\nconst SliderMarks = memo(({ marks, thumbRef, min, max }: MarksProps) => {\n // We seperate the container and measure divs so that our resize observer\n // does not fire when we adjust the height of the marks container.\n const marksContainerRef = useRef<HTMLDivElement>(null)\n const measureRef = useRef<HTMLDivElement>(null)\n\n // We measure the width of the slider within this component so that sliders\n // without marks do not pay a performance penalty.\n // @ts-expect-error(2322) -- bug in types: https://github.com/juliencrn/usehooks-ts/issues/663\n const { width: sliderWidth } = useResizeObserver({ ref: measureRef })\n // The knob's travel changes at the phone breakpoint (Slider.module.css), also where the width stays\n const tabletAndUp = useBreakpoint(\"md\")\n\n useLayoutEffect(() => {\n // Impossible\n if (!thumbRef.current || !marksContainerRef.current) {\n return\n }\n\n const markElements = Array.from(\n marksContainerRef.current.querySelectorAll(\"[data-mark]\"),\n ) as HTMLDivElement[]\n\n // Its layout width: a pressed knob is scaled into the lens\n const thumbHalfWidth = thumbRef.current.offsetWidth / 2\n const clamped = getComputedStyle(thumbRef.current).getPropertyValue(\"--slider-thumb-travel\").trim() === \"clamped\"\n\n // Wipe all styles so we can accurately determine the positions of the marks\n markElements.forEach((markEl) => {\n markEl.style.width = \"\"\n markEl.style.display = \"\"\n })\n\n const positionMarks = () => {\n if (!sliderWidth) {\n return\n }\n\n markElements.forEach((markEl, index) => {\n const markValue = marks[index].value\n const valuePercent = (markValue - min) / (max - min)\n const markWidth = markEl.getBoundingClientRect().width\n const markHalfWidth = markWidth / 2\n\n // Under the knob's centre at the mark's value, accounting for the width of the mark itself\n let left = thumbCentre(valuePercent, sliderWidth, thumbHalfWidth, clamped) - markHalfWidth\n\n // Clamp to the left and right bounds of the container\n left = Math.max(0, Math.min(left, sliderWidth - markWidth))\n\n markEl.style.left = `${left}px`\n })\n }\n\n const marksHaveCollisions = () => {\n for (let i = 0; i < markElements.length - 1; i++) {\n const currentRect = markElements[i].getBoundingClientRect()\n const nextRect = markElements[i + 1].getBoundingClientRect()\n\n if (currentRect.right + MINIMUM_MARK_SPACING_PX > nextRect.left) {\n return true\n }\n }\n return false\n }\n\n positionMarks()\n\n // If we have collisions, try to wrap the content\n if (marksHaveCollisions()) {\n markElements.forEach((markEl) => {\n markEl.style.width = \"min-content\"\n })\n\n positionMarks()\n\n // Hide all marks if we still have collisions\n if (marksHaveCollisions()) {\n markElements.forEach((markEl) => {\n markEl.style.display = \"none\"\n })\n }\n }\n\n const tallestHeight = Math.max(\n ...markElements.map((markEl) => markEl.getBoundingClientRect().height),\n )\n\n // Give our container a height so that we allocate space on the page\n // for the marks and push down other content when we have to wrap\n marksContainerRef.current.style.height = tallestHeight > 0 ? `${tallestHeight}px` : \"\"\n // Placed against the slider's width: the marks show, at their own height (Slider.module.css)\n if (sliderWidth) marksContainerRef.current.dataset.measured = \"\"\n }, [marks, thumbRef, marksContainerRef, min, max, sliderWidth, tabletAndUp])\n\n return (\n <div className={s.MarksContainer} ref={marksContainerRef}>\n <div ref={measureRef}>\n {marks.map((mark) => (\n <div key={mark.value} className={s.Mark} data-mark>\n <span className={s.MarkLabel}>{mark.label}</span>\n </div>\n ))}\n </div>\n </div>\n )\n})\nSliderMarks.displayName = \"SliderMarks\"\n\n/**\n * The value field is as wide as its characters at any font size: tabular digits are one `ch` each, and a sign,\n * a decimal point or a separator about half of one, so a right-aligned value sits next to its prefix unit.\n */\nconst getValueWidth = (text: string): string => {\n const digits = text.replace(/[^0-9]/g, \"\").length\n return `calc(${Math.max(digits + (text.length - digits) / 2, 1)}ch + 1px)`\n}\n"]}
|
|
@@ -9,7 +9,7 @@ import { GripVertical, Hamburger } from "../Icon/index.js";
|
|
|
9
9
|
import s from "@plexui/styles/components/Sortable/Sortable.module.css";
|
|
10
10
|
const preventNativeDrag = (event) => event.preventDefault();
|
|
11
11
|
/** Reorders its direct children by dragging, from anywhere but a control, or by a `Sortable.Handle` where grips are shown. */
|
|
12
|
-
export function Sortable({ value, onChange, layout = "list", as: Tag = "div", disabled = false, handles, group, name, onMove, onHold, className, children, onPointerDown, onKeyDown, ...rest }) {
|
|
12
|
+
export function Sortable({ value, onChange, layout = "list", as: Tag = "div", disabled = false, handles, handlePlacement, group, reach, name, onMove, onHold, className, children, onPointerDown, onKeyDown, ...rest }) {
|
|
13
13
|
const latest = useLatestValue({ value, onChange, onMove, onHold, name });
|
|
14
14
|
const cancelDrag = useRef(undefined);
|
|
15
15
|
useEffect(() => () => cancelDrag.current?.(), []);
|
|
@@ -44,7 +44,7 @@ export function Sortable({ value, onChange, layout = "list", as: Tag = "div", di
|
|
|
44
44
|
if (!disabled && !event.defaultPrevented)
|
|
45
45
|
void sortableKeyDown(event.nativeEvent, event.currentTarget, commit, link);
|
|
46
46
|
};
|
|
47
|
-
return (_jsx(Tag, { ...rest, className: clsx(s.Sortable, className), "data-sortable": "", "data-layout": layout, "data-disabled": disabled ? "" : undefined, "data-handles": handles?.toString(), "data-group": group, "data-name": name, onPointerDown: handlePointerDown, onKeyDown: handleKeyDown, onDragStart: preventNativeDrag, children: children }));
|
|
47
|
+
return (_jsx(Tag, { ...rest, className: clsx(s.Sortable, className), "data-sortable": "", "data-layout": layout, "data-disabled": disabled ? "" : undefined, "data-handles": handles?.toString(), "data-handle-placement": handlePlacement, "data-group": group, "data-reach": reach, "data-name": name, onPointerDown: handlePointerDown, onKeyDown: handleKeyDown, onDragStart: preventNativeDrag, children: children }));
|
|
48
48
|
}
|
|
49
49
|
/** The grip of an item. Arrow keys move the item while the handle has focus. */
|
|
50
50
|
function SortableHandle({ "aria-label": ariaLabel = "Reorder", className, children, ...rest }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":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,CAAC,CAAC,WAAW,wBAAgB,EAAA,KAAC,SAAS,IAAC,SAAS,EAAE,CAAC,CAAC,SAAS,uBAAc,mBAAmB,EAAC,MAAM,GAAG,IAAG,GAC7I,CACV,CAAA;AACH,CAAC;AAkBD,+FAA+F;AAC/F,SAAS,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,GAAG,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAuB;IAC/F,OAAO,KAAC,GAAG,OAAK,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,0BAAwB,KAAK,eAAa,IAAI,GAAI,CAAA;AAC9G,CAAC;AAED,QAAQ,CAAC,MAAM,GAAG,cAAc,CAAA;AAChC,QAAQ,CAAC,MAAM,GAAG,cAAc,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { useEffect, useRef, type ComponentProps, type DragEvent, type ElementType, type KeyboardEvent, type PointerEvent, type ReactNode } from \"react\"\nimport { flushSync } from \"react-dom\"\n\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\nimport { moveItem, sortableKeyDown, sortablePointerDown, type SortableLayout, type SortableMove } from \"../../lib/sortable\"\nimport { GripVertical, Hamburger } from \"../Icon\"\n\nimport s from \"@plexui/styles/components/Sortable/Sortable.module.css\"\n\nexport type SortableProps<T> = {\n /**\n * The list, in the order of the children\n */\n value: readonly T[]\n /**\n * Called with the new order after a drop\n */\n onChange?: (value: T[]) => void\n /**\n * `list` for rows one under another, `grid` for items that stand side by side\n * @default list\n */\n layout?: SortableLayout\n /**\n * Element to render, such as `TableBody` for table rows\n * @default div\n */\n as?: ElementType\n /**\n * Turns dragging off\n * @default false\n */\n disabled?: boolean\n /**\n * Shows the grips of `Sortable.Handle`. A hidden grip still takes the keyboard, and the item drags from anywhere but a control.\n * @default true in a table, otherwise false\n */\n handles?: boolean\n /**\n * Lists of one group trade items, and a `Sortable.Target` of that group takes them. Give each list a `name`.\n */\n group?: string\n /**\n * Names the list in `onMove`\n */\n name?: string\n /**\n * An item moved, inside this list or out of it. Out of it the app updates both lists: `onChange` is for a move inside one.\n */\n onMove?: (move: SortableMove<T>) => void\n /**\n * A drag rests on a `Sortable.Target` of the group: open what it stands for or go there\n */\n onHold?: (name: string) => void\n /**\n * The items, one direct child per entry of `value`, keyed by the entry and not by its index\n */\n children?: ReactNode\n} & Omit<ComponentProps<\"div\">, \"children\" | \"onChange\">\n\nconst preventNativeDrag = (event: DragEvent) => event.preventDefault()\n\n/** Reorders its direct children by dragging, from anywhere but a control, or by a `Sortable.Handle` where grips are shown. */\nexport function Sortable<T>({\n value,\n onChange,\n layout = \"list\",\n as: Tag = \"div\",\n disabled = false,\n handles,\n group,\n name,\n onMove,\n onHold,\n className,\n children,\n onPointerDown,\n onKeyDown,\n ...rest\n}: SortableProps<T>) {\n const latest = useLatestValue({ value, onChange, onMove, onHold, name })\n const cancelDrag = useRef<ReturnType<typeof sortablePointerDown>>(undefined)\n useEffect(() => () => cancelDrag.current?.(), [])\n useEffect(() => {\n if (disabled) {\n cancelDrag.current?.()\n cancelDrag.current = undefined\n }\n }, [disabled])\n\n const commit = (from: number, to: number) => {\n const { value: items, onChange: change, onMove: move, name: list } = latest.current\n flushSync(() => {\n change?.(moveItem(items, from, to))\n move?.({ item: items[from], from: list as string, fromIndex: from, to: list as string, toIndex: to })\n })\n }\n\n const link = {\n move: (fromIndex: number, to: string, toIndex?: number) => {\n const { value: items, onMove: move, name: from } = latest.current\n flushSync(() => move?.({ item: items[fromIndex], from: from as string, fromIndex, to, toIndex }))\n },\n hold: (target: string) => latest.current.onHold?.(target),\n }\n\n const handlePointerDown = (event: PointerEvent<HTMLDivElement>) => {\n onPointerDown?.(event)\n if (!disabled && !event.defaultPrevented) {\n cancelDrag.current = sortablePointerDown(event.nativeEvent, event.currentTarget, layout, commit, link) ?? cancelDrag.current\n }\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event)\n if (!disabled && !event.defaultPrevented) void sortableKeyDown(event.nativeEvent, event.currentTarget, commit, link)\n }\n\n return (\n <Tag\n {...rest}\n className={clsx(s.Sortable, className)}\n data-sortable=\"\"\n data-layout={layout}\n data-disabled={disabled ? \"\" : undefined}\n data-handles={handles?.toString()}\n data-group={group}\n data-name={name}\n onPointerDown={handlePointerDown}\n onKeyDown={handleKeyDown}\n onDragStart={preventNativeDrag}\n >\n {children}\n </Tag>\n )\n}\n\nexport type SortableHandleProps = {\n /**\n * Name of the handle for assistive technology\n * @default Reorder\n */\n \"aria-label\"?: string\n} & ComponentProps<\"button\">\n\n/** The grip of an item. Arrow keys move the item while the handle has focus. */\nfunction SortableHandle({ \"aria-label\": ariaLabel = \"Reorder\", className, children, ...rest }: SortableHandleProps) {\n return (\n <button {...rest} type=\"button\" className={clsx(s.Handle, className)} data-sortable-handle=\"\" aria-label={ariaLabel}>\n {children ?? <><GripVertical className={s.DesktopGrip} aria-hidden /><Hamburger className={s.PhoneGrip} aria-hidden preserveAspectRatio=\"none\" /></>}\n </button>\n )\n}\n\nexport type SortableTargetProps = {\n /**\n * The `group` of the lists whose items it takes\n */\n group: string\n /**\n * Names the target in `onMove` and `onHold` on the list\n */\n name: string\n /**\n * Element to render\n * @default div\n */\n as?: ElementType\n} & ComponentProps<\"div\">\n\n/** A place outside the lists that takes an item whole: a folder, a category in a side list. */\nfunction SortableTarget({ group, name, as: Tag = \"div\", className, ...rest }: SortableTargetProps) {\n return <Tag {...rest} className={clsx(s.Target, className)} data-sortable-target={group} data-name={name} />\n}\n\nSortable.Handle = SortableHandle\nSortable.Target = SortableTarget\n"]}
|
|
1
|
+
{"version":3,"file":"Sortable.js","sourceRoot":"","sources":["../../../../src/components/Sortable/Sortable.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,EAAgH,MAAM,OAA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CACV,CAAA;AACH,CAAC;AAkBD,+FAA+F;AAC/F,SAAS,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,GAAG,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAuB;IAC/F,OAAO,KAAC,GAAG,OAAK,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,0BAAwB,KAAK,eAAa,IAAI,GAAI,CAAA;AAC9G,CAAC;AAED,QAAQ,CAAC,MAAM,GAAG,cAAc,CAAA;AAChC,QAAQ,CAAC,MAAM,GAAG,cAAc,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { useEffect, useRef, type ComponentProps, type DragEvent, type ElementType, type KeyboardEvent, type PointerEvent, type ReactNode } from \"react\"\nimport { flushSync } from \"react-dom\"\n\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\nimport { moveItem, sortableKeyDown, sortablePointerDown, type SortableLayout, type SortableMove, type SortableReach } from \"../../lib/sortable\"\nimport { GripVertical, Hamburger } from \"../Icon\"\n\nimport s from \"@plexui/styles/components/Sortable/Sortable.module.css\"\n\nexport type SortableProps<T> = {\n /**\n * The list, in the order of the children\n */\n value: readonly T[]\n /**\n * Called with the new order after a drop\n */\n onChange?: (value: T[]) => void\n /**\n * `list` for rows one under another, `grid` for items that stand side by side\n * @default list\n */\n layout?: SortableLayout\n /**\n * Element to render, such as `TableBody` for table rows\n * @default div\n */\n as?: ElementType\n /**\n * Turns dragging off\n * @default false\n */\n disabled?: boolean\n /**\n * Shows the grips of `Sortable.Handle`. A hidden grip still takes the keyboard, and the item drags from anywhere but a control.\n * @default true in a table, otherwise false\n */\n handles?: boolean\n /**\n * Where a shown grip stands in its row: `start` before the content, `end` after it, as iOS ends a row with its\n * reorder control.\n * @default start on a desktop, end on a phone (touch.css)\n */\n handlePlacement?: \"start\" | \"end\"\n /**\n * Lists of one group trade items, and a `Sortable.Target` of that group takes them. Give each list a `name`.\n */\n group?: string\n /**\n * Where a drag goes: `group` to the lists of the group and its `Sortable.Target`s, `list` within this list and onto the targets, `targets` only onto a target, with no line or parting and the arrow keys leaving the order. A list that is not `group` neither gives items to the other lists nor takes theirs.\n * @default group\n */\n reach?: SortableReach\n /**\n * Names the list in `onMove`\n */\n name?: string\n /**\n * An item moved, inside this list or out of it. Out of it the app updates both lists: `onChange` is for a move inside one.\n */\n onMove?: (move: SortableMove<T>) => void\n /**\n * A drag rests on a `Sortable.Target` of the group: open what it stands for or go there\n */\n onHold?: (name: string) => void\n /**\n * The items, one direct child per entry of `value`, keyed by the entry and not by its index\n */\n children?: ReactNode\n} & Omit<ComponentProps<\"div\">, \"children\" | \"onChange\">\n\nconst preventNativeDrag = (event: DragEvent) => event.preventDefault()\n\n/** Reorders its direct children by dragging, from anywhere but a control, or by a `Sortable.Handle` where grips are shown. */\nexport function Sortable<T>({\n value,\n onChange,\n layout = \"list\",\n as: Tag = \"div\",\n disabled = false,\n handles,\n handlePlacement,\n group,\n reach,\n name,\n onMove,\n onHold,\n className,\n children,\n onPointerDown,\n onKeyDown,\n ...rest\n}: SortableProps<T>) {\n const latest = useLatestValue({ value, onChange, onMove, onHold, name })\n const cancelDrag = useRef<ReturnType<typeof sortablePointerDown>>(undefined)\n useEffect(() => () => cancelDrag.current?.(), [])\n useEffect(() => {\n if (disabled) {\n cancelDrag.current?.()\n cancelDrag.current = undefined\n }\n }, [disabled])\n\n const commit = (from: number, to: number) => {\n const { value: items, onChange: change, onMove: move, name: list } = latest.current\n flushSync(() => {\n change?.(moveItem(items, from, to))\n move?.({ item: items[from], from: list as string, fromIndex: from, to: list as string, toIndex: to })\n })\n }\n\n const link = {\n move: (fromIndex: number, to: string, toIndex?: number) => {\n const { value: items, onMove: move, name: from } = latest.current\n flushSync(() => move?.({ item: items[fromIndex], from: from as string, fromIndex, to, toIndex }))\n },\n hold: (target: string) => latest.current.onHold?.(target),\n }\n\n const handlePointerDown = (event: PointerEvent<HTMLDivElement>) => {\n onPointerDown?.(event)\n if (!disabled && !event.defaultPrevented) {\n cancelDrag.current = sortablePointerDown(event.nativeEvent, event.currentTarget, layout, commit, link) ?? cancelDrag.current\n }\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event)\n if (!disabled && !event.defaultPrevented) void sortableKeyDown(event.nativeEvent, event.currentTarget, commit, link)\n }\n\n return (\n <Tag\n {...rest}\n className={clsx(s.Sortable, className)}\n data-sortable=\"\"\n data-layout={layout}\n data-disabled={disabled ? \"\" : undefined}\n data-handles={handles?.toString()}\n data-handle-placement={handlePlacement}\n data-group={group}\n data-reach={reach}\n data-name={name}\n onPointerDown={handlePointerDown}\n onKeyDown={handleKeyDown}\n onDragStart={preventNativeDrag}\n >\n {children}\n </Tag>\n )\n}\n\nexport type SortableHandleProps = {\n /**\n * Name of the handle for assistive technology\n * @default Reorder\n */\n \"aria-label\"?: string\n} & ComponentProps<\"button\">\n\n/** The grip of an item. Arrow keys move the item while the handle has focus. */\nfunction SortableHandle({ \"aria-label\": ariaLabel = \"Reorder\", className, children, ...rest }: SortableHandleProps) {\n return (\n <button {...rest} type=\"button\" className={clsx(s.Handle, className)} data-sortable-handle=\"\" aria-label={ariaLabel}>\n {children ?? <><GripVertical className={s.DesktopGrip} aria-hidden /><Hamburger className={s.PhoneGrip} aria-hidden preserveAspectRatio=\"none\" /></>}\n </button>\n )\n}\n\nexport type SortableTargetProps = {\n /**\n * The `group` of the lists whose items it takes\n */\n group: string\n /**\n * Names the target in `onMove` and `onHold` on the list\n */\n name: string\n /**\n * Element to render\n * @default div\n */\n as?: ElementType\n} & ComponentProps<\"div\">\n\n/** A place outside the lists that takes an item whole: a folder, a category in a side list. */\nfunction SortableTarget({ group, name, as: Tag = \"div\", className, ...rest }: SortableTargetProps) {\n return <Tag {...rest} className={clsx(s.Target, className)} data-sortable-target={group} data-name={name} />\n}\n\nSortable.Handle = SortableHandle\nSortable.Target = SortableTarget\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Sortable/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,GAIT,MAAM,YAAY,CAAA","sourcesContent":["export {\n Sortable,\n type SortableHandleProps,\n type SortableProps,\n type SortableTargetProps,\n} from \"./Sortable\"\nexport type { SortableMove } from \"../../lib/sortable\"\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Sortable/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,GAIT,MAAM,YAAY,CAAA","sourcesContent":["export {\n Sortable,\n type SortableHandleProps,\n type SortableProps,\n type SortableTargetProps,\n} from \"./Sortable\"\nexport type { SortableMove, SortableReach } from \"../../lib/sortable\"\n"]}
|
|
@@ -399,7 +399,7 @@ const Tab = ({ children, icon, badge, ...restProps }) => {
|
|
|
399
399
|
// Normalize badge prop
|
|
400
400
|
const badgeProps = badge != null ? (isBadgeObject(badge) ? badge : { content: badge }) : null;
|
|
401
401
|
const vertical = useContext(TabsVerticalContext);
|
|
402
|
-
return (_jsxs(ToggleGroup.Item, { className: s.Tab, ...restProps, onPointerEnter: handlePressableMouseEnter, children: [_jsxs("span", { className: s.TabContent, children: [renderTabIcon(icon), children && _jsx("span", { className: s.TabLabel, children: children }), badgeProps && (_jsx("span", { className: s.TabBadge, "data-color": badgeProps.color ?? "secondary", "data-variant": badgeProps.variant ?? "soft", "data-pill": badgeProps.pill ? "" : undefined, children: badgeProps.loading ? _jsx(LoadingIndicator, {}) : badgeProps.content }))] }), vertical && _jsx(CheckMd, { className: s.TabCheckmark, "aria-hidden": "true" })] }));
|
|
402
|
+
return (_jsxs(ToggleGroup.Item, { className: s.Tab, ...restProps, onPointerEnter: handlePressableMouseEnter, children: [_jsxs("span", { className: s.TabContent, children: [renderTabIcon(icon), children && _jsx("span", { className: s.TabLabel, children: children }), badgeProps && (_jsx("span", { className: s.TabBadge, "data-slot": "tab-badge", "data-color": badgeProps.color ?? "secondary", "data-variant": badgeProps.variant ?? "soft", "data-pill": badgeProps.pill ? "" : undefined, children: badgeProps.loading ? _jsx(LoadingIndicator, {}) : badgeProps.content }))] }), vertical && _jsx(CheckMd, { className: s.TabCheckmark, "aria-hidden": "true" })] }));
|
|
403
403
|
};
|
|
404
404
|
// =============================================
|
|
405
405
|
// overflow="menu"
|