@spear-ai/spectral 1.8.8 → 1.9.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.
Files changed (54) hide show
  1. package/dist/.js +214 -210
  2. package/dist/Accordion.js +4 -4
  3. package/dist/Combobox/ComboboxBase.d.ts +8 -0
  4. package/dist/Combobox/ComboboxBase.js +80 -0
  5. package/dist/Combobox.d.ts +20 -0
  6. package/dist/Combobox.js +175 -0
  7. package/dist/ComboboxBase-CxNxYtdT.js +408 -0
  8. package/dist/ControlGroup/ControlGroupSelect.d.ts +33 -0
  9. package/dist/ControlGroup/ControlGroupSelect.js +104 -0
  10. package/dist/ControlGroup.d.ts +24 -0
  11. package/dist/ControlGroup.js +51 -0
  12. package/dist/Dialog.js +2 -2
  13. package/dist/Drawer.js +1 -1
  14. package/dist/HoverCard.js +4 -4
  15. package/dist/MultiSelect/MultiSelectBase.js +128 -126
  16. package/dist/Popover.js +1 -1
  17. package/dist/RadioGroup.d.ts +1 -1
  18. package/dist/RadioGroup.js +194 -204
  19. package/dist/Select.js +1 -1
  20. package/dist/Slider.js +3 -3
  21. package/dist/Tooltip.js +6 -6
  22. package/dist/Tray.d.ts +3 -1
  23. package/dist/Tray.js +36 -32
  24. package/dist/{Combination-CQ5bXZqE.js → index-6oYKCvIn.js} +179 -178
  25. package/dist/{index-CtqlhLRO.js → index-BFOf48AQ.js} +1 -1
  26. package/dist/{index-BJ6qs9i5.js → index-BlHU_t18.js} +7 -7
  27. package/dist/{index-D2Qxe4uK.js → index-Bm1RbF6w.js} +1 -1
  28. package/dist/{index-CXltlPV-.js → index-Bv2OIg5P.js} +6 -6
  29. package/dist/{index-Cgdmxb3F.js → index-CKEI0pDv.js} +1 -1
  30. package/dist/{index-CDkQCeZY.js → index-CM_hWgfC.js} +1 -1
  31. package/dist/{index-CJKg3MVV.js → index-C_YVr64u.js} +2 -2
  32. package/dist/{index-obMGvcdD.js → index-CwSyIPrv.js} +1 -1
  33. package/dist/{index-9OmOYyjJ.js → index-Dc0No4pV.js} +2 -1
  34. package/dist/{index-DqvTB1Bv.js → index-T6XEa11q.js} +7 -7
  35. package/dist/{index-CmWCa9Ae.js → index-pBCLb6Gr.js} +5 -5
  36. package/dist/{index-WBfSMXvE.js → index-psiVrsnE.js} +1 -1
  37. package/dist/index.d.ts +3 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/primitives/button.d.ts +1 -1
  40. package/dist/primitives/button.d.ts.map +1 -1
  41. package/dist/primitives/button.js +4 -4
  42. package/dist/{InputGroup.d.ts → primitives/input-group.d.ts} +10 -7
  43. package/dist/primitives/input-group.d.ts.map +1 -0
  44. package/dist/primitives/input-group.js +74 -0
  45. package/dist/primitives/input.d.ts +6 -1
  46. package/dist/primitives/input.d.ts.map +1 -1
  47. package/dist/primitives/input.js +1 -1
  48. package/dist/primitives/popover.d.ts +10 -0
  49. package/dist/primitives/popover.d.ts.map +1 -0
  50. package/dist/primitives/popover.js +26 -0
  51. package/dist/primitives/select.js +2 -2
  52. package/dist/styles/spectral.css +2 -2
  53. package/package.json +1 -1
  54. package/dist/InputGroup.js +0 -84
