@spear-ai/spectral 0.1.1 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +7 -83
  2. package/dist/Button.d.ts +2 -0
  3. package/dist/Button.js +118 -0
  4. package/dist/Card.d.ts +2 -0
  5. package/dist/Card.js +25 -0
  6. package/dist/Drawer.d.ts +2 -0
  7. package/dist/Drawer.js +2163 -0
  8. package/dist/Skeleton.d.ts +2 -0
  9. package/dist/Skeleton.js +9 -0
  10. package/dist/Slider.d.ts +2 -0
  11. package/dist/Slider.js +563 -0
  12. package/dist/assets/spectral.css +1 -0
  13. package/dist/components/Button/Button.d.ts +1 -1
  14. package/dist/components/Drawer/Drawer.d.ts +10 -0
  15. package/dist/index-C-ErIYr7.js +225 -0
  16. package/dist/index.d.ts +3 -14
  17. package/dist/index.js +32 -0
  18. package/dist/loader-circle-Btf6jOd5.js +101 -0
  19. package/dist/primitives/button.d.ts +1 -1
  20. package/dist/primitives/tooltip.d.ts +1 -1
  21. package/dist/twUtils-B9ArqCOv.js +2747 -0
  22. package/dist/utils/twUtils.d.ts +1 -0
  23. package/package.json +48 -43
  24. package/src/styles/horizon.css +35 -0
  25. package/src/styles/main.css +34 -0
  26. package/dist/App.d.ts +0 -1
  27. package/dist/components/Accordion/Accordion.d.ts +0 -35
  28. package/dist/components/Checkbox/Checkbox.d.ts +0 -10
  29. package/dist/components/Input/Input.d.ts +0 -21
  30. package/dist/components/Input/InputUtils.d.ts +0 -10
  31. package/dist/components/InputOtp/InputOtp.d.ts +0 -29
  32. package/dist/components/Label/Label.d.ts +0 -3
  33. package/dist/components/RadioGroup/Label.d.ts +0 -4
  34. package/dist/components/RadioGroup/RadioGroup.d.ts +0 -38
  35. package/dist/components/Select/Select.d.ts +0 -24
  36. package/dist/components/Select/SelectList.d.ts +0 -17
  37. package/dist/components/Sidebar/Sidebar.d.ts +0 -1
  38. package/dist/components/Sidebar/SidebarBase.d.ts +0 -65
  39. package/dist/components/Switch/Switch.d.ts +0 -16
  40. package/dist/components/Textarea/Textarea.d.ts +0 -16
  41. package/dist/components/Textarea/TextareaUtils.d.ts +0 -44
  42. package/dist/favicon-invert.svg +0 -5
  43. package/dist/favicon.svg +0 -5
  44. package/dist/logo/wordmark-dark-side-by-side.svg +0 -6
  45. package/dist/logo/wordmark-light-side-by-side.svg +0 -6
  46. package/dist/main.d.ts +0 -0
  47. package/dist/spectral.cjs.js +0 -60
  48. package/dist/spectral.css +0 -1
  49. package/dist/spectral.es.js +0 -5531
package/README.md CHANGED
@@ -1,91 +1,15 @@
1
1
  # Spectral Component Library
2
2
 
3
- A modern React component library built with TypeScript, Tailwind CSS, and automated versioning with Changesets.
4
-
5
3
  ## Installation
6
4
 
7
5
  ```bash
8
- npm install @spear-ai/spectral
9
- ```
10
-
11
- ## Usage
12
-
13
- ```javascript
14
- import { Button, Card, cn } from '@spear-ai/spectral'
15
- import '@spear-ai/spectral/styles'
16
-
17
- function App() {
18
- return (
19
- <Card title="Welcome">
20
- <Button label="Click me" onClick={() => console.log('Hello!')} />
21
- </Card>
22
- )
23
- }
24
- ```
25
-
26
- ## Development
27
-
28
- ```bash
29
- # Install dependencies
30
- npm install
31
-
32
- # Start Storybook
33
- npm run storybook
34
-
35
- # Build library
36
- npm run build:lib
37
-
38
- # Format code (Prettier + OXC plugin)
39
- npm run format
40
-
41
- # Lint code (super fast with Oxlint!)
42
- npm run lint
43
-
44
- # Create changeset for your changes
45
- npm run changeset
46
- ```
47
-
48
- ## Components
49
-
50
- - Button
51
- - Card
52
- - Checkbox
53
- - Input
54
- - Label
55
- - RadioGroup
56
- - Select
57
- - Sidebar
58
- - Skeleton
59
- - Slider
60
- - Switch
61
- - Textarea
62
-
63
- ## Utilities
64
-
65
- - `cn` - Class name utility for merging Tailwind classes
66
-
67
- ## Hooks
68
-
69
- - `useTheme` - Theme management hook
70
-
71
- ## Contributing
72
-
73
- This project uses **Changesets** for version management and publishing.
74
-
75
- **Quick Start:**
76
- ```bash
77
- # Make changes, then:
78
- git add .
79
- npm run changeset # Create changeset describing your changes
80
- git commit -m "feat: add new component"
81
- git push origin feature-branch # Create PR
82
-
83
- # Changesets bot will create a "Version Packages" PR when ready to release
6
+ pnpm install @spear-ai/spectral
84
7
  ```
