@spear-ai/spectral 1.10.1 → 1.10.3
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/Combobox/ComboboxBase.js +1 -1
- package/dist/Combobox.js +4 -3
- package/dist/{ComboboxBase-D8Nf4xC-.js → ComboboxBase-Dn8Lz9mG.js} +2 -2
- package/dist/ControlGroup/ControlGroupSelect.d.ts +17 -7
- package/dist/ControlGroup/ControlGroupSelect.js +95 -66
- package/dist/ControlGroup.js +29 -29
- package/dist/Select.js +24 -23
- package/dist/primitives/select.d.ts +1 -1
- package/dist/primitives/select.d.ts.map +1 -1
- package/dist/primitives/select.js +8 -4
- package/dist/styles/horizon/colors.css +2 -2
- package/dist/styles/main.css +1 -1
- package/dist/styles/spectral.css +1 -1
- package/dist/styles/theme.css +2 -2
- package/package.json +2 -2
|
@@ -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-Dn8Lz9mG.js";
|
|
3
3
|
export { i as ComboboxBase, n as CommandEmpty, r as CommandInput, t as CommandItem, e as CommandList };
|
package/dist/Combobox.js
CHANGED
|
@@ -6,7 +6,7 @@ import { t as n } from "./twUtils-VNWgstKL.js";
|
|
|
6
6
|
import { EmptyState as ee, ErrorMessage as r, LoadingState as i, getAriaProps as a, getErrorMessageId as o, getFormFieldCSSProperties as s, getStateClasses as c, useFormFieldId as l, useFormFieldState as u } from "./utils/formFieldUtils.js";
|
|
7
7
|
import { Label as d } from "./Label.js";
|
|
8
8
|
import { InputGroup as f, InputGroupAddon as p } from "./primitives/input-group.js";
|
|
9
|
-
import { a as m, i as h, n as g, o as _ } from "./ComboboxBase-
|
|
9
|
+
import { a as m, i as h, n as g, o as _ } from "./ComboboxBase-Dn8Lz9mG.js";
|
|
10
10
|
import { useCallback as v, useRef as y, useState as b } from "react";
|
|
11
11
|
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
12
12
|
//#region src/components/Combobox/Combobox.tsx
|
|
@@ -76,7 +76,7 @@ var C = ({ className: C, disabled: w, emptyMessage: T = "No options found.", err
|
|
|
76
76
|
"aria-controls": W,
|
|
77
77
|
"aria-expanded": X,
|
|
78
78
|
"aria-label": B ?? O,
|
|
79
|
-
className: "min-w-0 px-3 py-1 text-base flex-1 border-0 bg-transparent outline-hidden placeholder:text-input-text-
|
|
79
|
+
className: "min-w-0 px-3 py-1 text-base flex-1 border-0 bg-transparent text-input-text outline-hidden placeholder:text-input-text! placeholder:opacity-100 focus-visible:ring-0 focus-visible:outline-none",
|
|
80
80
|
disabled: K,
|
|
81
81
|
id: U,
|
|
82
82
|
onBlur: ie,
|
|
@@ -88,7 +88,8 @@ var C = ({ className: C, disabled: w, emptyMessage: T = "No options found.", err
|
|
|
88
88
|
...Y
|
|
89
89
|
}), /* @__PURE__ */ x(p, {
|
|
90
90
|
align: "inline-end",
|
|
91
|
-
|
|
91
|
+
className: "cursor-pointer",
|
|
92
|
+
children: q ? /* @__PURE__ */ x(t, { className: "size-5 motion-safe:animate-spin" }) : /* @__PURE__ */ x(e, { className: n("size-5 shrink-0 transition-transform duration-200", X && "rotate-180") })
|
|
92
93
|
})]
|
|
93
94
|
}), /* @__PURE__ */ x("div", {
|
|
94
95
|
className: n("left-0 mt-1 rounded-lg p-1 shadow-md absolute top-full z-50 w-full border border-input-border bg-input-bg", "motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-2 motion-safe:zoom-in-95", !X && "hidden"),
|
|
@@ -479,11 +479,11 @@ var le = {
|
|
|
479
479
|
...t
|
|
480
480
|
}), pe = ({ className: e, ...t }) => /* @__PURE__ */ p(J.Empty, {
|
|
481
481
|
"data-slot": "command-empty",
|
|
482
|
-
className: a("py-6 text-
|
|
482
|
+
className: a("py-6 text-base text-center text-text-secondary", e),
|
|
483
483
|
...t
|
|
484
484
|
}), me = ({ className: t, children: n, ...r }) => /* @__PURE__ */ m(J.Item, {
|
|
485
485
|
"data-slot": "command-item",
|
|
486
|
-
className: a("group/command-item gap-2 rounded-sm px-2 py-1.5 text-
|
|
486
|
+
className: a("group/command-item gap-2 rounded-sm px-2 py-1.5 text-base in-data-[slot=dialog-content]:rounded-lg! relative flex cursor-default items-center text-input-text outline-hidden select-none hover:bg-input-bg--hover data-selected:bg-input-bg--selected data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", t),
|
|
487
487
|
...r,
|
|
488
488
|
children: [n, /* @__PURE__ */ p(e, { className: "ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" })]
|
|
489
489
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Input } from '../primitives/input';
|
|
1
2
|
import { Select } from '../primitives/select';
|
|
2
3
|
import { FormFieldState } from '../utils/formFieldUtils';
|
|
3
4
|
import { ComponentProps } from 'react';
|
|
@@ -8,26 +9,35 @@ export interface SelectOptionType {
|
|
|
8
9
|
}
|
|
9
10
|
/** `inline`: `inputPlaceholder` / `selectPlaceholder` show inside the fields. `above`: same strings render as labels above each control (no inner placeholders). */
|
|
10
11
|
export type ControlGroupSelectCaptionLayout = 'above' | 'inline';
|
|
11
|
-
|
|
12
|
+
type ControlGroupSelectInputControlProps = {
|
|
13
|
+
inputValue: ComponentProps<typeof Input>['value'];
|
|
14
|
+
onInputChange: ComponentProps<typeof Input>['onChange'];
|
|
15
|
+
} | {
|
|
16
|
+
inputValue?: undefined;
|
|
17
|
+
onInputChange?: undefined;
|
|
18
|
+
};
|
|
19
|
+
type ControlGroupSelectBaseProps = ComponentProps<typeof Select> & Pick<ControlGroupProps, 'orientation'> & {
|
|
20
|
+
amountStep?: number;
|
|
12
21
|
/** Accessible name for the group wrapper (use when there is no visible group heading). */
|
|
13
22
|
ariaLabel?: string;
|
|
14
|
-
amountStep?: number;
|
|
15
23
|
captionLayout?: ControlGroupSelectCaptionLayout;
|
|
16
24
|
className?: string;
|
|
17
25
|
dataTestId?: string;
|
|
18
26
|
disabled?: boolean;
|
|
19
27
|
errorMessage?: string | string[] | Record<string, unknown> | null;
|
|
20
|
-
maxAmount?: number;
|
|
21
|
-
minAmount?: number;
|
|
22
|
-
inputPlaceholder?: string;
|
|
23
28
|
/** When `captionLayout` is `inline`, overrides the input's accessible name (defaults to `inputPlaceholder` when set). */
|
|
24
29
|
inputAriaLabel?: string;
|
|
30
|
+
inputPlaceholder?: string;
|
|
31
|
+
maxAmount?: number;
|
|
32
|
+
minAmount?: number;
|
|
25
33
|
selectPlaceholder?: string;
|
|
26
34
|
/** When `captionLayout` is `inline` and `selectPlaceholder` is empty, sets the select trigger's accessible name. */
|
|
27
35
|
selectAriaLabel?: string;
|
|
28
36
|
selectOptions: SelectOptionType[];
|
|
29
37
|
state?: FormFieldState;
|
|
30
38
|
type?: 'number' | 'text';
|
|
31
|
-
}
|
|
32
|
-
export
|
|
39
|
+
};
|
|
40
|
+
export type ControlGroupSelectProps = ControlGroupSelectBaseProps & ControlGroupSelectInputControlProps;
|
|
41
|
+
export declare const ControlGroupSelect: ({ amountStep, ariaLabel, captionLayout, className, dataTestId, disabled, errorMessage, inputAriaLabel, inputPlaceholder, inputValue, maxAmount, minAmount, onInputChange, orientation, selectAriaLabel, selectOptions, selectPlaceholder, state, type, ...selectProps }: ControlGroupSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export {};
|
|
33
43
|
//# sourceMappingURL=ControlGroupSelect.d.ts.map
|
|
@@ -1,88 +1,117 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
3
|
import { t as e } from "../twUtils-VNWgstKL.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
4
|
+
import { getStateClasses as t } from "../utils/formFieldUtils.js";
|
|
5
|
+
import { Label as n } from "../Label.js";
|
|
6
|
+
import { Input as r } from "../primitives/input.js";
|
|
7
|
+
import { Select as i, SelectContent as a, SelectItem as o, SelectTrigger as s, SelectValue as c } from "../primitives/select.js";
|
|
8
|
+
import { ControlGroup as l, ControlGroupItem as u, useControlGroup as d } from "../ControlGroup.js";
|
|
9
|
+
import { useId as f } from "react";
|
|
10
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
10
11
|
//#region src/components/ControlGroup/ControlGroupSelect.tsx
|
|
11
|
-
var
|
|
12
|
-
let
|
|
13
|
-
return
|
|
14
|
-
|
|
12
|
+
var g = "placeholder:text-small! [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:border-input-border--focus focus-visible:outline 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
|
+
let n = e?.trim();
|
|
14
|
+
if (n) return `${Math.max(n.length + t, 8)}ch`;
|
|
15
|
+
}, S = (e, t) => {
|
|
16
|
+
let n = e?.trim();
|
|
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, inputAriaLabel: s, inputPlaceholder: c, inputValue: u, maxAmount: d = 1e6, minAmount: p = 0, onInputChange: h, orientation: g = "horizontal", selectAriaLabel: y, selectOptions: b, selectPlaceholder: C, state: T = "default", type: E = "number", ...D }) => {
|
|
19
|
+
let O = f(), k = `${O}-amount`, A = `${O}-select`, j = `${k}-label`, M = `${A}-label`, N = n === "above", P = N ? void 0 : c, F = N ? void 0 : C, I = S(c, _), L = S(C, v), R = s ?? (N ? void 0 : I), z = y ?? (N ? void 0 : L), B = x(c, 3), V = x(C, 5), H = t ?? `${I} and ${L}`, U = !!a || T === "disabled", W = u !== void 0 && h !== void 0;
|
|
20
|
+
return /* @__PURE__ */ m(l, {
|
|
21
|
+
"aria-label": H,
|
|
15
22
|
className: r,
|
|
16
23
|
"data-testid": i,
|
|
17
24
|
disabled: a,
|
|
18
25
|
errorMessage: o,
|
|
19
|
-
orientation:
|
|
20
|
-
state:
|
|
21
|
-
children: /* @__PURE__ */
|
|
26
|
+
orientation: g,
|
|
27
|
+
state: T,
|
|
28
|
+
children: /* @__PURE__ */ m(w, {
|
|
22
29
|
amountStep: e,
|
|
23
30
|
dataTestId: i,
|
|
24
|
-
inputAccessibleName:
|
|
25
|
-
inputCaption:
|
|
26
|
-
inputId:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
inputAccessibleName: R,
|
|
32
|
+
inputCaption: P,
|
|
33
|
+
inputId: k,
|
|
34
|
+
inputLabelId: j,
|
|
35
|
+
inputLabelText: I,
|
|
36
|
+
inputMinWidth: B,
|
|
37
|
+
inputValue: W ? u : void 0,
|
|
38
|
+
isDisabled: U,
|
|
39
|
+
maxAmount: d,
|
|
40
|
+
minAmount: p,
|
|
41
|
+
onInputChange: W ? h : void 0,
|
|
42
|
+
selectCaption: F,
|
|
43
|
+
selectOptions: b,
|
|
44
|
+
selectLabelId: M,
|
|
45
|
+
selectLabelText: L,
|
|
46
|
+
selectProps: D,
|
|
47
|
+
selectTriggerAriaLabel: z,
|
|
48
|
+
selectTriggerId: A,
|
|
49
|
+
selectTriggerMinWidth: V,
|
|
50
|
+
type: E,
|
|
51
|
+
useAboveLabels: N
|
|
39
52
|
})
|
|
40
53
|
});
|
|
41
|
-
},
|
|
42
|
-
let { errorMessageId:
|
|
43
|
-
"aria-describedby":
|
|
54
|
+
}, w = ({ amountStep: l, dataTestId: f, inputAccessibleName: _, inputCaption: v, inputId: x, inputLabelId: S, inputLabelText: C, inputMinWidth: w, inputValue: T, isDisabled: E, maxAmount: D, minAmount: O, onInputChange: k, selectCaption: A, selectLabelId: j, selectLabelText: M, selectOptions: N, selectProps: P, selectTriggerAriaLabel: F, selectTriggerId: I, selectTriggerMinWidth: L, type: R, useAboveLabels: z }) => {
|
|
55
|
+
let { errorMessageId: B, orientation: V, state: H } = d(), U = V === "horizontal" ? "rounded-s-md rounded-e-none" : "rounded-ss-md rounded-se-md rounded-es-none rounded-ee-none", W = V === "horizontal" ? "rounded-s-none rounded-e-md" : "rounded-ss-none rounded-se-none rounded-es-md rounded-ee-md", G = V === "horizontal" ? "me-0" : "mbe-0", K = V === "horizontal" ? "me-0 [&>*:last-child]:-ms-0.5" : "mbe-0 [&>*:last-child]:-mt-0.5", q = /* @__PURE__ */ m(r, {
|
|
56
|
+
"aria-describedby": B,
|
|
44
57
|
"aria-label": _,
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
"aria-labelledby": z ? S : void 0,
|
|
59
|
+
className: e(b, U, t(H), R === "number" && g, R === "number" && "tabular-nums"),
|
|
60
|
+
"data-testid": `${f}-input`,
|
|
61
|
+
disabled: E,
|
|
62
|
+
id: z ? x : void 0,
|
|
63
|
+
type: R === "number" ? "number" : "text",
|
|
50
64
|
placeholder: v,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
style: w ? { minWidth: w } : void 0,
|
|
66
|
+
min: O ?? 0,
|
|
67
|
+
max: D ?? 1e6,
|
|
68
|
+
...T !== void 0 && k !== void 0 ? {
|
|
69
|
+
value: T,
|
|
70
|
+
onChange: k
|
|
71
|
+
} : {},
|
|
72
|
+
step: l ?? 1
|
|
73
|
+
}), J = /* @__PURE__ */ m(s, {
|
|
74
|
+
"aria-describedby": B,
|
|
75
|
+
"aria-label": F,
|
|
76
|
+
"aria-labelledby": z ? j : void 0,
|
|
77
|
+
className: e(b, W, "px-4 w-full justify-between focus-visible:ring-0", t(H)),
|
|
78
|
+
"data-testid": `${f}-select-trigger`,
|
|
79
|
+
disabled: E,
|
|
80
|
+
id: z ? I : void 0,
|
|
81
|
+
style: L ? { minWidth: L } : void 0,
|
|
82
|
+
children: /* @__PURE__ */ m(c, { placeholder: A })
|
|
62
83
|
});
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
-
className:
|
|
65
|
-
children:
|
|
66
|
-
className:
|
|
67
|
-
|
|
68
|
-
children: b
|
|
69
|
-
}) : null, N]
|
|
70
|
-
}) : N }), /* @__PURE__ */ m(r, {
|
|
71
|
-
"data-testid": `${d}-select-root`,
|
|
72
|
-
disabled: x,
|
|
73
|
-
...D,
|
|
74
|
-
children: [/* @__PURE__ */ p(l, { children: j ? /* @__PURE__ */ m("div", {
|
|
75
|
-
className: g,
|
|
76
|
-
children: [E ? /* @__PURE__ */ p(t, {
|
|
84
|
+
return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(u, {
|
|
85
|
+
className: z ? G : void 0,
|
|
86
|
+
children: z ? /* @__PURE__ */ h("div", {
|
|
87
|
+
className: y,
|
|
88
|
+
children: [/* @__PURE__ */ m(n, {
|
|
77
89
|
className: "text-text-primary",
|
|
78
|
-
htmlFor:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
90
|
+
htmlFor: x,
|
|
91
|
+
id: S,
|
|
92
|
+
children: C
|
|
93
|
+
}), q]
|
|
94
|
+
}) : q
|
|
95
|
+
}), /* @__PURE__ */ h(i, {
|
|
96
|
+
"data-testid": `${f}-select-root`,
|
|
97
|
+
disabled: E,
|
|
98
|
+
...P,
|
|
99
|
+
children: [/* @__PURE__ */ m(u, {
|
|
100
|
+
className: z ? K : void 0,
|
|
101
|
+
children: z ? /* @__PURE__ */ h("div", {
|
|
102
|
+
className: y,
|
|
103
|
+
children: [/* @__PURE__ */ m(n, {
|
|
104
|
+
className: "text-text-primary",
|
|
105
|
+
htmlFor: I,
|
|
106
|
+
id: j,
|
|
107
|
+
children: M
|
|
108
|
+
}), J]
|
|
109
|
+
}) : J
|
|
110
|
+
}), /* @__PURE__ */ m(a, { children: N.map((e) => /* @__PURE__ */ m(o, {
|
|
82
111
|
value: e.value,
|
|
83
112
|
children: e.label
|
|
84
113
|
}, e.value)) })]
|
|
85
114
|
})] });
|
|
86
115
|
};
|
|
87
116
|
//#endregion
|
|
88
|
-
export {
|
|
117
|
+
export { C as ControlGroupSelect };
|
package/dist/ControlGroup.js
CHANGED
|
@@ -2,47 +2,47 @@
|
|
|
2
2
|
import "./styles/main.css";
|
|
3
3
|
import { t as e } from "./twUtils-VNWgstKL.js";
|
|
4
4
|
import { Slot as t } from "./primitives/slot.js";
|
|
5
|
-
import { ErrorMessage as n, getErrorMessageId as r,
|
|
6
|
-
import { createContext as
|
|
7
|
-
import { jsx as
|
|
5
|
+
import { ErrorMessage as n, getErrorMessageId as r, useFormFieldId as i, useFormFieldState as a } from "./utils/formFieldUtils.js";
|
|
6
|
+
import { createContext as o, useContext as s } from "react";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/ControlGroup/ControlGroup.tsx
|
|
9
|
-
var
|
|
10
|
-
let e =
|
|
9
|
+
var u = o(null), d = () => {
|
|
10
|
+
let e = s(u);
|
|
11
11
|
if (e === null) throw Error("useControlGroup must be used within a ControlGroup");
|
|
12
12
|
return e;
|
|
13
|
-
},
|
|
14
|
-
let
|
|
15
|
-
return /* @__PURE__ */ u
|
|
13
|
+
}, f = ({ className: t, disabled: o, errorMessage: s, id: d, name: f, orientation: p = "horizontal", state: m = "default", ...h }) => {
|
|
14
|
+
let g = i(d, f), _ = r(g), { isDisabled: v, isLoading: y, isInvalid: b } = a(o, m);
|
|
15
|
+
return /* @__PURE__ */ l(u.Provider, {
|
|
16
16
|
value: {
|
|
17
|
-
errorMessageId:
|
|
18
|
-
isDisabled:
|
|
19
|
-
isInvalid:
|
|
20
|
-
isLoading:
|
|
21
|
-
orientation:
|
|
22
|
-
state:
|
|
17
|
+
errorMessageId: b && s ? _ : void 0,
|
|
18
|
+
isDisabled: v,
|
|
19
|
+
isInvalid: b,
|
|
20
|
+
isLoading: y,
|
|
21
|
+
orientation: p,
|
|
22
|
+
state: m
|
|
23
23
|
},
|
|
24
|
-
children: [/* @__PURE__ */
|
|
24
|
+
children: [/* @__PURE__ */ c("div", {
|
|
25
25
|
"data-slot": "control-group",
|
|
26
|
-
"data-orientation":
|
|
27
|
-
"data-state":
|
|
28
|
-
id:
|
|
26
|
+
"data-orientation": p,
|
|
27
|
+
"data-state": m,
|
|
28
|
+
id: g,
|
|
29
29
|
role: "group",
|
|
30
|
-
"aria-describedby":
|
|
31
|
-
className: e("group
|
|
32
|
-
...
|
|
33
|
-
}),
|
|
30
|
+
"aria-describedby": b && s ? _ : void 0,
|
|
31
|
+
className: e("group flex", p === "vertical" && "flex-col", v && "pointer-events-none opacity-50", t),
|
|
32
|
+
...h
|
|
33
|
+
}), b && s && /* @__PURE__ */ c(n, {
|
|
34
34
|
dataTestId: "spectral-control-group-error-message",
|
|
35
|
-
id:
|
|
36
|
-
message:
|
|
35
|
+
id: _,
|
|
36
|
+
message: s
|
|
37
37
|
})]
|
|
38
38
|
});
|
|
39
|
-
},
|
|
40
|
-
let { orientation: i } =
|
|
41
|
-
return /* @__PURE__ */
|
|
39
|
+
}, p = ({ className: n, ...r }) => {
|
|
40
|
+
let { orientation: i } = d();
|
|
41
|
+
return /* @__PURE__ */ c(t, {
|
|
42
42
|
"data-slot": "control-group-item",
|
|
43
|
-
className: e("rounded-none focus-within:z-10", i === "horizontal" && "first:rounded-s-md last:me-0 last:rounded-e-md -me-
|
|
43
|
+
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
44
|
...r
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
47
|
//#endregion
|
|
48
|
-
export {
|
|
48
|
+
export { f as ControlGroup, p as ControlGroupItem, d as useControlGroup };
|
package/dist/Select.js
CHANGED
|
@@ -4,14 +4,14 @@ import { CheckmarkIcon as e } from "./Icons/CheckmarkIcon.js";
|
|
|
4
4
|
import { ChevronDownIcon as t } from "./Icons/ChevronDownIcon.js";
|
|
5
5
|
import { LoaderIcon as n } from "./Icons/LoaderIcon.js";
|
|
6
6
|
import { t as r } from "./twUtils-VNWgstKL.js";
|
|
7
|
-
import { EmptyState as i, ErrorMessage as a, LoadingState as o, getAriaProps as s, getErrorMessageId as c, getFormFieldCSSProperties as l, getOptionClasses as ee, getStateClasses as te, getTriggerClasses as ne, groupOptions as re, useFormFieldId as
|
|
8
|
-
import { Label as
|
|
9
|
-
import { a as
|
|
7
|
+
import { EmptyState as i, ErrorMessage as a, LoadingState as o, getAriaProps as s, getErrorMessageId as c, getFormFieldCSSProperties as l, getOptionClasses as ee, getStateClasses as te, getTriggerClasses as ne, groupOptions as re, useFormFieldId as ie, useFormFieldState as u } from "./utils/formFieldUtils.js";
|
|
8
|
+
import { Label as d } from "./Label.js";
|
|
9
|
+
import { a as f, c as p, d as m, f as h, h as g, i as _, l as ae, m as oe, n as se, o as ce, p as le, r as ue, t as v, u as y } from "./dist-fW81qjVl.js";
|
|
10
10
|
import { useState as b } from "react";
|
|
11
11
|
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
12
12
|
//#region src/components/Select/Select.tsx
|
|
13
13
|
var w = (w) => {
|
|
14
|
-
let T = "value" in w, { align: E = "start", alignOffset: D = 0, avoidCollisions: O = !0, className: k, collisionBoundary: A, collisionPadding: j = 10, defaultValue: M, emptyMessage: N = "No options found", errorMessage: P, id: F, label: I, labelClassName: L, loadingMessage: de = "Loading…", name: R, onChange: z, options: B = [], placeholder: V = "Select an option", position: H = "popper", ref: fe, side: pe = "bottom", sideOffset: me = 4, state: U = "default", value: W, "aria-label": he, "aria-describedby": ge, ...G } = w, K = T ? W ?? "" : W, [q, _e] = b(!1), J =
|
|
14
|
+
let T = "value" in w, { align: E = "start", alignOffset: D = 0, avoidCollisions: O = !0, className: k, collisionBoundary: A, collisionPadding: j = 10, defaultValue: M, emptyMessage: N = "No options found", errorMessage: P, id: F, label: I, labelClassName: L, loadingMessage: de = "Loading…", name: R, onChange: z, options: B = [], placeholder: V = "Select an option", position: H = "popper", ref: fe, side: pe = "bottom", sideOffset: me = 4, state: U = "default", value: W, "aria-label": he, "aria-describedby": ge, ...G } = w, K = T ? W ?? "" : W, [q, _e] = b(!1), J = ie(F, R), Y = c(J), { isDisabled: X, isLoading: Z, isInvalid: ve } = u(G.disabled, U), ye = s(U, ge, G.required, Y), { groups: Q, ungrouped: $ } = re(B), be = () => {
|
|
15
15
|
if (Z) return /* @__PURE__ */ S(o, {
|
|
16
16
|
"data-testid": "spectral-select-loading",
|
|
17
17
|
message: de
|
|
@@ -22,16 +22,16 @@ var w = (w) => {
|
|
|
22
22
|
});
|
|
23
23
|
let t = (t) => {
|
|
24
24
|
let n = K === t.value;
|
|
25
|
-
return /* @__PURE__ */ C(
|
|
25
|
+
return /* @__PURE__ */ C(_, {
|
|
26
26
|
className: r(ee(!!t.disabled, !1, n), "relative flex w-full cursor-pointer items-center"),
|
|
27
27
|
"data-testid": "spectral-select-item",
|
|
28
28
|
disabled: t.disabled,
|
|
29
29
|
value: t.value,
|
|
30
|
-
children: [/* @__PURE__ */ S(
|
|
30
|
+
children: [/* @__PURE__ */ S(ce, {
|
|
31
31
|
"data-testid": "spectral-select-item-text",
|
|
32
32
|
className: "block truncate",
|
|
33
33
|
children: t.label
|
|
34
|
-
}), /* @__PURE__ */ S(
|
|
34
|
+
}), /* @__PURE__ */ S(f, {
|
|
35
35
|
"data-testid": "spectral-select-item-selected-indicator",
|
|
36
36
|
asChild: !0,
|
|
37
37
|
children: /* @__PURE__ */ S("span", {
|
|
@@ -41,17 +41,17 @@ var w = (w) => {
|
|
|
41
41
|
})]
|
|
42
42
|
}, t.value);
|
|
43
43
|
};
|
|
44
|
-
return /* @__PURE__ */ C(x, { children: [$.length > 0 && /* @__PURE__ */ C(x, { children: [$.map(t), Object.keys(Q).length > 0 && /* @__PURE__ */ S(
|
|
44
|
+
return /* @__PURE__ */ C(x, { children: [$.length > 0 && /* @__PURE__ */ C(x, { children: [$.map(t), Object.keys(Q).length > 0 && /* @__PURE__ */ S(h, {
|
|
45
45
|
className: "-mx-1 my-1 h-px bg-border-secondary",
|
|
46
46
|
"data-testid": "spectral-select-separator"
|
|
47
|
-
})] }), Object.entries(Q).map(([e, n], i) => /* @__PURE__ */ C(
|
|
47
|
+
})] }), Object.entries(Q).map(([e, n], i) => /* @__PURE__ */ C(se, {
|
|
48
48
|
"data-testid": "spectral-select-group",
|
|
49
49
|
children: [
|
|
50
|
-
i > 0 && /* @__PURE__ */ S(
|
|
50
|
+
i > 0 && /* @__PURE__ */ S(h, {
|
|
51
51
|
className: "-mx-1 my-1 h-px bg-border-secondary",
|
|
52
52
|
"data-testid": "spectral-select-group-separator"
|
|
53
53
|
}),
|
|
54
|
-
/* @__PURE__ */ S(
|
|
54
|
+
/* @__PURE__ */ S(d, {
|
|
55
55
|
className: r("px-2 py-1.5 text-base font-semibold text-text-primary", L),
|
|
56
56
|
"data-testid": "spectral-select-group-label",
|
|
57
57
|
children: e
|
|
@@ -63,13 +63,13 @@ var w = (w) => {
|
|
|
63
63
|
return /* @__PURE__ */ C("div", {
|
|
64
64
|
className: "w-full",
|
|
65
65
|
children: [
|
|
66
|
-
I && /* @__PURE__ */ S(
|
|
66
|
+
I && /* @__PURE__ */ S(d, {
|
|
67
67
|
className: r("mb-2 block text-text-primary", L, X && "text-text-secondary"),
|
|
68
68
|
"data-testid": "spectral-select-label",
|
|
69
69
|
htmlFor: J,
|
|
70
70
|
children: I
|
|
71
71
|
}),
|
|
72
|
-
/* @__PURE__ */ C(
|
|
72
|
+
/* @__PURE__ */ C(ae, {
|
|
73
73
|
"data-testid": "spectral-select",
|
|
74
74
|
defaultValue: M,
|
|
75
75
|
disabled: X,
|
|
@@ -79,12 +79,12 @@ var w = (w) => {
|
|
|
79
79
|
open: q,
|
|
80
80
|
required: G.required,
|
|
81
81
|
value: K,
|
|
82
|
-
children: [/* @__PURE__ */ S(
|
|
82
|
+
children: [/* @__PURE__ */ S(le, {
|
|
83
83
|
"aria-controls": J,
|
|
84
84
|
"aria-expanded": q,
|
|
85
85
|
"aria-label": he ?? I,
|
|
86
86
|
asChild: !0,
|
|
87
|
-
className: r(ne(!1, U), te(U), k),
|
|
87
|
+
className: r(ne(!1, U), te(U), "text-input-text data-placeholder:text-input-text!", k),
|
|
88
88
|
"data-slot": "select-trigger",
|
|
89
89
|
"data-state": U,
|
|
90
90
|
"data-testid": "spectral-select-trigger",
|
|
@@ -95,24 +95,25 @@ var w = (w) => {
|
|
|
95
95
|
...ye,
|
|
96
96
|
...G,
|
|
97
97
|
children: /* @__PURE__ */ C("button", {
|
|
98
|
+
className: "min-w-0 gap-2 [&>span]:min-w-0 grid w-full cursor-pointer grid-cols-[minmax(0,1fr)_auto] items-center overflow-hidden text-left whitespace-nowrap text-input-text! data-placeholder:text-input-text! [&>span]:block [&>span]:overflow-hidden [&>span]:text-ellipsis [&>span]:whitespace-nowrap [&>span[data-placeholder]]:text-input-text!",
|
|
98
99
|
type: "button",
|
|
99
100
|
disabled: X,
|
|
100
|
-
children: [/* @__PURE__ */ S(
|
|
101
|
-
className: "block truncate",
|
|
101
|
+
children: [/* @__PURE__ */ S(oe, {
|
|
102
|
+
className: "min-w-0 block max-w-full flex-1 truncate text-left whitespace-nowrap text-input-text! data-placeholder:text-input-text!",
|
|
102
103
|
"data-testid": "spectral-select-value",
|
|
103
104
|
placeholder: V
|
|
104
|
-
}), /* @__PURE__ */ S(
|
|
105
|
+
}), /* @__PURE__ */ S(ue, {
|
|
105
106
|
asChild: !0,
|
|
106
107
|
children: /* @__PURE__ */ S("div", {
|
|
107
|
-
className: "flex items-center",
|
|
108
|
+
className: "flex shrink-0 cursor-pointer items-center",
|
|
108
109
|
children: Z ? /* @__PURE__ */ S(n, { size: 20 }) : /* @__PURE__ */ S(t, {
|
|
109
|
-
className: "transition-transform duration-200
|
|
110
|
+
className: r("transition-transform duration-200", q && "rotate-180"),
|
|
110
111
|
size: 20
|
|
111
112
|
})
|
|
112
113
|
})
|
|
113
114
|
})]
|
|
114
115
|
})
|
|
115
|
-
}), /* @__PURE__ */ S(
|
|
116
|
+
}), /* @__PURE__ */ S(p, { children: /* @__PURE__ */ C(v, {
|
|
116
117
|
align: E,
|
|
117
118
|
alignOffset: D,
|
|
118
119
|
avoidCollisions: O,
|
|
@@ -125,7 +126,7 @@ var w = (w) => {
|
|
|
125
126
|
side: pe,
|
|
126
127
|
sideOffset: me,
|
|
127
128
|
children: [
|
|
128
|
-
/* @__PURE__ */ S(
|
|
129
|
+
/* @__PURE__ */ S(m, {
|
|
129
130
|
className: "py-1 flex cursor-default items-center justify-center",
|
|
130
131
|
"data-testid": "spectral-select-scroll-up-button",
|
|
131
132
|
children: /* @__PURE__ */ S(t, {
|
|
@@ -134,7 +135,7 @@ var w = (w) => {
|
|
|
134
135
|
size: 18
|
|
135
136
|
})
|
|
136
137
|
}),
|
|
137
|
-
/* @__PURE__ */ S(
|
|
138
|
+
/* @__PURE__ */ S(g, {
|
|
138
139
|
asChild: !0,
|
|
139
140
|
children: /* @__PURE__ */ S("div", {
|
|
140
141
|
className: r("p-1", H === "popper" && "scroll-my-1 h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)"),
|
|
@@ -2,7 +2,7 @@ import { ComponentProps } from 'react';
|
|
|
2
2
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
3
3
|
export declare const Select: ({ ...props }: ComponentProps<typeof SelectPrimitive.Root>) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export declare const SelectGroup: ({ ...props }: ComponentProps<typeof SelectPrimitive.Group>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
export declare const SelectValue: ({ ...props }: ComponentProps<typeof SelectPrimitive.Value>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const SelectValue: ({ className, ...props }: ComponentProps<typeof SelectPrimitive.Value>) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare const SelectTrigger: ({ asChild, children, className, size, ...props }: ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
7
7
|
size?: "sm" | "default";
|
|
8
8
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/primitives/select.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAEzD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C,eAAO,MAAM,MAAM,GAAI,cAAc,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,4CAE/E,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,cAAc,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,4CAErF,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/primitives/select.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAEzD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C,eAAO,MAAM,MAAM,GAAI,cAAc,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,4CAE/E,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,cAAc,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,4CAErF,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,yBAAyB,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,4CAEhG,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,kDAM3B,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,GAAG;IAClD,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;CACxB,4CAoBA,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,oDAA0E,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,4CAsBrJ,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,yBAAyB,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,4CAEhG,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,mCAAmC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,4CAkBxG,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,yBAAyB,cAAc,CAAC,OAAO,eAAe,CAAC,SAAS,CAAC,4CAExG,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,yBAAyB,cAAc,CAAC,OAAO,eAAe,CAAC,cAAc,CAAC,4CAMlH,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,yBAAyB,cAAc,CAAC,OAAO,eAAe,CAAC,gBAAgB,CAAC,4CAMtH,CAAA"}
|
|
@@ -12,18 +12,22 @@ var x = ({ ...e }) => /* @__PURE__ */ y(u, {
|
|
|
12
12
|
}), S = ({ ...e }) => /* @__PURE__ */ y(f, {
|
|
13
13
|
"data-slot": "select-group",
|
|
14
14
|
...e
|
|
15
|
-
}), C = ({
|
|
15
|
+
}), C = ({ className: e, ...t }) => /* @__PURE__ */ y(d, {
|
|
16
|
+
className: r("min-w-0 block max-w-full flex-1 truncate text-left whitespace-nowrap text-input-text! data-placeholder:text-input-text!", e),
|
|
16
17
|
"data-slot": "select-value",
|
|
17
|
-
...
|
|
18
|
+
...t
|
|
18
19
|
}), w = ({ asChild: e, children: n, className: i, size: a = "default", ...o }) => /* @__PURE__ */ b(m, {
|
|
19
20
|
asChild: e,
|
|
20
|
-
className: r("[&_svg:not([class*='text-'])]:text-text-placeholder focus-visible:border-ring focus-visible:ring-ring/50 gap-2 rounded-md px-3 py-2 text-sm shadow-xs h-9 *:data-[slot=select-value]:gap-2 [&_svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between border border-input-border bg-transparent
|
|
21
|
+
className: r("[&_svg:not([class*='text-'])]:text-text-placeholder focus-visible:border-ring focus-visible:ring-ring/50 gap-2 rounded-md px-3 py-2 text-sm shadow-xs h-9 *:data-[slot=select-value]:gap-2 [&_svg:not([class*='size-'])]:size-4 min-w-0 *:data-[slot=select-value]:min-w-0 flex w-fit cursor-pointer items-center justify-between border border-input-border bg-transparent text-input-text! transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-danger-400 data-placeholder:text-input-text! *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center data-[state=open]:**:data-[slot=select-chevron]:rotate-180 [&_svg]:pointer-events-none [&_svg]:shrink-0", i),
|
|
21
22
|
"data-size": a,
|
|
22
23
|
"data-slot": "select-trigger",
|
|
23
24
|
...o,
|
|
24
25
|
children: [n, !e && /* @__PURE__ */ y(h, {
|
|
25
26
|
asChild: !0,
|
|
26
|
-
children: /* @__PURE__ */ y(t, {
|
|
27
|
+
children: /* @__PURE__ */ y(t, {
|
|
28
|
+
className: "size-4 opacity-50 transition-transform duration-200",
|
|
29
|
+
"data-slot": "select-chevron"
|
|
30
|
+
})
|
|
27
31
|
})]
|
|
28
32
|
}), T = ({ align: e = "center", children: t, className: n, position: i = "popper", ...o }) => /* @__PURE__ */ y(a, { children: /* @__PURE__ */ b(_, {
|
|
29
33
|
align: e,
|
|
@@ -106,8 +106,8 @@
|
|
|
106
106
|
--color-button-ghost-text--hover: var(--horizon-color-accent);
|
|
107
107
|
--color-button-ghost-text--disabled: var(--horizon-color-neutral-400);
|
|
108
108
|
|
|
109
|
-
--color-button-danger: var(--horizon-color-danger-
|
|
110
|
-
--color-button-danger--hover: color-mix(in oklab, var(--horizon-color-danger-
|
|
109
|
+
--color-button-danger: var(--horizon-color-danger-400);
|
|
110
|
+
--color-button-danger--hover: color-mix(in oklab, var(--horizon-color-danger-500) 80%, transparent);
|
|
111
111
|
|
|
112
112
|
--color-checkbox-border: var(--horizon-color-neutral-100);
|
|
113
113
|
--color-checkbox-border--focus: var(--horizon-color-accent);
|