@pixpilot/shadcn-ui 0.65.0 → 0.67.1
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/Button.cjs +11 -77
- package/dist/Button.d.cts +1 -24
- package/dist/Button.d.ts +1 -24
- package/dist/Button.js +13 -78
- package/dist/ButtonExtended.cjs +104 -0
- package/dist/ButtonExtended.d.cts +58 -0
- package/dist/ButtonExtended.d.ts +58 -0
- package/dist/ButtonExtended.js +99 -0
- package/dist/ColorSelect.d.cts +2 -2
- package/dist/ColorSelect.d.ts +2 -2
- package/dist/ContentCard.d.cts +2 -2
- package/dist/ContentCard.d.ts +2 -2
- package/dist/DatePicker.d.cts +2 -2
- package/dist/DatePicker.d.ts +2 -2
- package/dist/IconToggle.cjs +44 -66
- package/dist/IconToggle.d.cts +2 -46
- package/dist/IconToggle.d.ts +2 -46
- package/dist/IconToggle.js +45 -66
- package/dist/Rating.d.cts +4 -4
- package/dist/Rating.d.ts +4 -4
- package/dist/Select.d.cts +2 -2
- package/dist/Select.d.ts +2 -2
- package/dist/ToggleButton.cjs +46 -0
- package/dist/ToggleButton.d.cts +41 -0
- package/dist/ToggleButton.d.ts +41 -0
- package/dist/ToggleButton.js +43 -0
- package/dist/dialog/Dialog.d.cts +4 -4
- package/dist/dialog/Dialog.d.ts +4 -4
- package/dist/file-upload/FileUpload.d.cts +2 -2
- package/dist/file-upload/FileUpload.d.ts +2 -2
- package/dist/file-upload-inline/FileUploadInline.d.ts +2 -2
- package/dist/file-upload-root/FileUploadRoot.d.ts +2 -2
- package/dist/index.cjs +4 -0
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/input/Input.d.cts +2 -2
- package/dist/input/Input.d.ts +2 -2
- package/dist/tags-input/TagsInput.d.cts +2 -2
- package/dist/tags-input/TagsInput.d.ts +2 -2
- package/dist/tags-input/TagsInputInline.d.ts +2 -2
- package/dist/theme-toggle/ThemeModeDropdown.d.cts +2 -2
- package/dist/theme-toggle/ThemeModeDropdown.d.ts +2 -2
- package/dist/theme-toggle/ThemeModeSwitchInside.d.cts +2 -2
- package/dist/theme-toggle/ThemeModeSwitchInside.d.ts +2 -2
- package/dist/theme-toggle/ThemeModeSwitchOutside.d.cts +2 -2
- package/dist/theme-toggle/ThemeModeSwitchOutside.d.ts +2 -2
- package/dist/theme-toggle/ThemeModeToggleButton.d.cts +2 -2
- package/dist/theme-toggle/ThemeModeToggleButton.d.ts +2 -2
- package/package.json +2 -2
package/dist/ContentCard.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Card } from "@pixpilot/shadcn";
|
|
2
2
|
import React, { ReactNode } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/ContentCard.d.ts
|
|
6
6
|
interface SectionCardProps extends React.ComponentProps<typeof Card> {
|
|
@@ -8,7 +8,7 @@ interface SectionCardProps extends React.ComponentProps<typeof Card> {
|
|
|
8
8
|
children: ReactNode;
|
|
9
9
|
marginBottom?: boolean;
|
|
10
10
|
}
|
|
11
|
-
declare function ContentCard(props: SectionCardProps):
|
|
11
|
+
declare function ContentCard(props: SectionCardProps): react_jsx_runtime3.JSX.Element;
|
|
12
12
|
declare namespace ContentCard {
|
|
13
13
|
var displayName: string;
|
|
14
14
|
}
|
package/dist/DatePicker.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
2
2
|
import { Calendar } from "@pixpilot/shadcn";
|
|
3
3
|
import { ComponentProps } from "react";
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ type DatePickerProps = {
|
|
|
8
8
|
onChange?: (date: Date | undefined) => void;
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
} & Omit<ComponentProps<typeof Calendar>, 'selected' | 'onSelect' | 'mode'>;
|
|
11
|
-
declare function DatePicker(props: DatePickerProps):
|
|
11
|
+
declare function DatePicker(props: DatePickerProps): react_jsx_runtime4.JSX.Element;
|
|
12
12
|
declare namespace DatePicker {
|
|
13
13
|
var displayName: string;
|
|
14
14
|
}
|
package/dist/DatePicker.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Calendar } from "@pixpilot/shadcn";
|
|
2
2
|
import { ComponentProps } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/DatePicker.d.ts
|
|
6
6
|
type DatePickerProps = {
|
|
@@ -8,7 +8,7 @@ type DatePickerProps = {
|
|
|
8
8
|
onChange?: (date: Date | undefined) => void;
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
} & Omit<ComponentProps<typeof Calendar>, 'selected' | 'onSelect' | 'mode'>;
|
|
11
|
-
declare function DatePicker(props: DatePickerProps):
|
|
11
|
+
declare function DatePicker(props: DatePickerProps): react_jsx_runtime4.JSX.Element;
|
|
12
12
|
declare namespace DatePicker {
|
|
13
13
|
var displayName: string;
|
|
14
14
|
}
|
package/dist/IconToggle.cjs
CHANGED
|
@@ -1,86 +1,64 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_ToggleButton = require('./ToggleButton.cjs');
|
|
2
3
|
const require_svg = require('./utils/svg.cjs');
|
|
3
|
-
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
4
|
-
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
5
4
|
let react = require("react");
|
|
6
5
|
react = require_rolldown_runtime.__toESM(react);
|
|
7
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
7
|
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
9
8
|
|
|
10
9
|
//#region src/IconToggle.tsx
|
|
11
|
-
|
|
12
|
-
* IconToggle - A toggle button component with customizable icons for checked/unchecked states.
|
|
13
|
-
* Perfect for visibility toggles, theme switches, or any boolean state with visual feedback.
|
|
14
|
-
* Icons can be React components (like lucide-react icons) or SVG markup strings.
|
|
15
|
-
*/
|
|
16
|
-
const IconToggle = react.default.forwardRef(({ checked: controlledChecked, defaultChecked = false, onCheckedChange, onChange, checkedIcon, uncheckedIcon, size = "default", variant = "default", iconSize = "1rem", className, disabled, style: styleProp,...props }, ref) => {
|
|
17
|
-
const [uncontrolledChecked, setUncontrolledChecked] = react.default.useState(defaultChecked);
|
|
18
|
-
const resolvedIconSize = typeof iconSize === "number" ? `${iconSize}px` : iconSize;
|
|
19
|
-
const isControlled = controlledChecked !== void 0;
|
|
20
|
-
const checked = isControlled ? controlledChecked : uncontrolledChecked;
|
|
21
|
-
const handleClick = (0, react.useCallback)((e) => {
|
|
22
|
-
if (disabled) return;
|
|
23
|
-
const newChecked = !checked;
|
|
24
|
-
if (!isControlled) setUncontrolledChecked(newChecked);
|
|
25
|
-
onCheckedChange?.(newChecked);
|
|
26
|
-
onChange?.(newChecked);
|
|
27
|
-
props.onClick?.(e);
|
|
28
|
-
}, [
|
|
29
|
-
checked,
|
|
30
|
-
disabled,
|
|
31
|
-
isControlled,
|
|
32
|
-
onChange,
|
|
33
|
-
onCheckedChange,
|
|
34
|
-
props
|
|
35
|
-
]);
|
|
36
|
-
const renderIcon = (icon) => {
|
|
37
|
-
if (icon === void 0 || icon === null) return null;
|
|
38
|
-
if (require_svg.isSvgMarkupString(icon)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
39
|
-
"data-slot": "svg-mask",
|
|
40
|
-
"aria-hidden": "true",
|
|
41
|
-
className: "inline-block",
|
|
42
|
-
style: {
|
|
43
|
-
width: "var(--icon-toggle-icon-size)",
|
|
44
|
-
height: "var(--icon-toggle-icon-size)",
|
|
45
|
-
backgroundColor: "currentColor",
|
|
46
|
-
WebkitMaskImage: require_svg.svgMarkupToMaskUrl(icon),
|
|
47
|
-
maskImage: require_svg.svgMarkupToMaskUrl(icon),
|
|
48
|
-
WebkitMaskRepeat: "no-repeat",
|
|
49
|
-
maskRepeat: "no-repeat",
|
|
50
|
-
WebkitMaskPosition: "center",
|
|
51
|
-
maskPosition: "center",
|
|
52
|
-
WebkitMaskSize: "contain",
|
|
53
|
-
maskSize: "contain"
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
return icon;
|
|
57
|
-
};
|
|
10
|
+
const IconToggle = react.default.forwardRef(({ checkedIcon, uncheckedIcon, size = "default", variant = "outline", iconSize, style, className,...props }, ref) => {
|
|
58
11
|
const sizeClasses = {
|
|
59
12
|
sm: "size-7",
|
|
60
13
|
default: "size-9",
|
|
61
14
|
lg: "size-11"
|
|
62
15
|
};
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
16
|
+
const resolvedIconSize = iconSize ?? {
|
|
17
|
+
sm: "14px",
|
|
18
|
+
default: "16px",
|
|
19
|
+
lg: "20px"
|
|
20
|
+
}[size];
|
|
21
|
+
const renderIcon = (icon) => {
|
|
22
|
+
if (icon == null) return null;
|
|
23
|
+
if (typeof icon === "string" && require_svg.isSvgMarkupString(icon)) {
|
|
24
|
+
const mask = require_svg.svgMarkupToMaskUrl(icon);
|
|
25
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
26
|
+
"aria-hidden": "true",
|
|
27
|
+
className: "inline-block",
|
|
28
|
+
style: {
|
|
29
|
+
width: "var(--icon-size)",
|
|
30
|
+
height: "var(--icon-size)",
|
|
31
|
+
flexShrink: 0,
|
|
32
|
+
backgroundColor: "currentColor",
|
|
33
|
+
WebkitMaskImage: mask,
|
|
34
|
+
maskImage: mask,
|
|
35
|
+
WebkitMaskRepeat: "no-repeat",
|
|
36
|
+
maskRepeat: "no-repeat",
|
|
37
|
+
WebkitMaskPosition: "center",
|
|
38
|
+
maskPosition: "center",
|
|
39
|
+
WebkitMaskSize: "contain",
|
|
40
|
+
maskSize: "contain"
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return icon;
|
|
67
45
|
};
|
|
68
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
69
|
-
type: "button",
|
|
70
|
-
role: "switch",
|
|
71
|
-
"data-slot": "icon-toggle",
|
|
72
|
-
...props,
|
|
73
|
-
disabled,
|
|
46
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ToggleButton.ToggleButton, {
|
|
74
47
|
ref,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
48
|
+
...props,
|
|
49
|
+
checkedContent: renderIcon(checkedIcon),
|
|
50
|
+
uncheckedContent: renderIcon(uncheckedIcon),
|
|
51
|
+
variant,
|
|
79
52
|
style: {
|
|
80
|
-
...
|
|
81
|
-
["--icon-
|
|
53
|
+
...style ?? {},
|
|
54
|
+
["--icon-size"]: resolvedIconSize
|
|
82
55
|
},
|
|
83
|
-
|
|
56
|
+
className: [
|
|
57
|
+
"inline-flex items-center justify-center rounded-md text-sm font-medium transition-all outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50",
|
|
58
|
+
"[&_svg]:pointer-events-none [&_svg:not([class*=\"size-\"])]:size-[var(--icon-size)] [&_svg]:shrink-0",
|
|
59
|
+
sizeClasses[size],
|
|
60
|
+
className
|
|
61
|
+
].filter(Boolean).join(" ")
|
|
84
62
|
});
|
|
85
63
|
});
|
|
86
64
|
IconToggle.displayName = "IconToggle";
|
package/dist/IconToggle.d.cts
CHANGED
|
@@ -1,57 +1,13 @@
|
|
|
1
|
+
import { ToggleButtonProps } from "./ToggleButton.cjs";
|
|
1
2
|
import React from "react";
|
|
2
3
|
|
|
3
4
|
//#region src/IconToggle.d.ts
|
|
4
|
-
interface IconToggleProps extends Omit<
|
|
5
|
-
/**
|
|
6
|
-
* The checked/toggled state
|
|
7
|
-
*/
|
|
8
|
-
checked?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Default checked state for uncontrolled usage
|
|
11
|
-
*/
|
|
12
|
-
defaultChecked?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Called when the toggle state changes (controlled)
|
|
15
|
-
*/
|
|
16
|
-
onCheckedChange?: (checked: boolean) => void;
|
|
17
|
-
/**
|
|
18
|
-
* Called when the toggle state changes (alternative handler)
|
|
19
|
-
*/
|
|
20
|
-
onChange?: (checked: boolean) => void;
|
|
21
|
-
/**
|
|
22
|
-
* Icon to show when checked (true state)
|
|
23
|
-
* Can be a React component (like lucide-react icons) or SVG markup string
|
|
24
|
-
*/
|
|
5
|
+
interface IconToggleProps extends Omit<ToggleButtonProps, 'checkedContent' | 'uncheckedContent'> {
|
|
25
6
|
checkedIcon?: React.ReactNode | string;
|
|
26
|
-
/**
|
|
27
|
-
* Icon to show when unchecked (false state)
|
|
28
|
-
* Can be a React component (like lucide-react icons) or SVG markup string
|
|
29
|
-
*/
|
|
30
7
|
uncheckedIcon?: React.ReactNode | string;
|
|
31
|
-
/**
|
|
32
|
-
* Size variant of the toggle button
|
|
33
|
-
* @default 'default'
|
|
34
|
-
*/
|
|
35
8
|
size?: 'sm' | 'default' | 'lg';
|
|
36
|
-
/**
|
|
37
|
-
* Visual variant of the toggle button
|
|
38
|
-
* @default 'default'
|
|
39
|
-
*/
|
|
40
|
-
variant?: 'default' | 'outline' | 'ghost';
|
|
41
|
-
/**
|
|
42
|
-
* Icon size for both React SVG icons (e.g. lucide-react) and SVG string masks.
|
|
43
|
-
* Provide any valid CSS length (e.g. `'16px'`, `'1.25rem'`) or a number (px).
|
|
44
|
-
*
|
|
45
|
-
* Note: This is independent of `font-size` (e.g. `text-lg`).
|
|
46
|
-
* @default '1rem'
|
|
47
|
-
*/
|
|
48
9
|
iconSize?: string | number;
|
|
49
10
|
}
|
|
50
|
-
/**
|
|
51
|
-
* IconToggle - A toggle button component with customizable icons for checked/unchecked states.
|
|
52
|
-
* Perfect for visibility toggles, theme switches, or any boolean state with visual feedback.
|
|
53
|
-
* Icons can be React components (like lucide-react icons) or SVG markup strings.
|
|
54
|
-
*/
|
|
55
11
|
declare const IconToggle: React.ForwardRefExoticComponent<Omit<IconToggleProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
56
12
|
//#endregion
|
|
57
13
|
export { IconToggle, IconToggleProps };
|
package/dist/IconToggle.d.ts
CHANGED
|
@@ -1,57 +1,13 @@
|
|
|
1
|
+
import { ToggleButtonProps } from "./ToggleButton.js";
|
|
1
2
|
import React from "react";
|
|
2
3
|
|
|
3
4
|
//#region src/IconToggle.d.ts
|
|
4
|
-
interface IconToggleProps extends Omit<
|
|
5
|
-
/**
|
|
6
|
-
* The checked/toggled state
|
|
7
|
-
*/
|
|
8
|
-
checked?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Default checked state for uncontrolled usage
|
|
11
|
-
*/
|
|
12
|
-
defaultChecked?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Called when the toggle state changes (controlled)
|
|
15
|
-
*/
|
|
16
|
-
onCheckedChange?: (checked: boolean) => void;
|
|
17
|
-
/**
|
|
18
|
-
* Called when the toggle state changes (alternative handler)
|
|
19
|
-
*/
|
|
20
|
-
onChange?: (checked: boolean) => void;
|
|
21
|
-
/**
|
|
22
|
-
* Icon to show when checked (true state)
|
|
23
|
-
* Can be a React component (like lucide-react icons) or SVG markup string
|
|
24
|
-
*/
|
|
5
|
+
interface IconToggleProps extends Omit<ToggleButtonProps, 'checkedContent' | 'uncheckedContent'> {
|
|
25
6
|
checkedIcon?: React.ReactNode | string;
|
|
26
|
-
/**
|
|
27
|
-
* Icon to show when unchecked (false state)
|
|
28
|
-
* Can be a React component (like lucide-react icons) or SVG markup string
|
|
29
|
-
*/
|
|
30
7
|
uncheckedIcon?: React.ReactNode | string;
|
|
31
|
-
/**
|
|
32
|
-
* Size variant of the toggle button
|
|
33
|
-
* @default 'default'
|
|
34
|
-
*/
|
|
35
8
|
size?: 'sm' | 'default' | 'lg';
|
|
36
|
-
/**
|
|
37
|
-
* Visual variant of the toggle button
|
|
38
|
-
* @default 'default'
|
|
39
|
-
*/
|
|
40
|
-
variant?: 'default' | 'outline' | 'ghost';
|
|
41
|
-
/**
|
|
42
|
-
* Icon size for both React SVG icons (e.g. lucide-react) and SVG string masks.
|
|
43
|
-
* Provide any valid CSS length (e.g. `'16px'`, `'1.25rem'`) or a number (px).
|
|
44
|
-
*
|
|
45
|
-
* Note: This is independent of `font-size` (e.g. `text-lg`).
|
|
46
|
-
* @default '1rem'
|
|
47
|
-
*/
|
|
48
9
|
iconSize?: string | number;
|
|
49
10
|
}
|
|
50
|
-
/**
|
|
51
|
-
* IconToggle - A toggle button component with customizable icons for checked/unchecked states.
|
|
52
|
-
* Perfect for visibility toggles, theme switches, or any boolean state with visual feedback.
|
|
53
|
-
* Icons can be React components (like lucide-react icons) or SVG markup strings.
|
|
54
|
-
*/
|
|
55
11
|
declare const IconToggle: React.ForwardRefExoticComponent<Omit<IconToggleProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
56
12
|
//#endregion
|
|
57
13
|
export { IconToggle, IconToggleProps };
|
package/dist/IconToggle.js
CHANGED
|
@@ -1,82 +1,61 @@
|
|
|
1
|
+
import { ToggleButton } from "./ToggleButton.js";
|
|
1
2
|
import { isSvgMarkupString, svgMarkupToMaskUrl } from "./utils/svg.js";
|
|
2
|
-
import
|
|
3
|
-
import React, { useCallback } from "react";
|
|
3
|
+
import React from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/IconToggle.tsx
|
|
7
|
-
|
|
8
|
-
* IconToggle - A toggle button component with customizable icons for checked/unchecked states.
|
|
9
|
-
* Perfect for visibility toggles, theme switches, or any boolean state with visual feedback.
|
|
10
|
-
* Icons can be React components (like lucide-react icons) or SVG markup strings.
|
|
11
|
-
*/
|
|
12
|
-
const IconToggle = React.forwardRef(({ checked: controlledChecked, defaultChecked = false, onCheckedChange, onChange, checkedIcon, uncheckedIcon, size = "default", variant = "default", iconSize = "1rem", className, disabled, style: styleProp,...props }, ref) => {
|
|
13
|
-
const [uncontrolledChecked, setUncontrolledChecked] = React.useState(defaultChecked);
|
|
14
|
-
const resolvedIconSize = typeof iconSize === "number" ? `${iconSize}px` : iconSize;
|
|
15
|
-
const isControlled = controlledChecked !== void 0;
|
|
16
|
-
const checked = isControlled ? controlledChecked : uncontrolledChecked;
|
|
17
|
-
const handleClick = useCallback((e) => {
|
|
18
|
-
if (disabled) return;
|
|
19
|
-
const newChecked = !checked;
|
|
20
|
-
if (!isControlled) setUncontrolledChecked(newChecked);
|
|
21
|
-
onCheckedChange?.(newChecked);
|
|
22
|
-
onChange?.(newChecked);
|
|
23
|
-
props.onClick?.(e);
|
|
24
|
-
}, [
|
|
25
|
-
checked,
|
|
26
|
-
disabled,
|
|
27
|
-
isControlled,
|
|
28
|
-
onChange,
|
|
29
|
-
onCheckedChange,
|
|
30
|
-
props
|
|
31
|
-
]);
|
|
32
|
-
const renderIcon = (icon) => {
|
|
33
|
-
if (icon === void 0 || icon === null) return null;
|
|
34
|
-
if (isSvgMarkupString(icon)) return /* @__PURE__ */ jsx("span", {
|
|
35
|
-
"data-slot": "svg-mask",
|
|
36
|
-
"aria-hidden": "true",
|
|
37
|
-
className: "inline-block",
|
|
38
|
-
style: {
|
|
39
|
-
width: "var(--icon-toggle-icon-size)",
|
|
40
|
-
height: "var(--icon-toggle-icon-size)",
|
|
41
|
-
backgroundColor: "currentColor",
|
|
42
|
-
WebkitMaskImage: svgMarkupToMaskUrl(icon),
|
|
43
|
-
maskImage: svgMarkupToMaskUrl(icon),
|
|
44
|
-
WebkitMaskRepeat: "no-repeat",
|
|
45
|
-
maskRepeat: "no-repeat",
|
|
46
|
-
WebkitMaskPosition: "center",
|
|
47
|
-
maskPosition: "center",
|
|
48
|
-
WebkitMaskSize: "contain",
|
|
49
|
-
maskSize: "contain"
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
return icon;
|
|
53
|
-
};
|
|
7
|
+
const IconToggle = React.forwardRef(({ checkedIcon, uncheckedIcon, size = "default", variant = "outline", iconSize, style, className,...props }, ref) => {
|
|
54
8
|
const sizeClasses = {
|
|
55
9
|
sm: "size-7",
|
|
56
10
|
default: "size-9",
|
|
57
11
|
lg: "size-11"
|
|
58
12
|
};
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
13
|
+
const resolvedIconSize = iconSize ?? {
|
|
14
|
+
sm: "14px",
|
|
15
|
+
default: "16px",
|
|
16
|
+
lg: "20px"
|
|
17
|
+
}[size];
|
|
18
|
+
const renderIcon = (icon) => {
|
|
19
|
+
if (icon == null) return null;
|
|
20
|
+
if (typeof icon === "string" && isSvgMarkupString(icon)) {
|
|
21
|
+
const mask = svgMarkupToMaskUrl(icon);
|
|
22
|
+
return /* @__PURE__ */ jsx("span", {
|
|
23
|
+
"aria-hidden": "true",
|
|
24
|
+
className: "inline-block",
|
|
25
|
+
style: {
|
|
26
|
+
width: "var(--icon-size)",
|
|
27
|
+
height: "var(--icon-size)",
|
|
28
|
+
flexShrink: 0,
|
|
29
|
+
backgroundColor: "currentColor",
|
|
30
|
+
WebkitMaskImage: mask,
|
|
31
|
+
maskImage: mask,
|
|
32
|
+
WebkitMaskRepeat: "no-repeat",
|
|
33
|
+
maskRepeat: "no-repeat",
|
|
34
|
+
WebkitMaskPosition: "center",
|
|
35
|
+
maskPosition: "center",
|
|
36
|
+
WebkitMaskSize: "contain",
|
|
37
|
+
maskSize: "contain"
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return icon;
|
|
63
42
|
};
|
|
64
|
-
return /* @__PURE__ */ jsx(
|
|
65
|
-
type: "button",
|
|
66
|
-
role: "switch",
|
|
67
|
-
"data-slot": "icon-toggle",
|
|
68
|
-
...props,
|
|
69
|
-
disabled,
|
|
43
|
+
return /* @__PURE__ */ jsx(ToggleButton, {
|
|
70
44
|
ref,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
45
|
+
...props,
|
|
46
|
+
checkedContent: renderIcon(checkedIcon),
|
|
47
|
+
uncheckedContent: renderIcon(uncheckedIcon),
|
|
48
|
+
variant,
|
|
75
49
|
style: {
|
|
76
|
-
...
|
|
77
|
-
["--icon-
|
|
50
|
+
...style ?? {},
|
|
51
|
+
["--icon-size"]: resolvedIconSize
|
|
78
52
|
},
|
|
79
|
-
|
|
53
|
+
className: [
|
|
54
|
+
"inline-flex items-center justify-center rounded-md text-sm font-medium transition-all outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50",
|
|
55
|
+
"[&_svg]:pointer-events-none [&_svg:not([class*=\"size-\"])]:size-[var(--icon-size)] [&_svg]:shrink-0",
|
|
56
|
+
sizeClasses[size],
|
|
57
|
+
className
|
|
58
|
+
].filter(Boolean).join(" ")
|
|
80
59
|
});
|
|
81
60
|
});
|
|
82
61
|
IconToggle.displayName = "IconToggle";
|
package/dist/Rating.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
2
2
|
import * as React$1 from "react";
|
|
3
3
|
import { VariantProps } from "class-variance-authority";
|
|
4
4
|
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
@@ -10,7 +10,7 @@ interface RatingOption {
|
|
|
10
10
|
value: number;
|
|
11
11
|
}
|
|
12
12
|
declare const ratingVariants: (props?: ({
|
|
13
|
-
size?: "
|
|
13
|
+
size?: "default" | "sm" | "lg" | "xl" | null | undefined;
|
|
14
14
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
15
15
|
type RatingSize = VariantProps<typeof ratingVariants>['size'];
|
|
16
16
|
type IconType = 'star' | 'circle';
|
|
@@ -35,7 +35,7 @@ declare function RatingButton({
|
|
|
35
35
|
index,
|
|
36
36
|
className,
|
|
37
37
|
...props
|
|
38
|
-
}: RatingButtonProps):
|
|
38
|
+
}: RatingButtonProps): react_jsx_runtime5.JSX.Element;
|
|
39
39
|
declare function Rating({
|
|
40
40
|
value: valueProp,
|
|
41
41
|
defaultValue,
|
|
@@ -52,6 +52,6 @@ declare function Rating({
|
|
|
52
52
|
className,
|
|
53
53
|
children,
|
|
54
54
|
...props
|
|
55
|
-
}: React$1.PropsWithChildren<RatingProps>):
|
|
55
|
+
}: React$1.PropsWithChildren<RatingProps>): react_jsx_runtime5.JSX.Element;
|
|
56
56
|
//#endregion
|
|
57
57
|
export { Rating, RatingButton, RatingButtonProps, RatingColor, RatingOption, RatingProps };
|
package/dist/Rating.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
3
3
|
import { VariantProps } from "class-variance-authority";
|
|
4
4
|
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
5
5
|
|
|
@@ -10,7 +10,7 @@ interface RatingOption {
|
|
|
10
10
|
value: number;
|
|
11
11
|
}
|
|
12
12
|
declare const ratingVariants: (props?: ({
|
|
13
|
-
size?: "
|
|
13
|
+
size?: "default" | "sm" | "lg" | "xl" | null | undefined;
|
|
14
14
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
15
15
|
type RatingSize = VariantProps<typeof ratingVariants>['size'];
|
|
16
16
|
type IconType = 'star' | 'circle';
|
|
@@ -35,7 +35,7 @@ declare function RatingButton({
|
|
|
35
35
|
index,
|
|
36
36
|
className,
|
|
37
37
|
...props
|
|
38
|
-
}: RatingButtonProps):
|
|
38
|
+
}: RatingButtonProps): react_jsx_runtime5.JSX.Element;
|
|
39
39
|
declare function Rating({
|
|
40
40
|
value: valueProp,
|
|
41
41
|
defaultValue,
|
|
@@ -52,6 +52,6 @@ declare function Rating({
|
|
|
52
52
|
className,
|
|
53
53
|
children,
|
|
54
54
|
...props
|
|
55
|
-
}: React$1.PropsWithChildren<RatingProps>):
|
|
55
|
+
}: React$1.PropsWithChildren<RatingProps>): react_jsx_runtime5.JSX.Element;
|
|
56
56
|
//#endregion
|
|
57
57
|
export { Rating, RatingButton, RatingButtonProps, RatingColor, RatingOption, RatingProps };
|
package/dist/Select.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
2
2
|
import { Select, SelectContent } from "@pixpilot/shadcn";
|
|
3
3
|
import React, { ComponentProps } from "react";
|
|
4
4
|
|
|
@@ -46,6 +46,6 @@ type BaseSelectProps = {
|
|
|
46
46
|
*/
|
|
47
47
|
clearable?: boolean;
|
|
48
48
|
} & Omit<ComponentProps<typeof Select>, 'value' | 'onValueChange' | 'children'>;
|
|
49
|
-
declare function Select$1(props: BaseSelectProps):
|
|
49
|
+
declare function Select$1(props: BaseSelectProps): react_jsx_runtime7.JSX.Element;
|
|
50
50
|
//#endregion
|
|
51
51
|
export { Select$1 as Select, SelectContentProps, SelectOption };
|
package/dist/Select.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Select, SelectContent } from "@pixpilot/shadcn";
|
|
2
2
|
import React, { ComponentProps } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/Select.d.ts
|
|
6
6
|
interface SelectOption {
|
|
@@ -46,6 +46,6 @@ type BaseSelectProps = {
|
|
|
46
46
|
*/
|
|
47
47
|
clearable?: boolean;
|
|
48
48
|
} & Omit<ComponentProps<typeof Select>, 'value' | 'onValueChange' | 'children'>;
|
|
49
|
-
declare function Select$1(props: BaseSelectProps):
|
|
49
|
+
declare function Select$1(props: BaseSelectProps): react_jsx_runtime7.JSX.Element;
|
|
50
50
|
//#endregion
|
|
51
51
|
export { Select$1 as Select, SelectContentProps, SelectOption };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
5
|
+
const require_Button = require('./Button.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
10
|
+
|
|
11
|
+
//#region src/ToggleButton.tsx
|
|
12
|
+
const ToggleButton = react.default.forwardRef(({ checked: controlledChecked, defaultChecked = false, onChange, checkedContent, uncheckedContent, checkedProps, uncheckedProps, disabled,...props }, ref) => {
|
|
13
|
+
const [uncontrolledChecked, setUncontrolledChecked] = react.default.useState(defaultChecked);
|
|
14
|
+
const isControlled = controlledChecked !== void 0;
|
|
15
|
+
const checked = isControlled ? controlledChecked : uncontrolledChecked;
|
|
16
|
+
const handleClick = (0, react.useCallback)((e) => {
|
|
17
|
+
if (disabled) return;
|
|
18
|
+
const next = !checked;
|
|
19
|
+
if (!isControlled) setUncontrolledChecked(next);
|
|
20
|
+
onChange?.(next);
|
|
21
|
+
props.onClick?.(e);
|
|
22
|
+
}, [
|
|
23
|
+
checked,
|
|
24
|
+
disabled,
|
|
25
|
+
isControlled,
|
|
26
|
+
onChange,
|
|
27
|
+
props
|
|
28
|
+
]);
|
|
29
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button.Button, {
|
|
30
|
+
variant: "outline",
|
|
31
|
+
type: "button",
|
|
32
|
+
"data-slot": "toggle-button",
|
|
33
|
+
...props,
|
|
34
|
+
...checked ? checkedProps : uncheckedProps,
|
|
35
|
+
"aria-pressed": checked,
|
|
36
|
+
"data-state": checked ? "checked" : "unchecked",
|
|
37
|
+
disabled,
|
|
38
|
+
ref,
|
|
39
|
+
onClick: handleClick,
|
|
40
|
+
children: checked ? checkedContent : uncheckedContent
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
ToggleButton.displayName = "ToggleButton";
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
exports.ToggleButton = ToggleButton;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { buttonVariants } from "@pixpilot/shadcn";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
|
|
5
|
+
//#region src/ToggleButton.d.ts
|
|
6
|
+
type ButtonBaseProps = React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
};
|
|
9
|
+
interface ToggleButtonProps extends Omit<ButtonBaseProps, 'onChange'> {
|
|
10
|
+
/**
|
|
11
|
+
* Controlled checked state
|
|
12
|
+
*/
|
|
13
|
+
checked?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Default checked state (uncontrolled)
|
|
16
|
+
*/
|
|
17
|
+
defaultChecked?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Fired when state changes
|
|
20
|
+
*/
|
|
21
|
+
onChange?: (checked: boolean) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Content rendered when checked
|
|
24
|
+
*/
|
|
25
|
+
checkedContent?: React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Content rendered when unchecked
|
|
28
|
+
*/
|
|
29
|
+
uncheckedContent?: React.ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Props to apply when checked
|
|
32
|
+
*/
|
|
33
|
+
checkedProps?: Partial<ButtonBaseProps>;
|
|
34
|
+
/**
|
|
35
|
+
* Props to apply when unchecked
|
|
36
|
+
*/
|
|
37
|
+
uncheckedProps?: Partial<ButtonBaseProps>;
|
|
38
|
+
}
|
|
39
|
+
declare const ToggleButton: React.ForwardRefExoticComponent<Omit<ToggleButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { ToggleButton, ToggleButtonProps };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { buttonVariants } from "@pixpilot/shadcn";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
|
|
5
|
+
//#region src/ToggleButton.d.ts
|
|
6
|
+
type ButtonBaseProps = React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
};
|
|
9
|
+
interface ToggleButtonProps extends Omit<ButtonBaseProps, 'onChange'> {
|
|
10
|
+
/**
|
|
11
|
+
* Controlled checked state
|
|
12
|
+
*/
|
|
13
|
+
checked?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Default checked state (uncontrolled)
|
|
16
|
+
*/
|
|
17
|
+
defaultChecked?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Fired when state changes
|
|
20
|
+
*/
|
|
21
|
+
onChange?: (checked: boolean) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Content rendered when checked
|
|
24
|
+
*/
|
|
25
|
+
checkedContent?: React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Content rendered when unchecked
|
|
28
|
+
*/
|
|
29
|
+
uncheckedContent?: React.ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Props to apply when checked
|
|
32
|
+
*/
|
|
33
|
+
checkedProps?: Partial<ButtonBaseProps>;
|
|
34
|
+
/**
|
|
35
|
+
* Props to apply when unchecked
|
|
36
|
+
*/
|
|
37
|
+
uncheckedProps?: Partial<ButtonBaseProps>;
|
|
38
|
+
}
|
|
39
|
+
declare const ToggleButton: React.ForwardRefExoticComponent<Omit<ToggleButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { ToggleButton, ToggleButtonProps };
|