@pixpilot/shadcn-ui 0.12.0 → 0.13.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 (37) hide show
  1. package/dist/ColorPicker/ColorPicker.cjs +55 -0
  2. package/dist/ColorPicker/ColorPicker.d.cts +10 -0
  3. package/dist/ColorPicker/ColorPicker.d.ts +11 -0
  4. package/dist/ColorPicker/ColorPicker.js +51 -0
  5. package/dist/ColorPicker/index.cjs +1 -0
  6. package/dist/ColorPicker/index.d.ts +1 -0
  7. package/dist/ColorPicker/index.js +1 -0
  8. package/dist/ColorPickerBase/ColorPickerBase.cjs +115 -0
  9. package/dist/ColorPickerBase/ColorPickerBase.d.cts +6 -0
  10. package/dist/ColorPickerBase/ColorPickerBase.d.ts +6 -0
  11. package/dist/ColorPickerBase/ColorPickerBase.js +111 -0
  12. package/dist/ColorPickerBase/ColorPickerCompact.cjs +51 -0
  13. package/dist/ColorPickerBase/ColorPickerCompact.js +46 -0
  14. package/dist/ColorPickerBase/ColorPickerContent.cjs +19 -0
  15. package/dist/ColorPickerBase/ColorPickerContent.js +15 -0
  16. package/dist/ColorPickerBase/ColorPickerFull.cjs +39 -0
  17. package/dist/ColorPickerBase/ColorPickerFull.js +35 -0
  18. package/dist/ColorPickerBase/ColorPickerInput.cjs +20 -0
  19. package/dist/ColorPickerBase/ColorPickerInput.js +16 -0
  20. package/dist/ColorPickerBase/PaletteButton.cjs +20 -0
  21. package/dist/ColorPickerBase/PaletteButton.js +16 -0
  22. package/dist/ColorPickerBase/PaletteSwatch.cjs +25 -0
  23. package/dist/ColorPickerBase/PaletteSwatch.js +22 -0
  24. package/dist/ColorPickerBase/index.cjs +1 -0
  25. package/dist/ColorPickerBase/index.d.ts +2 -0
  26. package/dist/ColorPickerBase/index.js +1 -0
  27. package/dist/ColorPickerBase/types.d.cts +16 -0
  28. package/dist/ColorPickerBase/types.d.ts +16 -0
  29. package/dist/hooks/src/index.cjs +1 -0
  30. package/dist/hooks/src/index.js +1 -0
  31. package/dist/hooks/src/use-controlled.cjs +42 -0
  32. package/dist/hooks/src/use-controlled.js +40 -0
  33. package/dist/index.cjs +6 -0
  34. package/dist/index.d.cts +4 -1
  35. package/dist/index.d.ts +6 -1
  36. package/dist/index.js +5 -1
  37. package/package.json +2 -1
