@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.
Files changed (37) hide show
  1. package/dist/es/components/Dialog/Dialog.js +86 -7
  2. package/dist/es/components/Dialog/Dialog.js.map +1 -1
  3. package/dist/es/components/Dialog/index.js.map +1 -1
  4. package/dist/es/components/Field/Field.js +2 -2
  5. package/dist/es/components/Field/Field.js.map +1 -1
  6. package/dist/es/components/FileUpload/FileUpload.js +3 -2
  7. package/dist/es/components/FileUpload/FileUpload.js.map +1 -1
  8. package/dist/es/components/Icon/index.js +2 -0
  9. package/dist/es/components/Icon/index.js.map +1 -1
  10. package/dist/es/components/Icon/svg/ZoomIn.js +5 -0
  11. package/dist/es/components/Icon/svg/ZoomIn.js.map +1 -0
  12. package/dist/es/components/Icon/svg/ZoomOut.js +5 -0
  13. package/dist/es/components/Icon/svg/ZoomOut.js.map +1 -0
  14. package/dist/es/components/Popover/Popover.js +21 -2
  15. package/dist/es/components/Popover/Popover.js.map +1 -1
  16. package/dist/es/components/Slider/Slider.js +9 -3
  17. package/dist/es/components/Slider/Slider.js.map +1 -1
  18. package/dist/es/components/Sortable/Sortable.js +2 -2
  19. package/dist/es/components/Sortable/Sortable.js.map +1 -1
  20. package/dist/es/components/Sortable/index.js.map +1 -1
  21. package/dist/es/components/Tabs/Tabs.js +1 -1
  22. package/dist/es/components/Tabs/Tabs.js.map +1 -1
  23. package/dist/es/lib/sortable.js +16 -4
  24. package/dist/es/lib/sortable.js.map +1 -1
  25. package/dist/types/components/Dialog/Dialog.d.ts +20 -1
  26. package/dist/types/components/Dialog/index.d.ts +1 -1
  27. package/dist/types/components/Field/Field.d.ts +12 -4
  28. package/dist/types/components/FileUpload/FileUpload.d.ts +11 -0
  29. package/dist/types/components/Icon/index.d.ts +2 -0
  30. package/dist/types/components/Icon/svg/ZoomIn.d.ts +6 -0
  31. package/dist/types/components/Icon/svg/ZoomOut.d.ts +6 -0
  32. package/dist/types/components/Popover/Popover.d.ts +7 -0
  33. package/dist/types/components/Slider/Slider.d.ts +9 -0
  34. package/dist/types/components/Sortable/Sortable.d.ts +13 -2
  35. package/dist/types/components/Sortable/index.d.ts +1 -1
  36. package/dist/types/lib/sortable.d.ts +3 -0
  37. package/package.json +2 -2
@@ -1,15 +1,17 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import clsx from "clsx";
4
- import { Dialog as RadixDialog } from "radix-ui";
5
- import { Children, cloneElement, createContext, Fragment, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, } from "react";
4
+ import { Dialog as RadixDialog, Slot } from "radix-ui";
5
+ import { Children, cloneElement, createContext, Fragment, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, } from "react";
6
6
  import { createPortal } from "react-dom";
7
7
  import { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from "../../hooks/useFloatingBoundary.js";
8
8
  import { useEscCloseStack } from "../../hooks/useEscCloseStack.js";
9
9
  import { inToastRegion } from "../../lib/toastRegion.js";
10
10
  import { cancelableKeyCopy, dataAttributes, keepMovedFocus, preventDefaultHandler, toCssVariables } from "../../lib/helpers.js";
11
11
  import { useStableCallback } from "../../hooks/useStableCallback.js";
12
+ import { Button } from "../Button/index.js";
12
13
  import { NavigationButton } from "../Button/NavigationButton.js";
14
+ import { Popover } from "../Popover/index.js";
13
15
  import { barBackground, Toolbar, ToolbarHostContext } from "../Toolbar/Toolbar.js";
14
16
  import { NO_SCROLL_EDGES, observeScrollEdges, sameScrollEdges } from "../../lib/scrollEdges.js";
15
17
  import { TransitionGroup } from "../Transition/index.js";
@@ -46,7 +48,7 @@ export const Dialog = ({ open: controlledOpen, onOpenChange: controlledOnOpenCha
46
48
  const Trigger = ({ children }) => {
47
49
  return _jsx(RadixDialog.Trigger, { asChild: true, children: children });
48
50
  };
49
- const Content = ({ children, width = 480, showClose = true, pill = false, className, placement = "center", mobilePlacement: requestedMobilePlacement, mobileVariant: requestedMobileVariant, surface = "plain", onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, onInteractOutside, zIndex, rootProps, overlayProps, layout = "auto", ...rest }) => {
51
+ const Content = ({ children, width = 480, showClose = true, pill = false, className, placement = "center", mobilePlacement: requestedMobilePlacement, mobileVariant: requestedMobileVariant, surface = "plain", onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, onInteractOutside, confirmClose, zIndex, rootProps, overlayProps, layout = "auto", ...rest }) => {
50
52
  const { open, setOpen } = useDialogContext();
51
53
  const outerPhoneLayout = useContext(PhoneLayoutContext);
52
54
  // A dialog laid out as on a phone by its own prop, outside a PhoneLayout, keeps the window: what it holds and
@@ -73,7 +75,49 @@ const Content = ({ children, width = 480, showClose = true, pill = false, classN
73
75
  const [bodySlot, setBodySlot] = useState(null);
74
76
  const [ownSlot, setOwnSlot] = useState(null);
75
77
  const descriptionSlot = ownSlot ?? bodySlot;
76
- const sheet = useMemo(() => (mobileVariant === "sheet" ? { showClose, descriptionSlot, setBodySlot, setOwnSlot } : null), [mobileVariant, showClose, descriptionSlot]);
78
+ // A close asked for while there are changes waits for the answer (`confirmClose`); the ref answers at once for
79
+ // the press that dismisses the question itself, so it does not ask again, nor does one just after it closed.
80
+ const [confirming, setConfirmingState] = useState(false);
81
+ const confirmingRef = useRef(false);
82
+ const confirmClosedAt = useRef(0);
83
+ const setConfirming = useCallback((next) => {
84
+ if (confirmingRef.current && !next)
85
+ confirmClosedAt.current = performance.now();
86
+ confirmingRef.current = next;
87
+ setConfirmingState(next);
88
+ }, []);
89
+ useEffect(() => { if (!open || !confirmClose)
90
+ setConfirming(false); }, [open, confirmClose, setConfirming]);
91
+ const [closeButton, setCloseButton] = useState(null);
92
+ // Where focus returns when the question is dismissed: the field or button that asked to close
93
+ const returnFocus = useRef(null);
94
+ const requestClose = useStableCallback(() => {
95
+ // A press on a dialog that is already leaving (closed from outside, its exit still on screen) asks nothing
96
+ if (!open)
97
+ return;
98
+ if (!confirmClose)
99
+ return setOpen(false);
100
+ // A press that dismissed the question (its pointer-down or click lands here too) keeps editing
101
+ if (confirmingRef.current || performance.now() - confirmClosedAt.current < DOUBLE_CLICK)
102
+ return;
103
+ returnFocus.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
104
+ setConfirming(true);
105
+ });
106
+ // The answer that discards: the question leaves first, then the dialog, as iOS dismisses the confirmation before
107
+ // the sheet. Together, the question would stand still over the sheet as it leaves: a closing dialog holds what
108
+ // it shows, the transitions inside it too.
109
+ const confirmTimer = useRef(undefined);
110
+ // A close from outside, or a new opening, ends a discard that is still waiting for the question to leave
111
+ useEffect(() => () => clearTimeout(confirmTimer.current), [open]);
112
+ const confirmAndClose = useStableCallback(() => {
113
+ setConfirming(false);
114
+ clearTimeout(confirmTimer.current);
115
+ confirmTimer.current = setTimeout(() => setOpen(false), overlayTiming.exitDuration);
116
+ });
117
+ const asksToClose = Boolean(confirmClose);
118
+ const sheet = useMemo(() => (mobileVariant === "sheet"
119
+ ? { showClose, descriptionSlot, setBodySlot, setOwnSlot, asksToClose, requestClose, setCloseButton }
120
+ : null), [mobileVariant, showClose, descriptionSlot, asksToClose, requestClose]);
77
121
  const boundary = useFloatingBoundaryScope();
78
122
  const setRoot = boundary.setRoot;
79
123
  const setPanelRef = useCallback((node) => { setPanel(node); setRoot(node); }, [setRoot]);
@@ -97,7 +141,7 @@ const Content = ({ children, width = 480, showClose = true, pill = false, classN
97
141
  if (request.defaultPrevented)
98
142
  return;
99
143
  }
100
- setOpen(false);
144
+ requestClose();
101
145
  });
102
146
  useEffect(() => {
103
147
  if (open)
@@ -112,6 +156,10 @@ const Content = ({ children, width = 480, showClose = true, pill = false, classN
112
156
  if (request.defaultPrevented)
113
157
  return false;
114
158
  }
159
+ if (confirmClose) {
160
+ requestClose();
161
+ return false;
162
+ }
115
163
  setOpen(false);
116
164
  return true;
117
165
  });
@@ -155,15 +203,23 @@ const Content = ({ children, width = 480, showClose = true, pill = false, classN
155
203
  onInteractOutside?.(event);
156
204
  if (event.defaultPrevented)
157
205
  return;
206
+ // With changes a press outside asks first; one that dismisses the question keeps editing
207
+ if (confirmClose) {
208
+ event.preventDefault();
209
+ requestClose();
210
+ return;
211
+ }
158
212
  // The second click of a double click lands on the overlay: it must not undo the first
159
213
  if (performance.now() - openedAt.current < DOUBLE_CLICK)
160
214
  event.preventDefault();
161
215
  else
162
216
  exitGuard.onInteractOutside(event);
163
- }, onOpenAutoFocus: onOpenAutoFocus, onCloseAutoFocus: handleCloseAutoFocus, children: _jsxs("div", { ref: setPanelRef, className: clsx(s.Panel, className), children: [showClose && (_jsx(RadixDialog.Close, { asChild: true, children: _jsx(NavigationButton, { action: "close", variant: "ghost", className: s.CloseButton, "aria-label": "Close dialog" }) })), _jsx(DialogScrollContext.Provider, { value: scroll, children: _jsx(DialogSheetContext.Provider, { value: sheet, children: _jsx(DialogBarContext.Provider, { value: false, children: _jsx(ToolbarHostContext.Provider, { value: toolbarHost, children: children }) }) }) })] }) })] }, "dialog")) }) }) }) }) }));
217
+ }, onOpenAutoFocus: onOpenAutoFocus, onCloseAutoFocus: handleCloseAutoFocus, children: _jsxs("div", { ref: setPanelRef, className: clsx(s.Panel, className), children: [showClose && (confirmClose ? (_jsx(NavigationButton, { action: "close", variant: "ghost", className: s.CloseButton, "aria-label": "Close dialog", onClick: requestClose })) : (_jsx(RadixDialog.Close, { asChild: true, children: _jsx(NavigationButton, { action: "close", variant: "ghost", className: s.CloseButton, "aria-label": "Close dialog" }) }))), _jsx(DialogRequestCloseContext.Provider, { value: confirmClose ? requestClose : null, children: _jsx(DialogScrollContext.Provider, { value: scroll, children: _jsx(DialogSheetContext.Provider, { value: sheet, children: _jsx(DialogBarContext.Provider, { value: false, children: _jsx(ToolbarHostContext.Provider, { value: toolbarHost, children: children }) }) }) }) }), confirmClose && (_jsx(ConfirmClose, { ...confirmClose, open: confirming, anchor: phone && mobileVariant === "sheet" ? closeButton : null, onOpenChange: setConfirming, returnFocus: returnFocus, onConfirm: confirmAndClose, zIndex: zIndex }))] }) })] }, "dialog")) }) }) }) }) }));
164
218
  };
165
219
  const DialogScrollContext = createContext(null);
166
220
  const DialogSheetContext = createContext(null);
221
+ // A close that asks first (`confirmClose`): Dialog.Close inside the content asks as the Close button does
222
+ const DialogRequestCloseContext = createContext(null);
167
223
  // Inside that bar: the title, the description and the header actions take the Toolbar's parts
168
224
  const DialogBarContext = createContext(false);
169
225
  const PhoneScope = ({ enabled, children }) => enabled ? _jsx("div", { className: s.PhoneScope, "data-plex-layout": "phone", children: children }) : children;
@@ -196,7 +252,7 @@ const Header = ({ children, className, background = "glass" }) => {
196
252
  // On a phone the header of a Sheet is its Toolbar (iOS 27 kit Sheets 507-24684, Toolbar - Top - iPhone
197
253
  // 1-54520): Close at the leading edge, the title alone centered on the row of controls, the header actions
198
254
  // at the trailing edge, all on one 44px row 16px under the top edge.
199
- return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { background: background, className: className, "data-dialog-bar": "", children: _jsxs(DialogBarContext.Provider, { value: true, children: [sheet.showClose && !parts.some(isLeadingAction) && (_jsx(Toolbar.Leading, { className: s.BarClose, children: _jsx(RadixDialog.Close, { asChild: true, children: _jsx(NavigationButton, { action: "close", variant: "ghost", "aria-label": "Close dialog" }) }) })), parts.filter(isLeadingAction), _jsx("div", { className: clsx(t.Heading, s.BarHeading), children: parts.filter((part) => !isHeaderAction(part) && !isDescription(part)) }), parts.filter((part) => isHeaderAction(part) && !isLeadingAction(part))] }) }), description && (sheet.descriptionSlot ? createPortal(description, sheet.descriptionSlot) : description)] }));
255
+ return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { background: background, className: className, "data-dialog-bar": "", children: _jsxs(DialogBarContext.Provider, { value: true, children: [sheet.showClose && !parts.some(isLeadingAction) && (_jsx(Toolbar.Leading, { className: s.BarClose, children: sheet.asksToClose ? (_jsx(NavigationButton, { ref: sheet.setCloseButton, action: "close", variant: "ghost", "aria-label": "Close dialog", onClick: sheet.requestClose })) : (_jsx(RadixDialog.Close, { asChild: true, children: _jsx(NavigationButton, { action: "close", variant: "ghost", "aria-label": "Close dialog" }) })) })), parts.filter(isLeadingAction), _jsx("div", { className: clsx(t.Heading, s.BarHeading), children: parts.filter((part) => !isHeaderAction(part) && !isDescription(part)) }), parts.filter((part) => isHeaderAction(part) && !isLeadingAction(part))] }) }), description && (sheet.descriptionSlot ? createPortal(description, sheet.descriptionSlot) : description)] }));
200
256
  }
