@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getId } from "../utils/get-id.js";
|
|
1
2
|
import { useFileError } from "../file-upload/hooks/use-file-error.js";
|
|
2
3
|
import { useFileUploadProgressCallbacks } from "../file-upload/hooks/use-file-upload-progress-callbacks.js";
|
|
3
4
|
import "../file-upload/index.js";
|
|
@@ -9,7 +10,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
9
10
|
|
|
10
11
|
//#region src/avatar-upload/AvatarUploadItem.tsx
|
|
11
12
|
const AvatarUploadItem = (props) => {
|
|
12
|
-
const { file, currentSize, change = "Change", onFileSuccess, onFileError, onClear, onError, size = "md" } = props;
|
|
13
|
+
const { file, currentSize, change = "Change", id, onFileSuccess, onFileError, onClear, onError, size = "md" } = props;
|
|
13
14
|
useFileUploadProgressCallbacks(file, {
|
|
14
15
|
onFileSuccess,
|
|
15
16
|
onFileError
|
|
@@ -34,6 +35,7 @@ const AvatarUploadItem = (props) => {
|
|
|
34
35
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
35
36
|
className: cn("relative"),
|
|
36
37
|
children: [/* @__PURE__ */ jsx(AvatarWrap, {
|
|
38
|
+
id,
|
|
37
39
|
showChangeIcon: true,
|
|
38
40
|
onClear,
|
|
39
41
|
size,
|
|
@@ -41,6 +43,7 @@ const AvatarUploadItem = (props) => {
|
|
|
41
43
|
}), fileError != null && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
42
44
|
asChild: true,
|
|
43
45
|
children: /* @__PURE__ */ jsx("button", {
|
|
46
|
+
id: getId(id, "error-button"),
|
|
44
47
|
type: "button",
|
|
45
48
|
className: "absolute -top-3 -left-3 p-1",
|
|
46
49
|
children: /* @__PURE__ */ jsx(AlertCircle, { className: "h-5 w-5 text-red-500" })
|
|
@@ -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_variant_config = require('../variant-config.cjs');
|
|
3
4
|
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
4
5
|
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
@@ -15,7 +16,7 @@ const variantMap = {
|
|
|
15
16
|
default: "default"
|
|
16
17
|
};
|
|
17
18
|
const ConfirmationDialog = __ebay_nice_modal_react.default.create((props) => {
|
|
18
|
-
const { title = "Confirmation Dialog", variant, showIcon = true } = props;
|
|
19
|
+
const { id, title = "Confirmation Dialog", variant, showIcon = true } = props;
|
|
19
20
|
const modal = (0, __ebay_nice_modal_react.useModal)();
|
|
20
21
|
const handleConfirm = () => {
|
|
21
22
|
props.onConfirm?.();
|
|
@@ -54,11 +55,13 @@ const ConfirmationDialog = __ebay_nice_modal_react.default.create((props) => {
|
|
|
54
55
|
children: props.description
|
|
55
56
|
})]
|
|
56
57
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.DialogFooter, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
58
|
+
id: require_get_id.getId(id, "cancel-button"),
|
|
57
59
|
"data-slots": "button-cancel",
|
|
58
60
|
variant: "outline",
|
|
59
61
|
onClick: handleCancel,
|
|
60
62
|
children: props.cancelText ?? "Cancel"
|
|
61
63
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
64
|
+
id,
|
|
62
65
|
"data-slots": "button-confirm",
|
|
63
66
|
variant: confirmBtnVariant,
|
|
64
67
|
className: confirmBtnClassName,
|
|
@@ -3,6 +3,7 @@ import "react";
|
|
|
3
3
|
//#region src/confirmation-dialog/ConfirmationDialog.d.ts
|
|
4
4
|
type ConfirmationDialogVariant = 'destructive' | 'warning' | 'primary' | 'default';
|
|
5
5
|
interface ConfirmationDialogProps {
|
|
6
|
+
id?: string;
|
|
6
7
|
title: string;
|
|
7
8
|
description?: string | React.ReactNode;
|
|
8
9
|
confirmText?: string;
|
|
@@ -4,6 +4,7 @@ import "@ebay/nice-modal-react";
|
|
|
4
4
|
//#region src/confirmation-dialog/ConfirmationDialog.d.ts
|
|
5
5
|
type ConfirmationDialogVariant = 'destructive' | 'warning' | 'primary' | 'default';
|
|
6
6
|
interface ConfirmationDialogProps {
|
|
7
|
+
id?: string;
|
|
7
8
|
title: string;
|
|
8
9
|
description?: string | React.ReactNode;
|
|
9
10
|
confirmText?: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getId } from "../utils/get-id.js";
|
|
1
2
|
import { variantConfig } from "../variant-config.js";
|
|
2
3
|
import { Button, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, cn } from "@pixpilot/shadcn";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -11,7 +12,7 @@ const variantMap = {
|
|
|
11
12
|
default: "default"
|
|
12
13
|
};
|
|
13
14
|
const ConfirmationDialog = NiceModal.create((props) => {
|
|
14
|
-
const { title = "Confirmation Dialog", variant, showIcon = true } = props;
|
|
15
|
+
const { id, title = "Confirmation Dialog", variant, showIcon = true } = props;
|
|
15
16
|
const modal = useModal();
|
|
16
17
|
const handleConfirm = () => {
|
|
17
18
|
props.onConfirm?.();
|
|
@@ -50,11 +51,13 @@ const ConfirmationDialog = NiceModal.create((props) => {
|
|
|
50
51
|
children: props.description
|
|
51
52
|
})]
|
|
52
53
|
}), /* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
|
|
54
|
+
id: getId(id, "cancel-button"),
|
|
53
55
|
"data-slots": "button-cancel",
|
|
54
56
|
variant: "outline",
|
|
55
57
|
onClick: handleCancel,
|
|
56
58
|
children: props.cancelText ?? "Cancel"
|
|
57
59
|
}), /* @__PURE__ */ jsx(Button, {
|
|
60
|
+
id,
|
|
58
61
|
"data-slots": "button-confirm",
|
|
59
62
|
variant: confirmBtnVariant,
|
|
60
63
|
className: confirmBtnClassName,
|
package/dist/dialog/Dialog.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DialogContent } from "@pixpilot/shadcn";
|
|
2
2
|
import * as React$1 from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime10 from "react/jsx-runtime";
|
|
4
4
|
import * as _radix_ui_react_dialog0 from "@radix-ui/react-dialog";
|
|
5
5
|
|
|
6
6
|
//#region src/dialog/Dialog.d.ts
|
|
@@ -13,14 +13,14 @@ declare const DialogContent$1: React$1.ForwardRefExoticComponent<Omit<_radix_ui_
|
|
|
13
13
|
declare function DialogHeader$1({
|
|
14
14
|
className,
|
|
15
15
|
...props
|
|
16
|
-
}: React$1.HTMLAttributes<HTMLDivElement>):
|
|
16
|
+
}: React$1.HTMLAttributes<HTMLDivElement>): react_jsx_runtime10.JSX.Element;
|
|
17
17
|
declare function DialogBody({
|
|
18
18
|
className,
|
|
19
19
|
...props
|
|
20
|
-
}: React$1.HTMLAttributes<HTMLDivElement>):
|
|
20
|
+
}: React$1.HTMLAttributes<HTMLDivElement>): react_jsx_runtime10.JSX.Element;
|
|
21
21
|
declare function DialogFooter$1({
|
|
22
22
|
className,
|
|
23
23
|
...props
|
|
24
|
-
}: React$1.HTMLAttributes<HTMLDivElement>):
|
|
24
|
+
}: React$1.HTMLAttributes<HTMLDivElement>): react_jsx_runtime10.JSX.Element;
|
|
25
25
|
//#endregion
|
|
26
26
|
export { DialogBody, DialogContent$1 as DialogContent, DialogContentProps, DialogFooter$1 as DialogFooter, DialogHeader$1 as DialogHeader };
|
|
@@ -12,7 +12,7 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
12
12
|
|
|
13
13
|
//#region src/file-upload/FileUpload.tsx
|
|
14
14
|
function FileUpload(props) {
|
|
15
|
-
const { value, onChange, className, onAccept, maxFiles, preventDuplicates, onFileReject, onFileSuccess, onFileError,...rest } = props;
|
|
15
|
+
const { value, onChange, className, onAccept, maxFiles, preventDuplicates, onFileReject, onFileSuccess, onFileError, id,...rest } = props;
|
|
16
16
|
const multiple = props.multiple ?? true;
|
|
17
17
|
const { handleAccept, displayFiles, deleteFile, getFile, orgValue } = require_use_file_upload_store.useFileUploadStore({
|
|
18
18
|
value,
|
|
@@ -38,6 +38,7 @@ function FileUpload(props) {
|
|
|
38
38
|
multiple,
|
|
39
39
|
className: (0, __pixpilot_shadcn.cn)("w-full", className),
|
|
40
40
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadDropzone, {
|
|
41
|
+
id,
|
|
41
42
|
className: containerClasses,
|
|
42
43
|
children: displayFiles.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
43
44
|
className: "flex flex-col items-center gap-1 text-center p-2",
|
|
@@ -63,6 +64,7 @@ function FileUpload(props) {
|
|
|
63
64
|
itemSize,
|
|
64
65
|
onFileSuccess,
|
|
65
66
|
onFileError,
|
|
67
|
+
id,
|
|
66
68
|
className: containerClasses
|
|
67
69
|
})
|
|
68
70
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FileUploadProps } from "./types/index.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime14 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_runtime14.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { FileUpload };
|
|
@@ -7,7 +7,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
|
|
8
8
|
//#region src/file-upload/FileUpload.tsx
|
|
9
9
|
function FileUpload$1(props) {
|
|
10
|
-
const { value, onChange, className, onAccept, maxFiles, preventDuplicates, onFileReject, onFileSuccess, onFileError,...rest } = props;
|
|
10
|
+
const { value, onChange, className, onAccept, maxFiles, preventDuplicates, onFileReject, onFileSuccess, onFileError, id,...rest } = props;
|
|
11
11
|
const multiple = props.multiple ?? true;
|
|
12
12
|
const { handleAccept, displayFiles, deleteFile, getFile, orgValue } = useFileUploadStore({
|
|
13
13
|
value,
|
|
@@ -33,6 +33,7 @@ function FileUpload$1(props) {
|
|
|
33
33
|
multiple,
|
|
34
34
|
className: cn("w-full", className),
|
|
35
35
|
children: /* @__PURE__ */ jsx(FileUploadDropzone, {
|
|
36
|
+
id,
|
|
36
37
|
className: containerClasses,
|
|
37
38
|
children: displayFiles.length === 0 ? /* @__PURE__ */ jsxs("div", {
|
|
38
39
|
className: "flex flex-col items-center gap-1 text-center p-2",
|
|
@@ -58,6 +59,7 @@ function FileUpload$1(props) {
|
|
|
58
59
|
itemSize,
|
|
59
60
|
onFileSuccess,
|
|
60
61
|
onFileError,
|
|
62
|
+
id,
|
|
61
63
|
className: containerClasses
|
|
62
64
|
})
|
|
63
65
|
})
|
|
@@ -11,7 +11,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
11
11
|
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
12
12
|
|
|
13
13
|
//#region src/file-upload/FileUploadItems.tsx
|
|
14
|
-
function FileUploadItems({ displayFiles, deleteFile, getFile, maxFiles, itemSize, onFileSuccess, onFileError, className }) {
|
|
14
|
+
function FileUploadItems({ id, displayFiles, deleteFile, getFile, maxFiles, itemSize, onFileSuccess, onFileError, className }) {
|
|
15
15
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.FileUploadList, {
|
|
16
16
|
orientation: "horizontal",
|
|
17
17
|
forceMount: true,
|
|
@@ -20,6 +20,7 @@ function FileUploadItems({ displayFiles, deleteFile, getFile, maxFiles, itemSize
|
|
|
20
20
|
const { name, lastModified } = fileMeta;
|
|
21
21
|
const key = `${name}-${lastModified}`;
|
|
22
22
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FileUploadListItem.FileUploadListItem, {
|
|
23
|
+
id,
|
|
23
24
|
fileMeta,
|
|
24
25
|
deleteFile,
|
|
25
26
|
getFile,
|
|
@@ -7,7 +7,7 @@ import { Plus } from "lucide-react";
|
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
|
|
9
9
|
//#region src/file-upload/FileUploadItems.tsx
|
|
10
|
-
function FileUploadItems({ displayFiles, deleteFile, getFile, maxFiles, itemSize, onFileSuccess, onFileError, className }) {
|
|
10
|
+
function FileUploadItems({ id, displayFiles, deleteFile, getFile, maxFiles, itemSize, onFileSuccess, onFileError, className }) {
|
|
11
11
|
return /* @__PURE__ */ jsxs(FileUploadList, {
|
|
12
12
|
orientation: "horizontal",
|
|
13
13
|
forceMount: true,
|
|
@@ -16,6 +16,7 @@ function FileUploadItems({ displayFiles, deleteFile, getFile, maxFiles, itemSize
|
|
|
16
16
|
const { name, lastModified } = fileMeta;
|
|
17
17
|
const key = `${name}-${lastModified}`;
|
|
18
18
|
return /* @__PURE__ */ jsx(FileUploadListItem, {
|
|
19
|
+
id,
|
|
19
20
|
fileMeta,
|
|
20
21
|
deleteFile,
|
|
21
22
|
getFile,
|
|
@@ -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_use_file_upload_progress_callbacks = require('./hooks/use-file-upload-progress-callbacks.cjs');
|
|
6
7
|
require('./hooks/index.cjs');
|
|
7
8
|
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
@@ -22,7 +23,7 @@ const Backdrop = ({ className, children }) => {
|
|
|
22
23
|
children
|
|
23
24
|
});
|
|
24
25
|
};
|
|
25
|
-
const FileUploadListItem = react.default.memo(({ fileMeta, deleteFile, getFile, itemSize, onFileSuccess, onFileError }) => {
|
|
26
|
+
const FileUploadListItem = react.default.memo(({ id, fileMeta, deleteFile, getFile, itemSize, onFileSuccess, onFileError }) => {
|
|
26
27
|
const file = getFile(fileMeta);
|
|
27
28
|
require_use_file_upload_progress_callbacks.useFileUploadProgressCallbacks(file, {
|
|
28
29
|
onFileSuccess,
|
|
@@ -74,6 +75,7 @@ const FileUploadListItem = react.default.memo(({ fileMeta, deleteFile, getFile,
|
|
|
74
75
|
})] })] }),
|
|
75
76
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadItemMetadata, { className: "sr-only" }),
|
|
76
77
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
78
|
+
id: require_get_id.getId(id, `remove-button-${fileMeta.name}-${fileMeta.lastModified}`),
|
|
77
79
|
type: "button",
|
|
78
80
|
variant: "secondary",
|
|
79
81
|
size: "icon",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
import { getId } from "../utils/get-id.js";
|
|
4
5
|
import { useFileUploadProgressCallbacks } from "./hooks/use-file-upload-progress-callbacks.js";
|
|
5
6
|
import "./hooks/index.js";
|
|
6
7
|
import { Button, FileUploadItem, FileUploadItemMetadata, FileUploadItemPreview, FileUploadItemProgress, Tooltip, TooltipContent, TooltipTrigger, cn, useFileUpload } from "@pixpilot/shadcn";
|
|
@@ -16,7 +17,7 @@ const Backdrop = ({ className, children }) => {
|
|
|
16
17
|
children
|
|
17
18
|
});
|
|
18
19
|
};
|
|
19
|
-
const FileUploadListItem = React.memo(({ fileMeta, deleteFile, getFile, itemSize, onFileSuccess, onFileError }) => {
|
|
20
|
+
const FileUploadListItem = React.memo(({ id, fileMeta, deleteFile, getFile, itemSize, onFileSuccess, onFileError }) => {
|
|
20
21
|
const file = getFile(fileMeta);
|
|
21
22
|
useFileUploadProgressCallbacks(file, {
|
|
22
23
|
onFileSuccess,
|
|
@@ -68,6 +69,7 @@ const FileUploadListItem = React.memo(({ fileMeta, deleteFile, getFile, itemSize
|
|
|
68
69
|
})] })] }),
|
|
69
70
|
/* @__PURE__ */ jsx(FileUploadItemMetadata, { className: "sr-only" }),
|
|
70
71
|
/* @__PURE__ */ jsx(Button, {
|
|
72
|
+
id: getId(id, `remove-button-${fileMeta.name}-${fileMeta.lastModified}`),
|
|
71
73
|
type: "button",
|
|
72
74
|
variant: "secondary",
|
|
73
75
|
size: "icon",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FileUploadInlineProps } from "./types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime13 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_runtime13.JSX.Element;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { FileUploadInline };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FileUploadInlineProps } from "./types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime9 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_runtime9.JSX.Element;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { FileUploadInline };
|
|
@@ -17,7 +17,7 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
17
17
|
* FileUploadInline - An inline file upload component using FileUpload primitives
|
|
18
18
|
*/
|
|
19
19
|
function FileUploadRoot(props) {
|
|
20
|
-
const { value, onChange, className, disabled, children, onAccept, maxFiles, preventDuplicates, slots, onFileSuccess, onFileError,...rest } = props;
|
|
20
|
+
const { value, onChange, className, disabled, children, onAccept, maxFiles, preventDuplicates, slots, onFileSuccess, onFileError, id,...rest } = props;
|
|
21
21
|
const multiple = props.multiple ?? false;
|
|
22
22
|
const effectiveMaxFiles = multiple ? maxFiles : 1;
|
|
23
23
|
const { handleAccept, displayFiles, deleteFile, getFile, orgValue } = require_use_file_upload_store.useFileUploadStore({
|
|
@@ -52,6 +52,7 @@ function FileUploadRoot(props) {
|
|
|
52
52
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadTrigger, {
|
|
53
53
|
asChild: true,
|
|
54
54
|
...slots?.trigger || {},
|
|
55
|
+
id: id ?? slots?.trigger?.id,
|
|
55
56
|
children
|
|
56
57
|
})
|
|
57
58
|
}), displayFiles.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadList, {
|
|
@@ -64,6 +65,7 @@ function FileUploadRoot(props) {
|
|
|
64
65
|
...data,
|
|
65
66
|
file: getFile(data),
|
|
66
67
|
disabled,
|
|
68
|
+
id,
|
|
67
69
|
onDelete: deleteFile,
|
|
68
70
|
onFileSuccess,
|
|
69
71
|
onFileError,
|
|
@@ -13,7 +13,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
* FileUploadInline - An inline file upload component using FileUpload primitives
|
|
14
14
|
*/
|
|
15
15
|
function FileUploadRoot(props) {
|
|
16
|
-
const { value, onChange, className, disabled, children, onAccept, maxFiles, preventDuplicates, slots, onFileSuccess, onFileError,...rest } = props;
|
|
16
|
+
const { value, onChange, className, disabled, children, onAccept, maxFiles, preventDuplicates, slots, onFileSuccess, onFileError, id,...rest } = props;
|
|
17
17
|
const multiple = props.multiple ?? false;
|
|
18
18
|
const effectiveMaxFiles = multiple ? maxFiles : 1;
|
|
19
19
|
const { handleAccept, displayFiles, deleteFile, getFile, orgValue } = useFileUploadStore({
|
|
@@ -46,6 +46,7 @@ function FileUploadRoot(props) {
|
|
|
46
46
|
children: /* @__PURE__ */ jsx(FileUploadTrigger, {
|
|
47
47
|
asChild: true,
|
|
48
48
|
...slots?.trigger || {},
|
|
49
|
+
id: id ?? slots?.trigger?.id,
|
|
49
50
|
children
|
|
50
51
|
})
|
|
51
52
|
}), displayFiles.length > 0 && /* @__PURE__ */ jsx(FileUploadList, {
|
|
@@ -58,6 +59,7 @@ function FileUploadRoot(props) {
|
|
|
58
59
|
...data,
|
|
59
60
|
file: getFile(data),
|
|
60
61
|
disabled,
|
|
62
|
+
id,
|
|
61
63
|
onDelete: deleteFile,
|
|
62
64
|
onFileSuccess,
|
|
63
65
|
onFileError,
|
|
@@ -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_use_file_error = require('../file-upload/hooks/use-file-error.cjs');
|
|
6
7
|
const require_use_file_upload_progress_callbacks = require('../file-upload/hooks/use-file-upload-progress-callbacks.cjs');
|
|
7
8
|
require('../file-upload/hooks/index.cjs');
|
|
@@ -33,8 +34,9 @@ const FileMetaDataDisplay = ({ size, name, children }) => {
|
|
|
33
34
|
]
|
|
34
35
|
});
|
|
35
36
|
};
|
|
36
|
-
const DeleteIconButton = ({ onClick }) => {
|
|
37
|
+
const DeleteIconButton = ({ id, onClick }) => {
|
|
37
38
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
39
|
+
id,
|
|
38
40
|
variant: "ghost",
|
|
39
41
|
size: "icon",
|
|
40
42
|
className: "size-7 shrink-0",
|
|
@@ -55,7 +57,7 @@ const FileItemInnerWrapper = ({ children }) => {
|
|
|
55
57
|
children
|
|
56
58
|
});
|
|
57
59
|
};
|
|
58
|
-
const FileUploadRootItem = react.default.memo(({ file, name = "", size = 0, type = "", lastModified = 0, disabled = false, onDelete, onFileError, onFileSuccess }) => {
|
|
60
|
+
const FileUploadRootItem = react.default.memo(({ file, name = "", size = 0, type = "", lastModified = 0, disabled = false, onDelete, onFileError, onFileSuccess, id }) => {
|
|
59
61
|
require_use_file_upload_progress_callbacks.useFileUploadProgressCallbacks(file, {
|
|
60
62
|
onFileSuccess,
|
|
61
63
|
onFileError
|
|
@@ -76,17 +78,20 @@ const FileUploadRootItem = react.default.memo(({ file, name = "", size = 0, type
|
|
|
76
78
|
className: "text-destructive text-xs",
|
|
77
79
|
children: fileError
|
|
78
80
|
})
|
|
79
|
-
}), !disabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeleteIconButton, {
|
|
80
|
-
|
|
81
|
-
e
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
81
|
+
}), !disabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeleteIconButton, {
|
|
82
|
+
id: require_get_id.getId(id, `remove-button-${name}-${lastModified}`),
|
|
83
|
+
onClick: (e) => {
|
|
84
|
+
e.stopPropagation();
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
onDelete({
|
|
87
|
+
name,
|
|
88
|
+
size,
|
|
89
|
+
type,
|
|
90
|
+
lastModified,
|
|
91
|
+
file
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
})] }), isUploading && fileError == null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadItemProgress, {
|
|
90
95
|
variant: "linear",
|
|
91
96
|
className: "h-1 w-full"
|
|
92
97
|
})] })
|
|
@@ -4,6 +4,7 @@ import React from "react";
|
|
|
4
4
|
|
|
5
5
|
//#region src/file-upload-root/FileUploadRootItem.d.ts
|
|
6
6
|
interface FileUploadRootItemProps extends Partial<FileMetadata>, FileUploadCallbacks {
|
|
7
|
+
id?: string;
|
|
7
8
|
file: File;
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
onDelete: (file: FileWithMetadata) => void;
|
|
@@ -5,6 +5,7 @@ import React from "react";
|
|
|
5
5
|
|
|
6
6
|
//#region src/file-upload-root/FileUploadRootItem.d.ts
|
|
7
7
|
interface FileUploadRootItemProps extends Partial<FileMetadata>, FileUploadCallbacks {
|
|
8
|
+
id?: string;
|
|
8
9
|
file: File;
|
|
9
10
|
disabled?: boolean;
|
|
10
11
|
onDelete: (file: FileWithMetadata) => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
import { getId } from "../utils/get-id.js";
|
|
4
5
|
import { useFileError } from "../file-upload/hooks/use-file-error.js";
|
|
5
6
|
import { useFileUploadProgressCallbacks } from "../file-upload/hooks/use-file-upload-progress-callbacks.js";
|
|
6
7
|
import "../file-upload/hooks/index.js";
|
|
@@ -27,8 +28,9 @@ const FileMetaDataDisplay = ({ size, name, children }) => {
|
|
|
27
28
|
]
|
|
28
29
|
});
|
|
29
30
|
};
|
|
30
|
-
const DeleteIconButton = ({ onClick }) => {
|
|
31
|
+
const DeleteIconButton = ({ id, onClick }) => {
|
|
31
32
|
return /* @__PURE__ */ jsx(Button, {
|
|
33
|
+
id,
|
|
32
34
|
variant: "ghost",
|
|
33
35
|
size: "icon",
|
|
34
36
|
className: "size-7 shrink-0",
|
|
@@ -49,7 +51,7 @@ const FileItemInnerWrapper = ({ children }) => {
|
|
|
49
51
|
children
|
|
50
52
|
});
|
|
51
53
|
};
|
|
52
|
-
const FileUploadRootItem = React.memo(({ file, name = "", size = 0, type = "", lastModified = 0, disabled = false, onDelete, onFileError, onFileSuccess }) => {
|
|
54
|
+
const FileUploadRootItem = React.memo(({ file, name = "", size = 0, type = "", lastModified = 0, disabled = false, onDelete, onFileError, onFileSuccess, id }) => {
|
|
53
55
|
useFileUploadProgressCallbacks(file, {
|
|
54
56
|
onFileSuccess,
|
|
55
57
|
onFileError
|
|
@@ -70,17 +72,20 @@ const FileUploadRootItem = React.memo(({ file, name = "", size = 0, type = "", l
|
|
|
70
72
|
className: "text-destructive text-xs",
|
|
71
73
|
children: fileError
|
|
72
74
|
})
|
|
73
|
-
}), !disabled && /* @__PURE__ */ jsx(DeleteIconButton, {
|
|
74
|
-
|
|
75
|
-
e
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
}), !disabled && /* @__PURE__ */ jsx(DeleteIconButton, {
|
|
76
|
+
id: getId(id, `remove-button-${name}-${lastModified}`),
|
|
77
|
+
onClick: (e) => {
|
|
78
|
+
e.stopPropagation();
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
onDelete({
|
|
81
|
+
name,
|
|
82
|
+
size,
|
|
83
|
+
type,
|
|
84
|
+
lastModified,
|
|
85
|
+
file
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
})] }), isUploading && fileError == null && /* @__PURE__ */ jsx(FileUploadItemProgress, {
|
|
84
89
|
variant: "linear",
|
|
85
90
|
className: "h-1 w-full"
|
|
86
91
|
})] })
|
|
@@ -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_Button = require('../Button.cjs');
|
|
3
4
|
const require_use_media_query = require('../hooks/use-media-query.cjs');
|
|
4
5
|
require('../hooks/index.cjs');
|
|
@@ -18,7 +19,7 @@ __iconify_react = require_rolldown_runtime.__toESM(__iconify_react);
|
|
|
18
19
|
|
|
19
20
|
//#region src/icon-selector/IconPicker.tsx
|
|
20
21
|
const ICON_SIZE = "!h-4 !w-4";
|
|
21
|
-
const IconPicker = ({ value, onChange, onOpenChange, pickerMode = "dialog", popoverProps, variant = "default", providers: providersProp, showValueText = true, emptyText = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Plus, { className: ICON_SIZE }), showClearButton = true, slots }) => {
|
|
22
|
+
const IconPicker = ({ id, value, onChange, onOpenChange, pickerMode = "dialog", popoverProps, variant = "default", providers: providersProp, showValueText = true, emptyText = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Plus, { className: ICON_SIZE }), showClearButton = true, slots }) => {
|
|
22
23
|
const [isOpen, setIsOpen] = (0, react.useState)(false);
|
|
23
24
|
const isMobile = require_use_media_query.useMediaQuery({ maxWidth: 768 });
|
|
24
25
|
const handleSelectIcon = (0, react.useCallback)((iconName) => {
|
|
@@ -46,6 +47,7 @@ const IconPicker = ({ value, onChange, onOpenChange, pickerMode = "dialog", popo
|
|
|
46
47
|
};
|
|
47
48
|
const displayIcon = renderIconDisplay("text-sm");
|
|
48
49
|
const selectorContent = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icon_picker_content.default, {
|
|
50
|
+
id,
|
|
49
51
|
providers: providersProp,
|
|
50
52
|
onChange: handleSelectIcon,
|
|
51
53
|
onSelect: () => setIsOpen(false)
|
|
@@ -66,11 +68,13 @@ const IconPicker = ({ value, onChange, onOpenChange, pickerMode = "dialog", popo
|
|
|
66
68
|
selectorContent,
|
|
67
69
|
popover: popoverProps,
|
|
68
70
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Button.Button, {
|
|
71
|
+
id,
|
|
69
72
|
type: "button",
|
|
70
73
|
variant: "outline",
|
|
71
74
|
"aria-label": iconButtonLabel,
|
|
72
75
|
className: (0, __pixpilot_shadcn.cn)("p-2 min-w-10", slots?.preview?.className),
|
|
73
76
|
children: [iconButtonContent, shouldShowClearButton && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button.Button, {
|
|
77
|
+
id: require_get_id.getId(id, "clear-button"),
|
|
74
78
|
type: "button",
|
|
75
79
|
title: "Clear selected icon",
|
|
76
80
|
className: (0, __pixpilot_shadcn.cn)(`absolute -right-1 -top-1 inline-flex ${ICON_SIZE} items-center justify-center rounded-full !p-1`, "border border-border bg-background text-foreground", "hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", slots?.clearIcon?.className),
|
|
@@ -101,6 +105,7 @@ const IconPicker = ({ value, onChange, onOpenChange, pickerMode = "dialog", popo
|
|
|
101
105
|
selectorContent,
|
|
102
106
|
popover: popoverProps,
|
|
103
107
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button.Button, {
|
|
108
|
+
id,
|
|
104
109
|
type: "button",
|
|
105
110
|
variant: "outline",
|
|
106
111
|
className: (0, __pixpilot_shadcn.cn)("whitespace-nowrap", slots?.trigger?.className),
|
|
@@ -108,6 +113,7 @@ const IconPicker = ({ value, onChange, onOpenChange, pickerMode = "dialog", popo
|
|
|
108
113
|
})
|
|
109
114
|
}),
|
|
110
115
|
shouldShowClearButton && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button.Button, {
|
|
116
|
+
id: require_get_id.getId(id, "clear-button"),
|
|
111
117
|
type: "button",
|
|
112
118
|
variant: "outline",
|
|
113
119
|
className: (0, __pixpilot_shadcn.cn)("whitespace-nowrap", slots?.clearButton?.className),
|
|
@@ -15,6 +15,7 @@ type IconPickerVariant = 'default' | 'icon-button';
|
|
|
15
15
|
* Allows users to select an icon from multiple icon providers via a dialog or popover
|
|
16
16
|
*/
|
|
17
17
|
interface IconPickerProps {
|
|
18
|
+
id?: string;
|
|
18
19
|
value?: string;
|
|
19
20
|
onChange?: (value: string) => void;
|
|
20
21
|
onOpenChange?: (open: boolean) => void;
|
|
@@ -15,6 +15,7 @@ type IconPickerVariant = 'default' | 'icon-button';
|
|
|
15
15
|
* Allows users to select an icon from multiple icon providers via a dialog or popover
|
|
16
16
|
*/
|
|
17
17
|
interface IconPickerProps {
|
|
18
|
+
id?: string;
|
|
18
19
|
value?: string;
|
|
19
20
|
onChange?: (value: string) => void;
|
|
20
21
|
onOpenChange?: (open: boolean) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getId } from "../utils/get-id.js";
|
|
1
2
|
import { Button as Button$1 } from "../Button.js";
|
|
2
3
|
import { useMediaQuery } from "../hooks/use-media-query.js";
|
|
3
4
|
import "../hooks/index.js";
|
|
@@ -12,7 +13,7 @@ import { Icon } from "@iconify/react";
|
|
|
12
13
|
|
|
13
14
|
//#region src/icon-selector/IconPicker.tsx
|
|
14
15
|
const ICON_SIZE = "!h-4 !w-4";
|
|
15
|
-
const IconPicker = ({ value, onChange, onOpenChange, pickerMode = "dialog", popoverProps, variant = "default", providers: providersProp, showValueText = true, emptyText = /* @__PURE__ */ jsx(Plus, { className: ICON_SIZE }), showClearButton = true, slots }) => {
|
|
16
|
+
const IconPicker = ({ id, value, onChange, onOpenChange, pickerMode = "dialog", popoverProps, variant = "default", providers: providersProp, showValueText = true, emptyText = /* @__PURE__ */ jsx(Plus, { className: ICON_SIZE }), showClearButton = true, slots }) => {
|
|
16
17
|
const [isOpen, setIsOpen] = useState(false);
|
|
17
18
|
const isMobile = useMediaQuery({ maxWidth: 768 });
|
|
18
19
|
const handleSelectIcon = useCallback((iconName) => {
|
|
@@ -40,6 +41,7 @@ const IconPicker = ({ value, onChange, onOpenChange, pickerMode = "dialog", popo
|
|
|
40
41
|
};
|
|
41
42
|
const displayIcon = renderIconDisplay("text-sm");
|
|
42
43
|
const selectorContent = /* @__PURE__ */ jsx(icon_picker_content_default, {
|
|
44
|
+
id,
|
|
43
45
|
providers: providersProp,
|
|
44
46
|
onChange: handleSelectIcon,
|
|
45
47
|
onSelect: () => setIsOpen(false)
|
|
@@ -59,11 +61,13 @@ const IconPicker = ({ value, onChange, onOpenChange, pickerMode = "dialog", popo
|
|
|
59
61
|
selectorContent,
|
|
60
62
|
popover: popoverProps,
|
|
61
63
|
children: /* @__PURE__ */ jsxs(Button$1, {
|
|
64
|
+
id,
|
|
62
65
|
type: "button",
|
|
63
66
|
variant: "outline",
|
|
64
67
|
"aria-label": iconButtonLabel,
|
|
65
68
|
className: cn("p-2 min-w-10", slots?.preview?.className),
|
|
66
69
|
children: [iconButtonContent, shouldShowClearButton && /* @__PURE__ */ jsx(Button$1, {
|
|
70
|
+
id: getId(id, "clear-button"),
|
|
67
71
|
type: "button",
|
|
68
72
|
title: "Clear selected icon",
|
|
69
73
|
className: cn(`absolute -right-1 -top-1 inline-flex ${ICON_SIZE} items-center justify-center rounded-full !p-1`, "border border-border bg-background text-foreground", "hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", slots?.clearIcon?.className),
|
|
@@ -94,6 +98,7 @@ const IconPicker = ({ value, onChange, onOpenChange, pickerMode = "dialog", popo
|
|
|
94
98
|
selectorContent,
|
|
95
99
|
popover: popoverProps,
|
|
96
100
|
children: /* @__PURE__ */ jsx(Button$1, {
|
|
101
|
+
id,
|
|
97
102
|
type: "button",
|
|
98
103
|
variant: "outline",
|
|
99
104
|
className: cn("whitespace-nowrap", slots?.trigger?.className),
|
|
@@ -101,6 +106,7 @@ const IconPicker = ({ value, onChange, onOpenChange, pickerMode = "dialog", popo
|
|
|
101
106
|
})
|
|
102
107
|
}),
|
|
103
108
|
shouldShowClearButton && /* @__PURE__ */ jsx(Button$1, {
|
|
109
|
+
id: getId(id, "clear-button"),
|
|
104
110
|
type: "button",
|
|
105
111
|
variant: "outline",
|
|
106
112
|
className: cn("whitespace-nowrap", slots?.clearButton?.className),
|