@plexui/ui 0.29.0 → 0.30.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 (110) hide show
  1. package/dist/es/components/Alert/Alert.js +2 -2
  2. package/dist/es/components/Alert/Alert.js.map +1 -1
  3. package/dist/es/components/Avatar/Avatar.js +3 -1
  4. package/dist/es/components/Avatar/Avatar.js.map +1 -1
  5. package/dist/es/components/Checkbox/Checkbox.js +1 -3
  6. package/dist/es/components/Checkbox/Checkbox.js.map +1 -1
  7. package/dist/es/components/ColorPicker/ColorPicker.js +227 -0
  8. package/dist/es/components/ColorPicker/ColorPicker.js.map +1 -0
  9. package/dist/es/components/ColorPicker/ColorWell.js +58 -0
  10. package/dist/es/components/ColorPicker/ColorWell.js.map +1 -0
  11. package/dist/es/components/ColorPicker/index.js +3 -0
  12. package/dist/es/components/ColorPicker/index.js.map +1 -0
  13. package/dist/es/components/ColorPicker/shared.js +132 -0
  14. package/dist/es/components/ColorPicker/shared.js.map +1 -0
  15. package/dist/es/components/ContextMenu/ContextMenu.js +164 -0
  16. package/dist/es/components/ContextMenu/ContextMenu.js.map +1 -0
  17. package/dist/es/components/ContextMenu/index.js +2 -0
  18. package/dist/es/components/ContextMenu/index.js.map +1 -0
  19. package/dist/es/components/ContextMenu/shared.js +56 -0
  20. package/dist/es/components/ContextMenu/shared.js.map +1 -0
  21. package/dist/es/components/DatePicker/DatePicker.js +4 -2
  22. package/dist/es/components/DatePicker/DatePicker.js.map +1 -1
  23. package/dist/es/components/DateRangePicker/DateRangePicker.js.map +1 -1
  24. package/dist/es/components/Dialog/Dialog.js +97 -16
  25. package/dist/es/components/Dialog/Dialog.js.map +1 -1
  26. package/dist/es/components/Field/Field.js +3 -3
  27. package/dist/es/components/Field/Field.js.map +1 -1
  28. package/dist/es/components/FieldGroup/FieldGroup.js +4 -2
  29. package/dist/es/components/FieldGroup/FieldGroup.js.map +1 -1
  30. package/dist/es/components/FloatingLabelInput/FloatingLabelInput.js +2 -2
  31. package/dist/es/components/FloatingLabelInput/FloatingLabelInput.js.map +1 -1
  32. package/dist/es/components/Icon/index.js +1 -0
  33. package/dist/es/components/Icon/index.js.map +1 -1
  34. package/dist/es/components/Icon/svg/Eyedropper.js +6 -0
  35. package/dist/es/components/Icon/svg/Eyedropper.js.map +1 -0
  36. package/dist/es/components/Indicator/LoadingIndicator.js.map +1 -1
  37. package/dist/es/components/Input/Input.js +2 -2
  38. package/dist/es/components/Input/Input.js.map +1 -1
  39. package/dist/es/components/Menu/Menu.js +106 -27
  40. package/dist/es/components/Menu/Menu.js.map +1 -1
  41. package/dist/es/components/Page/Page.js +42 -15
  42. package/dist/es/components/Page/Page.js.map +1 -1
  43. package/dist/es/components/PageControl/PageControl.js +146 -0
  44. package/dist/es/components/PageControl/PageControl.js.map +1 -0
  45. package/dist/es/components/PageControl/index.js +2 -0
  46. package/dist/es/components/PageControl/index.js.map +1 -0
  47. package/dist/es/components/Popover/Popover.js +2 -1
  48. package/dist/es/components/Popover/Popover.js.map +1 -1
  49. package/dist/es/components/Select/Select.js +11 -6
  50. package/dist/es/components/Select/Select.js.map +1 -1
  51. package/dist/es/components/SelectControl/SelectControl.js +1 -1
  52. package/dist/es/components/SelectControl/SelectControl.js.map +1 -1
  53. package/dist/es/components/Sidebar/Sidebar.js +21 -8
  54. package/dist/es/components/Sidebar/Sidebar.js.map +1 -1
  55. package/dist/es/components/Slider/Slider.js +10 -5
  56. package/dist/es/components/Slider/Slider.js.map +1 -1
  57. package/dist/es/components/Stepper/Stepper.js +114 -0
  58. package/dist/es/components/Stepper/Stepper.js.map +1 -0
  59. package/dist/es/components/Stepper/index.js +2 -0
  60. package/dist/es/components/Stepper/index.js.map +1 -0
  61. package/dist/es/components/TabBar/TabBar.js +128 -0
  62. package/dist/es/components/TabBar/TabBar.js.map +1 -0
  63. package/dist/es/components/TabBar/index.js +2 -0
  64. package/dist/es/components/TabBar/index.js.map +1 -0
  65. package/dist/es/components/Tabs/Tabs.js +13 -6
  66. package/dist/es/components/Tabs/Tabs.js.map +1 -1
  67. package/dist/es/components/Textarea/Textarea.js +1 -1
  68. package/dist/es/components/Textarea/Textarea.js.map +1 -1
  69. package/dist/es/components/Toolbar/Toolbar.js +31 -5
  70. package/dist/es/components/Toolbar/Toolbar.js.map +1 -1
  71. package/dist/es/components/Toolbar/index.js.map +1 -1
  72. package/dist/es/lib/fieldRow.js +7 -1
  73. package/dist/es/lib/fieldRow.js.map +1 -1
  74. package/dist/es/lib/menuSubmenuPlacement.js +51 -6
  75. package/dist/es/lib/menuSubmenuPlacement.js.map +1 -1
  76. package/dist/es/lib/menuTriggerCover.js +70 -0
  77. package/dist/es/lib/menuTriggerCover.js.map +1 -0
  78. package/dist/es/lib/scrollEdges.js +34 -0
  79. package/dist/es/lib/scrollEdges.js.map +1 -0
  80. package/dist/types/components/ColorPicker/ColorPicker.d.ts +34 -0
  81. package/dist/types/components/ColorPicker/ColorWell.d.ts +32 -0
  82. package/dist/types/components/ColorPicker/index.d.ts +3 -0
  83. package/dist/types/components/ColorPicker/shared.d.ts +69 -0
  84. package/dist/types/components/ContextMenu/ContextMenu.d.ts +78 -0
  85. package/dist/types/components/ContextMenu/index.d.ts +1 -0
  86. package/dist/types/components/ContextMenu/shared.d.ts +50 -0
  87. package/dist/types/components/DatePicker/DatePicker.d.ts +6 -1
  88. package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +1 -0
  89. package/dist/types/components/Dialog/Dialog.d.ts +5 -1
  90. package/dist/types/components/Field/Field.d.ts +11 -2
  91. package/dist/types/components/FieldGroup/FieldGroup.d.ts +11 -2
  92. package/dist/types/components/Icon/index.d.ts +1 -0
  93. package/dist/types/components/Icon/svg/Eyedropper.d.ts +6 -0
  94. package/dist/types/components/Indicator/LoadingIndicator.d.ts +1 -1
  95. package/dist/types/components/Menu/Menu.d.ts +73 -8
  96. package/dist/types/components/Page/Page.d.ts +8 -4
  97. package/dist/types/components/PageControl/PageControl.d.ts +52 -0
  98. package/dist/types/components/PageControl/index.d.ts +1 -0
  99. package/dist/types/components/Select/Select.d.ts +3 -3
  100. package/dist/types/components/Stepper/Stepper.d.ts +56 -0
  101. package/dist/types/components/Stepper/index.d.ts +1 -0
  102. package/dist/types/components/TabBar/TabBar.d.ts +74 -0
  103. package/dist/types/components/TabBar/index.d.ts +1 -0
  104. package/dist/types/components/Toolbar/Toolbar.d.ts +17 -5
  105. package/dist/types/components/Toolbar/index.d.ts +1 -1
  106. package/dist/types/lib/fieldRow.d.ts +6 -0
  107. package/dist/types/lib/menuSubmenuPlacement.d.ts +14 -1
  108. package/dist/types/lib/menuTriggerCover.d.ts +23 -0
  109. package/dist/types/lib/scrollEdges.d.ts +16 -0
  110. package/package.json +1 -1
@@ -2,17 +2,20 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import clsx from "clsx";
4
4
  import { Dialog as RadixDialog } from "radix-ui";
