@spear-ai/spectral 1.10.0 → 1.10.2

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 CHANGED
@@ -92,21 +92,22 @@ import { SpectralProvider as Ke } from "./SpectralProvider.js";
92
92
  import { Drawer as qe } from "./Drawer.js";
93
93
  import { n as Je, r as Ye, t as Xe } from "./HoverCard-CYDsIiVK.js";
94
94
  import { Input as Ze } from "./Input.js";
95
- import { t as Qe } from "./InputOTP-XUWW9xcI.js";
96
- import { Kbd as $e, KbdGroup as et } from "./Kbd.js";
97
- import { MultiSelect as tt } from "./MultiSelect.js";
98
- import { RadioButtonGroup as nt, RadioButtonGroupItem as rt } from "./RadioButtonGroup.js";
99
- import { RadioButton as it } from "./RadioButton.js";
100
- import { n as at, t as ot } from "./RadioGroup-w_q6RGEK.js";
101
- import { Select as st } from "./Select.js";
102
- import { Skeleton as ct } from "./Skeleton.js";
103
- import { t as lt } from "./Slider-BzzZT3Zm.js";
104
- import { t as ut } from "./Switch-CVzRJ-0n.js";
105
- import { Tabs as dt } from "./Tabs.js";
106
- import { Textarea as ft } from "./Textarea.js";
107
- import { n as pt, t as mt } from "./Toast-9zqXxKKO.js";
108
- import { Toggle as ht } from "./Toggle.js";
109
- import { ToggleGroup as gt, ToggleGroupItem as _t } from "./ToggleGroup.js";
110
- import { i as vt, n as yt, t as bt } from "./Tooltip-D1K8kY1y.js";
111
- import { Tray as xt } from "./Tray.js";
112
- export { ve as Accordion, be as Alert, n as AnalyzeIcon, r as AnnotationsIcon, i as ApprovedIcon, a as ArrowDownIcon, o as ArrowUpIcon, xe as Avatar, Se as Badge, s as BoxToolIcon, Ce as Button, Te as ButtonGroup, Ee as ButtonGroupItem, De as ButtonGroupSeparator, Oe as ButtonIcon, c as CalendarIcon, l as CheckCircleIcon, u as CheckSquareIcon, Ae as Checkbox, d as CheckmarkIcon, f as ChevronDownIcon, p as ChevronUpIcon, m as ClockIcon, h as CloseCircleIcon, g as CloseIcon, Re as Combobox, ze as ControlGroupSelect, _ as DashboardIcon, Be as DataCard, v as DatabaseIcon, We as DateTimePicker, y as DeleteIcon, Ge as Dialog, qe as Drawer, b as DurationIcon, x as EditIcon, S as EmailIcon, C as EraserIcon, w as ErrorIcon, T as EyeClosedIcon, E as EyeClosedIcon2, D as EyeOpenIcon, O as FileDownloadIcon, k as GoToFirstIcon, A as GoToLastIcon, j as HarmonicCursorsIcon, Xe as HoverCard, Je as HoverCardContent, Ye as HoverCardTrigger, e as IconBase, M as InfoIcon, Ze as Input, Me as InputGroup, Ne as InputGroupAddon, Pe as InputGroupButton, Fe as InputGroupInput, Ie as InputGroupText, Le as InputGroupTextarea, Qe as InputOTP, $e as Kbd, et as KbdGroup, N as KeyboardIcon, je as Label, P as LabelIcon, F as LassoIcon, I as LineToolIcon, L as LiveViewIcon, R as LoaderIcon, z as LocationIcon, B as LogoutIcon, V as MeasureIcon, H as MessagesIcon, U as MetadataIcon, W as MinusIcon, tt as MultiSelect, G as OntologyIcon, K as PanelIconClose, q as PanelIconOpen, J as PlayIcon, Y as PlusIcon, X as PolygonIcon, Ve as Popover, He as PopoverContent, Ue as PopoverTrigger, Z as ProgressCheckIcon, it as RadioButton, nt as RadioButtonGroup, rt as RadioButtonGroupItem, ot as RadioGroup, at as RadioGroupItem, Q as ResetIcon, $ as ReviewedIcon, ee as ScissorsIcon, te as SearchIcon, st as Select, we as Separator, ne as SettingsIcon, ct as Skeleton, lt as Slider, re as SortAscendingIcon, ie as SortAtoZIcon, ae as SortDescendingIcon, oe as SortZtoAIcon, Ke as SpectralProvider, se as StackIcon, ce as StarIcon, t as SvgIdContext, ut as Switch, dt as Tabs, ft as Textarea, mt as Toast, ht as Toggle, gt as ToggleGroup, _t as ToggleGroupItem, bt as Tooltip, yt as TooltipContent, vt as TooltipTrigger, le as TrashIcon, xt as Tray, ue as UndoIcon, de as User2Icon, fe as UserIcon, pe as WarningIcon, me as ZoomAllIcon, he as ZoomXIcon, ge as ZoomYIcon, ye as cn, pt as toast, _e as useAccordionAutoScroll, ke as useControllableState };
95
+ import { InputNumeric as Qe } from "./InputNumeric.js";
96
+ import { t as $e } from "./InputOTP-cVn5Bzyp.js";
97
+ import { Kbd as et, KbdGroup as tt } from "./Kbd.js";
98
+ import { MultiSelect as nt } from "./MultiSelect.js";
99
+ import { RadioButtonGroup as rt, RadioButtonGroupItem as it } from "./RadioButtonGroup.js";
100
+ import { RadioButton as at } from "./RadioButton.js";
101
+ import { n as ot, t as st } from "./RadioGroup-w_q6RGEK.js";
102
+ import { Select as ct } from "./Select.js";
103
+ import { Skeleton as lt } from "./Skeleton.js";
104
+ import { t as ut } from "./Slider-BzzZT3Zm.js";
105
+ import { t as dt } from "./Switch-CVzRJ-0n.js";
106
+ import { Tabs as ft } from "./Tabs.js";
107
+ import { Textarea as pt } from "./Textarea.js";
108
+ import { n as mt, t as ht } from "./Toast-9zqXxKKO.js";
109
+ import { Toggle as gt } from "./Toggle.js";
110
+ import { ToggleGroup as _t, ToggleGroupItem as vt } from "./ToggleGroup.js";
111
+ import { i as yt, n as bt, t as xt } from "./Tooltip-D1K8kY1y.js";
112
+ import { Tray as St } from "./Tray.js";
113
+ export { ve as Accordion, be as Alert, n as AnalyzeIcon, r as AnnotationsIcon, i as ApprovedIcon, a as ArrowDownIcon, o as ArrowUpIcon, xe as Avatar, Se as Badge, s as BoxToolIcon, Ce as Button, Te as ButtonGroup, Ee as ButtonGroupItem, De as ButtonGroupSeparator, Oe as ButtonIcon, c as CalendarIcon, l as CheckCircleIcon, u as CheckSquareIcon, Ae as Checkbox, d as CheckmarkIcon, f as ChevronDownIcon, p as ChevronUpIcon, m as ClockIcon, h as CloseCircleIcon, g as CloseIcon, Re as Combobox, ze as ControlGroupSelect, _ as DashboardIcon, Be as DataCard, v as DatabaseIcon, We as DateTimePicker, y as DeleteIcon, Ge as Dialog, qe as Drawer, b as DurationIcon, x as EditIcon, S as EmailIcon, C as EraserIcon, w as ErrorIcon, T as EyeClosedIcon, E as EyeClosedIcon2, D as EyeOpenIcon, O as FileDownloadIcon, k as GoToFirstIcon, A as GoToLastIcon, j as HarmonicCursorsIcon, Xe as HoverCard, Je as HoverCardContent, Ye as HoverCardTrigger, e as IconBase, M as InfoIcon, Ze as Input, Me as InputGroup, Ne as InputGroupAddon, Pe as InputGroupButton, Fe as InputGroupInput, Ie as InputGroupText, Le as InputGroupTextarea, Qe as InputNumeric, $e as InputOTP, et as Kbd, tt as KbdGroup, N as KeyboardIcon, je as Label, P as LabelIcon, F as LassoIcon, I as LineToolIcon, L as LiveViewIcon, R as LoaderIcon, z as LocationIcon, B as LogoutIcon, V as MeasureIcon, H as MessagesIcon, U as MetadataIcon, W as MinusIcon, nt as MultiSelect, G as OntologyIcon, K as PanelIconClose, q as PanelIconOpen, J as PlayIcon, Y as PlusIcon, X as PolygonIcon, Ve as Popover, He as PopoverContent, Ue as PopoverTrigger, Z as ProgressCheckIcon, at as RadioButton, rt as RadioButtonGroup, it as RadioButtonGroupItem, st as RadioGroup, ot as RadioGroupItem, Q as ResetIcon, $ as ReviewedIcon, ee as ScissorsIcon, te as SearchIcon, ct as Select, we as Separator, ne as SettingsIcon, lt as Skeleton, ut as Slider, re as SortAscendingIcon, ie as SortAtoZIcon, ae as SortDescendingIcon, oe as SortZtoAIcon, Ke as SpectralProvider, se as StackIcon, ce as StarIcon, t as SvgIdContext, dt as Switch, ft as Tabs, pt as Textarea, ht as Toast, gt as Toggle, _t as ToggleGroup, vt as ToggleGroupItem, xt as Tooltip, bt as TooltipContent, yt as TooltipTrigger, le as TrashIcon, St as Tray, ue as UndoIcon, de as User2Icon, fe as UserIcon, pe as WarningIcon, me as ZoomAllIcon, he as ZoomXIcon, ge as ZoomYIcon, ye as cn, mt as toast, _e as useAccordionAutoScroll, ke as useControllableState };
@@ -1,88 +1,111 @@
1
1
  "use client";
