tfy-web-components 0.0.42 → 0.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Button-BMEClWyK.js → Button-CPJYHldw.js} +3 -2
- package/dist/{Button-BMEClWyK.js.map → Button-CPJYHldw.js.map} +1 -1
- package/dist/{CompositeItem-BGwD51jI.js → CompositeItem-DJWNsIwE.js} +2 -2
- package/dist/{CompositeItem-BGwD51jI.js.map → CompositeItem-DJWNsIwE.js.map} +1 -1
- package/dist/{CompositeRoot-BxrPc7F6.js → CompositeRoot-BlljDWkR.js} +5 -5
- package/dist/{CompositeRoot-BxrPc7F6.js.map → CompositeRoot-BlljDWkR.js.map} +1 -1
- package/dist/{Input-OmtWyaSl.js → Input-Dcxu6SVO.js} +3 -3
- package/dist/{Input-OmtWyaSl.js.map → Input-Dcxu6SVO.js.map} +1 -1
- package/dist/{Modal-MUzR0rK2.js → Modal-BUWlwJcN.js} +18 -18
- package/dist/{Modal-MUzR0rK2.js.map → Modal-BUWlwJcN.js.map} +1 -1
- package/dist/{Popover-CBnt1wgJ.js → Popover-BqqXJnK1.js} +10 -10
- package/dist/{Popover-CBnt1wgJ.js.map → Popover-BqqXJnK1.js.map} +1 -1
- package/dist/{Tooltip-BkP9fnI0.js → Tooltip-uQIVdskf.js} +8 -8
- package/dist/{Tooltip-BkP9fnI0.js.map → Tooltip-uQIVdskf.js.map} +1 -1
- package/dist/components/atoms/Accordion.d.ts +20 -4
- package/dist/components/atoms/Accordion.es.js +74 -26
- package/dist/components/atoms/Accordion.es.js.map +1 -1
- package/dist/components/atoms/Button.d.ts +1 -0
- package/dist/components/atoms/Button.es.js +2 -2
- package/dist/components/atoms/ButtonGroup.d.ts +10 -5
- package/dist/components/atoms/ButtonGroup.es.js +95 -39
- package/dist/components/atoms/ButtonGroup.es.js.map +1 -1
- package/dist/components/atoms/IconButton.es.js +2 -2
- package/dist/components/atoms/Modal.es.js +6 -6
- package/dist/components/atoms/OverflowButton.es.js +2 -2
- package/dist/components/atoms/Switch.es.js +5 -5
- package/dist/components/atoms/Switch.es.js.map +1 -1
- package/dist/components/atoms/TabButton.es.js +6 -6
- package/dist/components/atoms/Tooltip.es.js +1 -1
- package/dist/components/molecules/Alert.es.js +3 -3
- package/dist/components/molecules/CopyField.es.js +2 -2
- package/dist/components/molecules/CustomDrawer.es.js +1 -1
- package/dist/components/molecules/Dialog.es.js +1 -1
- package/dist/components/molecules/ImagesPreview.es.js +2 -2
- package/dist/components/molecules/Input.es.js +2 -2
- package/dist/components/molecules/Markdown.es.js +2 -2
- package/dist/components/molecules/Markdown.es.js.map +1 -1
- package/dist/components/molecules/SimpleCodeEditor.es.js +2 -2
- package/dist/components/molecules/ToggleButton.es.js +2 -2
- package/dist/components/molecules/agent-chat.es.js +2 -2
- package/dist/{composite-DCpXNxz9.js → composite-BL4bbAWg.js} +2 -2
- package/dist/{composite-DCpXNxz9.js.map → composite-BL4bbAWg.js.map} +1 -1
- package/dist/{composite-CrCQWAKA.js → composite-C22yiNy1.js} +2 -2
- package/dist/{composite-CrCQWAKA.js.map → composite-C22yiNy1.js.map} +1 -1
- package/dist/{index-B806bfA-.js → index-C-2yrwZl.js} +3 -3
- package/dist/{index-B806bfA-.js.map → index-C-2yrwZl.js.map} +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +23 -12
- package/dist/index.es.js.map +1 -1
- package/dist/new-components/atoms/Alert.d.ts +31 -0
- package/dist/new-components/atoms/Alert.es.js +158 -0
- package/dist/new-components/atoms/Alert.es.js.map +1 -0
- package/dist/new-components/atoms/Checkbox.es.js +4 -4
- package/dist/new-components/atoms/EmptyState.d.ts +44 -0
- package/dist/new-components/atoms/EmptyState.es.js +234 -0
- package/dist/new-components/atoms/EmptyState.es.js.map +1 -0
- package/dist/new-components/atoms/Popover.es.js +2 -2
- package/dist/new-components/atoms/Radio.es.js +8 -8
- package/dist/new-components/atoms/SegmentedControl.es.js +4 -4
- package/dist/new-components/atoms/Slider.es.js +5 -5
- package/dist/new-components/atoms/Toast.d.ts +79 -0
- package/dist/new-components/atoms/Toast.es.js +449 -0
- package/dist/new-components/atoms/Toast.es.js.map +1 -0
- package/dist/new-components/atoms/Toggletip.es.js +3 -3
- package/dist/new-components/atoms/Toggletip.es.js.map +1 -1
- package/dist/{shadowDom-Bq4g0Qeu.js → shadowDom-BfewIqRj.js} +2 -2
- package/dist/{shadowDom-Bq4g0Qeu.js.map → shadowDom-BfewIqRj.js.map} +1 -1
- package/dist/style.css +1 -1
- package/dist/tokens.css +16 -5
- package/dist/{useAriaLabelledBy-B6n92QBS.js → useAriaLabelledBy-Lyj6n_TU.js} +2 -2
- package/dist/{useAriaLabelledBy-B6n92QBS.js.map → useAriaLabelledBy-Lyj6n_TU.js.map} +1 -1
- package/dist/{useBaseUiId-Ch7ujXpo.js → useBaseUiId-CmLtG9DS.js} +4 -4
- package/dist/{useBaseUiId-Ch7ujXpo.js.map → useBaseUiId-CmLtG9DS.js.map} +1 -1
- package/dist/{useButton-PUBhT4Vo.js → useButton-D2BMuSfC.js} +2 -2
- package/dist/{useButton-PUBhT4Vo.js.map → useButton-D2BMuSfC.js.map} +1 -1
- package/dist/{useLabelableId-DCLzrdD-.js → useLabelableId-CcIE3RU0.js} +2 -2
- package/dist/{useLabelableId-DCLzrdD-.js.map → useLabelableId-CcIE3RU0.js.map} +1 -1
- package/dist/{useOpenInteractionType-DGWLoAqp.js → useOpenInteractionType-CDFYOw2d.js} +9 -9
- package/dist/{useOpenInteractionType-DGWLoAqp.js.map → useOpenInteractionType-CDFYOw2d.js.map} +1 -1
- package/dist/{usePopupHandleStore-BdS-xYID.js → usePopupHandleStore-CkW2IoED.js} +32 -32
- package/dist/{usePopupHandleStore-BdS-xYID.js.map → usePopupHandleStore-CkW2IoED.js.map} +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { c as cva } from "../../index-DSVg79g-.js";
|
|
4
4
|
import IconProvider, { iconFrame } from "./IconProvider.es.js";
|
|
5
5
|
import { SpinnerMark } from "./Spinner.es.js";
|
|
6
|
-
import { L as LightTooltip, D as DarkTooltip, t as tooltipTrigger } from "../../Tooltip-
|
|
6
|
+
import { L as LightTooltip, D as DarkTooltip, t as tooltipTrigger } from "../../Tooltip-uQIVdskf.js";
|
|
7
7
|
import { c as classNames } from "../../classNames-B1XpQHle.js";
|
|
8
8
|
const buttonGroupVariants = cva(
|
|
9
9
|
[
|
|
@@ -36,7 +36,7 @@ const buttonGroupVariants = cva(
|
|
|
36
36
|
);
|
|
37
37
|
const buttonGroupItemVariants = cva(
|
|
38
38
|
[
|
|
39
|
-
"outline-
|
|
39
|
+
"focus-ring focus-visible:outline-offset-[0.25rem] relative inline-flex shrink-0 cursor-pointer items-center justify-center whitespace-nowrap transition-colors",
|
|
40
40
|
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
41
41
|
"[&_[data-slot=button-group-icon]]:pointer-events-none [&_[data-slot=button-group-icon]]:shrink-0"
|
|
42
42
|
],
|
|
@@ -48,31 +48,29 @@ const buttonGroupItemVariants = cva(
|
|
|
48
48
|
'before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] before:border before:border-button-secondary-border before:content-[""]',
|
|
49
49
|
"hover:bg-button-secondary-background-hover hover:text-button-secondary-text-hover",
|
|
50
50
|
"hover:[&_[data-slot=button-group-icon]]:text-button-secondary-icon-hover",
|
|
51
|
-
"data-
|
|
52
|
-
"data-[selected=true]:before:border-button-secondary-border-selected",
|
|
53
|
-
"[&_[data-slot=button-group-icon]]:text-button-secondary-icon",
|
|
54
|
-
"data-[selected=true]:[&_[data-slot=button-group-icon]]:text-button-secondary-icon-selected"
|
|
51
|
+
"[&_[data-slot=button-group-icon]]:text-button-secondary-icon"
|
|
55
52
|
],
|
|
56
53
|
ghost: [
|
|
57
54
|
"bg-transparent text-button-ghost-text",
|
|
58
55
|
"hover:bg-button-ghost-background-hover",
|
|
59
|
-
"data-
|
|
60
|
-
"[&_[data-slot=button-group-icon]]:text-button-ghost-icon",
|
|
61
|
-
"data-[selected=true]:[&_[data-slot=button-group-icon]]:text-button-ghost-icon-selected"
|
|
56
|
+
"[&_[data-slot=button-group-icon]]:text-button-ghost-icon"
|
|
62
57
|
],
|
|
63
58
|
loading: [
|
|
64
59
|
"bg-button-primary-background text-button-primary-text shadow-xs hover:bg-button-primary-background-hover",
|
|
65
60
|
"[&_[data-slot=button-group-icon]]:text-icon-on-inverse"
|
|
66
61
|
]
|
|
67
62
|
},
|
|
63
|
+
tone: {
|
|
64
|
+
neutral: "",
|
|
65
|
+
brand: ""
|
|
66
|
+
},
|
|
68
67
|
kind: {
|
|
69
68
|
text: "",
|
|
70
69
|
icon: "p-0"
|
|
71
70
|
},
|
|
72
71
|
size: {
|
|
73
72
|
default: "",
|
|
74
|
-
md: ""
|
|
75
|
-
sm: ""
|
|
73
|
+
md: ""
|
|
76
74
|
},
|
|
77
75
|
roundness: {
|
|
78
76
|
default: "rounded-sm",
|
|
@@ -82,14 +80,36 @@ const buttonGroupItemVariants = cva(
|
|
|
82
80
|
compoundVariants: [
|
|
83
81
|
{ kind: "text", size: "default", className: "h-8 gap-space-4 px-space-10 text-label-md" },
|
|
84
82
|
{ kind: "text", size: "md", className: "h-6 gap-space-4 px-space-8 text-label-sm" },
|
|
85
|
-
{ kind: "text", size: "sm", className: "h-6 gap-space-4 px-space-8 text-label-sm" },
|
|
86
83
|
{ kind: "icon", size: "default", className: "size-8" },
|
|
87
84
|
{ kind: "icon", size: "md", className: "size-6" },
|
|
88
|
-
{
|
|
89
|
-
|
|
85
|
+
{
|
|
86
|
+
variant: "secondary",
|
|
87
|
+
tone: "neutral",
|
|
88
|
+
className: [
|
|
89
|
+
"data-[selected=true]:bg-button-secondary-background-selected data-[selected=true]:text-button-secondary-text-selected",
|
|
90
|
+
"data-[selected=true]:before:border-button-secondary-border-selected",
|
|
91
|
+
"data-[selected=true]:[&_[data-slot=button-group-icon]]:text-button-secondary-icon-selected"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
variant: "ghost",
|
|
96
|
+
tone: "neutral",
|
|
97
|
+
className: [
|
|
98
|
+
"data-[selected=true]:bg-button-ghost-background-selected data-[selected=true]:text-button-ghost-text-selected",
|
|
99
|
+
"data-[selected=true]:[&_[data-slot=button-group-icon]]:text-button-ghost-icon-selected"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
tone: "brand",
|
|
104
|
+
className: [
|
|
105
|
+
"data-[selected=true]:bg-background-brand-bold data-[selected=true]:before:border-background-brand-bold",
|
|
106
|
+
"data-[selected=true]:text-text-on-bold data-[selected=true]:[&_[data-slot=button-group-icon]]:text-icon-on-bold"
|
|
107
|
+
]
|
|
108
|
+
}
|
|
90
109
|
],
|
|
91
110
|
defaultVariants: {
|
|
92
111
|
variant: "secondary",
|
|
112
|
+
tone: "neutral",
|
|
93
113
|
kind: "text",
|
|
94
114
|
size: "default",
|
|
95
115
|
roundness: "default"
|
|
@@ -103,6 +123,8 @@ function ButtonGroup({
|
|
|
103
123
|
variant = "secondary",
|
|
104
124
|
size = "default",
|
|
105
125
|
roundness = "default",
|
|
126
|
+
tone = "neutral",
|
|
127
|
+
disabled = false,
|
|
106
128
|
orientation = "horizontal",
|
|
107
129
|
value: valueProp,
|
|
108
130
|
defaultValue = "",
|
|
@@ -126,11 +148,13 @@ function ButtonGroup({
|
|
|
126
148
|
variant,
|
|
127
149
|
size,
|
|
128
150
|
roundness,
|
|
151
|
+
tone,
|
|
129
152
|
orientation: orientation ?? "horizontal",
|
|
153
|
+
disabled,
|
|
130
154
|
value,
|
|
131
155
|
select
|
|
132
156
|
}),
|
|
133
|
-
[orientation, roundness, select, size, value, variant]
|
|
157
|
+
[disabled, orientation, roundness, select, size, tone, value, variant]
|
|
134
158
|
);
|
|
135
159
|
return /* @__PURE__ */ jsx(ButtonGroupContext.Provider, { value: context, children: /* @__PURE__ */ jsx(
|
|
136
160
|
"div",
|
|
@@ -139,6 +163,8 @@ function ButtonGroup({
|
|
|
139
163
|
role,
|
|
140
164
|
"data-slot": "button-group",
|
|
141
165
|
"data-orientation": orientation,
|
|
166
|
+
"data-tone": tone,
|
|
167
|
+
"data-disabled": disabled || void 0,
|
|
142
168
|
className: classNames(buttonGroupVariants({ orientation }), className),
|
|
143
169
|
...props,
|
|
144
170
|
children
|
|
@@ -155,13 +181,15 @@ function useSelectableItem({
|
|
|
155
181
|
value,
|
|
156
182
|
selected,
|
|
157
183
|
loading,
|
|
184
|
+
disabled = false,
|
|
158
185
|
onClick
|
|
159
186
|
}) {
|
|
160
187
|
const context = useButtonGroup(component);
|
|
188
|
+
const isDisabled = disabled || context.disabled;
|
|
161
189
|
const isSelected = !loading && (selected ?? (value !== void 0 && context.value === value));
|
|
162
190
|
const handleClick = React.useCallback(
|
|
163
191
|
(event) => {
|
|
164
|
-
if (loading) {
|
|
192
|
+
if (loading || isDisabled) {
|
|
165
193
|
event.preventDefault();
|
|
166
194
|
return;
|
|
167
195
|
}
|
|
@@ -170,9 +198,12 @@ function useSelectableItem({
|
|
|
170
198
|
context.select(value, event);
|
|
171
199
|
}
|
|
172
200
|
},
|
|
173
|
-
[context, isSelected, loading, onClick, value]
|
|
201
|
+
[context, isDisabled, isSelected, loading, onClick, value]
|
|
174
202
|
);
|
|
175
|
-
return { context, isSelected, handleClick };
|
|
203
|
+
return { context, isDisabled, isSelected, handleClick };
|
|
204
|
+
}
|
|
205
|
+
function formatCount(count) {
|
|
206
|
+
return count > 99 ? "99+" : String(count);
|
|
176
207
|
}
|
|
177
208
|
function ButtonGroupItem({
|
|
178
209
|
ref,
|
|
@@ -184,28 +215,33 @@ function ButtonGroupItem({
|
|
|
184
215
|
disabledTooltip,
|
|
185
216
|
disabled = false,
|
|
186
217
|
loading = false,
|
|
218
|
+
count,
|
|
187
219
|
onClick,
|
|
188
220
|
className,
|
|
189
221
|
children,
|
|
190
222
|
"aria-label": ariaLabel,
|
|
191
223
|
...props
|
|
192
224
|
}) {
|
|
193
|
-
const { context, isSelected, handleClick } = useSelectableItem({
|
|
225
|
+
const { context, isDisabled, isSelected, handleClick } = useSelectableItem({
|
|
194
226
|
component: "ButtonGroup.Item",
|
|
195
227
|
value,
|
|
196
228
|
selected,
|
|
197
229
|
loading,
|
|
230
|
+
disabled,
|
|
198
231
|
onClick
|
|
199
232
|
});
|
|
200
|
-
const
|
|
201
|
-
const frame = iconFrame[textSize === "default" ? "16" : "12"];
|
|
233
|
+
const frame = iconFrame[context.size === "default" ? "16" : "12"];
|
|
202
234
|
const itemVariant = loading ? "loading" : context.variant;
|
|
203
|
-
const
|
|
204
|
-
const
|
|
235
|
+
const itemTone = loading ? "neutral" : context.tone;
|
|
236
|
+
const tooltipTitle = isDisabled ? disabledTooltip ?? tooltip : tooltip;
|
|
237
|
+
const TooltipWrap = isDisabled ? LightTooltip : DarkTooltip;
|
|
238
|
+
const countDisplay = count !== void 0 && !loading ? formatCount(count) : null;
|
|
239
|
+
const baseLabel = ariaLabel ?? (typeof children === "string" ? children : void 0);
|
|
240
|
+
const accessibleName = baseLabel !== void 0 && countDisplay !== null ? `${baseLabel}, ${countDisplay}` : baseLabel;
|
|
205
241
|
const iconNode = loading ? /* @__PURE__ */ jsx("span", { "data-slot": "button-group-icon", className: "inline-flex shrink-0", children: /* @__PURE__ */ jsx(
|
|
206
242
|
SpinnerMark,
|
|
207
243
|
{
|
|
208
|
-
size:
|
|
244
|
+
size: context.size === "default" ? "md" : "sm",
|
|
209
245
|
tone: "inverse",
|
|
210
246
|
role: void 0,
|
|
211
247
|
"aria-label": void 0,
|
|
@@ -220,6 +256,19 @@ function ButtonGroupItem({
|
|
|
220
256
|
children: /* @__PURE__ */ jsx(IconProvider, { icon, size: frame.glyph })
|
|
221
257
|
}
|
|
222
258
|
) : null;
|
|
259
|
+
const countNode = countDisplay !== null ? /* @__PURE__ */ jsx(
|
|
260
|
+
"span",
|
|
261
|
+
{
|
|
262
|
+
"data-slot": "button-group-count",
|
|
263
|
+
"aria-hidden": true,
|
|
264
|
+
className: classNames(
|
|
265
|
+
"inline-flex h-5 items-center px-space-8 text-label-sm",
|
|
266
|
+
context.roundness === "rounded" ? "rounded-pill" : "rounded-sm",
|
|
267
|
+
isSelected ? "bg-text-on-bold/20 text-text-on-bold" : "bg-background-item-selected text-text-secondary"
|
|
268
|
+
),
|
|
269
|
+
children: countDisplay
|
|
270
|
+
}
|
|
271
|
+
) : null;
|
|
223
272
|
const button = /* @__PURE__ */ jsxs(
|
|
224
273
|
"button",
|
|
225
274
|
{
|
|
@@ -227,20 +276,22 @@ function ButtonGroupItem({
|
|
|
227
276
|
type: "button",
|
|
228
277
|
"data-slot": "button-group-button",
|
|
229
278
|
"data-variant": itemVariant,
|
|
230
|
-
"data-size":
|
|
279
|
+
"data-size": context.size,
|
|
280
|
+
"data-tone": itemTone,
|
|
231
281
|
"data-selected": isSelected || void 0,
|
|
232
282
|
"data-loading": loading || void 0,
|
|
233
283
|
"aria-pressed": isSelected || void 0,
|
|
234
284
|
"aria-busy": loading || void 0,
|
|
235
|
-
"aria-disabled":
|
|
236
|
-
disabled,
|
|
285
|
+
"aria-disabled": isDisabled || loading || void 0,
|
|
286
|
+
disabled: isDisabled,
|
|
237
287
|
onClick: handleClick,
|
|
238
|
-
"aria-label":
|
|
288
|
+
"aria-label": accessibleName,
|
|
239
289
|
className: classNames(
|
|
240
290
|
buttonGroupItemVariants({
|
|
241
291
|
variant: itemVariant,
|
|
292
|
+
tone: itemTone,
|
|
242
293
|
kind: "text",
|
|
243
|
-
size:
|
|
294
|
+
size: context.size,
|
|
244
295
|
roundness: context.roundness
|
|
245
296
|
}),
|
|
246
297
|
className
|
|
@@ -249,11 +300,12 @@ function ButtonGroupItem({
|
|
|
249
300
|
children: [
|
|
250
301
|
iconPosition === "left" && iconNode,
|
|
251
302
|
children,
|
|
252
|
-
iconPosition === "right" && iconNode
|
|
303
|
+
iconPosition === "right" && iconNode,
|
|
304
|
+
countNode
|
|
253
305
|
]
|
|
254
306
|
}
|
|
255
307
|
);
|
|
256
|
-
return /* @__PURE__ */ jsx("span", { "data-slot": "button-group-item", children: tooltipTitle ? /* @__PURE__ */ jsx(TooltipWrap, { title: tooltipTitle, children: tooltipTrigger(
|
|
308
|
+
return /* @__PURE__ */ jsx("span", { "data-slot": "button-group-item", children: tooltipTitle ? /* @__PURE__ */ jsx(TooltipWrap, { title: tooltipTitle, children: tooltipTrigger(isDisabled, button) }) : button });
|
|
257
309
|
}
|
|
258
310
|
function ButtonGroupIconItem({
|
|
259
311
|
ref,
|
|
@@ -271,18 +323,20 @@ function ButtonGroupIconItem({
|
|
|
271
323
|
"aria-label": ariaLabel,
|
|
272
324
|
...props
|
|
273
325
|
}) {
|
|
274
|
-
const { context, isSelected, handleClick } = useSelectableItem({
|
|
326
|
+
const { context, isDisabled, isSelected, handleClick } = useSelectableItem({
|
|
275
327
|
component: "ButtonGroup.IconItem",
|
|
276
328
|
value,
|
|
277
329
|
selected,
|
|
278
330
|
loading,
|
|
331
|
+
disabled,
|
|
279
332
|
onClick
|
|
280
333
|
});
|
|
281
334
|
const itemVariant = loading ? "loading" : context.variant;
|
|
282
|
-
const
|
|
283
|
-
const
|
|
335
|
+
const itemTone = loading ? "neutral" : context.tone;
|
|
336
|
+
const tooltipTitle = isDisabled ? disabledTooltip ?? tooltip : tooltip;
|
|
337
|
+
const TooltipWrap = isDisabled ? LightTooltip : DarkTooltip;
|
|
284
338
|
const accessibleName = ariaLabel ?? (typeof tooltip === "string" ? tooltip : void 0);
|
|
285
|
-
const frame = iconFrame[
|
|
339
|
+
const frame = iconFrame["16"];
|
|
286
340
|
const resolvedIconSize = iconSize ?? frame.glyph;
|
|
287
341
|
const button = /* @__PURE__ */ jsx(
|
|
288
342
|
"button",
|
|
@@ -292,17 +346,19 @@ function ButtonGroupIconItem({
|
|
|
292
346
|
"data-slot": "button-group-button",
|
|
293
347
|
"data-variant": itemVariant,
|
|
294
348
|
"data-size": context.size,
|
|
349
|
+
"data-tone": itemTone,
|
|
295
350
|
"data-selected": isSelected || void 0,
|
|
296
351
|
"data-loading": loading || void 0,
|
|
297
352
|
"aria-label": accessibleName,
|
|
298
353
|
"aria-pressed": isSelected || void 0,
|
|
299
354
|
"aria-busy": loading || void 0,
|
|
300
|
-
"aria-disabled":
|
|
301
|
-
disabled,
|
|
355
|
+
"aria-disabled": isDisabled || loading || void 0,
|
|
356
|
+
disabled: isDisabled,
|
|
302
357
|
onClick: handleClick,
|
|
303
358
|
className: classNames(
|
|
304
359
|
buttonGroupItemVariants({
|
|
305
360
|
variant: itemVariant,
|
|
361
|
+
tone: itemTone,
|
|
306
362
|
kind: "icon",
|
|
307
363
|
size: context.size,
|
|
308
364
|
roundness: context.roundness
|
|
@@ -313,7 +369,7 @@ function ButtonGroupIconItem({
|
|
|
313
369
|
children: loading ? /* @__PURE__ */ jsx("span", { "data-slot": "button-group-icon", className: "inline-flex shrink-0", children: /* @__PURE__ */ jsx(
|
|
314
370
|
SpinnerMark,
|
|
315
371
|
{
|
|
316
|
-
size: context.size === "
|
|
372
|
+
size: context.size === "md" ? "sm" : "md",
|
|
317
373
|
tone: "inverse",
|
|
318
374
|
role: void 0,
|
|
319
375
|
"aria-label": void 0,
|
|
@@ -330,7 +386,7 @@ function ButtonGroupIconItem({
|
|
|
330
386
|
)
|
|
331
387
|
}
|
|
332
388
|
);
|
|
333
|
-
return /* @__PURE__ */ jsx("span", { "data-slot": "button-group-item", children: /* @__PURE__ */ jsx(TooltipWrap, { title: tooltipTitle, children: tooltipTrigger(
|
|
389
|
+
return /* @__PURE__ */ jsx("span", { "data-slot": "button-group-item", children: /* @__PURE__ */ jsx(TooltipWrap, { title: tooltipTitle, children: tooltipTrigger(isDisabled, button) }) });
|
|
334
390
|
}
|
|
335
391
|
const ButtonGroupCompound = ButtonGroup;
|
|
336
392
|
ButtonGroupCompound.Item = ButtonGroupItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonGroup.es.js","sources":["../../../src/components/atoms/ButtonGroup.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '@/lib/utils'\n\nimport IconProvider, { iconFrame, type IconProp } from './IconProvider'\nimport { SpinnerMark } from './Spinner'\nimport { DarkTooltip, LightTooltip, tooltipTrigger } from './Tooltip'\n\nconst buttonGroupVariants = cva(\n [\n 'isolate inline-flex',\n '[&>[data-slot=button-group-item]]:relative [&>[data-slot=button-group-item]]:inline-flex',\n '[&_[data-slot=button-group-button]]:relative [&_[data-slot=button-group-button]]:focus-visible:z-20',\n '[&_[data-slot=button-group-button]]:hover:z-10 [&_[data-slot=button-group-button][data-selected=true]]:z-10',\n ],\n {\n variants: {\n orientation: {\n horizontal: [\n 'flex-row',\n '[&>[data-slot=button-group-item]:not(:first-child)_[data-slot=button-group-button]]:rounded-s-none',\n '[&>[data-slot=button-group-item]:not(:first-child)_[data-slot=button-group-button]]:before:border-s-0',\n '[&>[data-slot=button-group-item]:not(:last-child)_[data-slot=button-group-button]]:rounded-e-none',\n ],\n vertical: [\n 'flex-col',\n '[&>[data-slot=button-group-item]:not(:first-child)_[data-slot=button-group-button]]:rounded-t-none',\n '[&>[data-slot=button-group-item]:not(:first-child)_[data-slot=button-group-button]]:before:border-t-0',\n '[&>[data-slot=button-group-item]:not(:last-child)_[data-slot=button-group-button]]:rounded-b-none',\n ],\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n },\n },\n)\n\nconst buttonGroupItemVariants = cva(\n [\n 'outline-none relative inline-flex shrink-0 cursor-pointer items-center justify-center whitespace-nowrap transition-colors',\n 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',\n '[&_[data-slot=button-group-icon]]:pointer-events-none [&_[data-slot=button-group-icon]]:shrink-0',\n ],\n {\n variants: {\n variant: {\n secondary: [\n 'bg-button-secondary-background text-button-secondary-text shadow-xs',\n 'before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] before:border before:border-button-secondary-border before:content-[\"\"]',\n 'hover:bg-button-secondary-background-hover hover:text-button-secondary-text-hover',\n 'hover:[&_[data-slot=button-group-icon]]:text-button-secondary-icon-hover',\n 'data-[selected=true]:bg-button-secondary-background-selected data-[selected=true]:text-button-secondary-text-selected',\n 'data-[selected=true]:before:border-button-secondary-border-selected',\n '[&_[data-slot=button-group-icon]]:text-button-secondary-icon',\n 'data-[selected=true]:[&_[data-slot=button-group-icon]]:text-button-secondary-icon-selected',\n ],\n ghost: [\n 'bg-transparent text-button-ghost-text',\n 'hover:bg-button-ghost-background-hover',\n 'data-[selected=true]:bg-button-ghost-background-selected data-[selected=true]:text-button-ghost-text-selected',\n '[&_[data-slot=button-group-icon]]:text-button-ghost-icon',\n 'data-[selected=true]:[&_[data-slot=button-group-icon]]:text-button-ghost-icon-selected',\n ],\n loading: [\n 'bg-button-primary-background text-button-primary-text shadow-xs hover:bg-button-primary-background-hover',\n '[&_[data-slot=button-group-icon]]:text-icon-on-inverse',\n ],\n },\n kind: {\n text: '',\n icon: 'p-0',\n },\n size: {\n default: '',\n md: '',\n sm: '',\n },\n roundness: {\n default: 'rounded-sm',\n rounded: 'rounded-pill',\n },\n },\n compoundVariants: [\n { kind: 'text', size: 'default', className: 'h-8 gap-space-4 px-space-10 text-label-md' },\n { kind: 'text', size: 'md', className: 'h-6 gap-space-4 px-space-8 text-label-sm' },\n { kind: 'text', size: 'sm', className: 'h-6 gap-space-4 px-space-8 text-label-sm' },\n { kind: 'icon', size: 'default', className: 'size-8' },\n { kind: 'icon', size: 'md', className: 'size-6' },\n { kind: 'icon', size: 'sm', roundness: 'default', className: 'size-4 rounded-sm' },\n { kind: 'icon', size: 'sm', roundness: 'rounded', className: 'size-4' },\n ],\n defaultVariants: {\n variant: 'secondary',\n kind: 'text',\n size: 'default',\n roundness: 'default',\n },\n },\n)\n\ntype ButtonGroupVariant = 'secondary' | 'ghost'\ntype ButtonGroupSize = 'default' | 'md' | 'sm'\ntype ButtonGroupRoundness = 'default' | 'rounded'\ntype ButtonGroupOrientation = NonNullable<VariantProps<typeof buttonGroupVariants>['orientation']>\n\ntype ButtonGroupContextValue = {\n variant: ButtonGroupVariant\n size: ButtonGroupSize\n roundness: ButtonGroupRoundness\n orientation: ButtonGroupOrientation\n value: string\n select: (value: string, event: React.MouseEvent<HTMLButtonElement>) => void\n}\n\nconst ButtonGroupContext = React.createContext<ButtonGroupContextValue | null>(null)\n\nexport type ButtonGroupProps = Omit<React.ComponentProps<'div'>, 'defaultValue' | 'onChange'> &\n VariantProps<typeof buttonGroupVariants> & {\n variant?: ButtonGroupVariant\n size?: ButtonGroupSize\n roundness?: ButtonGroupRoundness\n value?: string\n defaultValue?: string\n onValueChange?: (value: string, event: React.MouseEvent<HTMLButtonElement>) => void\n }\n\nfunction ButtonGroup({\n ref,\n className,\n variant = 'secondary',\n size = 'default',\n roundness = 'default',\n orientation = 'horizontal',\n value: valueProp,\n defaultValue = '',\n onValueChange,\n children,\n role = 'group',\n ...props\n}: ButtonGroupProps) {\n const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue)\n const controlled = valueProp !== undefined\n const value = controlled ? valueProp : uncontrolledValue\n\n const select = React.useCallback(\n (nextValue: string, event: React.MouseEvent<HTMLButtonElement>) => {\n if (!controlled) setUncontrolledValue(nextValue)\n onValueChange?.(nextValue, event)\n },\n [controlled, onValueChange],\n )\n\n const context = React.useMemo<ButtonGroupContextValue>(\n () => ({\n variant,\n size,\n roundness,\n orientation: orientation ?? 'horizontal',\n value,\n select,\n }),\n [orientation, roundness, select, size, value, variant],\n )\n\n return (\n <ButtonGroupContext.Provider value={context}>\n <div\n ref={ref}\n role={role}\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={cn(buttonGroupVariants({ orientation }), className)}\n {...props}\n >\n {children}\n </div>\n </ButtonGroupContext.Provider>\n )\n}\n\nfunction useButtonGroup(component: string) {\n const context = React.useContext(ButtonGroupContext)\n if (!context) throw new Error(`${component} must be used within ButtonGroup`)\n return context\n}\n\ntype SelectableItemProps = {\n value?: string\n selected?: boolean\n}\n\nfunction useSelectableItem({\n component,\n value,\n selected,\n loading,\n onClick,\n}: SelectableItemProps & {\n component: string\n loading: boolean\n onClick?: React.MouseEventHandler<HTMLButtonElement>\n}) {\n const context = useButtonGroup(component)\n const isSelected = !loading && (selected ?? (value !== undefined && context.value === value))\n\n const handleClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n (event) => {\n if (loading) {\n event.preventDefault()\n return\n }\n onClick?.(event)\n if (!event.defaultPrevented && value !== undefined && !isSelected) {\n context.select(value, event)\n }\n },\n [context, isSelected, loading, onClick, value],\n )\n\n return { context, isSelected, handleClick }\n}\n\ntype ButtonGroupItemProps = Omit<React.ComponentProps<'button'>, 'size'> &\n SelectableItemProps & {\n icon?: IconProp\n iconPosition?: 'left' | 'right'\n tooltip?: React.ReactNode\n disabledTooltip?: React.ReactNode\n loading?: boolean\n }\n\nfunction ButtonGroupItem({\n ref,\n value,\n selected,\n icon,\n iconPosition = 'left',\n tooltip,\n disabledTooltip,\n disabled = false,\n loading = false,\n onClick,\n className,\n children,\n 'aria-label': ariaLabel,\n ...props\n}: ButtonGroupItemProps) {\n const { context, isSelected, handleClick } = useSelectableItem({\n component: 'ButtonGroup.Item',\n value,\n selected,\n loading,\n onClick,\n })\n const textSize = context.size === 'default' ? 'default' : 'md'\n const frame = iconFrame[textSize === 'default' ? '16' : '12']\n const itemVariant = loading ? 'loading' : context.variant\n const tooltipTitle = disabled ? disabledTooltip ?? tooltip : tooltip\n const TooltipWrap = disabled ? LightTooltip : DarkTooltip\n\n const iconNode = loading ? (\n <span data-slot=\"button-group-icon\" className=\"inline-flex shrink-0\">\n <SpinnerMark\n size={textSize === 'default' ? 'md' : 'sm'}\n tone=\"inverse\"\n role={undefined}\n aria-label={undefined}\n aria-hidden\n />\n </span>\n ) : icon ? (\n <span\n data-slot=\"button-group-icon\"\n data-icon={String(icon)}\n className={cn('inline-flex shrink-0 items-center justify-center', frame.frameClass)}\n >\n <IconProvider icon={icon} size={frame.glyph} />\n </span>\n ) : null\n\n const button = (\n <button\n ref={ref}\n type=\"button\"\n data-slot=\"button-group-button\"\n data-variant={itemVariant}\n data-size={textSize}\n data-selected={isSelected || undefined}\n data-loading={loading || undefined}\n aria-pressed={isSelected || undefined}\n aria-busy={loading || undefined}\n aria-disabled={disabled || loading || undefined}\n disabled={disabled}\n onClick={handleClick}\n aria-label={loading && typeof children === 'string' ? ariaLabel ?? children : ariaLabel}\n className={cn(\n buttonGroupItemVariants({\n variant: itemVariant,\n kind: 'text',\n size: textSize,\n roundness: context.roundness,\n }),\n className,\n )}\n {...props}\n >\n {iconPosition === 'left' && iconNode}\n {children}\n {iconPosition === 'right' && iconNode}\n </button>\n )\n\n return (\n <span data-slot=\"button-group-item\">\n {tooltipTitle ? <TooltipWrap title={tooltipTitle}>{tooltipTrigger(disabled, button)}</TooltipWrap> : button}\n </span>\n )\n}\n\ntype ButtonGroupIconItemProps = Omit<React.ComponentProps<'button'>, 'children' | 'size'> &\n SelectableItemProps & {\n icon: IconProp\n iconSize?: number\n tooltip: React.ReactNode\n disabledTooltip?: React.ReactNode\n loading?: boolean\n }\n\nfunction ButtonGroupIconItem({\n ref,\n value,\n selected,\n icon,\n iconSize,\n tooltip,\n disabledTooltip,\n disabled = false,\n loading = false,\n onClick,\n className,\n type = 'button',\n 'aria-label': ariaLabel,\n ...props\n}: ButtonGroupIconItemProps) {\n const { context, isSelected, handleClick } = useSelectableItem({\n component: 'ButtonGroup.IconItem',\n value,\n selected,\n loading,\n onClick,\n })\n const itemVariant = loading ? 'loading' : context.variant\n const tooltipTitle = disabled ? disabledTooltip ?? tooltip : tooltip\n const TooltipWrap = disabled ? LightTooltip : DarkTooltip\n const accessibleName = ariaLabel ?? (typeof tooltip === 'string' ? tooltip : undefined)\n const frame = iconFrame[context.size === 'sm' ? '12' : context.size === 'md' ? '24' : '16']\n const resolvedIconSize = iconSize ?? frame.glyph\n\n const button = (\n <button\n ref={ref}\n type={type}\n data-slot=\"button-group-button\"\n data-variant={itemVariant}\n data-size={context.size}\n data-selected={isSelected || undefined}\n data-loading={loading || undefined}\n aria-label={accessibleName}\n aria-pressed={isSelected || undefined}\n aria-busy={loading || undefined}\n aria-disabled={disabled || loading || undefined}\n disabled={disabled}\n onClick={handleClick}\n className={cn(\n buttonGroupItemVariants({\n variant: itemVariant,\n kind: 'icon',\n size: context.size,\n roundness: context.roundness,\n }),\n className,\n )}\n {...props}\n >\n {loading ? (\n <span data-slot=\"button-group-icon\" className=\"inline-flex shrink-0\">\n <SpinnerMark\n size={context.size === 'sm' ? 'sm' : 'md'}\n tone=\"inverse\"\n role={undefined}\n aria-label={undefined}\n aria-hidden\n />\n </span>\n ) : (\n <span\n data-slot=\"button-group-icon\"\n data-icon={String(icon)}\n className={cn('inline-flex shrink-0 items-center justify-center', frame.frameClass)}\n >\n <IconProvider icon={icon} size={resolvedIconSize} />\n </span>\n )}\n </button>\n )\n\n return (\n <span data-slot=\"button-group-item\">\n <TooltipWrap title={tooltipTitle}>{tooltipTrigger(disabled, button)}</TooltipWrap>\n </span>\n )\n}\n\ntype ButtonGroupComponent = typeof ButtonGroup & {\n Item: typeof ButtonGroupItem\n IconItem: typeof ButtonGroupIconItem\n}\n\nconst ButtonGroupCompound = ButtonGroup as ButtonGroupComponent\nButtonGroupCompound.Item = ButtonGroupItem\nButtonGroupCompound.IconItem = ButtonGroupIconItem\n\nexport {\n ButtonGroupCompound as ButtonGroup,\n ButtonGroupIconItem,\n ButtonGroupItem,\n buttonGroupItemVariants,\n buttonGroupVariants,\n}\nexport type {\n ButtonGroupIconItemProps,\n ButtonGroupItemProps,\n ButtonGroupOrientation,\n ButtonGroupRoundness,\n ButtonGroupSize,\n ButtonGroupVariant,\n}\n\nexport default ButtonGroupCompound\n"],"names":["cn"],"mappings":";;;;;;;AASA,MAAM,sBAAsB;AAAA,EAC1B;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EA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K;AAAA,UACL,MAAM;AAAA,UACN,cAAY;AAAA,UACZ,eAAW;AAAA,QAAA;AAAA,MAAA,GAEf,IAEA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,aAAU;AAAA,UACV,aAAW,OAAO,IAAI;AAAA,UACtB,WAAWA,WAAG,oDAAoD,MAAM,UAAU;AAAA,UAElF,UAAA,oBAAC,cAAA,EAAa,MAAY,MAAM,iBAAA,CAAkB;AAAA,QAAA;AAAA,MAAA;AAAA,IACpD;AAAA,EAAA;AAKN,SACE,oBAAC,QAAA,EAAK,aAAU,qBACd,UAAA,oBAAC,aAAA,EAAY,OAAO,cAAe,UAAA,eAAe,UAAU,MAAM,EAAA,CAAE,GACtE;AAEJ;AAOA,MAAM,sBAAsB;AAC5B,oBAAoB,OAAO;AAC3B,oBAAoB,WAAW;"}
|
|
1
|
+
{"version":3,"file":"ButtonGroup.es.js","sources":["../../../src/components/atoms/ButtonGroup.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '@/lib/utils'\n\nimport IconProvider, { iconFrame, type IconProp } from './IconProvider'\nimport { SpinnerMark } from './Spinner'\nimport { DarkTooltip, LightTooltip, tooltipTrigger } from './Tooltip'\n\nconst buttonGroupVariants = cva(\n [\n 'isolate inline-flex',\n '[&>[data-slot=button-group-item]]:relative [&>[data-slot=button-group-item]]:inline-flex',\n '[&_[data-slot=button-group-button]]:relative [&_[data-slot=button-group-button]]:focus-visible:z-20',\n '[&_[data-slot=button-group-button]]:hover:z-10 [&_[data-slot=button-group-button][data-selected=true]]:z-10',\n ],\n {\n variants: {\n orientation: {\n horizontal: [\n 'flex-row',\n '[&>[data-slot=button-group-item]:not(:first-child)_[data-slot=button-group-button]]:rounded-s-none',\n '[&>[data-slot=button-group-item]:not(:first-child)_[data-slot=button-group-button]]:before:border-s-0',\n '[&>[data-slot=button-group-item]:not(:last-child)_[data-slot=button-group-button]]:rounded-e-none',\n ],\n vertical: [\n 'flex-col',\n '[&>[data-slot=button-group-item]:not(:first-child)_[data-slot=button-group-button]]:rounded-t-none',\n '[&>[data-slot=button-group-item]:not(:first-child)_[data-slot=button-group-button]]:before:border-t-0',\n '[&>[data-slot=button-group-item]:not(:last-child)_[data-slot=button-group-button]]:rounded-b-none',\n ],\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n },\n },\n)\n\nconst buttonGroupItemVariants = cva(\n [\n 'focus-ring focus-visible:outline-offset-[0.25rem] relative inline-flex shrink-0 cursor-pointer items-center justify-center whitespace-nowrap transition-colors',\n 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',\n '[&_[data-slot=button-group-icon]]:pointer-events-none [&_[data-slot=button-group-icon]]:shrink-0',\n ],\n {\n variants: {\n variant: {\n secondary: [\n 'bg-button-secondary-background text-button-secondary-text shadow-xs',\n 'before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] before:border before:border-button-secondary-border before:content-[\"\"]',\n 'hover:bg-button-secondary-background-hover hover:text-button-secondary-text-hover',\n 'hover:[&_[data-slot=button-group-icon]]:text-button-secondary-icon-hover',\n '[&_[data-slot=button-group-icon]]:text-button-secondary-icon',\n ],\n ghost: [\n 'bg-transparent text-button-ghost-text',\n 'hover:bg-button-ghost-background-hover',\n '[&_[data-slot=button-group-icon]]:text-button-ghost-icon',\n ],\n loading: [\n 'bg-button-primary-background text-button-primary-text shadow-xs hover:bg-button-primary-background-hover',\n '[&_[data-slot=button-group-icon]]:text-icon-on-inverse',\n ],\n },\n tone: {\n neutral: '',\n brand: '',\n },\n kind: {\n text: '',\n icon: 'p-0',\n },\n size: {\n default: '',\n md: '',\n },\n roundness: {\n default: 'rounded-sm',\n rounded: 'rounded-pill',\n },\n },\n compoundVariants: [\n { kind: 'text', size: 'default', className: 'h-8 gap-space-4 px-space-10 text-label-md' },\n { kind: 'text', size: 'md', className: 'h-6 gap-space-4 px-space-8 text-label-sm' },\n { kind: 'icon', size: 'default', className: 'size-8' },\n { kind: 'icon', size: 'md', className: 'size-6' },\n {\n variant: 'secondary',\n tone: 'neutral',\n className: [\n 'data-[selected=true]:bg-button-secondary-background-selected data-[selected=true]:text-button-secondary-text-selected',\n 'data-[selected=true]:before:border-button-secondary-border-selected',\n 'data-[selected=true]:[&_[data-slot=button-group-icon]]:text-button-secondary-icon-selected',\n ],\n },\n {\n variant: 'ghost',\n tone: 'neutral',\n className: [\n 'data-[selected=true]:bg-button-ghost-background-selected data-[selected=true]:text-button-ghost-text-selected',\n 'data-[selected=true]:[&_[data-slot=button-group-icon]]:text-button-ghost-icon-selected',\n ],\n },\n {\n tone: 'brand',\n className: [\n 'data-[selected=true]:bg-background-brand-bold data-[selected=true]:before:border-background-brand-bold',\n 'data-[selected=true]:text-text-on-bold data-[selected=true]:[&_[data-slot=button-group-icon]]:text-icon-on-bold',\n ],\n },\n ],\n defaultVariants: {\n variant: 'secondary',\n tone: 'neutral',\n kind: 'text',\n size: 'default',\n roundness: 'default',\n },\n },\n)\n\ntype ButtonGroupVariant = 'secondary' | 'ghost'\ntype ButtonGroupSize = 'default' | 'md'\ntype ButtonGroupRoundness = 'default' | 'rounded'\ntype ButtonGroupTone = 'neutral' | 'brand'\ntype ButtonGroupOrientation = NonNullable<VariantProps<typeof buttonGroupVariants>['orientation']>\n\ntype ButtonGroupContextValue = {\n variant: ButtonGroupVariant\n size: ButtonGroupSize\n roundness: ButtonGroupRoundness\n tone: ButtonGroupTone\n orientation: ButtonGroupOrientation\n disabled: boolean\n value: string\n select: (value: string, event: React.MouseEvent<HTMLButtonElement>) => void\n}\n\nconst ButtonGroupContext = React.createContext<ButtonGroupContextValue | null>(null)\n\nexport type ButtonGroupProps = Omit<React.ComponentProps<'div'>, 'defaultValue' | 'onChange'> &\n VariantProps<typeof buttonGroupVariants> & {\n variant?: ButtonGroupVariant\n size?: ButtonGroupSize\n roundness?: ButtonGroupRoundness\n tone?: ButtonGroupTone\n disabled?: boolean\n value?: string\n defaultValue?: string\n onValueChange?: (value: string, event: React.MouseEvent<HTMLButtonElement>) => void\n }\n\nfunction ButtonGroup({\n ref,\n className,\n variant = 'secondary',\n size = 'default',\n roundness = 'default',\n tone = 'neutral',\n disabled = false,\n orientation = 'horizontal',\n value: valueProp,\n defaultValue = '',\n onValueChange,\n children,\n role = 'group',\n ...props\n}: ButtonGroupProps) {\n const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue)\n const controlled = valueProp !== undefined\n const value = controlled ? valueProp : uncontrolledValue\n\n const select = React.useCallback(\n (nextValue: string, event: React.MouseEvent<HTMLButtonElement>) => {\n if (!controlled) setUncontrolledValue(nextValue)\n onValueChange?.(nextValue, event)\n },\n [controlled, onValueChange],\n )\n\n const context = React.useMemo<ButtonGroupContextValue>(\n () => ({\n variant,\n size,\n roundness,\n tone,\n orientation: orientation ?? 'horizontal',\n disabled,\n value,\n select,\n }),\n [disabled, orientation, roundness, select, size, tone, value, variant],\n )\n\n return (\n <ButtonGroupContext.Provider value={context}>\n <div\n ref={ref}\n role={role}\n data-slot=\"button-group\"\n data-orientation={orientation}\n data-tone={tone}\n data-disabled={disabled || undefined}\n className={cn(buttonGroupVariants({ orientation }), className)}\n {...props}\n >\n {children}\n </div>\n </ButtonGroupContext.Provider>\n )\n}\n\nfunction useButtonGroup(component: string) {\n const context = React.useContext(ButtonGroupContext)\n if (!context) throw new Error(`${component} must be used within ButtonGroup`)\n return context\n}\n\ntype SelectableItemProps = {\n value?: string\n selected?: boolean\n}\n\nfunction useSelectableItem({\n component,\n value,\n selected,\n loading,\n disabled = false,\n onClick,\n}: SelectableItemProps & {\n component: string\n loading: boolean\n disabled?: boolean\n onClick?: React.MouseEventHandler<HTMLButtonElement>\n}) {\n const context = useButtonGroup(component)\n const isDisabled = disabled || context.disabled\n const isSelected = !loading && (selected ?? (value !== undefined && context.value === value))\n\n const handleClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n (event) => {\n if (loading || isDisabled) {\n event.preventDefault()\n return\n }\n onClick?.(event)\n if (!event.defaultPrevented && value !== undefined && !isSelected) {\n context.select(value, event)\n }\n },\n [context, isDisabled, isSelected, loading, onClick, value],\n )\n\n return { context, isDisabled, isSelected, handleClick }\n}\n\nfunction formatCount(count: number) {\n return count > 99 ? '99+' : String(count)\n}\n\ntype ButtonGroupItemProps = Omit<React.ComponentProps<'button'>, 'size'> &\n SelectableItemProps & {\n icon?: IconProp\n iconPosition?: 'left' | 'right'\n tooltip?: React.ReactNode\n disabledTooltip?: React.ReactNode\n loading?: boolean\n count?: number\n }\n\nfunction ButtonGroupItem({\n ref,\n value,\n selected,\n icon,\n iconPosition = 'left',\n tooltip,\n disabledTooltip,\n disabled = false,\n loading = false,\n count,\n onClick,\n className,\n children,\n 'aria-label': ariaLabel,\n ...props\n}: ButtonGroupItemProps) {\n const { context, isDisabled, isSelected, handleClick } = useSelectableItem({\n component: 'ButtonGroup.Item',\n value,\n selected,\n loading,\n disabled,\n onClick,\n })\n const frame = iconFrame[context.size === 'default' ? '16' : '12']\n const itemVariant = loading ? 'loading' : context.variant\n const itemTone = loading ? 'neutral' : context.tone\n const tooltipTitle = isDisabled ? disabledTooltip ?? tooltip : tooltip\n const TooltipWrap = isDisabled ? LightTooltip : DarkTooltip\n const countDisplay = count !== undefined && !loading ? formatCount(count) : null\n const baseLabel = ariaLabel ?? (typeof children === 'string' ? children : undefined)\n const accessibleName = baseLabel !== undefined && countDisplay !== null ? `${baseLabel}, ${countDisplay}` : baseLabel\n\n const iconNode = loading ? (\n <span data-slot=\"button-group-icon\" className=\"inline-flex shrink-0\">\n <SpinnerMark\n size={context.size === 'default' ? 'md' : 'sm'}\n tone=\"inverse\"\n role={undefined}\n aria-label={undefined}\n aria-hidden\n />\n </span>\n ) : icon ? (\n <span\n data-slot=\"button-group-icon\"\n data-icon={String(icon)}\n className={cn('inline-flex shrink-0 items-center justify-center', frame.frameClass)}\n >\n <IconProvider icon={icon} size={frame.glyph} />\n </span>\n ) : null\n\n const countNode =\n countDisplay !== null ? (\n <span\n data-slot=\"button-group-count\"\n aria-hidden\n className={cn(\n 'inline-flex h-5 items-center px-space-8 text-label-sm',\n context.roundness === 'rounded' ? 'rounded-pill' : 'rounded-sm',\n isSelected ? 'bg-text-on-bold/20 text-text-on-bold' : 'bg-background-item-selected text-text-secondary',\n )}\n >\n {countDisplay}\n </span>\n ) : null\n\n const button = (\n <button\n ref={ref}\n type=\"button\"\n data-slot=\"button-group-button\"\n data-variant={itemVariant}\n data-size={context.size}\n data-tone={itemTone}\n data-selected={isSelected || undefined}\n data-loading={loading || undefined}\n aria-pressed={isSelected || undefined}\n aria-busy={loading || undefined}\n aria-disabled={isDisabled || loading || undefined}\n disabled={isDisabled}\n onClick={handleClick}\n aria-label={accessibleName}\n className={cn(\n buttonGroupItemVariants({\n variant: itemVariant,\n tone: itemTone,\n kind: 'text',\n size: context.size,\n roundness: context.roundness,\n }),\n className,\n )}\n {...props}\n >\n {iconPosition === 'left' && iconNode}\n {children}\n {iconPosition === 'right' && iconNode}\n {countNode}\n </button>\n )\n\n return (\n <span data-slot=\"button-group-item\">\n {tooltipTitle ? <TooltipWrap title={tooltipTitle}>{tooltipTrigger(isDisabled, button)}</TooltipWrap> : button}\n </span>\n )\n}\n\ntype ButtonGroupIconItemProps = Omit<React.ComponentProps<'button'>, 'children' | 'size'> &\n SelectableItemProps & {\n icon: IconProp\n iconSize?: number\n tooltip: React.ReactNode\n disabledTooltip?: React.ReactNode\n loading?: boolean\n }\n\nfunction ButtonGroupIconItem({\n ref,\n value,\n selected,\n icon,\n iconSize,\n tooltip,\n disabledTooltip,\n disabled = false,\n loading = false,\n onClick,\n className,\n type = 'button',\n 'aria-label': ariaLabel,\n ...props\n}: ButtonGroupIconItemProps) {\n const { context, isDisabled, isSelected, handleClick } = useSelectableItem({\n component: 'ButtonGroup.IconItem',\n value,\n selected,\n loading,\n disabled,\n onClick,\n })\n const itemVariant = loading ? 'loading' : context.variant\n const itemTone = loading ? 'neutral' : context.tone\n const tooltipTitle = isDisabled ? disabledTooltip ?? tooltip : tooltip\n const TooltipWrap = isDisabled ? LightTooltip : DarkTooltip\n const accessibleName = ariaLabel ?? (typeof tooltip === 'string' ? tooltip : undefined)\n const frame = iconFrame['16']\n const resolvedIconSize = iconSize ?? frame.glyph\n\n const button = (\n <button\n ref={ref}\n type={type}\n data-slot=\"button-group-button\"\n data-variant={itemVariant}\n data-size={context.size}\n data-tone={itemTone}\n data-selected={isSelected || undefined}\n data-loading={loading || undefined}\n aria-label={accessibleName}\n aria-pressed={isSelected || undefined}\n aria-busy={loading || undefined}\n aria-disabled={isDisabled || loading || undefined}\n disabled={isDisabled}\n onClick={handleClick}\n className={cn(\n buttonGroupItemVariants({\n variant: itemVariant,\n tone: itemTone,\n kind: 'icon',\n size: context.size,\n roundness: context.roundness,\n }),\n className,\n )}\n {...props}\n >\n {loading ? (\n <span data-slot=\"button-group-icon\" className=\"inline-flex shrink-0\">\n <SpinnerMark\n size={context.size === 'md' ? 'sm' : 'md'}\n tone=\"inverse\"\n role={undefined}\n aria-label={undefined}\n aria-hidden\n />\n </span>\n ) : (\n <span\n data-slot=\"button-group-icon\"\n data-icon={String(icon)}\n className={cn('inline-flex shrink-0 items-center justify-center', frame.frameClass)}\n >\n <IconProvider icon={icon} size={resolvedIconSize} />\n </span>\n )}\n </button>\n )\n\n return (\n <span data-slot=\"button-group-item\">\n <TooltipWrap title={tooltipTitle}>{tooltipTrigger(isDisabled, button)}</TooltipWrap>\n </span>\n )\n}\n\ntype ButtonGroupComponent = typeof ButtonGroup & {\n Item: typeof ButtonGroupItem\n IconItem: typeof ButtonGroupIconItem\n}\n\nconst ButtonGroupCompound = ButtonGroup as ButtonGroupComponent\nButtonGroupCompound.Item = ButtonGroupItem\nButtonGroupCompound.IconItem = ButtonGroupIconItem\n\nexport {\n ButtonGroupCompound as ButtonGroup,\n ButtonGroupIconItem,\n ButtonGroupItem,\n buttonGroupItemVariants,\n buttonGroupVariants,\n}\nexport type {\n ButtonGroupIconItemProps,\n ButtonGroupItemProps,\n ButtonGroupOrientation,\n ButtonGroupRoundness,\n ButtonGroupSize,\n ButtonGroupTone,\n ButtonGroupVariant,\n}\n\nexport default ButtonGroupCompound\n"],"names":["cn"],"mappings":";;;;;;;AASA,MAAM,sBAAsB;AAAA,EAC1B;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAEF;AAAA,IACE,UAAU;AAAA,MACR,aAAa;AAAA,QACX,YAAY;AAAA,UACV;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAEF,UAAU;AAAA,UACR;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,IACF;AAAA,IAEF,iBAAiB;AAAA,MACf,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ;AAEA,MAAM,0BAA0B;AAAA,EAC9B;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAEF;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAEF,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,QAEF,SAAS;AAAA,UACP;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,MAEF,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,OAAO;AAAA,MAAA;AAAA,MAET,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,MAAM;AAAA,MAAA;AAAA,MAER,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,MAAA;AAAA,MAEN,WAAW;AAAA,QACT,SAAS;AAAA,QACT,SAAS;AAAA,MAAA;AAAA,IACX;AAAA,IAEF,kBAAkB;AAAA,MAChB,EAAE,MAAM,QAAQ,MAAM,WAAW,WAAW,4CAAA;AAAA,MAC5C,EAAE,MAAM,QAAQ,MAAM,MAAM,WAAW,2CAAA;AAAA,MAC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AAA,QAAA;AAAA,UACC,aAAU;AAAA,UACV,aAAW,OAAO,IAAI;AAAA,UACtB,WAAWA,WAAG,oDAAoD,MAAM,UAAU;AAAA,UAElF,UAAA,oBAAC,cAAA,EAAa,MAAY,MAAM,iBAAA,CAAkB;AAAA,QAAA;AAAA,MAAA;AAAA,IACpD;AAAA,EAAA;AAKN,SACE,oBAAC,QAAA,EAAK,aAAU,qBACd,UAAA,oBAAC,aAAA,EAAY,OAAO,cAAe,UAAA,eAAe,YAAY,MAAM,EAAA,CAAE,GACxE;AAEJ;AAOA,MAAM,sBAAsB;AAC5B,oBAAoB,OAAO;AAC3B,oBAAoB,WAAW;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c as cva } from "../../index-DSVg79g-.js";
|
|
3
|
-
import { C as ControlButton } from "../../Button-
|
|
3
|
+
import { C as ControlButton } from "../../Button-CPJYHldw.js";
|
|
4
4
|
import IconProvider, { iconFrame } from "./IconProvider.es.js";
|
|
5
|
-
import { L as LightTooltip, D as DarkTooltip, t as tooltipTrigger } from "../../Tooltip-
|
|
5
|
+
import { L as LightTooltip, D as DarkTooltip, t as tooltipTrigger } from "../../Tooltip-uQIVdskf.js";
|
|
6
6
|
import { c as classNames } from "../../classNames-B1XpQHle.js";
|
|
7
7
|
const iconButtonVariants = cva("", {
|
|
8
8
|
variants: {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "./IconProvider.es.js";
|
|
3
3
|
import "../../classNames-B1XpQHle.js";
|
|
4
|
-
import {
|
|
4
|
+
import { f, k, g, l, j, h, m, n, i, o, M } from "../../Modal-BUWlwJcN.js";
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
f as Dialog,
|
|
7
7
|
k as DialogClose,
|
|
8
|
-
|
|
8
|
+
g as DialogContent,
|
|
9
9
|
l as DialogDescription,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
j as DialogFooter,
|
|
11
|
+
h as DialogHeader,
|
|
12
12
|
m as DialogOverlay,
|
|
13
13
|
n as DialogPortal,
|
|
14
|
-
|
|
14
|
+
i as DialogTitle,
|
|
15
15
|
o as DialogTrigger,
|
|
16
16
|
M as default
|
|
17
17
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { C as ControlButton } from "../../Button-
|
|
2
|
+
import { C as ControlButton } from "../../Button-CPJYHldw.js";
|
|
3
3
|
import IconProvider, { iconFrame } from "./IconProvider.es.js";
|
|
4
|
-
import { L as LightTooltip, D as DarkTooltip, t as tooltipTrigger } from "../../Tooltip-
|
|
4
|
+
import { L as LightTooltip, D as DarkTooltip, t as tooltipTrigger } from "../../Tooltip-uQIVdskf.js";
|
|
5
5
|
import { c as classNames } from "../../classNames-B1XpQHle.js";
|
|
6
6
|
const controlSizeMap = {
|
|
7
7
|
default: "overflow",
|
|
@@ -5,10 +5,10 @@ import * as React from "react";
|
|
|
5
5
|
import { u as useControlled } from "../../useControlled-BSyYkg5C.js";
|
|
6
6
|
import { f as formatErrorMessage, c as useMergedRefs, u as useIsoLayoutEffect, b as useRenderElement, d as EMPTY_OBJECT } from "../../useIsoLayoutEffect-e9VA-ICd.js";
|
|
7
7
|
import { v as visuallyHiddenInput, a as visuallyHidden } from "../../visuallyHidden-B6H2X3_Y.js";
|
|
8
|
-
import { u as useBaseUiId, c as createChangeEventDetails, n as none } from "../../useBaseUiId-
|
|
9
|
-
import { f as fieldValidityMapping, u as useFormContext, a as useFieldRootContext, b as useLabelableContext, c as useSetFieldFocused, d as useLabelableId, e as useRegisterFieldControl, g as useValueChanged } from "../../useLabelableId-
|
|
10
|
-
import { a as useButton, d as dispatchClickWithModifiers } from "../../useButton-
|
|
11
|
-
import { u as useAriaLabelledBy } from "../../useAriaLabelledBy-
|
|
8
|
+
import { u as useBaseUiId, c as createChangeEventDetails, n as none } from "../../useBaseUiId-CmLtG9DS.js";
|
|
9
|
+
import { f as fieldValidityMapping, u as useFormContext, a as useFieldRootContext, b as useLabelableContext, c as useSetFieldFocused, d as useLabelableId, e as useRegisterFieldControl, g as useValueChanged } from "../../useLabelableId-CcIE3RU0.js";
|
|
10
|
+
import { a as useButton, d as dispatchClickWithModifiers } from "../../useButton-D2BMuSfC.js";
|
|
11
|
+
import { u as useAriaLabelledBy } from "../../useAriaLabelledBy-Lyj6n_TU.js";
|
|
12
12
|
const SwitchRootContext = /* @__PURE__ */ React.createContext(void 0);
|
|
13
13
|
if (process.env.NODE_ENV !== "production") SwitchRootContext.displayName = "SwitchRootContext";
|
|
14
14
|
function useSwitchRootContext() {
|
|
@@ -239,7 +239,7 @@ const switchVariants = cva(
|
|
|
239
239
|
}
|
|
240
240
|
);
|
|
241
241
|
const switchThumbVariants = cva(
|
|
242
|
-
"pointer-events-none block translate-x-0 rounded-pill bg-icon-on-bold
|
|
242
|
+
"pointer-events-none block translate-x-0 rounded-pill bg-icon-on-bold elevation-2 transition-[translate,box-shadow] duration-150 ease-out group-hover:data-unchecked:elevation-1 group-data-disabled:data-unchecked:elevation-2 motion-reduce:transition-none",
|
|
243
243
|
{
|
|
244
244
|
variants: {
|
|
245
245
|
size: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.es.js","sources":["../../../node_modules/@base-ui/react/switch/root/SwitchRootContext.mjs","../../../node_modules/@base-ui/react/switch/root/SwitchRootDataAttributes.mjs","../../../node_modules/@base-ui/react/switch/stateAttributesMapping.mjs","../../../node_modules/@base-ui/react/switch/root/SwitchRoot.mjs","../../../node_modules/@base-ui/react/switch/thumb/SwitchThumb.mjs","../../../src/components/atoms/Switch.tsx"],"sourcesContent":["'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const SwitchRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") SwitchRootContext.displayName = \"SwitchRootContext\";\nexport function useSwitchRootContext() {\n const context = React.useContext(SwitchRootContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: SwitchRootContext is missing. Switch parts must be placed within <Switch.Root>.' : _formatErrorMessage(63));\n }\n return context;\n}","/**\n * Present when the switch is checked.\n */\nexport const checked = 'data-checked';\n/**\n * Present when the switch is not checked.\n */\nexport const unchecked = 'data-unchecked';\n/**\n * Present when the switch is disabled.\n */\nexport const disabled = 'data-disabled';\n/**\n * Present when the switch is readonly.\n */\nexport const readonly = 'data-readonly';\n/**\n * Present when the switch is required.\n */\nexport const required = 'data-required';\n/**\n * Present when the switch is in a valid state (when wrapped in Field.Root).\n */\nexport const valid = 'data-valid';\n/**\n * Present when the switch is in an invalid state (when wrapped in Field.Root).\n */\nexport const invalid = 'data-invalid';\n/**\n * Present when the switch has been touched (when wrapped in Field.Root).\n */\nexport const touched = 'data-touched';\n/**\n * Present when the switch's value has changed (when wrapped in Field.Root).\n */\nexport const dirty = 'data-dirty';\n/**\n * Present when the switch is active (when wrapped in Field.Root).\n */\nexport const filled = 'data-filled';\n/**\n * Present when the switch is focused (when wrapped in Field.Root).\n */\nexport const focused = 'data-focused';","import { fieldValidityMapping } from \"../internals/field-constants/constants.mjs\";\nimport * as SwitchRootDataAttributes from \"./root/SwitchRootDataAttributes.mjs\";\nexport const stateAttributesMapping = {\n ...fieldValidityMapping,\n checked(value) {\n if (value) {\n return {\n [SwitchRootDataAttributes.checked]: ''\n };\n }\n return {\n [SwitchRootDataAttributes.unchecked]: ''\n };\n }\n};","'use client';\n\nimport * as React from 'react';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { visuallyHidden, visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { SwitchRootContext } from \"./SwitchRootContext.mjs\";\nimport { stateAttributesMapping } from \"../stateAttributesMapping.mjs\";\nimport { dispatchClickWithModifiers } from \"../../utils/dispatchClickWithModifiers.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useSetFieldFocused } from \"../../internals/field-root-context/useSetFieldFocused.mjs\";\nimport { useRegisterFieldControl } from \"../../internals/field-register-control/useRegisterFieldControl.mjs\";\nimport { useFormContext } from \"../../internals/form-context/FormContext.mjs\";\nimport { useLabelableContext } from \"../../internals/labelable-provider/LabelableContext.mjs\";\nimport { useAriaLabelledBy } from \"../../internals/labelable-provider/useAriaLabelledBy.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useValueChanged } from \"../../internals/useValueChanged.mjs\";\n\n/**\n * Represents the switch itself.\n * Renders a `<span>` element and a hidden `<input>` beside.\n *\n * Documentation: [Base UI Switch](https://base-ui.com/react/components/switch)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const SwitchRoot = /*#__PURE__*/React.forwardRef(function SwitchRoot(componentProps, forwardedRef) {\n const {\n checked: checkedProp,\n className,\n defaultChecked,\n 'aria-labelledby': ariaLabelledByProp,\n form,\n id: idProp,\n inputRef: externalInputRef,\n name: nameProp,\n nativeButton = false,\n onCheckedChange,\n readOnly = false,\n required = false,\n disabled: disabledProp = false,\n render,\n uncheckedValue,\n value,\n style,\n ...elementProps\n } = componentProps;\n const {\n clearErrors\n } = useFormContext();\n const {\n state: fieldState,\n setTouched,\n setDirty,\n validityData,\n setFilled,\n validationMode,\n disabled: fieldDisabled,\n name: fieldName,\n validation\n } = useFieldRootContext();\n const {\n labelId\n } = useLabelableContext();\n const disabled = fieldDisabled || disabledProp;\n const name = fieldName ?? nameProp;\n const inputRef = React.useRef(null);\n const handleInputRef = useMergedRefs(inputRef, externalInputRef, validation.inputRef);\n const switchRef = React.useRef(null);\n const setFocused = useSetFieldFocused(disabled, switchRef);\n const id = useBaseUiId();\n const controlId = useLabelableId({\n id: idProp\n });\n const hiddenInputId = nativeButton ? undefined : controlId;\n const [checked, setCheckedState] = useControlled({\n controlled: checkedProp,\n default: Boolean(defaultChecked),\n name: 'Switch',\n state: 'checked'\n });\n useRegisterFieldControl(switchRef, id, checked, undefined, !disabled, nameProp);\n useIsoLayoutEffect(() => {\n setFilled(checked);\n }, [checked, setFilled]);\n useValueChanged(checked, () => {\n clearErrors(name);\n setDirty(checked !== validityData.initialValue);\n validation.change(checked);\n });\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n native: nativeButton\n });\n const ariaLabelledBy = useAriaLabelledBy(ariaLabelledByProp, labelId, inputRef, !nativeButton, hiddenInputId, elementProps['aria-label']);\n const rootProps = {\n id: nativeButton ? controlId : id,\n role: 'switch',\n 'aria-checked': checked,\n 'aria-readonly': readOnly || undefined,\n 'aria-required': required || undefined,\n 'aria-labelledby': ariaLabelledBy,\n onFocus() {\n setFocused(true);\n },\n onBlur() {\n const element = inputRef.current;\n if (!element || disabled) {\n return;\n }\n setTouched(true);\n setFocused(false);\n if (validationMode === 'onBlur') {\n validation.commit(element.checked);\n }\n },\n onClick(event) {\n if (readOnly || disabled) {\n return;\n }\n event.preventDefault();\n const input = inputRef.current;\n if (!input) {\n return;\n }\n dispatchClickWithModifiers(input, event);\n }\n };\n const inputProps = {\n ...validation.getValidationProps(disabled),\n checked,\n disabled,\n form,\n id: hiddenInputId,\n name,\n required,\n style: name ? visuallyHiddenInput : visuallyHidden,\n tabIndex: -1,\n type: 'checkbox',\n 'aria-hidden': true,\n ref: handleInputRef,\n onChange(event) {\n // Workaround for https://github.com/react/react/issues/9023\n if (event.nativeEvent.defaultPrevented) {\n return;\n }\n if (readOnly) {\n event.preventDefault();\n return;\n }\n const nextChecked = event.currentTarget.checked;\n const eventDetails = createChangeEventDetails(REASONS.none, event.nativeEvent);\n onCheckedChange?.(nextChecked, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setCheckedState(nextChecked);\n },\n onClick(event) {\n // The click dispatched from the root's `onClick` is an implementation detail\n // and must not reach ancestors, which already receive the original click.\n event.stopPropagation();\n },\n onFocus() {\n switchRef.current?.focus();\n },\n // React <19 sets an empty value if `undefined` is passed explicitly\n // To avoid this, we only set the value if it's defined\n ...(value !== undefined ? {\n value\n } : EMPTY_OBJECT)\n };\n const state = React.useMemo(() => ({\n ...fieldState,\n checked,\n disabled,\n readOnly,\n required\n }), [fieldState, checked, disabled, readOnly, required]);\n const element = useRenderElement('span', componentProps, {\n state,\n ref: [forwardedRef, switchRef, buttonRef],\n props: [rootProps, elementProps, getButtonProps, props => validation.getValidationProps(disabled, props)],\n stateAttributesMapping\n });\n return /*#__PURE__*/_jsxs(SwitchRootContext.Provider, {\n value: state,\n children: [element, !checked && name && uncheckedValue !== undefined && /*#__PURE__*/_jsx(\"input\", {\n type: \"hidden\",\n form: form,\n name: name,\n value: uncheckedValue,\n disabled: disabled\n }), /*#__PURE__*/_jsx(\"input\", {\n ...inputProps,\n suppressHydrationWarning: true\n })]\n });\n});\nif (process.env.NODE_ENV !== \"production\") SwitchRoot.displayName = \"SwitchRoot\";","'use client';\n\nimport * as React from 'react';\nimport { useSwitchRootContext } from \"../root/SwitchRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { stateAttributesMapping } from \"../stateAttributesMapping.mjs\";\n\n/**\n * The movable part of the switch that indicates whether the switch is on or off.\n * Renders a `<span>`.\n *\n * Documentation: [Base UI Switch](https://base-ui.com/react/components/switch)\n */\nexport const SwitchThumb = /*#__PURE__*/React.forwardRef(function SwitchThumb(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const state = useSwitchRootContext();\n return useRenderElement('span', componentProps, {\n state,\n ref: forwardedRef,\n stateAttributesMapping,\n props: elementProps\n });\n});\nif (process.env.NODE_ENV !== \"production\") SwitchThumb.displayName = \"SwitchThumb\";","import * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { Switch as SwitchPrimitive } from '@base-ui/react/switch'\n\nimport { cn } from '@/lib/utils'\n\nexport const switchVariants = cva(\n 'group relative inline-flex shrink-0 cursor-pointer items-center rounded-pill border border-border-subtle bg-background-input p-px focus-ring transition-[background-color,border-color] duration-150 ease-out after:absolute after:inset-x-0 after:content-[\"\"] hover:border-border-default data-checked:border-transparent data-checked:bg-background-brand-bold data-checked:hover:bg-background-brand-bold-selected dark:data-checked:hover:bg-background-brand-bold-hover data-disabled:cursor-not-allowed data-disabled:opacity-(--opacity-disabled) data-disabled:hover:border-border-subtle data-disabled:data-checked:hover:bg-background-brand-bold data-invalid:border-status-border-error-bold data-invalid:bg-status-background-error data-invalid:hover:border-status-border-error-bold data-invalid:data-checked:bg-status-background-error-bold data-invalid:data-checked:hover:bg-status-background-error-bold motion-reduce:transition-none',\n {\n variants: {\n size: {\n sm: 'h-3.5 w-6',\n default: 'h-4 w-8 after:-inset-y-1',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n },\n)\n\nconst switchThumbVariants = cva(\n 'pointer-events-none block translate-x-0 rounded-pill bg-icon-on-bold shadow-elevation-2 transition-[translate,box-shadow] duration-150 ease-out group-hover:data-unchecked:shadow-elevation-1 group-data-disabled:data-unchecked:shadow-elevation-2 motion-reduce:transition-none',\n {\n variants: {\n size: {\n sm: 'size-2.5 data-checked:translate-x-2.5',\n default: 'size-3 data-checked:translate-x-4',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n },\n)\n\ntype SwitchControlProps = Omit<SwitchPrimitive.Root.Props, 'size'> &\n VariantProps<typeof switchVariants> & {\n invalid?: boolean\n }\n\nfunction SwitchControl({ className, invalid, size, ...props }: SwitchControlProps) {\n return (\n <SwitchPrimitive.Root\n data-slot=\"switch\"\n {...props}\n aria-invalid={invalid || props['aria-invalid'] || undefined}\n data-invalid={invalid ? '' : undefined}\n className={cn(switchVariants({ size }), className)}\n >\n <SwitchPrimitive.Thumb data-slot=\"switch-thumb\" className={switchThumbVariants({ size })} />\n </SwitchPrimitive.Root>\n )\n}\n\n/** Legacy MUI Switch styled props — mapped to atoms Switch (Base UI). */\nexport interface StyledSwitchProps extends Omit<SwitchControlProps, 'onCheckedChange' | 'onChange'> {\n /**\n * Legacy MUI hidden-input attributes. `id`, `name`, `value`, `required`, `aria-*`, and `data-test`\n * are forwarded to the Base UI root (Base UI renders a hidden form input when `name` is set).\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement> & { 'data-test'?: string }\n /** @deprecated No-op — size is fixed by design tokens. */\n widthMultiple?: number\n /** @deprecated No-op — size is fixed by design tokens. */\n heightMultiple?: number\n /** @deprecated No-op — size is fixed by design tokens. */\n thumbWidthMultiple?: number\n /** Base UI / new API */\n onCheckedChange?: (checked: boolean) => void\n /** Legacy MUI-style change handler */\n onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void\n}\n\nexport type SwitchProps = StyledSwitchProps\n\nfunction Switch({\n inputProps,\n widthMultiple: _w,\n heightMultiple: _h,\n thumbWidthMultiple: _t,\n onChange,\n onCheckedChange,\n ...props\n}: SwitchProps) {\n const {\n id,\n name,\n value,\n required,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'data-test': dataTest,\n } = inputProps ?? {}\n\n return (\n <SwitchControl\n id={id}\n name={name}\n value={typeof value === 'string' ? value : undefined}\n required={required}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n data-test={dataTest}\n {...props}\n onCheckedChange={(checked) => {\n onCheckedChange?.(checked)\n if (onChange) {\n const target = {\n checked,\n name: name ?? '',\n value: typeof value === 'string' ? value : 'on',\n id: id ?? '',\n type: 'checkbox',\n }\n const event = {\n target,\n currentTarget: target,\n } as unknown as React.ChangeEvent<HTMLInputElement>\n onChange(event, checked)\n }\n }}\n />\n )\n}\n\nexport default Switch\n"],"names":["_formatErrorMessage","SwitchRootDataAttributes.checked","SwitchRootDataAttributes.unchecked","SwitchRoot","checked","element","REASONS.none","_jsxs","_jsx","SwitchThumb","SwitchPrimitive.Root","cn","SwitchPrimitive.Thumb"],"mappings":";;;;;;;;;;;AAIO,MAAM,oBAAiC,sBAAM,cAAc,MAAS;AAC3E,IAAI,QAAQ,IAAI,aAAa,aAAc,mBAAkB,cAAc;AACpE,SAAS,uBAAuB;AACrC,QAAM,UAAU,MAAM,WAAW,iBAAiB;AAClD,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI,MAAM,QAAQ,IAAI,aAAa,eAAe,6FAA6FA,mBAAoB,EAAE,CAAC;AAAA,EAC9K;AACA,SAAO;AACT;ACTO,MAAM,UAAU;AAIhB,MAAM,YAAY;ACLlB,MAAM,yBAAyB;AAAA,EACpC,GAAG;AAAA,EACH,QAAQ,OAAO;AACb,QAAI,OAAO;AACT,aAAO;AAAA,QACL,CAACC,OAAgC,GAAG;AAAA,MAC5C;AAAA,IACI;AACA,WAAO;AAAA,MACL,CAACC,SAAkC,GAAG;AAAA,IAC5C;AAAA,EACE;AACF;ACkBO,MAAM,aAA0B,sBAAM,WAAW,SAASC,YAAW,gBAAgB,cAAc;AACxG,QAAM;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,IACnB;AAAA,IACA,IAAI;AAAA,IACJ,UAAU;AAAA,IACV,MAAM;AAAA,IACN,eAAe;AAAA,IACf;AAAA,IACA,WAAW;AAAA,IACX,WAAW;AAAA,IACX,UAAU,eAAe;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACP,IAAM;AACJ,QAAM;AAAA,IACJ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,aAAY;AAC5B,2DAAkBA;AAClB,YAAI,UAAU;AACZ,gBAAM,SAAS;AAAA,YACb,SAAAA;AAAA,YACA,MAAM,QAAQ;AAAA,YACd,OAAO,OAAO,UAAU,WAAW,QAAQ;AAAA,YAC3C,IAAI,MAAM;AAAA,YACV,MAAM;AAAA,UAAA;AAER,gBAAM,QAAQ;AAAA,YACZ;AAAA,YACA,eAAe;AAAA,UAAA;AAEjB,mBAAS,OAAOA,QAAO;AAAA,QACzB;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;","x_google_ignoreList":[0,1,2,3,4]}
|
|
1
|
+
{"version":3,"file":"Switch.es.js","sources":["../../../node_modules/@base-ui/react/switch/root/SwitchRootContext.mjs","../../../node_modules/@base-ui/react/switch/root/SwitchRootDataAttributes.mjs","../../../node_modules/@base-ui/react/switch/stateAttributesMapping.mjs","../../../node_modules/@base-ui/react/switch/root/SwitchRoot.mjs","../../../node_modules/@base-ui/react/switch/thumb/SwitchThumb.mjs","../../../src/components/atoms/Switch.tsx"],"sourcesContent":["'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const SwitchRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") SwitchRootContext.displayName = \"SwitchRootContext\";\nexport function useSwitchRootContext() {\n const context = React.useContext(SwitchRootContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: SwitchRootContext is missing. Switch parts must be placed within <Switch.Root>.' : _formatErrorMessage(63));\n }\n return context;\n}","/**\n * Present when the switch is checked.\n */\nexport const checked = 'data-checked';\n/**\n * Present when the switch is not checked.\n */\nexport const unchecked = 'data-unchecked';\n/**\n * Present when the switch is disabled.\n */\nexport const disabled = 'data-disabled';\n/**\n * Present when the switch is readonly.\n */\nexport const readonly = 'data-readonly';\n/**\n * Present when the switch is required.\n */\nexport const required = 'data-required';\n/**\n * Present when the switch is in a valid state (when wrapped in Field.Root).\n */\nexport const valid = 'data-valid';\n/**\n * Present when the switch is in an invalid state (when wrapped in Field.Root).\n */\nexport const invalid = 'data-invalid';\n/**\n * Present when the switch has been touched (when wrapped in Field.Root).\n */\nexport const touched = 'data-touched';\n/**\n * Present when the switch's value has changed (when wrapped in Field.Root).\n */\nexport const dirty = 'data-dirty';\n/**\n * Present when the switch is active (when wrapped in Field.Root).\n */\nexport const filled = 'data-filled';\n/**\n * Present when the switch is focused (when wrapped in Field.Root).\n */\nexport const focused = 'data-focused';","import { fieldValidityMapping } from \"../internals/field-constants/constants.mjs\";\nimport * as SwitchRootDataAttributes from \"./root/SwitchRootDataAttributes.mjs\";\nexport const stateAttributesMapping = {\n ...fieldValidityMapping,\n checked(value) {\n if (value) {\n return {\n [SwitchRootDataAttributes.checked]: ''\n };\n }\n return {\n [SwitchRootDataAttributes.unchecked]: ''\n };\n }\n};","'use client';\n\nimport * as React from 'react';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { visuallyHidden, visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { SwitchRootContext } from \"./SwitchRootContext.mjs\";\nimport { stateAttributesMapping } from \"../stateAttributesMapping.mjs\";\nimport { dispatchClickWithModifiers } from \"../../utils/dispatchClickWithModifiers.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useSetFieldFocused } from \"../../internals/field-root-context/useSetFieldFocused.mjs\";\nimport { useRegisterFieldControl } from \"../../internals/field-register-control/useRegisterFieldControl.mjs\";\nimport { useFormContext } from \"../../internals/form-context/FormContext.mjs\";\nimport { useLabelableContext } from \"../../internals/labelable-provider/LabelableContext.mjs\";\nimport { useAriaLabelledBy } from \"../../internals/labelable-provider/useAriaLabelledBy.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useValueChanged } from \"../../internals/useValueChanged.mjs\";\n\n/**\n * Represents the switch itself.\n * Renders a `<span>` element and a hidden `<input>` beside.\n *\n * Documentation: [Base UI Switch](https://base-ui.com/react/components/switch)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const SwitchRoot = /*#__PURE__*/React.forwardRef(function SwitchRoot(componentProps, forwardedRef) {\n const {\n checked: checkedProp,\n className,\n defaultChecked,\n 'aria-labelledby': ariaLabelledByProp,\n form,\n id: idProp,\n inputRef: externalInputRef,\n name: nameProp,\n nativeButton = false,\n onCheckedChange,\n readOnly = false,\n required = false,\n disabled: disabledProp = false,\n render,\n uncheckedValue,\n value,\n style,\n ...elementProps\n } = componentProps;\n const {\n clearErrors\n } = useFormContext();\n const {\n state: fieldState,\n setTouched,\n setDirty,\n validityData,\n setFilled,\n validationMode,\n disabled: fieldDisabled,\n name: fieldName,\n validation\n } = useFieldRootContext();\n const {\n labelId\n } = useLabelableContext();\n const disabled = fieldDisabled || disabledProp;\n const name = fieldName ?? nameProp;\n const inputRef = React.useRef(null);\n const handleInputRef = useMergedRefs(inputRef, externalInputRef, validation.inputRef);\n const switchRef = React.useRef(null);\n const setFocused = useSetFieldFocused(disabled, switchRef);\n const id = useBaseUiId();\n const controlId = useLabelableId({\n id: idProp\n });\n const hiddenInputId = nativeButton ? undefined : controlId;\n const [checked, setCheckedState] = useControlled({\n controlled: checkedProp,\n default: Boolean(defaultChecked),\n name: 'Switch',\n state: 'checked'\n });\n useRegisterFieldControl(switchRef, id, checked, undefined, !disabled, nameProp);\n useIsoLayoutEffect(() => {\n setFilled(checked);\n }, [checked, setFilled]);\n useValueChanged(checked, () => {\n clearErrors(name);\n setDirty(checked !== validityData.initialValue);\n validation.change(checked);\n });\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n native: nativeButton\n });\n const ariaLabelledBy = useAriaLabelledBy(ariaLabelledByProp, labelId, inputRef, !nativeButton, hiddenInputId, elementProps['aria-label']);\n const rootProps = {\n id: nativeButton ? controlId : id,\n role: 'switch',\n 'aria-checked': checked,\n 'aria-readonly': readOnly || undefined,\n 'aria-required': required || undefined,\n 'aria-labelledby': ariaLabelledBy,\n onFocus() {\n setFocused(true);\n },\n onBlur() {\n const element = inputRef.current;\n if (!element || disabled) {\n return;\n }\n setTouched(true);\n setFocused(false);\n if (validationMode === 'onBlur') {\n validation.commit(element.checked);\n }\n },\n onClick(event) {\n if (readOnly || disabled) {\n return;\n }\n event.preventDefault();\n const input = inputRef.current;\n if (!input) {\n return;\n }\n dispatchClickWithModifiers(input, event);\n }\n };\n const inputProps = {\n ...validation.getValidationProps(disabled),\n checked,\n disabled,\n form,\n id: hiddenInputId,\n name,\n required,\n style: name ? visuallyHiddenInput : visuallyHidden,\n tabIndex: -1,\n type: 'checkbox',\n 'aria-hidden': true,\n ref: handleInputRef,\n onChange(event) {\n // Workaround for https://github.com/react/react/issues/9023\n if (event.nativeEvent.defaultPrevented) {\n return;\n }\n if (readOnly) {\n event.preventDefault();\n return;\n }\n const nextChecked = event.currentTarget.checked;\n const eventDetails = createChangeEventDetails(REASONS.none, event.nativeEvent);\n onCheckedChange?.(nextChecked, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setCheckedState(nextChecked);\n },\n onClick(event) {\n // The click dispatched from the root's `onClick` is an implementation detail\n // and must not reach ancestors, which already receive the original click.\n event.stopPropagation();\n },\n onFocus() {\n switchRef.current?.focus();\n },\n // React <19 sets an empty value if `undefined` is passed explicitly\n // To avoid this, we only set the value if it's defined\n ...(value !== undefined ? {\n value\n } : EMPTY_OBJECT)\n };\n const state = React.useMemo(() => ({\n ...fieldState,\n checked,\n disabled,\n readOnly,\n required\n }), [fieldState, checked, disabled, readOnly, required]);\n const element = useRenderElement('span', componentProps, {\n state,\n ref: [forwardedRef, switchRef, buttonRef],\n props: [rootProps, elementProps, getButtonProps, props => validation.getValidationProps(disabled, props)],\n stateAttributesMapping\n });\n return /*#__PURE__*/_jsxs(SwitchRootContext.Provider, {\n value: state,\n children: [element, !checked && name && uncheckedValue !== undefined && /*#__PURE__*/_jsx(\"input\", {\n type: \"hidden\",\n form: form,\n name: name,\n value: uncheckedValue,\n disabled: disabled\n }), /*#__PURE__*/_jsx(\"input\", {\n ...inputProps,\n suppressHydrationWarning: true\n })]\n });\n});\nif (process.env.NODE_ENV !== \"production\") SwitchRoot.displayName = \"SwitchRoot\";","'use client';\n\nimport * as React from 'react';\nimport { useSwitchRootContext } from \"../root/SwitchRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { stateAttributesMapping } from \"../stateAttributesMapping.mjs\";\n\n/**\n * The movable part of the switch that indicates whether the switch is on or off.\n * Renders a `<span>`.\n *\n * Documentation: [Base UI Switch](https://base-ui.com/react/components/switch)\n */\nexport const SwitchThumb = /*#__PURE__*/React.forwardRef(function SwitchThumb(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const state = useSwitchRootContext();\n return useRenderElement('span', componentProps, {\n state,\n ref: forwardedRef,\n stateAttributesMapping,\n props: elementProps\n });\n});\nif (process.env.NODE_ENV !== \"production\") SwitchThumb.displayName = \"SwitchThumb\";","import * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { Switch as SwitchPrimitive } from '@base-ui/react/switch'\n\nimport { cn } from '@/lib/utils'\n\nexport const switchVariants = cva(\n 'group relative inline-flex shrink-0 cursor-pointer items-center rounded-pill border border-border-subtle bg-background-input p-px focus-ring transition-[background-color,border-color] duration-150 ease-out after:absolute after:inset-x-0 after:content-[\"\"] hover:border-border-default data-checked:border-transparent data-checked:bg-background-brand-bold data-checked:hover:bg-background-brand-bold-selected dark:data-checked:hover:bg-background-brand-bold-hover data-disabled:cursor-not-allowed data-disabled:opacity-(--opacity-disabled) data-disabled:hover:border-border-subtle data-disabled:data-checked:hover:bg-background-brand-bold data-invalid:border-status-border-error-bold data-invalid:bg-status-background-error data-invalid:hover:border-status-border-error-bold data-invalid:data-checked:bg-status-background-error-bold data-invalid:data-checked:hover:bg-status-background-error-bold motion-reduce:transition-none',\n {\n variants: {\n size: {\n sm: 'h-3.5 w-6',\n default: 'h-4 w-8 after:-inset-y-1',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n },\n)\n\nconst switchThumbVariants = cva(\n 'pointer-events-none block translate-x-0 rounded-pill bg-icon-on-bold elevation-2 transition-[translate,box-shadow] duration-150 ease-out group-hover:data-unchecked:elevation-1 group-data-disabled:data-unchecked:elevation-2 motion-reduce:transition-none',\n {\n variants: {\n size: {\n sm: 'size-2.5 data-checked:translate-x-2.5',\n default: 'size-3 data-checked:translate-x-4',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n },\n)\n\ntype SwitchControlProps = Omit<SwitchPrimitive.Root.Props, 'size'> &\n VariantProps<typeof switchVariants> & {\n invalid?: boolean\n }\n\nfunction SwitchControl({ className, invalid, size, ...props }: SwitchControlProps) {\n return (\n <SwitchPrimitive.Root\n data-slot=\"switch\"\n {...props}\n aria-invalid={invalid || props['aria-invalid'] || undefined}\n data-invalid={invalid ? '' : undefined}\n className={cn(switchVariants({ size }), className)}\n >\n <SwitchPrimitive.Thumb data-slot=\"switch-thumb\" className={switchThumbVariants({ size })} />\n </SwitchPrimitive.Root>\n )\n}\n\n/** Legacy MUI Switch styled props — mapped to atoms Switch (Base UI). */\nexport interface StyledSwitchProps extends Omit<SwitchControlProps, 'onCheckedChange' | 'onChange'> {\n /**\n * Legacy MUI hidden-input attributes. `id`, `name`, `value`, `required`, `aria-*`, and `data-test`\n * are forwarded to the Base UI root (Base UI renders a hidden form input when `name` is set).\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement> & { 'data-test'?: string }\n /** @deprecated No-op — size is fixed by design tokens. */\n widthMultiple?: number\n /** @deprecated No-op — size is fixed by design tokens. */\n heightMultiple?: number\n /** @deprecated No-op — size is fixed by design tokens. */\n thumbWidthMultiple?: number\n /** Base UI / new API */\n onCheckedChange?: (checked: boolean) => void\n /** Legacy MUI-style change handler */\n onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void\n}\n\nexport type SwitchProps = StyledSwitchProps\n\nfunction Switch({\n inputProps,\n widthMultiple: _w,\n heightMultiple: _h,\n thumbWidthMultiple: _t,\n onChange,\n onCheckedChange,\n ...props\n}: SwitchProps) {\n const {\n id,\n name,\n value,\n required,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'data-test': dataTest,\n } = inputProps ?? {}\n\n return (\n <SwitchControl\n id={id}\n name={name}\n value={typeof value === 'string' ? value : undefined}\n required={required}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n data-test={dataTest}\n {...props}\n onCheckedChange={(checked) => {\n onCheckedChange?.(checked)\n if (onChange) {\n const target = {\n checked,\n name: name ?? '',\n value: typeof value === 'string' ? value : 'on',\n id: id ?? '',\n type: 'checkbox',\n }\n const event = {\n target,\n currentTarget: target,\n } as unknown as React.ChangeEvent<HTMLInputElement>\n onChange(event, checked)\n }\n }}\n />\n )\n}\n\nexport default Switch\n"],"names":["_formatErrorMessage","SwitchRootDataAttributes.checked","SwitchRootDataAttributes.unchecked","SwitchRoot","checked","element","REASONS.none","_jsxs","_jsx","SwitchThumb","SwitchPrimitive.Root","cn","SwitchPrimitive.Thumb"],"mappings":";;;;;;;;;;;AAIO,MAAM,oBAAiC,sBAAM,cAAc,MAAS;AAC3E,IAAI,QAAQ,IAAI,aAAa,aAAc,mBAAkB,cAAc;AACpE,SAAS,uBAAuB;AACr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