5
- import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, } from "react";
5
+ import { Children, cloneElement, createContext, Fragment, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, } from "react";
6
6
  import { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from "../../hooks/useFloatingBoundary.js";
7
7
  import { useEscCloseStack } from "../../hooks/useEscCloseStack.js";
8
8
  import { keepMovedFocus, preventDefaultHandler, toCssVariables } from "../../lib/helpers.js";
9
+ import { useStableCallback } from "../../hooks/useStableCallback.js";
9
10
  import { NavigationButton } from "../Button/NavigationButton.js";
10
- import { ToolbarHostContext } from "../Toolbar/Toolbar.js";
11
+ import { Toolbar, ToolbarHostContext } from "../Toolbar/Toolbar.js";
12
+ import { NO_SCROLL_EDGES, observeScrollEdges, sameScrollEdges } from "../../lib/scrollEdges.js";
11
13
  import { TransitionGroup } from "../Transition/index.js";
12
14
  import { createExitGuard, overlayTiming, overlayTimingLarge } from "../Transition/shared.js";
13
15
  import { attachSheetDrag } from "./sheetDrag.js";
14
16
  import { usePopoverDismissableSurface } from "../Popover/deferredOutsidePress.js";
15
17
  import s from "@plexui/styles/components/Dialog/Dialog.module.css";
18
+ import t from "@plexui/styles/components/Toolbar/Toolbar.module.css";
16
19
  const DOUBLE_CLICK = 300;
17
20
  const DialogContext = createContext(null);
18
21
  const useDialogContext = () => {
@@ -46,11 +49,23 @@ const Content = ({ children, width = 480, showClose = true, pill = false, classN
46
49
  : requestedMobilePlacement ?? (mobileVariant === "sheet" ? "bottom" : undefined);
47
50
  const [exitGuard] = useState(createExitGuard);
48
51
  const [panel, setPanel] = useState(null);
52
+ // Dialog.Body reports where content lies under the bars: they show their lines with it.
53
+ const [edges, setEdgesState] = useState(NO_SCROLL_EDGES);
54
+ const setEdges = useCallback((next) => setEdgesState((current) => sameScrollEdges(current, next) ? current : next), []);
55
+ const scroll = useMemo(() => ({ edges, setEdges }), [edges, setEdges]);
56
+ const toolbarHost = useMemo(() => ({ kind: "dialog", scrolled: edges.scrolled, contentBelow: edges.contentBelow }), [edges]);
57
+ const sheet = useMemo(() => (mobileVariant === "sheet" ? { showClose } : null), [mobileVariant, showClose]);
49
58
  const boundary = useFloatingBoundaryScope();
50
59
  const setRoot = boundary.setRoot;
51
60
  const setPanelRef = useCallback((node) => { setPanel(node); setRoot(node); }, [setRoot]);
52
61
  const openedAt = useRef(0);
53
62
  const crossesScreen = placement === "bottom" || placement === "start" || placement === "end" || placement === "fullscreen" || mobilePlacement === "bottom" || mobilePlacement === "fullscreen";
63
+ // The content of a closing dialog is frozen for its exit, so this reads the owner's latest
64
+ // handler: state that changes together with the close decides where focus returns.
65
+ const handleCloseAutoFocus = useStableCallback((event) => {
66
+ onCloseAutoFocus?.(event);
67
+ keepMovedFocus(event);
68
+ });
54
69
  useEscCloseStack(open, () => {
55
70
  setOpen(false);
56
71
  });
@@ -67,8 +82,11 @@ const Content = ({ children, width = 480, showClose = true, pill = false, classN
67
82
  if (!panel)
68
83
  return;
69
84
  const update = () => {
70
- // A phone Toolbar takes the place of the header or footer bar on its side.
71
- const header = panel.querySelector(`:scope > ${TOP_TOOLBAR}`) ?? panel.querySelector(`:scope > .${s.Header}`);
85
+ // A phone Toolbar takes the place of the header or footer bar on its side: one the dialog places itself
86
+ // before the bar its header becomes.
87
+ const header = panel.querySelector(`:scope > ${TOP_TOOLBAR}:not([data-dialog-bar])`)
88
+ ?? panel.querySelector(`:scope > ${TOP_TOOLBAR}`)
89
+ ?? panel.querySelector(`:scope > .${s.Header}`);
72
90
  const footer = panel.querySelector(`:scope > ${BOTTOM_TOOLBAR}`) ?? panel.querySelector(`:scope > .${s.Footer}`);
73
91
  panel.style.setProperty("--dialog-header-height", `${header?.offsetHeight ?? 0}px`);
74
92
  panel.style.setProperty("--dialog-footer-height", `${footer?.offsetHeight ?? 0}px`);
@@ -92,33 +110,96 @@ const Content = ({ children, width = 480, showClose = true, pill = false, classN
92
110
  event.preventDefault();
93
111
  else
94
112
  exitGuard.onInteractOutside(event);
95
- }, onOpenAutoFocus: onOpenAutoFocus, onCloseAutoFocus: (event) => {
96
- onCloseAutoFocus?.(event);
97
- keepMovedFocus(event);
98
- }, 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(ToolbarHostContext.Provider, { value: DIALOG_TOOLBAR_HOST, children: children })] }) })] }, "dialog")) }) }) }));
113
+ }, 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")) }) }) }));
114
+ };
115
+ const DialogScrollContext = createContext(null);
116
+ const DialogSheetContext = createContext(null);
117
+ // Inside that bar: the title, the description and the header actions take the Toolbar's parts
118
+ const DialogBarContext = createContext(false);
119
+ // The phone layout of the Dialog style sheet (its rules for the Sheet's bar use the same query). A dialog's content
120
+ // mounts on the client only (its portal waits for the document), so its first render already knows the layout, with
121
+ // nothing to swap after it.
122
+ const PHONE_LAYOUT = "(width <= 767px)";
123
+ const phoneLayout = () => (typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(PHONE_LAYOUT) : null);
124
+ const subscribePhoneLayout = (onChange) => {
125
+ const query = phoneLayout();
126
+ if (!query)
127
+ return () => { };
128
+ // Safari before 14 has only the older listener methods
129
+ if (typeof query.addEventListener !== "function") {
130
+ query.addListener(onChange);
131
+ return () => query.removeListener(onChange);
132
+ }
133
+ query.addEventListener("change", onChange);
134
+ return () => query.removeEventListener("change", onChange);
99
135
  };
100
- const DIALOG_TOOLBAR_HOST = { kind: "dialog" };
136
+ const usePhoneLayout = () => useSyncExternalStore(subscribePhoneLayout, () => phoneLayout()?.matches ?? false, () => false);
101
137
  const TOP_TOOLBAR = '[data-toolbar][data-placement="top"]';
102
138
  const BOTTOM_TOOLBAR = '[data-toolbar][data-placement="bottom"]';
