@reopt-ai/opt-ui 1.14.0 → 1.15.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/CHANGELOG.md +45 -0
- package/COMPONENT_CATALOG.md +222 -69
- package/README.md +26 -0
- package/dist/core/index.cjs +4 -4
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +2 -2
- package/dist/docs/02-components/01-core.md +37 -33
- package/dist/docs/02-components/02-visuals.md +1 -1
- package/dist/docs/02-components/03-shells.md +191 -36
- package/dist/docs/02-components/04-surfaces.md +1 -1
- package/dist/docs/02-components/index.md +4 -4
- package/dist/id-registry.cjs +24 -0
- package/dist/id-registry.js +24 -0
- package/dist/id-registry.json +51 -0
- package/dist/index.cjs +445 -381
- package/dist/index.d.cts +16 -13
- package/dist/index.d.ts +16 -13
- package/dist/index.js +303 -245
- package/dist/{key-pad-menu-CqFI6la9.js → key-pad-menu-BCOeYvsH.js} +50 -61
- package/dist/{key-pad-menu-D6pYzaj-.d.cts → key-pad-menu-CaIsTHB2.d.cts} +12 -8
- package/dist/{key-pad-menu-BgtSL3xe.cjs → key-pad-menu-Jaqxhx9P.cjs} +48 -71
- package/dist/{key-pad-menu-Yh7Fpb8m.d.ts → key-pad-menu-odAEycIX.d.ts} +12 -8
- package/dist/meta.cjs +447 -7
- package/dist/meta.js +447 -7
- package/dist/{field-sidebar-mSVCMAZp.js → replay-player-layout-BVUNsUS1.js} +891 -191
- package/dist/{field-sidebar-ePqFX6MN.cjs → replay-player-layout-Cmzptq89.cjs} +931 -189
- package/dist/{field-sidebar-CJ4HxP8D.d.cts → replay-player-layout-DpqdfdQ6.d.ts} +246 -3
- package/dist/{field-sidebar-DnhpcT2A.d.ts → replay-player-layout-DuZW-gFF.d.cts} +246 -3
- package/dist/shells/index.cjs +58 -52
- package/dist/shells/index.d.cts +2 -2
- package/dist/shells/index.d.ts +2 -2
- package/dist/shells/index.js +2 -2
- package/dist/{text-truncate-Bd-0WkSP.js → text-truncate-B-8nJgnu.js} +200 -101
- package/dist/{text-truncate-Bbul-jMD.d.cts → text-truncate-DOxUijpB.d.cts} +2 -0
- package/dist/{text-truncate-Bbul-jMD.d.ts → text-truncate-DOxUijpB.d.ts} +2 -0
- package/dist/{text-truncate-BeYW6XZu.cjs → text-truncate-gQhpMy-Z.cjs} +214 -97
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { Bn as OPT_ANIMATE_ENTER_EXIT, Cn as koBreadcrumbLabels, Fn as FieldMessages, Gt as SelectTrigger$1, In as RequiredMark, Kn as OPT_BORDER, Ln as getDescribedBy, Pn as useControlledState, Sn as Button, Ut as SelectPopover$1, Vt as SelectItem$1, Wt as SelectRoot$1, _r as _objectSpread2, b as formatOptNumber, br as cn, er as OPT_FOCUS, hr as OPT_TEXT_TERTIARY, it as isComposingKey, mr as OPT_TEXT_SECONDARY, or as OPT_SURFACE, pr as OPT_TEXT_PRIMARY, rr as OPT_INPUT, tr as OPT_FOCUS_VISIBLE, vn as Spinner, vr as _objectWithoutProperties, yn as Badge, zn as OPT_ANIMATE_DRAWER } from "./text-truncate-B-8nJgnu.js";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { createContext, createElement, forwardRef, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
6
|
-
import { AccordionContent, AccordionItem, AccordionRoot, AccordionTrigger, DialogDismiss, DialogPanel, DialogRoot, RadioGroupRoot, Separator,
|
|
6
|
+
import { AccordionContent, AccordionItem, AccordionRoot, AccordionTrigger, DialogDismiss, DialogPanel, DialogRoot, RadioGroupRoot, Separator, useDialogClose, useRadioGroupContext } from "@reopt-ai/opt-ui-primitives";
|
|
7
7
|
import { Check, ChevronDown, Pencil, X } from "lucide-react";
|
|
8
8
|
import { Mesh, Program, Renderer, Triangle } from "ogl";
|
|
9
9
|
import { hexToSrgb } from "@reopt-ai/opt-palette";
|
|
10
10
|
//#region src/core/text.tsx
|
|
11
|
-
const _excluded$
|
|
11
|
+
const _excluded$10 = [
|
|
12
12
|
"as",
|
|
13
13
|
"variant",
|
|
14
14
|
"tone",
|
|
@@ -24,7 +24,7 @@ const toneStyles$1 = {
|
|
|
24
24
|
};
|
|
25
25
|
/** Semantic body text whose visual role is controlled by foundation tokens. */
|
|
26
26
|
function Text(_ref) {
|
|
27
|
-
let { as, variant = "body", tone = "primary", truncate = false, className, children } = _ref, props = _objectWithoutProperties(_ref, _excluded$
|
|
27
|
+
let { as, variant = "body", tone = "primary", truncate = false, className, children } = _ref, props = _objectWithoutProperties(_ref, _excluded$10);
|
|
28
28
|
const Component = as !== null && as !== void 0 ? as : "span";
|
|
29
29
|
const elementProps = _objectSpread2(_objectSpread2({}, props), {}, {
|
|
30
30
|
className: cn(`opt-type-${variant}`, toneStyles$1[tone], truncate && "truncate", className),
|
|
@@ -39,7 +39,7 @@ function Text(_ref) {
|
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/core/heading.tsx
|
|
42
|
-
const _excluded$
|
|
42
|
+
const _excluded$9 = [
|
|
43
43
|
"level",
|
|
44
44
|
"variant",
|
|
45
45
|
"className",
|
|
@@ -47,7 +47,7 @@ const _excluded$10 = [
|
|
|
47
47
|
];
|
|
48
48
|
/** Semantic heading with independently selectable visual hierarchy. */
|
|
49
49
|
function Heading(_ref) {
|
|
50
|
-
let { level = 2, variant = `heading-${level}`, className, children } = _ref, props = _objectWithoutProperties(_ref, _excluded$
|
|
50
|
+
let { level = 2, variant = `heading-${level}`, className, children } = _ref, props = _objectWithoutProperties(_ref, _excluded$9);
|
|
51
51
|
const Component = {
|
|
52
52
|
1: "h1",
|
|
53
53
|
2: "h2",
|
|
@@ -265,47 +265,6 @@ function OtpField({ length = 6, value: controlledValue, defaultValue = "", onCha
|
|
|
265
265
|
}
|
|
266
266
|
OtpField.displayName = "OtpField";
|
|
267
267
|
//#endregion
|
|
268
|
-
//#region src/core/toggle.tsx
|
|
269
|
-
const _excluded$9 = [
|
|
270
|
-
"size",
|
|
271
|
-
"className",
|
|
272
|
-
"children"
|
|
273
|
-
];
|
|
274
|
-
const _excluded2$5 = [
|
|
275
|
-
"className",
|
|
276
|
-
"children",
|
|
277
|
-
"orientation"
|
|
278
|
-
];
|
|
279
|
-
const sizeStyles$6 = {
|
|
280
|
-
sm: "h-8 min-w-8 px-2 text-xs gap-1.5",
|
|
281
|
-
md: "h-10 min-w-10 px-3 text-sm gap-2"
|
|
282
|
-
};
|
|
283
|
-
const toggleBase = 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", OPT_FOCUS_VISIBLE);
|
|
284
|
-
/** A two-state (pressed) button. Use standalone or inside `ToggleGroup`. */
|
|
285
|
-
function Toggle$1(_ref) {
|
|
286
|
-
let { size = "md", className, children } = _ref, props = _objectWithoutProperties(_ref, _excluded$9);
|
|
287
|
-
return /* @__PURE__ */ jsx(Toggle, _objectSpread2(_objectSpread2({ className: cn(toggleBase, sizeStyles$6[size], className) }, props), {}, {
|
|
288
|
-
"data-opt-id": "GFCMY",
|
|
289
|
-
"data-opt-slug": "toggle.Toggle",
|
|
290
|
-
children
|
|
291
|
-
}));
|
|
292
|
-
}
|
|
293
|
-
Toggle$1.displayName = "Toggle";
|
|
294
|
-
/** A set of related toggles with shared selection and keyboard navigation. */
|
|
295
|
-
function ToggleGroup$1(_ref2) {
|
|
296
|
-
let { className, children, orientation = "horizontal" } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2$5);
|
|
297
|
-
return /* @__PURE__ */ jsx(ToggleGroup, _objectSpread2(_objectSpread2({
|
|
298
|
-
orientation,
|
|
299
|
-
"aria-orientation": orientation,
|
|
300
|
-
className: cn("inline-flex gap-1", orientation === "vertical" ? "flex-col" : "flex-row", className)
|
|
301
|
-
}, props), {}, {
|
|
302
|
-
"data-opt-id": "47J37",
|
|
303
|
-
"data-opt-slug": "toggle.ToggleGroup",
|
|
304
|
-
children
|
|
305
|
-
}));
|
|
306
|
-
}
|
|
307
|
-
ToggleGroup$1.displayName = "ToggleGroup";
|
|
308
|
-
//#endregion
|
|
309
268
|
//#region src/core/accordion.tsx
|
|
310
269
|
const _excluded$8 = ["className"];
|
|
311
270
|
const _excluded2$4 = ["className"];
|
|
@@ -3689,6 +3648,7 @@ function ColorPalettePicker({ palettes, value, onValueChange, label = "Colour pa
|
|
|
3689
3648
|
//#endregion
|
|
3690
3649
|
//#region src/core/inline-edit.tsx
|
|
3691
3650
|
const defaultLabels = {
|
|
3651
|
+
input: "Value",
|
|
3692
3652
|
edit: (value) => `Edit ${value}`,
|
|
3693
3653
|
save: "Save",
|
|
3694
3654
|
cancel: "Cancel",
|
|
@@ -3724,24 +3684,39 @@ function InlineEdit({ value, onSave, as: Tag = "span", size = "md", placeholder,
|
|
|
3724
3684
|
const [rejected, setRejected] = useState(false);
|
|
3725
3685
|
const [saving, setSaving] = useState(false);
|
|
3726
3686
|
const inputRef = useRef(null);
|
|
3687
|
+
const rootRef = useRef(null);
|
|
3688
|
+
const readButtonRef = useRef(null);
|
|
3689
|
+
const restoreFocusRef = useRef(false);
|
|
3690
|
+
const savingRef = useRef(false);
|
|
3691
|
+
const errorId = useId();
|
|
3727
3692
|
useEffect(() => {
|
|
3728
3693
|
if (!editing) setDraft(value);
|
|
3729
3694
|
}, [value, editing]);
|
|
3730
|
-
|
|
3695
|
+
useLayoutEffect(() => {
|
|
3731
3696
|
if (editing) {
|
|
3732
3697
|
var _inputRef$current, _inputRef$current2;
|
|
3733
3698
|
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
3734
3699
|
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.select();
|
|
3700
|
+
} else if (restoreFocusRef.current) {
|
|
3701
|
+
var _readButtonRef$curren;
|
|
3702
|
+
restoreFocusRef.current = false;
|
|
3703
|
+
(_readButtonRef$curren = readButtonRef.current) === null || _readButtonRef$curren === void 0 || _readButtonRef$curren.focus();
|
|
3735
3704
|
}
|
|
3736
3705
|
}, [editing]);
|
|
3737
|
-
const
|
|
3738
|
-
|
|
3706
|
+
const finishEditing = (restoreFocus) => {
|
|
3707
|
+
var _rootRef$current;
|
|
3708
|
+
restoreFocusRef.current = restoreFocus && (document.activeElement === document.body || Boolean((_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.contains(document.activeElement)));
|
|
3709
|
+
setEditing(false);
|
|
3710
|
+
};
|
|
3711
|
+
const commit = async (restoreFocus) => {
|
|
3712
|
+
if (savingRef.current || disabled) return;
|
|
3739
3713
|
const next = draft.trim();
|
|
3740
3714
|
if (next === value) {
|
|
3741
|
-
|
|
3715
|
+
finishEditing(restoreFocus);
|
|
3742
3716
|
setRejected(false);
|
|
3743
3717
|
return;
|
|
3744
3718
|
}
|
|
3719
|
+
savingRef.current = true;
|
|
3745
3720
|
setSaving(true);
|
|
3746
3721
|
try {
|
|
3747
3722
|
if (await onSave(next) === false) {
|
|
@@ -3749,26 +3724,35 @@ function InlineEdit({ value, onSave, as: Tag = "span", size = "md", placeholder,
|
|
|
3749
3724
|
return;
|
|
3750
3725
|
}
|
|
3751
3726
|
setRejected(false);
|
|
3752
|
-
|
|
3727
|
+
finishEditing(restoreFocus);
|
|
3728
|
+
} catch (_unused) {
|
|
3729
|
+
setRejected(true);
|
|
3753
3730
|
} finally {
|
|
3731
|
+
savingRef.current = false;
|
|
3754
3732
|
setSaving(false);
|
|
3755
3733
|
}
|
|
3756
3734
|
};
|
|
3757
3735
|
const cancel = () => {
|
|
3736
|
+
if (savingRef.current) return;
|
|
3758
3737
|
setDraft(value);
|
|
3759
3738
|
setRejected(false);
|
|
3760
|
-
|
|
3739
|
+
finishEditing(true);
|
|
3761
3740
|
};
|
|
3762
3741
|
const handleKeyDown = (event) => {
|
|
3742
|
+
if (isComposingKey(event)) return;
|
|
3763
3743
|
if (event.key === "Enter") {
|
|
3764
3744
|
event.preventDefault();
|
|
3765
|
-
commit();
|
|
3745
|
+
commit(true);
|
|
3766
3746
|
} else if (event.key === "Escape") {
|
|
3767
3747
|
event.preventDefault();
|
|
3768
3748
|
cancel();
|
|
3769
3749
|
}
|
|
3770
3750
|
};
|
|
3771
3751
|
if (editing) return /* @__PURE__ */ jsxs("span", {
|
|
3752
|
+
ref: rootRef,
|
|
3753
|
+
onBlur: (event) => {
|
|
3754
|
+
if (!event.currentTarget.contains(event.relatedTarget)) commit(false);
|
|
3755
|
+
},
|
|
3772
3756
|
className: cn("inline-flex min-w-0 items-center gap-element", className),
|
|
3773
3757
|
"data-opt-id": "RQ0H2",
|
|
3774
3758
|
"data-opt-slug": "inline-edit.InlineEdit",
|
|
@@ -3781,16 +3765,18 @@ function InlineEdit({ value, onSave, as: Tag = "span", size = "md", placeholder,
|
|
|
3781
3765
|
setRejected(false);
|
|
3782
3766
|
},
|
|
3783
3767
|
onKeyDown: handleKeyDown,
|
|
3784
|
-
onBlur: () => void commit(),
|
|
3785
3768
|
placeholder,
|
|
3786
3769
|
maxLength,
|
|
3787
|
-
|
|
3770
|
+
readOnly: saving || disabled,
|
|
3771
|
+
"aria-busy": saving || void 0,
|
|
3772
|
+
"aria-label": text.input,
|
|
3788
3773
|
"aria-invalid": rejected || void 0,
|
|
3789
|
-
"aria-errormessage": rejected ?
|
|
3774
|
+
"aria-errormessage": rejected ? errorId : void 0,
|
|
3775
|
+
"aria-describedby": rejected ? errorId : void 0,
|
|
3790
3776
|
className: cn(OPT_INPUT, sizeStyles$1[size], "min-w-0 flex-1")
|
|
3791
3777
|
}),
|
|
3792
3778
|
rejected && /* @__PURE__ */ jsx("span", {
|
|
3793
|
-
id:
|
|
3779
|
+
id: errorId,
|
|
3794
3780
|
role: "alert",
|
|
3795
3781
|
className: "sr-only",
|
|
3796
3782
|
children: text.invalid
|
|
@@ -3798,9 +3784,9 @@ function InlineEdit({ value, onSave, as: Tag = "span", size = "md", placeholder,
|
|
|
3798
3784
|
/* @__PURE__ */ jsx("button", {
|
|
3799
3785
|
type: "button",
|
|
3800
3786
|
"aria-label": text.save,
|
|
3801
|
-
disabled: saving,
|
|
3787
|
+
disabled: saving || disabled,
|
|
3802
3788
|
onMouseDown: (event) => event.preventDefault(),
|
|
3803
|
-
onClick: () => void commit(),
|
|
3789
|
+
onClick: () => void commit(true),
|
|
3804
3790
|
className: cn("text-success hover:bg-success-subtle rounded-md p-1", OPT_FOCUS_VISIBLE),
|
|
3805
3791
|
children: /* @__PURE__ */ jsx(Check, {
|
|
3806
3792
|
className: "size-4",
|
|
@@ -3810,6 +3796,7 @@ function InlineEdit({ value, onSave, as: Tag = "span", size = "md", placeholder,
|
|
|
3810
3796
|
/* @__PURE__ */ jsx("button", {
|
|
3811
3797
|
type: "button",
|
|
3812
3798
|
"aria-label": text.cancel,
|
|
3799
|
+
disabled: saving,
|
|
3813
3800
|
onMouseDown: (event) => event.preventDefault(),
|
|
3814
3801
|
onClick: cancel,
|
|
3815
3802
|
className: cn("text-text-tertiary hover:bg-bg-subtle rounded-md p-1", OPT_FOCUS_VISIBLE),
|
|
@@ -3821,10 +3808,12 @@ function InlineEdit({ value, onSave, as: Tag = "span", size = "md", placeholder,
|
|
|
3821
3808
|
]
|
|
3822
3809
|
});
|
|
3823
3810
|
return /* @__PURE__ */ jsxs("span", {
|
|
3811
|
+
ref: rootRef,
|
|
3824
3812
|
className: cn("inline-flex min-w-0 items-center gap-element", className),
|
|
3825
3813
|
"data-opt-id": "RQ0H2",
|
|
3826
3814
|
"data-opt-slug": "inline-edit.InlineEdit",
|
|
3827
3815
|
children: [/* @__PURE__ */ jsxs("button", {
|
|
3816
|
+
ref: readButtonRef,
|
|
3828
3817
|
type: "button",
|
|
3829
3818
|
disabled,
|
|
3830
3819
|
onClick: () => setEditing(true),
|
|
@@ -3925,4 +3914,4 @@ function KeyPadMenu({ items, label, selection = "single", value, onValueChange,
|
|
|
3925
3914
|
});
|
|
3926
3915
|
}
|
|
3927
3916
|
//#endregion
|
|
3928
|
-
export {
|
|
3917
|
+
export { Heading as $, LoadingOverlay as A, CardFooter as B, Logo as C, PageHeader as D, ScrollArea as E, CircularProgress as F, AvatarGroup as G, CardTitle as H, Progress as I, AccordionItem$1 as J, Breadcrumb as K, Card as L, RadioGroup as M, ConditionBuilder as N, createBlock as O, StepBuilder as P, Separator$1 as Q, CardContent as R, DrawerRoot as S, Container as T, Identity as U, CardHeader as V, Avatar as W, AccordionTrigger$1 as X, AccordionRoot$1 as Y, OtpField as Z, getShaderFragment as _, THEME_PALETTES as a, DrawerClose as b, ExpressionGroup as c, ShaderSurface as d, Text as et, SHADER_OVERLAY_PARAM_KEYS as f, SHADER_PRESET_IDS as g, SHADER_PRESETS as h, ColorPalettePicker as i, Radio$1 as j, BlockLayout as k, Facet as l, SHADER_PARAM_KEYS as m, InlineEdit as n, LiveRegion as o, SHADER_PARAM_FALLBACK as p, AccordionContent$1 as q, ColorPaletteDisplay as r, Expression as s, KeyPadMenu as t, FacetGroup as u, getShaderPreset as v, Section as w, DrawerPanel as x, VirtualList as y, CardDescription as z };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { U as StatCard$1, g as DateRangePickerProps } from "./text-truncate-
|
|
2
|
+
import { U as StatCard$1, g as DateRangePickerProps } from "./text-truncate-DOxUijpB.cjs";
|
|
3
3
|
import * as React$1 from "react";
|
|
4
4
|
import { CSSProperties, ComponentPropsWithoutRef, HTMLAttributes, ImgHTMLAttributes, ReactNode } from "react";
|
|
5
|
-
import { AccordionContentProps as PrimAccordionContentProps, AccordionItemProps as PrimAccordionItemProps, AccordionRootProps, AccordionTriggerProps as PrimAccordionTriggerProps, AlertDialogPanelProps, ComboboxGroupLabelProps, ComboboxGroupProps, ComboboxInputProps, ComboboxItemProps, ComboboxPopoverProps, ComboboxRootProps, Composite, CompositeItem, CompositeProvider, CompositeRow, DialogPanelProps, DialogRootProps, DisclosureContentProps as PrimDisclosureContentProps, DisclosureRootProps, DisclosureTriggerProps as PrimDisclosureTriggerProps, FormCheckboxProps, FormDescriptionProps, FormErrorProps, FormFieldProps, FormGroupLabelProps, FormGroupProps, FormInputProps, FormLabelProps, FormProvider, FormPushProps, FormRadioGroupProps, FormRadioProps, FormRemoveProps, FormResetProps, FormRootProps, FormStoreInstance, FormSubmitProps, FormSwitchProps, MenuButtonArrowProps, MenuItemCheckboxProps, MenuItemProps, MenuItemRadioProps, MenuPopoverProps, MenuRootProps, MenuSeparatorProps, MenuTriggerProps, MenubarContainerProps, MenubarRootProps, PopoverCloseProps, PopoverContentProps, PopoverRootProps, PopoverTriggerProps, SelectItemProps, SelectLabelProps, SelectPopoverProps, SelectRootProps, SelectTriggerProps, TabListProps, TabPanelProps, TabProps, TabsRootProps, ToggleGroupProps, ToggleProps, ToolbarButtonProps, ToolbarContainerProps, ToolbarRootProps, ToolbarSeparatorProps, TooltipAnchorProps, TooltipProps, TooltipRootProps, useFieldValue, useFormContext, useFormStore } from "@reopt-ai/opt-ui-primitives";
|
|
5
|
+
import { AccordionContentProps as PrimAccordionContentProps, AccordionItemProps as PrimAccordionItemProps, AccordionRootProps, AccordionTriggerProps as PrimAccordionTriggerProps, AlertDialogPanelProps, ComboboxGroupLabelProps, ComboboxGroupProps, ComboboxInputProps, ComboboxItemProps, ComboboxPopoverProps, ComboboxRootProps, Composite, CompositeItem, CompositeProvider, CompositeRow, DialogPanelProps, DialogRootProps, DisclosureContentProps as PrimDisclosureContentProps, DisclosureRootProps, DisclosureTriggerProps as PrimDisclosureTriggerProps, FormCheckboxProps, FormDescriptionProps, FormErrorProps, FormFieldProps, FormGroupLabelProps, FormGroupProps, FormInputProps, FormLabelProps, FormProvider, FormPushProps, FormRadioGroupProps, FormRadioProps, FormRemoveProps, FormResetProps, FormRootProps, FormStoreInstance, FormSubmitProps, FormSwitchProps, FormTextareaProps, MenuButtonArrowProps, MenuItemCheckboxProps, MenuItemProps, MenuItemRadioProps, MenuPopoverProps, MenuRootProps, MenuSeparatorProps, MenuTriggerProps, MenubarContainerProps, MenubarRootProps, PopoverCloseProps, PopoverContentProps, PopoverRootProps, PopoverTriggerProps, SelectItemProps, SelectLabelProps, SelectPopoverProps, SelectRootProps, SelectTriggerProps, TabListProps, TabPanelProps, TabProps, TabsRootProps, ToggleGroupProps, ToggleProps, ToolbarButtonProps, ToolbarContainerProps, ToolbarRootProps, ToolbarSeparatorProps, TooltipAnchorProps, TooltipProps, TooltipRootProps, useFieldValue, useFormContext, useFormStore } from "@reopt-ai/opt-ui-primitives";
|
|
6
6
|
import { GroupImperativeHandle, GroupProps, Layout, PanelImperativeHandle, PanelProps, PanelSize, SeparatorProps } from "react-resizable-panels";
|
|
7
7
|
//#region src/core/kbd.d.ts
|
|
8
8
|
/** Props for the kbd component. */
|
|
@@ -1144,6 +1144,8 @@ interface SliderProps {
|
|
|
1144
1144
|
value?: number;
|
|
1145
1145
|
defaultValue?: number;
|
|
1146
1146
|
onChange?: (value: number) => void;
|
|
1147
|
+
/** Called once when a pointer or keyboard edit finishes; useful for expensive seeks. */
|
|
1148
|
+
onValueCommit?: (value: number) => void;
|
|
1147
1149
|
min?: number;
|
|
1148
1150
|
max?: number;
|
|
1149
1151
|
step?: number;
|
|
@@ -1157,7 +1159,7 @@ interface SliderProps {
|
|
|
1157
1159
|
"aria-label"?: string;
|
|
1158
1160
|
}
|
|
1159
1161
|
/** Renders the slider component. */
|
|
1160
|
-
declare function Slider({ value: controlledValue, defaultValue, onChange, min, max, step, label, showValue, formatValue, disabled, className, "aria-label": ariaLabel }: SliderProps): import("react").JSX.Element;
|
|
1162
|
+
declare function Slider({ value: controlledValue, defaultValue, onChange, onValueCommit, min, max, step, label, showValue, formatValue, disabled, className, "aria-label": ariaLabel }: SliderProps): import("react").JSX.Element;
|
|
1161
1163
|
declare namespace Slider {
|
|
1162
1164
|
var displayName: string;
|
|
1163
1165
|
}
|
|
@@ -1260,23 +1262,24 @@ type FormInputProps$1 = FormInputProps;
|
|
|
1260
1262
|
/** Renders the form input component. */
|
|
1261
1263
|
declare function FormInput({ className, ...props }: FormInputProps$1): import("react").JSX.Element;
|
|
1262
1264
|
/** Props for the form textarea component. */
|
|
1263
|
-
type FormTextareaProps =
|
|
1264
|
-
name: string;
|
|
1265
|
+
type FormTextareaProps$1 = FormTextareaProps & {
|
|
1265
1266
|
resize?: "none" | "vertical" | "horizontal" | "both";
|
|
1266
1267
|
};
|
|
1267
1268
|
/** Renders the form textarea component. */
|
|
1268
|
-
declare function FormTextarea({ className, resize, rows, name, ...props }: FormTextareaProps): import("react").JSX.Element;
|
|
1269
|
+
declare function FormTextarea({ className, resize, rows, name, ...props }: FormTextareaProps$1): import("react").JSX.Element;
|
|
1269
1270
|
/** Props for the form select component. */
|
|
1270
1271
|
type FormSelectProps = {
|
|
1271
1272
|
name: string;
|
|
1273
|
+
id?: string;
|
|
1272
1274
|
children: React.ReactNode;
|
|
1273
1275
|
className?: string;
|
|
1274
1276
|
placeholder?: string;
|
|
1275
1277
|
minWidth?: number | string;
|
|
1276
1278
|
"aria-label"?: string;
|
|
1279
|
+
"aria-describedby"?: string;
|
|
1277
1280
|
};
|
|
1278
1281
|
/** Renders the form select component. */
|
|
1279
|
-
declare function FormSelect({ name, children, className, placeholder, minWidth, "aria-label": ariaLabel }: FormSelectProps): import("react").JSX.Element;
|
|
1282
|
+
declare function FormSelect({ name, id, children, className, placeholder, minWidth, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy }: FormSelectProps): import("react").JSX.Element;
|
|
1280
1283
|
type FormSelectPopoverProps = ComponentPropsWithoutRef<typeof SelectPopover>;
|
|
1281
1284
|
/** Renders the form select popover component. */
|
|
1282
1285
|
declare function FormSelectPopover({ className, ...props }: FormSelectPopoverProps): import("react").JSX.Element;
|
|
@@ -2195,6 +2198,7 @@ declare function ColorPalettePicker({ palettes, value, onValueChange, label, hid
|
|
|
2195
2198
|
//#region src/core/inline-edit.d.ts
|
|
2196
2199
|
/** Localized strings for inline editing. */
|
|
2197
2200
|
interface InlineEditLabels {
|
|
2201
|
+
input?: string;
|
|
2198
2202
|
edit?: (value: string) => string;
|
|
2199
2203
|
save?: string;
|
|
2200
2204
|
cancel?: string;
|
|
@@ -2299,4 +2303,4 @@ interface KeyPadMenuProps {
|
|
|
2299
2303
|
*/
|
|
2300
2304
|
declare function KeyPadMenu({ items, label, selection, value, onValueChange, columns, size, hideLabel, className }: KeyPadMenuProps): import("react").JSX.Element;
|
|
2301
2305
|
//#endregion
|
|
2302
|
-
export { DrawerSize as $, DescriptionListLabels as $i, ToolbarButton as $n, DisclosureContent as $r, FormColorPicker as $t, ShaderSurfaceHandle as A, TextElement as Aa, AlertProps as Ai, FormSubmit as An, DialogFooter as Ar, CheckboxGroupProps as At, ShaderPresetCategory as B, CardDescription as Bi, TagInput as Bn, SelectPopover as Br, PopoverRoot as Bt, Facet as C, Separator as Ca, SkeletonTable as Ci, FormSelectItem as Cn, AlertDialogPanel as Cr, BlockLayoutProps as Ct, FacetItem as D, HeadingProps as Da, Input as Di, FormSliderProps as Dn, DialogDescription as Dr, RadioProps as Dt, FacetGroupProps as E, HeadingLevel as Ea, SwitchProps as Ei, FormSlider as En, DialogBodyProps as Er, RadioGroupProps as Et, SHADER_PRESETS as F, KbdProps as Fa, Button as Fi, FormTextarea as Fn, DialogPanel as Fr, DropdownSeparator as Ft, VirtualListProps as G, CardHeaderProps as Gi, ColorPicker as Gn, TabListProps$1 as Gr, ConditionDef as Gt, getShaderFragment as H, CardFooter as Hi, IconDef as Hn, SelectTrigger as Hr, ConditionBuilder as Ht, SHADER_PRESET_IDS as I, ButtonProps as Ii, FormTextareaProps as In, DialogRoot as Ir, DropdownTrigger as It, DrawerClose as J, CardTitleProps as Ji, StarRatingProps as Jn, TabProps$1 as Jr, ConditionTypeRenderer as Jt, Pagination as K, CardProps as Ki, ColorPickerProps as Kn, TabPanel as Kr, ConditionGroup as Kt, ShaderParamKey as L, Card as Li, useFieldValue as Ln, DialogSize as Lr, PopoverClose as Lt, SHADER_OVERLAY_PARAM_KEYS as M, TextRole as Ma, SpinnerProps as Mi, FormSwitchProps$1 as Mn, DialogHeader as Mr, DropdownContent as Mt, SHADER_PARAM_FALLBACK as N, TextTone as Na, Badge as Ni, FormTagInput as Nn, DialogHeaderProps as Nr, DropdownItem as Nt, FacetProps as O, HeadingRole as Oa, InputProps as Oi, FormStarRating as On, DialogDisclosure as Or, Checkbox as Ot, SHADER_PARAM_KEYS as P, Kbd as Pa, BadgeProps as Pi, FormTagInputProps as Pn, DialogHeading as Pr, DropdownMenu as Pt, DrawerSide as Q, DescriptionListItem as Qi, NumberInputProps as Qn, TabsVariant as Qr, FormCheckbox as Qt, ShaderParamSpec as R, CardContent as Ri, useFormContext as Rn, SelectItem as Rr, PopoverContent as Rt, ExpressionTone as S, OtpFieldProps as Sa, SkeletonProps as Si, FormSelect as Sn, ComboboxRoot as Sr, BlockLayout as St, FacetGroupLabels as T, Heading as Ta, Switch as Ti, FormSelectProps as Tn, DialogBody as Tr, RadioGroup as Tt, getShaderPreset as U, CardFooterProps as Ui, IconPicker as Un, Tab as Ur, ConditionBuilderLabels as Ut, ShaderPresetId as V, CardDescriptionProps as Vi, TagInputProps as Vn, SelectRoot as Vr, PopoverTrigger as Vt, VirtualList as W, CardHeader as Wi, IconPickerProps as Wn, TabList as Wr, ConditionBuilderProps as Wt, DrawerPanelProps as X, IdentityProps as Xi, SliderProps as Xn, TabsRoot as Xr, StepBuilderProps as Xt, DrawerPanel as Y, Identity as Yi, Slider as Yn, TabStatus as Yr, StepBuilder as Yt, DrawerRoot as Z, DescriptionList as Zi, NumberInput as Zn, TabsRootProps$1 as Zr, StepDef as Zt, HighlightProps as _, Toggle as _a, Textarea as _i, FormRadio as _n, ComboboxGroup as _r, ScrollAreaProps as _t, InlineEditLabels as a, BreadcrumbItem as aa, CompositeRow as ai, FormError as an, TooltipProvider as ar, PanelSize as at, ExpressionGroupProps as b, ToggleProps$1 as ba, SkeletonAvatar as bi, FormReset as bn, ComboboxItem as br, BlockBaseProps as bt, ColorPaletteDisplay as c, StatCardProps as ca, MeterProps as ci, FormGroupLabel as cn, MenuItemCheckbox as cr, ResizablePanel as ct, ColorPalettePickerProps as d, AccordionRoot as da, Progress as di, FormInput as dn, MenuRoot as dr, ResizablePanelProps as dt, DescriptionListProps as ea, DisclosureRoot as ei, FormColorPickerProps as en, ToolbarContainer as er, Logo as et, PaletteKind as f, AccordionRootProps as fa, ProgressProps as fi, FormLabel as fn, MenuSeparator as fr, Section as ft, Highlight as g, PrimAccordionTriggerProps as ga, AvatarProps as gi, FormPush as gn, ComboboxEmpty as gr, ScrollArea as gt, LiveRegionProps as h, PrimAccordionItemProps as ha, AvatarGroupProps as hi, FormProvider$1 as hn, MenubarRoot as hr, ContainerProps as ht, InlineEdit as i, Breadcrumb as ia, CompositeProvider as ii, FormDescription as in, TooltipAnchor as ir, PanelImperativeHandle as it, ShaderSurfaceProps as j, TextProps as ja, Spinner as ji, FormSwitch as jn, DialogFooterProps as jr, CheckboxProps as jt, ShaderSurface as k, Text as ka, Alert as ki, FormStarRatingProps as kn, DialogDismiss as kr, CheckboxGroup as kt, ColorPaletteDisplayProps as l, AccordionContent as la, CircularProgress as li, FormIconPicker as ln, MenuItemRadio as lr, ResizablePanelGroup as lt, LiveRegion as m, PrimAccordionContentProps as ma, AvatarGroup as mi, FormNumberInputProps as mn, MenubarContainer as mr, Container as mt, KeyPadMenu as n, EmptyStateAction as na, Composite as ni, FormDateRangePicker as nn, ToolbarSeparator as nr, GroupImperativeHandle as nt, InlineEditProps as o, BreadcrumbProps as oa, CompositeZone as oi, FormField as on, MenuButtonArrow as or, ResizableHandle as ot, THEME_PALETTES as p, AccordionTrigger as pa, Avatar as pi, FormNumberInput as pn, MenuTrigger as pr, SectionProps as pt, PaginationProps as q, CardTitle as qi, StarRating as qn, TabPanelProps$1 as qr, ConditionOperator as qt, KeyPadMenuProps as r, EmptyStateProps as ra, CompositeItem as ri, FormDateRangePickerProps as rn, Tooltip as rr, Layout as rt, ColorPalette as s, StatCard as sa, Meter as si, FormGroup as sn, MenuItem as sr, ResizableHandleProps as st, KeyPadItem as t, EmptyState as ta, DisclosureTrigger as ti, FormControl as tn, ToolbarRoot as tr, LogoProps as tt, ColorPalettePicker as u, AccordionItem as ua, CircularProgressProps as ui, FormIconPickerProps as un, MenuPopover as ur, ResizablePanelGroupProps as ut, Expression as v, ToggleGroup as va, TextareaProps as vi, FormRadioGroup as vn, ComboboxGroupLabel as vr, PageHeader as vt, FacetGroup as w, SeparatorProps$1 as wa, SkeletonText as wi, FormSelectPopover as wn, AlertDialogPanelProps$1 as wr, Radio as wt, ExpressionProps as x, OtpField as xa, SkeletonCard as xi, FormRoot as xn, ComboboxPopover as xr, createBlock as xt, ExpressionGroup as y, ToggleGroupProps$1 as ya, Skeleton as yi, FormRemove as yn, ComboboxInput as yr, PageHeaderProps as yt, ShaderPreset as z, CardContentProps as zi, useFormStore as zn, SelectLabel as zr, PopoverContentProps$1 as zt };
|
|
2306
|
+
export { DrawerSize as $, DescriptionListLabels as $i, ToolbarButton as $n, DisclosureContent as $r, FormColorPicker as $t, ShaderSurfaceHandle as A, TextElement as Aa, AlertProps as Ai, FormSubmit as An, DialogFooter as Ar, CheckboxGroupProps as At, ShaderPresetCategory as B, CardDescription as Bi, TagInput as Bn, SelectPopover as Br, PopoverRoot as Bt, Facet as C, Separator as Ca, SkeletonTable as Ci, FormSelectItem as Cn, AlertDialogPanel as Cr, BlockLayoutProps as Ct, FacetItem as D, HeadingProps as Da, Input as Di, FormSliderProps as Dn, DialogDescription as Dr, RadioProps as Dt, FacetGroupProps as E, HeadingLevel as Ea, SwitchProps as Ei, FormSlider as En, DialogBodyProps as Er, RadioGroupProps as Et, SHADER_PRESETS as F, KbdProps as Fa, Button as Fi, FormTextarea as Fn, DialogPanel as Fr, DropdownSeparator as Ft, VirtualListProps as G, CardHeaderProps as Gi, ColorPicker as Gn, TabListProps$1 as Gr, ConditionDef as Gt, getShaderFragment as H, CardFooter as Hi, IconDef as Hn, SelectTrigger as Hr, ConditionBuilder as Ht, SHADER_PRESET_IDS as I, ButtonProps as Ii, FormTextareaProps$1 as In, DialogRoot as Ir, DropdownTrigger as It, DrawerClose as J, CardTitleProps as Ji, StarRatingProps as Jn, TabProps$1 as Jr, ConditionTypeRenderer as Jt, Pagination as K, CardProps as Ki, ColorPickerProps as Kn, TabPanel as Kr, ConditionGroup as Kt, ShaderParamKey as L, Card as Li, useFieldValue as Ln, DialogSize as Lr, PopoverClose as Lt, SHADER_OVERLAY_PARAM_KEYS as M, TextRole as Ma, SpinnerProps as Mi, FormSwitchProps$1 as Mn, DialogHeader as Mr, DropdownContent as Mt, SHADER_PARAM_FALLBACK as N, TextTone as Na, Badge as Ni, FormTagInput as Nn, DialogHeaderProps as Nr, DropdownItem as Nt, FacetProps as O, HeadingRole as Oa, InputProps as Oi, FormStarRating as On, DialogDisclosure as Or, Checkbox as Ot, SHADER_PARAM_KEYS as P, Kbd as Pa, BadgeProps as Pi, FormTagInputProps as Pn, DialogHeading as Pr, DropdownMenu as Pt, DrawerSide as Q, DescriptionListItem as Qi, NumberInputProps as Qn, TabsVariant as Qr, FormCheckbox as Qt, ShaderParamSpec as R, CardContent as Ri, useFormContext as Rn, SelectItem as Rr, PopoverContent as Rt, ExpressionTone as S, OtpFieldProps as Sa, SkeletonProps as Si, FormSelect as Sn, ComboboxRoot as Sr, BlockLayout as St, FacetGroupLabels as T, Heading as Ta, Switch as Ti, FormSelectProps as Tn, DialogBody as Tr, RadioGroup as Tt, getShaderPreset as U, CardFooterProps as Ui, IconPicker as Un, Tab as Ur, ConditionBuilderLabels as Ut, ShaderPresetId as V, CardDescriptionProps as Vi, TagInputProps as Vn, SelectRoot as Vr, PopoverTrigger as Vt, VirtualList as W, CardHeader as Wi, IconPickerProps as Wn, TabList as Wr, ConditionBuilderProps as Wt, DrawerPanelProps as X, IdentityProps as Xi, SliderProps as Xn, TabsRoot as Xr, StepBuilderProps as Xt, DrawerPanel as Y, Identity as Yi, Slider as Yn, TabStatus as Yr, StepBuilder as Yt, DrawerRoot as Z, DescriptionList as Zi, NumberInput as Zn, TabsRootProps$1 as Zr, StepDef as Zt, HighlightProps as _, Toggle as _a, Textarea as _i, FormRadio as _n, ComboboxGroup as _r, ScrollAreaProps as _t, InlineEditLabels as a, BreadcrumbItem as aa, CompositeRow as ai, FormError as an, TooltipProvider as ar, PanelSize as at, ExpressionGroupProps as b, ToggleProps$1 as ba, SkeletonAvatar as bi, FormReset as bn, ComboboxItem as br, BlockBaseProps as bt, ColorPaletteDisplay as c, StatCardProps as ca, MeterProps as ci, FormGroupLabel as cn, MenuItemCheckbox as cr, ResizablePanel as ct, ColorPalettePickerProps as d, AccordionRoot as da, Progress as di, FormInput as dn, MenuRoot as dr, ResizablePanelProps as dt, DescriptionListProps as ea, DisclosureRoot as ei, FormColorPickerProps as en, ToolbarContainer as er, Logo as et, PaletteKind as f, AccordionRootProps as fa, ProgressProps as fi, FormLabel as fn, MenuSeparator as fr, Section as ft, Highlight as g, PrimAccordionTriggerProps as ga, AvatarProps as gi, FormPush as gn, ComboboxEmpty as gr, ScrollArea as gt, LiveRegionProps as h, PrimAccordionItemProps as ha, AvatarGroupProps as hi, FormProvider$1 as hn, MenubarRoot as hr, ContainerProps as ht, InlineEdit as i, Breadcrumb as ia, CompositeProvider as ii, FormDescription as in, TooltipAnchor as ir, PanelImperativeHandle as it, ShaderSurfaceProps as j, TextProps as ja, Spinner as ji, FormSwitch as jn, DialogFooterProps as jr, CheckboxProps as jt, ShaderSurface as k, Text as ka, Alert as ki, FormStarRatingProps as kn, DialogDismiss as kr, CheckboxGroup as kt, ColorPaletteDisplayProps as l, AccordionContent as la, CircularProgress as li, FormIconPicker as ln, MenuItemRadio as lr, ResizablePanelGroup as lt, LiveRegion as m, PrimAccordionContentProps as ma, AvatarGroup as mi, FormNumberInputProps as mn, MenubarContainer as mr, Container as mt, KeyPadMenu as n, EmptyStateAction as na, Composite as ni, FormDateRangePicker as nn, ToolbarSeparator as nr, GroupImperativeHandle as nt, InlineEditProps as o, BreadcrumbProps as oa, CompositeZone as oi, FormField as on, MenuButtonArrow as or, ResizableHandle as ot, THEME_PALETTES as p, AccordionTrigger as pa, Avatar as pi, FormNumberInput as pn, MenuTrigger as pr, SectionProps as pt, PaginationProps as q, CardTitle as qi, StarRating as qn, TabPanelProps$1 as qr, ConditionOperator as qt, KeyPadMenuProps as r, EmptyStateProps as ra, CompositeItem as ri, FormDateRangePickerProps as rn, Tooltip as rr, Layout as rt, ColorPalette as s, StatCard as sa, Meter as si, FormGroup as sn, MenuItem as sr, ResizableHandleProps as st, KeyPadItem as t, EmptyState as ta, DisclosureTrigger as ti, FormControl as tn, ToolbarRoot as tr, LogoProps as tt, ColorPalettePicker as u, AccordionItem as ua, CircularProgressProps as ui, FormIconPickerProps as un, MenuPopover as ur, ResizablePanelGroupProps as ut, Expression as v, ToggleGroup as va, TextareaProps as vi, FormRadioGroup as vn, ComboboxGroupLabel as vr, PageHeader as vt, FacetGroup as w, SeparatorProps$1 as wa, SkeletonText as wi, FormSelectPopover as wn, AlertDialogPanelProps$1 as wr, Radio as wt, ExpressionProps as x, OtpField as xa, SkeletonCard as xi, FormRoot as xn, ComboboxPopover as xr, createBlock as xt, ExpressionGroup as y, ToggleGroupProps$1 as ya, Skeleton as yi, FormRemove as yn, ComboboxInput as yr, PageHeaderProps as yt, ShaderPreset as z, CardContentProps as zi, useFormStore as zn, SelectLabel as zr, PopoverContentProps$1 as zt };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const require_text_truncate = require("./text-truncate-
|
|
2
|
+
const require_text_truncate = require("./text-truncate-gQhpMy-Z.cjs");
|
|
3
3
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
4
|
let react = require("react");
|
|
5
5
|
react = require_text_truncate.__toESM(react, 1);
|
|
@@ -8,7 +8,7 @@ let lucide_react = require("lucide-react");
|
|
|
8
8
|
let ogl = require("ogl");
|
|
9
9
|
let _reopt_ai_opt_palette = require("@reopt-ai/opt-palette");
|
|
10
10
|
//#region src/core/text.tsx
|
|
11
|
-
const _excluded$
|
|
11
|
+
const _excluded$10 = [
|
|
12
12
|
"as",
|
|
13
13
|
"variant",
|
|
14
14
|
"tone",
|
|
@@ -24,7 +24,7 @@ const toneStyles$1 = {
|
|
|
24
24
|
};
|
|
25
25
|
/** Semantic body text whose visual role is controlled by foundation tokens. */
|
|
26
26
|
function Text(_ref) {
|
|
27
|
-
let { as, variant = "body", tone = "primary", truncate = false, className, children } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$
|
|
27
|
+
let { as, variant = "body", tone = "primary", truncate = false, className, children } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$10);
|
|
28
28
|
const Component = as !== null && as !== void 0 ? as : "span";
|
|
29
29
|
const elementProps = require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({}, props), {}, {
|
|
30
30
|
className: require_text_truncate.cn(`opt-type-${variant}`, toneStyles$1[tone], truncate && "truncate", className),
|
|
@@ -39,7 +39,7 @@ function Text(_ref) {
|
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/core/heading.tsx
|
|
42
|
-
const _excluded$
|
|
42
|
+
const _excluded$9 = [
|
|
43
43
|
"level",
|
|
44
44
|
"variant",
|
|
45
45
|
"className",
|
|
@@ -47,7 +47,7 @@ const _excluded$10 = [
|
|
|
47
47
|
];
|
|
48
48
|
/** Semantic heading with independently selectable visual hierarchy. */
|
|
49
49
|
function Heading(_ref) {
|
|
50
|
-
let { level = 2, variant = `heading-${level}`, className, children } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$
|
|
50
|
+
let { level = 2, variant = `heading-${level}`, className, children } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$9);
|
|
51
51
|
const Component = {
|
|
52
52
|
1: "h1",
|
|
53
53
|
2: "h2",
|
|
@@ -265,47 +265,6 @@ function OtpField({ length = 6, value: controlledValue, defaultValue = "", onCha
|
|
|
265
265
|
}
|
|
266
266
|
OtpField.displayName = "OtpField";
|
|
267
267
|
//#endregion
|
|
268
|
-
//#region src/core/toggle.tsx
|
|
269
|
-
const _excluded$9 = [
|
|
270
|
-
"size",
|
|
271
|
-
"className",
|
|
272
|
-
"children"
|
|
273
|
-
];
|
|
274
|
-
const _excluded2$5 = [
|
|
275
|
-
"className",
|
|
276
|
-
"children",
|
|
277
|
-
"orientation"
|
|
278
|
-
];
|
|
279
|
-
const sizeStyles$6 = {
|
|
280
|
-
sm: "h-8 min-w-8 px-2 text-xs gap-1.5",
|
|
281
|
-
md: "h-10 min-w-10 px-3 text-sm gap-2"
|
|
282
|
-
};
|
|
283
|
-
const toggleBase = require_text_truncate.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_text_truncate.OPT_FOCUS_VISIBLE);
|
|
284
|
-
/** A two-state (pressed) button. Use standalone or inside `ToggleGroup`. */
|
|
285
|
-
function Toggle(_ref) {
|
|
286
|
-
let { size = "md", className, children } = _ref, props = require_text_truncate._objectWithoutProperties(_ref, _excluded$9);
|
|
287
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.Toggle, require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({ className: require_text_truncate.cn(toggleBase, sizeStyles$6[size], className) }, props), {}, {
|
|
288
|
-
"data-opt-id": "GFCMY",
|
|
289
|
-
"data-opt-slug": "toggle.Toggle",
|
|
290
|
-
children
|
|
291
|
-
}));
|
|
292
|
-
}
|
|
293
|
-
Toggle.displayName = "Toggle";
|
|
294
|
-
/** A set of related toggles with shared selection and keyboard navigation. */
|
|
295
|
-
function ToggleGroup(_ref2) {
|
|
296
|
-
let { className, children, orientation = "horizontal" } = _ref2, props = require_text_truncate._objectWithoutProperties(_ref2, _excluded2$5);
|
|
297
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.ToggleGroup, require_text_truncate._objectSpread2(require_text_truncate._objectSpread2({
|
|
298
|
-
orientation,
|
|
299
|
-
"aria-orientation": orientation,
|
|
300
|
-
className: require_text_truncate.cn("inline-flex gap-1", orientation === "vertical" ? "flex-col" : "flex-row", className)
|
|
301
|
-
}, props), {}, {
|
|
302
|
-
"data-opt-id": "47J37",
|
|
303
|
-
"data-opt-slug": "toggle.ToggleGroup",
|
|
304
|
-
children
|
|
305
|
-
}));
|
|
306
|
-
}
|
|
307
|
-
ToggleGroup.displayName = "ToggleGroup";
|
|
308
|
-
//#endregion
|
|
309
268
|
//#region src/core/accordion.tsx
|
|
310
269
|
const _excluded$8 = ["className"];
|
|
311
270
|
const _excluded2$4 = ["className"];
|
|
@@ -3689,6 +3648,7 @@ function ColorPalettePicker({ palettes, value, onValueChange, label = "Colour pa
|
|
|
3689
3648
|
//#endregion
|
|
3690
3649
|
//#region src/core/inline-edit.tsx
|
|
3691
3650
|
const defaultLabels = {
|
|
3651
|
+
input: "Value",
|
|
3692
3652
|
edit: (value) => `Edit ${value}`,
|
|
3693
3653
|
save: "Save",
|
|
3694
3654
|
cancel: "Cancel",
|
|
@@ -3724,24 +3684,39 @@ function InlineEdit({ value, onSave, as: Tag = "span", size = "md", placeholder,
|
|
|
3724
3684
|
const [rejected, setRejected] = (0, react.useState)(false);
|
|
3725
3685
|
const [saving, setSaving] = (0, react.useState)(false);
|
|
3726
3686
|
const inputRef = (0, react.useRef)(null);
|
|
3687
|
+
const rootRef = (0, react.useRef)(null);
|
|
3688
|
+
const readButtonRef = (0, react.useRef)(null);
|
|
3689
|
+
const restoreFocusRef = (0, react.useRef)(false);
|
|
3690
|
+
const savingRef = (0, react.useRef)(false);
|
|
3691
|
+
const errorId = (0, react.useId)();
|
|
3727
3692
|
(0, react.useEffect)(() => {
|
|
3728
3693
|
if (!editing) setDraft(value);
|
|
3729
3694
|
}, [value, editing]);
|
|
3730
|
-
(0, react.
|
|
3695
|
+
(0, react.useLayoutEffect)(() => {
|
|
3731
3696
|
if (editing) {
|
|
3732
3697
|
var _inputRef$current, _inputRef$current2;
|
|
3733
3698
|
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
3734
3699
|
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.select();
|
|
3700
|
+
} else if (restoreFocusRef.current) {
|
|
3701
|
+
var _readButtonRef$curren;
|
|
3702
|
+
restoreFocusRef.current = false;
|
|
3703
|
+
(_readButtonRef$curren = readButtonRef.current) === null || _readButtonRef$curren === void 0 || _readButtonRef$curren.focus();
|
|
3735
3704
|
}
|
|
3736
3705
|
}, [editing]);
|
|
3737
|
-
const
|
|
3738
|
-
|
|
3706
|
+
const finishEditing = (restoreFocus) => {
|
|
3707
|
+
var _rootRef$current;
|
|
3708
|
+
restoreFocusRef.current = restoreFocus && (document.activeElement === document.body || Boolean((_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.contains(document.activeElement)));
|
|
3709
|
+
setEditing(false);
|
|
3710
|
+
};
|
|
3711
|
+
const commit = async (restoreFocus) => {
|
|
3712
|
+
if (savingRef.current || disabled) return;
|
|
3739
3713
|
const next = draft.trim();
|
|
3740
3714
|
if (next === value) {
|
|
3741
|
-
|
|
3715
|
+
finishEditing(restoreFocus);
|
|
3742
3716
|
setRejected(false);
|
|
3743
3717
|
return;
|
|
3744
3718
|
}
|
|
3719
|
+
savingRef.current = true;
|
|
3745
3720
|
setSaving(true);
|
|
3746
3721
|
try {
|
|
3747
3722
|
if (await onSave(next) === false) {
|
|
@@ -3749,26 +3724,35 @@ function InlineEdit({ value, onSave, as: Tag = "span", size = "md", placeholder,
|
|
|
3749
3724
|
return;
|
|
3750
3725
|
}
|
|
3751
3726
|
setRejected(false);
|
|
3752
|
-
|
|
3727
|
+
finishEditing(restoreFocus);
|
|
3728
|
+
} catch (_unused) {
|
|
3729
|
+
setRejected(true);
|
|
3753
3730
|
} finally {
|
|
3731
|
+
savingRef.current = false;
|
|
3754
3732
|
setSaving(false);
|
|
3755
3733
|
}
|
|
3756
3734
|
};
|
|
3757
3735
|
const cancel = () => {
|
|
3736
|
+
if (savingRef.current) return;
|
|
3758
3737
|
setDraft(value);
|
|
3759
3738
|
setRejected(false);
|
|
3760
|
-
|
|
3739
|
+
finishEditing(true);
|
|
3761
3740
|
};
|
|
3762
3741
|
const handleKeyDown = (event) => {
|
|
3742
|
+
if (require_text_truncate.isComposingKey(event)) return;
|
|
3763
3743
|
if (event.key === "Enter") {
|
|
3764
3744
|
event.preventDefault();
|
|
3765
|
-
commit();
|
|
3745
|
+
commit(true);
|
|
3766
3746
|
} else if (event.key === "Escape") {
|
|
3767
3747
|
event.preventDefault();
|
|
3768
3748
|
cancel();
|
|
3769
3749
|
}
|
|
3770
3750
|
};
|
|
3771
3751
|
if (editing) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3752
|
+
ref: rootRef,
|
|
3753
|
+
onBlur: (event) => {
|
|
3754
|
+
if (!event.currentTarget.contains(event.relatedTarget)) commit(false);
|
|
3755
|
+
},
|
|
3772
3756
|
className: require_text_truncate.cn("inline-flex min-w-0 items-center gap-element", className),
|
|
3773
3757
|
"data-opt-id": "RQ0H2",
|
|
3774
3758
|
"data-opt-slug": "inline-edit.InlineEdit",
|
|
@@ -3781,16 +3765,18 @@ function InlineEdit({ value, onSave, as: Tag = "span", size = "md", placeholder,
|
|
|
3781
3765
|
setRejected(false);
|
|
3782
3766
|
},
|
|
3783
3767
|
onKeyDown: handleKeyDown,
|
|
3784
|
-
onBlur: () => void commit(),
|
|
3785
3768
|
placeholder,
|
|
3786
3769
|
maxLength,
|
|
3787
|
-
|
|
3770
|
+
readOnly: saving || disabled,
|
|
3771
|
+
"aria-busy": saving || void 0,
|
|
3772
|
+
"aria-label": text.input,
|
|
3788
3773
|
"aria-invalid": rejected || void 0,
|
|
3789
|
-
"aria-errormessage": rejected ?
|
|
3774
|
+
"aria-errormessage": rejected ? errorId : void 0,
|
|
3775
|
+
"aria-describedby": rejected ? errorId : void 0,
|
|
3790
3776
|
className: require_text_truncate.cn(require_text_truncate.OPT_INPUT, sizeStyles$1[size], "min-w-0 flex-1")
|
|
3791
3777
|
}),
|
|
3792
3778
|
rejected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3793
|
-
id:
|
|
3779
|
+
id: errorId,
|
|
3794
3780
|
role: "alert",
|
|
3795
3781
|
className: "sr-only",
|
|
3796
3782
|
children: text.invalid
|
|
@@ -3798,9 +3784,9 @@ function InlineEdit({ value, onSave, as: Tag = "span", size = "md", placeholder,
|
|
|
3798
3784
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3799
3785
|
type: "button",
|
|
3800
3786
|
"aria-label": text.save,
|
|
3801
|
-
disabled: saving,
|
|
3787
|
+
disabled: saving || disabled,
|
|
3802
3788
|
onMouseDown: (event) => event.preventDefault(),
|
|
3803
|
-
onClick: () => void commit(),
|
|
3789
|
+
onClick: () => void commit(true),
|
|
3804
3790
|
className: require_text_truncate.cn("text-success hover:bg-success-subtle rounded-md p-1", require_text_truncate.OPT_FOCUS_VISIBLE),
|
|
3805
3791
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
|
|
3806
3792
|
className: "size-4",
|
|
@@ -3810,6 +3796,7 @@ function InlineEdit({ value, onSave, as: Tag = "span", size = "md", placeholder,
|
|
|
3810
3796
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3811
3797
|
type: "button",
|
|
3812
3798
|
"aria-label": text.cancel,
|
|
3799
|
+
disabled: saving,
|
|
3813
3800
|
onMouseDown: (event) => event.preventDefault(),
|
|
3814
3801
|
onClick: cancel,
|
|
3815
3802
|
className: require_text_truncate.cn("text-text-tertiary hover:bg-bg-subtle rounded-md p-1", require_text_truncate.OPT_FOCUS_VISIBLE),
|
|
@@ -3821,10 +3808,12 @@ function InlineEdit({ value, onSave, as: Tag = "span", size = "md", placeholder,
|
|
|
3821
3808
|
]
|
|
3822
3809
|
});
|
|
3823
3810
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3811
|
+
ref: rootRef,
|
|
3824
3812
|
className: require_text_truncate.cn("inline-flex min-w-0 items-center gap-element", className),
|
|
3825
3813
|
"data-opt-id": "RQ0H2",
|
|
3826
3814
|
"data-opt-slug": "inline-edit.InlineEdit",
|
|
3827
3815
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
3816
|
+
ref: readButtonRef,
|
|
3828
3817
|
type: "button",
|
|
3829
3818
|
disabled,
|
|
3830
3819
|
onClick: () => setEditing(true),
|
|
@@ -4225,18 +4214,6 @@ Object.defineProperty(exports, "Text", {
|
|
|
4225
4214
|
return Text;
|
|
4226
4215
|
}
|
|
4227
4216
|
});
|
|
4228
|
-
Object.defineProperty(exports, "Toggle", {
|
|
4229
|
-
enumerable: true,
|
|
4230
|
-
get: function() {
|
|
4231
|
-
return Toggle;
|
|
4232
|
-
}
|
|
4233
|
-
});
|
|
4234
|
-
Object.defineProperty(exports, "ToggleGroup", {
|
|
4235
|
-
enumerable: true,
|
|
4236
|
-
get: function() {
|
|
4237
|
-
return ToggleGroup;
|
|
4238
|
-
}
|
|
4239
|
-
});
|
|
4240
4217
|
Object.defineProperty(exports, "VirtualList", {
|
|
4241
4218
|
enumerable: true,
|
|
4242
4219
|
get: function() {
|