@pixpilot/shadcn-ui 0.16.0 → 0.17.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/Select.cjs +8 -5
- package/dist/Select.d.cts +3 -2
- package/dist/Select.d.ts +3 -2
- package/dist/Select.js +8 -5
- package/dist/file-upload-inline/FileUploadInline.d.cts +2 -2
- package/dist/icon-selector/icon-picker-content.cjs +3 -1
- package/dist/icon-selector/icon-picker-content.js +4 -2
- package/dist/index.cjs +5 -0
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/input/Input.cjs +41 -0
- package/dist/input/Input.d.cts +15 -0
- package/dist/input/Input.d.ts +15 -0
- package/dist/input/Input.js +37 -0
- package/dist/input/index.cjs +1 -0
- package/dist/input/index.d.cts +1 -0
- package/dist/input/index.d.ts +1 -0
- package/dist/input/index.js +1 -0
- package/dist/slider/SliderInput.cjs +7 -5
- package/dist/slider/SliderInput.d.cts +3 -3
- package/dist/slider/SliderInput.d.ts +3 -3
- package/dist/slider/SliderInput.js +6 -5
- package/dist/slider/SliderSelect.cjs +99 -0
- package/dist/slider/SliderSelect.d.cts +27 -0
- package/dist/slider/SliderSelect.d.ts +27 -0
- package/dist/slider/SliderSelect.js +95 -0
- package/dist/slider/index.cjs +1 -0
- package/dist/slider/index.d.cts +2 -1
- package/dist/slider/index.d.ts +2 -1
- package/dist/slider/index.js +1 -0
- package/package.json +5 -5
package/dist/Select.cjs
CHANGED
|
@@ -8,7 +8,7 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
8
8
|
|
|
9
9
|
//#region src/Select.tsx
|
|
10
10
|
function Select(props) {
|
|
11
|
-
const { options, value = "", onChange, placeholder,...restProps } = props;
|
|
11
|
+
const { options, value = "", onChange, placeholder, contentProps,...restProps } = props;
|
|
12
12
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Select, {
|
|
13
13
|
value,
|
|
14
14
|
onValueChange: onChange,
|
|
@@ -16,10 +16,13 @@ function Select(props) {
|
|
|
16
16
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectTrigger, {
|
|
17
17
|
className: "w-full",
|
|
18
18
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectValue, { placeholder })
|
|
19
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectContent, {
|
|
20
|
-
|
|
21
|
-
children: option.
|
|
22
|
-
|
|
19
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectContent, {
|
|
20
|
+
...contentProps,
|
|
21
|
+
children: options?.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.SelectItem, {
|
|
22
|
+
value: String(option.value),
|
|
23
|
+
children: option.label
|
|
24
|
+
}, option.value))
|
|
25
|
+
})]
|
|
23
26
|
});
|
|
24
27
|
}
|
|
25
28
|
|
package/dist/Select.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
2
|
-
import { Select } from "@pixpilot/shadcn";
|
|
3
|
-
import { ComponentProps } from "react";
|
|
2
|
+
import { Select, SelectContent } from "@pixpilot/shadcn";
|
|
3
|
+
import React, { ComponentProps } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/Select.d.ts
|
|
6
6
|
interface SelectOption {
|
|
@@ -9,6 +9,7 @@ interface SelectOption {
|
|
|
9
9
|
}
|
|
10
10
|
type BaseSelectProps = {
|
|
11
11
|
options?: SelectOption[];
|
|
12
|
+
contentProps?: React.ComponentProps<typeof SelectContent>;
|
|
12
13
|
value?: string;
|
|
13
14
|
onChange?: (value: string) => void;
|
|
14
15
|
placeholder?: string;
|
package/dist/Select.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Select } from "@pixpilot/shadcn";
|
|
2
|
-
import { ComponentProps } from "react";
|
|
1
|
+
import { Select, SelectContent } from "@pixpilot/shadcn";
|
|
2
|
+
import React, { ComponentProps } from "react";
|
|
3
3
|
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/Select.d.ts
|
|
@@ -9,6 +9,7 @@ interface SelectOption {
|
|
|
9
9
|
}
|
|
10
10
|
type BaseSelectProps = {
|
|
11
11
|
options?: SelectOption[];
|
|
12
|
+
contentProps?: React.ComponentProps<typeof SelectContent>;
|
|
12
13
|
value?: string;
|
|
13
14
|
onChange?: (value: string) => void;
|
|
14
15
|
placeholder?: string;
|
package/dist/Select.js
CHANGED
|
@@ -4,7 +4,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
|
|
5
5
|
//#region src/Select.tsx
|
|
6
6
|
function Select$1(props) {
|
|
7
|
-
const { options, value = "", onChange, placeholder,...restProps } = props;
|
|
7
|
+
const { options, value = "", onChange, placeholder, contentProps,...restProps } = props;
|
|
8
8
|
return /* @__PURE__ */ jsxs(Select, {
|
|
9
9
|
value,
|
|
10
10
|
onValueChange: onChange,
|
|
@@ -12,10 +12,13 @@ function Select$1(props) {
|
|
|
12
12
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
13
13
|
className: "w-full",
|
|
14
14
|
children: /* @__PURE__ */ jsx(SelectValue, { placeholder })
|
|
15
|
-
}), /* @__PURE__ */ jsx(SelectContent, {
|
|
16
|
-
|
|
17
|
-
children: option
|
|
18
|
-
|
|
15
|
+
}), /* @__PURE__ */ jsx(SelectContent, {
|
|
16
|
+
...contentProps,
|
|
17
|
+
children: options?.map((option) => /* @__PURE__ */ jsx(SelectItem, {
|
|
18
|
+
value: String(option.value),
|
|
19
|
+
children: option.label
|
|
20
|
+
}, option.value))
|
|
21
|
+
})]
|
|
19
22
|
});
|
|
20
23
|
}
|
|
21
24
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FileUploadInlineProps } from "./types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime8 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/file-upload-inline/FileUploadInline.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* FileUploadInline - An inline file upload component using FileUpload primitives
|
|
7
7
|
*/
|
|
8
|
-
declare function FileUploadInline(props: FileUploadInlineProps):
|
|
8
|
+
declare function FileUploadInline(props: FileUploadInlineProps): react_jsx_runtime8.JSX.Element;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { FileUploadInline };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_Input = require('../input/Input.cjs');
|
|
3
|
+
require('../input/index.cjs');
|
|
2
4
|
const require_LoadingOverlay = require('../LoadingOverlay.cjs');
|
|
3
5
|
const require_use_async_providers = require('./use-async-providers.cjs');
|
|
4
6
|
const require_virtualized_icon_grid = require('./virtualized-icon-grid.cjs');
|
|
@@ -84,7 +86,7 @@ const IconPickerContent = ({ providers: providersProp, onChange, onSelect, maxHe
|
|
|
84
86
|
children: [
|
|
85
87
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
86
88
|
className: "relative",
|
|
87
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
89
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Input.Input, {
|
|
88
90
|
placeholder: "Search icons...",
|
|
89
91
|
value: searchQuery,
|
|
90
92
|
onChange: (e) => setSearchQuery(e.target.value),
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { Input as Input$1 } from "../input/Input.js";
|
|
2
|
+
import "../input/index.js";
|
|
1
3
|
import { LoadingOverlay } from "../LoadingOverlay.js";
|
|
2
4
|
import { useAsyncProviders } from "./use-async-providers.js";
|
|
3
5
|
import virtualized_icon_grid_default from "./virtualized-icon-grid.js";
|
|
4
|
-
import {
|
|
6
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@pixpilot/shadcn";
|
|
5
7
|
import { X } from "lucide-react";
|
|
6
8
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
7
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -79,7 +81,7 @@ const IconPickerContent = ({ providers: providersProp, onChange, onSelect, maxHe
|
|
|
79
81
|
children: [
|
|
80
82
|
/* @__PURE__ */ jsxs("div", {
|
|
81
83
|
className: "relative",
|
|
82
|
-
children: [/* @__PURE__ */ jsx(Input, {
|
|
84
|
+
children: [/* @__PURE__ */ jsx(Input$1, {
|
|
83
85
|
placeholder: "Search icons...",
|
|
84
86
|
value: searchQuery,
|
|
85
87
|
onChange: (e) => setSearchQuery(e.target.value),
|
package/dist/index.cjs
CHANGED
|
@@ -24,6 +24,8 @@ const require_FileUploadInline = require('./file-upload-inline/FileUploadInline.
|
|
|
24
24
|
require('./file-upload-inline/index.cjs');
|
|
25
25
|
const require_use_media_query = require('./hooks/use-media-query.cjs');
|
|
26
26
|
require('./hooks/index.cjs');
|
|
27
|
+
const require_Input = require('./input/Input.cjs');
|
|
28
|
+
require('./input/index.cjs');
|
|
27
29
|
const require_LoadingOverlay = require('./LoadingOverlay.cjs');
|
|
28
30
|
const require_IconPicker = require('./icon-selector/IconPicker.cjs');
|
|
29
31
|
require('./icon-selector/index.cjs');
|
|
@@ -40,6 +42,7 @@ const require_ScaledPreview = require('./ScaledPreview.cjs');
|
|
|
40
42
|
const require_Select = require('./Select.cjs');
|
|
41
43
|
const require_Slider = require('./slider/Slider.cjs');
|
|
42
44
|
const require_SliderInput = require('./slider/SliderInput.cjs');
|
|
45
|
+
const require_SliderSelect = require('./slider/SliderSelect.cjs');
|
|
43
46
|
require('./slider/index.cjs');
|
|
44
47
|
const require_TabsContext = require('./tabs/TabsContext.cjs');
|
|
45
48
|
const require_TabsList = require('./tabs/TabsList.cjs');
|
|
@@ -73,6 +76,7 @@ exports.DialogProvider = require_DialogProvider.DialogProvider;
|
|
|
73
76
|
exports.FileUpload = require_FileUpload.FileUpload;
|
|
74
77
|
exports.FileUploadInline = require_FileUploadInline.FileUploadInline;
|
|
75
78
|
exports.IconPicker = require_IconPicker.IconPicker;
|
|
79
|
+
exports.Input = require_Input.Input;
|
|
76
80
|
exports.Layout = require_Layout.Layout;
|
|
77
81
|
exports.LayoutFooter = require_LayoutFooter.LayoutFooter;
|
|
78
82
|
exports.LayoutHeader = require_LayoutHeader.LayoutHeader;
|
|
@@ -84,6 +88,7 @@ exports.ScaledPreview = require_ScaledPreview.ScaledPreview;
|
|
|
84
88
|
exports.Select = require_Select.Select;
|
|
85
89
|
exports.Slider = require_Slider.Slider;
|
|
86
90
|
exports.SliderInput = require_SliderInput.SliderInput;
|
|
91
|
+
exports.SliderSelect = require_SliderSelect.SliderSelect;
|
|
87
92
|
exports.Tabs = __pixpilot_shadcn.Tabs;
|
|
88
93
|
exports.TabsContent = __pixpilot_shadcn.TabsContent;
|
|
89
94
|
exports.TabsContext = require_TabsContext.TabsContext;
|
package/dist/index.d.cts
CHANGED
|
@@ -27,6 +27,8 @@ import { useMediaQuery } from "./hooks/use-media-query.cjs";
|
|
|
27
27
|
import { IconProvider, IconProviderLoader, IconProviderProps } from "./icon-selector/types.cjs";
|
|
28
28
|
import { IconPicker, IconPickerProps, IconPickerVariant } from "./icon-selector/IconPicker.cjs";
|
|
29
29
|
import "./icon-selector/index.cjs";
|
|
30
|
+
import { Input, InputProps } from "./input/Input.cjs";
|
|
31
|
+
import "./input/index.cjs";
|
|
30
32
|
import { Layout, LayoutProps } from "./layout/Layout.cjs";
|
|
31
33
|
import { LayoutFooter, LayoutFooterProps } from "./layout/LayoutFooter.cjs";
|
|
32
34
|
import { LayoutHeader, LayoutHeaderProps } from "./layout/LayoutHeader.cjs";
|
|
@@ -41,6 +43,7 @@ import { ScaledPreview, ScaledPreviewProps, ScaledPreviewSize } from "./ScaledPr
|
|
|
41
43
|
import { Select, SelectOption } from "./Select.cjs";
|
|
42
44
|
import { Slider, SliderProps } from "./slider/Slider.cjs";
|
|
43
45
|
import { SliderInput, SliderInputProps } from "./slider/SliderInput.cjs";
|
|
46
|
+
import { SliderSelect, SliderSelectOption, SliderSelectProps, SliderSelectValue } from "./slider/SliderSelect.cjs";
|
|
44
47
|
import "./slider/index.cjs";
|
|
45
48
|
import { Tabs } from "./tabs/Tabs.cjs";
|
|
46
49
|
import { TabsContent } from "./tabs/TabsContent.cjs";
|
|
@@ -56,4 +59,4 @@ import { ThemeToggle } from "./ThemeToggle.cjs";
|
|
|
56
59
|
import { DEFAULT_ALERT_DURATION, ToastMessage, toast, toastError, toastInfo, toastSuccess, toastWarning } from "./toast/toast.cjs";
|
|
57
60
|
import "./toast/index.cjs";
|
|
58
61
|
import { cn } from "@pixpilot/shadcn";
|
|
59
|
-
export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, AvatarUpload, AvatarUploadProps, BaseTabsTriggerProps, Button, ButtonLoaderProps, ButtonProps, CircleLoader, CircleLoaderProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, ColorPicker, ColorPickerBase, ColorPickerBaseProps, ColorPickerProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DatePickerProps, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, Layout, LayoutFooter, LayoutFooterProps, LayoutHeader, LayoutHeaderProps, LayoutMain, LayoutMainProps, LayoutProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, RichTextEditor, RichTextEditorProps, ScaledPreview, ScaledPreviewProps, ScaledPreviewSize, Select, SelectOption, SingleFileUploadProps, Slider, SliderInput, SliderInputProps, SliderProps, Tabs, TabsContent, TabsContext, TabsContextValue, TabsList, TabsListProps, TabsTrigger, TabsTriggerProps, TabsVariant, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, ToolbarOption, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTabsContext, useTheme };
|
|
62
|
+
export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, AvatarUpload, AvatarUploadProps, BaseTabsTriggerProps, Button, ButtonLoaderProps, ButtonProps, CircleLoader, CircleLoaderProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, ColorPicker, ColorPickerBase, ColorPickerBaseProps, ColorPickerProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DatePickerProps, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, Input, InputProps, Layout, LayoutFooter, LayoutFooterProps, LayoutHeader, LayoutHeaderProps, LayoutMain, LayoutMainProps, LayoutProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, RichTextEditor, RichTextEditorProps, ScaledPreview, ScaledPreviewProps, ScaledPreviewSize, Select, SelectOption, SingleFileUploadProps, Slider, SliderInput, SliderInputProps, SliderProps, SliderSelect, SliderSelectOption, SliderSelectProps, SliderSelectValue, Tabs, TabsContent, TabsContext, TabsContextValue, TabsList, TabsListProps, TabsTrigger, TabsTriggerProps, TabsVariant, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, ToolbarOption, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTabsContext, useTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ import "./hooks/index.js";
|
|
|
30
30
|
import { IconProvider, IconProviderLoader, IconProviderProps } from "./icon-selector/types.js";
|
|
31
31
|
import { IconPicker, IconPickerProps, IconPickerVariant } from "./icon-selector/IconPicker.js";
|
|
32
32
|
import "./icon-selector/index.js";
|
|
33
|
+
import { Input, InputProps } from "./input/Input.js";
|
|
34
|
+
import "./input/index.js";
|
|
33
35
|
import { Layout, LayoutProps } from "./layout/Layout.js";
|
|
34
36
|
import { LayoutFooter, LayoutFooterProps } from "./layout/LayoutFooter.js";
|
|
35
37
|
import { LayoutHeader, LayoutHeaderProps } from "./layout/LayoutHeader.js";
|
|
@@ -44,6 +46,7 @@ import { ScaledPreview, ScaledPreviewProps, ScaledPreviewSize } from "./ScaledPr
|
|
|
44
46
|
import { Select, SelectOption } from "./Select.js";
|
|
45
47
|
import { Slider, SliderProps } from "./slider/Slider.js";
|
|
46
48
|
import { SliderInput, SliderInputProps } from "./slider/SliderInput.js";
|
|
49
|
+
import { SliderSelect, SliderSelectOption, SliderSelectProps, SliderSelectValue } from "./slider/SliderSelect.js";
|
|
47
50
|
import "./slider/index.js";
|
|
48
51
|
import { Tabs } from "./tabs/Tabs.js";
|
|
49
52
|
import { TabsContent } from "./tabs/TabsContent.js";
|
|
@@ -59,4 +62,4 @@ import { ThemeToggle } from "./ThemeToggle.js";
|
|
|
59
62
|
import { DEFAULT_ALERT_DURATION, ToastMessage, toast, toastError, toastInfo, toastSuccess, toastWarning } from "./toast/toast.js";
|
|
60
63
|
import "./toast/index.js";
|
|
61
64
|
import { cn } from "@pixpilot/shadcn";
|
|
62
|
-
export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, AvatarUpload, AvatarUploadProps, BaseTabsTriggerProps, Button, ButtonLoaderProps, ButtonProps, CircleLoader, CircleLoaderProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, ColorPicker, ColorPickerBase, ColorPickerBaseProps, ColorPickerProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DatePickerProps, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, Layout, LayoutFooter, LayoutFooterProps, LayoutHeader, LayoutHeaderProps, LayoutMain, LayoutMainProps, LayoutProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, RichTextEditor, RichTextEditorProps, ScaledPreview, ScaledPreviewProps, ScaledPreviewSize, Select, SelectOption, SingleFileUploadProps, Slider, SliderInput, SliderInputProps, SliderProps, Tabs, TabsContent, TabsContext, TabsContextValue, TabsList, TabsListProps, TabsTrigger, TabsTriggerProps, TabsVariant, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, ToolbarOption, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTabsContext, useTheme };
|
|
65
|
+
export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, AvatarUpload, AvatarUploadProps, BaseTabsTriggerProps, Button, ButtonLoaderProps, ButtonProps, CircleLoader, CircleLoaderProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, ColorPicker, ColorPickerBase, ColorPickerBaseProps, ColorPickerProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DatePickerProps, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, Input, InputProps, Layout, LayoutFooter, LayoutFooterProps, LayoutHeader, LayoutHeaderProps, LayoutMain, LayoutMainProps, LayoutProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, RichTextEditor, RichTextEditorProps, ScaledPreview, ScaledPreviewProps, ScaledPreviewSize, Select, SelectOption, SingleFileUploadProps, Slider, SliderInput, SliderInputProps, SliderProps, SliderSelect, SliderSelectOption, SliderSelectProps, SliderSelectValue, Tabs, TabsContent, TabsContext, TabsContextValue, TabsList, TabsListProps, TabsTrigger, TabsTriggerProps, TabsVariant, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, ToolbarOption, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTabsContext, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,8 @@ import { FileUploadInline } from "./file-upload-inline/FileUploadInline.js";
|
|
|
23
23
|
import "./file-upload-inline/index.js";
|
|
24
24
|
import { useMediaQuery } from "./hooks/use-media-query.js";
|
|
25
25
|
import "./hooks/index.js";
|
|
26
|
+
import { Input } from "./input/Input.js";
|
|
27
|
+
import "./input/index.js";
|
|
26
28
|
import { LoadingOverlay } from "./LoadingOverlay.js";
|
|
27
29
|
import { IconPicker } from "./icon-selector/IconPicker.js";
|
|
28
30
|
import "./icon-selector/index.js";
|
|
@@ -39,6 +41,7 @@ import { ScaledPreview } from "./ScaledPreview.js";
|
|
|
39
41
|
import { Select } from "./Select.js";
|
|
40
42
|
import { Slider } from "./slider/Slider.js";
|
|
41
43
|
import { SliderInput } from "./slider/SliderInput.js";
|
|
44
|
+
import { SliderSelect } from "./slider/SliderSelect.js";
|
|
42
45
|
import "./slider/index.js";
|
|
43
46
|
import { Tabs } from "./tabs/Tabs.js";
|
|
44
47
|
import { TabsContent } from "./tabs/TabsContent.js";
|
|
@@ -54,4 +57,4 @@ import { DEFAULT_ALERT_DURATION, toast, toastError, toastInfo, toastSuccess, toa
|
|
|
54
57
|
import "./toast/index.js";
|
|
55
58
|
import { cn } from "@pixpilot/shadcn";
|
|
56
59
|
|
|
57
|
-
export { AbsoluteFill, Alert, AvatarUpload, Button, CircleLoader, CloseButtonAbsolute, CloseButtonRounded, ColorPicker, ColorPickerBase, Combobox, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DialogProvider, FileUpload, FileUploadInline, IconPicker, Layout, LayoutFooter, LayoutHeader, LayoutMain, LoadingOverlay, Pagination, RichTextEditor, ScaledPreview, Select, Slider, SliderInput, Tabs, TabsContent, TabsContext, TabsList, TabsTrigger, TagsInput, ThemeProvider, ThemeToggle, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTabsContext, useTheme };
|
|
60
|
+
export { AbsoluteFill, Alert, AvatarUpload, Button, CircleLoader, CloseButtonAbsolute, CloseButtonRounded, ColorPicker, ColorPickerBase, Combobox, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DialogProvider, FileUpload, FileUploadInline, IconPicker, Input, Layout, LayoutFooter, LayoutHeader, LayoutMain, LoadingOverlay, Pagination, RichTextEditor, ScaledPreview, Select, Slider, SliderInput, SliderSelect, Tabs, TabsContent, TabsContext, TabsList, TabsTrigger, TagsInput, ThemeProvider, ThemeToggle, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTabsContext, useTheme };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
3
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
8
|
+
|
|
9
|
+
//#region src/input/Input.tsx
|
|
10
|
+
function Input(props) {
|
|
11
|
+
const { prefix, suffix, groupClassName, prefixClassName, suffixClassName, className, disabled,...restProps } = props;
|
|
12
|
+
if (prefix == null && suffix == null) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Input, {
|
|
13
|
+
className,
|
|
14
|
+
disabled,
|
|
15
|
+
...restProps
|
|
16
|
+
});
|
|
17
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.InputGroup, {
|
|
18
|
+
className: (0, __pixpilot_shadcn.cn)(groupClassName),
|
|
19
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
20
|
+
children: [
|
|
21
|
+
prefix != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.InputGroupAddon, {
|
|
22
|
+
align: "inline-start",
|
|
23
|
+
className: prefixClassName,
|
|
24
|
+
children: prefix
|
|
25
|
+
}) : null,
|
|
26
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.InputGroupInput, {
|
|
27
|
+
className,
|
|
28
|
+
disabled,
|
|
29
|
+
...restProps
|
|
30
|
+
}),
|
|
31
|
+
suffix != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.InputGroupAddon, {
|
|
32
|
+
align: "inline-end",
|
|
33
|
+
className: suffixClassName,
|
|
34
|
+
children: suffix
|
|
35
|
+
}) : null
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
exports.Input = Input;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
2
|
+
import { InputProps } from "@pixpilot/shadcn";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/input/Input.d.ts
|
|
6
|
+
type InputProps$1 = InputProps & {
|
|
7
|
+
prefix?: React$1.ReactNode;
|
|
8
|
+
suffix?: React$1.ReactNode;
|
|
9
|
+
groupClassName?: string;
|
|
10
|
+
prefixClassName?: string;
|
|
11
|
+
suffixClassName?: string;
|
|
12
|
+
};
|
|
13
|
+
declare function Input(props: InputProps$1): react_jsx_runtime7.JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Input, InputProps$1 as InputProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { InputProps } from "@pixpilot/shadcn";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import * as react_jsx_runtime8 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/input/Input.d.ts
|
|
6
|
+
type InputProps$1 = InputProps & {
|
|
7
|
+
prefix?: React$1.ReactNode;
|
|
8
|
+
suffix?: React$1.ReactNode;
|
|
9
|
+
groupClassName?: string;
|
|
10
|
+
prefixClassName?: string;
|
|
11
|
+
suffixClassName?: string;
|
|
12
|
+
};
|
|
13
|
+
declare function Input$1(props: InputProps$1): react_jsx_runtime8.JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Input$1 as Input, InputProps$1 as InputProps };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Input, InputGroup, InputGroupAddon, InputGroupInput, cn } from "@pixpilot/shadcn";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/input/Input.tsx
|
|
6
|
+
function Input$1(props) {
|
|
7
|
+
const { prefix, suffix, groupClassName, prefixClassName, suffixClassName, className, disabled,...restProps } = props;
|
|
8
|
+
if (prefix == null && suffix == null) return /* @__PURE__ */ jsx(Input, {
|
|
9
|
+
className,
|
|
10
|
+
disabled,
|
|
11
|
+
...restProps
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ jsxs(InputGroup, {
|
|
14
|
+
className: cn(groupClassName),
|
|
15
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
16
|
+
children: [
|
|
17
|
+
prefix != null ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
18
|
+
align: "inline-start",
|
|
19
|
+
className: prefixClassName,
|
|
20
|
+
children: prefix
|
|
21
|
+
}) : null,
|
|
22
|
+
/* @__PURE__ */ jsx(InputGroupInput, {
|
|
23
|
+
className,
|
|
24
|
+
disabled,
|
|
25
|
+
...restProps
|
|
26
|
+
}),
|
|
27
|
+
suffix != null ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
28
|
+
align: "inline-end",
|
|
29
|
+
className: suffixClassName,
|
|
30
|
+
children: suffix
|
|
31
|
+
}) : null
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { Input$1 as Input };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const require_Input = require('./Input.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Input, InputProps } from "./Input.cjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Input, InputProps } from "./Input.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Input } from "./Input.js";
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_use_controlled = require('../hooks/src/use-controlled.cjs');
|
|
3
3
|
require('../hooks/src/index.cjs');
|
|
4
|
+
const require_Input = require('../input/Input.cjs');
|
|
4
5
|
const require_Slider = require('./Slider.cjs');
|
|
5
|
-
|
|
6
|
-
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
6
|
+
require('../index.cjs');
|
|
7
7
|
let react = require("react");
|
|
8
8
|
react = require_rolldown_runtime.__toESM(react);
|
|
9
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
10
|
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
11
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
12
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
11
13
|
|
|
12
14
|
//#region src/slider/SliderInput.tsx
|
|
13
15
|
function clampNumber(input, min, max) {
|
|
@@ -56,16 +58,16 @@ const SliderInput = (props) => {
|
|
|
56
58
|
disabled,
|
|
57
59
|
value: currentValue,
|
|
58
60
|
onValueChange: handleValueChange
|
|
59
|
-
}), showInput && Array.isArray(currentValue) && currentValue.map((v, i) => /* @__PURE__ */ (0, react.createElement)(
|
|
60
|
-
...input,
|
|
61
|
+
}), showInput && Array.isArray(currentValue) && currentValue.map((v, i) => /* @__PURE__ */ (0, react.createElement)(require_Input.Input, {
|
|
61
62
|
id: id ?? `${id}-input-${i}`,
|
|
63
|
+
disabled,
|
|
64
|
+
...input,
|
|
62
65
|
key: inputKeysRef.current[i],
|
|
63
66
|
type: "number",
|
|
64
67
|
value: v,
|
|
65
68
|
min,
|
|
66
69
|
max,
|
|
67
70
|
step,
|
|
68
|
-
disabled,
|
|
69
71
|
onChange: (e) => {
|
|
70
72
|
const nextNumber = e.currentTarget.valueAsNumber;
|
|
71
73
|
if (Number.isNaN(nextNumber)) return;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { InputProps } from "../input/Input.cjs";
|
|
1
2
|
import { Slider } from "./Slider.cjs";
|
|
3
|
+
import "../index.cjs";
|
|
2
4
|
import React from "react";
|
|
3
5
|
|
|
4
6
|
//#region src/slider/SliderInput.d.ts
|
|
5
7
|
interface SliderInputProps extends React.ComponentProps<typeof Slider> {
|
|
6
8
|
showInput?: boolean;
|
|
7
|
-
input?:
|
|
8
|
-
className?: string;
|
|
9
|
-
};
|
|
9
|
+
input?: InputProps;
|
|
10
10
|
slider?: {
|
|
11
11
|
className?: string;
|
|
12
12
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { InputProps } from "../input/Input.js";
|
|
1
2
|
import { Slider } from "./Slider.js";
|
|
3
|
+
import "../index.js";
|
|
2
4
|
import React from "react";
|
|
3
5
|
|
|
4
6
|
//#region src/slider/SliderInput.d.ts
|
|
5
7
|
interface SliderInputProps extends React.ComponentProps<typeof Slider> {
|
|
6
8
|
showInput?: boolean;
|
|
7
|
-
input?:
|
|
8
|
-
className?: string;
|
|
9
|
-
};
|
|
9
|
+
input?: InputProps;
|
|
10
10
|
slider?: {
|
|
11
11
|
className?: string;
|
|
12
12
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import useControlled from "../hooks/src/use-controlled.js";
|
|
2
2
|
import "../hooks/src/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Input } from "../input/Input.js";
|
|
4
|
+
import { Slider } from "./Slider.js";
|
|
5
|
+
import { cn } from "../index.js";
|
|
5
6
|
import React, { createElement } from "react";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
|
|
@@ -42,7 +43,7 @@ const SliderInput = (props) => {
|
|
|
42
43
|
id,
|
|
43
44
|
className: "flex items-center gap-2",
|
|
44
45
|
style,
|
|
45
|
-
children: [/* @__PURE__ */ jsx(Slider
|
|
46
|
+
children: [/* @__PURE__ */ jsx(Slider, {
|
|
46
47
|
...rest,
|
|
47
48
|
className: slider?.className,
|
|
48
49
|
id: id ?? `${id}-slider`,
|
|
@@ -53,15 +54,15 @@ const SliderInput = (props) => {
|
|
|
53
54
|
value: currentValue,
|
|
54
55
|
onValueChange: handleValueChange
|
|
55
56
|
}), showInput && Array.isArray(currentValue) && currentValue.map((v, i) => /* @__PURE__ */ createElement(Input, {
|
|
56
|
-
...input,
|
|
57
57
|
id: id ?? `${id}-input-${i}`,
|
|
58
|
+
disabled,
|
|
59
|
+
...input,
|
|
58
60
|
key: inputKeysRef.current[i],
|
|
59
61
|
type: "number",
|
|
60
62
|
value: v,
|
|
61
63
|
min,
|
|
62
64
|
max,
|
|
63
65
|
step,
|
|
64
|
-
disabled,
|
|
65
66
|
onChange: (e) => {
|
|
66
67
|
const nextNumber = e.currentTarget.valueAsNumber;
|
|
67
68
|
if (Number.isNaN(nextNumber)) return;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_use_controlled = require('../hooks/src/use-controlled.cjs');
|
|
3
|
+
require('../hooks/src/index.cjs');
|
|
4
|
+
const require_Select = require('../Select.cjs');
|
|
5
|
+
const require_Slider = require('./Slider.cjs');
|
|
6
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
7
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
8
|
+
let react = require("react");
|
|
9
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
12
|
+
|
|
13
|
+
//#region src/slider/SliderSelect.tsx
|
|
14
|
+
function normalizeOptions(options) {
|
|
15
|
+
return options.map((option) => {
|
|
16
|
+
if (typeof option === "object" && option !== null && "value" in option) return {
|
|
17
|
+
value: option.value,
|
|
18
|
+
label: option.label ?? String(option.value)
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
value: option,
|
|
22
|
+
label: String(option)
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const SliderSelect = (props) => {
|
|
27
|
+
const { options, value: valueProp, defaultValue, onValueChange, disabled, id, className, style, showSelect = true, select, slider,...rest } = props;
|
|
28
|
+
const { containerClassName: selectContainerClassName,...selectProps } = select ?? {};
|
|
29
|
+
const normalizedOptions = react.default.useMemo(() => normalizeOptions(options), [options]);
|
|
30
|
+
const hasOptions = normalizedOptions.length > 0;
|
|
31
|
+
const [currentValue, setCurrentValue] = require_use_controlled.default({
|
|
32
|
+
controlled: valueProp,
|
|
33
|
+
default: react.default.useMemo(() => {
|
|
34
|
+
if (defaultValue !== void 0) return defaultValue;
|
|
35
|
+
if (valueProp !== void 0) return valueProp;
|
|
36
|
+
return hasOptions ? normalizedOptions[0].value : "";
|
|
37
|
+
}, [
|
|
38
|
+
defaultValue,
|
|
39
|
+
valueProp,
|
|
40
|
+
hasOptions,
|
|
41
|
+
normalizedOptions
|
|
42
|
+
]),
|
|
43
|
+
name: "SliderSelect",
|
|
44
|
+
state: "value"
|
|
45
|
+
});
|
|
46
|
+
const currentIndex = react.default.useMemo(() => {
|
|
47
|
+
const idx = normalizedOptions.findIndex((o) => o.value === currentValue);
|
|
48
|
+
return idx >= 0 ? idx : 0;
|
|
49
|
+
}, [currentValue, normalizedOptions]);
|
|
50
|
+
const handleOptionChange = (nextValue) => {
|
|
51
|
+
setCurrentValue(nextValue);
|
|
52
|
+
onValueChange?.(nextValue);
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
55
|
+
id,
|
|
56
|
+
className: (0, __pixpilot_shadcn.cn)("flex items-center gap-2", className),
|
|
57
|
+
style,
|
|
58
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Slider.Slider, {
|
|
59
|
+
...rest,
|
|
60
|
+
className: slider?.className,
|
|
61
|
+
id: id != null ? `${id}-slider` : void 0,
|
|
62
|
+
min: 0,
|
|
63
|
+
max: Math.max(0, normalizedOptions.length - 1),
|
|
64
|
+
step: 1,
|
|
65
|
+
disabled: disabled || !hasOptions,
|
|
66
|
+
value: [currentIndex],
|
|
67
|
+
onValueChange: (next) => {
|
|
68
|
+
const index = next[0] ?? 0;
|
|
69
|
+
const option = normalizedOptions[Math.max(0, Math.min(index, normalizedOptions.length - 1))];
|
|
70
|
+
if (!option) return;
|
|
71
|
+
handleOptionChange(option.value);
|
|
72
|
+
}
|
|
73
|
+
}), showSelect && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
74
|
+
className: (0, __pixpilot_shadcn.cn)("w-28", selectContainerClassName),
|
|
75
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Select.Select, {
|
|
76
|
+
...selectProps,
|
|
77
|
+
contentProps: {
|
|
78
|
+
position: "item-aligned",
|
|
79
|
+
...selectProps.contentProps
|
|
80
|
+
},
|
|
81
|
+
options: normalizedOptions.map((o) => ({
|
|
82
|
+
value: o.value,
|
|
83
|
+
label: o.label
|
|
84
|
+
})),
|
|
85
|
+
value: String(currentValue ?? ""),
|
|
86
|
+
onChange: (v) => {
|
|
87
|
+
const matched = normalizedOptions.find((o) => String(o.value) === v);
|
|
88
|
+
if (!matched) return;
|
|
89
|
+
handleOptionChange(matched.value);
|
|
90
|
+
},
|
|
91
|
+
disabled: disabled || !hasOptions
|
|
92
|
+
})
|
|
93
|
+
})]
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
SliderSelect.displayName = "SliderSelect";
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
99
|
+
exports.SliderSelect = SliderSelect;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Select } from "../Select.cjs";
|
|
2
|
+
import { Slider } from "./Slider.cjs";
|
|
3
|
+
import React, { ComponentProps } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/slider/SliderSelect.d.ts
|
|
6
|
+
type SliderSelectValue = string | number;
|
|
7
|
+
type SliderSelectOption = SliderSelectValue | {
|
|
8
|
+
value: SliderSelectValue;
|
|
9
|
+
label?: string;
|
|
10
|
+
};
|
|
11
|
+
type SliderSelectSelectProps = Omit<ComponentProps<typeof Select>, 'options' | 'value' | 'onChange'> & {
|
|
12
|
+
containerClassName?: string;
|
|
13
|
+
};
|
|
14
|
+
interface SliderSelectProps extends Omit<ComponentProps<typeof Slider>, 'min' | 'max' | 'step' | 'value' | 'defaultValue' | 'onValueChange'> {
|
|
15
|
+
options: SliderSelectOption[];
|
|
16
|
+
value?: SliderSelectValue;
|
|
17
|
+
defaultValue?: SliderSelectValue;
|
|
18
|
+
onValueChange?: (value: SliderSelectValue) => void;
|
|
19
|
+
showSelect?: boolean;
|
|
20
|
+
select?: SliderSelectSelectProps;
|
|
21
|
+
slider?: {
|
|
22
|
+
className?: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
declare const SliderSelect: React.FC<SliderSelectProps>;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { SliderSelect, SliderSelectOption, SliderSelectProps, SliderSelectValue };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Select } from "../Select.js";
|
|
2
|
+
import { Slider } from "./Slider.js";
|
|
3
|
+
import React, { ComponentProps } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/slider/SliderSelect.d.ts
|
|
6
|
+
type SliderSelectValue = string | number;
|
|
7
|
+
type SliderSelectOption = SliderSelectValue | {
|
|
8
|
+
value: SliderSelectValue;
|
|
9
|
+
label?: string;
|
|
10
|
+
};
|
|
11
|
+
type SliderSelectSelectProps = Omit<ComponentProps<typeof Select>, 'options' | 'value' | 'onChange'> & {
|
|
12
|
+
containerClassName?: string;
|
|
13
|
+
};
|
|
14
|
+
interface SliderSelectProps extends Omit<ComponentProps<typeof Slider>, 'min' | 'max' | 'step' | 'value' | 'defaultValue' | 'onValueChange'> {
|
|
15
|
+
options: SliderSelectOption[];
|
|
16
|
+
value?: SliderSelectValue;
|
|
17
|
+
defaultValue?: SliderSelectValue;
|
|
18
|
+
onValueChange?: (value: SliderSelectValue) => void;
|
|
19
|
+
showSelect?: boolean;
|
|
20
|
+
select?: SliderSelectSelectProps;
|
|
21
|
+
slider?: {
|
|
22
|
+
className?: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
declare const SliderSelect: React.FC<SliderSelectProps>;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { SliderSelect, SliderSelectOption, SliderSelectProps, SliderSelectValue };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import useControlled from "../hooks/src/use-controlled.js";
|
|
2
|
+
import "../hooks/src/index.js";
|
|
3
|
+
import { Select as Select$1 } from "../Select.js";
|
|
4
|
+
import { Slider as Slider$1 } from "./Slider.js";
|
|
5
|
+
import { cn } from "@pixpilot/shadcn";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/slider/SliderSelect.tsx
|
|
10
|
+
function normalizeOptions(options) {
|
|
11
|
+
return options.map((option) => {
|
|
12
|
+
if (typeof option === "object" && option !== null && "value" in option) return {
|
|
13
|
+
value: option.value,
|
|
14
|
+
label: option.label ?? String(option.value)
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
value: option,
|
|
18
|
+
label: String(option)
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const SliderSelect = (props) => {
|
|
23
|
+
const { options, value: valueProp, defaultValue, onValueChange, disabled, id, className, style, showSelect = true, select, slider,...rest } = props;
|
|
24
|
+
const { containerClassName: selectContainerClassName,...selectProps } = select ?? {};
|
|
25
|
+
const normalizedOptions = React.useMemo(() => normalizeOptions(options), [options]);
|
|
26
|
+
const hasOptions = normalizedOptions.length > 0;
|
|
27
|
+
const [currentValue, setCurrentValue] = useControlled({
|
|
28
|
+
controlled: valueProp,
|
|
29
|
+
default: React.useMemo(() => {
|
|
30
|
+
if (defaultValue !== void 0) return defaultValue;
|
|
31
|
+
if (valueProp !== void 0) return valueProp;
|
|
32
|
+
return hasOptions ? normalizedOptions[0].value : "";
|
|
33
|
+
}, [
|
|
34
|
+
defaultValue,
|
|
35
|
+
valueProp,
|
|
36
|
+
hasOptions,
|
|
37
|
+
normalizedOptions
|
|
38
|
+
]),
|
|
39
|
+
name: "SliderSelect",
|
|
40
|
+
state: "value"
|
|
41
|
+
});
|
|
42
|
+
const currentIndex = React.useMemo(() => {
|
|
43
|
+
const idx = normalizedOptions.findIndex((o) => o.value === currentValue);
|
|
44
|
+
return idx >= 0 ? idx : 0;
|
|
45
|
+
}, [currentValue, normalizedOptions]);
|
|
46
|
+
const handleOptionChange = (nextValue) => {
|
|
47
|
+
setCurrentValue(nextValue);
|
|
48
|
+
onValueChange?.(nextValue);
|
|
49
|
+
};
|
|
50
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
51
|
+
id,
|
|
52
|
+
className: cn("flex items-center gap-2", className),
|
|
53
|
+
style,
|
|
54
|
+
children: [/* @__PURE__ */ jsx(Slider$1, {
|
|
55
|
+
...rest,
|
|
56
|
+
className: slider?.className,
|
|
57
|
+
id: id != null ? `${id}-slider` : void 0,
|
|
58
|
+
min: 0,
|
|
59
|
+
max: Math.max(0, normalizedOptions.length - 1),
|
|
60
|
+
step: 1,
|
|
61
|
+
disabled: disabled || !hasOptions,
|
|
62
|
+
value: [currentIndex],
|
|
63
|
+
onValueChange: (next) => {
|
|
64
|
+
const index = next[0] ?? 0;
|
|
65
|
+
const option = normalizedOptions[Math.max(0, Math.min(index, normalizedOptions.length - 1))];
|
|
66
|
+
if (!option) return;
|
|
67
|
+
handleOptionChange(option.value);
|
|
68
|
+
}
|
|
69
|
+
}), showSelect && /* @__PURE__ */ jsx("div", {
|
|
70
|
+
className: cn("w-28", selectContainerClassName),
|
|
71
|
+
children: /* @__PURE__ */ jsx(Select$1, {
|
|
72
|
+
...selectProps,
|
|
73
|
+
contentProps: {
|
|
74
|
+
position: "item-aligned",
|
|
75
|
+
...selectProps.contentProps
|
|
76
|
+
},
|
|
77
|
+
options: normalizedOptions.map((o) => ({
|
|
78
|
+
value: o.value,
|
|
79
|
+
label: o.label
|
|
80
|
+
})),
|
|
81
|
+
value: String(currentValue ?? ""),
|
|
82
|
+
onChange: (v) => {
|
|
83
|
+
const matched = normalizedOptions.find((o) => String(o.value) === v);
|
|
84
|
+
if (!matched) return;
|
|
85
|
+
handleOptionChange(matched.value);
|
|
86
|
+
},
|
|
87
|
+
disabled: disabled || !hasOptions
|
|
88
|
+
})
|
|
89
|
+
})]
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
SliderSelect.displayName = "SliderSelect";
|
|
93
|
+
|
|
94
|
+
//#endregion
|
|
95
|
+
export { SliderSelect };
|
package/dist/slider/index.cjs
CHANGED
package/dist/slider/index.d.cts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { Slider, SliderProps } from "./Slider.cjs";
|
|
2
|
-
import { SliderInput, SliderInputProps } from "./SliderInput.cjs";
|
|
2
|
+
import { SliderInput, SliderInputProps } from "./SliderInput.cjs";
|
|
3
|
+
import { SliderSelect, SliderSelectOption, SliderSelectProps, SliderSelectValue } from "./SliderSelect.cjs";
|
package/dist/slider/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { Slider, SliderProps } from "./Slider.js";
|
|
2
|
-
import { SliderInput, SliderInputProps } from "./SliderInput.js";
|
|
2
|
+
import { SliderInput, SliderInputProps } from "./SliderInput.js";
|
|
3
|
+
import { SliderSelect, SliderSelectOption, SliderSelectProps, SliderSelectValue } from "./SliderSelect.js";
|
package/dist/slider/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixpilot/shadcn-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.17.0",
|
|
5
5
|
"description": "Custom UI components and utilities built with shadcn/ui.",
|
|
6
6
|
"author": "m.doaie <m.doaie@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"pretty-bytes": "^7.1.0",
|
|
45
45
|
"react-responsive": "^10.0.1",
|
|
46
46
|
"sonner": "2.0.7",
|
|
47
|
-
"@pixpilot/shadcn": "0.
|
|
47
|
+
"@pixpilot/shadcn": "0.7.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@storybook/react": "^8.6.14",
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"react-dom": "19.2.0",
|
|
58
58
|
"tsdown": "^0.15.12",
|
|
59
59
|
"typescript": "^5.9.3",
|
|
60
|
-
"@internal/prettier-config": "0.0.1",
|
|
61
|
-
"@internal/hooks": "0.0.0",
|
|
62
60
|
"@internal/eslint-config": "0.3.0",
|
|
63
|
-
"@internal/
|
|
61
|
+
"@internal/hooks": "0.0.0",
|
|
62
|
+
"@internal/prettier-config": "0.0.1",
|
|
64
63
|
"@internal/tsconfig": "0.1.0",
|
|
64
|
+
"@internal/tsdown-config": "0.1.0",
|
|
65
65
|
"@internal/vitest-config": "0.1.0"
|
|
66
66
|
},
|
|
67
67
|
"prettier": "@internal/prettier-config",
|