@@ -0,0 +1,55 @@
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
5
+ const require_PaletteSwatch = require('../ColorPickerBase/PaletteSwatch.cjs');
6
+ const require_ColorPickerBase = require('../ColorPickerBase/ColorPickerBase.cjs');
7
+ require('../ColorPickerBase/index.cjs');
8
+ let __pixpilot_shadcn = require("@pixpilot/shadcn");
9
+ __pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
10
+ let lucide_react = require("lucide-react");
11
+ lucide_react = require_rolldown_runtime.__toESM(lucide_react);
12
+ let react_jsx_runtime = require("react/jsx-runtime");
13
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
14
+
15
+ //#region src/ColorPicker/ColorPicker.tsx
16
+ const ColorPicker = (props) => {
17
+ const { variant = "input", placeholder = "Pick a color",...rest } = props;
18
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ColorPickerBase.ColorPickerBase, {
19
+ ...rest,
20
+ children: ({ value, onValueChange, isPickerOpen }) => {
21
+ if (variant === "input") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.InputGroup, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.InputGroupAddon, {
22
+ align: "inline-start",
23
+ className: "pl-1",
24
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaletteSwatch.PaletteSwatch, { color: value })
25
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.InputGroupInput, {
26
+ value: value ?? "",
27
+ onPointerDown: (e) => {
28
+ if (isPickerOpen) return;
29
+ e.stopPropagation();
30
+ },
31
+ onClick: (e) => {
32
+ if (isPickerOpen) return;
33
+ e.stopPropagation();
34
+ },
35
+ onChange: (e) => onValueChange(e.target.value),
36
+ placeholder
37
+ })] });
38
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
39
+ type: "button",
40
+ className: (0, __pixpilot_shadcn.cn)("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*=\"text-\"])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 h-9"),
41
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
42
+ className: "flex items-center gap-2",
43
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaletteSwatch.PaletteSwatch, { color: value }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
44
+ className: "text-foreground",
45
+ children: value ?? placeholder
46
+ })]
47
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDownIcon, { className: "size-4 opacity-50" })]
48
+ });
49
+ }
50
+ });
51
+ };
52
+ ColorPicker.displayName = "ColorPicker";
53
+
54
+ //#endregion
55
+ exports.ColorPicker = ColorPicker;
@@ -0,0 +1,10 @@
1
+ import { ColorPickerBaseProps } from "../ColorPickerBase/types.cjs";
2
+
3
+ //#region src/ColorPicker/ColorPicker.d.ts
4
+ interface ColorPickerProps extends Omit<ColorPickerBaseProps, 'children'> {
5
+ variant?: 'button' | 'input';
6
+ placeholder?: string;
7
+ }
8
+ declare const ColorPicker: React.FC<ColorPickerProps>;
9
+ //#endregion
10
+ export { ColorPicker, ColorPickerProps };
@@ -0,0 +1,11 @@
1
+ import { ColorPickerBaseProps } from "../ColorPickerBase/types.js";
2
+ import "../ColorPickerBase/index.js";
3
+
4
+ //#region src/ColorPicker/ColorPicker.d.ts
5
+ interface ColorPickerProps extends Omit<ColorPickerBaseProps, 'children'> {
6
+ variant?: 'button' | 'input';
7
+ placeholder?: string;
8
+ }
9
+ declare const ColorPicker: React.FC<ColorPickerProps>;
10
+ //#endregion
11
+ export { ColorPicker, ColorPickerProps };
@@ -0,0 +1,51 @@
1
+ 'use client';
2
+
3
+
4
+ import { PaletteSwatch } from "../ColorPickerBase/PaletteSwatch.js";
5
+ import { ColorPickerBase } from "../ColorPickerBase/ColorPickerBase.js";
6
+ import "../ColorPickerBase/index.js";
7
+ import { InputGroup, InputGroupAddon, InputGroupInput, cn } from "@pixpilot/shadcn";
8
+ import { ChevronDownIcon } from "lucide-react";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+
11
+ //#region src/ColorPicker/ColorPicker.tsx
12
+ const ColorPicker$1 = (props) => {
13
+ const { variant = "input", placeholder = "Pick a color",...rest } = props;
14
+ return /* @__PURE__ */ jsx(ColorPickerBase, {
15
+ ...rest,
16
+ children: ({ value, onValueChange, isPickerOpen }) => {
17
+ if (variant === "input") return /* @__PURE__ */ jsxs(InputGroup, { children: [/* @__PURE__ */ jsx(InputGroupAddon, {
18
+ align: "inline-start",
19
+ className: "pl-1",
20
+ children: /* @__PURE__ */ jsx(PaletteSwatch, { color: value })
21
+ }), /* @__PURE__ */ jsx(InputGroupInput, {
22
+ value: value ?? "",
23
+ onPointerDown: (e) => {
24
+ if (isPickerOpen) return;
25
+ e.stopPropagation();
26
+ },
27
+ onClick: (e) => {
28
+ if (isPickerOpen) return;
29
+ e.stopPropagation();
30
+ },
31
+ onChange: (e) => onValueChange(e.target.value),
32
+ placeholder
33
+ })] });
34
+ return /* @__PURE__ */ jsxs("button", {
35
+ type: "button",
36
+ className: cn("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*=\"text-\"])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 h-9"),
37
+ children: [/* @__PURE__ */ jsxs("div", {
38
+ className: "flex items-center gap-2",
39
+ children: [/* @__PURE__ */ jsx(PaletteSwatch, { color: value }), /* @__PURE__ */ jsx("span", {
40
+ className: "text-foreground",
41
+ children: value ?? placeholder
42
+ })]
43
+ }), /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 opacity-50" })]
44
+ });
45
+ }
46
+ });
47
+ };
48
+ ColorPicker$1.displayName = "ColorPicker";
49
+
50
+ //#endregion
51
+ export { ColorPicker$1 as ColorPicker };
@@ -0,0 +1 @@
1
+ const require_ColorPicker = require('./ColorPicker.cjs');
@@ -0,0 +1 @@
1
+ import { ColorPicker, ColorPickerProps } from "./ColorPicker.js";
@@ -0,0 +1 @@
1
+ import { ColorPicker } from "./ColorPicker.js";
@@ -0,0 +1,115 @@
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
5
+ const require_use_controlled = require('../hooks/src/use-controlled.cjs');
6
+ require('../hooks/src/index.cjs');
7
+ const require_ColorPickerCompact = require('./ColorPickerCompact.cjs');
8
+ const require_ColorPickerFull = require('./ColorPickerFull.cjs');
9
+ let __pixpilot_shadcn = require("@pixpilot/shadcn");
10
+ __pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
11
+ let react = require("react");
12
+ react = require_rolldown_runtime.__toESM(react);
13
+ let react_jsx_runtime = require("react/jsx-runtime");
14
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
15
+
16
+ //#region src/ColorPickerBase/ColorPickerBase.tsx
17
+ const commonColors = [
18
+ "transparent",
19
+ "#000000",
20
+ "#FFFFFF",
21
+ "#808080",
22
+ "#FF0000",
23
+ "#FFA500",
24
+ "#FFFF00",
25
+ "#84CC16",
26
+ "#22C55E",
27
+ "#14B8A6",
28
+ "#00FFFF",
29
+ "#3B82F6",
30
+ "#6366F1",
31
+ "#A855F7",
32
+ "#EC4899",
33
+ "#A52A2A"
34
+ ];
35
+ const DEFAULT_COLOR = "#000000";
36
+ const ColorPickerBase = (props) => {
37
+ const { value: propValue, onChange, onValueChange, layout = "full", presetColors, children,...rest } = props;
38
+ const [currentValue, setCurrentValue] = require_use_controlled.default({
39
+ controlled: propValue,
40
+ default: DEFAULT_COLOR,
41
+ name: "ColorPickerBase",
42
+ state: "value"
43
+ });
44
+ const [open, setOpen] = (0, react.useState)(false);
45
+ /**
46
+ * Prevent "Maximum update depth exceeded" in controlled mode.
47
+ *
48
+ * The underlying @pixpilot/shadcn ColorPicker calls onValueChange inside a layout-effect
49
+ * when syncing a controlled 'value' prop (it calls both store.setColor() and store.setHsv(),
50
+ * each of which emits onValueChange). This can create a feedback loop if the parent
51
+ * re-renders and passes back the same normalized value, causing infinite re-renders
52
+ * during fast pointer moves.
53
+ *
54
+ * We guard against this by:
55
+ * - Ignoring onValueChange events that occur immediately after a prop change.
56
+ * - Deduping repeated notifications of the same value.
57
+ */
58
+ const isApplyingControlledValueRef = (0, react.useRef)(false);
59
+ const lastPropValueRef = (0, react.useRef)(propValue);
60
+ const lastNotifiedValueRef = (0, react.useRef)(void 0);
61
+ if (propValue !== lastPropValueRef.current) {
62
+ lastPropValueRef.current = propValue;
63
+ isApplyingControlledValueRef.current = true;
64
+ }
65
+ (0, react.useEffect)(() => {
66
+ isApplyingControlledValueRef.current = false;
67
+ }, [propValue]);
68
+ const handleValueChange = (0, react.useCallback)((value) => {
69
+ if (isApplyingControlledValueRef.current) return;
70
+ if (lastNotifiedValueRef.current === value) {
71
+ setCurrentValue(value);
72
+ return;
73
+ }
74
+ setCurrentValue(value);
75
+ onChange?.(value);
76
+ onValueChange?.(value);
77
+ lastNotifiedValueRef.current = value;
78
+ }, [
79
+ setCurrentValue,
80
+ onChange,
81
+ onValueChange
82
+ ]);
83
+ let colors = presetColors || commonColors;
84
+ const handleOpen = (0, react.useCallback)((isOpen) => {
85
+ setOpen(isOpen);
86
+ }, []);
87
+ if (layout === "compact" && !presetColors) colors = colors.slice(0, -1);
88
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.ColorPicker, {
89
+ ...rest,
90
+ value: currentValue,
91
+ onValueChange: handleValueChange,
92
+ onOpenChange: handleOpen,
93
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerTrigger, {
94
+ asChild: true,
95
+ className: "w-full flex items-center gap-1 border border-input bg-background px-3 py-2 rounded-md ",
96
+ children: children({
97
+ value: currentValue,
98
+ onValueChange: handleValueChange,
99
+ isPickerOpen: open
100
+ })
101
+ }), layout === "compact" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ColorPickerCompact.ColorPickerCompact, {
102
+ onValueChange: handleValueChange,
103
+ layout,
104
+ presetColors: colors
105
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ColorPickerFull.ColorPickerFull, {
106
+ onValueChange: handleValueChange,
107
+ layout,
108
+ presetColors: colors
109
+ })]
110
+ });
111
+ };
112
+ ColorPickerBase.displayName = "ColorPickerBase";
113
+
114
+ //#endregion
115
+ exports.ColorPickerBase = ColorPickerBase;
@@ -0,0 +1,6 @@
1
+ import { ColorPickerBaseProps } from "./types.cjs";
2
+
3
+ //#region src/ColorPickerBase/ColorPickerBase.d.ts
4
+ declare const ColorPickerBase: React.FC<ColorPickerBaseProps>;
5
+ //#endregion
6
+ export { ColorPickerBase };
@@ -0,0 +1,6 @@
1
+ import { ColorPickerBaseProps } from "./types.js";
2
+
3
+ //#region src/ColorPickerBase/ColorPickerBase.d.ts
4
+ declare const ColorPickerBase: React.FC<ColorPickerBaseProps>;
5
+ //#endregion
6
+ export { ColorPickerBase };
@@ -0,0 +1,111 @@
1
+ 'use client';
2
+
3
+
4
+ import useControlled from "../hooks/src/use-controlled.js";
5
+ import "../hooks/src/index.js";
6
+ import { ColorPickerCompact } from "./ColorPickerCompact.js";
7
+ import { ColorPickerFull } from "./ColorPickerFull.js";
8
+ import { ColorPicker, ColorPickerTrigger } from "@pixpilot/shadcn";
9
+ import { useCallback, useEffect, useRef, useState } from "react";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+
12
+ //#region src/ColorPickerBase/ColorPickerBase.tsx
13
+ const commonColors = [
14
+ "transparent",
15
+ "#000000",
16
+ "#FFFFFF",
17
+ "#808080",
18
+ "#FF0000",
19
+ "#FFA500",
20
+ "#FFFF00",
21
+ "#84CC16",
22
+ "#22C55E",
23
+ "#14B8A6",
24
+ "#00FFFF",
25
+ "#3B82F6",
26
+ "#6366F1",
27
+ "#A855F7",
28
+ "#EC4899",
29
+ "#A52A2A"
30
+ ];
31
+ const DEFAULT_COLOR = "#000000";
32
+ const ColorPickerBase = (props) => {
33
+ const { value: propValue, onChange, onValueChange, layout = "full", presetColors, children,...rest } = props;
34
+ const [currentValue, setCurrentValue] = useControlled({
35
+ controlled: propValue,
36
+ default: DEFAULT_COLOR,
37
+ name: "ColorPickerBase",
38
+ state: "value"
39
+ });
40
+ const [open, setOpen] = useState(false);
41
+ /**
42
+ * Prevent "Maximum update depth exceeded" in controlled mode.
43
+ *
44
+ * The underlying @pixpilot/shadcn ColorPicker calls onValueChange inside a layout-effect
45
+ * when syncing a controlled 'value' prop (it calls both store.setColor() and store.setHsv(),
46
+ * each of which emits onValueChange). This can create a feedback loop if the parent
47
+ * re-renders and passes back the same normalized value, causing infinite re-renders
48
+ * during fast pointer moves.
49
+ *
50
+ * We guard against this by:
51
+ * - Ignoring onValueChange events that occur immediately after a prop change.
52
+ * - Deduping repeated notifications of the same value.
53
+ */
54
+ const isApplyingControlledValueRef = useRef(false);
55
+ const lastPropValueRef = useRef(propValue);
56
+ const lastNotifiedValueRef = useRef(void 0);
57
+ if (propValue !== lastPropValueRef.current) {
58
+ lastPropValueRef.current = propValue;
59
+ isApplyingControlledValueRef.current = true;
60
+ }
61
+ useEffect(() => {
62
+ isApplyingControlledValueRef.current = false;
63
+ }, [propValue]);
64
+ const handleValueChange = useCallback((value) => {
65
+ if (isApplyingControlledValueRef.current) return;
66
+ if (lastNotifiedValueRef.current === value) {
67
+ setCurrentValue(value);
68
+ return;
69
+ }
70
+ setCurrentValue(value);
71
+ onChange?.(value);
72
+ onValueChange?.(value);
73
+ lastNotifiedValueRef.current = value;
74
+ }, [
75
+ setCurrentValue,
76
+ onChange,
77
+ onValueChange
78
+ ]);
79
+ let colors = presetColors || commonColors;
80
+ const handleOpen = useCallback((isOpen) => {
81
+ setOpen(isOpen);
82
+ }, []);
83
+ if (layout === "compact" && !presetColors) colors = colors.slice(0, -1);
84
+ return /* @__PURE__ */ jsxs(ColorPicker, {
85
+ ...rest,
86
+ value: currentValue,
87
+ onValueChange: handleValueChange,
88
+ onOpenChange: handleOpen,
89
+ children: [/* @__PURE__ */ jsx(ColorPickerTrigger, {
90
+ asChild: true,
91
+ className: "w-full flex items-center gap-1 border border-input bg-background px-3 py-2 rounded-md ",
92
+ children: children({
93
+ value: currentValue,
94
+ onValueChange: handleValueChange,
95
+ isPickerOpen: open
96
+ })
97
+ }), layout === "compact" ? /* @__PURE__ */ jsx(ColorPickerCompact, {
98
+ onValueChange: handleValueChange,
99
+ layout,
100
+ presetColors: colors
101
+ }) : /* @__PURE__ */ jsx(ColorPickerFull, {
102
+ onValueChange: handleValueChange,
103
+ layout,
104
+ presetColors: colors
105
+ })]
106
+ });
107
+ };
108
+ ColorPickerBase.displayName = "ColorPickerBase";
109
+
110
+ //#endregion
111
+ export { ColorPickerBase };
@@ -0,0 +1,51 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_ColorPickerContent = require('./ColorPickerContent.cjs');
3
+ const require_ColorPickerInput = require('./ColorPickerInput.cjs');
4
+ const require_PaletteButton = require('./PaletteButton.cjs');
5
+ const require_PaletteSwatch = require('./PaletteSwatch.cjs');
6
+ let __pixpilot_shadcn = require("@pixpilot/shadcn");
7
+ __pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
8
+ let lucide_react = require("lucide-react");
9
+ lucide_react = require_rolldown_runtime.__toESM(lucide_react);
10
+ let react = require("react");
11
+ react = require_rolldown_runtime.__toESM(react);
12
+ let react_jsx_runtime = require("react/jsx-runtime");
13
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
14
+
15
+ //#region src/ColorPickerBase/ColorPickerCompact.tsx
16
+ const ColorPickerCompact = react.default.memo((props) => {
17
+ const { onValueChange, layout = "full", presetColors } = props;
18
+ const [showFullPicker, setShowFullPicker] = (0, react.useState)(false);
19
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_ColorPickerContent.ColorPickerContent, {
20
+ className: "w-[280px] xs:w-[300px]",
21
+ children: [
22
+ showFullPicker && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerArea, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
23
+ className: "flex items-center gap-2",
24
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerEyeDropper, { className: "hidden xs:flex " }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
25
+ className: "flex-1 space-y-2",
26
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerHueSlider, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerAlphaSlider, {})]
27
+ })]
28
+ })] }),
29
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
30
+ className: "gap-2 flex flex-wrap",
31
+ children: [presetColors.map((color) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaletteSwatch.PaletteSwatch, {
32
+ color,
33
+ onSelect: onValueChange
34
+ }, color)), layout === "compact" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaletteButton.PaletteButton, {
35
+ onClick: () => setShowFullPicker(!showFullPicker),
36
+ "aria-label": "Toggle full color picker",
37
+ className: "flex items-center justify-center border-input bg-input hover:bg-accent hover:text-accent-foreground",
38
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Droplet, { className: "h-4 w-4" })
39
+ })]
40
+ }),
41
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
42
+ className: "flex items-center gap-2 w-full",
43
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerFormatSelect, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ColorPickerInput.ColorPickerInput, {})]
44
+ })
45
+ ]
46
+ });
47
+ });
48
+ ColorPickerCompact.displayName = "ColorPickerCompact";
49
+
50
+ //#endregion
51
+ exports.ColorPickerCompact = ColorPickerCompact;
@@ -0,0 +1,46 @@
1
+ import { ColorPickerContent as ColorPickerContent$1 } from "./ColorPickerContent.js";
2
+ import { ColorPickerInput as ColorPickerInput$1 } from "./ColorPickerInput.js";
3
+ import { PaletteButton } from "./PaletteButton.js";
4
+ import { PaletteSwatch } from "./PaletteSwatch.js";
5
+ import { ColorPickerAlphaSlider, ColorPickerArea, ColorPickerEyeDropper, ColorPickerFormatSelect, ColorPickerHueSlider } from "@pixpilot/shadcn";
6
+ import { Droplet } from "lucide-react";
7
+ import React, { useState } from "react";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+
10
+ //#region src/ColorPickerBase/ColorPickerCompact.tsx
11
+ const ColorPickerCompact = React.memo((props) => {
12
+ const { onValueChange, layout = "full", presetColors } = props;
13
+ const [showFullPicker, setShowFullPicker] = useState(false);
14
+ return /* @__PURE__ */ jsxs(ColorPickerContent$1, {
15
+ className: "w-[280px] xs:w-[300px]",
16
+ children: [
17
+ showFullPicker && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ColorPickerArea, {}), /* @__PURE__ */ jsxs("div", {
18
+ className: "flex items-center gap-2",
19
+ children: [/* @__PURE__ */ jsx(ColorPickerEyeDropper, { className: "hidden xs:flex " }), /* @__PURE__ */ jsxs("div", {
20
+ className: "flex-1 space-y-2",
21
+ children: [/* @__PURE__ */ jsx(ColorPickerHueSlider, {}), /* @__PURE__ */ jsx(ColorPickerAlphaSlider, {})]
22
+ })]
23
+ })] }),
24
+ /* @__PURE__ */ jsxs("div", {
25
+ className: "gap-2 flex flex-wrap",
26
+ children: [presetColors.map((color) => /* @__PURE__ */ jsx(PaletteSwatch, {
27
+ color,
28
+ onSelect: onValueChange
29
+ }, color)), layout === "compact" && /* @__PURE__ */ jsx(PaletteButton, {
30
+ onClick: () => setShowFullPicker(!showFullPicker),
31
+ "aria-label": "Toggle full color picker",
32
+ className: "flex items-center justify-center border-input bg-input hover:bg-accent hover:text-accent-foreground",
33
+ children: /* @__PURE__ */ jsx(Droplet, { className: "h-4 w-4" })
34
+ })]
35
+ }),
36
+ /* @__PURE__ */ jsxs("div", {
37
+ className: "flex items-center gap-2 w-full",
38
+ children: [/* @__PURE__ */ jsx(ColorPickerFormatSelect, {}), /* @__PURE__ */ jsx(ColorPickerInput$1, {})]
39
+ })
40
+ ]
41
+ });
42
+ });
43
+ ColorPickerCompact.displayName = "ColorPickerCompact";
44
+
45
+ //#endregion
46
+ export { ColorPickerCompact };
@@ -0,0 +1,19 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __pixpilot_shadcn = require("@pixpilot/shadcn");
3
+ __pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
4
+ let react = require("react");
5
+ react = require_rolldown_runtime.__toESM(react);
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
8
+
9
+ //#region src/ColorPickerBase/ColorPickerContent.tsx
10
+ const ColorPickerContent = (props) => {
11
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerContent, {
12
+ ...props,
13
+ className: (0, __pixpilot_shadcn.cn)("w-[280px] xs:w-[300px]", props.className)
14
+ });
15
+ };
16
+ ColorPickerContent.displayName = "ColorPickerContent";
17
+
18
+ //#endregion
19
+ exports.ColorPickerContent = ColorPickerContent;
@@ -0,0 +1,15 @@
1
+ import { ColorPickerContent, cn } from "@pixpilot/shadcn";
2
+ import React from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+
5
+ //#region src/ColorPickerBase/ColorPickerContent.tsx
6
+ const ColorPickerContent$1 = (props) => {
7
+ return /* @__PURE__ */ jsx(ColorPickerContent, {
8
+ ...props,
9
+ className: cn("w-[280px] xs:w-[300px]", props.className)
10
+ });
11
+ };
12
+ ColorPickerContent$1.displayName = "ColorPickerContent";
13
+
14
+ //#endregion
15
+ export { ColorPickerContent$1 as ColorPickerContent };
@@ -0,0 +1,39 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_ColorPickerContent = require('./ColorPickerContent.cjs');
3
+ const require_ColorPickerInput = require('./ColorPickerInput.cjs');
4
+ const require_PaletteSwatch = require('./PaletteSwatch.cjs');
5
+ let __pixpilot_shadcn = require("@pixpilot/shadcn");
6
+ __pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
7
+ let react = require("react");
8
+ react = require_rolldown_runtime.__toESM(react);
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
11
+
12
+ //#region src/ColorPickerBase/ColorPickerFull.tsx
13
+ const ColorPickerFull = react.default.memo((props) => {
14
+ const { onValueChange, presetColors } = props;
15
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_ColorPickerContent.ColorPickerContent, { children: [
16
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerArea, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
17
+ className: "flex items-center gap-2",
18
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerEyeDropper, { className: "hidden xs:flex " }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
19
+ className: "flex-1 space-y-2",
20
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerHueSlider, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerAlphaSlider, {})]
21
+ })]
22
+ })] }),
23
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
24
+ className: "gap-2 flex flex-wrap",
25
+ children: presetColors.map((color) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaletteSwatch.PaletteSwatch, {
26
+ color,
27
+ onSelect: onValueChange
28
+ }, color))
29
+ }),
30
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
31
+ className: "flex items-center gap-2 w-full",
32
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerFormatSelect, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ColorPickerInput.ColorPickerInput, {})]
33
+ })
34
+ ] });
35
+ });
36
+ ColorPickerFull.displayName = "ColorPickerContentFull";
37
+
38
+ //#endregion
39
+ exports.ColorPickerFull = ColorPickerFull;
@@ -0,0 +1,35 @@
1
+ import { ColorPickerContent as ColorPickerContent$1 } from "./ColorPickerContent.js";
2
+ import { ColorPickerInput as ColorPickerInput$1 } from "./ColorPickerInput.js";
3
+ import { PaletteSwatch } from "./PaletteSwatch.js";
4
+ import { ColorPickerAlphaSlider, ColorPickerArea, ColorPickerEyeDropper, ColorPickerFormatSelect, ColorPickerHueSlider } from "@pixpilot/shadcn";
5
+ import React from "react";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+
8
+ //#region src/ColorPickerBase/ColorPickerFull.tsx
9
+ const ColorPickerFull = React.memo((props) => {
10
+ const { onValueChange, presetColors } = props;
11
+ return /* @__PURE__ */ jsxs(ColorPickerContent$1, { children: [
12
+ /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ColorPickerArea, {}), /* @__PURE__ */ jsxs("div", {
13
+ className: "flex items-center gap-2",
14
+ children: [/* @__PURE__ */ jsx(ColorPickerEyeDropper, { className: "hidden xs:flex " }), /* @__PURE__ */ jsxs("div", {
15
+ className: "flex-1 space-y-2",
16
+ children: [/* @__PURE__ */ jsx(ColorPickerHueSlider, {}), /* @__PURE__ */ jsx(ColorPickerAlphaSlider, {})]
17
+ })]
18
+ })] }),
19
+ /* @__PURE__ */ jsx("div", {
20
+ className: "gap-2 flex flex-wrap",
21
+ children: presetColors.map((color) => /* @__PURE__ */ jsx(PaletteSwatch, {
22
+ color,
23
+ onSelect: onValueChange
24
+ }, color))
25
+ }),
26
+ /* @__PURE__ */ jsxs("div", {
27
+ className: "flex items-center gap-2 w-full",
28
+ children: [/* @__PURE__ */ jsx(ColorPickerFormatSelect, {}), /* @__PURE__ */ jsx(ColorPickerInput$1, {})]
29
+ })
30
+ ] });
31
+ });
32
+ ColorPickerFull.displayName = "ColorPickerContentFull";
33
+
34
+ //#endregion
35
+ export { ColorPickerFull };
@@ -0,0 +1,20 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __pixpilot_shadcn = require("@pixpilot/shadcn");
3
+ __pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
4
+ let react = require("react");
5
+ react = require_rolldown_runtime.__toESM(react);
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
8
+
9
+ //#region src/ColorPickerBase/ColorPickerInput.tsx
10
+ const ColorPickerInput = (props) => {
11
+ if ((0, __pixpilot_shadcn.useColorPicker)((s) => s.format) === "hex") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerInput, { ...props });
12
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerInput, {
13
+ ...props,
14
+ className: "[&_input]:px-0 [&_input]:w-full [&_input]:min-w-0 flex-1 [&_input]:text-center"
15
+ });
16
+ };
17
+ ColorPickerInput.displayName = "ColorPickerInput";
18
+
19
+ //#endregion
20
+ exports.ColorPickerInput = ColorPickerInput;
@@ -0,0 +1,16 @@
1
+ import { ColorPickerInput, useColorPicker } from "@pixpilot/shadcn";
2
+ import React from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+
5
+ //#region src/ColorPickerBase/ColorPickerInput.tsx
6
+ const ColorPickerInput$1 = (props) => {
7
+ if (useColorPicker((s) => s.format) === "hex") return /* @__PURE__ */ jsx(ColorPickerInput, { ...props });
8
+ return /* @__PURE__ */ jsx(ColorPickerInput, {
9
+ ...props,
10
+ className: "[&_input]:px-0 [&_input]:w-full [&_input]:min-w-0 flex-1 [&_input]:text-center"
11
+ });
12
+ };
13
+ ColorPickerInput$1.displayName = "ColorPickerInput";
14
+
15
+ //#endregion
16
+ export { ColorPickerInput$1 as ColorPickerInput };
@@ -0,0 +1,20 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __pixpilot_shadcn = require("@pixpilot/shadcn");
3
+ __pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
4
+ let react = require("react");
5
+ react = require_rolldown_runtime.__toESM(react);
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
8
+
9
+ //#region src/ColorPickerBase/PaletteButton.tsx
10
+ const PaletteButton = (props) => {
11
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
12
+ type: "button",
13
+ ...props,
14
+ className: (0, __pixpilot_shadcn.cn)("w-6.5 h-6.5 rounded border border-input focus:outline-none focus:ring-2 focus:ring-ring", props.className)
15
+ });
16
+ };
17
+ PaletteButton.displayName = "PaletteButton";
18
+
19
+ //#endregion
20
+ exports.PaletteButton = PaletteButton;
@@ -0,0 +1,16 @@
1
+ import { cn } from "@pixpilot/shadcn";
2
+ import React from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+
5
+ //#region src/ColorPickerBase/PaletteButton.tsx
6
+ const PaletteButton = (props) => {
7
+ return /* @__PURE__ */ jsx("button", {
8
+ type: "button",
9
+ ...props,
10
+ className: cn("w-6.5 h-6.5 rounded border border-input focus:outline-none focus:ring-2 focus:ring-ring", props.className)
11
+ });
12
+ };
13
+ PaletteButton.displayName = "PaletteButton";
14
+
15
+ //#endregion
16
+ export { PaletteButton };
@@ -0,0 +1,25 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_PaletteButton = require('./PaletteButton.cjs');
3
+ let react = require("react");
4
+ react = require_rolldown_runtime.__toESM(react);
5
+ let react_jsx_runtime = require("react/jsx-runtime");
6
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
7
+
8
+ //#region src/ColorPickerBase/PaletteSwatch.tsx
9
+ const PaletteSwatch = ({ color, onSelect }) => {
10
+ const handleClick = (0, react.useCallback)(() => {
11
+ if (onSelect) onSelect(color ?? "transparent");
12
+ }, [color, onSelect]);
13
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaletteButton.PaletteButton, {
14
+ style: color == null || color === "transparent" ? {
15
+ backgroundColor: "transparent",
16
+ backgroundImage: "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)",
17
+ backgroundSize: "4px 4px",
18
+ backgroundPosition: "0 0, 0 2px, 2px -2px, -2px 0px"
19
+ } : { backgroundColor: color },
20
+ onClick: handleClick
21
+ });
22
+ };
23
+
24
+ //#endregion
25
+ exports.PaletteSwatch = PaletteSwatch;
@@ -0,0 +1,22 @@
1
+ import { PaletteButton } from "./PaletteButton.js";
2
+ import { useCallback } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+
5
+ //#region src/ColorPickerBase/PaletteSwatch.tsx
6
+ const PaletteSwatch = ({ color, onSelect }) => {
7
+ const handleClick = useCallback(() => {
8
+ if (onSelect) onSelect(color ?? "transparent");
9
+ }, [color, onSelect]);
10
+ return /* @__PURE__ */ jsx(PaletteButton, {
11
+ style: color == null || color === "transparent" ? {
12
+ backgroundColor: "transparent",
13
+ backgroundImage: "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)",
14
+ backgroundSize: "4px 4px",
15
+ backgroundPosition: "0 0, 0 2px, 2px -2px, -2px 0px"
16
+ } : { backgroundColor: color },
17
+ onClick: handleClick
18
+ });
19
+ };
20
+
21
+ //#endregion
22
+ export { PaletteSwatch };
@@ -0,0 +1 @@
1
+ const require_ColorPickerBase = require('./ColorPickerBase.cjs');
@@ -0,0 +1,2 @@
1
+ import { ColorPickerBaseProps } from "./types.js";
2
+ import { ColorPickerBase } from "./ColorPickerBase.js";
@@ -0,0 +1 @@
1
+ import { ColorPickerBase } from "./ColorPickerBase.js";
@@ -0,0 +1,16 @@
1
+ import { ColorPickerProps } from "@pixpilot/shadcn";
2
+
3
+ //#region src/ColorPickerBase/types.d.ts
4
+ interface ColorPickerBaseProps extends Omit<ColorPickerProps, 'onChange' | 'children'> {
5
+ value?: string;
6
+ onChange?: (value: string) => void;
7
+ presetColors?: string[];
8
+ layout?: 'full' | 'compact';
9
+ children: (props: {
10
+ value?: string;
11
+ onValueChange: (value: string) => void;
12
+ isPickerOpen: boolean;
13
+ }) => React.ReactNode;
14
+ }
15
+ //#endregion
16
+ export { ColorPickerBaseProps };
@@ -0,0 +1,16 @@
1
+ import { ColorPickerProps } from "@pixpilot/shadcn";
2
+
3
+ //#region src/ColorPickerBase/types.d.ts
4
+ interface ColorPickerBaseProps extends Omit<ColorPickerProps, 'onChange' | 'children'> {
5
+ value?: string;
6
+ onChange?: (value: string) => void;
7
+ presetColors?: string[];
8
+ layout?: 'full' | 'compact';
9
+ children: (props: {
10
+ value?: string;
11
+ onValueChange: (value: string) => void;
12
+ isPickerOpen: boolean;
13
+ }) => React.ReactNode;
14
+ }
15
+ //#endregion
16
+ export { ColorPickerBaseProps };
@@ -0,0 +1 @@
1
+ const require_use_controlled = require('./use-controlled.cjs');
@@ -0,0 +1 @@
1
+ import useControlled from "./use-controlled.js";
@@ -0,0 +1,42 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ let react = require("react");
3
+ react = require_rolldown_runtime.__toESM(react);
4
+
5
+ //#region ../hooks/src/use-controlled.ts
6
+ function useControlled(props) {
7
+ const { controlled, default: defaultProp, name, state = "value" } = props;
8
+ const { current: isControlled } = react.default.useRef(controlled !== void 0);
9
+ const [valueState, setValue] = react.default.useState(defaultProp);
10
+ const value = isControlled ? controlled : valueState;
11
+ if (process.env.NODE_ENV !== "production") {
12
+ react.default.useEffect(() => {
13
+ if (isControlled !== (controlled !== void 0)) console.error([
14
+ `A component is changing the ${isControlled ? "" : "un"}controlled ${state} state of ${name} to be ${isControlled ? "un" : ""}controlled.`,
15
+ "Elements should not switch from uncontrolled to controlled (or vice versa).",
16
+ `Decide between using a controlled or uncontrolled ${name} element for the lifetime of the component.`,
17
+ "The nature of the state is determined during the first render, it's considered controlled if the value is not `undefined`.",
18
+ "More info: https://fb.me/react-controlled-components"
19
+ ].join("\n"));
20
+ }, [
21
+ state,
22
+ name,
23
+ controlled,
24
+ isControlled
25
+ ]);
26
+ const { current: defaultValue } = react.default.useRef(defaultProp);
27
+ react.default.useEffect(() => {
28
+ if (!isControlled && defaultValue !== defaultProp) console.error([`A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. To suppress this warning opt to use a controlled ${name}.`].join("\n"));
29
+ }, [JSON.stringify(defaultProp)]);
30
+ }
31
+ return [
32
+ value,
33
+ react.default.useCallback((newValue) => {
34
+ if (!isControlled) setValue(newValue);
35
+ else if (typeof newValue === "function") newValue(controlled);
36
+ }, [controlled, isControlled]),
37
+ isControlled
38
+ ];
39
+ }
40
+
41
+ //#endregion
42
+ exports.default = useControlled;
@@ -0,0 +1,40 @@
1
+ import React from "react";
2
+
3
+ //#region ../hooks/src/use-controlled.ts
4
+ function useControlled(props) {
5
+ const { controlled, default: defaultProp, name, state = "value" } = props;
6
+ const { current: isControlled } = React.useRef(controlled !== void 0);
7
+ const [valueState, setValue] = React.useState(defaultProp);
8
+ const value = isControlled ? controlled : valueState;
9
+ {
10
+ React.useEffect(() => {
11
+ if (isControlled !== (controlled !== void 0)) console.error([
12
+ `A component is changing the ${isControlled ? "" : "un"}controlled ${state} state of ${name} to be ${isControlled ? "un" : ""}controlled.`,
13
+ "Elements should not switch from uncontrolled to controlled (or vice versa).",
14
+ `Decide between using a controlled or uncontrolled ${name} element for the lifetime of the component.`,
15
+ "The nature of the state is determined during the first render, it's considered controlled if the value is not `undefined`.",
16
+ "More info: https://fb.me/react-controlled-components"
17
+ ].join("\n"));
18
+ }, [
19
+ state,
20
+ name,
21
+ controlled,
22
+ isControlled
23
+ ]);
24
+ const { current: defaultValue } = React.useRef(defaultProp);
25
+ React.useEffect(() => {
26
+ if (!isControlled && defaultValue !== defaultProp) console.error([`A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. To suppress this warning opt to use a controlled ${name}.`].join("\n"));
27
+ }, [JSON.stringify(defaultProp)]);
28
+ }
29
+ return [
30
+ value,
31
+ React.useCallback((newValue) => {
32
+ if (!isControlled) setValue(newValue);
33
+ else if (typeof newValue === "function") newValue(controlled);
34
+ }, [controlled, isControlled]),
35
+ isControlled
36
+ ];
37
+ }
38
+
39
+ //#endregion
40
+ export { useControlled as default };
package/dist/index.cjs CHANGED
@@ -10,6 +10,10 @@ const require_circle_loader = require('./circle-loader/circle-loader.cjs');
10
10
  require('./circle-loader/index.cjs');
