@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
package/dist/popover.js
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as RadixPopover from '@radix-ui/react-popover';
|
|
3
|
+
import * as React2 from 'react';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
// src/popover.tsx
|
|
9
|
+
function cn(...inputs) {
|
|
10
|
+
return twMerge(clsx(inputs));
|
|
11
|
+
}
|
|
12
|
+
var CLOSE_ICON_PATH = "M9.44 8.035a.791.791 0 0 0 1.12 0l3.802-3.803a.791.791 0 0 1 1.119 0l.287.287a.79.79 0 0 1 0 1.119L11.965 9.44a.79.79 0 0 0 0 1.118l3.803 3.803a.791.791 0 0 1 0 1.119l-.287.287a.791.791 0 0 1-1.119 0l-3.803-3.803a.79.79 0 0 0-1.118 0l-3.803 3.803a.79.79 0 0 1-1.119 0l-.287-.287a.791.791 0 0 1 0-1.119l3.803-3.803a.791.791 0 0 0 0-1.118L4.232 5.638a.791.791 0 0 1 0-1.119l.287-.287a.791.791 0 0 1 1.119 0L9.44 8.035Z";
|
|
13
|
+
var CloseButton = React2.forwardRef(function CloseButton2(props, ref) {
|
|
14
|
+
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
"button",
|
|
17
|
+
{
|
|
18
|
+
type: "button",
|
|
19
|
+
"aria-label": "Close",
|
|
20
|
+
ref,
|
|
21
|
+
className: cn(
|
|
22
|
+
"inline-flex items-center justify-center",
|
|
23
|
+
"size-5 min-w-0 shrink-0 p-0",
|
|
24
|
+
"rounded-sm border-0 overflow-hidden",
|
|
25
|
+
"bg-transparent text-[var(--closeButton-fg,currentColor)]",
|
|
26
|
+
"hover:bg-transparent hover:text-[var(--hover-color,currentColor)]",
|
|
27
|
+
"disabled:opacity-40",
|
|
28
|
+
"cursor-pointer",
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
...rest,
|
|
32
|
+
children: children ?? /* @__PURE__ */ jsx(
|
|
33
|
+
"svg",
|
|
34
|
+
{
|
|
35
|
+
className: "size-5",
|
|
36
|
+
viewBox: "0 0 20 20",
|
|
37
|
+
fill: "none",
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
children: /* @__PURE__ */ jsx(
|
|
40
|
+
"path",
|
|
41
|
+
{
|
|
42
|
+
d: CLOSE_ICON_PATH,
|
|
43
|
+
fill: "currentColor"
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
function parsePlacement(placement) {
|
|
52
|
+
if (!placement) {
|
|
53
|
+
return { side: "bottom", align: "start" };
|
|
54
|
+
}
|
|
55
|
+
const parts = placement.split("-");
|
|
56
|
+
const side = parts[0] ?? "bottom";
|
|
57
|
+
const alignPart = parts[1];
|
|
58
|
+
let align = "center";
|
|
59
|
+
if (alignPart === "start") {
|
|
60
|
+
align = "start";
|
|
61
|
+
} else if (alignPart === "end") {
|
|
62
|
+
align = "end";
|
|
63
|
+
}
|
|
64
|
+
return { side, align };
|
|
65
|
+
}
|
|
66
|
+
var PositioningContext = React2.createContext({
|
|
67
|
+
side: "bottom",
|
|
68
|
+
align: "start",
|
|
69
|
+
sideOffset: 4,
|
|
70
|
+
alignOffset: 0,
|
|
71
|
+
collisionPadding: 4,
|
|
72
|
+
autoFocus: false,
|
|
73
|
+
closeOnInteractOutside: true
|
|
74
|
+
});
|
|
75
|
+
var PopoverRoot = (props) => {
|
|
76
|
+
const {
|
|
77
|
+
children,
|
|
78
|
+
open,
|
|
79
|
+
defaultOpen,
|
|
80
|
+
onOpenChange,
|
|
81
|
+
positioning,
|
|
82
|
+
autoFocus = false,
|
|
83
|
+
closeOnInteractOutside = true,
|
|
84
|
+
modal = false,
|
|
85
|
+
// lazyMount and unmountOnExit are handled via forceMount on Portal/Content
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
87
|
+
lazyMount: _lazyMount,
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
89
|
+
unmountOnExit: _unmountOnExit
|
|
90
|
+
} = props;
|
|
91
|
+
const mergedPositioning = {
|
|
92
|
+
placement: "bottom-start",
|
|
93
|
+
overflowPadding: 4,
|
|
94
|
+
...positioning,
|
|
95
|
+
offset: {
|
|
96
|
+
mainAxis: 4,
|
|
97
|
+
...positioning?.offset
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const { side, align } = parsePlacement(mergedPositioning.placement);
|
|
101
|
+
const positioningValue = React2.useMemo(() => ({
|
|
102
|
+
side,
|
|
103
|
+
align,
|
|
104
|
+
sideOffset: mergedPositioning.offset?.mainAxis ?? 4,
|
|
105
|
+
alignOffset: mergedPositioning.offset?.crossAxis ?? 0,
|
|
106
|
+
collisionPadding: mergedPositioning.overflowPadding ?? 4,
|
|
107
|
+
autoFocus,
|
|
108
|
+
closeOnInteractOutside
|
|
109
|
+
}), [
|
|
110
|
+
side,
|
|
111
|
+
align,
|
|
112
|
+
mergedPositioning.offset?.mainAxis,
|
|
113
|
+
mergedPositioning.offset?.crossAxis,
|
|
114
|
+
mergedPositioning.overflowPadding,
|
|
115
|
+
autoFocus,
|
|
116
|
+
closeOnInteractOutside
|
|
117
|
+
]);
|
|
118
|
+
const handleOpenChange = React2.useCallback((isOpen) => {
|
|
119
|
+
onOpenChange?.({ open: isOpen });
|
|
120
|
+
}, [onOpenChange]);
|
|
121
|
+
return /* @__PURE__ */ jsx(PositioningContext.Provider, { value: positioningValue, children: /* @__PURE__ */ jsx(
|
|
122
|
+
RadixPopover.Root,
|
|
123
|
+
{
|
|
124
|
+
open,
|
|
125
|
+
defaultOpen,
|
|
126
|
+
onOpenChange: handleOpenChange,
|
|
127
|
+
modal,
|
|
128
|
+
children
|
|
129
|
+
}
|
|
130
|
+
) });
|
|
131
|
+
};
|
|
132
|
+
var PopoverTrigger = React2.forwardRef(function PopoverTrigger2(props, ref) {
|
|
133
|
+
const { asChild = true, ...rest } = props;
|
|
134
|
+
return /* @__PURE__ */ jsx(RadixPopover.Trigger, { asChild, ref, ...rest });
|
|
135
|
+
});
|
|
136
|
+
var PopoverContent = React2.forwardRef(function PopoverContent2(props, ref) {
|
|
137
|
+
const { portalled = true, portalRef, className, w, minW, maxW, paddingTop, style: styleProp, ...rest } = props;
|
|
138
|
+
const resolvedW = typeof w === "object" ? w.base ?? w.lg : w;
|
|
139
|
+
const contentStyle = {
|
|
140
|
+
...styleProp,
|
|
141
|
+
...resolvedW ? { width: resolvedW } : {},
|
|
142
|
+
...minW ? { minWidth: minW } : {},
|
|
143
|
+
...maxW ? { maxWidth: maxW } : {},
|
|
144
|
+
...paddingTop !== void 0 ? { paddingTop: typeof paddingTop === "number" ? `${paddingTop * 4}px` : paddingTop } : {}
|
|
145
|
+
};
|
|
146
|
+
const positioning = React2.useContext(PositioningContext);
|
|
147
|
+
const preventFocus = React2.useCallback((e) => e.preventDefault(), []);
|
|
148
|
+
const preventInteract = React2.useCallback((e) => e.preventDefault(), []);
|
|
149
|
+
const content = /* @__PURE__ */ jsx(
|
|
150
|
+
RadixPopover.Content,
|
|
151
|
+
{
|
|
152
|
+
ref,
|
|
153
|
+
side: positioning.side,
|
|
154
|
+
align: positioning.align,
|
|
155
|
+
sideOffset: positioning.sideOffset,
|
|
156
|
+
alignOffset: positioning.alignOffset,
|
|
157
|
+
collisionPadding: positioning.collisionPadding,
|
|
158
|
+
onOpenAutoFocus: positioning.autoFocus ? void 0 : preventFocus,
|
|
159
|
+
onInteractOutside: positioning.closeOnInteractOutside ? void 0 : preventInteract,
|
|
160
|
+
className: cn(
|
|
161
|
+
"z-50 rounded-lg border border-[var(--color-popover-border,var(--color-border-divider))]",
|
|
162
|
+
"bg-[var(--color-popover-bg,var(--color-dialog-bg))]",
|
|
163
|
+
"shadow-[var(--shadow-popover,var(--shadow-lg))]",
|
|
164
|
+
"outline-none",
|
|
165
|
+
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
166
|
+
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
167
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
|
|
168
|
+
"data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
169
|
+
className
|
|
170
|
+
),
|
|
171
|
+
style: Object.keys(contentStyle).length > 0 ? contentStyle : void 0,
|
|
172
|
+
...rest
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
if (!portalled) {
|
|
176
|
+
return content;
|
|
177
|
+
}
|
|
178
|
+
return /* @__PURE__ */ jsx(RadixPopover.Portal, { container: portalRef?.current ?? void 0, children: content });
|
|
179
|
+
});
|
|
180
|
+
var PopoverArrow = React2.forwardRef(function PopoverArrow2(props, ref) {
|
|
181
|
+
const { className, ...rest } = props;
|
|
182
|
+
return /* @__PURE__ */ jsx(
|
|
183
|
+
RadixPopover.Arrow,
|
|
184
|
+
{
|
|
185
|
+
ref,
|
|
186
|
+
className: cn("fill-[var(--color-popover-bg,var(--color-dialog-bg))]", className),
|
|
187
|
+
...rest
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
});
|
|
191
|
+
var PopoverCloseTrigger = React2.forwardRef(function PopoverCloseTrigger2(props, ref) {
|
|
192
|
+
const { className, ...rest } = props;
|
|
193
|
+
return /* @__PURE__ */ jsx(
|
|
194
|
+
RadixPopover.Close,
|
|
195
|
+
{
|
|
196
|
+
className: cn("absolute top-1 right-1", className),
|
|
197
|
+
...rest,
|
|
198
|
+
asChild: true,
|
|
199
|
+
ref,
|
|
200
|
+
children: /* @__PURE__ */ jsx(CloseButton, {})
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
});
|
|
204
|
+
var PopoverCloseTriggerWrapper = React2.forwardRef(function PopoverCloseTriggerWrapper2(props, ref) {
|
|
205
|
+
const { disabled, children, ...rest } = props;
|
|
206
|
+
if (disabled) {
|
|
207
|
+
return children;
|
|
208
|
+
}
|
|
209
|
+
return /* @__PURE__ */ jsx(RadixPopover.Close, { ref, ...rest, asChild: true, children });
|
|
210
|
+
});
|
|
211
|
+
var PopoverBody = React2.forwardRef(function PopoverBody2(props, ref) {
|
|
212
|
+
const {
|
|
213
|
+
className,
|
|
214
|
+
style: styleProp,
|
|
215
|
+
display: _display,
|
|
216
|
+
flexDir: _flexDir,
|
|
217
|
+
rowGap: _rowGap,
|
|
218
|
+
px: _px,
|
|
219
|
+
py: _py,
|
|
220
|
+
textStyle: _textStyle,
|
|
221
|
+
alignItems: _alignItems,
|
|
222
|
+
...rest
|
|
223
|
+
} = props;
|
|
224
|
+
const bodyStyle = {
|
|
225
|
+
...styleProp,
|
|
226
|
+
..._display ? { display: _display } : {},
|
|
227
|
+
..._flexDir ? { flexDirection: _flexDir } : {},
|
|
228
|
+
..._rowGap !== void 0 ? { rowGap: typeof _rowGap === "number" ? `${_rowGap * 4}px` : _rowGap } : {},
|
|
229
|
+
..._px !== void 0 ? {
|
|
230
|
+
paddingLeft: typeof _px === "number" ? `${_px * 4}px` : _px,
|
|
231
|
+
paddingRight: typeof _px === "number" ? `${_px * 4}px` : _px
|
|
232
|
+
} : {},
|
|
233
|
+
..._py !== void 0 ? {
|
|
234
|
+
paddingTop: typeof _py === "number" ? `${_py * 4}px` : _py,
|
|
235
|
+
paddingBottom: typeof _py === "number" ? `${_py * 4}px` : _py
|
|
236
|
+
} : {},
|
|
237
|
+
..._alignItems ? { alignItems: _alignItems } : {}
|
|
238
|
+
};
|
|
239
|
+
return /* @__PURE__ */ jsx(
|
|
240
|
+
"div",
|
|
241
|
+
{
|
|
242
|
+
ref,
|
|
243
|
+
className: cn("p-4", className),
|
|
244
|
+
style: Object.keys(bodyStyle).length > 0 ? bodyStyle : void 0,
|
|
245
|
+
...rest
|
|
246
|
+
}
|
|
247
|
+
);
|
|
248
|
+
});
|
|
249
|
+
var PopoverHeader = React2.forwardRef(function PopoverHeader2(props, ref) {
|
|
250
|
+
const { className, ...rest } = props;
|
|
251
|
+
return /* @__PURE__ */ jsx(
|
|
252
|
+
"div",
|
|
253
|
+
{
|
|
254
|
+
ref,
|
|
255
|
+
className: cn("px-4 pt-4 pb-0 font-semibold", className),
|
|
256
|
+
...rest
|
|
257
|
+
}
|
|
258
|
+
);
|
|
259
|
+
});
|
|
260
|
+
var PopoverFooter = React2.forwardRef(function PopoverFooter2(props, ref) {
|
|
261
|
+
const { className, ...rest } = props;
|
|
262
|
+
return /* @__PURE__ */ jsx(
|
|
263
|
+
"div",
|
|
264
|
+
{
|
|
265
|
+
ref,
|
|
266
|
+
className: cn("px-4 pb-4 pt-0", className),
|
|
267
|
+
...rest
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
});
|
|
271
|
+
var PopoverTitle = React2.forwardRef(function PopoverTitle2(props, ref) {
|
|
272
|
+
const { className, ...rest } = props;
|
|
273
|
+
return /* @__PURE__ */ jsx(
|
|
274
|
+
"h3",
|
|
275
|
+
{
|
|
276
|
+
ref,
|
|
277
|
+
className: cn("text-base font-semibold", className),
|
|
278
|
+
...rest
|
|
279
|
+
}
|
|
280
|
+
);
|
|
281
|
+
});
|
|
282
|
+
var PopoverDescription = React2.forwardRef(function PopoverDescription2(props, ref) {
|
|
283
|
+
const { className, ...rest } = props;
|
|
284
|
+
return /* @__PURE__ */ jsx(
|
|
285
|
+
"p",
|
|
286
|
+
{
|
|
287
|
+
ref,
|
|
288
|
+
className: cn("text-sm", className),
|
|
289
|
+
...rest
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
export { PopoverArrow, PopoverBody, PopoverCloseTrigger, PopoverCloseTriggerWrapper, PopoverContent, PopoverDescription, PopoverFooter, PopoverHeader, PopoverRoot, PopoverTitle, PopoverTrigger };
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var clsx = require('clsx');
|
|
6
|
+
var tailwindMerge = require('tailwind-merge');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
28
|
+
|
|
29
|
+
// src/progress-circle.tsx
|
|
30
|
+
function cn(...inputs) {
|
|
31
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
32
|
+
}
|
|
33
|
+
var SIZE_MAP = {
|
|
34
|
+
xs: { size: 24, thickness: 4, textClass: "text-[10px]" },
|
|
35
|
+
sm: { size: 32, thickness: 5, textClass: "text-[10px]" },
|
|
36
|
+
md: { size: 40, thickness: 6, textClass: "text-xs" },
|
|
37
|
+
lg: { size: 48, thickness: 7, textClass: "text-sm" },
|
|
38
|
+
xl: { size: 64, thickness: 8, textClass: "text-sm" }
|
|
39
|
+
};
|
|
40
|
+
var Ctx = React__namespace.createContext({
|
|
41
|
+
value: 0,
|
|
42
|
+
size: "md",
|
|
43
|
+
colorPalette: "blue"
|
|
44
|
+
});
|
|
45
|
+
var ProgressCircleRoot = React__namespace.forwardRef(function ProgressCircleRoot2(props, ref) {
|
|
46
|
+
const {
|
|
47
|
+
value = 0,
|
|
48
|
+
size = "md",
|
|
49
|
+
colorPalette = "blue",
|
|
50
|
+
className,
|
|
51
|
+
children,
|
|
52
|
+
...rest
|
|
53
|
+
} = props;
|
|
54
|
+
const ctx = React__namespace.useMemo(
|
|
55
|
+
() => ({ value: value ?? null, size, colorPalette }),
|
|
56
|
+
[value, size, colorPalette]
|
|
57
|
+
);
|
|
58
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Ctx.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
ref,
|
|
62
|
+
role: "progressbar",
|
|
63
|
+
"aria-valuenow": value ?? void 0,
|
|
64
|
+
"aria-valuemin": 0,
|
|
65
|
+
"aria-valuemax": 100,
|
|
66
|
+
className: cn("relative inline-flex text-sm", className),
|
|
67
|
+
...rest,
|
|
68
|
+
children
|
|
69
|
+
}
|
|
70
|
+
) });
|
|
71
|
+
});
|
|
72
|
+
var ProgressCircleRing = React__namespace.forwardRef(function ProgressCircleRing2(props, ref) {
|
|
73
|
+
const { trackColor, cap, color, className, ...rest } = props;
|
|
74
|
+
const { value, size: sizeKey } = React__namespace.useContext(Ctx);
|
|
75
|
+
const { size, thickness } = SIZE_MAP[sizeKey];
|
|
76
|
+
const radius = size / 2 - thickness / 2;
|
|
77
|
+
const circumference = 2 * Math.PI * radius;
|
|
78
|
+
const percent = value ?? 0;
|
|
79
|
+
const offset = circumference * ((100 - percent) / 100);
|
|
80
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
81
|
+
"svg",
|
|
82
|
+
{
|
|
83
|
+
ref,
|
|
84
|
+
width: size,
|
|
85
|
+
height: size,
|
|
86
|
+
viewBox: `0 0 ${size} ${size}`,
|
|
87
|
+
className: cn(
|
|
88
|
+
value === null && "animate-spin",
|
|
89
|
+
className
|
|
90
|
+
),
|
|
91
|
+
...rest,
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
94
|
+
"circle",
|
|
95
|
+
{
|
|
96
|
+
cx: size / 2,
|
|
97
|
+
cy: size / 2,
|
|
98
|
+
r: radius,
|
|
99
|
+
fill: "transparent",
|
|
100
|
+
strokeWidth: thickness,
|
|
101
|
+
stroke: trackColor ?? "currentColor",
|
|
102
|
+
className: !trackColor ? "opacity-20" : void 0
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
106
|
+
"circle",
|
|
107
|
+
{
|
|
108
|
+
cx: size / 2,
|
|
109
|
+
cy: size / 2,
|
|
110
|
+
r: radius,
|
|
111
|
+
fill: "transparent",
|
|
112
|
+
strokeWidth: thickness,
|
|
113
|
+
stroke: color ?? "currentColor",
|
|
114
|
+
strokeLinecap: cap,
|
|
115
|
+
strokeDasharray: circumference,
|
|
116
|
+
strokeDashoffset: offset,
|
|
117
|
+
style: {
|
|
118
|
+
transformOrigin: "center",
|
|
119
|
+
transform: "rotate(-90deg)",
|
|
120
|
+
transition: "stroke-dashoffset 0.6s, stroke-dasharray 0.6s",
|
|
121
|
+
opacity: percent === 0 ? 0 : void 0
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
});
|
|
129
|
+
var ProgressCircleValueText = React__namespace.forwardRef(function ProgressCircleValueText2(props, ref) {
|
|
130
|
+
const { className, children, ...rest } = props;
|
|
131
|
+
const { value, size: sizeKey } = React__namespace.useContext(Ctx);
|
|
132
|
+
const { textClass } = SIZE_MAP[sizeKey];
|
|
133
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
ref,
|
|
137
|
+
"aria-live": "polite",
|
|
138
|
+
className: cn(
|
|
139
|
+
"absolute inset-0 flex items-center justify-center",
|
|
140
|
+
"font-medium tracking-tight tabular-nums leading-none",
|
|
141
|
+
textClass,
|
|
142
|
+
className
|
|
143
|
+
),
|
|
144
|
+
...rest,
|
|
145
|
+
children: children ?? `${Math.round(value ?? 0)}%`
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
exports.ProgressCircleRing = ProgressCircleRing;
|
|
151
|
+
exports.ProgressCircleRoot = ProgressCircleRoot;
|
|
152
|
+
exports.ProgressCircleValueText = ProgressCircleValueText;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
declare const SIZE_MAP: {
|
|
4
|
+
readonly xs: {
|
|
5
|
+
readonly size: 24;
|
|
6
|
+
readonly thickness: 4;
|
|
7
|
+
readonly textClass: "text-[10px]";
|
|
8
|
+
};
|
|
9
|
+
readonly sm: {
|
|
10
|
+
readonly size: 32;
|
|
11
|
+
readonly thickness: 5;
|
|
12
|
+
readonly textClass: "text-[10px]";
|
|
13
|
+
};
|
|
14
|
+
readonly md: {
|
|
15
|
+
readonly size: 40;
|
|
16
|
+
readonly thickness: 6;
|
|
17
|
+
readonly textClass: "text-xs";
|
|
18
|
+
};
|
|
19
|
+
readonly lg: {
|
|
20
|
+
readonly size: 48;
|
|
21
|
+
readonly thickness: 7;
|
|
22
|
+
readonly textClass: "text-sm";
|
|
23
|
+
};
|
|
24
|
+
readonly xl: {
|
|
25
|
+
readonly size: 64;
|
|
26
|
+
readonly thickness: 8;
|
|
27
|
+
readonly textClass: "text-sm";
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
type Size = keyof typeof SIZE_MAP;
|
|
31
|
+
interface ProgressCircleRootProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'> {
|
|
32
|
+
readonly value?: number | null;
|
|
33
|
+
readonly size?: Size;
|
|
34
|
+
readonly colorPalette?: string;
|
|
35
|
+
}
|
|
36
|
+
declare const ProgressCircleRoot: React.ForwardRefExoticComponent<ProgressCircleRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
37
|
+
interface ProgressCircleRingProps extends Omit<React.SVGAttributes<SVGSVGElement>, 'color'> {
|
|
38
|
+
readonly trackColor?: string;
|
|
39
|
+
readonly cap?: React.SVGAttributes<SVGCircleElement>['strokeLinecap'];
|
|
40
|
+
readonly color?: string;
|
|
41
|
+
}
|
|
42
|
+
declare const ProgressCircleRing: React.ForwardRefExoticComponent<ProgressCircleRingProps & React.RefAttributes<SVGSVGElement>>;
|
|
43
|
+
interface ProgressCircleValueTextProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
44
|
+
}
|
|
45
|
+
declare const ProgressCircleValueText: React.ForwardRefExoticComponent<ProgressCircleValueTextProps & React.RefAttributes<HTMLDivElement>>;
|
|
46
|
+
|
|
47
|
+
export { ProgressCircleRing, type ProgressCircleRingProps, ProgressCircleRoot, type ProgressCircleRootProps, ProgressCircleValueText, type ProgressCircleValueTextProps };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
declare const SIZE_MAP: {
|
|
4
|
+
readonly xs: {
|
|
5
|
+
readonly size: 24;
|
|
6
|
+
readonly thickness: 4;
|
|
7
|
+
readonly textClass: "text-[10px]";
|
|
8
|
+
};
|
|
9
|
+
readonly sm: {
|
|
10
|
+
readonly size: 32;
|
|
11
|
+
readonly thickness: 5;
|
|
12
|
+
readonly textClass: "text-[10px]";
|
|
13
|
+
};
|
|
14
|
+
readonly md: {
|
|
15
|
+
readonly size: 40;
|
|
16
|
+
readonly thickness: 6;
|
|
17
|
+
readonly textClass: "text-xs";
|
|
18
|
+
};
|
|
19
|
+
readonly lg: {
|
|
20
|
+
readonly size: 48;
|
|
21
|
+
readonly thickness: 7;
|
|
22
|
+
readonly textClass: "text-sm";
|
|
23
|
+
};
|
|
24
|
+
readonly xl: {
|
|
25
|
+
readonly size: 64;
|
|
26
|
+
readonly thickness: 8;
|
|
27
|
+
readonly textClass: "text-sm";
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
type Size = keyof typeof SIZE_MAP;
|
|
31
|
+
interface ProgressCircleRootProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'> {
|
|
32
|
+
readonly value?: number | null;
|
|
33
|
+
readonly size?: Size;
|
|
34
|
+
readonly colorPalette?: string;
|
|
35
|
+
}
|
|
36
|
+
declare const ProgressCircleRoot: React.ForwardRefExoticComponent<ProgressCircleRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
37
|
+
interface ProgressCircleRingProps extends Omit<React.SVGAttributes<SVGSVGElement>, 'color'> {
|
|
38
|
+
readonly trackColor?: string;
|
|
39
|
+
readonly cap?: React.SVGAttributes<SVGCircleElement>['strokeLinecap'];
|
|
40
|
+
readonly color?: string;
|
|
41
|
+
}
|
|
42
|
+
declare const ProgressCircleRing: React.ForwardRefExoticComponent<ProgressCircleRingProps & React.RefAttributes<SVGSVGElement>>;
|
|
43
|
+
interface ProgressCircleValueTextProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
44
|
+
}
|
|
45
|
+
declare const ProgressCircleValueText: React.ForwardRefExoticComponent<ProgressCircleValueTextProps & React.RefAttributes<HTMLDivElement>>;
|
|
46
|
+
|
|
47
|
+
export { ProgressCircleRing, type ProgressCircleRingProps, ProgressCircleRoot, type ProgressCircleRootProps, ProgressCircleValueText, type ProgressCircleValueTextProps };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
// src/progress-circle.tsx
|
|
8
|
+
function cn(...inputs) {
|
|
9
|
+
return twMerge(clsx(inputs));
|
|
10
|
+
}
|
|
11
|
+
var SIZE_MAP = {
|
|
12
|
+
xs: { size: 24, thickness: 4, textClass: "text-[10px]" },
|
|
13
|
+
sm: { size: 32, thickness: 5, textClass: "text-[10px]" },
|
|
14
|
+
md: { size: 40, thickness: 6, textClass: "text-xs" },
|
|
15
|
+
lg: { size: 48, thickness: 7, textClass: "text-sm" },
|
|
16
|
+
xl: { size: 64, thickness: 8, textClass: "text-sm" }
|
|
17
|
+
};
|
|
18
|
+
var Ctx = React.createContext({
|
|
19
|
+
value: 0,
|
|
20
|
+
size: "md",
|
|
21
|
+
colorPalette: "blue"
|
|
22
|
+
});
|
|
23
|
+
var ProgressCircleRoot = React.forwardRef(function ProgressCircleRoot2(props, ref) {
|
|
24
|
+
const {
|
|
25
|
+
value = 0,
|
|
26
|
+
size = "md",
|
|
27
|
+
colorPalette = "blue",
|
|
28
|
+
className,
|
|
29
|
+
children,
|
|
30
|
+
...rest
|
|
31
|
+
} = props;
|
|
32
|
+
const ctx = React.useMemo(
|
|
33
|
+
() => ({ value: value ?? null, size, colorPalette }),
|
|
34
|
+
[value, size, colorPalette]
|
|
35
|
+
);
|
|
36
|
+
return /* @__PURE__ */ jsx(Ctx.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
ref,
|
|
40
|
+
role: "progressbar",
|
|
41
|
+
"aria-valuenow": value ?? void 0,
|
|
42
|
+
"aria-valuemin": 0,
|
|
43
|
+
"aria-valuemax": 100,
|
|
44
|
+
className: cn("relative inline-flex text-sm", className),
|
|
45
|
+
...rest,
|
|
46
|
+
children
|
|
47
|
+
}
|
|
48
|
+
) });
|
|
49
|
+
});
|
|
50
|
+
var ProgressCircleRing = React.forwardRef(function ProgressCircleRing2(props, ref) {
|
|
51
|
+
const { trackColor, cap, color, className, ...rest } = props;
|
|
52
|
+
const { value, size: sizeKey } = React.useContext(Ctx);
|
|
53
|
+
const { size, thickness } = SIZE_MAP[sizeKey];
|
|
54
|
+
const radius = size / 2 - thickness / 2;
|
|
55
|
+
const circumference = 2 * Math.PI * radius;
|
|
56
|
+
const percent = value ?? 0;
|
|
57
|
+
const offset = circumference * ((100 - percent) / 100);
|
|
58
|
+
return /* @__PURE__ */ jsxs(
|
|
59
|
+
"svg",
|
|
60
|
+
{
|
|
61
|
+
ref,
|
|
62
|
+
width: size,
|
|
63
|
+
height: size,
|
|
64
|
+
viewBox: `0 0 ${size} ${size}`,
|
|
65
|
+
className: cn(
|
|
66
|
+
value === null && "animate-spin",
|
|
67
|
+
className
|
|
68
|
+
),
|
|
69
|
+
...rest,
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
"circle",
|
|
73
|
+
{
|
|
74
|
+
cx: size / 2,
|
|
75
|
+
cy: size / 2,
|
|
76
|
+
r: radius,
|
|
77
|
+
fill: "transparent",
|
|
78
|
+
strokeWidth: thickness,
|
|
79
|
+
stroke: trackColor ?? "currentColor",
|
|
80
|
+
className: !trackColor ? "opacity-20" : void 0
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ jsx(
|
|
84
|
+
"circle",
|
|
85
|
+
{
|
|
86
|
+
cx: size / 2,
|
|
87
|
+
cy: size / 2,
|
|
88
|
+
r: radius,
|
|
89
|
+
fill: "transparent",
|
|
90
|
+
strokeWidth: thickness,
|
|
91
|
+
stroke: color ?? "currentColor",
|
|
92
|
+
strokeLinecap: cap,
|
|
93
|
+
strokeDasharray: circumference,
|
|
94
|
+
strokeDashoffset: offset,
|
|
95
|
+
style: {
|
|
96
|
+
transformOrigin: "center",
|
|
97
|
+
transform: "rotate(-90deg)",
|
|
98
|
+
transition: "stroke-dashoffset 0.6s, stroke-dasharray 0.6s",
|
|
99
|
+
opacity: percent === 0 ? 0 : void 0
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
var ProgressCircleValueText = React.forwardRef(function ProgressCircleValueText2(props, ref) {
|
|
108
|
+
const { className, children, ...rest } = props;
|
|
109
|
+
const { value, size: sizeKey } = React.useContext(Ctx);
|
|
110
|
+
const { textClass } = SIZE_MAP[sizeKey];
|
|
111
|
+
return /* @__PURE__ */ jsx(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
ref,
|
|
115
|
+
"aria-live": "polite",
|
|
116
|
+
className: cn(
|
|
117
|
+
"absolute inset-0 flex items-center justify-center",
|
|
118
|
+
"font-medium tracking-tight tabular-nums leading-none",
|
|
119
|
+
textClass,
|
|
120
|
+
className
|
|
121
|
+
),
|
|
122
|
+
...rest,
|
|
123
|
+
children: children ?? `${Math.round(value ?? 0)}%`
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export { ProgressCircleRing, ProgressCircleRoot, ProgressCircleValueText };
|