201
257
  return _jsx("div", { className: clsx(s.Header, className), "data-background": barBackground(background), "data-scrolled": scrolled ? "" : undefined, children: children });
202
258
  };
@@ -268,7 +324,30 @@ const Description = ({ children, className }) => {
268
324
  };
269
325
  /** The steps of a flow inside a dialog, such as a sign-in that asks for an email and then a code. */
270
326
  const Steps = ({ step, direction = "forward", children, className }) => (_jsx("div", { className: clsx(s.Steps, className), "data-direction": direction, children: _jsx(TransitionGroup, { ...STEP_TIMING, as: "div", overlay: true, className: s.Step, onEnter: enterStep, onExit: leaveStep, onExitActive: settleStepHeight, onExitComplete: releaseStepHeight, children: _jsx("div", { "data-dialog-step": "", tabIndex: -1, children: children }, step) }) }));
327
+ // iOS asks at the button that closes (a confirmation dialog presented from the sheet's Close on iOS 27: a glass
328
+ // popover under it, no dimming, the question in 17 regular over a full-width destructive pill); with no such button,
329
+ // and on a desktop, the question is an alert.
330
+ const ConfirmClose = ({ message, confirmLabel = "Discard Changes", cancelLabel = "Keep Editing", open, anchor, onOpenChange, onConfirm, returnFocus, zIndex, }) => {
331
+ const messageId = useId();
332
+ if (anchor) {
333
+ return (_jsxs(Popover, { open: open, onOpenChange: onOpenChange, children: [_jsx(Popover.Anchor, { element: anchor }), _jsxs(Popover.Content, { side: "bottom", align: "start", sideOffset: -anchor.offsetHeight, alignOffset: -6, collisionPadding: 10, width: 240, minWidth: 240, zIndex: zIndex, "aria-labelledby": messageId, className: s.ConfirmClose, "data-dialog-confirm-close": "", children: [_jsx("p", { id: messageId, className: s.ConfirmCloseMessage, children: message }), _jsx(Button, { block: true, pill: true, color: "danger", variant: "soft", className: s.ConfirmCloseAction, onClick: onConfirm, children: confirmLabel })] })] }));
334
+ }
335
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(Content, { mobileVariant: "alert", surface: "plain", width: 360, showClose: false, zIndex: zIndex, "data-dialog-confirm-close": "", onCloseAutoFocus: (event) => {
336
+ const target = returnFocus.current;
337
+ if (target?.isConnected) {
338
+ event.preventDefault();
339
+ target.focus({ preventScroll: true });
340
+ }
341
+ }, children: [_jsx(Header, { children: _jsx(Title, { children: message }) }), _jsxs(Footer, { children: [_jsx(Close, { children: _jsx(Button, { color: "secondary", variant: "soft", children: cancelLabel }) }), _jsx(Button, { color: "danger", onClick: onConfirm, children: confirmLabel })] })] }) }));
342
+ };
271
343
  const Close = ({ children }) => {
344
+ const requestClose = useContext(DialogRequestCloseContext);
345
+ // A button that does not submit the form around it, and a child that prevented its click keeps the dialog, as
346
+ // Radix's Close does
347
+ if (requestClose) {
348
+ return (_jsx(Slot.Root, { type: "button", onClick: (event) => { if (!event.defaultPrevented)
349
+ requestClose(); }, children: children }));
350
+ }
272
351
  return _jsx(RadixDialog.Close, { asChild: true, children: children });
273
352
  };