11
11
  const require_CloseButtonRounded = require('./CloseButtonRounded.cjs');
12
12
  const require_CloseButtonAbsolute = require('./CloseButtonAbsolute.cjs');
13
+ const require_ColorPickerBase = require('./ColorPickerBase/ColorPickerBase.cjs');
14
+ require('./ColorPickerBase/index.cjs');
15
+ const require_ColorPicker = require('./ColorPicker/ColorPicker.cjs');
16
+ require('./ColorPicker/index.cjs');
13
17
  const require_Combobox = require('./Combobox.cjs');
14
18
  const require_confirmation_dialogs = require('./confirmation-dialog/confirmation-dialogs.cjs');
15
19
  const require_DialogProvider = require('./confirmation-dialog/DialogProvider.cjs');
@@ -57,6 +61,8 @@ exports.Button = require_Button.Button;
57
61
  exports.CircleLoader = require_circle_loader.CircleLoader;
58
62
  exports.CloseButtonAbsolute = require_CloseButtonAbsolute.CloseButtonAbsolute;
59
63
  exports.CloseButtonRounded = require_CloseButtonRounded.CloseButtonRounded;
64
+ exports.ColorPicker = require_ColorPicker.ColorPicker;
65
+ exports.ColorPickerBase = require_ColorPickerBase.ColorPickerBase;
60
66
  exports.Combobox = require_Combobox.Combobox;