2
2
  import "../styles/main.css";
3
3
  import { t as e } from "../twUtils-VNWgstKL.js";
4
- import { Label as t } from "../Label.js";
5
- import { Input as n } from "../primitives/input.js";
6
- import { Select as r, SelectContent as i, SelectItem as a, SelectTrigger as o, SelectValue as s } from "../primitives/select.js";
7
- import { ControlGroup as c, ControlGroupItem as l, useControlGroup as u } from "../ControlGroup.js";
8
- import { useId as d } from "react";
9
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
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 h = "placeholder:text-small! [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", g = "flex w-full min-w-0 flex-col gap-1.5", _ = ({ amountStep: e, ariaLabel: t, captionLayout: n = "inline", className: r, dataTestId: i = "spectral-control-group-select", disabled: a, errorMessage: o, inputAriaLabel: s, inputPlaceholder: l, maxAmount: u = 1e6, minAmount: f = 0, orientation: m = "horizontal", selectAriaLabel: h, selectOptions: g, selectPlaceholder: _, state: y = "default", type: b = "number", ...x }) => {
12
- let S = d(), C = `${S}-amount`, w = `${S}-select`, T = n === "above", E = T ? void 0 : l, D = T ? void 0 : _, O = T ? l ? void 0 : s ?? void 0 : s ?? l ?? void 0, k = T ? _ ? void 0 : h ?? void 0 : h ?? _ ?? void 0, A = !!a || y === "disabled";
13
- return /* @__PURE__ */ p(c, {
14
- "aria-label": t,
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, maxAmount: u = 1e6, minAmount: d = 0, orientation: p = "horizontal", selectAriaLabel: h, selectOptions: g, selectPlaceholder: y, state: b = "default", type: C = "number", ...T }) => {
19
+ let E = f(), D = `${E}-amount`, O = `${E}-select`, k = `${D}-label`, A = `${O}-label`, j = n === "above", M = j ? void 0 : c, N = j ? void 0 : y, P = S(c, _), F = S(y, v), I = s ?? (j ? void 0 : P), L = h ?? (j ? void 0 : F), R = x(c, 3), z = x(y, 5), B = t ?? `${P} and ${F}`, V = !!a || b === "disabled";
20
+ return /* @__PURE__ */ m(l, {
21
+ "aria-label": B,
15
22
  className: r,
16
23
  "data-testid": i,
17
24
  disabled: a,
18
25
  errorMessage: o,
19
- orientation: m,
20
- state: y,
21
- children: /* @__PURE__ */ p(v, {
26
+ orientation: p,
27
+ state: b,
28
+ children: /* @__PURE__ */ m(w, {
22
29
  amountStep: e,
23
30
  dataTestId: i,
24
- inputAccessibleName: O,
25
- inputCaption: E,
26
- inputId: C,
27
- isDisabled: A,
31
+ inputAccessibleName: I,
32
+ inputCaption: M,
33
+ inputId: D,
34
+ inputLabelId: k,
35
+ inputLabelText: P,
36
+ inputMinWidth: R,
37
+ isDisabled: V,
28
38
  maxAmount: u,
29
- minAmount: f,
30
- selectCaption: D,
39
+ minAmount: d,
40
+ selectCaption: N,
31
41
  selectOptions: g,
32
- selectProps: x,
33
- selectTriggerAriaLabel: k,
34
- selectTriggerId: w,
35
- type: b,
36
- useAboveLabels: T,
37
- inputPlaceholder: l,
38
- selectPlaceholder: _
42
+ selectLabelId: A,
43
+ selectLabelText: F,
44
+ selectProps: T,
45
+ selectTriggerAriaLabel: L,
46
+ selectTriggerId: O,
47
+ selectTriggerMinWidth: z,
48
+ type: C,
49
+ useAboveLabels: j
39
50
  })
40
51
  });
41
- }, v = ({ amountStep: c, dataTestId: d, inputAccessibleName: _, inputCaption: v, inputId: y, inputPlaceholder: b, isDisabled: x, maxAmount: S, minAmount: C, selectCaption: w, selectOptions: T, selectPlaceholder: E, selectProps: D, selectTriggerAriaLabel: O, selectTriggerId: k, type: A, useAboveLabels: j }) => {
42
- let { errorMessageId: M } = u(), N = /* @__PURE__ */ p(n, {
43
- "aria-describedby": M,
52
+ }, w = ({ amountStep: l, dataTestId: f, inputAccessibleName: _, inputCaption: v, inputId: x, inputLabelId: S, inputLabelText: C, inputMinWidth: w, isDisabled: T, maxAmount: E, minAmount: D, selectCaption: O, selectLabelId: k, selectLabelText: A, selectOptions: j, selectProps: M, selectTriggerAriaLabel: N, selectTriggerId: P, selectTriggerMinWidth: F, type: I, useAboveLabels: L }) => {
53
+ let { errorMessageId: R, orientation: z, state: B } = d(), V = z === "horizontal" ? "rounded-s-md rounded-e-none" : "rounded-ss-md rounded-se-md rounded-es-none rounded-ee-none", H = z === "horizontal" ? "rounded-s-none rounded-e-md" : "rounded-ss-none rounded-se-none rounded-es-md rounded-ee-md", U = z === "horizontal" ? "me-0" : "mbe-0", W = z === "horizontal" ? "me-0 [&>*:last-child]:-ms-0.5" : "mbe-0 [&>*:last-child]:-mt-0.5", G = /* @__PURE__ */ m(r, {
54
+ "aria-describedby": R,
44
55
  "aria-label": _,
45
- className: e(A === "number" && h, j && "rounded-s-md rounded-none"),
46
- "data-testid": `${d}-input`,
47
- disabled: x,
48
- id: j ? y : void 0,
49
- type: A === "number" ? "number" : "text",
56
+ "aria-labelledby": L ? S : void 0,
57
+ className: e(b, V, t(B), I === "number" && g, I === "number" && "tabular-nums"),
58
+ "data-testid": `${f}-input`,
59
+ disabled: T,
60
+ id: L ? x : void 0,
61
+ type: I === "number" ? "number" : "text",
50
62
  placeholder: v,
51
- min: C ?? 0,
52
- max: S ?? 1e6,
53
- step: c ?? 1
54
- }), P = /* @__PURE__ */ p(o, {
55
- "aria-describedby": M,
56
- "aria-label": O,
57
- className: e(j && "rounded-e-md rounded-none"),
58
- "data-testid": `${d}-select-trigger`,
59
- disabled: x,
60
- id: j ? k : void 0,
61
- children: /* @__PURE__ */ p(s, { placeholder: w })
63
+ style: w ? { minWidth: w } : void 0,
64
+ min: D ?? 0,
65
+ max: E ?? 1e6,
66
+ step: l ?? 1
67
+ }), K = /* @__PURE__ */ m(s, {
68
+ "aria-describedby": R,
69
+ "aria-label": N,
70
+ "aria-labelledby": L ? k : void 0,
71
+ className: e(b, H, "px-4 w-full justify-between focus-visible:ring-0", t(B)),
72
+ "data-testid": `${f}-select-trigger`,
73
+ disabled: T,
74
+ id: L ? P : void 0,
75
+ style: F ? { minWidth: F } : void 0,
76
+ children: /* @__PURE__ */ m(c, { placeholder: O })
62
77
  });
63
- return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(l, { children: j ? /* @__PURE__ */ m("div", {
64
- className: g,
65
- children: [b ? /* @__PURE__ */ p(t, {
66
- className: "text-text-primary",
67
- htmlFor: y,
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, {
78
+ return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(u, {
79
+ className: L ? U : void 0,
80
+ children: L ? /* @__PURE__ */ h("div", {
81
+ className: y,
82
+ children: [/* @__PURE__ */ m(n, {
77
83
  className: "text-text-primary",
78
- htmlFor: k,
79
- children: E
80
- }) : null, P]
81
- }) : P }), /* @__PURE__ */ p(i, { children: T.map((e) => /* @__PURE__ */ p(a, {
84
+ htmlFor: x,
85
+ id: S,
86
+ children: C
87
+ }), G]
88
+ }) : G
89
+ }), /* @__PURE__ */ h(i, {
90
+ "data-testid": `${f}-select-root`,
91
+ disabled: T,
92
+ ...M,
93
+ children: [/* @__PURE__ */ m(u, {
94
+ className: L ? W : void 0,
95
+ children: L ? /* @__PURE__ */ h("div", {
96
+ className: y,
97
+ children: [/* @__PURE__ */ m(n, {
98
+ className: "text-text-primary",
99
+ htmlFor: P,
100
+ id: k,
101
+ children: A
102
+ }), K]
103
+ }) : K
104
+ }), /* @__PURE__ */ m(a, { children: j.map((e) => /* @__PURE__ */ m(o, {
82
105
  value: e.value,
83
106
  children: e.label
84
107
  }, e.value)) })]
85
108
  })] });
86
109
  };
87
110
  //#endregion
88
- export { _ as ControlGroupSelect };
111
+ export { C as ControlGroupSelect };
@@ -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, getStateClasses 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";
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 d = s(null), f = () => {
10
- let e = c(d);
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
- }, p = ({ className: t, disabled: s, errorMessage: c, id: f, name: p, orientation: m = "horizontal", state: h = "default", ...g }) => {
14
- let _ = a(f, p), v = r(_), { isDisabled: y, isLoading: b, isInvalid: x } = o(s, h);
15
- return /* @__PURE__ */ u(d.Provider, {
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: x && c ? v : void 0,
18
- isDisabled: y,
19
- isInvalid: x,
20
- isLoading: b,
21
- orientation: m,
22
- state: h
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__ */ l("div", {
24
+ children: [/* @__PURE__ */ c("div", {
25
25
  "data-slot": "control-group",
26
- "data-orientation": m,
27
- "data-state": h,
28
- id: _,
26
+ "data-orientation": p,
27
+ "data-state": m,
28
+ id: g,
29
29
  role: "group",
30
- "aria-describedby": x && c ? v : void 0,
31
- className: e("group rounded-lg flex border-2 border-transparent", m === "vertical" && "flex-col", i(h), y && "pointer-events-none opacity-50", t),
32
- ...g
33
- }), x && c && /* @__PURE__ */ l(n, {
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: v,
36
- message: c
35
+ id: _,
36
+ message: s
37
37
  })]
38
38
  });
39
- }, m = ({ className: n, ...r }) => {
40
- let { orientation: i } = f();
41
- return /* @__PURE__ */ l(t, {
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-px h-auto", i === "vertical" && "first:rounded-ss-md first:rounded-se-md last:rounded-ee-md last:rounded-es-md last:mbe-0 -mbe-px w-auto", n),
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 { p as ControlGroup, m as ControlGroupItem, f as useControlGroup };
48
+ export { f as ControlGroup, p as ControlGroupItem, d as useControlGroup };
package/dist/DataCard.js CHANGED
@@ -23,7 +23,7 @@ var s = ({ accentColor: s, cardHeaderEndSlot: c, className: l, dataDescription:
23
23
  }), /* @__PURE__ */ a(n, { children: /* @__PURE__ */ o("div", {
24
24
  className: "gap-4 flex flex-col",
25
25
  children: [/* @__PURE__ */ a("div", {
26
- className: "text-4xl font-bold",
26
+ className: "text-4xl font-bold tabular-nums",
27
27
  "data-testid": "spectral-datacard-data-value",
28
28
  style: { color: s },
29
29
  children: d
package/dist/Input.js CHANGED
@@ -5,19 +5,19 @@ import { CloseCircleIcon as t } from "./Icons/CloseCircleIcon.js";
5
5
  import { ErrorIcon as n } from "./Icons/ErrorIcon.js";
6
6
  import { EyeClosedIcon as r } from "./Icons/EyeClosedIcon.js";
7
7
  import { EyeOpenIcon as i } from "./Icons/EyeOpenIcon.js";
8
- import { LoaderIcon as ee } from "./Icons/LoaderIcon.js";
9
- import { t as a } from "./twUtils-VNWgstKL.js";
10
- import { ErrorMessage as o, getAriaProps as s, getFormFieldCSSProperties as c, getInputClasses as l, useFormFieldId as u, useFormFieldState as d } from "./utils/formFieldUtils.js";
11
- import { Label as f } from "./Label.js";
12
- import { useClearOnFocus as te, usePasswordVisibility as ne, usePrefixWidth as p } from "./Input/InputUtils.js";
13
- import { useCallback as m, useRef as h } from "react";
14
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
8
+ import { LoaderIcon as a } from "./Icons/LoaderIcon.js";
9
+ import { t as o } from "./twUtils-VNWgstKL.js";
10
+ import { ErrorMessage as s, getAriaProps as c, getFormFieldCSSProperties as l, getInputClasses as u, useFormFieldId as d, useFormFieldState as f } from "./utils/formFieldUtils.js";
11
+ import { Label as ee } from "./Label.js";
12
+ import { useClearOnFocus as te, usePasswordVisibility as p, usePrefixWidth as m } from "./Input/InputUtils.js";
13
+ import { useCallback as h, useRef as g } from "react";
14
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
15
15
  //#region src/components/Input/Input.tsx
16
- var v = (...e) => (t) => {
16
+ var y = (...e) => (t) => {
17
17
  e.forEach((e) => {
18
18
  e && (typeof e == "function" ? e(t) : e.current = t);
19
19
  });
20
- }, y = (e) => ({
20
+ }, ne = (e) => ({
21
21
  date: "off",
22
22
  email: "email",
23
23
  number: "off",
@@ -27,81 +27,81 @@ var v = (...e) => (t) => {
27
27
  url: "url",
28
28
  "datetime-local": "off"
29
29
  })[e] || "off", b = ({ className: b, clearOnFocus: x = !1, disabled: S, endIcon: C, errorMessage: w, id: re, label: T, labelClassName: E, name: D, onBlur: O, onChange: k, onFocus: A, placeholder: j, prefix: M, ref: N, required: P, showClearButton: F = !1, startIcon: I, state: L = "default", suppressHydrationWarning: R = !0, type: z = "text", value: B = "", "aria-label": V, "aria-describedby": H, ...U }) => {
30
- let W = u(re, D), G = `${W}-error`, { isDisabled: K, isLoading: q, isInvalid: J } = d(S, L), Y = s(L, H, P, G), X = h(null), ie = v(N, X), { isVisible: Z, toggleVisibility: ae, inputType: oe } = ne(), { prefixWidth: se, prefixRef: ce } = p(M), { handleFocus: Q } = te(x, k ? (e) => k(e.target.value) : void 0), le = m((e) => {
30
+ let W = d(re, D), G = `${W}-error`, { isDisabled: K, isLoading: q, isInvalid: J } = f(S, L), Y = c(L, H, P, G), X = g(null), ie = y(N, X), { isVisible: Z, toggleVisibility: ae, inputType: oe } = p(), { prefixWidth: se, prefixRef: ce } = m(M), { handleFocus: Q } = te(x, k ? (e) => k(e.target.value) : void 0), le = h((e) => {
31
31
  O?.(e);
32
- }, [O]), ue = m((e) => {
32
+ }, [O]), ue = h((e) => {
33
33
  Q(e, A);
34
- }, [Q, A]), de = m((e) => {
34
+ }, [Q, A]), de = h((e) => {
35
35
  let t = e.target.value;
36
36
  k?.(t);
37
- }, [k]), fe = m(() => {
37
+ }, [k]), fe = h(() => {
38
38
  let e = X.current;
39
39
  e && (e.value = "", e.dispatchEvent(new Event("input", { bubbles: !0 })), e.focus());
40
40
  }, []), $ = F && B.length > 0, pe = () => {
41
- let a = "absolute right-4 top-1/2 -translate-y-1/2 text-input-icon hover:text-input-icon--hover focus:outline-none cursor-pointer", o = {
42
- password: () => /* @__PURE__ */ g("button", {
41
+ let o = "absolute right-4 top-1/2 -translate-y-1/2 text-input-icon hover:text-input-icon--hover focus:outline-none cursor-pointer", s = {
42
+ password: () => /* @__PURE__ */ _("button", {
43
43
  "aria-controls": W,
44
44
  "aria-label": Z ? `Hide ${T ?? "password"}` : `Show ${T ?? "password"}`,
45
45
  "aria-pressed": Z,
46
- className: a,
46
+ className: o,
47
47
  "data-testid": "spectral-input-password-toggle",
48
48
  onClick: ae,
49
49
  type: "button",
50
- children: g(Z ? r : i, { size: 22 })
50
+ children: _(Z ? r : i, { size: 22 })
51
51
  }),
52
- clear: () => /* @__PURE__ */ g("button", {
52
+ clear: () => /* @__PURE__ */ _("button", {
53
53
  "aria-label": String(`Clear ${T ?? "input"}`),
54
- className: a,
54
+ className: o,
55
55
  "data-testid": "spectral-input-clear-button",
56
56
  onClick: fe,
57
57
  type: "button",
58
- children: /* @__PURE__ */ g(t, { size: 24 })
58
+ children: /* @__PURE__ */ _(t, { size: 24 })
59
59
  }),
60
- loading: () => /* @__PURE__ */ g("div", {
60
+ loading: () => /* @__PURE__ */ _("div", {
61
61
  className: "right-4 text-input-icon absolute top-1/2 -translate-y-1/2",
62
62
  "data-testid": "spectral-input-loading-icon",
63
- children: /* @__PURE__ */ g(ee, { size: 24 })
63
+ children: /* @__PURE__ */ _(a, { size: 24 })
64
64
  }),
65
- error: () => /* @__PURE__ */ g("div", {
65
+ error: () => /* @__PURE__ */ _("div", {
66
66
  className: "right-4 absolute top-1/2 -translate-y-1/2 text-danger-400",
67
67
  "data-testid": "spectral-input-error-icon",
68
- children: /* @__PURE__ */ g(n, { size: 24 })
68
+ children: /* @__PURE__ */ _(n, { size: 24 })
69
69
  }),
70
- success: () => /* @__PURE__ */ g("div", {
70
+ success: () => /* @__PURE__ */ _("div", {
71
71
  className: "right-4 absolute top-1/2 -translate-y-1/2 text-success-400",
72
72
  "data-testid": "spectral-input-success-icon",
73
- children: /* @__PURE__ */ g(e, { size: 24 })
73
+ children: /* @__PURE__ */ _(e, { size: 24 })
74
74
  })
75
75
  };
76
- return C ? /* @__PURE__ */ g("div", {
76
+ return C ? /* @__PURE__ */ _("div", {
77
77
  className: "right-4 text-input-icon absolute top-1/2 -translate-y-1/2",
78
78
  children: C
79
- }) : z === "password" ? o.password() : $ ? o.clear() : q ? o.loading() : L === "success" ? o.success() : L === "error" ? o.error() : null;
80
- }, me = () => I || null, he = a(l(L, b), "[text-indent:var(--prefix-width)]", $ && "pr-10"), ge = a("inset-y-0 left-4 text-base pointer-events-none absolute flex items-center text-input-text-prefix opacity-100 peer-disabled:opacity-50");
81
- return /* @__PURE__ */ _("div", {
79
+ }) : z === "password" ? s.password() : $ ? s.clear() : q ? s.loading() : L === "success" ? s.success() : L === "error" ? s.error() : null;
80
+ }, me = () => I || null, he = z === "number" || z === "date" || z === "datetime-local", ge = o(u(L, b), "[text-indent:var(--prefix-width)]", $ && "pr-10", he && "tabular-nums"), _e = o("inset-y-0 left-4 text-base pointer-events-none absolute flex items-center text-input-text-prefix opacity-100 peer-disabled:opacity-50");
81
+ return /* @__PURE__ */ v("div", {
82
82
  className: "space-y-1.5 w-full",
83
83
  "data-testid": "spectral-input-container",
84
- children: [T && /* @__PURE__ */ g(f, {
85
- className: a("mb-2 block", E, K && "cursor-not-allowed text-input-text--disabled placeholder:text-input-text-placeholder"),
84
+ children: [T && /* @__PURE__ */ _(ee, {
85
+ className: o("mb-2 block", E, K && "cursor-not-allowed text-input-text--disabled placeholder:text-input-text-placeholder"),
86
86
  "data-testid": "spectral-input-label",
87
87
  htmlFor: W,
88
88
  children: T
89
- }), /* @__PURE__ */ _("div", {
89
+ }), /* @__PURE__ */ v("div", {
90
90
  className: "relative",
91
91
  "data-testid": "spectral-input-wrapper",
92
- children: [/* @__PURE__ */ _("div", {
92
+ children: [/* @__PURE__ */ v("div", {
93
93
  className: "relative",
94
94
  children: [
95
95
  me(),
96
- M && /* @__PURE__ */ g("span", {
96
+ M && /* @__PURE__ */ _("span", {
97
97
  ref: ce,
98
- className: ge,
98
+ className: _e,
99
99
  children: M
100
100
  }),
101
- /* @__PURE__ */ g("input", {
101
+ /* @__PURE__ */ _("input", {
102
102
  "aria-label": V ?? T,
103
- autoComplete: y(z),
104
- className: he,
103
+ autoComplete: ne(z),
104
+ className: ge,
105
105
  "data-state": L,
106
106
  "data-testid": "spectral-input",
107
107
  disabled: K,
@@ -113,7 +113,7 @@ var v = (...e) => (t) => {
113
113
  placeholder: j ?? T,
114
114
  ref: ie,
115
115
  required: P,
116
- style: c({ "--prefix-width": M ? `${se}px` : "0" }),
116
+ style: l({ "--prefix-width": M ? `${se}px` : "0" }),
117
117
  suppressHydrationWarning: R,
118
118
  type: z === "password" ? oe : z,
119
119
  value: B,
@@ -122,7 +122,7 @@ var v = (...e) => (t) => {
122
122
  }),
123
123
  pe()
124
124
  ]
125
- }), J && w && /* @__PURE__ */ g(o, {
125
+ }), J && w && /* @__PURE__ */ _(s, {
126
126
  dataTestId: "spectral-input-error-message",
127
127
  id: G,
128
128
  message: w
@@ -0,0 +1,14 @@
1
+ import { InputProps } from '../Input/Input';
2
+ import { ReactElement } from 'react';
3
+ export type InputNumericProps = Omit<InputProps, 'inputMode' | 'onChange' | 'pattern' | 'type'> & {
4
+ allowDecimal?: boolean;
5
+ allowNegative?: boolean;
6
+ locale?: string;
7
+ onChange?: (value: string) => void;
8
+ value?: string;
9
+ };
10
+ export declare const InputNumeric: {
11
+ ({ allowDecimal, allowNegative, className, locale, max, min, onChange, onKeyDown, onPaste, step, value, ...props }: InputNumericProps): ReactElement;
12
+ displayName: string;
13
+ };
14
+ //# sourceMappingURL=InputNumeric.d.ts.map
@@ -0,0 +1,137 @@
1
+ "use client";
2
+ import "./styles/main.css";
3
+ import { t as e } from "./twUtils-VNWgstKL.js";
4
+ import { Input as t } from "./Input.js";
5
+ import { useCallback as n } from "react";
6
+ import { jsx as r } from "react/jsx-runtime";
7
+ //#region src/components/InputNumeric/InputNumeric.tsx
8
+ var i = /^\d$/, a = new Set([
9
+ "e",
10
+ "E",
11
+ "+"
12
+ ]), o = new Set([
13
+ "Backspace",
14
+ "Delete",
15
+ "ArrowLeft",
16
+ "ArrowRight",
17
+ "ArrowUp",
18
+ "ArrowDown",
19
+ "Home",
20
+ "End",
21
+ "Tab",
22
+ "Enter",
23
+ "Escape"
24
+ ]), s = (e) => {
25
+ try {
26
+ return new Intl.NumberFormat(e).formatToParts(1.1).find((e) => e.type === "decimal")?.value ?? ".";
27
+ } catch {
28
+ return ".";
29
+ }
30
+ }, c = (e, t) => t === "." ? e : e.replaceAll(t, "."), l = (e, t, n, r) => {
31
+ if (!e) return "";
32
+ let i = c(e, r).replace(/[^\d.-]/g, "");
33
+ if (n ? (i = i.replace(/(?!^)-/g, ""), i.startsWith("--") && (i = `-${i.replace(/-/g, "")}`)) : i = i.replace(/-/g, ""), !t) i = i.replace(/\./g, "");
34
+ else {
35
+ let e = i.indexOf(".");
36
+ e >= 0 && (i = `${i.slice(0, e + 1)}${i.slice(e + 1).replace(/\./g, "")}`);
37
+ }
38
+ return i;
39
+ }, u = (e) => {
40
+ if (e.selectionStart === null || e.selectionEnd === null) return !e.value.includes(".");
41
+ let t = e.value.slice(e.selectionStart, e.selectionEnd);
42
+ return !e.value.includes(".") || t.includes(".");
43
+ }, d = (e) => {
44
+ if (e.selectionStart === null || e.selectionEnd === null) return e.value.length === 0;
45
+ let t = e.selectionStart === 0, n = e.value.slice(e.selectionStart, e.selectionEnd);
46
+ return t && (!e.value.includes("-") || n.includes("-"));
47
+ }, f = (e) => {
48
+ if (e == null || e === "") return;
49
+ let t = typeof e == "number" ? e : Number.parseFloat(e);
50
+ return Number.isFinite(t) ? t : void 0;
51
+ }, p = (e) => {
52
+ let t = e.toString();
53
+ return t.includes(".") ? t.split(".")[1]?.length ?? 0 : 0;
54
+ }, m = (e, t) => {
55
+ if (t <= 0) return e;
56
+ let n = 10 ** t;
57
+ return Math.round(e * n) / n;
58
+ }, h = ({ allowDecimal: h = !0, allowNegative: g = !1, className: _, locale: v, max: y, min: b, onChange: x, onKeyDown: S, onPaste: C, step: w, value: T = "", ...E }) => {
59
+ let D = s(v), O = f(b), k = f(y), A = f(w), j = A && A > 0 ? A : 1, M = O ?? (g ? void 0 : 0), N = n((e) => {
60
+ if (S?.(e), !(e.defaultPrevented || e.nativeEvent.isComposing) && !(e.metaKey || e.ctrlKey || e.altKey)) {
61
+ if (e.key === "ArrowUp" || e.key === "ArrowDown") {
62
+ e.preventDefault();
63
+ let t = e.key === "ArrowUp" ? 1 : -1, n = c(T, D), r = Number.parseFloat(n), i = (Number.isFinite(r) ? r : M ?? 0) + t * j;
64
+ M !== void 0 && (i = Math.max(M, i)), k !== void 0 && (i = Math.min(k, i)), h || (i = Math.trunc(i));
65
+ let a = h ? p(j) : 0, o = m(i, a), s = Object.is(o, -0) ? 0 : o, u = a > 0 ? s.toFixed(a).replace(/\.?0+$/, "") : s.toString();
66
+ x?.(l(u, h, g, D));
67
+ return;
68
+ }
69
+ if (!o.has(e.key) && !i.test(e.key)) {
70
+ if (a.has(e.key)) {
71
+ e.preventDefault();
72
+ return;
73
+ }
74
+ if (e.key === "." || e.key === D) {
75
+ (!h || !u(e.currentTarget)) && e.preventDefault();
76
+ return;
77
+ }
78
+ if (e.key === "-") {
79
+ (!g || !d(e.currentTarget)) && e.preventDefault();
80
+ return;
81
+ }
82
+ e.preventDefault();
83
+ }
84
+ }
85
+ }, [
86
+ h,
87
+ g,
88
+ D,
89
+ M,
90
+ x,
91
+ S,
92
+ k,
93
+ j,
94
+ T
95
+ ]), P = n((e) => {
96
+ if (C?.(e), e.defaultPrevented) return;
97
+ let t = e.clipboardData.getData("text"), n = l(t, h, g, D);
98
+ if (c(t, D) === n) return;
99
+ e.preventDefault();
100
+ let r = e.currentTarget, i = r.selectionStart ?? r.value.length, a = r.selectionEnd ?? r.value.length, o = l(`${r.value.slice(0, i)}${n}${r.value.slice(a)}`, h, g, D);
101
+ x?.(o);
102
+ }, [
103
+ h,
104
+ g,
105
+ D,
106
+ x,
107
+ C
108
+ ]), F = n((e) => {
109
+ x?.(l(e, h, g, D));
110
+ }, [
111
+ h,
112
+ g,
113
+ D,
114
+ x
115
+ ]), I = h ? "decimal" : "numeric", L = h ? "[0-9]*[.]?[0-9]*" : "[0-9]*", R = c(T, D), z = R === "" || R === "-" || R === "." ? void 0 : Number.parseFloat(R);
116
+ return /* @__PURE__ */ r(t, {
117
+ ...E,
118
+ "aria-valuemax": k,
119
+ "aria-valuemin": M,
120
+ "aria-valuenow": Number.isFinite(z) ? z : void 0,
121
+ className: e("tabular-nums", _),
122
+ inputMode: I,
123
+ max: y,
124
+ min: b,
125
+ onChange: F,
126
+ onKeyDown: N,
127
+ onPaste: P,
128
+ pattern: L,
129
+ role: "spinbutton",
130
+ step: w,
131
+ type: "text",
132
+ value: T
133
+ });
134
+ };
135
+ h.displayName = "InputNumeric";
136
+ //#endregion
137
+ export { h as InputNumeric };