@luxfi/ui 6.1.2 → 7.0.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/accordion.cjs +213 -0
- package/dist/accordion.d.cts +74 -0
- package/dist/accordion.d.ts +74 -0
- package/dist/accordion.js +186 -0
- package/dist/alert.cjs +553 -0
- package/dist/alert.d.cts +30 -0
- package/dist/alert.d.ts +30 -0
- package/dist/alert.js +531 -0
- package/dist/avatar.cjs +149 -0
- package/dist/avatar.d.cts +25 -0
- package/dist/avatar.d.ts +25 -0
- package/dist/avatar.js +125 -0
- package/dist/badge.cjs +611 -0
- package/dist/badge.d.cts +23 -0
- package/dist/badge.d.ts +23 -0
- package/dist/badge.js +589 -0
- package/dist/bank.cjs +272 -0
- package/dist/bank.d.cts +76 -0
- package/dist/bank.d.ts +76 -0
- package/dist/bank.js +258 -0
- package/dist/button.cjs +689 -0
- package/dist/button.d.cts +52 -0
- package/dist/button.d.ts +52 -0
- package/dist/button.js +664 -0
- package/dist/checkbox.cjs +265 -0
- package/dist/checkbox.d.cts +31 -0
- package/dist/checkbox.d.ts +31 -0
- package/dist/checkbox.js +241 -0
- package/dist/close-button.cjs +73 -0
- package/dist/close-button.d.cts +9 -0
- package/dist/close-button.d.ts +9 -0
- package/dist/close-button.js +51 -0
- package/dist/collapsible.cjs +702 -0
- package/dist/collapsible.d.cts +23 -0
- package/dist/collapsible.d.ts +23 -0
- package/dist/collapsible.js +679 -0
- package/dist/color-mode.cjs +96 -0
- package/dist/color-mode.d.cts +25 -0
- package/dist/color-mode.d.ts +25 -0
- package/dist/color-mode.js +72 -0
- package/dist/dialog.cjs +279 -0
- package/dist/dialog.d.cts +66 -0
- package/dist/dialog.d.ts +66 -0
- package/dist/dialog.js +246 -0
- package/dist/drawer.cjs +207 -0
- package/dist/drawer.d.cts +36 -0
- package/dist/drawer.d.ts +36 -0
- package/dist/drawer.js +175 -0
- package/dist/empty-state.cjs +93 -0
- package/dist/empty-state.d.cts +13 -0
- package/dist/empty-state.d.ts +13 -0
- package/dist/empty-state.js +71 -0
- package/dist/expiration-selector.cjs +138 -0
- package/dist/expiration-selector.d.cts +16 -0
- package/dist/expiration-selector.d.ts +16 -0
- package/dist/expiration-selector.js +116 -0
- package/dist/field.cjs +183 -0
- package/dist/field.d.cts +24 -0
- package/dist/field.d.ts +24 -0
- package/dist/field.js +160 -0
- package/dist/greeks-display.cjs +114 -0
- package/dist/greeks-display.d.cts +14 -0
- package/dist/greeks-display.d.ts +14 -0
- package/dist/greeks-display.js +92 -0
- package/dist/heading.cjs +46 -0
- package/dist/heading.d.cts +10 -0
- package/dist/heading.d.ts +10 -0
- package/dist/heading.js +40 -0
- package/dist/icon-button.cjs +491 -0
- package/dist/icon-button.d.cts +33 -0
- package/dist/icon-button.d.ts +33 -0
- package/dist/icon-button.js +470 -0
- package/dist/image.cjs +572 -0
- package/dist/image.d.cts +57 -0
- package/dist/image.d.ts +57 -0
- package/dist/image.js +551 -0
- package/dist/index.cjs +7316 -0
- package/dist/index.d.cts +58 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.js +7137 -0
- package/dist/input-group.cjs +155 -0
- package/dist/input-group.d.cts +17 -0
- package/dist/input-group.d.ts +17 -0
- package/dist/input-group.js +133 -0
- package/dist/input.cjs +65 -0
- package/dist/input.d.cts +11 -0
- package/dist/input.d.ts +11 -0
- package/dist/input.js +59 -0
- package/dist/link.cjs +630 -0
- package/dist/link.d.cts +37 -0
- package/dist/link.d.ts +37 -0
- package/dist/link.js +606 -0
- package/dist/menu.cjs +305 -0
- package/dist/menu.d.cts +84 -0
- package/dist/menu.d.ts +84 -0
- package/dist/menu.js +269 -0
- package/dist/option-chain.cjs +221 -0
- package/dist/option-chain.d.cts +37 -0
- package/dist/option-chain.d.ts +37 -0
- package/dist/option-chain.js +199 -0
- package/dist/option-position.cjs +164 -0
- package/dist/option-position.d.cts +29 -0
- package/dist/option-position.d.ts +29 -0
- package/dist/option-position.js +142 -0
- package/dist/pin-input.cjs +182 -0
- package/dist/pin-input.d.cts +25 -0
- package/dist/pin-input.d.ts +25 -0
- package/dist/pin-input.js +160 -0
- package/dist/pnl-diagram.cjs +453 -0
- package/dist/pnl-diagram.d.cts +11 -0
- package/dist/pnl-diagram.d.ts +11 -0
- package/dist/pnl-diagram.js +431 -0
- package/dist/popover.cjs +327 -0
- package/dist/popover.d.cts +73 -0
- package/dist/popover.d.ts +73 -0
- package/dist/popover.js +294 -0
- package/dist/progress-circle.cjs +152 -0
- package/dist/progress-circle.d.cts +47 -0
- package/dist/progress-circle.d.ts +47 -0
- package/dist/progress-circle.js +128 -0
- package/dist/progress.cjs +117 -0
- package/dist/progress.d.cts +28 -0
- package/dist/progress.d.ts +28 -0
- package/dist/progress.js +94 -0
- package/dist/provider.cjs +62 -0
- package/dist/provider.d.cts +7 -0
- package/dist/provider.d.ts +7 -0
- package/dist/provider.js +40 -0
- package/dist/radio.cjs +177 -0
- package/dist/radio.d.cts +53 -0
- package/dist/radio.d.ts +53 -0
- package/dist/radio.js +153 -0
- package/dist/rating.cjs +80 -0
- package/dist/rating.d.cts +14 -0
- package/dist/rating.d.ts +14 -0
- package/dist/rating.js +58 -0
- package/dist/select.cjs +791 -0
- package/dist/select.d.cts +130 -0
- package/dist/select.d.ts +130 -0
- package/dist/select.js +757 -0
- package/dist/separator.cjs +57 -0
- package/dist/separator.d.cts +13 -0
- package/dist/separator.d.ts +13 -0
- package/dist/separator.js +51 -0
- package/dist/skeleton.cjs +370 -0
- package/dist/skeleton.d.cts +60 -0
- package/dist/skeleton.d.ts +60 -0
- package/dist/skeleton.js +346 -0
- package/dist/slider.cjs +138 -0
- package/dist/slider.d.cts +24 -0
- package/dist/slider.d.ts +24 -0
- package/dist/slider.js +115 -0
- package/dist/strategy-builder.cjs +373 -0
- package/dist/strategy-builder.d.cts +26 -0
- package/dist/strategy-builder.d.ts +26 -0
- package/dist/strategy-builder.js +351 -0
- package/dist/switch.cjs +163 -0
- package/dist/switch.d.cts +27 -0
- package/dist/switch.d.ts +27 -0
- package/dist/switch.js +140 -0
- package/dist/table.cjs +1044 -0
- package/dist/table.d.cts +107 -0
- package/dist/table.d.ts +107 -0
- package/dist/table.js +1013 -0
- package/dist/tabs.cjs +240 -0
- package/dist/tabs.d.cts +78 -0
- package/dist/tabs.d.ts +78 -0
- package/dist/tabs.js +213 -0
- package/dist/tag.cjs +651 -0
- package/dist/tag.d.cts +21 -0
- package/dist/tag.d.ts +21 -0
- package/dist/tag.js +628 -0
- package/dist/textarea.cjs +65 -0
- package/dist/textarea.d.cts +11 -0
- package/dist/textarea.d.ts +11 -0
- package/dist/textarea.js +59 -0
- package/dist/toaster.cjs +99 -0
- package/dist/toaster.d.cts +29 -0
- package/dist/toaster.d.ts +29 -0
- package/dist/toaster.js +96 -0
- package/dist/tooltip.cjs +171 -0
- package/dist/tooltip.d.cts +39 -0
- package/dist/tooltip.d.ts +39 -0
- package/dist/tooltip.js +148 -0
- package/dist/utils.cjs +11 -0
- package/dist/utils.d.cts +5 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +9 -0
- package/package.json +284 -85
- package/src/accordion.tsx +285 -0
- package/src/alert.tsx +221 -0
- package/src/avatar.tsx +174 -0
- package/src/badge.tsx +158 -0
- package/src/bank.tsx +325 -0
- package/src/button.tsx +411 -0
- package/src/checkbox.tsx +307 -0
- package/src/close-button.tsx +51 -0
- package/src/collapsible.tsx +126 -0
- package/src/color-mode.tsx +125 -0
- package/src/dialog.tsx +356 -0
- package/src/drawer.tsx +186 -0
- package/src/empty-state.tsx +97 -0
- package/src/expiration-selector.tsx +163 -0
- package/src/field.tsx +202 -0
- package/src/greeks-display.tsx +138 -0
- package/src/heading.tsx +55 -0
- package/src/icon-button.tsx +192 -0
- package/src/image.tsx +280 -0
- package/src/index.ts +268 -0
- package/src/input-group.tsx +159 -0
- package/src/input.tsx +60 -0
- package/src/link.tsx +326 -0
- package/src/menu.tsx +471 -0
- package/src/option-chain.tsx +261 -0
- package/src/option-position.tsx +200 -0
- package/src/pin-input.tsx +187 -0
- package/src/pnl-diagram.tsx +458 -0
- package/src/popover.tsx +400 -0
- package/src/progress-circle.tsx +180 -0
- package/src/progress.tsx +109 -0
- package/src/provider.tsx +12 -0
- package/src/radio.tsx +175 -0
- package/src/rating.tsx +79 -0
- package/src/select.tsx +696 -0
- package/src/separator.tsx +59 -0
- package/src/skeleton.tsx +302 -0
- package/src/slider.tsx +152 -0
- package/src/strategy-builder.tsx +466 -0
- package/src/switch.tsx +158 -0
- package/src/table.tsx +621 -0
- package/src/tabs.tsx +354 -0
- package/src/tag.tsx +159 -0
- package/src/textarea.tsx +60 -0
- package/src/toaster.tsx +117 -0
- package/src/tokens.css +438 -0
- package/src/tooltip.tsx +184 -0
- package/src/utils/cn.ts +7 -0
- package/src/utils.ts +6 -0
- package/tokens.css +438 -0
- package/README.md +0 -109
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var RadixProgress = require('@radix-ui/react-progress');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var clsx = require('clsx');
|
|
7
|
+
var tailwindMerge = require('tailwind-merge');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n.default = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var RadixProgress__namespace = /*#__PURE__*/_interopNamespace(RadixProgress);
|
|
29
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
30
|
+
|
|
31
|
+
// src/progress.tsx
|
|
32
|
+
function cn(...inputs) {
|
|
33
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
34
|
+
}
|
|
35
|
+
var SIZE_CLASSES = {
|
|
36
|
+
sm: "h-1",
|
|
37
|
+
md: "h-2",
|
|
38
|
+
lg: "h-3",
|
|
39
|
+
xl: "h-4"
|
|
40
|
+
};
|
|
41
|
+
function normalizeValue(value, min, max) {
|
|
42
|
+
if (value == null) return 0;
|
|
43
|
+
if (max <= min) return 0;
|
|
44
|
+
return Math.round((value - min) / (max - min) * 100);
|
|
45
|
+
}
|
|
46
|
+
var Progress = React__namespace.forwardRef(
|
|
47
|
+
function Progress2(props, ref) {
|
|
48
|
+
const {
|
|
49
|
+
value,
|
|
50
|
+
min = 0,
|
|
51
|
+
max = 100,
|
|
52
|
+
size = "md",
|
|
53
|
+
color,
|
|
54
|
+
trackProps,
|
|
55
|
+
className,
|
|
56
|
+
style,
|
|
57
|
+
w,
|
|
58
|
+
flex,
|
|
59
|
+
...rest
|
|
60
|
+
} = props;
|
|
61
|
+
const percent = normalizeValue(value, min, max);
|
|
62
|
+
const trackStyle = {
|
|
63
|
+
...trackProps?.style,
|
|
64
|
+
...trackProps?.borderStartRadius !== void 0 && {
|
|
65
|
+
borderStartStartRadius: trackProps.borderStartRadius,
|
|
66
|
+
borderEndStartRadius: trackProps.borderStartRadius
|
|
67
|
+
},
|
|
68
|
+
...trackProps?.borderEndRadius !== void 0 && {
|
|
69
|
+
borderStartEndRadius: trackProps.borderEndRadius,
|
|
70
|
+
borderEndEndRadius: trackProps.borderEndRadius
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const rootStyle = {
|
|
74
|
+
...style,
|
|
75
|
+
...w !== void 0 && { width: w === "full" ? "100%" : w },
|
|
76
|
+
...flex !== void 0 && { flex }
|
|
77
|
+
};
|
|
78
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
ref,
|
|
82
|
+
className: cn("relative", className),
|
|
83
|
+
style: rootStyle,
|
|
84
|
+
...rest,
|
|
85
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
86
|
+
RadixProgress__namespace.Root,
|
|
87
|
+
{
|
|
88
|
+
value: percent,
|
|
89
|
+
max: 100,
|
|
90
|
+
className: cn(
|
|
91
|
+
"w-full overflow-hidden rounded-full",
|
|
92
|
+
"bg-[var(--color-progress-track)]",
|
|
93
|
+
SIZE_CLASSES[size],
|
|
94
|
+
trackProps?.className
|
|
95
|
+
),
|
|
96
|
+
style: trackStyle,
|
|
97
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
98
|
+
RadixProgress__namespace.Indicator,
|
|
99
|
+
{
|
|
100
|
+
className: cn(
|
|
101
|
+
"h-full rounded-full transition-transform duration-500 ease-out",
|
|
102
|
+
!color && "bg-[var(--color-progress-indicator)]"
|
|
103
|
+
),
|
|
104
|
+
style: {
|
|
105
|
+
width: `${percent}%`,
|
|
106
|
+
...color && { backgroundColor: `var(--color-${color.replace(".", "-")}, ${color})` }
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
exports.Progress = Progress;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
declare const SIZE_CLASSES: {
|
|
4
|
+
readonly sm: "h-1";
|
|
5
|
+
readonly md: "h-2";
|
|
6
|
+
readonly lg: "h-3";
|
|
7
|
+
readonly xl: "h-4";
|
|
8
|
+
};
|
|
9
|
+
type Size = keyof typeof SIZE_CLASSES;
|
|
10
|
+
interface TrackProps {
|
|
11
|
+
readonly borderStartRadius?: number | string;
|
|
12
|
+
readonly borderEndRadius?: number | string;
|
|
13
|
+
readonly className?: string;
|
|
14
|
+
readonly style?: React.CSSProperties;
|
|
15
|
+
}
|
|
16
|
+
interface ProgressProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
17
|
+
readonly value?: number | null;
|
|
18
|
+
readonly min?: number;
|
|
19
|
+
readonly max?: number;
|
|
20
|
+
readonly size?: Size;
|
|
21
|
+
readonly color?: string;
|
|
22
|
+
readonly trackProps?: TrackProps;
|
|
23
|
+
readonly w?: string;
|
|
24
|
+
readonly flex?: string | number;
|
|
25
|
+
}
|
|
26
|
+
declare const Progress: React.ForwardRefExoticComponent<ProgressProps & React.RefAttributes<HTMLDivElement>>;
|
|
27
|
+
|
|
28
|
+
export { Progress };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
declare const SIZE_CLASSES: {
|
|
4
|
+
readonly sm: "h-1";
|
|
5
|
+
readonly md: "h-2";
|
|
6
|
+
readonly lg: "h-3";
|
|
7
|
+
readonly xl: "h-4";
|
|
8
|
+
};
|
|
9
|
+
type Size = keyof typeof SIZE_CLASSES;
|
|
10
|
+
interface TrackProps {
|
|
11
|
+
readonly borderStartRadius?: number | string;
|
|
12
|
+
readonly borderEndRadius?: number | string;
|
|
13
|
+
readonly className?: string;
|
|
14
|
+
readonly style?: React.CSSProperties;
|
|
15
|
+
}
|
|
16
|
+
interface ProgressProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
17
|
+
readonly value?: number | null;
|
|
18
|
+
readonly min?: number;
|
|
19
|
+
readonly max?: number;
|
|
20
|
+
readonly size?: Size;
|
|
21
|
+
readonly color?: string;
|
|
22
|
+
readonly trackProps?: TrackProps;
|
|
23
|
+
readonly w?: string;
|
|
24
|
+
readonly flex?: string | number;
|
|
25
|
+
}
|
|
26
|
+
declare const Progress: React.ForwardRefExoticComponent<ProgressProps & React.RefAttributes<HTMLDivElement>>;
|
|
27
|
+
|
|
28
|
+
export { Progress };
|
package/dist/progress.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as RadixProgress from '@radix-ui/react-progress';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
// src/progress.tsx
|
|
9
|
+
function cn(...inputs) {
|
|
10
|
+
return twMerge(clsx(inputs));
|
|
11
|
+
}
|
|
12
|
+
var SIZE_CLASSES = {
|
|
13
|
+
sm: "h-1",
|
|
14
|
+
md: "h-2",
|
|
15
|
+
lg: "h-3",
|
|
16
|
+
xl: "h-4"
|
|
17
|
+
};
|
|
18
|
+
function normalizeValue(value, min, max) {
|
|
19
|
+
if (value == null) return 0;
|
|
20
|
+
if (max <= min) return 0;
|
|
21
|
+
return Math.round((value - min) / (max - min) * 100);
|
|
22
|
+
}
|
|
23
|
+
var Progress = React.forwardRef(
|
|
24
|
+
function Progress2(props, ref) {
|
|
25
|
+
const {
|
|
26
|
+
value,
|
|
27
|
+
min = 0,
|
|
28
|
+
max = 100,
|
|
29
|
+
size = "md",
|
|
30
|
+
color,
|
|
31
|
+
trackProps,
|
|
32
|
+
className,
|
|
33
|
+
style,
|
|
34
|
+
w,
|
|
35
|
+
flex,
|
|
36
|
+
...rest
|
|
37
|
+
} = props;
|
|
38
|
+
const percent = normalizeValue(value, min, max);
|
|
39
|
+
const trackStyle = {
|
|
40
|
+
...trackProps?.style,
|
|
41
|
+
...trackProps?.borderStartRadius !== void 0 && {
|
|
42
|
+
borderStartStartRadius: trackProps.borderStartRadius,
|
|
43
|
+
borderEndStartRadius: trackProps.borderStartRadius
|
|
44
|
+
},
|
|
45
|
+
...trackProps?.borderEndRadius !== void 0 && {
|
|
46
|
+
borderStartEndRadius: trackProps.borderEndRadius,
|
|
47
|
+
borderEndEndRadius: trackProps.borderEndRadius
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const rootStyle = {
|
|
51
|
+
...style,
|
|
52
|
+
...w !== void 0 && { width: w === "full" ? "100%" : w },
|
|
53
|
+
...flex !== void 0 && { flex }
|
|
54
|
+
};
|
|
55
|
+
return /* @__PURE__ */ jsx(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
ref,
|
|
59
|
+
className: cn("relative", className),
|
|
60
|
+
style: rootStyle,
|
|
61
|
+
...rest,
|
|
62
|
+
children: /* @__PURE__ */ jsx(
|
|
63
|
+
RadixProgress.Root,
|
|
64
|
+
{
|
|
65
|
+
value: percent,
|
|
66
|
+
max: 100,
|
|
67
|
+
className: cn(
|
|
68
|
+
"w-full overflow-hidden rounded-full",
|
|
69
|
+
"bg-[var(--color-progress-track)]",
|
|
70
|
+
SIZE_CLASSES[size],
|
|
71
|
+
trackProps?.className
|
|
72
|
+
),
|
|
73
|
+
style: trackStyle,
|
|
74
|
+
children: /* @__PURE__ */ jsx(
|
|
75
|
+
RadixProgress.Indicator,
|
|
76
|
+
{
|
|
77
|
+
className: cn(
|
|
78
|
+
"h-full rounded-full transition-transform duration-500 ease-out",
|
|
79
|
+
!color && "bg-[var(--color-progress-indicator)]"
|
|
80
|
+
),
|
|
81
|
+
style: {
|
|
82
|
+
width: `${percent}%`,
|
|
83
|
+
...color && { backgroundColor: `var(--color-${color.replace(".", "-")}, ${color})` }
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
export { Progress };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n.default = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
|
+
|
|
27
|
+
var ColorModeContext = React__namespace.createContext(void 0);
|
|
28
|
+
function ColorModeProvider(props) {
|
|
29
|
+
const { children, defaultTheme = "light", value: controlledValue, onValueChange } = props;
|
|
30
|
+
const [internalMode, setInternalMode] = React__namespace.useState(() => {
|
|
31
|
+
if (controlledValue === "dark" || controlledValue === "light") {
|
|
32
|
+
return controlledValue;
|
|
33
|
+
}
|
|
34
|
+
if (typeof document !== "undefined") {
|
|
35
|
+
if (document.documentElement.classList.contains("dark")) return "dark";
|
|
36
|
+
}
|
|
37
|
+
return defaultTheme === "dark" ? "dark" : "light";
|
|
38
|
+
});
|
|
39
|
+
const colorMode = controlledValue === "dark" || controlledValue === "light" ? controlledValue : internalMode;
|
|
40
|
+
const setColorMode = React__namespace.useCallback((mode) => {
|
|
41
|
+
const resolved = mode === "dark" ? "dark" : "light";
|
|
42
|
+
setInternalMode(resolved);
|
|
43
|
+
onValueChange?.(resolved);
|
|
44
|
+
if (typeof document !== "undefined") {
|
|
45
|
+
document.documentElement.classList.toggle("dark", resolved === "dark");
|
|
46
|
+
document.documentElement.classList.toggle("light", resolved === "light");
|
|
47
|
+
}
|
|
48
|
+
}, [onValueChange]);
|
|
49
|
+
const toggleColorMode = React__namespace.useCallback(() => {
|
|
50
|
+
setColorMode(colorMode === "dark" ? "light" : "dark");
|
|
51
|
+
}, [colorMode, setColorMode]);
|
|
52
|
+
const ctx = React__namespace.useMemo(
|
|
53
|
+
() => ({ colorMode, setColorMode, toggleColorMode }),
|
|
54
|
+
[colorMode, setColorMode, toggleColorMode]
|
|
55
|
+
);
|
|
56
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ColorModeContext.Provider, { value: ctx, children });
|
|
57
|
+
}
|
|
58
|
+
function Provider(props) {
|
|
59
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ColorModeProvider, { ...props });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
exports.Provider = Provider;
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var ColorModeContext = React.createContext(void 0);
|
|
6
|
+
function ColorModeProvider(props) {
|
|
7
|
+
const { children, defaultTheme = "light", value: controlledValue, onValueChange } = props;
|
|
8
|
+
const [internalMode, setInternalMode] = React.useState(() => {
|
|
9
|
+
if (controlledValue === "dark" || controlledValue === "light") {
|
|
10
|
+
return controlledValue;
|
|
11
|
+
}
|
|
12
|
+
if (typeof document !== "undefined") {
|
|
13
|
+
if (document.documentElement.classList.contains("dark")) return "dark";
|
|
14
|
+
}
|
|
15
|
+
return defaultTheme === "dark" ? "dark" : "light";
|
|
16
|
+
});
|
|
17
|
+
const colorMode = controlledValue === "dark" || controlledValue === "light" ? controlledValue : internalMode;
|
|
18
|
+
const setColorMode = React.useCallback((mode) => {
|
|
19
|
+
const resolved = mode === "dark" ? "dark" : "light";
|
|
20
|
+
setInternalMode(resolved);
|
|
21
|
+
onValueChange?.(resolved);
|
|
22
|
+
if (typeof document !== "undefined") {
|
|
23
|
+
document.documentElement.classList.toggle("dark", resolved === "dark");
|
|
24
|
+
document.documentElement.classList.toggle("light", resolved === "light");
|
|
25
|
+
}
|
|
26
|
+
}, [onValueChange]);
|
|
27
|
+
const toggleColorMode = React.useCallback(() => {
|
|
28
|
+
setColorMode(colorMode === "dark" ? "light" : "dark");
|
|
29
|
+
}, [colorMode, setColorMode]);
|
|
30
|
+
const ctx = React.useMemo(
|
|
31
|
+
() => ({ colorMode, setColorMode, toggleColorMode }),
|
|
32
|
+
[colorMode, setColorMode, toggleColorMode]
|
|
33
|
+
);
|
|
34
|
+
return /* @__PURE__ */ jsx(ColorModeContext.Provider, { value: ctx, children });
|
|
35
|
+
}
|
|
36
|
+
function Provider(props) {
|
|
37
|
+
return /* @__PURE__ */ jsx(ColorModeProvider, { ...props });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { Provider };
|
package/dist/radio.cjs
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var RadixRadioGroup = require('@radix-ui/react-radio-group');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var clsx = require('clsx');
|
|
7
|
+
var tailwindMerge = require('tailwind-merge');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n.default = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var RadixRadioGroup__namespace = /*#__PURE__*/_interopNamespace(RadixRadioGroup);
|
|
29
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
30
|
+
|
|
31
|
+
// src/radio.tsx
|
|
32
|
+
function cn(...inputs) {
|
|
33
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
34
|
+
}
|
|
35
|
+
var SIZE_CLASSES = {
|
|
36
|
+
xs: {
|
|
37
|
+
root: "gap-1.5",
|
|
38
|
+
control: "h-3 w-3",
|
|
39
|
+
indicator: "h-1.5 w-1.5",
|
|
40
|
+
label: "text-xs"
|
|
41
|
+
},
|
|
42
|
+
sm: {
|
|
43
|
+
root: "gap-1.5",
|
|
44
|
+
control: "h-3.5 w-3.5",
|
|
45
|
+
indicator: "h-1.5 w-1.5",
|
|
46
|
+
label: "text-xs"
|
|
47
|
+
},
|
|
48
|
+
md: {
|
|
49
|
+
root: "gap-2",
|
|
50
|
+
control: "h-4 w-4",
|
|
51
|
+
indicator: "h-2 w-2",
|
|
52
|
+
label: "text-sm"
|
|
53
|
+
},
|
|
54
|
+
lg: {
|
|
55
|
+
root: "gap-2.5",
|
|
56
|
+
control: "h-5 w-5",
|
|
57
|
+
indicator: "h-2.5 w-2.5",
|
|
58
|
+
label: "text-base"
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var RadioSizeContext = React__namespace.createContext("md");
|
|
62
|
+
var RadioGroupBase = React__namespace.forwardRef(
|
|
63
|
+
function RadioGroup(props, ref) {
|
|
64
|
+
const {
|
|
65
|
+
children,
|
|
66
|
+
name,
|
|
67
|
+
required,
|
|
68
|
+
disabled = false,
|
|
69
|
+
readOnly = false,
|
|
70
|
+
orientation = "vertical",
|
|
71
|
+
loop = true,
|
|
72
|
+
defaultValue,
|
|
73
|
+
value,
|
|
74
|
+
onValueChange,
|
|
75
|
+
size = "md",
|
|
76
|
+
className,
|
|
77
|
+
...rest
|
|
78
|
+
} = props;
|
|
79
|
+
const handleValueChange = React__namespace.useCallback(
|
|
80
|
+
(nextValue) => {
|
|
81
|
+
if (readOnly) return;
|
|
82
|
+
onValueChange?.({ value: nextValue });
|
|
83
|
+
},
|
|
84
|
+
[readOnly, onValueChange]
|
|
85
|
+
);
|
|
86
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadioSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
87
|
+
RadixRadioGroup__namespace.Root,
|
|
88
|
+
{
|
|
89
|
+
ref,
|
|
90
|
+
name,
|
|
91
|
+
required,
|
|
92
|
+
disabled: disabled || readOnly,
|
|
93
|
+
orientation,
|
|
94
|
+
loop,
|
|
95
|
+
defaultValue,
|
|
96
|
+
value: value ?? void 0,
|
|
97
|
+
onValueChange: handleValueChange,
|
|
98
|
+
className: cn(
|
|
99
|
+
"flex",
|
|
100
|
+
orientation === "vertical" ? "flex-col gap-3" : "flex-row gap-6",
|
|
101
|
+
className
|
|
102
|
+
),
|
|
103
|
+
...rest,
|
|
104
|
+
children
|
|
105
|
+
}
|
|
106
|
+
) });
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
var RadioGroup2 = RadioGroupBase;
|
|
110
|
+
var NOOP = () => {
|
|
111
|
+
};
|
|
112
|
+
var RadioBase = React__namespace.forwardRef(
|
|
113
|
+
function Radio(props, ref) {
|
|
114
|
+
const { children, inputProps, rootRef, value, disabled, className, ...rest } = props;
|
|
115
|
+
const size = React__namespace.useContext(RadioSizeContext);
|
|
116
|
+
const sizeClasses = SIZE_CLASSES[size];
|
|
117
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
118
|
+
"label",
|
|
119
|
+
{
|
|
120
|
+
ref: rootRef,
|
|
121
|
+
className: cn(
|
|
122
|
+
"inline-flex items-center cursor-pointer select-none",
|
|
123
|
+
sizeClasses.root,
|
|
124
|
+
disabled && "opacity-50 cursor-not-allowed",
|
|
125
|
+
className
|
|
126
|
+
),
|
|
127
|
+
"data-disabled": disabled || void 0,
|
|
128
|
+
...rest,
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
131
|
+
RadixRadioGroup__namespace.Item,
|
|
132
|
+
{
|
|
133
|
+
value,
|
|
134
|
+
disabled,
|
|
135
|
+
className: cn(
|
|
136
|
+
"inline-flex items-center justify-center shrink-0 rounded-full",
|
|
137
|
+
"border-2 border-current/30",
|
|
138
|
+
"data-[state=checked]:border-gray-800 dark:border-white",
|
|
139
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-500",
|
|
140
|
+
"transition-colors duration-150",
|
|
141
|
+
sizeClasses.control
|
|
142
|
+
),
|
|
143
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
144
|
+
RadixRadioGroup__namespace.Indicator,
|
|
145
|
+
{
|
|
146
|
+
className: cn(
|
|
147
|
+
"block rounded-full bg-gray-800 dark:bg-white",
|
|
148
|
+
sizeClasses.indicator
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
155
|
+
"input",
|
|
156
|
+
{
|
|
157
|
+
ref,
|
|
158
|
+
type: "radio",
|
|
159
|
+
className: "sr-only",
|
|
160
|
+
value,
|
|
161
|
+
disabled,
|
|
162
|
+
tabIndex: -1,
|
|
163
|
+
"aria-hidden": true,
|
|
164
|
+
onChange: NOOP,
|
|
165
|
+
...inputProps
|
|
166
|
+
}
|
|
167
|
+
),
|
|
168
|
+
children != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: sizeClasses.label, children })
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
var Radio2 = RadioBase;
|
|
175
|
+
|
|
176
|
+
exports.Radio = Radio2;
|
|
177
|
+
exports.RadioGroup = RadioGroup2;
|
package/dist/radio.d.cts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
declare const SIZE_CLASSES: {
|
|
4
|
+
readonly xs: {
|
|
5
|
+
readonly root: "gap-1.5";
|
|
6
|
+
readonly control: "h-3 w-3";
|
|
7
|
+
readonly indicator: "h-1.5 w-1.5";
|
|
8
|
+
readonly label: "text-xs";
|
|
9
|
+
};
|
|
10
|
+
readonly sm: {
|
|
11
|
+
readonly root: "gap-1.5";
|
|
12
|
+
readonly control: "h-3.5 w-3.5";
|
|
13
|
+
readonly indicator: "h-1.5 w-1.5";
|
|
14
|
+
readonly label: "text-xs";
|
|
15
|
+
};
|
|
16
|
+
readonly md: {
|
|
17
|
+
readonly root: "gap-2";
|
|
18
|
+
readonly control: "h-4 w-4";
|
|
19
|
+
readonly indicator: "h-2 w-2";
|
|
20
|
+
readonly label: "text-sm";
|
|
21
|
+
};
|
|
22
|
+
readonly lg: {
|
|
23
|
+
readonly root: "gap-2.5";
|
|
24
|
+
readonly control: "h-5 w-5";
|
|
25
|
+
readonly indicator: "h-2.5 w-2.5";
|
|
26
|
+
readonly label: "text-base";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
type RadioSize = keyof typeof SIZE_CLASSES;
|
|
30
|
+
interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'dir'> {
|
|
31
|
+
name?: string;
|
|
32
|
+
required?: boolean;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
readOnly?: boolean;
|
|
35
|
+
orientation?: 'horizontal' | 'vertical';
|
|
36
|
+
loop?: boolean;
|
|
37
|
+
defaultValue?: string;
|
|
38
|
+
value?: string | null;
|
|
39
|
+
onValueChange?: (details: {
|
|
40
|
+
value: string | null;
|
|
41
|
+
}) => void;
|
|
42
|
+
size?: RadioSize;
|
|
43
|
+
}
|
|
44
|
+
declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
45
|
+
interface RadioProps extends Omit<React.ComponentPropsWithoutRef<'label'>, 'onChange'> {
|
|
46
|
+
rootRef?: React.Ref<HTMLLabelElement>;
|
|
47
|
+
inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
48
|
+
value: string;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
}
|
|
51
|
+
declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;
|
|
52
|
+
|
|
53
|
+
export { Radio, RadioGroup, type RadioGroupProps, type RadioProps };
|
package/dist/radio.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
declare const SIZE_CLASSES: {
|
|
4
|
+
readonly xs: {
|
|
5
|
+
readonly root: "gap-1.5";
|
|
6
|
+
readonly control: "h-3 w-3";
|
|
7
|
+
readonly indicator: "h-1.5 w-1.5";
|
|
8
|
+
readonly label: "text-xs";
|
|
9
|
+
};
|
|
10
|
+
readonly sm: {
|
|
11
|
+
readonly root: "gap-1.5";
|
|
12
|
+
readonly control: "h-3.5 w-3.5";
|
|
13
|
+
readonly indicator: "h-1.5 w-1.5";
|
|
14
|
+
readonly label: "text-xs";
|
|
15
|
+
};
|
|
16
|
+
readonly md: {
|
|
17
|
+
readonly root: "gap-2";
|
|
18
|
+
readonly control: "h-4 w-4";
|
|
19
|
+
readonly indicator: "h-2 w-2";
|
|
20
|
+
readonly label: "text-sm";
|
|
21
|
+
};
|
|
22
|
+
readonly lg: {
|
|
23
|
+
readonly root: "gap-2.5";
|
|
24
|
+
readonly control: "h-5 w-5";
|
|
25
|
+
readonly indicator: "h-2.5 w-2.5";
|
|
26
|
+
readonly label: "text-base";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
type RadioSize = keyof typeof SIZE_CLASSES;
|
|
30
|
+
interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'dir'> {
|
|
31
|
+
name?: string;
|
|
32
|
+
required?: boolean;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
readOnly?: boolean;
|
|
35
|
+
orientation?: 'horizontal' | 'vertical';
|
|
36
|
+
loop?: boolean;
|
|
37
|
+
defaultValue?: string;
|
|
38
|
+
value?: string | null;
|
|
39
|
+
onValueChange?: (details: {
|
|
40
|
+
value: string | null;
|
|
41
|
+
}) => void;
|
|
42
|
+
size?: RadioSize;
|
|
43
|
+
}
|
|
44
|
+
declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
45
|
+
interface RadioProps extends Omit<React.ComponentPropsWithoutRef<'label'>, 'onChange'> {
|
|
46
|
+
rootRef?: React.Ref<HTMLLabelElement>;
|
|
47
|
+
inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
48
|
+
value: string;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
}
|
|
51
|
+
declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;
|
|
52
|
+
|
|
53
|
+
export { Radio, RadioGroup, type RadioGroupProps, type RadioProps };
|