61
67
  exports.ContentCard = require_ContentCard.ContentCard;
62
68
  exports.DEFAULT_ALERT_DURATION = require_toast.DEFAULT_ALERT_DURATION;
package/dist/index.d.cts CHANGED
@@ -10,6 +10,9 @@ import { CircleLoader, CircleLoaderProps } from "./circle-loader/circle-loader.c
10
10
  import "./circle-loader/index.cjs";
11
11
  import { CloseButtonRounded, CloseButtonRoundedProps } from "./CloseButtonRounded.cjs";
12
12
  import { CloseButtonAbsolute, PopoverCloseButtonProps } from "./CloseButtonAbsolute.cjs";
13
+ import { ColorPickerBaseProps } from "./ColorPickerBase/types.cjs";
14
+ import { ColorPickerBase } from "./ColorPickerBase/ColorPickerBase.cjs";
15
+ import { ColorPicker, ColorPickerProps } from "./ColorPicker/ColorPicker.cjs";
13
16
  import { Combobox } from "./Combobox.cjs";
14
17
  import { ConfirmationDialogProps } from "./confirmation-dialog/ConfirmationDialog.cjs";
15
18
  import { showConfirmDialog } from "./confirmation-dialog/confirmation-dialogs.cjs";
@@ -51,4 +54,4 @@ import { ThemeToggle } from "./ThemeToggle.cjs";
51
54
  import { DEFAULT_ALERT_DURATION, ToastMessage, toast, toastError, toastInfo, toastSuccess, toastWarning } from "./toast/toast.cjs";