274
353
  Dialog.Trigger = Trigger;
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,cAAc,EACd,WAAW,EACX,UAAU,EACV,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE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OAAO,CAAA;AACxB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;AACxB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;AACtB,MAAM,CAAC,YAAY,GAAG,YAAY,CAAA;AAClC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAA;AAClB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;AACtB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;AACpB,MAAM,CAAC,WAAW,GAAG,WAAW,CAAA;AAChC,MAAM,CAAC,eAAe,GAAG,eAAe,CAAA;AACxC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;AACpB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { Dialog as RadixDialog } from \"radix-ui\"\nimport {\n Children,\n cloneElement,\n createContext,\n Fragment,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from \"../../hooks/useFloatingBoundary\"\nimport { useEscCloseStack } from \"../../hooks/useEscCloseStack\"\nimport { inToastRegion } from \"../../lib/toastRegion\"\nimport { cancelableKeyCopy, dataAttributes, keepMovedFocus, preventDefaultHandler, toCssVariables } from \"../../lib/helpers\"\nimport { useStableCallback } from \"../../hooks/useStableCallback\"\nimport { NavigationButton } from \"../Button/NavigationButton\"\nimport { barBackground, Toolbar, ToolbarHostContext, type BarBackground, type BarBackgroundAlias, type ToolbarHost } from \"../Toolbar/Toolbar\"\nimport { NO_SCROLL_EDGES, observeScrollEdges, sameScrollEdges, type ScrollEdges } from \"../../lib/scrollEdges\"\nimport { TransitionGroup } from \"../Transition\"\nimport { createExitGuard, overlayTiming, overlayTimingLarge } from \"../Transition/shared\"\nimport { attachSheetDrag } from \"./sheetDrag\"\nimport { watchDialogViewport } from \"./dialogViewport\"\nimport { enterStep, leaveStep, releaseStepHeight, settleStepHeight, STEP_TIMING } from \"./dialogSteps\"\nimport { PhoneLayoutContext, usePhoneLayout, type PhoneLayoutValue } from \"../PhoneLayout/PhoneLayout\"\nimport { usePopoverDismissableSurface } from \"../Popover/deferredOutsidePress\"\nimport s from \"@plexui/styles/components/Dialog/Dialog.module.css\"\nimport t from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\ntype DialogContextValue = {\n open: boolean\n setOpen: (nextState: boolean) => void\n}\n\nconst DOUBLE_CLICK = 300\n\nconst DialogContext = createContext<DialogContextValue | null>(null)\n\nconst useDialogContext = () => {\n const context = useContext(DialogContext)\n\n if (!context) {\n throw new Error(\"Dialog compound components must be used inside <Dialog>\")\n }\n\n return context\n}\n\nexport type DialogProps = {\n open?: boolean\n onOpenChange?: (open: boolean) => void\n children: ReactNode\n}\n\nexport const Dialog = ({\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n children,\n}: DialogProps) => {\n const [open, setOpen] = useState<boolean>(false)\n const isOpen = controlledOpen ?? open\n\n const handleOpenChange = useCallback(\n (nextState: boolean) => {\n controlledOnOpenChange?.(nextState)\n setOpen(nextState)\n },\n [controlledOnOpenChange],\n )\n\n const store = useMemo<DialogContextValue>(\n () => ({\n open: isOpen,\n setOpen: handleOpenChange,\n }),\n [isOpen, handleOpenChange],\n )\n\n return (\n <DialogContext value={store}>\n <RadixDialog.Root open={isOpen} onOpenChange={handleOpenChange}>\n {children}\n </RadixDialog.Root>\n </DialogContext>\n )\n}\n\nconst Trigger = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Trigger asChild>{children}</RadixDialog.Trigger>\n}\n\nexport type DialogPlacement = \"center\" | \"top\" | \"bottom\" | \"start\" | \"end\" | \"fullscreen\"\n\n/**\n * A press or a focus outside the dialog, or a phone sheet pulled down to close; `event.detail.originalEvent` is the\n * browser's event (a TouchEvent for the sheet).\n */\nexport type DialogInteractOutsideEvent = CustomEvent<{ originalEvent: PointerEvent | FocusEvent | TouchEvent }>\n\n/** Class, style and data attributes for one of the dialog's layers. */\nexport type DialogLayerProps = {\n className?: string\n style?: CSSProperties\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nexport type DialogContentProps = {\n children: ReactNode\n width?: number | string\n showClose?: boolean\n /**\n * Rounder panel and a round close button, for dialogs that sit beside pill controls.\n * @default false\n */\n pill?: boolean\n className?: string\n /**\n * Where the panel sits: centered, near the top (search, command lists),\n * a sheet along the bottom, a full-height panel on the start or end side,\n * or the whole screen.\n * @default center\n */\n placement?: DialogPlacement\n /**\n * Where a phone sheet stands at 767px and below: `bottom`, or `fullscreen` for the whole screen. `center` is the\n * alert's place: without `mobileVariant` it makes the dialog an alert. @default \"fullscreen\" for a fullscreen\n * dialog, else \"bottom\"\n */\n mobilePlacement?: Extract<DialogPlacement, \"center\" | \"bottom\" | \"fullscreen\">\n /**\n * The iOS presentation at 767px and below. A phone has two modal views: the sheet, which iOS gives any view it\n * presents, and the alert, a short question with its answers (UIAlertController). @default \"sheet\"\n */\n mobileVariant?: \"alert\" | \"sheet\"\n /** Mobile panel palette; dark mode uses elevated surfaces. @default \"plain\" */\n surface?: \"plain\" | \"grouped\"\n /**\n * Called when focus moves into the dialog on open. Call\n * `event.preventDefault()` to focus something else yourself.\n */\n onOpenAutoFocus?: (event: Event) => void\n /** Called when focus returns on close. Call `event.preventDefault()` to keep it elsewhere. */\n onCloseAutoFocus?: (event: Event) => void\n /**\n * Called on Escape before the dialog closes. Call `event.preventDefault()` to keep it open, such as for a form\n * with unsaved changes.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n /**\n * Called on a press or a focus outside the dialog, and on a phone sheet pulled down to close, before it closes. Call\n * `event.preventDefault()` to keep it open, such as for a form with unsaved changes (the sheet then returns, as an\n * iOS sheet does under `isModalInPresentation`), or for a press on a developer panel over the page.\n */\n onInteractOutside?: (event: DialogInteractOutsideEvent) => void\n /** Stack order of the overlay and the dialog. @default 50 */\n zIndex?: number\n /** Class, style and data attributes for the fixed layer that holds the panel. Data attributes of Content land here too. */\n rootProps?: DialogLayerProps\n /** Class, style and data attributes for the overlay. */\n overlayProps?: DialogLayerProps\n /**\n * `phone` lays the dialog out as on a phone at any window width. Inside a PhoneLayout it always is.\n * @default \"auto\"\n */\n layout?: \"auto\" | \"phone\"\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nconst Content = ({\n children,\n width = 480,\n showClose = true,\n pill = false,\n className,\n placement = \"center\",\n mobilePlacement: requestedMobilePlacement,\n mobileVariant: requestedMobileVariant,\n surface = \"plain\",\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onInteractOutside,\n zIndex,\n rootProps,\n overlayProps,\n layout = \"auto\",\n ...rest\n}: DialogContentProps) => {\n const { open, setOpen } = useDialogContext()\n const outerPhoneLayout = useContext(PhoneLayoutContext)\n // A dialog laid out as on a phone by its own prop, outside a PhoneLayout, keeps the window: what it holds and\n // the dialogs it opens are phone ones too.\n const phoneLayout = useMemo<PhoneLayoutValue | null>(\n () => outerPhoneLayout ?? (layout === \"phone\" ? { container: null } : null),\n [outerPhoneLayout, layout],\n )\n const [content, setContent] = useState<HTMLDivElement | null>(null)\n useDialogViewport(content, outerPhoneLayout?.container ?? null)\n const overlaySurfaceRef = usePopoverDismissableSurface()\n // A phone has no other modal view than the sheet and the alert (owner 12.11: «нет такого в iOS»): a centered\n // dialog is an alert, any other a sheet, at the bottom or over the whole screen.\n const mobileVariant = requestedMobileVariant ?? (requestedMobilePlacement === \"center\" ? \"alert\" : \"sheet\")\n const mobilePlacement =\n mobileVariant === \"alert\"\n ? \"center\"\n : (requestedMobilePlacement ?? placement) === \"fullscreen\" ? \"fullscreen\" : \"bottom\"\n const [exitGuard] = useState(createExitGuard)\n const [panel, setPanel] = useState<HTMLDivElement | null>(null)\n // Dialog.Body reports where content lies under the bars: they show their lines with it.\n const [edges, setEdgesState] = useState(NO_SCROLL_EDGES)\n const setEdges = useCallback((next: ScrollEdges) => setEdgesState((current) => sameScrollEdges(current, next) ? current : next), [])\n const scroll = useMemo(() => ({ edges, setEdges }), [edges, setEdges])\n const toolbarHost = useMemo<ToolbarHost>(() => ({ kind: \"dialog\", scrolled: edges.scrolled, contentBelow: edges.contentBelow }), [edges])\n // Where a phone Sheet's description goes: the first text of the content, under the bar. Dialog.Body offers\n // its top; a Dialog.DescriptionSlot of the content's own, such as a scroller inside a form, comes first.\n const [bodySlot, setBodySlot] = useState<HTMLElement | null>(null)\n const [ownSlot, setOwnSlot] = useState<HTMLElement | null>(null)\n const descriptionSlot = ownSlot ?? bodySlot\n const sheet = useMemo<DialogSheetValue | null>(\n () => (mobileVariant === \"sheet\" ? { showClose, descriptionSlot, setBodySlot, setOwnSlot } : null),\n [mobileVariant, showClose, descriptionSlot],\n )\n const boundary = useFloatingBoundaryScope()\n const setRoot = boundary.setRoot\n const setPanelRef = useCallback((node: HTMLDivElement | null) => { setPanel(node); setRoot(node) }, [setRoot])\n const openedAt = useRef(0)\n // A sheet crosses the screen on a phone, and wherever its owner asked for one; a dialog left to its defaults stays\n // the centred panel on a desktop, with that panel's timing.\n const phone = usePhoneLayout() || layout === \"phone\"\n const sheetCrosses = (phone || requestedMobileVariant === \"sheet\" || requestedMobilePlacement !== undefined) &&\n (mobilePlacement === \"bottom\" || mobilePlacement === \"fullscreen\")\n const crossesScreen =\n placement === \"bottom\" || placement === \"start\" || placement === \"end\" || placement === \"fullscreen\" || sheetCrosses\n\n // The content of a closing dialog is frozen for its exit, so this reads the owner's latest\n // handler: state that changes together with the close decides where focus returns.\n const handleCloseAutoFocus = useStableCallback((event: Event) => {\n onCloseAutoFocus?.(event)\n keepMovedFocus(event)\n })\n\n useEscCloseStack(open, (event) => {\n if (onEscapeKeyDown) {\n const request = cancelableKeyCopy(event)\n onEscapeKeyDown(request)\n if (request.defaultPrevented) return\n }\n setOpen(false)\n })\n\n useEffect(() => {\n if (open) openedAt.current = performance.now()\n }, [open])\n\n // A sheet pulled down asks as a press outside does: an owner that keeps the dialog open on one, such as a form\n // with unsaved changes, keeps it on the other, and the sheet returns.\n const dismissByDrag = useStableCallback((originalEvent: TouchEvent) => {\n if (onInteractOutside) {\n const request: DialogInteractOutsideEvent = new CustomEvent(\"dialog.sheetDrag\", { cancelable: true, detail: { originalEvent } })\n onInteractOutside(request)\n if (request.defaultPrevented) return false\n }\n setOpen(false)\n return true\n })\n\n useEffect(() => {\n if (!panel || mobilePlacement !== \"bottom\") return undefined\n return attachSheetDrag(panel, dismissByDrag)\n }, [panel, mobilePlacement, dismissByDrag])\n\n useLayoutEffect(() => {\n if (!panel) return\n const update = () => {\n // A phone Toolbar takes the place of the header or footer bar on its side: one the dialog places itself\n // before the bar its header becomes.\n const header = panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}:not([data-dialog-bar])`)\n ?? panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}`)\n ?? panel.querySelector<HTMLElement>(`:scope > .${s.Header}`)\n const footer = panel.querySelector<HTMLElement>(`:scope > ${BOTTOM_TOOLBAR}`) ?? panel.querySelector<HTMLElement>(`:scope > .${s.Footer}`)\n panel.style.setProperty(\"--dialog-header-height\", `${header?.offsetHeight ?? 0}px`)\n panel.style.setProperty(\"--dialog-footer-height\", `${footer?.offsetHeight ?? 0}px`)\n }\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n const observeBars = () => {\n observer?.disconnect()\n panel.querySelectorAll<HTMLElement>(`:scope > .${s.Header}, :scope > .${s.Footer}, :scope > [data-toolbar]`)\n .forEach((bar) => observer?.observe(bar, { box: \"border-box\" }))\n update()\n }\n observeBars()\n // A form can add or remove its action bar while the dialog stays open.\n const children = new MutationObserver(observeBars)\n children.observe(panel, { childList: true })\n return () => { observer?.disconnect(); children.disconnect() }\n }, [panel])\n\n const layerStyle = toCssVariables({ \"dialog-z-index\": zIndex === undefined ? undefined : String(zIndex) })\n\n return (\n <FloatingBoundaryProvider value={boundary}>\n <PhoneLayoutContext value={phoneLayout}>\n <RadixDialog.Portal forceMount container={outerPhoneLayout?.container ?? undefined}>\n {/* Portaled out of any phone layout, a phone dialog carries its own scope, above its transition: the phone\n rules of the style sheet start there. */}\n <PhoneScope enabled={phoneLayout !== null && !outerPhoneLayout?.container}>\n {/* A dialog mounted open enters too, as `open` set with the mount does */}\n <TransitionGroup\n {...(crossesScreen ? overlayTimingLarge : overlayTiming)}\n {...exitGuard.transition}\n className={s.Transition}\n overlay\n preventInitialTransition={false}\n >\n {open && (\n <div key=\"dialog\">\n <RadixDialog.Overlay\n {...overlayProps}\n ref={overlaySurfaceRef}\n className={clsx(s.Overlay, overlayProps?.className)}\n style={{ ...layerStyle, ...overlayProps?.style }}\n />\n <RadixDialog.Content\n {...dataAttributes(rest)}\n {...rootProps}\n ref={setContent}\n forceMount\n className={clsx(s.Content, rootProps?.className)}\n data-plex-dialog=\"\"\n style={{ ...toCssVariables({ \"dialog-width\": width }), ...layerStyle, ...rootProps?.style }}\n data-placement={placement === \"center\" ? undefined : placement}\n data-mobile-placement={mobilePlacement}\n data-mobile-variant={mobileVariant}\n data-surface={surface}\n data-pill={pill ? \"\" : undefined}\n onEscapeKeyDown={preventDefaultHandler}\n onInteractOutside={(event) => {\n // A press or focus in a toast is not outside: the toast region is a layer above the dialog. The\n // Toaster stops these before Radix sees them; this holds when the Toaster mounted after the dialog.\n if (inToastRegion(event.detail.originalEvent.target)) return event.preventDefault()\n onInteractOutside?.(event)\n if (event.defaultPrevented) return\n // The second click of a double click lands on the overlay: it must not undo the first\n if (performance.now() - openedAt.current < DOUBLE_CLICK) event.preventDefault()\n else exitGuard.onInteractOutside(event)\n }}\n onOpenAutoFocus={onOpenAutoFocus}\n onCloseAutoFocus={handleCloseAutoFocus}\n >\n <div ref={setPanelRef} className={clsx(s.Panel, className)}>\n {showClose && (\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" className={s.CloseButton} aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n )}\n <DialogScrollContext.Provider value={scroll}>\n <DialogSheetContext.Provider value={sheet}>\n {/* A dialog opened from a header action is not inside that header's bar */}\n <DialogBarContext.Provider value={false}>\n <ToolbarHostContext.Provider value={toolbarHost}>{children}</ToolbarHostContext.Provider>\n </DialogBarContext.Provider>\n </DialogSheetContext.Provider>\n </DialogScrollContext.Provider>\n </div>\n </RadixDialog.Content>\n </div>\n )}\n </TransitionGroup>\n </PhoneScope>\n </RadixDialog.Portal>\n </PhoneLayoutContext>\n </FloatingBoundaryProvider>\n )\n}\n\ntype DialogScrollValue = { edges: ScrollEdges; setEdges: (edges: ScrollEdges) => void }\nconst DialogScrollContext = createContext<DialogScrollValue | null>(null)\n// What the header of a Sheet needs from its Content to become the Sheet's bar on a phone\ntype DialogSheetValue = {\n showClose: boolean\n descriptionSlot: HTMLElement | null\n setBodySlot: (slot: HTMLElement | null) => void\n setOwnSlot: (slot: HTMLElement | null) => void\n}\nconst DialogSheetContext = createContext<DialogSheetValue | null>(null)\n// Inside that bar: the title, the description and the header actions take the Toolbar's parts\nconst DialogBarContext = createContext(false)\n\nconst PhoneScope = ({ enabled, children }: { enabled: boolean; children: ReactNode }) =>\n enabled ? <div className={s.PhoneScope} data-plex-layout=\"phone\">{children}</div> : children\n\nconst useDialogViewport = (content: HTMLElement | null, container: HTMLElement | null) => {\n useLayoutEffect(() => (content ? watchDialogViewport(content, container) : undefined), [content, container])\n}\nconst TOP_TOOLBAR = '[data-toolbar][data-placement=\"top\"]'\nconst BOTTOM_TOOLBAR = '[data-toolbar][data-placement=\"bottom\"]'\n\ntype DialogSlotProps = {\n children: ReactNode\n className?: string\n}\n\n/** How a Sheet's bar meets the content scrolled under it; see `BarBackground`. */\nexport type DialogBarBackground = BarBackground | BarBackgroundAlias\nexport type DialogHeaderProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"glass\" */\n background?: DialogBarBackground\n}\n\n// The header's own parts, fragments opened up, so its actions can stand at the end of the bar. A part from a\n// fragment keeps the fragment's key before its own, so two parts never share a key.\nconst headerParts = (children: ReactNode, prefix = \"\"): ReactNode[] =>\n Children.toArray(children).flatMap((part) => {\n if (!isValidElement<{ children?: ReactNode }>(part)) return [part]\n if (part.type === Fragment) return headerParts(part.props.children, `${prefix}${String(part.key)}/`)\n return [prefix ? cloneElement(part, { key: `${prefix}${String(part.key)}` }) : part]\n })\nconst isHeaderAction = (part: ReactNode): part is ReactElement => isValidElement(part) && part.type === HeaderAction\nconst isLeadingAction = (part: ReactNode): part is ReactElement<DialogHeaderActionProps> =>\n isHeaderAction(part) && (part.props as DialogHeaderActionProps).side === \"leading\"\nconst isDescription = (part: ReactNode): part is ReactElement => isValidElement(part) && part.type === Description\n\nconst Header = ({ children, className, background = \"glass\" }: DialogHeaderProps) => {\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n const scrolled = useContext(DialogScrollContext)?.edges.scrolled\n if (sheet && phone) {\n const parts = headerParts(children)\n const descriptions = parts.filter(isDescription)\n // The description reads as the first text of the content, at the top of Dialog.Body when there is one\n const description = descriptions.length > 0 && <div className={s.SheetDescription}>{descriptions}</div>\n // On a phone the header of a Sheet is its Toolbar (iOS 27 kit Sheets 507-24684, Toolbar - Top - iPhone\n // 1-54520): Close at the leading edge, the title alone centered on the row of controls, the header actions\n // at the trailing edge, all on one 44px row 16px under the top edge.\n return (\n <>\n <Toolbar background={background} className={className} data-dialog-bar=\"\">\n <DialogBarContext.Provider value={true}>\n {/* A step's Back takes the leading place, as the back button of a screen pushed inside an iOS sheet */}\n {sheet.showClose && !parts.some(isLeadingAction) && (\n <Toolbar.Leading className={s.BarClose}>\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n </Toolbar.Leading>\n )}\n {parts.filter(isLeadingAction)}\n <div className={clsx(t.Heading, s.BarHeading)}>{parts.filter((part) => !isHeaderAction(part) && !isDescription(part))}</div>\n {parts.filter((part) => isHeaderAction(part) && !isLeadingAction(part))}\n </DialogBarContext.Provider>\n </Toolbar>\n {description && (sheet.descriptionSlot ? createPortal(description, sheet.descriptionSlot) : description)}\n </>\n )\n }\n return <div className={clsx(s.Header, className)} data-background={barBackground(background)} data-scrolled={scrolled ? \"\" : undefined}>{children}</div>\n}\n\nexport type DialogHeaderActionProps = DialogSlotProps & {\n /**\n * `leading` puts the action before the title, such as the Back of a step in `Dialog.Steps`: on a phone Sheet it\n * takes the place of Close, as the back button of a screen pushed inside an iOS sheet does.\n * @default \"trailing\"\n */\n side?: \"leading\" | \"trailing\"\n}\n\nconst HeaderAction = ({ children, className, side = \"trailing\" }: DialogHeaderActionProps) => {\n const bar = useContext(DialogBarContext)\n if (bar && side === \"leading\") return <Toolbar.Leading className={clsx(s.BarClose, className)}>{children}</Toolbar.Leading>\n if (bar) return <Toolbar.Trailing className={className}>{children}</Toolbar.Trailing>\n return <div className={clsx(s.HeaderAction, className)} data-side={side === \"leading\" ? \"leading\" : undefined}>{children}</div>\n}\n\n/** The scrolling part between Header and Footer: with it, only the body scrolls */\nconst Body = ({ children, className }: DialogSlotProps) => {\n const setEdges = useContext(DialogScrollContext)?.setEdges\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n // A phone Sheet's description starts the body (Dialog.Header portals it here)\n const setDescriptionSlot = sheet && phone ? sheet.setBodySlot : null\n const element = useRef<HTMLDivElement | null>(null)\n useLayoutEffect(() => {\n const body = element.current\n if (!body || !setEdges) return\n const stop = observeScrollEdges(body, setEdges)\n return () => { stop(); setEdges(NO_SCROLL_EDGES) }\n }, [setEdges])\n return (\n <div ref={element} className={clsx(s.Body, className)}>\n {setDescriptionSlot && <div ref={setDescriptionSlot} className={s.SheetDescriptionSlot} />}\n {children}\n </div>\n )\n}\n\n/**\n * Where a phone Sheet's description goes in content of your own, such as a scroller inside a form so that Enter\n * submits: the description starts it, as it starts Dialog.Body, and it comes before the body's place. It renders\n * nothing outside a phone Sheet.\n */\nconst DescriptionSlot = () => {\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n const setOwnSlot = sheet && phone ? sheet.setOwnSlot : null\n return setOwnSlot ? <div ref={setOwnSlot} className={s.SheetDescriptionSlot} /> : null\n}\n\nexport type DialogFooterProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"soft\" */\n background?: DialogBarBackground\n /** Override the mobile action layout. Two alert actions default to inline, three or more and sheets to stacked. */\n mobileLayout?: \"inline\" | \"stacked\"\n}\n\nconst Footer = ({ children, className, mobileLayout, background = \"soft\" }: DialogFooterProps) => {\n const setFooter = useFloatingBoundaryRegistration()?.setFooter\n const contentBelow = useContext(DialogScrollContext)?.edges.contentBelow\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n // A phone Sheet stacks its main action on top, as an iOS setup sheet does. A footer is written with it last,\n // where a desktop row ends, so the order is turned in the page itself: focus and a screen reader meet the\n // actions in the order they are seen.\n const parts = sheet && phone && mobileLayout !== \"inline\" ? headerParts(children).reverse() : children\n return (\n <div\n ref={setFooter}\n className={clsx(s.Footer, className)}\n data-mobile-layout={mobileLayout}\n data-background={barBackground(background)}\n data-content-below={contentBelow ? \"\" : undefined}\n >\n {parts}\n </div>\n )\n}\n\nconst Title = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n return <RadixDialog.Title className={clsx(bar ? t.Title : s.Title, className)}>{children}</RadixDialog.Title>\n}\n\nconst Description = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n const element = useRef<HTMLParagraphElement | null>(null)\n const [shown, setShown] = useState(false)\n useLayoutEffect(() => {\n // The header leaves its own descriptions out of the bar. One the bar still holds, inside a part of the\n // header's own, is the title's second line (Toolbar's subtitle) when the reader sees it; one that is only\n // read out, visually hidden, leaves the title on its one line.\n const node = element.current\n // A measurement of the laid-out description, which only an effect after layout can read\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setShown(bar && !!node && node.offsetHeight > 1 && node.offsetWidth > 1)\n }, [bar, children, className])\n return (\n <RadixDialog.Description ref={element} className={clsx(bar && shown ? t.Subtitle : s.Description, className)}>\n {children}\n </RadixDialog.Description>\n )\n}\n\nexport type DialogStepsProps = {\n /** The step on screen. A new value brings its content in. */\n step: string | number\n /**\n * `forward` brings the new step in from the trailing edge over the one before, as a push on iOS; `back` returns to\n * a step before it.\n * @default \"forward\"\n */\n direction?: \"forward\" | \"back\"\n children: ReactNode\n className?: string\n}\n\n/** The steps of a flow inside a dialog, such as a sign-in that asks for an email and then a code. */\nconst Steps = ({ step, direction = \"forward\", children, className }: DialogStepsProps) => (\n <div className={clsx(s.Steps, className)} data-direction={direction}>\n <TransitionGroup {...STEP_TIMING} as=\"div\" overlay className={s.Step} onEnter={enterStep} onExit={leaveStep} onExitActive={settleStepHeight} onExitComplete={releaseStepHeight}>\n <div key={step} data-dialog-step=\"\" tabIndex={-1}>{children}</div>\n </TransitionGroup>\n </div>\n)\n\nconst Close = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Close asChild>{children}</RadixDialog.Close>\n}\n\nDialog.Trigger = Trigger\nDialog.Content = Content\nDialog.Header = Header\nDialog.HeaderAction = HeaderAction\nDialog.Body = Body\nDialog.Footer = Footer\nDialog.Title = Title\nDialog.Description = Description\nDialog.DescriptionSlot = DescriptionSlot\nDialog.Close = Close\nDialog.Steps = Steps\n"]}
1
+ {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,cAAc,EACd,WAAW,EACX,UAAU,EACV,SAAS,EACT,KAAK,EACL,eAAe,EAC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AK,GAAG,CAAC,EAAE,QAAQ,EAA2B,EAAE,EAAE;IACtD,MAAM,YAAY,GAAG,UAAU,CAAC,yBAAyB,CAAC,CAAA;IAC1D,8GAA8G;IAC9G,qBAAqB;IACrB,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,CACL,KAAC,IAAI,CAAC,IAAI,IAAO,IAAI,EAAE,QAAQ,EAAI,OAAO,EAAE,CAAC,KAAoC,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB;gBAAE,YAAY,EAAE,CAAA,CAAC,CAAC,YAClI,QAAQ,GACC,CACb,CAAA;IACH,CAAC;IACD,OAAO,KAAC,WAAW,CAAC,KAAK,IAAC,OAAO,kBAAE,QAAQ,GAAqB,CAAA;AAClE,CAAC,CAAA;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;AACxB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;AACxB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;AACtB,MAAM,CAAC,YAAY,GAAG,YAAY,CAAA;AAClC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAA;AAClB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;AACtB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;AACpB,MAAM,CAAC,WAAW,GAAG,WAAW,CAAA;AAChC,MAAM,CAAC,eAAe,GAAG,eAAe,CAAA;AACxC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;AACpB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { Dialog as RadixDialog, Slot } from \"radix-ui\"\nimport {\n Children,\n cloneElement,\n createContext,\n Fragment,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from \"../../hooks/useFloatingBoundary\"\nimport { useEscCloseStack } from \"../../hooks/useEscCloseStack\"\nimport { inToastRegion } from \"../../lib/toastRegion\"\nimport { cancelableKeyCopy, dataAttributes, keepMovedFocus, preventDefaultHandler, toCssVariables } from \"../../lib/helpers\"\nimport { useStableCallback } from \"../../hooks/useStableCallback\"\nimport { Button } from \"../Button\"\nimport { NavigationButton } from \"../Button/NavigationButton\"\nimport { Popover } from \"../Popover\"\nimport { barBackground, Toolbar, ToolbarHostContext, type BarBackground, type BarBackgroundAlias, type ToolbarHost } from \"../Toolbar/Toolbar\"\nimport { NO_SCROLL_EDGES, observeScrollEdges, sameScrollEdges, type ScrollEdges } from \"../../lib/scrollEdges\"\nimport { TransitionGroup } from \"../Transition\"\nimport { createExitGuard, overlayTiming, overlayTimingLarge } from \"../Transition/shared\"\nimport { attachSheetDrag } from \"./sheetDrag\"\nimport { watchDialogViewport } from \"./dialogViewport\"\nimport { enterStep, leaveStep, releaseStepHeight, settleStepHeight, STEP_TIMING } from \"./dialogSteps\"\nimport { PhoneLayoutContext, usePhoneLayout, type PhoneLayoutValue } from \"../PhoneLayout/PhoneLayout\"\nimport { usePopoverDismissableSurface } from \"../Popover/deferredOutsidePress\"\nimport s from \"@plexui/styles/components/Dialog/Dialog.module.css\"\nimport t from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\ntype DialogContextValue = {\n open: boolean\n setOpen: (nextState: boolean) => void\n}\n\nconst DOUBLE_CLICK = 300\n\nconst DialogContext = createContext<DialogContextValue | null>(null)\n\nconst useDialogContext = () => {\n const context = useContext(DialogContext)\n\n if (!context) {\n throw new Error(\"Dialog compound components must be used inside <Dialog>\")\n }\n\n return context\n}\n\nexport type DialogProps = {\n open?: boolean\n onOpenChange?: (open: boolean) => void\n children: ReactNode\n}\n\nexport const Dialog = ({\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n children,\n}: DialogProps) => {\n const [open, setOpen] = useState<boolean>(false)\n const isOpen = controlledOpen ?? open\n\n const handleOpenChange = useCallback(\n (nextState: boolean) => {\n controlledOnOpenChange?.(nextState)\n setOpen(nextState)\n },\n [controlledOnOpenChange],\n )\n\n const store = useMemo<DialogContextValue>(\n () => ({\n open: isOpen,\n setOpen: handleOpenChange,\n }),\n [isOpen, handleOpenChange],\n )\n\n return (\n <DialogContext value={store}>\n <RadixDialog.Root open={isOpen} onOpenChange={handleOpenChange}>\n {children}\n </RadixDialog.Root>\n </DialogContext>\n )\n}\n\nconst Trigger = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Trigger asChild>{children}</RadixDialog.Trigger>\n}\n\nexport type DialogPlacement = \"center\" | \"top\" | \"bottom\" | \"start\" | \"end\" | \"fullscreen\"\n\n/**\n * A press or a focus outside the dialog, or a phone sheet pulled down to close; `event.detail.originalEvent` is the\n * browser's event (a TouchEvent for the sheet).\n */\nexport type DialogInteractOutsideEvent = CustomEvent<{ originalEvent: PointerEvent | FocusEvent | TouchEvent }>\n\n/**\n * What a dialog asks before it closes with unsaved changes: the question and its destructive answer. On a phone\n * Sheet it stands at the bar's Close as an iOS confirmation (a glass popover over the sheet, no dimming; a press\n * outside it keeps editing); elsewhere it is an alert with a second answer that keeps editing.\n */\nexport type DialogConfirmClose = {\n /** The question, such as \"Are you sure you want to discard this new note?\" */\n message: ReactNode\n /** The answer that closes and loses the changes. @default \"Discard Changes\" */\n confirmLabel?: ReactNode\n /** The alert's answer that keeps the dialog open. @default \"Keep Editing\" */\n cancelLabel?: ReactNode\n}\n\n/** Class, style and data attributes for one of the dialog's layers. */\nexport type DialogLayerProps = {\n className?: string\n style?: CSSProperties\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nexport type DialogContentProps = {\n children: ReactNode\n width?: number | string\n showClose?: boolean\n /**\n * Rounder panel and a round close button, for dialogs that sit beside pill controls.\n * @default false\n */\n pill?: boolean\n className?: string\n /**\n * Where the panel sits: centered, near the top (search, command lists),\n * a sheet along the bottom, a full-height panel on the start or end side,\n * or the whole screen.\n * @default center\n */\n placement?: DialogPlacement\n /**\n * Where a phone sheet stands at 767px and below: `bottom`, or `fullscreen` for the whole screen. `center` is the\n * alert's place: without `mobileVariant` it makes the dialog an alert. @default \"fullscreen\" for a fullscreen\n * dialog, else \"bottom\"\n */\n mobilePlacement?: Extract<DialogPlacement, \"center\" | \"bottom\" | \"fullscreen\">\n /**\n * The iOS presentation at 767px and below. A phone has two modal views: the sheet, which iOS gives any view it\n * presents, and the alert, a short question with its answers (UIAlertController). @default \"sheet\"\n */\n mobileVariant?: \"alert\" | \"sheet\"\n /** Mobile panel palette; dark mode uses elevated surfaces. @default \"plain\" */\n surface?: \"plain\" | \"grouped\"\n /**\n * Called when focus moves into the dialog on open. Call\n * `event.preventDefault()` to focus something else yourself.\n */\n onOpenAutoFocus?: (event: Event) => void\n /** Called when focus returns on close. Call `event.preventDefault()` to keep it elsewhere. */\n onCloseAutoFocus?: (event: Event) => void\n /**\n * Called on Escape before the dialog closes. Call `event.preventDefault()` to keep it open, such as for a form\n * with unsaved changes.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n /**\n * Called on a press or a focus outside the dialog, and on a phone sheet pulled down to close, before it closes. Call\n * `event.preventDefault()` to keep it open, such as for a form with unsaved changes (the sheet then returns, as an\n * iOS sheet does under `isModalInPresentation`), or for a press on a developer panel over the page.\n */\n onInteractOutside?: (event: DialogInteractOutsideEvent) => void\n /**\n * Asks before the dialog closes, as a form with unsaved changes does: Close, Escape, a press outside and a phone\n * sheet pulled down all ask first. Pass it while there are changes and leave it out (or `false`) when there are\n * none. Setting `open` to false yourself, such as after Save, closes at once.\n */\n confirmClose?: DialogConfirmClose | false | null\n /** Stack order of the overlay and the dialog. @default 50 */\n zIndex?: number\n /** Class, style and data attributes for the fixed layer that holds the panel. Data attributes of Content land here too. */\n rootProps?: DialogLayerProps\n /** Class, style and data attributes for the overlay. */\n overlayProps?: DialogLayerProps\n /**\n * `phone` lays the dialog out as on a phone at any window width. Inside a PhoneLayout it always is.\n * @default \"auto\"\n */\n layout?: \"auto\" | \"phone\"\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nconst Content = ({\n children,\n width = 480,\n showClose = true,\n pill = false,\n className,\n placement = \"center\",\n mobilePlacement: requestedMobilePlacement,\n mobileVariant: requestedMobileVariant,\n surface = \"plain\",\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onInteractOutside,\n confirmClose,\n zIndex,\n rootProps,\n overlayProps,\n layout = \"auto\",\n ...rest\n}: DialogContentProps) => {\n const { open, setOpen } = useDialogContext()\n const outerPhoneLayout = useContext(PhoneLayoutContext)\n // A dialog laid out as on a phone by its own prop, outside a PhoneLayout, keeps the window: what it holds and\n // the dialogs it opens are phone ones too.\n const phoneLayout = useMemo<PhoneLayoutValue | null>(\n () => outerPhoneLayout ?? (layout === \"phone\" ? { container: null } : null),\n [outerPhoneLayout, layout],\n )\n const [content, setContent] = useState<HTMLDivElement | null>(null)\n useDialogViewport(content, outerPhoneLayout?.container ?? null)\n const overlaySurfaceRef = usePopoverDismissableSurface()\n // A phone has no other modal view than the sheet and the alert (owner 12.11: «нет такого в iOS»): a centered\n // dialog is an alert, any other a sheet, at the bottom or over the whole screen.\n const mobileVariant = requestedMobileVariant ?? (requestedMobilePlacement === \"center\" ? \"alert\" : \"sheet\")\n const mobilePlacement =\n mobileVariant === \"alert\"\n ? \"center\"\n : (requestedMobilePlacement ?? placement) === \"fullscreen\" ? \"fullscreen\" : \"bottom\"\n const [exitGuard] = useState(createExitGuard)\n const [panel, setPanel] = useState<HTMLDivElement | null>(null)\n // Dialog.Body reports where content lies under the bars: they show their lines with it.\n const [edges, setEdgesState] = useState(NO_SCROLL_EDGES)\n const setEdges = useCallback((next: ScrollEdges) => setEdgesState((current) => sameScrollEdges(current, next) ? current : next), [])\n const scroll = useMemo(() => ({ edges, setEdges }), [edges, setEdges])\n const toolbarHost = useMemo<ToolbarHost>(() => ({ kind: \"dialog\", scrolled: edges.scrolled, contentBelow: edges.contentBelow }), [edges])\n // Where a phone Sheet's description goes: the first text of the content, under the bar. Dialog.Body offers\n // its top; a Dialog.DescriptionSlot of the content's own, such as a scroller inside a form, comes first.\n const [bodySlot, setBodySlot] = useState<HTMLElement | null>(null)\n const [ownSlot, setOwnSlot] = useState<HTMLElement | null>(null)\n const descriptionSlot = ownSlot ?? bodySlot\n // A close asked for while there are changes waits for the answer (`confirmClose`); the ref answers at once for\n // the press that dismisses the question itself, so it does not ask again, nor does one just after it closed.\n const [confirming, setConfirmingState] = useState(false)\n const confirmingRef = useRef(false)\n const confirmClosedAt = useRef(0)\n const setConfirming = useCallback((next: boolean) => {\n if (confirmingRef.current && !next) confirmClosedAt.current = performance.now()\n confirmingRef.current = next\n setConfirmingState(next)\n }, [])\n useEffect(() => { if (!open || !confirmClose) setConfirming(false) }, [open, confirmClose, setConfirming])\n const [closeButton, setCloseButton] = useState<HTMLElement | null>(null)\n // Where focus returns when the question is dismissed: the field or button that asked to close\n const returnFocus = useRef<HTMLElement | null>(null)\n const requestClose = useStableCallback(() => {\n // A press on a dialog that is already leaving (closed from outside, its exit still on screen) asks nothing\n if (!open) return\n if (!confirmClose) return setOpen(false)\n // A press that dismissed the question (its pointer-down or click lands here too) keeps editing\n if (confirmingRef.current || performance.now() - confirmClosedAt.current < DOUBLE_CLICK) return\n returnFocus.current = document.activeElement instanceof HTMLElement ? document.activeElement : null\n setConfirming(true)\n })\n // The answer that discards: the question leaves first, then the dialog, as iOS dismisses the confirmation before\n // the sheet. Together, the question would stand still over the sheet as it leaves: a closing dialog holds what\n // it shows, the transitions inside it too.\n const confirmTimer = useRef<ReturnType<typeof setTimeout>>(undefined)\n // A close from outside, or a new opening, ends a discard that is still waiting for the question to leave\n useEffect(() => () => clearTimeout(confirmTimer.current), [open])\n const confirmAndClose = useStableCallback(() => {\n setConfirming(false)\n clearTimeout(confirmTimer.current)\n confirmTimer.current = setTimeout(() => setOpen(false), overlayTiming.exitDuration)\n })\n const asksToClose = Boolean(confirmClose)\n const sheet = useMemo<DialogSheetValue | null>(\n () => (mobileVariant === \"sheet\"\n ? { showClose, descriptionSlot, setBodySlot, setOwnSlot, asksToClose, requestClose, setCloseButton }\n : null),\n [mobileVariant, showClose, descriptionSlot, asksToClose, requestClose],\n )\n const boundary = useFloatingBoundaryScope()\n const setRoot = boundary.setRoot\n const setPanelRef = useCallback((node: HTMLDivElement | null) => { setPanel(node); setRoot(node) }, [setRoot])\n const openedAt = useRef(0)\n // A sheet crosses the screen on a phone, and wherever its owner asked for one; a dialog left to its defaults stays\n // the centred panel on a desktop, with that panel's timing.\n const phone = usePhoneLayout() || layout === \"phone\"\n const sheetCrosses = (phone || requestedMobileVariant === \"sheet\" || requestedMobilePlacement !== undefined) &&\n (mobilePlacement === \"bottom\" || mobilePlacement === \"fullscreen\")\n const crossesScreen =\n placement === \"bottom\" || placement === \"start\" || placement === \"end\" || placement === \"fullscreen\" || sheetCrosses\n\n // The content of a closing dialog is frozen for its exit, so this reads the owner's latest\n // handler: state that changes together with the close decides where focus returns.\n const handleCloseAutoFocus = useStableCallback((event: Event) => {\n onCloseAutoFocus?.(event)\n keepMovedFocus(event)\n })\n\n useEscCloseStack(open, (event) => {\n if (onEscapeKeyDown) {\n const request = cancelableKeyCopy(event)\n onEscapeKeyDown(request)\n if (request.defaultPrevented) return\n }\n requestClose()\n })\n\n useEffect(() => {\n if (open) openedAt.current = performance.now()\n }, [open])\n\n // A sheet pulled down asks as a press outside does: an owner that keeps the dialog open on one, such as a form\n // with unsaved changes, keeps it on the other, and the sheet returns.\n const dismissByDrag = useStableCallback((originalEvent: TouchEvent) => {\n if (onInteractOutside) {\n const request: DialogInteractOutsideEvent = new CustomEvent(\"dialog.sheetDrag\", { cancelable: true, detail: { originalEvent } })\n onInteractOutside(request)\n if (request.defaultPrevented) return false\n }\n if (confirmClose) {\n requestClose()\n return false\n }\n setOpen(false)\n return true\n })\n\n useEffect(() => {\n if (!panel || mobilePlacement !== \"bottom\") return undefined\n return attachSheetDrag(panel, dismissByDrag)\n }, [panel, mobilePlacement, dismissByDrag])\n\n useLayoutEffect(() => {\n if (!panel) return\n const update = () => {\n // A phone Toolbar takes the place of the header or footer bar on its side: one the dialog places itself\n // before the bar its header becomes.\n const header = panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}:not([data-dialog-bar])`)\n ?? panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}`)\n ?? panel.querySelector<HTMLElement>(`:scope > .${s.Header}`)\n const footer = panel.querySelector<HTMLElement>(`:scope > ${BOTTOM_TOOLBAR}`) ?? panel.querySelector<HTMLElement>(`:scope > .${s.Footer}`)\n panel.style.setProperty(\"--dialog-header-height\", `${header?.offsetHeight ?? 0}px`)\n panel.style.setProperty(\"--dialog-footer-height\", `${footer?.offsetHeight ?? 0}px`)\n }\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n const observeBars = () => {\n observer?.disconnect()\n panel.querySelectorAll<HTMLElement>(`:scope > .${s.Header}, :scope > .${s.Footer}, :scope > [data-toolbar]`)\n .forEach((bar) => observer?.observe(bar, { box: \"border-box\" }))\n update()\n }\n observeBars()\n // A form can add or remove its action bar while the dialog stays open.\n const children = new MutationObserver(observeBars)\n children.observe(panel, { childList: true })\n return () => { observer?.disconnect(); children.disconnect() }\n }, [panel])\n\n const layerStyle = toCssVariables({ \"dialog-z-index\": zIndex === undefined ? undefined : String(zIndex) })\n\n return (\n <FloatingBoundaryProvider value={boundary}>\n <PhoneLayoutContext value={phoneLayout}>\n <RadixDialog.Portal forceMount container={outerPhoneLayout?.container ?? undefined}>\n {/* Portaled out of any phone layout, a phone dialog carries its own scope, above its transition: the phone\n rules of the style sheet start there. */}\n <PhoneScope enabled={phoneLayout !== null && !outerPhoneLayout?.container}>\n {/* A dialog mounted open enters too, as `open` set with the mount does */}\n <TransitionGroup\n {...(crossesScreen ? overlayTimingLarge : overlayTiming)}\n {...exitGuard.transition}\n className={s.Transition}\n overlay\n preventInitialTransition={false}\n >\n {open && (\n <div key=\"dialog\">\n <RadixDialog.Overlay\n {...overlayProps}\n ref={overlaySurfaceRef}\n className={clsx(s.Overlay, overlayProps?.className)}\n style={{ ...layerStyle, ...overlayProps?.style }}\n />\n <RadixDialog.Content\n {...dataAttributes(rest)}\n {...rootProps}\n ref={setContent}\n forceMount\n className={clsx(s.Content, rootProps?.className)}\n data-plex-dialog=\"\"\n style={{ ...toCssVariables({ \"dialog-width\": width }), ...layerStyle, ...rootProps?.style }}\n data-placement={placement === \"center\" ? undefined : placement}\n data-mobile-placement={mobilePlacement}\n data-mobile-variant={mobileVariant}\n data-surface={surface}\n data-pill={pill ? \"\" : undefined}\n onEscapeKeyDown={preventDefaultHandler}\n onInteractOutside={(event) => {\n // A press or focus in a toast is not outside: the toast region is a layer above the dialog. The\n // Toaster stops these before Radix sees them; this holds when the Toaster mounted after the dialog.\n if (inToastRegion(event.detail.originalEvent.target)) return event.preventDefault()\n onInteractOutside?.(event)\n if (event.defaultPrevented) return\n // With changes a press outside asks first; one that dismisses the question keeps editing\n if (confirmClose) {\n event.preventDefault()\n requestClose()\n return\n }\n // The second click of a double click lands on the overlay: it must not undo the first\n if (performance.now() - openedAt.current < DOUBLE_CLICK) event.preventDefault()\n else exitGuard.onInteractOutside(event)\n }}\n onOpenAutoFocus={onOpenAutoFocus}\n onCloseAutoFocus={handleCloseAutoFocus}\n >\n <div ref={setPanelRef} className={clsx(s.Panel, className)}>\n {showClose && (confirmClose ? (\n <NavigationButton action=\"close\" variant=\"ghost\" className={s.CloseButton} aria-label=\"Close dialog\" onClick={requestClose} />\n ) : (\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" className={s.CloseButton} aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n ))}\n <DialogRequestCloseContext.Provider value={confirmClose ? requestClose : null}>\n <DialogScrollContext.Provider value={scroll}>\n <DialogSheetContext.Provider value={sheet}>\n {/* A dialog opened from a header action is not inside that header's bar */}\n <DialogBarContext.Provider value={false}>\n <ToolbarHostContext.Provider value={toolbarHost}>{children}</ToolbarHostContext.Provider>\n </DialogBarContext.Provider>\n </DialogSheetContext.Provider>\n </DialogScrollContext.Provider>\n </DialogRequestCloseContext.Provider>\n {confirmClose && (\n <ConfirmClose\n {...confirmClose}\n open={confirming}\n anchor={phone && mobileVariant === \"sheet\" ? closeButton : null}\n onOpenChange={setConfirming}\n returnFocus={returnFocus}\n onConfirm={confirmAndClose}\n zIndex={zIndex}\n />\n )}\n </div>\n </RadixDialog.Content>\n </div>\n )}\n </TransitionGroup>\n </PhoneScope>\n </RadixDialog.Portal>\n </PhoneLayoutContext>\n </FloatingBoundaryProvider>\n )\n}\n\ntype DialogScrollValue = { edges: ScrollEdges; setEdges: (edges: ScrollEdges) => void }\nconst DialogScrollContext = createContext<DialogScrollValue | null>(null)\n// What the header of a Sheet needs from its Content to become the Sheet's bar on a phone\ntype DialogSheetValue = {\n showClose: boolean\n descriptionSlot: HTMLElement | null\n setBodySlot: (slot: HTMLElement | null) => void\n setOwnSlot: (slot: HTMLElement | null) => void\n /** The bar's Close asks first (`confirmClose`) */\n asksToClose: boolean\n requestClose: () => void\n setCloseButton: (button: HTMLElement | null) => void\n}\nconst DialogSheetContext = createContext<DialogSheetValue | null>(null)\n// A close that asks first (`confirmClose`): Dialog.Close inside the content asks as the Close button does\nconst DialogRequestCloseContext = createContext<(() => void) | null>(null)\n// Inside that bar: the title, the description and the header actions take the Toolbar's parts\nconst DialogBarContext = createContext(false)\n\nconst PhoneScope = ({ enabled, children }: { enabled: boolean; children: ReactNode }) =>\n enabled ? <div className={s.PhoneScope} data-plex-layout=\"phone\">{children}</div> : children\n\nconst useDialogViewport = (content: HTMLElement | null, container: HTMLElement | null) => {\n useLayoutEffect(() => (content ? watchDialogViewport(content, container) : undefined), [content, container])\n}\nconst TOP_TOOLBAR = '[data-toolbar][data-placement=\"top\"]'\nconst BOTTOM_TOOLBAR = '[data-toolbar][data-placement=\"bottom\"]'\n\ntype DialogSlotProps = {\n children: ReactNode\n className?: string\n}\n\n/** How a Sheet's bar meets the content scrolled under it; see `BarBackground`. */\nexport type DialogBarBackground = BarBackground | BarBackgroundAlias\nexport type DialogHeaderProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"glass\" */\n background?: DialogBarBackground\n}\n\n// The header's own parts, fragments opened up, so its actions can stand at the end of the bar. A part from a\n// fragment keeps the fragment's key before its own, so two parts never share a key.\nconst headerParts = (children: ReactNode, prefix = \"\"): ReactNode[] =>\n Children.toArray(children).flatMap((part) => {\n if (!isValidElement<{ children?: ReactNode }>(part)) return [part]\n if (part.type === Fragment) return headerParts(part.props.children, `${prefix}${String(part.key)}/`)\n return [prefix ? cloneElement(part, { key: `${prefix}${String(part.key)}` }) : part]\n })\nconst isHeaderAction = (part: ReactNode): part is ReactElement => isValidElement(part) && part.type === HeaderAction\nconst isLeadingAction = (part: ReactNode): part is ReactElement<DialogHeaderActionProps> =>\n isHeaderAction(part) && (part.props as DialogHeaderActionProps).side === \"leading\"\nconst isDescription = (part: ReactNode): part is ReactElement => isValidElement(part) && part.type === Description\n\nconst Header = ({ children, className, background = \"glass\" }: DialogHeaderProps) => {\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n const scrolled = useContext(DialogScrollContext)?.edges.scrolled\n if (sheet && phone) {\n const parts = headerParts(children)\n const descriptions = parts.filter(isDescription)\n // The description reads as the first text of the content, at the top of Dialog.Body when there is one\n const description = descriptions.length > 0 && <div className={s.SheetDescription}>{descriptions}</div>\n // On a phone the header of a Sheet is its Toolbar (iOS 27 kit Sheets 507-24684, Toolbar - Top - iPhone\n // 1-54520): Close at the leading edge, the title alone centered on the row of controls, the header actions\n // at the trailing edge, all on one 44px row 16px under the top edge.\n return (\n <>\n <Toolbar background={background} className={className} data-dialog-bar=\"\">\n <DialogBarContext.Provider value={true}>\n {/* A step's Back takes the leading place, as the back button of a screen pushed inside an iOS sheet */}\n {sheet.showClose && !parts.some(isLeadingAction) && (\n <Toolbar.Leading className={s.BarClose}>\n {sheet.asksToClose ? (\n <NavigationButton ref={sheet.setCloseButton} action=\"close\" variant=\"ghost\" aria-label=\"Close dialog\" onClick={sheet.requestClose} />\n ) : (\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n )}\n </Toolbar.Leading>\n )}\n {parts.filter(isLeadingAction)}\n <div className={clsx(t.Heading, s.BarHeading)}>{parts.filter((part) => !isHeaderAction(part) && !isDescription(part))}</div>\n {parts.filter((part) => isHeaderAction(part) && !isLeadingAction(part))}\n </DialogBarContext.Provider>\n </Toolbar>\n {description && (sheet.descriptionSlot ? createPortal(description, sheet.descriptionSlot) : description)}\n </>\n )\n }\n return <div className={clsx(s.Header, className)} data-background={barBackground(background)} data-scrolled={scrolled ? \"\" : undefined}>{children}</div>\n}\n\nexport type DialogHeaderActionProps = DialogSlotProps & {\n /**\n * `leading` puts the action before the title, such as the Back of a step in `Dialog.Steps`: on a phone Sheet it\n * takes the place of Close, as the back button of a screen pushed inside an iOS sheet does.\n * @default \"trailing\"\n */\n side?: \"leading\" | \"trailing\"\n}\n\nconst HeaderAction = ({ children, className, side = \"trailing\" }: DialogHeaderActionProps) => {\n const bar = useContext(DialogBarContext)\n if (bar && side === \"leading\") return <Toolbar.Leading className={clsx(s.BarClose, className)}>{children}</Toolbar.Leading>\n if (bar) return <Toolbar.Trailing className={className}>{children}</Toolbar.Trailing>\n return <div className={clsx(s.HeaderAction, className)} data-side={side === \"leading\" ? \"leading\" : undefined}>{children}</div>\n}\n\n/** The scrolling part between Header and Footer: with it, only the body scrolls */\nconst Body = ({ children, className }: DialogSlotProps) => {\n const setEdges = useContext(DialogScrollContext)?.setEdges\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n // A phone Sheet's description starts the body (Dialog.Header portals it here)\n const setDescriptionSlot = sheet && phone ? sheet.setBodySlot : null\n const element = useRef<HTMLDivElement | null>(null)\n useLayoutEffect(() => {\n const body = element.current\n if (!body || !setEdges) return\n const stop = observeScrollEdges(body, setEdges)\n return () => { stop(); setEdges(NO_SCROLL_EDGES) }\n }, [setEdges])\n return (\n <div ref={element} className={clsx(s.Body, className)}>\n {setDescriptionSlot && <div ref={setDescriptionSlot} className={s.SheetDescriptionSlot} />}\n {children}\n </div>\n )\n}\n\n/**\n * Where a phone Sheet's description goes in content of your own, such as a scroller inside a form so that Enter\n * submits: the description starts it, as it starts Dialog.Body, and it comes before the body's place. It renders\n * nothing outside a phone Sheet.\n */\nconst DescriptionSlot = () => {\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n const setOwnSlot = sheet && phone ? sheet.setOwnSlot : null\n return setOwnSlot ? <div ref={setOwnSlot} className={s.SheetDescriptionSlot} /> : null\n}\n\nexport type DialogFooterProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"soft\" */\n background?: DialogBarBackground\n /** Override the mobile action layout. Two alert actions default to inline, three or more and sheets to stacked. */\n mobileLayout?: \"inline\" | \"stacked\"\n}\n\nconst Footer = ({ children, className, mobileLayout, background = \"soft\" }: DialogFooterProps) => {\n const setFooter = useFloatingBoundaryRegistration()?.setFooter\n const contentBelow = useContext(DialogScrollContext)?.edges.contentBelow\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n // A phone Sheet stacks its main action on top, as an iOS setup sheet does. A footer is written with it last,\n // where a desktop row ends, so the order is turned in the page itself: focus and a screen reader meet the\n // actions in the order they are seen.\n const parts = sheet && phone && mobileLayout !== \"inline\" ? headerParts(children).reverse() : children\n return (\n <div\n ref={setFooter}\n className={clsx(s.Footer, className)}\n data-mobile-layout={mobileLayout}\n data-background={barBackground(background)}\n data-content-below={contentBelow ? \"\" : undefined}\n >\n {parts}\n </div>\n )\n}\n\nconst Title = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n return <RadixDialog.Title className={clsx(bar ? t.Title : s.Title, className)}>{children}</RadixDialog.Title>\n}\n\nconst Description = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n const element = useRef<HTMLParagraphElement | null>(null)\n const [shown, setShown] = useState(false)\n useLayoutEffect(() => {\n // The header leaves its own descriptions out of the bar. One the bar still holds, inside a part of the\n // header's own, is the title's second line (Toolbar's subtitle) when the reader sees it; one that is only\n // read out, visually hidden, leaves the title on its one line.\n const node = element.current\n // A measurement of the laid-out description, which only an effect after layout can read\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setShown(bar && !!node && node.offsetHeight > 1 && node.offsetWidth > 1)\n }, [bar, children, className])\n return (\n <RadixDialog.Description ref={element} className={clsx(bar && shown ? t.Subtitle : s.Description, className)}>\n {children}\n </RadixDialog.Description>\n )\n}\n\nexport type DialogStepsProps = {\n /** The step on screen. A new value brings its content in. */\n step: string | number\n /**\n * `forward` brings the new step in from the trailing edge over the one before, as a push on iOS; `back` returns to\n * a step before it.\n * @default \"forward\"\n */\n direction?: \"forward\" | \"back\"\n children: ReactNode\n className?: string\n}\n\n/** The steps of a flow inside a dialog, such as a sign-in that asks for an email and then a code. */\nconst Steps = ({ step, direction = \"forward\", children, className }: DialogStepsProps) => (\n <div className={clsx(s.Steps, className)} data-direction={direction}>\n <TransitionGroup {...STEP_TIMING} as=\"div\" overlay className={s.Step} onEnter={enterStep} onExit={leaveStep} onExitActive={settleStepHeight} onExitComplete={releaseStepHeight}>\n <div key={step} data-dialog-step=\"\" tabIndex={-1}>{children}</div>\n </TransitionGroup>\n </div>\n)\n\ntype ConfirmCloseProps = DialogConfirmClose & {\n open: boolean\n /** The phone Sheet's Close: the question stands at it. Without one it is an alert. */\n anchor: HTMLElement | null\n onOpenChange: (open: boolean) => void\n onConfirm: () => void\n returnFocus: { current: HTMLElement | null }\n /** The owner dialog's stack order: the question stands over it */\n zIndex?: number\n}\n\n// iOS asks at the button that closes (a confirmation dialog presented from the sheet's Close on iOS 27: a glass\n// popover under it, no dimming, the question in 17 regular over a full-width destructive pill); with no such button,\n// and on a desktop, the question is an alert.\nconst ConfirmClose = ({\n message,\n confirmLabel = \"Discard Changes\",\n cancelLabel = \"Keep Editing\",\n open,\n anchor,\n onOpenChange,\n onConfirm,\n returnFocus,\n zIndex,\n}: ConfirmCloseProps) => {\n const messageId = useId()\n if (anchor) {\n return (\n <Popover open={open} onOpenChange={onOpenChange}>\n <Popover.Anchor element={anchor} />\n {/* Over the Close, its corner 6 before the button's, as the native confirmation grows out of it */}\n <Popover.Content side=\"bottom\" align=\"start\" sideOffset={-anchor.offsetHeight} alignOffset={-6} collisionPadding={10} width={240} minWidth={240} zIndex={zIndex} aria-labelledby={messageId} className={s.ConfirmClose} data-dialog-confirm-close=\"\">\n <p id={messageId} className={s.ConfirmCloseMessage}>{message}</p>\n <Button block pill color=\"danger\" variant=\"soft\" className={s.ConfirmCloseAction} onClick={onConfirm}>{confirmLabel}</Button>\n </Popover.Content>\n </Popover>\n )\n }\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <Content\n mobileVariant=\"alert\"\n surface=\"plain\"\n width={360}\n showClose={false}\n zIndex={zIndex}\n data-dialog-confirm-close=\"\"\n onCloseAutoFocus={(event) => {\n const target = returnFocus.current\n if (target?.isConnected) {\n event.preventDefault()\n target.focus({ preventScroll: true })\n }\n }}\n >\n {/* The question names the alert, as an alert's title does */}\n <Header>\n <Title>{message}</Title>\n </Header>\n <Footer>\n <Close><Button color=\"secondary\" variant=\"soft\">{cancelLabel}</Button></Close>\n <Button color=\"danger\" onClick={onConfirm}>{confirmLabel}</Button>\n </Footer>\n </Content>\n </Dialog>\n )\n}\n\nconst Close = ({ children }: { children: ReactNode }) => {\n const requestClose = useContext(DialogRequestCloseContext)\n // A button that does not submit the form around it, and a child that prevented its click keeps the dialog, as\n // Radix's Close does\n if (requestClose) {\n return (\n <Slot.Root {...{ type: \"button\" }} onClick={(event: { defaultPrevented: boolean }) => { if (!event.defaultPrevented) requestClose() }}>\n {children}\n </Slot.Root>\n )\n }\n return <RadixDialog.Close asChild>{children}</RadixDialog.Close>\n}\n\nDialog.Trigger = Trigger\nDialog.Content = Content\nDialog.Header = Header\nDialog.HeaderAction = HeaderAction\nDialog.Body = Body\nDialog.Footer = Footer\nDialog.Title = Title\nDialog.Description = Description\nDialog.DescriptionSlot = DescriptionSlot\nDialog.Close = Close\nDialog.Steps = Steps\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Dialog/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,GAWP,MAAM,UAAU,CAAA","sourcesContent":["export {\n Dialog,\n type DialogBarBackground,\n type DialogContentProps,\n type DialogFooterProps,\n type DialogHeaderActionProps,\n type DialogHeaderProps,\n type DialogInteractOutsideEvent,\n type DialogLayerProps,\n type DialogPlacement,\n type DialogProps,\n type DialogStepsProps,\n} from \"./Dialog\"\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Dialog/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,GAYP,MAAM,UAAU,CAAA","sourcesContent":["export {\n Dialog,\n type DialogBarBackground,\n type DialogConfirmClose,\n type DialogContentProps,\n type DialogFooterProps,\n type DialogHeaderActionProps,\n type DialogHeaderProps,\n type DialogInteractOutsideEvent,\n type DialogLayerProps,\n type DialogPlacement,\n type DialogProps,\n type DialogStepsProps,\n} from \"./Dialog\"\n"]}
@@ -6,7 +6,7 @@ import { FieldRowContext } from "../../lib/fieldRow.js";
6
6
  import { FieldError } from "../FieldError/index.js";
7
7
  import s from "@plexui/styles/components/Field/Field.module.css";
8
8
  const CONTROL_SIZES = new Set(["3xs", "2xs", "xs", "sm", "md", "lg", "xl", "2xl", "3xl"]);
9
- export function Field({ label, hideLabel = false, description, errorMessage, labelAction, action, size: sizeProp, required = false, orientation: orientationProp, row = false, fill = false, opticallyAlign, id: idProp, className, children, ...rest }) {
9
+ export function Field({ label, hideLabel = false, description, errorMessage, labelAction, action, icon, size: sizeProp, required = false, orientation: orientationProp, row = false, fill = false, opticallyAlign, id: idProp, className, children, ...rest }) {
10
10
  const orientation = orientationProp ?? (row && !hideLabel ? "horizontal" : "vertical");
11
11
  const generatedId = useId();
12
12
  const forwardingRowClick = useRef(false);
@@ -97,6 +97,6 @@ export function Field({ label, hideLabel = false, description, errorMessage, lab
97
97
  // Form controls can bubble their hidden input click after the render flush.
98
98
  queueMicrotask(() => { forwardingRowClick.current = false; });
99
99
  }
100
- } : undefined, className: clsx(s.Field, className), "data-slot": "field", "data-size": size, "data-orientation": orientation, "data-optically-align": opticallyAlign, "data-row": row ? "" : undefined, "data-fill": fill ? "" : undefined, "data-label-hidden": hideLabel ? "" : undefined, children: [_jsxs("div", { className: s.LabelGroup, children: [labelAction ? (_jsxs("div", { className: s.LabelRow, children: [labelElement, _jsx("div", { className: s.LabelAction, children: labelAction })] })) : (labelElement), description && (_jsx("div", { className: s.Description, id: descriptionId, children: description }))] }), _jsxs("div", { className: s.Content, children: [_jsx("div", { className: s.Control, children: resolvedChildren }), errorMessage && (_jsx(FieldError, { id: errorId, children: errorMessage }))] }), row && action ? _jsx("div", { className: s.Action, children: action }) : null] }) }));
100
+ } : undefined, className: clsx(s.Field, className), "data-slot": "field", "data-size": size, "data-orientation": orientation, "data-optically-align": opticallyAlign, "data-row": row ? "" : undefined, "data-fill": fill ? "" : undefined, "data-label-hidden": hideLabel ? "" : undefined, children: [row && icon ? _jsx("div", { className: s.Icon, "aria-hidden": "true", children: icon }) : null, _jsxs("div", { className: s.LabelGroup, children: [labelAction ? (_jsxs("div", { className: s.LabelRow, children: [labelElement, _jsx("div", { className: s.LabelAction, children: labelAction })] })) : (labelElement), description && (_jsx("div", { className: s.Description, id: descriptionId, children: description }))] }), _jsxs("div", { className: s.Content, children: [_jsx("div", { className: s.Control, children: resolvedChildren }), errorMessage && (_jsx(FieldError, { id: errorId, children: errorMessage }))] }), row && action ? _jsx("div", { className: s.Action, children: action }) : null] }) }));
101
101
  }
