@reopt-ai/opt-ui 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPONENT_CATALOG.md +222 -34
- package/README.md +70 -6
- package/dist/core/index.cjs +170 -155
- package/dist/core/index.d.cts +3 -2
- package/dist/core/index.d.ts +3 -2
- package/dist/core/index.js +3 -3
- package/dist/docs/02-components/01-core.md +223 -18
- package/dist/docs/02-components/02-visuals.md +1 -1
- package/dist/docs/02-components/03-shells.md +17 -16
- package/dist/docs/02-components/04-surfaces.md +1 -1
- package/dist/docs/02-components/index.md +4 -4
- package/dist/{field-sidebar-CB8vjvUM.d.ts → field-sidebar-B5vk3luQ.d.cts} +30 -3
- package/dist/{field-sidebar-BTZCBviA.d.cts.map → field-sidebar-B5vk3luQ.d.cts.map} +1 -1
- package/dist/{field-sidebar-Cs-J-5VE.js → field-sidebar-B7QkWvMG.js} +52 -17
- package/dist/{field-sidebar-Cs-J-5VE.js.map → field-sidebar-B7QkWvMG.js.map} +1 -1
- package/dist/{field-sidebar-BTZCBviA.d.cts → field-sidebar-Dk9gJGA_.d.ts} +30 -3
- package/dist/{field-sidebar-CB8vjvUM.d.ts.map → field-sidebar-Dk9gJGA_.d.ts.map} +1 -1
- package/dist/{field-sidebar-CzIQX70-.cjs → field-sidebar-mFHemxBz.cjs} +328 -293
- package/dist/{types-D0FlcYnM.d.ts → field-token-CSOrU5gl.d.cts} +66 -2
- package/dist/field-token-CSOrU5gl.d.cts.map +1 -0
- package/dist/{types-D0FlcYnM.d.cts → field-token-CSOrU5gl.d.ts} +66 -2
- package/dist/field-token-CSOrU5gl.d.ts.map +1 -0
- package/dist/{pagination-DWbvACuN.js → highlight-C2sfnJN8.js} +263 -11
- package/dist/highlight-C2sfnJN8.js.map +1 -0
- package/dist/{pagination-DjfxBcjX.cjs → highlight-CGcrYGMC.cjs} +284 -8
- package/dist/id-registry.cjs +98 -2
- package/dist/id-registry.d.cts.map +1 -1
- package/dist/id-registry.d.ts.map +1 -1
- package/dist/id-registry.js +98 -2
- package/dist/id-registry.js.map +1 -1
- package/dist/id-registry.json +202 -4
- package/dist/index.cjs +664 -643
- package/dist/index.d.cts +5 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/{shader-surface-BUPZ0P-n.js → key-pad-menu-BFd79JoS.js} +855 -19
- package/dist/key-pad-menu-BFd79JoS.js.map +1 -0
- package/dist/{shader-surface-DRrcLrWf.d.cts → key-pad-menu-D8OS_VCT.d.cts} +459 -3
- package/dist/key-pad-menu-D8OS_VCT.d.cts.map +1 -0
- package/dist/{shader-surface-Fav5K9UC.cjs → key-pad-menu-DoGskWbp.cjs} +1103 -201
- package/dist/{shader-surface-BfTP9c1Q.d.ts → key-pad-menu-EEb6Ho5h.d.ts} +459 -3
- package/dist/key-pad-menu-EEb6Ho5h.d.ts.map +1 -0
- package/dist/meta.cjs +641 -0
- package/dist/meta.d.cts.map +1 -1
- package/dist/meta.d.ts.map +1 -1
- package/dist/meta.js +641 -0
- package/dist/meta.js.map +1 -1
- package/dist/shells/index.cjs +1 -1
- package/dist/shells/index.d.cts +1 -1
- package/dist/shells/index.d.ts +1 -1
- package/dist/shells/index.js +1 -1
- package/package.json +2 -2
- package/dist/pagination-DWbvACuN.js.map +0 -1
- package/dist/shader-surface-BUPZ0P-n.js.map +0 -1
- package/dist/shader-surface-BfTP9c1Q.d.ts.map +0 -1
- package/dist/shader-surface-DRrcLrWf.d.cts.map +0 -1
- package/dist/types-D0FlcYnM.d.cts.map +0 -1
- package/dist/types-D0FlcYnM.d.ts.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const
|
|
2
|
+
const require_highlight = require("./highlight-CGcrYGMC.cjs");
|
|
3
3
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
4
|
let react = require("react");
|
|
5
|
-
react =
|
|
5
|
+
react = require_highlight.__toESM(react, 1);
|
|
6
6
|
let _reopt_ai_opt_ui_primitives = require("@reopt-ai/opt-ui-primitives");
|
|
7
7
|
let lucide_react = require("lucide-react");
|
|
8
8
|
let react_resizable_panels = require("react-resizable-panels");
|
|
@@ -17,7 +17,7 @@ const _excluded$17 = [
|
|
|
17
17
|
"className",
|
|
18
18
|
"children"
|
|
19
19
|
];
|
|
20
|
-
const toneStyles = {
|
|
20
|
+
const toneStyles$1 = {
|
|
21
21
|
primary: "text-text-primary",
|
|
22
22
|
secondary: "text-text-secondary",
|
|
23
23
|
tertiary: "text-text-tertiary",
|
|
@@ -25,10 +25,10 @@ const toneStyles = {
|
|
|
25
25
|
};
|
|
26
26
|
/** Semantic body text whose visual role is controlled by foundation tokens. */
|
|
27
27
|
function Text(_ref) {
|
|
28
|
-
let { as, variant = "body", tone = "primary", truncate = false, className, children } = _ref, props =
|
|
28
|
+
let { as, variant = "body", tone = "primary", truncate = false, className, children } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$17);
|
|
29
29
|
const Component = as !== null && as !== void 0 ? as : "span";
|
|
30
|
-
const elementProps =
|
|
31
|
-
className:
|
|
30
|
+
const elementProps = require_highlight._objectSpread2(require_highlight._objectSpread2({}, props), {}, {
|
|
31
|
+
className: require_highlight.cn(`opt-type-${variant}`, toneStyles$1[tone], truncate && "truncate", className),
|
|
32
32
|
"data-opt-component": "text",
|
|
33
33
|
"data-opt-part": "root",
|
|
34
34
|
"data-opt-id": "NFKP2",
|
|
@@ -48,7 +48,7 @@ const _excluded$16 = [
|
|
|
48
48
|
];
|
|
49
49
|
/** Semantic heading with independently selectable visual hierarchy. */
|
|
50
50
|
function Heading(_ref) {
|
|
51
|
-
let { level = 2, variant = `heading-${level}`, className, children } = _ref, props =
|
|
51
|
+
let { level = 2, variant = `heading-${level}`, className, children } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$16);
|
|
52
52
|
const Component = {
|
|
53
53
|
1: "h1",
|
|
54
54
|
2: "h2",
|
|
@@ -57,7 +57,7 @@ function Heading(_ref) {
|
|
|
57
57
|
5: "h5",
|
|
58
58
|
6: "h6"
|
|
59
59
|
}[level];
|
|
60
|
-
return (0, react.createElement)(Component,
|
|
60
|
+
return (0, react.createElement)(Component, require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn(`opt-type-${variant}`, "text-text-primary", className) }, props), {}, {
|
|
61
61
|
"data-opt-component": "heading",
|
|
62
62
|
"data-opt-part": "root",
|
|
63
63
|
"data-opt-id": "NF0BT",
|
|
@@ -74,7 +74,7 @@ function Heading(_ref) {
|
|
|
74
74
|
*/
|
|
75
75
|
function Separator$1({ orientation = "horizontal", decorative = false, children, className }) {
|
|
76
76
|
if (orientation === "horizontal" && children != null) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
77
|
-
className:
|
|
77
|
+
className: require_highlight.cn("gap-element flex items-center", className),
|
|
78
78
|
"data-opt-id": "7PWJS",
|
|
79
79
|
"data-opt-slug": "separator.Separator",
|
|
80
80
|
children: [
|
|
@@ -97,7 +97,7 @@ function Separator$1({ orientation = "horizontal", decorative = false, children,
|
|
|
97
97
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.Separator, {
|
|
98
98
|
orientation,
|
|
99
99
|
decorative,
|
|
100
|
-
className:
|
|
100
|
+
className: require_highlight.cn("bg-border shrink-0", orientation === "horizontal" ? "h-px w-full" : "h-full w-px self-stretch", className),
|
|
101
101
|
"data-opt-id": "7PWJS",
|
|
102
102
|
"data-opt-slug": "separator.Separator"
|
|
103
103
|
});
|
|
@@ -122,7 +122,7 @@ function OtpField({ length = 6, value: controlledValue, defaultValue = "", onCha
|
|
|
122
122
|
const labelId = label ? `${fieldId}-label` : void 0;
|
|
123
123
|
const groupLabelledBy = ariaLabel ? void 0 : labelId;
|
|
124
124
|
const groupAriaLabel = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : groupLabelledBy ? void 0 : "One-time code";
|
|
125
|
-
const [value, setRawValue] =
|
|
125
|
+
const [value, setRawValue] = require_highlight.useControlledState(defaultValue, controlledValue, onChange);
|
|
126
126
|
const completedRef = react.useRef(false);
|
|
127
127
|
const setValue = react.useCallback((next) => {
|
|
128
128
|
const clipped = next.slice(0, length);
|
|
@@ -215,20 +215,20 @@ function OtpField({ length = 6, value: controlledValue, defaultValue = "", onCha
|
|
|
215
215
|
focusCell
|
|
216
216
|
]);
|
|
217
217
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
218
|
-
className:
|
|
218
|
+
className: require_highlight.cn("flex flex-col gap-1.5", className),
|
|
219
219
|
"data-opt-id": "0083Q",
|
|
220
220
|
"data-opt-slug": "otp-field.OtpField",
|
|
221
221
|
children: [
|
|
222
222
|
label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
223
223
|
className: "text-sm font-medium text-text-primary",
|
|
224
224
|
id: labelId,
|
|
225
|
-
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
225
|
+
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.RequiredMark, {})]
|
|
226
226
|
}),
|
|
227
227
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
228
228
|
role: "group",
|
|
229
229
|
"aria-label": groupAriaLabel,
|
|
230
230
|
"aria-labelledby": groupLabelledBy,
|
|
231
|
-
"aria-describedby":
|
|
231
|
+
"aria-describedby": require_highlight.getDescribedBy(fieldId, error, hint),
|
|
232
232
|
className: "gap-element flex items-center",
|
|
233
233
|
children: cells.map((cell, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
234
234
|
ref: (node) => {
|
|
@@ -247,7 +247,7 @@ function OtpField({ length = 6, value: controlledValue, defaultValue = "", onCha
|
|
|
247
247
|
onKeyDown: handleKeyDown(i),
|
|
248
248
|
onPaste: handlePaste(i),
|
|
249
249
|
onFocus: (e) => e.target.select(),
|
|
250
|
-
className:
|
|
250
|
+
className: require_highlight.cn(require_highlight.OPT_INPUT, "h-12 w-10 text-center text-lg font-medium", hasError && "border-danger focus-visible:outline-danger")
|
|
251
251
|
}, i))
|
|
252
252
|
}),
|
|
253
253
|
name && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
@@ -256,7 +256,7 @@ function OtpField({ length = 6, value: controlledValue, defaultValue = "", onCha
|
|
|
256
256
|
value,
|
|
257
257
|
disabled
|
|
258
258
|
}),
|
|
259
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
259
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.FieldMessages, {
|
|
260
260
|
id: fieldId,
|
|
261
261
|
error,
|
|
262
262
|
hint
|
|
@@ -277,15 +277,15 @@ const _excluded2$8 = [
|
|
|
277
277
|
"children",
|
|
278
278
|
"orientation"
|
|
279
279
|
];
|
|
280
|
-
const sizeStyles$
|
|
280
|
+
const sizeStyles$8 = {
|
|
281
281
|
sm: "h-8 min-w-8 px-2 text-xs gap-1.5",
|
|
282
282
|
md: "h-10 min-w-10 px-3 text-sm gap-2"
|
|
283
283
|
};
|
|
284
|
-
const toggleBase =
|
|
284
|
+
const toggleBase = require_highlight.cn("inline-flex cursor-pointer items-center justify-center rounded-md border border-border bg-surface font-medium text-text-secondary", "hover:bg-bg-subtle hover:text-text-primary", "data-[pressed]:border-accent data-[pressed]:bg-accent-subtle data-[pressed]:text-accent", "disabled:pointer-events-none disabled:opacity-40", require_highlight.OPT_FOCUS_VISIBLE);
|
|
285
285
|
/** A two-state (pressed) button. Use standalone or inside `ToggleGroup`. */
|
|
286
286
|
function Toggle(_ref) {
|
|
287
|
-
let { size = "md", className, children } = _ref, props =
|
|
288
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.Toggle,
|
|
287
|
+
let { size = "md", className, children } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$15);
|
|
288
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.Toggle, require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn(toggleBase, sizeStyles$8[size], className) }, props), {}, {
|
|
289
289
|
"data-opt-id": "GFCMY",
|
|
290
290
|
"data-opt-slug": "toggle.Toggle",
|
|
291
291
|
children
|
|
@@ -294,11 +294,11 @@ function Toggle(_ref) {
|
|
|
294
294
|
Toggle.displayName = "Toggle";
|
|
295
295
|
/** A set of related toggles with shared selection and keyboard navigation. */
|
|
296
296
|
function ToggleGroup(_ref2) {
|
|
297
|
-
let { className, children, orientation = "horizontal" } = _ref2, props =
|
|
298
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.ToggleGroup,
|
|
297
|
+
let { className, children, orientation = "horizontal" } = _ref2, props = require_highlight._objectWithoutProperties(_ref2, _excluded2$8);
|
|
298
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.ToggleGroup, require_highlight._objectSpread2(require_highlight._objectSpread2({
|
|
299
299
|
orientation,
|
|
300
300
|
"aria-orientation": orientation,
|
|
301
|
-
className:
|
|
301
|
+
className: require_highlight.cn("inline-flex gap-1", orientation === "vertical" ? "flex-col" : "flex-row", className)
|
|
302
302
|
}, props), {}, {
|
|
303
303
|
"data-opt-id": "47J37",
|
|
304
304
|
"data-opt-slug": "toggle.ToggleGroup",
|
|
@@ -312,23 +312,23 @@ const _excluded$14 = ["className"];
|
|
|
312
312
|
const _excluded2$7 = ["className"];
|
|
313
313
|
const _excluded3$4 = ["className", "children"];
|
|
314
314
|
const _excluded4$3 = ["className", "children"];
|
|
315
|
-
const triggerClass = `group/acc-trigger flex w-full cursor-pointer items-center justify-between gap-2 py-4 text-left text-sm font-medium text-text-primary transition-colors hover:text-text-secondary ${
|
|
316
|
-
const contentClass = `overflow-hidden text-sm text-text-secondary ${
|
|
315
|
+
const triggerClass = `group/acc-trigger flex w-full cursor-pointer items-center justify-between gap-2 py-4 text-left text-sm font-medium text-text-primary transition-colors hover:text-text-secondary ${require_highlight.OPT_FOCUS} disabled:cursor-not-allowed disabled:opacity-50`;
|
|
316
|
+
const contentClass = `overflow-hidden text-sm text-text-secondary ${require_highlight.OPT_ANIMATE_ENTER_EXIT}`;
|
|
317
317
|
/** A vertically stacked set of expandable panels (single or multiple open). */
|
|
318
318
|
function AccordionRoot(_ref) {
|
|
319
|
-
let { className } = _ref, props =
|
|
319
|
+
let { className } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$14);
|
|
320
320
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
321
|
-
className:
|
|
321
|
+
className: require_highlight.cn("border-border border-y", className),
|
|
322
322
|
"data-opt-id": "CSBA9",
|
|
323
323
|
"data-opt-slug": "accordion.AccordionRoot",
|
|
324
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.AccordionRoot,
|
|
324
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.AccordionRoot, require_highlight._objectSpread2({}, props))
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
327
|
AccordionRoot.displayName = "AccordionRoot";
|
|
328
328
|
/** A single accordion entry, identified by its `value`. */
|
|
329
329
|
function AccordionItem(_ref2) {
|
|
330
|
-
let { className } = _ref2, props =
|
|
331
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.AccordionItem,
|
|
330
|
+
let { className } = _ref2, props = require_highlight._objectWithoutProperties(_ref2, _excluded2$7);
|
|
331
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.AccordionItem, require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn("border-border border-b last:border-b-0", className) }, props), {}, {
|
|
332
332
|
"data-opt-id": "JTY9M",
|
|
333
333
|
"data-opt-slug": "accordion.AccordionItem"
|
|
334
334
|
}));
|
|
@@ -336,8 +336,8 @@ function AccordionItem(_ref2) {
|
|
|
336
336
|
AccordionItem.displayName = "AccordionItem";
|
|
337
337
|
/** The clickable header that expands/collapses its panel. */
|
|
338
338
|
function AccordionTrigger(_ref3) {
|
|
339
|
-
let { className, children } = _ref3, props =
|
|
340
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_reopt_ai_opt_ui_primitives.AccordionTrigger,
|
|
339
|
+
let { className, children } = _ref3, props = require_highlight._objectWithoutProperties(_ref3, _excluded3$4);
|
|
340
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_reopt_ai_opt_ui_primitives.AccordionTrigger, require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn(triggerClass, className) }, props), {}, {
|
|
341
341
|
"data-opt-id": "CWJZZ",
|
|
342
342
|
"data-opt-slug": "accordion.AccordionTrigger",
|
|
343
343
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -352,8 +352,8 @@ function AccordionTrigger(_ref3) {
|
|
|
352
352
|
AccordionTrigger.displayName = "AccordionTrigger";
|
|
353
353
|
/** The collapsible panel body associated with a trigger. */
|
|
354
354
|
function AccordionContent(_ref4) {
|
|
355
|
-
let { className, children } = _ref4, props =
|
|
356
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.AccordionContent,
|
|
355
|
+
let { className, children } = _ref4, props = require_highlight._objectWithoutProperties(_ref4, _excluded4$3);
|
|
356
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.AccordionContent, require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn(contentClass, className) }, props), {}, {
|
|
357
357
|
"data-opt-id": "J98AG",
|
|
358
358
|
"data-opt-slug": "accordion.AccordionContent",
|
|
359
359
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -372,19 +372,19 @@ function interpolate(template, values) {
|
|
|
372
372
|
function Breadcrumb({ items, separator = "/", className, onNavigate, "aria-label": ariaLabel = "Breadcrumb" }) {
|
|
373
373
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
374
374
|
"aria-label": ariaLabel,
|
|
375
|
-
className:
|
|
375
|
+
className: require_highlight.cn("flex items-center gap-1 px-1.5 text-sm", className),
|
|
376
376
|
"data-opt-id": "3FR0Y",
|
|
377
377
|
"data-opt-slug": "breadcrumb.Breadcrumb",
|
|
378
378
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
|
|
379
379
|
className: "flex items-center gap-1",
|
|
380
380
|
children: items.map((item, index) => {
|
|
381
381
|
const isLast = index === items.length - 1;
|
|
382
|
-
const linkClassName =
|
|
382
|
+
const linkClassName = require_highlight.cn(`flex items-center gap-1.5 rounded-sm ${require_highlight.OPT_FOCUS} transition-colors`, item.disabled ? `${require_highlight.OPT_TEXT_TERTIARY} cursor-not-allowed` : `${require_highlight.OPT_TEXT_SECONDARY} hover:text-text-primary cursor-pointer`);
|
|
383
383
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
384
384
|
className: "flex items-center gap-1",
|
|
385
385
|
children: isLast ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
386
386
|
"aria-current": "page",
|
|
387
|
-
className: `flex items-center gap-1.5 font-medium ${
|
|
387
|
+
className: `flex items-center gap-1.5 font-medium ${require_highlight.OPT_TEXT_PRIMARY}`,
|
|
388
388
|
children: [item.icon, item.label]
|
|
389
389
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [item.href ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
|
|
390
390
|
href: item.disabled ? void 0 : item.href,
|
|
@@ -395,13 +395,13 @@ function Breadcrumb({ items, separator = "/", className, onNavigate, "aria-label
|
|
|
395
395
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
396
396
|
type: "button",
|
|
397
397
|
disabled: item.disabled,
|
|
398
|
-
"aria-label": interpolate(
|
|
398
|
+
"aria-label": interpolate(require_highlight.koBreadcrumbLabels.navAriaLabel, { label: item.label }),
|
|
399
399
|
className: linkClassName,
|
|
400
400
|
onClick: () => !item.disabled && (onNavigate === null || onNavigate === void 0 ? void 0 : onNavigate(item)),
|
|
401
401
|
children: [item.icon, item.label]
|
|
402
402
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
403
403
|
"aria-hidden": "true",
|
|
404
|
-
className:
|
|
404
|
+
className: require_highlight.OPT_TEXT_TERTIARY,
|
|
405
405
|
children: separator
|
|
406
406
|
})] })
|
|
407
407
|
}, item.id);
|
|
@@ -448,7 +448,7 @@ const _excluded6 = [
|
|
|
448
448
|
];
|
|
449
449
|
/** Renders the card component. */
|
|
450
450
|
function Card(_ref) {
|
|
451
|
-
let { variant = "default", padding = "md", shadow = true, selectable = false, selected = false, onSelectedChange, className, children, onClick, onKeyDown, role, tabIndex } = _ref, props =
|
|
451
|
+
let { variant = "default", padding = "md", shadow = true, selectable = false, selected = false, onSelectedChange, className, children, onClick, onKeyDown, role, tabIndex } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$13);
|
|
452
452
|
const isInteractive = selectable || !!onClick;
|
|
453
453
|
const handleClick = selectable ? (e) => {
|
|
454
454
|
onSelectedChange === null || onSelectedChange === void 0 || onSelectedChange(!selected);
|
|
@@ -467,7 +467,7 @@ function Card(_ref) {
|
|
|
467
467
|
}
|
|
468
468
|
onKeyDown === null || onKeyDown === void 0 || onKeyDown(e);
|
|
469
469
|
} : onKeyDown;
|
|
470
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div",
|
|
470
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", require_highlight._objectSpread2(require_highlight._objectSpread2(require_highlight._objectSpread2({}, props), {}, { className: require_highlight.cn("rounded-xl", variant === "default" && require_highlight.cn(`border border-border bg-surface`, shadow && "shadow-sm"), variant === "outline" && "border-border border-2 bg-transparent", variant === "ghost" && "bg-bg-subtle", padding === "none" && "p-0", padding === "sm" && "p-3", padding === "md" && "p-5", padding === "lg" && "p-8", selectable && "cursor-pointer transition-colors", selectable && selected && "ring-accent border-accent ring-2 ring-offset-1", selectable && !selected && "hover:border-accent/50", className) }, isInteractive ? {
|
|
471
471
|
role: selectable ? "option" : "button",
|
|
472
472
|
tabIndex: 0,
|
|
473
473
|
"aria-selected": selectable ? selected : void 0,
|
|
@@ -491,8 +491,8 @@ const headerGapClasses = {
|
|
|
491
491
|
};
|
|
492
492
|
/** Renders the card header component. */
|
|
493
493
|
function CardHeader(_ref2) {
|
|
494
|
-
let { gap = "sm", className, children } = _ref2, props =
|
|
495
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div",
|
|
494
|
+
let { gap = "sm", className, children } = _ref2, props = require_highlight._objectWithoutProperties(_ref2, _excluded2$6);
|
|
495
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn("flex flex-col", headerGapClasses[gap], className) }, props), {}, {
|
|
496
496
|
"data-opt-id": "JST3J",
|
|
497
497
|
"data-opt-slug": "card.CardHeader",
|
|
498
498
|
children
|
|
@@ -500,8 +500,8 @@ function CardHeader(_ref2) {
|
|
|
500
500
|
}
|
|
501
501
|
/** Renders the card title component. */
|
|
502
502
|
function CardTitle(_ref3) {
|
|
503
|
-
let { as: Tag = "h3", className, children } = _ref3, props =
|
|
504
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag,
|
|
503
|
+
let { as: Tag = "h3", className, children } = _ref3, props = require_highlight._objectWithoutProperties(_ref3, _excluded3$3);
|
|
504
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn(`text-lg font-semibold ${require_highlight.OPT_TEXT_PRIMARY}`, className) }, props), {}, {
|
|
505
505
|
"data-opt-id": "V15TX",
|
|
506
506
|
"data-opt-slug": "card.CardTitle",
|
|
507
507
|
children
|
|
@@ -509,8 +509,8 @@ function CardTitle(_ref3) {
|
|
|
509
509
|
}
|
|
510
510
|
/** Renders the card description component. */
|
|
511
511
|
function CardDescription(_ref4) {
|
|
512
|
-
let { className, children } = _ref4, props =
|
|
513
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p",
|
|
512
|
+
let { className, children } = _ref4, props = require_highlight._objectWithoutProperties(_ref4, _excluded4$2);
|
|
513
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn(`text-sm ${require_highlight.OPT_TEXT_SECONDARY}`, className) }, props), {}, {
|
|
514
514
|
"data-opt-id": "YB1RN",
|
|
515
515
|
"data-opt-slug": "card.CardDescription",
|
|
516
516
|
children
|
|
@@ -524,8 +524,8 @@ const contentSpacingClasses = {
|
|
|
524
524
|
};
|
|
525
525
|
/** Renders the card content component. */
|
|
526
526
|
function CardContent(_ref5) {
|
|
527
|
-
let { spacing = "md", className, children } = _ref5, props =
|
|
528
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div",
|
|
527
|
+
let { spacing = "md", className, children } = _ref5, props = require_highlight._objectWithoutProperties(_ref5, _excluded5);
|
|
528
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn(contentSpacingClasses[spacing], className) }, props), {}, {
|
|
529
529
|
"data-opt-id": "9Y68R",
|
|
530
530
|
"data-opt-slug": "card.CardContent",
|
|
531
531
|
children
|
|
@@ -533,8 +533,8 @@ function CardContent(_ref5) {
|
|
|
533
533
|
}
|
|
534
534
|
/** Renders the card footer component. */
|
|
535
535
|
function CardFooter(_ref6) {
|
|
536
|
-
let { divider = true, className, children } = _ref6, props =
|
|
537
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div",
|
|
536
|
+
let { divider = true, className, children } = _ref6, props = require_highlight._objectWithoutProperties(_ref6, _excluded6);
|
|
537
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn("mt-4 flex items-center justify-end gap-2 pt-4", divider && `border-t border border-border`, className) }, props), {}, {
|
|
538
538
|
"data-opt-id": "GRNTR",
|
|
539
539
|
"data-opt-slug": "card.CardFooter",
|
|
540
540
|
children
|
|
@@ -559,7 +559,7 @@ const _excluded$12 = [
|
|
|
559
559
|
"aria-label",
|
|
560
560
|
"aria-labelledby"
|
|
561
561
|
];
|
|
562
|
-
const sizeStyles$
|
|
562
|
+
const sizeStyles$7 = {
|
|
563
563
|
sm: {
|
|
564
564
|
track: "h-5 w-9",
|
|
565
565
|
thumb: "h-4 w-4",
|
|
@@ -578,12 +578,12 @@ const sizeStyles$4 = {
|
|
|
578
578
|
};
|
|
579
579
|
const Switch = (0, react.forwardRef)((_ref, ref) => {
|
|
580
580
|
var _useInputId;
|
|
581
|
-
let { label, required, error, hint, description, checked: controlledChecked, defaultChecked = false, onChange, size = "md", disabled, className, id, onClick, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy } = _ref, props =
|
|
581
|
+
let { label, required, error, hint, description, checked: controlledChecked, defaultChecked = false, onChange, size = "md", disabled, className, id, onClick, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$12);
|
|
582
582
|
const fallbackId = (0, react.useId)();
|
|
583
|
-
const switchId = (_useInputId =
|
|
583
|
+
const switchId = (_useInputId = require_highlight.useInputId(id, label, "switch")) !== null && _useInputId !== void 0 ? _useInputId : `switch-${fallbackId}`;
|
|
584
584
|
const hintText = hint !== null && hint !== void 0 ? hint : description;
|
|
585
585
|
const hasError = Boolean(error);
|
|
586
|
-
const styles = sizeStyles$
|
|
586
|
+
const styles = sizeStyles$7[size];
|
|
587
587
|
const labelId = label ? `${switchId}-label` : void 0;
|
|
588
588
|
const switchLabelledBy = ariaLabelledBy !== null && ariaLabelledBy !== void 0 ? ariaLabelledBy : ariaLabel ? void 0 : labelId;
|
|
589
589
|
const switchAriaLabel = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : switchLabelledBy ? void 0 : "Switch";
|
|
@@ -602,12 +602,12 @@ const Switch = (0, react.forwardRef)((_ref, ref) => {
|
|
|
602
602
|
onClick
|
|
603
603
|
]);
|
|
604
604
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
605
|
-
className:
|
|
605
|
+
className: require_highlight.cn("flex flex-col gap-1.5", className),
|
|
606
606
|
"data-opt-id": "51Z9R",
|
|
607
607
|
"data-opt-slug": "switch.Switch",
|
|
608
608
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
609
609
|
className: "flex items-start gap-3",
|
|
610
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button",
|
|
610
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", require_highlight._objectSpread2(require_highlight._objectSpread2({
|
|
611
611
|
ref,
|
|
612
612
|
type: "button",
|
|
613
613
|
role: "switch",
|
|
@@ -616,24 +616,24 @@ const Switch = (0, react.forwardRef)((_ref, ref) => {
|
|
|
616
616
|
"aria-label": switchAriaLabel,
|
|
617
617
|
"aria-labelledby": switchLabelledBy,
|
|
618
618
|
disabled,
|
|
619
|
-
className:
|
|
619
|
+
className: require_highlight.cn("group relative inline-flex shrink-0 cursor-pointer rounded-full p-0.5 transition-colors", styles.track, "bg-bg-muted", "aria-[checked=true]:bg-accent", "disabled:cursor-not-allowed disabled:opacity-50", require_highlight.OPT_FOCUS_VISIBLE),
|
|
620
620
|
"aria-invalid": hasError,
|
|
621
621
|
"aria-required": required,
|
|
622
|
-
"aria-describedby":
|
|
622
|
+
"aria-describedby": require_highlight.getDescribedBy(switchId, error, hintText),
|
|
623
623
|
onClick: handleClick
|
|
624
|
-
}, props), {}, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className:
|
|
624
|
+
}, props), {}, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_highlight.cn("pointer-events-none inline-block transform rounded-full bg-white shadow-sm ring-0 transition-transform", styles.thumb, "translate-x-0", size === "sm" && "group-aria-[checked=true]:translate-x-4", size === "md" && "group-aria-[checked=true]:translate-x-5", size === "lg" && "group-aria-[checked=true]:translate-x-7") }) })), (label || hintText) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
625
625
|
className: "flex flex-col",
|
|
626
626
|
children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
627
627
|
id: labelId,
|
|
628
|
-
className:
|
|
629
|
-
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
628
|
+
className: require_highlight.cn("text-text-primary text-sm font-medium", disabled && "opacity-50"),
|
|
629
|
+
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.RequiredMark, {})]
|
|
630
630
|
}), hintText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
631
631
|
id: `${switchId}-hint`,
|
|
632
|
-
className:
|
|
632
|
+
className: require_highlight.cn("text-text-tertiary text-sm", disabled && "opacity-50"),
|
|
633
633
|
children: hintText
|
|
634
634
|
})]
|
|
635
635
|
})]
|
|
636
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
636
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.FieldMessages, {
|
|
637
637
|
id: switchId,
|
|
638
638
|
error
|
|
639
639
|
})]
|
|
@@ -661,9 +661,9 @@ const variantStyles$2 = {
|
|
|
661
661
|
};
|
|
662
662
|
/** Renders the skeleton component. */
|
|
663
663
|
function Skeleton(_ref) {
|
|
664
|
-
let { variant = "text", width, height, lines = 1, animated = true, className, style } = _ref, props =
|
|
665
|
-
const baseClass =
|
|
666
|
-
const computedStyle =
|
|
664
|
+
let { variant = "text", width, height, lines = 1, animated = true, className, style } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$11);
|
|
665
|
+
const baseClass = require_highlight.cn("bg-bg-subtle", animated && "animate-pulse", variantStyles$2[variant], className);
|
|
666
|
+
const computedStyle = require_highlight._objectSpread2({
|
|
667
667
|
width: typeof width === "number" ? `${width}px` : width,
|
|
668
668
|
height: typeof height === "number" ? `${height}px` : height
|
|
669
669
|
}, style);
|
|
@@ -673,15 +673,15 @@ function Skeleton(_ref) {
|
|
|
673
673
|
"aria-label": "Loading",
|
|
674
674
|
"data-opt-id": "EJT87",
|
|
675
675
|
"data-opt-slug": "skeleton.Skeleton",
|
|
676
|
-
children: [Array.from({ length: lines }).map((_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div",
|
|
677
|
-
className:
|
|
676
|
+
children: [Array.from({ length: lines }).map((_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", require_highlight._objectSpread2({
|
|
677
|
+
className: require_highlight.cn(baseClass, i === lines - 1 && "w-4/5"),
|
|
678
678
|
style: i === lines - 1 ? void 0 : computedStyle
|
|
679
679
|
}, props), i)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
680
680
|
className: "sr-only",
|
|
681
681
|
children: "Loading..."
|
|
682
682
|
})]
|
|
683
683
|
});
|
|
684
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div",
|
|
684
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", require_highlight._objectSpread2(require_highlight._objectSpread2({
|
|
685
685
|
className: baseClass,
|
|
686
686
|
style: computedStyle,
|
|
687
687
|
role: "status",
|
|
@@ -697,8 +697,8 @@ function Skeleton(_ref) {
|
|
|
697
697
|
}
|
|
698
698
|
/** Renders the skeleton text component. */
|
|
699
699
|
function SkeletonText(_ref2) {
|
|
700
|
-
let { lines = 3, className } = _ref2, props =
|
|
701
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton,
|
|
700
|
+
let { lines = 3, className } = _ref2, props = require_highlight._objectWithoutProperties(_ref2, _excluded2$5);
|
|
701
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, require_highlight._objectSpread2(require_highlight._objectSpread2({
|
|
702
702
|
variant: "text",
|
|
703
703
|
lines,
|
|
704
704
|
className
|
|
@@ -709,8 +709,8 @@ function SkeletonText(_ref2) {
|
|
|
709
709
|
}
|
|
710
710
|
/** Renders the skeleton avatar component. */
|
|
711
711
|
function SkeletonAvatar(_ref3) {
|
|
712
|
-
let { size = 40, className } = _ref3, props =
|
|
713
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton,
|
|
712
|
+
let { size = 40, className } = _ref3, props = require_highlight._objectWithoutProperties(_ref3, _excluded3$2);
|
|
713
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, require_highlight._objectSpread2(require_highlight._objectSpread2({
|
|
714
714
|
variant: "circular",
|
|
715
715
|
width: size,
|
|
716
716
|
height: size,
|
|
@@ -722,8 +722,8 @@ function SkeletonAvatar(_ref3) {
|
|
|
722
722
|
}
|
|
723
723
|
/** Renders the skeleton card component. */
|
|
724
724
|
function SkeletonCard(_ref4) {
|
|
725
|
-
let { className } = _ref4, props =
|
|
726
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div",
|
|
725
|
+
let { className } = _ref4, props = require_highlight._objectWithoutProperties(_ref4, _excluded4$1);
|
|
726
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn("gap-group flex flex-col", className) }, props), {}, {
|
|
727
727
|
"data-opt-id": "34V5D",
|
|
728
728
|
"data-opt-slug": "skeleton.SkeletonCard",
|
|
729
729
|
children: [
|
|
@@ -745,7 +745,7 @@ function SkeletonCard(_ref4) {
|
|
|
745
745
|
/** Renders the skeleton table component. */
|
|
746
746
|
function SkeletonTable({ rows = 5, columns = 4, className }) {
|
|
747
747
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
748
|
-
className:
|
|
748
|
+
className: require_highlight.cn("gap-element flex flex-col", className),
|
|
749
749
|
role: "status",
|
|
750
750
|
"aria-label": "Loading table",
|
|
751
751
|
"data-opt-id": "3KEDN",
|
|
@@ -788,7 +788,7 @@ const _excluded$10 = [
|
|
|
788
788
|
"id",
|
|
789
789
|
"rows"
|
|
790
790
|
];
|
|
791
|
-
const textareaSizeStyles =
|
|
791
|
+
const textareaSizeStyles = require_highlight.OPT_TEXTAREA_SIZE;
|
|
792
792
|
const resizeStyles = {
|
|
793
793
|
none: "resize-none",
|
|
794
794
|
vertical: "resize-y",
|
|
@@ -797,29 +797,29 @@ const resizeStyles = {
|
|
|
797
797
|
};
|
|
798
798
|
const Textarea = (0, react.forwardRef)((_ref, ref) => {
|
|
799
799
|
var _useInputId;
|
|
800
|
-
let { label, error, hint, fullWidth = false, required, resize = "vertical", size = "md", className, id, rows = 4 } = _ref, props =
|
|
800
|
+
let { label, error, hint, fullWidth = false, required, resize = "vertical", size = "md", className, id, rows = 4 } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$10);
|
|
801
801
|
const fallbackId = (0, react.useId)().replace(/:/g, "");
|
|
802
|
-
const textareaId = (_useInputId =
|
|
802
|
+
const textareaId = (_useInputId = require_highlight.useInputId(id, label, "textarea")) !== null && _useInputId !== void 0 ? _useInputId : `textarea-${fallbackId}`;
|
|
803
803
|
const hasError = Boolean(error);
|
|
804
804
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
805
|
-
className:
|
|
805
|
+
className: require_highlight.cn("flex flex-col gap-1.5", fullWidth && "w-full"),
|
|
806
806
|
"data-opt-id": "6T58H",
|
|
807
807
|
"data-opt-slug": "textarea.Textarea",
|
|
808
808
|
children: [
|
|
809
809
|
label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
810
810
|
htmlFor: textareaId,
|
|
811
811
|
className: "text-text-primary text-sm font-medium",
|
|
812
|
-
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
812
|
+
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.RequiredMark, {})]
|
|
813
813
|
}),
|
|
814
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea",
|
|
814
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", require_highlight._objectSpread2({
|
|
815
815
|
ref,
|
|
816
816
|
id: textareaId,
|
|
817
817
|
rows,
|
|
818
|
-
className:
|
|
818
|
+
className: require_highlight.cn("border-border bg-surface text-text-primary placeholder:text-text-tertiary w-full rounded-lg border px-4 py-3 text-sm outline-transparent", require_highlight.OPT_FOCUS_VISIBLE, textareaSizeStyles[size], resizeStyles[resize], hasError && "border-danger focus-visible:outline-danger", !fullWidth && "w-auto", className),
|
|
819
819
|
"aria-invalid": hasError,
|
|
820
|
-
"aria-describedby":
|
|
820
|
+
"aria-describedby": require_highlight.getDescribedBy(textareaId, error, hint)
|
|
821
821
|
}, props)),
|
|
822
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
822
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.FieldMessages, {
|
|
823
823
|
id: textareaId,
|
|
824
824
|
error,
|
|
825
825
|
hint
|
|
@@ -889,7 +889,7 @@ function useImageLoadingStatus(src, { srcSet, sizes, crossOrigin, referrerPolicy
|
|
|
889
889
|
]);
|
|
890
890
|
return status;
|
|
891
891
|
}
|
|
892
|
-
const sizeStyles$
|
|
892
|
+
const sizeStyles$6 = {
|
|
893
893
|
xs: "h-6 w-6 text-[10px]",
|
|
894
894
|
sm: "h-8 w-8 text-xs",
|
|
895
895
|
md: "h-10 w-10 text-sm",
|
|
@@ -932,7 +932,7 @@ function getColorFromName(name) {
|
|
|
932
932
|
/** Renders the avatar component. */
|
|
933
933
|
function Avatar(_ref) {
|
|
934
934
|
var _ref2, _ref3;
|
|
935
|
-
let { src, srcSet, sizes, crossOrigin, referrerPolicy, alt, name, size = "md", fallback, status, className, onLoadingStatusChange } = _ref, props =
|
|
935
|
+
let { src, srcSet, sizes, crossOrigin, referrerPolicy, alt, name, size = "md", fallback, status, className, onLoadingStatusChange } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$9);
|
|
936
936
|
const loadingStatus = useImageLoadingStatus(src, {
|
|
937
937
|
srcSet,
|
|
938
938
|
sizes,
|
|
@@ -970,33 +970,33 @@ function Avatar(_ref) {
|
|
|
970
970
|
"aria-hidden": "true",
|
|
971
971
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" })
|
|
972
972
|
});
|
|
973
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span",
|
|
973
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", require_highlight._objectSpread2(require_highlight._objectSpread2({
|
|
974
974
|
role: "img",
|
|
975
975
|
"aria-label": avatarLabel,
|
|
976
|
-
className:
|
|
976
|
+
className: require_highlight.cn("relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full", sizeStyles$6[size], !showImage && bgColor, className)
|
|
977
977
|
}, props), {}, {
|
|
978
978
|
"data-opt-id": "SCMM0",
|
|
979
979
|
"data-opt-slug": "avatar.Avatar",
|
|
980
980
|
children: [avatarContent, status && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
981
|
-
className:
|
|
981
|
+
className: require_highlight.cn("border-surface absolute right-0 bottom-0 rounded-full", statusStyles[status], statusSizeStyles[size]),
|
|
982
982
|
"aria-hidden": "true"
|
|
983
983
|
})]
|
|
984
984
|
}));
|
|
985
985
|
}
|
|
986
986
|
/** Renders the avatar group component. */
|
|
987
987
|
function AvatarGroup(_ref5) {
|
|
988
|
-
let { max = 4, size = "md", children, className } = _ref5, props =
|
|
988
|
+
let { max = 4, size = "md", children, className } = _ref5, props = require_highlight._objectWithoutProperties(_ref5, _excluded2$4);
|
|
989
989
|
const avatars = Array.isArray(children) ? children : [children];
|
|
990
990
|
const visibleAvatars = avatars.slice(0, max);
|
|
991
991
|
const remainingCount = avatars.length - max;
|
|
992
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div",
|
|
992
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn("flex", className) }, props), {}, {
|
|
993
993
|
"data-opt-id": "MVB53",
|
|
994
994
|
"data-opt-slug": "avatar.AvatarGroup",
|
|
995
995
|
children: [visibleAvatars.map((child, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
996
996
|
className: "ring-surface relative -ml-2 inline-block rounded-full ring-2 first:ml-0",
|
|
997
997
|
children: child
|
|
998
998
|
}, index)), remainingCount > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
999
|
-
className:
|
|
999
|
+
className: require_highlight.cn("bg-bg-subtle text-text-secondary ring-surface relative inline-flex items-center justify-center rounded-full font-medium ring-2", sizeStyles$6[size]),
|
|
1000
1000
|
children: ["+", remainingCount]
|
|
1001
1001
|
})]
|
|
1002
1002
|
}));
|
|
@@ -1025,7 +1025,7 @@ const _excluded2$3 = [
|
|
|
1025
1025
|
"indeterminate",
|
|
1026
1026
|
"className"
|
|
1027
1027
|
];
|
|
1028
|
-
const sizeStyles$
|
|
1028
|
+
const sizeStyles$5 = {
|
|
1029
1029
|
sm: "h-1",
|
|
1030
1030
|
md: "h-2",
|
|
1031
1031
|
lg: "h-3"
|
|
@@ -1049,10 +1049,10 @@ function getProgressValue(value, max) {
|
|
|
1049
1049
|
}
|
|
1050
1050
|
/** Renders the progress component. */
|
|
1051
1051
|
function Progress(_ref) {
|
|
1052
|
-
let { value, max = 100, size = "md", variant = "default", showLabel = false, label, animated = true, indeterminate = false, className } = _ref, props =
|
|
1052
|
+
let { value, max = 100, size = "md", variant = "default", showLabel = false, label, animated = true, indeterminate = false, className } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$8);
|
|
1053
1053
|
const progress = indeterminate || value === void 0 ? null : getProgressValue(value, max);
|
|
1054
1054
|
const shouldRenderHeader = Boolean(label) || showLabel && progress;
|
|
1055
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div",
|
|
1055
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn("w-full", className) }, props), {}, {
|
|
1056
1056
|
"data-opt-id": "Y5N8R",
|
|
1057
1057
|
"data-opt-slug": "progress.Progress",
|
|
1058
1058
|
children: [shouldRenderHeader && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -1065,7 +1065,7 @@ function Progress(_ref) {
|
|
|
1065
1065
|
children: progress.valueText
|
|
1066
1066
|
})]
|
|
1067
1067
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1068
|
-
className:
|
|
1068
|
+
className: require_highlight.cn("bg-bg-subtle w-full overflow-hidden rounded-full", sizeStyles$5[size]),
|
|
1069
1069
|
role: "progressbar",
|
|
1070
1070
|
"aria-valuenow": progress === null || progress === void 0 ? void 0 : progress.clampedValue,
|
|
1071
1071
|
"aria-valuemin": progress ? 0 : void 0,
|
|
@@ -1073,7 +1073,7 @@ function Progress(_ref) {
|
|
|
1073
1073
|
"aria-valuetext": progress === null || progress === void 0 ? void 0 : progress.valueText,
|
|
1074
1074
|
"aria-label": label !== null && label !== void 0 ? label : progress ? `${progress.valueText} complete` : "Loading",
|
|
1075
1075
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1076
|
-
className:
|
|
1076
|
+
className: require_highlight.cn("h-full rounded-full", variantStyles$1[variant], !progress && "w-1/3 animate-pulse", animated && (progress ? "transition-all duration-300 ease-out" : "transition-opacity duration-700 ease-in-out")),
|
|
1077
1077
|
style: progress ? { width: `${progress.percentage}%` } : void 0
|
|
1078
1078
|
})
|
|
1079
1079
|
})]
|
|
@@ -1088,7 +1088,7 @@ const circularVariantStyles = {
|
|
|
1088
1088
|
/** Renders the circular progress component. */
|
|
1089
1089
|
function CircularProgress(_ref2) {
|
|
1090
1090
|
var _progress$percentage;
|
|
1091
|
-
let { value, max = 100, size = 48, strokeWidth = 4, variant = "default", showLabel = false, label, indeterminate = false, className } = _ref2, props =
|
|
1091
|
+
let { value, max = 100, size = 48, strokeWidth = 4, variant = "default", showLabel = false, label, indeterminate = false, className } = _ref2, props = require_highlight._objectWithoutProperties(_ref2, _excluded2$3);
|
|
1092
1092
|
const labelId = (0, react.useId)();
|
|
1093
1093
|
const isIndeterminate = indeterminate || value === void 0;
|
|
1094
1094
|
const progress = isIndeterminate ? null : getProgressValue(value, max);
|
|
@@ -1106,10 +1106,10 @@ function CircularProgress(_ref2) {
|
|
|
1106
1106
|
className: "sr-only",
|
|
1107
1107
|
children: label
|
|
1108
1108
|
}),
|
|
1109
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg",
|
|
1109
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", require_highlight._objectSpread2(require_highlight._objectSpread2({
|
|
1110
1110
|
width: size,
|
|
1111
1111
|
height: size,
|
|
1112
|
-
className:
|
|
1112
|
+
className: require_highlight.cn(isIndeterminate ? "animate-spin" : "-rotate-90", className),
|
|
1113
1113
|
role: isIndeterminate ? "progressbar" : "meter",
|
|
1114
1114
|
"aria-labelledby": label ? labelId : void 0,
|
|
1115
1115
|
"aria-valuenow": progress === null || progress === void 0 ? void 0 : progress.clampedValue,
|
|
@@ -1131,7 +1131,7 @@ function CircularProgress(_ref2) {
|
|
|
1131
1131
|
fill: "none",
|
|
1132
1132
|
strokeWidth,
|
|
1133
1133
|
strokeLinecap: "round",
|
|
1134
|
-
className:
|
|
1134
|
+
className: require_highlight.cn("transition-all duration-300 ease-out", circularVariantStyles[variant]),
|
|
1135
1135
|
style: {
|
|
1136
1136
|
strokeDasharray: isIndeterminate ? `${circumference * .28} ${circumference}` : circumference,
|
|
1137
1137
|
strokeDashoffset: isIndeterminate ? 0 : strokeDashoffset,
|
|
@@ -1158,7 +1158,7 @@ const _excluded$7 = [
|
|
|
1158
1158
|
"getValueLabel",
|
|
1159
1159
|
"className"
|
|
1160
1160
|
];
|
|
1161
|
-
const sizeStyles$
|
|
1161
|
+
const sizeStyles$4 = {
|
|
1162
1162
|
sm: "h-1",
|
|
1163
1163
|
md: "h-2",
|
|
1164
1164
|
lg: "h-3"
|
|
@@ -1175,10 +1175,10 @@ const variantStyles = {
|
|
|
1175
1175
|
* opt-ui-primitives Meter primitive, which owns the role/aria/valuetext.
|
|
1176
1176
|
*/
|
|
1177
1177
|
function Meter(_ref) {
|
|
1178
|
-
let { value, min = 0, max = 100, size = "md", variant = "default", showValue = false, label, getValueLabel, className } = _ref, props =
|
|
1178
|
+
let { value, min = 0, max = 100, size = "md", variant = "default", showValue = false, label, getValueLabel, className } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$7);
|
|
1179
1179
|
const clamped = Math.min(Math.max(value, min), max);
|
|
1180
1180
|
const percentage = max === min ? 0 : (clamped - min) / (max - min) * 100;
|
|
1181
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div",
|
|
1181
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn("w-full", className) }, props), {}, {
|
|
1182
1182
|
"data-opt-id": "G01TE",
|
|
1183
1183
|
"data-opt-slug": "meter.Meter",
|
|
1184
1184
|
children: [(showValue || label) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -1196,9 +1196,9 @@ function Meter(_ref) {
|
|
|
1196
1196
|
max,
|
|
1197
1197
|
getValueLabel,
|
|
1198
1198
|
"aria-label": label !== null && label !== void 0 ? label : `${Math.round(percentage)}%`,
|
|
1199
|
-
className:
|
|
1199
|
+
className: require_highlight.cn("bg-bg-subtle w-full overflow-hidden rounded-full", sizeStyles$4[size]),
|
|
1200
1200
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1201
|
-
className:
|
|
1201
|
+
className: require_highlight.cn("h-full rounded-full transition-all duration-300 ease-out", variantStyles[variant]),
|
|
1202
1202
|
style: { width: `${percentage}%` }
|
|
1203
1203
|
})
|
|
1204
1204
|
})]
|
|
@@ -1242,7 +1242,7 @@ function StepBuilder({ steps, onChange, label, addLabel = "Add step", maxSteps,
|
|
|
1242
1242
|
editingId
|
|
1243
1243
|
]);
|
|
1244
1244
|
const updateStep = (0, react.useCallback)((id, updates) => {
|
|
1245
|
-
onChange(steps.map((s) => s.id === id ?
|
|
1245
|
+
onChange(steps.map((s) => s.id === id ? require_highlight._objectSpread2(require_highlight._objectSpread2({}, s), updates) : s));
|
|
1246
1246
|
}, [steps, onChange]);
|
|
1247
1247
|
const moveStep = (0, react.useCallback)((index, direction) => {
|
|
1248
1248
|
const target = index + direction;
|
|
@@ -1253,7 +1253,7 @@ function StepBuilder({ steps, onChange, label, addLabel = "Add step", maxSteps,
|
|
|
1253
1253
|
}, [steps, onChange]);
|
|
1254
1254
|
const atLimit = Boolean(maxSteps && steps.length >= maxSteps);
|
|
1255
1255
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1256
|
-
className:
|
|
1256
|
+
className: require_highlight.cn("flex flex-col gap-3", className),
|
|
1257
1257
|
role: "list",
|
|
1258
1258
|
"aria-label": (_ref = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label) !== null && _ref !== void 0 ? _ref : "Step builder",
|
|
1259
1259
|
"data-opt-id": "7BQDT",
|
|
@@ -1266,7 +1266,7 @@ function StepBuilder({ steps, onChange, label, addLabel = "Add step", maxSteps,
|
|
|
1266
1266
|
steps.map((step, index) => {
|
|
1267
1267
|
var _step$description;
|
|
1268
1268
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1269
|
-
className:
|
|
1269
|
+
className: require_highlight.cn(require_highlight.OPT_SURFACE, require_highlight.OPT_BORDER, "flex items-start gap-3 p-3"),
|
|
1270
1270
|
role: "listitem",
|
|
1271
1271
|
children: [
|
|
1272
1272
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -1286,7 +1286,7 @@ function StepBuilder({ steps, onChange, label, addLabel = "Add step", maxSteps,
|
|
|
1286
1286
|
onKeyDown: (e) => {
|
|
1287
1287
|
if (e.key === "Enter") setEditingId(null);
|
|
1288
1288
|
},
|
|
1289
|
-
className:
|
|
1289
|
+
className: require_highlight.cn("border-border bg-surface focus-visible:ring-ring focus-visible:ring-offset-ring-offset w-full rounded-md border px-2 py-1 text-sm outline-none focus-visible:ring-2 focus-visible:ring-offset-1", require_highlight.OPT_TEXT_PRIMARY, require_highlight.OPT_FOCUS_VISIBLE),
|
|
1290
1290
|
"aria-label": "Step label",
|
|
1291
1291
|
autoFocus: true
|
|
1292
1292
|
}),
|
|
@@ -1295,10 +1295,10 @@ function StepBuilder({ steps, onChange, label, addLabel = "Add step", maxSteps,
|
|
|
1295
1295
|
value: (_step$description = step.description) !== null && _step$description !== void 0 ? _step$description : "",
|
|
1296
1296
|
onChange: (e) => updateStep(step.id, { description: e.target.value }),
|
|
1297
1297
|
placeholder: "Description (optional)",
|
|
1298
|
-
className:
|
|
1298
|
+
className: require_highlight.cn("border-border bg-surface focus-visible:ring-ring focus-visible:ring-offset-ring-offset w-full rounded-md border px-2 py-1 text-sm outline-none focus-visible:ring-2 focus-visible:ring-offset-1", require_highlight.OPT_TEXT_PRIMARY, "placeholder:text-text-tertiary", require_highlight.OPT_FOCUS_VISIBLE),
|
|
1299
1299
|
"aria-label": "Step description"
|
|
1300
1300
|
}),
|
|
1301
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1301
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.Button, {
|
|
1302
1302
|
variant: "ghost",
|
|
1303
1303
|
size: "sm",
|
|
1304
1304
|
onClick: () => setEditingId(null),
|
|
@@ -1311,10 +1311,10 @@ function StepBuilder({ steps, onChange, label, addLabel = "Add step", maxSteps,
|
|
|
1311
1311
|
onClick: () => setEditingId(step.id),
|
|
1312
1312
|
"aria-label": `Edit ${step.label}`,
|
|
1313
1313
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1314
|
-
className:
|
|
1314
|
+
className: require_highlight.cn(require_highlight.OPT_TEXT_PRIMARY, "text-sm font-medium"),
|
|
1315
1315
|
children: step.label
|
|
1316
1316
|
}), step.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1317
|
-
className:
|
|
1317
|
+
className: require_highlight.cn("text-text-secondary", "mt-0.5 block text-xs"),
|
|
1318
1318
|
children: step.description
|
|
1319
1319
|
})]
|
|
1320
1320
|
})
|
|
@@ -1326,7 +1326,7 @@ function StepBuilder({ steps, onChange, label, addLabel = "Add step", maxSteps,
|
|
|
1326
1326
|
type: "button",
|
|
1327
1327
|
onClick: () => moveStep(index, -1),
|
|
1328
1328
|
disabled: index === 0,
|
|
1329
|
-
className:
|
|
1329
|
+
className: require_highlight.cn("rounded p-1 text-sm", require_highlight.OPT_TEXT_TERTIARY, "hover:bg-bg-subtle", "disabled:opacity-30", require_highlight.OPT_FOCUS_VISIBLE),
|
|
1330
1330
|
"aria-label": "Move up",
|
|
1331
1331
|
children: "▲"
|
|
1332
1332
|
}),
|
|
@@ -1334,14 +1334,14 @@ function StepBuilder({ steps, onChange, label, addLabel = "Add step", maxSteps,
|
|
|
1334
1334
|
type: "button",
|
|
1335
1335
|
onClick: () => moveStep(index, 1),
|
|
1336
1336
|
disabled: index === steps.length - 1,
|
|
1337
|
-
className:
|
|
1337
|
+
className: require_highlight.cn("rounded p-1 text-sm", require_highlight.OPT_TEXT_TERTIARY, "hover:bg-bg-subtle", "disabled:opacity-30", require_highlight.OPT_FOCUS_VISIBLE),
|
|
1338
1338
|
"aria-label": "Move down",
|
|
1339
1339
|
children: "▼"
|
|
1340
1340
|
}),
|
|
1341
1341
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1342
1342
|
type: "button",
|
|
1343
1343
|
onClick: () => removeStep(step.id),
|
|
1344
|
-
className:
|
|
1344
|
+
className: require_highlight.cn("text-danger-fg hover:bg-danger-subtle rounded p-1 text-sm", require_highlight.OPT_FOCUS_VISIBLE),
|
|
1345
1345
|
"aria-label": `Remove ${step.label}`,
|
|
1346
1346
|
children: "✕"
|
|
1347
1347
|
})
|
|
@@ -1350,7 +1350,7 @@ function StepBuilder({ steps, onChange, label, addLabel = "Add step", maxSteps,
|
|
|
1350
1350
|
]
|
|
1351
1351
|
}, step.id);
|
|
1352
1352
|
}),
|
|
1353
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
1353
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_highlight.Button, {
|
|
1354
1354
|
variant: "secondary",
|
|
1355
1355
|
size: "sm",
|
|
1356
1356
|
onClick: addStep,
|
|
@@ -1526,12 +1526,12 @@ function ConditionBuilder({ groups, onChange, properties = DEFAULT_PROPERTIES, l
|
|
|
1526
1526
|
onChange(groups.filter((g) => g.id !== groupId));
|
|
1527
1527
|
}, [groups, onChange]);
|
|
1528
1528
|
const updateGroupLogic = (0, react.useCallback)((groupId, logic) => {
|
|
1529
|
-
onChange(groups.map((g) => g.id === groupId ?
|
|
1529
|
+
onChange(groups.map((g) => g.id === groupId ? require_highlight._objectSpread2(require_highlight._objectSpread2({}, g), {}, { logic }) : g));
|
|
1530
1530
|
}, [groups, onChange]);
|
|
1531
1531
|
const addCondition = (0, react.useCallback)((groupId) => {
|
|
1532
1532
|
onChange(groups.map((g) => {
|
|
1533
1533
|
var _properties$2;
|
|
1534
|
-
return g.id === groupId ?
|
|
1534
|
+
return g.id === groupId ? require_highlight._objectSpread2(require_highlight._objectSpread2({}, g), {}, { conditions: [...g.conditions, {
|
|
1535
1535
|
id: createConditionId(),
|
|
1536
1536
|
property: (_properties$2 = properties[0]) !== null && _properties$2 !== void 0 ? _properties$2 : "",
|
|
1537
1537
|
operator: "equals",
|
|
@@ -1545,15 +1545,15 @@ function ConditionBuilder({ groups, onChange, properties = DEFAULT_PROPERTIES, l
|
|
|
1545
1545
|
createConditionId
|
|
1546
1546
|
]);
|
|
1547
1547
|
const removeCondition = (0, react.useCallback)((groupId, condId) => {
|
|
1548
|
-
onChange(groups.map((g) => g.id === groupId ?
|
|
1548
|
+
onChange(groups.map((g) => g.id === groupId ? require_highlight._objectSpread2(require_highlight._objectSpread2({}, g), {}, { conditions: g.conditions.filter((c) => c.id !== condId) }) : g));
|
|
1549
1549
|
}, [groups, onChange]);
|
|
1550
1550
|
const updateCondition = (0, react.useCallback)((groupId, condId, updates) => {
|
|
1551
|
-
onChange(groups.map((g) => g.id === groupId ?
|
|
1551
|
+
onChange(groups.map((g) => g.id === groupId ? require_highlight._objectSpread2(require_highlight._objectSpread2({}, g), {}, { conditions: g.conditions.map((c) => c.id === condId ? require_highlight._objectSpread2(require_highlight._objectSpread2({}, c), updates) : c) }) : g));
|
|
1552
1552
|
}, [groups, onChange]);
|
|
1553
1553
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConditionBuilderIdScopeContext.Provider, {
|
|
1554
1554
|
value: idScope,
|
|
1555
1555
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1556
|
-
className:
|
|
1556
|
+
className: require_highlight.cn("flex flex-col gap-3", className),
|
|
1557
1557
|
"aria-label": (_ref = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label) !== null && _ref !== void 0 ? _ref : "Condition builder",
|
|
1558
1558
|
"data-opt-id": "SXXKJ",
|
|
1559
1559
|
"data-opt-slug": "condition-builder.ConditionBuilder",
|
|
@@ -1573,7 +1573,7 @@ function ConditionBuilder({ groups, onChange, properties = DEFAULT_PROPERTIES, l
|
|
|
1573
1573
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "bg-border-subtle h-px flex-1" })
|
|
1574
1574
|
]
|
|
1575
1575
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1576
|
-
className:
|
|
1576
|
+
className: require_highlight.cn(require_highlight.OPT_SURFACE, require_highlight.OPT_BORDER, "p-3"),
|
|
1577
1577
|
role: "group",
|
|
1578
1578
|
"aria-label": `Condition group ${groupIndex + 1}`,
|
|
1579
1579
|
children: [
|
|
@@ -1583,7 +1583,7 @@ function ConditionBuilder({ groups, onChange, properties = DEFAULT_PROPERTIES, l
|
|
|
1583
1583
|
className: "flex items-center gap-2",
|
|
1584
1584
|
children: [
|
|
1585
1585
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1586
|
-
className:
|
|
1586
|
+
className: require_highlight.cn(require_highlight.OPT_TEXT_SECONDARY, "text-xs font-medium"),
|
|
1587
1587
|
children: "Match"
|
|
1588
1588
|
}),
|
|
1589
1589
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
@@ -1592,7 +1592,7 @@ function ConditionBuilder({ groups, onChange, properties = DEFAULT_PROPERTIES, l
|
|
|
1592
1592
|
const v = e.target.value;
|
|
1593
1593
|
if (v === "and" || v === "or") updateGroupLogic(group.id, v);
|
|
1594
1594
|
},
|
|
1595
|
-
className:
|
|
1595
|
+
className: require_highlight.cn("border-border bg-surface focus-visible:ring-ring focus-visible:ring-offset-ring-offset rounded border px-2 py-0.5 text-xs font-semibold outline-none focus-visible:ring-2 focus-visible:ring-offset-1", require_highlight.OPT_TEXT_PRIMARY, require_highlight.OPT_FOCUS_VISIBLE),
|
|
1596
1596
|
"aria-label": "Group logic",
|
|
1597
1597
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
1598
1598
|
value: "and",
|
|
@@ -1603,14 +1603,14 @@ function ConditionBuilder({ groups, onChange, properties = DEFAULT_PROPERTIES, l
|
|
|
1603
1603
|
})]
|
|
1604
1604
|
}),
|
|
1605
1605
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1606
|
-
className:
|
|
1606
|
+
className: require_highlight.cn(require_highlight.OPT_TEXT_SECONDARY, "text-xs"),
|
|
1607
1607
|
children: "of the following"
|
|
1608
1608
|
})
|
|
1609
1609
|
]
|
|
1610
1610
|
}), groups.length > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1611
1611
|
type: "button",
|
|
1612
1612
|
onClick: () => removeGroup(group.id),
|
|
1613
|
-
className:
|
|
1613
|
+
className: require_highlight.cn("text-danger-fg hover:bg-danger-subtle rounded p-1 text-xs", "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-ring-offset"),
|
|
1614
1614
|
"aria-label": "Remove group",
|
|
1615
1615
|
children: "✕"
|
|
1616
1616
|
})]
|
|
@@ -1623,7 +1623,7 @@ function ConditionBuilder({ groups, onChange, properties = DEFAULT_PROPERTIES, l
|
|
|
1623
1623
|
className: "flex items-center gap-2",
|
|
1624
1624
|
children: [
|
|
1625
1625
|
condIndex > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1626
|
-
className:
|
|
1626
|
+
className: require_highlight.cn("w-8 text-center text-[10px] font-semibold uppercase", group.logic === "and" ? "text-info-fg" : "text-warning-fg"),
|
|
1627
1627
|
children: group.logic
|
|
1628
1628
|
}),
|
|
1629
1629
|
condIndex === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "w-8" }),
|
|
@@ -1636,7 +1636,7 @@ function ConditionBuilder({ groups, onChange, properties = DEFAULT_PROPERTIES, l
|
|
|
1636
1636
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
|
|
1637
1637
|
value: cond.property,
|
|
1638
1638
|
onChange: (e) => updateCondition(group.id, cond.id, { property: e.target.value }),
|
|
1639
|
-
className:
|
|
1639
|
+
className: require_highlight.cn("border-border bg-surface focus-visible:ring-ring focus-visible:ring-offset-ring-offset min-w-[120px] rounded border px-2 py-1.5 text-sm outline-none focus-visible:ring-2 focus-visible:ring-offset-1", require_highlight.OPT_TEXT_PRIMARY, require_highlight.OPT_FOCUS_VISIBLE),
|
|
1640
1640
|
"aria-label": "Property",
|
|
1641
1641
|
children: properties.map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
1642
1642
|
value: p,
|
|
@@ -1649,7 +1649,7 @@ function ConditionBuilder({ groups, onChange, properties = DEFAULT_PROPERTIES, l
|
|
|
1649
1649
|
const v = e.target.value;
|
|
1650
1650
|
if (isConditionOperator(v)) updateCondition(group.id, cond.id, { operator: v });
|
|
1651
1651
|
},
|
|
1652
|
-
className:
|
|
1652
|
+
className: require_highlight.cn("border-border bg-surface focus-visible:ring-ring focus-visible:ring-offset-ring-offset min-w-[130px] rounded border px-2 py-1.5 text-sm outline-none focus-visible:ring-2 focus-visible:ring-offset-1", require_highlight.OPT_TEXT_PRIMARY, require_highlight.OPT_FOCUS_VISIBLE),
|
|
1653
1653
|
"aria-label": "Operator",
|
|
1654
1654
|
children: Object.entries(OPERATOR_LABELS).map(([key, lbl]) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
1655
1655
|
value: key,
|
|
@@ -1661,14 +1661,14 @@ function ConditionBuilder({ groups, onChange, properties = DEFAULT_PROPERTIES, l
|
|
|
1661
1661
|
value: cond.value,
|
|
1662
1662
|
onChange: (e) => updateCondition(group.id, cond.id, { value: e.target.value }),
|
|
1663
1663
|
placeholder: "Value",
|
|
1664
|
-
className:
|
|
1664
|
+
className: require_highlight.cn("border-border bg-surface focus-visible:ring-ring focus-visible:ring-offset-ring-offset min-w-[100px] flex-1 rounded border px-2 py-1.5 text-sm outline-none focus-visible:ring-2 focus-visible:ring-offset-1", "text-text-primary", "placeholder:text-text-tertiary", "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-ring-offset"),
|
|
1665
1665
|
"aria-label": "Value"
|
|
1666
1666
|
})
|
|
1667
1667
|
] }),
|
|
1668
1668
|
group.conditions.length > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1669
1669
|
type: "button",
|
|
1670
1670
|
onClick: () => removeCondition(group.id, cond.id),
|
|
1671
|
-
className:
|
|
1671
|
+
className: require_highlight.cn("text-danger-fg hover:bg-danger-subtle rounded p-1 text-sm", "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-ring-offset"),
|
|
1672
1672
|
"aria-label": "Remove condition",
|
|
1673
1673
|
children: "✕"
|
|
1674
1674
|
})
|
|
@@ -1681,7 +1681,7 @@ function ConditionBuilder({ groups, onChange, properties = DEFAULT_PROPERTIES, l
|
|
|
1681
1681
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConditionBuilder, {
|
|
1682
1682
|
groups: group.children,
|
|
1683
1683
|
onChange: (newChildren) => {
|
|
1684
|
-
onChange(groups.map((g) => g.id === group.id ?
|
|
1684
|
+
onChange(groups.map((g) => g.id === group.id ? require_highlight._objectSpread2(require_highlight._objectSpread2({}, g), {}, { children: newChildren }) : g));
|
|
1685
1685
|
},
|
|
1686
1686
|
properties,
|
|
1687
1687
|
addConditionLabel,
|
|
@@ -1694,12 +1694,12 @@ function ConditionBuilder({ groups, onChange, properties = DEFAULT_PROPERTIES, l
|
|
|
1694
1694
|
}),
|
|
1695
1695
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1696
1696
|
className: "mt-2 flex items-center gap-2",
|
|
1697
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
1697
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_highlight.Button, {
|
|
1698
1698
|
variant: "ghost",
|
|
1699
1699
|
size: "sm",
|
|
1700
1700
|
onClick: () => addCondition(group.id),
|
|
1701
1701
|
children: ["+ ", addConditionLabel]
|
|
1702
|
-
}), nested && maxDepth > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
1702
|
+
}), nested && maxDepth > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_highlight.Button, {
|
|
1703
1703
|
variant: "ghost",
|
|
1704
1704
|
size: "sm",
|
|
1705
1705
|
onClick: () => {
|
|
@@ -1716,7 +1716,7 @@ function ConditionBuilder({ groups, onChange, properties = DEFAULT_PROPERTIES, l
|
|
|
1716
1716
|
};
|
|
1717
1717
|
onChange(groups.map((g) => {
|
|
1718
1718
|
var _g$children;
|
|
1719
|
-
return g.id === group.id ?
|
|
1719
|
+
return g.id === group.id ? require_highlight._objectSpread2(require_highlight._objectSpread2({}, g), {}, { children: [...(_g$children = g.children) !== null && _g$children !== void 0 ? _g$children : [], nestedGroup] }) : g;
|
|
1720
1720
|
}));
|
|
1721
1721
|
},
|
|
1722
1722
|
children: ["+ ", addNestedGroupLabel]
|
|
@@ -1726,14 +1726,14 @@ function ConditionBuilder({ groups, onChange, properties = DEFAULT_PROPERTIES, l
|
|
|
1726
1726
|
})] }, group.id)),
|
|
1727
1727
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1728
1728
|
className: "flex items-center gap-3",
|
|
1729
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
1729
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_highlight.Button, {
|
|
1730
1730
|
variant: "secondary",
|
|
1731
1731
|
size: "sm",
|
|
1732
1732
|
onClick: addGroup,
|
|
1733
1733
|
className: "self-start",
|
|
1734
1734
|
children: ["+ ", addGroupLabel]
|
|
1735
1735
|
}), previewCount != null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1736
|
-
className:
|
|
1736
|
+
className: require_highlight.cn("text-text-secondary", "text-sm"),
|
|
1737
1737
|
children: [formatOptNumber(previewCount), " matches"]
|
|
1738
1738
|
})]
|
|
1739
1739
|
})
|
|
@@ -1748,35 +1748,35 @@ const _excluded$6 = ["className"];
|
|
|
1748
1748
|
const _excluded2$2 = ["className"];
|
|
1749
1749
|
const _excluded3$1 = ["className", "variant"];
|
|
1750
1750
|
const _excluded4 = ["className"];
|
|
1751
|
-
const DropdownMenu =
|
|
1751
|
+
const DropdownMenu = require_highlight.MenuRoot;
|
|
1752
1752
|
/** Renders the dropdown trigger component. */
|
|
1753
1753
|
function DropdownTrigger(_ref) {
|
|
1754
|
-
let { className } = _ref, props =
|
|
1755
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1754
|
+
let { className } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$6);
|
|
1755
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.MenuTrigger, require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn("cursor-pointer gap-2", className) }, props), {}, {
|
|
1756
1756
|
"data-opt-id": "C4BSS",
|
|
1757
1757
|
"data-opt-slug": "dropdown-menu.DropdownTrigger"
|
|
1758
1758
|
}));
|
|
1759
1759
|
}
|
|
1760
1760
|
/** Renders the dropdown content component. */
|
|
1761
1761
|
function DropdownContent(_ref2) {
|
|
1762
|
-
let { className } = _ref2, props =
|
|
1763
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1762
|
+
let { className } = _ref2, props = require_highlight._objectWithoutProperties(_ref2, _excluded2$2);
|
|
1763
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.MenuPopover, require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn(className) }, props), {}, {
|
|
1764
1764
|
"data-opt-id": "J6NF7",
|
|
1765
1765
|
"data-opt-slug": "dropdown-menu.DropdownContent"
|
|
1766
1766
|
}));
|
|
1767
1767
|
}
|
|
1768
1768
|
/** Renders the dropdown item component. */
|
|
1769
1769
|
function DropdownItem(_ref3) {
|
|
1770
|
-
let { className, variant = "default" } = _ref3, props =
|
|
1771
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1770
|
+
let { className, variant = "default" } = _ref3, props = require_highlight._objectWithoutProperties(_ref3, _excluded3$1);
|
|
1771
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.MenuItem, require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn("cursor-pointer data-[disabled]:cursor-not-allowed", variant === "destructive" && "text-danger-fg data-[active-item]:bg-danger-subtle data-[active-item]:text-danger-fg", className) }, props), {}, {
|
|
1772
1772
|
"data-opt-id": "5M6GA",
|
|
1773
1773
|
"data-opt-slug": "dropdown-menu.DropdownItem"
|
|
1774
1774
|
}));
|
|
1775
1775
|
}
|
|
1776
1776
|
/** Renders the dropdown separator component. */
|
|
1777
1777
|
function DropdownSeparator(_ref4) {
|
|
1778
|
-
let { className } = _ref4, props =
|
|
1779
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1778
|
+
let { className } = _ref4, props = require_highlight._objectWithoutProperties(_ref4, _excluded4);
|
|
1779
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.MenuSeparator, require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn(className) }, props), {}, {
|
|
1780
1780
|
"data-opt-id": "K9Y54",
|
|
1781
1781
|
"data-opt-slug": "dropdown-menu.DropdownSeparator"
|
|
1782
1782
|
}));
|
|
@@ -1793,7 +1793,7 @@ const _excluded$5 = [
|
|
|
1793
1793
|
"disabled",
|
|
1794
1794
|
"className"
|
|
1795
1795
|
];
|
|
1796
|
-
const sizeStyles = {
|
|
1796
|
+
const sizeStyles$3 = {
|
|
1797
1797
|
sm: {
|
|
1798
1798
|
radio: "h-4 w-4",
|
|
1799
1799
|
dot: "h-2 w-2",
|
|
@@ -1824,7 +1824,7 @@ function RadioGroup({ children, value, defaultValue = "", onChange, disabled, si
|
|
|
1824
1824
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadioGroupContext.Provider, {
|
|
1825
1825
|
value: ctxValue,
|
|
1826
1826
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1827
|
-
className:
|
|
1827
|
+
className: require_highlight.cn("flex flex-col gap-1.5", className),
|
|
1828
1828
|
"data-opt-id": "2F20H",
|
|
1829
1829
|
"data-opt-slug": "radio-group.RadioGroup",
|
|
1830
1830
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_reopt_ai_opt_ui_primitives.RadioGroupRoot, {
|
|
@@ -1839,14 +1839,14 @@ function RadioGroup({ children, value, defaultValue = "", onChange, disabled, si
|
|
|
1839
1839
|
"aria-labelledby": labelId,
|
|
1840
1840
|
"aria-required": required,
|
|
1841
1841
|
"aria-invalid": hasError,
|
|
1842
|
-
"aria-describedby":
|
|
1843
|
-
className:
|
|
1842
|
+
"aria-describedby": require_highlight.getDescribedBy(groupId, error, void 0),
|
|
1843
|
+
className: require_highlight.cn("flex", orientation === "vertical" ? "flex-col gap-3" : "flex-row gap-6"),
|
|
1844
1844
|
children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1845
1845
|
id: labelId,
|
|
1846
1846
|
className: "text-text-secondary mb-1 text-sm font-medium",
|
|
1847
|
-
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1847
|
+
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.RequiredMark, {})]
|
|
1848
1848
|
}), children]
|
|
1849
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1849
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.FieldMessages, {
|
|
1850
1850
|
id: groupId,
|
|
1851
1851
|
error
|
|
1852
1852
|
})]
|
|
@@ -1855,13 +1855,13 @@ function RadioGroup({ children, value, defaultValue = "", onChange, disabled, si
|
|
|
1855
1855
|
}
|
|
1856
1856
|
const Radio = (0, react.forwardRef)((_ref, ref) => {
|
|
1857
1857
|
var _ref2;
|
|
1858
|
-
let { label, hint, description, value, name: _name, size: sizeProp, disabled: disabledProp, className } = _ref, props =
|
|
1858
|
+
let { label, hint, description, value, name: _name, size: sizeProp, disabled: disabledProp, className } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$5);
|
|
1859
1859
|
const groupContext = (0, react.useContext)(RadioGroupContext);
|
|
1860
1860
|
const primContext = (0, _reopt_ai_opt_ui_primitives.useRadioGroupContext)();
|
|
1861
1861
|
const size = sizeProp !== null && sizeProp !== void 0 ? sizeProp : groupContext.size;
|
|
1862
1862
|
const disabled = (_ref2 = disabledProp !== null && disabledProp !== void 0 ? disabledProp : groupContext.disabled) !== null && _ref2 !== void 0 ? _ref2 : primContext === null || primContext === void 0 ? void 0 : primContext.disabled;
|
|
1863
1863
|
const hintText = hint !== null && hint !== void 0 ? hint : description;
|
|
1864
|
-
const styles = sizeStyles[size];
|
|
1864
|
+
const styles = sizeStyles$3[size];
|
|
1865
1865
|
const isChecked = (primContext === null || primContext === void 0 ? void 0 : primContext.value) === value;
|
|
1866
1866
|
const radioId = `radio-${(0, react.useId)().replace(/:/g, "")}`;
|
|
1867
1867
|
const labelId = label ? `${radioId}-label` : void 0;
|
|
@@ -1873,10 +1873,10 @@ const Radio = (0, react.forwardRef)((_ref, ref) => {
|
|
|
1873
1873
|
value,
|
|
1874
1874
|
primContext
|
|
1875
1875
|
]);
|
|
1876
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label",
|
|
1876
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", require_highlight._objectSpread2(require_highlight._objectSpread2({
|
|
1877
1877
|
ref,
|
|
1878
1878
|
"aria-checked": isChecked,
|
|
1879
|
-
className:
|
|
1879
|
+
className: require_highlight.cn("group flex items-start gap-3", disabled && "cursor-not-allowed opacity-50", !disabled && "cursor-pointer", className)
|
|
1880
1880
|
}, props), {}, {
|
|
1881
1881
|
"data-opt-id": "HY7YG",
|
|
1882
1882
|
"data-opt-slug": "radio-group.Radio",
|
|
@@ -1895,15 +1895,15 @@ const Radio = (0, react.forwardRef)((_ref, ref) => {
|
|
|
1895
1895
|
className: "sr-only"
|
|
1896
1896
|
}),
|
|
1897
1897
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1898
|
-
className:
|
|
1898
|
+
className: require_highlight.cn("relative mt-0.5 inline-flex shrink-0 items-center justify-center rounded-full", styles.radio, "border-border border-2", "bg-surface", "group-aria-checked:border-accent", "transition-colors", "group-has-[:focus-visible]:outline-ring outline-transparent group-has-[:focus-visible]:outline-2 group-has-[:focus-visible]:-outline-offset-1"),
|
|
1899
1899
|
"aria-hidden": "true",
|
|
1900
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className:
|
|
1900
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_highlight.cn(styles.dot, "bg-accent rounded-full", "scale-0 opacity-0 transition-all", "group-aria-checked:scale-100 group-aria-checked:opacity-100") })
|
|
1901
1901
|
}),
|
|
1902
1902
|
(label || hintText) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1903
1903
|
className: "flex flex-col",
|
|
1904
1904
|
children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1905
1905
|
id: labelId,
|
|
1906
|
-
className:
|
|
1906
|
+
className: require_highlight.cn("text-text-primary font-medium", styles.text),
|
|
1907
1907
|
children: label
|
|
1908
1908
|
}), hintText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1909
1909
|
id: hintId,
|
|
@@ -1925,12 +1925,12 @@ const _excluded$4 = [
|
|
|
1925
1925
|
];
|
|
1926
1926
|
/** Renders the loading overlay component. */
|
|
1927
1927
|
function LoadingOverlay(_ref) {
|
|
1928
|
-
let { loading, children, label = "Loading…", className } = _ref, props =
|
|
1929
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div",
|
|
1928
|
+
let { loading, children, label = "Loading…", className } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$4);
|
|
1929
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", require_highlight._objectSpread2(require_highlight._objectSpread2({
|
|
1930
1930
|
"data-opt-id": "380ZR",
|
|
1931
1931
|
"data-opt-slug": "loading-overlay.LoadingOverlay"
|
|
1932
1932
|
}, props), {}, {
|
|
1933
|
-
className:
|
|
1933
|
+
className: require_highlight.cn("relative", className),
|
|
1934
1934
|
children: [children, loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1935
1935
|
className: "bg-surface/60 absolute inset-0 z-10 flex items-center justify-center rounded-lg backdrop-blur-[1px]",
|
|
1936
1936
|
role: "status",
|
|
@@ -1938,7 +1938,7 @@ function LoadingOverlay(_ref) {
|
|
|
1938
1938
|
"aria-label": label,
|
|
1939
1939
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1940
1940
|
className: "flex flex-col items-center gap-2",
|
|
1941
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1941
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.Spinner, {
|
|
1942
1942
|
size: "md",
|
|
1943
1943
|
"aria-hidden": "true"
|
|
1944
1944
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -1974,9 +1974,9 @@ const insetClass = {
|
|
|
1974
1974
|
};
|
|
1975
1975
|
/** Renders the block layout component. */
|
|
1976
1976
|
function BlockLayout(_ref) {
|
|
1977
|
-
let { children, className, spacing = "section", inset, loading, loadingLabel } = _ref, props =
|
|
1978
|
-
const layoutClassName =
|
|
1979
|
-
if (loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LoadingOverlay,
|
|
1977
|
+
let { children, className, spacing = "section", inset, loading, loadingLabel } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$3);
|
|
1978
|
+
const layoutClassName = require_highlight.cn("flex flex-col", spacingClass[spacing], inset ? insetClass[inset] : void 0, className);
|
|
1979
|
+
if (loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LoadingOverlay, require_highlight._objectSpread2(require_highlight._objectSpread2({
|
|
1980
1980
|
"data-opt-id": "9D8QR",
|
|
1981
1981
|
"data-opt-slug": "block-layout.BlockLayout"
|
|
1982
1982
|
}, props), {}, {
|
|
@@ -1985,7 +1985,7 @@ function BlockLayout(_ref) {
|
|
|
1985
1985
|
label: loadingLabel,
|
|
1986
1986
|
children
|
|
1987
1987
|
}));
|
|
1988
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div",
|
|
1988
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", require_highlight._objectSpread2(require_highlight._objectSpread2({
|
|
1989
1989
|
"data-opt-id": "9D8QR",
|
|
1990
1990
|
"data-opt-slug": "block-layout.BlockLayout"
|
|
1991
1991
|
}, props), {}, {
|
|
@@ -2006,7 +2006,7 @@ const _excluded$2 = ["loading", "className"];
|
|
|
2006
2006
|
*/
|
|
2007
2007
|
function createBlock(name, render, options) {
|
|
2008
2008
|
const Component = (props) => {
|
|
2009
|
-
const { loading, className } = props, rest =
|
|
2009
|
+
const { loading, className } = props, rest = require_highlight._objectWithoutProperties(props, _excluded$2);
|
|
2010
2010
|
const layoutCn = (options === null || options === void 0 ? void 0 : options.layoutClassName) ? `${options.layoutClassName}${className ? ` ${className}` : ""}` : className;
|
|
2011
2011
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BlockLayout, {
|
|
2012
2012
|
loading,
|
|
@@ -2022,7 +2022,7 @@ function createBlock(name, render, options) {
|
|
|
2022
2022
|
/** Renders the page header component. */
|
|
2023
2023
|
function PageHeader({ title, description, actions, className }) {
|
|
2024
2024
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2025
|
-
className:
|
|
2025
|
+
className: require_highlight.cn("gap-group flex flex-col items-stretch sm:flex-row sm:items-center sm:justify-between", className),
|
|
2026
2026
|
"data-opt-id": "7AK8Z",
|
|
2027
2027
|
"data-opt-slug": "page-header.PageHeader",
|
|
2028
2028
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -2051,7 +2051,7 @@ const overflowMap = {
|
|
|
2051
2051
|
/** Renders the scroll area component. */
|
|
2052
2052
|
function ScrollArea({ children, className, orientation = "vertical" }) {
|
|
2053
2053
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2054
|
-
className:
|
|
2054
|
+
className: require_highlight.cn(overflowMap[orientation], "scrollbar-thin scrollbar-track-transparent scrollbar-thumb-border hover:scrollbar-thumb-border-hover", className),
|
|
2055
2055
|
"data-opt-id": "A9X4K",
|
|
2056
2056
|
"data-opt-slug": "scroll-area.ScrollArea",
|
|
2057
2057
|
children
|
|
@@ -2071,7 +2071,7 @@ const maxWidthMap = {
|
|
|
2071
2071
|
/** Renders the container component. */
|
|
2072
2072
|
function Container({ children, maxWidth = "xl", center = true, className }) {
|
|
2073
2073
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2074
|
-
className:
|
|
2074
|
+
className: require_highlight.cn(maxWidthMap[maxWidth], center && "mx-auto", "px-4", className),
|
|
2075
2075
|
"data-opt-id": "H3G96",
|
|
2076
2076
|
"data-opt-slug": "container.Container",
|
|
2077
2077
|
children
|
|
@@ -2084,7 +2084,7 @@ Container.displayName = "Container";
|
|
|
2084
2084
|
function Section({ children, title, description, className }) {
|
|
2085
2085
|
const titleId = `${(0, react.useId)()}-title`;
|
|
2086
2086
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
2087
|
-
className:
|
|
2087
|
+
className: require_highlight.cn("gap-group flex flex-col", className),
|
|
2088
2088
|
"aria-labelledby": title ? titleId : void 0,
|
|
2089
2089
|
"data-opt-id": "M3QXW",
|
|
2090
2090
|
"data-opt-slug": "section.Section",
|
|
@@ -2125,11 +2125,11 @@ function toPanelSize(size) {
|
|
|
2125
2125
|
}
|
|
2126
2126
|
/** Renders the resizable panel group component. */
|
|
2127
2127
|
function ResizablePanelGroup(_ref) {
|
|
2128
|
-
let { direction, children, className, id, autoSaveId } = _ref, props =
|
|
2129
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_resizable_panels.Group,
|
|
2128
|
+
let { direction, children, className, id, autoSaveId } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded$1);
|
|
2129
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_resizable_panels.Group, require_highlight._objectSpread2(require_highlight._objectSpread2({
|
|
2130
2130
|
orientation: direction,
|
|
2131
2131
|
id: id !== null && id !== void 0 ? id : autoSaveId,
|
|
2132
|
-
className:
|
|
2132
|
+
className: require_highlight.cn("flex h-full w-full", className)
|
|
2133
2133
|
}, props), {}, {
|
|
2134
2134
|
"data-opt-id": "BM5RR",
|
|
2135
2135
|
"data-opt-slug": "resizable.ResizablePanelGroup",
|
|
@@ -2139,13 +2139,13 @@ function ResizablePanelGroup(_ref) {
|
|
|
2139
2139
|
ResizablePanelGroup.displayName = "ResizablePanelGroup";
|
|
2140
2140
|
/** Renders the resizable panel component. */
|
|
2141
2141
|
function ResizablePanel(_ref2) {
|
|
2142
|
-
let { collapsedSize, defaultSize, minSize, maxSize, children, className } = _ref2, props =
|
|
2143
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_resizable_panels.Panel,
|
|
2142
|
+
let { collapsedSize, defaultSize, minSize, maxSize, children, className } = _ref2, props = require_highlight._objectWithoutProperties(_ref2, _excluded2$1);
|
|
2143
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_resizable_panels.Panel, require_highlight._objectSpread2(require_highlight._objectSpread2({
|
|
2144
2144
|
collapsedSize: toPanelSize(collapsedSize),
|
|
2145
2145
|
defaultSize: toPanelSize(defaultSize),
|
|
2146
2146
|
minSize: toPanelSize(minSize),
|
|
2147
2147
|
maxSize: toPanelSize(maxSize),
|
|
2148
|
-
className:
|
|
2148
|
+
className: require_highlight.cn("overflow-auto", className)
|
|
2149
2149
|
}, props), {}, {
|
|
2150
2150
|
"data-opt-id": "88X4V",
|
|
2151
2151
|
"data-opt-slug": "resizable.ResizablePanel",
|
|
@@ -2155,8 +2155,8 @@ function ResizablePanel(_ref2) {
|
|
|
2155
2155
|
ResizablePanel.displayName = "ResizablePanel";
|
|
2156
2156
|
/** Renders the resizable handle component. */
|
|
2157
2157
|
function ResizableHandle(_ref3) {
|
|
2158
|
-
let { className, withHandle = false } = _ref3, props =
|
|
2159
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_resizable_panels.Separator,
|
|
2158
|
+
let { className, withHandle = false } = _ref3, props = require_highlight._objectWithoutProperties(_ref3, _excluded3);
|
|
2159
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_resizable_panels.Separator, require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn("bg-border relative flex items-center justify-center", "after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2", "data-[resize-handle-active]:bg-accent", "[&[data-orientation=vertical]]:h-px [&[data-orientation=vertical]]:w-full", "[&[data-orientation=horizontal]]:h-full [&[data-orientation=horizontal]]:w-px", className) }, props), {}, {
|
|
2160
2160
|
"data-opt-id": "6Z22W",
|
|
2161
2161
|
"data-opt-slug": "resizable.ResizableHandle",
|
|
2162
2162
|
children: withHandle && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -2190,28 +2190,28 @@ function Logo({ src, icon, text, alt = "Logo", size = "md", href, onClick, class
|
|
|
2190
2190
|
if (showImage) mark = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
2191
2191
|
src,
|
|
2192
2192
|
alt,
|
|
2193
|
-
className:
|
|
2193
|
+
className: require_highlight.cn("object-contain", markSizeStyles[size]),
|
|
2194
2194
|
onError: () => setImageError(true)
|
|
2195
2195
|
});
|
|
2196
2196
|
else if (icon) mark = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2197
|
-
className:
|
|
2197
|
+
className: require_highlight.cn("flex shrink-0 items-center justify-center", markSizeStyles[size]),
|
|
2198
2198
|
"aria-hidden": "true",
|
|
2199
2199
|
children: icon
|
|
2200
2200
|
});
|
|
2201
2201
|
else if (fallbackLetter) mark = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2202
|
-
className:
|
|
2202
|
+
className: require_highlight.cn("bg-accent text-on-accent flex shrink-0 items-center justify-center rounded-lg font-bold", markSizeStyles[size], textSizeStyles[size]),
|
|
2203
2203
|
"aria-hidden": "true",
|
|
2204
2204
|
children: fallbackLetter
|
|
2205
2205
|
});
|
|
2206
2206
|
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [mark, text && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2207
|
-
className:
|
|
2207
|
+
className: require_highlight.cn("text-text-primary font-semibold", textSizeStyles[size]),
|
|
2208
2208
|
children: text
|
|
2209
2209
|
})] });
|
|
2210
|
-
const sharedClassName =
|
|
2210
|
+
const sharedClassName = require_highlight.cn("inline-flex items-center gap-element", className);
|
|
2211
2211
|
if (href) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
2212
2212
|
href,
|
|
2213
2213
|
onClick,
|
|
2214
|
-
className:
|
|
2214
|
+
className: require_highlight.cn(sharedClassName, "no-underline"),
|
|
2215
2215
|
"aria-label": text !== null && text !== void 0 ? text : alt,
|
|
2216
2216
|
"data-opt-id": "R906A",
|
|
2217
2217
|
"data-opt-slug": "logo.Logo",
|
|
@@ -2264,7 +2264,7 @@ const positionClass = {
|
|
|
2264
2264
|
};
|
|
2265
2265
|
/** Renders the drawer root component. */
|
|
2266
2266
|
function DrawerRoot(props) {
|
|
2267
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.DialogRoot,
|
|
2267
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.DialogRoot, require_highlight._objectSpread2(require_highlight._objectSpread2({ animated: true }, props), {}, {
|
|
2268
2268
|
"data-opt-id": "YGJ0M",
|
|
2269
2269
|
"data-opt-slug": "drawer.DrawerRoot"
|
|
2270
2270
|
}));
|
|
@@ -2280,7 +2280,7 @@ function dismissOffset(side, dx, dy) {
|
|
|
2280
2280
|
}
|
|
2281
2281
|
/** Renders the drawer panel component. */
|
|
2282
2282
|
function DrawerPanel(_ref) {
|
|
2283
|
-
let { className, side = "right", size = "md", swipeToDismiss = true, swipeDismissThreshold = 80, style, onPointerDown } = _ref, props =
|
|
2283
|
+
let { className, side = "right", size = "md", swipeToDismiss = true, swipeDismissThreshold = 80, style, onPointerDown } = _ref, props = require_highlight._objectWithoutProperties(_ref, _excluded);
|
|
2284
2284
|
const isHorizontal = side === "left" || side === "right";
|
|
2285
2285
|
const close = (0, _reopt_ai_opt_ui_primitives.useDialogClose)();
|
|
2286
2286
|
const dragStart = (0, react.useRef)(null);
|
|
@@ -2342,9 +2342,9 @@ function DrawerPanel(_ref) {
|
|
|
2342
2342
|
};
|
|
2343
2343
|
}, [side]);
|
|
2344
2344
|
const dragStyle = offset !== 0 ? { transform: `translate${axis}(${offset}px)` } : void 0;
|
|
2345
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.DialogPanel,
|
|
2346
|
-
className:
|
|
2347
|
-
style:
|
|
2345
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.DialogPanel, require_highlight._objectSpread2(require_highlight._objectSpread2({
|
|
2346
|
+
className: require_highlight.cn("border-border bg-surface z-50 m-0 flex flex-col border p-0 shadow-2xl", "data-[enter]:fade-in data-[leave]:fade-out", dragging ? "touch-none" : require_highlight.OPT_ANIMATE_DRAWER[side], positionClass[side], isHorizontal ? ["h-full w-full", sizeMap[size]] : ["w-full", heightMap[size]], className),
|
|
2347
|
+
style: require_highlight._objectSpread2(require_highlight._objectSpread2(require_highlight._objectSpread2(require_highlight._objectSpread2({}, style), dragStyle), keyboardInset > 0 ? { marginBottom: keyboardInset } : null), dragging ? { transition: "none" } : null),
|
|
2348
2348
|
onPointerDown: handlePointerDown,
|
|
2349
2349
|
onPointerMove: swipeToDismiss ? handlePointerMove : void 0,
|
|
2350
2350
|
onPointerUp: swipeToDismiss ? endDrag : void 0,
|
|
@@ -2356,8 +2356,8 @@ function DrawerPanel(_ref) {
|
|
|
2356
2356
|
}
|
|
2357
2357
|
/** Renders the drawer close component. */
|
|
2358
2358
|
function DrawerClose(_ref2) {
|
|
2359
|
-
let { className } = _ref2, props =
|
|
2360
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.DialogDismiss,
|
|
2359
|
+
let { className } = _ref2, props = require_highlight._objectWithoutProperties(_ref2, _excluded2);
|
|
2360
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.DialogDismiss, require_highlight._objectSpread2(require_highlight._objectSpread2({ className: require_highlight.cn("hover:bg-bg-subtle rounded-md p-1.5 transition-colors", "cursor-pointer data-[disabled]:cursor-not-allowed", require_highlight.OPT_FOCUS, className) }, props), {}, {
|
|
2361
2361
|
"data-opt-id": "M6D6D",
|
|
2362
2362
|
"data-opt-slug": "drawer.DrawerClose"
|
|
2363
2363
|
}));
|
|
@@ -2464,8 +2464,8 @@ function VirtualList({ items, renderItem, itemHeight, overscan = 3, className, s
|
|
|
2464
2464
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2465
2465
|
ref: handleRef,
|
|
2466
2466
|
onScroll: handleScroll,
|
|
2467
|
-
className:
|
|
2468
|
-
style:
|
|
2467
|
+
className: require_highlight.cn("overflow-auto", className),
|
|
2468
|
+
style: require_highlight._objectSpread2({ position: "relative" }, style),
|
|
2469
2469
|
role: "list",
|
|
2470
2470
|
"data-opt-id": "VT2NP",
|
|
2471
2471
|
"data-opt-slug": "virtual-list.VirtualList",
|
|
@@ -3638,8 +3638,8 @@ const ShaderSurfaceComponent = (0, react.forwardRef)(function ShaderSurface({ pr
|
|
|
3638
3638
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3639
3639
|
ref: containerRef,
|
|
3640
3640
|
"aria-hidden": ariaHidden,
|
|
3641
|
-
className:
|
|
3642
|
-
style:
|
|
3641
|
+
className: require_highlight.cn("relative overflow-hidden", className),
|
|
3642
|
+
style: require_highlight._objectSpread2({ background: fallbackBackground }, style),
|
|
3643
3643
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("canvas", {
|
|
3644
3644
|
ref: canvasRef,
|
|
3645
3645
|
className: "absolute inset-0 block h-full w-full"
|
|
@@ -3649,6 +3649,842 @@ const ShaderSurfaceComponent = (0, react.forwardRef)(function ShaderSurface({ pr
|
|
|
3649
3649
|
ShaderSurfaceComponent.displayName = "ShaderSurface";
|
|
3650
3650
|
const ShaderSurface = ShaderSurfaceComponent;
|
|
3651
3651
|
//#endregion
|
|
3652
|
+
//#region src/core/facet.tsx
|
|
3653
|
+
const defaultLabels$1 = {
|
|
3654
|
+
empty: "No values in this range.",
|
|
3655
|
+
loading: "Counting…",
|
|
3656
|
+
showMore: (remaining) => `Show ${remaining} more`,
|
|
3657
|
+
showLess: "Show fewer",
|
|
3658
|
+
selectHint: (label, count, share) => `${label}, ${count} (${share})`
|
|
3659
|
+
};
|
|
3660
|
+
function defaultCountFormat(value) {
|
|
3661
|
+
return new Intl.NumberFormat(void 0, { notation: "compact" }).format(value);
|
|
3662
|
+
}
|
|
3663
|
+
function formatShare(share) {
|
|
3664
|
+
const percent = share * 100;
|
|
3665
|
+
if (percent > 0 && percent < .1) return "<0.1%";
|
|
3666
|
+
return `${percent >= 10 ? Math.round(percent) : percent.toFixed(1)}%`;
|
|
3667
|
+
}
|
|
3668
|
+
/**
|
|
3669
|
+
* Facet — one value of a field, its count, and its share of the whole.
|
|
3670
|
+
*
|
|
3671
|
+
* The row is the filter: reading it and acting on it are the same gesture,
|
|
3672
|
+
* which is what separates a facet from a legend.
|
|
3673
|
+
*/
|
|
3674
|
+
function Facet({ item, selected = false, onSelect, showShare = true, share, countFormatter = defaultCountFormat, layout = "vertical", labels, className }) {
|
|
3675
|
+
var _ref;
|
|
3676
|
+
const text = require_highlight._objectSpread2(require_highlight._objectSpread2({}, defaultLabels$1), labels);
|
|
3677
|
+
const resolvedShare = (_ref = share !== null && share !== void 0 ? share : item.share) !== null && _ref !== void 0 ? _ref : 0;
|
|
3678
|
+
const interactive = onSelect !== void 0 && !item.disabled;
|
|
3679
|
+
const countText = item.count === void 0 ? "" : countFormatter(item.count);
|
|
3680
|
+
const shareText = formatShare(resolvedShare);
|
|
3681
|
+
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3682
|
+
showShare && layout === "vertical" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3683
|
+
"aria-hidden": "true",
|
|
3684
|
+
className: require_highlight.cn("absolute inset-y-0 left-0 rounded-[inherit] transition-[width] duration-300", selected ? "bg-accent/25" : "bg-accent/10"),
|
|
3685
|
+
style: {
|
|
3686
|
+
width: `${Math.max(resolvedShare * 100, resolvedShare > 0 ? 1.5 : 0)}%`,
|
|
3687
|
+
backgroundColor: item.color ? `color-mix(in oklab, ${item.color} ${selected ? 30 : 16}%, transparent)` : void 0
|
|
3688
|
+
}
|
|
3689
|
+
}),
|
|
3690
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3691
|
+
className: "gap-element relative flex min-w-0 flex-1 items-center",
|
|
3692
|
+
children: [
|
|
3693
|
+
item.color && !item.icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3694
|
+
"aria-hidden": "true",
|
|
3695
|
+
className: "size-2 shrink-0 rounded-full",
|
|
3696
|
+
style: { backgroundColor: item.color }
|
|
3697
|
+
}),
|
|
3698
|
+
item.icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3699
|
+
"aria-hidden": "true",
|
|
3700
|
+
className: "shrink-0",
|
|
3701
|
+
children: item.icon
|
|
3702
|
+
}),
|
|
3703
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3704
|
+
className: "truncate",
|
|
3705
|
+
children: item.label
|
|
3706
|
+
})
|
|
3707
|
+
]
|
|
3708
|
+
}),
|
|
3709
|
+
item.count !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3710
|
+
className: "text-text-tertiary relative shrink-0 tabular-nums",
|
|
3711
|
+
children: countText
|
|
3712
|
+
}),
|
|
3713
|
+
showShare && item.count !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3714
|
+
className: "text-text-tertiary relative w-11 shrink-0 text-right text-xs tabular-nums",
|
|
3715
|
+
children: shareText
|
|
3716
|
+
})
|
|
3717
|
+
] });
|
|
3718
|
+
const shellClass = require_highlight.cn("relative flex w-full items-center gap-element overflow-hidden rounded-md px-2 py-1.5 text-left text-sm", layout === "horizontal" && "w-auto", selected ? "text-text-primary font-medium" : "text-text-secondary", interactive && "hover:bg-accent-subtle hover:text-text-primary cursor-pointer transition-colors", item.disabled && "cursor-not-allowed opacity-50", className);
|
|
3719
|
+
if (!interactive) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3720
|
+
className: shellClass,
|
|
3721
|
+
"data-selected": selected || void 0,
|
|
3722
|
+
"data-opt-id": "E9H18",
|
|
3723
|
+
"data-opt-slug": "facet.Facet",
|
|
3724
|
+
children: content
|
|
3725
|
+
});
|
|
3726
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3727
|
+
type: "button",
|
|
3728
|
+
className: require_highlight.cn(shellClass, require_highlight.OPT_FOCUS_VISIBLE),
|
|
3729
|
+
"aria-pressed": selected,
|
|
3730
|
+
"aria-label": text.selectHint(typeof item.label === "string" ? item.label : item.id, countText, shareText),
|
|
3731
|
+
disabled: item.disabled,
|
|
3732
|
+
onClick: () => onSelect(item.id),
|
|
3733
|
+
"data-selected": selected || void 0,
|
|
3734
|
+
"data-opt-id": "E9H18",
|
|
3735
|
+
"data-opt-slug": "facet.Facet",
|
|
3736
|
+
children: content
|
|
3737
|
+
});
|
|
3738
|
+
}
|
|
3739
|
+
/**
|
|
3740
|
+
* FacetGroup — the distribution of one field, as a list you can filter with.
|
|
3741
|
+
*
|
|
3742
|
+
* Counts alone do not say whether 4,000 is most of the data or a rounding
|
|
3743
|
+
* error, so every row carries its share of the whole as a bar behind the
|
|
3744
|
+
* label. The tail collapses by default: a high-cardinality field would
|
|
3745
|
+
* otherwise push everything else off the screen.
|
|
3746
|
+
*
|
|
3747
|
+
* @example
|
|
3748
|
+
* ```tsx
|
|
3749
|
+
* <FacetGroup
|
|
3750
|
+
* items={topValues}
|
|
3751
|
+
* selected={filters}
|
|
3752
|
+
* onSelectedChange={setFilters}
|
|
3753
|
+
* total={sampledRows}
|
|
3754
|
+
* max={5}
|
|
3755
|
+
* />
|
|
3756
|
+
* ```
|
|
3757
|
+
*/
|
|
3758
|
+
function FacetGroup({ items, selected, onSelectedChange, selection = "multiple", layout = "vertical", showShare = true, countFormatter = defaultCountFormat, max, total, loading = false, emptyState, labels, className, "aria-label": ariaLabel }) {
|
|
3759
|
+
const text = require_highlight._objectSpread2(require_highlight._objectSpread2({}, defaultLabels$1), labels);
|
|
3760
|
+
const [uncontrolled, setUncontrolled] = (0, react.useState)([]);
|
|
3761
|
+
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
3762
|
+
const current = selected !== null && selected !== void 0 ? selected : uncontrolled;
|
|
3763
|
+
const denominator = (0, react.useMemo)(() => {
|
|
3764
|
+
if (total !== void 0 && total > 0) return total;
|
|
3765
|
+
const sum = items.reduce((acc, item) => {
|
|
3766
|
+
var _item$count;
|
|
3767
|
+
return acc + ((_item$count = item.count) !== null && _item$count !== void 0 ? _item$count : 0);
|
|
3768
|
+
}, 0);
|
|
3769
|
+
return sum > 0 ? sum : 1;
|
|
3770
|
+
}, [items, total]);
|
|
3771
|
+
const visible = max === void 0 || expanded ? items : items.slice(0, Math.max(max, 1));
|
|
3772
|
+
const remaining = items.length - visible.length;
|
|
3773
|
+
const handleSelect = (id) => {
|
|
3774
|
+
if (selection === "none") return;
|
|
3775
|
+
const next = selection === "single" ? current.includes(id) ? [] : [id] : current.includes(id) ? current.filter((value) => value !== id) : [...current, id];
|
|
3776
|
+
if (selected === void 0) setUncontrolled(next);
|
|
3777
|
+
onSelectedChange === null || onSelectedChange === void 0 || onSelectedChange(next);
|
|
3778
|
+
};
|
|
3779
|
+
if (loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3780
|
+
className: require_highlight.cn("flex flex-col gap-element", className),
|
|
3781
|
+
"aria-busy": "true",
|
|
3782
|
+
"aria-label": ariaLabel,
|
|
3783
|
+
"data-opt-id": "G1RNN",
|
|
3784
|
+
"data-opt-slug": "facet.FacetGroup",
|
|
3785
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3786
|
+
className: "sr-only",
|
|
3787
|
+
children: text.loading
|
|
3788
|
+
}), Array.from({ length: Math.min(max !== null && max !== void 0 ? max : 4, 6) }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3789
|
+
"aria-hidden": "true",
|
|
3790
|
+
className: "bg-bg-subtle h-7 animate-pulse rounded-md"
|
|
3791
|
+
}, index))]
|
|
3792
|
+
});
|
|
3793
|
+
if (items.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3794
|
+
className: require_highlight.cn("text-text-tertiary px-2 py-1.5 text-sm", className),
|
|
3795
|
+
"aria-label": ariaLabel,
|
|
3796
|
+
"data-opt-id": "G1RNN",
|
|
3797
|
+
"data-opt-slug": "facet.FacetGroup",
|
|
3798
|
+
children: emptyState !== null && emptyState !== void 0 ? emptyState : text.empty
|
|
3799
|
+
});
|
|
3800
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3801
|
+
className: require_highlight.cn(layout === "vertical" ? "flex flex-col gap-0.5" : "flex flex-wrap items-center gap-element", className),
|
|
3802
|
+
role: selection === "none" ? "list" : "group",
|
|
3803
|
+
"aria-label": ariaLabel,
|
|
3804
|
+
"data-opt-id": "G1RNN",
|
|
3805
|
+
"data-opt-slug": "facet.FacetGroup",
|
|
3806
|
+
children: [visible.map((item) => {
|
|
3807
|
+
var _item$share, _item$count2;
|
|
3808
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Facet, {
|
|
3809
|
+
item,
|
|
3810
|
+
layout,
|
|
3811
|
+
selected: current.includes(item.id),
|
|
3812
|
+
onSelect: selection === "none" ? void 0 : handleSelect,
|
|
3813
|
+
showShare,
|
|
3814
|
+
share: (_item$share = item.share) !== null && _item$share !== void 0 ? _item$share : ((_item$count2 = item.count) !== null && _item$count2 !== void 0 ? _item$count2 : 0) / denominator,
|
|
3815
|
+
countFormatter,
|
|
3816
|
+
labels
|
|
3817
|
+
}, item.id);
|
|
3818
|
+
}), (remaining > 0 || expanded) && max !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3819
|
+
type: "button",
|
|
3820
|
+
className: require_highlight.cn("text-text-tertiary hover:text-text-primary rounded-md px-2 py-1 text-left text-xs", "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-ring-offset"),
|
|
3821
|
+
onClick: () => setExpanded((value) => !value),
|
|
3822
|
+
children: expanded ? text.showLess : text.showMore(remaining)
|
|
3823
|
+
})]
|
|
3824
|
+
});
|
|
3825
|
+
}
|
|
3826
|
+
//#endregion
|
|
3827
|
+
//#region src/core/expression.tsx
|
|
3828
|
+
const toneStyles = {
|
|
3829
|
+
accent: {
|
|
3830
|
+
text: "text-accent",
|
|
3831
|
+
rule: "decoration-accent"
|
|
3832
|
+
},
|
|
3833
|
+
success: {
|
|
3834
|
+
text: "text-success",
|
|
3835
|
+
rule: "decoration-success"
|
|
3836
|
+
},
|
|
3837
|
+
warning: {
|
|
3838
|
+
text: "text-warning",
|
|
3839
|
+
rule: "decoration-warning"
|
|
3840
|
+
},
|
|
3841
|
+
danger: {
|
|
3842
|
+
text: "text-danger",
|
|
3843
|
+
rule: "decoration-danger"
|
|
3844
|
+
},
|
|
3845
|
+
info: {
|
|
3846
|
+
text: "text-info",
|
|
3847
|
+
rule: "decoration-info"
|
|
3848
|
+
},
|
|
3849
|
+
muted: {
|
|
3850
|
+
text: "text-text-secondary",
|
|
3851
|
+
rule: "decoration-border-hover"
|
|
3852
|
+
}
|
|
3853
|
+
};
|
|
3854
|
+
/**
|
|
3855
|
+
* Expression — one clause of a condition, written as a sentence and edited in
|
|
3856
|
+
* place.
|
|
3857
|
+
*
|
|
3858
|
+
* A rule like "when the count of checkout events is above 100 over 5 minutes"
|
|
3859
|
+
* is a sentence before it is a form. Rendering it as one — with only the
|
|
3860
|
+
* variable halves clickable — lets a reader verify the rule by reading it,
|
|
3861
|
+
* which is the step a stack of labelled inputs skips.
|
|
3862
|
+
*
|
|
3863
|
+
* @example
|
|
3864
|
+
* ```tsx
|
|
3865
|
+
* <ExpressionGroup>
|
|
3866
|
+
* <Expression description="when" value="count()" onClick={openAggregation} />
|
|
3867
|
+
* <Expression description="is above" value="100" tone="danger" onClick={openThreshold} />
|
|
3868
|
+
* <Expression description="for the last" value="5 minutes" onClick={openWindow} />
|
|
3869
|
+
* </ExpressionGroup>
|
|
3870
|
+
* ```
|
|
3871
|
+
*/
|
|
3872
|
+
function Expression({ description, value, tone = "accent", active = false, invalid = false, disabled = false, onClick, display = "inline", "aria-label": ariaLabel, className }) {
|
|
3873
|
+
const palette = invalid ? toneStyles.danger : toneStyles[tone];
|
|
3874
|
+
const interactive = onClick !== void 0 && !disabled;
|
|
3875
|
+
const body = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3876
|
+
className: require_highlight.cn("text-text-secondary text-xs font-semibold tracking-wide uppercase", disabled && "opacity-60"),
|
|
3877
|
+
children: description
|
|
3878
|
+
}), value !== void 0 && value !== null && value !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3879
|
+
className: require_highlight.cn("text-sm font-semibold", palette.text, interactive && require_highlight.cn("underline decoration-2 underline-offset-4", palette.rule, active ? "decoration-solid" : "decoration-dotted"), disabled && "opacity-60"),
|
|
3880
|
+
children: value
|
|
3881
|
+
})] });
|
|
3882
|
+
const shell = require_highlight.cn(display === "stacked" ? "flex flex-col items-start gap-0.5" : "inline-flex items-baseline gap-1.5", "rounded-md px-1.5 py-1 text-left", interactive && "hover:bg-accent-subtle cursor-pointer transition-colors", active && "bg-accent-subtle", disabled && "cursor-not-allowed", className);
|
|
3883
|
+
if (!interactive) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3884
|
+
className: shell,
|
|
3885
|
+
"data-invalid": invalid || void 0,
|
|
3886
|
+
"data-opt-id": "TXGA8",
|
|
3887
|
+
"data-opt-slug": "expression.Expression",
|
|
3888
|
+
children: body
|
|
3889
|
+
});
|
|
3890
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3891
|
+
type: "button",
|
|
3892
|
+
className: require_highlight.cn(shell, require_highlight.OPT_FOCUS_VISIBLE),
|
|
3893
|
+
onClick,
|
|
3894
|
+
disabled,
|
|
3895
|
+
"aria-expanded": active,
|
|
3896
|
+
"aria-label": ariaLabel,
|
|
3897
|
+
"data-invalid": invalid || void 0,
|
|
3898
|
+
"data-opt-id": "TXGA8",
|
|
3899
|
+
"data-opt-slug": "expression.Expression",
|
|
3900
|
+
children: body
|
|
3901
|
+
});
|
|
3902
|
+
}
|
|
3903
|
+
/**
|
|
3904
|
+
* ExpressionGroup — the clauses of one condition, laid out so they read as a
|
|
3905
|
+
* single sentence rather than as a row of unrelated controls.
|
|
3906
|
+
*/
|
|
3907
|
+
function ExpressionGroup({ children, display = "sentence", className, "aria-label": ariaLabel }) {
|
|
3908
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3909
|
+
className: require_highlight.cn(display === "sentence" ? "flex flex-wrap items-baseline gap-x-1 gap-y-1" : "grid grid-flow-col auto-cols-fr items-start gap-group", className),
|
|
3910
|
+
role: "group",
|
|
3911
|
+
"aria-label": ariaLabel,
|
|
3912
|
+
"data-opt-id": "F78CE",
|
|
3913
|
+
"data-opt-slug": "expression.ExpressionGroup",
|
|
3914
|
+
children
|
|
3915
|
+
});
|
|
3916
|
+
}
|
|
3917
|
+
//#endregion
|
|
3918
|
+
//#region src/core/text-truncate.tsx
|
|
3919
|
+
const useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
3920
|
+
/** Measures text in the element's own resolved font, not an assumed one. */
|
|
3921
|
+
function createMeasurer(element) {
|
|
3922
|
+
const context = document.createElement("canvas").getContext("2d");
|
|
3923
|
+
if (!context) return null;
|
|
3924
|
+
const computed = window.getComputedStyle(element);
|
|
3925
|
+
context.font = [
|
|
3926
|
+
computed.fontStyle,
|
|
3927
|
+
computed.fontVariant,
|
|
3928
|
+
computed.fontWeight,
|
|
3929
|
+
`${computed.fontSize}/${computed.lineHeight}`,
|
|
3930
|
+
computed.fontFamily
|
|
3931
|
+
].join(" ");
|
|
3932
|
+
const spacing = Number.parseFloat(computed.letterSpacing) || 0;
|
|
3933
|
+
return (value) => context.measureText(value).width + spacing * value.length;
|
|
3934
|
+
}
|
|
3935
|
+
/** Largest `n` in `[0, max]` for which `fits(n)` holds. */
|
|
3936
|
+
function largestFitting(max, fits) {
|
|
3937
|
+
let low = 0;
|
|
3938
|
+
let high = max;
|
|
3939
|
+
while (low < high) {
|
|
3940
|
+
const mid = Math.ceil((low + high) / 2);
|
|
3941
|
+
if (fits(mid)) low = mid;
|
|
3942
|
+
else high = mid - 1;
|
|
3943
|
+
}
|
|
3944
|
+
return low;
|
|
3945
|
+
}
|
|
3946
|
+
function truncateToWidth(text, side, ellipsis, available, measure) {
|
|
3947
|
+
if (measure(text) <= available) return text;
|
|
3948
|
+
const chars = Array.from(text);
|
|
3949
|
+
if (side === "end") {
|
|
3950
|
+
const keep = largestFitting(chars.length, (n) => measure(chars.slice(0, n).join("") + ellipsis) <= available);
|
|
3951
|
+
return chars.slice(0, keep).join("") + ellipsis;
|
|
3952
|
+
}
|
|
3953
|
+
if (side === "start") {
|
|
3954
|
+
const keep = largestFitting(chars.length, (n) => measure(ellipsis + chars.slice(chars.length - n).join("")) <= available);
|
|
3955
|
+
return ellipsis + chars.slice(chars.length - keep).join("");
|
|
3956
|
+
}
|
|
3957
|
+
if (side === "startEnd") {
|
|
3958
|
+
const keep = largestFitting(Math.floor(chars.length / 2), (n) => {
|
|
3959
|
+
const head = chars.slice(0, n).join("");
|
|
3960
|
+
const tail = chars.slice(chars.length - n).join("");
|
|
3961
|
+
return measure(head + ellipsis + tail) <= available;
|
|
3962
|
+
});
|
|
3963
|
+
if (keep === 0) return ellipsis;
|
|
3964
|
+
return chars.slice(0, keep).join("") + ellipsis + chars.slice(chars.length - keep).join("");
|
|
3965
|
+
}
|
|
3966
|
+
const span = largestFitting(chars.length, (n) => {
|
|
3967
|
+
const start = Math.floor((chars.length - n) / 2);
|
|
3968
|
+
return measure(ellipsis + chars.slice(start, start + n).join("") + ellipsis) <= available;
|
|
3969
|
+
});
|
|
3970
|
+
if (span === 0) return ellipsis;
|
|
3971
|
+
const start = Math.floor((chars.length - span) / 2);
|
|
3972
|
+
return ellipsis + chars.slice(start, start + span).join("") + ellipsis;
|
|
3973
|
+
}
|
|
3974
|
+
/**
|
|
3975
|
+
* TextTruncate — drops characters from the part of a string that identifies it
|
|
3976
|
+
* least.
|
|
3977
|
+
*
|
|
3978
|
+
* CSS can only cut the end. That is the wrong end for the strings analytics
|
|
3979
|
+
* shows most: two URLs that differ in their query string, two ids that share a
|
|
3980
|
+
* prefix, a stack frame whose filename is at the tail. This measures the real
|
|
3981
|
+
* text in the real font against the real available width and cuts where the
|
|
3982
|
+
* caller says.
|
|
3983
|
+
*
|
|
3984
|
+
* The full string stays in the accessibility tree and in `title`, so
|
|
3985
|
+
* truncation never costs the reader information — only space.
|
|
3986
|
+
*
|
|
3987
|
+
* @example
|
|
3988
|
+
* ```tsx
|
|
3989
|
+
* <TextTruncate text={event.url} truncation="startEnd" />
|
|
3990
|
+
* ```
|
|
3991
|
+
*/
|
|
3992
|
+
function TextTruncate({ text, truncation = "startEnd", ellipsis = "…", width, children, className }) {
|
|
3993
|
+
const ref = (0, react.useRef)(null);
|
|
3994
|
+
const [available, setAvailable] = (0, react.useState)(width !== null && width !== void 0 ? width : null);
|
|
3995
|
+
useIsomorphicLayoutEffect(() => {
|
|
3996
|
+
if (width !== void 0) {
|
|
3997
|
+
setAvailable(width);
|
|
3998
|
+
return;
|
|
3999
|
+
}
|
|
4000
|
+
const element = ref.current;
|
|
4001
|
+
if (!element || typeof ResizeObserver === "undefined") return;
|
|
4002
|
+
const observer = new ResizeObserver((entries) => {
|
|
4003
|
+
const entry = entries[0];
|
|
4004
|
+
if (entry) setAvailable(entry.contentRect.width);
|
|
4005
|
+
});
|
|
4006
|
+
observer.observe(element);
|
|
4007
|
+
setAvailable(element.getBoundingClientRect().width);
|
|
4008
|
+
return () => observer.disconnect();
|
|
4009
|
+
}, [width]);
|
|
4010
|
+
const [rendered, setRendered] = (0, react.useState)(text);
|
|
4011
|
+
useIsomorphicLayoutEffect(() => {
|
|
4012
|
+
const element = ref.current;
|
|
4013
|
+
if (!element || available === null || available <= 0) {
|
|
4014
|
+
setRendered(text);
|
|
4015
|
+
return;
|
|
4016
|
+
}
|
|
4017
|
+
const measure = createMeasurer(element);
|
|
4018
|
+
if (!measure) {
|
|
4019
|
+
setRendered(text);
|
|
4020
|
+
return;
|
|
4021
|
+
}
|
|
4022
|
+
setRendered(truncateToWidth(text, truncation, ellipsis, available, measure));
|
|
4023
|
+
}, [
|
|
4024
|
+
text,
|
|
4025
|
+
truncation,
|
|
4026
|
+
ellipsis,
|
|
4027
|
+
available
|
|
4028
|
+
]);
|
|
4029
|
+
const truncated = rendered !== text;
|
|
4030
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
4031
|
+
ref,
|
|
4032
|
+
className: require_highlight.cn("block w-full overflow-hidden whitespace-nowrap", className),
|
|
4033
|
+
title: truncated ? text : void 0,
|
|
4034
|
+
"data-opt-id": "Y6BGX",
|
|
4035
|
+
"data-opt-slug": "text-truncate.TextTruncate",
|
|
4036
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4037
|
+
"aria-hidden": truncated ? "true" : void 0,
|
|
4038
|
+
children: children ? children(rendered) : rendered
|
|
4039
|
+
}), truncated && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4040
|
+
className: "sr-only",
|
|
4041
|
+
children: text
|
|
4042
|
+
})]
|
|
4043
|
+
});
|
|
4044
|
+
}
|
|
4045
|
+
//#endregion
|
|
4046
|
+
//#region src/core/live-region.tsx
|
|
4047
|
+
/**
|
|
4048
|
+
* LiveRegion — says out loud what a live view changed.
|
|
4049
|
+
*
|
|
4050
|
+
* Data that updates without a page change is invisible to a screen reader
|
|
4051
|
+
* unless something narrates it. This is that narrator: one polite region per
|
|
4052
|
+
* live surface, throttled so a fast stream produces a readable summary rather
|
|
4053
|
+
* than a torrent, and alternating between two nodes so a repeat of the same
|
|
4054
|
+
* words is still announced rather than swallowed as an unchanged region.
|
|
4055
|
+
*
|
|
4056
|
+
* @example
|
|
4057
|
+
* ```tsx
|
|
4058
|
+
* <LiveRegion
|
|
4059
|
+
* message={`${newRows} new events`}
|
|
4060
|
+
* nonce={batchId}
|
|
4061
|
+
* throttleMs={4000}
|
|
4062
|
+
* muted={paused}
|
|
4063
|
+
* />
|
|
4064
|
+
* ```
|
|
4065
|
+
*/
|
|
4066
|
+
function LiveRegion({ message, nonce, politeness = "polite", throttleMs = 0, muted = false }) {
|
|
4067
|
+
const [slots, setSlots] = (0, react.useState)(["", ""]);
|
|
4068
|
+
const activeSlot = (0, react.useRef)(0);
|
|
4069
|
+
const pending = (0, react.useRef)(null);
|
|
4070
|
+
const timer = (0, react.useRef)(null);
|
|
4071
|
+
(0, react.useEffect)(() => {
|
|
4072
|
+
if (muted || message === "") return;
|
|
4073
|
+
const flush = () => {
|
|
4074
|
+
const next = pending.current;
|
|
4075
|
+
pending.current = null;
|
|
4076
|
+
timer.current = null;
|
|
4077
|
+
if (next === null) return;
|
|
4078
|
+
const slot = activeSlot.current;
|
|
4079
|
+
activeSlot.current = slot === 0 ? 1 : 0;
|
|
4080
|
+
setSlots(slot === 0 ? [next, ""] : ["", next]);
|
|
4081
|
+
};
|
|
4082
|
+
pending.current = message;
|
|
4083
|
+
if (throttleMs <= 0) {
|
|
4084
|
+
flush();
|
|
4085
|
+
return;
|
|
4086
|
+
}
|
|
4087
|
+
if (timer.current === null) timer.current = setTimeout(flush, throttleMs);
|
|
4088
|
+
return () => {
|
|
4089
|
+
if (timer.current !== null) {
|
|
4090
|
+
clearTimeout(timer.current);
|
|
4091
|
+
timer.current = null;
|
|
4092
|
+
}
|
|
4093
|
+
};
|
|
4094
|
+
}, [
|
|
4095
|
+
message,
|
|
4096
|
+
nonce,
|
|
4097
|
+
throttleMs,
|
|
4098
|
+
muted
|
|
4099
|
+
]);
|
|
4100
|
+
(0, react.useEffect)(() => {
|
|
4101
|
+
if (!muted) return;
|
|
4102
|
+
pending.current = null;
|
|
4103
|
+
if (timer.current !== null) {
|
|
4104
|
+
clearTimeout(timer.current);
|
|
4105
|
+
timer.current = null;
|
|
4106
|
+
}
|
|
4107
|
+
setSlots(["", ""]);
|
|
4108
|
+
}, [muted]);
|
|
4109
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4110
|
+
className: "sr-only",
|
|
4111
|
+
"data-opt-id": "0CFGR",
|
|
4112
|
+
"data-opt-slug": "live-region.LiveRegion",
|
|
4113
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4114
|
+
role: "status",
|
|
4115
|
+
"aria-live": politeness,
|
|
4116
|
+
"aria-atomic": "true",
|
|
4117
|
+
children: slots[0]
|
|
4118
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4119
|
+
role: "status",
|
|
4120
|
+
"aria-live": politeness,
|
|
4121
|
+
"aria-atomic": "true",
|
|
4122
|
+
children: slots[1]
|
|
4123
|
+
})]
|
|
4124
|
+
});
|
|
4125
|
+
}
|
|
4126
|
+
//#endregion
|
|
4127
|
+
//#region src/core/color-palette.tsx
|
|
4128
|
+
/** The theme's own chart ramps, so a picker can offer them without a literal. */
|
|
4129
|
+
const THEME_PALETTES = [
|
|
4130
|
+
{
|
|
4131
|
+
id: "categorical",
|
|
4132
|
+
label: "Categorical",
|
|
4133
|
+
kind: "categorical",
|
|
4134
|
+
colors: Array.from({ length: 10 }, (_, index) => `var(--opt-chart-${index + 1})`)
|
|
4135
|
+
},
|
|
4136
|
+
{
|
|
4137
|
+
id: "sequential",
|
|
4138
|
+
label: "Sequential",
|
|
4139
|
+
kind: "sequential",
|
|
4140
|
+
colors: Array.from({ length: 5 }, (_, index) => `var(--opt-chart-sequential-${index + 1})`)
|
|
4141
|
+
},
|
|
4142
|
+
{
|
|
4143
|
+
id: "diverging",
|
|
4144
|
+
label: "Diverging",
|
|
4145
|
+
kind: "diverging",
|
|
4146
|
+
colors: [
|
|
4147
|
+
"var(--opt-chart-diverging-negative)",
|
|
4148
|
+
"var(--opt-chart-diverging-neutral)",
|
|
4149
|
+
"var(--opt-chart-diverging-positive)"
|
|
4150
|
+
]
|
|
4151
|
+
}
|
|
4152
|
+
];
|
|
4153
|
+
const sizeStyles$2 = {
|
|
4154
|
+
xs: "h-1.5",
|
|
4155
|
+
sm: "h-2.5",
|
|
4156
|
+
md: "h-4",
|
|
4157
|
+
lg: "h-6"
|
|
4158
|
+
};
|
|
4159
|
+
/**
|
|
4160
|
+
* ColorPaletteDisplay — a palette, shown as the thing it will look like.
|
|
4161
|
+
*
|
|
4162
|
+
* A palette name tells a reader nothing; the colours do. Categorical palettes
|
|
4163
|
+
* draw as discrete blocks and ramps draw as a blend, so the picture itself
|
|
4164
|
+
* states which kind of data the palette is for.
|
|
4165
|
+
*/
|
|
4166
|
+
function ColorPaletteDisplay({ palette, render, size = "sm", "aria-label": ariaLabel, className }) {
|
|
4167
|
+
const mode = render !== null && render !== void 0 ? render : palette.kind === "categorical" ? "stops" : "gradient";
|
|
4168
|
+
const colors = palette.colors.length > 0 ? palette.colors : ["transparent"];
|
|
4169
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4170
|
+
className: require_highlight.cn("flex w-full overflow-hidden rounded-sm", sizeStyles$2[size], className),
|
|
4171
|
+
role: "img",
|
|
4172
|
+
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : palette.label,
|
|
4173
|
+
style: mode === "gradient" ? { backgroundImage: `linear-gradient(to right, ${colors.join(", ")})` } : void 0,
|
|
4174
|
+
"data-opt-id": "E7T89",
|
|
4175
|
+
"data-opt-slug": "color-palette.ColorPaletteDisplay",
|
|
4176
|
+
children: mode === "stops" && colors.map((color, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4177
|
+
className: "h-full flex-1",
|
|
4178
|
+
style: { backgroundColor: color }
|
|
4179
|
+
}, `${color}-${index}`))
|
|
4180
|
+
});
|
|
4181
|
+
}
|
|
4182
|
+
/**
|
|
4183
|
+
* ColorPalettePicker — choose the colours a visualisation is drawn in.
|
|
4184
|
+
*
|
|
4185
|
+
* Each option shows its own palette, so the choice is made by looking rather
|
|
4186
|
+
* than by remembering what "Cool" meant last time.
|
|
4187
|
+
*
|
|
4188
|
+
* @example
|
|
4189
|
+
* ```tsx
|
|
4190
|
+
* <ColorPalettePicker
|
|
4191
|
+
* palettes={THEME_PALETTES}
|
|
4192
|
+
* value={paletteId}
|
|
4193
|
+
* onValueChange={setPaletteId}
|
|
4194
|
+
* label="Series colours"
|
|
4195
|
+
* />
|
|
4196
|
+
* ```
|
|
4197
|
+
*/
|
|
4198
|
+
function ColorPalettePicker({ palettes, value, onValueChange, label = "Colour palette", hideLabel = false, size = "sm", disabled = false, className }) {
|
|
4199
|
+
var _palettes$find, _ref;
|
|
4200
|
+
const labelId = (0, react.useId)();
|
|
4201
|
+
const selected = (_palettes$find = palettes.find((palette) => palette.id === value)) !== null && _palettes$find !== void 0 ? _palettes$find : palettes[0];
|
|
4202
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4203
|
+
className: require_highlight.cn("flex flex-col gap-element", className),
|
|
4204
|
+
"data-opt-id": "5R0PG",
|
|
4205
|
+
"data-opt-slug": "color-palette.ColorPalettePicker",
|
|
4206
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4207
|
+
id: labelId,
|
|
4208
|
+
className: require_highlight.cn("text-text-primary text-sm font-medium", hideLabel && "sr-only"),
|
|
4209
|
+
children: label
|
|
4210
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_highlight.SelectRoot, {
|
|
4211
|
+
value: (_ref = value !== null && value !== void 0 ? value : selected === null || selected === void 0 ? void 0 : selected.id) !== null && _ref !== void 0 ? _ref : "",
|
|
4212
|
+
setValue: (next) => {
|
|
4213
|
+
if (typeof next === "string") onValueChange === null || onValueChange === void 0 || onValueChange(next);
|
|
4214
|
+
},
|
|
4215
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.SelectTrigger, {
|
|
4216
|
+
"aria-labelledby": labelId,
|
|
4217
|
+
disabled,
|
|
4218
|
+
className: require_highlight.cn("gap-group", require_highlight.OPT_FOCUS_VISIBLE),
|
|
4219
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
4220
|
+
className: "gap-group flex min-w-0 flex-1 items-center",
|
|
4221
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4222
|
+
className: "text-text-primary shrink-0 truncate text-sm",
|
|
4223
|
+
children: selected === null || selected === void 0 ? void 0 : selected.label
|
|
4224
|
+
}), selected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorPaletteDisplay, {
|
|
4225
|
+
palette: selected,
|
|
4226
|
+
size,
|
|
4227
|
+
className: require_highlight.cn("min-w-16 flex-1", "border border-border"),
|
|
4228
|
+
"aria-label": ""
|
|
4229
|
+
})]
|
|
4230
|
+
})
|
|
4231
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.SelectPopover, { children: palettes.map((palette) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_highlight.SelectItem, {
|
|
4232
|
+
value: palette.id,
|
|
4233
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
4234
|
+
className: "gap-group flex w-full min-w-40 items-center",
|
|
4235
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4236
|
+
className: "shrink-0 truncate text-sm",
|
|
4237
|
+
children: palette.label
|
|
4238
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorPaletteDisplay, {
|
|
4239
|
+
palette,
|
|
4240
|
+
size,
|
|
4241
|
+
className: "min-w-16 flex-1",
|
|
4242
|
+
"aria-label": ""
|
|
4243
|
+
})]
|
|
4244
|
+
})
|
|
4245
|
+
}, palette.id)) })]
|
|
4246
|
+
})]
|
|
4247
|
+
});
|
|
4248
|
+
}
|
|
4249
|
+
//#endregion
|
|
4250
|
+
//#region src/core/inline-edit.tsx
|
|
4251
|
+
const defaultLabels = {
|
|
4252
|
+
edit: (value) => `Edit ${value}`,
|
|
4253
|
+
save: "Save",
|
|
4254
|
+
cancel: "Cancel",
|
|
4255
|
+
invalid: "That value cannot be saved."
|
|
4256
|
+
};
|
|
4257
|
+
const sizeStyles$1 = {
|
|
4258
|
+
sm: "text-sm",
|
|
4259
|
+
md: "text-base",
|
|
4260
|
+
lg: "text-lg font-semibold",
|
|
4261
|
+
xl: "text-2xl font-semibold tracking-tight"
|
|
4262
|
+
};
|
|
4263
|
+
/**
|
|
4264
|
+
* InlineEdit — renames a thing where the thing is, instead of in a dialog.
|
|
4265
|
+
*
|
|
4266
|
+
* A dashboard title, a metric name, a saved segment: each is read far more
|
|
4267
|
+
* often than it is renamed, so the control has to disappear into the text and
|
|
4268
|
+
* reappear on intent. Read mode is a button carrying the text; edit mode is a
|
|
4269
|
+
* field sized to match it, so the words do not move when the mode does.
|
|
4270
|
+
*
|
|
4271
|
+
* Enter commits, Escape reverts, and a rejected save keeps the field open with
|
|
4272
|
+
* what was typed — losing an edit to a validation error is worse than the
|
|
4273
|
+
* error.
|
|
4274
|
+
*
|
|
4275
|
+
* @example
|
|
4276
|
+
* ```tsx
|
|
4277
|
+
* <InlineEdit as="h2" size="xl" value={dashboard.name} onSave={rename} />
|
|
4278
|
+
* ```
|
|
4279
|
+
*/
|
|
4280
|
+
function InlineEdit({ value, onSave, as: Tag = "span", size = "md", placeholder, emptyText = "Untitled", disabled = false, maxLength, suffix, labels, className }) {
|
|
4281
|
+
const text = require_highlight._objectSpread2(require_highlight._objectSpread2({}, defaultLabels), labels);
|
|
4282
|
+
const [editing, setEditing] = (0, react.useState)(false);
|
|
4283
|
+
const [draft, setDraft] = (0, react.useState)(value);
|
|
4284
|
+
const [rejected, setRejected] = (0, react.useState)(false);
|
|
4285
|
+
const [saving, setSaving] = (0, react.useState)(false);
|
|
4286
|
+
const inputRef = (0, react.useRef)(null);
|
|
4287
|
+
(0, react.useEffect)(() => {
|
|
4288
|
+
if (!editing) setDraft(value);
|
|
4289
|
+
}, [value, editing]);
|
|
4290
|
+
(0, react.useEffect)(() => {
|
|
4291
|
+
if (editing) {
|
|
4292
|
+
var _inputRef$current, _inputRef$current2;
|
|
4293
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
4294
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.select();
|
|
4295
|
+
}
|
|
4296
|
+
}, [editing]);
|
|
4297
|
+
const commit = async () => {
|
|
4298
|
+
if (saving) return;
|
|
4299
|
+
const next = draft.trim();
|
|
4300
|
+
if (next === value) {
|
|
4301
|
+
setEditing(false);
|
|
4302
|
+
setRejected(false);
|
|
4303
|
+
return;
|
|
4304
|
+
}
|
|
4305
|
+
setSaving(true);
|
|
4306
|
+
try {
|
|
4307
|
+
if (await onSave(next) === false) {
|
|
4308
|
+
setRejected(true);
|
|
4309
|
+
return;
|
|
4310
|
+
}
|
|
4311
|
+
setRejected(false);
|
|
4312
|
+
setEditing(false);
|
|
4313
|
+
} finally {
|
|
4314
|
+
setSaving(false);
|
|
4315
|
+
}
|
|
4316
|
+
};
|
|
4317
|
+
const cancel = () => {
|
|
4318
|
+
setDraft(value);
|
|
4319
|
+
setRejected(false);
|
|
4320
|
+
setEditing(false);
|
|
4321
|
+
};
|
|
4322
|
+
const handleKeyDown = (event) => {
|
|
4323
|
+
if (event.key === "Enter") {
|
|
4324
|
+
event.preventDefault();
|
|
4325
|
+
commit();
|
|
4326
|
+
} else if (event.key === "Escape") {
|
|
4327
|
+
event.preventDefault();
|
|
4328
|
+
cancel();
|
|
4329
|
+
}
|
|
4330
|
+
};
|
|
4331
|
+
if (editing) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
4332
|
+
className: require_highlight.cn("inline-flex items-center gap-element", className),
|
|
4333
|
+
"data-opt-id": "RQ0H2",
|
|
4334
|
+
"data-opt-slug": "inline-edit.InlineEdit",
|
|
4335
|
+
children: [
|
|
4336
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
4337
|
+
ref: inputRef,
|
|
4338
|
+
value: draft,
|
|
4339
|
+
onChange: (event) => {
|
|
4340
|
+
setDraft(event.target.value);
|
|
4341
|
+
setRejected(false);
|
|
4342
|
+
},
|
|
4343
|
+
onKeyDown: handleKeyDown,
|
|
4344
|
+
onBlur: () => void commit(),
|
|
4345
|
+
placeholder,
|
|
4346
|
+
maxLength,
|
|
4347
|
+
disabled: saving,
|
|
4348
|
+
"aria-invalid": rejected || void 0,
|
|
4349
|
+
"aria-errormessage": rejected ? "inline-edit-error" : void 0,
|
|
4350
|
+
className: require_highlight.cn(require_highlight.OPT_INPUT, sizeStyles$1[size], "min-w-0 flex-1")
|
|
4351
|
+
}),
|
|
4352
|
+
rejected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4353
|
+
id: "inline-edit-error",
|
|
4354
|
+
role: "alert",
|
|
4355
|
+
className: "sr-only",
|
|
4356
|
+
children: text.invalid
|
|
4357
|
+
}),
|
|
4358
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
4359
|
+
type: "button",
|
|
4360
|
+
"aria-label": text.save,
|
|
4361
|
+
disabled: saving,
|
|
4362
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
4363
|
+
onClick: () => void commit(),
|
|
4364
|
+
className: require_highlight.cn("text-success hover:bg-success-subtle rounded-md p-1", require_highlight.OPT_FOCUS_VISIBLE),
|
|
4365
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
|
|
4366
|
+
className: "size-4",
|
|
4367
|
+
"aria-hidden": "true"
|
|
4368
|
+
})
|
|
4369
|
+
}),
|
|
4370
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
4371
|
+
type: "button",
|
|
4372
|
+
"aria-label": text.cancel,
|
|
4373
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
4374
|
+
onClick: cancel,
|
|
4375
|
+
className: require_highlight.cn("text-text-tertiary hover:bg-bg-subtle rounded-md p-1", require_highlight.OPT_FOCUS_VISIBLE),
|
|
4376
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, {
|
|
4377
|
+
className: "size-4",
|
|
4378
|
+
"aria-hidden": "true"
|
|
4379
|
+
})
|
|
4380
|
+
})
|
|
4381
|
+
]
|
|
4382
|
+
});
|
|
4383
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
4384
|
+
className: require_highlight.cn("inline-flex items-center gap-element", className),
|
|
4385
|
+
"data-opt-id": "RQ0H2",
|
|
4386
|
+
"data-opt-slug": "inline-edit.InlineEdit",
|
|
4387
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
4388
|
+
type: "button",
|
|
4389
|
+
disabled,
|
|
4390
|
+
onClick: () => setEditing(true),
|
|
4391
|
+
"aria-label": text.edit(value || emptyText),
|
|
4392
|
+
className: require_highlight.cn("group -mx-1.5 -my-0.5 inline-flex max-w-full items-center gap-element rounded-md px-1.5 py-0.5 text-left", !disabled && "hover:bg-bg-subtle cursor-pointer", disabled && "cursor-default", require_highlight.OPT_FOCUS_VISIBLE),
|
|
4393
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
|
|
4394
|
+
className: require_highlight.cn("truncate", sizeStyles$1[size], value ? "text-text-primary" : "text-text-tertiary italic"),
|
|
4395
|
+
children: value || emptyText
|
|
4396
|
+
}), !disabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Pencil, {
|
|
4397
|
+
"aria-hidden": "true",
|
|
4398
|
+
className: require_highlight.cn("text-text-tertiary size-3.5 shrink-0 opacity-0 transition-opacity", "group-hover:opacity-100 group-focus-visible:opacity-100")
|
|
4399
|
+
})]
|
|
4400
|
+
}), suffix]
|
|
4401
|
+
});
|
|
4402
|
+
}
|
|
4403
|
+
//#endregion
|
|
4404
|
+
//#region src/core/key-pad-menu.tsx
|
|
4405
|
+
const sizeStyles = {
|
|
4406
|
+
sm: "min-h-20 p-2 text-xs [&_[data-keypad-icon]]:size-5",
|
|
4407
|
+
md: "min-h-24 p-3 text-sm [&_[data-keypad-icon]]:size-6"
|
|
4408
|
+
};
|
|
4409
|
+
/**
|
|
4410
|
+
* KeyPadMenu — a choice between things that are easier to recognise than to
|
|
4411
|
+
* name.
|
|
4412
|
+
*
|
|
4413
|
+
* A chart type, a layout, an import source: the picture is the label, and a
|
|
4414
|
+
* dropdown of words makes the reader translate twice. Tiles are real radios or
|
|
4415
|
+
* checkboxes underneath, so arrow keys, screen readers, and form submission
|
|
4416
|
+
* all behave as they would for any other group.
|
|
4417
|
+
*
|
|
4418
|
+
* @example
|
|
4419
|
+
* ```tsx
|
|
4420
|
+
* <KeyPadMenu
|
|
4421
|
+
* label="Chart type"
|
|
4422
|
+
* items={vizTypes}
|
|
4423
|
+
* value={vizType}
|
|
4424
|
+
* onValueChange={setVizType}
|
|
4425
|
+
* />
|
|
4426
|
+
* ```
|
|
4427
|
+
*/
|
|
4428
|
+
function KeyPadMenu({ items, label, selection = "single", value, onValueChange, columns = "auto", size = "md", hideLabel = false, className }) {
|
|
4429
|
+
const name = (0, react.useId)();
|
|
4430
|
+
const selected = new Set(value === void 0 ? [] : Array.isArray(value) ? value : [value]);
|
|
4431
|
+
const handleChange = (id) => {
|
|
4432
|
+
if (selection === "multiple") {
|
|
4433
|
+
const next = selected.has(id) ? [...selected].filter((item) => item !== id) : [...selected, id];
|
|
4434
|
+
onValueChange === null || onValueChange === void 0 || onValueChange(next);
|
|
4435
|
+
return;
|
|
4436
|
+
}
|
|
4437
|
+
onValueChange === null || onValueChange === void 0 || onValueChange(id);
|
|
4438
|
+
};
|
|
4439
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
|
|
4440
|
+
className: require_highlight.cn("min-w-0", className),
|
|
4441
|
+
"data-opt-id": "ZZG2R",
|
|
4442
|
+
"data-opt-slug": "key-pad-menu.KeyPadMenu",
|
|
4443
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
|
|
4444
|
+
className: require_highlight.cn("text-text-primary mb-element text-sm font-medium", hideLabel && "sr-only"),
|
|
4445
|
+
children: label
|
|
4446
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4447
|
+
className: "gap-element grid",
|
|
4448
|
+
style: { gridTemplateColumns: columns === "auto" ? "repeat(auto-fill, minmax(6.5rem, 1fr))" : `repeat(${columns}, minmax(0, 1fr))` },
|
|
4449
|
+
children: items.map((item) => {
|
|
4450
|
+
const isSelected = selected.has(item.id);
|
|
4451
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
4452
|
+
className: require_highlight.cn("relative flex cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg text-center transition-colors", require_highlight.OPT_BORDER, sizeStyles[size], isSelected ? "border-accent bg-accent-subtle text-text-primary" : "text-text-secondary hover:border-border-hover hover:bg-bg-subtle", item.disabled && "cursor-not-allowed opacity-50", "has-[:focus-visible]:outline-ring has-[:focus-visible]:outline-2"),
|
|
4453
|
+
children: [
|
|
4454
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
4455
|
+
type: selection === "single" ? "radio" : "checkbox",
|
|
4456
|
+
name: selection === "single" ? name : void 0,
|
|
4457
|
+
value: item.id,
|
|
4458
|
+
checked: isSelected,
|
|
4459
|
+
disabled: item.disabled,
|
|
4460
|
+
onChange: () => handleChange(item.id),
|
|
4461
|
+
className: require_highlight.cn("sr-only", require_highlight.OPT_FOCUS_VISIBLE)
|
|
4462
|
+
}),
|
|
4463
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4464
|
+
"data-keypad-icon": "",
|
|
4465
|
+
"aria-hidden": "true",
|
|
4466
|
+
className: require_highlight.cn("flex items-center justify-center", isSelected ? "text-accent" : "text-text-tertiary"),
|
|
4467
|
+
children: item.icon
|
|
4468
|
+
}),
|
|
4469
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4470
|
+
className: "font-medium",
|
|
4471
|
+
children: item.label
|
|
4472
|
+
}),
|
|
4473
|
+
item.hint && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4474
|
+
className: "text-text-tertiary line-clamp-2 text-[11px] leading-tight",
|
|
4475
|
+
children: item.hint
|
|
4476
|
+
}),
|
|
4477
|
+
item.badge && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4478
|
+
className: "bg-info-subtle text-info absolute top-1 right-1 rounded px-1 text-[10px] font-semibold",
|
|
4479
|
+
children: item.badge
|
|
4480
|
+
})
|
|
4481
|
+
]
|
|
4482
|
+
}, item.id);
|
|
4483
|
+
})
|
|
4484
|
+
})]
|
|
4485
|
+
});
|
|
4486
|
+
}
|
|
4487
|
+
//#endregion
|
|
3652
4488
|
Object.defineProperty(exports, "AccordionContent", {
|
|
3653
4489
|
enumerable: true,
|
|
3654
4490
|
get: function() {
|
|
@@ -3739,6 +4575,18 @@ Object.defineProperty(exports, "CircularProgress", {
|
|
|
3739
4575
|
return CircularProgress;
|
|
3740
4576
|
}
|
|
3741
4577
|
});
|
|
4578
|
+
Object.defineProperty(exports, "ColorPaletteDisplay", {
|
|
4579
|
+
enumerable: true,
|
|
4580
|
+
get: function() {
|
|
4581
|
+
return ColorPaletteDisplay;
|
|
4582
|
+
}
|
|
4583
|
+
});
|
|
4584
|
+
Object.defineProperty(exports, "ColorPalettePicker", {
|
|
4585
|
+
enumerable: true,
|
|
4586
|
+
get: function() {
|
|
4587
|
+
return ColorPalettePicker;
|
|
4588
|
+
}
|
|
4589
|
+
});
|
|
3742
4590
|
Object.defineProperty(exports, "ConditionBuilder", {
|
|
3743
4591
|
enumerable: true,
|
|
3744
4592
|
get: function() {
|
|
@@ -3799,12 +4647,54 @@ Object.defineProperty(exports, "DropdownTrigger", {
|
|
|
3799
4647
|
return DropdownTrigger;
|
|
3800
4648
|
}
|
|
3801
4649
|
});
|
|
4650
|
+
Object.defineProperty(exports, "Expression", {
|
|
4651
|
+
enumerable: true,
|
|
4652
|
+
get: function() {
|
|
4653
|
+
return Expression;
|
|
4654
|
+
}
|
|
4655
|
+
});
|
|
4656
|
+
Object.defineProperty(exports, "ExpressionGroup", {
|
|
4657
|
+
enumerable: true,
|
|
4658
|
+
get: function() {
|
|
4659
|
+
return ExpressionGroup;
|
|
4660
|
+
}
|
|
4661
|
+
});
|
|
4662
|
+
Object.defineProperty(exports, "Facet", {
|
|
4663
|
+
enumerable: true,
|
|
4664
|
+
get: function() {
|
|
4665
|
+
return Facet;
|
|
4666
|
+
}
|
|
4667
|
+
});
|
|
4668
|
+
Object.defineProperty(exports, "FacetGroup", {
|
|
4669
|
+
enumerable: true,
|
|
4670
|
+
get: function() {
|
|
4671
|
+
return FacetGroup;
|
|
4672
|
+
}
|
|
4673
|
+
});
|
|
3802
4674
|
Object.defineProperty(exports, "Heading", {
|
|
3803
4675
|
enumerable: true,
|
|
3804
4676
|
get: function() {
|
|
3805
4677
|
return Heading;
|
|
3806
4678
|
}
|
|
3807
4679
|
});
|
|
4680
|
+
Object.defineProperty(exports, "InlineEdit", {
|
|
4681
|
+
enumerable: true,
|
|
4682
|
+
get: function() {
|
|
4683
|
+
return InlineEdit;
|
|
4684
|
+
}
|
|
4685
|
+
});
|
|
4686
|
+
Object.defineProperty(exports, "KeyPadMenu", {
|
|
4687
|
+
enumerable: true,
|
|
4688
|
+
get: function() {
|
|
4689
|
+
return KeyPadMenu;
|
|
4690
|
+
}
|
|
4691
|
+
});
|
|
4692
|
+
Object.defineProperty(exports, "LiveRegion", {
|
|
4693
|
+
enumerable: true,
|
|
4694
|
+
get: function() {
|
|
4695
|
+
return LiveRegion;
|
|
4696
|
+
}
|
|
4697
|
+
});
|
|
3808
4698
|
Object.defineProperty(exports, "LoadingOverlay", {
|
|
3809
4699
|
enumerable: true,
|
|
3810
4700
|
get: function() {
|
|
@@ -3967,12 +4857,24 @@ Object.defineProperty(exports, "Switch", {
|
|
|
3967
4857
|
return Switch;
|
|
3968
4858
|
}
|
|
3969
4859
|
});
|
|
4860
|
+
Object.defineProperty(exports, "THEME_PALETTES", {
|
|
4861
|
+
enumerable: true,
|
|
4862
|
+
get: function() {
|
|
4863
|
+
return THEME_PALETTES;
|
|
4864
|
+
}
|
|
4865
|
+
});
|
|
3970
4866
|
Object.defineProperty(exports, "Text", {
|
|
3971
4867
|
enumerable: true,
|
|
3972
4868
|
get: function() {
|
|
3973
4869
|
return Text;
|
|
3974
4870
|
}
|
|
3975
4871
|
});
|
|
4872
|
+
Object.defineProperty(exports, "TextTruncate", {
|
|
4873
|
+
enumerable: true,
|
|
4874
|
+
get: function() {
|
|
4875
|
+
return TextTruncate;
|
|
4876
|
+
}
|
|
4877
|
+
});
|
|
3976
4878
|
Object.defineProperty(exports, "Textarea", {
|
|
3977
4879
|
enumerable: true,
|
|
3978
4880
|
get: function() {
|