@pixpilot/shadcn-ui 1.22.0 → 1.24.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 +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 +1 -0
- 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/DatePicker.cjs +2 -1
- package/dist/DatePicker.d.cts +1 -0
- package/dist/DatePicker.d.ts +1 -0
- 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 +1 -0
- package/dist/Rating.d.ts +1 -0
- package/dist/Rating.js +7 -2
- package/dist/Select.cjs +5 -1
- package/dist/Select.js +5 -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.ts +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-inline/FileUploadInline.d.ts +2 -2
- package/dist/file-upload-root/FileUploadRoot.cjs +3 -1
- 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/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 +2 -0
- package/dist/tags-input/TagsInput.d.ts +4 -2
- 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
|
@@ -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
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/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
package/dist/DatePicker.d.ts
CHANGED
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 || "",
|
package/dist/Rating.d.cts
CHANGED
package/dist/Rating.d.ts
CHANGED
package/dist/Rating.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getId } from "./utils/get-id.js";
|
|
1
2
|
import { cn } from "@pixpilot/shadcn";
|
|
2
3
|
import { Circle, Star } from "lucide-react";
|
|
3
4
|
import * as React$1 from "react";
|
|
@@ -118,7 +119,7 @@ function RatingButton({ index, className,...props }) {
|
|
|
118
119
|
}) : null]
|
|
119
120
|
});
|
|
120
121
|
}
|
|
121
|
-
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 }) {
|
|
122
|
+
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 }) {
|
|
122
123
|
const isControlled = valueProp !== void 0;
|
|
123
124
|
const [internalValue, setInternalValue] = React$1.useState(defaultValue ?? 0);
|
|
124
125
|
const [hoverIndex, setHoverIndex] = React$1.useState(0);
|
|
@@ -179,12 +180,16 @@ function Rating({ value: valueProp, defaultValue, onValueChange, options: option
|
|
|
179
180
|
return /* @__PURE__ */ jsx(RatingContext, {
|
|
180
181
|
value: contextValue,
|
|
181
182
|
children: /* @__PURE__ */ jsxs("div", {
|
|
183
|
+
id: getId(id, "rating-group"),
|
|
182
184
|
role: "radiogroup",
|
|
183
185
|
tabIndex: 0,
|
|
184
186
|
className: cn(ratingVariants({ size }), className),
|
|
185
187
|
onMouseLeave: handleMouseLeave,
|
|
186
188
|
...props,
|
|
187
|
-
children: [children ?? Array.from({ length: max }, (_, index) => /* @__PURE__ */ jsx(RatingButton, {
|
|
189
|
+
children: [children ?? Array.from({ length: max }, (_, index) => /* @__PURE__ */ jsx(RatingButton, {
|
|
190
|
+
id: index === 0 ? id : getId(id, `option-${index + 1}`),
|
|
191
|
+
index: index + 1
|
|
192
|
+
}, index)), hasNameText ? /* @__PURE__ */ jsx("input", {
|
|
188
193
|
type: "hidden",
|
|
189
194
|
name: nameTextOrEmpty,
|
|
190
195
|
value: value || "",
|
package/dist/Select.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);
|
|
@@ -11,7 +12,7 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
11
12
|
|
|
12
13
|
//#region src/Select.tsx
|
|
13
14
|
function Select(props) {
|
|
14
|
-
const { options, value = "", onChange, placeholder, contentProps, keyboardMode = "dropdown", open: openProp, onOpenChange: onOpenChangeProp, position, clearable = false, disabled, className,...restProps } = props;
|
|
15
|
+
const { options, value = "", onChange, placeholder, contentProps, keyboardMode = "dropdown", open: openProp, onOpenChange: onOpenChangeProp, position, clearable = false, disabled, className, id,...restProps } = props;
|
|
15
16
|
const [uncontrolledOpen, setUncontrolledOpen] = react.default.useState(false);
|
|
16
17
|
const open = openProp ?? uncontrolledOpen;
|
|
17
18
|
const handleOpenChange = (nextOpen) => {
|
|
@@ -35,11 +36,13 @@ function Select(props) {
|
|
|
35
36
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
36
37
|
className: "relative w-full",
|
|
37
38
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectTrigger, {
|
|
39
|
+
id,
|
|
38
40
|
className: (0, __pixpilot_shadcn.cn)("w-full", className),
|
|
39
41
|
onKeyDown: handleTriggerKeyDown,
|
|
40
42
|
disabled,
|
|
41
43
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectValue, { placeholder })
|
|
42
44
|
}), clearable && value !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
45
|
+
id: require_get_id.getId(id, "clear-button"),
|
|
43
46
|
type: "button",
|
|
44
47
|
className: "absolute right-8 top-1/2 -translate-y-1/2 flex h-6 w-6 items-center justify-center rounded-sm opacity-40 hover:opacity-100 z-10",
|
|
45
48
|
onClick: (e) => {
|
|
@@ -54,6 +57,7 @@ function Select(props) {
|
|
|
54
57
|
position,
|
|
55
58
|
...contentProps,
|
|
56
59
|
children: options?.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectItem, {
|
|
60
|
+
id: require_get_id.getId(id, `option-${option.value}`),
|
|
57
61
|
value: String(option.value),
|
|
58
62
|
children: option.label
|
|
59
63
|
}, option.value))
|
package/dist/Select.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, cn } from "@pixpilot/shadcn";
|
|
3
4
|
import { XIcon } from "lucide-react";
|
|
@@ -6,7 +7,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
7
|
|
|
7
8
|
//#region src/Select.tsx
|
|
8
9
|
function Select$1(props) {
|
|
9
|
-
const { options, value = "", onChange, placeholder, contentProps, keyboardMode = "dropdown", open: openProp, onOpenChange: onOpenChangeProp, position, clearable = false, disabled, className,...restProps } = props;
|
|
10
|
+
const { options, value = "", onChange, placeholder, contentProps, keyboardMode = "dropdown", open: openProp, onOpenChange: onOpenChangeProp, position, clearable = false, disabled, className, id,...restProps } = props;
|
|
10
11
|
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false);
|
|
11
12
|
const open = openProp ?? uncontrolledOpen;
|
|
12
13
|
const handleOpenChange = (nextOpen) => {
|
|
@@ -30,11 +31,13 @@ function Select$1(props) {
|
|
|
30
31
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
31
32
|
className: "relative w-full",
|
|
32
33
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
34
|
+
id,
|
|
33
35
|
className: cn("w-full", className),
|
|
34
36
|
onKeyDown: handleTriggerKeyDown,
|
|
35
37
|
disabled,
|
|
36
38
|
children: /* @__PURE__ */ jsx(SelectValue, { placeholder })
|
|
37
39
|
}), clearable && value !== "" && /* @__PURE__ */ jsx("button", {
|
|
40
|
+
id: getId(id, "clear-button"),
|
|
38
41
|
type: "button",
|
|
39
42
|
className: "absolute right-8 top-1/2 -translate-y-1/2 flex h-6 w-6 items-center justify-center rounded-sm opacity-40 hover:opacity-100 z-10",
|
|
40
43
|
onClick: (e) => {
|
|
@@ -49,6 +52,7 @@ function Select$1(props) {
|
|
|
49
52
|
position,
|
|
50
53
|
...contentProps,
|
|
51
54
|
children: options?.map((option) => /* @__PURE__ */ jsx(SelectItem, {
|
|
55
|
+
id: getId(id, `option-${option.value}`),
|
|
52
56
|
value: String(option.value),
|
|
53
57
|
children: option.label
|
|
54
58
|
}, option.value))
|
|
@@ -27,7 +27,7 @@ const sizeClasses = {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
const AvatarUpload = (props) => {
|
|
30
|
-
const { className, messages, value, onAccept, onFileSuccess, onFileError, onChange, size = "md", clearable = true,...rest } = props;
|
|
30
|
+
const { className, messages, value, onAccept, onFileSuccess, onFileError, onChange, size = "md", clearable = true, id,...rest } = props;
|
|
31
31
|
const { upload = "Upload", change = "Change" } = messages || {};
|
|
32
32
|
const hasValue = value != null && Object.keys(value).length > 0;
|
|
33
33
|
const currentSize = sizeClasses[size];
|
|
@@ -56,6 +56,7 @@ const AvatarUpload = (props) => {
|
|
|
56
56
|
accept: "image/*",
|
|
57
57
|
"data-slots": "avatar-upload",
|
|
58
58
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadDropzone, {
|
|
59
|
+
id,
|
|
59
60
|
className: require_utils.cn(error != null && "border-red-500", currentSize.dropZone),
|
|
60
61
|
children: selectedFile != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadList, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AvatarUploadItem.AvatarUploadItem, {
|
|
61
62
|
file: selectedFile.file,
|
|
@@ -65,10 +66,12 @@ const AvatarUpload = (props) => {
|
|
|
65
66
|
onError: setError,
|
|
66
67
|
onFileError,
|
|
67
68
|
onClear: showClearButton ? handleClear : void 0,
|
|
68
|
-
size
|
|
69
|
+
size,
|
|
70
|
+
id
|
|
69
71
|
}, selectedFile.id) }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_AvatarUploadComponents.MainWrapper, {
|
|
70
72
|
currentSize,
|
|
71
73
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AvatarUploadComponents.AvatarWrap, {
|
|
74
|
+
id,
|
|
72
75
|
showChangeIcon: hasValue,
|
|
73
76
|
onClear: showClearButton ? handleClear : void 0,
|
|
74
77
|
size,
|
|
@@ -22,7 +22,7 @@ const sizeClasses = {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
const AvatarUpload = (props) => {
|
|
25
|
-
const { className, messages, value, onAccept, onFileSuccess, onFileError, onChange, size = "md", clearable = true,...rest } = props;
|
|
25
|
+
const { className, messages, value, onAccept, onFileSuccess, onFileError, onChange, size = "md", clearable = true, id,...rest } = props;
|
|
26
26
|
const { upload = "Upload", change = "Change" } = messages || {};
|
|
27
27
|
const hasValue = value != null && Object.keys(value).length > 0;
|
|
28
28
|
const currentSize = sizeClasses[size];
|
|
@@ -51,6 +51,7 @@ const AvatarUpload = (props) => {
|
|
|
51
51
|
accept: "image/*",
|
|
52
52
|
"data-slots": "avatar-upload",
|
|
53
53
|
children: /* @__PURE__ */ jsx(FileUploadDropzone, {
|
|
54
|
+
id,
|
|
54
55
|
className: cn$1(error != null && "border-red-500", currentSize.dropZone),
|
|
55
56
|
children: selectedFile != null ? /* @__PURE__ */ jsx(FileUploadList, { children: /* @__PURE__ */ jsx(AvatarUploadItem, {
|
|
56
57
|
file: selectedFile.file,
|
|
@@ -60,10 +61,12 @@ const AvatarUpload = (props) => {
|
|
|
60
61
|
onError: setError,
|
|
61
62
|
onFileError,
|
|
62
63
|
onClear: showClearButton ? handleClear : void 0,
|
|
63
|
-
size
|
|
64
|
+
size,
|
|
65
|
+
id
|
|
64
66
|
}, selectedFile.id) }) : /* @__PURE__ */ jsxs(MainWrapper, {
|
|
65
67
|
currentSize,
|
|
66
68
|
children: [/* @__PURE__ */ jsx(AvatarWrap, {
|
|
69
|
+
id,
|
|
67
70
|
showChangeIcon: hasValue,
|
|
68
71
|
onClear: showClearButton ? handleClear : void 0,
|
|
69
72
|
size,
|
|
@@ -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_utils = require('../shadcn/src/lib/utils.cjs');
|
|
3
4
|
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
4
5
|
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
@@ -16,7 +17,7 @@ const MessageComponent = ({ message, className }) => {
|
|
|
16
17
|
children: message
|
|
17
18
|
});
|
|
18
19
|
};
|
|
19
|
-
const AvatarWrap = ({ children, className, showChangeIcon, size, onClear }) => {
|
|
20
|
+
const AvatarWrap = ({ id, children, className, showChangeIcon, size, onClear }) => {
|
|
20
21
|
const editIcon = {
|
|
21
22
|
sm: "size-5.5 bottom-0 right-0",
|
|
22
23
|
md: "size-6.5 bottom-1 right-1",
|
|
@@ -37,6 +38,7 @@ const AvatarWrap = ({ children, className, showChangeIcon, size, onClear }) => {
|
|
|
37
38
|
children,
|
|
38
39
|
showChangeIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Pencil, { className: require_utils.cn(editIcon[size], `absolute bg-secondary text-secondary-foreground rounded-full p-1.5 shadow-md`) }),
|
|
39
40
|
onClear != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
41
|
+
id: require_get_id.getId(id, "clear-button"),
|
|
40
42
|
type: "button",
|
|
41
43
|
variant: "secondary",
|
|
42
44
|
size: "icon",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getId } from "../utils/get-id.js";
|
|
1
2
|
import { cn as cn$1 } from "../shadcn/src/lib/utils.js";
|
|
2
3
|
import { Button } from "@pixpilot/shadcn";
|
|
3
4
|
import { Pencil, X } from "lucide-react";
|
|
@@ -11,7 +12,7 @@ const MessageComponent = ({ message, className }) => {
|
|
|
11
12
|
children: message
|
|
12
13
|
});
|
|
13
14
|
};
|
|
14
|
-
const AvatarWrap = ({ children, className, showChangeIcon, size, onClear }) => {
|
|
15
|
+
const AvatarWrap = ({ id, children, className, showChangeIcon, size, onClear }) => {
|
|
15
16
|
const editIcon = {
|
|
16
17
|
sm: "size-5.5 bottom-0 right-0",
|
|
17
18
|
md: "size-6.5 bottom-1 right-1",
|
|
@@ -32,6 +33,7 @@ const AvatarWrap = ({ children, className, showChangeIcon, size, onClear }) => {
|
|
|
32
33
|
children,
|
|
33
34
|
showChangeIcon && /* @__PURE__ */ jsx(Pencil, { className: cn$1(editIcon[size], `absolute bg-secondary text-secondary-foreground rounded-full p-1.5 shadow-md`) }),
|
|
34
35
|
onClear != null && /* @__PURE__ */ jsx(Button, {
|
|
36
|
+
id: getId(id, "clear-button"),
|
|
35
37
|
type: "button",
|
|
36
38
|
variant: "secondary",
|
|
37
39
|
size: "icon",
|
|
@@ -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_file_error = require('../file-upload/hooks/use-file-error.cjs');
|
|
3
4
|
const require_use_file_upload_progress_callbacks = require('../file-upload/hooks/use-file-upload-progress-callbacks.cjs');
|
|
4
5
|
require('../file-upload/index.cjs');
|
|
@@ -14,7 +15,7 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
14
15
|
|
|
15
16
|
//#region src/avatar-upload/AvatarUploadItem.tsx
|
|
16
17
|
const AvatarUploadItem = (props) => {
|
|
17
|
-
const { file, currentSize, change = "Change", onFileSuccess, onFileError, onClear, onError, size = "md" } = props;
|
|
18
|
+
const { file, currentSize, change = "Change", id, onFileSuccess, onFileError, onClear, onError, size = "md" } = props;
|
|
18
19
|
require_use_file_upload_progress_callbacks.useFileUploadProgressCallbacks(file, {
|
|
19
20
|
onFileSuccess,
|
|
20
21
|
onFileError
|
|
@@ -39,6 +40,7 @@ const AvatarUploadItem = (props) => {
|
|
|
39
40
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
40
41
|
className: (0, __pixpilot_shadcn.cn)("relative"),
|
|
41
42
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AvatarUploadComponents.AvatarWrap, {
|
|
43
|
+
id,
|
|
42
44
|
showChangeIcon: true,
|
|
43
45
|
onClear,
|
|
44
46
|
size,
|
|
@@ -46,6 +48,7 @@ const AvatarUploadItem = (props) => {
|
|
|
46
48
|
}), fileError != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.TooltipProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.TooltipTrigger, {
|
|
47
49
|
asChild: true,
|
|
48
50
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
51
|
+
id: require_get_id.getId(id, "error-button"),
|
|
49
52
|
type: "button",
|
|
50
53
|
className: "absolute -top-3 -left-3 p-1",
|
|
51
54
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.AlertCircle, { className: "h-5 w-5 text-red-500" })
|