52
55
  import "./toast/index.cjs";
53
56
  import { cn } from "@pixpilot/shadcn";
54
- export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, AvatarUpload, AvatarUploadProps, BaseTabsTriggerProps, Button, ButtonLoaderProps, ButtonProps, CircleLoader, CircleLoaderProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DatePickerProps, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, Layout, LayoutFooter, LayoutFooterProps, LayoutHeader, LayoutHeaderProps, LayoutMain, LayoutMainProps, LayoutProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, RichTextEditor, RichTextEditorProps, ScaledPreview, ScaledPreviewProps, ScaledPreviewSize, Select, SelectOption, SingleFileUploadProps, Slider, SliderProps, Tabs, TabsContent, TabsContext, TabsContextValue, TabsList, TabsListProps, TabsTrigger, TabsTriggerProps, TabsVariant, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, ToolbarOption, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTabsContext, useTheme };
57
+ export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, AvatarUpload, AvatarUploadProps, BaseTabsTriggerProps, Button, ButtonLoaderProps, ButtonProps, CircleLoader, CircleLoaderProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, ColorPicker, ColorPickerBase, ColorPickerBaseProps, ColorPickerProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DatePickerProps, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, Layout, LayoutFooter, LayoutFooterProps, LayoutHeader, LayoutHeaderProps, LayoutMain, LayoutMainProps, LayoutProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, RichTextEditor, RichTextEditorProps, ScaledPreview, ScaledPreviewProps, ScaledPreviewSize, Select, SelectOption, SingleFileUploadProps, Slider, SliderProps, Tabs, TabsContent, TabsContext, TabsContextValue, TabsList, TabsListProps, TabsTrigger, TabsTriggerProps, TabsVariant, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, ToolbarOption, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTabsContext, useTheme };
package/dist/index.d.ts CHANGED
@@ -10,6 +10,11 @@ import { CircleLoader, CircleLoaderProps } from "./circle-loader/circle-loader.j
10
10
  import "./circle-loader/index.js";
