@spear-ai/spectral 1.12.6 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.js +41 -38
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +46 -45
- package/dist/Checkbox.js +6 -5
- package/dist/{Combobox-DCCcIDgq.js → Combobox-DRQqx0os.js} +9 -8
- package/dist/Combobox.js +1 -1
- package/dist/ControlGroup/ControlGroupSelect.d.ts +5 -1
- package/dist/ControlGroup/ControlGroupSelect.js +73 -67
- package/dist/ControlGroup.js +29 -24
- package/dist/DateTimePicker/TimePeriodSelect.js +1 -1
- package/dist/DateTimePicker.js +8 -7
- package/dist/DropdownMenu-BO_RPCVU.js +870 -0
- package/dist/DropdownMenu.d.ts +3 -2
- package/dist/DropdownMenu.js +2 -868
- package/dist/FormFieldMessage.d.ts +11 -0
- package/dist/FormFieldMessage.js +55 -0
- package/dist/Input.d.ts +1 -0
- package/dist/Input.js +68 -67
- package/dist/InputNumeric.js +3 -14
- package/dist/{InputOTP-DyhesOLs.js → InputOTP-DLn7ja7J.js} +5 -4
- package/dist/InputOTP.js +1 -1
- package/dist/MultiSelect/MultiSelectBase.js +105 -104
- package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +2 -2
- package/dist/{RadioGroup-BsBK247l.js → RadioGroup-D-XjCU4Q.js} +33 -28
- package/dist/RadioGroup.js +1 -1
- package/dist/Select.js +21 -20
- package/dist/{Switch-Vep4hsq4.js → Switch-CSmXtkia.js} +26 -25
- package/dist/Switch.js +1 -1
- package/dist/Textarea/TextareaUtils.js +4 -8
- package/dist/Textarea.js +23 -22
- package/dist/Toggle.js +1 -1
- package/dist/ToggleGroup/ToggleGroup.context.d.ts +9 -0
- package/dist/ToggleGroup/ToggleGroup.context.js +11 -0
- package/dist/ToggleGroup/ToggleGroupItem.d.ts +15 -0
- package/dist/ToggleGroup/ToggleGroupItem.js +35 -0
- package/dist/ToggleGroup/ToggleGroupSplitMenuItem.d.ts +22 -0
- package/dist/ToggleGroup/ToggleGroupSplitMenuItem.js +114 -0
- package/dist/ToggleGroup.d.ts +6 -14
- package/dist/ToggleGroup.js +24 -46
- package/dist/Tooltip.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/primitives/select.d.ts +1 -1
- package/dist/primitives/select.d.ts.map +1 -1
- package/dist/primitives/select.js +1 -1
- package/dist/primitives/textarea.js +1 -1
- package/dist/{select-oAOoVl5g.js → select-DFE8xm1L.js} +230 -259
- package/dist/styles/spectral.css +1 -1
- package/dist/utils/formFieldUtils.d.ts +1 -13
- package/dist/utils/formFieldUtils.d.ts.map +1 -1
- package/dist/utils/formFieldUtils.js +48 -69
- package/package.json +1 -1
- /package/dist/{Tooltip-vEdD4f2U.js → Tooltip-CTjKOfvC.js} +0 -0
package/dist/.js
CHANGED
|
@@ -86,41 +86,44 @@ import { t as Ae } from "./twUtils-BpqlKSeB.js";
|
|
|
86
86
|
import { Alert as je } from "./Alert.js";
|
|
87
87
|
import { Avatar as Me } from "./Avatar.js";
|
|
88
88
|
import { Badge as Ne } from "./Badge.js";
|
|
89
|
-
import {
|
|
90
|
-
import {
|
|
91
|
-
import {
|
|
92
|
-
import {
|
|
93
|
-
import {
|
|
94
|
-
import {
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import {
|
|
99
|
-
import {
|
|
100
|
-
import {
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
103
|
-
import {
|
|
104
|
-
import {
|
|
105
|
-
import {
|
|
106
|
-
import {
|
|
107
|
-
import {
|
|
108
|
-
import {
|
|
109
|
-
import {
|
|
110
|
-
import {
|
|
111
|
-
import {
|
|
112
|
-
import {
|
|
113
|
-
import {
|
|
114
|
-
import {
|
|
115
|
-
import {
|
|
116
|
-
import {
|
|
117
|
-
import { t as
|
|
118
|
-
import {
|
|
119
|
-
import {
|
|
120
|
-
import {
|
|
121
|
-
import {
|
|
122
|
-
import {
|
|
123
|
-
import {
|
|
124
|
-
import {
|
|
125
|
-
import {
|
|
126
|
-
|
|
89
|
+
import { ErrorMessage as Pe, WarningMessage as Fe } from "./FormFieldMessage.js";
|
|
90
|
+
import { Button as Ie } from "./Button.js";
|
|
91
|
+
import { Separator as Le } from "./Separator.js";
|
|
92
|
+
import { ButtonGroup as Re, ButtonGroupItem as ze, ButtonGroupSeparator as Be } from "./ButtonGroup.js";
|
|
93
|
+
import { ButtonIcon as Ve } from "./ButtonIcon.js";
|
|
94
|
+
import { useUncontrolledState as He } from "./hooks/useUncontrolledState.js";
|
|
95
|
+
import { Checkbox as Ue } from "./Checkbox.js";
|
|
96
|
+
import { t as We } from "./Combobox-DRQqx0os.js";
|
|
97
|
+
import { Label as Ge } from "./Label.js";
|
|
98
|
+
import { InputGroup as Ke, InputGroupAddon as qe, InputGroupButton as Je, InputGroupInput as Ye, InputGroupText as Xe, InputGroupTextarea as Ze } from "./primitives/input-group.js";
|
|
99
|
+
import { ControlGroupSelect as Qe } from "./ControlGroup/ControlGroupSelect.js";
|
|
100
|
+
import { DataCard as $e } from "./DataCard.js";
|
|
101
|
+
import { Popover as et, PopoverContent as tt, PopoverTrigger as nt } from "./Popover.js";
|
|
102
|
+
import { DateTimePicker as rt } from "./DateTimePicker.js";
|
|
103
|
+
import { Dialog as it } from "./Dialog.js";
|
|
104
|
+
import { SpectralProvider as at } from "./SpectralProvider.js";
|
|
105
|
+
import { Drawer as ot } from "./Drawer.js";
|
|
106
|
+
import { n as st, r as ct, t as lt } from "./HoverCard-BhxgELKP.js";
|
|
107
|
+
import { Input as ut } from "./Input.js";
|
|
108
|
+
import { InputNumeric as dt } from "./InputNumeric.js";
|
|
109
|
+
import { t as ft } from "./InputOTP-DLn7ja7J.js";
|
|
110
|
+
import { Kbd as pt, KbdGroup as mt } from "./Kbd.js";
|
|
111
|
+
import { MultiSelect as ht } from "./MultiSelect.js";
|
|
112
|
+
import { RadioButtonGroup as gt, RadioButtonGroupItem as _t } from "./RadioButtonGroup.js";
|
|
113
|
+
import { RadioButton as vt } from "./RadioButton.js";
|
|
114
|
+
import { n as yt, t as bt } from "./RadioGroup-D-XjCU4Q.js";
|
|
115
|
+
import { Select as xt } from "./Select.js";
|
|
116
|
+
import { Skeleton as St } from "./Skeleton.js";
|
|
117
|
+
import { t as Ct } from "./Slider-CPYW_VYu.js";
|
|
118
|
+
import { t as wt } from "./Switch-CSmXtkia.js";
|
|
119
|
+
import { Tabs as Tt } from "./Tabs.js";
|
|
120
|
+
import { Textarea as Et } from "./Textarea.js";
|
|
121
|
+
import { n as Dt, t as Ot } from "./Toast-BuaZxqlt.js";
|
|
122
|
+
import { Toggle as kt } from "./Toggle.js";
|
|
123
|
+
import { ToggleGroupItem as At } from "./ToggleGroup/ToggleGroupItem.js";
|
|
124
|
+
import { ToggleGroupSplitMenuItem as jt } from "./ToggleGroup/ToggleGroupSplitMenuItem.js";
|
|
125
|
+
import { ToggleGroup as Mt } from "./ToggleGroup.js";
|
|
126
|
+
import { i as Nt, n as Pt, t as Ft } from "./Tooltip-CTjKOfvC.js";
|
|
127
|
+
import { Tray as It } from "./Tray.js";
|
|
128
|
+
import { useControllableState as Lt } from "./hooks/useControllableState.js";
|
|
129
|
+
export { ke as Accordion, n as AdjustmentsIcon, je as Alert, r as AnalyzeIcon, i as AnnotationsIcon, a as ApprovedIcon, o as ArrowDownIcon, s as ArrowUpIcon, Me as Avatar, Ne as Badge, c as BoxToolIcon, Ie as Button, Re as ButtonGroup, ze as ButtonGroupItem, Be as ButtonGroupSeparator, Ve as ButtonIcon, l as CalendarIcon, u as CheckCircleIcon, d as CheckSquareIcon, Ue as Checkbox, f as CheckmarkIcon, p as ChevronDownIcon, m as ChevronUpIcon, h as ClockIcon, g as CloseCircleIcon, _ as CloseIcon, We as Combobox, Qe as ControlGroupSelect, v as Crosshairs2Icon, y as CrosshairsIcon, b as DashboardIcon, $e as DataCard, x as DatabaseIcon, rt as DateTimePicker, S as DeleteIcon, it as Dialog, ot as Drawer, C as DurationIcon, w as EditIcon, T as EmailIcon, E as EraserIcon, D as ErrorIcon, Pe as ErrorMessage, O as EyeClosedIcon, k as EyeClosedIcon2, A as EyeOpenIcon, j as FileDownloadIcon, M as GoToFirstIcon, N as GoToLastIcon, P as HarmonicCursorsIcon, lt as HoverCard, st as HoverCardContent, ct as HoverCardTrigger, e as IconBase, F as InfoIcon, ut as Input, Ke as InputGroup, qe as InputGroupAddon, Je as InputGroupButton, Ye as InputGroupInput, Xe as InputGroupText, Ze as InputGroupTextarea, dt as InputNumeric, ft as InputOTP, pt as Kbd, mt as KbdGroup, I as KeyboardIcon, Ge as Label, L as LabelIcon, R as LassoIcon, z as LineToolIcon, B as LiveViewIcon, V as LoaderIcon, H as LocationIcon, U as LogoutIcon, W as MaximizeIcon, G as MeasureIcon, K as MenuDotsIcon, q as MenuIcon, J as MessagesIcon, Y as MetadataIcon, X as MinimizeIcon, Z as MinusIcon, ht as MultiSelect, Q as OntologyIcon, $ as PanelIconClose, ee as PanelIconOpen, te as PauseIcon, ne as PlayIcon, re as PlusIcon, ie as PolygonIcon, et as Popover, tt as PopoverContent, nt as PopoverTrigger, ae as PrinterIcon, oe as ProgressCheckIcon, vt as RadioButton, gt as RadioButtonGroup, _t as RadioButtonGroupItem, bt as RadioGroup, yt as RadioGroupItem, se as ResetIcon, ce as ReviewedIcon, le as ScissorsIcon, ue as SearchIcon, xt as Select, Le as Separator, de as SettingsIcon, St as Skeleton, Ct as Slider, fe as SortAscendingIcon, pe as SortAtoZIcon, me as SortDescendingIcon, he as SortZtoAIcon, ge as SparklesIcon, at as SpectralProvider, _e as StackIcon, ve as StarIcon, t as SvgIdContext, wt as Switch, Tt as Tabs, Et as Textarea, Ot as Toast, kt as Toggle, Mt as ToggleGroup, At as ToggleGroupItem, jt as ToggleGroupSplitMenuItem, Ft as Tooltip, Pt as TooltipContent, Nt as TooltipTrigger, ye as TrashIcon, It as Tray, be as UndoIcon, xe as UploadIcon, Se as User2Icon, Ce as UserIcon, we as WarningIcon, Fe as WarningMessage, Te as ZoomAllIcon, Ee as ZoomXIcon, De as ZoomYIcon, Ae as cn, Dt as toast, Oe as useAccordionAutoScroll, Lt as useControllableState, He as useUncontrolledState };
|
package/dist/Button.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface ButtonProps extends AsChildProp, Omit<ButtonHTMLAttributes<HTML
|
|
|
20
20
|
variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'unstyled';
|
|
21
21
|
}
|
|
22
22
|
export declare const Button: {
|
|
23
|
-
({ asChild, children, className, dataTestId, disabled, endIcon, errorMessage, label, onClick, ref, size, startIcon, state, type, variant, ...props }: ButtonProps & {
|
|
23
|
+
({ asChild, children, className, dataTestId, disabled, endIcon, errorMessage, id, label, onClick, ref, size, startIcon, state, type, variant, ...props }: ButtonProps & {
|
|
24
24
|
ref?: Ref<HTMLButtonElement>;
|
|
25
25
|
}): import("react/jsx-runtime").JSX.Element;
|
|
26
26
|
displayName: string;
|
package/dist/Button.js
CHANGED
|
@@ -4,11 +4,11 @@ import { LoaderIcon as e } from "./Icons/LoaderIcon.js";
|
|
|
4
4
|
import { t } from "./twUtils-BpqlKSeB.js";
|
|
5
5
|
import { t as n } from "./dist-tMzzRwxG.js";
|
|
6
6
|
import { Slot as r } from "./primitives/slot.js";
|
|
7
|
-
import { ErrorMessage as i } from "./
|
|
8
|
-
import { Children as a, isValidElement as o } from "react";
|
|
9
|
-
import { Fragment as
|
|
7
|
+
import { ErrorMessage as i } from "./FormFieldMessage.js";
|
|
8
|
+
import { Children as a, isValidElement as o, useId as s } from "react";
|
|
9
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
10
10
|
//#region src/components/Button/Button.tsx
|
|
11
|
-
var
|
|
11
|
+
var d = n("gap-2 rounded-lg font-semibold [&_svg]:size-4 relative flex cursor-pointer items-center justify-center border font-sans! whitespace-nowrap transition-colors focus:outline-none focus-visible:outline-1 focus-visible:outline-offset-2 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
12
12
|
variants: {
|
|
13
13
|
variant: {
|
|
14
14
|
primary: "border-button-primary-border bg-button-primary-bg text-button-primary-text hover:border-button-primary-border--hover hover:bg-button-primary-bg--hover hover:text-button-primary-text--hover focus-visible:outline-button-primary-border disabled:border-button-primary-border--disabled disabled:bg-button-primary-bg--disabled disabled:text-button-primary-text--disabled",
|
|
@@ -33,8 +33,8 @@ var u = n("gap-2 rounded-lg font-semibold [&_svg]:size-4 relative flex cursor-po
|
|
|
33
33
|
state: "default",
|
|
34
34
|
size: "default"
|
|
35
35
|
}
|
|
36
|
-
}),
|
|
37
|
-
let
|
|
36
|
+
}), f = ({ asChild: n = !1, children: f, className: p, dataTestId: m, disabled: h, endIcon: g, errorMessage: _, id: v, label: y, onClick: b, ref: x, size: S, startIcon: C, state: w, type: T = "button", variant: E = "primary", ...D }) => {
|
|
37
|
+
let O = {
|
|
38
38
|
error: {
|
|
39
39
|
primary: "bg-button-danger border-button-danger text-text-primary hover:bg-button-danger--hover hover:text-text-primary",
|
|
40
40
|
secondary: "bg-button-danger border-button-danger text-text-primary hover:bg-button-danger--hover hover:text-text-primary",
|
|
@@ -49,57 +49,58 @@ var u = n("gap-2 rounded-lg font-semibold [&_svg]:size-4 relative flex cursor-po
|
|
|
49
49
|
ghost: "bg-transparent text-button-ghost-text--disabled pointer-events-none",
|
|
50
50
|
unstyled: "bg-transparent opacity-50 pointer-events-none"
|
|
51
51
|
}
|
|
52
|
-
},
|
|
53
|
-
variant:
|
|
54
|
-
state:
|
|
55
|
-
size:
|
|
56
|
-
}),
|
|
57
|
-
if (!
|
|
58
|
-
let
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
return /* @__PURE__ */
|
|
62
|
-
className: t("flex flex-col justify-items-center",
|
|
63
|
-
children: [/* @__PURE__ */
|
|
64
|
-
"aria-disabled":
|
|
65
|
-
className: t(
|
|
66
|
-
"data-as-child":
|
|
67
|
-
"data-state":
|
|
68
|
-
"data-testid":
|
|
69
|
-
"data-variant":
|
|
70
|
-
disabled:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
52
|
+
}, k = t(d({
|
|
53
|
+
variant: E,
|
|
54
|
+
state: w,
|
|
55
|
+
size: S
|
|
56
|
+
}), w === "error" && O.error[E], w === "loading" && O.loading[E], p), A = s(), j = v ? `${v}-error` : `${A}-error`, M = n && o(f) && a.count(f) === 1, N = M ? void 0 : f ?? y, P = w === "error" && typeof _ == "string" ? _ : null, F = w === "error" && o(_) ? _ : null;
|
|
57
|
+
if (!M && !N) throw Error("Button requires either `label` or `children`");
|
|
58
|
+
let I = (e) => {
|
|
59
|
+
h && (e.preventDefault(), e.stopPropagation());
|
|
60
|
+
}, L = M ? r : "button";
|
|
61
|
+
return /* @__PURE__ */ u("div", {
|
|
62
|
+
className: t("flex flex-col justify-items-center", S),
|
|
63
|
+
children: [/* @__PURE__ */ l(L, {
|
|
64
|
+
"aria-disabled": h,
|
|
65
|
+
className: t(k, M && "no-underline! before:content-none after:content-none", M && h && "pointer-events-none opacity-50"),
|
|
66
|
+
"data-as-child": M ? "true" : void 0,
|
|
67
|
+
"data-state": w,
|
|
68
|
+
"data-testid": m ?? `spectral-button-${E}`,
|
|
69
|
+
"data-variant": E,
|
|
70
|
+
disabled: M ? void 0 : h,
|
|
71
|
+
id: v,
|
|
72
|
+
onClick: b,
|
|
73
|
+
onClickCapture: M ? I : void 0,
|
|
74
|
+
ref: x,
|
|
75
|
+
tabIndex: M && h ? -1 : void 0,
|
|
76
|
+
type: M ? void 0 : T,
|
|
77
|
+
...D,
|
|
78
|
+
children: M ? f : /* @__PURE__ */ u(c, { children: [
|
|
79
|
+
C && /* @__PURE__ */ l("span", {
|
|
80
|
+
className: t("flex", E !== "unstyled" && "pr-1"),
|
|
80
81
|
"aria-hidden": !0,
|
|
81
82
|
"data-testid": "spectral-button-start-icon",
|
|
82
|
-
children:
|
|
83
|
+
children: C
|
|
83
84
|
}),
|
|
84
|
-
|
|
85
|
+
w === "loading" && /* @__PURE__ */ l(e, {
|
|
85
86
|
className: "ml-2 motion-safe:animate-spin",
|
|
86
87
|
size: 16
|
|
87
88
|
}),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
className: t("flex",
|
|
89
|
+
N,
|
|
90
|
+
g && w !== "loading" && /* @__PURE__ */ l("span", {
|
|
91
|
+
className: t("flex", E !== "unstyled" && "pl-2"),
|
|
91
92
|
"aria-hidden": !0,
|
|
92
93
|
"data-testid": "spectral-button-end-icon",
|
|
93
|
-
children:
|
|
94
|
+
children: g
|
|
94
95
|
})
|
|
95
96
|
] })
|
|
96
|
-
}),
|
|
97
|
-
message: g,
|
|
97
|
+
}), F ?? /* @__PURE__ */ l(i, {
|
|
98
98
|
dataTestId: "spectral-button-error-message",
|
|
99
|
-
id:
|
|
99
|
+
id: j,
|
|
100
|
+
message: P
|
|
100
101
|
})]
|
|
101
102
|
});
|
|
102
103
|
};
|
|
103
|
-
|
|
104
|
+
f.displayName = "Button";
|
|
104
105
|
//#endregion
|
|
105
|
-
export {
|
|
106
|
+
export { f as Button };
|
package/dist/Checkbox.js
CHANGED
|
@@ -3,7 +3,8 @@ import './styles/main.css'
|
|
|
3
3
|
import { CheckmarkIcon as e } from "./Icons/CheckmarkIcon.js";
|
|
4
4
|
import { MinusIcon as t } from "./Icons/MinusIcon.js";
|
|
5
5
|
import { t as n } from "./twUtils-BpqlKSeB.js";
|
|
6
|
-
import { ErrorMessage as r, WarningMessage as i
|
|
6
|
+
import { ErrorMessage as r, WarningMessage as i } from "./FormFieldMessage.js";
|
|
7
|
+
import { useFormFieldId as a } from "./utils/formFieldUtils.js";
|
|
7
8
|
import { CheckboxBase as o, CheckboxIndicator as s } from "./Checkbox/CheckboxBase.js";
|
|
8
9
|
import "react";
|
|
9
10
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
@@ -46,15 +47,15 @@ var u = ({ checked: u, className: d, errorMessage: f, id: p, label: m, labelText
|
|
|
46
47
|
children: T
|
|
47
48
|
})]
|
|
48
49
|
}),
|
|
49
|
-
|
|
50
|
+
/* @__PURE__ */ c(r, {
|
|
50
51
|
dataTestId: "spectral-checkbox-error-message",
|
|
51
52
|
id: E,
|
|
52
|
-
message: f
|
|
53
|
+
message: y === "error" ? f : null
|
|
53
54
|
}),
|
|
54
|
-
|
|
55
|
+
/* @__PURE__ */ c(i, {
|
|
55
56
|
dataTestId: "spectral-checkbox-warning-message",
|
|
56
57
|
id: D,
|
|
57
|
-
message: b
|
|
58
|
+
message: y === "warning" ? b : null
|
|
58
59
|
})
|
|
59
60
|
] });
|
|
60
61
|
};
|
|
@@ -5,7 +5,8 @@ import { CheckmarkIcon as n } from "./Icons/CheckmarkIcon.js";
|
|
|
5
5
|
import { ChevronDownIcon as r } from "./Icons/ChevronDownIcon.js";
|
|
6
6
|
import { LoaderIcon as i } from "./Icons/LoaderIcon.js";
|
|
7
7
|
import { t as a } from "./twUtils-BpqlKSeB.js";
|
|
8
|
-
import {
|
|
8
|
+
import { ErrorMessage as o, WarningMessage as s } from "./FormFieldMessage.js";
|
|
9
|
+
import { EmptyState as c, LoadingState as l, getAriaProps as u, getDropdownSurfaceClasses as d, getDropdownWidthStyles as f, getErrorMessageId as p, getFormFieldCSSProperties as m, getOptionClasses as h, getTriggerClasses as g, useFormFieldId as _ } from "./utils/formFieldUtils.js";
|
|
9
10
|
import { useUncontrolledState as v } from "./hooks/useUncontrolledState.js";
|
|
10
11
|
import { Label as y } from "./Label.js";
|
|
11
12
|
import { InputGroup as b, InputGroupAddon as x } from "./primitives/input-group.js";
|
|
@@ -6286,7 +6287,7 @@ var Ic = ({ className: e, disabled: t, defaultValue: S = "", dropdownWidth: C =
|
|
|
6286
6287
|
onClick: (e) => {
|
|
6287
6288
|
if (fe || pe) return;
|
|
6288
6289
|
let t = e.target;
|
|
6289
|
-
t !== ve.current && (t.closest("[data-slot=combobox-trigger-button]") ||
|
|
6290
|
+
t !== ve.current && (t.closest("[data-slot=combobox-trigger-button]") || (ve.current?.focus(), V(!0)));
|
|
6290
6291
|
},
|
|
6291
6292
|
style: m()
|
|
6292
6293
|
}),
|
|
@@ -6335,12 +6336,12 @@ var Ic = ({ className: e, disabled: t, defaultValue: S = "", dropdownWidth: C =
|
|
|
6335
6336
|
className: "isolate z-50",
|
|
6336
6337
|
sideOffset: 4,
|
|
6337
6338
|
children: /* @__PURE__ */ O(Dc, {
|
|
6338
|
-
className: a("p-1 z-50 motion-safe:data-closed:animate-out motion-safe:data-open:animate-in", d(), "motion-safe:data-closed:fade-out-0 motion-safe:data-closed:zoom-out-95 motion-safe:data-open:fade-in-0 motion-safe:data-open:zoom-in-95", "max-h-[min(var(--available-height),18rem)] motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=top]:slide-in-from-bottom-2", "min-w-32 origin-(--transform-origin) overflow-
|
|
6339
|
+
className: a("p-1 z-50 motion-safe:data-closed:animate-out motion-safe:data-open:animate-in", d(), "motion-safe:data-closed:fade-out-0 motion-safe:data-closed:zoom-out-95 motion-safe:data-open:fade-in-0 motion-safe:data-open:zoom-in-95", "max-h-[min(var(--available-height),18rem)] motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=top]:slide-in-from-bottom-2", "min-w-32 origin-(--transform-origin) overflow-hidden"),
|
|
6339
6340
|
"data-dropdown-width-mode": Te,
|
|
6340
6341
|
"data-dropdown-width-value": Te === "custom" ? C : void 0,
|
|
6341
6342
|
"data-testid": "spectral-combobox-content",
|
|
6342
6343
|
style: Ee,
|
|
6343
|
-
children: pe ? /* @__PURE__ */ O(
|
|
6344
|
+
children: pe ? /* @__PURE__ */ O(l, { message: N }) : Ce.length === 0 ? /* @__PURE__ */ O(c, { message: w }) : /* @__PURE__ */ O(lc, {
|
|
6344
6345
|
className: "max-h-[min(var(--available-height),18rem)] overflow-y-auto",
|
|
6345
6346
|
id: le,
|
|
6346
6347
|
children: Ce.map((e) => /* @__PURE__ */ k(Mc, {
|
|
@@ -6360,15 +6361,15 @@ var Ic = ({ className: e, disabled: t, defaultValue: S = "", dropdownWidth: C =
|
|
|
6360
6361
|
})
|
|
6361
6362
|
}) })]
|
|
6362
6363
|
}),
|
|
6363
|
-
|
|
6364
|
+
/* @__PURE__ */ O(o, {
|
|
6364
6365
|
dataTestId: "spectral-combobox-error-message",
|
|
6365
6366
|
id: z,
|
|
6366
|
-
message: D
|
|
6367
|
+
message: B ? D ?? null : null
|
|
6367
6368
|
}),
|
|
6368
|
-
|
|
6369
|
+
/* @__PURE__ */ O(s, {
|
|
6369
6370
|
dataTestId: "spectral-combobox-warning-message",
|
|
6370
6371
|
id: ue,
|
|
6371
|
-
message: ae
|
|
6372
|
+
message: R === "warning" ? ae ?? null : null
|
|
6372
6373
|
})
|
|
6373
6374
|
]
|
|
6374
6375
|
});
|
package/dist/Combobox.js
CHANGED
|
@@ -28,6 +28,8 @@ type ControlGroupSelectBaseProps = ComponentProps<typeof Select> & Pick<ControlG
|
|
|
28
28
|
dropdownWidth?: DropdownWidth;
|
|
29
29
|
errorMessage?: string | string[] | Record<string, unknown> | null;
|
|
30
30
|
id?: string;
|
|
31
|
+
/** Class applied to the input `ControlGroupItem` segment for width/split composition. */
|
|
32
|
+
inputItemClassName?: string;
|
|
31
33
|
/** When `captionLayout` is `inline`, overrides the input's accessible name (defaults to `inputPlaceholder` when set). */
|
|
32
34
|
inputAriaLabel?: string;
|
|
33
35
|
inputPlaceholder?: string;
|
|
@@ -36,12 +38,14 @@ type ControlGroupSelectBaseProps = ComponentProps<typeof Select> & Pick<ControlG
|
|
|
36
38
|
selectPlaceholder?: string;
|
|
37
39
|
/** When `captionLayout` is `inline` and `selectPlaceholder` is empty, sets the select trigger's accessible name. */
|
|
38
40
|
selectAriaLabel?: string;
|
|
41
|
+
/** Class applied to the select `ControlGroupItem` segment for width/split composition. */
|
|
42
|
+
selectItemClassName?: string;
|
|
39
43
|
selectOptions: SelectOptionType[];
|
|
40
44
|
state?: Exclude<FormFieldState, 'disabled'>;
|
|
41
45
|
type?: 'number' | 'text';
|
|
42
46
|
warningMessage?: string | string[] | Record<string, unknown> | null;
|
|
43
47
|
};
|
|
44
48
|
export type ControlGroupSelectProps = ControlGroupSelectBaseProps & ControlGroupSelectInputControlProps;
|
|
45
|
-
export declare const ControlGroupSelect: ({ amountStep, ariaLabel, captionLayout, className, dataTestId, disabled, errorMessage, id, dropdownWidth, inputAriaLabel, inputPlaceholder, inputValue, maxAmount, minAmount, onInputChange, orientation, selectAriaLabel, selectOptions, selectPlaceholder, state, type, warningMessage, ...selectProps }: ControlGroupSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export declare const ControlGroupSelect: ({ amountStep, ariaLabel, captionLayout, className, dataTestId, disabled, errorMessage, id, dropdownWidth, inputAriaLabel, inputPlaceholder, inputItemClassName, inputValue, maxAmount, minAmount, onInputChange, orientation, selectAriaLabel, selectItemClassName, selectOptions, selectPlaceholder, state, type, warningMessage, ...selectProps }: ControlGroupSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
50
|
export {};
|
|
47
51
|
//# sourceMappingURL=ControlGroupSelect.d.ts.map
|
|
@@ -4,119 +4,125 @@ import { t as e } from "../twUtils-BpqlKSeB.js";
|
|
|
4
4
|
import { getStateClasses as t } from "../utils/formFieldUtils.js";
|
|
5
5
|
import { Label as n } from "../Label.js";
|
|
6
6
|
import { Input as r } from "../primitives/input.js";
|
|
7
|
-
import { i, l as a, n as o, t as s, u as c } from "../select-
|
|
7
|
+
import { i, l as a, n as o, t as s, u as c } from "../select-DFE8xm1L.js";
|
|
8
8
|
import { ControlGroup as l, ControlGroupItem as u, useControlGroup as d } from "../ControlGroup.js";
|
|
9
9
|
import { useId as f } from "react";
|
|
10
10
|
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
11
11
|
//#region src/components/ControlGroup/ControlGroupSelect.tsx
|
|
12
|
-
var g = "
|
|
12
|
+
var g = "[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", _ = "Amount", v = "Select an option", y = "flex w-full min-w-0 flex-col gap-1.5", b = "h-12! min-h-12! border-2! border-input-border bg-input-bg text-base text-input-text transition duration-200 placeholder:text-input-text-placeholder hover:border-input-border--hover focus-visible:border-input-border--focus focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-input-border--focus disabled:pointer-events-none disabled:border-input-border--disabled disabled:bg-input-bg--disabled disabled:text-input-text--disabled", x = (e, t = 0) => {
|
|
13
13
|
let n = e?.trim();
|
|
14
14
|
if (n) return `${Math.max(n.length + t, 8)}ch`;
|
|
15
15
|
}, S = (e, t) => {
|
|
16
16
|
let n = e?.trim();
|
|
17
17
|
return n && n.length > 0 ? n : t;
|
|
18
|
-
}, C = ({ amountStep: e, ariaLabel: t, captionLayout: n = "inline", className: r, dataTestId: i = "spectral-control-group-select", disabled: a, errorMessage: o, id: s, dropdownWidth: c = "trigger", inputAriaLabel: u, inputPlaceholder: d,
|
|
19
|
-
let
|
|
18
|
+
}, C = ({ amountStep: e, ariaLabel: t, captionLayout: n = "inline", className: r, dataTestId: i = "spectral-control-group-select", disabled: a, errorMessage: o, id: s, dropdownWidth: c = "trigger", inputAriaLabel: u, inputPlaceholder: d, inputItemClassName: p, inputValue: h, maxAmount: g = 1e6, minAmount: y = 0, onInputChange: b, orientation: C = "horizontal", selectAriaLabel: T, selectItemClassName: E, selectOptions: D, selectPlaceholder: O, state: k = "default", type: A = "number", warningMessage: j, ...M }) => {
|
|
19
|
+
let N = f(), P = s ?? N, F = `${P}-amount`, I = `${P}-select`, L = `${F}-label`, R = `${I}-label`, z = n === "above", B = z ? void 0 : d, V = z ? void 0 : O, H = S(d, _), U = S(O, v), W = u ?? (z ? void 0 : H), G = T ?? (z ? void 0 : U), K = x(d, 3), q = x(O, 5), J = t ?? `${H} and ${U}`, Y = !!a, X = h !== void 0 && b !== void 0;
|
|
20
20
|
return /* @__PURE__ */ m(l, {
|
|
21
|
-
"aria-label":
|
|
21
|
+
"aria-label": J,
|
|
22
22
|
className: r,
|
|
23
23
|
"data-testid": i,
|
|
24
24
|
disabled: a,
|
|
25
25
|
errorMessage: o,
|
|
26
|
-
id:
|
|
27
|
-
orientation:
|
|
28
|
-
state:
|
|
29
|
-
warningMessage:
|
|
26
|
+
id: P,
|
|
27
|
+
orientation: C,
|
|
28
|
+
state: k,
|
|
29
|
+
warningMessage: j,
|
|
30
30
|
children: /* @__PURE__ */ m(w, {
|
|
31
31
|
amountStep: e,
|
|
32
32
|
dataTestId: i,
|
|
33
|
-
inputAccessibleName:
|
|
34
|
-
inputCaption:
|
|
35
|
-
inputId:
|
|
36
|
-
inputLabelId:
|
|
37
|
-
inputLabelText:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
inputAccessibleName: W,
|
|
34
|
+
inputCaption: B,
|
|
35
|
+
inputId: F,
|
|
36
|
+
inputLabelId: L,
|
|
37
|
+
inputLabelText: H,
|
|
38
|
+
inputItemClassName: p,
|
|
39
|
+
inputMinWidth: K,
|
|
40
|
+
inputValue: X ? h : void 0,
|
|
41
|
+
isDisabled: Y,
|
|
42
|
+
maxAmount: g,
|
|
43
|
+
minAmount: y,
|
|
44
|
+
onInputChange: X ? b : void 0,
|
|
44
45
|
dropdownWidth: c,
|
|
45
|
-
selectCaption:
|
|
46
|
-
selectOptions:
|
|
47
|
-
selectLabelId:
|
|
48
|
-
selectLabelText:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
selectCaption: V,
|
|
47
|
+
selectOptions: D,
|
|
48
|
+
selectLabelId: R,
|
|
49
|
+
selectLabelText: U,
|
|
50
|
+
selectItemClassName: E,
|
|
51
|
+
selectProps: M,
|
|
52
|
+
selectTriggerAriaLabel: G,
|
|
53
|
+
selectTriggerId: I,
|
|
54
|
+
selectTriggerMinWidth: q,
|
|
55
|
+
type: A,
|
|
56
|
+
useAboveLabels: z
|
|
55
57
|
})
|
|
56
58
|
});
|
|
57
|
-
}, w = ({ amountStep: l, dataTestId: f, dropdownWidth: _, inputAccessibleName: v, inputCaption: x, inputId: S, inputLabelId: C, inputLabelText: w,
|
|
58
|
-
let { messageId:
|
|
59
|
-
|
|
59
|
+
}, w = ({ amountStep: l, dataTestId: f, dropdownWidth: _, inputAccessibleName: v, inputCaption: x, inputId: S, inputLabelId: C, inputLabelText: w, inputItemClassName: T, inputMinWidth: E, inputValue: D, isDisabled: O, maxAmount: k, minAmount: A, onInputChange: j, selectCaption: M, selectLabelId: N, selectLabelText: P, selectItemClassName: F, selectOptions: I, selectProps: L, selectTriggerAriaLabel: R, selectTriggerId: z, selectTriggerMinWidth: B, type: V, useAboveLabels: H }) => {
|
|
60
|
+
let { messageId: U, orientation: W, state: G } = d(), K = L.open !== void 0, q = (e) => {
|
|
61
|
+
L.onOpenChange?.(e);
|
|
62
|
+
}, J = W === "horizontal" ? "rounded-s-md rounded-e-none" : "rounded-ss-md rounded-se-md rounded-es-none rounded-ee-none", Y = W === "horizontal" ? "rounded-s-none rounded-e-md" : "rounded-ss-none rounded-se-none rounded-es-md rounded-ee-md", X = W === "horizontal" ? "me-0" : "mbe-0", Z = W === "horizontal" ? "me-0 [&>*:last-child]:-ms-0.5" : "mbe-0 [&>*:last-child]:-mt-0.5", Q = /* @__PURE__ */ m(r, {
|
|
63
|
+
"aria-describedby": U,
|
|
60
64
|
"aria-label": v,
|
|
61
|
-
"aria-labelledby":
|
|
62
|
-
className: e(b,
|
|
65
|
+
"aria-labelledby": H ? C : void 0,
|
|
66
|
+
className: e(b, J, t(G), V === "number" && g, V === "number" && "tabular-nums"),
|
|
63
67
|
"data-testid": `${f}-input`,
|
|
64
|
-
disabled:
|
|
65
|
-
id:
|
|
66
|
-
type:
|
|
68
|
+
disabled: O,
|
|
69
|
+
id: H ? S : void 0,
|
|
70
|
+
type: V === "number" ? "number" : "text",
|
|
67
71
|
placeholder: x,
|
|
68
|
-
style:
|
|
69
|
-
min:
|
|
70
|
-
max:
|
|
71
|
-
...
|
|
72
|
-
value:
|
|
73
|
-
onChange:
|
|
72
|
+
style: E ? { minWidth: E } : void 0,
|
|
73
|
+
min: A ?? 0,
|
|
74
|
+
max: k ?? 1e6,
|
|
75
|
+
...D !== void 0 && j !== void 0 ? {
|
|
76
|
+
value: D,
|
|
77
|
+
onChange: j
|
|
74
78
|
} : {},
|
|
75
79
|
step: l ?? 1
|
|
76
|
-
}),
|
|
77
|
-
"aria-describedby":
|
|
78
|
-
"aria-label":
|
|
79
|
-
"aria-labelledby":
|
|
80
|
-
className: e(
|
|
80
|
+
}), $ = /* @__PURE__ */ m(a, {
|
|
81
|
+
"aria-describedby": U,
|
|
82
|
+
"aria-label": R,
|
|
83
|
+
"aria-labelledby": H ? N : void 0,
|
|
84
|
+
className: e("text-input-text data-placeholder:text-input-text-placeholder!", Y, "px-4 w-full justify-between focus-visible:border-input-border--focus focus-visible:ring-0 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-input-border--focus", t(G)),
|
|
81
85
|
"data-testid": `${f}-select-trigger`,
|
|
82
|
-
disabled:
|
|
83
|
-
id:
|
|
84
|
-
style:
|
|
86
|
+
disabled: O,
|
|
87
|
+
id: H ? z : void 0,
|
|
88
|
+
style: B ? { minWidth: B } : void 0,
|
|
85
89
|
children: /* @__PURE__ */ m(c, {
|
|
86
90
|
className: "min-w-0 block max-w-full truncate text-left whitespace-nowrap text-input-text! data-placeholder:text-input-text-placeholder!",
|
|
87
|
-
placeholder:
|
|
91
|
+
placeholder: M
|
|
88
92
|
})
|
|
89
93
|
});
|
|
90
94
|
return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(u, {
|
|
91
|
-
className:
|
|
92
|
-
children:
|
|
95
|
+
className: e(H ? X : void 0, T),
|
|
96
|
+
children: H ? /* @__PURE__ */ h("div", {
|
|
93
97
|
className: y,
|
|
94
98
|
children: [/* @__PURE__ */ m(n, {
|
|
95
99
|
className: "text-text-primary",
|
|
96
100
|
htmlFor: S,
|
|
97
101
|
id: C,
|
|
98
102
|
children: w
|
|
99
|
-
}),
|
|
100
|
-
}) :
|
|
103
|
+
}), Q]
|
|
104
|
+
}) : Q
|
|
101
105
|
}), /* @__PURE__ */ h(s, {
|
|
106
|
+
...L,
|
|
102
107
|
"data-testid": `${f}-select-root`,
|
|
103
|
-
disabled:
|
|
104
|
-
...
|
|
108
|
+
disabled: O,
|
|
109
|
+
...K ? { open: L.open } : {},
|
|
110
|
+
onOpenChange: q,
|
|
105
111
|
children: [/* @__PURE__ */ m(u, {
|
|
106
|
-
className:
|
|
107
|
-
children:
|
|
112
|
+
className: e(H ? Z : void 0, F),
|
|
113
|
+
children: H ? /* @__PURE__ */ h("div", {
|
|
108
114
|
className: y,
|
|
109
115
|
children: [/* @__PURE__ */ m(n, {
|
|
110
116
|
className: "text-text-primary",
|
|
111
|
-
htmlFor:
|
|
112
|
-
id:
|
|
113
|
-
children:
|
|
114
|
-
}),
|
|
115
|
-
}) :
|
|
117
|
+
htmlFor: z,
|
|
118
|
+
id: N,
|
|
119
|
+
children: P
|
|
120
|
+
}), $]
|
|
121
|
+
}) : $
|
|
116
122
|
}), /* @__PURE__ */ m(o, {
|
|
117
123
|
"data-testid": `${f}-select-content`,
|
|
118
124
|
dropdownWidth: _,
|
|
119
|
-
children:
|
|
125
|
+
children: I.map((e) => /* @__PURE__ */ m(i, {
|
|
120
126
|
disabled: e.disabled,
|
|
121
127
|
value: e.value,
|
|
122
128
|
children: e.label
|