103
- const Header = ({ children, className, background = "glass" }) => {
104
- return _jsx("div", { className: clsx(s.Header, className), "data-background": background, children: children });
139
+ // The header's own parts, fragments opened up, so its actions can stand at the end of the bar. A part from a
140
+ // fragment keeps the fragment's key before its own, so two parts never share a key.
141
+ const headerParts = (children, prefix = "") => Children.toArray(children).flatMap((part) => {
142
+ if (!isValidElement(part))
143
+ return [part];
144
+ if (part.type === Fragment)
145
+ return headerParts(part.props.children, `${prefix}${String(part.key)}/`);
146
+ return [prefix ? cloneElement(part, { key: `${prefix}${String(part.key)}` }) : part];
147
+ });
148
+ const isHeaderAction = (part) => isValidElement(part) && part.type === HeaderAction;
149
+ const Header = ({ children, className, background = "soft" }) => {
150
+ const sheet = useContext(DialogSheetContext);
151
+ const phone = usePhoneLayout();
152
+ const scrolled = useContext(DialogScrollContext)?.edges.scrolled;
153
+ if (sheet && phone) {
154
+ const parts = headerParts(children);
155
+ // On a phone the header of a Sheet is its Toolbar (iOS 27 kit Sheets 507-24684, Toolbar - Top - iPhone
156
+ // 1-54520): Close at the leading edge, the title centered on the row of controls, the header actions at the
157
+ // trailing edge, all on one 44px row under the grabber.
158
+ return (_jsx(Toolbar, { background: background, className: className, "data-dialog-bar": "", children: _jsxs(DialogBarContext.Provider, { value: true, children: [sheet.showClose && (_jsx(Toolbar.Leading, { className: s.BarClose, children: _jsx(RadixDialog.Close, { asChild: true, children: _jsx(NavigationButton, { action: "close", variant: "ghost", "aria-label": "Close dialog" }) }) })), _jsx("div", { className: clsx(t.Heading, s.BarHeading), children: parts.filter((part) => !isHeaderAction(part)) }), parts.filter(isHeaderAction)] }) }));
159
+ }
160
+ return _jsx("div", { className: clsx(s.Header, className), "data-background": background, "data-scrolled": scrolled ? "" : undefined, children: children });
105
161
  };
106
162
  const HeaderAction = ({ children, className }) => {
163
+ const bar = useContext(DialogBarContext);
164
+ if (bar)
165
+ return _jsx(Toolbar.Trailing, { className: className, children: children });
107
166
  return _jsx("div", { className: clsx(s.HeaderAction, className), children: children });
108
167
  };
109
168
  /** The scrolling part between Header and Footer: with it, only the body scrolls */
110
169
  const Body = ({ children, className }) => {
111
- return _jsx("div", { className: clsx(s.Body, className), children: children });
170
+ const setEdges = useContext(DialogScrollContext)?.setEdges;
171
+ const element = useRef(null);
172
+ useLayoutEffect(() => {
173
+ const body = element.current;
174
+ if (!body || !setEdges)
175
+ return;
176
+ const stop = observeScrollEdges(body, setEdges);
177
+ return () => { stop(); setEdges(NO_SCROLL_EDGES); };
178
+ }, [setEdges]);
179
+ return _jsx("div", { ref: element, className: clsx(s.Body, className), children: children });
112
180
  };
113
- const Footer = ({ children, className, mobileLayout, background = "glass" }) => {
181
+ const Footer = ({ children, className, mobileLayout, background = "soft" }) => {
114
182
  const setFooter = useFloatingBoundaryRegistration()?.setFooter;
115
- return _jsx("div", { ref: setFooter, className: clsx(s.Footer, className), "data-mobile-layout": mobileLayout, "data-background": background, children: children });
183
+ const contentBelow = useContext(DialogScrollContext)?.edges.contentBelow;
184
+ return (_jsx("div", { ref: setFooter, className: clsx(s.Footer, className), "data-mobile-layout": mobileLayout, "data-background": background, "data-content-below": contentBelow ? "" : undefined, children: children }));
116
185
  };
117
186
  const Title = ({ children, className }) => {
118
- return _jsx(RadixDialog.Title, { className: clsx(s.Title, className), children: children });
187
+ const bar = useContext(DialogBarContext);
188
+ return _jsx(RadixDialog.Title, { className: clsx(bar ? t.Title : s.Title, className), children: children });
119
189
  };
120
190
  const Description = ({ children, className }) => {
121
- return (_jsx(RadixDialog.Description, { className: clsx(s.Description, className), children: children }));
191
+ const bar = useContext(DialogBarContext);
192
+ const element = useRef(null);
193
+ const [shown, setShown] = useState(false);
194
+ useLayoutEffect(() => {
195
+ // In the bar a description the reader sees is the title's second line (Toolbar's subtitle); one that is only
196
+ // read out, visually hidden, leaves the title on its one line.
197
+ const node = element.current;
198
+ // A measurement of the laid-out description, which only an effect after layout can read
199
+ // eslint-disable-next-line react-hooks/set-state-in-effect
200
+ setShown(bar && !!node && node.offsetHeight > 1 && node.offsetWidth > 1);
201
+ }, [bar, children, className]);
202
+ return (_jsx(RadixDialog.Description, { ref: element, className: clsx(bar && shown ? t.Subtitle : s.Description, className), children: children }));
122
203
  };
123
204
  const Close = ({ children }) => {
124
205
  return _jsx(RadixDialog.Close, { asChild: true, children: children });
@@ -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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AO,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,KAAK,GAAG,KAAK,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { Dialog as RadixDialog } from \"radix-ui\"\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\"\nimport { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from \"../../hooks/useFloatingBoundary\"\nimport { useEscCloseStack } from \"../../hooks/useEscCloseStack\"\nimport { keepMovedFocus, preventDefaultHandler, toCssVariables } from \"../../lib/helpers\"\nimport { NavigationButton } from \"../Button/NavigationButton\"\nimport { ToolbarHostContext, type ToolbarHost } from \"../Toolbar/Toolbar\"\nimport { TransitionGroup } from \"../Transition\"\nimport { createExitGuard, overlayTiming, overlayTimingLarge } from \"../Transition/shared\"\nimport { attachSheetDrag } from \"./sheetDrag\"\nimport { usePopoverDismissableSurface } from \"../Popover/deferredOutsidePress\"\nimport s from \"@plexui/styles/components/Dialog/Dialog.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\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 /** Placement at 767px and below, such as a bottom sheet on phones. @default placement */\n mobilePlacement?: Extract<DialogPlacement, \"center\" | \"bottom\" | \"fullscreen\">\n /** Mobile presentation at 767px and below. Sheets default to bottom placement. */\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\nconst Content = ({\n children,\n width = 480,\n showClose = true,\n pill = false,\n className,\n placement = \"center\",\n mobilePlacement: requestedMobilePlacement,\n mobileVariant,\n surface = \"plain\",\n onOpenAutoFocus,\n onCloseAutoFocus,\n}: DialogContentProps) => {\n const { open, setOpen } = useDialogContext()\n const overlaySurfaceRef = usePopoverDismissableSurface()\n const mobilePlacement =\n mobileVariant === \"alert\"\n ? \"center\"\n : requestedMobilePlacement ?? (mobileVariant === \"sheet\" ? \"bottom\" : undefined)\n const [exitGuard] = useState(createExitGuard)\n const [panel, setPanel] = useState<HTMLDivElement | null>(null)\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 const crossesScreen =\n placement === \"bottom\" || placement === \"start\" || placement === \"end\" || placement === \"fullscreen\" || mobilePlacement === \"bottom\" || mobilePlacement === \"fullscreen\"\n\n useEscCloseStack(open, () => {\n setOpen(false)\n })\n\n useEffect(() => {\n if (open) openedAt.current = performance.now()\n }, [open])\n\n useEffect(() => {\n if (!panel || mobilePlacement !== \"bottom\") return undefined\n return attachSheetDrag(panel, () => setOpen(false))\n }, [panel, mobilePlacement, setOpen])\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.\n const header = panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}`) ?? 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 return (\n <FloatingBoundaryProvider value={boundary}>\n <RadixDialog.Portal forceMount>\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 ref={overlaySurfaceRef} className={s.Overlay} />\n <RadixDialog.Content\n forceMount\n className={s.Content}\n data-plex-dialog=\"\"\n style={toCssVariables({ \"dialog-width\": width })}\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 // 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={(event) => {\n onCloseAutoFocus?.(event)\n keepMovedFocus(event)\n }}\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 <ToolbarHostContext.Provider value={DIALOG_TOOLBAR_HOST}>{children}</ToolbarHostContext.Provider>\n </div>\n </RadixDialog.Content>\n </div>\n )}\n </TransitionGroup>\n </RadixDialog.Portal>\n </FloatingBoundaryProvider>\n )\n}\n\nconst DIALOG_TOOLBAR_HOST: ToolbarHost = { kind: \"dialog\" }\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\nexport type DialogBarBackground = \"glass\" | \"solid\"\nexport type DialogHeaderProps = DialogSlotProps & { background?: DialogBarBackground }\n\nconst Header = ({ children, className, background = \"glass\" }: DialogHeaderProps) => {\n return <div className={clsx(s.Header, className)} data-background={background}>{children}</div>\n}\n\nconst HeaderAction = ({ children, className }: DialogSlotProps) => {\n return <div className={clsx(s.HeaderAction, className)}>{children}</div>\n}\n\n/** The scrolling part between Header and Footer: with it, only the body scrolls */\nconst Body = ({ children, className }: DialogSlotProps) => {\n return <div className={clsx(s.Body, className)}>{children}</div>\n}\n\nexport type DialogFooterProps = DialogSlotProps & {\n background?: DialogBarBackground\n /** Override the mobile action layout. Alerts default to inline; sheets to stacked. */\n mobileLayout?: \"inline\" | \"stacked\"\n}\n\nconst Footer = ({ children, className, mobileLayout, background = \"glass\" }: DialogFooterProps) => {\n const setFooter = useFloatingBoundaryRegistration()?.setFooter\n return <div ref={setFooter} className={clsx(s.Footer, className)} data-mobile-layout={mobileLayout} data-background={background}>{children}</div>\n}\n\nconst Title = ({ children, className }: DialogSlotProps) => {\n return <RadixDialog.Title className={clsx(s.Title, className)}>{children}</RadixDialog.Title>\n}\n\nconst Description = ({ children, className }: DialogSlotProps) => {\n return (\n <RadixDialog.Description className={clsx(s.Description, className)}>\n {children}\n </RadixDialog.Description>\n )\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.Close = Close\n"]}
1
+ {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/components/Dialog/Dial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AAO,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,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 useSyncExternalStore,\n type ReactElement,\n type ReactNode,\n} from \"react\"\nimport { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from \"../../hooks/useFloatingBoundary\"\nimport { useEscCloseStack } from \"../../hooks/useEscCloseStack\"\nimport { keepMovedFocus, preventDefaultHandler, toCssVariables } from \"../../lib/helpers\"\nimport { useStableCallback } from \"../../hooks/useStableCallback\"\nimport { NavigationButton } from \"../Button/NavigationButton\"\nimport { Toolbar, ToolbarHostContext, type BarBackground, 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 { 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\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 /** Placement at 767px and below, such as a bottom sheet on phones. @default placement */\n mobilePlacement?: Extract<DialogPlacement, \"center\" | \"bottom\" | \"fullscreen\">\n /** Mobile presentation at 767px and below. Sheets default to bottom placement. */\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\nconst Content = ({\n children,\n width = 480,\n showClose = true,\n pill = false,\n className,\n placement = \"center\",\n mobilePlacement: requestedMobilePlacement,\n mobileVariant,\n surface = \"plain\",\n onOpenAutoFocus,\n onCloseAutoFocus,\n}: DialogContentProps) => {\n const { open, setOpen } = useDialogContext()\n const overlaySurfaceRef = usePopoverDismissableSurface()\n const mobilePlacement =\n mobileVariant === \"alert\"\n ? \"center\"\n : requestedMobilePlacement ?? (mobileVariant === \"sheet\" ? \"bottom\" : undefined)\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 const sheet = useMemo<DialogSheetValue | null>(() => (mobileVariant === \"sheet\" ? { showClose } : null), [mobileVariant, showClose])\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 const crossesScreen =\n placement === \"bottom\" || placement === \"start\" || placement === \"end\" || placement === \"fullscreen\" || mobilePlacement === \"bottom\" || mobilePlacement === \"fullscreen\"\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, () => {\n setOpen(false)\n })\n\n useEffect(() => {\n if (open) openedAt.current = performance.now()\n }, [open])\n\n useEffect(() => {\n if (!panel || mobilePlacement !== \"bottom\") return undefined\n return attachSheetDrag(panel, () => setOpen(false))\n }, [panel, mobilePlacement, setOpen])\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 return (\n <FloatingBoundaryProvider value={boundary}>\n <RadixDialog.Portal forceMount>\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 ref={overlaySurfaceRef} className={s.Overlay} />\n <RadixDialog.Content\n forceMount\n className={s.Content}\n data-plex-dialog=\"\"\n style={toCssVariables({ \"dialog-width\": width })}\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 // 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 </RadixDialog.Portal>\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 = { showClose: boolean }\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\n// The phone layout of the Dialog style sheet (its rules for the Sheet's bar use the same query). A dialog's content\n// mounts on the client only (its portal waits for the document), so its first render already knows the layout, with\n// nothing to swap after it.\nconst PHONE_LAYOUT = \"(width <= 767px)\"\nconst phoneLayout = () => (typeof window !== \"undefined\" && typeof window.matchMedia === \"function\" ? window.matchMedia(PHONE_LAYOUT) : null)\nconst subscribePhoneLayout = (onChange: () => void) => {\n const query = phoneLayout()\n if (!query) return () => {}\n // Safari before 14 has only the older listener methods\n if (typeof query.addEventListener !== \"function\") {\n query.addListener(onChange)\n return () => query.removeListener(onChange)\n }\n query.addEventListener(\"change\", onChange)\n return () => query.removeEventListener(\"change\", onChange)\n}\nconst usePhoneLayout = () => useSyncExternalStore(subscribePhoneLayout, () => phoneLayout()?.matches ?? false, () => false)\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\nexport type DialogHeaderProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"soft\" */\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\n\nconst Header = ({ children, className, background = \"soft\" }: 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 // 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 centered on the row of controls, the header actions at the\n // trailing edge, all on one 44px row under the grabber.\n return (\n <Toolbar background={background} className={className} data-dialog-bar=\"\">\n <DialogBarContext.Provider value={true}>\n {sheet.showClose && (\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 <div className={clsx(t.Heading, s.BarHeading)}>{parts.filter((part) => !isHeaderAction(part))}</div>\n {parts.filter(isHeaderAction)}\n </DialogBarContext.Provider>\n </Toolbar>\n )\n }\n return <div className={clsx(s.Header, className)} data-background={background} data-scrolled={scrolled ? \"\" : undefined}>{children}</div>\n}\n\nconst HeaderAction = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n if (bar) return <Toolbar.Trailing className={className}>{children}</Toolbar.Trailing>\n return <div className={clsx(s.HeaderAction, className)}>{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 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 <div ref={element} className={clsx(s.Body, className)}>{children}</div>\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. Alerts default to inline; 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 return (\n <div\n ref={setFooter}\n className={clsx(s.Footer, className)}\n data-mobile-layout={mobileLayout}\n data-background={background}\n data-content-below={contentBelow ? \"\" : undefined}\n >\n {children}\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 // In the bar a description the reader sees is the title's second line (Toolbar's subtitle); 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\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.Close = Close\n"]}
@@ -6,8 +6,8 @@ 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, description, errorMessage, labelAction, action, size: sizeProp, required = false, orientation: orientationProp, row = false, fill = false, opticallyAlign, id: idProp, className, children, ...rest }) {
10
- const orientation = orientationProp ?? (row ? "horizontal" : "vertical");
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 }) {
10
+ const orientation = orientationProp ?? (row && !hideLabel ? "horizontal" : "vertical");
11
11
  const generatedId = useId();
12
12
  const forwardingRowClick = useRef(false);
13
13
  const fieldId = idProp || `field-${generatedId}`;
@@ -97,6 +97,6 @@ export function Field({ label, description, errorMessage, labelAction, action, s
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-size": size, "data-orientation": orientation, "data-optically-align": opticallyAlign, "data-row": row ? "" : undefined, "data-fill": fill ? "" : 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: [_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,CAA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B,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 * 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`, 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 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 ? \"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-size={size}\n data-orientation={orientation}\n data-optically-align={opticallyAlign}\n data-row={row ? \"\" : undefined}\n data-fill={fill ? \"\" : 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,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,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AAY,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 `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"]}
@@ -3,9 +3,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import clsx from "clsx";
4
4
  import { useId } from "react";
5
5
  import s from "@plexui/styles/components/FieldGroup/FieldGroup.module.css";
6
+ import { FieldColumnsContext } from "../../lib/fieldRow.js";
6
7
  /** A titled block of rows: `Field row` lines with hairlines between them. */
7
- export function FieldGroup({ title, description, action, footer, columns = false, bodyClassName, className, children, ...rest }) {
8
+ export function FieldGroup({ title, headerProminence = "standard", description, action, footer, columns = false, bodyClassName, className, children, ...rest }) {
8
9
  const titleId = `field-group-${useId()}`;
9
- return (_jsxs("section", { role: "group", "aria-labelledby": title ? titleId : undefined, "data-field-columns": columns ? "" : undefined, ...rest, className: clsx(s.FieldGroup, className), children: [(title || description || action) && (_jsxs("div", { className: s.Header, children: [_jsxs("div", { className: s.HeaderText, children: [title && (_jsx("h2", { className: s.Title, id: titleId, children: title })), description && _jsx("p", { className: s.Description, children: description })] }), action] })), _jsx("div", { className: clsx(s.Body, bodyClassName), children: children }), footer != null && typeof footer !== "boolean" && footer !== "" && (_jsx("div", { className: s.Footer, children: footer }))] }));
10
+ const descriptionId = `${titleId}-description`;
11
+ return (_jsxs("section", { role: "group", "aria-labelledby": title ? titleId : undefined, "aria-describedby": description ? descriptionId : undefined, "data-field-columns": columns ? "" : undefined, "data-header-prominence": headerProminence === "increased" ? "increased" : undefined, ...rest, className: clsx(s.FieldGroup, className), children: [(title || description || action) && (_jsxs("div", { className: s.Header, children: [_jsxs("div", { className: s.HeaderText, children: [title && (_jsx("h2", { className: s.Title, id: titleId, children: title })), description && _jsx("p", { className: s.Description, id: descriptionId, children: description })] }), action] })), _jsx("div", { className: clsx(s.Body, bodyClassName), children: _jsx(FieldColumnsContext.Provider, { value: columns, children: children }) }), footer != null && typeof footer !== "boolean" && footer !== "" && (_jsx("div", { className: s.Footer, children: footer }))] }));
10
12
  }
11
13
  //# sourceMappingURL=FieldGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FieldGroup.js","sourceRoot":"","sources":["../../../../src/components/FieldGroup/FieldGroup.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAE7B,OAAO,CAAC,MAAM,4DAA4D,CAAA;AAmC1E,6EAA6E;AAC7E,MAAM,UAAU,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,MAAM,EACN,MAAM,EACN,OAAO,GAAG,KAAK,EACf,aAAa,EACb,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACS;IAChB,MAAM,OAAO,GAAG,eAAe,KAAK,EAAE,EAAE,CAAA;IAExC,OAAO,CACL,mBACE,IAAI,EAAC,OAAO,qBACK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,wBACxB,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KACxC,IAAI,EACR,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,aAEvC,CAAC,KAAK,IAAI,WAAW,IAAI,MAAM,CAAC,IAAI,CACnC,eAAK,SAAS,EAAE,CAAC,CAAC,MAAM,aACtB,eAAK,SAAS,EAAE,CAAC,CAAC,UAAU,aACzB,KAAK,IAAI,CACR,aAAI,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,OAAO,YAChC,KAAK,GACH,CACN,EACA,WAAW,IAAI,YAAG,SAAS,EAAE,CAAC,CAAC,WAAW,YAAG,WAAW,GAAK,IAC1D,EACL,MAAM,IACH,CACP,EACD,cAAK,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,YAAG,QAAQ,GAAO,EAC5D,MAAM,IAAI,IAAI,IAAI,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,EAAE,IAAI,CACjE,cAAK,SAAS,EAAE,CAAC,CAAC,MAAM,YAAG,MAAM,GAAO,CACzC,IACO,CACX,CAAA;AACH,CAAC","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { useId } from \"react\"\n\nimport s from \"@plexui/styles/components/FieldGroup/FieldGroup.module.css\"\n\nexport type FieldGroupProps = {\n /**\n * Heading over the block. It names the group.\n */\n title?: React.ReactNode\n /**\n * Line under the title.\n */\n description?: React.ReactNode\n /**\n * Content at the end of the header, such as a button.\n */\n action?: React.ReactNode\n /**\n * Content under the block, such as a note.\n */\n footer?: React.ReactNode\n /**\n * Every value starts at one column, `--field-row-column-width` into the row, on the\n * web and on a phone. Off, values end at the row's edge.\n * @default false\n */\n columns?: boolean\n /**\n * CSS class for the block that holds the rows.\n */\n bodyClassName?: string\n /**\n * The rows: `Field row`, or rows of your own.\n */\n children?: React.ReactNode\n} & Omit<React.ComponentProps<\"section\">, \"title\" | \"children\">\n\n/** A titled block of rows: `Field row` lines with hairlines between them. */\nexport function FieldGroup({\n title,\n description,\n action,\n footer,\n columns = false,\n bodyClassName,\n className,\n children,\n ...rest\n}: FieldGroupProps) {\n const titleId = `field-group-${useId()}`\n\n return (\n <section\n role=\"group\"\n aria-labelledby={title ? titleId : undefined}\n data-field-columns={columns ? \"\" : undefined}\n {...rest}\n className={clsx(s.FieldGroup, className)}\n >\n {(title || description || action) && (\n <div className={s.Header}>\n <div className={s.HeaderText}>\n {title && (\n <h2 className={s.Title} id={titleId}>\n {title}\n </h2>\n )}\n {description && <p className={s.Description}>{description}</p>}\n </div>\n {action}\n </div>\n )}\n <div className={clsx(s.Body, bodyClassName)}>{children}</div>\n {footer != null && typeof footer !== \"boolean\" && footer !== \"\" && (\n <div className={s.Footer}>{footer}</div>\n )}\n </section>\n )\n}\n"]}
1
+ {"version":3,"file":"FieldGroup.js","sourceRoot":"","sources":["../../../../src/components/FieldGroup/FieldGroup.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAE7B,OAAO,CAAC,MAAM,4DAA4D,CAAA;AAE1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AA4CxD,6EAA6E;AAC7E,MAAM,UAAU,UAAU,CAAC,EACzB,KAAK,EACL,gBAAgB,GAAG,UAAU,EAC7B,WAAW,EACX,MAAM,EACN,MAAM,EACN,OAAO,GAAG,KAAK,EACf,aAA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Content":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { useId } from \"react\"\n\nimport s from \"@plexui/styles/components/FieldGroup/FieldGroup.module.css\"\n\nimport { FieldColumnsContext } from \"../../lib/fieldRow\"\n\nexport type FieldGroupProps = {\n /**\n * Heading over the block. It names the group.\n */\n title?: React.ReactNode\n /**\n * How much the title stands out. \"standard\" is a quiet heading over the rows (on a\n * phone the kit's Nested list header: 17 Semibold, secondary). \"increased\" leads its\n * content, as a section of a page does (the kit's Prominent header: 20 Semibold,\n * primary).\n * @default \"standard\"\n */\n headerProminence?: \"standard\" | \"increased\"\n /**\n * Line under the title.\n */\n description?: React.ReactNode\n /**\n * Content at the end of the header, such as a button. On a phone a ghost text button\n * reads as the list header's action: tinted text on the title's last line.\n */\n action?: React.ReactNode\n /**\n * Content under the block, such as a note.\n */\n footer?: React.ReactNode\n /**\n * Every value starts at one column, `--field-row-column-width` into the row, on the\n * web and on a phone. Off, values end at the row's edge.\n * @default false\n */\n columns?: boolean\n /**\n * CSS class for the block that holds the rows.\n */\n bodyClassName?: string\n /**\n * The rows: `Field row`, or rows of your own.\n */\n children?: React.ReactNode\n} & Omit<React.ComponentProps<\"section\">, \"title\" | \"children\">\n\n/** A titled block of rows: `Field row` lines with hairlines between them. */\nexport function FieldGroup({\n title,\n headerProminence = \"standard\",\n description,\n action,\n footer,\n columns = false,\n bodyClassName,\n className,\n children,\n ...rest\n}: FieldGroupProps) {\n const titleId = `field-group-${useId()}`\n const descriptionId = `${titleId}-description`\n\n return (\n <section\n role=\"group\"\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n data-field-columns={columns ? \"\" : undefined}\n data-header-prominence={headerProminence === \"increased\" ? \"increased\" : undefined}\n {...rest}\n className={clsx(s.FieldGroup, className)}\n >\n {(title || description || action) && (\n <div className={s.Header}>\n <div className={s.HeaderText}>\n {title && (\n <h2 className={s.Title} id={titleId}>\n {title}\n </h2>\n )}\n {description && <p className={s.Description} id={descriptionId}>{description}</p>}\n </div>\n {action}\n </div>\n )}\n <div className={clsx(s.Body, bodyClassName)}>\n <FieldColumnsContext.Provider value={columns}>{children}</FieldColumnsContext.Provider>\n </div>\n {footer != null && typeof footer !== \"boolean\" && footer !== \"\" && (\n <div className={s.Footer}>{footer}</div>\n )}\n </section>\n )\n}\n"]}
@@ -4,7 +4,7 @@ import clsx from "clsx";
4
4
  import { forwardRef, useCallback, useId, useLayoutEffect, useRef, useState } from "react";
5
5
  import { mergeRefs } from "react-merge-refs";
6
6
  import { observeTextareaWidth } from "../../lib/observeTextareaWidth.js";
7
- import { Eye, EyeOff, X } from "../Icon/index.js";
7
+ import { Eye, EyeOff, X, XCircleFilled } from "../Icon/index.js";
8
8
  import { FieldError } from "../FieldError/index.js";
9
9
  import s from "@plexui/styles/components/FloatingLabelInput/FloatingLabelInput.module.css";
10
10
  // Attributes that only mean something on <input>; everything else (required,
@@ -119,7 +119,7 @@ export const FloatingLabelInput = forwardRef(function FloatingLabelInput(props,
119
119
  }, [onRevealedChange]);
120
120
  return (_jsxs("div", { className: clsx(s.Root, className), "data-label-placement": labelPlacement === "inside" ? "inside" : undefined, "data-pill": pill && labelPlacement !== "inside" ? "" : undefined, children: [_jsxs("div", { className: clsx(s.FieldFootprint, {
121
121
  [s.HasValue]: hasValue || !!startAdornment,
122
- }), "data-focused": focused ? "" : undefined, "data-has-value": hasValue ? "" : undefined, "data-invalid": invalid ? "" : undefined, "data-disabled": disabled ? "" : undefined, "data-readonly": readOnly ? "" : undefined, "data-multiline": multiline ? "" : undefined, onMouseDown: handleContainerMouseDown, children: [_jsx("label", { className: s.TypeableLabel, htmlFor: inputId, children: _jsx("div", { className: s.LabelPositioner, children: _jsx("div", { className: s.LabelText, children: label }) }) }), startAdornment && (_jsx("div", { className: s.StartAdornment, children: startAdornment })), multiline ? (_jsx("textarea", { ...textareaProps(restProps), ref: mergeRefs([ref, inputRef]), id: inputId, name: name, rows: rows, className: s.Textarea, value: value, defaultValue: defaultValue, disabled: disabled, readOnly: readOnly, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur })) : (_jsx("input", { ...restProps, ref: mergeRefs([ref, inputRef]), id: inputId, name: name, type: effectiveType, className: s.Input, value: value, defaultValue: defaultValue, disabled: disabled, readOnly: readOnly, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, onAnimationStart: handleAnimationStart, "data-lpignore": allowAutofillExtensions ? undefined : true, "data-1p-ignore": allowAutofillExtensions ? undefined : true })), endAdornment && (_jsx("div", { className: s.EndAdornment, children: endAdornment })), showClearButton && (_jsx("button", { type: "button", "aria-label": "Clear input", className: s.ClearButton, onClick: handleClear, children: _jsx(X, {}) })), showRevealButton && (_jsx("button", { type: "button", "aria-label": revealed ? "Hide" : "Show", className: s.RevealButton, onClick: handleRevealToggle, children: revealed ? _jsx(EyeOff, {}) : _jsx(Eye, {}) }))] }), errorMessage && (_jsx(FieldError, { id: errorId, className: s.ErrorMessage, children: errorMessage })), description && (_jsx("div", { id: descriptionId, className: s.Description, children: description }))] }));
122
+ }), "data-focused": focused ? "" : undefined, "data-has-value": hasValue ? "" : undefined, "data-invalid": invalid ? "" : undefined, "data-disabled": disabled ? "" : undefined, "data-readonly": readOnly ? "" : undefined, "data-multiline": multiline ? "" : undefined, onMouseDown: handleContainerMouseDown, children: [_jsx("label", { className: s.TypeableLabel, htmlFor: inputId, children: _jsx("div", { className: s.LabelPositioner, children: _jsx("div", { className: s.LabelText, children: label }) }) }), startAdornment && (_jsx("div", { className: s.StartAdornment, children: startAdornment })), multiline ? (_jsx("textarea", { ...textareaProps(restProps), ref: mergeRefs([ref, inputRef]), id: inputId, name: name, rows: rows, className: s.Textarea, value: value, defaultValue: defaultValue, disabled: disabled, readOnly: readOnly, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur })) : (_jsx("input", { ...restProps, ref: mergeRefs([ref, inputRef]), id: inputId, name: name, type: effectiveType, className: s.Input, value: value, defaultValue: defaultValue, disabled: disabled, readOnly: readOnly, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, onAnimationStart: handleAnimationStart, "data-lpignore": allowAutofillExtensions ? undefined : true, "data-1p-ignore": allowAutofillExtensions ? undefined : true })), endAdornment && (_jsx("div", { className: s.EndAdornment, children: endAdornment })), showClearButton && (_jsxs("button", { type: "button", "aria-label": "Clear input", className: s.ClearButton, onClick: handleClear, children: [_jsx(X, { className: s.ClearIcon }), _jsx(XCircleFilled, { className: s.ClearPhoneIcon })] })), showRevealButton && (_jsx("button", { type: "button", "aria-label": revealed ? "Hide" : "Show", className: s.RevealButton, onClick: handleRevealToggle, children: revealed ? _jsx(EyeOff, {}) : _jsx(Eye, {}) }))] }), errorMessage && (_jsx(FieldError, { id: errorId, className: s.ErrorMessage, children: errorMessage })), description && (_jsx("div", { id: descriptionId, className: s.Description, children: description }))] }));
123
123
  });