102
102
  //# sourceMappingURL=Field.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../../src/components/Field/Field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,CAAC,MAAM,kDAAkD,CAAA;AAWhE,MAAM,aAAa,GAAyB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA;AAoG/G,MAAM,UAAU,KAAK,CAAC,EACpB,KAAK,EACL,SAAS,GAAG,KAAK,EACjB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,MAAM,EACN,IAAI,EAAE,QAAQ,EACd,QAAQ,GAAG,KAAK,EAChB,WAAW,EAAE,eAAe,EAC5B,GAAG,GAAG,KAAK,EACX,IAAI,GAAG,KAAK,EACZ,cAAc,EACd,EAAE,EAAE,MAAM,EACV,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACI;IACX,MAAM,WAAW,GAAG,eAAe,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;IACtF,MAAM,WAAW,GAAG,KAAK,EAAE,CAAA;IAC3B,MAAM,kBAAkB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IACxC,MAAM,OAAO,GAAG,MAAM,IAAI,SAAS,WAAW,EAAE,CAAA;IAChD,MAAM,OAAO,GAAG,GAAG,OAAO,QAAQ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,SAAS,EAAE,CAAC,CAAC,OAAO,YAAG,gBAAgB,GAAO,EAClD,YAAY,IAAI,CACf,KAAC,UAAU,IAAC,EAAE,EAAE,OAAO,YAAG,YAAY,GAAc,CACrD,IACG,EACL,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,cAAK,SAAS,EAAE,CAAC,CAAC,MAAM,YAAG,MAAM,GAAO,CAAC,CAAC,CAAC,IAAI,IAC5D,GACmB,CAC5B,CAAA;AACH,CAAC","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { cloneElement, isValidElement, useId, useRef } from \"react\"\n\nimport { FieldRowContext } from \"../../lib/fieldRow\"\nimport type { ControlSize } from \"../../types\"\nimport { FieldError } from \"../FieldError\"\n\nimport s from \"@plexui/styles/components/Field/Field.module.css\"\n\nexport type FieldChildProps = {\n id: string\n /** The label's id. Spread onto a control that the label's `for` cannot name, such as a Select trigger. */\n \"aria-labelledby\"?: string\n \"aria-describedby\"?: string\n \"aria-invalid\"?: boolean\n opticallyAlign?: \"start\" | \"end\"\n}\n\nconst CONTROL_SIZES: ReadonlySet<unknown> = new Set([\"3xs\", \"2xs\", \"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\", \"3xl\"])\n\nexport type FieldProps = {\n /**\n * Label text for the field\n */\n label: React.ReactNode\n /**\n * Helper/description text displayed below the label.\n * Automatically linked via aria-describedby.\n */\n description?: React.ReactNode\n /**\n * Hides the label from view; it still names the control for assistive technology.\n * On a `row` the value or placeholder then starts at the row's edge, as an iOS cell that\n * shows only its placeholder or value (Notes, a title, a server's address), so the row is\n * vertical unless `orientation` says otherwise. Words that explain the field go in the\n * FieldGroup's `footer`.\n * @default false\n */\n hideLabel?: boolean\n /**\n * Error message displayed below the control.\n * When provided, the child control receives aria-invalid=\"true\".\n * Uses the existing FieldError component internally.\n */\n errorMessage?: React.ReactNode\n /**\n * Content placed at the end of the label row, such as a link that acts on\n * the field (\"Forgot password?\", \"Replace\").\n */\n labelAction?: React.ReactNode\n /**\n * On a `fill` row, a control at the end of the row, such as a button that adds\n * to a list. It stays on the list's first line, and on a phone it stands beside\n * the label with the list on a line of its own.\n */\n action?: React.ReactNode\n /**\n * Controls the font size of the label to visually match the child control's size.\n * Matches the ControlSize scale used by Input, Select, etc.\n * @default the child control's `size`, else \"md\"\n */\n size?: ControlSize\n /**\n * Display a required indicator (asterisk) after the label.\n * This is purely visual — it does not add the `required` HTML attribute.\n * @default false\n */\n required?: boolean\n /**\n * Layout direction of label and control.\n * - \"vertical\": label stacked above control (default)\n * - \"horizontal\": label beside control\n * @default \"horizontal\" on a `row` with a visible label, else \"vertical\"\n */\n orientation?: \"vertical\" | \"horizontal\"\n /**\n * One line of a FieldGroup: label at the start, control at the end, an error\n * under both. Other div props reach the root only on a row, so it can carry\n * a click or data attributes.\n * Clicking a non-interactive part of the row focuses its text editor or activates its choice control or popup trigger.\n * A control at the end of the row is a pill unless its own `pill` says otherwise.\n * @default false\n */\n row?: boolean\n /**\n * On a `row`, the control takes the rest of the line after the label, for a\n * list of tags and the like.\n * @default false\n */\n fill?: boolean\n /**\n * Allows overriding the auto-generated `id`. When provided, this becomes\n * the id set on the child control and the `htmlFor` on the label. A child's\n * own `id` wins over both: it stays, and the label's `htmlFor` follows it.\n */\n id?: string\n /**\n * Applies a negative margin on the child control using its gutter to\n * optically align the control's text with surrounding content.\n * Passed through to the child control via cloneElement / render prop.\n */\n opticallyAlign?: \"start\" | \"end\"\n /**\n * CSS class applied to the root wrapper\n */\n className?: string\n /**\n * The form control(s) to render.\n * - If a single ReactElement, Field clones it with { id, aria-describedby, aria-invalid },\n * keeping an `id` the child already has.\n * A child without its own `aria-label`, `aria-labelledby` or `label` also gets\n * `aria-labelledby` pointing at the label, which names controls the label's\n * `for` cannot reach, such as the Select and DatePicker triggers.\n * - If a function (render prop), it is called with { id, \"aria-labelledby\", \"aria-describedby\", \"aria-invalid\" }.\n */\n children: React.ReactElement | ((fieldProps: FieldChildProps) => React.ReactNode)\n} & Omit<React.ComponentProps<\"div\">, \"children\" | \"id\" | \"className\">\n\nexport function Field({\n label,\n hideLabel = false,\n description,\n errorMessage,\n labelAction,\n action,\n size: sizeProp,\n required = false,\n orientation: orientationProp,\n row = false,\n fill = false,\n opticallyAlign,\n id: idProp,\n className,\n children,\n ...rest\n}: FieldProps) {\n const orientation = orientationProp ?? (row && !hideLabel ? \"horizontal\" : \"vertical\")\n const generatedId = useId()\n const forwardingRowClick = useRef(false)\n const fieldId = idProp || `field-${generatedId}`\n const labelId = `${fieldId}-label`\n const childProps = isValidElement<{ size?: unknown; id?: string }>(children) ? children.props : undefined\n const childSize = childProps?.size\n const size = sizeProp ?? (CONTROL_SIZES.has(childSize) ? (childSize as ControlSize) : \"md\")\n // The control's id, which the label's `htmlFor` has to match\n const controlId = childProps?.id || fieldId\n const descriptionId = description ? `${fieldId}-description` : undefined\n const errorId = errorMessage ? `${fieldId}-error` : undefined\n\n // Build aria-describedby from description + error IDs\n const ariaDescribedBy =\n [descriptionId, errorId].filter(Boolean).join(\" \") || undefined\n\n const invalid = !!errorMessage\n\n // Props to inject into the child control (`aria-labelledby` is added below:\n // to a render prop's props, and to a cloned child without a name of its own)\n const fieldChildProps: FieldChildProps = {\n id: controlId,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": invalid || undefined,\n ...(opticallyAlign && { opticallyAlign }),\n }\n\n // Resolve the children\n let resolvedChildren: React.ReactNode\n if (typeof children === \"function\") {\n resolvedChildren = children({ ...fieldChildProps, \"aria-labelledby\": labelId })\n } else if (isValidElement(children)) {\n const child = children as React.ReactElement<Record<string, unknown>>\n // Merge with the child's own associations instead of overwriting them\n const childDescribedBy = child.props[\"aria-describedby\"] as string | undefined\n const childNamed =\n child.props[\"aria-label\"] != null || child.props[\"aria-labelledby\"] != null || child.props.label != null\n resolvedChildren = cloneElement(child, {\n ...fieldChildProps,\n \"aria-describedby\":\n [childDescribedBy, ariaDescribedBy].filter(Boolean).join(\" \") || undefined,\n \"aria-invalid\": child.props[\"aria-invalid\"] ?? fieldChildProps[\"aria-invalid\"],\n ...(!childNamed && { \"aria-labelledby\": labelId }),\n })\n } else {\n resolvedChildren = children\n }\n\n const labelElement = (\n <label className={s.Label} id={labelId} htmlFor={controlId}>\n {label}\n {required && (\n <span className={s.RequiredIndicator} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )\n\n return (\n <FieldRowContext.Provider value={row && orientation === \"horizontal\"}>\n <div\n {...(row ? rest : undefined)}\n onClick={row ? (event) => {\n if (forwardingRowClick.current) return\n rest.onClick?.(event)\n if (event.defaultPrevented) return\n const target = event.target\n const root = event.currentTarget\n // The linked control remains the keyboard stop and owns its state.\n // Nested actions keep their own click, including a Select's clear button.\n if (!(target instanceof Element) || target.closest(\"[data-row]\") !== root ||\n target.closest('button, a, input, select, textarea, [role=\"button\"], [role=\"link\"], [contenteditable]:not([contenteditable=\"false\"])')) return\n const linkedControl = root.ownerDocument.getElementById(controlId)\n if (!linkedControl || linkedControl.closest(\"[data-row]\") !== root) return\n // Select's id belongs to its hidden form proxy inside the trigger.\n // Never search sibling popups, such as an InputGroup's unit action.\n const control = linkedControl.matches('input[aria-hidden=\"true\"]')\n ? linkedControl.closest<HTMLElement>(':is(button, [role=\"button\"])[aria-haspopup]:not([aria-haspopup=\"false\"])') ?? linkedControl\n : linkedControl\n if (control.matches(':disabled, [disabled], [data-disabled], [aria-disabled=\"true\"], [data-loading], [aria-busy=\"true\"]')) return\n const label = target.closest(\"label\")\n // Native labels already click their linked form control. A directly\n // linked span trigger, such as DatePicker's, needs forwarding instead.\n if (label && (label.htmlFor !== linkedControl.id || label.control === linkedControl)) return\n // The row is the hit area for its plain editor. Focus only: a synthetic\n // click would also run input actions or disturb native text selection.\n if (control.matches('textarea, input:not([type]), input[type=\"text\"], input[type=\"email\"], input[type=\"password\"], input[type=\"search\"], input[type=\"tel\"], input[type=\"url\"], input[type=\"number\"]') &&\n !control.matches('[hidden], [aria-hidden=\"true\"]')) {\n control.focus({ preventScroll: true })\n return\n }\n if (!control.matches('button[role=\"radio\"], button[role=\"checkbox\"], button[role=\"switch\"], input[type=\"radio\"], input[type=\"checkbox\"], :is(button, [role=\"button\"])[aria-haspopup]:not([aria-haspopup=\"false\"])')) return\n forwardingRowClick.current = true\n try {\n control.focus({ preventScroll: true })\n control.click()\n } finally {\n // Form controls can bubble their hidden input click after the render flush.\n queueMicrotask(() => { forwardingRowClick.current = false })\n }\n } : undefined}\n className={clsx(s.Field, className)}\n data-slot=\"field\"\n data-size={size}\n data-orientation={orientation}\n data-optically-align={opticallyAlign}\n data-row={row ? \"\" : undefined}\n data-fill={fill ? \"\" : undefined}\n data-label-hidden={hideLabel ? \"\" : undefined}\n >\n <div className={s.LabelGroup}>\n {labelAction ? (\n <div className={s.LabelRow}>\n {labelElement}\n <div className={s.LabelAction}>{labelAction}</div>\n </div>\n ) : (\n labelElement\n )}\n {description && (\n <div className={s.Description} id={descriptionId}>\n {description}\n </div>\n )}\n </div>\n <div className={s.Content}>\n <div className={s.Control}>{resolvedChildren}</div>\n {errorMessage && (\n <FieldError id={errorId}>{errorMessage}</FieldError>\n )}\n </div>\n {row && action ? <div className={s.Action}>{action}</div> : null}\n </div>\n </FieldRowContext.Provider>\n )\n}\n"]}
