@devalok/shilp-sutra 0.27.2 → 0.28.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.
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsxs as m, jsx as a } from "react/jsx-runtime";
3
3
  import * as t from "react";
4
- import { W as f, X as b, Y as y, Z as w, _ as g, $ as v, a0 as h, a1 as x, a2 as N, a3 as M, a4 as P, a5 as _, a6 as j, a7 as G, a8 as T } from "../_chunks/primitives.js";
4
+ import { X as f, Y as b, Z as y, _ as w, $ as g, a0 as v, a1 as h, a2 as x, a3 as N, a4 as M, a5 as P, a6 as _, a7 as j, a8 as G, a9 as T } from "../_chunks/primitives.js";
5
5
  import { IconChevronRight as z, IconCheck as A, IconCircle as L } from "@tabler/icons-react";
6
6
  import { cn as d } from "./lib/utils.js";
7
7
  import { tweens as D, springs as C } from "./lib/motion.js";
@@ -21,7 +21,7 @@ const I = t.createContext(!1), k = t.createContext(!1), U = ({
21
21
  return /* @__PURE__ */ a(I.Provider, { value: l, children: /* @__PURE__ */ a(_, { open: l, onOpenChange: p, ...r }) });
22
22
  };
23
23
  U.displayName = "DropdownMenu";
24
- const se = P, ae = j, oe = y, W = ({
24
+ const se = P, ae = j, oe = y, X = ({
25
25
  open: s,
26
26
  defaultOpen: o = !1,
27
27
  onOpenChange: e,
@@ -35,8 +35,8 @@ const se = P, ae = j, oe = y, W = ({
35
35
  );
36
36
  return /* @__PURE__ */ a(k.Provider, { value: l, children: /* @__PURE__ */ a(T, { open: l, onOpenChange: p, ...r }) });
37
37
  };
38
- W.displayName = "DropdownMenuSub";
39
- const re = G, X = t.forwardRef(({ className: s, inset: o, children: e, ...r }, n) => /* @__PURE__ */ m(
38
+ X.displayName = "DropdownMenuSub";
39
+ const re = G, Y = t.forwardRef(({ className: s, inset: o, children: e, ...r }, n) => /* @__PURE__ */ m(
40
40
  f,
41
41
  {
42
42
  ref: n,
@@ -52,8 +52,8 @@ const re = G, X = t.forwardRef(({ className: s, inset: o, children: e, ...r }, n
52
52
  ]
53
53
  }
54
54
  ));
55
- X.displayName = f.displayName;
56
- const Y = t.forwardRef(({ className: s, children: o, ...e }, r) => {
55
+ Y.displayName = f.displayName;
56
+ const Z = t.forwardRef(({ className: s, children: o, ...e }, r) => {
57
57
  const n = t.useContext(k);
58
58
  return /* @__PURE__ */ a(R, { children: n && /* @__PURE__ */ a(
59
59
  b,
@@ -79,8 +79,8 @@ const Y = t.forwardRef(({ className: s, children: o, ...e }, r) => {
79
79
  }
80
80
  ) });
81
81
  });
82
- Y.displayName = b.displayName;
83
- const Z = t.forwardRef(({ className: s, sideOffset: o = 4, children: e, ...r }, n) => {
82
+ Z.displayName = b.displayName;
83
+ const $ = t.forwardRef(({ className: s, sideOffset: o = 4, children: e, ...r }, n) => {
84
84
  const c = t.useContext(I);
85
85
  return /* @__PURE__ */ a(R, { children: c && /* @__PURE__ */ a(y, { forceMount: !0, children: /* @__PURE__ */ a(
86
86
  w,
@@ -107,8 +107,8 @@ const Z = t.forwardRef(({ className: s, sideOffset: o = 4, children: e, ...r },
107
107
  }
108
108
  ) }) });
109
109
  });
110
- Z.displayName = w.displayName;
111
- const $ = t.forwardRef(({ className: s, inset: o, ...e }, r) => /* @__PURE__ */ a(
110
+ $.displayName = w.displayName;
111
+ const q = t.forwardRef(({ className: s, inset: o, ...e }, r) => /* @__PURE__ */ a(
112
112
  g,
113
113
  {
114
114
  ref: r,
@@ -120,8 +120,8 @@ const $ = t.forwardRef(({ className: s, inset: o, ...e }, r) => /* @__PURE__ */
120
120
  ...e
121
121
  }
122
122
  ));
123
- $.displayName = g.displayName;
124
- const q = t.forwardRef(({ className: s, children: o, checked: e, ...r }, n) => /* @__PURE__ */ m(
123
+ q.displayName = g.displayName;
124
+ const B = t.forwardRef(({ className: s, children: o, checked: e, ...r }, n) => /* @__PURE__ */ m(
125
125
  v,
126
126
  {
127
127
  ref: n,
@@ -137,8 +137,8 @@ const q = t.forwardRef(({ className: s, children: o, checked: e, ...r }, n) => /
137
137
  ]
138
138
  }
139
139
  ));
140
- q.displayName = v.displayName;
141
- const B = t.forwardRef(({ className: s, children: o, ...e }, r) => /* @__PURE__ */ m(
140
+ B.displayName = v.displayName;
141
+ const E = t.forwardRef(({ className: s, children: o, ...e }, r) => /* @__PURE__ */ m(
142
142
  x,
143
143
  {
144
144
  ref: r,
@@ -153,8 +153,8 @@ const B = t.forwardRef(({ className: s, children: o, ...e }, r) => /* @__PURE__
153
153
  ]
154
154
  }
155
155
  ));
156
- B.displayName = x.displayName;
157
- const E = t.forwardRef(({ className: s, inset: o, ...e }, r) => /* @__PURE__ */ a(
156
+ E.displayName = x.displayName;
157
+ const F = t.forwardRef(({ className: s, inset: o, ...e }, r) => /* @__PURE__ */ a(
158
158
  N,
159
159
  {
160
160
  ref: r,
@@ -166,8 +166,8 @@ const E = t.forwardRef(({ className: s, inset: o, ...e }, r) => /* @__PURE__ */
166
166
  ...e
167
167
  }
168
168
  ));
169
- E.displayName = N.displayName;
170
- const F = t.forwardRef(({ className: s, ...o }, e) => /* @__PURE__ */ a(
169
+ F.displayName = N.displayName;
170
+ const H = t.forwardRef(({ className: s, ...o }, e) => /* @__PURE__ */ a(
171
171
  M,
172
172
  {
173
173
  ref: e,
@@ -175,8 +175,8 @@ const F = t.forwardRef(({ className: s, ...o }, e) => /* @__PURE__ */ a(
175
175
  ...o
176
176
  }
177
177
  ));
178
- F.displayName = M.displayName;
179
- const H = ({
178
+ H.displayName = M.displayName;
179
+ const J = ({
180
180
  className: s,
181
181
  ...o
182
182
  }) => /* @__PURE__ */ a(
@@ -186,21 +186,21 @@ const H = ({
186
186
  ...o
187
187
  }
188
188
  );
189
- H.displayName = "DropdownMenuShortcut";
189
+ J.displayName = "DropdownMenuShortcut";
190
190
  export {
191
191
  U as DropdownMenu,
192
- q as DropdownMenuCheckboxItem,
193
- Z as DropdownMenuContent,
192
+ B as DropdownMenuCheckboxItem,
193
+ $ as DropdownMenuContent,
194
194
  ae as DropdownMenuGroup,
195
- $ as DropdownMenuItem,
196
- E as DropdownMenuLabel,
195
+ q as DropdownMenuItem,
196
+ F as DropdownMenuLabel,
197
197
  oe as DropdownMenuPortal,
198
198
  re as DropdownMenuRadioGroup,
199
- B as DropdownMenuRadioItem,
200
- F as DropdownMenuSeparator,
201
- H as DropdownMenuShortcut,
202
- W as DropdownMenuSub,
203
- Y as DropdownMenuSubContent,
204
- X as DropdownMenuSubTrigger,
199
+ E as DropdownMenuRadioItem,
200
+ H as DropdownMenuSeparator,
201
+ J as DropdownMenuShortcut,
202
+ X as DropdownMenuSub,
203
+ Z as DropdownMenuSubContent,
204
+ Y as DropdownMenuSubTrigger,
205
205
  se as DropdownMenuTrigger
206
206
  };
package/dist/ui/label.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsxs as i, jsx as d } from "react/jsx-runtime";
3
3
  import * as n from "react";
4
- import { ah as a } from "../_chunks/primitives.js";
4
+ import { ai as a } from "../_chunks/primitives.js";
5
5
  import { cn as m } from "./lib/utils.js";
6
6
  const c = n.forwardRef(({ className: e, required: t, children: r, ...s }, o) => /* @__PURE__ */ i(
7
7
  a,
@@ -1,32 +1,32 @@
1
1
  "use client";
2
2
  import { jsx as e } from "react/jsx-runtime";
3
3
  import * as t from "react";
4
- import { P as u, d, c as v, b as P, aP as y } from "../_chunks/primitives.js";
4
+ import { P as u, d, c as v, b as P, W as y } from "../_chunks/primitives.js";
5
5
  import { cn as g } from "./lib/utils.js";
6
6
  import { tweens as x, springs as b } from "./lib/motion.js";
7
7
  import { A as h, m as C } from "../_chunks/framer.js";
8
8
  const m = t.createContext(!1), w = ({
9
9
  open: s,
10
- defaultOpen: a = !1,
10
+ defaultOpen: n = !1,
11
11
  onOpenChange: o,
12
- ...n
12
+ ...a
13
13
  }) => {
14
- const [c, i] = t.useState(a), r = s !== void 0, p = r ? s : c, f = t.useCallback(
14
+ const [c, i] = t.useState(n), r = s !== void 0, p = r ? s : c, f = t.useCallback(
15
15
  (l) => {
16
16
  r || i(l), o == null || o(l);
17
17
  },
18
18
  [r, o]
19
19
  );
20
- return /* @__PURE__ */ e(m.Provider, { value: p, children: /* @__PURE__ */ e(P, { open: p, onOpenChange: f, ...n }) });
20
+ return /* @__PURE__ */ e(m.Provider, { value: p, children: /* @__PURE__ */ e(P, { open: p, onOpenChange: f, ...a }) });
21
21
  };
22
22
  w.displayName = "Popover";
23
- const k = v, z = y, A = t.forwardRef(({ className: s, align: a = "center", sideOffset: o = 4, children: n, ...c }, i) => {
23
+ const k = v, z = y, A = t.forwardRef(({ className: s, align: n = "center", sideOffset: o = 4, children: a, ...c }, i) => {
24
24
  const r = t.useContext(m);
25
25
  return /* @__PURE__ */ e(h, { children: r && /* @__PURE__ */ e(u, { forceMount: !0, children: /* @__PURE__ */ e(
26
26
  d,
27
27
  {
28
28
  ref: i,
29
- align: a,
29
+ align: n,
30
30
  sideOffset: o,
31
31
  forceMount: !0,
32
32
  asChild: !0,
@@ -42,7 +42,7 @@ const k = v, z = y, A = t.forwardRef(({ className: s, align: a = "center", sideO
42
42
  "z-popover w-72 rounded-ds-lg border border-surface-border-strong bg-surface-overlay p-ds-05 text-surface-fg shadow-floating outline-none",
43
43
  s
44
44
  ),
45
- children: n
45
+ children: a
46
46
  }
47
47
  )
48
48
  }
package/dist/ui/radio.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as e } from "react/jsx-runtime";
3
- import { aj as o, ak as i, al as n } from "../_chunks/primitives.js";
3
+ import { ak as o, al as i, am as n } from "../_chunks/primitives.js";
4
4
  import { IconCircle as d } from "@tabler/icons-react";
5
5
  import * as t from "react";
6
6
  import { springs as l } from "./lib/motion.js";
package/dist/ui/select.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import { jsxs as l, jsx as e } from "react/jsx-runtime";
3
3
  import * as o from "react";
4
- import { ao as c, ap as g, aq as n, ar as m, as as w, at as p, au as N, av as f, aw as u, ax as v, ay as S, az as h, aA as I, aB as R, aC as C } from "../_chunks/primitives.js";
4
+ import { ap as c, aq as g, ar as n, as as m, at as w, au as p, av as N, aw as f, ax as u, ay as v, az as S, aA as h, aB as I, aC as R, aD as C } from "../_chunks/primitives.js";
5
5
  import { IconChevronDown as y, IconChevronUp as j, IconCheck as B } from "@tabler/icons-react";
6
6
  import { c as V } from "../_chunks/vendor-utils.js";
7
7
  import { cn as r } from "./lib/utils.js";
8
- import { tweens as z, springs as T } from "./lib/motion.js";
9
- import { m as D } from "../_chunks/framer.js";
8
+ import { tweens as z, springs as D } from "./lib/motion.js";
9
+ import { m as T } from "../_chunks/framer.js";
10
10
  const O = I, Q = C, W = R, U = V(
11
11
  "flex w-full items-center justify-between whitespace-nowrap rounded-ds-md border border-surface-border-strong bg-surface-raised-hover placeholder:text-surface-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2 focus-visible:border-accent-7 disabled:cursor-not-allowed disabled:opacity-action-disabled [&>span]:line-clamp-1",
12
12
  {
@@ -67,11 +67,11 @@ const L = o.forwardRef(({ className: a, children: t, position: s = "popper", ...
67
67
  asChild: !0,
68
68
  ...d,
69
69
  children: /* @__PURE__ */ l(
70
- D.div,
70
+ T.div,
71
71
  {
72
72
  initial: { opacity: 0, scale: 0.95 },
73
73
  animate: { opacity: 1, scale: 1 },
74
- transition: { ...T.snappy, opacity: z.fade },
74
+ transition: { ...D.snappy, opacity: z.fade },
75
75
  className: r(
76
76
  "relative z-popover max-h-96 min-w-[8rem] overflow-hidden rounded-ds-lg border border-surface-border-strong bg-surface-overlay text-surface-fg shadow-floating",
77
77
  s === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
@@ -1,16 +1,16 @@
1
1
  "use client";
2
2
  import { jsx as g } from "react/jsx-runtime";
3
- import * as i from "react";
4
- import { ai as e } from "../_chunks/primitives.js";
5
- import { cn as d } from "./lib/utils.js";
6
- const l = i.forwardRef(
3
+ import * as d from "react";
4
+ import { aj as e } from "../_chunks/primitives.js";
5
+ import { cn as i } from "./lib/utils.js";
6
+ const l = d.forwardRef(
7
7
  ({ className: t, orientation: a = "horizontal", decorative: o = !0, variant: r = "default", ...n }, s) => /* @__PURE__ */ g(
8
8
  e,
9
9
  {
10
10
  ref: s,
11
11
  decorative: o,
12
12
  orientation: a,
13
- className: d(
13
+ className: i(
14
14
  "shrink-0",
15
15
  r === "gradient" ? "bg-transparent bg-[image:linear-gradient(90deg,transparent,var(--color-surface-border)_15%,var(--color-surface-border)_85%,transparent)]" : r === "gradient-left" ? "bg-transparent bg-[image:linear-gradient(90deg,transparent,var(--color-surface-border)_30%)]" : r === "gradient-right" ? "bg-transparent bg-[image:linear-gradient(90deg,var(--color-surface-border)_70%,transparent)]" : "bg-surface-border",
16
16
  a === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
package/dist/ui/sheet.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as r, jsxs as c } from "react/jsx-runtime";
3
3
  import * as o from "react";
4
- import { a9 as h, aa as R, ab as u, ac as x, ad as b, ae as y, af as P, ag as j } from "../_chunks/primitives.js";
4
+ import { aa as h, ab as R, ac as u, ad as x, ae as b, af as y, ag as P, ah as j } from "../_chunks/primitives.js";
5
5
  import { c as T } from "../_chunks/vendor-utils.js";
6
6
  import { IconX as A } from "@tabler/icons-react";
7
7
  import { cn as a } from "./lib/utils.js";
package/dist/ui/slider.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsxs as d, jsx as e } from "react/jsx-runtime";
3
3
  import * as f from "react";
4
- import { aD as r, aE as m, aF as b, aG as u } from "../_chunks/primitives.js";
4
+ import { aE as r, aF as m, aG as b, aH as u } from "../_chunks/primitives.js";
5
5
  import { cn as h } from "./lib/utils.js";
6
6
  const v = f.forwardRef(({ className: i, "aria-label": l, value: a, defaultValue: o, ...n }, t) => {
7
7
  const s = (a ?? o ?? [0]).length;
package/dist/ui/switch.js CHANGED
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  import { jsx as s } from "react/jsx-runtime";
3
3
  import * as a from "react";
4
- import { am as i, an as p } from "../_chunks/primitives.js";
4
+ import { an as i, ao as p } from "../_chunks/primitives.js";
5
5
  import { springs as h } from "./lib/motion.js";
6
6
  import { cn as g } from "./lib/utils.js";
7
7
  import { m as v } from "../_chunks/framer.js";
8
- const w = a.forwardRef(({ className: n, error: d, checked: r, defaultChecked: t, onCheckedChange: e, ...c }, l) => {
9
- const [m, f] = a.useState(t ?? !1), b = r !== void 0 ? r : m, u = a.useCallback(
10
- (o) => {
11
- r === void 0 && f(o), e == null || e(o);
8
+ const w = a.forwardRef(({ className: n, error: d, checked: r, defaultChecked: o, onCheckedChange: e, ...c }, l) => {
9
+ const [f, m] = a.useState(o ?? !1), b = r !== void 0 ? r : f, u = a.useCallback(
10
+ (t) => {
11
+ r === void 0 && m(t), e == null || e(t);
12
12
  },
13
13
  [r, e]
14
14
  );
@@ -21,7 +21,7 @@ const w = a.forwardRef(({ className: n, error: d, checked: r, defaultChecked: t,
21
21
  n
22
22
  ),
23
23
  checked: r,
24
- defaultChecked: t,
24
+ defaultChecked: o,
25
25
  onCheckedChange: u,
26
26
  ...c,
27
27
  ref: l,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as n } from "react/jsx-runtime";
3
3
  import * as e from "react";
4
- import { aI as i, aJ as l } from "../_chunks/primitives.js";
4
+ import { aJ as i, aK as l } from "../_chunks/primitives.js";
5
5
  import { cn as c } from "./lib/utils.js";
6
6
  import { toggleVariants as f } from "./toggle.js";
7
7
  const p = e.createContext({
package/dist/ui/toggle.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as i } from "react/jsx-runtime";
3
3
  import * as n from "react";
4
- import { aH as e } from "../_chunks/primitives.js";
4
+ import { aI as e } from "../_chunks/primitives.js";
5
5
  import { c as d } from "../_chunks/vendor-utils.js";
6
6
  import { springs as m, motionProps as c } from "./lib/motion.js";
7
7
  import { cn as f } from "./lib/utils.js";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as t, Fragment as y } from "react/jsx-runtime";
3
3
  import * as o from "react";
4
- import { aK as h, aL as p, aM as P, aN as u, aO as T } from "../_chunks/primitives.js";
4
+ import { aL as P, aM as p, aN as h, aO as u, aP as T } from "../_chunks/primitives.js";
5
5
  import { cn as C } from "./lib/utils.js";
6
6
  import { tweens as g, springs as N } from "./lib/motion.js";
7
7
  import { A as b, m as w } from "../_chunks/framer.js";
@@ -27,14 +27,14 @@ const m = o.createContext({ open: !1 }), A = ({
27
27
  return /* @__PURE__ */ t(M, { children: /* @__PURE__ */ t(m.Provider, { value: x, children: /* @__PURE__ */ t(T, { open: s, onOpenChange: v, ...n }) }) });
28
28
  };
29
29
  A.displayName = "Tooltip";
30
- const K = P, R = {
30
+ const L = h, R = {
31
31
  top: { y: 4 },
32
32
  bottom: { y: -4 },
33
33
  left: { x: 4 },
34
34
  right: { x: -4 }
35
35
  }, I = o.forwardRef(({ className: e, sideOffset: i = 4, side: r = "top", children: n, ...l }, c) => {
36
36
  const { open: a } = o.useContext(m), s = R[r] ?? {};
37
- return /* @__PURE__ */ t(b, { children: a && /* @__PURE__ */ t(h, { forceMount: !0, children: /* @__PURE__ */ t(
37
+ return /* @__PURE__ */ t(b, { children: a && /* @__PURE__ */ t(P, { forceMount: !0, children: /* @__PURE__ */ t(
38
38
  p,
39
39
  {
40
40
  ref: c,
@@ -65,5 +65,5 @@ export {
65
65
  A as Tooltip,
66
66
  I as TooltipContent,
67
67
  F as TooltipProvider,
68
- K as TooltipTrigger
68
+ L as TooltipTrigger
69
69
  };
@@ -3,30 +3,84 @@
3
3
  - Import: @devalok/shilp-sutra/ui/color-input
4
4
  - Server-safe: No
5
5
  - Category: ui
6
+ - Dependency: react-colorful (bundled, 2.8KB gzipped)
6
7
 
7
8
  ## Props
8
9
  value: string (hex color, e.g. "#d33163")
9
10
  onChange: (value: string) => void
10
- presets: string[] (optional preset color swatches)
11
+ presets: { hex: string; label: string }[] | string[] | false (default: 10 named colors. Pass false to hide.)
12
+ variant: "default" | "inline" (default: "default")
13
+ showPicker: boolean (default: true — set false for swatches-only mode)
14
+ defaultFormat: "hex" | "rgb" | "hsl" (default: "hex")
15
+ align: "start" | "center" | "end" (popover alignment, default: "start")
11
16
  disabled: boolean
12
17
  className: string
13
18
 
14
19
  ## Defaults
15
- value="#000000", disabled=false
20
+ value="#000000", variant="default", showPicker=true, defaultFormat="hex", align="start", disabled=false
21
+
22
+ ## Variants
23
+
24
+ **default** — Gradient swatch on left edge fading into surface background, hex text on right. Popover opens on click.
25
+
26
+ **inline** — Entire trigger IS the selected color. Hex text overlaid with contrast-aware color (white on dark, dark on light). Great for color tags, labels, and compact UIs.
27
+
28
+ ## Popover Contents
29
+
30
+ 1. Interactive gradient picker (saturation/brightness square + hue slider)
31
+ 2. Format switcher (HEX / RGB / HSL) with animated sliding pill
32
+ 3. Format-specific input fields (all editable, auto-converting)
33
+ 4. Preset color swatches (10 named defaults, customizable)
34
+ 5. Reset/Undo footer (appears when color has changed)
16
35
 
17
36
  ## Example
18
37
  ```jsx
19
38
  <ColorInput
20
39
  value={color}
21
40
  onChange={setColor}
22
- presets={['#d33163', '#2563eb', '#16a34a']}
23
41
  />
42
+
43
+ // Inline variant
44
+ <ColorInput
45
+ value={color}
46
+ onChange={setColor}
47
+ variant="inline"
48
+ />
49
+
50
+ // Custom presets
51
+ <ColorInput
52
+ value={color}
53
+ onChange={setColor}
54
+ presets={[
55
+ { hex: '#EF4444', label: 'Danger' },
56
+ { hex: '#10B981', label: 'Success' },
57
+ ]}
58
+ />
59
+
60
+ // Swatches only (no picker)
61
+ <ColorInput value={color} onChange={setColor} showPicker={false} />
24
62
  ```
25
63
 
26
64
  ## Gotchas
27
- - Uses native color picker under the hood; value must be a valid hex string
65
+ - Value must be a 6-character hex string (e.g. "#d33163")
66
+ - Presets accept both `string[]` (backward-compatible) and `{ hex, label }[]` (recommended for accessibility)
67
+ - The interactive picker (react-colorful) is pointer-based — keyboard users can edit colors via the HEX/RGB/HSL format inputs
68
+ - Multiple ColorInput instances on the same page work correctly (unique layoutId per instance)
69
+ - Undo tracks discrete changes (preset clicks, field edits), not continuous picker drag — dragging pushes one undo entry
28
70
 
29
71
  ## Changes
72
+
73
+ ### v0.28.0
74
+ - **Changed** Full redesign: replaced native `<input type="color">` with react-colorful interactive picker in a Popover
75
+ - **Added** `variant` prop: `"default"` (gradient trigger) and `"inline"` (color-as-background trigger)
76
+ - **Added** Multi-format input fields (HEX / RGB / HSL) with animated format switcher
77
+ - **Added** `showPicker`, `defaultFormat`, `align` props
78
+ - **Added** Reset/Undo functionality with footer UI
79
+ - **Added** Framer Motion animations throughout (triggers, format swap, presets)
80
+ - **Added** Internal state management — works both controlled and uncontrolled
81
+ - **Changed** `presets` prop now accepts `{ hex, label }[]` or `false` in addition to `string[]`
82
+ - **Fixed** Accessibility: label/input association, ARIA labels, input clamping
83
+
30
84
  ### v0.15.0
31
85
  - **Changed** `md` size font standardized to `text-ds-md` (14px) from mixed values
32
86
 
package/llms-full.txt CHANGED
@@ -5,7 +5,7 @@
5
5
  > All variant values and props verified from source CVA definitions.
6
6
  >
7
7
  > Package: @devalok/shilp-sutra
8
- > Version: 0.27.2
8
+ > Version: 0.28.0
9
9
 
10
10
  ---
11
11
 
@@ -839,30 +839,84 @@ import { BarChart } from '@devalok/shilp-sutra/ui/charts'
839
839
  - Import: @devalok/shilp-sutra/ui/color-input
840
840
  - Server-safe: No
841
841
  - Category: ui
842
+ - Dependency: react-colorful (bundled, 2.8KB gzipped)
842
843
 
843
844
  ## Props
844
845
  value: string (hex color, e.g. "#d33163")
845
846
  onChange: (value: string) => void
846
- presets: string[] (optional preset color swatches)
847
+ presets: { hex: string; label: string }[] | string[] | false (default: 10 named colors. Pass false to hide.)
848
+ variant: "default" | "inline" (default: "default")
849
+ showPicker: boolean (default: true — set false for swatches-only mode)
850
+ defaultFormat: "hex" | "rgb" | "hsl" (default: "hex")
851
+ align: "start" | "center" | "end" (popover alignment, default: "start")
847
852
  disabled: boolean
848
853
  className: string
849
854
 
850
855
  ## Defaults
851
- value="#000000", disabled=false
856
+ value="#000000", variant="default", showPicker=true, defaultFormat="hex", align="start", disabled=false
857
+
858
+ ## Variants
859
+
860
+ **default** — Gradient swatch on left edge fading into surface background, hex text on right. Popover opens on click.
861
+
862
+ **inline** — Entire trigger IS the selected color. Hex text overlaid with contrast-aware color (white on dark, dark on light). Great for color tags, labels, and compact UIs.
863
+
864
+ ## Popover Contents
865
+
866
+ 1. Interactive gradient picker (saturation/brightness square + hue slider)
867
+ 2. Format switcher (HEX / RGB / HSL) with animated sliding pill
868
+ 3. Format-specific input fields (all editable, auto-converting)
869
+ 4. Preset color swatches (10 named defaults, customizable)
870
+ 5. Reset/Undo footer (appears when color has changed)
852
871
 
853
872
  ## Example
854
873
  ```jsx
855
874
  <ColorInput
856
875
  value={color}
857
876
  onChange={setColor}
858
- presets={['#d33163', '#2563eb', '#16a34a']}
859
877
  />
878
+
879
+ // Inline variant
880
+ <ColorInput
881
+ value={color}
882
+ onChange={setColor}
883
+ variant="inline"
884
+ />
885
+
886
+ // Custom presets
887
+ <ColorInput
888
+ value={color}
889
+ onChange={setColor}
890
+ presets={[
891
+ { hex: '#EF4444', label: 'Danger' },
892
+ { hex: '#10B981', label: 'Success' },
893
+ ]}
894
+ />
895
+
896
+ // Swatches only (no picker)
897
+ <ColorInput value={color} onChange={setColor} showPicker={false} />
860
898
  ```
861
899
 
862
900
  ## Gotchas
863
- - Uses native color picker under the hood; value must be a valid hex string
901
+ - Value must be a 6-character hex string (e.g. "#d33163")
902
+ - Presets accept both `string[]` (backward-compatible) and `{ hex, label }[]` (recommended for accessibility)
903
+ - The interactive picker (react-colorful) is pointer-based — keyboard users can edit colors via the HEX/RGB/HSL format inputs
904
+ - Multiple ColorInput instances on the same page work correctly (unique layoutId per instance)
905
+ - Undo tracks discrete changes (preset clicks, field edits), not continuous picker drag — dragging pushes one undo entry
864
906
 
865
907
  ## Changes
908
+
909
+ ### v0.28.0
910
+ - **Changed** Full redesign: replaced native `<input type="color">` with react-colorful interactive picker in a Popover
911
+ - **Added** `variant` prop: `"default"` (gradient trigger) and `"inline"` (color-as-background trigger)
912
+ - **Added** Multi-format input fields (HEX / RGB / HSL) with animated format switcher
913
+ - **Added** `showPicker`, `defaultFormat`, `align` props
914
+ - **Added** Reset/Undo functionality with footer UI
915
+ - **Added** Framer Motion animations throughout (triggers, format swap, presets)
916
+ - **Added** Internal state management — works both controlled and uncontrolled
917
+ - **Changed** `presets` prop now accepts `{ hex, label }[]` or `false` in addition to `string[]`
918
+ - **Fixed** Accessibility: label/input association, ARIA labels, input clamping
919
+
866
920
  ### v0.15.0
867
921
  - **Changed** `md` size font standardized to `text-ds-md` (14px) from mixed values
868
922
 
package/llms.txt CHANGED
@@ -308,7 +308,7 @@ Components with two-axis system: Button, Badge, Alert, Chip, Banner, Progress, S
308
308
  - SearchInput: size(xs|sm|md|lg) + loading, onClear
309
309
  - NumberInput: value + onValueChange, min, max, step (controlled only)
310
310
  - Textarea: size(xs|sm|md|lg) state(default|error|warning|success)
311
- - ColorInput: value(hex string) onChange(value) presets(string[]) disabled
311
+ - ColorInput: value(hex string) onChange(value) presets({hex,label}[]|string[]|false, default: 10 named colors) variant('default'|'inline') showPicker(boolean, default:true) defaultFormat('hex'|'rgb'|'hsl') align('start'|'center'|'end') disabled. Popover trigger opens interactive picker (react-colorful) + format switcher + preset swatches + undo/reset. Inline variant renders entire trigger as the color with contrast-aware text.
312
312
  - Checkbox: checked, onCheckedChange, error(boolean), indeterminate(boolean)
313
313
  - Switch: checked, onCheckedChange, error(boolean)
314
314
  - RadioGroup > RadioGroupItem(value)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devalok/shilp-sutra",
3
- "version": "0.27.2",
3
+ "version": "0.28.0",
4
4
  "description": "Devalok Design System — tokens, components, and patterns for Next.js",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -804,6 +804,7 @@
804
804
  "esbuild": "^0.27.4",
805
805
  "framer-motion": "^12.36.0",
806
806
  "input-otp": "^1.4.2",
807
+ "react-colorful": "^5.6.1",
807
808
  "react-markdown": "^10.1.0",
808
809
  "react-pdf": "^10.4.1",
809
810
  "react-remove-scroll": "^2.6.3",