11
11
  import { CloseButtonRounded, CloseButtonRoundedProps } from "./CloseButtonRounded.js";
12
12
  import { CloseButtonAbsolute, PopoverCloseButtonProps } from "./CloseButtonAbsolute.js";
13
+ import { ColorPickerBaseProps } from "./ColorPickerBase/types.js";
14
+ import { ColorPickerBase } from "./ColorPickerBase/ColorPickerBase.js";
15
+ import "./ColorPickerBase/index.js";
16
+ import { ColorPicker, ColorPickerProps } from "./ColorPicker/ColorPicker.js";
17
+ import "./ColorPicker/index.js";
13
18
  import { Combobox } from "./Combobox.js";
14
19
  import { ConfirmationDialogProps } from "./confirmation-dialog/ConfirmationDialog.js";
15
20
  import { showConfirmDialog } from "./confirmation-dialog/confirmation-dialogs.js";
@@ -52,4 +57,4 @@ import { ThemeToggle } from "./ThemeToggle.js";
52
57
  import { DEFAULT_ALERT_DURATION, ToastMessage, toast, toastError, toastInfo, toastSuccess, toastWarning } from "./toast/toast.js";
53
58
  import "./toast/index.js";
54
59
  import { cn } from "@pixpilot/shadcn";
55
- export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, AvatarUpload, AvatarUploadProps, BaseTabsTriggerProps, Button, ButtonLoaderProps, ButtonProps, CircleLoader, CircleLoaderProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DatePickerProps, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, Layout, LayoutFooter, LayoutFooterProps, LayoutHeader, LayoutHeaderProps, LayoutMain, LayoutMainProps, LayoutProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, RichTextEditor, RichTextEditorProps, ScaledPreview, ScaledPreviewProps, ScaledPreviewSize, Select, SelectOption, SingleFileUploadProps, Slider, SliderProps, Tabs, TabsContent, TabsContext, TabsContextValue, TabsList, TabsListProps, TabsTrigger, TabsTriggerProps, TabsVariant, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, ToolbarOption, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTabsContext, useTheme };
60
+ export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, AvatarUpload, AvatarUploadProps, BaseTabsTriggerProps, Button, ButtonLoaderProps, ButtonProps, CircleLoader, CircleLoaderProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, ColorPicker, ColorPickerBase, ColorPickerBaseProps, ColorPickerProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DatePickerProps, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, Layout, LayoutFooter, LayoutFooterProps, LayoutHeader, LayoutHeaderProps, LayoutMain, LayoutMainProps, LayoutProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, RichTextEditor, RichTextEditorProps, ScaledPreview, ScaledPreviewProps, ScaledPreviewSize, Select, SelectOption, SingleFileUploadProps, Slider, SliderProps, Tabs, TabsContent, TabsContext, TabsContextValue, TabsList, TabsListProps, TabsTrigger, TabsTriggerProps, TabsVariant, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, ToolbarOption, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTabsContext, useTheme };
package/dist/index.js CHANGED
@@ -9,6 +9,10 @@ import { CircleLoader } from "./circle-loader/circle-loader.js";
9
9
  import "./circle-loader/index.js";