1
+ {"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../../src/components/Field/Field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,CAAC,MAAM,kDAAkD,CAAA;AAWhE,MAAM,aAAa,GAAyB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,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CAAC,CAAC,CAAC,SAAS,EACb,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,SAAS,CAAC,eACzB,OAAO,eACN,IAAI,sBACG,WAAW,0BACP,cAAc,cAC1B,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,eACnB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,uBACb,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,aAE5C,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,cAAK,SAAS,EAAE,CAAC,CAAC,IAAI,iBAAc,MAAM,YAAE,IAAI,GAAO,CAAC,CAAC,CAAC,IAAI,EAC7E,eAAK,SAAS,EAAE,CAAC,CAAC,UAAU,aACzB,WAAW,CAAC,CAAC,CAAC,CACb,eAAK,SAAS,EAAE,CAAC,CAAC,QAAQ,aACvB,YAAY,EACb,cAAK,SAAS,EAAE,CAAC,CAAC,WAAW,YAAG,WAAW,GAAO,IAC9C,CACP,CAAC,CAAC,CAAC,CACF,YAAY,CACb,EACA,WAAW,IAAI,CACd,cAAK,SAAS,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,EAAE,aAAa,YAC7C,WAAW,GACR,CACP,IACG,EACN,eAAK,SAAS,EAAE,CAAC,CAAC,OAAO,aACvB,cAAK,SAAS,EAAE,CAAC,CAAC,OAAO,YAAG,gBAAgB,GAAO,EAClD,YAAY,IAAI,CACf,KAAC,UAAU,IAAC,EAAE,EAAE,OAAO,YAAG,YAAY,GAAc,CACrD,IACG,EACL,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,cAAK,SAAS,EAAE,CAAC,CAAC,MAAM,YAAG,MAAM,GAAO,CAAC,CAAC,CAAC,IAAI,IAC5D,GACmB,CAC5B,CAAA;AACH,CAAC","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { cloneElement, isValidElement, useId, useRef } from \"react\"\n\nimport { FieldRowContext } from \"../../lib/fieldRow\"\nimport type { ControlSize } from \"../../types\"\nimport { FieldError } from \"../FieldError\"\n\nimport s from \"@plexui/styles/components/Field/Field.module.css\"\n\nexport type FieldChildProps = {\n id: string\n /** The label's id. Spread onto a control that the label's `for` cannot name, such as a Select trigger. */\n \"aria-labelledby\"?: string\n \"aria-describedby\"?: string\n \"aria-invalid\"?: boolean\n opticallyAlign?: \"start\" | \"end\"\n}\n\nconst CONTROL_SIZES: ReadonlySet<unknown> = new Set([\"3xs\", \"2xs\", \"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"2xl\", \"3xl\"])\n\nexport type FieldProps = {\n /**\n * Label text for the field\n */\n label: React.ReactNode\n /**\n * Helper/description text displayed below the label.\n * Automatically linked via aria-describedby.\n */\n description?: React.ReactNode\n /**\n * Hides the label from view; it still names the control for assistive technology.\n * On a `row` the value or placeholder then starts at the row's edge, as an iOS cell that\n * shows only its placeholder or value (Notes, a title, a server's address), so the row is\n * vertical unless `orientation` says otherwise. Words that explain the field go in the\n * FieldGroup's `footer`.\n * @default false\n */\n hideLabel?: boolean\n /**\n * Error message displayed below the control.\n * When provided, the child control receives aria-invalid=\"true\".\n * Uses the existing FieldError component internally.\n */\n errorMessage?: React.ReactNode\n /**\n * Content placed at the end of the label row, such as a link that acts on\n * the field (\"Forgot password?\", \"Replace\").\n */\n labelAction?: React.ReactNode\n /**\n * On a `row`, a control at the end of the row after the row's own control. On a `fill`\n * row, such as a button that adds to a list, it stays on the list's first line, and on a\n * phone it stands beside the label with the list on a line of its own. On a row whose\n * control is a radio, such as an info button after a network or a VPN, the radio's mark\n * leads in the icon column and the action alone stands at the end.\n */\n action?: React.ReactNode\n /**\n * On a `row`, a symbol or an app's picture before the label, as an iOS cell's image: the label, its\n * description and the line above the row start after it. An `img` fills the column with the corners of an\n * app icon; an icon takes the symbol size.\n */\n icon?: React.ReactNode\n /**\n * Controls the font size of the label to visually match the child control's size.\n * Matches the ControlSize scale used by Input, Select, etc.\n * @default the child control's `size`, else \"md\"\n */\n size?: ControlSize\n /**\n * Display a required indicator (asterisk) after the label.\n * This is purely visual — it does not add the `required` HTML attribute.\n * @default false\n */\n required?: boolean\n /**\n * Layout direction of label and control.\n * - \"vertical\": label stacked above control (default)\n * - \"horizontal\": label beside control\n * @default \"horizontal\" on a `row` with a visible label, else \"vertical\"\n */\n orientation?: \"vertical\" | \"horizontal\"\n /**\n * One line of a FieldGroup: label at the start, control at the end, an error\n * under both. Other div props reach the root only on a row, so it can carry\n * a click or data attributes.\n * Clicking a non-interactive part of the row focuses its text editor or activates its choice control or popup trigger.\n * A control at the end of the row is a pill unless its own `pill` says otherwise.\n * @default false\n */\n row?: boolean\n /**\n * On a `row`, the control takes the rest of the line after the label, for a\n * list of tags and the like.\n * @default false\n */\n fill?: boolean\n /**\n * Allows overriding the auto-generated `id`. When provided, this becomes\n * the id set on the child control and the `htmlFor` on the label. A child's\n * own `id` wins over both: it stays, and the label's `htmlFor` follows it.\n */\n id?: string\n /**\n * Applies a negative margin on the child control using its gutter to\n * optically align the control's text with surrounding content.\n * Passed through to the child control via cloneElement / render prop.\n */\n opticallyAlign?: \"start\" | \"end\"\n /**\n * CSS class applied to the root wrapper\n */\n className?: string\n /**\n * The form control(s) to render.\n * - If a single ReactElement, Field clones it with { id, aria-describedby, aria-invalid },\n * keeping an `id` the child already has.\n * A child without its own `aria-label`, `aria-labelledby` or `label` also gets\n * `aria-labelledby` pointing at the label, which names controls the label's\n * `for` cannot reach, such as the Select and DatePicker triggers.\n * - If a function (render prop), it is called with { id, \"aria-labelledby\", \"aria-describedby\", \"aria-invalid\" }.\n */\n children: React.ReactElement | ((fieldProps: FieldChildProps) => React.ReactNode)\n} & Omit<React.ComponentProps<\"div\">, \"children\" | \"id\" | \"className\">\n\nexport function Field({\n label,\n hideLabel = false,\n description,\n errorMessage,\n labelAction,\n action,\n icon,\n size: sizeProp,\n required = false,\n orientation: orientationProp,\n row = false,\n fill = false,\n opticallyAlign,\n id: idProp,\n className,\n children,\n ...rest\n}: FieldProps) {\n const orientation = orientationProp ?? (row && !hideLabel ? \"horizontal\" : \"vertical\")\n const generatedId = useId()\n const forwardingRowClick = useRef(false)\n const fieldId = idProp || `field-${generatedId}`\n const labelId = `${fieldId}-label`\n const childProps = isValidElement<{ size?: unknown; id?: string }>(children) ? children.props : undefined\n const childSize = childProps?.size\n const size = sizeProp ?? (CONTROL_SIZES.has(childSize) ? (childSize as ControlSize) : \"md\")\n // The control's id, which the label's `htmlFor` has to match\n const controlId = childProps?.id || fieldId\n const descriptionId = description ? `${fieldId}-description` : undefined\n const errorId = errorMessage ? `${fieldId}-error` : undefined\n\n // Build aria-describedby from description + error IDs\n const ariaDescribedBy =\n [descriptionId, errorId].filter(Boolean).join(\" \") || undefined\n\n const invalid = !!errorMessage\n\n // Props to inject into the child control (`aria-labelledby` is added below:\n // to a render prop's props, and to a cloned child without a name of its own)\n const fieldChildProps: FieldChildProps = {\n id: controlId,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": invalid || undefined,\n ...(opticallyAlign && { opticallyAlign }),\n }\n\n // Resolve the children\n let resolvedChildren: React.ReactNode\n if (typeof children === \"function\") {\n resolvedChildren = children({ ...fieldChildProps, \"aria-labelledby\": labelId })\n } else if (isValidElement(children)) {\n const child = children as React.ReactElement<Record<string, unknown>>\n // Merge with the child's own associations instead of overwriting them\n const childDescribedBy = child.props[\"aria-describedby\"] as string | undefined\n const childNamed =\n child.props[\"aria-label\"] != null || child.props[\"aria-labelledby\"] != null || child.props.label != null\n resolvedChildren = cloneElement(child, {\n ...fieldChildProps,\n \"aria-describedby\":\n [childDescribedBy, ariaDescribedBy].filter(Boolean).join(\" \") || undefined,\n \"aria-invalid\": child.props[\"aria-invalid\"] ?? fieldChildProps[\"aria-invalid\"],\n ...(!childNamed && { \"aria-labelledby\": labelId }),\n })\n } else {\n resolvedChildren = children\n }\n\n const labelElement = (\n <label className={s.Label} id={labelId} htmlFor={controlId}>\n {label}\n {required && (\n <span className={s.RequiredIndicator} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )\n\n return (\n <FieldRowContext.Provider value={row && orientation === \"horizontal\"}>\n <div\n {...(row ? rest : undefined)}\n onClick={row ? (event) => {\n if (forwardingRowClick.current) return\n rest.onClick?.(event)\n if (event.defaultPrevented) return\n const target = event.target\n const root = event.currentTarget\n // The linked control remains the keyboard stop and owns its state.\n // Nested actions keep their own click, including a Select's clear button.\n if (!(target instanceof Element) || target.closest(\"[data-row]\") !== root ||\n target.closest('button, a, input, select, textarea, [role=\"button\"], [role=\"link\"], [contenteditable]:not([contenteditable=\"false\"])')) return\n const linkedControl = root.ownerDocument.getElementById(controlId)\n if (!linkedControl || linkedControl.closest(\"[data-row]\") !== root) return\n // Select's id belongs to its hidden form proxy inside the trigger.\n // Never search sibling popups, such as an InputGroup's unit action.\n const control = linkedControl.matches('input[aria-hidden=\"true\"]')\n ? linkedControl.closest<HTMLElement>(':is(button, [role=\"button\"])[aria-haspopup]:not([aria-haspopup=\"false\"])') ?? linkedControl\n : linkedControl\n if (control.matches(':disabled, [disabled], [data-disabled], [aria-disabled=\"true\"], [data-loading], [aria-busy=\"true\"]')) return\n const label = target.closest(\"label\")\n // Native labels already click their linked form control. A directly\n // linked span trigger, such as DatePicker's, needs forwarding instead.\n if (label && (label.htmlFor !== linkedControl.id || label.control === linkedControl)) return\n // The row is the hit area for its plain editor. Focus only: a synthetic\n // click would also run input actions or disturb native text selection.\n if (control.matches('textarea, input:not([type]), input[type=\"text\"], input[type=\"email\"], input[type=\"password\"], input[type=\"search\"], input[type=\"tel\"], input[type=\"url\"], input[type=\"number\"]') &&\n !control.matches('[hidden], [aria-hidden=\"true\"]')) {\n control.focus({ preventScroll: true })\n return\n }\n if (!control.matches('button[role=\"radio\"], button[role=\"checkbox\"], button[role=\"switch\"], input[type=\"radio\"], input[type=\"checkbox\"], :is(button, [role=\"button\"])[aria-haspopup]:not([aria-haspopup=\"false\"])')) return\n forwardingRowClick.current = true\n try {\n control.focus({ preventScroll: true })\n control.click()\n } finally {\n // Form controls can bubble their hidden input click after the render flush.\n queueMicrotask(() => { forwardingRowClick.current = false })\n }\n } : undefined}\n className={clsx(s.Field, className)}\n data-slot=\"field\"\n data-size={size}\n data-orientation={orientation}\n data-optically-align={opticallyAlign}\n data-row={row ? \"\" : undefined}\n data-fill={fill ? \"\" : undefined}\n data-label-hidden={hideLabel ? \"\" : undefined}\n >\n {row && icon ? <div className={s.Icon} aria-hidden=\"true\">{icon}</div> : null}\n <div className={s.LabelGroup}>\n {labelAction ? (\n <div className={s.LabelRow}>\n {labelElement}\n <div className={s.LabelAction}>{labelAction}</div>\n </div>\n ) : (\n labelElement\n )}\n {description && (\n <div className={s.Description} id={descriptionId}>\n {description}\n </div>\n )}\n </div>\n <div className={s.Content}>\n <div className={s.Control}>{resolvedChildren}</div>\n {errorMessage && (\n <FieldError id={errorId}>{errorMessage}</FieldError>\n )}\n </div>\n {row && action ? <div className={s.Action}>{action}</div> : null}\n </div>\n </FieldRowContext.Provider>\n )\n}\n"]}
@@ -5,6 +5,7 @@ import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from
5
5
  import { FileDocument, ImageSquare, FileBlank, UploadDocuments, X, } from "../Icon/index.js";