@@ -0,0 +1,104 @@
1
+ "use client";
2
+ import "../styles/main.css";
3
+ import { jsx as e, jsxs as x, Fragment as k } from "react/jsx-runtime";
4
+ import { ControlGroup as F, useControlGroup as j, ControlGroupItem as I } from "../ControlGroup.js";
5
+ import { Label as $ } from "../Label.js";
6
+ import { Input as E } from "../primitives/input.js";
7
+ import { SelectTrigger as z, SelectValue as M, Select as T, SelectContent as V, SelectItem as q } from "../primitives/select.js";
8
+ import { cn as w } from "../utils/twUtils.js";
9
+ import { useId as B } from "react";
10
+ const D = "placeholder:text-small! [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", y = "flex w-full min-w-0 flex-col gap-1.5", L = ({
11
+ amountStep: v,
12
+ ariaLabel: o,
13
+ captionLayout: C = "inline",
14
+ className: h,
15
+ dataTestId: i = "spectral-control-group-select",
16
+ disabled: l,
17
+ errorMessage: a,
18
+ inputAriaLabel: p,
19
+ inputPlaceholder: r,
20
+ maxAmount: N = 1e6,
21
+ minAmount: S = 0,
22
+ orientation: u = "horizontal",
23
+ selectAriaLabel: b,
24
+ selectOptions: G,
25
+ selectPlaceholder: n,
26
+ state: c = "default",
27
+ type: t = "number",
28
+ ...g
29
+ }) => {
30
+ const d = B(), f = `${d}-amount`, s = `${d}-select`, m = C === "above";
31
+ return /* @__PURE__ */ e(F, { "aria-label": o, className: h, "data-testid": i, disabled: l, errorMessage: a, orientation: u, state: c, children: /* @__PURE__ */ e(
32
+ H,
33
+ {
34
+ amountStep: v,
35
+ dataTestId: i,
36
+ inputAccessibleName: m ? r ? void 0 : p ?? void 0 : p ?? r ?? void 0,
37
+ inputCaption: m ? void 0 : r,
38
+ inputId: f,
39
+ isDisabled: !!l || c === "disabled",
40
+ maxAmount: N,
41
+ minAmount: S,
42
+ selectCaption: m ? void 0 : n,
43
+ selectOptions: G,
44
+ selectProps: g,
45
+ selectTriggerAriaLabel: m ? n ? void 0 : b ?? void 0 : b ?? n ?? void 0,
46
+ selectTriggerId: s,
47
+ type: t,
48
+ useAboveLabels: m,
49
+ inputPlaceholder: r,
50
+ selectPlaceholder: n
51
+ }
52
+ ) });
53
+ }, H = ({
54
+ amountStep: v,
55
+ dataTestId: o,
56
+ inputAccessibleName: C,
57
+ inputCaption: h,
58
+ inputId: i,
59
+ inputPlaceholder: l,
60
+ isDisabled: a,
61
+ maxAmount: p,
62
+ minAmount: r,
63
+ selectCaption: N,
64
+ selectOptions: S,
65
+ selectPlaceholder: u,
66
+ selectProps: b,
67
+ selectTriggerAriaLabel: G,
68
+ selectTriggerId: n,
69
+ type: c,
70
+ useAboveLabels: t
71
+ }) => {
72
+ const { errorMessageId: g } = j(), d = /* @__PURE__ */ e(
73
+ E,
74
+ {
75
+ "aria-describedby": g,
76
+ "aria-label": C,
77
+ className: w(c === "number" && D, t && "rounded-none rounded-s-md"),
78
+ "data-testid": `${o}-input`,
79
+ disabled: a,
80
+ id: t ? i : void 0,
81
+ type: c === "number" ? "number" : "text",
82
+ placeholder: h,
83
+ min: r ?? 0,
84
+ max: p ?? 1e6,
85
+ step: v ?? 1
86
+ }
87
+ ), f = /* @__PURE__ */ e(z, { "aria-describedby": g, "aria-label": G, className: w(t && "rounded-none rounded-e-md"), "data-testid": `${o}-select-trigger`, disabled: a, id: t ? n : void 0, children: /* @__PURE__ */ e(M, { placeholder: N }) });
88
+ return /* @__PURE__ */ x(k, { children: [
89
+ /* @__PURE__ */ e(I, { children: t ? /* @__PURE__ */ x("div", { className: y, children: [
90
+ l ? /* @__PURE__ */ e($, { className: "text-text-primary", htmlFor: i, children: l }) : null,
91
+ d
92
+ ] }) : d }),
93
+ /* @__PURE__ */ x(T, { "data-testid": `${o}-select-root`, disabled: a, ...b, children: [
94
+ /* @__PURE__ */ e(I, { children: t ? /* @__PURE__ */ x("div", { className: y, children: [
95
+ u ? /* @__PURE__ */ e($, { className: "text-text-primary", htmlFor: n, children: u }) : null,
96
+ f
97
+ ] }) : f }),
98
+ /* @__PURE__ */ e(V, { children: S.map((s) => /* @__PURE__ */ e(q, { value: s.value, children: s.label }, s.value)) })
99
+ ] })
100
+ ] });
101
+ };
102
+ export {
103
+ L as ControlGroupSelect
104
+ };
@@ -0,0 +1,24 @@
1
+ import { Slot } from './primitives/slot';
2
+ import { FormFieldState } from './utils/formFieldUtils';
3
+ import { ComponentProps } from 'react';
4
+ interface ControlGroupContextValue {
5
+ errorMessageId?: string;
6
+ isDisabled: boolean;
7
+ isInvalid: boolean;
8
+ isLoading: boolean;
9
+ orientation: 'horizontal' | 'vertical';
10
+ state: FormFieldState;
11
+ }
12
+ export declare const useControlGroup: () => ControlGroupContextValue;
13
+ export interface ControlGroupProps extends ComponentProps<'div'> {
14
+ disabled?: boolean;
15
+ errorMessage?: string | string[] | Record<string, unknown> | null;
16
+ id?: string;
17
+ name?: string;
18
+ orientation?: 'horizontal' | 'vertical';
19
+ state?: FormFieldState;
20
+ }
21
+ export declare const ControlGroup: ({ className, disabled, errorMessage, id, name, orientation, state, ...props }: ControlGroupProps) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const ControlGroupItem: ({ className, ...props }: ComponentProps<typeof Slot>) => import("react/jsx-runtime").JSX.Element;
23
+ export {};
24
+ //# sourceMappingURL=ControlGroup.d.ts.map
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import "./styles/main.css";
3
+ import { jsxs as x, jsx as a } from "react/jsx-runtime";
4
+ import { Slot as C } from "./primitives/slot.js";
5
+ import { useFormFieldId as v, useFormFieldState as b, getStateClasses as I, ErrorMessage as h, getErrorMessageId as G } from "./utils/formFieldUtils.js";
6
+ import { cn as u } from "./utils/twUtils.js";
7
+ import { createContext as w, useContext as F } from "react";
8
+ const m = w(null), z = () => {
9
+ const r = F(m);
10
+ if (r === null)
11
+ throw new Error("useControlGroup must be used within a ControlGroup");
12
+ return r;
13
+ }, D = ({ className: r, disabled: s, errorMessage: o, id: c, name: p, orientation: n = "horizontal", state: t = "default", ...f }) => {
14
+ const l = v(c, p), d = G(l), { isDisabled: i, isLoading: g, isInvalid: e } = b(s, t);
15
+ return /* @__PURE__ */ x(m.Provider, { value: { errorMessageId: e && o ? d : void 0, isDisabled: i, isInvalid: e, isLoading: g, orientation: n, state: t }, children: [
16
+ /* @__PURE__ */ a(
17
+ "div",
18
+ {
19
+ "data-slot": "control-group",
20
+ "data-orientation": n,
21
+ "data-state": t,
22
+ id: l,
23
+ role: "group",
24
+ "aria-describedby": e && o ? d : void 0,
25
+ className: u("group flex rounded-lg border-2 border-transparent", n === "vertical" && "flex-col", I(t), i && "pointer-events-none opacity-50", r),
26
+ ...f
27
+ }
28
+ ),
29
+ e && o && /* @__PURE__ */ a(h, { dataTestId: "spectral-control-group-error-message", id: d, message: o })
30
+ ] });
31
+ }, L = ({ className: r, ...s }) => {
32
+ const { orientation: o } = z();
33
+ return /* @__PURE__ */ a(
34
+ C,
35
+ {
36
+ "data-slot": "control-group-item",
37
+ className: u(
38
+ "rounded-none focus-within:z-10",
39
+ o === "horizontal" && "-me-px h-auto first:rounded-s-md last:me-0 last:rounded-e-md",
40
+ o === "vertical" && "-mbe-px w-auto first:rounded-ss-md first:rounded-se-md last:mbe-0 last:rounded-ee-md last:rounded-es-md",
41
+ r
42
+ ),
43
+ ...s
44
+ }
45
+ );
46
+ };
47
+ export {
48
+ D as ControlGroup,
49
+ L as ControlGroupItem,
50
+ z as useControlGroup
51
+ };
package/dist/Dialog.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import "./styles/main.css";
2
2
  import { jsx as o, jsxs as l } from "react/jsx-runtime";
