@exponential_app/eui-react 0.0.0-stage → 0.2.1
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/LICENSE +201 -0
- package/NOTICE +54 -0
- package/README.md +360 -2
- package/dist/chunks/index-5yzzfez5.js +126 -0
- package/dist/chunks/index-5yzzfez5.js.map +11 -0
- package/dist/exponential-ui-react.css +2 -0
- package/dist/index.js +7700 -0
- package/dist/index.js.map +46 -0
- package/dist/primitives/index.js +3154 -0
- package/dist/primitives/index.js.map +59 -0
- package/dist/types/context.d.ts +96 -0
- package/dist/types/extensions.d.ts +25 -0
- package/dist/types/form.d.ts +65 -0
- package/dist/types/host-surface.d.ts +32 -0
- package/dist/types/host.d.ts +37 -0
- package/dist/types/icons.d.ts +31 -0
- package/dist/types/index.d.ts +37 -0
- package/dist/types/inputs.d.ts +25 -0
- package/dist/types/list.d.ts +31 -0
- package/dist/types/live.d.ts +18 -0
- package/dist/types/markdown.d.ts +9 -0
- package/dist/types/media.d.ts +15 -0
- package/dist/types/natives/actions.d.ts +10 -0
- package/dist/types/natives/bound.d.ts +2 -0
- package/dist/types/natives/chart.d.ts +2 -0
- package/dist/types/natives/chips.d.ts +5 -0
- package/dist/types/natives/choice-tiles.d.ts +2 -0
- package/dist/types/natives/code.d.ts +2 -0
- package/dist/types/natives/dates.d.ts +29 -0
- package/dist/types/natives/feedback.d.ts +29 -0
- package/dist/types/natives/index.d.ts +4 -0
- package/dist/types/natives/inputs.d.ts +19 -0
- package/dist/types/natives/layout.d.ts +15 -0
- package/dist/types/natives/listbox.d.ts +15 -0
- package/dist/types/natives/media.d.ts +13 -0
- package/dist/types/natives/nav.d.ts +17 -0
- package/dist/types/natives/overlays.d.ts +17 -0
- package/dist/types/natives/qr.d.ts +3 -0
- package/dist/types/natives/resizable.d.ts +2 -0
- package/dist/types/natives/search.d.ts +46 -0
- package/dist/types/natives/select.d.ts +8 -0
- package/dist/types/natives/shared.d.ts +35 -0
- package/dist/types/natives/table.d.ts +5 -0
- package/dist/types/natives/text.d.ts +4 -0
- package/dist/types/node-view.d.ts +73 -0
- package/dist/types/platform.d.ts +12 -0
- package/dist/types/primitives/alert-dialog.d.ts +14 -0
- package/dist/types/primitives/alert.d.ts +7 -0
- package/dist/types/primitives/avatar-color.d.ts +1 -0
- package/dist/types/primitives/avatar.d.ts +8 -0
- package/dist/types/primitives/badge.d.ts +8 -0
- package/dist/types/primitives/breadcrumb.d.ts +11 -0
- package/dist/types/primitives/button.d.ts +7 -0
- package/dist/types/primitives/calendar.d.ts +8 -0
- package/dist/types/primitives/card.d.ts +9 -0
- package/dist/types/primitives/checkbox.d.ts +4 -0
- package/dist/types/primitives/choice-tiles.d.ts +60 -0
- package/dist/types/primitives/cn.d.ts +1 -0
- package/dist/types/primitives/code-block.d.ts +32 -0
- package/dist/types/primitives/collapsible.d.ts +6 -0
- package/dist/types/primitives/command.d.ts +49 -0
- package/dist/types/primitives/context-ring.d.ts +15 -0
- package/dist/types/primitives/dialog-arms.d.ts +2 -0
- package/dist/types/primitives/dialog.d.ts +32 -0
- package/dist/types/primitives/disclosure-header.d.ts +7 -0
- package/dist/types/primitives/dock-card.d.ts +43 -0
- package/dist/types/primitives/dropdown-menu.d.ts +26 -0
- package/dist/types/primitives/empty-state.d.ts +19 -0
- package/dist/types/primitives/glass-card.d.ts +3 -0
- package/dist/types/primitives/hover-card.d.ts +6 -0
- package/dist/types/primitives/icon-disc.d.ts +10 -0
- package/dist/types/primitives/index.d.ts +52 -0
- package/dist/types/primitives/input.d.ts +4 -0
- package/dist/types/primitives/kbd.d.ts +4 -0
- package/dist/types/primitives/label.d.ts +4 -0
- package/dist/types/primitives/menu-surface.d.ts +1 -0
- package/dist/types/primitives/meter.d.ts +10 -0
- package/dist/types/primitives/popover.d.ts +7 -0
- package/dist/types/primitives/progress-ring.d.ts +12 -0
- package/dist/types/primitives/progress.d.ts +4 -0
- package/dist/types/primitives/scroll-area.d.ts +5 -0
- package/dist/types/primitives/segmented-control.d.ts +25 -0
- package/dist/types/primitives/select.d.ts +15 -0
- package/dist/types/primitives/separator.d.ts +4 -0
- package/dist/types/primitives/sheet-chrome.d.ts +13 -0
- package/dist/types/primitives/sheet.d.ts +18 -0
- package/dist/types/primitives/skeleton.d.ts +3 -0
- package/dist/types/primitives/spinner.d.ts +8 -0
- package/dist/types/primitives/switch.d.ts +6 -0
- package/dist/types/primitives/table.d.ts +11 -0
- package/dist/types/primitives/tabs.d.ts +8 -0
- package/dist/types/primitives/textarea.d.ts +3 -0
- package/dist/types/primitives/toast.d.ts +16 -0
- package/dist/types/primitives/tooltip.d.ts +7 -0
- package/dist/types/primitives/truncate.d.ts +1 -0
- package/dist/types/primitives/use-media-query.d.ts +3 -0
- package/dist/types/primitives/use-mobile.d.ts +1 -0
- package/dist/types/primitives/use-sheet-drag.d.ts +20 -0
- package/dist/types/primitives/voice-wave.d.ts +22 -0
- package/dist/types/surface.d.ts +117 -0
- package/dist/types/use-surface.d.ts +57 -0
- package/package.json +60 -4
|
@@ -0,0 +1,3154 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn2,
|
|
3
|
+
getInitials2,
|
|
4
|
+
ChoiceTilesFrame2,
|
|
5
|
+
ChoiceTiles2,
|
|
6
|
+
choiceColumns2,
|
|
7
|
+
choiceToggle2,
|
|
8
|
+
choiceValues2
|
|
9
|
+
} from "../chunks/index-5yzzfez5.js";
|
|
10
|
+
|
|
11
|
+
// packages/exponential-ui-react/src/primitives/alert.tsx
|
|
12
|
+
import { ALERT_CLASSES, alertVariants } from "@exponential_app/eui/web/primitives";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
function Alert({
|
|
15
|
+
className,
|
|
16
|
+
variant,
|
|
17
|
+
...props
|
|
18
|
+
}) {
|
|
19
|
+
return /* @__PURE__ */ jsx("div", {
|
|
20
|
+
"data-slot": "alert",
|
|
21
|
+
role: "alert",
|
|
22
|
+
className: cn2(alertVariants({ variant }), className),
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function AlertTitle({ className, ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsx("div", {
|
|
28
|
+
"data-slot": "alert-title",
|
|
29
|
+
className: cn2(ALERT_CLASSES.title, className),
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function AlertDescription({
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}) {
|
|
37
|
+
return /* @__PURE__ */ jsx("div", {
|
|
38
|
+
"data-slot": "alert-description",
|
|
39
|
+
className: cn2(ALERT_CLASSES.description, className),
|
|
40
|
+
...props
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// packages/exponential-ui-react/src/primitives/alert-dialog.tsx
|
|
44
|
+
import { AlertDialog as AlertDialogPrimitive } from "radix-ui";
|
|
45
|
+
import { ALERT_DIALOG_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
46
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
47
|
+
function AlertDialog({ ...props }) {
|
|
48
|
+
return /* @__PURE__ */ jsx2(AlertDialogPrimitive.Root, {
|
|
49
|
+
"data-slot": "alert-dialog",
|
|
50
|
+
...props
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function AlertDialogTrigger({ ...props }) {
|
|
54
|
+
return /* @__PURE__ */ jsx2(AlertDialogPrimitive.Trigger, {
|
|
55
|
+
"data-slot": "alert-dialog-trigger",
|
|
56
|
+
...props
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function AlertDialogPortal({ ...props }) {
|
|
60
|
+
return /* @__PURE__ */ jsx2(AlertDialogPrimitive.Portal, {
|
|
61
|
+
"data-slot": "alert-dialog-portal",
|
|
62
|
+
...props
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function AlertDialogOverlay({ className, ...props }) {
|
|
66
|
+
return /* @__PURE__ */ jsx2(AlertDialogPrimitive.Overlay, {
|
|
67
|
+
"data-slot": "alert-dialog-overlay",
|
|
68
|
+
className: cn2(ALERT_DIALOG_CLASSES.overlay, className),
|
|
69
|
+
...props
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function AlertDialogContent({ className, ...props }) {
|
|
73
|
+
return /* @__PURE__ */ jsxs(AlertDialogPortal, {
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ jsx2(AlertDialogOverlay, {}),
|
|
76
|
+
/* @__PURE__ */ jsx2(AlertDialogPrimitive.Content, {
|
|
77
|
+
"data-slot": "alert-dialog-content",
|
|
78
|
+
className: cn2(ALERT_DIALOG_CLASSES.content, className),
|
|
79
|
+
...props
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function AlertDialogHeader({ className, ...props }) {
|
|
85
|
+
return /* @__PURE__ */ jsx2("div", {
|
|
86
|
+
"data-slot": "alert-dialog-header",
|
|
87
|
+
className: cn2(ALERT_DIALOG_CLASSES.header, className),
|
|
88
|
+
...props
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function AlertDialogFooter({ className, ...props }) {
|
|
92
|
+
return /* @__PURE__ */ jsx2("div", {
|
|
93
|
+
"data-slot": "alert-dialog-footer",
|
|
94
|
+
className: cn2(ALERT_DIALOG_CLASSES.footer, className),
|
|
95
|
+
...props
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function AlertDialogTitle({ className, ...props }) {
|
|
99
|
+
return /* @__PURE__ */ jsx2(AlertDialogPrimitive.Title, {
|
|
100
|
+
"data-slot": "alert-dialog-title",
|
|
101
|
+
className: cn2(ALERT_DIALOG_CLASSES.title, className),
|
|
102
|
+
...props
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function AlertDialogDescription({ className, ...props }) {
|
|
106
|
+
return /* @__PURE__ */ jsx2(AlertDialogPrimitive.Description, {
|
|
107
|
+
"data-slot": "alert-dialog-description",
|
|
108
|
+
className: cn2(ALERT_DIALOG_CLASSES.description, className),
|
|
109
|
+
...props
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function AlertDialogAction({ className, ...props }) {
|
|
113
|
+
return /* @__PURE__ */ jsx2(AlertDialogPrimitive.Action, {
|
|
114
|
+
className: cn2(ALERT_DIALOG_CLASSES.action, className),
|
|
115
|
+
...props
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function AlertDialogCancel({ className, ...props }) {
|
|
119
|
+
return /* @__PURE__ */ jsx2(AlertDialogPrimitive.Cancel, {
|
|
120
|
+
className: cn2(ALERT_DIALOG_CLASSES.cancel, className),
|
|
121
|
+
...props
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
// packages/exponential-ui-react/src/primitives/avatar.tsx
|
|
125
|
+
import { Avatar as AvatarPrimitive } from "radix-ui";
|
|
126
|
+
import { AVATAR_CLASSES, avatarFallbackColors, avatarFallbackHue } from "@exponential_app/eui/web/primitives";
|
|
127
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
128
|
+
function Avatar({
|
|
129
|
+
className,
|
|
130
|
+
...props
|
|
131
|
+
}) {
|
|
132
|
+
return /* @__PURE__ */ jsx3(AvatarPrimitive.Root, {
|
|
133
|
+
"data-slot": "avatar",
|
|
134
|
+
className: cn2(AVATAR_CLASSES.root, className),
|
|
135
|
+
...props
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function AvatarImage({
|
|
139
|
+
className,
|
|
140
|
+
...props
|
|
141
|
+
}) {
|
|
142
|
+
return /* @__PURE__ */ jsx3(AvatarPrimitive.Image, {
|
|
143
|
+
"data-slot": "avatar-image",
|
|
144
|
+
className: cn2(AVATAR_CLASSES.image, className),
|
|
145
|
+
...props
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function AvatarFallback({
|
|
149
|
+
className,
|
|
150
|
+
userId,
|
|
151
|
+
style,
|
|
152
|
+
...props
|
|
153
|
+
}) {
|
|
154
|
+
const hue = avatarFallbackHue(userId);
|
|
155
|
+
return /* @__PURE__ */ jsx3(AvatarPrimitive.Fallback, {
|
|
156
|
+
"data-slot": "avatar-fallback",
|
|
157
|
+
className: cn2(AVATAR_CLASSES.fallback, hue === undefined && AVATAR_CLASSES.fallbackMuted, className),
|
|
158
|
+
style: hue === undefined ? style : { ...avatarFallbackColors(hue), ...style },
|
|
159
|
+
...props
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
// packages/exponential-ui-react/src/primitives/avatar-color.ts
|
|
163
|
+
import { AVATAR_HUE_COUNT, avatarHueIndex } from "@exponential_app/eui/web/primitives";
|
|
164
|
+
// packages/exponential-ui-react/src/primitives/badge.tsx
|
|
165
|
+
import { BADGE_CLASSES, badgeLabel } from "@exponential_app/eui/web/primitives";
|
|
166
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
167
|
+
function Badge({
|
|
168
|
+
count,
|
|
169
|
+
max = 99,
|
|
170
|
+
tone = `muted`,
|
|
171
|
+
className,
|
|
172
|
+
...props
|
|
173
|
+
}) {
|
|
174
|
+
if (count <= 0)
|
|
175
|
+
return null;
|
|
176
|
+
return /* @__PURE__ */ jsx4("span", {
|
|
177
|
+
"data-slot": "badge",
|
|
178
|
+
"data-tone": tone,
|
|
179
|
+
className: cn2(BADGE_CLASSES.root, BADGE_CLASSES.tones[tone], className),
|
|
180
|
+
...props,
|
|
181
|
+
children: badgeLabel(count, max)
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
// packages/exponential-ui-react/src/primitives/breadcrumb.tsx
|
|
185
|
+
import { ChevronRight, Ellipsis } from "lucide-react";
|
|
186
|
+
import { Slot } from "radix-ui";
|
|
187
|
+
import { BREADCRUMB_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
188
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
189
|
+
function Breadcrumb({ ...props }) {
|
|
190
|
+
return /* @__PURE__ */ jsx5("nav", {
|
|
191
|
+
"aria-label": "breadcrumb",
|
|
192
|
+
"data-slot": "breadcrumb",
|
|
193
|
+
...props
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
function BreadcrumbList({ className, ...props }) {
|
|
197
|
+
return /* @__PURE__ */ jsx5("ol", {
|
|
198
|
+
"data-slot": "breadcrumb-list",
|
|
199
|
+
className: cn2(BREADCRUMB_CLASSES.list, className),
|
|
200
|
+
...props
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
204
|
+
return /* @__PURE__ */ jsx5("li", {
|
|
205
|
+
"data-slot": "breadcrumb-item",
|
|
206
|
+
className: cn2(BREADCRUMB_CLASSES.item, className),
|
|
207
|
+
...props
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
function BreadcrumbLink({ asChild, className, ...props }) {
|
|
211
|
+
const Comp = asChild ? Slot.Root : `a`;
|
|
212
|
+
return /* @__PURE__ */ jsx5(Comp, {
|
|
213
|
+
"data-slot": "breadcrumb-link",
|
|
214
|
+
className: cn2(BREADCRUMB_CLASSES.link, className),
|
|
215
|
+
...props
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
219
|
+
return /* @__PURE__ */ jsx5("span", {
|
|
220
|
+
"data-slot": "breadcrumb-page",
|
|
221
|
+
role: "link",
|
|
222
|
+
"aria-disabled": "true",
|
|
223
|
+
"aria-current": "page",
|
|
224
|
+
className: cn2(BREADCRUMB_CLASSES.page, className),
|
|
225
|
+
...props
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
function BreadcrumbSeparator({ children, className, ...props }) {
|
|
229
|
+
return /* @__PURE__ */ jsx5("li", {
|
|
230
|
+
"data-slot": "breadcrumb-separator",
|
|
231
|
+
role: "presentation",
|
|
232
|
+
"aria-hidden": "true",
|
|
233
|
+
className: cn2(BREADCRUMB_CLASSES.separator, className),
|
|
234
|
+
...props,
|
|
235
|
+
children: children ?? /* @__PURE__ */ jsx5(ChevronRight, {})
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function BreadcrumbEllipsis({ className, ...props }) {
|
|
239
|
+
return /* @__PURE__ */ jsxs2("span", {
|
|
240
|
+
"data-slot": "breadcrumb-ellipsis",
|
|
241
|
+
role: "presentation",
|
|
242
|
+
"aria-hidden": "true",
|
|
243
|
+
className: cn2(BREADCRUMB_CLASSES.ellipsis, className),
|
|
244
|
+
...props,
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ jsx5(Ellipsis, {
|
|
247
|
+
className: BREADCRUMB_CLASSES.ellipsisIcon
|
|
248
|
+
}),
|
|
249
|
+
/* @__PURE__ */ jsx5("span", {
|
|
250
|
+
className: BREADCRUMB_CLASSES.srOnly,
|
|
251
|
+
children: "More"
|
|
252
|
+
})
|
|
253
|
+
]
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
// packages/exponential-ui-react/src/primitives/button.tsx
|
|
257
|
+
import { Slot as Slot2 } from "radix-ui";
|
|
258
|
+
import { buttonVariants } from "@exponential_app/eui/web/primitives";
|
|
259
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
260
|
+
function Button({
|
|
261
|
+
className,
|
|
262
|
+
variant = `default`,
|
|
263
|
+
size = `default`,
|
|
264
|
+
asChild = false,
|
|
265
|
+
...props
|
|
266
|
+
}) {
|
|
267
|
+
const Comp = asChild ? Slot2.Root : `button`;
|
|
268
|
+
return /* @__PURE__ */ jsx6(Comp, {
|
|
269
|
+
"data-slot": "button",
|
|
270
|
+
"data-variant": variant,
|
|
271
|
+
"data-size": size,
|
|
272
|
+
className: cn2(buttonVariants({ variant, size, className })),
|
|
273
|
+
...props
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
// packages/exponential-ui-react/src/primitives/calendar.tsx
|
|
277
|
+
import * as React from "react";
|
|
278
|
+
import {
|
|
279
|
+
ChevronDownIcon,
|
|
280
|
+
ChevronLeftIcon,
|
|
281
|
+
ChevronRightIcon
|
|
282
|
+
} from "lucide-react";
|
|
283
|
+
import {
|
|
284
|
+
DayPicker,
|
|
285
|
+
getDefaultClassNames
|
|
286
|
+
} from "react-day-picker";
|
|
287
|
+
import { CALENDAR_CLASSES, buttonVariants as buttonVariants2 } from "@exponential_app/eui/web/primitives";
|
|
288
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
289
|
+
function Calendar({
|
|
290
|
+
className,
|
|
291
|
+
classNames,
|
|
292
|
+
showOutsideDays = true,
|
|
293
|
+
captionLayout = `label`,
|
|
294
|
+
buttonVariant = `ghost`,
|
|
295
|
+
formatters,
|
|
296
|
+
components,
|
|
297
|
+
...props
|
|
298
|
+
}) {
|
|
299
|
+
const defaultClassNames = getDefaultClassNames();
|
|
300
|
+
const parts = CALENDAR_CLASSES.classNames;
|
|
301
|
+
return /* @__PURE__ */ jsx7(DayPicker, {
|
|
302
|
+
showOutsideDays,
|
|
303
|
+
className: cn2(CALENDAR_CLASSES.root, className),
|
|
304
|
+
captionLayout,
|
|
305
|
+
formatters: {
|
|
306
|
+
formatMonthDropdown: (date) => date.toLocaleString(`default`, { month: `short` }),
|
|
307
|
+
...formatters
|
|
308
|
+
},
|
|
309
|
+
classNames: {
|
|
310
|
+
root: cn2(parts.root, defaultClassNames.root),
|
|
311
|
+
months: cn2(parts.months, defaultClassNames.months),
|
|
312
|
+
month: cn2(parts.month, defaultClassNames.month),
|
|
313
|
+
nav: cn2(parts.nav, defaultClassNames.nav),
|
|
314
|
+
button_previous: cn2(buttonVariants2({ variant: buttonVariant }), parts.button_previous, defaultClassNames.button_previous),
|
|
315
|
+
button_next: cn2(buttonVariants2({ variant: buttonVariant }), parts.button_next, defaultClassNames.button_next),
|
|
316
|
+
month_caption: cn2(parts.month_caption, defaultClassNames.month_caption),
|
|
317
|
+
dropdowns: cn2(parts.dropdowns, defaultClassNames.dropdowns),
|
|
318
|
+
dropdown_root: cn2(parts.dropdown_root, defaultClassNames.dropdown_root),
|
|
319
|
+
dropdown: cn2(parts.dropdown, defaultClassNames.dropdown),
|
|
320
|
+
caption_label: cn2(parts.caption_label, captionLayout === `label` ? CALENDAR_CLASSES.captionLabel.label : CALENDAR_CLASSES.captionLabel.dropdown, defaultClassNames.caption_label),
|
|
321
|
+
table: parts.table,
|
|
322
|
+
weekdays: cn2(parts.weekdays, defaultClassNames.weekdays),
|
|
323
|
+
weekday: cn2(parts.weekday, defaultClassNames.weekday),
|
|
324
|
+
week: cn2(parts.week, defaultClassNames.week),
|
|
325
|
+
week_number_header: cn2(parts.week_number_header, defaultClassNames.week_number_header),
|
|
326
|
+
week_number: cn2(parts.week_number, defaultClassNames.week_number),
|
|
327
|
+
day: cn2(parts.day, props.showWeekNumber ? CALENDAR_CLASSES.dayFirst.weekNumbers : CALENDAR_CLASSES.dayFirst.plain, defaultClassNames.day),
|
|
328
|
+
range_start: cn2(parts.range_start, defaultClassNames.range_start),
|
|
329
|
+
range_middle: cn2(parts.range_middle, defaultClassNames.range_middle),
|
|
330
|
+
range_end: cn2(parts.range_end, defaultClassNames.range_end),
|
|
331
|
+
today: cn2(parts.today, defaultClassNames.today),
|
|
332
|
+
outside: cn2(parts.outside, defaultClassNames.outside),
|
|
333
|
+
disabled: cn2(parts.disabled, defaultClassNames.disabled),
|
|
334
|
+
hidden: cn2(parts.hidden, defaultClassNames.hidden),
|
|
335
|
+
...classNames
|
|
336
|
+
},
|
|
337
|
+
components: {
|
|
338
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
339
|
+
return /* @__PURE__ */ jsx7("div", {
|
|
340
|
+
"data-slot": "calendar",
|
|
341
|
+
ref: rootRef,
|
|
342
|
+
className: cn2(className),
|
|
343
|
+
...props
|
|
344
|
+
});
|
|
345
|
+
},
|
|
346
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
347
|
+
if (orientation === `left`) {
|
|
348
|
+
return /* @__PURE__ */ jsx7(ChevronLeftIcon, {
|
|
349
|
+
className: cn2(CALENDAR_CLASSES.chevron, className),
|
|
350
|
+
...props
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
if (orientation === `right`) {
|
|
354
|
+
return /* @__PURE__ */ jsx7(ChevronRightIcon, {
|
|
355
|
+
className: cn2(CALENDAR_CLASSES.chevron, className),
|
|
356
|
+
...props
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
return /* @__PURE__ */ jsx7(ChevronDownIcon, {
|
|
360
|
+
className: cn2(CALENDAR_CLASSES.chevron, className),
|
|
361
|
+
...props
|
|
362
|
+
});
|
|
363
|
+
},
|
|
364
|
+
DayButton: CalendarDayButton,
|
|
365
|
+
WeekNumber: ({ children, ...props }) => {
|
|
366
|
+
return /* @__PURE__ */ jsx7("td", {
|
|
367
|
+
...props,
|
|
368
|
+
children: /* @__PURE__ */ jsx7("div", {
|
|
369
|
+
className: CALENDAR_CLASSES.weekNumber,
|
|
370
|
+
children
|
|
371
|
+
})
|
|
372
|
+
});
|
|
373
|
+
},
|
|
374
|
+
...components
|
|
375
|
+
},
|
|
376
|
+
...props
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
function CalendarDayButton({
|
|
380
|
+
className,
|
|
381
|
+
day,
|
|
382
|
+
modifiers,
|
|
383
|
+
...props
|
|
384
|
+
}) {
|
|
385
|
+
const defaultClassNames = getDefaultClassNames();
|
|
386
|
+
const ref = React.useRef(null);
|
|
387
|
+
React.useEffect(() => {
|
|
388
|
+
if (modifiers.focused)
|
|
389
|
+
ref.current?.focus();
|
|
390
|
+
}, [modifiers.focused]);
|
|
391
|
+
return /* @__PURE__ */ jsx7(Button, {
|
|
392
|
+
ref,
|
|
393
|
+
variant: "ghost",
|
|
394
|
+
size: "icon",
|
|
395
|
+
"data-day": day.date.toLocaleDateString(),
|
|
396
|
+
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
397
|
+
"data-range-start": modifiers.range_start,
|
|
398
|
+
"data-range-end": modifiers.range_end,
|
|
399
|
+
"data-range-middle": modifiers.range_middle,
|
|
400
|
+
className: cn2(CALENDAR_CLASSES.dayButton, defaultClassNames.day, className),
|
|
401
|
+
...props
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
// packages/exponential-ui-react/src/primitives/card.tsx
|
|
405
|
+
import { CARD_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
406
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
407
|
+
function Card({ className, ...props }) {
|
|
408
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
409
|
+
"data-slot": "card",
|
|
410
|
+
className: cn2(CARD_CLASSES.root, className),
|
|
411
|
+
...props
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
function CardHeader({ className, ...props }) {
|
|
415
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
416
|
+
"data-slot": "card-header",
|
|
417
|
+
className: cn2(CARD_CLASSES.header, className),
|
|
418
|
+
...props
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
function CardTitle({ className, ...props }) {
|
|
422
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
423
|
+
"data-slot": "card-title",
|
|
424
|
+
className: cn2(CARD_CLASSES.title, className),
|
|
425
|
+
...props
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
function CardDescription({ className, ...props }) {
|
|
429
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
430
|
+
"data-slot": "card-description",
|
|
431
|
+
className: cn2(CARD_CLASSES.description, className),
|
|
432
|
+
...props
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
function CardAction({ className, ...props }) {
|
|
436
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
437
|
+
"data-slot": "card-action",
|
|
438
|
+
className: cn2(CARD_CLASSES.action, className),
|
|
439
|
+
...props
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
function CardContent({ className, ...props }) {
|
|
443
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
444
|
+
"data-slot": "card-content",
|
|
445
|
+
className: cn2(CARD_CLASSES.content, className),
|
|
446
|
+
...props
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
function CardFooter({ className, ...props }) {
|
|
450
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
451
|
+
"data-slot": "card-footer",
|
|
452
|
+
className: cn2(CARD_CLASSES.footer, className),
|
|
453
|
+
...props
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
// packages/exponential-ui-react/src/primitives/checkbox.tsx
|
|
457
|
+
import { CheckIcon } from "lucide-react";
|
|
458
|
+
import { Checkbox as CheckboxPrimitive } from "radix-ui";
|
|
459
|
+
import { CHECKBOX_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
460
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
461
|
+
function Checkbox({
|
|
462
|
+
className,
|
|
463
|
+
...props
|
|
464
|
+
}) {
|
|
465
|
+
return /* @__PURE__ */ jsx9(CheckboxPrimitive.Root, {
|
|
466
|
+
"data-slot": "checkbox",
|
|
467
|
+
className: cn2(CHECKBOX_CLASSES.root, className),
|
|
468
|
+
...props,
|
|
469
|
+
children: /* @__PURE__ */ jsx9(CheckboxPrimitive.Indicator, {
|
|
470
|
+
"data-slot": "checkbox-indicator",
|
|
471
|
+
className: CHECKBOX_CLASSES.indicator,
|
|
472
|
+
children: /* @__PURE__ */ jsx9(CheckIcon, {
|
|
473
|
+
className: CHECKBOX_CLASSES.icon
|
|
474
|
+
})
|
|
475
|
+
})
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
// packages/exponential-ui-react/src/primitives/code-block.tsx
|
|
479
|
+
import * as React2 from "react";
|
|
480
|
+
import { Check, Copy } from "lucide-react";
|
|
481
|
+
import { tokenizeCode } from "@exponential_app/eui";
|
|
482
|
+
import { CODE_BLOCK_CLASSES, CODE_TOKEN_CLASS, codeBlockLineVariants, codeBlockVariants } from "@exponential_app/eui/web/primitives";
|
|
483
|
+
import { jsx as jsx10, jsxs as jsxs3, Fragment } from "react/jsx-runtime";
|
|
484
|
+
function CodeBlock({
|
|
485
|
+
className,
|
|
486
|
+
variant = `default`,
|
|
487
|
+
size = `default`,
|
|
488
|
+
...props
|
|
489
|
+
}) {
|
|
490
|
+
return /* @__PURE__ */ jsx10("div", {
|
|
491
|
+
"data-slot": "code-block",
|
|
492
|
+
"data-variant": variant,
|
|
493
|
+
"data-size": size,
|
|
494
|
+
className: cn2(codeBlockVariants({ variant }), className),
|
|
495
|
+
...props
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
function CodeBlockHeader({ className, ...props }) {
|
|
499
|
+
return /* @__PURE__ */ jsx10("div", {
|
|
500
|
+
"data-slot": "code-block-header",
|
|
501
|
+
className: cn2(CODE_BLOCK_CLASSES.header, className),
|
|
502
|
+
...props
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
function CodeBlockTitle({ className, ...props }) {
|
|
506
|
+
return /* @__PURE__ */ jsx10("div", {
|
|
507
|
+
"data-slot": "code-block-title",
|
|
508
|
+
className: cn2(CODE_BLOCK_CLASSES.title, className),
|
|
509
|
+
...props
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
function CodeBlockActions({
|
|
513
|
+
className,
|
|
514
|
+
...props
|
|
515
|
+
}) {
|
|
516
|
+
return /* @__PURE__ */ jsx10("div", {
|
|
517
|
+
"data-slot": "code-block-actions",
|
|
518
|
+
className: cn2(CODE_BLOCK_CLASSES.actions, className),
|
|
519
|
+
...props
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
function CodeBlockCopyButton({
|
|
523
|
+
value,
|
|
524
|
+
variant = `ghost`,
|
|
525
|
+
size = `icon-xs`,
|
|
526
|
+
className,
|
|
527
|
+
onClick,
|
|
528
|
+
labels = { copy: `Copy`, copied: `Copied` },
|
|
529
|
+
...props
|
|
530
|
+
}) {
|
|
531
|
+
const [copied, setCopied] = React2.useState(false);
|
|
532
|
+
React2.useEffect(() => {
|
|
533
|
+
if (!copied)
|
|
534
|
+
return;
|
|
535
|
+
const timeout = setTimeout(() => setCopied(false), 2000);
|
|
536
|
+
return () => clearTimeout(timeout);
|
|
537
|
+
}, [copied]);
|
|
538
|
+
return /* @__PURE__ */ jsxs3(Fragment, {
|
|
539
|
+
children: [
|
|
540
|
+
/* @__PURE__ */ jsx10(Button, {
|
|
541
|
+
"data-slot": "code-block-copy-button",
|
|
542
|
+
"data-copied": copied || undefined,
|
|
543
|
+
variant,
|
|
544
|
+
size,
|
|
545
|
+
"aria-label": copied ? labels.copied : labels.copy,
|
|
546
|
+
className: cn2(className),
|
|
547
|
+
onClick: (event) => {
|
|
548
|
+
onClick?.(event);
|
|
549
|
+
const clipboard = typeof navigator === `undefined` ? undefined : navigator.clipboard;
|
|
550
|
+
if (!clipboard?.writeText)
|
|
551
|
+
return;
|
|
552
|
+
clipboard.writeText(value).then(() => setCopied(true)).catch(() => {});
|
|
553
|
+
},
|
|
554
|
+
...props,
|
|
555
|
+
children: copied ? /* @__PURE__ */ jsx10(Check, {}) : /* @__PURE__ */ jsx10(Copy, {})
|
|
556
|
+
}),
|
|
557
|
+
/* @__PURE__ */ jsx10("span", {
|
|
558
|
+
"aria-live": "polite",
|
|
559
|
+
className: CODE_BLOCK_CLASSES.srOnly,
|
|
560
|
+
children: copied ? labels.copied : ``
|
|
561
|
+
})
|
|
562
|
+
]
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
function CodeBlockContent({
|
|
566
|
+
className,
|
|
567
|
+
children,
|
|
568
|
+
style,
|
|
569
|
+
wrap = false,
|
|
570
|
+
lineNumbers = false,
|
|
571
|
+
startLine = 1,
|
|
572
|
+
language,
|
|
573
|
+
maxLines = 16,
|
|
574
|
+
...props
|
|
575
|
+
}) {
|
|
576
|
+
const source = typeof children === `string` ? children : null;
|
|
577
|
+
const lines = React2.useMemo(() => source !== null && language ? tokenizeCode(source.replace(/\n$/, ``), language) : null, [source, language]);
|
|
578
|
+
return /* @__PURE__ */ jsx10("pre", {
|
|
579
|
+
"data-slot": "code-block-content",
|
|
580
|
+
"data-wrap": wrap || undefined,
|
|
581
|
+
"data-numbered": lineNumbers || undefined,
|
|
582
|
+
"data-language": language,
|
|
583
|
+
dir: "ltr",
|
|
584
|
+
tabIndex: 0,
|
|
585
|
+
style: {
|
|
586
|
+
counterReset: `line ${startLine - 1}`,
|
|
587
|
+
...maxLines > 0 ? { maxHeight: `calc(${maxLines}lh + var(--code-block-pad, 1.5rem))` } : null,
|
|
588
|
+
...style
|
|
589
|
+
},
|
|
590
|
+
className: cn2(CODE_BLOCK_CLASSES.content, className),
|
|
591
|
+
...props,
|
|
592
|
+
children: /* @__PURE__ */ jsx10("code", {
|
|
593
|
+
"data-slot": "code-block-code",
|
|
594
|
+
className: CODE_BLOCK_CLASSES.code,
|
|
595
|
+
children: lines !== null ? lines.map((tokens, index) => /* @__PURE__ */ jsx10(CodeBlockLine, {
|
|
596
|
+
children: tokens.length === 0 ? null : tokens.map((token, j) => /* @__PURE__ */ jsx10("span", {
|
|
597
|
+
"data-token": token.kind,
|
|
598
|
+
className: cn2(CODE_TOKEN_CLASS[token.kind], CODE_BLOCK_CLASSES.token),
|
|
599
|
+
children: token.text
|
|
600
|
+
}, j))
|
|
601
|
+
}, index)) : lineNumbers && source !== null ? source.replace(/\n$/, ``).split(`
|
|
602
|
+
`).map((line, index) => /* @__PURE__ */ jsx10(CodeBlockLine, {
|
|
603
|
+
children: line
|
|
604
|
+
}, index)) : children
|
|
605
|
+
})
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
function CodeBlockLine({
|
|
609
|
+
className,
|
|
610
|
+
variant = `default`,
|
|
611
|
+
children,
|
|
612
|
+
...props
|
|
613
|
+
}) {
|
|
614
|
+
const empty = children === undefined || children === null || children === `` || Array.isArray(children) && children.length === 0;
|
|
615
|
+
return /* @__PURE__ */ jsx10("span", {
|
|
616
|
+
"data-slot": "code-block-line",
|
|
617
|
+
"data-variant": variant,
|
|
618
|
+
className: cn2(codeBlockLineVariants({ variant }), className),
|
|
619
|
+
...props,
|
|
620
|
+
children: /* @__PURE__ */ jsx10("span", {
|
|
621
|
+
"data-slot": "code-block-line-content",
|
|
622
|
+
className: CODE_BLOCK_CLASSES.lineContent,
|
|
623
|
+
children: empty ? `
|
|
624
|
+
` : children
|
|
625
|
+
})
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
function CodeBlockFooter({ className, ...props }) {
|
|
629
|
+
return /* @__PURE__ */ jsx10("div", {
|
|
630
|
+
"data-slot": "code-block-footer",
|
|
631
|
+
className: cn2(CODE_BLOCK_CLASSES.footer, className),
|
|
632
|
+
...props
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
// packages/exponential-ui-react/src/primitives/collapsible.tsx
|
|
636
|
+
import { Collapsible as CollapsiblePrimitive } from "radix-ui";
|
|
637
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
638
|
+
function Collapsible({
|
|
639
|
+
...props
|
|
640
|
+
}) {
|
|
641
|
+
return /* @__PURE__ */ jsx11(CollapsiblePrimitive.Root, {
|
|
642
|
+
"data-slot": "collapsible",
|
|
643
|
+
...props
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
function CollapsibleTrigger({
|
|
647
|
+
...props
|
|
648
|
+
}) {
|
|
649
|
+
return /* @__PURE__ */ jsx11(CollapsiblePrimitive.Trigger, {
|
|
650
|
+
"data-slot": "collapsible-trigger",
|
|
651
|
+
...props
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
function CollapsibleContent({
|
|
655
|
+
...props
|
|
656
|
+
}) {
|
|
657
|
+
return /* @__PURE__ */ jsx11(CollapsiblePrimitive.Content, {
|
|
658
|
+
"data-slot": "collapsible-content",
|
|
659
|
+
...props
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
// packages/exponential-ui-react/src/primitives/command.tsx
|
|
663
|
+
import * as React3 from "react";
|
|
664
|
+
import { CircleXIcon, SearchIcon } from "lucide-react";
|
|
665
|
+
import { COMMAND_CLASSES, COMMAND_LABEL_STYLE, COMMAND_SELECT_EVENT, commandItemValue, createCommandStore, observeCommandListHeight } from "@exponential_app/eui/web/primitives";
|
|
666
|
+
import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
667
|
+
"use client";
|
|
668
|
+
var CommandContext = React3.createContext(null);
|
|
669
|
+
var GroupContext = React3.createContext(null);
|
|
670
|
+
function useRoot() {
|
|
671
|
+
const ctx = React3.useContext(CommandContext);
|
|
672
|
+
if (!ctx)
|
|
673
|
+
throw new Error(`Command parts must sit inside <Command>`);
|
|
674
|
+
return ctx;
|
|
675
|
+
}
|
|
676
|
+
function useStore(store) {
|
|
677
|
+
React3.useSyncExternalStore(store.subscribe, () => store.version, () => store.version);
|
|
678
|
+
}
|
|
679
|
+
function Command({ className, value, defaultValue, onValueChange, filter, shouldFilter, loop, label, children, onKeyDown, ...props }) {
|
|
680
|
+
const latest = React3.useRef({ value, onValueChange, filter, shouldFilter, loop });
|
|
681
|
+
latest.current = { value, onValueChange, filter, shouldFilter, loop };
|
|
682
|
+
const [, setTick] = React3.useState(0);
|
|
683
|
+
const [store] = React3.useState(() => {
|
|
684
|
+
const s = createCommandStore({ props: () => latest.current, schedule: () => setTick((t) => t + 1) });
|
|
685
|
+
if (value === undefined && defaultValue !== undefined)
|
|
686
|
+
s.setValue(defaultValue.trim());
|
|
687
|
+
return s;
|
|
688
|
+
});
|
|
689
|
+
useStore(store);
|
|
690
|
+
React3.useLayoutEffect(() => {
|
|
691
|
+
store.syncValue();
|
|
692
|
+
}, [store, value]);
|
|
693
|
+
React3.useLayoutEffect(() => store.flush());
|
|
694
|
+
const listId = React3.useId();
|
|
695
|
+
const inputId = React3.useId();
|
|
696
|
+
const labelId = React3.useId();
|
|
697
|
+
const ctx = React3.useMemo(() => ({ store, listId, inputId, labelId }), [store, listId, inputId, labelId]);
|
|
698
|
+
return /* @__PURE__ */ jsxs4("div", {
|
|
699
|
+
"data-slot": "command",
|
|
700
|
+
tabIndex: -1,
|
|
701
|
+
className: cn2(COMMAND_CLASSES.root, className),
|
|
702
|
+
...props,
|
|
703
|
+
onKeyDown: (e) => {
|
|
704
|
+
onKeyDown?.(e);
|
|
705
|
+
store.onKeyDown(e.nativeEvent);
|
|
706
|
+
},
|
|
707
|
+
children: [
|
|
708
|
+
/* @__PURE__ */ jsx12("label", {
|
|
709
|
+
"data-slot": "command-label",
|
|
710
|
+
htmlFor: inputId,
|
|
711
|
+
id: labelId,
|
|
712
|
+
style: COMMAND_LABEL_STYLE,
|
|
713
|
+
children: label
|
|
714
|
+
}),
|
|
715
|
+
/* @__PURE__ */ jsx12(CommandContext.Provider, {
|
|
716
|
+
value: ctx,
|
|
717
|
+
children
|
|
718
|
+
})
|
|
719
|
+
]
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
function CommandInput({ className, value, defaultValue, onValueChange, clearLabel, ref, ...props }) {
|
|
723
|
+
const { store, listId, inputId, labelId } = useRoot();
|
|
724
|
+
useStore(store);
|
|
725
|
+
const input = React3.useRef(null);
|
|
726
|
+
const controlled = value !== undefined;
|
|
727
|
+
React3.useState(() => store.setSearch(controlled ? value : defaultValue ?? ``, true));
|
|
728
|
+
React3.useEffect(() => {
|
|
729
|
+
if (controlled)
|
|
730
|
+
store.setSearch(value);
|
|
731
|
+
}, [controlled, value, store]);
|
|
732
|
+
const shown = controlled ? value : store.search;
|
|
733
|
+
const change = (next) => {
|
|
734
|
+
if (!controlled)
|
|
735
|
+
store.setSearch(next);
|
|
736
|
+
onValueChange?.(next);
|
|
737
|
+
};
|
|
738
|
+
return /* @__PURE__ */ jsxs4("div", {
|
|
739
|
+
"data-slot": "command-input-wrapper",
|
|
740
|
+
className: COMMAND_CLASSES.inputWrapper,
|
|
741
|
+
children: [
|
|
742
|
+
/* @__PURE__ */ jsx12(SearchIcon, {
|
|
743
|
+
className: COMMAND_CLASSES.inputGlyph
|
|
744
|
+
}),
|
|
745
|
+
/* @__PURE__ */ jsx12("input", {
|
|
746
|
+
ref: (node) => {
|
|
747
|
+
input.current = node;
|
|
748
|
+
if (typeof ref === `function`)
|
|
749
|
+
ref(node);
|
|
750
|
+
else if (ref)
|
|
751
|
+
ref.current = node;
|
|
752
|
+
},
|
|
753
|
+
"data-slot": "command-input",
|
|
754
|
+
className: cn2(COMMAND_CLASSES.input, className),
|
|
755
|
+
...props,
|
|
756
|
+
autoComplete: "off",
|
|
757
|
+
autoCorrect: "off",
|
|
758
|
+
spellCheck: false,
|
|
759
|
+
"aria-autocomplete": "list",
|
|
760
|
+
role: "combobox",
|
|
761
|
+
"aria-expanded": true,
|
|
762
|
+
"aria-controls": listId,
|
|
763
|
+
"aria-labelledby": labelId,
|
|
764
|
+
"aria-activedescendant": store.selectedId,
|
|
765
|
+
id: inputId,
|
|
766
|
+
type: "text",
|
|
767
|
+
value: shown,
|
|
768
|
+
onChange: (e) => change(e.target.value)
|
|
769
|
+
}),
|
|
770
|
+
shown !== `` ? /* @__PURE__ */ jsx12("button", {
|
|
771
|
+
type: "button",
|
|
772
|
+
"data-slot": "command-input-clear",
|
|
773
|
+
"aria-label": clearLabel ?? `Clear search`,
|
|
774
|
+
className: COMMAND_CLASSES.inputClear,
|
|
775
|
+
onClick: () => {
|
|
776
|
+
change(``);
|
|
777
|
+
input.current?.focus();
|
|
778
|
+
},
|
|
779
|
+
children: /* @__PURE__ */ jsx12(CircleXIcon, {})
|
|
780
|
+
}) : null
|
|
781
|
+
]
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
function CommandList({ className, children, "aria-label": ariaLabel, ...props }) {
|
|
785
|
+
const { store, listId } = useRoot();
|
|
786
|
+
useStore(store);
|
|
787
|
+
const list = React3.useRef(null);
|
|
788
|
+
const sizer = React3.useRef(null);
|
|
789
|
+
React3.useEffect(() => {
|
|
790
|
+
if (list.current && sizer.current)
|
|
791
|
+
return observeCommandListHeight(list.current, sizer.current);
|
|
792
|
+
}, []);
|
|
793
|
+
return /* @__PURE__ */ jsx12("div", {
|
|
794
|
+
ref: list,
|
|
795
|
+
"data-slot": "command-list",
|
|
796
|
+
className: cn2(COMMAND_CLASSES.list, className),
|
|
797
|
+
...props,
|
|
798
|
+
role: "listbox",
|
|
799
|
+
tabIndex: -1,
|
|
800
|
+
"aria-activedescendant": store.selectedId,
|
|
801
|
+
"aria-label": ariaLabel ?? `Suggestions`,
|
|
802
|
+
id: listId,
|
|
803
|
+
children: /* @__PURE__ */ jsx12("div", {
|
|
804
|
+
ref: (node) => {
|
|
805
|
+
sizer.current = node;
|
|
806
|
+
store.setSizer(node);
|
|
807
|
+
},
|
|
808
|
+
"data-slot": "command-list-sizer",
|
|
809
|
+
children
|
|
810
|
+
})
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
function CommandEmpty({ className, ...props }) {
|
|
814
|
+
const { store } = useRoot();
|
|
815
|
+
useStore(store);
|
|
816
|
+
return store.empty() ? /* @__PURE__ */ jsx12("div", {
|
|
817
|
+
"data-slot": "command-empty",
|
|
818
|
+
className: cn2(COMMAND_CLASSES.empty, className),
|
|
819
|
+
...props,
|
|
820
|
+
role: "presentation"
|
|
821
|
+
}) : null;
|
|
822
|
+
}
|
|
823
|
+
function CommandGroup({ className, heading, value, forceMount, children, ...props }) {
|
|
824
|
+
const { store } = useRoot();
|
|
825
|
+
useStore(store);
|
|
826
|
+
const id = React3.useId();
|
|
827
|
+
const headingId = React3.useId();
|
|
828
|
+
const el = React3.useRef(null);
|
|
829
|
+
const [seq] = React3.useState(() => store.nextSeq());
|
|
830
|
+
React3.useLayoutEffect(() => store.register({ id, kind: `group`, seq }), [store, id, seq]);
|
|
831
|
+
React3.useLayoutEffect(() => store.update(id, { el: el.current }));
|
|
832
|
+
const visible = forceMount || store.groupVisible(id);
|
|
833
|
+
const groupValue = value ?? (typeof heading === `string` ? heading : undefined);
|
|
834
|
+
const ctx = React3.useMemo(() => ({ id, forceMount }), [id, forceMount]);
|
|
835
|
+
return /* @__PURE__ */ jsxs4("div", {
|
|
836
|
+
ref: el,
|
|
837
|
+
"data-slot": "command-group",
|
|
838
|
+
className: cn2(COMMAND_CLASSES.group, className),
|
|
839
|
+
...props,
|
|
840
|
+
role: "presentation",
|
|
841
|
+
"data-value": groupValue,
|
|
842
|
+
hidden: visible ? undefined : true,
|
|
843
|
+
children: [
|
|
844
|
+
heading ? /* @__PURE__ */ jsx12("div", {
|
|
845
|
+
"data-slot": "command-group-heading",
|
|
846
|
+
className: COMMAND_CLASSES.groupHeading,
|
|
847
|
+
"aria-hidden": true,
|
|
848
|
+
id: headingId,
|
|
849
|
+
children: heading
|
|
850
|
+
}) : null,
|
|
851
|
+
/* @__PURE__ */ jsx12("div", {
|
|
852
|
+
"data-slot": "command-group-items",
|
|
853
|
+
role: "group",
|
|
854
|
+
"aria-labelledby": heading ? headingId : undefined,
|
|
855
|
+
children: /* @__PURE__ */ jsx12(GroupContext.Provider, {
|
|
856
|
+
value: ctx,
|
|
857
|
+
children
|
|
858
|
+
})
|
|
859
|
+
})
|
|
860
|
+
]
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
function CommandItem({ className, value, keywords, onSelect, disabled, forceMount, children, ...props }) {
|
|
864
|
+
const { store } = useRoot();
|
|
865
|
+
useStore(store);
|
|
866
|
+
const group = React3.useContext(GroupContext);
|
|
867
|
+
const id = React3.useId();
|
|
868
|
+
const el = React3.useRef(null);
|
|
869
|
+
const [seq] = React3.useState(() => store.nextSeq());
|
|
870
|
+
const known = React3.useRef(``);
|
|
871
|
+
const forced = forceMount ?? group?.forceMount ?? false;
|
|
872
|
+
React3.useLayoutEffect(() => store.register({ id, kind: `item`, seq, group: group?.id, forceMount: forced }), [store, id, seq, group?.id, forced]);
|
|
873
|
+
const own = commandItemValue(value, children, el.current, known.current);
|
|
874
|
+
React3.useLayoutEffect(() => {
|
|
875
|
+
const next = commandItemValue(value, children, el.current, known.current);
|
|
876
|
+
known.current = next;
|
|
877
|
+
store.update(id, { el: el.current, value: next, keywords: keywords?.map((k) => k.trim()), disabled });
|
|
878
|
+
});
|
|
879
|
+
const select = React3.useRef(() => {});
|
|
880
|
+
select.current = () => {
|
|
881
|
+
const v = known.current;
|
|
882
|
+
store.setValue(v, { pointer: true });
|
|
883
|
+
onSelect?.(v);
|
|
884
|
+
};
|
|
885
|
+
React3.useEffect(() => {
|
|
886
|
+
const node = el.current;
|
|
887
|
+
if (!node || disabled)
|
|
888
|
+
return;
|
|
889
|
+
const listener = () => select.current();
|
|
890
|
+
node.addEventListener(COMMAND_SELECT_EVENT, listener);
|
|
891
|
+
return () => node.removeEventListener(COMMAND_SELECT_EVENT, listener);
|
|
892
|
+
});
|
|
893
|
+
const visible = forced || store.score(own, keywords) > 0;
|
|
894
|
+
if (!visible)
|
|
895
|
+
return null;
|
|
896
|
+
const selected = own !== `` && store.value === own;
|
|
897
|
+
return /* @__PURE__ */ jsx12("div", {
|
|
898
|
+
ref: el,
|
|
899
|
+
"data-slot": "command-item",
|
|
900
|
+
className: cn2(COMMAND_CLASSES.item, className),
|
|
901
|
+
...props,
|
|
902
|
+
id,
|
|
903
|
+
role: "option",
|
|
904
|
+
"aria-disabled": Boolean(disabled),
|
|
905
|
+
"aria-selected": selected,
|
|
906
|
+
"data-disabled": Boolean(disabled),
|
|
907
|
+
"data-selected": selected,
|
|
908
|
+
"data-value": own || undefined,
|
|
909
|
+
onPointerMove: disabled ? undefined : () => store.setValue(known.current, { pointer: true }),
|
|
910
|
+
onClick: disabled ? undefined : () => select.current(),
|
|
911
|
+
children
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
function CommandSeparator({ className, alwaysRender, ...props }) {
|
|
915
|
+
const { store } = useRoot();
|
|
916
|
+
useStore(store);
|
|
917
|
+
const id = React3.useId();
|
|
918
|
+
const [seq] = React3.useState(() => store.nextSeq());
|
|
919
|
+
const el = React3.useRef(null);
|
|
920
|
+
React3.useLayoutEffect(() => store.register({ id, kind: `separator`, seq }), [store, id, seq]);
|
|
921
|
+
React3.useLayoutEffect(() => store.update(id, { el: el.current }));
|
|
922
|
+
if (!alwaysRender && store.search !== ``)
|
|
923
|
+
return null;
|
|
924
|
+
return /* @__PURE__ */ jsx12("div", {
|
|
925
|
+
ref: el,
|
|
926
|
+
"data-slot": "command-separator",
|
|
927
|
+
className: cn2(COMMAND_CLASSES.separator, className),
|
|
928
|
+
...props,
|
|
929
|
+
role: "separator"
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
function CommandShortcut({ className, ...props }) {
|
|
933
|
+
return /* @__PURE__ */ jsx12("span", {
|
|
934
|
+
"data-slot": "command-shortcut",
|
|
935
|
+
className: cn2(COMMAND_CLASSES.shortcut, className),
|
|
936
|
+
...props
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
// packages/exponential-ui-react/src/primitives/context-ring.tsx
|
|
940
|
+
import { forwardRef } from "react";
|
|
941
|
+
import { CONTEXT_RING_CLASSES, RING_RADIUS, RING_SIZE, RING_STROKE, RING_TONE_CLASS, ringGeometry } from "@exponential_app/eui/web/primitives";
|
|
942
|
+
import { RING_RADIUS as RING_RADIUS2, RING_SIZE as RING_SIZE2, RING_STROKE as RING_STROKE2, RING_TONE_CLASS as RING_TONE_CLASS2, ringGeometry as ringGeometry2 } from "@exponential_app/eui/web/primitives";
|
|
943
|
+
import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
944
|
+
var ContextRing = forwardRef(function ContextRing({ percent, tone, showEmpty = false, className, ...props }, ref) {
|
|
945
|
+
const value = percent ?? null;
|
|
946
|
+
if (value === null && !showEmpty)
|
|
947
|
+
return null;
|
|
948
|
+
const { circumference, dashOffset } = ringGeometry(value ?? 0);
|
|
949
|
+
return /* @__PURE__ */ jsx13(Button, {
|
|
950
|
+
ref,
|
|
951
|
+
type: "button",
|
|
952
|
+
variant: "ghost",
|
|
953
|
+
size: "icon-xs",
|
|
954
|
+
"aria-label": "Usage",
|
|
955
|
+
title: "Usage",
|
|
956
|
+
"data-testid": "session-context-ring",
|
|
957
|
+
className: cn2(CONTEXT_RING_CLASSES.root, value === null ? RING_TONE_CLASS.normal : RING_TONE_CLASS[tone ?? `normal`], className),
|
|
958
|
+
...props,
|
|
959
|
+
children: /* @__PURE__ */ jsxs5("svg", {
|
|
960
|
+
viewBox: `0 0 ${RING_SIZE} ${RING_SIZE}`,
|
|
961
|
+
width: RING_SIZE,
|
|
962
|
+
height: RING_SIZE,
|
|
963
|
+
"aria-hidden": true,
|
|
964
|
+
className: CONTEXT_RING_CLASSES.svg,
|
|
965
|
+
children: [
|
|
966
|
+
/* @__PURE__ */ jsx13("circle", {
|
|
967
|
+
cx: RING_SIZE / 2,
|
|
968
|
+
cy: RING_SIZE / 2,
|
|
969
|
+
r: RING_RADIUS,
|
|
970
|
+
fill: "none",
|
|
971
|
+
stroke: "currentColor",
|
|
972
|
+
strokeWidth: RING_STROKE,
|
|
973
|
+
opacity: 0.2
|
|
974
|
+
}),
|
|
975
|
+
value !== null && /* @__PURE__ */ jsx13("circle", {
|
|
976
|
+
cx: RING_SIZE / 2,
|
|
977
|
+
cy: RING_SIZE / 2,
|
|
978
|
+
r: RING_RADIUS,
|
|
979
|
+
fill: "none",
|
|
980
|
+
stroke: "currentColor",
|
|
981
|
+
strokeWidth: RING_STROKE,
|
|
982
|
+
strokeLinecap: "round",
|
|
983
|
+
strokeDasharray: circumference,
|
|
984
|
+
strokeDashoffset: dashOffset
|
|
985
|
+
})
|
|
986
|
+
]
|
|
987
|
+
})
|
|
988
|
+
});
|
|
989
|
+
});
|
|
990
|
+
// packages/exponential-ui-react/src/primitives/dialog.tsx
|
|
991
|
+
import * as React7 from "react";
|
|
992
|
+
import { XIcon as XIcon2 } from "lucide-react";
|
|
993
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
994
|
+
import { DIALOG_CLASSES, DIALOG_PHONE_QUERY, isTypeaheadPortalInteraction as isTypeaheadPortalInteraction2 } from "@exponential_app/eui/web/primitives";
|
|
995
|
+
|
|
996
|
+
// packages/exponential-ui-react/src/primitives/dialog-arms.ts
|
|
997
|
+
import { MOBILE_ALERT, MOBILE_ARMS, MOBILE_PAGE, MOBILE_SHEET, MOBILE_SHEET_FULL } from "@exponential_app/eui/web/primitives";
|
|
998
|
+
|
|
999
|
+
// packages/exponential-ui-react/src/primitives/sheet-chrome.tsx
|
|
1000
|
+
import * as React4 from "react";
|
|
1001
|
+
import { SHEET_CHROME_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
1002
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1003
|
+
var SheetDragContext = React4.createContext(null);
|
|
1004
|
+
function SheetDragProvider({
|
|
1005
|
+
value,
|
|
1006
|
+
children
|
|
1007
|
+
}) {
|
|
1008
|
+
return /* @__PURE__ */ jsx14(SheetDragContext.Provider, {
|
|
1009
|
+
value,
|
|
1010
|
+
children
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
function useSheetDragHandleProps() {
|
|
1014
|
+
return React4.useContext(SheetDragContext);
|
|
1015
|
+
}
|
|
1016
|
+
function SheetGrabber({
|
|
1017
|
+
className,
|
|
1018
|
+
...props
|
|
1019
|
+
}) {
|
|
1020
|
+
const drag = useSheetDragHandleProps();
|
|
1021
|
+
return /* @__PURE__ */ jsx14("div", {
|
|
1022
|
+
"data-slot": "sheet-grabber",
|
|
1023
|
+
"aria-hidden": true,
|
|
1024
|
+
...drag,
|
|
1025
|
+
...props,
|
|
1026
|
+
className: cn2(SHEET_CHROME_CLASSES.grabber, className)
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
// packages/exponential-ui-react/src/primitives/sheet.tsx
|
|
1031
|
+
import * as React6 from "react";
|
|
1032
|
+
import { XIcon } from "lucide-react";
|
|
1033
|
+
import { Dialog as SheetPrimitive } from "radix-ui";
|
|
1034
|
+
import { SHEET_CLASSES, isTypeaheadPortalInteraction } from "@exponential_app/eui/web/primitives";
|
|
1035
|
+
|
|
1036
|
+
// packages/exponential-ui-react/src/primitives/use-sheet-drag.ts
|
|
1037
|
+
import * as React5 from "react";
|
|
1038
|
+
var SHEET_MEDIA_QUERY = `(max-width: 639px)`;
|
|
1039
|
+
var DISMISS_DISTANCE_PX = 80;
|
|
1040
|
+
var DISMISS_VELOCITY = 0.6;
|
|
1041
|
+
var FLICK_DISTANCE_PX = 24;
|
|
1042
|
+
var DISMISS_ANIMATION_MS = 180;
|
|
1043
|
+
var DISMISS_TRANSITION = `transform var(--motion-duration-standard, ${DISMISS_ANIMATION_MS}ms) var(--motion-ease-accelerate, cubic-bezier(0.3, 0, 1, 1))`;
|
|
1044
|
+
var SNAP_BACK_TRANSITION = `transform var(--motion-duration-standard, ${DISMISS_ANIMATION_MS}ms) var(--motion-ease-decelerate, cubic-bezier(0, 0, 0.2, 1))`;
|
|
1045
|
+
function shouldDismissSheet(dy, dtMs) {
|
|
1046
|
+
if (dy > DISMISS_DISTANCE_PX) {
|
|
1047
|
+
return true;
|
|
1048
|
+
}
|
|
1049
|
+
if (dy <= FLICK_DISTANCE_PX) {
|
|
1050
|
+
return false;
|
|
1051
|
+
}
|
|
1052
|
+
return dtMs > 0 && dy / dtMs > DISMISS_VELOCITY;
|
|
1053
|
+
}
|
|
1054
|
+
function useSheetDrag({
|
|
1055
|
+
panelRef,
|
|
1056
|
+
onDismiss
|
|
1057
|
+
}) {
|
|
1058
|
+
const drag = React5.useRef(null);
|
|
1059
|
+
const paint = React5.useCallback((transform, transition) => {
|
|
1060
|
+
const panel = panelRef.current;
|
|
1061
|
+
if (!panel) {
|
|
1062
|
+
return;
|
|
1063
|
+
}
|
|
1064
|
+
panel.style.transition = transition;
|
|
1065
|
+
panel.style.transform = transform;
|
|
1066
|
+
}, [panelRef]);
|
|
1067
|
+
const release = React5.useCallback(() => {
|
|
1068
|
+
const panel = panelRef.current;
|
|
1069
|
+
if (!panel) {
|
|
1070
|
+
return;
|
|
1071
|
+
}
|
|
1072
|
+
panel.style.transition = ``;
|
|
1073
|
+
panel.style.transform = ``;
|
|
1074
|
+
}, [panelRef]);
|
|
1075
|
+
const handleProps = React5.useMemo(() => ({
|
|
1076
|
+
style: { touchAction: `none` },
|
|
1077
|
+
onPointerDown: (event) => {
|
|
1078
|
+
if (typeof window === `undefined` || typeof window.matchMedia !== `function` || !window.matchMedia(SHEET_MEDIA_QUERY).matches) {
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
drag.current = {
|
|
1082
|
+
pointerId: event.pointerId,
|
|
1083
|
+
y: event.clientY,
|
|
1084
|
+
at: Date.now()
|
|
1085
|
+
};
|
|
1086
|
+
const target = event.currentTarget;
|
|
1087
|
+
if (typeof target.setPointerCapture === `function`) {
|
|
1088
|
+
target.setPointerCapture(event.pointerId);
|
|
1089
|
+
}
|
|
1090
|
+
},
|
|
1091
|
+
onPointerMove: (event) => {
|
|
1092
|
+
const started = drag.current;
|
|
1093
|
+
if (!started || started.pointerId !== event.pointerId) {
|
|
1094
|
+
return;
|
|
1095
|
+
}
|
|
1096
|
+
const dy = event.clientY - started.y;
|
|
1097
|
+
paint(`translateY(${dy > 0 ? dy : dy / 4}px)`, `none`);
|
|
1098
|
+
},
|
|
1099
|
+
onPointerUp: (event) => {
|
|
1100
|
+
const started = drag.current;
|
|
1101
|
+
if (!started || started.pointerId !== event.pointerId) {
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
drag.current = null;
|
|
1105
|
+
const dy = event.clientY - started.y;
|
|
1106
|
+
if (shouldDismissSheet(dy, Date.now() - started.at)) {
|
|
1107
|
+
paint(`translateY(100%)`, DISMISS_TRANSITION);
|
|
1108
|
+
window.setTimeout(() => {
|
|
1109
|
+
onDismiss();
|
|
1110
|
+
window.requestAnimationFrame(() => {
|
|
1111
|
+
const panel = panelRef.current;
|
|
1112
|
+
if (panel && panel.dataset.state === `open`) {
|
|
1113
|
+
release();
|
|
1114
|
+
}
|
|
1115
|
+
});
|
|
1116
|
+
}, DISMISS_ANIMATION_MS);
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
paint(`translateY(0px)`, SNAP_BACK_TRANSITION);
|
|
1120
|
+
window.setTimeout(release, DISMISS_ANIMATION_MS);
|
|
1121
|
+
},
|
|
1122
|
+
onPointerCancel: (event) => {
|
|
1123
|
+
if (!drag.current || drag.current.pointerId !== event.pointerId) {
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
drag.current = null;
|
|
1127
|
+
release();
|
|
1128
|
+
}
|
|
1129
|
+
}), [onDismiss, paint, panelRef, release]);
|
|
1130
|
+
return { handleProps };
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
// packages/exponential-ui-react/src/primitives/sheet.tsx
|
|
1134
|
+
import { jsx as jsx15, jsxs as jsxs6, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
1135
|
+
function Sheet({ ...props }) {
|
|
1136
|
+
return /* @__PURE__ */ jsx15(SheetPrimitive.Root, {
|
|
1137
|
+
"data-slot": "sheet",
|
|
1138
|
+
...props
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
function SheetTrigger({
|
|
1142
|
+
...props
|
|
1143
|
+
}) {
|
|
1144
|
+
return /* @__PURE__ */ jsx15(SheetPrimitive.Trigger, {
|
|
1145
|
+
"data-slot": "sheet-trigger",
|
|
1146
|
+
...props
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
function SheetClose({
|
|
1150
|
+
...props
|
|
1151
|
+
}) {
|
|
1152
|
+
return /* @__PURE__ */ jsx15(SheetPrimitive.Close, {
|
|
1153
|
+
"data-slot": "sheet-close",
|
|
1154
|
+
...props
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
function SheetPortal({
|
|
1158
|
+
...props
|
|
1159
|
+
}) {
|
|
1160
|
+
return /* @__PURE__ */ jsx15(SheetPrimitive.Portal, {
|
|
1161
|
+
"data-slot": "sheet-portal",
|
|
1162
|
+
...props
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
function SheetOverlay({
|
|
1166
|
+
className,
|
|
1167
|
+
...props
|
|
1168
|
+
}) {
|
|
1169
|
+
return /* @__PURE__ */ jsx15(SheetPrimitive.Overlay, {
|
|
1170
|
+
"data-slot": "sheet-overlay",
|
|
1171
|
+
className: cn2(SHEET_CLASSES.overlay, className),
|
|
1172
|
+
...props
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
function SheetContent({
|
|
1176
|
+
className,
|
|
1177
|
+
children,
|
|
1178
|
+
side = `right`,
|
|
1179
|
+
showCloseButton = side !== `bottom`,
|
|
1180
|
+
showGrabber = side === `bottom`,
|
|
1181
|
+
ref,
|
|
1182
|
+
onInteractOutside,
|
|
1183
|
+
...props
|
|
1184
|
+
}) {
|
|
1185
|
+
const panelRef = React6.useRef(null);
|
|
1186
|
+
const dragCloseRef = React6.useRef(null);
|
|
1187
|
+
const onDragDismiss = React6.useCallback(() => {
|
|
1188
|
+
dragCloseRef.current?.click();
|
|
1189
|
+
}, []);
|
|
1190
|
+
const { handleProps } = useSheetDrag({ panelRef, onDismiss: onDragDismiss });
|
|
1191
|
+
const setPanel = React6.useCallback((node) => {
|
|
1192
|
+
panelRef.current = node;
|
|
1193
|
+
if (typeof ref === `function`) {
|
|
1194
|
+
ref(node);
|
|
1195
|
+
} else if (ref) {
|
|
1196
|
+
ref.current = node;
|
|
1197
|
+
}
|
|
1198
|
+
}, [ref]);
|
|
1199
|
+
return /* @__PURE__ */ jsxs6(SheetPortal, {
|
|
1200
|
+
children: [
|
|
1201
|
+
/* @__PURE__ */ jsx15(SheetPrimitive.Close, {
|
|
1202
|
+
asChild: true,
|
|
1203
|
+
children: /* @__PURE__ */ jsx15(SheetOverlay, {})
|
|
1204
|
+
}),
|
|
1205
|
+
/* @__PURE__ */ jsx15(SheetPrimitive.Content, {
|
|
1206
|
+
"data-slot": "sheet-content",
|
|
1207
|
+
"data-side": side,
|
|
1208
|
+
ref: setPanel,
|
|
1209
|
+
className: cn2(SHEET_CLASSES.content, SHEET_CLASSES.sides[side], className),
|
|
1210
|
+
onInteractOutside: (event) => {
|
|
1211
|
+
onInteractOutside?.(event);
|
|
1212
|
+
if (!event.defaultPrevented && isTypeaheadPortalInteraction(event)) {
|
|
1213
|
+
event.preventDefault();
|
|
1214
|
+
}
|
|
1215
|
+
},
|
|
1216
|
+
...props,
|
|
1217
|
+
children: /* @__PURE__ */ jsxs6(SheetDragProvider, {
|
|
1218
|
+
value: side === `bottom` ? handleProps : null,
|
|
1219
|
+
children: [
|
|
1220
|
+
showGrabber && /* @__PURE__ */ jsxs6(Fragment2, {
|
|
1221
|
+
children: [
|
|
1222
|
+
/* @__PURE__ */ jsx15(SheetGrabber, {}),
|
|
1223
|
+
/* @__PURE__ */ jsx15(SheetPrimitive.Close, {
|
|
1224
|
+
ref: dragCloseRef,
|
|
1225
|
+
"aria-hidden": true,
|
|
1226
|
+
tabIndex: -1,
|
|
1227
|
+
className: SHEET_CLASSES.dragClose
|
|
1228
|
+
})
|
|
1229
|
+
]
|
|
1230
|
+
}),
|
|
1231
|
+
children,
|
|
1232
|
+
showCloseButton && /* @__PURE__ */ jsxs6(SheetPrimitive.Close, {
|
|
1233
|
+
className: SHEET_CLASSES.close,
|
|
1234
|
+
children: [
|
|
1235
|
+
/* @__PURE__ */ jsx15(XIcon, {
|
|
1236
|
+
className: SHEET_CLASSES.closeIcon
|
|
1237
|
+
}),
|
|
1238
|
+
/* @__PURE__ */ jsx15("span", {
|
|
1239
|
+
className: SHEET_CLASSES.srOnly,
|
|
1240
|
+
children: "Close"
|
|
1241
|
+
})
|
|
1242
|
+
]
|
|
1243
|
+
})
|
|
1244
|
+
]
|
|
1245
|
+
})
|
|
1246
|
+
})
|
|
1247
|
+
]
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
function SheetHeader({ className, ...props }) {
|
|
1251
|
+
const drag = useSheetDragHandleProps();
|
|
1252
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
1253
|
+
"data-slot": "sheet-header",
|
|
1254
|
+
...drag,
|
|
1255
|
+
className: cn2(SHEET_CLASSES.header, className),
|
|
1256
|
+
...props
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
function SheetFooter({ className, ...props }) {
|
|
1260
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
1261
|
+
"data-slot": "sheet-footer",
|
|
1262
|
+
className: cn2(SHEET_CLASSES.footer, className),
|
|
1263
|
+
...props
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1266
|
+
function SheetTitle({
|
|
1267
|
+
className,
|
|
1268
|
+
...props
|
|
1269
|
+
}) {
|
|
1270
|
+
return /* @__PURE__ */ jsx15(SheetPrimitive.Title, {
|
|
1271
|
+
"data-slot": "sheet-title",
|
|
1272
|
+
className: cn2(SHEET_CLASSES.title, className),
|
|
1273
|
+
...props
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
function SheetDescription({
|
|
1277
|
+
className,
|
|
1278
|
+
...props
|
|
1279
|
+
}) {
|
|
1280
|
+
return /* @__PURE__ */ jsx15(SheetPrimitive.Description, {
|
|
1281
|
+
"data-slot": "sheet-description",
|
|
1282
|
+
className: cn2(SHEET_CLASSES.description, className),
|
|
1283
|
+
...props
|
|
1284
|
+
});
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
// packages/exponential-ui-react/src/primitives/use-media-query.ts
|
|
1288
|
+
import { useCallback as useCallback3, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
1289
|
+
function useMediaQuery(query) {
|
|
1290
|
+
const subscribe = useCallback3((onChange) => {
|
|
1291
|
+
if (typeof window === `undefined` || typeof window.matchMedia !== `function`)
|
|
1292
|
+
return () => {};
|
|
1293
|
+
const mql = window.matchMedia(query);
|
|
1294
|
+
mql.addEventListener(`change`, onChange);
|
|
1295
|
+
return () => mql.removeEventListener(`change`, onChange);
|
|
1296
|
+
}, [query]);
|
|
1297
|
+
const read = () => typeof window !== `undefined` && typeof window.matchMedia === `function` && window.matchMedia(query).matches;
|
|
1298
|
+
return useSyncExternalStore2(subscribe, read, () => false);
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
// packages/exponential-ui-react/src/primitives/dialog.tsx
|
|
1302
|
+
import { jsx as jsx16, jsxs as jsxs7, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
1303
|
+
function Dialog({
|
|
1304
|
+
...props
|
|
1305
|
+
}) {
|
|
1306
|
+
return /* @__PURE__ */ jsx16(DialogPrimitive.Root, {
|
|
1307
|
+
"data-slot": "dialog",
|
|
1308
|
+
...props
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1311
|
+
function DialogTrigger({
|
|
1312
|
+
...props
|
|
1313
|
+
}) {
|
|
1314
|
+
return /* @__PURE__ */ jsx16(DialogPrimitive.Trigger, {
|
|
1315
|
+
"data-slot": "dialog-trigger",
|
|
1316
|
+
...props
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
function DialogPortal({
|
|
1320
|
+
...props
|
|
1321
|
+
}) {
|
|
1322
|
+
return /* @__PURE__ */ jsx16(DialogPrimitive.Portal, {
|
|
1323
|
+
"data-slot": "dialog-portal",
|
|
1324
|
+
...props
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
function DialogClose({
|
|
1328
|
+
...props
|
|
1329
|
+
}) {
|
|
1330
|
+
return /* @__PURE__ */ jsx16(DialogPrimitive.Close, {
|
|
1331
|
+
"data-slot": "dialog-close",
|
|
1332
|
+
...props
|
|
1333
|
+
});
|
|
1334
|
+
}
|
|
1335
|
+
function DialogOverlay({
|
|
1336
|
+
className,
|
|
1337
|
+
...props
|
|
1338
|
+
}) {
|
|
1339
|
+
return /* @__PURE__ */ jsx16(DialogPrimitive.Overlay, {
|
|
1340
|
+
"data-slot": "dialog-overlay",
|
|
1341
|
+
className: cn2(DIALOG_CLASSES.overlay, className),
|
|
1342
|
+
...props
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1345
|
+
var DialogPresentationContext = React7.createContext(null);
|
|
1346
|
+
function DialogContent({
|
|
1347
|
+
className,
|
|
1348
|
+
children,
|
|
1349
|
+
showCloseButton = true,
|
|
1350
|
+
mobile = `sheet`,
|
|
1351
|
+
ref,
|
|
1352
|
+
onInteractOutside,
|
|
1353
|
+
...props
|
|
1354
|
+
}) {
|
|
1355
|
+
const isSheet = mobile === `sheet` || mobile === `sheet-full`;
|
|
1356
|
+
const panelRef = React7.useRef(null);
|
|
1357
|
+
const dragCloseRef = React7.useRef(null);
|
|
1358
|
+
const onDragDismiss = React7.useCallback(() => {
|
|
1359
|
+
dragCloseRef.current?.click();
|
|
1360
|
+
}, []);
|
|
1361
|
+
const { handleProps } = useSheetDrag({ panelRef, onDismiss: onDragDismiss });
|
|
1362
|
+
const setPanel = React7.useCallback((node) => {
|
|
1363
|
+
panelRef.current = node;
|
|
1364
|
+
if (typeof ref === `function`) {
|
|
1365
|
+
ref(node);
|
|
1366
|
+
} else if (ref) {
|
|
1367
|
+
ref.current = node;
|
|
1368
|
+
}
|
|
1369
|
+
}, [ref]);
|
|
1370
|
+
const isPhone = useMediaQuery(DIALOG_PHONE_QUERY);
|
|
1371
|
+
if (isSheet && isPhone) {
|
|
1372
|
+
return /* @__PURE__ */ jsx16(SheetContent, {
|
|
1373
|
+
side: "bottom",
|
|
1374
|
+
"data-slot": "dialog-content",
|
|
1375
|
+
"data-mobile": mobile,
|
|
1376
|
+
ref,
|
|
1377
|
+
className: cn2(DIALOG_CLASSES.phoneSheet, mobile === `sheet-full` && DIALOG_CLASSES.phoneSheetFull, className),
|
|
1378
|
+
onInteractOutside,
|
|
1379
|
+
...props,
|
|
1380
|
+
children: /* @__PURE__ */ jsx16(DialogPresentationContext.Provider, {
|
|
1381
|
+
value: mobile,
|
|
1382
|
+
children
|
|
1383
|
+
})
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
return /* @__PURE__ */ jsxs7(DialogPortal, {
|
|
1387
|
+
"data-slot": "dialog-portal",
|
|
1388
|
+
children: [
|
|
1389
|
+
/* @__PURE__ */ jsx16(DialogOverlay, {}),
|
|
1390
|
+
/* @__PURE__ */ jsx16(DialogPrimitive.Content, {
|
|
1391
|
+
"data-slot": "dialog-content",
|
|
1392
|
+
"data-mobile": mobile,
|
|
1393
|
+
ref: setPanel,
|
|
1394
|
+
className: cn2(DIALOG_CLASSES.content, MOBILE_ARMS[mobile], className),
|
|
1395
|
+
onInteractOutside: (event) => {
|
|
1396
|
+
onInteractOutside?.(event);
|
|
1397
|
+
if (!event.defaultPrevented && isTypeaheadPortalInteraction2(event)) {
|
|
1398
|
+
event.preventDefault();
|
|
1399
|
+
}
|
|
1400
|
+
},
|
|
1401
|
+
...props,
|
|
1402
|
+
children: /* @__PURE__ */ jsx16(DialogPresentationContext.Provider, {
|
|
1403
|
+
value: mobile,
|
|
1404
|
+
children: /* @__PURE__ */ jsxs7(SheetDragProvider, {
|
|
1405
|
+
value: isSheet ? handleProps : null,
|
|
1406
|
+
children: [
|
|
1407
|
+
isSheet && /* @__PURE__ */ jsxs7(Fragment3, {
|
|
1408
|
+
children: [
|
|
1409
|
+
/* @__PURE__ */ jsx16(SheetGrabber, {
|
|
1410
|
+
className: DIALOG_CLASSES.grabber
|
|
1411
|
+
}),
|
|
1412
|
+
/* @__PURE__ */ jsx16(DialogPrimitive.Close, {
|
|
1413
|
+
ref: dragCloseRef,
|
|
1414
|
+
"aria-hidden": true,
|
|
1415
|
+
tabIndex: -1,
|
|
1416
|
+
className: DIALOG_CLASSES.dragClose
|
|
1417
|
+
})
|
|
1418
|
+
]
|
|
1419
|
+
}),
|
|
1420
|
+
children,
|
|
1421
|
+
showCloseButton && /* @__PURE__ */ jsxs7(DialogPrimitive.Close, {
|
|
1422
|
+
"data-slot": "dialog-close",
|
|
1423
|
+
className: cn2(DIALOG_CLASSES.close, mobile !== `page` && DIALOG_CLASSES.closePhoneHidden),
|
|
1424
|
+
children: [
|
|
1425
|
+
/* @__PURE__ */ jsx16(XIcon2, {}),
|
|
1426
|
+
/* @__PURE__ */ jsx16("span", {
|
|
1427
|
+
className: DIALOG_CLASSES.srOnly,
|
|
1428
|
+
children: "Close"
|
|
1429
|
+
})
|
|
1430
|
+
]
|
|
1431
|
+
})
|
|
1432
|
+
]
|
|
1433
|
+
})
|
|
1434
|
+
})
|
|
1435
|
+
})
|
|
1436
|
+
]
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
function DialogHeader({ className, ...props }) {
|
|
1440
|
+
const drag = useSheetDragHandleProps();
|
|
1441
|
+
return /* @__PURE__ */ jsx16("div", {
|
|
1442
|
+
"data-slot": "dialog-header",
|
|
1443
|
+
...drag,
|
|
1444
|
+
className: cn2(DIALOG_CLASSES.header, className),
|
|
1445
|
+
...props
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
function DialogBody({ className, ...props }) {
|
|
1449
|
+
return /* @__PURE__ */ jsx16("div", {
|
|
1450
|
+
"data-slot": "dialog-body",
|
|
1451
|
+
className: cn2(DIALOG_CLASSES.body, className),
|
|
1452
|
+
...props
|
|
1453
|
+
});
|
|
1454
|
+
}
|
|
1455
|
+
function DialogFooter({ className, ...props }) {
|
|
1456
|
+
return /* @__PURE__ */ jsx16("div", {
|
|
1457
|
+
"data-slot": "dialog-footer",
|
|
1458
|
+
className: cn2(DIALOG_CLASSES.footer, className),
|
|
1459
|
+
...props
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1462
|
+
function DialogCancel({
|
|
1463
|
+
className,
|
|
1464
|
+
children = `Cancel`,
|
|
1465
|
+
...props
|
|
1466
|
+
}) {
|
|
1467
|
+
const mobile = React7.useContext(DialogPresentationContext);
|
|
1468
|
+
const keepOnMobile = mobile === `alert` || mobile === `page`;
|
|
1469
|
+
return /* @__PURE__ */ jsx16(DialogPrimitive.Close, {
|
|
1470
|
+
asChild: true,
|
|
1471
|
+
children: /* @__PURE__ */ jsx16(Button, {
|
|
1472
|
+
type: "button",
|
|
1473
|
+
variant: "ghost",
|
|
1474
|
+
"data-dialog-cancel": "",
|
|
1475
|
+
className: cn2(!keepOnMobile && DIALOG_CLASSES.cancelPhoneHidden, className),
|
|
1476
|
+
...props,
|
|
1477
|
+
children
|
|
1478
|
+
})
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
function DialogTitle({
|
|
1482
|
+
className,
|
|
1483
|
+
...props
|
|
1484
|
+
}) {
|
|
1485
|
+
return /* @__PURE__ */ jsx16(DialogPrimitive.Title, {
|
|
1486
|
+
"data-slot": "dialog-title",
|
|
1487
|
+
className: cn2(DIALOG_CLASSES.title, className),
|
|
1488
|
+
...props
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
function DialogDescription({
|
|
1492
|
+
className,
|
|
1493
|
+
...props
|
|
1494
|
+
}) {
|
|
1495
|
+
return /* @__PURE__ */ jsx16(DialogPrimitive.Description, {
|
|
1496
|
+
"data-slot": "dialog-description",
|
|
1497
|
+
className: cn2(DIALOG_CLASSES.description, className),
|
|
1498
|
+
...props
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
// packages/exponential-ui-react/src/primitives/disclosure-header.tsx
|
|
1502
|
+
import { ChevronDown, ChevronRight as ChevronRight2 } from "lucide-react";
|
|
1503
|
+
import { DISCLOSURE_HEADER_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
1504
|
+
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1505
|
+
var ChevronRightGlyph = ChevronRight2;
|
|
1506
|
+
var ChevronDownGlyph = ChevronDown;
|
|
1507
|
+
function DisclosureHeader({
|
|
1508
|
+
open,
|
|
1509
|
+
onToggle,
|
|
1510
|
+
chevron = `leading`,
|
|
1511
|
+
className,
|
|
1512
|
+
children,
|
|
1513
|
+
...props
|
|
1514
|
+
}) {
|
|
1515
|
+
const Glyph = open ? ChevronDownGlyph : ChevronRightGlyph;
|
|
1516
|
+
const glyph = /* @__PURE__ */ jsx17(Glyph, {
|
|
1517
|
+
"data-slot": "disclosure-chevron",
|
|
1518
|
+
className: cn2(DISCLOSURE_HEADER_CLASSES.chevron, chevron === `trailing` && DISCLOSURE_HEADER_CLASSES.chevronTrailing)
|
|
1519
|
+
});
|
|
1520
|
+
return /* @__PURE__ */ jsxs8("button", {
|
|
1521
|
+
type: "button",
|
|
1522
|
+
"data-slot": "disclosure-header",
|
|
1523
|
+
"data-chevron": chevron,
|
|
1524
|
+
"aria-expanded": open,
|
|
1525
|
+
onClick: onToggle,
|
|
1526
|
+
className: cn2(DISCLOSURE_HEADER_CLASSES.root, className),
|
|
1527
|
+
...props,
|
|
1528
|
+
children: [
|
|
1529
|
+
chevron === `leading` && glyph,
|
|
1530
|
+
children,
|
|
1531
|
+
chevron === `trailing` && glyph
|
|
1532
|
+
]
|
|
1533
|
+
});
|
|
1534
|
+
}
|
|
1535
|
+
// packages/exponential-ui-react/src/primitives/dock-card.tsx
|
|
1536
|
+
import * as React8 from "react";
|
|
1537
|
+
import { ChevronRight as ChevronRight3 } from "lucide-react";
|
|
1538
|
+
import { DOCK_CARD_CLASSES, DOCK_PILE_CLASSES, dockPileGeometry } from "@exponential_app/eui/web/primitives";
|
|
1539
|
+
import { DOCK_CARD_CLASSES as DOCK_CARD_CLASSES2, DOCK_PILE_CLASSES as DOCK_PILE_CLASSES2, DOCK_PILE_CONSTANTS, dockPileGeometry as dockPileGeometry2 } from "@exponential_app/eui/web/primitives";
|
|
1540
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1541
|
+
function DockCard({
|
|
1542
|
+
tint = `muted`,
|
|
1543
|
+
icon: Icon,
|
|
1544
|
+
label,
|
|
1545
|
+
caption,
|
|
1546
|
+
meta,
|
|
1547
|
+
title,
|
|
1548
|
+
onOpen,
|
|
1549
|
+
trailing,
|
|
1550
|
+
hidden = false,
|
|
1551
|
+
openLabel,
|
|
1552
|
+
className,
|
|
1553
|
+
onKeyDown,
|
|
1554
|
+
...props
|
|
1555
|
+
}) {
|
|
1556
|
+
const pressable = onOpen !== undefined;
|
|
1557
|
+
return /* @__PURE__ */ jsx18("div", {
|
|
1558
|
+
"data-slot": "dock-card",
|
|
1559
|
+
role: pressable ? `button` : undefined,
|
|
1560
|
+
tabIndex: pressable && !hidden ? 0 : undefined,
|
|
1561
|
+
"aria-label": pressable ? openLabel : undefined,
|
|
1562
|
+
"aria-hidden": hidden ? true : undefined,
|
|
1563
|
+
className: cn2(DOCK_CARD_CLASSES.root, pressable && DOCK_CARD_CLASSES.pressable, className),
|
|
1564
|
+
onClick: onOpen,
|
|
1565
|
+
onKeyDown: (event) => {
|
|
1566
|
+
onKeyDown?.(event);
|
|
1567
|
+
if (!pressable || event.defaultPrevented)
|
|
1568
|
+
return;
|
|
1569
|
+
if (event.key === `Enter` || event.key === ` `) {
|
|
1570
|
+
event.preventDefault();
|
|
1571
|
+
onOpen();
|
|
1572
|
+
}
|
|
1573
|
+
},
|
|
1574
|
+
...props,
|
|
1575
|
+
children: /* @__PURE__ */ jsxs9("div", {
|
|
1576
|
+
"data-slot": "dock-card-body",
|
|
1577
|
+
"data-hidden": hidden ? `true` : `false`,
|
|
1578
|
+
className: DOCK_CARD_CLASSES.body,
|
|
1579
|
+
children: [
|
|
1580
|
+
Icon && /* @__PURE__ */ jsx18(Icon, {
|
|
1581
|
+
"aria-hidden": true,
|
|
1582
|
+
"data-slot": "dock-card-icon",
|
|
1583
|
+
className: cn2(DOCK_CARD_CLASSES.icon, DOCK_CARD_CLASSES.tint[tint])
|
|
1584
|
+
}),
|
|
1585
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
1586
|
+
className: DOCK_CARD_CLASSES.text,
|
|
1587
|
+
children: [
|
|
1588
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
1589
|
+
className: DOCK_CARD_CLASSES.header,
|
|
1590
|
+
children: [
|
|
1591
|
+
/* @__PURE__ */ jsx18("span", {
|
|
1592
|
+
"data-slot": "dock-card-label",
|
|
1593
|
+
className: cn2(DOCK_CARD_CLASSES.label, DOCK_CARD_CLASSES.tint[tint]),
|
|
1594
|
+
children: label
|
|
1595
|
+
}),
|
|
1596
|
+
caption !== undefined && caption !== null && /* @__PURE__ */ jsx18("span", {
|
|
1597
|
+
"data-slot": "dock-card-caption",
|
|
1598
|
+
className: DOCK_CARD_CLASSES.caption,
|
|
1599
|
+
children: caption
|
|
1600
|
+
}),
|
|
1601
|
+
meta !== undefined && meta !== null && /* @__PURE__ */ jsx18("span", {
|
|
1602
|
+
"data-slot": "dock-card-meta",
|
|
1603
|
+
className: DOCK_CARD_CLASSES.meta,
|
|
1604
|
+
children: meta
|
|
1605
|
+
})
|
|
1606
|
+
]
|
|
1607
|
+
}),
|
|
1608
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
1609
|
+
className: DOCK_CARD_CLASSES.row,
|
|
1610
|
+
children: [
|
|
1611
|
+
/* @__PURE__ */ jsx18("span", {
|
|
1612
|
+
"data-slot": "dock-card-title",
|
|
1613
|
+
className: DOCK_CARD_CLASSES.title,
|
|
1614
|
+
children: title
|
|
1615
|
+
}),
|
|
1616
|
+
pressable ? /* @__PURE__ */ jsx18(ChevronRight3, {
|
|
1617
|
+
"aria-hidden": true,
|
|
1618
|
+
"data-slot": "dock-card-chevron",
|
|
1619
|
+
className: DOCK_CARD_CLASSES.chevron
|
|
1620
|
+
}) : trailing !== undefined && trailing !== null ? /* @__PURE__ */ jsx18("span", {
|
|
1621
|
+
"data-slot": "dock-card-trailing",
|
|
1622
|
+
className: DOCK_CARD_CLASSES.trailing,
|
|
1623
|
+
children: trailing
|
|
1624
|
+
}) : null
|
|
1625
|
+
]
|
|
1626
|
+
})
|
|
1627
|
+
]
|
|
1628
|
+
})
|
|
1629
|
+
]
|
|
1630
|
+
})
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
function DockPile({ items, expanded, onExpandedChange, className, style, ...props }) {
|
|
1634
|
+
const [measured, setMeasured] = React8.useState({});
|
|
1635
|
+
const nodes = React8.useRef(new Map);
|
|
1636
|
+
React8.useLayoutEffect(() => {
|
|
1637
|
+
const measure = () => {
|
|
1638
|
+
const next = {};
|
|
1639
|
+
for (const item of items) {
|
|
1640
|
+
const el = nodes.current.get(item.id);
|
|
1641
|
+
if (item.height === undefined && el)
|
|
1642
|
+
next[item.id] = el.offsetHeight;
|
|
1643
|
+
}
|
|
1644
|
+
setMeasured((prev) => Object.keys(next).length === Object.keys(prev).length && Object.entries(next).every(([k, v]) => prev[k] === v) ? prev : next);
|
|
1645
|
+
};
|
|
1646
|
+
measure();
|
|
1647
|
+
if (typeof ResizeObserver === `undefined`)
|
|
1648
|
+
return;
|
|
1649
|
+
const observer = new ResizeObserver(measure);
|
|
1650
|
+
for (const el of nodes.current.values())
|
|
1651
|
+
observer.observe(el);
|
|
1652
|
+
return () => observer.disconnect();
|
|
1653
|
+
}, [items]);
|
|
1654
|
+
const geometry = dockPileGeometry(items.map((item) => item.height ?? measured[item.id] ?? 0), expanded);
|
|
1655
|
+
return /* @__PURE__ */ jsx18("div", {
|
|
1656
|
+
"data-slot": "dock-pile",
|
|
1657
|
+
"data-expanded": expanded ? `true` : `false`,
|
|
1658
|
+
className: cn2(DOCK_PILE_CLASSES.root, className),
|
|
1659
|
+
style: { ...style, height: geometry.height },
|
|
1660
|
+
onPointerEnter: (event) => {
|
|
1661
|
+
if (event.pointerType !== `touch`)
|
|
1662
|
+
onExpandedChange?.(true);
|
|
1663
|
+
},
|
|
1664
|
+
onPointerLeave: (event) => {
|
|
1665
|
+
if (event.pointerType !== `touch`)
|
|
1666
|
+
onExpandedChange?.(false);
|
|
1667
|
+
},
|
|
1668
|
+
onFocus: () => onExpandedChange?.(true),
|
|
1669
|
+
onBlur: (event) => {
|
|
1670
|
+
const next = event.relatedTarget;
|
|
1671
|
+
if (!next || !event.currentTarget.contains(next))
|
|
1672
|
+
onExpandedChange?.(false);
|
|
1673
|
+
},
|
|
1674
|
+
...props,
|
|
1675
|
+
children: items.map((item, i) => {
|
|
1676
|
+
const placed = geometry.items[i] ?? { offset: 0, scale: 1, visible: true };
|
|
1677
|
+
return /* @__PURE__ */ jsx18("div", {
|
|
1678
|
+
ref: (el) => {
|
|
1679
|
+
if (el)
|
|
1680
|
+
nodes.current.set(item.id, el);
|
|
1681
|
+
else
|
|
1682
|
+
nodes.current.delete(item.id);
|
|
1683
|
+
},
|
|
1684
|
+
"data-slot": "dock-pile-item",
|
|
1685
|
+
"data-front": i === items.length - 1 ? `true` : `false`,
|
|
1686
|
+
"data-visible": placed.visible ? `true` : `false`,
|
|
1687
|
+
className: DOCK_PILE_CLASSES.item,
|
|
1688
|
+
style: { "--offset": `${placed.offset}px`, "--scale": `${placed.scale}`, zIndex: i + 1 },
|
|
1689
|
+
children: item.node
|
|
1690
|
+
}, item.id);
|
|
1691
|
+
})
|
|
1692
|
+
});
|
|
1693
|
+
}
|
|
1694
|
+
// packages/exponential-ui-react/src/primitives/dropdown-menu.tsx
|
|
1695
|
+
import { CheckIcon as CheckIcon2, ChevronRightIcon as ChevronRightIcon2, CircleIcon } from "lucide-react";
|
|
1696
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
1697
|
+
import { DROPDOWN_MENU_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
1698
|
+
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1699
|
+
"use client";
|
|
1700
|
+
function DropdownMenu({
|
|
1701
|
+
...props
|
|
1702
|
+
}) {
|
|
1703
|
+
return /* @__PURE__ */ jsx19(DropdownMenuPrimitive.Root, {
|
|
1704
|
+
"data-slot": "dropdown-menu",
|
|
1705
|
+
...props
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
function DropdownMenuPortal({
|
|
1709
|
+
...props
|
|
1710
|
+
}) {
|
|
1711
|
+
return /* @__PURE__ */ jsx19(DropdownMenuPrimitive.Portal, {
|
|
1712
|
+
"data-slot": "dropdown-menu-portal",
|
|
1713
|
+
...props
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
function DropdownMenuTrigger({
|
|
1717
|
+
...props
|
|
1718
|
+
}) {
|
|
1719
|
+
return /* @__PURE__ */ jsx19(DropdownMenuPrimitive.Trigger, {
|
|
1720
|
+
"data-slot": "dropdown-menu-trigger",
|
|
1721
|
+
...props
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
function DropdownMenuContent({
|
|
1725
|
+
className,
|
|
1726
|
+
sideOffset = 4,
|
|
1727
|
+
...props
|
|
1728
|
+
}) {
|
|
1729
|
+
return /* @__PURE__ */ jsx19(DropdownMenuPrimitive.Portal, {
|
|
1730
|
+
children: /* @__PURE__ */ jsx19(DropdownMenuPrimitive.Content, {
|
|
1731
|
+
"data-slot": "dropdown-menu-content",
|
|
1732
|
+
sideOffset,
|
|
1733
|
+
className: cn2(DROPDOWN_MENU_CLASSES.content, className),
|
|
1734
|
+
...props
|
|
1735
|
+
})
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
function DropdownMenuGroup({
|
|
1739
|
+
...props
|
|
1740
|
+
}) {
|
|
1741
|
+
return /* @__PURE__ */ jsx19(DropdownMenuPrimitive.Group, {
|
|
1742
|
+
"data-slot": "dropdown-menu-group",
|
|
1743
|
+
...props
|
|
1744
|
+
});
|
|
1745
|
+
}
|
|
1746
|
+
function DropdownMenuItem({
|
|
1747
|
+
className,
|
|
1748
|
+
inset,
|
|
1749
|
+
variant = `default`,
|
|
1750
|
+
...props
|
|
1751
|
+
}) {
|
|
1752
|
+
return /* @__PURE__ */ jsx19(DropdownMenuPrimitive.Item, {
|
|
1753
|
+
"data-slot": "dropdown-menu-item",
|
|
1754
|
+
"data-inset": inset,
|
|
1755
|
+
"data-variant": variant,
|
|
1756
|
+
className: cn2(DROPDOWN_MENU_CLASSES.item, className),
|
|
1757
|
+
...props
|
|
1758
|
+
});
|
|
1759
|
+
}
|
|
1760
|
+
function DropdownMenuCheckboxItem({
|
|
1761
|
+
className,
|
|
1762
|
+
children,
|
|
1763
|
+
checked,
|
|
1764
|
+
...props
|
|
1765
|
+
}) {
|
|
1766
|
+
return /* @__PURE__ */ jsxs10(DropdownMenuPrimitive.CheckboxItem, {
|
|
1767
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
1768
|
+
className: cn2(DROPDOWN_MENU_CLASSES.checkItem, className),
|
|
1769
|
+
checked,
|
|
1770
|
+
...props,
|
|
1771
|
+
children: [
|
|
1772
|
+
/* @__PURE__ */ jsx19("span", {
|
|
1773
|
+
className: DROPDOWN_MENU_CLASSES.itemIndicator,
|
|
1774
|
+
children: /* @__PURE__ */ jsx19(DropdownMenuPrimitive.ItemIndicator, {
|
|
1775
|
+
children: /* @__PURE__ */ jsx19(CheckIcon2, {
|
|
1776
|
+
className: DROPDOWN_MENU_CLASSES.checkIcon
|
|
1777
|
+
})
|
|
1778
|
+
})
|
|
1779
|
+
}),
|
|
1780
|
+
children
|
|
1781
|
+
]
|
|
1782
|
+
});
|
|
1783
|
+
}
|
|
1784
|
+
function DropdownMenuRadioGroup({
|
|
1785
|
+
...props
|
|
1786
|
+
}) {
|
|
1787
|
+
return /* @__PURE__ */ jsx19(DropdownMenuPrimitive.RadioGroup, {
|
|
1788
|
+
"data-slot": "dropdown-menu-radio-group",
|
|
1789
|
+
...props
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1792
|
+
function DropdownMenuRadioItem({
|
|
1793
|
+
className,
|
|
1794
|
+
children,
|
|
1795
|
+
...props
|
|
1796
|
+
}) {
|
|
1797
|
+
return /* @__PURE__ */ jsxs10(DropdownMenuPrimitive.RadioItem, {
|
|
1798
|
+
"data-slot": "dropdown-menu-radio-item",
|
|
1799
|
+
className: cn2(DROPDOWN_MENU_CLASSES.checkItem, className),
|
|
1800
|
+
...props,
|
|
1801
|
+
children: [
|
|
1802
|
+
/* @__PURE__ */ jsx19("span", {
|
|
1803
|
+
className: DROPDOWN_MENU_CLASSES.itemIndicator,
|
|
1804
|
+
children: /* @__PURE__ */ jsx19(DropdownMenuPrimitive.ItemIndicator, {
|
|
1805
|
+
children: /* @__PURE__ */ jsx19(CircleIcon, {
|
|
1806
|
+
className: DROPDOWN_MENU_CLASSES.radioIcon
|
|
1807
|
+
})
|
|
1808
|
+
})
|
|
1809
|
+
}),
|
|
1810
|
+
children
|
|
1811
|
+
]
|
|
1812
|
+
});
|
|
1813
|
+
}
|
|
1814
|
+
function DropdownMenuLabel({
|
|
1815
|
+
className,
|
|
1816
|
+
inset,
|
|
1817
|
+
...props
|
|
1818
|
+
}) {
|
|
1819
|
+
return /* @__PURE__ */ jsx19(DropdownMenuPrimitive.Label, {
|
|
1820
|
+
"data-slot": "dropdown-menu-label",
|
|
1821
|
+
"data-inset": inset,
|
|
1822
|
+
className: cn2(DROPDOWN_MENU_CLASSES.label, className),
|
|
1823
|
+
...props
|
|
1824
|
+
});
|
|
1825
|
+
}
|
|
1826
|
+
function DropdownMenuSeparator({
|
|
1827
|
+
className,
|
|
1828
|
+
...props
|
|
1829
|
+
}) {
|
|
1830
|
+
return /* @__PURE__ */ jsx19(DropdownMenuPrimitive.Separator, {
|
|
1831
|
+
"data-slot": "dropdown-menu-separator",
|
|
1832
|
+
className: cn2(DROPDOWN_MENU_CLASSES.separator, className),
|
|
1833
|
+
...props
|
|
1834
|
+
});
|
|
1835
|
+
}
|
|
1836
|
+
function DropdownMenuShortcut({
|
|
1837
|
+
className,
|
|
1838
|
+
...props
|
|
1839
|
+
}) {
|
|
1840
|
+
return /* @__PURE__ */ jsx19("span", {
|
|
1841
|
+
"data-slot": "dropdown-menu-shortcut",
|
|
1842
|
+
className: cn2(DROPDOWN_MENU_CLASSES.shortcut, className),
|
|
1843
|
+
...props
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
function DropdownMenuSub({
|
|
1847
|
+
...props
|
|
1848
|
+
}) {
|
|
1849
|
+
return /* @__PURE__ */ jsx19(DropdownMenuPrimitive.Sub, {
|
|
1850
|
+
"data-slot": "dropdown-menu-sub",
|
|
1851
|
+
...props
|
|
1852
|
+
});
|
|
1853
|
+
}
|
|
1854
|
+
function DropdownMenuSubTrigger({
|
|
1855
|
+
className,
|
|
1856
|
+
inset,
|
|
1857
|
+
children,
|
|
1858
|
+
variant = `default`,
|
|
1859
|
+
...props
|
|
1860
|
+
}) {
|
|
1861
|
+
return /* @__PURE__ */ jsxs10(DropdownMenuPrimitive.SubTrigger, {
|
|
1862
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
1863
|
+
"data-inset": inset,
|
|
1864
|
+
"data-variant": variant,
|
|
1865
|
+
className: cn2(DROPDOWN_MENU_CLASSES.subTrigger, className),
|
|
1866
|
+
...props,
|
|
1867
|
+
children: [
|
|
1868
|
+
children,
|
|
1869
|
+
/* @__PURE__ */ jsx19(ChevronRightIcon2, {
|
|
1870
|
+
className: DROPDOWN_MENU_CLASSES.subChevron
|
|
1871
|
+
})
|
|
1872
|
+
]
|
|
1873
|
+
});
|
|
1874
|
+
}
|
|
1875
|
+
function DropdownMenuSubContent({
|
|
1876
|
+
className,
|
|
1877
|
+
...props
|
|
1878
|
+
}) {
|
|
1879
|
+
return /* @__PURE__ */ jsx19(DropdownMenuPrimitive.Portal, {
|
|
1880
|
+
children: /* @__PURE__ */ jsx19(DropdownMenuPrimitive.SubContent, {
|
|
1881
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
1882
|
+
className: cn2(DROPDOWN_MENU_CLASSES.subContent, className),
|
|
1883
|
+
...props
|
|
1884
|
+
})
|
|
1885
|
+
});
|
|
1886
|
+
}
|
|
1887
|
+
// packages/exponential-ui-react/src/primitives/empty-state.tsx
|
|
1888
|
+
import { EMPTY_STATE_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
1889
|
+
|
|
1890
|
+
// packages/exponential-ui-react/src/primitives/icon-disc.tsx
|
|
1891
|
+
import { ICON_DISC_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
1892
|
+
import { ICON_DISC_TONES } from "@exponential_app/eui/web/primitives";
|
|
1893
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1894
|
+
function IconDisc({
|
|
1895
|
+
icon: Icon,
|
|
1896
|
+
tone = `primary`,
|
|
1897
|
+
strokeWidth,
|
|
1898
|
+
className
|
|
1899
|
+
}) {
|
|
1900
|
+
return /* @__PURE__ */ jsx20("div", {
|
|
1901
|
+
"data-slot": "icon-disc",
|
|
1902
|
+
className: cn2(ICON_DISC_CLASSES.root, ICON_DISC_CLASSES.tones[tone], className),
|
|
1903
|
+
children: /* @__PURE__ */ jsx20(Icon, {
|
|
1904
|
+
className: ICON_DISC_CLASSES.icon,
|
|
1905
|
+
strokeWidth,
|
|
1906
|
+
"aria-hidden": "true",
|
|
1907
|
+
focusable: "false"
|
|
1908
|
+
})
|
|
1909
|
+
});
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
// packages/exponential-ui-react/src/primitives/empty-state.tsx
|
|
1913
|
+
import { EMPTY_STATE_SIZES } from "@exponential_app/eui/web/primitives";
|
|
1914
|
+
import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1915
|
+
function EmptyState({
|
|
1916
|
+
icon: Icon,
|
|
1917
|
+
title,
|
|
1918
|
+
description,
|
|
1919
|
+
size = `page`,
|
|
1920
|
+
className,
|
|
1921
|
+
children
|
|
1922
|
+
}) {
|
|
1923
|
+
if (size === `list`) {
|
|
1924
|
+
return /* @__PURE__ */ jsxs11("div", {
|
|
1925
|
+
"data-slot": "empty-state",
|
|
1926
|
+
"data-size": "list",
|
|
1927
|
+
role: "status",
|
|
1928
|
+
className: cn2(EMPTY_STATE_CLASSES.list, className),
|
|
1929
|
+
children: [
|
|
1930
|
+
Icon && /* @__PURE__ */ jsx21(Icon, {
|
|
1931
|
+
"aria-hidden": "true",
|
|
1932
|
+
focusable: "false",
|
|
1933
|
+
className: EMPTY_STATE_CLASSES.listIcon
|
|
1934
|
+
}),
|
|
1935
|
+
/* @__PURE__ */ jsx21("span", {
|
|
1936
|
+
children: title
|
|
1937
|
+
})
|
|
1938
|
+
]
|
|
1939
|
+
});
|
|
1940
|
+
}
|
|
1941
|
+
return /* @__PURE__ */ jsxs11("div", {
|
|
1942
|
+
"data-slot": "empty-state",
|
|
1943
|
+
"data-size": "page",
|
|
1944
|
+
role: "status",
|
|
1945
|
+
className: cn2(EMPTY_STATE_CLASSES.page, className),
|
|
1946
|
+
children: [
|
|
1947
|
+
Icon && /* @__PURE__ */ jsx21(IconDisc, {
|
|
1948
|
+
icon: Icon
|
|
1949
|
+
}),
|
|
1950
|
+
/* @__PURE__ */ jsx21("h2", {
|
|
1951
|
+
className: EMPTY_STATE_CLASSES.pageTitle,
|
|
1952
|
+
children: title
|
|
1953
|
+
}),
|
|
1954
|
+
description && /* @__PURE__ */ jsx21("p", {
|
|
1955
|
+
className: EMPTY_STATE_CLASSES.pageDescription,
|
|
1956
|
+
children: description
|
|
1957
|
+
}),
|
|
1958
|
+
children && /* @__PURE__ */ jsx21("div", {
|
|
1959
|
+
className: EMPTY_STATE_CLASSES.pageActions,
|
|
1960
|
+
children
|
|
1961
|
+
})
|
|
1962
|
+
]
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
function ListEmpty({
|
|
1966
|
+
className,
|
|
1967
|
+
children,
|
|
1968
|
+
...props
|
|
1969
|
+
}) {
|
|
1970
|
+
return /* @__PURE__ */ jsx21("p", {
|
|
1971
|
+
"data-slot": "list-empty",
|
|
1972
|
+
role: "status",
|
|
1973
|
+
className: cn2(EMPTY_STATE_CLASSES.listEmpty, className),
|
|
1974
|
+
...props,
|
|
1975
|
+
children
|
|
1976
|
+
});
|
|
1977
|
+
}
|
|
1978
|
+
function EmptyCta({
|
|
1979
|
+
icon: Icon,
|
|
1980
|
+
title,
|
|
1981
|
+
description,
|
|
1982
|
+
className,
|
|
1983
|
+
type,
|
|
1984
|
+
...props
|
|
1985
|
+
}) {
|
|
1986
|
+
return /* @__PURE__ */ jsxs11("button", {
|
|
1987
|
+
type: type ?? `button`,
|
|
1988
|
+
"data-slot": "empty-cta",
|
|
1989
|
+
className: cn2(EMPTY_STATE_CLASSES.cta, className),
|
|
1990
|
+
...props,
|
|
1991
|
+
children: [
|
|
1992
|
+
/* @__PURE__ */ jsxs11("span", {
|
|
1993
|
+
className: EMPTY_STATE_CLASSES.ctaTitle,
|
|
1994
|
+
children: [
|
|
1995
|
+
/* @__PURE__ */ jsx21(Icon, {
|
|
1996
|
+
className: EMPTY_STATE_CLASSES.ctaIcon
|
|
1997
|
+
}),
|
|
1998
|
+
title
|
|
1999
|
+
]
|
|
2000
|
+
}),
|
|
2001
|
+
/* @__PURE__ */ jsx21("span", {
|
|
2002
|
+
className: EMPTY_STATE_CLASSES.ctaDescription,
|
|
2003
|
+
children: description
|
|
2004
|
+
})
|
|
2005
|
+
]
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
2008
|
+
// packages/exponential-ui-react/src/primitives/glass-card.tsx
|
|
2009
|
+
import { GLASS_CARD_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2010
|
+
import { GLASS_CARD_CLASS, GLASS_CARD_CLASSES as GLASS_CARD_CLASSES2 } from "@exponential_app/eui/web/primitives";
|
|
2011
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2012
|
+
function GlassCard({ className, ...props }) {
|
|
2013
|
+
return /* @__PURE__ */ jsx22("div", {
|
|
2014
|
+
"data-slot": "glass-card",
|
|
2015
|
+
className: cn2(GLASS_CARD_CLASSES.root, className),
|
|
2016
|
+
...props
|
|
2017
|
+
});
|
|
2018
|
+
}
|
|
2019
|
+
// packages/exponential-ui-react/src/primitives/hover-card.tsx
|
|
2020
|
+
import { HoverCard as HoverCardPrimitive } from "radix-ui";
|
|
2021
|
+
import { HOVER_CARD_CLASSES, HOVER_CARD_DELAYS } from "@exponential_app/eui/web/primitives";
|
|
2022
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
2023
|
+
function HoverCard({
|
|
2024
|
+
openDelay = HOVER_CARD_DELAYS.openDelay,
|
|
2025
|
+
closeDelay = HOVER_CARD_DELAYS.closeDelay,
|
|
2026
|
+
...props
|
|
2027
|
+
}) {
|
|
2028
|
+
return /* @__PURE__ */ jsx23(HoverCardPrimitive.Root, {
|
|
2029
|
+
"data-slot": "hover-card",
|
|
2030
|
+
openDelay,
|
|
2031
|
+
closeDelay,
|
|
2032
|
+
...props
|
|
2033
|
+
});
|
|
2034
|
+
}
|
|
2035
|
+
function HoverCardTrigger({
|
|
2036
|
+
...props
|
|
2037
|
+
}) {
|
|
2038
|
+
return /* @__PURE__ */ jsx23(HoverCardPrimitive.Trigger, {
|
|
2039
|
+
"data-slot": "hover-card-trigger",
|
|
2040
|
+
...props
|
|
2041
|
+
});
|
|
2042
|
+
}
|
|
2043
|
+
function HoverCardContent({
|
|
2044
|
+
className,
|
|
2045
|
+
align = `start`,
|
|
2046
|
+
sideOffset = 6,
|
|
2047
|
+
...props
|
|
2048
|
+
}) {
|
|
2049
|
+
return /* @__PURE__ */ jsx23(HoverCardPrimitive.Portal, {
|
|
2050
|
+
children: /* @__PURE__ */ jsx23(HoverCardPrimitive.Content, {
|
|
2051
|
+
"data-slot": "hover-card-content",
|
|
2052
|
+
align,
|
|
2053
|
+
sideOffset,
|
|
2054
|
+
className: cn2(HOVER_CARD_CLASSES.content, className),
|
|
2055
|
+
...props
|
|
2056
|
+
})
|
|
2057
|
+
});
|
|
2058
|
+
}
|
|
2059
|
+
// packages/exponential-ui-react/src/primitives/input.tsx
|
|
2060
|
+
import * as React9 from "react";
|
|
2061
|
+
import { INPUT_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2062
|
+
import { BARE_FIELD_CLASS, FIELD_CHROME_CLASS } from "@exponential_app/eui/web/primitives";
|
|
2063
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
2064
|
+
var Input = React9.forwardRef(({ className, type, ...props }, ref) => {
|
|
2065
|
+
return /* @__PURE__ */ jsx24("input", {
|
|
2066
|
+
ref,
|
|
2067
|
+
type,
|
|
2068
|
+
"data-slot": "input",
|
|
2069
|
+
className: cn2(INPUT_CLASSES.root, className),
|
|
2070
|
+
...props
|
|
2071
|
+
});
|
|
2072
|
+
});
|
|
2073
|
+
Input.displayName = `Input`;
|
|
2074
|
+
// packages/exponential-ui-react/src/primitives/kbd.tsx
|
|
2075
|
+
import { KBD_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2076
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
2077
|
+
function Kbd({ className, ...props }) {
|
|
2078
|
+
return /* @__PURE__ */ jsx25("kbd", {
|
|
2079
|
+
"data-slot": "kbd",
|
|
2080
|
+
className: cn2(KBD_CLASSES.root, className),
|
|
2081
|
+
...props
|
|
2082
|
+
});
|
|
2083
|
+
}
|
|
2084
|
+
function KbdGroup({ className, ...props }) {
|
|
2085
|
+
return /* @__PURE__ */ jsx25("span", {
|
|
2086
|
+
"data-slot": "kbd-group",
|
|
2087
|
+
className: cn2(KBD_CLASSES.group, className),
|
|
2088
|
+
...props
|
|
2089
|
+
});
|
|
2090
|
+
}
|
|
2091
|
+
// packages/exponential-ui-react/src/primitives/label.tsx
|
|
2092
|
+
import { Label as LabelPrimitive } from "radix-ui";
|
|
2093
|
+
import { LABEL_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2094
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
2095
|
+
function Label({
|
|
2096
|
+
className,
|
|
2097
|
+
...props
|
|
2098
|
+
}) {
|
|
2099
|
+
return /* @__PURE__ */ jsx26(LabelPrimitive.Root, {
|
|
2100
|
+
"data-slot": "label",
|
|
2101
|
+
className: cn2(LABEL_CLASSES.root, className),
|
|
2102
|
+
...props
|
|
2103
|
+
});
|
|
2104
|
+
}
|
|
2105
|
+
// packages/exponential-ui-react/src/primitives/menu-surface.ts
|
|
2106
|
+
import { MENU_CHECK_ITEM_CLASS, MENU_CHEVRON_CLASS, MENU_CONTENT_CLASS, MENU_ITEM_CLASS, MENU_LABEL_CLASS, MENU_SEPARATOR_CLASS, MENU_SHORTCUT_CLASS, MENU_SUB_TRIGGER_CLASS, MENU_SURFACE_CLASS, MENU_VALUE_CLASS } from "@exponential_app/eui/web/primitives";
|
|
2107
|
+
// packages/exponential-ui-react/src/primitives/meter.tsx
|
|
2108
|
+
import { METER_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2109
|
+
|
|
2110
|
+
// packages/exponential-ui-react/src/primitives/progress.tsx
|
|
2111
|
+
import { Progress as ProgressPrimitive } from "radix-ui";
|
|
2112
|
+
import { PROGRESS_CLASSES, progressIndicatorTransform } from "@exponential_app/eui/web/primitives";
|
|
2113
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
2114
|
+
function Progress({
|
|
2115
|
+
className,
|
|
2116
|
+
value,
|
|
2117
|
+
...props
|
|
2118
|
+
}) {
|
|
2119
|
+
const indeterminate = value === null || value === undefined;
|
|
2120
|
+
return /* @__PURE__ */ jsx27(ProgressPrimitive.Root, {
|
|
2121
|
+
"data-slot": "progress",
|
|
2122
|
+
value,
|
|
2123
|
+
className: cn2(PROGRESS_CLASSES.root, className),
|
|
2124
|
+
...props,
|
|
2125
|
+
children: /* @__PURE__ */ jsx27(ProgressPrimitive.Indicator, {
|
|
2126
|
+
"data-slot": "progress-indicator",
|
|
2127
|
+
className: cn2(PROGRESS_CLASSES.indicator, indeterminate ? PROGRESS_CLASSES.indicatorIndeterminate : PROGRESS_CLASSES.indicatorDeterminate),
|
|
2128
|
+
style: indeterminate ? undefined : { transform: progressIndicatorTransform(value) }
|
|
2129
|
+
})
|
|
2130
|
+
});
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
// packages/exponential-ui-react/src/primitives/meter.tsx
|
|
2134
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
2135
|
+
function Meter({
|
|
2136
|
+
value,
|
|
2137
|
+
tone = `normal`,
|
|
2138
|
+
className,
|
|
2139
|
+
...props
|
|
2140
|
+
}) {
|
|
2141
|
+
return /* @__PURE__ */ jsx28(Progress, {
|
|
2142
|
+
"data-slot": "meter",
|
|
2143
|
+
"data-tone": tone,
|
|
2144
|
+
value,
|
|
2145
|
+
className: cn2(METER_CLASSES.root, METER_CLASSES.tones[tone], className),
|
|
2146
|
+
...props
|
|
2147
|
+
});
|
|
2148
|
+
}
|
|
2149
|
+
// packages/exponential-ui-react/src/primitives/popover.tsx
|
|
2150
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
2151
|
+
import { POPOVER_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2152
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
2153
|
+
function Popover({
|
|
2154
|
+
...props
|
|
2155
|
+
}) {
|
|
2156
|
+
return /* @__PURE__ */ jsx29(PopoverPrimitive.Root, {
|
|
2157
|
+
"data-slot": "popover",
|
|
2158
|
+
...props
|
|
2159
|
+
});
|
|
2160
|
+
}
|
|
2161
|
+
function PopoverTrigger({
|
|
2162
|
+
...props
|
|
2163
|
+
}) {
|
|
2164
|
+
return /* @__PURE__ */ jsx29(PopoverPrimitive.Trigger, {
|
|
2165
|
+
"data-slot": "popover-trigger",
|
|
2166
|
+
...props
|
|
2167
|
+
});
|
|
2168
|
+
}
|
|
2169
|
+
function PopoverContent({
|
|
2170
|
+
className,
|
|
2171
|
+
align = `center`,
|
|
2172
|
+
sideOffset = 4,
|
|
2173
|
+
...props
|
|
2174
|
+
}) {
|
|
2175
|
+
return /* @__PURE__ */ jsx29(PopoverPrimitive.Portal, {
|
|
2176
|
+
children: /* @__PURE__ */ jsx29(PopoverPrimitive.Content, {
|
|
2177
|
+
"data-slot": "popover-content",
|
|
2178
|
+
align,
|
|
2179
|
+
sideOffset,
|
|
2180
|
+
className: cn2(POPOVER_CLASSES.content, className),
|
|
2181
|
+
...props
|
|
2182
|
+
})
|
|
2183
|
+
});
|
|
2184
|
+
}
|
|
2185
|
+
function PopoverAnchor({
|
|
2186
|
+
...props
|
|
2187
|
+
}) {
|
|
2188
|
+
return /* @__PURE__ */ jsx29(PopoverPrimitive.Anchor, {
|
|
2189
|
+
"data-slot": "popover-anchor",
|
|
2190
|
+
...props
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2193
|
+
// packages/exponential-ui-react/src/primitives/progress-ring.tsx
|
|
2194
|
+
import { PROGRESS_RING_CLASSES, RING_RADIUS as RING_RADIUS3, RING_SIZE as RING_SIZE3, RING_STROKE as RING_STROKE3, progressRingPercent, ringGeometry as ringGeometry3 } from "@exponential_app/eui/web/primitives";
|
|
2195
|
+
import { progressRingPercent as progressRingPercent2 } from "@exponential_app/eui/web/primitives";
|
|
2196
|
+
import { jsx as jsx30, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2197
|
+
function ProgressRing({
|
|
2198
|
+
done,
|
|
2199
|
+
total,
|
|
2200
|
+
size = 14,
|
|
2201
|
+
colorClass,
|
|
2202
|
+
colorHex,
|
|
2203
|
+
className
|
|
2204
|
+
}) {
|
|
2205
|
+
const { circumference, dashOffset } = ringGeometry3(progressRingPercent(done, total));
|
|
2206
|
+
const centre = RING_SIZE3 / 2;
|
|
2207
|
+
return /* @__PURE__ */ jsxs12("svg", {
|
|
2208
|
+
viewBox: `0 0 ${RING_SIZE3} ${RING_SIZE3}`,
|
|
2209
|
+
width: size,
|
|
2210
|
+
height: size,
|
|
2211
|
+
"aria-hidden": true,
|
|
2212
|
+
"data-slot": "progress-ring",
|
|
2213
|
+
"data-done": done,
|
|
2214
|
+
"data-total": total,
|
|
2215
|
+
className: cn2(PROGRESS_RING_CLASSES.root, colorClass, className),
|
|
2216
|
+
style: colorHex ? { color: colorHex } : undefined,
|
|
2217
|
+
children: [
|
|
2218
|
+
/* @__PURE__ */ jsx30("circle", {
|
|
2219
|
+
cx: centre,
|
|
2220
|
+
cy: centre,
|
|
2221
|
+
r: RING_RADIUS3,
|
|
2222
|
+
fill: "none",
|
|
2223
|
+
stroke: "currentColor",
|
|
2224
|
+
strokeWidth: RING_STROKE3,
|
|
2225
|
+
opacity: 0.2
|
|
2226
|
+
}),
|
|
2227
|
+
done > 0 && /* @__PURE__ */ jsx30("circle", {
|
|
2228
|
+
"data-slot": "progress-ring-arc",
|
|
2229
|
+
cx: centre,
|
|
2230
|
+
cy: centre,
|
|
2231
|
+
r: RING_RADIUS3,
|
|
2232
|
+
fill: "none",
|
|
2233
|
+
stroke: "currentColor",
|
|
2234
|
+
strokeWidth: RING_STROKE3,
|
|
2235
|
+
strokeLinecap: "round",
|
|
2236
|
+
strokeDasharray: circumference,
|
|
2237
|
+
strokeDashoffset: dashOffset
|
|
2238
|
+
})
|
|
2239
|
+
]
|
|
2240
|
+
});
|
|
2241
|
+
}
|
|
2242
|
+
// packages/exponential-ui-react/src/primitives/scroll-area.tsx
|
|
2243
|
+
import { ScrollArea as ScrollAreaPrimitive } from "radix-ui";
|
|
2244
|
+
import { SCROLL_AREA_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2245
|
+
import { jsx as jsx31, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2246
|
+
function ScrollArea({ className, children, ...props }) {
|
|
2247
|
+
return /* @__PURE__ */ jsxs13(ScrollAreaPrimitive.Root, {
|
|
2248
|
+
"data-slot": "scroll-area",
|
|
2249
|
+
className: cn2(SCROLL_AREA_CLASSES.root, className),
|
|
2250
|
+
...props,
|
|
2251
|
+
children: [
|
|
2252
|
+
/* @__PURE__ */ jsx31(ScrollAreaPrimitive.Viewport, {
|
|
2253
|
+
"data-slot": "scroll-area-viewport",
|
|
2254
|
+
className: SCROLL_AREA_CLASSES.viewport,
|
|
2255
|
+
children
|
|
2256
|
+
}),
|
|
2257
|
+
/* @__PURE__ */ jsx31(ScrollBar, {}),
|
|
2258
|
+
/* @__PURE__ */ jsx31(ScrollAreaPrimitive.Corner, {})
|
|
2259
|
+
]
|
|
2260
|
+
});
|
|
2261
|
+
}
|
|
2262
|
+
function ScrollBar({ className, orientation = `vertical`, ...props }) {
|
|
2263
|
+
return /* @__PURE__ */ jsx31(ScrollAreaPrimitive.ScrollAreaScrollbar, {
|
|
2264
|
+
"data-slot": "scroll-area-scrollbar",
|
|
2265
|
+
orientation,
|
|
2266
|
+
className: cn2(SCROLL_AREA_CLASSES.scrollbar, SCROLL_AREA_CLASSES.orientations[orientation], className),
|
|
2267
|
+
...props,
|
|
2268
|
+
children: /* @__PURE__ */ jsx31(ScrollAreaPrimitive.ScrollAreaThumb, {
|
|
2269
|
+
"data-slot": "scroll-area-thumb",
|
|
2270
|
+
className: SCROLL_AREA_CLASSES.thumb
|
|
2271
|
+
})
|
|
2272
|
+
});
|
|
2273
|
+
}
|
|
2274
|
+
// packages/exponential-ui-react/src/primitives/segmented-control.tsx
|
|
2275
|
+
import { SEGMENTED_CONTROL_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2276
|
+
|
|
2277
|
+
// packages/exponential-ui-react/src/primitives/tabs.tsx
|
|
2278
|
+
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
2279
|
+
import { TABS_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2280
|
+
import { SEGMENTED_ITEM, SEGMENTED_LIST, SEGMENTED_ROW, SEGMENTED_ROW_COMPACT, SEGMENTED_TAB } from "@exponential_app/eui/web/primitives";
|
|
2281
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
2282
|
+
function Tabs({
|
|
2283
|
+
className,
|
|
2284
|
+
...props
|
|
2285
|
+
}) {
|
|
2286
|
+
return /* @__PURE__ */ jsx32(TabsPrimitive.Root, {
|
|
2287
|
+
"data-slot": "tabs",
|
|
2288
|
+
className: cn2(TABS_CLASSES.root, className),
|
|
2289
|
+
...props
|
|
2290
|
+
});
|
|
2291
|
+
}
|
|
2292
|
+
function TabsList({
|
|
2293
|
+
className,
|
|
2294
|
+
...props
|
|
2295
|
+
}) {
|
|
2296
|
+
return /* @__PURE__ */ jsx32(TabsPrimitive.List, {
|
|
2297
|
+
"data-slot": "tabs-list",
|
|
2298
|
+
className: cn2(TABS_CLASSES.list, className),
|
|
2299
|
+
...props
|
|
2300
|
+
});
|
|
2301
|
+
}
|
|
2302
|
+
function TabsTrigger({
|
|
2303
|
+
className,
|
|
2304
|
+
...props
|
|
2305
|
+
}) {
|
|
2306
|
+
return /* @__PURE__ */ jsx32(TabsPrimitive.Trigger, {
|
|
2307
|
+
"data-slot": "tabs-trigger",
|
|
2308
|
+
className: cn2(TABS_CLASSES.trigger, className),
|
|
2309
|
+
...props
|
|
2310
|
+
});
|
|
2311
|
+
}
|
|
2312
|
+
function TabsContent({
|
|
2313
|
+
className,
|
|
2314
|
+
...props
|
|
2315
|
+
}) {
|
|
2316
|
+
return /* @__PURE__ */ jsx32(TabsPrimitive.Content, {
|
|
2317
|
+
"data-slot": "tabs-content",
|
|
2318
|
+
className: cn2(TABS_CLASSES.content, className),
|
|
2319
|
+
...props
|
|
2320
|
+
});
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
// packages/exponential-ui-react/src/primitives/segmented-control.tsx
|
|
2324
|
+
import { jsx as jsx33, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2325
|
+
function SegmentedControl({
|
|
2326
|
+
value,
|
|
2327
|
+
onValueChange,
|
|
2328
|
+
options,
|
|
2329
|
+
fill = false,
|
|
2330
|
+
disabled = false,
|
|
2331
|
+
className
|
|
2332
|
+
}) {
|
|
2333
|
+
const triggers = options.map((option) => {
|
|
2334
|
+
const Glyph = option.icon;
|
|
2335
|
+
return /* @__PURE__ */ jsxs14(TabsTrigger, {
|
|
2336
|
+
value: option.value,
|
|
2337
|
+
disabled: disabled || option.disabled,
|
|
2338
|
+
className: SEGMENTED_CONTROL_CLASSES.trigger,
|
|
2339
|
+
children: [
|
|
2340
|
+
Glyph ? /* @__PURE__ */ jsx33(Glyph, {
|
|
2341
|
+
"aria-hidden": true
|
|
2342
|
+
}) : null,
|
|
2343
|
+
option.label
|
|
2344
|
+
]
|
|
2345
|
+
}, option.value);
|
|
2346
|
+
});
|
|
2347
|
+
return /* @__PURE__ */ jsx33(Tabs, {
|
|
2348
|
+
"data-slot": "segmented-control",
|
|
2349
|
+
value,
|
|
2350
|
+
onValueChange: (next) => onValueChange(next),
|
|
2351
|
+
children: /* @__PURE__ */ jsx33(TabsList, {
|
|
2352
|
+
className: cn2(fill && SEGMENTED_CONTROL_CLASSES.fill, className),
|
|
2353
|
+
children: triggers
|
|
2354
|
+
})
|
|
2355
|
+
});
|
|
2356
|
+
}
|
|
2357
|
+
// packages/exponential-ui-react/src/primitives/select.tsx
|
|
2358
|
+
import { CheckIcon as CheckIcon3, ChevronDownIcon as ChevronDownIcon2, ChevronUpIcon } from "lucide-react";
|
|
2359
|
+
import { Select as SelectPrimitive } from "radix-ui";
|
|
2360
|
+
import { SELECT_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2361
|
+
import { jsx as jsx34, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2362
|
+
"use client";
|
|
2363
|
+
function Select({
|
|
2364
|
+
...props
|
|
2365
|
+
}) {
|
|
2366
|
+
return /* @__PURE__ */ jsx34(SelectPrimitive.Root, {
|
|
2367
|
+
"data-slot": "select",
|
|
2368
|
+
...props
|
|
2369
|
+
});
|
|
2370
|
+
}
|
|
2371
|
+
function SelectGroup({
|
|
2372
|
+
...props
|
|
2373
|
+
}) {
|
|
2374
|
+
return /* @__PURE__ */ jsx34(SelectPrimitive.Group, {
|
|
2375
|
+
"data-slot": "select-group",
|
|
2376
|
+
...props
|
|
2377
|
+
});
|
|
2378
|
+
}
|
|
2379
|
+
function SelectValue({
|
|
2380
|
+
...props
|
|
2381
|
+
}) {
|
|
2382
|
+
return /* @__PURE__ */ jsx34(SelectPrimitive.Value, {
|
|
2383
|
+
"data-slot": "select-value",
|
|
2384
|
+
...props
|
|
2385
|
+
});
|
|
2386
|
+
}
|
|
2387
|
+
function SelectTrigger({
|
|
2388
|
+
className,
|
|
2389
|
+
size = `default`,
|
|
2390
|
+
children,
|
|
2391
|
+
...props
|
|
2392
|
+
}) {
|
|
2393
|
+
return /* @__PURE__ */ jsxs15(SelectPrimitive.Trigger, {
|
|
2394
|
+
"data-slot": "select-trigger",
|
|
2395
|
+
"data-size": size,
|
|
2396
|
+
className: cn2(SELECT_CLASSES.trigger, className),
|
|
2397
|
+
...props,
|
|
2398
|
+
children: [
|
|
2399
|
+
children,
|
|
2400
|
+
/* @__PURE__ */ jsx34(SelectPrimitive.Icon, {
|
|
2401
|
+
asChild: true,
|
|
2402
|
+
children: /* @__PURE__ */ jsx34(ChevronDownIcon2, {
|
|
2403
|
+
className: SELECT_CLASSES.triggerIcon
|
|
2404
|
+
})
|
|
2405
|
+
})
|
|
2406
|
+
]
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2409
|
+
function SelectContent({
|
|
2410
|
+
className,
|
|
2411
|
+
children,
|
|
2412
|
+
position = `item-aligned`,
|
|
2413
|
+
align = `center`,
|
|
2414
|
+
...props
|
|
2415
|
+
}) {
|
|
2416
|
+
return /* @__PURE__ */ jsx34(SelectPrimitive.Portal, {
|
|
2417
|
+
children: /* @__PURE__ */ jsxs15(SelectPrimitive.Content, {
|
|
2418
|
+
"data-slot": "select-content",
|
|
2419
|
+
className: cn2(SELECT_CLASSES.content, position === `popper` && SELECT_CLASSES.contentPopper, className),
|
|
2420
|
+
position,
|
|
2421
|
+
align,
|
|
2422
|
+
...props,
|
|
2423
|
+
children: [
|
|
2424
|
+
/* @__PURE__ */ jsx34(SelectScrollUpButton, {}),
|
|
2425
|
+
/* @__PURE__ */ jsx34(SelectPrimitive.Viewport, {
|
|
2426
|
+
className: cn2(SELECT_CLASSES.viewport, position === `popper` && SELECT_CLASSES.viewportPopper),
|
|
2427
|
+
children
|
|
2428
|
+
}),
|
|
2429
|
+
/* @__PURE__ */ jsx34(SelectScrollDownButton, {})
|
|
2430
|
+
]
|
|
2431
|
+
})
|
|
2432
|
+
});
|
|
2433
|
+
}
|
|
2434
|
+
function SelectLabel({
|
|
2435
|
+
className,
|
|
2436
|
+
...props
|
|
2437
|
+
}) {
|
|
2438
|
+
return /* @__PURE__ */ jsx34(SelectPrimitive.Label, {
|
|
2439
|
+
"data-slot": "select-label",
|
|
2440
|
+
className: cn2(SELECT_CLASSES.label, className),
|
|
2441
|
+
...props
|
|
2442
|
+
});
|
|
2443
|
+
}
|
|
2444
|
+
function SelectItem({
|
|
2445
|
+
className,
|
|
2446
|
+
children,
|
|
2447
|
+
...props
|
|
2448
|
+
}) {
|
|
2449
|
+
return /* @__PURE__ */ jsxs15(SelectPrimitive.Item, {
|
|
2450
|
+
"data-slot": "select-item",
|
|
2451
|
+
className: cn2(SELECT_CLASSES.item, className),
|
|
2452
|
+
...props,
|
|
2453
|
+
children: [
|
|
2454
|
+
/* @__PURE__ */ jsx34("span", {
|
|
2455
|
+
"data-slot": "select-item-indicator",
|
|
2456
|
+
className: SELECT_CLASSES.itemIndicator,
|
|
2457
|
+
children: /* @__PURE__ */ jsx34(SelectPrimitive.ItemIndicator, {
|
|
2458
|
+
children: /* @__PURE__ */ jsx34(CheckIcon3, {
|
|
2459
|
+
className: SELECT_CLASSES.itemCheck
|
|
2460
|
+
})
|
|
2461
|
+
})
|
|
2462
|
+
}),
|
|
2463
|
+
/* @__PURE__ */ jsx34(SelectPrimitive.ItemText, {
|
|
2464
|
+
children
|
|
2465
|
+
})
|
|
2466
|
+
]
|
|
2467
|
+
});
|
|
2468
|
+
}
|
|
2469
|
+
function SelectSeparator({
|
|
2470
|
+
className,
|
|
2471
|
+
...props
|
|
2472
|
+
}) {
|
|
2473
|
+
return /* @__PURE__ */ jsx34(SelectPrimitive.Separator, {
|
|
2474
|
+
"data-slot": "select-separator",
|
|
2475
|
+
className: cn2(SELECT_CLASSES.separator, className),
|
|
2476
|
+
...props
|
|
2477
|
+
});
|
|
2478
|
+
}
|
|
2479
|
+
function SelectScrollUpButton({
|
|
2480
|
+
className,
|
|
2481
|
+
...props
|
|
2482
|
+
}) {
|
|
2483
|
+
return /* @__PURE__ */ jsx34(SelectPrimitive.ScrollUpButton, {
|
|
2484
|
+
"data-slot": "select-scroll-up-button",
|
|
2485
|
+
className: cn2(SELECT_CLASSES.scrollButton, className),
|
|
2486
|
+
...props,
|
|
2487
|
+
children: /* @__PURE__ */ jsx34(ChevronUpIcon, {
|
|
2488
|
+
className: SELECT_CLASSES.scrollIcon
|
|
2489
|
+
})
|
|
2490
|
+
});
|
|
2491
|
+
}
|
|
2492
|
+
function SelectScrollDownButton({
|
|
2493
|
+
className,
|
|
2494
|
+
...props
|
|
2495
|
+
}) {
|
|
2496
|
+
return /* @__PURE__ */ jsx34(SelectPrimitive.ScrollDownButton, {
|
|
2497
|
+
"data-slot": "select-scroll-down-button",
|
|
2498
|
+
className: cn2(SELECT_CLASSES.scrollButton, className),
|
|
2499
|
+
...props,
|
|
2500
|
+
children: /* @__PURE__ */ jsx34(ChevronDownIcon2, {
|
|
2501
|
+
className: SELECT_CLASSES.scrollIcon
|
|
2502
|
+
})
|
|
2503
|
+
});
|
|
2504
|
+
}
|
|
2505
|
+
// packages/exponential-ui-react/src/primitives/separator.tsx
|
|
2506
|
+
import { Separator as SeparatorPrimitive } from "radix-ui";
|
|
2507
|
+
import { SEPARATOR_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2508
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
2509
|
+
"use client";
|
|
2510
|
+
function Separator({
|
|
2511
|
+
className,
|
|
2512
|
+
orientation = `horizontal`,
|
|
2513
|
+
decorative = true,
|
|
2514
|
+
...props
|
|
2515
|
+
}) {
|
|
2516
|
+
return /* @__PURE__ */ jsx35(SeparatorPrimitive.Root, {
|
|
2517
|
+
"data-slot": "separator",
|
|
2518
|
+
decorative,
|
|
2519
|
+
orientation,
|
|
2520
|
+
className: cn2(SEPARATOR_CLASSES.root, className),
|
|
2521
|
+
...props
|
|
2522
|
+
});
|
|
2523
|
+
}
|
|
2524
|
+
// packages/exponential-ui-react/src/primitives/skeleton.tsx
|
|
2525
|
+
import { SKELETON_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2526
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
2527
|
+
function Skeleton({ className, ...props }) {
|
|
2528
|
+
return /* @__PURE__ */ jsx36("div", {
|
|
2529
|
+
"data-slot": "skeleton",
|
|
2530
|
+
className: cn2(SKELETON_CLASSES.root, className),
|
|
2531
|
+
...props
|
|
2532
|
+
});
|
|
2533
|
+
}
|
|
2534
|
+
// packages/exponential-ui-react/src/primitives/spinner.tsx
|
|
2535
|
+
import { LoaderCircle } from "lucide-react";
|
|
2536
|
+
import { SPINNER_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2537
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
2538
|
+
function Spinner({
|
|
2539
|
+
size = 10,
|
|
2540
|
+
label = `Loading`,
|
|
2541
|
+
className,
|
|
2542
|
+
...props
|
|
2543
|
+
}) {
|
|
2544
|
+
return /* @__PURE__ */ jsx37(LoaderCircle, {
|
|
2545
|
+
"data-slot": "spinner",
|
|
2546
|
+
"data-testid": "feedback-spinner",
|
|
2547
|
+
"aria-label": label,
|
|
2548
|
+
width: size,
|
|
2549
|
+
height: size,
|
|
2550
|
+
style: { width: size, height: size },
|
|
2551
|
+
className: cn2(SPINNER_CLASSES.root, className),
|
|
2552
|
+
...props
|
|
2553
|
+
});
|
|
2554
|
+
}
|
|
2555
|
+
// packages/exponential-ui-react/src/primitives/switch.tsx
|
|
2556
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
2557
|
+
import { SWITCH_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2558
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
2559
|
+
function Switch({
|
|
2560
|
+
className,
|
|
2561
|
+
size = `default`,
|
|
2562
|
+
...props
|
|
2563
|
+
}) {
|
|
2564
|
+
return /* @__PURE__ */ jsx38(SwitchPrimitive.Root, {
|
|
2565
|
+
"data-slot": "switch",
|
|
2566
|
+
"data-size": size,
|
|
2567
|
+
className: cn2(SWITCH_CLASSES.root, className),
|
|
2568
|
+
...props,
|
|
2569
|
+
children: /* @__PURE__ */ jsx38(SwitchPrimitive.Thumb, {
|
|
2570
|
+
"data-slot": "switch-thumb",
|
|
2571
|
+
className: cn2(SWITCH_CLASSES.thumb)
|
|
2572
|
+
})
|
|
2573
|
+
});
|
|
2574
|
+
}
|
|
2575
|
+
// packages/exponential-ui-react/src/primitives/table.tsx
|
|
2576
|
+
import { TABLE_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2577
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
2578
|
+
function Table({ className, ...props }) {
|
|
2579
|
+
return /* @__PURE__ */ jsx39("div", {
|
|
2580
|
+
"data-slot": "table-container",
|
|
2581
|
+
className: TABLE_CLASSES.container,
|
|
2582
|
+
children: /* @__PURE__ */ jsx39("table", {
|
|
2583
|
+
"data-slot": "table",
|
|
2584
|
+
className: cn2(TABLE_CLASSES.root, className),
|
|
2585
|
+
...props
|
|
2586
|
+
})
|
|
2587
|
+
});
|
|
2588
|
+
}
|
|
2589
|
+
function TableHeader({ className, ...props }) {
|
|
2590
|
+
return /* @__PURE__ */ jsx39("thead", {
|
|
2591
|
+
"data-slot": "table-header",
|
|
2592
|
+
className: cn2(TABLE_CLASSES.header, className),
|
|
2593
|
+
...props
|
|
2594
|
+
});
|
|
2595
|
+
}
|
|
2596
|
+
function TableBody({ className, ...props }) {
|
|
2597
|
+
return /* @__PURE__ */ jsx39("tbody", {
|
|
2598
|
+
"data-slot": "table-body",
|
|
2599
|
+
className: cn2(TABLE_CLASSES.body, className),
|
|
2600
|
+
...props
|
|
2601
|
+
});
|
|
2602
|
+
}
|
|
2603
|
+
function TableFooter({ className, ...props }) {
|
|
2604
|
+
return /* @__PURE__ */ jsx39("tfoot", {
|
|
2605
|
+
"data-slot": "table-footer",
|
|
2606
|
+
className: cn2(TABLE_CLASSES.footer, className),
|
|
2607
|
+
...props
|
|
2608
|
+
});
|
|
2609
|
+
}
|
|
2610
|
+
function TableRow({ className, ...props }) {
|
|
2611
|
+
return /* @__PURE__ */ jsx39("tr", {
|
|
2612
|
+
"data-slot": "table-row",
|
|
2613
|
+
className: cn2(TABLE_CLASSES.row, className),
|
|
2614
|
+
...props
|
|
2615
|
+
});
|
|
2616
|
+
}
|
|
2617
|
+
function TableHead({ className, ...props }) {
|
|
2618
|
+
return /* @__PURE__ */ jsx39("th", {
|
|
2619
|
+
"data-slot": "table-head",
|
|
2620
|
+
className: cn2(TABLE_CLASSES.head, className),
|
|
2621
|
+
...props
|
|
2622
|
+
});
|
|
2623
|
+
}
|
|
2624
|
+
function TableCell({ className, ...props }) {
|
|
2625
|
+
return /* @__PURE__ */ jsx39("td", {
|
|
2626
|
+
"data-slot": "table-cell",
|
|
2627
|
+
className: cn2(TABLE_CLASSES.cell, className),
|
|
2628
|
+
...props
|
|
2629
|
+
});
|
|
2630
|
+
}
|
|
2631
|
+
function TableCaption({ className, ...props }) {
|
|
2632
|
+
return /* @__PURE__ */ jsx39("caption", {
|
|
2633
|
+
"data-slot": "table-caption",
|
|
2634
|
+
className: cn2(TABLE_CLASSES.caption, className),
|
|
2635
|
+
...props
|
|
2636
|
+
});
|
|
2637
|
+
}
|
|
2638
|
+
// packages/exponential-ui-react/src/primitives/textarea.tsx
|
|
2639
|
+
import { TEXTAREA_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2640
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
2641
|
+
function Textarea({ className, ...props }) {
|
|
2642
|
+
return /* @__PURE__ */ jsx40("textarea", {
|
|
2643
|
+
"data-slot": "textarea",
|
|
2644
|
+
className: cn2(TEXTAREA_CLASSES.root, className),
|
|
2645
|
+
...props
|
|
2646
|
+
});
|
|
2647
|
+
}
|
|
2648
|
+
// packages/exponential-ui-react/src/primitives/toast.tsx
|
|
2649
|
+
import * as React10 from "react";
|
|
2650
|
+
import { CircleCheck, CircleX, Info, TriangleAlert, XIcon as XIcon3 } from "lucide-react";
|
|
2651
|
+
import {
|
|
2652
|
+
TOAST_CLASSES,
|
|
2653
|
+
TOAST_TOUCH_QUERY,
|
|
2654
|
+
createToastStore,
|
|
2655
|
+
layoutSize,
|
|
2656
|
+
toastPlacement,
|
|
2657
|
+
toastStackGeometry
|
|
2658
|
+
} from "@exponential_app/eui/web/primitives";
|
|
2659
|
+
import { createToastStore as createToastStore2, toastStackGeometry as toastStackGeometry2, toastPlacement as toastPlacement2, TOAST_CONSTANTS, TOAST_KINDS, TOAST_TOUCH_QUERY as TOAST_TOUCH_QUERY2 } from "@exponential_app/eui/web/primitives";
|
|
2660
|
+
import { jsx as jsx41, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2661
|
+
var KIND_ICONS = {
|
|
2662
|
+
success: CircleCheck,
|
|
2663
|
+
error: CircleX,
|
|
2664
|
+
info: Info,
|
|
2665
|
+
warning: TriangleAlert
|
|
2666
|
+
};
|
|
2667
|
+
var toastStore = createToastStore();
|
|
2668
|
+
var toast = toastStore.toast;
|
|
2669
|
+
function useToasts(store) {
|
|
2670
|
+
return React10.useSyncExternalStore(store.subscribe, store.toasts, store.toasts);
|
|
2671
|
+
}
|
|
2672
|
+
function Toaster({ store = toastStore, touch, closeLabel = `Close`, className, ...props }) {
|
|
2673
|
+
const toasts = useToasts(store);
|
|
2674
|
+
const touchQuery = useMediaQuery(TOAST_TOUCH_QUERY);
|
|
2675
|
+
const { placement, anchoredBottom } = toastPlacement(touch ?? touchQuery);
|
|
2676
|
+
const [expanded, setExpanded] = React10.useState(false);
|
|
2677
|
+
const [measured, setMeasured] = React10.useState({});
|
|
2678
|
+
const items = React10.useRef(new Map);
|
|
2679
|
+
const open = expanded && toasts.length > 0;
|
|
2680
|
+
React10.useEffect(() => {
|
|
2681
|
+
if (open)
|
|
2682
|
+
store.pauseAll();
|
|
2683
|
+
else
|
|
2684
|
+
store.resumeAll();
|
|
2685
|
+
}, [open, store]);
|
|
2686
|
+
React10.useLayoutEffect(() => {
|
|
2687
|
+
const next = {};
|
|
2688
|
+
for (const t of toasts) {
|
|
2689
|
+
const el = items.current.get(t.id);
|
|
2690
|
+
if (t.height === undefined && el)
|
|
2691
|
+
next[t.id] = layoutSize(el).height;
|
|
2692
|
+
}
|
|
2693
|
+
setMeasured((prev) => Object.keys(next).length === Object.keys(prev).length && Object.entries(next).every(([k, v]) => prev[k] === v) ? prev : next);
|
|
2694
|
+
}, [toasts]);
|
|
2695
|
+
const geometry = toastStackGeometry(toasts.map((t) => t.height ?? measured[t.id] ?? 0), open, anchoredBottom);
|
|
2696
|
+
return /* @__PURE__ */ jsx41("section", {
|
|
2697
|
+
"aria-label": "Notifications",
|
|
2698
|
+
"data-slot": "toaster",
|
|
2699
|
+
"data-placement": placement,
|
|
2700
|
+
className: cn2(TOAST_CLASSES.region, TOAST_CLASSES.regionPlacement[placement], className),
|
|
2701
|
+
...props,
|
|
2702
|
+
children: /* @__PURE__ */ jsx41("ol", {
|
|
2703
|
+
"data-slot": "toast-list",
|
|
2704
|
+
"data-expanded": open ? `true` : `false`,
|
|
2705
|
+
className: cn2(TOAST_CLASSES.list, TOAST_CLASSES.listPlacement[placement]),
|
|
2706
|
+
style: { height: geometry.height },
|
|
2707
|
+
onPointerEnter: (event) => {
|
|
2708
|
+
if (event.pointerType !== `touch`)
|
|
2709
|
+
setExpanded(true);
|
|
2710
|
+
},
|
|
2711
|
+
onPointerLeave: (event) => {
|
|
2712
|
+
if (event.pointerType !== `touch`)
|
|
2713
|
+
setExpanded(false);
|
|
2714
|
+
},
|
|
2715
|
+
onPointerDown: (event) => {
|
|
2716
|
+
if (event.pointerType === `touch`)
|
|
2717
|
+
setExpanded((was) => !was);
|
|
2718
|
+
},
|
|
2719
|
+
children: toasts.map((t, i) => {
|
|
2720
|
+
const item = geometry.items[i];
|
|
2721
|
+
const rank = toasts.length - 1 - i;
|
|
2722
|
+
const Icon = t.kind ? KIND_ICONS[t.kind] : null;
|
|
2723
|
+
return /* @__PURE__ */ jsxs16("li", {
|
|
2724
|
+
ref: (el) => {
|
|
2725
|
+
if (el)
|
|
2726
|
+
items.current.set(t.id, el);
|
|
2727
|
+
else
|
|
2728
|
+
items.current.delete(t.id);
|
|
2729
|
+
},
|
|
2730
|
+
role: "status",
|
|
2731
|
+
"aria-live": "polite",
|
|
2732
|
+
"aria-atomic": "true",
|
|
2733
|
+
"data-slot": "toast",
|
|
2734
|
+
"data-kind": t.kind ?? `default`,
|
|
2735
|
+
"data-front": rank === 0 ? `true` : `false`,
|
|
2736
|
+
"data-expanded": open ? `true` : `false`,
|
|
2737
|
+
"data-visible": item.visible ? `true` : `false`,
|
|
2738
|
+
"data-index": rank,
|
|
2739
|
+
className: cn2(TOAST_CLASSES.toast, TOAST_CLASSES.toastOrigin[anchoredBottom ? `bottom` : `top`]),
|
|
2740
|
+
style: { "--offset": `${item.offset}px`, "--scale": `${item.scale}`, zIndex: i + 1 },
|
|
2741
|
+
children: [
|
|
2742
|
+
Icon && /* @__PURE__ */ jsx41("div", {
|
|
2743
|
+
className: TOAST_CLASSES.iconSlot,
|
|
2744
|
+
children: /* @__PURE__ */ jsx41(Icon, {
|
|
2745
|
+
"data-toast-kind": t.kind,
|
|
2746
|
+
className: cn2(TOAST_CLASSES.icon, TOAST_CLASSES.kindIcon[t.kind])
|
|
2747
|
+
})
|
|
2748
|
+
}),
|
|
2749
|
+
/* @__PURE__ */ jsxs16("div", {
|
|
2750
|
+
className: TOAST_CLASSES.content,
|
|
2751
|
+
children: [
|
|
2752
|
+
/* @__PURE__ */ jsx41("div", {
|
|
2753
|
+
"data-slot": "toast-title",
|
|
2754
|
+
className: TOAST_CLASSES.title,
|
|
2755
|
+
children: t.title
|
|
2756
|
+
}),
|
|
2757
|
+
t.description !== undefined && /* @__PURE__ */ jsx41("div", {
|
|
2758
|
+
"data-slot": "toast-description",
|
|
2759
|
+
className: TOAST_CLASSES.description,
|
|
2760
|
+
children: t.description
|
|
2761
|
+
})
|
|
2762
|
+
]
|
|
2763
|
+
}),
|
|
2764
|
+
t.action && /* @__PURE__ */ jsx41("button", {
|
|
2765
|
+
type: "button",
|
|
2766
|
+
"data-slot": "toast-action",
|
|
2767
|
+
className: TOAST_CLASSES.action,
|
|
2768
|
+
onClick: (event) => {
|
|
2769
|
+
t.action?.onClick?.(event.nativeEvent);
|
|
2770
|
+
store.dismiss(t.id);
|
|
2771
|
+
},
|
|
2772
|
+
children: t.action.label
|
|
2773
|
+
}),
|
|
2774
|
+
/* @__PURE__ */ jsx41("button", {
|
|
2775
|
+
type: "button",
|
|
2776
|
+
"data-slot": "toast-close",
|
|
2777
|
+
"aria-label": closeLabel,
|
|
2778
|
+
className: TOAST_CLASSES.close,
|
|
2779
|
+
onClick: () => store.dismiss(t.id),
|
|
2780
|
+
children: /* @__PURE__ */ jsx41(XIcon3, {})
|
|
2781
|
+
})
|
|
2782
|
+
]
|
|
2783
|
+
}, t.id);
|
|
2784
|
+
})
|
|
2785
|
+
})
|
|
2786
|
+
});
|
|
2787
|
+
}
|
|
2788
|
+
// packages/exponential-ui-react/src/primitives/tooltip.tsx
|
|
2789
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
2790
|
+
import { TOOLTIP_CLASSES } from "@exponential_app/eui/web/primitives";
|
|
2791
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
2792
|
+
function TooltipProvider({
|
|
2793
|
+
delayDuration = 0,
|
|
2794
|
+
...props
|
|
2795
|
+
}) {
|
|
2796
|
+
return /* @__PURE__ */ jsx42(TooltipPrimitive.Provider, {
|
|
2797
|
+
"data-slot": "tooltip-provider",
|
|
2798
|
+
delayDuration,
|
|
2799
|
+
...props
|
|
2800
|
+
});
|
|
2801
|
+
}
|
|
2802
|
+
function Tooltip({
|
|
2803
|
+
...props
|
|
2804
|
+
}) {
|
|
2805
|
+
return /* @__PURE__ */ jsx42(TooltipPrimitive.Root, {
|
|
2806
|
+
"data-slot": "tooltip",
|
|
2807
|
+
...props
|
|
2808
|
+
});
|
|
2809
|
+
}
|
|
2810
|
+
function TooltipTrigger({
|
|
2811
|
+
...props
|
|
2812
|
+
}) {
|
|
2813
|
+
return /* @__PURE__ */ jsx42(TooltipPrimitive.Trigger, {
|
|
2814
|
+
"data-slot": "tooltip-trigger",
|
|
2815
|
+
...props
|
|
2816
|
+
});
|
|
2817
|
+
}
|
|
2818
|
+
function TooltipContent({
|
|
2819
|
+
className,
|
|
2820
|
+
sideOffset = 0,
|
|
2821
|
+
children,
|
|
2822
|
+
...props
|
|
2823
|
+
}) {
|
|
2824
|
+
return /* @__PURE__ */ jsx42(TooltipPrimitive.Portal, {
|
|
2825
|
+
children: /* @__PURE__ */ jsx42(TooltipPrimitive.Content, {
|
|
2826
|
+
"data-slot": "tooltip-content",
|
|
2827
|
+
sideOffset,
|
|
2828
|
+
className: cn2(TOOLTIP_CLASSES.content, className),
|
|
2829
|
+
...props,
|
|
2830
|
+
children
|
|
2831
|
+
})
|
|
2832
|
+
});
|
|
2833
|
+
}
|
|
2834
|
+
// packages/exponential-ui-react/src/primitives/truncate.ts
|
|
2835
|
+
import { middleTruncate } from "@exponential_app/eui/web/primitives";
|
|
2836
|
+
// packages/exponential-ui-react/src/primitives/use-mobile.ts
|
|
2837
|
+
import * as React11 from "react";
|
|
2838
|
+
var MOBILE_BREAKPOINT = 768;
|
|
2839
|
+
function useIsMobile() {
|
|
2840
|
+
const [isMobile, setIsMobile] = React11.useState(() => typeof window !== `undefined` && window.innerWidth < MOBILE_BREAKPOINT);
|
|
2841
|
+
React11.useEffect(() => {
|
|
2842
|
+
if (typeof window.matchMedia !== `function`) {
|
|
2843
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
2844
|
+
return;
|
|
2845
|
+
}
|
|
2846
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
2847
|
+
const onChange = () => {
|
|
2848
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
2849
|
+
};
|
|
2850
|
+
mql.addEventListener(`change`, onChange);
|
|
2851
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
2852
|
+
return () => mql.removeEventListener(`change`, onChange);
|
|
2853
|
+
}, []);
|
|
2854
|
+
return isMobile;
|
|
2855
|
+
}
|
|
2856
|
+
// packages/exponential-ui-react/src/primitives/voice-wave.tsx
|
|
2857
|
+
import { useEffect as useEffect6, useLayoutEffect as useLayoutEffect4, useRef as useRef8 } from "react";
|
|
2858
|
+
import { voiceWave, voiceWaveChildBox, voiceWavePath } from "@exponential_app/eui";
|
|
2859
|
+
import {
|
|
2860
|
+
VOICE_WAVE_CLASSES,
|
|
2861
|
+
VOICE_WAVE_SIZE_PX,
|
|
2862
|
+
voiceWaveAnimates,
|
|
2863
|
+
voiceWaveClock,
|
|
2864
|
+
voiceWaveFitChild,
|
|
2865
|
+
voiceWaveName,
|
|
2866
|
+
voiceWaveQuiet
|
|
2867
|
+
} from "@exponential_app/eui/web/primitives";
|
|
2868
|
+
import { jsx as jsx43, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2869
|
+
var hasChild = (c) => c !== undefined && c !== null && c !== false && !(Array.isArray(c) && c.length === 0);
|
|
2870
|
+
function VoiceWave({ activity = `idle`, level = 0, bands, size = `md`, label, className, children }) {
|
|
2871
|
+
const px = VOICE_WAVE_SIZE_PX[size] ?? VOICE_WAVE_SIZE_PX.md;
|
|
2872
|
+
const reducedMotion = useMediaQuery(`(prefers-reduced-motion: reduce)`);
|
|
2873
|
+
const input = { size: px, activity, level, bands, reducedMotion };
|
|
2874
|
+
const latest = useRef8(input);
|
|
2875
|
+
latest.current = input;
|
|
2876
|
+
const elapsed = useRef8(0);
|
|
2877
|
+
const paths = useRef8([]);
|
|
2878
|
+
const animates = voiceWaveAnimates(activity) && !reducedMotion;
|
|
2879
|
+
useEffect6(() => {
|
|
2880
|
+
if (!animates) {
|
|
2881
|
+
elapsed.current = 0;
|
|
2882
|
+
return;
|
|
2883
|
+
}
|
|
2884
|
+
return voiceWaveClock((t) => {
|
|
2885
|
+
elapsed.current = t;
|
|
2886
|
+
voiceWave({ ...latest.current, elapsed: t }).rings.forEach((ring, k) => paths.current[k]?.setAttribute(`d`, voiceWavePath(ring)));
|
|
2887
|
+
});
|
|
2888
|
+
}, [animates]);
|
|
2889
|
+
const childEl = useRef8(null);
|
|
2890
|
+
const present = hasChild(children);
|
|
2891
|
+
useLayoutEffect4(() => present && childEl.current ? voiceWaveFitChild(childEl.current, (c) => voiceWaveChildBox(px, c).scale) : undefined, [present, px]);
|
|
2892
|
+
const wave = voiceWave({ ...input, elapsed: elapsed.current });
|
|
2893
|
+
const quiet = voiceWaveQuiet(activity);
|
|
2894
|
+
const name = voiceWaveName(label, activity);
|
|
2895
|
+
return /* @__PURE__ */ jsxs17("span", {
|
|
2896
|
+
"data-slot": "voice-wave",
|
|
2897
|
+
"data-activity": activity,
|
|
2898
|
+
"data-size": size,
|
|
2899
|
+
role: name ? `img` : undefined,
|
|
2900
|
+
"aria-label": name,
|
|
2901
|
+
"aria-hidden": name ? undefined : true,
|
|
2902
|
+
className: cn2(VOICE_WAVE_CLASSES.root, VOICE_WAVE_CLASSES.size[size], quiet && VOICE_WAVE_CLASSES.quiet, className),
|
|
2903
|
+
children: [
|
|
2904
|
+
/* @__PURE__ */ jsx43("svg", {
|
|
2905
|
+
viewBox: `0 0 ${px} ${px}`,
|
|
2906
|
+
width: px,
|
|
2907
|
+
height: px,
|
|
2908
|
+
"aria-hidden": true,
|
|
2909
|
+
className: VOICE_WAVE_CLASSES.svg,
|
|
2910
|
+
children: wave.rings.map((ring, k) => /* @__PURE__ */ jsx43("path", {
|
|
2911
|
+
ref: (el) => {
|
|
2912
|
+
paths.current[k] = el;
|
|
2913
|
+
},
|
|
2914
|
+
"data-slot": "voice-wave-ring",
|
|
2915
|
+
"data-ring": ring.part,
|
|
2916
|
+
className: quiet ? VOICE_WAVE_CLASSES.ringQuiet : VOICE_WAVE_CLASSES.ring[ring.part],
|
|
2917
|
+
d: voiceWavePath(ring),
|
|
2918
|
+
fill: "currentColor",
|
|
2919
|
+
fillOpacity: ring.fillAlpha,
|
|
2920
|
+
stroke: "currentColor",
|
|
2921
|
+
strokeOpacity: ring.strokeAlpha,
|
|
2922
|
+
strokeWidth: ring.strokeWidth,
|
|
2923
|
+
strokeLinejoin: "round"
|
|
2924
|
+
}, ring.part))
|
|
2925
|
+
}),
|
|
2926
|
+
present ? /* @__PURE__ */ jsx43("span", {
|
|
2927
|
+
ref: childEl,
|
|
2928
|
+
"data-slot": "voice-wave-child",
|
|
2929
|
+
"aria-hidden": wave.childSize > 0 ? undefined : true,
|
|
2930
|
+
className: cn2(VOICE_WAVE_CLASSES.child, activity === `muted` && VOICE_WAVE_CLASSES.childMuted, wave.childSize > 0 ? undefined : VOICE_WAVE_CLASSES.childHidden),
|
|
2931
|
+
children
|
|
2932
|
+
}) : null
|
|
2933
|
+
]
|
|
2934
|
+
});
|
|
2935
|
+
}
|
|
2936
|
+
export {
|
|
2937
|
+
AVATAR_HUE_COUNT,
|
|
2938
|
+
Alert,
|
|
2939
|
+
AlertDescription,
|
|
2940
|
+
AlertDialog,
|
|
2941
|
+
AlertDialogAction,
|
|
2942
|
+
AlertDialogCancel,
|
|
2943
|
+
AlertDialogContent,
|
|
2944
|
+
AlertDialogDescription,
|
|
2945
|
+
AlertDialogFooter,
|
|
2946
|
+
AlertDialogHeader,
|
|
2947
|
+
AlertDialogOverlay,
|
|
2948
|
+
AlertDialogPortal,
|
|
2949
|
+
AlertDialogTitle,
|
|
2950
|
+
AlertDialogTrigger,
|
|
2951
|
+
AlertTitle,
|
|
2952
|
+
Avatar,
|
|
2953
|
+
AvatarFallback,
|
|
2954
|
+
AvatarImage,
|
|
2955
|
+
BARE_FIELD_CLASS,
|
|
2956
|
+
Badge,
|
|
2957
|
+
Breadcrumb,
|
|
2958
|
+
BreadcrumbEllipsis,
|
|
2959
|
+
BreadcrumbItem,
|
|
2960
|
+
BreadcrumbLink,
|
|
2961
|
+
BreadcrumbList,
|
|
2962
|
+
BreadcrumbPage,
|
|
2963
|
+
BreadcrumbSeparator,
|
|
2964
|
+
Button,
|
|
2965
|
+
CODE_TOKEN_CLASS,
|
|
2966
|
+
Calendar,
|
|
2967
|
+
CalendarDayButton,
|
|
2968
|
+
Card,
|
|
2969
|
+
CardAction,
|
|
2970
|
+
CardContent,
|
|
2971
|
+
CardDescription,
|
|
2972
|
+
CardFooter,
|
|
2973
|
+
CardHeader,
|
|
2974
|
+
CardTitle,
|
|
2975
|
+
Checkbox,
|
|
2976
|
+
ChoiceTiles2 as ChoiceTiles,
|
|
2977
|
+
ChoiceTilesFrame2 as ChoiceTilesFrame,
|
|
2978
|
+
CodeBlock,
|
|
2979
|
+
CodeBlockActions,
|
|
2980
|
+
CodeBlockContent,
|
|
2981
|
+
CodeBlockCopyButton,
|
|
2982
|
+
CodeBlockFooter,
|
|
2983
|
+
CodeBlockHeader,
|
|
2984
|
+
CodeBlockLine,
|
|
2985
|
+
CodeBlockTitle,
|
|
2986
|
+
Collapsible,
|
|
2987
|
+
CollapsibleContent,
|
|
2988
|
+
CollapsibleTrigger,
|
|
2989
|
+
Command,
|
|
2990
|
+
CommandEmpty,
|
|
2991
|
+
CommandGroup,
|
|
2992
|
+
CommandInput,
|
|
2993
|
+
CommandItem,
|
|
2994
|
+
CommandList,
|
|
2995
|
+
CommandSeparator,
|
|
2996
|
+
CommandShortcut,
|
|
2997
|
+
ContextRing,
|
|
2998
|
+
DOCK_CARD_CLASSES2 as DOCK_CARD_CLASSES,
|
|
2999
|
+
DOCK_PILE_CLASSES2 as DOCK_PILE_CLASSES,
|
|
3000
|
+
DOCK_PILE_CONSTANTS,
|
|
3001
|
+
Dialog,
|
|
3002
|
+
DialogBody,
|
|
3003
|
+
DialogCancel,
|
|
3004
|
+
DialogClose,
|
|
3005
|
+
DialogContent,
|
|
3006
|
+
DialogDescription,
|
|
3007
|
+
DialogFooter,
|
|
3008
|
+
DialogHeader,
|
|
3009
|
+
DialogOverlay,
|
|
3010
|
+
DialogPortal,
|
|
3011
|
+
DialogPresentationContext,
|
|
3012
|
+
DialogTitle,
|
|
3013
|
+
DialogTrigger,
|
|
3014
|
+
DisclosureHeader,
|
|
3015
|
+
DockCard,
|
|
3016
|
+
DockPile,
|
|
3017
|
+
DropdownMenu,
|
|
3018
|
+
DropdownMenuCheckboxItem,
|
|
3019
|
+
DropdownMenuContent,
|
|
3020
|
+
DropdownMenuGroup,
|
|
3021
|
+
DropdownMenuItem,
|
|
3022
|
+
DropdownMenuLabel,
|
|
3023
|
+
DropdownMenuPortal,
|
|
3024
|
+
DropdownMenuRadioGroup,
|
|
3025
|
+
DropdownMenuRadioItem,
|
|
3026
|
+
DropdownMenuSeparator,
|
|
3027
|
+
DropdownMenuShortcut,
|
|
3028
|
+
DropdownMenuSub,
|
|
3029
|
+
DropdownMenuSubContent,
|
|
3030
|
+
DropdownMenuSubTrigger,
|
|
3031
|
+
DropdownMenuTrigger,
|
|
3032
|
+
EMPTY_STATE_SIZES,
|
|
3033
|
+
EmptyCta,
|
|
3034
|
+
EmptyState,
|
|
3035
|
+
FIELD_CHROME_CLASS,
|
|
3036
|
+
GLASS_CARD_CLASS,
|
|
3037
|
+
GLASS_CARD_CLASSES2 as GLASS_CARD_CLASSES,
|
|
3038
|
+
GlassCard,
|
|
3039
|
+
HoverCard,
|
|
3040
|
+
HoverCardContent,
|
|
3041
|
+
HoverCardTrigger,
|
|
3042
|
+
ICON_DISC_TONES,
|
|
3043
|
+
IconDisc,
|
|
3044
|
+
Input,
|
|
3045
|
+
Kbd,
|
|
3046
|
+
KbdGroup,
|
|
3047
|
+
Label,
|
|
3048
|
+
ListEmpty,
|
|
3049
|
+
MENU_CHECK_ITEM_CLASS,
|
|
3050
|
+
MENU_CHEVRON_CLASS,
|
|
3051
|
+
MENU_CONTENT_CLASS,
|
|
3052
|
+
MENU_ITEM_CLASS,
|
|
3053
|
+
MENU_LABEL_CLASS,
|
|
3054
|
+
MENU_SEPARATOR_CLASS,
|
|
3055
|
+
MENU_SHORTCUT_CLASS,
|
|
3056
|
+
MENU_SUB_TRIGGER_CLASS,
|
|
3057
|
+
MENU_SURFACE_CLASS,
|
|
3058
|
+
MENU_VALUE_CLASS,
|
|
3059
|
+
MOBILE_ALERT,
|
|
3060
|
+
MOBILE_ARMS,
|
|
3061
|
+
MOBILE_PAGE,
|
|
3062
|
+
MOBILE_SHEET,
|
|
3063
|
+
MOBILE_SHEET_FULL,
|
|
3064
|
+
Meter,
|
|
3065
|
+
Popover,
|
|
3066
|
+
PopoverAnchor,
|
|
3067
|
+
PopoverContent,
|
|
3068
|
+
PopoverTrigger,
|
|
3069
|
+
Progress,
|
|
3070
|
+
ProgressRing,
|
|
3071
|
+
RING_RADIUS2 as RING_RADIUS,
|
|
3072
|
+
RING_SIZE2 as RING_SIZE,
|
|
3073
|
+
RING_STROKE2 as RING_STROKE,
|
|
3074
|
+
RING_TONE_CLASS2 as RING_TONE_CLASS,
|
|
3075
|
+
SEGMENTED_ITEM,
|
|
3076
|
+
SEGMENTED_LIST,
|
|
3077
|
+
SEGMENTED_ROW,
|
|
3078
|
+
SEGMENTED_ROW_COMPACT,
|
|
3079
|
+
SEGMENTED_TAB,
|
|
3080
|
+
ScrollArea,
|
|
3081
|
+
ScrollBar,
|
|
3082
|
+
SegmentedControl,
|
|
3083
|
+
Select,
|
|
3084
|
+
SelectContent,
|
|
3085
|
+
SelectGroup,
|
|
3086
|
+
SelectItem,
|
|
3087
|
+
SelectLabel,
|
|
3088
|
+
SelectScrollDownButton,
|
|
3089
|
+
SelectScrollUpButton,
|
|
3090
|
+
SelectSeparator,
|
|
3091
|
+
SelectTrigger,
|
|
3092
|
+
SelectValue,
|
|
3093
|
+
Separator,
|
|
3094
|
+
Sheet,
|
|
3095
|
+
SheetClose,
|
|
3096
|
+
SheetContent,
|
|
3097
|
+
SheetDescription,
|
|
3098
|
+
SheetDragProvider,
|
|
3099
|
+
SheetFooter,
|
|
3100
|
+
SheetGrabber,
|
|
3101
|
+
SheetHeader,
|
|
3102
|
+
SheetTitle,
|
|
3103
|
+
SheetTrigger,
|
|
3104
|
+
Skeleton,
|
|
3105
|
+
Spinner,
|
|
3106
|
+
Switch,
|
|
3107
|
+
TOAST_CONSTANTS,
|
|
3108
|
+
TOAST_KINDS,
|
|
3109
|
+
TOAST_TOUCH_QUERY2 as TOAST_TOUCH_QUERY,
|
|
3110
|
+
Table,
|
|
3111
|
+
TableBody,
|
|
3112
|
+
TableCaption,
|
|
3113
|
+
TableCell,
|
|
3114
|
+
TableFooter,
|
|
3115
|
+
TableHead,
|
|
3116
|
+
TableHeader,
|
|
3117
|
+
TableRow,
|
|
3118
|
+
Tabs,
|
|
3119
|
+
TabsContent,
|
|
3120
|
+
TabsList,
|
|
3121
|
+
TabsTrigger,
|
|
3122
|
+
Textarea,
|
|
3123
|
+
Toaster,
|
|
3124
|
+
Tooltip,
|
|
3125
|
+
TooltipContent,
|
|
3126
|
+
TooltipProvider,
|
|
3127
|
+
TooltipTrigger,
|
|
3128
|
+
VoiceWave,
|
|
3129
|
+
alertVariants,
|
|
3130
|
+
avatarHueIndex,
|
|
3131
|
+
buttonVariants,
|
|
3132
|
+
choiceColumns2 as choiceColumns,
|
|
3133
|
+
choiceToggle2 as choiceToggle,
|
|
3134
|
+
choiceValues2 as choiceValues,
|
|
3135
|
+
cn2 as cn,
|
|
3136
|
+
createToastStore2 as createToastStore,
|
|
3137
|
+
dockPileGeometry2 as dockPileGeometry,
|
|
3138
|
+
getInitials2 as getInitials,
|
|
3139
|
+
middleTruncate,
|
|
3140
|
+
progressRingPercent2 as progressRingPercent,
|
|
3141
|
+
ringGeometry2 as ringGeometry,
|
|
3142
|
+
shouldDismissSheet,
|
|
3143
|
+
toast,
|
|
3144
|
+
toastPlacement2 as toastPlacement,
|
|
3145
|
+
toastStackGeometry2 as toastStackGeometry,
|
|
3146
|
+
toastStore,
|
|
3147
|
+
useIsMobile,
|
|
3148
|
+
useMediaQuery,
|
|
3149
|
+
useSheetDrag,
|
|
3150
|
+
useSheetDragHandleProps
|
|
3151
|
+
};
|
|
3152
|
+
|
|
3153
|
+
//# debugId=F72B037A10E5B0A264756E2164756E21
|
|
3154
|
+
//# sourceMappingURL=index.js.map
|