@spear-ai/spectral 1.11.3 → 1.12.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/README.md +4 -0
- package/dist/.js +124 -121
- package/dist/{Accordion-CDXdSAST.js → Accordion-Cyrb2byI.js} +1 -1
- package/dist/Accordion.js +1 -1
- package/dist/Alert/AlertBase.js +1 -1
- package/dist/Alert.js +3 -3
- package/dist/{AnimatePresence-D-9jXfgI.js → AnimatePresence-D9FLxIGV.js} +1 -1
- package/dist/Avatar.js +46 -48
- package/dist/Badge.js +1 -1
- package/dist/Button.js +1 -1
- package/dist/ButtonGroup/ButtonGroupButton.js +1 -1
- package/dist/ButtonGroup.js +1 -1
- package/dist/ButtonIcon.js +1 -1
- package/dist/{Calendar-s4lyijkn.js → Calendar-Cnh_PTbQ.js} +4 -4
- package/dist/Checkbox/CheckboxBase.js +1 -1
- package/dist/Checkbox.d.ts +10 -3
- package/dist/Checkbox.js +55 -35
- package/dist/Combobox/ComboboxBase.js +1 -1
- package/dist/Combobox.d.ts +5 -3
- package/dist/Combobox.js +64 -70
- package/dist/{ComboboxBase-qX-mQhT6.js → ComboboxBase-BzDGK36x.js} +1 -1
- package/dist/ControlGroup/ControlGroupSelect.d.ts +5 -2
- package/dist/ControlGroup/ControlGroupSelect.js +32 -29
- package/dist/ControlGroup.d.ts +3 -2
- package/dist/ControlGroup.js +41 -33
- package/dist/DataCard/Card.js +1 -1
- package/dist/DataCard.js +1 -1
- package/dist/DateTimePicker/Calendar.js +1 -1
- package/dist/DateTimePicker/DateTimeDisplayInput.js +84 -83
- package/dist/DateTimePicker/DateTimeInput.js +2 -2
- package/dist/DateTimePicker/DateTimeUtils.js +1 -1
- package/dist/DateTimePicker/TimePeriodSelect.js +32 -35
- package/dist/DateTimePicker/TimePicker.js +2 -2
- package/dist/DateTimePicker.d.ts +1 -1
- package/dist/DateTimePicker.js +55 -52
- package/dist/{DateTimeUtils-DVvG6H-p.js → DateTimeUtils-BJUAMuot.js} +1 -1
- package/dist/Dialog.js +1 -1
- package/dist/DropdownMenu.d.ts +61 -0
- package/dist/DropdownMenu.js +869 -0
- package/dist/{HoverCard-CYDsIiVK.js → HoverCard-DERasp0v.js} +1 -1
- package/dist/HoverCard.js +1 -1
- package/dist/Icons/AdjustmentsIcon.d.ts +5 -0
- package/dist/Icons/AdjustmentsIcon.js +78 -0
- package/dist/Icons/MenuDotsIcon.d.ts +5 -0
- package/dist/Icons/MenuDotsIcon.js +36 -0
- package/dist/Icons/MenuIcon.d.ts +5 -0
- package/dist/Icons/MenuIcon.js +36 -0
- package/dist/Icons/index.d.ts +3 -0
- package/dist/Icons.js +81 -78
- package/dist/IconsAnimated/PanelLeftCloseIcon.js +3 -3
- package/dist/IconsAnimated/PanelLeftOpenIcon.js +3 -3
- package/dist/Input.js +1 -1
- package/dist/InputNumeric.js +1 -1
- package/dist/{InputOTP-cVn5Bzyp.js → InputOTP-BkSw_KIB.js} +12 -10
- package/dist/InputOTP.js +1 -1
- package/dist/Kbd.js +1 -1
- package/dist/Label.js +1 -1
- package/dist/MultiSelect/MultiSelectBase.d.ts +6 -4
- package/dist/MultiSelect/MultiSelectBase.js +222 -201
- package/dist/MultiSelect.d.ts +2 -1
- package/dist/MultiSelect.js +14 -12
- package/dist/Popover.js +1 -1
- package/dist/RadioButton.js +1 -1
- package/dist/RadioButtonGroup/RadioButtonGroupBase.js +1 -1
- package/dist/RadioButtonGroup.js +1 -1
- package/dist/RadioGroup-DqKggFnI.js +328 -0
- package/dist/RadioGroup.d.ts +7 -0
- package/dist/RadioGroup.js +1 -1
- package/dist/Select.d.ts +5 -2
- package/dist/Select.js +98 -86
- package/dist/Separator.js +1 -1
- package/dist/Skeleton.js +1 -1
- package/dist/{Slider-BzzZT3Zm.js → Slider-CfUFkWU4.js} +1 -1
- package/dist/Slider.js +1 -1
- package/dist/Switch-Wj_zov--.js +144 -0
- package/dist/Switch.d.ts +12 -3
- package/dist/Switch.js +1 -1
- package/dist/Tabs/TabsBase.js +4 -4
- package/dist/Tabs.js +1 -1
- package/dist/Textarea.d.ts +3 -2
- package/dist/Textarea.js +50 -45
- package/dist/{Toast-9zqXxKKO.js → Toast-CJvzLlMD.js} +1 -1
- package/dist/Toast.js +1 -1
- package/dist/Toggle.js +1 -1
- package/dist/ToggleGroup.js +1 -1
- package/dist/{Tooltip-D1K8kY1y.js → Tooltip-BR0tdif4.js} +2 -2
- package/dist/Tooltip.js +1 -1
- package/dist/Tray.js +4 -4
- package/dist/{chunk-h9knIhTc.js → chunk-C4rFPcKS.js} +1 -1
- package/dist/dist-DcUGLq_y.js +149 -0
- package/dist/main.js +1 -1
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/input-group.js +1 -1
- package/dist/primitives/input.js +1 -1
- package/dist/primitives/popover.js +1 -1
- package/dist/primitives/select.js +13 -13
- package/dist/primitives/textarea.js +1 -1
- package/dist/{proxy-Dn10Pl_g.js → proxy-CCB7C4Pu.js} +10 -10
- package/dist/styles/spectral.css +1 -1
- package/dist/{twUtils-VNWgstKL.js → twUtils-D_qzdiwM.js} +1 -1
- package/dist/{use-animation-CBUDycyW.js → use-animation-C-qL83hj.js} +1 -1
- package/dist/utils/formFieldUtils.d.ts +15 -1
- package/dist/utils/formFieldUtils.d.ts.map +1 -1
- package/dist/utils/formFieldUtils.js +35 -19
- package/dist/utils/twUtils.js +1 -1
- package/package.json +26 -22
- package/dist/RadioGroup-w_q6RGEK.js +0 -447
- package/dist/Switch-CVzRJ-0n.js +0 -126
- /package/dist/{dist-B4FgboI8.js → dist-Cujfuel1.js} +0 -0
package/dist/Checkbox.js
CHANGED
|
@@ -1,42 +1,62 @@
|
|
|
1
1
|
import "./styles/main.css";
|
|
2
2
|
import { CheckmarkIcon as e } from "./Icons/CheckmarkIcon.js";
|
|
3
3
|
import { MinusIcon as t } from "./Icons/MinusIcon.js";
|
|
4
|
-
import { t as n } from "./twUtils-
|
|
5
|
-
import {
|
|
4
|
+
import { t as n } from "./twUtils-D_qzdiwM.js";
|
|
5
|
+
import { ErrorMessage as r, WarningMessage as i, useFormFieldId as a } from "./utils/formFieldUtils.js";
|
|
6
|
+
import { CheckboxBase as o, CheckboxIndicator as s } from "./Checkbox/CheckboxBase.js";
|
|
6
7
|
import "react";
|
|
7
|
-
import { jsx as
|
|
8
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
9
|
//#region src/components/Checkbox/Checkbox.tsx
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
10
|
+
var u = ({ checked: u, className: d, errorMessage: f, id: p, label: m, labelText: h, onCheckedChange: g, ref: _, required: v, state: y = "default", warningMessage: b, "aria-describedby": x, "aria-label": S, ...C }) => {
|
|
11
|
+
let w = a(p, C.name), T = h ?? m, E = `${w}-error`, D = `${w}-warning`;
|
|
12
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
13
|
+
/* @__PURE__ */ l("div", {
|
|
14
|
+
className: "gap-2 flex items-center",
|
|
15
|
+
children: [/* @__PURE__ */ c(o, {
|
|
16
|
+
"aria-describedby": [y === "error" && f && E ? E : y === "warning" && b && D ? D : void 0, x].filter(Boolean).join(" ") || void 0,
|
|
17
|
+
"aria-invalid": y === "error" ? !0 : void 0,
|
|
18
|
+
"aria-label": S ?? (T ? void 0 : "Checkbox"),
|
|
19
|
+
"aria-required": v ?? void 0,
|
|
20
|
+
checked: u,
|
|
21
|
+
className: n("checkbox peer h-5 w-5 rounded-sm shrink-0 border border-checkbox-border hover:opacity-80 focus:outline-none focus-visible:outline-1 focus-visible:outline-checkbox-border--focus", "focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-checkbox-border--checked", d),
|
|
22
|
+
"data-field-state": y,
|
|
23
|
+
"data-testid": "spectral-checkbox",
|
|
24
|
+
id: w,
|
|
25
|
+
onCheckedChange: g,
|
|
26
|
+
ref: _,
|
|
27
|
+
...C,
|
|
28
|
+
children: /* @__PURE__ */ c(s, {
|
|
29
|
+
"data-testid": "spectral-checkbox-indicator",
|
|
30
|
+
className: n("checkbox-indicator flex items-center justify-center text-checkbox-indicator--checked"),
|
|
31
|
+
children: u === "indeterminate" ? /* @__PURE__ */ c(t, {
|
|
32
|
+
className: "checkbox-indeterminate",
|
|
33
|
+
size: 16,
|
|
34
|
+
strokeWidth: 4
|
|
35
|
+
}) : /* @__PURE__ */ c(e, {
|
|
36
|
+
className: "checkbox-check",
|
|
37
|
+
size: 16,
|
|
38
|
+
strokeWidth: 4
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
}), T && /* @__PURE__ */ c("label", {
|
|
42
|
+
className: "text-md peer-disabled:text-neutral-400 text-text-primary",
|
|
43
|
+
"data-testid": "spectral-checkbox-label",
|
|
44
|
+
htmlFor: w,
|
|
45
|
+
children: T
|
|
46
|
+
})]
|
|
47
|
+
}),
|
|
48
|
+
y === "error" && f && E && /* @__PURE__ */ c(r, {
|
|
49
|
+
dataTestId: "spectral-checkbox-error-message",
|
|
50
|
+
id: E,
|
|
51
|
+
message: f
|
|
52
|
+
}),
|
|
53
|
+
y === "warning" && b && D && /* @__PURE__ */ c(i, {
|
|
54
|
+
dataTestId: "spectral-checkbox-warning-message",
|
|
55
|
+
id: D,
|
|
56
|
+
message: b
|
|
32
57
|
})
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
htmlFor: l,
|
|
37
|
-
children: u
|
|
38
|
-
})]
|
|
39
|
-
});
|
|
40
|
-
s.displayName = "Checkbox";
|
|
58
|
+
] });
|
|
59
|
+
};
|
|
60
|
+
u.displayName = "Checkbox";
|
|
41
61
|
//#endregion
|
|
42
|
-
export {
|
|
62
|
+
export { u as Checkbox };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "../primitives/input-group.js";
|
|
2
|
-
import { a as e, i as t, n, r, t as i } from "../ComboboxBase-
|
|
2
|
+
import { a as e, i as t, n, r, t as i } from "../ComboboxBase-BzDGK36x.js";
|
|
3
3
|
export { i as ComboboxBase, n as CommandEmpty, r as CommandInput, t as CommandItem, e as CommandList };
|
package/dist/Combobox.d.ts
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { BaseFormFieldProps, BaseOption, DropdownWidth } from './utils/formFieldUtils';
|
|
1
|
+
import { BaseFormFieldProps, BaseOption, DropdownWidth, FormFieldState } from './utils/formFieldUtils';
|
|
2
2
|
import { Ref } from 'react';
|
|
3
3
|
export type ComboboxOption = BaseOption;
|
|
4
|
-
export interface ComboboxProps extends Omit<BaseFormFieldProps, 'onChange'> {
|
|
4
|
+
export interface ComboboxProps extends Omit<BaseFormFieldProps, 'onChange' | 'state'> {
|
|
5
5
|
className?: string;
|
|
6
6
|
defaultValue?: string;
|
|
7
7
|
dropdownWidth?: DropdownWidth;
|
|
8
8
|
emptyMessage?: string;
|
|
9
9
|
labelClassName?: string;
|
|
10
10
|
loadingMessage?: string;
|
|
11
|
+
onChange?: (value: string) => void;
|
|
11
12
|
onValueChange?: (value: string) => void;
|
|
12
13
|
options: ComboboxOption[];
|
|
13
14
|
placeholder?: string;
|
|
15
|
+
state?: Exclude<FormFieldState, 'disabled'>;
|
|
14
16
|
value?: string;
|
|
15
17
|
warningMessage?: BaseFormFieldProps['errorMessage'];
|
|
16
18
|
}
|
|
17
19
|
export declare const Combobox: {
|
|
18
|
-
({ className, disabled, defaultValue, dropdownWidth, emptyMessage, errorMessage, id, label, labelClassName, loadingMessage, name, onValueChange, options, placeholder, ref, required, state, value: valueProp, warningMessage, "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, }: ComboboxProps & {
|
|
20
|
+
({ className, disabled, defaultValue, dropdownWidth, emptyMessage, errorMessage, id, label, labelClassName, loadingMessage, name, onChange, onValueChange, options, placeholder, ref, required, state, value: valueProp, warningMessage, "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, }: ComboboxProps & {
|
|
19
21
|
ref?: Ref<HTMLDivElement>;
|
|
20
22
|
}): import("react/jsx-runtime").JSX.Element;
|
|
21
23
|
displayName: string;
|
package/dist/Combobox.js
CHANGED
|
@@ -2,56 +2,50 @@
|
|
|
2
2
|
import "./styles/main.css";
|
|
3
3
|
import { ChevronDownIcon as e } from "./Icons/ChevronDownIcon.js";
|
|
4
4
|
import { LoaderIcon as t } from "./Icons/LoaderIcon.js";
|
|
5
|
-
import { t as n } from "./twUtils-
|
|
6
|
-
import { EmptyState as ee, ErrorMessage as
|
|
7
|
-
import { useUncontrolledState as
|
|
8
|
-
import { Label as
|
|
9
|
-
import { InputGroup as
|
|
10
|
-
import { useAutoDropdownHorizontalShift as
|
|
11
|
-
import { a as
|
|
5
|
+
import { t as n } from "./twUtils-D_qzdiwM.js";
|
|
6
|
+
import { EmptyState as ee, ErrorMessage as r, LoadingState as i, WarningMessage as a, getAriaProps as o, getDropdownSurfaceClasses as s, getDropdownWidthStyles as c, getErrorMessageId as l, getFormFieldCSSProperties as u, getOptionClasses as d, getTriggerClasses as f, useFormFieldId as te } from "./utils/formFieldUtils.js";
|
|
7
|
+
import { useUncontrolledState as ne } from "./hooks/useUncontrolledState.js";
|
|
8
|
+
import { Label as re } from "./Label.js";
|
|
9
|
+
import { InputGroup as ie, InputGroupAddon as ae } from "./primitives/input-group.js";
|
|
10
|
+
import { useAutoDropdownHorizontalShift as oe } from "./utils/dropdownPositioning.js";
|
|
11
|
+
import { a as se, i as p, n as ce, o as m } from "./ComboboxBase-BzDGK36x.js";
|
|
12
12
|
import { useCallback as le, useRef as h, useState as g } from "react";
|
|
13
13
|
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
14
14
|
//#region src/components/Combobox/Combobox.tsx
|
|
15
|
-
var y = ({ className: y, disabled: ue, defaultValue: de = "", dropdownWidth: b = "trigger", emptyMessage: x = "No options found.", errorMessage: S, id: C, label: w, labelClassName: T, loadingMessage: E = "Loading…", name: D,
|
|
16
|
-
process.env.NODE_ENV !== "production" && !w && !
|
|
17
|
-
let
|
|
18
|
-
value:
|
|
15
|
+
var y = ({ className: y, disabled: ue, defaultValue: de = "", dropdownWidth: b = "trigger", emptyMessage: x = "No options found.", errorMessage: S, id: C, label: w, labelClassName: T, loadingMessage: E = "Loading…", name: D, onChange: O, onValueChange: k, options: A = [], placeholder: j = "Search…", ref: M, required: N, state: P = "default", value: F, warningMessage: I, "aria-describedby": L, "aria-label": R }) => {
|
|
16
|
+
process.env.NODE_ENV !== "production" && !w && !R && console.warn("Combobox: provide either `label` or `aria-label` for an accessible name.");
|
|
17
|
+
let z = h(null), B = h(null), V = te(C, D), H = `${V}-listbox`, U = l(V), W = `${V}-warning`, fe = P === "error" ? U : P === "warning" && I ? W : void 0, G = !!ue, K = P === "loading", pe = P === "error", me = o(P, L, N, fe), [q, J] = g(!1), { dropdownShiftStyle: he, setDropdownElement: ge } = oe(q), [Y, X] = g(""), [Z, _e] = ne({
|
|
18
|
+
value: F,
|
|
19
19
|
defaultValue: de,
|
|
20
|
-
onChange:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
...$
|
|
29
|
-
} : {
|
|
30
|
-
width: b,
|
|
31
|
-
...$
|
|
32
|
-
}, be = (e) => {
|
|
33
|
-
_e(e === X ? "" : e), Y(""), q(!1);
|
|
20
|
+
onChange: (e) => {
|
|
21
|
+
O ? O(e) : k?.(e);
|
|
22
|
+
}
|
|
23
|
+
}), Q = A.find((e) => e.value === Z), ve = !!(Q && Y.length === 0), { dropdownWidthMode: $, dropdownWidthStyle: ye } = c({
|
|
24
|
+
dropdownWidth: b,
|
|
25
|
+
triggerWidth: "var(--radix-popover-trigger-width)"
|
|
26
|
+
}), be = (e) => {
|
|
27
|
+
_e(e === Z ? "" : e), X(""), J(!1);
|
|
34
28
|
}, xe = (e) => {
|
|
35
|
-
e.key === "Escape" &&
|
|
29
|
+
e.key === "Escape" && J(!1);
|
|
36
30
|
}, Se = le(() => {
|
|
37
31
|
requestAnimationFrame(() => {
|
|
38
|
-
|
|
32
|
+
B.current?.contains(document.activeElement) || (J(!1), X(""));
|
|
39
33
|
});
|
|
40
34
|
}, []), Ce = () => {
|
|
41
|
-
|
|
42
|
-
}, we = () =>
|
|
43
|
-
id:
|
|
35
|
+
G || K || (z.current?.focus(), J(!0));
|
|
36
|
+
}, we = () => K ? /* @__PURE__ */ _("div", {
|
|
37
|
+
id: H,
|
|
44
38
|
role: "listbox",
|
|
45
|
-
children: /* @__PURE__ */ _(
|
|
46
|
-
}) :
|
|
47
|
-
id:
|
|
39
|
+
children: /* @__PURE__ */ _(i, { message: E })
|
|
40
|
+
}) : A.length === 0 ? /* @__PURE__ */ _("div", {
|
|
41
|
+
id: H,
|
|
48
42
|
role: "listbox",
|
|
49
43
|
children: /* @__PURE__ */ _(ee, { message: x })
|
|
50
|
-
}) : /* @__PURE__ */ v(
|
|
51
|
-
id:
|
|
52
|
-
children: [/* @__PURE__ */ _(
|
|
53
|
-
className: n(
|
|
54
|
-
"data-checked":
|
|
44
|
+
}) : /* @__PURE__ */ v(se, {
|
|
45
|
+
id: H,
|
|
46
|
+
children: [/* @__PURE__ */ _(ce, { children: x }), A.map((e) => /* @__PURE__ */ _(p, {
|
|
47
|
+
className: n(d(!!e.disabled, !1, Z === e.value), "group/command-item relative flex w-full items-center data-[selected=true]:bg-input-bg--hover"),
|
|
48
|
+
"data-checked": Z === e.value || void 0,
|
|
55
49
|
disabled: e.disabled,
|
|
56
50
|
onMouseDown: (e) => e.preventDefault(),
|
|
57
51
|
onSelect: () => be(e.value),
|
|
@@ -64,58 +58,58 @@ var y = ({ className: y, disabled: ue, defaultValue: de = "", dropdownWidth: b =
|
|
|
64
58
|
});
|
|
65
59
|
return /* @__PURE__ */ v("div", {
|
|
66
60
|
className: "w-full",
|
|
67
|
-
ref:
|
|
61
|
+
ref: M,
|
|
68
62
|
children: [
|
|
69
63
|
D && /* @__PURE__ */ _("input", {
|
|
70
64
|
type: "hidden",
|
|
71
65
|
name: D,
|
|
72
|
-
value:
|
|
73
|
-
disabled:
|
|
66
|
+
value: Z,
|
|
67
|
+
disabled: G
|
|
74
68
|
}),
|
|
75
|
-
w && /* @__PURE__ */ _(
|
|
76
|
-
className: n("mb-2 block text-text-primary", T,
|
|
69
|
+
w && /* @__PURE__ */ _(re, {
|
|
70
|
+
className: n("mb-2 block text-text-primary", T, G && "text-text-secondary"),
|
|
77
71
|
"data-testid": "spectral-combobox-label",
|
|
78
|
-
htmlFor:
|
|
72
|
+
htmlFor: V,
|
|
79
73
|
children: w
|
|
80
74
|
}),
|
|
81
75
|
/* @__PURE__ */ v(m, {
|
|
82
|
-
ref:
|
|
83
|
-
label:
|
|
76
|
+
ref: B,
|
|
77
|
+
label: R ?? w,
|
|
84
78
|
onKeyDown: xe,
|
|
85
79
|
className: "relative w-full",
|
|
86
|
-
children: [/* @__PURE__ */ v(
|
|
80
|
+
children: [/* @__PURE__ */ v(ie, {
|
|
87
81
|
"data-slot": "combobox-content",
|
|
88
|
-
"data-state":
|
|
82
|
+
"data-state": P,
|
|
89
83
|
"data-testid": "spectral-combobox-trigger",
|
|
90
|
-
className: n(
|
|
84
|
+
className: n(f(q, P), "ring-0!", G && "pointer-events-none cursor-not-allowed", y),
|
|
91
85
|
onClick: Ce,
|
|
92
|
-
style:
|
|
86
|
+
style: u(),
|
|
93
87
|
children: [/* @__PURE__ */ _(m.Input, {
|
|
94
|
-
ref:
|
|
88
|
+
ref: z,
|
|
95
89
|
autoComplete: "off",
|
|
96
90
|
"data-slot": "input-group-control",
|
|
97
|
-
"aria-controls":
|
|
98
|
-
"aria-expanded":
|
|
99
|
-
"aria-label":
|
|
91
|
+
"aria-controls": H,
|
|
92
|
+
"aria-expanded": q,
|
|
93
|
+
"aria-label": R ?? w,
|
|
100
94
|
className: n("min-w-0 px-3 py-1 text-base flex-1 truncate overflow-hidden border-0 bg-transparent whitespace-nowrap text-input-text outline-hidden placeholder:opacity-100 focus-visible:ring-0 focus-visible:outline-none", ve ? "placeholder:text-input-text!" : "placeholder:text-input-text-placeholder!"),
|
|
101
|
-
disabled:
|
|
102
|
-
id:
|
|
95
|
+
disabled: G,
|
|
96
|
+
id: V,
|
|
103
97
|
onBlur: Se,
|
|
104
|
-
onFocus: () => !
|
|
105
|
-
onValueChange:
|
|
106
|
-
placeholder:
|
|
98
|
+
onFocus: () => !G && !K && J(!0),
|
|
99
|
+
onValueChange: X,
|
|
100
|
+
placeholder: Q?.label ?? j,
|
|
107
101
|
role: "combobox",
|
|
108
|
-
value:
|
|
102
|
+
value: Y,
|
|
109
103
|
...me
|
|
110
|
-
}), /* @__PURE__ */ _(
|
|
104
|
+
}), /* @__PURE__ */ _(ae, {
|
|
111
105
|
align: "inline-end",
|
|
112
106
|
className: "cursor-pointer",
|
|
113
|
-
children:
|
|
107
|
+
children: K ? /* @__PURE__ */ _(t, { className: "size-5 motion-safe:animate-spin" }) : /* @__PURE__ */ _(e, { className: n("size-5 shrink-0 transition-transform duration-200", q && "rotate-180") })
|
|
114
108
|
})]
|
|
115
109
|
}), /* @__PURE__ */ _("div", {
|
|
116
|
-
className: n("left-0 mt-1 p-1 absolute top-full z-50 w-full",
|
|
117
|
-
"data-dropdown-width-mode":
|
|
118
|
-
"data-dropdown-width-value":
|
|
110
|
+
className: n("left-0 mt-1 p-1 absolute top-full z-50 w-full", s(), "motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-2 motion-safe:zoom-in-95", !q && "hidden"),
|
|
111
|
+
"data-dropdown-width-mode": $,
|
|
112
|
+
"data-dropdown-width-value": $ === "custom" ? b : void 0,
|
|
119
113
|
"data-testid": "spectral-combobox-content",
|
|
120
114
|
ref: ge,
|
|
121
115
|
style: {
|
|
@@ -125,15 +119,15 @@ var y = ({ className: y, disabled: ue, defaultValue: de = "", dropdownWidth: b =
|
|
|
125
119
|
children: we()
|
|
126
120
|
})]
|
|
127
121
|
}),
|
|
128
|
-
pe && S && /* @__PURE__ */ _(
|
|
122
|
+
pe && S && /* @__PURE__ */ _(r, {
|
|
129
123
|
dataTestId: "spectral-combobox-error-message",
|
|
130
|
-
id:
|
|
124
|
+
id: U,
|
|
131
125
|
message: S
|
|
132
126
|
}),
|
|
133
|
-
|
|
127
|
+
P === "warning" && I && /* @__PURE__ */ _(a, {
|
|
134
128
|
dataTestId: "spectral-combobox-warning-message",
|
|
135
|
-
id:
|
|
136
|
-
message:
|
|
129
|
+
id: W,
|
|
130
|
+
message: I
|
|
137
131
|
})
|
|
138
132
|
]
|
|
139
133
|
});
|
|
@@ -3,7 +3,7 @@ import { CheckmarkIcon as e } from "./Icons/CheckmarkIcon.js";
|
|
|
3
3
|
import { SearchIcon as t } from "./Icons/SearchIcon.js";
|
|
4
4
|
import { c as n, t as r } from "./dist-7HRQ5IKN.js";
|
|
5
5
|
import { t as i } from "./dist-Dtvmk11N.js";
|
|
6
|
-
import { t as a } from "./twUtils-
|
|
6
|
+
import { t as a } from "./twUtils-D_qzdiwM.js";
|
|
7
7
|
import { InputGroup as o, InputGroupAddon as s } from "./primitives/input-group.js";
|
|
8
8
|
import { a as c, i as l, n as u, o as d } from "./dist-B9tup-4O.js";
|
|
9
9
|
import * as f from "react";
|
|
@@ -4,6 +4,7 @@ import { DropdownWidth, FormFieldState } from '../utils/formFieldUtils';
|
|
|
4
4
|
import { ComponentProps } from 'react';
|
|
5
5
|
import { ControlGroupProps } from './ControlGroup';
|
|
6
6
|
export interface SelectOptionType {
|
|
7
|
+
disabled?: boolean;
|
|
7
8
|
label: string;
|
|
8
9
|
value: string;
|
|
9
10
|
}
|
|
@@ -26,6 +27,7 @@ type ControlGroupSelectBaseProps = ComponentProps<typeof Select> & Pick<ControlG
|
|
|
26
27
|
disabled?: boolean;
|
|
27
28
|
dropdownWidth?: DropdownWidth;
|
|
28
29
|
errorMessage?: string | string[] | Record<string, unknown> | null;
|
|
30
|
+
id?: string;
|
|
29
31
|
/** When `captionLayout` is `inline`, overrides the input's accessible name (defaults to `inputPlaceholder` when set). */
|
|
30
32
|
inputAriaLabel?: string;
|
|
31
33
|
inputPlaceholder?: string;
|
|
@@ -35,10 +37,11 @@ type ControlGroupSelectBaseProps = ComponentProps<typeof Select> & Pick<ControlG
|
|
|
35
37
|
/** When `captionLayout` is `inline` and `selectPlaceholder` is empty, sets the select trigger's accessible name. */
|
|
36
38
|
selectAriaLabel?: string;
|
|
37
39
|
selectOptions: SelectOptionType[];
|
|
38
|
-
state?: FormFieldState
|
|
40
|
+
state?: Exclude<FormFieldState, 'disabled'>;
|
|
39
41
|
type?: 'number' | 'text';
|
|
42
|
+
warningMessage?: string | string[] | Record<string, unknown> | null;
|
|
40
43
|
};
|
|
41
44
|
export type ControlGroupSelectProps = ControlGroupSelectBaseProps & ControlGroupSelectInputControlProps;
|
|
42
|
-
export declare const ControlGroupSelect: ({ amountStep, ariaLabel, captionLayout, className, dataTestId, disabled, errorMessage, dropdownWidth, inputAriaLabel, inputPlaceholder, inputValue, maxAmount, minAmount, onInputChange, orientation, selectAriaLabel, selectOptions, selectPlaceholder, state, type, ...selectProps }: ControlGroupSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
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;
|
|
43
46
|
export {};
|
|
44
47
|
//# sourceMappingURL=ControlGroupSelect.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
|
-
import { t as e } from "../twUtils-
|
|
3
|
+
import { t as e } from "../twUtils-D_qzdiwM.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";
|
|
@@ -15,45 +15,47 @@ var g = "placeholder:text-small! [appearance:textfield] [&::-webkit-inner-spin-b
|
|
|
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,
|
|
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, inputValue: p, maxAmount: h = 1e6, minAmount: g = 0, onInputChange: y, orientation: b = "horizontal", selectAriaLabel: C, selectOptions: T, selectPlaceholder: E, state: D = "default", type: O = "number", warningMessage: k, ...A }) => {
|
|
19
|
+
let j = f(), M = s ?? j, N = `${M}-amount`, P = `${M}-select`, F = `${N}-label`, I = `${P}-label`, L = n === "above", R = L ? void 0 : d, z = L ? void 0 : E, B = S(d, _), V = S(E, v), H = u ?? (L ? void 0 : B), U = C ?? (L ? void 0 : V), W = x(d, 3), G = x(E, 5), K = t ?? `${B} and ${V}`, q = !!a, J = p !== void 0 && y !== void 0;
|
|
20
20
|
return /* @__PURE__ */ m(l, {
|
|
21
|
-
"aria-label":
|
|
21
|
+
"aria-label": K,
|
|
22
22
|
className: r,
|
|
23
23
|
"data-testid": i,
|
|
24
24
|
disabled: a,
|
|
25
25
|
errorMessage: o,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
id: M,
|
|
27
|
+
orientation: b,
|
|
28
|
+
state: D,
|
|
29
|
+
warningMessage: k,
|
|
28
30
|
children: /* @__PURE__ */ m(w, {
|
|
29
31
|
amountStep: e,
|
|
30
32
|
dataTestId: i,
|
|
31
|
-
inputAccessibleName:
|
|
32
|
-
inputCaption:
|
|
33
|
-
inputId:
|
|
34
|
-
inputLabelId:
|
|
35
|
-
inputLabelText:
|
|
36
|
-
inputMinWidth:
|
|
37
|
-
inputValue:
|
|
38
|
-
isDisabled:
|
|
39
|
-
maxAmount:
|
|
40
|
-
minAmount:
|
|
41
|
-
onInputChange:
|
|
42
|
-
dropdownWidth:
|
|
43
|
-
selectCaption:
|
|
44
|
-
selectOptions:
|
|
45
|
-
selectLabelId:
|
|
46
|
-
selectLabelText:
|
|
47
|
-
selectProps:
|
|
48
|
-
selectTriggerAriaLabel:
|
|
49
|
-
selectTriggerId:
|
|
50
|
-
selectTriggerMinWidth:
|
|
51
|
-
type:
|
|
52
|
-
useAboveLabels:
|
|
33
|
+
inputAccessibleName: H,
|
|
34
|
+
inputCaption: R,
|
|
35
|
+
inputId: N,
|
|
36
|
+
inputLabelId: F,
|
|
37
|
+
inputLabelText: B,
|
|
38
|
+
inputMinWidth: W,
|
|
39
|
+
inputValue: J ? p : void 0,
|
|
40
|
+
isDisabled: q,
|
|
41
|
+
maxAmount: h,
|
|
42
|
+
minAmount: g,
|
|
43
|
+
onInputChange: J ? y : void 0,
|
|
44
|
+
dropdownWidth: c,
|
|
45
|
+
selectCaption: z,
|
|
46
|
+
selectOptions: T,
|
|
47
|
+
selectLabelId: I,
|
|
48
|
+
selectLabelText: V,
|
|
49
|
+
selectProps: A,
|
|
50
|
+
selectTriggerAriaLabel: U,
|
|
51
|
+
selectTriggerId: P,
|
|
52
|
+
selectTriggerMinWidth: G,
|
|
53
|
+
type: O,
|
|
54
|
+
useAboveLabels: L
|
|
53
55
|
})
|
|
54
56
|
});
|
|
55
57
|
}, w = ({ amountStep: l, dataTestId: f, dropdownWidth: _, inputAccessibleName: v, inputCaption: x, inputId: S, inputLabelId: C, inputLabelText: w, inputMinWidth: T, inputValue: E, isDisabled: D, maxAmount: O, minAmount: k, onInputChange: A, selectCaption: j, selectLabelId: M, selectLabelText: N, selectOptions: P, selectProps: F, selectTriggerAriaLabel: I, selectTriggerId: L, selectTriggerMinWidth: R, type: z, useAboveLabels: B }) => {
|
|
56
|
-
let {
|
|
58
|
+
let { messageId: V, orientation: H, state: U } = d(), W = H === "horizontal" ? "rounded-s-md rounded-e-none" : "rounded-ss-md rounded-se-md rounded-es-none rounded-ee-none", G = H === "horizontal" ? "rounded-s-none rounded-e-md" : "rounded-ss-none rounded-se-none rounded-es-md rounded-ee-md", K = H === "horizontal" ? "me-0" : "mbe-0", q = H === "horizontal" ? "me-0 [&>*:last-child]:-ms-0.5" : "mbe-0 [&>*:last-child]:-mt-0.5", J = /* @__PURE__ */ m(r, {
|
|
57
59
|
"aria-describedby": V,
|
|
58
60
|
"aria-label": v,
|
|
59
61
|
"aria-labelledby": B ? C : void 0,
|
|
@@ -115,6 +117,7 @@ var g = "placeholder:text-small! [appearance:textfield] [&::-webkit-inner-spin-b
|
|
|
115
117
|
"data-testid": `${f}-select-content`,
|
|
116
118
|
dropdownWidth: _,
|
|
117
119
|
children: P.map((e) => /* @__PURE__ */ m(o, {
|
|
120
|
+
disabled: e.disabled,
|
|
118
121
|
value: e.value,
|
|
119
122
|
children: e.label
|
|
120
123
|
}, e.value))
|
package/dist/ControlGroup.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Slot } from './primitives/slot';
|
|
|
2
2
|
import { FormFieldState } from './utils/formFieldUtils';
|
|
3
3
|
import { ComponentProps } from 'react';
|
|
4
4
|
interface ControlGroupContextValue {
|
|
5
|
-
|
|
5
|
+
messageId?: string;
|
|
6
6
|
isDisabled: boolean;
|
|
7
7
|
isInvalid: boolean;
|
|
8
8
|
isLoading: boolean;
|
|
@@ -17,8 +17,9 @@ export interface ControlGroupProps extends ComponentProps<'div'> {
|
|
|
17
17
|
name?: string;
|
|
18
18
|
orientation?: 'horizontal' | 'vertical';
|
|
19
19
|
state?: FormFieldState;
|
|
20
|
+
warningMessage?: string | string[] | Record<string, unknown> | null;
|
|
20
21
|
}
|
|
21
|
-
export declare const ControlGroup: ({ className, disabled, errorMessage, id, name, orientation, state, ...props }: ControlGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const ControlGroup: ({ className, disabled, errorMessage, id, name, orientation, state, warningMessage, ...props }: ControlGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export declare const ControlGroupItem: ({ className, ...props }: ComponentProps<typeof Slot>) => import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
export {};
|
|
24
25
|
//# sourceMappingURL=ControlGroup.d.ts.map
|
package/dist/ControlGroup.js
CHANGED
|
@@ -1,48 +1,56 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "./styles/main.css";
|
|
3
|
-
import { t as e } from "./twUtils-
|
|
3
|
+
import { t as e } from "./twUtils-D_qzdiwM.js";
|
|
4
4
|
import { Slot as t } from "./primitives/slot.js";
|
|
5
|
-
import { ErrorMessage as n,
|
|
6
|
-
import { createContext as
|
|
7
|
-
import { jsx as
|
|
5
|
+
import { ErrorMessage as n, WarningMessage as r, getErrorMessageId as i, useFormFieldId as a, useFormFieldState as o } from "./utils/formFieldUtils.js";
|
|
6
|
+
import { createContext as s, useContext as c } from "react";
|
|
7
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/ControlGroup/ControlGroup.tsx
|
|
9
|
-
var
|
|
10
|
-
let e =
|
|
9
|
+
var d = s(null), f = () => {
|
|
10
|
+
let e = c(d);
|
|
11
11
|
if (e === null) throw Error("useControlGroup must be used within a ControlGroup");
|
|
12
12
|
return e;
|
|
13
|
-
},
|
|
14
|
-
let
|
|
15
|
-
return /* @__PURE__ */
|
|
13
|
+
}, p = ({ className: t, disabled: s, errorMessage: c, id: f, name: p, orientation: m = "horizontal", state: h = "default", warningMessage: g, ..._ }) => {
|
|
14
|
+
let v = a(f, p), y = i(v), b = `${v}-warning`, { isDisabled: x, isLoading: S, isInvalid: C } = o(s, h), w = h === "error" && c ? y : h === "warning" && g ? b : void 0;
|
|
15
|
+
return /* @__PURE__ */ u(d.Provider, {
|
|
16
16
|
value: {
|
|
17
|
-
|
|
18
|
-
isDisabled:
|
|
19
|
-
isInvalid:
|
|
20
|
-
isLoading:
|
|
21
|
-
orientation:
|
|
22
|
-
state:
|
|
17
|
+
messageId: w,
|
|
18
|
+
isDisabled: x,
|
|
19
|
+
isInvalid: C,
|
|
20
|
+
isLoading: S,
|
|
21
|
+
orientation: m,
|
|
22
|
+
state: h
|
|
23
23
|
},
|
|
24
|
-
children: [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ l("div", {
|
|
26
|
+
"data-slot": "control-group",
|
|
27
|
+
"data-orientation": m,
|
|
28
|
+
"data-state": h,
|
|
29
|
+
id: v,
|
|
30
|
+
role: "group",
|
|
31
|
+
"aria-describedby": w,
|
|
32
|
+
className: e("group flex", m === "vertical" && "flex-col", x && "pointer-events-none opacity-50", t),
|
|
33
|
+
..._
|
|
34
|
+
}),
|
|
35
|
+
C && c && /* @__PURE__ */ l(n, {
|
|
36
|
+
dataTestId: "spectral-control-group-error-message",
|
|
37
|
+
id: y,
|
|
38
|
+
message: c
|
|
39
|
+
}),
|
|
40
|
+
h === "warning" && g && /* @__PURE__ */ l(r, {
|
|
41
|
+
dataTestId: "spectral-control-group-warning-message",
|
|
42
|
+
id: b,
|
|
43
|
+
message: g
|
|
44
|
+
})
|
|
45
|
+
]
|
|
38
46
|
});
|
|
39
|
-
},
|
|
40
|
-
let { orientation: i } =
|
|
41
|
-
return /* @__PURE__ */
|
|
47
|
+
}, m = ({ className: n, ...r }) => {
|
|
48
|
+
let { orientation: i } = f();
|
|
49
|
+
return /* @__PURE__ */ l(t, {
|
|
42
50
|
"data-slot": "control-group-item",
|
|
43
51
|
className: e("rounded-none focus-within:z-10 hover:z-10", i === "horizontal" && "first:rounded-s-md last:me-0 last:rounded-e-md -me-0.5 h-auto", i === "vertical" && "first:rounded-ss-md first:rounded-se-md last:rounded-ee-md last:rounded-es-md last:mbe-0 -mbe-0.5 w-auto", n),
|
|
44
52
|
...r
|
|
45
53
|
});
|
|
46
54
|
};
|
|
47
55
|
//#endregion
|
|
48
|
-
export {
|
|
56
|
+
export { p as ControlGroup, m as ControlGroupItem, f as useControlGroup };
|
package/dist/DataCard/Card.js
CHANGED
package/dist/DataCard.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./styles/main.css";
|
|
2
|
-
import { t as e } from "./twUtils-
|
|
2
|
+
import { t as e } from "./twUtils-D_qzdiwM.js";
|
|
3
3
|
import { Card as t, CardContent as n, CardHeader as r, CardTitle as i } from "./DataCard/Card.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../Calendar-
|
|
1
|
+
import { t as e } from "../Calendar-Cnh_PTbQ.js";
|
|
2
2
|
export { e as Calendar };
|