tfy-web-components 0.0.34 → 0.0.36
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/README.md +49 -58
- package/dist/Button-C77b7jpW.js +284 -0
- package/dist/Button-C77b7jpW.js.map +1 -0
- package/dist/CompositeItem-BGwD51jI.js +33 -0
- package/dist/CompositeItem-BGwD51jI.js.map +1 -0
- package/dist/CompositeList-D4xmSZ5V.js +291 -0
- package/dist/CompositeList-D4xmSZ5V.js.map +1 -0
- package/dist/CompositeRoot-BxrPc7F6.js +351 -0
- package/dist/CompositeRoot-BxrPc7F6.js.map +1 -0
- package/dist/DirectionContext-Pb9yafF5.js +11 -0
- package/dist/DirectionContext-Pb9yafF5.js.map +1 -0
- package/dist/FieldItemContext-DRVgx-D1.js +13 -0
- package/dist/FieldItemContext-DRVgx-D1.js.map +1 -0
- package/dist/{Input-BvwIpntS.js → Input-Dhmo6L2n.js} +100 -78
- package/dist/Input-Dhmo6L2n.js.map +1 -0
- package/dist/Modal-C4MUy9GD.js +696 -0
- package/dist/Modal-C4MUy9GD.js.map +1 -0
- package/dist/{MonacoEditorCore-xfpJ6z-E.js → MonacoEditorCore-n-df5f7I.js} +2 -2
- package/dist/{MonacoEditorCore-xfpJ6z-E.js.map → MonacoEditorCore-n-df5f7I.js.map} +1 -1
- package/dist/Popover-eC_vX5By.js +1074 -0
- package/dist/Popover-eC_vX5By.js.map +1 -0
- package/dist/ToolbarRootContext-B_HxjkNI.js +11 -0
- package/dist/ToolbarRootContext-B_HxjkNI.js.map +1 -0
- package/dist/Tooltip-BuGLP-PU.js +4096 -0
- package/dist/Tooltip-BuGLP-PU.js.map +1 -0
- package/dist/classNames-B1XpQHle.js +44 -0
- package/dist/classNames-B1XpQHle.js.map +1 -0
- package/dist/components/atoms/Accordion.d.ts +19 -37
- package/dist/components/atoms/Accordion.es.js +847 -78
- package/dist/components/atoms/Accordion.es.js.map +1 -1
- package/dist/components/atoms/AudioPlayer.es.js +9 -9
- package/dist/components/atoms/AudioPlayer.es.js.map +1 -1
- package/dist/components/atoms/Avatar.d.ts +42 -9
- package/dist/components/atoms/Avatar.es.js +491 -36
- package/dist/components/atoms/Avatar.es.js.map +1 -1
- package/dist/components/atoms/Badge.d.ts +40 -35
- package/dist/components/atoms/Badge.es.js +163 -53
- package/dist/components/atoms/Badge.es.js.map +1 -1
- package/dist/components/atoms/Button.d.ts +37 -16
- package/dist/components/atoms/Button.es.js +16 -221
- package/dist/components/atoms/Button.es.js.map +1 -1
- package/dist/components/atoms/ButtonGroup.d.ts +53 -0
- package/dist/components/atoms/ButtonGroup.es.js +349 -0
- package/dist/components/atoms/ButtonGroup.es.js.map +1 -0
- package/dist/components/atoms/IconButton.d.ts +23 -9
- package/dist/components/atoms/IconButton.es.js +82 -16
- package/dist/components/atoms/IconButton.es.js.map +1 -1
- package/dist/components/atoms/IconProvider.d.ts +5 -2
- package/dist/components/atoms/IconProvider.es.js +69 -10
- package/dist/components/atoms/IconProvider.es.js.map +1 -1
- package/dist/components/atoms/Logo.d.ts +18 -0
- package/dist/components/atoms/Logo.es.js +79 -0
- package/dist/components/atoms/Logo.es.js.map +1 -0
- package/dist/components/atoms/Modal.d.ts +27 -3
- package/dist/components/atoms/Modal.es.js +15 -16
- package/dist/components/atoms/Modal.es.js.map +1 -1
- package/dist/components/atoms/Notification.d.ts +1 -1
- package/dist/components/atoms/Notification.es.js +26 -3
- package/dist/components/atoms/Notification.es.js.map +1 -1
- package/dist/components/atoms/OutlinedRadio.d.ts +6 -2
- package/dist/components/atoms/OutlinedRadio.es.js +12 -25
- package/dist/components/atoms/OutlinedRadio.es.js.map +1 -1
- package/dist/components/atoms/Progress.d.ts +48 -0
- package/dist/components/atoms/Progress.es.js +279 -0
- package/dist/components/atoms/Progress.es.js.map +1 -0
- package/dist/components/atoms/Skeleton.d.ts +9 -3
- package/dist/components/atoms/Skeleton.es.js +33 -3
- package/dist/components/atoms/Skeleton.es.js.map +1 -1
- package/dist/components/atoms/Spinner.d.ts +15 -4
- package/dist/components/atoms/Spinner.es.js +86 -22
- package/dist/components/atoms/Spinner.es.js.map +1 -1
- package/dist/components/atoms/Switch.d.ts +19 -7
- package/dist/components/atoms/Switch.es.js +288 -50
- package/dist/components/atoms/Switch.es.js.map +1 -1
- package/dist/components/atoms/TabButton.d.ts +17 -3
- package/dist/components/atoms/TabButton.es.js +647 -25
- package/dist/components/atoms/TabButton.es.js.map +1 -1
- package/dist/components/atoms/TabPanel.es.js +1 -1
- package/dist/components/atoms/Tag.d.ts +43 -0
- package/dist/components/atoms/Tag.es.js +219 -0
- package/dist/components/atoms/Tag.es.js.map +1 -0
- package/dist/components/atoms/Tooltip.d.ts +36 -14
- package/dist/components/atoms/Tooltip.es.js +7 -114
- package/dist/components/atoms/Tooltip.es.js.map +1 -1
- package/dist/components/molecules/Alert.d.ts +1 -1
- package/dist/components/molecules/Alert.es.js +13 -9
- package/dist/components/molecules/Alert.es.js.map +1 -1
- package/dist/components/molecules/CopyField.d.ts +2 -2
- package/dist/components/molecules/CopyField.es.js +3 -4
- package/dist/components/molecules/CopyField.es.js.map +1 -1
- package/dist/components/molecules/CustomDrawer.d.ts +5 -4
- package/dist/components/molecules/CustomDrawer.es.js +141 -82
- package/dist/components/molecules/CustomDrawer.es.js.map +1 -1
- package/dist/components/molecules/Dialog.d.ts +16 -8
- package/dist/components/molecules/Dialog.es.js +33 -31
- package/dist/components/molecules/Dialog.es.js.map +1 -1
- package/dist/components/molecules/ImagesPreview.es.js +15 -11
- package/dist/components/molecules/ImagesPreview.es.js.map +1 -1
- package/dist/components/molecules/Input.d.ts +1 -1
- package/dist/components/molecules/Input.es.js +3 -5
- package/dist/components/molecules/Input.es.js.map +1 -1
- package/dist/components/molecules/Markdown/ExpandableMarkdown.d.ts +8 -8
- package/dist/components/molecules/Markdown/components.d.ts +12 -11
- package/dist/components/molecules/Markdown.es.js +26 -49
- package/dist/components/molecules/Markdown.es.js.map +1 -1
- package/dist/components/molecules/Notify.d.ts +30 -1
- package/dist/components/molecules/Notify.es.js +91 -36
- package/dist/components/molecules/Notify.es.js.map +1 -1
- package/dist/components/molecules/SimpleCodeEditor.es.js +32 -19
- package/dist/components/molecules/SimpleCodeEditor.es.js.map +1 -1
- package/dist/components/molecules/ToggleButton.d.ts +3 -2
- package/dist/components/molecules/ToggleButton.es.js +155 -57
- package/dist/components/molecules/ToggleButton.es.js.map +1 -1
- package/dist/components/molecules/agent-chat/UserMessage.es.js +2 -2
- package/dist/components/molecules/agent-chat/UserMessage.es.js.map +1 -1
- package/dist/components/molecules/agent-chat/UserMessageEdit.es.js +5 -5
- package/dist/components/molecules/agent-chat/UserMessageEdit.es.js.map +1 -1
- package/dist/components/molecules/agent-chat/index.d.ts +0 -6
- package/dist/components/molecules/agent-chat.es.js +76 -407
- package/dist/components/molecules/agent-chat.es.js.map +1 -1
- package/dist/components/molecules/monacoEditorCore/MonacoEditorCore.d.ts +0 -1
- package/dist/components/theme/colors.d.ts +17 -53
- package/dist/components/theme/colors.es.js +384 -180
- package/dist/components/theme/colors.es.js.map +1 -1
- package/dist/components/theme/theme.d.ts +14 -11
- package/dist/components/theme/theme.es.js +3 -64
- package/dist/components/theme/theme.es.js.map +1 -1
- package/dist/components/theme/useTheme.es.js +1 -4
- package/dist/components/theme/useTheme.es.js.map +1 -1
- package/dist/composite-CrCQWAKA.js +108 -0
- package/dist/composite-CrCQWAKA.js.map +1 -0
- package/dist/composite-DCpXNxz9.js +66 -0
- package/dist/composite-DCpXNxz9.js.map +1 -0
- package/dist/conversions-CbWPvHRE.js +14 -0
- package/dist/conversions-CbWPvHRE.js.map +1 -0
- package/dist/error-FX4R42W-.js +6 -0
- package/dist/error-FX4R42W-.js.map +1 -0
- package/dist/fonts.css +7 -0
- package/dist/hooks/useContainerDimensions.d.ts +1 -1
- package/dist/index-B806bfA-.js +257 -0
- package/dist/index-B806bfA-.js.map +1 -0
- package/dist/index-DSVg79g-.js +45 -0
- package/dist/index-DSVg79g-.js.map +1 -0
- package/dist/index.d.ts +21 -4
- package/dist/index.es.js +58 -9
- package/dist/index.es.js.map +1 -1
- package/dist/inertValue-IJM5NA30.js +11 -0
- package/dist/inertValue-IJM5NA30.js.map +1 -0
- package/dist/lib/utils.d.ts +1 -0
- package/dist/markdown.css +13 -14
- package/dist/new-components/atoms/Checkbox.d.ts +6 -0
- package/dist/new-components/atoms/Checkbox.es.js +423 -0
- package/dist/new-components/atoms/Checkbox.es.js.map +1 -0
- package/dist/new-components/atoms/Chip.d.ts +38 -0
- package/dist/new-components/atoms/Chip.es.js +269 -0
- package/dist/new-components/atoms/Chip.es.js.map +1 -0
- package/dist/new-components/atoms/Popover.d.ts +87 -0
- package/dist/new-components/atoms/Popover.es.js +21 -0
- package/dist/new-components/atoms/Popover.es.js.map +1 -0
- package/dist/new-components/atoms/Radio.d.ts +14 -0
- package/dist/new-components/atoms/Radio.es.js +536 -0
- package/dist/new-components/atoms/Radio.es.js.map +1 -0
- package/dist/new-components/atoms/SegmentedControl.d.ts +28 -0
- package/dist/new-components/atoms/SegmentedControl.es.js +326 -0
- package/dist/new-components/atoms/SegmentedControl.es.js.map +1 -0
- package/dist/new-components/atoms/Slider.d.ts +8 -0
- package/dist/new-components/atoms/Slider.es.js +1415 -0
- package/dist/new-components/atoms/Slider.es.js.map +1 -0
- package/dist/new-components/atoms/Toggletip.d.ts +43 -0
- package/dist/new-components/atoms/Toggletip.es.js +216 -0
- package/dist/new-components/atoms/Toggletip.es.js.map +1 -0
- package/dist/new-components/atoms/stories/ThemeComparison.d.ts +8 -0
- package/dist/shadowDom-Bq4g0Qeu.js +52 -0
- package/dist/shadowDom-Bq4g0Qeu.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/tfy-YZ5zY9Jw.js +6 -0
- package/dist/tfy-YZ5zY9Jw.js.map +1 -0
- package/dist/theme.css +9 -154
- package/dist/tokens.css +1124 -0
- package/dist/useAnimationFrame-DwhymJoW.js +108 -0
- package/dist/useAnimationFrame-DwhymJoW.js.map +1 -0
- package/dist/useAriaLabelledBy-B6n92QBS.js +49 -0
- package/dist/useAriaLabelledBy-B6n92QBS.js.map +1 -0
- package/dist/useBaseUiId-Ch7ujXpo.js +281 -0
- package/dist/useBaseUiId-Ch7ujXpo.js.map +1 -0
- package/dist/useButton-PUBhT4Vo.js +235 -0
- package/dist/useButton-PUBhT4Vo.js.map +1 -0
- package/dist/useControlled-BSyYkg5C.js +65 -0
- package/dist/useControlled-BSyYkg5C.js.map +1 -0
- package/dist/useIsoLayoutEffect-e9VA-ICd.js +499 -0
- package/dist/useIsoLayoutEffect-e9VA-ICd.js.map +1 -0
- package/dist/useLabelableId-DCLzrdD-.js +241 -0
- package/dist/useLabelableId-DCLzrdD-.js.map +1 -0
- package/dist/useOpenInteractionType-DGWLoAqp.js +1086 -0
- package/dist/useOpenInteractionType-DGWLoAqp.js.map +1 -0
- package/dist/usePopupHandleStore-BdS-xYID.js +2372 -0
- package/dist/usePopupHandleStore-BdS-xYID.js.map +1 -0
- package/dist/useTimeout-BXf1hDIL.js +46 -0
- package/dist/useTimeout-BXf1hDIL.js.map +1 -0
- package/dist/useTransitionStatus-C9gg_XJ-.js +202 -0
- package/dist/useTransitionStatus-C9gg_XJ-.js.map +1 -0
- package/dist/useValueAsRef-BfFRcMg6.js +28 -0
- package/dist/useValueAsRef-BfFRcMg6.js.map +1 -0
- package/dist/utils/classNames.d.ts +3 -2
- package/dist/visuallyHidden-B6H2X3_Y.js +26 -0
- package/dist/visuallyHidden-B6H2X3_Y.js.map +1 -0
- package/dist/vite-env.d.ts +18 -0
- package/package.json +30 -22
- package/dist/Input-BvwIpntS.js.map +0 -1
- package/dist/Notification-BT4CZ69U.js +0 -39
- package/dist/Notification-BT4CZ69U.js.map +0 -1
- package/dist/RootFontSizeContext-7vgn7Y_k.js +0 -22
- package/dist/RootFontSizeContext-7vgn7Y_k.js.map +0 -1
- package/dist/classNames-Dy-RXSjS.js +0 -9
- package/dist/classNames-Dy-RXSjS.js.map +0 -1
- package/dist/components/molecules/DropdownMenu.d.ts +0 -18
- package/dist/components/molecules/DropdownMenu.es.js +0 -104
- package/dist/components/molecules/DropdownMenu.es.js.map +0 -1
- package/dist/components/molecules/ThumbsFeedback.d.ts +0 -13
- package/dist/components/molecules/ThumbsFeedback.es.js +0 -98
- package/dist/components/molecules/ThumbsFeedback.es.js.map +0 -1
- package/dist/components/molecules/agent-chat/SandboxToolCall.d.ts +0 -15
- package/dist/components/molecules/agent-chat/ToolCallCard.d.ts +0 -26
- package/dist/components/molecules/agent-chat/ToolCallContentBlock.d.ts +0 -17
- package/dist/components/theme/lightColorPlugin.d.ts +0 -1
- package/dist/components/theme/lightColorPlugin.es.js +0 -92
- package/dist/components/theme/lightColorPlugin.es.js.map +0 -1
- package/dist/tailwindPreset.d.ts +0 -144
- package/dist/tailwindPreset.es.js +0 -100
- package/dist/tailwindPreset.es.js.map +0 -1
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { c as cva } from "../../index-DSVg79g-.js";
|
|
4
|
+
import IconProvider from "./IconProvider.es.js";
|
|
5
|
+
import { c as classNames } from "../../classNames-B1XpQHle.js";
|
|
6
|
+
const progressTrackVariants = cva("relative w-full overflow-hidden rounded-pill bg-border-subtle", {
|
|
7
|
+
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
sm: "h-1",
|
|
10
|
+
md: "h-2"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: { size: "sm" }
|
|
14
|
+
});
|
|
15
|
+
const toneClasses = {
|
|
16
|
+
brand: "bg-background-fill-brand",
|
|
17
|
+
success: "bg-background-fill-success",
|
|
18
|
+
error: "bg-background-fill-error"
|
|
19
|
+
};
|
|
20
|
+
const fillToneClasses = {
|
|
21
|
+
brand: "fill-background-fill-brand",
|
|
22
|
+
success: "fill-background-fill-success",
|
|
23
|
+
error: "fill-background-fill-error"
|
|
24
|
+
};
|
|
25
|
+
const strokeToneClasses = {
|
|
26
|
+
brand: "text-background-fill-brand",
|
|
27
|
+
success: "text-background-fill-success",
|
|
28
|
+
error: "text-background-fill-error"
|
|
29
|
+
};
|
|
30
|
+
function clampValue(value) {
|
|
31
|
+
return Number.isFinite(value) ? Math.min(100, Math.max(0, value)) : 0;
|
|
32
|
+
}
|
|
33
|
+
function Progress({
|
|
34
|
+
ref,
|
|
35
|
+
className,
|
|
36
|
+
value = 25,
|
|
37
|
+
loading = false,
|
|
38
|
+
tone = "brand",
|
|
39
|
+
size = "sm",
|
|
40
|
+
label = "Progress",
|
|
41
|
+
...props
|
|
42
|
+
}) {
|
|
43
|
+
const clampedValue = clampValue(value);
|
|
44
|
+
const indicatorRadius = size === "md" ? 4 : 2;
|
|
45
|
+
return /* @__PURE__ */ jsx(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
ref,
|
|
49
|
+
"data-slot": "progress",
|
|
50
|
+
role: "progressbar",
|
|
51
|
+
"aria-label": label,
|
|
52
|
+
"aria-valuemin": 0,
|
|
53
|
+
"aria-valuemax": 100,
|
|
54
|
+
"aria-valuenow": loading ? void 0 : clampedValue,
|
|
55
|
+
className: classNames(progressTrackVariants({ size }), className),
|
|
56
|
+
...props,
|
|
57
|
+
children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
58
|
+
/* @__PURE__ */ jsx("svg", { "aria-hidden": true, className: "absolute inset-0 size-full overflow-visible motion-reduce:hidden", children: /* @__PURE__ */ jsx(
|
|
59
|
+
"rect",
|
|
60
|
+
{
|
|
61
|
+
"data-slot": "progress-indicator",
|
|
62
|
+
x: "-40%",
|
|
63
|
+
width: "40%",
|
|
64
|
+
height: "100%",
|
|
65
|
+
rx: indicatorRadius,
|
|
66
|
+
className: fillToneClasses[tone],
|
|
67
|
+
children: /* @__PURE__ */ jsx("animate", { attributeName: "x", values: "-40%;100%", dur: "1.5s", repeatCount: "indefinite" })
|
|
68
|
+
}
|
|
69
|
+
) }),
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
"span",
|
|
72
|
+
{
|
|
73
|
+
"data-slot": "progress-indicator",
|
|
74
|
+
className: classNames(
|
|
75
|
+
"absolute inset-y-0 left-[30%] right-[30%] hidden rounded-pill motion-reduce:block",
|
|
76
|
+
toneClasses[tone]
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
] }) : /* @__PURE__ */ jsx("svg", { "aria-hidden": true, className: "absolute inset-0 size-full", children: /* @__PURE__ */ jsx(
|
|
81
|
+
"rect",
|
|
82
|
+
{
|
|
83
|
+
"data-slot": "progress-indicator",
|
|
84
|
+
width: `${clampedValue}%`,
|
|
85
|
+
height: "100%",
|
|
86
|
+
rx: indicatorRadius,
|
|
87
|
+
className: fillToneClasses[tone]
|
|
88
|
+
}
|
|
89
|
+
) })
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
const circleSizeClasses = {
|
|
94
|
+
sm: "size-[var(--size-24)]",
|
|
95
|
+
md: "size-[var(--size-40)]",
|
|
96
|
+
lg: "size-[var(--size-64)]"
|
|
97
|
+
};
|
|
98
|
+
function ProgressCircle({
|
|
99
|
+
ref,
|
|
100
|
+
className,
|
|
101
|
+
value = 50,
|
|
102
|
+
loading = false,
|
|
103
|
+
tone = "brand",
|
|
104
|
+
size = "sm",
|
|
105
|
+
showValue = true,
|
|
106
|
+
label = "Progress",
|
|
107
|
+
...props
|
|
108
|
+
}) {
|
|
109
|
+
const clampedValue = clampValue(value);
|
|
110
|
+
const strokeWidth = size === "lg" ? 4 : 3;
|
|
111
|
+
return /* @__PURE__ */ jsxs(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
ref,
|
|
115
|
+
"data-slot": "progress-circle",
|
|
116
|
+
role: "progressbar",
|
|
117
|
+
"aria-label": label,
|
|
118
|
+
"aria-valuemin": 0,
|
|
119
|
+
"aria-valuemax": 100,
|
|
120
|
+
"aria-valuenow": loading ? void 0 : clampedValue,
|
|
121
|
+
className: classNames("relative shrink-0", circleSizeClasses[size], strokeToneClasses[tone], className),
|
|
122
|
+
...props,
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ jsxs(
|
|
125
|
+
"svg",
|
|
126
|
+
{
|
|
127
|
+
"aria-hidden": true,
|
|
128
|
+
viewBox: "0 0 36 36",
|
|
129
|
+
className: classNames("size-full -rotate-90", loading && "motion-safe:animate-spin"),
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ jsx("circle", { cx: "18", cy: "18", r: "16", fill: "none", strokeWidth, className: "stroke-border-subtle" }),
|
|
132
|
+
/* @__PURE__ */ jsx(
|
|
133
|
+
"circle",
|
|
134
|
+
{
|
|
135
|
+
cx: "18",
|
|
136
|
+
cy: "18",
|
|
137
|
+
r: "16",
|
|
138
|
+
fill: "none",
|
|
139
|
+
pathLength: "100",
|
|
140
|
+
stroke: "currentColor",
|
|
141
|
+
strokeWidth,
|
|
142
|
+
strokeLinecap: "round",
|
|
143
|
+
strokeDasharray: loading ? "25 75" : "100",
|
|
144
|
+
strokeDashoffset: loading ? 0 : 100 - clampedValue
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
size === "lg" && showValue && !loading ? /* @__PURE__ */ jsxs(
|
|
151
|
+
"span",
|
|
152
|
+
{
|
|
153
|
+
"data-slot": "progress-circle-value",
|
|
154
|
+
className: "absolute inset-0 flex items-center justify-center text-label-md text-text-primary",
|
|
155
|
+
children: [
|
|
156
|
+
clampedValue,
|
|
157
|
+
"%"
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
) : null
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
function ProgressSteps({
|
|
166
|
+
ref,
|
|
167
|
+
className,
|
|
168
|
+
segments = 3,
|
|
169
|
+
completed = 1,
|
|
170
|
+
tone = "brand",
|
|
171
|
+
size = "sm",
|
|
172
|
+
label = "Progress steps",
|
|
173
|
+
...props
|
|
174
|
+
}) {
|
|
175
|
+
const normalizedCompleted = Math.min(segments, Math.max(0, completed));
|
|
176
|
+
return /* @__PURE__ */ jsx(
|
|
177
|
+
"div",
|
|
178
|
+
{
|
|
179
|
+
ref,
|
|
180
|
+
"data-slot": "progress-steps",
|
|
181
|
+
role: "progressbar",
|
|
182
|
+
"aria-label": label,
|
|
183
|
+
"aria-valuemin": 0,
|
|
184
|
+
"aria-valuemax": segments,
|
|
185
|
+
"aria-valuenow": normalizedCompleted,
|
|
186
|
+
className: classNames("flex w-full gap-space-4", size === "md" ? "h-2" : "h-1", className),
|
|
187
|
+
...props,
|
|
188
|
+
children: Array.from({ length: segments }, (_, index) => /* @__PURE__ */ jsx(
|
|
189
|
+
"span",
|
|
190
|
+
{
|
|
191
|
+
"data-slot": "progress-step",
|
|
192
|
+
"data-complete": index < normalizedCompleted || void 0,
|
|
193
|
+
className: classNames(
|
|
194
|
+
"h-full min-w-px flex-1 rounded-pill",
|
|
195
|
+
index < normalizedCompleted ? toneClasses[tone] : "bg-border-subtle"
|
|
196
|
+
)
|
|
197
|
+
},
|
|
198
|
+
index
|
|
199
|
+
))
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
function ProgressField({
|
|
204
|
+
ref,
|
|
205
|
+
className,
|
|
206
|
+
value = 50,
|
|
207
|
+
loading = false,
|
|
208
|
+
state = "default",
|
|
209
|
+
label,
|
|
210
|
+
message,
|
|
211
|
+
showValue = true,
|
|
212
|
+
size = "md",
|
|
213
|
+
...props
|
|
214
|
+
}) {
|
|
215
|
+
const tone = state === "default" ? "brand" : state;
|
|
216
|
+
const clampedValue = clampValue(value);
|
|
217
|
+
const messageId = React.useId();
|
|
218
|
+
return /* @__PURE__ */ jsxs(
|
|
219
|
+
"div",
|
|
220
|
+
{
|
|
221
|
+
ref,
|
|
222
|
+
"data-slot": "progress-field",
|
|
223
|
+
"data-state": state,
|
|
224
|
+
className: classNames("flex w-full flex-col gap-space-6", className),
|
|
225
|
+
...props,
|
|
226
|
+
children: [
|
|
227
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "progress-field-header", className: "flex items-center justify-between gap-space-8", children: [
|
|
228
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 text-label-md text-text-primary", children: label }),
|
|
229
|
+
showValue && !loading ? /* @__PURE__ */ jsxs("span", { className: "shrink-0 text-body-sm text-text-secondary", children: [
|
|
230
|
+
clampedValue,
|
|
231
|
+
"%"
|
|
232
|
+
] }) : null
|
|
233
|
+
] }),
|
|
234
|
+
/* @__PURE__ */ jsx(
|
|
235
|
+
Progress,
|
|
236
|
+
{
|
|
237
|
+
value,
|
|
238
|
+
loading,
|
|
239
|
+
tone,
|
|
240
|
+
size,
|
|
241
|
+
label: typeof label === "string" ? label : "Progress",
|
|
242
|
+
"aria-describedby": message ? messageId : void 0
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
message ? /* @__PURE__ */ jsxs(
|
|
246
|
+
"div",
|
|
247
|
+
{
|
|
248
|
+
id: messageId,
|
|
249
|
+
"data-slot": "progress-field-message",
|
|
250
|
+
className: classNames(
|
|
251
|
+
"flex items-start gap-space-4 text-body-sm",
|
|
252
|
+
state === "default" && "text-text-secondary",
|
|
253
|
+
state === "success" && "text-text-success",
|
|
254
|
+
state === "error" && "text-text-error"
|
|
255
|
+
),
|
|
256
|
+
children: [
|
|
257
|
+
state !== "default" ? /* @__PURE__ */ jsx(
|
|
258
|
+
IconProvider,
|
|
259
|
+
{
|
|
260
|
+
icon: state === "success" ? "check-circle" : "circle-xmark",
|
|
261
|
+
className: "mt-0.5 size-3 shrink-0"
|
|
262
|
+
}
|
|
263
|
+
) : null,
|
|
264
|
+
/* @__PURE__ */ jsx("span", { children: message })
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
) : null
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
export {
|
|
273
|
+
Progress,
|
|
274
|
+
ProgressCircle,
|
|
275
|
+
ProgressField,
|
|
276
|
+
ProgressSteps,
|
|
277
|
+
Progress as default
|
|
278
|
+
};
|
|
279
|
+
//# sourceMappingURL=Progress.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Progress.es.js","sources":["../../../src/components/atoms/Progress.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '@/lib/utils'\n\nimport IconProvider from './IconProvider'\n\nexport type ProgressTone = 'brand' | 'success' | 'error'\nexport type ProgressSize = 'sm' | 'md'\n\nconst progressTrackVariants = cva('relative w-full overflow-hidden rounded-pill bg-border-subtle', {\n variants: {\n size: {\n sm: 'h-1',\n md: 'h-2',\n },\n },\n defaultVariants: { size: 'sm' },\n})\n\nconst toneClasses: Record<ProgressTone, string> = {\n brand: 'bg-background-fill-brand',\n success: 'bg-background-fill-success',\n error: 'bg-background-fill-error',\n}\n\nconst fillToneClasses: Record<ProgressTone, string> = {\n brand: 'fill-background-fill-brand',\n success: 'fill-background-fill-success',\n error: 'fill-background-fill-error',\n}\n\nconst strokeToneClasses: Record<ProgressTone, string> = {\n brand: 'text-background-fill-brand',\n success: 'text-background-fill-success',\n error: 'text-background-fill-error',\n}\n\nfunction clampValue(value: number): number {\n return Number.isFinite(value) ? Math.min(100, Math.max(0, value)) : 0\n}\n\nexport type ProgressProps = Omit<React.ComponentProps<'div'>, 'children'> &\n VariantProps<typeof progressTrackVariants> & {\n ref?: React.Ref<HTMLDivElement>\n value?: number\n loading?: boolean\n tone?: ProgressTone\n label?: string\n }\n\nexport function Progress({\n ref,\n className,\n value = 25,\n loading = false,\n tone = 'brand',\n size = 'sm',\n label = 'Progress',\n ...props\n}: ProgressProps) {\n const clampedValue = clampValue(value)\n const indicatorRadius = size === 'md' ? 4 : 2\n\n return (\n <div\n ref={ref}\n data-slot=\"progress\"\n role=\"progressbar\"\n aria-label={label}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={loading ? undefined : clampedValue}\n className={cn(progressTrackVariants({ size }), className)}\n {...props}\n >\n {loading ? (\n <>\n <svg aria-hidden className=\"absolute inset-0 size-full overflow-visible motion-reduce:hidden\">\n <rect\n data-slot=\"progress-indicator\"\n x=\"-40%\"\n width=\"40%\"\n height=\"100%\"\n rx={indicatorRadius}\n className={fillToneClasses[tone]}\n >\n <animate attributeName=\"x\" values=\"-40%;100%\" dur=\"1.5s\" repeatCount=\"indefinite\" />\n </rect>\n </svg>\n <span\n data-slot=\"progress-indicator\"\n className={cn(\n 'absolute inset-y-0 left-[30%] right-[30%] hidden rounded-pill motion-reduce:block',\n toneClasses[tone],\n )}\n />\n </>\n ) : (\n <svg aria-hidden className=\"absolute inset-0 size-full\">\n <rect\n data-slot=\"progress-indicator\"\n width={`${clampedValue}%`}\n height=\"100%\"\n rx={indicatorRadius}\n className={fillToneClasses[tone]}\n />\n </svg>\n )}\n </div>\n )\n}\n\nexport type ProgressCircleSize = 'sm' | 'md' | 'lg'\n\nconst circleSizeClasses: Record<ProgressCircleSize, string> = {\n sm: 'size-[var(--size-24)]',\n md: 'size-[var(--size-40)]',\n lg: 'size-[var(--size-64)]',\n}\n\nexport interface ProgressCircleProps extends Omit<React.ComponentProps<'div'>, 'children'> {\n ref?: React.Ref<HTMLDivElement>\n value?: number\n loading?: boolean\n tone?: ProgressTone\n size?: ProgressCircleSize\n showValue?: boolean\n label?: string\n}\n\nexport function ProgressCircle({\n ref,\n className,\n value = 50,\n loading = false,\n tone = 'brand',\n size = 'sm',\n showValue = true,\n label = 'Progress',\n ...props\n}: ProgressCircleProps) {\n const clampedValue = clampValue(value)\n const strokeWidth = size === 'lg' ? 4 : 3\n\n return (\n <div\n ref={ref}\n data-slot=\"progress-circle\"\n role=\"progressbar\"\n aria-label={label}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={loading ? undefined : clampedValue}\n className={cn('relative shrink-0', circleSizeClasses[size], strokeToneClasses[tone], className)}\n {...props}\n >\n <svg\n aria-hidden\n viewBox=\"0 0 36 36\"\n className={cn('size-full -rotate-90', loading && 'motion-safe:animate-spin')}\n >\n <circle cx=\"18\" cy=\"18\" r=\"16\" fill=\"none\" strokeWidth={strokeWidth} className=\"stroke-border-subtle\" />\n <circle\n cx=\"18\"\n cy=\"18\"\n r=\"16\"\n fill=\"none\"\n pathLength=\"100\"\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeDasharray={loading ? '25 75' : '100'}\n strokeDashoffset={loading ? 0 : 100 - clampedValue}\n />\n </svg>\n {size === 'lg' && showValue && !loading ? (\n <span\n data-slot=\"progress-circle-value\"\n className=\"absolute inset-0 flex items-center justify-center text-label-md text-text-primary\"\n >\n {clampedValue}%\n </span>\n ) : null}\n </div>\n )\n}\n\nexport interface ProgressStepsProps extends Omit<React.ComponentProps<'div'>, 'children'> {\n ref?: React.Ref<HTMLDivElement>\n segments?: 3 | 4 | 5\n completed?: number\n tone?: ProgressTone\n size?: ProgressSize\n label?: string\n}\n\nexport function ProgressSteps({\n ref,\n className,\n segments = 3,\n completed = 1,\n tone = 'brand',\n size = 'sm',\n label = 'Progress steps',\n ...props\n}: ProgressStepsProps) {\n const normalizedCompleted = Math.min(segments, Math.max(0, completed))\n\n return (\n <div\n ref={ref}\n data-slot=\"progress-steps\"\n role=\"progressbar\"\n aria-label={label}\n aria-valuemin={0}\n aria-valuemax={segments}\n aria-valuenow={normalizedCompleted}\n className={cn('flex w-full gap-space-4', size === 'md' ? 'h-2' : 'h-1', className)}\n {...props}\n >\n {Array.from({ length: segments }, (_, index) => (\n <span\n key={index}\n data-slot=\"progress-step\"\n data-complete={index < normalizedCompleted || undefined}\n className={cn(\n 'h-full min-w-px flex-1 rounded-pill',\n index < normalizedCompleted ? toneClasses[tone] : 'bg-border-subtle',\n )}\n />\n ))}\n </div>\n )\n}\n\nexport type ProgressFieldState = 'default' | 'success' | 'error'\n\nexport interface ProgressFieldProps extends Omit<React.ComponentProps<'div'>, 'children'> {\n ref?: React.Ref<HTMLDivElement>\n value?: number\n loading?: boolean\n state?: ProgressFieldState\n label: React.ReactNode\n message?: React.ReactNode\n showValue?: boolean\n size?: ProgressSize\n}\n\nexport function ProgressField({\n ref,\n className,\n value = 50,\n loading = false,\n state = 'default',\n label,\n message,\n showValue = true,\n size = 'md',\n ...props\n}: ProgressFieldProps) {\n const tone = state === 'default' ? 'brand' : state\n const clampedValue = clampValue(value)\n const messageId = React.useId()\n\n return (\n <div\n ref={ref}\n data-slot=\"progress-field\"\n data-state={state}\n className={cn('flex w-full flex-col gap-space-6', className)}\n {...props}\n >\n <div data-slot=\"progress-field-header\" className=\"flex items-center justify-between gap-space-8\">\n <span className=\"min-w-0 text-label-md text-text-primary\">{label}</span>\n {showValue && !loading ? (\n <span className=\"shrink-0 text-body-sm text-text-secondary\">{clampedValue}%</span>\n ) : null}\n </div>\n <Progress\n value={value}\n loading={loading}\n tone={tone}\n size={size}\n label={typeof label === 'string' ? label : 'Progress'}\n aria-describedby={message ? messageId : undefined}\n />\n {message ? (\n <div\n id={messageId}\n data-slot=\"progress-field-message\"\n className={cn(\n 'flex items-start gap-space-4 text-body-sm',\n state === 'default' && 'text-text-secondary',\n state === 'success' && 'text-text-success',\n state === 'error' && 'text-text-error',\n )}\n >\n {state !== 'default' ? (\n <IconProvider\n icon={state === 'success' ? 'check-circle' : 'circle-xmark'}\n className=\"mt-0.5 size-3 shrink-0\"\n />\n ) : null}\n <span>{message}</span>\n </div>\n ) : null}\n </div>\n )\n}\n\nexport default Progress\n"],"names":["cn"],"mappings":";;;;;AAUA,MAAM,wBAAwB,IAAI,iEAAiE;AAAA,EACjG,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IAAA;AAAA,EACN;AAAA,EAEF,iBAAiB,EAAE,MAAM,KAAA;AAC3B,CAAC;AAED,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AC7C,WAAU;AAAA,gBAAA;AAAA,cAAA,IAEV;AAAA,cACJ,oBAAC,UAAM,UAAA,QAAA,CAAQ;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA,IAEf;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/** Legacy MUI Skeleton props used by ImagesPreview and similar. */
|
|
3
|
+
export type LegacySkeletonProps = Omit<React.ComponentProps<'div'>, 'children'> & {
|
|
4
|
+
variant?: 'rectangular' | 'circular' | 'text';
|
|
5
|
+
animation?: 'wave' | 'pulse' | false;
|
|
6
|
+
width?: number | string;
|
|
7
|
+
height?: number | string;
|
|
8
|
+
};
|
|
9
|
+
declare const Skeleton: React.FC<LegacySkeletonProps>;
|
|
4
10
|
export default Skeleton;
|
|
@@ -1,7 +1,37 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
return /* @__PURE__ */ jsx(
|
|
2
|
+
import { c as classNames } from "../../classNames-B1XpQHle.js";
|
|
3
|
+
function SkeletonBar({ className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsx(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
"data-slot": "skeleton",
|
|
8
|
+
className: classNames("animate-pulse rounded-md bg-background-surface-sunken", className),
|
|
9
|
+
...props
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
const Skeleton = ({
|
|
14
|
+
variant = "rectangular",
|
|
15
|
+
animation = "wave",
|
|
16
|
+
width,
|
|
17
|
+
height,
|
|
18
|
+
className,
|
|
19
|
+
style,
|
|
20
|
+
...props
|
|
21
|
+
}) => {
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
SkeletonBar,
|
|
24
|
+
{
|
|
25
|
+
className: classNames(
|
|
26
|
+
variant === "circular" && "rounded-full",
|
|
27
|
+
variant === "text" && "h-4 w-full",
|
|
28
|
+
animation === false && "animate-none",
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
style: { width, height, ...style },
|
|
32
|
+
...props
|
|
33
|
+
}
|
|
34
|
+
);
|
|
5
35
|
};
|
|
6
36
|
export {
|
|
7
37
|
Skeleton as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.es.js","sources":["../../../src/components/atoms/Skeleton.tsx"],"sourcesContent":["import React from 'react'\nimport {
|
|
1
|
+
{"version":3,"file":"Skeleton.es.js","sources":["../../../src/components/atoms/Skeleton.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\nfunction SkeletonBar({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"skeleton\"\n className={cn('animate-pulse rounded-md bg-background-surface-sunken', className)}\n {...props}\n />\n )\n}\n\n/** Legacy MUI Skeleton props used by ImagesPreview and similar. */\nexport type LegacySkeletonProps = Omit<React.ComponentProps<'div'>, 'children'> & {\n variant?: 'rectangular' | 'circular' | 'text'\n animation?: 'wave' | 'pulse' | false\n width?: number | string\n height?: number | string\n}\n\nconst Skeleton: React.FC<LegacySkeletonProps> = ({\n variant = 'rectangular',\n animation = 'wave',\n width,\n height,\n className,\n style,\n ...props\n}) => {\n return (\n <SkeletonBar\n className={cn(\n variant === 'circular' && 'rounded-full',\n variant === 'text' && 'h-4 w-full',\n animation === false && 'animate-none',\n className,\n )}\n style={{ width, height, ...style }}\n {...props}\n />\n )\n}\n\nexport default Skeleton\n"],"names":["cn"],"mappings":";;AAIA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAsC;AACzE,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAWA,WAAG,yDAAyD,SAAS;AAAA,MAC/E,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AAUA,MAAM,WAA0C,CAAC;AAAA,EAC/C,UAAU;AAAA,EACV,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWA;AAAAA,QACT,YAAY,cAAc;AAAA,QAC1B,YAAY,UAAU;AAAA,QACtB,cAAc,SAAS;AAAA,QACvB;AAAA,MAAA;AAAA,MAEF,OAAO,EAAE,OAAO,QAAQ,GAAG,MAAA;AAAA,MAC1B,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
declare const spinnerVariants: (props?: ({
|
|
4
|
+
size?: "sm" | "lg" | "xl" | "md" | null | undefined;
|
|
5
|
+
tone?: "inverse" | "brand" | "neutral" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export type SpinnerSize = NonNullable<VariantProps<typeof spinnerVariants>['size']>;
|
|
8
|
+
export type SpinnerTone = NonNullable<VariantProps<typeof spinnerVariants>['tone']>;
|
|
9
|
+
export declare function SpinnerMark({ className, size, tone, ...props }: React.ComponentProps<'span'> & VariantProps<typeof spinnerVariants>): React.JSX.Element;
|
|
10
|
+
export interface SpinnerProps extends Omit<React.ComponentProps<'span'>, 'children'> {
|
|
11
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
12
|
+
size?: SpinnerSize;
|
|
13
|
+
tone?: SpinnerTone;
|
|
4
14
|
small?: boolean;
|
|
5
15
|
big?: boolean;
|
|
6
16
|
medium?: boolean;
|
|
7
17
|
center?: boolean;
|
|
8
18
|
type?: 'normal';
|
|
9
19
|
}
|
|
10
|
-
|
|
20
|
+
/** Legacy flags map onto the nearest Figma size; prefer the size prop. */
|
|
21
|
+
declare function Spinner({ ref, className, size, tone, small, big, medium, center, ...props }: SpinnerProps): React.JSX.Element;
|
|
11
22
|
export default Spinner;
|
|
@@ -1,26 +1,90 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { c as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c as cva } from "../../index-DSVg79g-.js";
|
|
3
|
+
import { c as classNames } from "../../classNames-B1XpQHle.js";
|
|
4
|
+
const spinnerVariants = cva("", {
|
|
5
|
+
variants: {
|
|
6
|
+
size: {
|
|
7
|
+
sm: "size-[var(--size-12)]",
|
|
8
|
+
md: "size-[var(--size-16)]",
|
|
9
|
+
lg: "size-[var(--size-20)]",
|
|
10
|
+
xl: "size-[var(--size-24)]"
|
|
11
|
+
},
|
|
12
|
+
tone: {
|
|
13
|
+
brand: "text-background-fill-brand",
|
|
14
|
+
neutral: "text-icon-secondary",
|
|
15
|
+
inverse: "text-icon-inverse"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: { size: "md", tone: "brand" }
|
|
19
|
+
});
|
|
20
|
+
const spinnerStrokeVariants = cva("border-solid", {
|
|
21
|
+
variants: {
|
|
22
|
+
size: {
|
|
23
|
+
sm: "border-[0.09375rem]",
|
|
24
|
+
md: "border-2",
|
|
25
|
+
lg: "border-[0.15625rem]",
|
|
26
|
+
xl: "border-[0.1875rem]"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: { size: "md" }
|
|
30
|
+
});
|
|
31
|
+
function SpinnerMark({
|
|
32
|
+
className,
|
|
33
|
+
size,
|
|
34
|
+
tone,
|
|
35
|
+
...props
|
|
36
|
+
}) {
|
|
37
|
+
return /* @__PURE__ */ jsxs(
|
|
38
|
+
"span",
|
|
39
|
+
{
|
|
40
|
+
"data-slot": "spinner",
|
|
41
|
+
role: "status",
|
|
42
|
+
"aria-label": "Loading",
|
|
43
|
+
className: classNames("relative inline-block shrink-0", spinnerVariants({ size, tone }), className),
|
|
44
|
+
...props,
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
"span",
|
|
48
|
+
{
|
|
49
|
+
"data-slot": "spinner-track",
|
|
50
|
+
"aria-hidden": true,
|
|
51
|
+
className: classNames(
|
|
52
|
+
"absolute inset-0 rounded-full",
|
|
53
|
+
spinnerStrokeVariants({ size }),
|
|
54
|
+
tone === "inverse" ? "border-icon-inverse opacity-[0.24]" : "border-border-subtle"
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
"span",
|
|
60
|
+
{
|
|
61
|
+
"data-slot": "spinner-indicator",
|
|
62
|
+
"aria-hidden": true,
|
|
63
|
+
className: classNames(
|
|
64
|
+
"absolute inset-0 animate-spin rounded-full border-transparent border-r-current border-t-current motion-reduce:animate-none",
|
|
65
|
+
spinnerStrokeVariants({ size })
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
function Spinner({ ref, className, size, tone = "brand", small, big, medium, center, ...props }) {
|
|
74
|
+
const resolvedSize = size ?? (big || medium ? "xl" : small ? "md" : "xl");
|
|
75
|
+
return /* @__PURE__ */ jsx(
|
|
76
|
+
SpinnerMark,
|
|
77
|
+
{
|
|
78
|
+
ref,
|
|
79
|
+
size: resolvedSize,
|
|
80
|
+
tone,
|
|
81
|
+
className: classNames(center && "mx-auto block", className),
|
|
82
|
+
...props
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
23
86
|
export {
|
|
87
|
+
SpinnerMark,
|
|
24
88
|
Spinner as default
|
|
25
89
|
};
|
|
26
90
|
//# sourceMappingURL=Spinner.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.es.js","sources":["../../../src/components/atoms/Spinner.tsx"],"sourcesContent":["import React from 'react'\n\nimport
|
|
1
|
+
{"version":3,"file":"Spinner.es.js","sources":["../../../src/components/atoms/Spinner.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '@/lib/utils'\n\nconst spinnerVariants = cva('', {\n variants: {\n size: {\n sm: 'size-[var(--size-12)]',\n md: 'size-[var(--size-16)]',\n lg: 'size-[var(--size-20)]',\n xl: 'size-[var(--size-24)]',\n },\n tone: {\n brand: 'text-background-fill-brand',\n neutral: 'text-icon-secondary',\n inverse: 'text-icon-inverse',\n },\n },\n defaultVariants: { size: 'md', tone: 'brand' },\n})\n\nconst spinnerStrokeVariants = cva('border-solid', {\n variants: {\n size: {\n sm: 'border-[0.09375rem]',\n md: 'border-2',\n lg: 'border-[0.15625rem]',\n xl: 'border-[0.1875rem]',\n },\n },\n defaultVariants: { size: 'md' },\n})\n\nexport type SpinnerSize = NonNullable<VariantProps<typeof spinnerVariants>['size']>\nexport type SpinnerTone = NonNullable<VariantProps<typeof spinnerVariants>['tone']>\n\nexport function SpinnerMark({\n className,\n size,\n tone,\n ...props\n}: React.ComponentProps<'span'> & VariantProps<typeof spinnerVariants>) {\n return (\n <span\n data-slot=\"spinner\"\n role=\"status\"\n aria-label=\"Loading\"\n className={cn('relative inline-block shrink-0', spinnerVariants({ size, tone }), className)}\n {...props}\n >\n <span\n data-slot=\"spinner-track\"\n aria-hidden\n className={cn(\n 'absolute inset-0 rounded-full',\n spinnerStrokeVariants({ size }),\n tone === 'inverse' ? 'border-icon-inverse opacity-[0.24]' : 'border-border-subtle',\n )}\n />\n <span\n data-slot=\"spinner-indicator\"\n aria-hidden\n className={cn(\n 'absolute inset-0 animate-spin rounded-full border-transparent border-r-current border-t-current motion-reduce:animate-none',\n spinnerStrokeVariants({ size }),\n )}\n />\n </span>\n )\n}\n\nexport interface SpinnerProps extends Omit<React.ComponentProps<'span'>, 'children'> {\n ref?: React.Ref<HTMLSpanElement>\n size?: SpinnerSize\n tone?: SpinnerTone\n small?: boolean\n big?: boolean\n medium?: boolean\n center?: boolean\n type?: 'normal'\n}\n\n/** Legacy flags map onto the nearest Figma size; prefer the size prop. */\nfunction Spinner({ ref, className, size, tone = 'brand', small, big, medium, center, ...props }: SpinnerProps) {\n const resolvedSize = size ?? (big || medium ? 'xl' : small ? 'md' : 'xl')\n\n return (\n <SpinnerMark\n ref={ref}\n size={resolvedSize}\n tone={tone}\n className={cn(center && 'mx-auto block', className)}\n {...props}\n />\n )\n}\n\nexport default Spinner\n"],"names":["cn"],"mappings":";;;AAKA,MAAM,kBAAkB,IAAI,IAAI;AAAA,EAC9B,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IAAA;AAAA,IAEN,MAAM;AAAA,MACJ,OAAO;AAAA,MACP,SAAS;AAAA,MACT,SAAS;AAAA,IAAA;AAAA,EACX;AAAA,EAEF,iBAAiB,EAAE,MAAM,MAAM,MAAM,QAAA;AACvC,CAAC;AAED,MAAM,wBAAwB,IAAI,gBAAgB;AAAA,EAChD,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IAAA;AAAA,EACN;AAAA,EAEF,iBAAiB,EAAE,MAAM,KAAA;AAC3B,CAAC;AAKM,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAwE;AACtE,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACV,MAAK;AAAA,MACL,cAAW;AAAA,MACX,WAAWA,WAAG,kCAAkC,gBAAgB,EAAE,MAAM,KAAA,CAAM,GAAG,SAAS;AAAA,MACzF,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,aAAU;AAAA,YACV,eAAW;AAAA,YACX,WAAWA;AAAAA,cACT;AAAA,cACA,sBAAsB,EAAE,MAAM;AAAA,cAC9B,SAAS,YAAY,uCAAuC;AAAA,YAAA;AAAA,UAC9D;AAAA,QAAA;AAAA,QAEF;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,aAAU;AAAA,YACV,eAAW;AAAA,YACX,WAAWA;AAAAA,cACT;AAAA,cACA,sBAAsB,EAAE,KAAA,CAAM;AAAA,YAAA;AAAA,UAChC;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;AAcA,SAAS,QAAQ,EAAE,KAAK,WAAW,MAAM,OAAO,SAAS,OAAO,KAAK,QAAQ,QAAQ,GAAG,SAAuB;AAC7G,QAAM,eAAe,SAAS,OAAO,SAAS,OAAO,QAAQ,OAAO;AAEpE,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,MAAM;AAAA,MACN;AAAA,MACA,WAAWA,WAAG,UAAU,iBAAiB,SAAS;AAAA,MACjD,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Switch as SwitchPrimitive } from '@base-ui/react/switch';
|
|
3
|
+
/** Legacy MUI Switch styled props — mapped to atoms Switch (Base UI). */
|
|
4
|
+
export interface StyledSwitchProps extends Omit<SwitchPrimitive.Root.Props, 'onCheckedChange' | 'onChange'> {
|
|
5
|
+
/**
|
|
6
|
+
* Legacy MUI hidden-input attributes. `id`, `name`, `value`, `required`, `aria-*`, and `data-test`
|
|
7
|
+
* are forwarded to the Base UI root (Base UI renders a hidden form input when `name` is set).
|
|
8
|
+
*/
|
|
9
|
+
inputProps?: React.InputHTMLAttributes<HTMLInputElement> & {
|
|
10
|
+
'data-test'?: string;
|
|
11
|
+
};
|
|
12
|
+
/** @deprecated No-op — size is fixed by design tokens. */
|
|
7
13
|
widthMultiple?: number;
|
|
14
|
+
/** @deprecated No-op — size is fixed by design tokens. */
|
|
8
15
|
heightMultiple?: number;
|
|
16
|
+
/** @deprecated No-op — size is fixed by design tokens. */
|
|
9
17
|
thumbWidthMultiple?: number;
|
|
18
|
+
/** Base UI / new API */
|
|
19
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
20
|
+
/** Legacy MUI-style change handler */
|
|
21
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
|
|
10
22
|
}
|
|
11
|
-
declare const Switch:
|
|
23
|
+
declare const Switch: React.FC<StyledSwitchProps>;
|
|
12
24
|
export default Switch;
|