124
124
  FloatingLabelInput.displayName = "FloatingLabelInput";
125
125
  //# sourceMappingURL=FloatingLabelInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FloatingLabelInput.js","sourceRoot":"","sources":["../../../../src/components/FloatingLabelInput/FloatingLabelInput.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AAErE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EAAE,UAAU,EAA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AE,SAAS,EAAE,CAAC,CAAC,YAAY,YAC/C,YAAY,GACF,CACd,EACA,WAAW,IAAI,CACd,cAAK,EAAE,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,CAAC,WAAW,YAC7C,WAAW,GACR,CACP,IACG,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { forwardRef, useCallback, useId, useLayoutEffect, useRef, useState } from \"react\"\nimport { mergeRefs } from \"react-merge-refs\"\nimport { observeTextareaWidth } from \"../../lib/observeTextareaWidth\"\n\nimport { Eye, EyeOff, X } from \"../Icon\"\nimport { FieldError } from \"../FieldError\"\n\nimport s from \"@plexui/styles/components/FloatingLabelInput/FloatingLabelInput.module.css\"\n\nexport type FloatingLabelInputProps = {\n /**\n * Label text for the floating label\n */\n label: string\n /**\n * Error message to display below the input\n */\n errorMessage?: string\n /**\n * Mark the input as invalid\n * @default false (or true if errorMessage is provided)\n */\n invalid?: boolean\n /**\n * Disables the input visually and from interactions\n * @default false\n */\n disabled?: boolean\n /**\n * Makes the input read-only\n * @default false\n */\n readOnly?: boolean\n /**\n * Callback invoked when the clear button is clicked\n */\n onClear?: () => void\n /**\n * Callback invoked when the input is autofilled by the browser\n */\n onAutofill?: () => void\n /**\n * Allow autofill extensions to appear in the input\n * @default false\n */\n allowAutofillExtensions?: boolean\n /**\n * Helper/description text displayed below the input.\n * Shown alongside the error message when both are present.\n */\n description?: React.ReactNode\n /**\n * Content rendered before the input.\n */\n startAdornment?: React.ReactNode\n /**\n * Content rendered after the input, before the clear button.\n * For password fields the reveal toggle is built in — see `revealable`.\n */\n endAdornment?: React.ReactNode\n /**\n * Render a built-in reveal/hide toggle (eye icon) inside the field.\n * For `type=\"password\"` it swaps the input between `password` and `text`.\n * Defaults to `true` for password inputs that don't supply their own\n * `endAdornment`. Pass it explicitly to add the toggle to other sensitive\n * fields (e.g. a masked SSN) and react to it via `onRevealedChange`.\n * @default true when type=\"password\" and no endAdornment is provided\n */\n revealable?: boolean\n /**\n * Called with the new revealed state each time the reveal toggle is clicked.\n */\n onRevealedChange?: (revealed: boolean) => void\n /**\n * Render as a multi-line textarea instead of a single-line input.\n * @default false\n */\n multiline?: boolean\n /**\n * Number of visible text lines when `multiline` is true.\n * @default 2\n */\n rows?: number\n /**\n * Where the label rests once it floats: on the border, or inside the box\n * with the value under it. `inside` always takes the rounded box.\n * @default \"border\"\n */\n labelPlacement?: \"border\" | \"inside\"\n /**\n * Pill shape. `false` takes the rounded box of the other fields.\n * @default true\n */\n pill?: boolean\n} & React.InputHTMLAttributes<HTMLInputElement>\n\n// Attributes that only mean something on <input>; everything else (required,\n// maxLength, placeholder, key and clipboard handlers, aria-*, data-*) also\n// applies to the multiline <textarea>\nconst INPUT_ONLY_PROPS = [\n \"accept\", \"alt\", \"capture\", \"checked\", \"height\", \"list\", \"max\", \"min\", \"multiple\",\n \"pattern\", \"size\", \"src\", \"step\", \"width\", \"formAction\", \"formEncType\",\n \"formMethod\", \"formNoValidate\", \"formTarget\",\n] as const\n\nconst textareaProps = (props: Record<string, unknown>) => {\n const rest = { ...props }\n for (const key of INPUT_ONLY_PROPS) delete rest[key]\n return rest\n}\n\nexport const FloatingLabelInput = forwardRef<HTMLInputElement, FloatingLabelInputProps>(\n function FloatingLabelInput(props, ref) {\n const {\n label,\n description,\n errorMessage,\n \"invalid\": invalidProp,\n disabled = false,\n readOnly = false,\n onClear,\n onAutofill,\n allowAutofillExtensions = false,\n startAdornment,\n endAdornment,\n revealable: revealableProp,\n onRevealedChange,\n multiline = false,\n rows = 2,\n labelPlacement = \"border\",\n pill = true,\n className,\n \"id\": idProp,\n name,\n type = \"text\",\n value,\n defaultValue,\n onChange,\n onFocus,\n onBlur,\n onAnimationStart,\n \"aria-describedby\": ariaDescribedByProp,\n ...restProps\n } = props\n\n const inputRef = useRef<HTMLInputElement | null>(null)\n const generatedId = useId()\n const inputId = idProp || `floating-label-input-${generatedId}`\n const descriptionId = description ? `${inputId}-description` : undefined\n const errorId = errorMessage ? `${inputId}-error` : undefined\n\n const [focused, setFocused] = useState(false)\n const [hasUncontrolledValue, setHasValue] = useState(() => {\n return String((value !== undefined ? value : defaultValue) ?? \"\") !== \"\"\n })\n const [revealed, setRevealed] = useState(false)\n const revealedRef = useRef(false)\n\n const hasValue = value !== undefined ? String(value ?? \"\") !== \"\" : hasUncontrolledValue\n\n const autoResize = useCallback(() => {\n const el = inputRef.current\n if (!multiline || !el) return\n el.style.height = \"auto\"\n el.style.height = `${el.scrollHeight}px`\n }, [multiline])\n\n useLayoutEffect(() => {\n if (!multiline || !inputRef.current) return\n return observeTextareaWidth(inputRef.current, autoResize)\n }, [multiline, autoResize])\n\n // Also resize when a controlled value or rows changes without a keystroke\n useLayoutEffect(() => {\n autoResize()\n }, [autoResize, value, rows])\n\n const invalid = invalidProp ?? !!errorMessage\n\n // Determine if clear button should be shown\n const showClearButton = !!onClear && hasValue && !disabled && !readOnly\n\n // Built-in password reveal toggle\n const isPassword = type === \"password\"\n const revealable = revealableProp ?? (isPassword && !endAdornment)\n const showRevealButton = revealable && !disabled\n const effectiveType = isPassword && revealed ? \"text\" : type\n\n // Merge aria-describedby with error id\n const ariaDescribedBy =\n [ariaDescribedByProp, errorId, descriptionId].filter(Boolean).join(\" \") || undefined\n // An explicit aria-invalid (e.g. from Field) wins over the computed state\n const ariaInvalid = restProps[\"aria-invalid\"] ?? (invalid ? true : undefined)\n\n // Handle clicks on the container to focus the input\n const handleContainerMouseDown = useCallback((evt: React.MouseEvent<HTMLDivElement>) => {\n const input = inputRef.current\n if (!evt.target || !(evt.target instanceof Element) || !input) {\n return\n }\n if (input.contains(evt.target)) {\n return\n }\n if (evt.target.closest(\"button, [type='button'], [role='button']\")) {\n return\n }\n evt.preventDefault()\n if (document.activeElement !== input) {\n input.focus()\n }\n // email, number and other types without the selection API throw on setSelectionRange\n if (input.selectionStart === null) return\n const length = input.value.length\n input.setSelectionRange(length, length)\n }, [])\n\n // The clear button unmounts once the value is gone, so keep focus in the field\n const handleClear = useCallback(\n (evt: React.MouseEvent<HTMLButtonElement>) => {\n inputRef.current?.focus()\n ;(onClear as React.MouseEventHandler<HTMLButtonElement> | undefined)?.(evt)\n },\n [onClear],\n )\n\n const handleFocus = useCallback(\n (evt: React.FocusEvent<HTMLInputElement>) => {\n setFocused(true)\n onFocus?.(evt)\n },\n [onFocus],\n )\n\n const handleBlur = useCallback(\n (evt: React.FocusEvent<HTMLInputElement>) => {\n setFocused(false)\n onBlur?.(evt)\n },\n [onBlur],\n )\n\n const handleChange = useCallback(\n (evt: React.ChangeEvent<HTMLInputElement>) => {\n setHasValue(!!evt.currentTarget.value)\n onChange?.(evt)\n autoResize()\n },\n [onChange, autoResize],\n )\n\n const handleAnimationStart = useCallback(\n (evt: React.AnimationEvent<HTMLInputElement>) => {\n onAnimationStart?.(evt)\n // Detect browser autofill\n if (evt.animationName === \"native-autofill-in\") {\n setHasValue(true)\n onAutofill?.()\n }\n },\n [onAnimationStart, onAutofill],\n )\n\n const handleRevealToggle = useCallback(() => {\n const next = !revealedRef.current\n revealedRef.current = next\n setRevealed(next)\n onRevealedChange?.(next)\n }, [onRevealedChange])\n\n return (\n <div\n className={clsx(s.Root, className)}\n data-label-placement={labelPlacement === \"inside\" ? \"inside\" : undefined}\n data-pill={pill && labelPlacement !== \"inside\" ? \"\" : undefined}\n >\n <div\n className={clsx(s.FieldFootprint, {\n [s.HasValue]: hasValue || !!startAdornment,\n })}\n data-focused={focused ? \"\" : undefined}\n data-has-value={hasValue ? \"\" : undefined}\n data-invalid={invalid ? \"\" : undefined}\n data-disabled={disabled ? \"\" : undefined}\n data-readonly={readOnly ? \"\" : undefined}\n data-multiline={multiline ? \"\" : undefined}\n onMouseDown={handleContainerMouseDown}\n >\n <label className={s.TypeableLabel} htmlFor={inputId}>\n <div className={s.LabelPositioner}>\n <div className={s.LabelText}>{label}</div>\n </div>\n </label>\n {startAdornment && (\n <div className={s.StartAdornment}>{startAdornment}</div>\n )}\n {multiline ? (\n <textarea\n {...(textareaProps(restProps) as React.TextareaHTMLAttributes<HTMLTextAreaElement>)}\n ref={mergeRefs([ref, inputRef]) as React.Ref<HTMLTextAreaElement>}\n id={inputId}\n name={name}\n rows={rows}\n className={s.Textarea}\n value={value}\n defaultValue={defaultValue}\n disabled={disabled}\n readOnly={readOnly}\n aria-invalid={ariaInvalid}\n aria-describedby={ariaDescribedBy}\n onChange={handleChange as unknown as React.ChangeEventHandler<HTMLTextAreaElement>}\n onFocus={handleFocus as unknown as React.FocusEventHandler<HTMLTextAreaElement>}\n onBlur={handleBlur as unknown as React.FocusEventHandler<HTMLTextAreaElement>}\n />\n ) : (\n <input\n {...restProps}\n ref={mergeRefs([ref, inputRef])}\n id={inputId}\n name={name}\n type={effectiveType}\n className={s.Input}\n value={value}\n defaultValue={defaultValue}\n disabled={disabled}\n readOnly={readOnly}\n aria-invalid={ariaInvalid}\n aria-describedby={ariaDescribedBy}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onAnimationStart={handleAnimationStart}\n data-lpignore={allowAutofillExtensions ? undefined : true}\n data-1p-ignore={allowAutofillExtensions ? undefined : true}\n />\n )}\n {endAdornment && (\n <div className={s.EndAdornment}>\n {endAdornment}\n </div>\n )}\n {showClearButton && (\n <button\n type=\"button\"\n aria-label=\"Clear input\"\n className={s.ClearButton}\n onClick={handleClear}\n >\n <X />\n </button>\n )}\n {showRevealButton && (\n <button\n type=\"button\"\n aria-label={revealed ? \"Hide\" : \"Show\"}\n className={s.RevealButton}\n onClick={handleRevealToggle}\n >\n {revealed ? <EyeOff /> : <Eye />}\n </button>\n )}\n </div>\n {errorMessage && (\n <FieldError id={errorId} className={s.ErrorMessage}>\n {errorMessage}\n </FieldError>\n )}\n {description && (\n <div id={descriptionId} className={s.Description}>\n {description}\n </div>\n )}\n </div>\n )\n },\n)\n\nFloatingLabelInput.displayName = \"FloatingLabelInput\"\n"]}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e,IAAI,CAClB,kBACE,IAAI,EAAC,QAAQ,gBACF,aAAa,EACxB,SAAS,EAAE,CAAC,CAAC,WAAW,EACxB,OAAO,EAAE,WAAW,aAEpB,KAAC,CAAC,IAAC,SAAS,EAAE,CAAC,CAAC,SAAS,GAAI,EAC7B,KAAC,aAAa,IAAC,SAAS,EAAE,CAAC,CAAC,cAAc,GAAI,IACvC,CACV,EACA,gBAAgB,IAAI,CACnB,iBACE,IAAI,EAAC,QAAQ,gBACD,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EACtC,SAAS,EAAE,CAAC,CAAC,YAAY,EACzB,OAAO,EAAE,kBAAkB,YAE1B,QAAQ,CAAC,CAAC,CAAC,KAAC,MAAM,KAAG,CAAC,CAAC,CAAC,KAAC,GAAG,KAAG,GACzB,CACV,IACG,EACL,YAAY,IAAI,CACf,KAAC,UAAU,IAAC,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,YAAY,YAC/C,YAAY,GACF,CACd,EACA,WAAW,IAAI,CACd,cAAK,EAAE,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,CAAC,WAAW,YAC7C,WAAW,GACR,CACP,IACG,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { forwardRef, useCallback, useId, useLayoutEffect, useRef, useState } from \"react\"\nimport { mergeRefs } from \"react-merge-refs\"\nimport { observeTextareaWidth } from \"../../lib/observeTextareaWidth\"\n\nimport { Eye, EyeOff, X, XCircleFilled } from \"../Icon\"\nimport { FieldError } from \"../FieldError\"\n\nimport s from \"@plexui/styles/components/FloatingLabelInput/FloatingLabelInput.module.css\"\n\nexport type FloatingLabelInputProps = {\n /**\n * Label text for the floating label\n */\n label: string\n /**\n * Error message to display below the input\n */\n errorMessage?: string\n /**\n * Mark the input as invalid\n * @default false (or true if errorMessage is provided)\n */\n invalid?: boolean\n /**\n * Disables the input visually and from interactions\n * @default false\n */\n disabled?: boolean\n /**\n * Makes the input read-only\n * @default false\n */\n readOnly?: boolean\n /**\n * Callback invoked when the clear button is clicked\n */\n onClear?: () => void\n /**\n * Callback invoked when the input is autofilled by the browser\n */\n onAutofill?: () => void\n /**\n * Allow autofill extensions to appear in the input\n * @default false\n */\n allowAutofillExtensions?: boolean\n /**\n * Helper/description text displayed below the input.\n * Shown alongside the error message when both are present.\n */\n description?: React.ReactNode\n /**\n * Content rendered before the input.\n */\n startAdornment?: React.ReactNode\n /**\n * Content rendered after the input, before the clear button.\n * For password fields the reveal toggle is built in — see `revealable`.\n */\n endAdornment?: React.ReactNode\n /**\n * Render a built-in reveal/hide toggle (eye icon) inside the field.\n * For `type=\"password\"` it swaps the input between `password` and `text`.\n * Defaults to `true` for password inputs that don't supply their own\n * `endAdornment`. Pass it explicitly to add the toggle to other sensitive\n * fields (e.g. a masked SSN) and react to it via `onRevealedChange`.\n * @default true when type=\"password\" and no endAdornment is provided\n */\n revealable?: boolean\n /**\n * Called with the new revealed state each time the reveal toggle is clicked.\n */\n onRevealedChange?: (revealed: boolean) => void\n /**\n * Render as a multi-line textarea instead of a single-line input.\n * @default false\n */\n multiline?: boolean\n /**\n * Number of visible text lines when `multiline` is true.\n * @default 2\n */\n rows?: number\n /**\n * Where the label rests once it floats: on the border, or inside the box\n * with the value under it. `inside` always takes the rounded box.\n * @default \"border\"\n */\n labelPlacement?: \"border\" | \"inside\"\n /**\n * Pill shape. `false` takes the rounded box of the other fields.\n * @default true\n */\n pill?: boolean\n} & React.InputHTMLAttributes<HTMLInputElement>\n\n// Attributes that only mean something on <input>; everything else (required,\n// maxLength, placeholder, key and clipboard handlers, aria-*, data-*) also\n// applies to the multiline <textarea>\nconst INPUT_ONLY_PROPS = [\n \"accept\", \"alt\", \"capture\", \"checked\", \"height\", \"list\", \"max\", \"min\", \"multiple\",\n \"pattern\", \"size\", \"src\", \"step\", \"width\", \"formAction\", \"formEncType\",\n \"formMethod\", \"formNoValidate\", \"formTarget\",\n] as const\n\nconst textareaProps = (props: Record<string, unknown>) => {\n const rest = { ...props }\n for (const key of INPUT_ONLY_PROPS) delete rest[key]\n return rest\n}\n\nexport const FloatingLabelInput = forwardRef<HTMLInputElement, FloatingLabelInputProps>(\n function FloatingLabelInput(props, ref) {\n const {\n label,\n description,\n errorMessage,\n \"invalid\": invalidProp,\n disabled = false,\n readOnly = false,\n onClear,\n onAutofill,\n allowAutofillExtensions = false,\n startAdornment,\n endAdornment,\n revealable: revealableProp,\n onRevealedChange,\n multiline = false,\n rows = 2,\n labelPlacement = \"border\",\n pill = true,\n className,\n \"id\": idProp,\n name,\n type = \"text\",\n value,\n defaultValue,\n onChange,\n onFocus,\n onBlur,\n onAnimationStart,\n \"aria-describedby\": ariaDescribedByProp,\n ...restProps\n } = props\n\n const inputRef = useRef<HTMLInputElement | null>(null)\n const generatedId = useId()\n const inputId = idProp || `floating-label-input-${generatedId}`\n const descriptionId = description ? `${inputId}-description` : undefined\n const errorId = errorMessage ? `${inputId}-error` : undefined\n\n const [focused, setFocused] = useState(false)\n const [hasUncontrolledValue, setHasValue] = useState(() => {\n return String((value !== undefined ? value : defaultValue) ?? \"\") !== \"\"\n })\n const [revealed, setRevealed] = useState(false)\n const revealedRef = useRef(false)\n\n const hasValue = value !== undefined ? String(value ?? \"\") !== \"\" : hasUncontrolledValue\n\n const autoResize = useCallback(() => {\n const el = inputRef.current\n if (!multiline || !el) return\n el.style.height = \"auto\"\n el.style.height = `${el.scrollHeight}px`\n }, [multiline])\n\n useLayoutEffect(() => {\n if (!multiline || !inputRef.current) return\n return observeTextareaWidth(inputRef.current, autoResize)\n }, [multiline, autoResize])\n\n // Also resize when a controlled value or rows changes without a keystroke\n useLayoutEffect(() => {\n autoResize()\n }, [autoResize, value, rows])\n\n const invalid = invalidProp ?? !!errorMessage\n\n // Determine if clear button should be shown\n const showClearButton = !!onClear && hasValue && !disabled && !readOnly\n\n // Built-in password reveal toggle\n const isPassword = type === \"password\"\n const revealable = revealableProp ?? (isPassword && !endAdornment)\n const showRevealButton = revealable && !disabled\n const effectiveType = isPassword && revealed ? \"text\" : type\n\n // Merge aria-describedby with error id\n const ariaDescribedBy =\n [ariaDescribedByProp, errorId, descriptionId].filter(Boolean).join(\" \") || undefined\n // An explicit aria-invalid (e.g. from Field) wins over the computed state\n const ariaInvalid = restProps[\"aria-invalid\"] ?? (invalid ? true : undefined)\n\n // Handle clicks on the container to focus the input\n const handleContainerMouseDown = useCallback((evt: React.MouseEvent<HTMLDivElement>) => {\n const input = inputRef.current\n if (!evt.target || !(evt.target instanceof Element) || !input) {\n return\n }\n if (input.contains(evt.target)) {\n return\n }\n if (evt.target.closest(\"button, [type='button'], [role='button']\")) {\n return\n }\n evt.preventDefault()\n if (document.activeElement !== input) {\n input.focus()\n }\n // email, number and other types without the selection API throw on setSelectionRange\n if (input.selectionStart === null) return\n const length = input.value.length\n input.setSelectionRange(length, length)\n }, [])\n\n // The clear button unmounts once the value is gone, so keep focus in the field\n const handleClear = useCallback(\n (evt: React.MouseEvent<HTMLButtonElement>) => {\n inputRef.current?.focus()\n ;(onClear as React.MouseEventHandler<HTMLButtonElement> | undefined)?.(evt)\n },\n [onClear],\n )\n\n const handleFocus = useCallback(\n (evt: React.FocusEvent<HTMLInputElement>) => {\n setFocused(true)\n onFocus?.(evt)\n },\n [onFocus],\n )\n\n const handleBlur = useCallback(\n (evt: React.FocusEvent<HTMLInputElement>) => {\n setFocused(false)\n onBlur?.(evt)\n },\n [onBlur],\n )\n\n const handleChange = useCallback(\n (evt: React.ChangeEvent<HTMLInputElement>) => {\n setHasValue(!!evt.currentTarget.value)\n onChange?.(evt)\n autoResize()\n },\n [onChange, autoResize],\n )\n\n const handleAnimationStart = useCallback(\n (evt: React.AnimationEvent<HTMLInputElement>) => {\n onAnimationStart?.(evt)\n // Detect browser autofill\n if (evt.animationName === \"native-autofill-in\") {\n setHasValue(true)\n onAutofill?.()\n }\n },\n [onAnimationStart, onAutofill],\n )\n\n const handleRevealToggle = useCallback(() => {\n const next = !revealedRef.current\n revealedRef.current = next\n setRevealed(next)\n onRevealedChange?.(next)\n }, [onRevealedChange])\n\n return (\n <div\n className={clsx(s.Root, className)}\n data-label-placement={labelPlacement === \"inside\" ? \"inside\" : undefined}\n data-pill={pill && labelPlacement !== \"inside\" ? \"\" : undefined}\n >\n <div\n className={clsx(s.FieldFootprint, {\n [s.HasValue]: hasValue || !!startAdornment,\n })}\n data-focused={focused ? \"\" : undefined}\n data-has-value={hasValue ? \"\" : undefined}\n data-invalid={invalid ? \"\" : undefined}\n data-disabled={disabled ? \"\" : undefined}\n data-readonly={readOnly ? \"\" : undefined}\n data-multiline={multiline ? \"\" : undefined}\n onMouseDown={handleContainerMouseDown}\n >\n <label className={s.TypeableLabel} htmlFor={inputId}>\n <div className={s.LabelPositioner}>\n <div className={s.LabelText}>{label}</div>\n </div>\n </label>\n {startAdornment && (\n <div className={s.StartAdornment}>{startAdornment}</div>\n )}\n {multiline ? (\n <textarea\n {...(textareaProps(restProps) as React.TextareaHTMLAttributes<HTMLTextAreaElement>)}\n ref={mergeRefs([ref, inputRef]) as React.Ref<HTMLTextAreaElement>}\n id={inputId}\n name={name}\n rows={rows}\n className={s.Textarea}\n value={value}\n defaultValue={defaultValue}\n disabled={disabled}\n readOnly={readOnly}\n aria-invalid={ariaInvalid}\n aria-describedby={ariaDescribedBy}\n onChange={handleChange as unknown as React.ChangeEventHandler<HTMLTextAreaElement>}\n onFocus={handleFocus as unknown as React.FocusEventHandler<HTMLTextAreaElement>}\n onBlur={handleBlur as unknown as React.FocusEventHandler<HTMLTextAreaElement>}\n />\n ) : (\n <input\n {...restProps}\n ref={mergeRefs([ref, inputRef])}\n id={inputId}\n name={name}\n type={effectiveType}\n className={s.Input}\n value={value}\n defaultValue={defaultValue}\n disabled={disabled}\n readOnly={readOnly}\n aria-invalid={ariaInvalid}\n aria-describedby={ariaDescribedBy}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onAnimationStart={handleAnimationStart}\n data-lpignore={allowAutofillExtensions ? undefined : true}\n data-1p-ignore={allowAutofillExtensions ? undefined : true}\n />\n )}\n {endAdornment && (\n <div className={s.EndAdornment}>\n {endAdornment}\n </div>\n )}\n {showClearButton && (\n <button\n type=\"button\"\n aria-label=\"Clear input\"\n className={s.ClearButton}\n onClick={handleClear}\n >\n <X className={s.ClearIcon} />\n <XCircleFilled className={s.ClearPhoneIcon} />\n </button>\n )}\n {showRevealButton && (\n <button\n type=\"button\"\n aria-label={revealed ? \"Hide\" : \"Show\"}\n className={s.RevealButton}\n onClick={handleRevealToggle}\n >\n {revealed ? <EyeOff /> : <Eye />}\n </button>\n )}\n </div>\n {errorMessage && (\n <FieldError id={errorId} className={s.ErrorMessage}>\n {errorMessage}\n </FieldError>\n )}\n {description && (\n <div id={descriptionId} className={s.Description}>\n {description}\n </div>\n )}\n </div>\n )\n },\n)\n\nFloatingLabelInput.displayName = \"FloatingLabelInput\"\n"]}