3
3
  import { CloseIcon as m } from "./Icons/CloseIcon.js";
4
- import { R as p, C as i, a as f, D as u, O as x, P as b, T as h, b as v } from "./index-CmWCa9Ae.js";
4
+ import { R as p, C as i, a as f, D as u, O as x, P as b, T as h, b as v } from "./index-pBCLb6Gr.js";
5
5
  import { cn as e } from "./utils/twUtils.js";
6
6
  import "react";
7
- import { R as y } from "./Combination-CQ5bXZqE.js";
7
+ import { R as y } from "./index-6oYKCvIn.js";
8
8
  const j = ({
9
9
  isOpen: t,
10
10
  modal: a = !1,
package/dist/Drawer.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./styles/main.css";
2
2
  import { jsx as t, jsxs as s } from "react/jsx-runtime";
3
3
  import { SpectralProvider as f } from "./SpectralProvider.js";
4
- import { D as e } from "./index-D2Qxe4uK.js";
4
+ import { D as e } from "./index-Bm1RbF6w.js";
5
5
  const u = ({ children: l, defaultOpen: d = !1, description: i, direction: o = "right", dismissible: c = !0, modal: n = !0, onOpenChange: p, open: x, size: r = "380px", title: h, trigger: m }) => {
6
6
  const a = "font-sans! fixed", w = {
7
7
  left: {
package/dist/HoverCard.js CHANGED
@@ -3,10 +3,10 @@ import "./styles/main.css";
3
3
  import { jsx as i } from "react/jsx-runtime";
4
4
  import * as s from "react";
5
5
  import { createContext as I, useContext as B } from "react";
6
- import { e as U, c as m, P as $, u as W, a as z } from "./index-9OmOYyjJ.js";
7
- import { R as G, A as K, c as O, C as j, a as V } from "./index-CJKg3MVV.js";
8
- import { P as q, D as J } from "./index-BJ6qs9i5.js";
9
- import { P as T } from "./index-CtqlhLRO.js";
6
+ import { e as U, c as m, P as $, u as W, a as z } from "./index-Dc0No4pV.js";
7
+ import { R as G, A as K, c as O, C as j, a as V } from "./index-C_YVr64u.js";
8
+ import { P as q, D as J } from "./index-BlHU_t18.js";
9
+ import { P as T } from "./index-BFOf48AQ.js";
10
10
  import { cn as E } from "./utils/twUtils.js";
11
11
  var H, x = "HoverCard", [N] = z(x, [
12
12
  O