prime-ui-kit 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -12
- package/dist/chunks/{chunk-NHOWNIAR.js → chunk-6JTZOA5I.js} +1472 -671
- package/dist/chunks/{chunk-DB2Y3XXA.js → chunk-OAE4IQX2.js} +2845 -1732
- package/dist/chunks/{chunk-KCQFOORX.js → chunk-U5SR2LZR.js} +17 -4
- package/dist/color-picker.js +2 -2
- package/dist/components/button/Button.d.ts +19 -2
- package/dist/components/card/Card.d.ts +1 -1
- package/dist/components/code-block/CodeBlock.d.ts +1 -1
- package/dist/components/color-picker/ColorPicker.d.ts +1 -1
- package/dist/components/data-table/DataTable.d.ts +6 -1
- package/dist/components/data-table/Row.d.ts +3 -1
- package/dist/components/data-table/rows.d.ts +4 -0
- package/dist/components/data-table/types.d.ts +5 -0
- package/dist/components/digit-input/DigitInput.d.ts +6 -1
- package/dist/components/dnd/Dnd.d.ts +1 -1
- package/dist/components/dnd/dragSession.d.ts +9 -0
- package/dist/components/dnd/useDropTarget.d.ts +5 -0
- package/dist/components/dnd/useFlipList.d.ts +3 -3
- package/dist/components/drawer/Drawer.d.ts +8 -5
- package/dist/components/dropdown/Dropdown.d.ts +17 -0
- package/dist/components/index.d.ts +9 -2
- package/dist/components/input/Input.d.ts +16 -1
- package/dist/components/input/passwordStrength.d.ts +9 -0
- package/dist/components/kanban/Kanban.d.ts +129 -0
- package/dist/components/modal/Modal.d.ts +5 -2
- package/dist/components/page-toolbar/PageToolbar.d.ts +53 -0
- package/dist/components/progress-bar/ProgressBar.d.ts +16 -1
- package/dist/components/segmented-control/SegmentedControl.d.ts +5 -2
- package/dist/components/sparkline/Sparkline.d.ts +26 -0
- package/dist/components/tabs/Tabs.d.ts +5 -2
- package/dist/hooks/useEdgeOverflow.d.ts +16 -0
- package/dist/hooks/useMediaQuery.d.ts +7 -0
- package/dist/hooks/useSwipeDismiss.d.ts +34 -0
- package/dist/icons/registry.d.ts +2 -0
- package/dist/index.css +2977 -1306
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -3
- package/dist/internal/CheckMark.d.ts +12 -0
- package/dist/internal/MorphText.d.ts +12 -0
- package/dist/internal/RollingNumber.d.ts +14 -0
- package/dist/internal/overlay/FloatingPanel.d.ts +3 -1
- package/dist/internal/overlay/useFloatingLayer.d.ts +11 -1
- package/dist/internal/surfaceDepth.d.ts +25 -0
- package/dist/internal/swatch.d.ts +4 -1
- package/dist/internal/touchTarget.d.ts +4 -0
- package/dist/layout/app-header/AppHeader.d.ts +110 -0
- package/dist/layout/app-shell/AppShell.d.ts +16 -11
- package/dist/layout/bottom-nav/BottomNav.d.ts +80 -0
- package/dist/layout/index.d.ts +5 -1
- package/dist/motion/celebrate.d.ts +18 -0
- package/dist/tokens/layers.d.ts +37 -0
- package/dist/tokens/naming.d.ts +1 -1
- package/dist/tokens/primitives.d.ts +4 -0
- package/dist/tokens/semantic.d.ts +122 -56
- package/dist/tokens/themes/dark.d.ts +10 -14
- package/package.json +3 -2
- package/src/components/accordion/COMPONENT.md +5 -5
- package/src/components/avatar/COMPONENT.md +1 -1
- package/src/components/badge/COMPONENT.md +2 -2
- package/src/components/banner/COMPONENT.md +1 -1
- package/src/components/button/COMPONENT.md +26 -5
- package/src/components/button/examples/download.tsx +45 -0
- package/src/components/button/examples/hold-to-confirm.tsx +23 -0
- package/src/components/button/examples/label-morph.tsx +33 -0
- package/src/components/card/COMPONENT.md +4 -2
- package/src/components/card/examples/narrow.tsx +2 -2
- package/src/components/card/examples/panel-chart.tsx +1 -1
- package/src/components/card/examples/variants.tsx +1 -1
- package/src/components/checkbox/examples/examples.module.css +5 -3
- package/src/components/code-block/COMPONENT.md +6 -6
- package/src/components/code-block/examples/overview.tsx +1 -1
- package/src/components/code-block/examples/variants.tsx +1 -1
- package/src/components/color-picker/COMPONENT.md +1 -1
- package/src/components/color-swatches/COMPONENT.md +5 -5
- package/src/components/command-menu/COMPONENT.md +1 -1
- package/src/components/crossfade/COMPONENT.md +1 -1
- package/src/components/crossfade/examples/overview.tsx +3 -3
- package/src/components/data-table/COMPONENT.md +24 -10
- package/src/components/data-table/examples/columns-visibility.tsx +167 -0
- package/src/components/digit-input/COMPONENT.md +15 -13
- package/src/components/digit-input/examples/examples.module.css +8 -0
- package/src/components/digit-input/examples/in-form.tsx +2 -5
- package/src/components/digit-input/examples/on-complete.tsx +7 -6
- package/src/components/digit-input/examples/sizes.tsx +1 -1
- package/src/components/divider/COMPONENT.md +1 -1
- package/src/components/dnd/COMPONENT.md +3 -3
- package/src/components/dnd/examples/examples.module.css +4 -4
- package/src/components/drawer/COMPONENT.md +17 -9
- package/src/components/drawer/examples/date-sheet.tsx +41 -0
- package/src/components/drawer/examples/examples.module.css +5 -0
- package/src/components/drawer/examples/placement.tsx +4 -2
- package/src/components/dropdown/COMPONENT.md +20 -6
- package/src/components/dropdown/examples/checkbox-items.tsx +48 -0
- package/src/components/dropdown/examples/examples.module.css +1 -1
- package/src/components/empty-page/COMPONENT.md +1 -1
- package/src/components/empty-page/examples/examples.module.css +1 -1
- package/src/components/example-frame/COMPONENT.md +1 -1
- package/src/components/input/COMPONENT.md +10 -1
- package/src/components/input/examples/password-strength.tsx +12 -0
- package/src/components/kanban/COMPONENT.md +181 -0
- package/src/components/kanban/examples/controlled.tsx +78 -0
- package/src/components/kanban/examples/examples.module.css +31 -0
- package/src/components/kanban/examples/limits.tsx +58 -0
- package/src/components/kanban/examples/narrow.tsx +76 -0
- package/src/components/kanban/examples/overview.tsx +130 -0
- package/src/components/kanban/examples/states.tsx +75 -0
- package/src/components/kanban/examples/structure.tsx +76 -0
- package/src/components/login-form/COMPONENT.md +5 -5
- package/src/components/login-form/examples/register.tsx +2 -2
- package/src/components/login-form/examples/reset-password.tsx +2 -2
- package/src/components/modal/COMPONENT.md +11 -8
- package/src/components/modal/examples/examples.module.css +2 -2
- package/src/components/notification/COMPONENT.md +2 -2
- package/src/components/page-content/COMPONENT.md +1 -1
- package/src/components/page-content/examples/examples.module.css +1 -1
- package/src/components/page-toolbar/COMPONENT.md +142 -0
- package/src/components/page-toolbar/examples/examples.module.css +16 -0
- package/src/components/page-toolbar/examples/narrow.tsx +103 -0
- package/src/components/page-toolbar/examples/overview.tsx +113 -0
- package/src/components/page-toolbar/examples/save-changes.tsx +40 -0
- package/src/components/page-toolbar/examples/without-search.tsx +60 -0
- package/src/components/popover/COMPONENT.md +5 -4
- package/src/components/progress-bar/COMPONENT.md +6 -2
- package/src/components/progress-bar/examples/examples.module.css +7 -0
- package/src/components/progress-bar/examples/milestone.tsx +43 -0
- package/src/components/progress-bar/examples/steps.tsx +35 -0
- package/src/components/progress-circle/COMPONENT.md +1 -1
- package/src/components/scroll-container/COMPONENT.md +1 -1
- package/src/components/segmented-control/COMPONENT.md +8 -8
- package/src/components/segmented-control/examples/full-width.tsx +1 -1
- package/src/components/select/COMPONENT.md +2 -1
- package/src/components/skeleton/COMPONENT.md +1 -1
- package/src/components/skeleton/examples/with-crossfade.tsx +3 -3
- package/src/components/smart-filter/COMPONENT.md +2 -0
- package/src/components/sparkline/COMPONENT.md +98 -0
- package/src/components/sparkline/examples/examples.module.css +13 -0
- package/src/components/sparkline/examples/overview.tsx +27 -0
- package/src/components/sparkline/examples/period.tsx +46 -0
- package/src/components/spinner/COMPONENT.md +1 -1
- package/src/components/tabs/COMPONENT.md +24 -22
- package/src/components/tabs/examples/closable.tsx +1 -1
- package/src/components/tabs/examples/examples.module.css +14 -0
- package/src/components/tabs/examples/orientation.tsx +87 -33
- package/src/components/tooltip/COMPONENT.md +8 -6
- package/src/components/tooltip/examples/examples.module.css +2 -2
- package/src/layout/app-header/COMPONENT.md +178 -0
- package/src/layout/app-header/examples/breadcrumbs.tsx +36 -0
- package/src/layout/app-header/examples/examples.module.css +47 -0
- package/src/layout/app-header/examples/in-app-shell.tsx +70 -0
- package/src/layout/app-header/examples/narrow.tsx +29 -0
- package/src/layout/app-header/examples/overview.tsx +36 -0
- package/src/layout/app-shell/COMPONENT.md +35 -29
- package/src/layout/app-shell/examples/examples.module.css +17 -2
- package/src/layout/app-shell/examples/footer.tsx +59 -0
- package/src/layout/app-shell/examples/overview.tsx +19 -8
- package/src/layout/bottom-nav/COMPONENT.md +153 -0
- package/src/layout/bottom-nav/examples/examples.module.css +39 -0
- package/src/layout/bottom-nav/examples/floating.tsx +89 -0
- package/src/layout/bottom-nav/examples/icon-only.tsx +41 -0
- package/src/layout/bottom-nav/examples/in-app-shell.tsx +64 -0
- package/src/layout/bottom-nav/examples/overview.tsx +44 -0
- package/src/layout/bottom-nav/examples/router.tsx +31 -0
- package/src/layout/bottom-nav/examples/structure.tsx +47 -0
- package/src/layout/sidebar/COMPONENT.md +14 -13
- package/src/layout/sidebar/examples/examples.module.css +5 -5
- package/src/styles/globals.css +125 -2
- package/src/styles/theme-dark.css +39 -13
- package/src/styles/theme-light.css +84 -16
- package/src/styles/tokens.css +2 -0
|
@@ -15,31 +15,9 @@ function useControlSize(sizeProp) {
|
|
|
15
15
|
return sizeProp ?? host ?? "m";
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
// src/components/
|
|
19
|
-
import * as React3 from "react";
|
|
20
|
-
|
|
21
|
-
// src/hooks/useMergedRefs.ts
|
|
18
|
+
// src/components/spinner/Spinner.tsx
|
|
22
19
|
import * as React2 from "react";
|
|
23
20
|
|
|
24
|
-
// src/internal/mergeRefs.ts
|
|
25
|
-
function mergeRefs(...refs) {
|
|
26
|
-
return (value) => {
|
|
27
|
-
for (const ref of refs) {
|
|
28
|
-
if (ref == null) continue;
|
|
29
|
-
if (typeof ref === "function") {
|
|
30
|
-
ref(value);
|
|
31
|
-
} else {
|
|
32
|
-
ref.current = value;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// src/hooks/useMergedRefs.ts
|
|
39
|
-
function useMergedRefs(...refs) {
|
|
40
|
-
return React2.useMemo(() => mergeRefs(...refs), refs);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
21
|
// src/internal/cx.ts
|
|
44
22
|
function cx(...classNames) {
|
|
45
23
|
return classNames.filter(Boolean).join(" ");
|
|
@@ -58,102 +36,6 @@ function toDataAttributes(input) {
|
|
|
58
36
|
return result;
|
|
59
37
|
}
|
|
60
38
|
|
|
61
|
-
// src/components/scroll-container/ScrollContainer.module.css
|
|
62
|
-
var ScrollContainer_default = {
|
|
63
|
-
root: "ScrollContainer_root",
|
|
64
|
-
vertical: "ScrollContainer_vertical",
|
|
65
|
-
horizontal: "ScrollContainer_horizontal",
|
|
66
|
-
both: "ScrollContainer_both",
|
|
67
|
-
overscrollContain: "ScrollContainer_overscrollContain",
|
|
68
|
-
overscrollNone: "ScrollContainer_overscrollNone",
|
|
69
|
-
scrollbarHidden: "ScrollContainer_scrollbarHidden"
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// src/components/scroll-container/ScrollContainer.tsx
|
|
73
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
74
|
-
var axisClass = {
|
|
75
|
-
vertical: ScrollContainer_default.vertical,
|
|
76
|
-
horizontal: ScrollContainer_default.horizontal,
|
|
77
|
-
both: ScrollContainer_default.both
|
|
78
|
-
};
|
|
79
|
-
function useEdgeOverflow(ref, enabled, horizontal) {
|
|
80
|
-
const [overflow, setOverflow] = React3.useState({ start: false, end: false });
|
|
81
|
-
React3.useLayoutEffect(() => {
|
|
82
|
-
const node = ref.current;
|
|
83
|
-
if (!enabled || !node) return;
|
|
84
|
-
const update = () => {
|
|
85
|
-
const position = horizontal ? Math.abs(node.scrollLeft) : node.scrollTop;
|
|
86
|
-
const max = horizontal ? node.scrollWidth - node.clientWidth : node.scrollHeight - node.clientHeight;
|
|
87
|
-
const start = position > 1;
|
|
88
|
-
const end = max - position > 1;
|
|
89
|
-
setOverflow((prev) => prev.start === start && prev.end === end ? prev : { start, end });
|
|
90
|
-
};
|
|
91
|
-
let frame = 0;
|
|
92
|
-
const schedule = () => {
|
|
93
|
-
if (frame) return;
|
|
94
|
-
frame = requestAnimationFrame(() => {
|
|
95
|
-
frame = 0;
|
|
96
|
-
update();
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
update();
|
|
100
|
-
node.addEventListener("scroll", schedule, { passive: true });
|
|
101
|
-
const resize = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(schedule);
|
|
102
|
-
const observeChildren = () => {
|
|
103
|
-
for (const child of Array.from(node.children)) resize?.observe(child);
|
|
104
|
-
};
|
|
105
|
-
resize?.observe(node);
|
|
106
|
-
observeChildren();
|
|
107
|
-
const mutation = new MutationObserver(() => {
|
|
108
|
-
observeChildren();
|
|
109
|
-
schedule();
|
|
110
|
-
});
|
|
111
|
-
mutation.observe(node, { childList: true });
|
|
112
|
-
return () => {
|
|
113
|
-
cancelAnimationFrame(frame);
|
|
114
|
-
node.removeEventListener("scroll", schedule);
|
|
115
|
-
resize?.disconnect();
|
|
116
|
-
mutation.disconnect();
|
|
117
|
-
};
|
|
118
|
-
}, [ref, enabled, horizontal]);
|
|
119
|
-
return enabled ? overflow : { start: false, end: false };
|
|
120
|
-
}
|
|
121
|
-
function ScrollContainer({
|
|
122
|
-
as: Component = "div",
|
|
123
|
-
axis = "vertical",
|
|
124
|
-
overscrollBehavior = "contain",
|
|
125
|
-
fade = false,
|
|
126
|
-
scrollbar = "thin",
|
|
127
|
-
className,
|
|
128
|
-
ref,
|
|
129
|
-
...rest
|
|
130
|
-
}) {
|
|
131
|
-
const innerRef = React3.useRef(null);
|
|
132
|
-
const mergedRef = useMergedRefs(innerRef, ref);
|
|
133
|
-
const horizontal = axis === "horizontal";
|
|
134
|
-
const overflow = useEdgeOverflow(innerRef, fade, horizontal);
|
|
135
|
-
return /* @__PURE__ */ jsx2(
|
|
136
|
-
Component,
|
|
137
|
-
{
|
|
138
|
-
ref: mergedRef,
|
|
139
|
-
className: cx(
|
|
140
|
-
ScrollContainer_default.root,
|
|
141
|
-
axisClass[axis],
|
|
142
|
-
overscrollBehavior === "contain" && ScrollContainer_default.overscrollContain,
|
|
143
|
-
overscrollBehavior === "none" && ScrollContainer_default.overscrollNone,
|
|
144
|
-
scrollbar === "hidden" && ScrollContainer_default.scrollbarHidden,
|
|
145
|
-
className
|
|
146
|
-
),
|
|
147
|
-
...toDataAttributes({
|
|
148
|
-
fade: fade ? horizontal ? "horizontal" : "vertical" : void 0,
|
|
149
|
-
"overflow-start": overflow.start || void 0,
|
|
150
|
-
"overflow-end": overflow.end || void 0
|
|
151
|
-
}),
|
|
152
|
-
...rest
|
|
153
|
-
}
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
39
|
// src/internal/iconBox.module.css
|
|
158
40
|
var iconBox_default = {
|
|
159
41
|
box: "iconBox_box",
|
|
@@ -175,216 +57,16 @@ var textTone_default = {
|
|
|
175
57
|
tone: "textTone_tone"
|
|
176
58
|
};
|
|
177
59
|
|
|
178
|
-
// src/
|
|
179
|
-
var
|
|
180
|
-
root: "
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
// src/icons/registry.ts
|
|
184
|
-
import {
|
|
185
|
-
Activity,
|
|
186
|
-
AlertTriangle,
|
|
187
|
-
ArrowDown,
|
|
188
|
-
ArrowUp,
|
|
189
|
-
ArrowUpDown,
|
|
190
|
-
Bell,
|
|
191
|
-
Bold,
|
|
192
|
-
BookOpen,
|
|
193
|
-
Calendar,
|
|
194
|
-
ChartColumn,
|
|
195
|
-
Check,
|
|
196
|
-
CheckCircle2,
|
|
197
|
-
ChevronDown,
|
|
198
|
-
ChevronLeft,
|
|
199
|
-
ChevronRight,
|
|
200
|
-
ChevronsLeft,
|
|
201
|
-
ChevronsUpDown,
|
|
202
|
-
ChevronUp,
|
|
203
|
-
Circle,
|
|
204
|
-
CloudOff,
|
|
205
|
-
CloudUpload,
|
|
206
|
-
Code2,
|
|
207
|
-
Copy,
|
|
208
|
-
Download,
|
|
209
|
-
ExternalLink,
|
|
210
|
-
Eye,
|
|
211
|
-
EyeOff,
|
|
212
|
-
FileText,
|
|
213
|
-
GripVertical,
|
|
214
|
-
HardDrive,
|
|
215
|
-
House,
|
|
216
|
-
Image,
|
|
217
|
-
Inbox,
|
|
218
|
-
Info,
|
|
219
|
-
Italic,
|
|
220
|
-
KeyRound,
|
|
221
|
-
LayoutDashboard,
|
|
222
|
-
LayoutGrid,
|
|
223
|
-
Link2,
|
|
224
|
-
List,
|
|
225
|
-
ListFilter,
|
|
226
|
-
ListTodo,
|
|
227
|
-
Lock,
|
|
228
|
-
LogIn,
|
|
229
|
-
LogOut,
|
|
230
|
-
Mail,
|
|
231
|
-
MailCheck,
|
|
232
|
-
Menu,
|
|
233
|
-
MessageSquare,
|
|
234
|
-
Minus,
|
|
235
|
-
Monitor,
|
|
236
|
-
Moon,
|
|
237
|
-
MoreHorizontal,
|
|
238
|
-
Package,
|
|
239
|
-
PanelLeftClose,
|
|
240
|
-
PanelLeftOpen,
|
|
241
|
-
Pipette,
|
|
242
|
-
Plus,
|
|
243
|
-
Receipt,
|
|
244
|
-
RefreshCw,
|
|
245
|
-
Rocket,
|
|
246
|
-
Search,
|
|
247
|
-
Send,
|
|
248
|
-
Settings,
|
|
249
|
-
ShoppingCart,
|
|
250
|
-
Smartphone,
|
|
251
|
-
Sun,
|
|
252
|
-
Tablet,
|
|
253
|
-
Trash2,
|
|
254
|
-
Truck,
|
|
255
|
-
Underline,
|
|
256
|
-
UserRound,
|
|
257
|
-
Users,
|
|
258
|
-
Wallet,
|
|
259
|
-
X,
|
|
260
|
-
XCircle
|
|
261
|
-
} from "lucide-react";
|
|
262
|
-
var iconRegistry = {
|
|
263
|
-
"nav.chevronDown": ChevronDown,
|
|
264
|
-
"nav.chevronLeft": ChevronLeft,
|
|
265
|
-
"nav.chevronRight": ChevronRight,
|
|
266
|
-
"nav.chevronUp": ChevronUp,
|
|
267
|
-
"nav.chevronsLeft": ChevronsLeft,
|
|
268
|
-
"nav.chevronsUpDown": ChevronsUpDown,
|
|
269
|
-
"nav.dashboard": LayoutDashboard,
|
|
270
|
-
"nav.home": House,
|
|
271
|
-
"nav.itemDot": Circle,
|
|
272
|
-
"nav.layoutGrid": LayoutGrid,
|
|
273
|
-
"nav.menu": Menu,
|
|
274
|
-
"nav.sidebarCollapse": PanelLeftClose,
|
|
275
|
-
"nav.sidebarExpand": PanelLeftOpen,
|
|
276
|
-
"action.add": Plus,
|
|
277
|
-
"action.check": Check,
|
|
278
|
-
"action.close": X,
|
|
279
|
-
"action.copy": Copy,
|
|
280
|
-
"action.delete": Trash2,
|
|
281
|
-
"action.download": Download,
|
|
282
|
-
"action.drag": GripVertical,
|
|
283
|
-
"action.externalLink": ExternalLink,
|
|
284
|
-
"action.eyedropper": Pipette,
|
|
285
|
-
"action.filter": ListFilter,
|
|
286
|
-
"action.login": LogIn,
|
|
287
|
-
"action.logout": LogOut,
|
|
288
|
-
"action.more": MoreHorizontal,
|
|
289
|
-
"action.refresh": RefreshCw,
|
|
290
|
-
"action.remove": Minus,
|
|
291
|
-
"action.search": Search,
|
|
292
|
-
"action.send": Send,
|
|
293
|
-
"action.settings": Settings,
|
|
294
|
-
"action.upload": CloudUpload,
|
|
295
|
-
"field.calendar": Calendar,
|
|
296
|
-
"field.email": Mail,
|
|
297
|
-
"field.password.show": Eye,
|
|
298
|
-
"field.password.hide": EyeOff,
|
|
299
|
-
"format.bold": Bold,
|
|
300
|
-
"format.italic": Italic,
|
|
301
|
-
"format.link": Link2,
|
|
302
|
-
"format.list": List,
|
|
303
|
-
"format.underline": Underline,
|
|
304
|
-
"object.activity": Activity,
|
|
305
|
-
"object.bell": Bell,
|
|
306
|
-
"object.book": BookOpen,
|
|
307
|
-
"object.cart": ShoppingCart,
|
|
308
|
-
"object.chart": ChartColumn,
|
|
309
|
-
"object.document": FileText,
|
|
310
|
-
"object.image": Image,
|
|
311
|
-
"object.inbox": Inbox,
|
|
312
|
-
"object.key": KeyRound,
|
|
313
|
-
"object.message": MessageSquare,
|
|
314
|
-
"object.package": Package,
|
|
315
|
-
"object.receipt": Receipt,
|
|
316
|
-
"object.rocket": Rocket,
|
|
317
|
-
"object.storage": HardDrive,
|
|
318
|
-
"object.tasks": ListTodo,
|
|
319
|
-
"object.truck": Truck,
|
|
320
|
-
"object.user": UserRound,
|
|
321
|
-
"object.users": Users,
|
|
322
|
-
"object.wallet": Wallet,
|
|
323
|
-
"sort.ascending": ArrowUp,
|
|
324
|
-
"sort.descending": ArrowDown,
|
|
325
|
-
"sort.none": ArrowUpDown,
|
|
326
|
-
"status.danger": XCircle,
|
|
327
|
-
"status.emailSent": MailCheck,
|
|
328
|
-
"status.info": Info,
|
|
329
|
-
"status.locked": Lock,
|
|
330
|
-
"status.offline": CloudOff,
|
|
331
|
-
"status.success": CheckCircle2,
|
|
332
|
-
"status.warning": AlertTriangle,
|
|
333
|
-
"theme.dark": Moon,
|
|
334
|
-
"theme.light": Sun,
|
|
335
|
-
"view.code": Code2,
|
|
336
|
-
"view.preview": Eye,
|
|
337
|
-
"viewport.desktop": Monitor,
|
|
338
|
-
"viewport.mobile": Smartphone,
|
|
339
|
-
"viewport.tablet": Tablet
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
// src/icons/Icon.tsx
|
|
343
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
344
|
-
function IconSvg({
|
|
345
|
-
glyph: GlyphSvg,
|
|
346
|
-
className,
|
|
347
|
-
size,
|
|
348
|
-
tone = "default",
|
|
349
|
-
strokeWidth = 1.75,
|
|
350
|
-
...rest
|
|
351
|
-
}) {
|
|
352
|
-
const tier = useOptionalControlSize();
|
|
353
|
-
return /* @__PURE__ */ jsx3(
|
|
354
|
-
GlyphSvg,
|
|
355
|
-
{
|
|
356
|
-
className: cx(Icon_default.root, iconBoxClass(size, tier), textTone_default.tone, className),
|
|
357
|
-
"data-tone": tone === "default" ? void 0 : tone,
|
|
358
|
-
strokeWidth,
|
|
359
|
-
"aria-hidden": "true",
|
|
360
|
-
...rest
|
|
361
|
-
}
|
|
362
|
-
);
|
|
363
|
-
}
|
|
364
|
-
function Icon({ name, ...rest }) {
|
|
365
|
-
return /* @__PURE__ */ jsx3(IconSvg, { glyph: iconRegistry[name], ...rest });
|
|
366
|
-
}
|
|
367
|
-
function createIcon(glyph) {
|
|
368
|
-
function DomainIcon(props) {
|
|
369
|
-
return /* @__PURE__ */ jsx3(IconSvg, { glyph, ...props });
|
|
370
|
-
}
|
|
371
|
-
DomainIcon.displayName = `Icon(${glyph.displayName ?? "Glyph"})`;
|
|
372
|
-
return DomainIcon;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
// src/components/spinner/Spinner.tsx
|
|
376
|
-
import * as React4 from "react";
|
|
377
|
-
|
|
378
|
-
// src/internal/VisuallyHidden.module.css
|
|
379
|
-
var VisuallyHidden_default = {
|
|
380
|
-
root: "VisuallyHidden_root"
|
|
60
|
+
// src/internal/VisuallyHidden.module.css
|
|
61
|
+
var VisuallyHidden_default = {
|
|
62
|
+
root: "VisuallyHidden_root"
|
|
381
63
|
};
|
|
382
64
|
|
|
383
65
|
// src/internal/VisuallyHidden.tsx
|
|
384
|
-
import { jsx as
|
|
66
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
385
67
|
var visuallyHiddenClass = VisuallyHidden_default.root;
|
|
386
68
|
function VisuallyHidden({ className, ...rest }) {
|
|
387
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ jsx2("span", { className: cx(VisuallyHidden_default.root, className), ...rest });
|
|
388
70
|
}
|
|
389
71
|
|
|
390
72
|
// src/components/spinner/Spinner.module.css
|
|
@@ -395,7 +77,7 @@ var Spinner_default = {
|
|
|
395
77
|
};
|
|
396
78
|
|
|
397
79
|
// src/components/spinner/Spinner.tsx
|
|
398
|
-
import { jsx as
|
|
80
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
399
81
|
var SPINNER_LABELS = {
|
|
400
82
|
loading: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430"
|
|
401
83
|
};
|
|
@@ -407,7 +89,7 @@ function Spinner({
|
|
|
407
89
|
...rest
|
|
408
90
|
}) {
|
|
409
91
|
const controlSize = useOptionalControlSize();
|
|
410
|
-
const labels =
|
|
92
|
+
const labels = React2.useMemo(() => ({ ...SPINNER_LABELS, ...labelsProp }), [labelsProp]);
|
|
411
93
|
const size = sizeProp ?? controlSize ?? "m";
|
|
412
94
|
return /* @__PURE__ */ jsxs(
|
|
413
95
|
"span",
|
|
@@ -417,13 +99,16 @@ function Spinner({
|
|
|
417
99
|
...toDataAttributes({ size, tone: tone === "default" ? void 0 : tone }),
|
|
418
100
|
...rest,
|
|
419
101
|
children: [
|
|
420
|
-
/* @__PURE__ */
|
|
421
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ jsx3("span", { className: Spinner_default.ring, "aria-hidden": "true" }),
|
|
103
|
+
/* @__PURE__ */ jsx3(VisuallyHidden, { children: labels.loading })
|
|
422
104
|
]
|
|
423
105
|
}
|
|
424
106
|
);
|
|
425
107
|
}
|
|
426
108
|
|
|
109
|
+
// src/components/button/Button.tsx
|
|
110
|
+
import * as React8 from "react";
|
|
111
|
+
|
|
427
112
|
// src/internal/fieldSurface.module.css
|
|
428
113
|
var fieldSurface_default = {
|
|
429
114
|
surface: "fieldSurface_surface"
|
|
@@ -445,12 +130,12 @@ var fieldTierClass = fieldTier_default.tier;
|
|
|
445
130
|
var fieldTriggerClass = `${fieldTier_default.tier} ${fieldSurface_default.surface} ${fieldTrigger_default.trigger}`;
|
|
446
131
|
|
|
447
132
|
// src/internal/iconLayout.ts
|
|
448
|
-
import * as
|
|
133
|
+
import * as React3 from "react";
|
|
449
134
|
function iconLayout(children, iconType) {
|
|
450
|
-
const content =
|
|
135
|
+
const content = React3.Children.toArray(children).filter(
|
|
451
136
|
(child) => !(typeof child === "string" && child.trim() === "")
|
|
452
137
|
);
|
|
453
|
-
const isIcon = (child) =>
|
|
138
|
+
const isIcon = (child) => React3.isValidElement(child) && child.type === iconType;
|
|
454
139
|
const iconOnly = content.length > 0 && content.every(isIcon);
|
|
455
140
|
return {
|
|
456
141
|
iconOnly,
|
|
@@ -459,9 +144,174 @@ function iconLayout(children, iconType) {
|
|
|
459
144
|
};
|
|
460
145
|
}
|
|
461
146
|
|
|
147
|
+
// src/internal/MorphText.tsx
|
|
148
|
+
import * as React5 from "react";
|
|
149
|
+
|
|
150
|
+
// src/hooks/usePresence.ts
|
|
151
|
+
import * as React4 from "react";
|
|
152
|
+
var DURATION_FALLBACK_MS = {
|
|
153
|
+
fast: 230,
|
|
154
|
+
base: 380,
|
|
155
|
+
slow: 570
|
|
156
|
+
};
|
|
157
|
+
var TIMEOUT_SLACK_MS = 50;
|
|
158
|
+
function prefersReducedMotion() {
|
|
159
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
160
|
+
}
|
|
161
|
+
function parseDurationMs(raw) {
|
|
162
|
+
const value = raw.trim();
|
|
163
|
+
if (value === "") return null;
|
|
164
|
+
const n = Number.parseFloat(value);
|
|
165
|
+
if (Number.isNaN(n)) return null;
|
|
166
|
+
if (value.endsWith("ms")) return n;
|
|
167
|
+
if (value.endsWith("s")) return n * 1e3;
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
function motionDurationMs(token) {
|
|
171
|
+
if (typeof document === "undefined") return DURATION_FALLBACK_MS[token];
|
|
172
|
+
const raw = getComputedStyle(document.documentElement).getPropertyValue(
|
|
173
|
+
`--prime-motion-duration-${token}`
|
|
174
|
+
);
|
|
175
|
+
return parseDurationMs(raw) ?? DURATION_FALLBACK_MS[token];
|
|
176
|
+
}
|
|
177
|
+
function exitTimeoutMs(token) {
|
|
178
|
+
return motionDurationMs(token) + TIMEOUT_SLACK_MS;
|
|
179
|
+
}
|
|
180
|
+
function usePresence(open, options = {}) {
|
|
181
|
+
const { exitDuration = "base" } = options;
|
|
182
|
+
const [mounted, setMounted] = React4.useState(open);
|
|
183
|
+
if (open && !mounted) setMounted(true);
|
|
184
|
+
if (!open && mounted && prefersReducedMotion()) setMounted(false);
|
|
185
|
+
const openRef = React4.useRef(open);
|
|
186
|
+
openRef.current = open;
|
|
187
|
+
React4.useEffect(() => {
|
|
188
|
+
if (open || !mounted) return;
|
|
189
|
+
const id = window.setTimeout(() => setMounted(false), exitTimeoutMs(exitDuration));
|
|
190
|
+
return () => window.clearTimeout(id);
|
|
191
|
+
}, [open, mounted, exitDuration]);
|
|
192
|
+
const onExitEnd = React4.useCallback((event) => {
|
|
193
|
+
if (event.target !== event.currentTarget) return;
|
|
194
|
+
if (!openRef.current) setMounted(false);
|
|
195
|
+
}, []);
|
|
196
|
+
return { mounted: open || mounted, state: open ? "open" : "closed", onExitEnd };
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/internal/MorphText.module.css
|
|
200
|
+
var MorphText_default = {
|
|
201
|
+
root: "MorphText_root",
|
|
202
|
+
morphing: "MorphText_morphing",
|
|
203
|
+
sizer: "MorphText_sizer",
|
|
204
|
+
layer: "MorphText_layer",
|
|
205
|
+
letter: "MorphText_letter",
|
|
206
|
+
letterOut: "MorphText_letterOut",
|
|
207
|
+
primeMorphOut: "MorphText_primeMorphOut",
|
|
208
|
+
letterIn: "MorphText_letterIn",
|
|
209
|
+
primeMorphIn: "MorphText_primeMorphIn"
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// src/internal/MorphText.tsx
|
|
213
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
214
|
+
function digitsOnly(a, b) {
|
|
215
|
+
return a.replace(/\d/g, "") === b.replace(/\d/g, "");
|
|
216
|
+
}
|
|
217
|
+
function letters(text, kind) {
|
|
218
|
+
return [...text].map((char, i) => /* @__PURE__ */ jsx4(
|
|
219
|
+
"span",
|
|
220
|
+
{
|
|
221
|
+
className: cx(MorphText_default.letter, kind === "in" ? MorphText_default.letterIn : MorphText_default.letterOut),
|
|
222
|
+
style: { "--morph-i": i },
|
|
223
|
+
children: char
|
|
224
|
+
},
|
|
225
|
+
i
|
|
226
|
+
));
|
|
227
|
+
}
|
|
228
|
+
function settleMs(text, root) {
|
|
229
|
+
const css = getComputedStyle(root);
|
|
230
|
+
const read = (name) => Number.parseFloat(css.getPropertyValue(name)) || 0;
|
|
231
|
+
const base = read("--prime-motion-duration-base");
|
|
232
|
+
const step = read("--prime-motion-stagger") / 6;
|
|
233
|
+
return base + step * text.length + 50;
|
|
234
|
+
}
|
|
235
|
+
function MorphText({ children: text, className }) {
|
|
236
|
+
const rootRef = React5.useRef(null);
|
|
237
|
+
const sizerRef = React5.useRef(null);
|
|
238
|
+
const prevText = React5.useRef(null);
|
|
239
|
+
const restWidth = React5.useRef(0);
|
|
240
|
+
const nextId = React5.useRef(0);
|
|
241
|
+
const [morph, setMorph] = React5.useState(null);
|
|
242
|
+
const morphRef = React5.useRef(morph);
|
|
243
|
+
morphRef.current = morph;
|
|
244
|
+
React5.useLayoutEffect(() => {
|
|
245
|
+
const root = rootRef.current;
|
|
246
|
+
const prev = prevText.current;
|
|
247
|
+
prevText.current = text;
|
|
248
|
+
if (!root || prev === null || prev === text) return;
|
|
249
|
+
if (prefersReducedMotion() || digitsOnly(prev, text)) {
|
|
250
|
+
setMorph(null);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const running = morphRef.current;
|
|
254
|
+
const width = running ? root.getBoundingClientRect().width : restWidth.current;
|
|
255
|
+
nextId.current += 1;
|
|
256
|
+
setMorph({ id: nextId.current, from: running ? running.to : prev, to: text, width });
|
|
257
|
+
}, [text]);
|
|
258
|
+
React5.useLayoutEffect(() => {
|
|
259
|
+
if (!morph) return;
|
|
260
|
+
const root = rootRef.current;
|
|
261
|
+
const sizer = sizerRef.current;
|
|
262
|
+
if (!root || !sizer) return;
|
|
263
|
+
const target = sizer.getBoundingClientRect().width;
|
|
264
|
+
if (target !== morph.width) {
|
|
265
|
+
root.style.width = `${morph.width}px`;
|
|
266
|
+
root.getBoundingClientRect();
|
|
267
|
+
root.style.width = `${target}px`;
|
|
268
|
+
}
|
|
269
|
+
const timer = window.setTimeout(() => setMorph(null), settleMs(morph.to, root));
|
|
270
|
+
return () => window.clearTimeout(timer);
|
|
271
|
+
}, [morph]);
|
|
272
|
+
React5.useLayoutEffect(() => {
|
|
273
|
+
if (morph || !rootRef.current) return;
|
|
274
|
+
rootRef.current.style.width = "";
|
|
275
|
+
restWidth.current = rootRef.current.getBoundingClientRect().width;
|
|
276
|
+
});
|
|
277
|
+
if (!morph) {
|
|
278
|
+
return /* @__PURE__ */ jsx4("span", { ref: rootRef, className: cx(MorphText_default.root, className), children: text });
|
|
279
|
+
}
|
|
280
|
+
return /* @__PURE__ */ jsxs2("span", { ref: rootRef, className: cx(MorphText_default.root, MorphText_default.morphing, className), children: [
|
|
281
|
+
/* @__PURE__ */ jsx4("span", { ref: sizerRef, className: MorphText_default.sizer, "aria-hidden": "true", children: morph.to }),
|
|
282
|
+
/* @__PURE__ */ jsx4("span", { className: MorphText_default.layer, "aria-hidden": "true", children: letters(morph.from, "out") }, `out-${morph.id}`),
|
|
283
|
+
/* @__PURE__ */ jsx4("span", { className: MorphText_default.layer, "aria-hidden": "true", children: letters(morph.to, "in") }, `in-${morph.id}`),
|
|
284
|
+
/* @__PURE__ */ jsx4(VisuallyHidden, { children: morph.to })
|
|
285
|
+
] });
|
|
286
|
+
}
|
|
287
|
+
|
|
462
288
|
// src/internal/slot.tsx
|
|
289
|
+
import * as React7 from "react";
|
|
290
|
+
|
|
291
|
+
// src/hooks/useMergedRefs.ts
|
|
463
292
|
import * as React6 from "react";
|
|
464
|
-
|
|
293
|
+
|
|
294
|
+
// src/internal/mergeRefs.ts
|
|
295
|
+
function mergeRefs(...refs) {
|
|
296
|
+
return (value) => {
|
|
297
|
+
for (const ref of refs) {
|
|
298
|
+
if (ref == null) continue;
|
|
299
|
+
if (typeof ref === "function") {
|
|
300
|
+
ref(value);
|
|
301
|
+
} else {
|
|
302
|
+
ref.current = value;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// src/hooks/useMergedRefs.ts
|
|
309
|
+
function useMergedRefs(...refs) {
|
|
310
|
+
return React6.useMemo(() => mergeRefs(...refs), refs);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// src/internal/slot.tsx
|
|
314
|
+
import { Fragment, jsx as jsx5 } from "react/jsx-runtime";
|
|
465
315
|
var isPrevented = (event) => typeof event === "object" && event !== null && event.defaultPrevented === true;
|
|
466
316
|
function mergeProps(slotProps, childProps) {
|
|
467
317
|
const merged = { ...slotProps };
|
|
@@ -500,26 +350,82 @@ function blockDisabledClick(event) {
|
|
|
500
350
|
event.stopPropagation();
|
|
501
351
|
}
|
|
502
352
|
function Slot({ children, ref, ...slotProps }) {
|
|
503
|
-
const child =
|
|
353
|
+
const child = React7.isValidElement(children) ? children : null;
|
|
504
354
|
const childRef = child?.props.ref ?? void 0;
|
|
505
355
|
const composedRef = useMergedRefs(ref, childRef);
|
|
506
|
-
if (!child) return /* @__PURE__ */
|
|
356
|
+
if (!child) return /* @__PURE__ */ jsx5(Fragment, { children });
|
|
507
357
|
const merged = mergeProps(slotProps, child.props);
|
|
508
358
|
const disabled = slotProps["aria-disabled"] === true || slotProps["aria-disabled"] === "true";
|
|
509
359
|
if (disabled) merged.onClickCapture = blockDisabledClick;
|
|
510
|
-
return
|
|
360
|
+
return React7.cloneElement(child, { ...merged, ref: composedRef });
|
|
511
361
|
}
|
|
512
362
|
Slot.displayName = "Slot";
|
|
513
363
|
|
|
364
|
+
// src/internal/touchTarget.module.css
|
|
365
|
+
var touchTarget_default = {
|
|
366
|
+
target: "touchTarget_target",
|
|
367
|
+
targetBlock: "touchTarget_targetBlock"
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
// src/internal/touchTarget.ts
|
|
371
|
+
var touchTargetClass = touchTarget_default.target;
|
|
372
|
+
var touchTargetBlockClass = touchTarget_default.targetBlock;
|
|
373
|
+
|
|
514
374
|
// src/components/button/Button.module.css
|
|
515
375
|
var Button_default = {
|
|
516
376
|
root: "Button_root",
|
|
517
377
|
icon: "Button_icon",
|
|
518
|
-
spinner: "Button_spinner"
|
|
378
|
+
spinner: "Button_spinner",
|
|
379
|
+
fillTrack: "Button_fillTrack",
|
|
380
|
+
fill: "Button_fill"
|
|
519
381
|
};
|
|
520
382
|
|
|
521
383
|
// src/components/button/Button.tsx
|
|
522
|
-
import { jsx as
|
|
384
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
385
|
+
var BUTTON_LABELS = { holdHint: "\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0439\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C" };
|
|
386
|
+
var HOLD_MS = 1200;
|
|
387
|
+
function useHoldToConfirm(enabled, onConfirm) {
|
|
388
|
+
const [phase, setPhase] = React8.useState("idle");
|
|
389
|
+
const timer = React8.useRef(void 0);
|
|
390
|
+
const confirm = React8.useRef(onConfirm);
|
|
391
|
+
confirm.current = onConfirm;
|
|
392
|
+
React8.useEffect(() => () => window.clearTimeout(timer.current), []);
|
|
393
|
+
const start = () => {
|
|
394
|
+
if (!enabled || phase === "holding" || phase === "done") return;
|
|
395
|
+
setPhase("holding");
|
|
396
|
+
timer.current = window.setTimeout(() => {
|
|
397
|
+
setPhase("done");
|
|
398
|
+
confirm.current?.();
|
|
399
|
+
}, HOLD_MS);
|
|
400
|
+
};
|
|
401
|
+
const stop = () => {
|
|
402
|
+
window.clearTimeout(timer.current);
|
|
403
|
+
setPhase(
|
|
404
|
+
(current) => current === "holding" ? "cancel" : current === "done" ? "idle" : current
|
|
405
|
+
);
|
|
406
|
+
};
|
|
407
|
+
return { phase, start, stop };
|
|
408
|
+
}
|
|
409
|
+
function morphLabels(children) {
|
|
410
|
+
const out = [];
|
|
411
|
+
let run = null;
|
|
412
|
+
const flush = () => {
|
|
413
|
+
if (run !== null && run !== "") {
|
|
414
|
+
out.push(/* @__PURE__ */ jsx6(MorphText, { children: run }, `label-${out.length}`));
|
|
415
|
+
}
|
|
416
|
+
run = null;
|
|
417
|
+
};
|
|
418
|
+
for (const child of React8.Children.toArray(children)) {
|
|
419
|
+
if (typeof child === "string" || typeof child === "number") {
|
|
420
|
+
run = (run ?? "") + String(child);
|
|
421
|
+
} else {
|
|
422
|
+
flush();
|
|
423
|
+
out.push(child);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
flush();
|
|
427
|
+
return out;
|
|
428
|
+
}
|
|
523
429
|
function ButtonRoot({
|
|
524
430
|
children,
|
|
525
431
|
className,
|
|
@@ -529,6 +435,10 @@ function ButtonRoot({
|
|
|
529
435
|
fullWidth,
|
|
530
436
|
type = "button",
|
|
531
437
|
loading = false,
|
|
438
|
+
progress,
|
|
439
|
+
holdToConfirm = false,
|
|
440
|
+
onConfirm,
|
|
441
|
+
labels,
|
|
532
442
|
disabled,
|
|
533
443
|
asChild = false,
|
|
534
444
|
onClick: onClick2,
|
|
@@ -538,6 +448,11 @@ function ButtonRoot({
|
|
|
538
448
|
const size = useControlSize(sizeProp);
|
|
539
449
|
const isDisabled = disabled || loading;
|
|
540
450
|
const layout = iconLayout(children, ButtonIcon);
|
|
451
|
+
const hold = useHoldToConfirm(holdToConfirm && !isDisabled, onConfirm);
|
|
452
|
+
const hintId = React8.useId();
|
|
453
|
+
const inProgress = progress !== void 0;
|
|
454
|
+
const [fillUsed, setFillUsed] = React8.useState(false);
|
|
455
|
+
if ((inProgress || holdToConfirm) && !fillUsed) setFillUsed(true);
|
|
541
456
|
const dataAttrs = toDataAttributes({
|
|
542
457
|
variant,
|
|
543
458
|
tone,
|
|
@@ -550,11 +465,13 @@ function ButtonRoot({
|
|
|
550
465
|
"leading-icon": layout.leadingIcon || void 0,
|
|
551
466
|
"trailing-icon": layout.trailingIcon || void 0,
|
|
552
467
|
// Without a leading icon the spinner is centered over the hidden label: width stays put.
|
|
553
|
-
"loading-overlay": loading && !asChild && !layout.leadingIcon && !layout.iconOnly || void 0
|
|
468
|
+
"loading-overlay": loading && !asChild && !layout.leadingIcon && !layout.iconOnly || void 0,
|
|
469
|
+
progress: inProgress || void 0,
|
|
470
|
+
hold: holdToConfirm ? hold.phase : void 0
|
|
554
471
|
});
|
|
555
|
-
const classes = cx(fieldTierClass, Button_default.root, className);
|
|
472
|
+
const classes = cx(fieldTierClass, touchTargetClass, Button_default.root, className);
|
|
556
473
|
if (asChild) {
|
|
557
|
-
return /* @__PURE__ */
|
|
474
|
+
return /* @__PURE__ */ jsx6(ControlSizeProvider, { value: size, children: /* @__PURE__ */ jsx6(
|
|
558
475
|
Slot,
|
|
559
476
|
{
|
|
560
477
|
...rest,
|
|
@@ -568,31 +485,427 @@ function ButtonRoot({
|
|
|
568
485
|
}
|
|
569
486
|
) });
|
|
570
487
|
}
|
|
571
|
-
|
|
488
|
+
const {
|
|
489
|
+
onPointerDown: onPointerDown2,
|
|
490
|
+
onPointerUp,
|
|
491
|
+
onPointerLeave,
|
|
492
|
+
onPointerCancel,
|
|
493
|
+
onKeyDown: onKeyDown2,
|
|
494
|
+
onKeyUp,
|
|
495
|
+
onBlur
|
|
496
|
+
} = rest;
|
|
497
|
+
const holdHandlers = holdToConfirm ? {
|
|
498
|
+
onPointerDown: (event) => {
|
|
499
|
+
onPointerDown2?.(event);
|
|
500
|
+
if (event.button === 0) hold.start();
|
|
501
|
+
},
|
|
502
|
+
onPointerUp: (event) => {
|
|
503
|
+
onPointerUp?.(event);
|
|
504
|
+
hold.stop();
|
|
505
|
+
},
|
|
506
|
+
onPointerLeave: (event) => {
|
|
507
|
+
onPointerLeave?.(event);
|
|
508
|
+
hold.stop();
|
|
509
|
+
},
|
|
510
|
+
onPointerCancel: (event) => {
|
|
511
|
+
onPointerCancel?.(event);
|
|
512
|
+
hold.stop();
|
|
513
|
+
},
|
|
514
|
+
onKeyDown: (event) => {
|
|
515
|
+
onKeyDown2?.(event);
|
|
516
|
+
if ((event.key === " " || event.key === "Enter") && !event.repeat) {
|
|
517
|
+
event.preventDefault();
|
|
518
|
+
hold.start();
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
onKeyUp: (event) => {
|
|
522
|
+
onKeyUp?.(event);
|
|
523
|
+
if (event.key === " " || event.key === "Enter") hold.stop();
|
|
524
|
+
},
|
|
525
|
+
onBlur: (event) => {
|
|
526
|
+
onBlur?.(event);
|
|
527
|
+
hold.stop();
|
|
528
|
+
},
|
|
529
|
+
onContextMenu: (event) => {
|
|
530
|
+
rest.onContextMenu?.(event);
|
|
531
|
+
if (hold.phase === "holding" || hold.phase === "done") event.preventDefault();
|
|
532
|
+
}
|
|
533
|
+
} : null;
|
|
534
|
+
const describedBy = holdToConfirm ? cx(rest["aria-describedby"], hintId) || void 0 : rest["aria-describedby"];
|
|
535
|
+
const button = /* @__PURE__ */ jsxs3(
|
|
572
536
|
"button",
|
|
573
537
|
{
|
|
574
538
|
...rest,
|
|
539
|
+
...holdHandlers,
|
|
575
540
|
ref,
|
|
576
541
|
type,
|
|
577
542
|
className: classes,
|
|
578
543
|
disabled: isDisabled,
|
|
579
|
-
"aria-busy": loading || void 0,
|
|
544
|
+
"aria-busy": loading || inProgress || void 0,
|
|
545
|
+
"aria-describedby": describedBy,
|
|
580
546
|
onClick: onClick2,
|
|
547
|
+
style: inProgress || holdToConfirm ? {
|
|
548
|
+
...rest.style,
|
|
549
|
+
"--btn-progress": inProgress ? Math.min(1, Math.max(0, progress)) : void 0,
|
|
550
|
+
"--btn-hold-duration": holdToConfirm ? `${HOLD_MS}ms` : void 0
|
|
551
|
+
} : rest.style,
|
|
581
552
|
...dataAttrs,
|
|
582
|
-
children:
|
|
583
|
-
|
|
584
|
-
children
|
|
585
|
-
|
|
553
|
+
children: [
|
|
554
|
+
fillUsed ? /* @__PURE__ */ jsx6("span", { className: Button_default.fillTrack, "aria-hidden": "true", children: /* @__PURE__ */ jsx6("span", { className: Button_default.fill }) }) : null,
|
|
555
|
+
/* @__PURE__ */ jsxs3(ControlSizeProvider, { value: size, children: [
|
|
556
|
+
loading ? /* @__PURE__ */ jsx6(Spinner, { className: Button_default.spinner, "aria-hidden": "true" }) : null,
|
|
557
|
+
morphLabels(children)
|
|
558
|
+
] })
|
|
559
|
+
]
|
|
586
560
|
}
|
|
587
561
|
);
|
|
562
|
+
if (!holdToConfirm) return button;
|
|
563
|
+
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
564
|
+
button,
|
|
565
|
+
/* @__PURE__ */ jsx6(VisuallyHidden, { id: hintId, children: { ...BUTTON_LABELS, ...labels }.holdHint })
|
|
566
|
+
] });
|
|
588
567
|
}
|
|
589
568
|
ButtonRoot.displayName = "Button.Root";
|
|
590
569
|
function ButtonIcon({ children, className, ...rest }) {
|
|
591
|
-
return /* @__PURE__ */
|
|
570
|
+
return /* @__PURE__ */ jsx6("span", { className: cx(Button_default.icon, className), "aria-hidden": "true", ...rest, children });
|
|
592
571
|
}
|
|
593
572
|
ButtonIcon.displayName = "Button.Icon";
|
|
594
573
|
var Button = { Root: ButtonRoot, Icon: ButtonIcon };
|
|
595
574
|
|
|
575
|
+
// src/components/divider/Divider.module.css
|
|
576
|
+
var Divider_default = {
|
|
577
|
+
root: "Divider_root",
|
|
578
|
+
content: "Divider_content"
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
// src/components/divider/Divider.tsx
|
|
582
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
583
|
+
function Divider({
|
|
584
|
+
orientation = "horizontal",
|
|
585
|
+
align = "center",
|
|
586
|
+
size = "m",
|
|
587
|
+
children,
|
|
588
|
+
className,
|
|
589
|
+
role = "separator",
|
|
590
|
+
...rest
|
|
591
|
+
}) {
|
|
592
|
+
return /* @__PURE__ */ jsx7(
|
|
593
|
+
"div",
|
|
594
|
+
{
|
|
595
|
+
...rest,
|
|
596
|
+
className: cx(Divider_default.root, className),
|
|
597
|
+
role,
|
|
598
|
+
...orientation === "vertical" ? { "aria-orientation": "vertical" } : {},
|
|
599
|
+
...toDataAttributes({ orientation, align, size }),
|
|
600
|
+
children: children != null ? /* @__PURE__ */ jsx7(ControlSizeProvider, { value: size, children: /* @__PURE__ */ jsx7("span", { className: Divider_default.content, children }) }) : null
|
|
601
|
+
}
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// src/icons/Icon.module.css
|
|
606
|
+
var Icon_default = {
|
|
607
|
+
root: "Icon_root"
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
// src/icons/registry.ts
|
|
611
|
+
import {
|
|
612
|
+
Activity,
|
|
613
|
+
AlertTriangle,
|
|
614
|
+
ArrowDown,
|
|
615
|
+
ArrowUp,
|
|
616
|
+
ArrowUpDown,
|
|
617
|
+
Bell,
|
|
618
|
+
Bold,
|
|
619
|
+
BookOpen,
|
|
620
|
+
Calendar,
|
|
621
|
+
ChartColumn,
|
|
622
|
+
Check,
|
|
623
|
+
CheckCircle2,
|
|
624
|
+
ChevronDown,
|
|
625
|
+
ChevronLeft,
|
|
626
|
+
ChevronRight,
|
|
627
|
+
ChevronsLeft,
|
|
628
|
+
ChevronsUpDown,
|
|
629
|
+
ChevronUp,
|
|
630
|
+
Circle,
|
|
631
|
+
CloudOff,
|
|
632
|
+
CloudUpload,
|
|
633
|
+
Code2,
|
|
634
|
+
Copy,
|
|
635
|
+
Download,
|
|
636
|
+
ExternalLink,
|
|
637
|
+
Eye,
|
|
638
|
+
EyeOff,
|
|
639
|
+
FileText,
|
|
640
|
+
GripVertical,
|
|
641
|
+
HardDrive,
|
|
642
|
+
House,
|
|
643
|
+
Image,
|
|
644
|
+
Inbox,
|
|
645
|
+
Info,
|
|
646
|
+
Italic,
|
|
647
|
+
KeyRound,
|
|
648
|
+
LayoutDashboard,
|
|
649
|
+
LayoutGrid,
|
|
650
|
+
Link2,
|
|
651
|
+
List,
|
|
652
|
+
ListFilter,
|
|
653
|
+
ListTodo,
|
|
654
|
+
Lock,
|
|
655
|
+
LogIn,
|
|
656
|
+
LogOut,
|
|
657
|
+
Mail,
|
|
658
|
+
MailCheck,
|
|
659
|
+
Menu,
|
|
660
|
+
MessageSquare,
|
|
661
|
+
Minus,
|
|
662
|
+
Monitor,
|
|
663
|
+
Moon,
|
|
664
|
+
MoreHorizontal,
|
|
665
|
+
Package,
|
|
666
|
+
PanelLeftClose,
|
|
667
|
+
PanelLeftOpen,
|
|
668
|
+
Pipette,
|
|
669
|
+
Plus,
|
|
670
|
+
Receipt,
|
|
671
|
+
RefreshCw,
|
|
672
|
+
Rocket,
|
|
673
|
+
Search,
|
|
674
|
+
Send,
|
|
675
|
+
Settings,
|
|
676
|
+
ShoppingCart,
|
|
677
|
+
Smartphone,
|
|
678
|
+
Sun,
|
|
679
|
+
Tablet,
|
|
680
|
+
Trash2,
|
|
681
|
+
Truck,
|
|
682
|
+
Underline,
|
|
683
|
+
UserRound,
|
|
684
|
+
Users,
|
|
685
|
+
Wallet,
|
|
686
|
+
X,
|
|
687
|
+
XCircle
|
|
688
|
+
} from "lucide-react";
|
|
689
|
+
var iconRegistry = {
|
|
690
|
+
"nav.chevronDown": ChevronDown,
|
|
691
|
+
"nav.chevronLeft": ChevronLeft,
|
|
692
|
+
"nav.chevronRight": ChevronRight,
|
|
693
|
+
"nav.chevronUp": ChevronUp,
|
|
694
|
+
"nav.chevronsLeft": ChevronsLeft,
|
|
695
|
+
"nav.chevronsUpDown": ChevronsUpDown,
|
|
696
|
+
"nav.dashboard": LayoutDashboard,
|
|
697
|
+
"nav.home": House,
|
|
698
|
+
"nav.itemDot": Circle,
|
|
699
|
+
"nav.layoutGrid": LayoutGrid,
|
|
700
|
+
"nav.menu": Menu,
|
|
701
|
+
"nav.sidebarCollapse": PanelLeftClose,
|
|
702
|
+
"nav.sidebarExpand": PanelLeftOpen,
|
|
703
|
+
"action.add": Plus,
|
|
704
|
+
"action.check": Check,
|
|
705
|
+
"action.close": X,
|
|
706
|
+
"action.copy": Copy,
|
|
707
|
+
"action.delete": Trash2,
|
|
708
|
+
"action.download": Download,
|
|
709
|
+
"action.drag": GripVertical,
|
|
710
|
+
"action.externalLink": ExternalLink,
|
|
711
|
+
"action.eyedropper": Pipette,
|
|
712
|
+
"action.filter": ListFilter,
|
|
713
|
+
"action.login": LogIn,
|
|
714
|
+
"action.logout": LogOut,
|
|
715
|
+
"action.more": MoreHorizontal,
|
|
716
|
+
"action.refresh": RefreshCw,
|
|
717
|
+
"action.remove": Minus,
|
|
718
|
+
"action.search": Search,
|
|
719
|
+
"action.send": Send,
|
|
720
|
+
"action.settings": Settings,
|
|
721
|
+
"action.upload": CloudUpload,
|
|
722
|
+
"field.calendar": Calendar,
|
|
723
|
+
"field.email": Mail,
|
|
724
|
+
"field.password.show": Eye,
|
|
725
|
+
"field.password.hide": EyeOff,
|
|
726
|
+
"format.bold": Bold,
|
|
727
|
+
"format.italic": Italic,
|
|
728
|
+
"format.link": Link2,
|
|
729
|
+
"format.list": List,
|
|
730
|
+
"format.underline": Underline,
|
|
731
|
+
"object.activity": Activity,
|
|
732
|
+
"object.bell": Bell,
|
|
733
|
+
"object.book": BookOpen,
|
|
734
|
+
"object.cart": ShoppingCart,
|
|
735
|
+
"object.chart": ChartColumn,
|
|
736
|
+
"object.document": FileText,
|
|
737
|
+
"object.image": Image,
|
|
738
|
+
"object.inbox": Inbox,
|
|
739
|
+
"object.key": KeyRound,
|
|
740
|
+
"object.message": MessageSquare,
|
|
741
|
+
"object.package": Package,
|
|
742
|
+
"object.receipt": Receipt,
|
|
743
|
+
"object.rocket": Rocket,
|
|
744
|
+
"object.storage": HardDrive,
|
|
745
|
+
"object.tasks": ListTodo,
|
|
746
|
+
"object.truck": Truck,
|
|
747
|
+
"object.user": UserRound,
|
|
748
|
+
"object.users": Users,
|
|
749
|
+
"object.wallet": Wallet,
|
|
750
|
+
"sort.ascending": ArrowUp,
|
|
751
|
+
"sort.descending": ArrowDown,
|
|
752
|
+
"sort.none": ArrowUpDown,
|
|
753
|
+
"status.danger": XCircle,
|
|
754
|
+
"status.emailSent": MailCheck,
|
|
755
|
+
"status.info": Info,
|
|
756
|
+
"status.locked": Lock,
|
|
757
|
+
"status.offline": CloudOff,
|
|
758
|
+
"status.success": CheckCircle2,
|
|
759
|
+
/** A rising trend; a falling one is the same arrow turned half a turn (it rotates between them). */
|
|
760
|
+
"status.trendUp": ArrowUp,
|
|
761
|
+
"status.warning": AlertTriangle,
|
|
762
|
+
"theme.dark": Moon,
|
|
763
|
+
"theme.light": Sun,
|
|
764
|
+
"view.code": Code2,
|
|
765
|
+
"view.preview": Eye,
|
|
766
|
+
"viewport.desktop": Monitor,
|
|
767
|
+
"viewport.mobile": Smartphone,
|
|
768
|
+
"viewport.tablet": Tablet
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
// src/icons/Icon.tsx
|
|
772
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
773
|
+
function IconSvg({
|
|
774
|
+
glyph: GlyphSvg,
|
|
775
|
+
className,
|
|
776
|
+
size,
|
|
777
|
+
tone = "default",
|
|
778
|
+
strokeWidth = 1.75,
|
|
779
|
+
...rest
|
|
780
|
+
}) {
|
|
781
|
+
const tier = useOptionalControlSize();
|
|
782
|
+
return /* @__PURE__ */ jsx8(
|
|
783
|
+
GlyphSvg,
|
|
784
|
+
{
|
|
785
|
+
className: cx(Icon_default.root, iconBoxClass(size, tier), textTone_default.tone, className),
|
|
786
|
+
"data-tone": tone === "default" ? void 0 : tone,
|
|
787
|
+
strokeWidth,
|
|
788
|
+
"aria-hidden": "true",
|
|
789
|
+
...rest
|
|
790
|
+
}
|
|
791
|
+
);
|
|
792
|
+
}
|
|
793
|
+
function Icon({ name, ...rest }) {
|
|
794
|
+
return /* @__PURE__ */ jsx8(IconSvg, { glyph: iconRegistry[name], ...rest });
|
|
795
|
+
}
|
|
796
|
+
function createIcon(glyph) {
|
|
797
|
+
function DomainIcon(props) {
|
|
798
|
+
return /* @__PURE__ */ jsx8(IconSvg, { glyph, ...props });
|
|
799
|
+
}
|
|
800
|
+
DomainIcon.displayName = `Icon(${glyph.displayName ?? "Glyph"})`;
|
|
801
|
+
return DomainIcon;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
// src/components/scroll-container/ScrollContainer.tsx
|
|
805
|
+
import * as React10 from "react";
|
|
806
|
+
|
|
807
|
+
// src/hooks/useEdgeOverflow.ts
|
|
808
|
+
import * as React9 from "react";
|
|
809
|
+
var NONE = { start: false, end: false };
|
|
810
|
+
function useEdgeOverflow(ref, enabled, horizontal) {
|
|
811
|
+
const [overflow, setOverflow] = React9.useState(NONE);
|
|
812
|
+
React9.useLayoutEffect(() => {
|
|
813
|
+
const node = ref.current;
|
|
814
|
+
if (!enabled || !node) return;
|
|
815
|
+
const update = () => {
|
|
816
|
+
const position = horizontal ? Math.abs(node.scrollLeft) : node.scrollTop;
|
|
817
|
+
const max = horizontal ? node.scrollWidth - node.clientWidth : node.scrollHeight - node.clientHeight;
|
|
818
|
+
const start = position > 1;
|
|
819
|
+
const end = max - position > 1;
|
|
820
|
+
node.style.setProperty("--edge-start", `${Math.max(0, position)}px`);
|
|
821
|
+
node.style.setProperty("--edge-end", `${Math.max(0, max - position)}px`);
|
|
822
|
+
setOverflow((prev) => prev.start === start && prev.end === end ? prev : { start, end });
|
|
823
|
+
};
|
|
824
|
+
let frame = 0;
|
|
825
|
+
const schedule = () => {
|
|
826
|
+
if (frame) return;
|
|
827
|
+
frame = requestAnimationFrame(() => {
|
|
828
|
+
frame = 0;
|
|
829
|
+
update();
|
|
830
|
+
});
|
|
831
|
+
};
|
|
832
|
+
update();
|
|
833
|
+
node.addEventListener("scroll", schedule, { passive: true });
|
|
834
|
+
const resize = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(schedule);
|
|
835
|
+
const observeChildren = () => {
|
|
836
|
+
for (const child of Array.from(node.children)) resize?.observe(child);
|
|
837
|
+
};
|
|
838
|
+
resize?.observe(node);
|
|
839
|
+
observeChildren();
|
|
840
|
+
const mutation = new MutationObserver(() => {
|
|
841
|
+
observeChildren();
|
|
842
|
+
schedule();
|
|
843
|
+
});
|
|
844
|
+
mutation.observe(node, { childList: true });
|
|
845
|
+
return () => {
|
|
846
|
+
cancelAnimationFrame(frame);
|
|
847
|
+
node.removeEventListener("scroll", schedule);
|
|
848
|
+
resize?.disconnect();
|
|
849
|
+
mutation.disconnect();
|
|
850
|
+
};
|
|
851
|
+
}, [ref, enabled, horizontal]);
|
|
852
|
+
return enabled ? overflow : NONE;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
// src/components/scroll-container/ScrollContainer.module.css
|
|
856
|
+
var ScrollContainer_default = {
|
|
857
|
+
root: "ScrollContainer_root",
|
|
858
|
+
vertical: "ScrollContainer_vertical",
|
|
859
|
+
horizontal: "ScrollContainer_horizontal",
|
|
860
|
+
both: "ScrollContainer_both",
|
|
861
|
+
overscrollContain: "ScrollContainer_overscrollContain",
|
|
862
|
+
overscrollNone: "ScrollContainer_overscrollNone",
|
|
863
|
+
scrollbarHidden: "ScrollContainer_scrollbarHidden"
|
|
864
|
+
};
|
|
865
|
+
|
|
866
|
+
// src/components/scroll-container/ScrollContainer.tsx
|
|
867
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
868
|
+
var axisClass = {
|
|
869
|
+
vertical: ScrollContainer_default.vertical,
|
|
870
|
+
horizontal: ScrollContainer_default.horizontal,
|
|
871
|
+
both: ScrollContainer_default.both
|
|
872
|
+
};
|
|
873
|
+
function ScrollContainer({
|
|
874
|
+
as: Component = "div",
|
|
875
|
+
axis = "vertical",
|
|
876
|
+
overscrollBehavior = "contain",
|
|
877
|
+
fade = false,
|
|
878
|
+
scrollbar = "thin",
|
|
879
|
+
className,
|
|
880
|
+
ref,
|
|
881
|
+
...rest
|
|
882
|
+
}) {
|
|
883
|
+
const innerRef = React10.useRef(null);
|
|
884
|
+
const mergedRef = useMergedRefs(innerRef, ref);
|
|
885
|
+
const horizontal = axis === "horizontal";
|
|
886
|
+
const overflow = useEdgeOverflow(innerRef, fade, horizontal);
|
|
887
|
+
return /* @__PURE__ */ jsx9(
|
|
888
|
+
Component,
|
|
889
|
+
{
|
|
890
|
+
ref: mergedRef,
|
|
891
|
+
className: cx(
|
|
892
|
+
ScrollContainer_default.root,
|
|
893
|
+
axisClass[axis],
|
|
894
|
+
overscrollBehavior === "contain" && ScrollContainer_default.overscrollContain,
|
|
895
|
+
overscrollBehavior === "none" && ScrollContainer_default.overscrollNone,
|
|
896
|
+
scrollbar === "hidden" && ScrollContainer_default.scrollbarHidden,
|
|
897
|
+
className
|
|
898
|
+
),
|
|
899
|
+
...toDataAttributes({
|
|
900
|
+
fade: fade ? horizontal ? "horizontal" : "vertical" : void 0,
|
|
901
|
+
"overflow-start": overflow.start || void 0,
|
|
902
|
+
"overflow-end": overflow.end || void 0
|
|
903
|
+
}),
|
|
904
|
+
...rest
|
|
905
|
+
}
|
|
906
|
+
);
|
|
907
|
+
}
|
|
908
|
+
|
|
596
909
|
// src/internal/states.ts
|
|
597
910
|
var controlSizes = ["xs", "s", "m", "l", "xl"];
|
|
598
911
|
function stepDown(size, n = 1) {
|
|
@@ -646,9 +959,9 @@ var Hint_default = {
|
|
|
646
959
|
};
|
|
647
960
|
|
|
648
961
|
// src/components/hint/Hint.tsx
|
|
649
|
-
import { jsx as
|
|
962
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
650
963
|
function HintRoot({ className, size = "m", invalid, disabled, children, ...rest }) {
|
|
651
|
-
return /* @__PURE__ */
|
|
964
|
+
return /* @__PURE__ */ jsx10(ControlSizeProvider, { value: size, children: /* @__PURE__ */ jsx10(
|
|
652
965
|
"p",
|
|
653
966
|
{
|
|
654
967
|
...rest,
|
|
@@ -664,7 +977,7 @@ function HintRoot({ className, size = "m", invalid, disabled, children, ...rest
|
|
|
664
977
|
}
|
|
665
978
|
HintRoot.displayName = "Hint.Root";
|
|
666
979
|
function HintIcon({ className, ...rest }) {
|
|
667
|
-
return /* @__PURE__ */
|
|
980
|
+
return /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", className: cx(Hint_default.icon, className), ...rest });
|
|
668
981
|
}
|
|
669
982
|
HintIcon.displayName = "Hint.Icon";
|
|
670
983
|
var Hint = { Root: HintRoot, Icon: HintIcon };
|
|
@@ -679,7 +992,7 @@ var Label_default = {
|
|
|
679
992
|
};
|
|
680
993
|
|
|
681
994
|
// src/components/label/Label.tsx
|
|
682
|
-
import { jsx as
|
|
995
|
+
import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
683
996
|
var LABEL_LABELS = { optional: "\u043D\u0435\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E" };
|
|
684
997
|
function LabelRoot({
|
|
685
998
|
className,
|
|
@@ -695,7 +1008,7 @@ function LabelRoot({
|
|
|
695
1008
|
const size = useControlSize(sizeProp);
|
|
696
1009
|
return (
|
|
697
1010
|
// biome-ignore lint/a11y/noLabelWithoutControl: field label primitive; association via htmlFor or wrapping control is caller responsibility
|
|
698
|
-
/* @__PURE__ */
|
|
1011
|
+
/* @__PURE__ */ jsx11(
|
|
699
1012
|
"label",
|
|
700
1013
|
{
|
|
701
1014
|
ref,
|
|
@@ -703,10 +1016,10 @@ function LabelRoot({
|
|
|
703
1016
|
"aria-disabled": disabled || void 0,
|
|
704
1017
|
...rest,
|
|
705
1018
|
...toDataAttributes({ disabled: disabled || void 0, size }),
|
|
706
|
-
children: /* @__PURE__ */
|
|
1019
|
+
children: /* @__PURE__ */ jsxs4(ControlSizeProvider, { value: size, children: [
|
|
707
1020
|
children,
|
|
708
|
-
required ? /* @__PURE__ */
|
|
709
|
-
optional ? /* @__PURE__ */
|
|
1021
|
+
required ? /* @__PURE__ */ jsx11("span", { className: Label_default.asterisk, "aria-hidden": "true", children: "*" }) : null,
|
|
1022
|
+
optional ? /* @__PURE__ */ jsx11("span", { className: Label_default.optional, children: labels?.optional ?? LABEL_LABELS.optional }) : null
|
|
710
1023
|
] })
|
|
711
1024
|
}
|
|
712
1025
|
)
|
|
@@ -714,11 +1027,11 @@ function LabelRoot({
|
|
|
714
1027
|
}
|
|
715
1028
|
LabelRoot.displayName = "Label.Root";
|
|
716
1029
|
function LabelIcon({ className, ...rest }) {
|
|
717
|
-
return /* @__PURE__ */
|
|
1030
|
+
return /* @__PURE__ */ jsx11("span", { className: cx(Label_default.icon, className), "aria-hidden": "true", ...rest });
|
|
718
1031
|
}
|
|
719
1032
|
LabelIcon.displayName = "Label.Icon";
|
|
720
1033
|
function LabelDescription({ className, ...rest }) {
|
|
721
|
-
return /* @__PURE__ */
|
|
1034
|
+
return /* @__PURE__ */ jsx11("span", { className: cx(Label_default.description, className), ...rest });
|
|
722
1035
|
}
|
|
723
1036
|
LabelDescription.displayName = "Label.Description";
|
|
724
1037
|
var Label = {
|
|
@@ -728,21 +1041,21 @@ var Label = {
|
|
|
728
1041
|
};
|
|
729
1042
|
|
|
730
1043
|
// src/components/checkbox/Checkbox.tsx
|
|
731
|
-
import * as
|
|
1044
|
+
import * as React13 from "react";
|
|
732
1045
|
|
|
733
1046
|
// src/hooks/useControllableState.ts
|
|
734
|
-
import * as
|
|
1047
|
+
import * as React11 from "react";
|
|
735
1048
|
function useControllableState({
|
|
736
1049
|
value,
|
|
737
1050
|
defaultValue,
|
|
738
1051
|
onChange
|
|
739
1052
|
}) {
|
|
740
|
-
const [internalValue, setInternalValue] =
|
|
1053
|
+
const [internalValue, setInternalValue] = React11.useState(defaultValue);
|
|
741
1054
|
const isControlled = value !== void 0;
|
|
742
1055
|
const currentValue = isControlled ? value : internalValue;
|
|
743
|
-
const currentValueRef =
|
|
1056
|
+
const currentValueRef = React11.useRef(currentValue);
|
|
744
1057
|
currentValueRef.current = currentValue;
|
|
745
|
-
const setValue =
|
|
1058
|
+
const setValue = React11.useCallback(
|
|
746
1059
|
(nextValue) => {
|
|
747
1060
|
const previousValue = currentValueRef.current;
|
|
748
1061
|
const computedValue = typeof nextValue === "function" ? nextValue(previousValue) : nextValue;
|
|
@@ -760,6 +1073,32 @@ function useControllableState({
|
|
|
760
1073
|
return [currentValue, setValue];
|
|
761
1074
|
}
|
|
762
1075
|
|
|
1076
|
+
// src/internal/CheckMark.module.css
|
|
1077
|
+
var CheckMark_default = {
|
|
1078
|
+
svg: "CheckMark_svg",
|
|
1079
|
+
check: "CheckMark_check",
|
|
1080
|
+
bar: "CheckMark_bar"
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
// src/internal/CheckMark.tsx
|
|
1084
|
+
import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1085
|
+
function CheckMark({ state, className }) {
|
|
1086
|
+
return /* @__PURE__ */ jsxs5(
|
|
1087
|
+
"svg",
|
|
1088
|
+
{
|
|
1089
|
+
viewBox: "0 0 24 24",
|
|
1090
|
+
className: cx(CheckMark_default.svg, className),
|
|
1091
|
+
"data-state": state,
|
|
1092
|
+
"aria-hidden": "true",
|
|
1093
|
+
focusable: "false",
|
|
1094
|
+
children: [
|
|
1095
|
+
/* @__PURE__ */ jsx12("path", { d: "M5.5 12.5l4.25 4.25L18.5 8", pathLength: 1, className: CheckMark_default.check }),
|
|
1096
|
+
/* @__PURE__ */ jsx12("path", { d: "M7 12h10", pathLength: 1, className: CheckMark_default.bar })
|
|
1097
|
+
]
|
|
1098
|
+
}
|
|
1099
|
+
);
|
|
1100
|
+
}
|
|
1101
|
+
|
|
763
1102
|
// src/internal/ChoiceField.module.css
|
|
764
1103
|
var ChoiceField_default = {
|
|
765
1104
|
tier: "ChoiceField_tier",
|
|
@@ -773,7 +1112,7 @@ var ChoiceField_default = {
|
|
|
773
1112
|
};
|
|
774
1113
|
|
|
775
1114
|
// src/internal/ChoiceField.tsx
|
|
776
|
-
import { jsx as
|
|
1115
|
+
import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
777
1116
|
var choiceInputClass = ChoiceField_default.input;
|
|
778
1117
|
var choiceVisualClass = ChoiceField_default.visual;
|
|
779
1118
|
var choiceTierClass = ChoiceField_default.tier;
|
|
@@ -789,7 +1128,7 @@ function ChoiceField({
|
|
|
789
1128
|
className,
|
|
790
1129
|
children
|
|
791
1130
|
}) {
|
|
792
|
-
return /* @__PURE__ */
|
|
1131
|
+
return /* @__PURE__ */ jsx13(ControlSizeProvider, { value: size, children: /* @__PURE__ */ jsxs6(
|
|
793
1132
|
"div",
|
|
794
1133
|
{
|
|
795
1134
|
className: cx(ChoiceField_default.tier, ChoiceField_default.field, className),
|
|
@@ -801,21 +1140,21 @@ function ChoiceField({
|
|
|
801
1140
|
readonly: readOnly || void 0
|
|
802
1141
|
}),
|
|
803
1142
|
children: [
|
|
804
|
-
/* @__PURE__ */
|
|
805
|
-
/* @__PURE__ */
|
|
1143
|
+
/* @__PURE__ */ jsxs6("label", { htmlFor: ids.controlId, className: ChoiceField_default.row, children: [
|
|
1144
|
+
/* @__PURE__ */ jsx13("span", { className: cx(ChoiceField_default.controlCell, touchTargetClass), children: control }),
|
|
806
1145
|
children
|
|
807
1146
|
] }),
|
|
808
|
-
ids.showError ? /* @__PURE__ */
|
|
1147
|
+
ids.showError ? /* @__PURE__ */ jsx13(Hint.Root, { id: ids.errorId, size, invalid: true, className: ChoiceField_default.support, children: error }) : ids.showHint ? /* @__PURE__ */ jsx13(Hint.Root, { id: ids.hintId, size, disabled, className: ChoiceField_default.support, children: hint }) : null
|
|
809
1148
|
]
|
|
810
1149
|
}
|
|
811
1150
|
) });
|
|
812
1151
|
}
|
|
813
1152
|
function ChoiceLabel({ className, ...rest }) {
|
|
814
|
-
return /* @__PURE__ */
|
|
1153
|
+
return /* @__PURE__ */ jsx13("span", { className: cx(ChoiceField_default.text, className), ...rest });
|
|
815
1154
|
}
|
|
816
1155
|
|
|
817
1156
|
// src/internal/FieldFrame.tsx
|
|
818
|
-
import * as
|
|
1157
|
+
import * as React12 from "react";
|
|
819
1158
|
|
|
820
1159
|
// src/internal/formatLabel.ts
|
|
821
1160
|
function formatLabel(template, values) {
|
|
@@ -825,6 +1164,31 @@ function formatLabel(template, values) {
|
|
|
825
1164
|
).trim();
|
|
826
1165
|
}
|
|
827
1166
|
|
|
1167
|
+
// src/internal/RollingNumber.module.css
|
|
1168
|
+
var RollingNumber_default = {
|
|
1169
|
+
root: "RollingNumber_root",
|
|
1170
|
+
digit: "RollingNumber_digit",
|
|
1171
|
+
char: "RollingNumber_char"
|
|
1172
|
+
};
|
|
1173
|
+
|
|
1174
|
+
// src/internal/RollingNumber.tsx
|
|
1175
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1176
|
+
function RollingNumber({ children, className }) {
|
|
1177
|
+
const chars = [...String(children)];
|
|
1178
|
+
return /* @__PURE__ */ jsx14("span", { className: cx(RollingNumber_default.root, className), children: chars.map((char, i) => {
|
|
1179
|
+
const key = chars.length - i;
|
|
1180
|
+
return /\d/.test(char) ? /* @__PURE__ */ jsx14(
|
|
1181
|
+
"span",
|
|
1182
|
+
{
|
|
1183
|
+
className: RollingNumber_default.digit,
|
|
1184
|
+
style: { "--rolling-n": char },
|
|
1185
|
+
children: char
|
|
1186
|
+
},
|
|
1187
|
+
`d${key}`
|
|
1188
|
+
) : /* @__PURE__ */ jsx14("span", { className: RollingNumber_default.char, children: char }, `c${key}`);
|
|
1189
|
+
}) });
|
|
1190
|
+
}
|
|
1191
|
+
|
|
828
1192
|
// src/internal/FieldFrame.module.css
|
|
829
1193
|
var FieldFrame_default = {
|
|
830
1194
|
root: "FieldFrame_root",
|
|
@@ -838,7 +1202,7 @@ var FieldFrame_default = {
|
|
|
838
1202
|
};
|
|
839
1203
|
|
|
840
1204
|
// src/internal/FieldFrame.tsx
|
|
841
|
-
import { jsx as
|
|
1205
|
+
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
842
1206
|
function hasContent(node) {
|
|
843
1207
|
return node != null && node !== false && node !== "";
|
|
844
1208
|
}
|
|
@@ -848,7 +1212,7 @@ function useFieldFrame(explicitId, {
|
|
|
848
1212
|
error,
|
|
849
1213
|
invalid
|
|
850
1214
|
}, ariaDescribedBy) {
|
|
851
|
-
const generated =
|
|
1215
|
+
const generated = React12.useId();
|
|
852
1216
|
const controlId = explicitId ?? generated;
|
|
853
1217
|
const labelId = `${controlId}-label`;
|
|
854
1218
|
const hintId = `${controlId}-hint`;
|
|
@@ -888,7 +1252,7 @@ function FieldFrame({
|
|
|
888
1252
|
}) {
|
|
889
1253
|
const { showError, showHint } = ids;
|
|
890
1254
|
const showSupport = showError || showHint || counter != null || reserveSupportRow;
|
|
891
|
-
const labelNode = hasContent(label) ? /* @__PURE__ */
|
|
1255
|
+
const labelNode = hasContent(label) ? /* @__PURE__ */ jsx15(
|
|
892
1256
|
Label.Root,
|
|
893
1257
|
{
|
|
894
1258
|
id: ids.labelId,
|
|
@@ -902,7 +1266,7 @@ function FieldFrame({
|
|
|
902
1266
|
children: label
|
|
903
1267
|
}
|
|
904
1268
|
) : null;
|
|
905
|
-
return /* @__PURE__ */
|
|
1269
|
+
return /* @__PURE__ */ jsxs7(
|
|
906
1270
|
"div",
|
|
907
1271
|
{
|
|
908
1272
|
...rest,
|
|
@@ -913,19 +1277,19 @@ function FieldFrame({
|
|
|
913
1277
|
disabled: disabled || void 0
|
|
914
1278
|
}),
|
|
915
1279
|
children: [
|
|
916
|
-
labelEnd != null ? /* @__PURE__ */
|
|
1280
|
+
labelEnd != null ? /* @__PURE__ */ jsxs7("div", { className: FieldFrame_default.labelRow, children: [
|
|
917
1281
|
labelNode,
|
|
918
|
-
/* @__PURE__ */
|
|
1282
|
+
/* @__PURE__ */ jsx15("span", { className: FieldFrame_default.labelEnd, children: labelEnd })
|
|
919
1283
|
] }) : labelNode,
|
|
920
|
-
/* @__PURE__ */
|
|
1284
|
+
/* @__PURE__ */ jsxs7("div", { className: FieldFrame_default.body, children: [
|
|
921
1285
|
children,
|
|
922
|
-
showSupport ? /* @__PURE__ */
|
|
1286
|
+
showSupport ? /* @__PURE__ */ jsxs7(
|
|
923
1287
|
"div",
|
|
924
1288
|
{
|
|
925
1289
|
className: FieldFrame_default.support,
|
|
926
1290
|
...toDataAttributes({ size, reserve: reserveSupportRow || void 0 }),
|
|
927
1291
|
children: [
|
|
928
|
-
showError ? /* @__PURE__ */
|
|
1292
|
+
showError ? /* @__PURE__ */ jsx15(Hint.Root, { id: ids.errorId, size, invalid: true, className: FieldFrame_default.supportText, children: error }) : showHint ? /* @__PURE__ */ jsx15(
|
|
929
1293
|
Hint.Root,
|
|
930
1294
|
{
|
|
931
1295
|
id: ids.hintId,
|
|
@@ -934,7 +1298,7 @@ function FieldFrame({
|
|
|
934
1298
|
className: FieldFrame_default.supportText,
|
|
935
1299
|
children: hint
|
|
936
1300
|
}
|
|
937
|
-
) : /* @__PURE__ */
|
|
1301
|
+
) : /* @__PURE__ */ jsx15("span", { className: FieldFrame_default.supportText }),
|
|
938
1302
|
counter
|
|
939
1303
|
]
|
|
940
1304
|
}
|
|
@@ -945,7 +1309,7 @@ function FieldFrame({
|
|
|
945
1309
|
);
|
|
946
1310
|
}
|
|
947
1311
|
function FieldCounter({ current, max, size, label, className, ...rest }) {
|
|
948
|
-
return /* @__PURE__ */
|
|
1312
|
+
return /* @__PURE__ */ jsxs7(
|
|
949
1313
|
"span",
|
|
950
1314
|
{
|
|
951
1315
|
...rest,
|
|
@@ -954,12 +1318,12 @@ function FieldCounter({ current, max, size, label, className, ...rest }) {
|
|
|
954
1318
|
"data-invalid": current > max || void 0,
|
|
955
1319
|
"aria-live": "polite",
|
|
956
1320
|
children: [
|
|
957
|
-
/* @__PURE__ */
|
|
958
|
-
current,
|
|
1321
|
+
/* @__PURE__ */ jsxs7("span", { "aria-hidden": "true", children: [
|
|
1322
|
+
/* @__PURE__ */ jsx15(RollingNumber, { children: current }),
|
|
959
1323
|
"/",
|
|
960
1324
|
max
|
|
961
1325
|
] }),
|
|
962
|
-
/* @__PURE__ */
|
|
1326
|
+
/* @__PURE__ */ jsx15(VisuallyHidden, { children: formatLabel(label, { current, max }) })
|
|
963
1327
|
]
|
|
964
1328
|
}
|
|
965
1329
|
);
|
|
@@ -969,20 +1333,11 @@ function FieldCounter({ current, max, size, label, className, ...rest }) {
|
|
|
969
1333
|
var Checkbox_default = {
|
|
970
1334
|
root: "Checkbox_root",
|
|
971
1335
|
indicator: "Checkbox_indicator",
|
|
972
|
-
control: "Checkbox_control"
|
|
973
|
-
svg: "Checkbox_svg",
|
|
974
|
-
checkPath: "Checkbox_checkPath",
|
|
975
|
-
indeterminateLine: "Checkbox_indeterminateLine"
|
|
1336
|
+
control: "Checkbox_control"
|
|
976
1337
|
};
|
|
977
1338
|
|
|
978
1339
|
// src/components/checkbox/Checkbox.tsx
|
|
979
|
-
import { Fragment as
|
|
980
|
-
function CheckboxMark() {
|
|
981
|
-
return /* @__PURE__ */ jsxs6("svg", { viewBox: "0 0 24 24", className: Checkbox_default.svg, "aria-hidden": "true", focusable: "false", children: [
|
|
982
|
-
/* @__PURE__ */ jsx12("path", { d: "M5.5 12.5l4.25 4.25L18.5 8", pathLength: 1, className: Checkbox_default.checkPath }),
|
|
983
|
-
/* @__PURE__ */ jsx12("path", { d: "M7 12h10", pathLength: 1, className: Checkbox_default.indeterminateLine })
|
|
984
|
-
] });
|
|
985
|
-
}
|
|
1340
|
+
import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
986
1341
|
function CheckboxRoot({
|
|
987
1342
|
id,
|
|
988
1343
|
checked: checkedProp,
|
|
@@ -1008,12 +1363,12 @@ function CheckboxRoot({
|
|
|
1008
1363
|
defaultValue: defaultChecked,
|
|
1009
1364
|
onChange: onCheckedChange
|
|
1010
1365
|
});
|
|
1011
|
-
const internalRef =
|
|
1366
|
+
const internalRef = React13.useRef(null);
|
|
1012
1367
|
const mergedRef = useMergedRefs(internalRef, ref);
|
|
1013
|
-
|
|
1368
|
+
React13.useEffect(() => {
|
|
1014
1369
|
if (internalRef.current) internalRef.current.indeterminate = indeterminate;
|
|
1015
1370
|
}, [indeterminate]);
|
|
1016
|
-
return /* @__PURE__ */
|
|
1371
|
+
return /* @__PURE__ */ jsx16(
|
|
1017
1372
|
ChoiceField,
|
|
1018
1373
|
{
|
|
1019
1374
|
ids,
|
|
@@ -1024,8 +1379,8 @@ function CheckboxRoot({
|
|
|
1024
1379
|
hint,
|
|
1025
1380
|
error,
|
|
1026
1381
|
className: cx(Checkbox_default.root, className),
|
|
1027
|
-
control: /* @__PURE__ */
|
|
1028
|
-
/* @__PURE__ */
|
|
1382
|
+
control: /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1383
|
+
/* @__PURE__ */ jsx16(
|
|
1029
1384
|
"input",
|
|
1030
1385
|
{
|
|
1031
1386
|
...inputRest,
|
|
@@ -1043,7 +1398,12 @@ function CheckboxRoot({
|
|
|
1043
1398
|
"aria-describedby": ids.describedBy
|
|
1044
1399
|
}
|
|
1045
1400
|
),
|
|
1046
|
-
/* @__PURE__ */
|
|
1401
|
+
/* @__PURE__ */ jsx16("span", { className: cx(choiceVisualClass, Checkbox_default.control), "aria-hidden": "true", children: /* @__PURE__ */ jsx16(
|
|
1402
|
+
CheckMark,
|
|
1403
|
+
{
|
|
1404
|
+
state: indeterminate ? "indeterminate" : checked ? "checked" : "unchecked"
|
|
1405
|
+
}
|
|
1406
|
+
) })
|
|
1047
1407
|
] }),
|
|
1048
1408
|
children
|
|
1049
1409
|
}
|
|
@@ -1051,7 +1411,7 @@ function CheckboxRoot({
|
|
|
1051
1411
|
}
|
|
1052
1412
|
CheckboxRoot.displayName = "Checkbox.Root";
|
|
1053
1413
|
function CheckboxLabel(props) {
|
|
1054
|
-
return /* @__PURE__ */
|
|
1414
|
+
return /* @__PURE__ */ jsx16(ChoiceLabel, { ...props });
|
|
1055
1415
|
}
|
|
1056
1416
|
CheckboxLabel.displayName = "Checkbox.Label";
|
|
1057
1417
|
function CheckboxIndicator({
|
|
@@ -1063,7 +1423,7 @@ function CheckboxIndicator({
|
|
|
1063
1423
|
...rest
|
|
1064
1424
|
}) {
|
|
1065
1425
|
const size = useControlSize(sizeProp);
|
|
1066
|
-
return /* @__PURE__ */
|
|
1426
|
+
return /* @__PURE__ */ jsx16(
|
|
1067
1427
|
"span",
|
|
1068
1428
|
{
|
|
1069
1429
|
"aria-hidden": "true",
|
|
@@ -1080,7 +1440,7 @@ function CheckboxIndicator({
|
|
|
1080
1440
|
disabled: disabled || void 0
|
|
1081
1441
|
}),
|
|
1082
1442
|
...rest,
|
|
1083
|
-
children: /* @__PURE__ */
|
|
1443
|
+
children: /* @__PURE__ */ jsx16(CheckMark, { state: indeterminate ? "indeterminate" : checked ? "checked" : "unchecked" })
|
|
1084
1444
|
}
|
|
1085
1445
|
);
|
|
1086
1446
|
}
|
|
@@ -1092,7 +1452,7 @@ var Checkbox = {
|
|
|
1092
1452
|
};
|
|
1093
1453
|
|
|
1094
1454
|
// src/internal/swatch.tsx
|
|
1095
|
-
import * as
|
|
1455
|
+
import * as React14 from "react";
|
|
1096
1456
|
|
|
1097
1457
|
// src/internal/swatch.module.css
|
|
1098
1458
|
var swatch_default = {
|
|
@@ -1105,7 +1465,7 @@ var swatch_default = {
|
|
|
1105
1465
|
};
|
|
1106
1466
|
|
|
1107
1467
|
// src/internal/swatch.tsx
|
|
1108
|
-
import { Fragment as
|
|
1468
|
+
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1109
1469
|
var COLOR_PRESETS = [
|
|
1110
1470
|
{ value: "#ef4444", label: "\u041A\u0440\u0430\u0441\u043D\u044B\u0439" },
|
|
1111
1471
|
{ value: "#f97316", label: "\u041E\u0440\u0430\u043D\u0436\u0435\u0432\u044B\u0439" },
|
|
@@ -1125,7 +1485,7 @@ var COLOR_PRESETS = [
|
|
|
1125
1485
|
{ value: "#be185d", label: "\u0422\u0451\u043C\u043D\u043E-\u0440\u043E\u0437\u043E\u0432\u044B\u0439" }
|
|
1126
1486
|
];
|
|
1127
1487
|
function useSwatchOptions(presets, allowEmpty, emptyLabel) {
|
|
1128
|
-
return
|
|
1488
|
+
return React14.useMemo(
|
|
1129
1489
|
() => [
|
|
1130
1490
|
...presets.map((preset) => ({ ...preset, contrast: markContrast(preset.value) })),
|
|
1131
1491
|
...allowEmpty ? [{ value: null, label: emptyLabel, contrast: "dark" }] : []
|
|
@@ -1136,17 +1496,17 @@ function useSwatchOptions(presets, allowEmpty, emptyLabel) {
|
|
|
1136
1496
|
var swatchClass = swatch_default.swatch;
|
|
1137
1497
|
var swatchTierClass = swatch_default.tier;
|
|
1138
1498
|
function SwatchFill({ value }) {
|
|
1139
|
-
if (value == null) return /* @__PURE__ */
|
|
1140
|
-
return /* @__PURE__ */
|
|
1499
|
+
if (value == null) return /* @__PURE__ */ jsx17("span", { "aria-hidden": true, className: swatch_default.checker });
|
|
1500
|
+
return /* @__PURE__ */ jsx17("svg", { className: swatch_default.fill, "aria-hidden": "true", viewBox: "0 0 1 1", preserveAspectRatio: "none", children: /* @__PURE__ */ jsx17("rect", { width: "1", height: "1", fill: value }) });
|
|
1141
1501
|
}
|
|
1142
1502
|
function SwatchContent({ value, selected }) {
|
|
1143
|
-
return /* @__PURE__ */
|
|
1144
|
-
/* @__PURE__ */
|
|
1145
|
-
|
|
1503
|
+
return /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
1504
|
+
/* @__PURE__ */ jsx17(SwatchFill, { value }),
|
|
1505
|
+
/* @__PURE__ */ jsx17(CheckMark, { state: selected ? "checked" : "unchecked", className: swatch_default.check })
|
|
1146
1506
|
] });
|
|
1147
1507
|
}
|
|
1148
1508
|
function SwatchChip({ value, className, ...rest }) {
|
|
1149
|
-
return /* @__PURE__ */
|
|
1509
|
+
return /* @__PURE__ */ jsx17("span", { ...rest, "aria-hidden": true, className: cx(swatch_default.chip, className), children: /* @__PURE__ */ jsx17(SwatchFill, { value }) });
|
|
1150
1510
|
}
|
|
1151
1511
|
function sameColor(a, b) {
|
|
1152
1512
|
return (a ?? "").trim().toLowerCase() === (b ?? "").trim().toLowerCase();
|
|
@@ -1190,7 +1550,7 @@ function markContrast(value) {
|
|
|
1190
1550
|
}
|
|
1191
1551
|
|
|
1192
1552
|
// src/components/color-swatches/ColorSwatches.tsx
|
|
1193
|
-
import * as
|
|
1553
|
+
import * as React15 from "react";
|
|
1194
1554
|
|
|
1195
1555
|
// src/internal/rovingFocus.ts
|
|
1196
1556
|
var PREV = {
|
|
@@ -1239,7 +1599,7 @@ var ColorSwatches_default = {
|
|
|
1239
1599
|
};
|
|
1240
1600
|
|
|
1241
1601
|
// src/components/color-swatches/ColorSwatches.tsx
|
|
1242
|
-
import { jsx as
|
|
1602
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1243
1603
|
var COLOR_SWATCHES_LABELS = {
|
|
1244
1604
|
group: "\u0426\u0432\u0435\u0442",
|
|
1245
1605
|
empty: "\u0411\u0435\u0437 \u0446\u0432\u0435\u0442\u0430",
|
|
@@ -1284,7 +1644,7 @@ function ColorSwatches({
|
|
|
1284
1644
|
const options = useSwatchOptions(presets, allowEmpty, labels.empty);
|
|
1285
1645
|
const selectedIndex = options.findIndex((option) => sameColor(option.value, value));
|
|
1286
1646
|
const focusIndex = Math.max(0, selectedIndex);
|
|
1287
|
-
const itemRefs =
|
|
1647
|
+
const itemRefs = React15.useRef([]);
|
|
1288
1648
|
const labelledBy = ariaLabelledBy ?? ids.labelledBy;
|
|
1289
1649
|
const onKeyDown2 = (event) => {
|
|
1290
1650
|
const current = itemRefs.current.indexOf(document.activeElement);
|
|
@@ -1299,7 +1659,7 @@ function ColorSwatches({
|
|
|
1299
1659
|
setValue(options[next].value);
|
|
1300
1660
|
itemRefs.current[next]?.focus();
|
|
1301
1661
|
};
|
|
1302
|
-
return /* @__PURE__ */
|
|
1662
|
+
return /* @__PURE__ */ jsx18(
|
|
1303
1663
|
FieldFrame,
|
|
1304
1664
|
{
|
|
1305
1665
|
...rest,
|
|
@@ -1314,7 +1674,7 @@ function ColorSwatches({
|
|
|
1314
1674
|
optionalLabel: labels.optional,
|
|
1315
1675
|
group: true,
|
|
1316
1676
|
className,
|
|
1317
|
-
children: /* @__PURE__ */
|
|
1677
|
+
children: /* @__PURE__ */ jsxs10(
|
|
1318
1678
|
"div",
|
|
1319
1679
|
{
|
|
1320
1680
|
id: ids.controlId,
|
|
@@ -1336,7 +1696,7 @@ function ColorSwatches({
|
|
|
1336
1696
|
const selected = index === selectedIndex;
|
|
1337
1697
|
return (
|
|
1338
1698
|
// biome-ignore lint/a11y/useSemanticElements: a swatch is a styled button in a roving radiogroup; a native radio cannot carry the color fill and check mark
|
|
1339
|
-
/* @__PURE__ */
|
|
1699
|
+
/* @__PURE__ */ jsx18(
|
|
1340
1700
|
"button",
|
|
1341
1701
|
{
|
|
1342
1702
|
ref: (el) => {
|
|
@@ -1355,13 +1715,13 @@ function ColorSwatches({
|
|
|
1355
1715
|
contrast: option.contrast
|
|
1356
1716
|
}),
|
|
1357
1717
|
onClick: () => setValue(option.value),
|
|
1358
|
-
children: /* @__PURE__ */
|
|
1718
|
+
children: /* @__PURE__ */ jsx18(SwatchContent, { value: option.value, selected })
|
|
1359
1719
|
},
|
|
1360
1720
|
option.value ?? "empty"
|
|
1361
1721
|
)
|
|
1362
1722
|
);
|
|
1363
1723
|
}),
|
|
1364
|
-
name ? /* @__PURE__ */
|
|
1724
|
+
name ? /* @__PURE__ */ jsx18("input", { type: "hidden", name, value: value ?? "" }) : null
|
|
1365
1725
|
]
|
|
1366
1726
|
}
|
|
1367
1727
|
)
|
|
@@ -1379,7 +1739,7 @@ var EmptyPage_default = {
|
|
|
1379
1739
|
};
|
|
1380
1740
|
|
|
1381
1741
|
// src/components/empty-page/EmptyPage.tsx
|
|
1382
|
-
import { jsx as
|
|
1742
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1383
1743
|
function EmptyPageRoot({
|
|
1384
1744
|
size = "m",
|
|
1385
1745
|
layout = "default",
|
|
@@ -1387,31 +1747,31 @@ function EmptyPageRoot({
|
|
|
1387
1747
|
children,
|
|
1388
1748
|
...rest
|
|
1389
1749
|
}) {
|
|
1390
|
-
return /* @__PURE__ */
|
|
1750
|
+
return /* @__PURE__ */ jsx19(
|
|
1391
1751
|
"div",
|
|
1392
1752
|
{
|
|
1393
1753
|
className: cx(EmptyPage_default.root, layout !== "compact" && enterMotion_default.enterBaseChildren, className),
|
|
1394
1754
|
...rest,
|
|
1395
1755
|
...toDataAttributes({ size, layout: layout === "default" ? void 0 : layout }),
|
|
1396
|
-
children: /* @__PURE__ */
|
|
1756
|
+
children: /* @__PURE__ */ jsx19(ControlSizeProvider, { value: size, children })
|
|
1397
1757
|
}
|
|
1398
1758
|
);
|
|
1399
1759
|
}
|
|
1400
1760
|
EmptyPageRoot.displayName = "EmptyPage.Root";
|
|
1401
1761
|
function EmptyPageIcon({ tone = "neutral", className, ...rest }) {
|
|
1402
|
-
return /* @__PURE__ */
|
|
1762
|
+
return /* @__PURE__ */ jsx19("div", { className: cx(EmptyPage_default.iconWrap, className), "data-tone": tone, ...rest });
|
|
1403
1763
|
}
|
|
1404
1764
|
EmptyPageIcon.displayName = "EmptyPage.Icon";
|
|
1405
1765
|
function EmptyPageTitle({ as: Tag = "h2", className, ref, ...rest }) {
|
|
1406
|
-
return /* @__PURE__ */
|
|
1766
|
+
return /* @__PURE__ */ jsx19(Tag, { ref, className: cx(EmptyPage_default.title, className), ...rest });
|
|
1407
1767
|
}
|
|
1408
1768
|
EmptyPageTitle.displayName = "EmptyPage.Title";
|
|
1409
1769
|
function EmptyPageDescription({ className, ...rest }) {
|
|
1410
|
-
return /* @__PURE__ */
|
|
1770
|
+
return /* @__PURE__ */ jsx19("p", { className: cx(EmptyPage_default.description, className), ...rest });
|
|
1411
1771
|
}
|
|
1412
1772
|
EmptyPageDescription.displayName = "EmptyPage.Description";
|
|
1413
1773
|
function EmptyPageActions({ className, ...rest }) {
|
|
1414
|
-
return /* @__PURE__ */
|
|
1774
|
+
return /* @__PURE__ */ jsx19("div", { className: cx(EmptyPage_default.actions, className), ...rest });
|
|
1415
1775
|
}
|
|
1416
1776
|
EmptyPageActions.displayName = "EmptyPage.Actions";
|
|
1417
1777
|
var EmptyPage = {
|
|
@@ -1422,46 +1782,208 @@ var EmptyPage = {
|
|
|
1422
1782
|
Actions: EmptyPageActions
|
|
1423
1783
|
};
|
|
1424
1784
|
|
|
1425
|
-
// src/components/
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1785
|
+
// src/components/progress-bar/ProgressBar.tsx
|
|
1786
|
+
import * as React16 from "react";
|
|
1787
|
+
|
|
1788
|
+
// src/internal/progressSegments.ts
|
|
1789
|
+
function resolveValue(value, max) {
|
|
1790
|
+
const top = max !== void 0 && max > 0 ? max : 100;
|
|
1791
|
+
const clamped = Math.min(top, Math.max(Number.isFinite(value) ? value : 0, 0));
|
|
1792
|
+
return {
|
|
1793
|
+
value: clamped,
|
|
1794
|
+
max: top,
|
|
1795
|
+
ratio: clamped / top,
|
|
1796
|
+
percent: Math.round(clamped / top * 100)
|
|
1797
|
+
};
|
|
1798
|
+
}
|
|
1799
|
+
var DEFAULT_PROGRESS_SEGMENTS_LABELS = {
|
|
1800
|
+
empty: "\u041D\u0435\u0442 \u0441\u0435\u0433\u043C\u0435\u043D\u0442\u043E\u0432",
|
|
1801
|
+
allEmpty: "\u0412\u0441\u0435 \u0441\u0435\u0433\u043C\u0435\u043D\u0442\u044B \u043F\u0443\u0441\u0442\u044B"
|
|
1429
1802
|
};
|
|
1803
|
+
function nonNegative(n) {
|
|
1804
|
+
return Number.isFinite(n) && n > 0 ? n : 0;
|
|
1805
|
+
}
|
|
1806
|
+
function resolveSegments(input, max, labels) {
|
|
1807
|
+
const segments = input.map((s) => ({ ...s, value: nonNegative(s.value) }));
|
|
1808
|
+
const total = segments.reduce((acc, s) => acc + s.value, 0);
|
|
1809
|
+
const scale = max !== void 0 && max > 0 ? Math.max(max, total) : total;
|
|
1810
|
+
let text;
|
|
1811
|
+
if (segments.length === 0) text = labels.empty;
|
|
1812
|
+
else if (scale <= 0) text = labels.allEmpty;
|
|
1813
|
+
else
|
|
1814
|
+
text = segments.map((s) => {
|
|
1815
|
+
const pct = Math.round(s.value / scale * 100);
|
|
1816
|
+
return s.label ? `${s.label}: ${pct}%` : `${pct}%`;
|
|
1817
|
+
}).join(", ");
|
|
1818
|
+
return {
|
|
1819
|
+
segments,
|
|
1820
|
+
total,
|
|
1821
|
+
scale,
|
|
1822
|
+
rest: scale - total,
|
|
1823
|
+
percent: scale > 0 ? Math.round(total / scale * 100) : 0,
|
|
1824
|
+
text
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
1430
1827
|
|
|
1431
|
-
// src/components/
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1828
|
+
// src/components/progress-bar/ProgressBar.module.css
|
|
1829
|
+
var ProgressBar_default = {
|
|
1830
|
+
root: "ProgressBar_root",
|
|
1831
|
+
segment: "ProgressBar_segment",
|
|
1832
|
+
header: "ProgressBar_header",
|
|
1833
|
+
label: "ProgressBar_label",
|
|
1834
|
+
value: "ProgressBar_value",
|
|
1835
|
+
native: "ProgressBar_native",
|
|
1836
|
+
bar: "ProgressBar_bar",
|
|
1837
|
+
fill: "ProgressBar_fill",
|
|
1838
|
+
segments: "ProgressBar_segments",
|
|
1839
|
+
rest: "ProgressBar_rest",
|
|
1840
|
+
step: "ProgressBar_step"
|
|
1841
|
+
};
|
|
1842
|
+
|
|
1843
|
+
// src/components/progress-bar/ProgressBar.tsx
|
|
1844
|
+
import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1845
|
+
var MIN_STEPS = 2;
|
|
1846
|
+
var MAX_STEPS = 12;
|
|
1847
|
+
function useStepOrder(filled, count) {
|
|
1848
|
+
const prev = React16.useRef(filled);
|
|
1849
|
+
const from = prev.current;
|
|
1850
|
+
React16.useEffect(() => {
|
|
1851
|
+
prev.current = filled;
|
|
1852
|
+
}, [filled]);
|
|
1853
|
+
return Array.from(
|
|
1854
|
+
{ length: count },
|
|
1855
|
+
(_, i) => filled >= from ? Math.max(0, i - from) : Math.max(0, from - 1 - i)
|
|
1452
1856
|
);
|
|
1453
1857
|
}
|
|
1858
|
+
function ProgressBar(props) {
|
|
1859
|
+
const {
|
|
1860
|
+
label,
|
|
1861
|
+
size = "m",
|
|
1862
|
+
showValue = false,
|
|
1863
|
+
className,
|
|
1864
|
+
value: valueProp,
|
|
1865
|
+
max: maxProp,
|
|
1866
|
+
tone: toneProp,
|
|
1867
|
+
segments: segmentsProp,
|
|
1868
|
+
segmentGap = "none",
|
|
1869
|
+
steps = false,
|
|
1870
|
+
labels,
|
|
1871
|
+
"aria-label": ariaLabel,
|
|
1872
|
+
...rest
|
|
1873
|
+
} = props;
|
|
1874
|
+
const labelId = React16.useId();
|
|
1875
|
+
const descriptionId = React16.useId();
|
|
1876
|
+
const stepResolved = !segmentsProp && steps ? resolveValue(valueProp ?? 0, maxProp) : null;
|
|
1877
|
+
const stepCount = stepResolved ? Math.min(MAX_STEPS, Math.max(MIN_STEPS, Math.round(stepResolved.max))) : 0;
|
|
1878
|
+
const stepFilled = stepResolved ? Math.round(stepResolved.value / stepResolved.max * stepCount) : 0;
|
|
1879
|
+
const stepOrder = useStepOrder(stepFilled, stepCount);
|
|
1880
|
+
let percent;
|
|
1881
|
+
let tone;
|
|
1882
|
+
let bar;
|
|
1883
|
+
if (segmentsProp) {
|
|
1884
|
+
const resolved = resolveSegments(segmentsProp, maxProp, {
|
|
1885
|
+
...DEFAULT_PROGRESS_SEGMENTS_LABELS,
|
|
1886
|
+
...labels
|
|
1887
|
+
});
|
|
1888
|
+
const { segments, total, rest: free, text } = resolved;
|
|
1889
|
+
percent = resolved.percent;
|
|
1890
|
+
const named = Boolean(label || ariaLabel);
|
|
1891
|
+
const a11y = named ? {
|
|
1892
|
+
"aria-labelledby": label ? labelId : void 0,
|
|
1893
|
+
"aria-label": label ? void 0 : ariaLabel,
|
|
1894
|
+
"aria-describedby": descriptionId
|
|
1895
|
+
} : { "aria-label": text };
|
|
1896
|
+
bar = /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
1897
|
+
named ? /* @__PURE__ */ jsx20(VisuallyHidden, { id: descriptionId, children: text }) : null,
|
|
1898
|
+
/* @__PURE__ */ jsxs11(
|
|
1899
|
+
"div",
|
|
1900
|
+
{
|
|
1901
|
+
className: ProgressBar_default.bar,
|
|
1902
|
+
role: "group",
|
|
1903
|
+
...a11y,
|
|
1904
|
+
...toDataAttributes({ "segment-gap": segmentGap }),
|
|
1905
|
+
children: [
|
|
1906
|
+
total > 0 ? /* @__PURE__ */ jsx20("span", { className: ProgressBar_default.segments, style: { flexGrow: total }, children: segments.map((seg, i) => /* @__PURE__ */ jsx20(
|
|
1907
|
+
"span",
|
|
1908
|
+
{
|
|
1909
|
+
className: ProgressBar_default.segment,
|
|
1910
|
+
style: { flexGrow: seg.value },
|
|
1911
|
+
title: seg.label,
|
|
1912
|
+
...toDataAttributes({ tone: seg.tone ?? "accent" })
|
|
1913
|
+
},
|
|
1914
|
+
i
|
|
1915
|
+
)) }) : null,
|
|
1916
|
+
free > 0 || total === 0 ? /* @__PURE__ */ jsx20("span", { className: ProgressBar_default.rest, style: { flexGrow: free > 0 ? free : 1 } }) : null
|
|
1917
|
+
]
|
|
1918
|
+
}
|
|
1919
|
+
)
|
|
1920
|
+
] });
|
|
1921
|
+
} else {
|
|
1922
|
+
const resolved = resolveValue(valueProp ?? 0, maxProp);
|
|
1923
|
+
const { value, max } = resolved;
|
|
1924
|
+
percent = resolved.percent;
|
|
1925
|
+
tone = toneProp ?? "accent";
|
|
1926
|
+
bar = /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
1927
|
+
/* @__PURE__ */ jsx20(
|
|
1928
|
+
"progress",
|
|
1929
|
+
{
|
|
1930
|
+
value,
|
|
1931
|
+
max,
|
|
1932
|
+
"aria-labelledby": label ? labelId : void 0,
|
|
1933
|
+
"aria-label": label ? void 0 : ariaLabel,
|
|
1934
|
+
className: ProgressBar_default.native
|
|
1935
|
+
}
|
|
1936
|
+
),
|
|
1937
|
+
steps ? /* @__PURE__ */ jsx20("span", { className: ProgressBar_default.bar, "aria-hidden": "true", "data-steps": "true", children: stepOrder.map((order, i) => /* @__PURE__ */ jsx20(
|
|
1938
|
+
"span",
|
|
1939
|
+
{
|
|
1940
|
+
className: ProgressBar_default.step,
|
|
1941
|
+
"data-filled": i < stepFilled || void 0,
|
|
1942
|
+
style: { "--pb-step-order": order }
|
|
1943
|
+
},
|
|
1944
|
+
i
|
|
1945
|
+
)) }) : /* @__PURE__ */ jsx20(
|
|
1946
|
+
"span",
|
|
1947
|
+
{
|
|
1948
|
+
className: ProgressBar_default.bar,
|
|
1949
|
+
"aria-hidden": "true",
|
|
1950
|
+
style: { "--pb-ratio": resolved.ratio },
|
|
1951
|
+
children: /* @__PURE__ */ jsx20("span", { className: ProgressBar_default.fill })
|
|
1952
|
+
}
|
|
1953
|
+
)
|
|
1954
|
+
] });
|
|
1955
|
+
}
|
|
1956
|
+
return /* @__PURE__ */ jsxs11("div", { className: cx(ProgressBar_default.root, className), ...rest, ...toDataAttributes({ size, tone }), children: [
|
|
1957
|
+
label || showValue ? /* @__PURE__ */ jsxs11("div", { className: ProgressBar_default.header, children: [
|
|
1958
|
+
label ? /* @__PURE__ */ jsx20("span", { className: ProgressBar_default.label, id: labelId, children: label }) : null,
|
|
1959
|
+
showValue ? /* @__PURE__ */ jsxs11("span", { className: ProgressBar_default.value, "aria-hidden": "true", children: [
|
|
1960
|
+
percent,
|
|
1961
|
+
"%"
|
|
1962
|
+
] }) : null
|
|
1963
|
+
] }) : null,
|
|
1964
|
+
bar
|
|
1965
|
+
] });
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
// src/components/input/passwordStrength.ts
|
|
1969
|
+
var SHORT = 8;
|
|
1970
|
+
function getPasswordStrength(value) {
|
|
1971
|
+
if (value.length === 0) return 0;
|
|
1972
|
+
const points = Number(/\p{Ll}/u.test(value)) + Number(/\p{Lu}/u.test(value)) + Number(/\p{N}/u.test(value)) + Number(/[^\p{L}\p{N}\s]/u.test(value)) + Number(value.length >= 10) + Number(value.length >= 14);
|
|
1973
|
+
const level = points >= 5 ? 4 : points === 4 ? 3 : points === 3 ? 2 : 1;
|
|
1974
|
+
return value.length < SHORT ? Math.min(level, 2) : level;
|
|
1975
|
+
}
|
|
1454
1976
|
|
|
1455
1977
|
// src/components/input/Input.tsx
|
|
1456
|
-
import * as
|
|
1978
|
+
import * as React18 from "react";
|
|
1457
1979
|
|
|
1458
1980
|
// src/internal/context.ts
|
|
1459
|
-
import * as
|
|
1981
|
+
import * as React17 from "react";
|
|
1460
1982
|
function createComponentContext(displayName) {
|
|
1461
|
-
const Ctx =
|
|
1983
|
+
const Ctx = React17.createContext(null);
|
|
1462
1984
|
Ctx.displayName = `${displayName}Context`;
|
|
1463
1985
|
function useComponentContext() {
|
|
1464
|
-
const value =
|
|
1986
|
+
const value = React17.useContext(Ctx);
|
|
1465
1987
|
if (value === null) {
|
|
1466
1988
|
throw new Error(
|
|
1467
1989
|
`[prime-ui-kit] \`${displayName}\` sub-component must be used inside \`${displayName}.Root\`.`
|
|
@@ -1480,15 +2002,27 @@ var Input_default = {
|
|
|
1480
2002
|
field: "Input_field",
|
|
1481
2003
|
inlineAffix: "Input_inlineAffix",
|
|
1482
2004
|
icon: "Input_icon",
|
|
1483
|
-
action: "Input_action"
|
|
2005
|
+
action: "Input_action",
|
|
2006
|
+
strengthWord: "Input_strengthWord"
|
|
1484
2007
|
};
|
|
1485
2008
|
|
|
1486
2009
|
// src/components/input/Input.tsx
|
|
1487
|
-
import { jsx as
|
|
2010
|
+
import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1488
2011
|
var INPUT_LABELS = {
|
|
1489
2012
|
optional: "\u043D\u0435\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E",
|
|
1490
2013
|
clear: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
|
|
1491
|
-
counter: "{current} \u0438\u0437 {max} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"
|
|
2014
|
+
counter: "{current} \u0438\u0437 {max} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",
|
|
2015
|
+
strength: "\u041D\u0430\u0434\u0451\u0436\u043D\u043E\u0441\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044F",
|
|
2016
|
+
strengthWeak: "\u0421\u043B\u0430\u0431\u044B\u0439",
|
|
2017
|
+
strengthEasy: "\u041B\u0451\u0433\u043A\u0438\u0439",
|
|
2018
|
+
strengthMedium: "\u0421\u0440\u0435\u0434\u043D\u0438\u0439",
|
|
2019
|
+
strengthHard: "\u0421\u043B\u043E\u0436\u043D\u044B\u0439"
|
|
2020
|
+
};
|
|
2021
|
+
var STRENGTH_TONES = {
|
|
2022
|
+
1: "danger",
|
|
2023
|
+
2: "warning",
|
|
2024
|
+
3: "accent",
|
|
2025
|
+
4: "success"
|
|
1492
2026
|
};
|
|
1493
2027
|
var [InputProvider, useInputContext] = createComponentContext("Input");
|
|
1494
2028
|
function InputRoot({
|
|
@@ -1503,17 +2037,20 @@ function InputRoot({
|
|
|
1503
2037
|
counter,
|
|
1504
2038
|
reserveSupportRow = false,
|
|
1505
2039
|
id,
|
|
2040
|
+
strength = false,
|
|
2041
|
+
getStrength = getPasswordStrength,
|
|
1506
2042
|
labels: labelsProp,
|
|
1507
2043
|
children,
|
|
1508
2044
|
className,
|
|
1509
2045
|
...rest
|
|
1510
2046
|
}) {
|
|
2047
|
+
const [strengthValue, setStrengthValue] = React18.useState("");
|
|
1511
2048
|
const size = useControlSize(sizeProp);
|
|
1512
2049
|
const ids = useFieldFrame(id, { label, hint, error, invalid });
|
|
1513
|
-
const labels =
|
|
2050
|
+
const labels = React18.useMemo(() => ({ ...INPUT_LABELS, ...labelsProp }), [labelsProp]);
|
|
1514
2051
|
const { invalid: isInvalid, controlId: inputId, describedBy } = ids;
|
|
1515
|
-
const inputRef =
|
|
1516
|
-
const contextValue =
|
|
2052
|
+
const inputRef = React18.useRef(null);
|
|
2053
|
+
const contextValue = React18.useMemo(
|
|
1517
2054
|
() => ({
|
|
1518
2055
|
size,
|
|
1519
2056
|
invalid: isInvalid,
|
|
@@ -1522,11 +2059,14 @@ function InputRoot({
|
|
|
1522
2059
|
inputId,
|
|
1523
2060
|
inputRef,
|
|
1524
2061
|
describedBy,
|
|
1525
|
-
labels
|
|
2062
|
+
labels,
|
|
2063
|
+
reportValue: strength ? setStrengthValue : null
|
|
1526
2064
|
}),
|
|
1527
|
-
[size, isInvalid, focusRing, required, inputId, describedBy, labels]
|
|
2065
|
+
[size, isInvalid, focusRing, required, inputId, describedBy, labels, strength]
|
|
1528
2066
|
);
|
|
1529
|
-
|
|
2067
|
+
const level = strength ? getStrength(strengthValue) : 0;
|
|
2068
|
+
const levelWord = level ? [labels.strengthWeak, labels.strengthEasy, labels.strengthMedium, labels.strengthHard][level - 1] : "";
|
|
2069
|
+
return /* @__PURE__ */ jsx21(InputProvider, { value: contextValue, children: /* @__PURE__ */ jsx21(ControlSizeProvider, { value: size, children: /* @__PURE__ */ jsxs12(
|
|
1530
2070
|
FieldFrame,
|
|
1531
2071
|
{
|
|
1532
2072
|
...rest,
|
|
@@ -1537,18 +2077,45 @@ function InputRoot({
|
|
|
1537
2077
|
optional,
|
|
1538
2078
|
hint,
|
|
1539
2079
|
error,
|
|
1540
|
-
counter,
|
|
1541
|
-
|
|
2080
|
+
counter: strength ? /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
2081
|
+
/* @__PURE__ */ jsx21(
|
|
2082
|
+
"span",
|
|
2083
|
+
{
|
|
2084
|
+
className: Input_default.strengthWord,
|
|
2085
|
+
"data-tone": level ? STRENGTH_TONES[level] : void 0,
|
|
2086
|
+
"aria-live": "polite",
|
|
2087
|
+
children: levelWord ? /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
2088
|
+
/* @__PURE__ */ jsx21(VisuallyHidden, { children: `${labels.strength}: ` }),
|
|
2089
|
+
/* @__PURE__ */ jsx21(MorphText, { children: levelWord })
|
|
2090
|
+
] }) : null
|
|
2091
|
+
}
|
|
2092
|
+
),
|
|
2093
|
+
counter
|
|
2094
|
+
] }) : counter,
|
|
2095
|
+
reserveSupportRow: reserveSupportRow || strength,
|
|
1542
2096
|
optionalLabel: labels.optional,
|
|
1543
2097
|
className: cx(fieldTierClass, Input_default.root, className),
|
|
1544
|
-
children
|
|
2098
|
+
children: [
|
|
2099
|
+
children,
|
|
2100
|
+
strength ? /* @__PURE__ */ jsx21(
|
|
2101
|
+
ProgressBar,
|
|
2102
|
+
{
|
|
2103
|
+
steps: true,
|
|
2104
|
+
value: level,
|
|
2105
|
+
max: 4,
|
|
2106
|
+
tone: level ? STRENGTH_TONES[level] : "neutral",
|
|
2107
|
+
size: "xs",
|
|
2108
|
+
"aria-label": labels.strength
|
|
2109
|
+
}
|
|
2110
|
+
) : null
|
|
2111
|
+
]
|
|
1545
2112
|
}
|
|
1546
2113
|
) }) });
|
|
1547
2114
|
}
|
|
1548
2115
|
InputRoot.displayName = "Input.Root";
|
|
1549
2116
|
function InputWrapper({ children, className, ...rest }) {
|
|
1550
2117
|
const { size, invalid, focusRing } = useInputContext();
|
|
1551
|
-
return /* @__PURE__ */
|
|
2118
|
+
return /* @__PURE__ */ jsx21(
|
|
1552
2119
|
"div",
|
|
1553
2120
|
{
|
|
1554
2121
|
...rest,
|
|
@@ -1572,10 +2139,23 @@ function InputField({
|
|
|
1572
2139
|
ref,
|
|
1573
2140
|
...rest
|
|
1574
2141
|
}) {
|
|
1575
|
-
const {
|
|
2142
|
+
const {
|
|
2143
|
+
inputId,
|
|
2144
|
+
inputRef,
|
|
2145
|
+
invalid,
|
|
2146
|
+
required: requiredCtx,
|
|
2147
|
+
describedBy,
|
|
2148
|
+
reportValue
|
|
2149
|
+
} = useInputContext();
|
|
1576
2150
|
const setRefs = useMergedRefs(inputRef, ref);
|
|
2151
|
+
const controlled = rest.value;
|
|
2152
|
+
React18.useEffect(() => {
|
|
2153
|
+
if (!reportValue) return;
|
|
2154
|
+
if (controlled !== void 0) reportValue(String(controlled));
|
|
2155
|
+
else if (inputRef.current) reportValue(inputRef.current.value);
|
|
2156
|
+
}, [reportValue, controlled, inputRef]);
|
|
1577
2157
|
const resolvedDescribedBy = [ariaDescribedBy, describedBy].filter(Boolean).join(" ") || void 0;
|
|
1578
|
-
return /* @__PURE__ */
|
|
2158
|
+
return /* @__PURE__ */ jsx21(
|
|
1579
2159
|
"input",
|
|
1580
2160
|
{
|
|
1581
2161
|
...rest,
|
|
@@ -1588,21 +2168,22 @@ function InputField({
|
|
|
1588
2168
|
onChange: (event) => {
|
|
1589
2169
|
onChange?.(event);
|
|
1590
2170
|
onValueChange?.(event.target.value);
|
|
2171
|
+
reportValue?.(event.target.value);
|
|
1591
2172
|
}
|
|
1592
2173
|
}
|
|
1593
2174
|
);
|
|
1594
2175
|
}
|
|
1595
2176
|
InputField.displayName = "Input.Field";
|
|
1596
2177
|
function InputIcon({ side, children, className, ...rest }) {
|
|
1597
|
-
return /* @__PURE__ */
|
|
2178
|
+
return /* @__PURE__ */ jsx21("span", { ...rest, className: cx(Input_default.icon, className), "data-side": side, "aria-hidden": "true", children });
|
|
1598
2179
|
}
|
|
1599
2180
|
InputIcon.displayName = "Input.Icon";
|
|
1600
2181
|
function InputAffix({ side, children, className, ...rest }) {
|
|
1601
|
-
return /* @__PURE__ */
|
|
2182
|
+
return /* @__PURE__ */ jsx21("div", { ...rest, className: cx(Input_default.affix, className), "data-side": side, "aria-hidden": "true", children });
|
|
1602
2183
|
}
|
|
1603
2184
|
InputAffix.displayName = "Input.Affix";
|
|
1604
2185
|
function InputInlineAffix({ side, children, className, ...rest }) {
|
|
1605
|
-
return /* @__PURE__ */
|
|
2186
|
+
return /* @__PURE__ */ jsx21(
|
|
1606
2187
|
"span",
|
|
1607
2188
|
{
|
|
1608
2189
|
...rest,
|
|
@@ -1616,7 +2197,7 @@ function InputInlineAffix({ side, children, className, ...rest }) {
|
|
|
1616
2197
|
InputInlineAffix.displayName = "Input.InlineAffix";
|
|
1617
2198
|
function InputClearButton({ className, onClick: onClick2, ref, ...rest }) {
|
|
1618
2199
|
const { inputId, inputRef, labels } = useInputContext();
|
|
1619
|
-
return /* @__PURE__ */
|
|
2200
|
+
return /* @__PURE__ */ jsx21(
|
|
1620
2201
|
"button",
|
|
1621
2202
|
{
|
|
1622
2203
|
...rest,
|
|
@@ -1629,14 +2210,14 @@ function InputClearButton({ className, onClick: onClick2, ref, ...rest }) {
|
|
|
1629
2210
|
onClick2?.(event);
|
|
1630
2211
|
if (!event.defaultPrevented) inputRef.current?.focus();
|
|
1631
2212
|
},
|
|
1632
|
-
children: /* @__PURE__ */
|
|
2213
|
+
children: /* @__PURE__ */ jsx21(Icon, { name: "action.close" })
|
|
1633
2214
|
}
|
|
1634
2215
|
);
|
|
1635
2216
|
}
|
|
1636
2217
|
InputClearButton.displayName = "Input.ClearButton";
|
|
1637
2218
|
function InputCounter(props) {
|
|
1638
2219
|
const { size, labels } = useInputContext();
|
|
1639
|
-
return /* @__PURE__ */
|
|
2220
|
+
return /* @__PURE__ */ jsx21(FieldCounter, { ...props, size, label: labels.counter });
|
|
1640
2221
|
}
|
|
1641
2222
|
InputCounter.displayName = "Input.Counter";
|
|
1642
2223
|
var Input = {
|
|
@@ -1651,17 +2232,17 @@ var Input = {
|
|
|
1651
2232
|
};
|
|
1652
2233
|
|
|
1653
2234
|
// src/internal/imageSlot.tsx
|
|
1654
|
-
import * as
|
|
2235
|
+
import * as React20 from "react";
|
|
1655
2236
|
|
|
1656
2237
|
// src/hooks/useImageStatus.ts
|
|
1657
|
-
import * as
|
|
2238
|
+
import * as React19 from "react";
|
|
1658
2239
|
function useImageStatus(report, { onLoad, onError } = {}) {
|
|
1659
|
-
const [status, setStatus] =
|
|
1660
|
-
|
|
2240
|
+
const [status, setStatus] = React19.useState("loading");
|
|
2241
|
+
React19.useLayoutEffect(() => {
|
|
1661
2242
|
report("loading");
|
|
1662
2243
|
return () => report("idle");
|
|
1663
2244
|
}, [report]);
|
|
1664
|
-
const handleLoad =
|
|
2245
|
+
const handleLoad = React19.useCallback(
|
|
1665
2246
|
(event) => {
|
|
1666
2247
|
setStatus("loaded");
|
|
1667
2248
|
report("loaded");
|
|
@@ -1669,7 +2250,7 @@ function useImageStatus(report, { onLoad, onError } = {}) {
|
|
|
1669
2250
|
},
|
|
1670
2251
|
[onLoad, report]
|
|
1671
2252
|
);
|
|
1672
|
-
const handleError =
|
|
2253
|
+
const handleError = React19.useCallback(
|
|
1673
2254
|
(event) => {
|
|
1674
2255
|
setStatus("error");
|
|
1675
2256
|
report("error");
|
|
@@ -1681,18 +2262,18 @@ function useImageStatus(report, { onLoad, onError } = {}) {
|
|
|
1681
2262
|
}
|
|
1682
2263
|
|
|
1683
2264
|
// src/internal/imageSlot.tsx
|
|
1684
|
-
import { jsx as
|
|
2265
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1685
2266
|
function createImageSlot(name, classNames) {
|
|
1686
2267
|
const [Provider, useSlotContext] = createComponentContext(name);
|
|
1687
2268
|
function ImageSlotProvider({ children }) {
|
|
1688
|
-
const [imageStatus, setImageStatus] =
|
|
1689
|
-
const value =
|
|
1690
|
-
return /* @__PURE__ */
|
|
2269
|
+
const [imageStatus, setImageStatus] = React20.useState("idle");
|
|
2270
|
+
const value = React20.useMemo(() => ({ imageStatus, setImageStatus }), [imageStatus]);
|
|
2271
|
+
return /* @__PURE__ */ jsx22(Provider, { value, children });
|
|
1691
2272
|
}
|
|
1692
2273
|
function ImageInner({ src, alt = "", className, onLoad, onError, ...rest }) {
|
|
1693
2274
|
const { setImageStatus } = useSlotContext();
|
|
1694
2275
|
const image = useImageStatus(setImageStatus, { onLoad, onError });
|
|
1695
|
-
return /* @__PURE__ */
|
|
2276
|
+
return /* @__PURE__ */ jsx22(
|
|
1696
2277
|
"img",
|
|
1697
2278
|
{
|
|
1698
2279
|
src,
|
|
@@ -1706,12 +2287,12 @@ function createImageSlot(name, classNames) {
|
|
|
1706
2287
|
);
|
|
1707
2288
|
}
|
|
1708
2289
|
function Image2(props) {
|
|
1709
|
-
return /* @__PURE__ */
|
|
2290
|
+
return /* @__PURE__ */ jsx22(ImageInner, { ...props }, props.src);
|
|
1710
2291
|
}
|
|
1711
2292
|
Image2.displayName = `${name}.Image`;
|
|
1712
2293
|
function Fallback({ className, ...rest }) {
|
|
1713
2294
|
const { imageStatus } = useSlotContext();
|
|
1714
|
-
return /* @__PURE__ */
|
|
2295
|
+
return /* @__PURE__ */ jsx22(
|
|
1715
2296
|
"span",
|
|
1716
2297
|
{
|
|
1717
2298
|
className: cx(classNames.fallback, className),
|
|
@@ -1742,7 +2323,7 @@ var Thumbnail_default = {
|
|
|
1742
2323
|
};
|
|
1743
2324
|
|
|
1744
2325
|
// src/components/thumbnail/Thumbnail.tsx
|
|
1745
|
-
import { jsx as
|
|
2326
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1746
2327
|
var slot = createImageSlot("Thumbnail", { image: Thumbnail_default.image, fallback: Thumbnail_default.fallback });
|
|
1747
2328
|
function ThumbnailRoot({
|
|
1748
2329
|
size = "m",
|
|
@@ -1755,7 +2336,7 @@ function ThumbnailRoot({
|
|
|
1755
2336
|
children,
|
|
1756
2337
|
...rest
|
|
1757
2338
|
}) {
|
|
1758
|
-
return /* @__PURE__ */
|
|
2339
|
+
return /* @__PURE__ */ jsx23(slot.ImageSlotProvider, { children: /* @__PURE__ */ jsx23(
|
|
1759
2340
|
"div",
|
|
1760
2341
|
{
|
|
1761
2342
|
className: cx(Thumbnail_default.root, palette_default.hue, className),
|
|
@@ -1774,7 +2355,7 @@ function ThumbnailRoot({
|
|
|
1774
2355
|
}
|
|
1775
2356
|
ThumbnailRoot.displayName = "Thumbnail.Root";
|
|
1776
2357
|
function ThumbnailImage({ fit = "cover", ...rest }) {
|
|
1777
|
-
return /* @__PURE__ */
|
|
2358
|
+
return /* @__PURE__ */ jsx23(slot.Image, { ...rest, "data-fit": fit });
|
|
1778
2359
|
}
|
|
1779
2360
|
ThumbnailImage.displayName = "Thumbnail.Image";
|
|
1780
2361
|
var ThumbnailFallback = slot.Fallback;
|
|
@@ -1785,10 +2366,10 @@ var Thumbnail = {
|
|
|
1785
2366
|
};
|
|
1786
2367
|
|
|
1787
2368
|
// src/components/select/Select.tsx
|
|
1788
|
-
import * as
|
|
2369
|
+
import * as React34 from "react";
|
|
1789
2370
|
|
|
1790
2371
|
// src/internal/listbox.ts
|
|
1791
|
-
import * as
|
|
2372
|
+
import * as React21 from "react";
|
|
1792
2373
|
var optionDomId = (listboxId, value) => `${listboxId}-opt-${value.replace(/\s+/g, "_")}`;
|
|
1793
2374
|
function enabledOptions(container) {
|
|
1794
2375
|
if (!container) return [];
|
|
@@ -1813,11 +2394,11 @@ function createStore(initial) {
|
|
|
1813
2394
|
};
|
|
1814
2395
|
}
|
|
1815
2396
|
function useCreateStore(initial) {
|
|
1816
|
-
return
|
|
2397
|
+
return React21.useState(() => createStore(initial))[0];
|
|
1817
2398
|
}
|
|
1818
2399
|
function useStoreSlice(store, select) {
|
|
1819
2400
|
const read = () => select(store.get());
|
|
1820
|
-
return
|
|
2401
|
+
return React21.useSyncExternalStore(store.subscribe, read, read);
|
|
1821
2402
|
}
|
|
1822
2403
|
function handleListboxKeyDown(event, { items, highlight, onSelect }) {
|
|
1823
2404
|
if (items.length === 0) return;
|
|
@@ -1839,10 +2420,10 @@ function handleListboxKeyDown(event, { items, highlight, onSelect }) {
|
|
|
1839
2420
|
}
|
|
1840
2421
|
var TYPEAHEAD_RESET_MS = 500;
|
|
1841
2422
|
function useTypeahead() {
|
|
1842
|
-
const state =
|
|
1843
|
-
|
|
1844
|
-
const isTyping =
|
|
1845
|
-
const find =
|
|
2423
|
+
const state = React21.useRef({ buffer: "", timer: 0 });
|
|
2424
|
+
React21.useEffect(() => () => window.clearTimeout(state.current.timer), []);
|
|
2425
|
+
const isTyping = React21.useCallback(() => state.current.buffer !== "", []);
|
|
2426
|
+
const find = React21.useCallback(
|
|
1846
2427
|
(key, items, highlighted) => {
|
|
1847
2428
|
const s = state.current;
|
|
1848
2429
|
window.clearTimeout(s.timer);
|
|
@@ -1864,7 +2445,7 @@ function useTypeahead() {
|
|
|
1864
2445
|
}
|
|
1865
2446
|
|
|
1866
2447
|
// src/internal/MenuGroup.tsx
|
|
1867
|
-
import * as
|
|
2448
|
+
import * as React22 from "react";
|
|
1868
2449
|
|
|
1869
2450
|
// src/internal/menu.module.css
|
|
1870
2451
|
var menu_default = {
|
|
@@ -1873,6 +2454,7 @@ var menu_default = {
|
|
|
1873
2454
|
item: "menu_item",
|
|
1874
2455
|
itemIcon: "menu_itemIcon",
|
|
1875
2456
|
shortcut: "menu_shortcut",
|
|
2457
|
+
check: "menu_check",
|
|
1876
2458
|
group: "menu_group",
|
|
1877
2459
|
groupLabel: "menu_groupLabel",
|
|
1878
2460
|
separator: "menu_separator",
|
|
@@ -1881,12 +2463,12 @@ var menu_default = {
|
|
|
1881
2463
|
};
|
|
1882
2464
|
|
|
1883
2465
|
// src/internal/MenuGroup.tsx
|
|
1884
|
-
import { jsx as
|
|
2466
|
+
import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1885
2467
|
function MenuGroup({ label, className, children, ...rest }) {
|
|
1886
|
-
const labelId =
|
|
2468
|
+
const labelId = React22.useId();
|
|
1887
2469
|
return (
|
|
1888
2470
|
// biome-ignore lint/a11y/useSemanticElements: role="group" inside a menu / listbox; <fieldset> is not allowed there
|
|
1889
|
-
/* @__PURE__ */
|
|
2471
|
+
/* @__PURE__ */ jsxs13(
|
|
1890
2472
|
"div",
|
|
1891
2473
|
{
|
|
1892
2474
|
...rest,
|
|
@@ -1894,7 +2476,7 @@ function MenuGroup({ label, className, children, ...rest }) {
|
|
|
1894
2476
|
"aria-labelledby": label != null ? labelId : void 0,
|
|
1895
2477
|
className: cx(menu_default.group, className),
|
|
1896
2478
|
children: [
|
|
1897
|
-
label != null ? /* @__PURE__ */
|
|
2479
|
+
label != null ? /* @__PURE__ */ jsx24("div", { id: labelId, role: "presentation", className: menu_default.groupLabel, children: label }) : null,
|
|
1898
2480
|
children
|
|
1899
2481
|
]
|
|
1900
2482
|
}
|
|
@@ -1905,13 +2487,17 @@ function MenuGroup({ label, className, children, ...rest }) {
|
|
|
1905
2487
|
// src/internal/floatingSurface.module.css
|
|
1906
2488
|
var floatingSurface_default = {
|
|
1907
2489
|
surface: "floatingSurface_surface",
|
|
1908
|
-
layer: "floatingSurface_layer"
|
|
2490
|
+
layer: "floatingSurface_layer",
|
|
2491
|
+
scrim: "floatingSurface_scrim",
|
|
2492
|
+
sheet: "floatingSurface_sheet",
|
|
2493
|
+
sheetContent: "floatingSurface_sheetContent"
|
|
1909
2494
|
};
|
|
1910
2495
|
|
|
1911
2496
|
// src/internal/overlayMotion.module.css
|
|
1912
2497
|
var overlayMotion_default = {
|
|
1913
2498
|
dialog: "overlayMotion_dialog",
|
|
1914
2499
|
drawer: "overlayMotion_drawer",
|
|
2500
|
+
sheet: "overlayMotion_sheet",
|
|
1915
2501
|
floating: "overlayMotion_floating",
|
|
1916
2502
|
scrim: "overlayMotion_scrim",
|
|
1917
2503
|
overlayFadeIn: "overlayMotion_overlayFadeIn",
|
|
@@ -1927,11 +2513,11 @@ var overlayMotion_default = {
|
|
|
1927
2513
|
};
|
|
1928
2514
|
|
|
1929
2515
|
// src/internal/Portal.tsx
|
|
1930
|
-
import * as
|
|
2516
|
+
import * as React23 from "react";
|
|
1931
2517
|
import { createPortal } from "react-dom";
|
|
1932
2518
|
function Portal({ children, container }) {
|
|
1933
|
-
const [mounted, setMounted] =
|
|
1934
|
-
|
|
2519
|
+
const [mounted, setMounted] = React23.useState(false);
|
|
2520
|
+
React23.useLayoutEffect(() => {
|
|
1935
2521
|
setMounted(true);
|
|
1936
2522
|
return () => setMounted(false);
|
|
1937
2523
|
}, []);
|
|
@@ -1939,8 +2525,35 @@ function Portal({ children, container }) {
|
|
|
1939
2525
|
return createPortal(children, container ?? document.body);
|
|
1940
2526
|
}
|
|
1941
2527
|
|
|
2528
|
+
// src/internal/sheet.module.css
|
|
2529
|
+
var sheet_default = {
|
|
2530
|
+
handle: "sheet_handle",
|
|
2531
|
+
swipeY: "sheet_swipeY",
|
|
2532
|
+
swipeX: "sheet_swipeX"
|
|
2533
|
+
};
|
|
2534
|
+
|
|
2535
|
+
// src/internal/surfaceDepth.tsx
|
|
2536
|
+
import * as React24 from "react";
|
|
2537
|
+
var SurfaceDepthContext = React24.createContext(0);
|
|
2538
|
+
SurfaceDepthContext.displayName = "SurfaceDepthContext";
|
|
2539
|
+
function nextSurfaceDepth(depth) {
|
|
2540
|
+
if (typeof depth === "number") return Math.min(depth + 1, 4);
|
|
2541
|
+
if (depth === "tinted") return 1;
|
|
2542
|
+
return depth === "floating" ? "floating-1" : "floating-2";
|
|
2543
|
+
}
|
|
2544
|
+
function useNestedSurfaceDepth() {
|
|
2545
|
+
return nextSurfaceDepth(React24.useContext(SurfaceDepthContext));
|
|
2546
|
+
}
|
|
2547
|
+
var SurfaceDepthProvider = SurfaceDepthContext.Provider;
|
|
2548
|
+
var StageDepthContext = React24.createContext(0);
|
|
2549
|
+
StageDepthContext.displayName = "StageDepthContext";
|
|
2550
|
+
var StageDepthProvider = StageDepthContext.Provider;
|
|
2551
|
+
function useStageDepth() {
|
|
2552
|
+
return React24.useContext(StageDepthContext);
|
|
2553
|
+
}
|
|
2554
|
+
|
|
1942
2555
|
// src/internal/overlay/layerStack.ts
|
|
1943
|
-
import * as
|
|
2556
|
+
import * as React25 from "react";
|
|
1944
2557
|
|
|
1945
2558
|
// src/internal/overlay/focus.ts
|
|
1946
2559
|
var FOCUSABLE = [
|
|
@@ -2061,22 +2674,22 @@ function push(entry) {
|
|
|
2061
2674
|
if (stack.length === 0) listen(false);
|
|
2062
2675
|
};
|
|
2063
2676
|
}
|
|
2064
|
-
var LayerContext =
|
|
2677
|
+
var LayerContext = React25.createContext(null);
|
|
2065
2678
|
var LayerProvider = LayerContext.Provider;
|
|
2066
2679
|
function useLayer(open, options) {
|
|
2067
|
-
const parent =
|
|
2068
|
-
const [entry] =
|
|
2680
|
+
const parent = React25.useContext(LayerContext);
|
|
2681
|
+
const [entry] = React25.useState(() => ({ parent, trap: false, ...options }));
|
|
2069
2682
|
entry.parent = parent;
|
|
2070
2683
|
entry.refs = options.refs;
|
|
2071
2684
|
entry.dismiss = options.dismiss;
|
|
2072
2685
|
entry.trap = options.trap ?? false;
|
|
2073
2686
|
entry.onDismiss = options.onDismiss;
|
|
2074
|
-
|
|
2687
|
+
React25.useLayoutEffect(() => open ? push(entry) : void 0, [open, entry]);
|
|
2075
2688
|
return entry;
|
|
2076
2689
|
}
|
|
2077
2690
|
|
|
2078
2691
|
// src/internal/overlay/FloatingPanel.tsx
|
|
2079
|
-
import { jsx as
|
|
2692
|
+
import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2080
2693
|
function FloatingPanel({
|
|
2081
2694
|
floating,
|
|
2082
2695
|
size,
|
|
@@ -2088,43 +2701,96 @@ function FloatingPanel({
|
|
|
2088
2701
|
ref,
|
|
2089
2702
|
...rest
|
|
2090
2703
|
}) {
|
|
2091
|
-
const
|
|
2704
|
+
const mergedRef = useMergedRefs(floating.panelRef, ref);
|
|
2092
2705
|
if (!floating.mounted) return null;
|
|
2706
|
+
const { sheet, presence } = floating;
|
|
2707
|
+
const panelRef = sheet ? ref : mergedRef;
|
|
2093
2708
|
const props = {
|
|
2094
2709
|
...rest,
|
|
2095
|
-
className: cx(
|
|
2710
|
+
className: sheet ? cx(floatingSurface_default.sheetContent, className) : cx(
|
|
2096
2711
|
surface && floatingSurface_default.surface,
|
|
2097
2712
|
floatingSurface_default.layer,
|
|
2098
2713
|
overlayMotion_default.floating,
|
|
2099
2714
|
className
|
|
2100
2715
|
),
|
|
2101
|
-
"data-state": floating.presence.state,
|
|
2102
|
-
"data-side": floating.side,
|
|
2103
2716
|
"data-size": size,
|
|
2104
|
-
|
|
2717
|
+
...surface && !sheet ? { "data-depth": "floating" } : null,
|
|
2718
|
+
...sheet ? null : {
|
|
2719
|
+
"data-state": presence.state,
|
|
2720
|
+
"data-side": floating.side,
|
|
2721
|
+
onAnimationEnd: presence.onExitEnd
|
|
2722
|
+
},
|
|
2105
2723
|
onKeyDown: (event) => {
|
|
2106
2724
|
onKeyDown2?.(event);
|
|
2107
2725
|
floating.onKeyDown(event);
|
|
2108
2726
|
}
|
|
2109
2727
|
};
|
|
2110
|
-
|
|
2728
|
+
const panel = scroll ? /* @__PURE__ */ jsx25(ScrollContainer, { ...props, ref: panelRef, children }) : /* @__PURE__ */ jsx25("div", { ...props, ref: panelRef, children });
|
|
2729
|
+
return /* @__PURE__ */ jsx25(Portal, { children: /* @__PURE__ */ jsx25(LayerProvider, { value: floating.layer, children: /* @__PURE__ */ jsx25(SurfaceDepthProvider, { value: "floating", children: /* @__PURE__ */ jsx25(ControlSizeProvider, { value: size, children: sheet ? /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
2730
|
+
/* @__PURE__ */ jsx25(
|
|
2731
|
+
"div",
|
|
2732
|
+
{
|
|
2733
|
+
role: "presentation",
|
|
2734
|
+
className: cx(floatingSurface_default.scrim, floatingSurface_default.layer, overlayMotion_default.scrim),
|
|
2735
|
+
"data-state": presence.state
|
|
2736
|
+
}
|
|
2737
|
+
),
|
|
2738
|
+
/* @__PURE__ */ jsxs14(
|
|
2739
|
+
"div",
|
|
2740
|
+
{
|
|
2741
|
+
ref: floating.panelRef,
|
|
2742
|
+
className: cx(
|
|
2743
|
+
floatingSurface_default.sheet,
|
|
2744
|
+
floatingSurface_default.layer,
|
|
2745
|
+
overlayMotion_default.sheet,
|
|
2746
|
+
sheet_default.swipeY
|
|
2747
|
+
),
|
|
2748
|
+
"data-depth": "floating",
|
|
2749
|
+
"data-state": presence.state,
|
|
2750
|
+
onAnimationEnd: presence.onExitEnd,
|
|
2751
|
+
onPointerDown: floating.onSheetPointerDown,
|
|
2752
|
+
children: [
|
|
2753
|
+
/* @__PURE__ */ jsx25("div", { className: sheet_default.handle, "data-swipe-handle": "", "aria-hidden": "true" }),
|
|
2754
|
+
panel
|
|
2755
|
+
]
|
|
2756
|
+
}
|
|
2757
|
+
)
|
|
2758
|
+
] }) : panel }) }) }) });
|
|
2111
2759
|
}
|
|
2112
2760
|
function FloatingTrigger({ triggerProps, children, ...forwarded }) {
|
|
2113
|
-
return /* @__PURE__ */
|
|
2761
|
+
return /* @__PURE__ */ jsx25(Slot, { ...forwarded, children: /* @__PURE__ */ jsx25(Slot, { ...triggerProps, children }) });
|
|
2114
2762
|
}
|
|
2115
2763
|
|
|
2116
2764
|
// src/internal/overlay/useFloatingLayer.ts
|
|
2117
|
-
import * as
|
|
2765
|
+
import * as React31 from "react";
|
|
2766
|
+
|
|
2767
|
+
// src/hooks/useMediaQuery.ts
|
|
2768
|
+
import * as React26 from "react";
|
|
2769
|
+
var COMPACT_QUERY = "(max-width: 639px)";
|
|
2770
|
+
function useMediaQuery(query, enabled = true) {
|
|
2771
|
+
const subscribe = React26.useCallback(
|
|
2772
|
+
(onChange) => {
|
|
2773
|
+
if (!enabled || typeof window === "undefined" || !window.matchMedia) return () => {
|
|
2774
|
+
};
|
|
2775
|
+
const mq = window.matchMedia(query);
|
|
2776
|
+
mq.addEventListener("change", onChange);
|
|
2777
|
+
return () => mq.removeEventListener("change", onChange);
|
|
2778
|
+
},
|
|
2779
|
+
[enabled, query]
|
|
2780
|
+
);
|
|
2781
|
+
const getSnapshot = () => enabled && typeof window !== "undefined" && !!window.matchMedia ? window.matchMedia(query).matches : false;
|
|
2782
|
+
return React26.useSyncExternalStore(subscribe, getSnapshot, () => false);
|
|
2783
|
+
}
|
|
2118
2784
|
|
|
2119
2785
|
// src/hooks/usePosition.ts
|
|
2120
|
-
import * as
|
|
2786
|
+
import * as React28 from "react";
|
|
2121
2787
|
|
|
2122
2788
|
// src/internal/AnchorRectContext.tsx
|
|
2123
|
-
import * as
|
|
2124
|
-
var AnchorRectContext =
|
|
2789
|
+
import * as React27 from "react";
|
|
2790
|
+
var AnchorRectContext = React27.createContext(null);
|
|
2125
2791
|
var AnchorRectProvider = AnchorRectContext.Provider;
|
|
2126
2792
|
function useAnchorRectResolver() {
|
|
2127
|
-
return
|
|
2793
|
+
return React27.useContext(AnchorRectContext);
|
|
2128
2794
|
}
|
|
2129
2795
|
|
|
2130
2796
|
// src/internal/layoutPxFromPrimitives.ts
|
|
@@ -2249,11 +2915,11 @@ function usePosition(enabled, anchorRef, layerRef, {
|
|
|
2249
2915
|
offsetToken = "--prime-panel-offset",
|
|
2250
2916
|
arrowInset
|
|
2251
2917
|
} = {}) {
|
|
2252
|
-
const [attached, setAttached] =
|
|
2253
|
-
const [resolvedSide, setResolvedSide] =
|
|
2918
|
+
const [attached, setAttached] = React28.useState(false);
|
|
2919
|
+
const [resolvedSide, setResolvedSide] = React28.useState(preferredSide);
|
|
2254
2920
|
const resolveAnchorRect = useAnchorRectResolver();
|
|
2255
|
-
const metricsRef =
|
|
2256
|
-
const update =
|
|
2921
|
+
const metricsRef = React28.useRef(null);
|
|
2922
|
+
const update = React28.useCallback(
|
|
2257
2923
|
(remeasure) => {
|
|
2258
2924
|
const anchor = anchorRef.current;
|
|
2259
2925
|
const layer = layerRef.current;
|
|
@@ -2307,9 +2973,9 @@ function usePosition(enabled, anchorRef, layerRef, {
|
|
|
2307
2973
|
resolveAnchorRect
|
|
2308
2974
|
]
|
|
2309
2975
|
);
|
|
2310
|
-
const updateRef =
|
|
2976
|
+
const updateRef = React28.useRef(update);
|
|
2311
2977
|
updateRef.current = update;
|
|
2312
|
-
const attachLayer =
|
|
2978
|
+
const attachLayer = React28.useCallback(
|
|
2313
2979
|
(node) => {
|
|
2314
2980
|
layerRef.current = node;
|
|
2315
2981
|
setAttached(node !== null);
|
|
@@ -2317,10 +2983,10 @@ function usePosition(enabled, anchorRef, layerRef, {
|
|
|
2317
2983
|
[layerRef]
|
|
2318
2984
|
);
|
|
2319
2985
|
const active = enabled && attached;
|
|
2320
|
-
|
|
2986
|
+
React28.useLayoutEffect(() => {
|
|
2321
2987
|
if (active) update(true);
|
|
2322
2988
|
}, [active, update]);
|
|
2323
|
-
|
|
2989
|
+
React28.useLayoutEffect(() => {
|
|
2324
2990
|
if (!active) return;
|
|
2325
2991
|
let frame = 0;
|
|
2326
2992
|
let remeasure = false;
|
|
@@ -2354,53 +3020,158 @@ function usePosition(enabled, anchorRef, layerRef, {
|
|
|
2354
3020
|
return { side: resolvedSide, attachLayer };
|
|
2355
3021
|
}
|
|
2356
3022
|
|
|
2357
|
-
// src/hooks/
|
|
2358
|
-
import * as
|
|
2359
|
-
var
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
};
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
3023
|
+
// src/hooks/useScrollLock.ts
|
|
3024
|
+
import * as React29 from "react";
|
|
3025
|
+
var lockCount = 0;
|
|
3026
|
+
var saved = null;
|
|
3027
|
+
function lockScroll() {
|
|
3028
|
+
if (lockCount === 0) {
|
|
3029
|
+
const { body, documentElement } = document;
|
|
3030
|
+
const scrollbarWidth = window.innerWidth - documentElement.clientWidth;
|
|
3031
|
+
saved = { overflow: body.style.overflow, paddingRight: body.style.paddingRight };
|
|
3032
|
+
if (scrollbarWidth > 0) {
|
|
3033
|
+
const padding = Number.parseFloat(window.getComputedStyle(body).paddingRight) || 0;
|
|
3034
|
+
body.style.paddingRight = `${padding + scrollbarWidth}px`;
|
|
3035
|
+
}
|
|
3036
|
+
body.style.overflow = "hidden";
|
|
3037
|
+
}
|
|
3038
|
+
lockCount++;
|
|
3039
|
+
}
|
|
3040
|
+
function unlockScroll() {
|
|
3041
|
+
lockCount = Math.max(0, lockCount - 1);
|
|
3042
|
+
if (lockCount === 0 && saved) {
|
|
3043
|
+
document.body.style.overflow = saved.overflow;
|
|
3044
|
+
document.body.style.paddingRight = saved.paddingRight;
|
|
3045
|
+
saved = null;
|
|
3046
|
+
}
|
|
2367
3047
|
}
|
|
2368
|
-
function
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
3048
|
+
function useScrollLock(enabled) {
|
|
3049
|
+
React29.useEffect(() => {
|
|
3050
|
+
if (!enabled) return;
|
|
3051
|
+
lockScroll();
|
|
3052
|
+
return unlockScroll;
|
|
3053
|
+
}, [enabled]);
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3056
|
+
// src/hooks/useSwipeDismiss.ts
|
|
3057
|
+
import * as React30 from "react";
|
|
3058
|
+
var SLOP_PX = 8;
|
|
3059
|
+
var DISTANCE_RATIO = 0.3;
|
|
3060
|
+
var FLICK_VELOCITY = 0.5;
|
|
3061
|
+
var VELOCITY_WINDOW_MS = 100;
|
|
3062
|
+
var NO_DRAG = "input, textarea, select, [contenteditable], [role='slider']";
|
|
3063
|
+
var SWIPE_OFFSET_VAR = "--swipe-offset";
|
|
3064
|
+
var OVERPULL_PX = 24;
|
|
3065
|
+
function rubberBand(distance) {
|
|
3066
|
+
return -OVERPULL_PX * (1 - 1 / (1 + Math.abs(distance) / OVERPULL_PX));
|
|
3067
|
+
}
|
|
3068
|
+
function inCrossScroller(target, panel, horizontal) {
|
|
3069
|
+
for (let node = target; node && node !== panel; node = node.parentElement) {
|
|
3070
|
+
const style = getComputedStyle(node);
|
|
3071
|
+
const overflow = horizontal ? style.overflowX : style.overflowY;
|
|
3072
|
+
const scrolls = horizontal ? node.scrollWidth > node.clientWidth : node.scrollHeight > node.clientHeight;
|
|
3073
|
+
if (scrolls && (overflow === "auto" || overflow === "scroll")) return true;
|
|
3074
|
+
}
|
|
3075
|
+
return false;
|
|
2376
3076
|
}
|
|
2377
|
-
function
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
3077
|
+
function useSwipeDismiss({
|
|
3078
|
+
enabled,
|
|
3079
|
+
direction,
|
|
3080
|
+
onDismiss,
|
|
3081
|
+
handle,
|
|
3082
|
+
touchAnywhere = false,
|
|
3083
|
+
onProgress
|
|
3084
|
+
}) {
|
|
3085
|
+
const optionsRef = React30.useRef({ direction, onDismiss, handle, touchAnywhere, onProgress });
|
|
3086
|
+
optionsRef.current = { direction, onDismiss, handle, touchAnywhere, onProgress };
|
|
3087
|
+
const cleanupRef = React30.useRef(null);
|
|
3088
|
+
React30.useEffect(() => () => cleanupRef.current?.(), []);
|
|
3089
|
+
const onPointerDown2 = React30.useCallback(
|
|
3090
|
+
(event) => {
|
|
3091
|
+
if (!enabled || event.defaultPrevented || !event.isPrimary || event.button !== 0) return;
|
|
3092
|
+
const { direction: direction2, handle: handle2, touchAnywhere: touchAnywhere2 } = optionsRef.current;
|
|
3093
|
+
const panel = event.currentTarget;
|
|
3094
|
+
const target = event.target;
|
|
3095
|
+
if (target.closest(NO_DRAG)) return;
|
|
3096
|
+
const fromHandle = target.closest(handle2) !== null && panel.contains(target.closest(handle2));
|
|
3097
|
+
const horizontal = direction2 !== "down";
|
|
3098
|
+
if (!fromHandle) {
|
|
3099
|
+
if (!touchAnywhere2 || event.pointerType !== "touch") return;
|
|
3100
|
+
if (inCrossScroller(target, panel, horizontal)) return;
|
|
3101
|
+
}
|
|
3102
|
+
cleanupRef.current?.();
|
|
3103
|
+
const pointerId = event.pointerId;
|
|
3104
|
+
const sign = direction2 === "left" ? -1 : 1;
|
|
3105
|
+
const start = horizontal ? event.clientX : event.clientY;
|
|
3106
|
+
const startCross = horizontal ? event.clientY : event.clientX;
|
|
3107
|
+
let dragging = false;
|
|
3108
|
+
let offset = 0;
|
|
3109
|
+
let samples = [];
|
|
3110
|
+
const full = horizontal ? panel.offsetWidth : panel.offsetHeight;
|
|
3111
|
+
const write = (value, progress = full > 0 ? value / full : value > 0 ? 1 : 0) => {
|
|
3112
|
+
panel.style.setProperty(SWIPE_OFFSET_VAR, `${value * sign}px`);
|
|
3113
|
+
optionsRef.current.onProgress?.(Math.min(1, Math.max(0, progress)));
|
|
3114
|
+
};
|
|
3115
|
+
const finish = () => {
|
|
3116
|
+
window.removeEventListener("pointermove", onMove);
|
|
3117
|
+
window.removeEventListener("pointerup", onUp);
|
|
3118
|
+
window.removeEventListener("pointercancel", onCancel);
|
|
3119
|
+
cleanupRef.current = null;
|
|
3120
|
+
};
|
|
3121
|
+
const settle = (dismiss) => {
|
|
3122
|
+
delete panel.dataset.swiping;
|
|
3123
|
+
if (dismiss) {
|
|
3124
|
+
panel.dataset.swipeDismissed = "";
|
|
3125
|
+
write(full, 1);
|
|
3126
|
+
optionsRef.current.onDismiss();
|
|
3127
|
+
} else {
|
|
3128
|
+
write(0);
|
|
3129
|
+
}
|
|
3130
|
+
};
|
|
3131
|
+
const onMove = (move) => {
|
|
3132
|
+
if (move.pointerId !== pointerId) return;
|
|
3133
|
+
const along = ((horizontal ? move.clientX : move.clientY) - start) * sign;
|
|
3134
|
+
const across = (horizontal ? move.clientY : move.clientX) - startCross;
|
|
3135
|
+
if (!dragging) {
|
|
3136
|
+
if (Math.abs(along) < SLOP_PX && Math.abs(across) < SLOP_PX) return;
|
|
3137
|
+
if (Math.abs(across) > Math.abs(along) || !fromHandle && along < 0) {
|
|
3138
|
+
finish();
|
|
3139
|
+
return;
|
|
3140
|
+
}
|
|
3141
|
+
dragging = true;
|
|
3142
|
+
panel.dataset.swiping = "";
|
|
3143
|
+
panel.setPointerCapture?.(pointerId);
|
|
3144
|
+
}
|
|
3145
|
+
move.preventDefault();
|
|
3146
|
+
offset = along > 0 ? along : rubberBand(along);
|
|
3147
|
+
write(offset);
|
|
3148
|
+
const now = move.timeStamp;
|
|
3149
|
+
samples.push({ t: now, d: along });
|
|
3150
|
+
samples = samples.filter((s) => now - s.t <= VELOCITY_WINDOW_MS);
|
|
3151
|
+
};
|
|
3152
|
+
const onUp = (up) => {
|
|
3153
|
+
if (up.pointerId !== pointerId) return;
|
|
3154
|
+
finish();
|
|
3155
|
+
if (!dragging) return;
|
|
3156
|
+
const first = samples[0];
|
|
3157
|
+
const last = samples[samples.length - 1];
|
|
3158
|
+
const elapsed = first && last ? last.t - first.t : 0;
|
|
3159
|
+
const velocity = elapsed > 0 ? (last.d - first.d) / elapsed : 0;
|
|
3160
|
+
settle(offset > full * DISTANCE_RATIO || offset > SLOP_PX && velocity > FLICK_VELOCITY);
|
|
3161
|
+
};
|
|
3162
|
+
const onCancel = (cancel) => {
|
|
3163
|
+
if (cancel.pointerId !== pointerId) return;
|
|
3164
|
+
finish();
|
|
3165
|
+
if (dragging) settle(false);
|
|
3166
|
+
};
|
|
3167
|
+
window.addEventListener("pointermove", onMove, { passive: false });
|
|
3168
|
+
window.addEventListener("pointerup", onUp);
|
|
3169
|
+
window.addEventListener("pointercancel", onCancel);
|
|
3170
|
+
cleanupRef.current = finish;
|
|
3171
|
+
},
|
|
3172
|
+
[enabled]
|
|
2381
3173
|
);
|
|
2382
|
-
return
|
|
2383
|
-
}
|
|
2384
|
-
function exitTimeoutMs(token) {
|
|
2385
|
-
return motionDurationMs(token) + TIMEOUT_SLACK_MS;
|
|
2386
|
-
}
|
|
2387
|
-
function usePresence(open, options = {}) {
|
|
2388
|
-
const { exitDuration = "base" } = options;
|
|
2389
|
-
const [mounted, setMounted] = React22.useState(open);
|
|
2390
|
-
if (open && !mounted) setMounted(true);
|
|
2391
|
-
if (!open && mounted && prefersReducedMotion()) setMounted(false);
|
|
2392
|
-
const openRef = React22.useRef(open);
|
|
2393
|
-
openRef.current = open;
|
|
2394
|
-
React22.useEffect(() => {
|
|
2395
|
-
if (open || !mounted) return;
|
|
2396
|
-
const id = window.setTimeout(() => setMounted(false), exitTimeoutMs(exitDuration));
|
|
2397
|
-
return () => window.clearTimeout(id);
|
|
2398
|
-
}, [open, mounted, exitDuration]);
|
|
2399
|
-
const onExitEnd = React22.useCallback((event) => {
|
|
2400
|
-
if (event.target !== event.currentTarget) return;
|
|
2401
|
-
if (!openRef.current) setMounted(false);
|
|
2402
|
-
}, []);
|
|
2403
|
-
return { mounted: open || mounted, state: open ? "open" : "closed", onExitEnd };
|
|
3174
|
+
return { onPointerDown: onPointerDown2 };
|
|
2404
3175
|
}
|
|
2405
3176
|
|
|
2406
3177
|
// src/internal/overlay/useFloatingLayer.ts
|
|
@@ -2416,32 +3187,44 @@ function useFloatingLayer({
|
|
|
2416
3187
|
tabExit = "none",
|
|
2417
3188
|
exitDuration = "fast",
|
|
2418
3189
|
skipExit = false,
|
|
3190
|
+
sheet: sheetOption = false,
|
|
2419
3191
|
...positionOptions
|
|
2420
3192
|
}) {
|
|
2421
|
-
const
|
|
3193
|
+
const sheet = useMediaQuery(COMPACT_QUERY, sheetOption);
|
|
3194
|
+
const presence = usePresence(open, { exitDuration: sheet ? "base" : exitDuration });
|
|
2422
3195
|
const mounted = presence.mounted && (open || !skipExit);
|
|
2423
|
-
const contentRef =
|
|
2424
|
-
const position = usePosition(mounted, triggerRef, contentRef, positionOptions);
|
|
2425
|
-
|
|
3196
|
+
const contentRef = React31.useRef(null);
|
|
3197
|
+
const position = usePosition(mounted && !sheet, triggerRef, contentRef, positionOptions);
|
|
3198
|
+
useScrollLock(open && sheet);
|
|
3199
|
+
const [panel, setPanel] = React31.useState(null);
|
|
2426
3200
|
const { attachLayer } = position;
|
|
2427
|
-
const panelRef =
|
|
3201
|
+
const panelRef = React31.useCallback(
|
|
2428
3202
|
(node) => {
|
|
2429
3203
|
attachLayer(node);
|
|
2430
3204
|
setPanel(node);
|
|
2431
3205
|
},
|
|
2432
3206
|
[attachLayer]
|
|
2433
3207
|
);
|
|
2434
|
-
const outsideRef =
|
|
2435
|
-
const close =
|
|
3208
|
+
const outsideRef = React31.useRef(false);
|
|
3209
|
+
const close = React31.useCallback(() => {
|
|
2436
3210
|
outsideRef.current = false;
|
|
2437
3211
|
onOpenChange(false);
|
|
2438
3212
|
}, [onOpenChange]);
|
|
3213
|
+
const dismissOutside = React31.useCallback(() => {
|
|
3214
|
+
outsideRef.current = true;
|
|
3215
|
+
onOpenChange(false);
|
|
3216
|
+
}, [onOpenChange]);
|
|
3217
|
+
const swipe = useSwipeDismiss({
|
|
3218
|
+
enabled: sheet && open && closeOnOutsideClick,
|
|
3219
|
+
direction: "down",
|
|
3220
|
+
onDismiss: dismissOutside,
|
|
3221
|
+
handle: "[data-swipe-handle]"
|
|
3222
|
+
});
|
|
2439
3223
|
const onDismiss = (reason) => {
|
|
2440
3224
|
if (reason === "escape") {
|
|
2441
3225
|
if (closeOnEscape) close();
|
|
2442
3226
|
} else if (closeOnOutsideClick) {
|
|
2443
|
-
|
|
2444
|
-
onOpenChange(false);
|
|
3227
|
+
dismissOutside();
|
|
2445
3228
|
}
|
|
2446
3229
|
};
|
|
2447
3230
|
const layer = useLayer(open, {
|
|
@@ -2451,7 +3234,7 @@ function useFloatingLayer({
|
|
|
2451
3234
|
onDismiss
|
|
2452
3235
|
});
|
|
2453
3236
|
const passive = dismiss === "none";
|
|
2454
|
-
|
|
3237
|
+
React31.useEffect(() => {
|
|
2455
3238
|
if (!open || !panel || passive) return;
|
|
2456
3239
|
outsideRef.current = false;
|
|
2457
3240
|
if (focusOnOpen) focusInto(panel);
|
|
@@ -2482,6 +3265,8 @@ function useFloatingLayer({
|
|
|
2482
3265
|
presence,
|
|
2483
3266
|
mounted,
|
|
2484
3267
|
side: position.side,
|
|
3268
|
+
sheet,
|
|
3269
|
+
onSheetPointerDown: swipe.onPointerDown,
|
|
2485
3270
|
panelRef,
|
|
2486
3271
|
contentRef,
|
|
2487
3272
|
layer,
|
|
@@ -2510,15 +3295,14 @@ var Select_default = {
|
|
|
2510
3295
|
itemTitle: "Select_itemTitle",
|
|
2511
3296
|
itemDescription: "Select_itemDescription",
|
|
2512
3297
|
itemMeta: "Select_itemMeta",
|
|
2513
|
-
media: "Select_media"
|
|
2514
|
-
check: "Select_check"
|
|
3298
|
+
media: "Select_media"
|
|
2515
3299
|
};
|
|
2516
3300
|
|
|
2517
3301
|
// src/components/select/SelectItem.tsx
|
|
2518
|
-
import * as
|
|
3302
|
+
import * as React33 from "react";
|
|
2519
3303
|
|
|
2520
3304
|
// src/internal/HighlightMatch.tsx
|
|
2521
|
-
import * as
|
|
3305
|
+
import * as React32 from "react";
|
|
2522
3306
|
|
|
2523
3307
|
// src/internal/HighlightMatch.module.css
|
|
2524
3308
|
var HighlightMatch_default = {
|
|
@@ -2526,7 +3310,7 @@ var HighlightMatch_default = {
|
|
|
2526
3310
|
};
|
|
2527
3311
|
|
|
2528
3312
|
// src/internal/HighlightMatch.tsx
|
|
2529
|
-
import { Fragment as
|
|
3313
|
+
import { Fragment as Fragment8, jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2530
3314
|
function matchIndex(text, query) {
|
|
2531
3315
|
if (!query) return -1;
|
|
2532
3316
|
return text.toLowerCase().indexOf(query.toLowerCase());
|
|
@@ -2534,18 +3318,18 @@ function matchIndex(text, query) {
|
|
|
2534
3318
|
function HighlightMatch({ text, query }) {
|
|
2535
3319
|
const q = query.trim();
|
|
2536
3320
|
const at = matchIndex(text, q);
|
|
2537
|
-
if (at < 0) return /* @__PURE__ */
|
|
2538
|
-
return /* @__PURE__ */
|
|
3321
|
+
if (at < 0) return /* @__PURE__ */ jsx26(Fragment8, { children: text });
|
|
3322
|
+
return /* @__PURE__ */ jsxs15("span", { children: [
|
|
2539
3323
|
text.slice(0, at),
|
|
2540
|
-
/* @__PURE__ */
|
|
3324
|
+
/* @__PURE__ */ jsx26("mark", { className: HighlightMatch_default.match, children: text.slice(at, at + q.length) }),
|
|
2541
3325
|
text.slice(at + q.length)
|
|
2542
3326
|
] });
|
|
2543
3327
|
}
|
|
2544
3328
|
function highlightChildren(children, query) {
|
|
2545
3329
|
if (!query.trim()) return children;
|
|
2546
|
-
return
|
|
3330
|
+
return React32.Children.map(
|
|
2547
3331
|
children,
|
|
2548
|
-
(child) => typeof child === "string" || typeof child === "number" ? /* @__PURE__ */
|
|
3332
|
+
(child) => typeof child === "string" || typeof child === "number" ? /* @__PURE__ */ jsx26(HighlightMatch, { text: String(child), query }) : child
|
|
2549
3333
|
);
|
|
2550
3334
|
}
|
|
2551
3335
|
|
|
@@ -2579,24 +3363,24 @@ function createItemRegistry() {
|
|
|
2579
3363
|
var [SelectProvider, useSelectContext] = createComponentContext("Select");
|
|
2580
3364
|
|
|
2581
3365
|
// src/components/select/SelectItem.tsx
|
|
2582
|
-
import { jsx as
|
|
3366
|
+
import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2583
3367
|
var MEDIA_SIZE = { xs: "xs", s: "xs", m: "s", l: "s", xl: "m" };
|
|
2584
3368
|
function textOf(node) {
|
|
2585
3369
|
if (node == null || typeof node === "boolean") return "";
|
|
2586
3370
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
2587
3371
|
if (Array.isArray(node)) return node.map(textOf).join("");
|
|
2588
|
-
if (
|
|
3372
|
+
if (React33.isValidElement(node))
|
|
2589
3373
|
return textOf(node.props.children);
|
|
2590
3374
|
return "";
|
|
2591
3375
|
}
|
|
2592
3376
|
function SelectItemIcon({ className, ...rest }) {
|
|
2593
|
-
return /* @__PURE__ */
|
|
3377
|
+
return /* @__PURE__ */ jsx27("span", { "aria-hidden": "true", className: cx(menu_default.itemIcon, className), ...rest });
|
|
2594
3378
|
}
|
|
2595
3379
|
SelectItemIcon.displayName = "Select.ItemIcon";
|
|
2596
|
-
var OptionQueryContext =
|
|
3380
|
+
var OptionQueryContext = React33.createContext("");
|
|
2597
3381
|
function SelectItemText({ children, className, ...rest }) {
|
|
2598
|
-
const query =
|
|
2599
|
-
return /* @__PURE__ */
|
|
3382
|
+
const query = React33.useContext(OptionQueryContext);
|
|
3383
|
+
return /* @__PURE__ */ jsx27("span", { ...rest, className: cx(Select_default.itemTitle, className), children: highlightChildren(children, query) });
|
|
2600
3384
|
}
|
|
2601
3385
|
SelectItemText.displayName = "Select.ItemText";
|
|
2602
3386
|
function SelectItemDescription({
|
|
@@ -2604,12 +3388,12 @@ function SelectItemDescription({
|
|
|
2604
3388
|
className,
|
|
2605
3389
|
...rest
|
|
2606
3390
|
}) {
|
|
2607
|
-
const query =
|
|
2608
|
-
return /* @__PURE__ */
|
|
3391
|
+
const query = React33.useContext(OptionQueryContext);
|
|
3392
|
+
return /* @__PURE__ */ jsx27("span", { ...rest, className: cx(Select_default.itemDescription, className), children: highlightChildren(children, query) });
|
|
2609
3393
|
}
|
|
2610
3394
|
SelectItemDescription.displayName = "Select.ItemDescription";
|
|
2611
3395
|
function SelectItemMeta({ children, className, ...rest }) {
|
|
2612
|
-
return /* @__PURE__ */
|
|
3396
|
+
return /* @__PURE__ */ jsx27("span", { ...rest, className: cx(Select_default.itemMeta, className), children });
|
|
2613
3397
|
}
|
|
2614
3398
|
SelectItemMeta.displayName = "Select.ItemMeta";
|
|
2615
3399
|
function splitItemChildren(children) {
|
|
@@ -2622,11 +3406,11 @@ function splitItemChildren(children) {
|
|
|
2622
3406
|
description: ""
|
|
2623
3407
|
};
|
|
2624
3408
|
let plain = "";
|
|
2625
|
-
for (const child of
|
|
2626
|
-
if (!
|
|
3409
|
+
for (const child of React33.Children.toArray(children)) {
|
|
3410
|
+
if (!React33.isValidElement(child)) {
|
|
2627
3411
|
plain += textOf(child);
|
|
2628
3412
|
parts.body.push(child);
|
|
2629
|
-
} else if (child.type ===
|
|
3413
|
+
} else if (child.type === React33.Fragment) {
|
|
2630
3414
|
const inner = splitItemChildren(child.props.children);
|
|
2631
3415
|
parts.leading.push(...inner.leading);
|
|
2632
3416
|
parts.body.push(...inner.body);
|
|
@@ -2656,7 +3440,7 @@ function splitItemChildren(children) {
|
|
|
2656
3440
|
}
|
|
2657
3441
|
function sizeMedia(leading, size) {
|
|
2658
3442
|
return leading.map(
|
|
2659
|
-
(node) =>
|
|
3443
|
+
(node) => React33.isValidElement(node) && node.type === Thumbnail.Root ? React33.cloneElement(node, {
|
|
2660
3444
|
size: node.props.size ?? MEDIA_SIZE[size],
|
|
2661
3445
|
className: cx(Select_default.media, node.props.className),
|
|
2662
3446
|
"aria-hidden": true
|
|
@@ -2678,7 +3462,7 @@ function SelectItem({
|
|
|
2678
3462
|
const haystack = normalize(`${resolvedLabel} ${parts.description} ${keywords ?? ""}`);
|
|
2679
3463
|
const isSelected = selected.includes(value);
|
|
2680
3464
|
const isHighlighted = useStoreSlice(highlight, (current) => current === value);
|
|
2681
|
-
|
|
3465
|
+
React33.useLayoutEffect(
|
|
2682
3466
|
() => registry.register(value, resolvedLabel, haystack),
|
|
2683
3467
|
[registry, value, resolvedLabel, haystack]
|
|
2684
3468
|
);
|
|
@@ -2687,7 +3471,7 @@ function SelectItem({
|
|
|
2687
3471
|
return (
|
|
2688
3472
|
// biome-ignore lint/a11y/useFocusableInteractive: focus stays on the listbox / search (aria-activedescendant)
|
|
2689
3473
|
// biome-ignore lint/a11y/useKeyWithClickEvents: the keyboard is handled on the listbox
|
|
2690
|
-
/* @__PURE__ */
|
|
3474
|
+
/* @__PURE__ */ jsxs16(
|
|
2691
3475
|
"div",
|
|
2692
3476
|
{
|
|
2693
3477
|
ref,
|
|
@@ -2711,11 +3495,11 @@ function SelectItem({
|
|
|
2711
3495
|
rich: parts.rich || void 0
|
|
2712
3496
|
}),
|
|
2713
3497
|
children: [
|
|
2714
|
-
multiple ? /* @__PURE__ */
|
|
3498
|
+
multiple ? /* @__PURE__ */ jsx27(Checkbox.Indicator, { checked: isSelected, disabled, size: stepDown(size) }) : null,
|
|
2715
3499
|
sizeMedia(parts.leading, size),
|
|
2716
|
-
/* @__PURE__ */
|
|
3500
|
+
/* @__PURE__ */ jsx27("span", { className: Select_default.itemText, children: /* @__PURE__ */ jsx27(OptionQueryContext.Provider, { value: query, children: highlightChildren(parts.body, query) }) }),
|
|
2717
3501
|
parts.meta,
|
|
2718
|
-
multiple ? null : /* @__PURE__ */
|
|
3502
|
+
multiple ? null : /* @__PURE__ */ jsx27("span", { className: menu_default.check, "aria-hidden": "true", children: isSelected ? /* @__PURE__ */ jsx27(Icon, { name: "action.check" }) : null })
|
|
2719
3503
|
]
|
|
2720
3504
|
}
|
|
2721
3505
|
)
|
|
@@ -2724,7 +3508,7 @@ function SelectItem({
|
|
|
2724
3508
|
SelectItem.displayName = "Select.Item";
|
|
2725
3509
|
|
|
2726
3510
|
// src/components/select/Select.tsx
|
|
2727
|
-
import { jsx as
|
|
3511
|
+
import { jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2728
3512
|
var SELECT_LABELS = {
|
|
2729
3513
|
search: "\u041F\u043E\u0438\u0441\u043A",
|
|
2730
3514
|
empty: "\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",
|
|
@@ -2761,14 +3545,14 @@ function SelectRoot(props) {
|
|
|
2761
3545
|
...rest
|
|
2762
3546
|
} = props;
|
|
2763
3547
|
const multiple = props.multiple === true;
|
|
2764
|
-
const labels =
|
|
3548
|
+
const labels = React34.useMemo(() => ({ ...SELECT_LABELS, ...labelsProp }), [labelsProp]);
|
|
2765
3549
|
const ids = useFieldFrame(id, { hint, error, invalid });
|
|
2766
3550
|
const [value, setValue] = useControllableState({
|
|
2767
3551
|
value: props.value,
|
|
2768
3552
|
defaultValue: props.defaultValue ?? (multiple ? [] : void 0),
|
|
2769
3553
|
onChange: props.onValueChange
|
|
2770
3554
|
});
|
|
2771
|
-
const selected =
|
|
3555
|
+
const selected = React34.useMemo(
|
|
2772
3556
|
() => Array.isArray(value) ? value : value ? [value] : [],
|
|
2773
3557
|
[value]
|
|
2774
3558
|
);
|
|
@@ -2778,11 +3562,11 @@ function SelectRoot(props) {
|
|
|
2778
3562
|
onChange: onOpenChange
|
|
2779
3563
|
});
|
|
2780
3564
|
const highlight = useCreateStore(void 0);
|
|
2781
|
-
const [registry] =
|
|
2782
|
-
const [query, setQuery] =
|
|
2783
|
-
const triggerRef =
|
|
3565
|
+
const [registry] = React34.useState(createItemRegistry);
|
|
3566
|
+
const [query, setQuery] = React34.useState("");
|
|
3567
|
+
const triggerRef = React34.useRef(null);
|
|
2784
3568
|
if (!isOpen && query !== "") setQuery("");
|
|
2785
|
-
const pick =
|
|
3569
|
+
const pick = React34.useCallback(
|
|
2786
3570
|
(optionValue) => {
|
|
2787
3571
|
if (multiple) {
|
|
2788
3572
|
setValue((prev) => {
|
|
@@ -2796,8 +3580,8 @@ function SelectRoot(props) {
|
|
|
2796
3580
|
},
|
|
2797
3581
|
[multiple, setValue, setOpen]
|
|
2798
3582
|
);
|
|
2799
|
-
const clear =
|
|
2800
|
-
const context =
|
|
3583
|
+
const clear = React34.useCallback(() => setValue(multiple ? [] : ""), [multiple, setValue]);
|
|
3584
|
+
const context = React34.useMemo(
|
|
2801
3585
|
() => ({
|
|
2802
3586
|
size,
|
|
2803
3587
|
invalid: ids.invalid,
|
|
@@ -2846,7 +3630,7 @@ function SelectRoot(props) {
|
|
|
2846
3630
|
labels
|
|
2847
3631
|
]
|
|
2848
3632
|
);
|
|
2849
|
-
return /* @__PURE__ */
|
|
3633
|
+
return /* @__PURE__ */ jsx28(
|
|
2850
3634
|
FieldFrame,
|
|
2851
3635
|
{
|
|
2852
3636
|
...rest,
|
|
@@ -2860,7 +3644,7 @@ function SelectRoot(props) {
|
|
|
2860
3644
|
disabled,
|
|
2861
3645
|
optionalLabel: labels.optional,
|
|
2862
3646
|
className,
|
|
2863
|
-
children: /* @__PURE__ */
|
|
3647
|
+
children: /* @__PURE__ */ jsx28(SelectProvider, { value: context, children: /* @__PURE__ */ jsx28(ControlSizeProvider, { value: size, children }) })
|
|
2864
3648
|
}
|
|
2865
3649
|
);
|
|
2866
3650
|
}
|
|
@@ -2894,7 +3678,7 @@ function SelectTrigger({
|
|
|
2894
3678
|
} = useSelectContext();
|
|
2895
3679
|
const mergedRef = useMergedRefs(triggerRef, ref);
|
|
2896
3680
|
const showClear = clearable && selected.length > 0 && !disabled && !loading;
|
|
2897
|
-
return /* @__PURE__ */
|
|
3681
|
+
return /* @__PURE__ */ jsxs17(
|
|
2898
3682
|
"button",
|
|
2899
3683
|
{
|
|
2900
3684
|
...rest,
|
|
@@ -2935,11 +3719,11 @@ function SelectTrigger({
|
|
|
2935
3719
|
"focus-ring": focusRing ? void 0 : false
|
|
2936
3720
|
}),
|
|
2937
3721
|
children: [
|
|
2938
|
-
/* @__PURE__ */
|
|
3722
|
+
/* @__PURE__ */ jsx28("span", { className: Select_default.triggerMain, children }),
|
|
2939
3723
|
showClear ? (
|
|
2940
3724
|
// A segment, not a button: interactive content inside a <button> is invalid. The keyboard
|
|
2941
3725
|
// clears with Delete / Backspace on the trigger.
|
|
2942
|
-
/* @__PURE__ */
|
|
3726
|
+
/* @__PURE__ */ jsx28(
|
|
2943
3727
|
"span",
|
|
2944
3728
|
{
|
|
2945
3729
|
className: Select_default.clear,
|
|
@@ -2951,11 +3735,11 @@ function SelectTrigger({
|
|
|
2951
3735
|
event.stopPropagation();
|
|
2952
3736
|
clear();
|
|
2953
3737
|
},
|
|
2954
|
-
children: /* @__PURE__ */
|
|
3738
|
+
children: /* @__PURE__ */ jsx28(Icon, { name: "action.close" })
|
|
2955
3739
|
}
|
|
2956
3740
|
)
|
|
2957
3741
|
) : null,
|
|
2958
|
-
/* @__PURE__ */
|
|
3742
|
+
/* @__PURE__ */ jsx28("span", { className: Select_default.chevron, "aria-hidden": "true", children: loading ? /* @__PURE__ */ jsx28(Spinner, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx28(Icon, { name: "nav.chevronDown" }) })
|
|
2959
3743
|
]
|
|
2960
3744
|
}
|
|
2961
3745
|
);
|
|
@@ -2967,7 +3751,7 @@ function SelectValue({ renderValue, className, ...rest }) {
|
|
|
2967
3751
|
if (selected.length > 0 && renderValue && !multiple) {
|
|
2968
3752
|
const value = selected[0] ?? "";
|
|
2969
3753
|
const parts = splitItemChildren(renderValue({ value, label: text }));
|
|
2970
|
-
return /* @__PURE__ */
|
|
3754
|
+
return /* @__PURE__ */ jsxs17(
|
|
2971
3755
|
"span",
|
|
2972
3756
|
{
|
|
2973
3757
|
...rest,
|
|
@@ -2975,12 +3759,12 @@ function SelectValue({ renderValue, className, ...rest }) {
|
|
|
2975
3759
|
...toDataAttributes({ rich: parts.rich || void 0 }),
|
|
2976
3760
|
children: [
|
|
2977
3761
|
sizeMedia(parts.leading, size),
|
|
2978
|
-
/* @__PURE__ */
|
|
3762
|
+
/* @__PURE__ */ jsx28("span", { className: Select_default.valueBody, children: parts.body })
|
|
2979
3763
|
]
|
|
2980
3764
|
}
|
|
2981
3765
|
);
|
|
2982
3766
|
}
|
|
2983
|
-
return /* @__PURE__ */
|
|
3767
|
+
return /* @__PURE__ */ jsx28(
|
|
2984
3768
|
"span",
|
|
2985
3769
|
{
|
|
2986
3770
|
...rest,
|
|
@@ -2992,7 +3776,7 @@ function SelectValue({ renderValue, className, ...rest }) {
|
|
|
2992
3776
|
}
|
|
2993
3777
|
SelectValue.displayName = "Select.Value";
|
|
2994
3778
|
function SelectTriggerIcon({ className, ...rest }) {
|
|
2995
|
-
return /* @__PURE__ */
|
|
3779
|
+
return /* @__PURE__ */ jsx28("span", { "aria-hidden": "true", className: cx(Select_default.triggerIcon, className), ...rest });
|
|
2996
3780
|
}
|
|
2997
3781
|
SelectTriggerIcon.displayName = "Select.TriggerIcon";
|
|
2998
3782
|
function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
@@ -3012,7 +3796,7 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
3012
3796
|
labels,
|
|
3013
3797
|
registry
|
|
3014
3798
|
} = useSelectContext();
|
|
3015
|
-
const listboxRef =
|
|
3799
|
+
const listboxRef = React34.useRef(null);
|
|
3016
3800
|
const floating = useFloatingLayer({
|
|
3017
3801
|
open: isOpen,
|
|
3018
3802
|
onOpenChange: setOpen,
|
|
@@ -3021,7 +3805,8 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
3021
3805
|
align: "start",
|
|
3022
3806
|
matchAnchorWidth: true,
|
|
3023
3807
|
focusOnOpen: true,
|
|
3024
|
-
tabExit: "always"
|
|
3808
|
+
tabExit: "always",
|
|
3809
|
+
sheet: true
|
|
3025
3810
|
});
|
|
3026
3811
|
const highlighted = useStoreSlice(highlight, (value) => value);
|
|
3027
3812
|
const isEmpty = useStoreSlice(registry.version, () => !registry.anyMatch(normalize(query)));
|
|
@@ -3042,9 +3827,9 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
3042
3827
|
}
|
|
3043
3828
|
handleListboxKeyDown(event, { items, highlight, onSelect: pick });
|
|
3044
3829
|
};
|
|
3045
|
-
if (!floating.mounted) return /* @__PURE__ */
|
|
3830
|
+
if (!floating.mounted) return /* @__PURE__ */ jsx28("div", { hidden: true, children });
|
|
3046
3831
|
const activeDescendant = isOpen && highlighted !== void 0 ? optionDomId(listboxId, highlighted) : void 0;
|
|
3047
|
-
return /* @__PURE__ */
|
|
3832
|
+
return /* @__PURE__ */ jsxs17(
|
|
3048
3833
|
FloatingPanel,
|
|
3049
3834
|
{
|
|
3050
3835
|
...rest,
|
|
@@ -3056,9 +3841,9 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
3056
3841
|
children: [
|
|
3057
3842
|
searchable ? (
|
|
3058
3843
|
// The permanent focus of the panel: no ring, the caret is the indicator (foundation §7).
|
|
3059
|
-
/* @__PURE__ */
|
|
3060
|
-
/* @__PURE__ */
|
|
3061
|
-
/* @__PURE__ */
|
|
3844
|
+
/* @__PURE__ */ jsxs17("div", { className: cx(menu_default.searchRow, Select_default.search), "data-focus-ring": "false", children: [
|
|
3845
|
+
/* @__PURE__ */ jsx28(Icon, { name: "action.search", size: "s" }),
|
|
3846
|
+
/* @__PURE__ */ jsx28(
|
|
3062
3847
|
"input",
|
|
3063
3848
|
{
|
|
3064
3849
|
type: "text",
|
|
@@ -3077,11 +3862,11 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
3077
3862
|
)
|
|
3078
3863
|
] })
|
|
3079
3864
|
) : null,
|
|
3080
|
-
loading ? /* @__PURE__ */
|
|
3081
|
-
/* @__PURE__ */
|
|
3865
|
+
loading ? /* @__PURE__ */ jsxs17("div", { className: Select_default.status, role: "status", children: [
|
|
3866
|
+
/* @__PURE__ */ jsx28(Spinner, { "aria-hidden": "true" }),
|
|
3082
3867
|
labels.loading
|
|
3083
3868
|
] }) : null,
|
|
3084
|
-
/* @__PURE__ */
|
|
3869
|
+
/* @__PURE__ */ jsx28(
|
|
3085
3870
|
ScrollContainer,
|
|
3086
3871
|
{
|
|
3087
3872
|
ref: listboxRef,
|
|
@@ -3097,11 +3882,11 @@ function SelectContent({ searchable = false, className, children, ...rest }) {
|
|
|
3097
3882
|
children
|
|
3098
3883
|
}
|
|
3099
3884
|
),
|
|
3100
|
-
isEmpty && !loading ? /* @__PURE__ */
|
|
3101
|
-
/* @__PURE__ */
|
|
3102
|
-
query !== "" && labels.emptyHint ? /* @__PURE__ */
|
|
3885
|
+
isEmpty && !loading ? /* @__PURE__ */ jsxs17(EmptyPage.Root, { layout: "compact", role: "status", children: [
|
|
3886
|
+
/* @__PURE__ */ jsx28(EmptyPage.Title, { as: "p", children: labels.empty }),
|
|
3887
|
+
query !== "" && labels.emptyHint ? /* @__PURE__ */ jsx28(EmptyPage.Description, { children: labels.emptyHint }) : null
|
|
3103
3888
|
] }) : null,
|
|
3104
|
-
/* @__PURE__ */
|
|
3889
|
+
/* @__PURE__ */ jsx28(HighlightOnOpen, { listboxRef, highlight })
|
|
3105
3890
|
]
|
|
3106
3891
|
}
|
|
3107
3892
|
);
|
|
@@ -3112,9 +3897,9 @@ function HighlightOnOpen({
|
|
|
3112
3897
|
highlight
|
|
3113
3898
|
}) {
|
|
3114
3899
|
const { isOpen, query, selected } = useSelectContext();
|
|
3115
|
-
const selectedRef =
|
|
3900
|
+
const selectedRef = React34.useRef(selected);
|
|
3116
3901
|
selectedRef.current = selected;
|
|
3117
|
-
|
|
3902
|
+
React34.useLayoutEffect(() => {
|
|
3118
3903
|
if (!isOpen) return;
|
|
3119
3904
|
const options = enabledOptions(listboxRef.current);
|
|
3120
3905
|
const first = options.find((item) => selectedRef.current.includes(item.dataset.value ?? ""));
|
|
@@ -3122,17 +3907,17 @@ function HighlightOnOpen({
|
|
|
3122
3907
|
first?.scrollIntoView?.({ block: "nearest" });
|
|
3123
3908
|
return () => highlight.set(void 0);
|
|
3124
3909
|
}, [isOpen, listboxRef, highlight]);
|
|
3125
|
-
|
|
3910
|
+
React34.useLayoutEffect(() => {
|
|
3126
3911
|
if (query !== "") highlight.set(enabledOptions(listboxRef.current)[0]?.dataset.value);
|
|
3127
3912
|
}, [query, listboxRef, highlight]);
|
|
3128
3913
|
return null;
|
|
3129
3914
|
}
|
|
3130
3915
|
function SelectGroup({ className, ...rest }) {
|
|
3131
|
-
return /* @__PURE__ */
|
|
3916
|
+
return /* @__PURE__ */ jsx28(MenuGroup, { ...rest, className: cx(Select_default.group, className) });
|
|
3132
3917
|
}
|
|
3133
3918
|
SelectGroup.displayName = "Select.Group";
|
|
3134
3919
|
function SelectSeparator({ className, ...rest }) {
|
|
3135
|
-
return /* @__PURE__ */
|
|
3920
|
+
return /* @__PURE__ */ jsx28(Divider, { ...rest, className: cx(menu_default.separator, Select_default.separator, className) });
|
|
3136
3921
|
}
|
|
3137
3922
|
SelectSeparator.displayName = "Select.Separator";
|
|
3138
3923
|
var Select = {
|
|
@@ -3154,28 +3939,40 @@ export {
|
|
|
3154
3939
|
ControlSizeProvider,
|
|
3155
3940
|
useOptionalControlSize,
|
|
3156
3941
|
useControlSize,
|
|
3157
|
-
useMergedRefs,
|
|
3158
3942
|
cx,
|
|
3159
3943
|
toDataAttributes,
|
|
3160
|
-
ScrollContainer,
|
|
3161
|
-
createComponentContext,
|
|
3162
|
-
createImageSlot,
|
|
3163
|
-
palette_default,
|
|
3164
|
-
textTone_default,
|
|
3165
|
-
Icon,
|
|
3166
|
-
createIcon,
|
|
3167
3944
|
fieldSurfaceClass,
|
|
3168
3945
|
fieldTierClass,
|
|
3169
3946
|
fieldTriggerClass,
|
|
3170
3947
|
iconLayout,
|
|
3171
|
-
|
|
3948
|
+
prefersReducedMotion,
|
|
3949
|
+
motionDurationMs,
|
|
3950
|
+
exitTimeoutMs,
|
|
3951
|
+
usePresence,
|
|
3172
3952
|
visuallyHiddenClass,
|
|
3173
3953
|
VisuallyHidden,
|
|
3954
|
+
useMergedRefs,
|
|
3955
|
+
Slot,
|
|
3956
|
+
touchTargetBlockClass,
|
|
3957
|
+
textTone_default,
|
|
3174
3958
|
Spinner,
|
|
3175
3959
|
Button,
|
|
3960
|
+
Divider,
|
|
3961
|
+
Icon,
|
|
3962
|
+
createIcon,
|
|
3963
|
+
useEdgeOverflow,
|
|
3964
|
+
ScrollContainer,
|
|
3965
|
+
palette_default,
|
|
3966
|
+
RollingNumber,
|
|
3967
|
+
createComponentContext,
|
|
3968
|
+
createImageSlot,
|
|
3176
3969
|
useControllableState,
|
|
3177
3970
|
overlayMotion_default,
|
|
3178
3971
|
Portal,
|
|
3972
|
+
sheet_default,
|
|
3973
|
+
useNestedSurfaceDepth,
|
|
3974
|
+
SurfaceDepthProvider,
|
|
3975
|
+
useStageDepth,
|
|
3179
3976
|
focusInto,
|
|
3180
3977
|
focusBack,
|
|
3181
3978
|
activeElement,
|
|
@@ -3183,13 +3980,13 @@ export {
|
|
|
3183
3980
|
useLayer,
|
|
3184
3981
|
FloatingPanel,
|
|
3185
3982
|
FloatingTrigger,
|
|
3983
|
+
COMPACT_QUERY,
|
|
3984
|
+
useMediaQuery,
|
|
3186
3985
|
AnchorRectProvider,
|
|
3187
3986
|
readCssLengthPx,
|
|
3188
3987
|
getViewportPadPx,
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
exitTimeoutMs,
|
|
3192
|
-
usePresence,
|
|
3988
|
+
useScrollLock,
|
|
3989
|
+
useSwipeDismiss,
|
|
3193
3990
|
useFloatingLayer,
|
|
3194
3991
|
rovingIndex,
|
|
3195
3992
|
gridIndex,
|
|
@@ -3232,7 +4029,11 @@ export {
|
|
|
3232
4029
|
handleListboxKeyDown,
|
|
3233
4030
|
menu_default,
|
|
3234
4031
|
MenuGroup,
|
|
3235
|
-
|
|
4032
|
+
resolveValue,
|
|
4033
|
+
DEFAULT_PROGRESS_SEGMENTS_LABELS,
|
|
4034
|
+
resolveSegments,
|
|
4035
|
+
ProgressBar,
|
|
4036
|
+
getPasswordStrength,
|
|
3236
4037
|
Input,
|
|
3237
4038
|
Thumbnail,
|
|
3238
4039
|
Select
|