@pixpilot/shadcn-ui 0.21.0 → 0.22.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.
- package/dist/ColorPicker/ColorPicker.cjs +12 -4
- package/dist/ColorPicker/ColorPicker.d.cts +1 -0
- package/dist/ColorPicker/ColorPicker.d.ts +1 -0
- package/dist/ColorPicker/ColorPicker.js +12 -4
- package/dist/file-upload/FileUpload.d.cts +2 -2
- package/dist/file-upload/FileUpload.d.ts +2 -2
- package/dist/file-upload-inline/FileUploadInline.d.ts +2 -2
- package/dist/input/Input.d.cts +2 -2
- package/package.json +2 -2
|
@@ -19,14 +19,22 @@ function Swatch(props) {
|
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
const ColorPicker = (props) => {
|
|
22
|
-
const { variant = "input", placeholder = "Pick a color",...rest } = props;
|
|
22
|
+
const { variant = "input", placeholder = "Pick a color", formatDisplayValue,...rest } = props;
|
|
23
23
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ColorPickerBase.ColorPickerBase, {
|
|
24
24
|
...rest,
|
|
25
25
|
children: ({ value, onValueChange, isPickerOpen }) => {
|
|
26
|
+
const swatchColor = value != null && value !== "" ? value : void 0;
|
|
27
|
+
const renderSwatch = () => {
|
|
28
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Swatch, { color: swatchColor });
|
|
29
|
+
};
|
|
30
|
+
const renderDisplayValue = () => {
|
|
31
|
+
if (value == null || value === "") return placeholder;
|
|
32
|
+
return formatDisplayValue != null ? formatDisplayValue(value) : value;
|
|
33
|
+
};
|
|
26
34
|
if (variant === "input") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.InputGroup, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.InputGroupAddon, {
|
|
27
35
|
align: "inline-start",
|
|
28
36
|
className: "pl-0",
|
|
29
|
-
children:
|
|
37
|
+
children: renderSwatch()
|
|
30
38
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.InputGroupInput, {
|
|
31
39
|
value: value ?? "",
|
|
32
40
|
onPointerDown: (e) => {
|
|
@@ -46,11 +54,11 @@ const ColorPicker = (props) => {
|
|
|
46
54
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.InputGroupAddon, {
|
|
47
55
|
align: "inline-start",
|
|
48
56
|
className: "pl-0",
|
|
49
|
-
children:
|
|
57
|
+
children: renderSwatch()
|
|
50
58
|
}),
|
|
51
59
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.InputGroupText, {
|
|
52
60
|
className: "flex-1 text-left text-foreground pl-2",
|
|
53
|
-
children:
|
|
61
|
+
children: renderDisplayValue()
|
|
54
62
|
}),
|
|
55
63
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.InputGroupAddon, {
|
|
56
64
|
align: "inline-end",
|
|
@@ -4,6 +4,7 @@ import { ColorPickerBaseProps } from "../ColorPickerBase/types.cjs";
|
|
|
4
4
|
interface ColorPickerProps extends Omit<ColorPickerBaseProps, 'children'> {
|
|
5
5
|
variant?: 'button' | 'input';
|
|
6
6
|
placeholder?: string;
|
|
7
|
+
formatDisplayValue?: (value: string) => React.ReactNode;
|
|
7
8
|
}
|
|
8
9
|
declare const ColorPicker: React.FC<ColorPickerProps>;
|
|
9
10
|
//#endregion
|
|
@@ -5,6 +5,7 @@ import "../ColorPickerBase/index.js";
|
|
|
5
5
|
interface ColorPickerProps extends Omit<ColorPickerBaseProps, 'children'> {
|
|
6
6
|
variant?: 'button' | 'input';
|
|
7
7
|
placeholder?: string;
|
|
8
|
+
formatDisplayValue?: (value: string) => React.ReactNode;
|
|
8
9
|
}
|
|
9
10
|
declare const ColorPicker: React.FC<ColorPickerProps>;
|
|
10
11
|
//#endregion
|
|
@@ -15,14 +15,22 @@ function Swatch(props) {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
const ColorPicker$1 = (props) => {
|
|
18
|
-
const { variant = "input", placeholder = "Pick a color",...rest } = props;
|
|
18
|
+
const { variant = "input", placeholder = "Pick a color", formatDisplayValue,...rest } = props;
|
|
19
19
|
return /* @__PURE__ */ jsx(ColorPickerBase, {
|
|
20
20
|
...rest,
|
|
21
21
|
children: ({ value, onValueChange, isPickerOpen }) => {
|
|
22
|
+
const swatchColor = value != null && value !== "" ? value : void 0;
|
|
23
|
+
const renderSwatch = () => {
|
|
24
|
+
return /* @__PURE__ */ jsx(Swatch, { color: swatchColor });
|
|
25
|
+
};
|
|
26
|
+
const renderDisplayValue = () => {
|
|
27
|
+
if (value == null || value === "") return placeholder;
|
|
28
|
+
return formatDisplayValue != null ? formatDisplayValue(value) : value;
|
|
29
|
+
};
|
|
22
30
|
if (variant === "input") return /* @__PURE__ */ jsxs(InputGroup, { children: [/* @__PURE__ */ jsx(InputGroupAddon, {
|
|
23
31
|
align: "inline-start",
|
|
24
32
|
className: "pl-0",
|
|
25
|
-
children:
|
|
33
|
+
children: renderSwatch()
|
|
26
34
|
}), /* @__PURE__ */ jsx(InputGroupInput, {
|
|
27
35
|
value: value ?? "",
|
|
28
36
|
onPointerDown: (e) => {
|
|
@@ -42,11 +50,11 @@ const ColorPicker$1 = (props) => {
|
|
|
42
50
|
/* @__PURE__ */ jsx(InputGroupAddon, {
|
|
43
51
|
align: "inline-start",
|
|
44
52
|
className: "pl-0",
|
|
45
|
-
children:
|
|
53
|
+
children: renderSwatch()
|
|
46
54
|
}),
|
|
47
55
|
/* @__PURE__ */ jsx(InputGroupText, {
|
|
48
56
|
className: "flex-1 text-left text-foreground pl-2",
|
|
49
|
-
children:
|
|
57
|
+
children: renderDisplayValue()
|
|
50
58
|
}),
|
|
51
59
|
/* @__PURE__ */ jsx(InputGroupAddon, {
|
|
52
60
|
align: "inline-end",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FileUploadProps } from "./types/index.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/file-upload/FileUpload.d.ts
|
|
5
|
-
declare function FileUpload(props: FileUploadProps):
|
|
5
|
+
declare function FileUpload(props: FileUploadProps): react_jsx_runtime7.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { FileUpload };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FileUploadProps } from "./types/index.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/file-upload/FileUpload.d.ts
|
|
5
|
-
declare function FileUpload(props: FileUploadProps):
|
|
5
|
+
declare function FileUpload(props: FileUploadProps): react_jsx_runtime7.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { FileUpload };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FileUploadInlineProps } from "./types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime8 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/file-upload-inline/FileUploadInline.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* FileUploadInline - An inline file upload component using FileUpload primitives
|
|
7
7
|
*/
|
|
8
|
-
declare function FileUploadInline(props: FileUploadInlineProps):
|
|
8
|
+
declare function FileUploadInline(props: FileUploadInlineProps): react_jsx_runtime8.JSX.Element;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { FileUploadInline };
|
package/dist/input/Input.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime9 from "react/jsx-runtime";
|
|
2
2
|
import { InputProps } from "@pixpilot/shadcn";
|
|
3
3
|
import * as React$1 from "react";
|
|
4
4
|
|
|
@@ -10,6 +10,6 @@ type InputProps$1 = InputProps & {
|
|
|
10
10
|
prefixClassName?: string;
|
|
11
11
|
suffixClassName?: string;
|
|
12
12
|
};
|
|
13
|
-
declare function Input(props: InputProps$1):
|
|
13
|
+
declare function Input(props: InputProps$1): react_jsx_runtime9.JSX.Element;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { Input, InputProps$1 as InputProps };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixpilot/shadcn-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.22.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",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"tsdown": "^0.15.12",
|
|
59
59
|
"typescript": "^5.9.3",
|
|
60
60
|
"@internal/eslint-config": "0.3.0",
|
|
61
|
+
"@internal/hooks": "0.0.0",
|
|
61
62
|
"@internal/prettier-config": "0.0.1",
|
|
62
63
|
"@internal/tsconfig": "0.1.0",
|
|
63
|
-
"@internal/hooks": "0.0.0",
|
|
64
64
|
"@internal/tsdown-config": "0.1.0",
|
|
65
65
|
"@internal/vitest-config": "0.1.0"
|
|
66
66
|
},
|