85
8
 
86
- **Change Types:**
87
- - `patch` → Bug fixes, small improvements (1.0.0 → 1.0.1)
88
- - `minor` → New features, new components (1.0.0 → 1.1.0)
89
- - `major` → Breaking changes (1.0.0 → 2.0.0)
90
9
 
91
- 📋 **See [CHANGESET_GUIDE.md](./CHANGESET_GUIDE.md) for complete workflow guide**
10
+ ### Development Stack
11
+ - **React 19** + **TypeScript 5.9**
12
+ - **Tailwind CSS v4** + **PostCSS**
13
+ - **Vite** for build optimization
14
+ - **Storybook 9** for component documentation
15
+ - **OXLint** for ultra-fast linting
@@ -0,0 +1,2 @@
1
+ export * from './components/Button/Button'
2
+ export {}
package/dist/Button.js ADDED
@@ -0,0 +1,118 @@
1
+ import { jsxs as f, jsx as v } from "react/jsx-runtime";
2
+ import { a as V, c as p } from "./twUtils-B9ArqCOv.js";
3
+ import { forwardRef as j } from "react";
4
+ import { L as w } from "./loader-circle-Btf6jOd5.js";
5
+ const N = (o) => typeof o == "boolean" ? `${o}` : o === 0 ? "0" : o, h = V, C = (o, e) => (t) => {
6
+ var l;
7
+ if (e?.variants == null) return h(o, t?.class, t?.className);
8
+ const { variants: r, defaultVariants: i } = e, u = Object.keys(r).map((n) => {
9
+ const a = t?.[n], s = i?.[n];
10
+ if (a === null) return null;
11
+ const d = N(a) || N(s);
12
+ return r[n][d];
13
+ }), b = t && Object.entries(t).reduce((n, a) => {
14
+ let [s, d] = a;
15
+ return d === void 0 || (n[s] = d), n;
16
+ }, {}), y = e == null || (l = e.compoundVariants) === null || l === void 0 ? void 0 : l.reduce((n, a) => {
17
+ let { class: s, className: d, ...c } = a;
18
+ return Object.entries(c).every((m) => {
19
+ let [g, x] = m;
20
+ return Array.isArray(x) ? x.includes({
21
+ ...i,
22
+ ...b
23
+ }[g]) : {
24
+ ...i,
25
+ ...b
26
+ }[g] === x;
27
+ }) ? [
28
+ ...n,
29
+ s,
30
+ d
31
+ ] : n;
32
+ }, []);
33
+ return h(o, u, y, t?.class, t?.className);
34
+ }, _ = C(
35
+ `
36
+ flex relative items-center justify-center gap-2 whitespace-nowrap transition-colors cursor-pointer py-2 px-6 rounded-lg border font-semibold
37
+ focus:outline-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus:ring-2 focus:ring-ring focus:ring-offset-2
38
+ focus-visible:ring-offset-2 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0
39
+ `,
40
+ {
41
+ variants: {
42
+ variant: {
43
+ primary: "bg-button-primary-bg text-button-primary-text border-button-primary-border disabled:bg-button-primary-bg--disabled disabled:text-button-primary-text--disabled disabled:border-button-primary-border--disabled",
44
+ secondary: "bg-button-secondary-bg border-button-secondary-border text-button-secondary-text disabled:bg-button-secondary-bg--disabled disabled:text-button-secondary-text--disabled disabled:border-button-secondary-border--disabled",
45
+ outline: "bg-button-outline-bg border-button-outline-border text-button-outline-text disabled:text-button-outline-text--disabled disabled:border-button-outline-border--disabled"
46
+ },
47
+ state: {
48
+ default: "",
49
+ error: "bg-button-danger text-button-primary-text transition pointer-events-none",
50
+ loading: "cursor-wait pointer-events-none"
51
+ }
52
+ },
53
+ defaultVariants: {
54
+ variant: "primary",
55
+ state: "default"
56
+ }
57
+ }
58
+ ), k = j(
59
+ ({
60
+ className: o,
61
+ variant: e,
62
+ label: t,
63
+ endIcon: l,
64
+ state: r,
65
+ errorMessage: i,
66
+ startIcon: u,
67
+ disabled: b,
68
+ type: y = "button",
69
+ dataTestId: n = `button-${e}`,
70
+ isFullWidth: a,
71
+ ...s
72
+ }, d) => {
73
+ const c = {
74
+ error: {
75
+ primary: "bg-button-danger border-button-danger text-button-primary-text pointer-events-none",
76
+ secondary: "bg-button-danger border-button-danger text-button-secondary-text pointer-events-none",
77
+ outline: "bg-transparent border-button-danger text-button-danger pointer-events-none"
78
+ },
79
+ loading: {
80
+ primary: "bg-button-primary-bg--disabled border-button-primary-border--disabled text-button-primary-text--disabled pointer-events-none",
81
+ secondary: "bg-button-secondary-bg--disabled border-button-secondary-border--disabled text-button-secondary-text--disabled pointer-events-none",
82
+ outline: "bg-button-outline-bg--disabled border-button-outline-border--disabled text-button-outline-text--disabled pointer-events-none"
83
+ }
84
+ }, m = a ? "w-full" : "w-auto", g = p(
85
+ _({ variant: e, state: r }),
86
+ r === "error" && c.error[e || "primary"],
87
+ r === "loading" && c.loading[e || "primary"],
88
+ m,
89
+ o
90
+ );
91
+ return /* @__PURE__ */ f("div", { className: p("flex justify-items-center", m), children: [
92
+ /* @__PURE__ */ f(
93
+ "button",
94
+ {
95
+ className: g,
96
+ ref: d,
97
+ type: y,
98
+ "aria-disabled": b,
99
+ disabled: b,
100
+ "data-testid": n,
101
+ ...s,
102
+ "data-state": r,
103
+ children: [
104
+ u && /* @__PURE__ */ v("span", { className: "flex pr-2", "aria-hidden": !0, children: u }),
105
+ t,
106
+ r === "loading" && /* @__PURE__ */ v(w, { className: "ml-2 animate-spin", size: 16 }),
107
+ l && r !== "loading" && /* @__PURE__ */ v("span", { className: "flex pl-2", "aria-hidden": !0, children: l })
108
+ ]
109
+ }
110
+ ),
111
+ r === "error" && i && /* @__PURE__ */ v("p", { className: "text-danger text-xs", role: "alert", "aria-live": "polite", children: i })
112
+ ] });
113
+ }
114
+ );
115
+ k.displayName = "Button";
116
+ export {
117
+ k as Button
118
+ };
package/dist/Card.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/Card/Card'
2
+ export {}
package/dist/Card.js ADDED
@@ -0,0 +1,25 @@
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import { c as a } from "./twUtils-B9ArqCOv.js";
3
+ import { forwardRef as u } from "react";
4
+ import { L as b } from "./loader-circle-Btf6jOd5.js";
5
+ const p = u(
6
+ ({ className: l, title: s, icon: r, width: n = "full", isLoading: c = !1, children: d, ...f }, o) => {
7
+ const i = s || r, m = a(
8
+ "relative bg-card-bg rounded-2xl p-4 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
9
+ n === "full" ? "w-full" : "w-fit",
10
+ l
11
+ );
12
+ return /* @__PURE__ */ t("div", { ref: o, className: m, ...f, children: [
13
+ c && /* @__PURE__ */ e("div", { className: "bg-card-bg/50 absolute inset-0 z-10 flex items-center justify-center", children: /* @__PURE__ */ e(b, { className: "text-muted-foreground animate-spin", size: 24 }) }),
14
+ i && /* @__PURE__ */ t("div", { className: a("flex items-center pb-4", s ? "justify-between" : "justify-end"), children: [
15
+ s && /* @__PURE__ */ e("h3", { className: "text-card-text truncate text-base font-semibold", children: s }),
16
+ r && /* @__PURE__ */ e("div", { className: "flex-shrink-0", "aria-hidden": "true", children: r })
17
+ ] }),
18
+ /* @__PURE__ */ e("div", { className: a("min-h-40 p-4", i && "pt-0"), children: d })
19
+ ] });
20
+ }
21
+ );
22
+ p.displayName = "Card";
23
+ export {
24
+ p as Card
25
+ };
@@ -0,0 +1,2 @@
1
+ export * from './components/Drawer/Drawer'
2
+ export {}