6
6
  import { Button } from "../Button/index.js";
7
7
  import { FieldError } from "../FieldError/index.js";
8
+ import {} from "../../types.js";
8
9
  import s from "@plexui/styles/components/FileUpload/FileUpload.module.css";
9
10
  function getFileIcon(file) {
10
11
  const type = file.type;
@@ -63,7 +64,7 @@ function matchesAccept(file, accept) {
63
64
  });
64
65
  }
65
66
  export const FileUpload = (props) => {
66
- const { variant = "compact", label, description, accept, multiple = false, maxFiles, maxSize, value: controlledValue, onValueChange, onFileReject, errorMessage, "invalid": invalidProp, disabled = false, className, id: idProp, "aria-describedby": ariaDescribedByProp, "aria-invalid": ariaInvalidProp, } = props;
67
+ const { variant = "compact", label, description, size = "3xl", pill = true, block = true, accept, multiple = false, maxFiles, maxSize, value: controlledValue, onValueChange, onFileReject, errorMessage, "invalid": invalidProp, disabled = false, className, id: idProp, "aria-describedby": ariaDescribedByProp, "aria-invalid": ariaInvalidProp, } = props;
67
68
  const [internalFiles, setInternalFiles] = useState([]);
68
69
  const inputRef = useRef(null);
69
70
  const rootRef = useRef(null);
@@ -154,6 +155,6 @@ export const FileUpload = (props) => {
154
155
  inputRef.current?.click();
155
156
  }, []);