10
10
  import { CloseButtonRounded } from "./CloseButtonRounded.js";
11
11
  import { CloseButtonAbsolute } from "./CloseButtonAbsolute.js";
12
+ import { ColorPickerBase } from "./ColorPickerBase/ColorPickerBase.js";
13
+ import "./ColorPickerBase/index.js";
14
+ import { ColorPicker } from "./ColorPicker/ColorPicker.js";
15
+ import "./ColorPicker/index.js";
12
16
  import { Combobox } from "./Combobox.js";
13
17
  import { showConfirmDialog } from "./confirmation-dialog/confirmation-dialogs.js";
14
18
  import { DialogProvider } from "./confirmation-dialog/DialogProvider.js";
@@ -48,4 +52,4 @@ import { DEFAULT_ALERT_DURATION, toast, toastError, toastInfo, toastSuccess, toa
48
52
  import "./toast/index.js";
49
53
  import { cn } from "@pixpilot/shadcn";
50
54
 
51
- export { AbsoluteFill, Alert, AvatarUpload, Button, CircleLoader, CloseButtonAbsolute, CloseButtonRounded, Combobox, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DialogProvider, FileUpload, FileUploadInline, IconPicker, Layout, LayoutFooter, LayoutHeader, LayoutMain, LoadingOverlay, Pagination, RichTextEditor, ScaledPreview, Select, Slider, Tabs, TabsContent, TabsContext, TabsList, TabsTrigger, TagsInput, ThemeProvider, ThemeToggle, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTabsContext, useTheme };
55
+ export { AbsoluteFill, Alert, AvatarUpload, Button, CircleLoader, CloseButtonAbsolute, CloseButtonRounded, ColorPicker, ColorPickerBase, Combobox, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DialogProvider, FileUpload, FileUploadInline, IconPicker, Layout, LayoutFooter, LayoutHeader, LayoutMain, LoadingOverlay, Pagination, RichTextEditor, ScaledPreview, Select, Slider, Tabs, TabsContent, TabsContext, TabsList, TabsTrigger, TagsInput, ThemeProvider, ThemeToggle, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTabsContext, useTheme };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pixpilot/shadcn-ui",
3
3
  "type": "module",
4
- "version": "0.12.0",
4
+ "version": "0.13.0",
5
5
  "description": "Custom UI components and utilities built with shadcn/ui.",
6
6
  "author": "m.doaie <m.doaie@hotmail.com>",
7
7
  "license": "MIT",
@@ -44,6 +44,7 @@
44
44
  "pretty-bytes": "^7.1.0",
45
45
  "react-responsive": "^10.0.1",
46
46
  "sonner": "2.0.7",
47
+ "@internal/hooks": "0.0.0",
47
48
  "@pixpilot/shadcn": "0.5.0"
48
49
  },
49
50
  "devDependencies": {