@pixpilot/shadcn-ui 1.23.0 → 1.25.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/AbsoluteFill.d.cts +2 -2
- package/dist/Alert.cjs +21 -17
- package/dist/Alert.js +21 -17
- package/dist/Button.d.cts +2 -2
- package/dist/ButtonExtended.d.cts +2 -2
- package/dist/ColorPicker/ColorPicker.cjs +4 -1
- package/dist/ColorPicker/ColorPicker.js +4 -1
- package/dist/ColorPickerBase/ColorPickerBase.cjs +5 -2
- package/dist/ColorPickerBase/ColorPickerBase.js +5 -2
- package/dist/ColorPickerBase/ColorPickerButton.cjs +6 -2
- package/dist/ColorPickerBase/ColorPickerButton.js +6 -2
- package/dist/ColorPickerBase/ColorPickerCompactControls.cjs +5 -3
- package/dist/ColorPickerBase/ColorPickerCompactControls.js +5 -3
- package/dist/ColorPickerBase/ColorPickerControls.cjs +14 -3
- package/dist/ColorPickerBase/ColorPickerControls.js +14 -3
- package/dist/ColorPickerBase/ColorPickerFormatControls.cjs +3 -2
- package/dist/ColorPickerBase/ColorPickerFormatControls.js +3 -2
- package/dist/ColorPickerBase/ColorPickerFullControls.cjs +8 -4
- package/dist/ColorPickerBase/ColorPickerFullControls.js +8 -4
- package/dist/ColorPickerBase/ColorPickerInput.cjs +6 -2
- package/dist/ColorPickerBase/ColorPickerInput.js +6 -2
- package/dist/ColorPickerBase/ColorPickerRoot.cjs +2 -1
- package/dist/ColorPickerBase/ColorPickerRoot.js +2 -1
- package/dist/ColorPickerBase/color-palette/ColorPalette.cjs +8 -2
- package/dist/ColorPickerBase/color-palette/ColorPalette.js +8 -2
- package/dist/ColorPickerBase/color-palette/PaletteSwatch.cjs +2 -1
- package/dist/ColorPickerBase/color-palette/PaletteSwatch.d.cts +1 -0
- package/dist/ColorPickerBase/color-palette/PaletteSwatch.d.ts +1 -0
- package/dist/ColorPickerBase/color-palette/PaletteSwatch.js +2 -1
- package/dist/ColorPickerBase/color-picker-context.d.cts +1 -0
- package/dist/ColorPickerBase/color-picker-context.d.ts +1 -0
- package/dist/ColorPickerBase/types.d.cts +2 -0
- package/dist/ColorPickerBase/types.d.ts +2 -0
- package/dist/ColorSelect.cjs +4 -1
- package/dist/ColorSelect.d.cts +3 -2
- package/dist/ColorSelect.d.ts +1 -0
- package/dist/ColorSelect.js +4 -1
- package/dist/Combobox.cjs +8 -2
- package/dist/Combobox.d.cts +1 -0
- package/dist/Combobox.d.ts +1 -0
- package/dist/Combobox.js +8 -2
- package/dist/CommandOptionList.cjs +3 -1
- package/dist/CommandOptionList.js +3 -1
- package/dist/ContentCard.d.cts +2 -2
- package/dist/ContentCard.d.ts +2 -2
- package/dist/DatePicker.cjs +2 -1
- package/dist/DatePicker.d.cts +3 -2
- package/dist/DatePicker.d.ts +3 -2
- package/dist/DatePicker.js +2 -1
- package/dist/IconToggle.cjs +1 -1
- package/dist/IconToggle.js +1 -1
- package/dist/Rating.cjs +7 -2
- package/dist/Rating.d.cts +4 -3
- package/dist/Rating.d.ts +4 -3
- package/dist/Rating.js +7 -2
- package/dist/Select.cjs +1 -1
- package/dist/Select.d.cts +2 -2
- package/dist/Select.js +1 -1
- package/dist/avatar-upload/AvatarUpload.cjs +5 -2
- package/dist/avatar-upload/AvatarUpload.js +5 -2
- package/dist/avatar-upload/AvatarUploadComponents.cjs +3 -1
- package/dist/avatar-upload/AvatarUploadComponents.js +3 -1
- package/dist/avatar-upload/AvatarUploadItem.cjs +4 -1
- package/dist/avatar-upload/AvatarUploadItem.js +4 -1
- package/dist/confirmation-dialog/ConfirmationDialog.cjs +4 -1
- package/dist/confirmation-dialog/ConfirmationDialog.d.cts +1 -0
- package/dist/confirmation-dialog/ConfirmationDialog.d.ts +1 -0
- package/dist/confirmation-dialog/ConfirmationDialog.js +4 -1
- package/dist/dialog/Dialog.d.cts +4 -4
- package/dist/file-upload/FileUpload.cjs +3 -1
- package/dist/file-upload/FileUpload.d.cts +2 -2
- package/dist/file-upload/FileUpload.js +3 -1
- package/dist/file-upload/FileUploadItems.cjs +2 -1
- package/dist/file-upload/FileUploadItems.js +2 -1
- package/dist/file-upload/FileUploadListItem.cjs +3 -1
- package/dist/file-upload/FileUploadListItem.js +3 -1
- package/dist/file-upload-inline/FileUploadInline.d.cts +2 -2
- package/dist/file-upload-root/FileUploadRoot.cjs +3 -1
- package/dist/file-upload-root/FileUploadRoot.d.cts +2 -2
- package/dist/file-upload-root/FileUploadRoot.js +3 -1
- package/dist/file-upload-root/FileUploadRootItem.cjs +18 -13
- package/dist/file-upload-root/FileUploadRootItem.d.cts +1 -0
- package/dist/file-upload-root/FileUploadRootItem.d.ts +1 -0
- package/dist/file-upload-root/FileUploadRootItem.js +18 -13
- package/dist/icon-selector/IconPicker.cjs +7 -1
- package/dist/icon-selector/IconPicker.d.cts +1 -0
- package/dist/icon-selector/IconPicker.d.ts +1 -0
- package/dist/icon-selector/IconPicker.js +7 -1
- package/dist/icon-selector/icon-picker-content.cjs +8 -1
- package/dist/icon-selector/icon-picker-content.js +8 -1
- package/dist/icon-selector/virtualized-icon-grid.cjs +5 -2
- package/dist/icon-selector/virtualized-icon-grid.js +5 -2
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/input/Input.d.cts +2 -2
- package/dist/input/Input.d.ts +2 -2
- package/dist/pagination/Pagination.cjs +28 -6
- package/dist/pagination/Pagination.d.cts +1 -0
- package/dist/pagination/Pagination.d.ts +1 -0
- package/dist/pagination/Pagination.js +28 -6
- package/dist/rich-text-editor/ToolbarButton.cjs +1 -1
- package/dist/rich-text-editor/ToolbarButton.js +1 -1
- package/dist/slider/SliderInput.cjs +1 -1
- package/dist/slider/SliderInput.js +1 -1
- package/dist/slider/SliderSelect.cjs +1 -1
- package/dist/slider/SliderSelect.js +1 -1
- package/dist/tags-input/TagsInput.cjs +4 -1
- package/dist/tags-input/TagsInput.d.cts +4 -2
- package/dist/tags-input/TagsInput.d.ts +2 -0
- package/dist/tags-input/TagsInput.js +4 -1
- package/dist/tags-input/TagsInputInline.cjs +9 -2
- package/dist/tags-input/TagsInputInline.d.cts +4 -2
- package/dist/tags-input/TagsInputInline.d.ts +4 -2
- package/dist/tags-input/TagsInputInline.js +9 -2
- package/dist/theme-toggle/ThemeModeDropdown.cjs +6 -1
- package/dist/theme-toggle/ThemeModeDropdown.d.cts +3 -2
- package/dist/theme-toggle/ThemeModeDropdown.d.ts +3 -2
- package/dist/theme-toggle/ThemeModeDropdown.js +6 -1
- package/dist/theme-toggle/ThemeModeSwitchInside.cjs +3 -1
- package/dist/theme-toggle/ThemeModeSwitchInside.d.cts +3 -2
- package/dist/theme-toggle/ThemeModeSwitchInside.d.ts +3 -2
- package/dist/theme-toggle/ThemeModeSwitchInside.js +3 -1
- package/dist/theme-toggle/ThemeModeSwitchOutside.cjs +3 -1
- package/dist/theme-toggle/ThemeModeSwitchOutside.d.cts +3 -2
- package/dist/theme-toggle/ThemeModeSwitchOutside.d.ts +3 -2
- package/dist/theme-toggle/ThemeModeSwitchOutside.js +3 -1
- package/dist/theme-toggle/ThemeModeToggleButton.cjs +2 -1
- package/dist/theme-toggle/ThemeModeToggleButton.d.cts +3 -2
- package/dist/theme-toggle/ThemeModeToggleButton.d.ts +3 -2
- package/dist/theme-toggle/ThemeModeToggleButton.js +2 -1
- package/dist/toast/AlertToast.cjs +2 -1
- package/dist/toast/AlertToast.js +2 -1
- package/package.json +5 -5
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getId } from "../utils/get-id.js";
|
|
1
2
|
import { useColorPickerContext } from "./color-picker-context.js";
|
|
2
3
|
import { ColorPickerSwatch as ColorPickerSwatch$1 } from "./ColorPickerSwatch.js";
|
|
3
4
|
import { useColorPickerResetOptions } from "./hooks/use-color-picker-reset-options.js";
|
|
@@ -8,8 +9,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
8
9
|
|
|
9
10
|
//#region src/ColorPickerBase/ColorPickerInput.tsx
|
|
10
11
|
const ColorPickerInput$1 = (props) => {
|
|
11
|
-
const { slots, onChange, onClear, resetOptions, placeholder, title,...rest } = props;
|
|
12
|
-
const { isPickerOpen, onValueChange } = useColorPickerContext();
|
|
12
|
+
const { slots, onChange, onClear, resetOptions, placeholder, title, id,...rest } = props;
|
|
13
|
+
const { id: contextId, isPickerOpen, onValueChange } = useColorPickerContext();
|
|
13
14
|
const { value, isResetValue, resetLabel, resetTooltip, resetIcon, handleClear, showClearButton, swatchColor } = useColorPickerResetOptions({
|
|
14
15
|
resetOptions,
|
|
15
16
|
onClear
|
|
@@ -17,6 +18,7 @@ const ColorPickerInput$1 = (props) => {
|
|
|
17
18
|
if (onValueChange === void 0) throw new Error("ColorPickerInput must be used within a ColorPickerRoot component");
|
|
18
19
|
const inputValue = isResetValue ? "" : value ?? "";
|
|
19
20
|
const inputPlaceholder = isResetValue ? resetLabel : placeholder;
|
|
21
|
+
const controlId = id ?? contextId;
|
|
20
22
|
const swatchChildren = slots?.swatch?.children ?? (isResetValue ? resetIcon : void 0);
|
|
21
23
|
return /* @__PURE__ */ jsx(ColorPickerTrigger, {
|
|
22
24
|
asChild: true,
|
|
@@ -32,6 +34,7 @@ const ColorPickerInput$1 = (props) => {
|
|
|
32
34
|
})
|
|
33
35
|
}),
|
|
34
36
|
/* @__PURE__ */ jsx(InputGroupInput, {
|
|
37
|
+
id: controlId,
|
|
35
38
|
value: inputValue,
|
|
36
39
|
...rest,
|
|
37
40
|
title,
|
|
@@ -54,6 +57,7 @@ const ColorPickerInput$1 = (props) => {
|
|
|
54
57
|
showClearButton ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
55
58
|
align: "inline-end",
|
|
56
59
|
children: /* @__PURE__ */ jsx(Button, {
|
|
60
|
+
id: getId(controlId, "clear-button"),
|
|
57
61
|
type: "button",
|
|
58
62
|
variant: "ghost",
|
|
59
63
|
size: "icon",
|
|
@@ -15,7 +15,7 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
15
15
|
//#region src/ColorPickerBase/ColorPickerRoot.tsx
|
|
16
16
|
const DEFAULT_COLOR = "#000000";
|
|
17
17
|
const ColorPickerRoot = (props) => {
|
|
18
|
-
const { value: propValue, onChange, onValueChange, format, defaultFormat = "hex", onFormatChange, children,...rest } = props;
|
|
18
|
+
const { value: propValue, onChange, onValueChange, format, defaultFormat = "hex", onFormatChange, children, id,...rest } = props;
|
|
19
19
|
const { currentValue, handleValueChange } = require_use_color_picker_base_value.useColorPickerBaseValue({
|
|
20
20
|
value: propValue,
|
|
21
21
|
defaultValue: DEFAULT_COLOR,
|
|
@@ -32,6 +32,7 @@ const ColorPickerRoot = (props) => {
|
|
|
32
32
|
const [open, setOpen] = (0, react.useState)(false);
|
|
33
33
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_color_picker_context.Provider, {
|
|
34
34
|
value: {
|
|
35
|
+
id,
|
|
35
36
|
isPickerOpen: open,
|
|
36
37
|
value: currentValue,
|
|
37
38
|
onValueChange: handleValueChange,
|
|
@@ -11,7 +11,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
11
11
|
//#region src/ColorPickerBase/ColorPickerRoot.tsx
|
|
12
12
|
const DEFAULT_COLOR = "#000000";
|
|
13
13
|
const ColorPickerRoot = (props) => {
|
|
14
|
-
const { value: propValue, onChange, onValueChange, format, defaultFormat = "hex", onFormatChange, children,...rest } = props;
|
|
14
|
+
const { value: propValue, onChange, onValueChange, format, defaultFormat = "hex", onFormatChange, children, id,...rest } = props;
|
|
15
15
|
const { currentValue, handleValueChange } = useColorPickerBaseValue({
|
|
16
16
|
value: propValue,
|
|
17
17
|
defaultValue: DEFAULT_COLOR,
|
|
@@ -28,6 +28,7 @@ const ColorPickerRoot = (props) => {
|
|
|
28
28
|
const [open, setOpen] = useState(false);
|
|
29
29
|
return /* @__PURE__ */ jsx(Provider, {
|
|
30
30
|
value: {
|
|
31
|
+
id,
|
|
31
32
|
isPickerOpen: open,
|
|
32
33
|
value: currentValue,
|
|
33
34
|
onValueChange: handleValueChange,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_get_id = require('../../utils/get-id.cjs');
|
|
2
3
|
const require_color_picker_context = require('../color-picker-context.cjs');
|
|
3
4
|
const require_PaletteButton = require('./PaletteButton.cjs');
|
|
4
5
|
const require_PaletteSwatch = require('./PaletteSwatch.cjs');
|
|
@@ -79,19 +80,24 @@ const COMMON_COLORS = [
|
|
|
79
80
|
}
|
|
80
81
|
];
|
|
81
82
|
const ColorPickerColorPalette = (props) => {
|
|
82
|
-
const { presetColors = COMMON_COLORS, enableEyeDropper, onMoreColor,...rest } = props;
|
|
83
|
+
const { presetColors = COMMON_COLORS, enableEyeDropper, onMoreColor, id,...rest } = props;
|
|
83
84
|
const { value: selectedColor, onValueChange } = require_color_picker_context.useColorPickerContext();
|
|
84
85
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
85
86
|
...rest,
|
|
86
87
|
className: (0, __pixpilot_shadcn.cn)("gap-2 flex flex-wrap", rest.className),
|
|
87
88
|
children: [
|
|
88
|
-
enableEyeDropper && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerEyeDropper, {
|
|
89
|
+
enableEyeDropper && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.ColorPickerEyeDropper, {
|
|
90
|
+
id: require_get_id.getId(id, "eye-dropper-button"),
|
|
91
|
+
className: require_PaletteButton.COLOR_PICKER_PALETTE_BUTTON_CLASSES
|
|
92
|
+
}),
|
|
89
93
|
presetColors.map((color) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaletteSwatch.ColorPickerPaletteSwatch, {
|
|
94
|
+
id: require_get_id.getId(id, `option-${color.value}`),
|
|
90
95
|
color,
|
|
91
96
|
onSelect: onValueChange,
|
|
92
97
|
selectedValue: selectedColor
|
|
93
98
|
}, color.value)),
|
|
94
99
|
onMoreColor && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaletteButton.ColorPickerPaletteButton, {
|
|
100
|
+
id: require_get_id.getId(id, "more-colors-button"),
|
|
95
101
|
onClick: onMoreColor,
|
|
96
102
|
"aria-label": "Toggle full color picker",
|
|
97
103
|
className: "flex items-center justify-center border-input bg-input hover:bg-accent hover:text-accent-foreground",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getId } from "../../utils/get-id.js";
|
|
1
2
|
import { useColorPickerContext } from "../color-picker-context.js";
|
|
2
3
|
import { COLOR_PICKER_PALETTE_BUTTON_CLASSES, ColorPickerPaletteButton } from "./PaletteButton.js";
|
|
3
4
|
import { ColorPickerPaletteSwatch } from "./PaletteSwatch.js";
|
|
@@ -74,19 +75,24 @@ const COMMON_COLORS = [
|
|
|
74
75
|
}
|
|
75
76
|
];
|
|
76
77
|
const ColorPickerColorPalette = (props) => {
|
|
77
|
-
const { presetColors = COMMON_COLORS, enableEyeDropper, onMoreColor,...rest } = props;
|
|
78
|
+
const { presetColors = COMMON_COLORS, enableEyeDropper, onMoreColor, id,...rest } = props;
|
|
78
79
|
const { value: selectedColor, onValueChange } = useColorPickerContext();
|
|
79
80
|
return /* @__PURE__ */ jsxs("div", {
|
|
80
81
|
...rest,
|
|
81
82
|
className: cn("gap-2 flex flex-wrap", rest.className),
|
|
82
83
|
children: [
|
|
83
|
-
enableEyeDropper && /* @__PURE__ */ jsx(ColorPickerEyeDropper, {
|
|
84
|
+
enableEyeDropper && /* @__PURE__ */ jsx(ColorPickerEyeDropper, {
|
|
85
|
+
id: getId(id, "eye-dropper-button"),
|
|
86
|
+
className: COLOR_PICKER_PALETTE_BUTTON_CLASSES
|
|
87
|
+
}),
|
|
84
88
|
presetColors.map((color) => /* @__PURE__ */ jsx(ColorPickerPaletteSwatch, {
|
|
89
|
+
id: getId(id, `option-${color.value}`),
|
|
85
90
|
color,
|
|
86
91
|
onSelect: onValueChange,
|
|
87
92
|
selectedValue: selectedColor
|
|
88
93
|
}, color.value)),
|
|
89
94
|
onMoreColor && /* @__PURE__ */ jsx(ColorPickerPaletteButton, {
|
|
95
|
+
id: getId(id, "more-colors-button"),
|
|
90
96
|
onClick: onMoreColor,
|
|
91
97
|
"aria-label": "Toggle full color picker",
|
|
92
98
|
className: "flex items-center justify-center border-input bg-input hover:bg-accent hover:text-accent-foreground",
|
|
@@ -8,7 +8,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
8
8
|
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
9
9
|
|
|
10
10
|
//#region src/ColorPickerBase/color-palette/PaletteSwatch.tsx
|
|
11
|
-
const ColorPickerPaletteSwatch = ({ color, onSelect, className, selectedValue }) => {
|
|
11
|
+
const ColorPickerPaletteSwatch = ({ id, color, onSelect, className, selectedValue }) => {
|
|
12
12
|
const colorValue = color?.value ?? "rgb(0,0,0,0)";
|
|
13
13
|
const colorLabel = color?.label;
|
|
14
14
|
const normalizeColor = (0, react.useCallback)((value) => {
|
|
@@ -27,6 +27,7 @@ const ColorPickerPaletteSwatch = ({ color, onSelect, className, selectedValue })
|
|
|
27
27
|
if (onSelect) onSelect(colorValue);
|
|
28
28
|
}, [colorValue, onSelect]);
|
|
29
29
|
const button = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PaletteButton.ColorPickerPaletteButton, {
|
|
30
|
+
id,
|
|
30
31
|
style: {
|
|
31
32
|
backgroundImage: `linear-gradient(${colorValue}, ${colorValue}), repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%)`,
|
|
32
33
|
backgroundSize: "auto, 8px 8px"
|
|
@@ -4,7 +4,7 @@ import { useCallback } from "react";
|
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/ColorPickerBase/color-palette/PaletteSwatch.tsx
|
|
7
|
-
const ColorPickerPaletteSwatch = ({ color, onSelect, className, selectedValue }) => {
|
|
7
|
+
const ColorPickerPaletteSwatch = ({ id, color, onSelect, className, selectedValue }) => {
|
|
8
8
|
const colorValue = color?.value ?? "rgb(0,0,0,0)";
|
|
9
9
|
const colorLabel = color?.label;
|
|
10
10
|
const normalizeColor = useCallback((value) => {
|
|
@@ -23,6 +23,7 @@ const ColorPickerPaletteSwatch = ({ color, onSelect, className, selectedValue })
|
|
|
23
23
|
if (onSelect) onSelect(colorValue);
|
|
24
24
|
}, [colorValue, onSelect]);
|
|
25
25
|
const button = /* @__PURE__ */ jsx(ColorPickerPaletteButton, {
|
|
26
|
+
id,
|
|
26
27
|
style: {
|
|
27
28
|
backgroundImage: `linear-gradient(${colorValue}, ${colorValue}), repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%)`,
|
|
28
29
|
backgroundSize: "auto, 8px 8px"
|
|
@@ -12,6 +12,7 @@ interface ColorPickerContentWrapperProps extends React.ComponentProps<typeof Col
|
|
|
12
12
|
width?: number | string;
|
|
13
13
|
}
|
|
14
14
|
type ColorPickerContentProps = Required<Pick<ColorPickerBaseProps, 'onValueChange' | 'presetColors' | 'sections'>> & {
|
|
15
|
+
id?: string;
|
|
15
16
|
currentValue: string;
|
|
16
17
|
contentProps?: Partial<ColorPickerContentWrapperProps>;
|
|
17
18
|
};
|
|
@@ -34,6 +35,7 @@ interface ColorPickerBaseProps extends Omit<ColorPickerProps, 'onChange' | 'chil
|
|
|
34
35
|
value?: string;
|
|
35
36
|
onValueChange: (value: string) => void;
|
|
36
37
|
isPickerOpen: boolean;
|
|
38
|
+
id?: string;
|
|
37
39
|
}) => React.ReactNode);
|
|
38
40
|
}
|
|
39
41
|
interface ColorPickerResetOptions {
|
|
@@ -12,6 +12,7 @@ interface ColorPickerContentWrapperProps extends React.ComponentProps<typeof Col
|
|
|
12
12
|
width?: number | string;
|
|
13
13
|
}
|
|
14
14
|
type ColorPickerContentProps = Required<Pick<ColorPickerBaseProps, 'onValueChange' | 'presetColors' | 'sections'>> & {
|
|
15
|
+
id?: string;
|
|
15
16
|
currentValue: string;
|
|
16
17
|
contentProps?: Partial<ColorPickerContentWrapperProps>;
|
|
17
18
|
};
|
|
@@ -34,6 +35,7 @@ interface ColorPickerBaseProps extends Omit<ColorPickerProps, 'onChange' | 'chil
|
|
|
34
35
|
value?: string;
|
|
35
36
|
onValueChange: (value: string) => void;
|
|
36
37
|
isPickerOpen: boolean;
|
|
38
|
+
id?: string;
|
|
37
39
|
}) => React.ReactNode);
|
|
38
40
|
}
|
|
39
41
|
interface ColorPickerResetOptions {
|
package/dist/ColorSelect.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_get_id = require('./utils/get-id.cjs');
|
|
2
3
|
const require_use_select_keyboard = require('./hooks/use-select-keyboard.cjs');
|
|
3
4
|
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
4
5
|
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
@@ -9,7 +10,7 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
9
10
|
|
|
10
11
|
//#region src/ColorSelect.tsx
|
|
11
12
|
function ColorSelect(props) {
|
|
12
|
-
const { options, value = "", onChange, placeholder, contentProps, keyboardMode = "dropdown", open: openProp, onOpenChange: onOpenChangeProp,...restProps } = props;
|
|
13
|
+
const { options, value = "", onChange, placeholder, contentProps, keyboardMode = "dropdown", open: openProp, onOpenChange: onOpenChangeProp, id,...restProps } = props;
|
|
13
14
|
const [uncontrolledOpen, setUncontrolledOpen] = react.default.useState(false);
|
|
14
15
|
const open = openProp ?? uncontrolledOpen;
|
|
15
16
|
const handleOpenChange = (nextOpen) => {
|
|
@@ -32,6 +33,7 @@ function ColorSelect(props) {
|
|
|
32
33
|
onOpenChange: handleOpenChange,
|
|
33
34
|
...restProps,
|
|
34
35
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectTrigger, {
|
|
36
|
+
id,
|
|
35
37
|
className: "w-full",
|
|
36
38
|
onKeyDown: handleTriggerKeyDown,
|
|
37
39
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectValue, {
|
|
@@ -47,6 +49,7 @@ function ColorSelect(props) {
|
|
|
47
49
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectContent, {
|
|
48
50
|
...contentProps,
|
|
49
51
|
children: options?.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectItem, {
|
|
52
|
+
id: require_get_id.getId(id, `option-${option.value}`),
|
|
50
53
|
value: option.value,
|
|
51
54
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
52
55
|
className: "flex items-center gap-2",
|
package/dist/ColorSelect.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
2
2
|
import { Select, SelectContent } from "@pixpilot/shadcn";
|
|
3
3
|
import React, { ComponentProps } from "react";
|
|
4
4
|
|
|
@@ -8,6 +8,7 @@ interface ColorSelectOption {
|
|
|
8
8
|
value: string;
|
|
9
9
|
}
|
|
10
10
|
type BaseColorSelectProps = {
|
|
11
|
+
id?: string;
|
|
11
12
|
options?: ColorSelectOption[];
|
|
12
13
|
contentProps?: React.ComponentProps<typeof SelectContent>;
|
|
13
14
|
value?: string;
|
|
@@ -15,6 +16,6 @@ type BaseColorSelectProps = {
|
|
|
15
16
|
placeholder?: string;
|
|
16
17
|
keyboardMode?: 'cycle' | 'dropdown';
|
|
17
18
|
} & Omit<ComponentProps<typeof Select>, 'value' | 'onValueChange' | 'children'>;
|
|
18
|
-
declare function ColorSelect(props: BaseColorSelectProps):
|
|
19
|
+
declare function ColorSelect(props: BaseColorSelectProps): react_jsx_runtime2.JSX.Element;
|
|
19
20
|
//#endregion
|
|
20
21
|
export { BaseColorSelectProps, ColorSelect, ColorSelectOption };
|
package/dist/ColorSelect.d.ts
CHANGED
package/dist/ColorSelect.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getId } from "./utils/get-id.js";
|
|
1
2
|
import { useSelectKeyboard } from "./hooks/use-select-keyboard.js";
|
|
2
3
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@pixpilot/shadcn";
|
|
3
4
|
import React from "react";
|
|
@@ -5,7 +6,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
5
6
|
|
|
6
7
|
//#region src/ColorSelect.tsx
|
|
7
8
|
function ColorSelect(props) {
|
|
8
|
-
const { options, value = "", onChange, placeholder, contentProps, keyboardMode = "dropdown", open: openProp, onOpenChange: onOpenChangeProp,...restProps } = props;
|
|
9
|
+
const { options, value = "", onChange, placeholder, contentProps, keyboardMode = "dropdown", open: openProp, onOpenChange: onOpenChangeProp, id,...restProps } = props;
|
|
9
10
|
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false);
|
|
10
11
|
const open = openProp ?? uncontrolledOpen;
|
|
11
12
|
const handleOpenChange = (nextOpen) => {
|
|
@@ -28,6 +29,7 @@ function ColorSelect(props) {
|
|
|
28
29
|
onOpenChange: handleOpenChange,
|
|
29
30
|
...restProps,
|
|
30
31
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
32
|
+
id,
|
|
31
33
|
className: "w-full",
|
|
32
34
|
onKeyDown: handleTriggerKeyDown,
|
|
33
35
|
children: /* @__PURE__ */ jsx(SelectValue, {
|
|
@@ -43,6 +45,7 @@ function ColorSelect(props) {
|
|
|
43
45
|
}), /* @__PURE__ */ jsx(SelectContent, {
|
|
44
46
|
...contentProps,
|
|
45
47
|
children: options?.map((option) => /* @__PURE__ */ jsx(SelectItem, {
|
|
48
|
+
id: getId(id, `option-${option.value}`),
|
|
46
49
|
value: option.value,
|
|
47
50
|
children: /* @__PURE__ */ jsxs("div", {
|
|
48
51
|
className: "flex items-center gap-2",
|
package/dist/Combobox.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
5
|
+
const require_get_id = require('./utils/get-id.cjs');
|
|
5
6
|
const require_CommandOptionList = require('./CommandOptionList.cjs');
|
|
6
7
|
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
7
8
|
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
@@ -15,7 +16,7 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
15
16
|
//#region src/Combobox.tsx
|
|
16
17
|
const DEFAULT_OPTIONS = [];
|
|
17
18
|
const Combobox = (props) => {
|
|
18
|
-
const { value = "", onChange, options = DEFAULT_OPTIONS, placeholder = "Select option...", searchPlaceholder = "Search...", emptyText = "No option found.",...commandProps } = props;
|
|
19
|
+
const { value = "", onChange, options = DEFAULT_OPTIONS, placeholder = "Select option...", searchPlaceholder = "Search...", emptyText = "No option found.", id,...commandProps } = props;
|
|
19
20
|
const [open, setOpen] = (0, react.useState)(false);
|
|
20
21
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Popover, {
|
|
21
22
|
open,
|
|
@@ -23,6 +24,7 @@ const Combobox = (props) => {
|
|
|
23
24
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.PopoverTrigger, {
|
|
24
25
|
asChild: true,
|
|
25
26
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Button, {
|
|
27
|
+
id,
|
|
26
28
|
variant: "outline",
|
|
27
29
|
role: "combobox",
|
|
28
30
|
"aria-expanded": open,
|
|
@@ -34,7 +36,11 @@ const Combobox = (props) => {
|
|
|
34
36
|
style: { width: "var(--radix-popover-trigger-width)" },
|
|
35
37
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Command, {
|
|
36
38
|
...commandProps,
|
|
37
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.CommandInput, {
|
|
39
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.CommandInput, {
|
|
40
|
+
id: require_get_id.getId(id, "search-input"),
|
|
41
|
+
placeholder: searchPlaceholder
|
|
42
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CommandOptionList.CommandOptionList, {
|
|
43
|
+
id,
|
|
38
44
|
options,
|
|
39
45
|
value,
|
|
40
46
|
onChange: (val) => {
|
package/dist/Combobox.d.cts
CHANGED
package/dist/Combobox.d.ts
CHANGED
package/dist/Combobox.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
import { getId } from "./utils/get-id.js";
|
|
4
5
|
import { CommandOptionList } from "./CommandOptionList.js";
|
|
5
6
|
import { Button, Command, CommandInput, Popover, PopoverContent, PopoverTrigger } from "@pixpilot/shadcn";
|
|
6
7
|
import { ChevronsUpDown } from "lucide-react";
|
|
@@ -10,7 +11,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
10
11
|
//#region src/Combobox.tsx
|
|
11
12
|
const DEFAULT_OPTIONS = [];
|
|
12
13
|
const Combobox = (props) => {
|
|
13
|
-
const { value = "", onChange, options = DEFAULT_OPTIONS, placeholder = "Select option...", searchPlaceholder = "Search...", emptyText = "No option found.",...commandProps } = props;
|
|
14
|
+
const { value = "", onChange, options = DEFAULT_OPTIONS, placeholder = "Select option...", searchPlaceholder = "Search...", emptyText = "No option found.", id,...commandProps } = props;
|
|
14
15
|
const [open, setOpen] = useState(false);
|
|
15
16
|
return /* @__PURE__ */ jsxs(Popover, {
|
|
16
17
|
open,
|
|
@@ -18,6 +19,7 @@ const Combobox = (props) => {
|
|
|
18
19
|
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
19
20
|
asChild: true,
|
|
20
21
|
children: /* @__PURE__ */ jsxs(Button, {
|
|
22
|
+
id,
|
|
21
23
|
variant: "outline",
|
|
22
24
|
role: "combobox",
|
|
23
25
|
"aria-expanded": open,
|
|
@@ -29,7 +31,11 @@ const Combobox = (props) => {
|
|
|
29
31
|
style: { width: "var(--radix-popover-trigger-width)" },
|
|
30
32
|
children: /* @__PURE__ */ jsxs(Command, {
|
|
31
33
|
...commandProps,
|
|
32
|
-
children: [/* @__PURE__ */ jsx(CommandInput, {
|
|
34
|
+
children: [/* @__PURE__ */ jsx(CommandInput, {
|
|
35
|
+
id: getId(id, "search-input"),
|
|
36
|
+
placeholder: searchPlaceholder
|
|
37
|
+
}), /* @__PURE__ */ jsx(CommandOptionList, {
|
|
38
|
+
id,
|
|
33
39
|
options,
|
|
34
40
|
value,
|
|
35
41
|
onChange: (val) => {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
5
|
+
const require_get_id = require('./utils/get-id.cjs');
|
|
5
6
|
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
6
7
|
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
7
8
|
let lucide_react = require("lucide-react");
|
|
@@ -11,8 +12,9 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
11
12
|
|
|
12
13
|
//#region src/CommandOptionList.tsx
|
|
13
14
|
const CommandOptionList = (props) => {
|
|
14
|
-
const { options, value, onChange, emptyText = "No option found." } = props;
|
|
15
|
+
const { id, options, value, onChange, emptyText = "No option found." } = props;
|
|
15
16
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.CommandList, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.CommandEmpty, { children: emptyText }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.CommandGroup, { children: options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.CommandItem, {
|
|
17
|
+
id: require_get_id.getId(id, `option-${option.value}`),
|
|
16
18
|
value: option.value,
|
|
17
19
|
onSelect: (currentValue) => {
|
|
18
20
|
onChange?.(currentValue === value ? "" : currentValue);
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
import { getId } from "./utils/get-id.js";
|
|
4
5
|
import { CommandEmpty, CommandGroup, CommandItem, CommandList, cn } from "@pixpilot/shadcn";
|
|
5
6
|
import { Check } from "lucide-react";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
|
|
8
9
|
//#region src/CommandOptionList.tsx
|
|
9
10
|
const CommandOptionList = (props) => {
|
|
10
|
-
const { options, value, onChange, emptyText = "No option found." } = props;
|
|
11
|
+
const { id, options, value, onChange, emptyText = "No option found." } = props;
|
|
11
12
|
return /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: emptyText }), /* @__PURE__ */ jsx(CommandGroup, { children: options.map((option) => /* @__PURE__ */ jsx(CommandItem, {
|
|
13
|
+
id: getId(id, `option-${option.value}`),
|
|
12
14
|
value: option.value,
|
|
13
15
|
onSelect: (currentValue) => {
|
|
14
16
|
onChange?.(currentValue === value ? "" : currentValue);
|
package/dist/ContentCard.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
2
2
|
import { Card } from "@pixpilot/shadcn";
|
|
3
3
|
import React, { ReactNode } from "react";
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ interface SectionCardProps extends React.ComponentProps<typeof Card> {
|
|
|
8
8
|
children: ReactNode;
|
|
9
9
|
marginBottom?: boolean;
|
|
10
10
|
}
|
|
11
|
-
declare function ContentCard(props: SectionCardProps):
|
|
11
|
+
declare function ContentCard(props: SectionCardProps): react_jsx_runtime3.JSX.Element;
|
|
12
12
|
declare namespace ContentCard {
|
|
13
13
|
var displayName: string;
|
|
14
14
|
}
|
package/dist/ContentCard.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Card } from "@pixpilot/shadcn";
|
|
2
2
|
import React, { ReactNode } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/ContentCard.d.ts
|
|
6
6
|
interface SectionCardProps extends React.ComponentProps<typeof Card> {
|
|
@@ -8,7 +8,7 @@ interface SectionCardProps extends React.ComponentProps<typeof Card> {
|
|
|
8
8
|
children: ReactNode;
|
|
9
9
|
marginBottom?: boolean;
|
|
10
10
|
}
|
|
11
|
-
declare function ContentCard(props: SectionCardProps):
|
|
11
|
+
declare function ContentCard(props: SectionCardProps): react_jsx_runtime3.JSX.Element;
|
|
12
12
|
declare namespace ContentCard {
|
|
13
13
|
var displayName: string;
|
|
14
14
|
}
|
package/dist/DatePicker.cjs
CHANGED
|
@@ -13,10 +13,11 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
13
13
|
|
|
14
14
|
//#region src/DatePicker.tsx
|
|
15
15
|
function DatePicker(props) {
|
|
16
|
-
const { value, onChange, placeholder = "Pick a date",...calendarProps } = props;
|
|
16
|
+
const { id, value, onChange, placeholder = "Pick a date",...calendarProps } = props;
|
|
17
17
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Popover, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.PopoverTrigger, {
|
|
18
18
|
asChild: true,
|
|
19
19
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Button, {
|
|
20
|
+
id,
|
|
20
21
|
variant: "outline",
|
|
21
22
|
className: (0, __pixpilot_shadcn.cn)("w-full justify-start text-left font-normal", !value && "text-muted-foreground"),
|
|
22
23
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CalendarIcon, { className: "mr-2 h-4 w-4" }), value ? value.toLocaleDateString() : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: placeholder })]
|
package/dist/DatePicker.d.cts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
2
2
|
import { Calendar } from "@pixpilot/shadcn";
|
|
3
3
|
import { ComponentProps } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/DatePicker.d.ts
|
|
6
6
|
type DatePickerProps = {
|
|
7
|
+
id?: string;
|
|
7
8
|
value?: Date;
|
|
8
9
|
onChange?: (date: Date | undefined) => void;
|
|
9
10
|
placeholder?: string;
|
|
10
11
|
} & Omit<ComponentProps<typeof Calendar>, 'selected' | 'onSelect' | 'mode'>;
|
|
11
|
-
declare function DatePicker(props: DatePickerProps):
|
|
12
|
+
declare function DatePicker(props: DatePickerProps): react_jsx_runtime4.JSX.Element;
|
|
12
13
|
declare namespace DatePicker {
|
|
13
14
|
var displayName: string;
|
|
14
15
|
}
|
package/dist/DatePicker.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Calendar } from "@pixpilot/shadcn";
|
|
2
2
|
import { ComponentProps } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/DatePicker.d.ts
|
|
6
6
|
type DatePickerProps = {
|
|
7
|
+
id?: string;
|
|
7
8
|
value?: Date;
|
|
8
9
|
onChange?: (date: Date | undefined) => void;
|
|
9
10
|
placeholder?: string;
|
|
10
11
|
} & Omit<ComponentProps<typeof Calendar>, 'selected' | 'onSelect' | 'mode'>;
|
|
11
|
-
declare function DatePicker(props: DatePickerProps):
|
|
12
|
+
declare function DatePicker(props: DatePickerProps): react_jsx_runtime4.JSX.Element;
|
|
12
13
|
declare namespace DatePicker {
|
|
13
14
|
var displayName: string;
|
|
14
15
|
}
|
package/dist/DatePicker.js
CHANGED
|
@@ -8,10 +8,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
|
|
9
9
|
//#region src/DatePicker.tsx
|
|
10
10
|
function DatePicker(props) {
|
|
11
|
-
const { value, onChange, placeholder = "Pick a date",...calendarProps } = props;
|
|
11
|
+
const { id, value, onChange, placeholder = "Pick a date",...calendarProps } = props;
|
|
12
12
|
return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
13
13
|
asChild: true,
|
|
14
14
|
children: /* @__PURE__ */ jsxs(Button, {
|
|
15
|
+
id,
|
|
15
16
|
variant: "outline",
|
|
16
17
|
className: cn("w-full justify-start text-left font-normal", !value && "text-muted-foreground"),
|
|
17
18
|
children: [/* @__PURE__ */ jsx(CalendarIcon, { className: "mr-2 h-4 w-4" }), value ? value.toLocaleDateString() : /* @__PURE__ */ jsx("span", { children: placeholder })]
|
package/dist/IconToggle.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_ToggleButton = require('./ToggleButton.cjs');
|
|
3
2
|
const require_svg = require('./utils/svg.cjs');
|
|
3
|
+
const require_ToggleButton = require('./ToggleButton.cjs');
|
|
4
4
|
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
5
5
|
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
6
6
|
let react = require("react");
|
package/dist/IconToggle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ToggleButton } from "./ToggleButton.js";
|
|
2
1
|
import { isSvgMarkupString, svgMarkupToMaskUrl } from "./utils/svg.js";
|
|
2
|
+
import { ToggleButton } from "./ToggleButton.js";
|
|
3
3
|
import { cn } from "@pixpilot/shadcn";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
package/dist/Rating.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_get_id = require('./utils/get-id.cjs');
|
|
2
3
|
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
3
4
|
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
4
5
|
let lucide_react = require("lucide-react");
|
|
@@ -124,7 +125,7 @@ function RatingButton({ index, className,...props }) {
|
|
|
124
125
|
}) : null]
|
|
125
126
|
});
|
|
126
127
|
}
|
|
127
|
-
function Rating({ value: valueProp, defaultValue, onValueChange, options: optionsProp, max: maxProp = DEFAULT_MAX_RATING, iconType = "star", size = "default", readOnly = false, disabled = false, name, required, color = "default", className, children,...props }) {
|
|
128
|
+
function Rating({ value: valueProp, defaultValue, onValueChange, options: optionsProp, max: maxProp = DEFAULT_MAX_RATING, iconType = "star", size = "default", readOnly = false, disabled = false, name, required, color = "default", className, children, id,...props }) {
|
|
128
129
|
const isControlled = valueProp !== void 0;
|
|
129
130
|
const [internalValue, setInternalValue] = react.useState(defaultValue ?? 0);
|
|
130
131
|
const [hoverIndex, setHoverIndex] = react.useState(0);
|
|
@@ -185,12 +186,16 @@ function Rating({ value: valueProp, defaultValue, onValueChange, options: option
|
|
|
185
186
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RatingContext, {
|
|
186
187
|
value: contextValue,
|
|
187
188
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
189
|
+
id: require_get_id.getId(id, "rating-group"),
|
|
188
190
|
role: "radiogroup",
|
|
189
191
|
tabIndex: 0,
|
|
190
192
|
className: (0, __pixpilot_shadcn.cn)(ratingVariants({ size }), className),
|
|
191
193
|
onMouseLeave: handleMouseLeave,
|
|
192
194
|
...props,
|
|
193
|
-
children: [children ?? Array.from({ length: max }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RatingButton, {
|
|
195
|
+
children: [children ?? Array.from({ length: max }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RatingButton, {
|
|
196
|
+
id: index === 0 ? id : require_get_id.getId(id, `option-${index + 1}`),
|
|
197
|
+
index: index + 1
|
|
198
|
+
}, index)), hasNameText ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
194
199
|
type: "hidden",
|
|
195
200
|
name: nameTextOrEmpty,
|
|
196
201
|
value: value || "",
|