156
157
  const atLimit = multiple && !!maxFiles && files.length >= maxFiles;
157
- return (_jsxs("div", { ref: rootRef, className: clsx(s.Root, className), role: "group", "aria-describedby": ariaDescribedBy, children: [variant === "area" ? (_jsxs("button", { type: "button", className: s.AreaTrigger, "data-invalid": invalid ? "" : undefined, onClick: openPicker, disabled: disabled || atLimit, "aria-describedby": ariaDescribedBy, children: [_jsx(UploadDocuments, { className: s.AreaIcon }), _jsx("span", { className: s.AreaLabel, children: label || "Tap to upload files" }), description && _jsx("span", { className: s.AreaDescription, children: description })] })) : (_jsx(Button, { color: "secondary", variant: "soft", size: "3xl", pill: true, block: true, disabled: disabled || atLimit, onClick: openPicker, "aria-describedby": ariaDescribedBy, children: label || "Upload file" })), files.length > 0 && (_jsx("ul", { ref: listRef, className: s.FileList, "data-variant": variant, "aria-label": "Attached files", children: files.map((file, index) => (_jsx("li", { children: _jsx(FileCard, { file: file, onRemove: () => removeFile(index), disabled: disabled }) }, `${file.name}-${file.size}-${file.lastModified}`))) })), _jsx("input", { ref: inputRef, type: "file", className: s.HiddenInput, accept: accept, multiple: multiple, onChange: handleFileSelect, disabled: disabled, id: inputId, "aria-label": label || (variant === "area" ? "Tap to upload files" : "Upload file"), "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, tabIndex: -1 }), errorMessage && (_jsx(FieldError, { id: errorId, className: s.ErrorMessage, children: errorMessage }))] }));
158
+ return (_jsxs("div", { ref: rootRef, className: clsx(s.Root, className), role: "group", "aria-describedby": ariaDescribedBy, children: [variant === "area" ? (_jsxs("button", { type: "button", className: s.AreaTrigger, "data-invalid": invalid ? "" : undefined, onClick: openPicker, disabled: disabled || atLimit, "aria-describedby": ariaDescribedBy, children: [_jsx(UploadDocuments, { className: s.AreaIcon }), _jsx("span", { className: s.AreaLabel, children: label || "Tap to upload files" }), description && _jsx("span", { className: s.AreaDescription, children: description })] })) : (_jsx(Button, { color: "secondary", variant: "soft", size: size, pill: pill, block: block, disabled: disabled || atLimit, onClick: openPicker, "aria-describedby": ariaDescribedBy, children: label || "Upload file" })), files.length > 0 && (_jsx("ul", { ref: listRef, className: s.FileList, "data-variant": variant, "aria-label": "Attached files", children: files.map((file, index) => (_jsx("li", { children: _jsx(FileCard, { file: file, onRemove: () => removeFile(index), disabled: disabled }) }, `${file.name}-${file.size}-${file.lastModified}`))) })), _jsx("input", { ref: inputRef, type: "file", className: s.HiddenInput, accept: accept, multiple: multiple, onChange: handleFileSelect, disabled: disabled, id: inputId, "aria-label": label || (variant === "area" ? "Tap to upload files" : "Upload file"), "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, tabIndex: -1 }), errorMessage && (_jsx(FieldError, { id: errorId, className: s.ErrorMessage, children: errorMessage }))] }));
158
159
  };
159
160
  //# sourceMappingURL=FileUpload.js.map