tfy-web-components 0.0.34 → 0.0.35
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 +1 -1
- package/dist/components/atoms/IconProvider.es.js +48 -7
- package/dist/components/atoms/IconProvider.es.js.map +1 -1
- 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 +19 -4
- package/dist/index.es.js +56 -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/theme.css +9 -154
- package/dist/tokens.css +1136 -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,326 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { c as cva } from "../../index-DSVg79g-.js";
|
|
4
|
+
import IconProvider from "../../components/atoms/IconProvider.es.js";
|
|
5
|
+
import { b as useRenderElement, a as useStableCallback, E as EMPTY_ARRAY } from "../../useIsoLayoutEffect-e9VA-ICd.js";
|
|
6
|
+
import { u as useControlled } from "../../useControlled-BSyYkg5C.js";
|
|
7
|
+
import { C as CompositeRoot } from "../../CompositeRoot-BxrPc7F6.js";
|
|
8
|
+
import { u as useToolbarRootContext } from "../../ToolbarRootContext-B_HxjkNI.js";
|
|
9
|
+
import { c as classNames } from "../../classNames-B1XpQHle.js";
|
|
10
|
+
import { e as error } from "../../error-FX4R42W-.js";
|
|
11
|
+
import { u as useBaseUiId, c as createChangeEventDetails, n as none } from "../../useBaseUiId-Ch7ujXpo.js";
|
|
12
|
+
import { a as useButton } from "../../useButton-PUBhT4Vo.js";
|
|
13
|
+
import { C as CompositeItem } from "../../CompositeItem-BGwD51jI.js";
|
|
14
|
+
const ToggleGroupContext = /* @__PURE__ */ React.createContext(void 0);
|
|
15
|
+
if (process.env.NODE_ENV !== "production") ToggleGroupContext.displayName = "ToggleGroupContext";
|
|
16
|
+
function useToggleGroupContext() {
|
|
17
|
+
return React.useContext(ToggleGroupContext);
|
|
18
|
+
}
|
|
19
|
+
const Toggle = /* @__PURE__ */ React.forwardRef(function Toggle2(componentProps, forwardedRef) {
|
|
20
|
+
const {
|
|
21
|
+
className,
|
|
22
|
+
defaultPressed = false,
|
|
23
|
+
disabled: disabledProp = false,
|
|
24
|
+
form,
|
|
25
|
+
// never participates in form validation
|
|
26
|
+
onPressedChange,
|
|
27
|
+
pressed: pressedProp,
|
|
28
|
+
render,
|
|
29
|
+
type,
|
|
30
|
+
// cannot change button type
|
|
31
|
+
value: valueProp,
|
|
32
|
+
nativeButton = true,
|
|
33
|
+
style,
|
|
34
|
+
...elementProps
|
|
35
|
+
} = componentProps;
|
|
36
|
+
const value = useBaseUiId(valueProp || void 0);
|
|
37
|
+
const groupContext = useToggleGroupContext();
|
|
38
|
+
const groupValue = (groupContext == null ? void 0 : groupContext.value) ?? [];
|
|
39
|
+
const disabled = (disabledProp || (groupContext == null ? void 0 : groupContext.disabled)) ?? false;
|
|
40
|
+
if (process.env.NODE_ENV !== "production") {
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
if (groupContext && valueProp === void 0 && groupContext.isValueInitialized) {
|
|
43
|
+
error("A `<Toggle>` component rendered in a `<ToggleGroup>` has no explicit `value` prop.", "This will cause issues between the Toggle Group and Toggle values.", "Provide the `<Toggle>` with a `value` prop matching the `<ToggleGroup>` values prop type.");
|
|
44
|
+
}
|
|
45
|
+
}, [groupContext, valueProp, groupContext == null ? void 0 : groupContext.isValueInitialized]);
|
|
46
|
+
}
|
|
47
|
+
const [pressed, setPressedState] = useControlled({
|
|
48
|
+
controlled: groupContext ? value !== void 0 && groupValue.indexOf(value) > -1 : pressedProp,
|
|
49
|
+
default: defaultPressed,
|
|
50
|
+
name: "Toggle",
|
|
51
|
+
state: "pressed"
|
|
52
|
+
});
|
|
53
|
+
const {
|
|
54
|
+
getButtonProps,
|
|
55
|
+
buttonRef
|
|
56
|
+
} = useButton({
|
|
57
|
+
disabled,
|
|
58
|
+
native: nativeButton
|
|
59
|
+
});
|
|
60
|
+
const state = {
|
|
61
|
+
disabled,
|
|
62
|
+
pressed
|
|
63
|
+
};
|
|
64
|
+
const refs = [buttonRef, forwardedRef];
|
|
65
|
+
const props = [{
|
|
66
|
+
"aria-pressed": pressed,
|
|
67
|
+
onClick(event) {
|
|
68
|
+
var _a;
|
|
69
|
+
const nextPressed = !pressed;
|
|
70
|
+
const details = createChangeEventDetails(none, event.nativeEvent);
|
|
71
|
+
onPressedChange == null ? void 0 : onPressedChange(nextPressed, details);
|
|
72
|
+
if (details.isCanceled) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (value) {
|
|
76
|
+
(_a = groupContext == null ? void 0 : groupContext.setGroupValue) == null ? void 0 : _a.call(groupContext, value, nextPressed, details);
|
|
77
|
+
}
|
|
78
|
+
if (details.isCanceled) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
setPressedState(nextPressed);
|
|
82
|
+
}
|
|
83
|
+
}, elementProps, getButtonProps];
|
|
84
|
+
const element = useRenderElement("button", componentProps, {
|
|
85
|
+
enabled: !groupContext,
|
|
86
|
+
state,
|
|
87
|
+
ref: refs,
|
|
88
|
+
props
|
|
89
|
+
});
|
|
90
|
+
const itemMetadata = React.useMemo(() => ({
|
|
91
|
+
disabled,
|
|
92
|
+
focusableWhenDisabled: false
|
|
93
|
+
}), [disabled]);
|
|
94
|
+
if (groupContext) {
|
|
95
|
+
return /* @__PURE__ */ jsx(CompositeItem, {
|
|
96
|
+
tag: "button",
|
|
97
|
+
render,
|
|
98
|
+
className,
|
|
99
|
+
style,
|
|
100
|
+
metadata: itemMetadata,
|
|
101
|
+
state,
|
|
102
|
+
refs,
|
|
103
|
+
props
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return element;
|
|
107
|
+
});
|
|
108
|
+
if (process.env.NODE_ENV !== "production") Toggle.displayName = "Toggle";
|
|
109
|
+
const ToolbarGroupContext = /* @__PURE__ */ React.createContext(void 0);
|
|
110
|
+
if (process.env.NODE_ENV !== "production") ToolbarGroupContext.displayName = "ToolbarGroupContext";
|
|
111
|
+
function useToolbarGroupContext() {
|
|
112
|
+
return React.useContext(ToolbarGroupContext);
|
|
113
|
+
}
|
|
114
|
+
const ToggleGroup = /* @__PURE__ */ React.forwardRef(function ToggleGroup2(componentProps, forwardedRef) {
|
|
115
|
+
const {
|
|
116
|
+
defaultValue: defaultValueProp,
|
|
117
|
+
disabled: disabledProp = false,
|
|
118
|
+
loopFocus = true,
|
|
119
|
+
onValueChange,
|
|
120
|
+
orientation = "horizontal",
|
|
121
|
+
multiple = false,
|
|
122
|
+
value: valueProp,
|
|
123
|
+
className,
|
|
124
|
+
render,
|
|
125
|
+
style,
|
|
126
|
+
...elementProps
|
|
127
|
+
} = componentProps;
|
|
128
|
+
const toolbarContext = useToolbarRootContext();
|
|
129
|
+
const toolbarGroupContext = useToolbarGroupContext();
|
|
130
|
+
const defaultValue = defaultValueProp ?? EMPTY_ARRAY;
|
|
131
|
+
const isValueInitialized = valueProp !== void 0 || defaultValueProp !== void 0;
|
|
132
|
+
const disabled = ((toolbarContext == null ? void 0 : toolbarContext.disabled) ?? false) || ((toolbarGroupContext == null ? void 0 : toolbarGroupContext.disabled) ?? false) || disabledProp;
|
|
133
|
+
const [groupValue, setValueState] = useControlled({
|
|
134
|
+
controlled: valueProp,
|
|
135
|
+
default: defaultValue,
|
|
136
|
+
name: "ToggleGroup",
|
|
137
|
+
state: "value"
|
|
138
|
+
});
|
|
139
|
+
const setGroupValue = useStableCallback((newValue, nextPressed, eventDetails) => {
|
|
140
|
+
let newGroupValue;
|
|
141
|
+
if (multiple) {
|
|
142
|
+
newGroupValue = groupValue.slice();
|
|
143
|
+
if (nextPressed) {
|
|
144
|
+
newGroupValue.push(newValue);
|
|
145
|
+
} else {
|
|
146
|
+
newGroupValue.splice(groupValue.indexOf(newValue), 1);
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
newGroupValue = nextPressed ? [newValue] : [];
|
|
150
|
+
}
|
|
151
|
+
onValueChange == null ? void 0 : onValueChange(newGroupValue, eventDetails);
|
|
152
|
+
if (eventDetails.isCanceled) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
setValueState(newGroupValue);
|
|
156
|
+
});
|
|
157
|
+
const state = {
|
|
158
|
+
disabled,
|
|
159
|
+
multiple,
|
|
160
|
+
orientation
|
|
161
|
+
};
|
|
162
|
+
const contextValue = React.useMemo(() => ({
|
|
163
|
+
disabled,
|
|
164
|
+
setGroupValue,
|
|
165
|
+
value: groupValue,
|
|
166
|
+
isValueInitialized
|
|
167
|
+
}), [disabled, setGroupValue, groupValue, isValueInitialized]);
|
|
168
|
+
const defaultProps = {
|
|
169
|
+
role: "group"
|
|
170
|
+
};
|
|
171
|
+
const element = useRenderElement("div", componentProps, {
|
|
172
|
+
enabled: Boolean(toolbarContext),
|
|
173
|
+
state,
|
|
174
|
+
ref: forwardedRef,
|
|
175
|
+
props: [defaultProps, elementProps]
|
|
176
|
+
});
|
|
177
|
+
return /* @__PURE__ */ jsx(ToggleGroupContext.Provider, {
|
|
178
|
+
value: contextValue,
|
|
179
|
+
children: toolbarContext ? element : /* @__PURE__ */ jsx(CompositeRoot, {
|
|
180
|
+
render,
|
|
181
|
+
className,
|
|
182
|
+
style,
|
|
183
|
+
state,
|
|
184
|
+
refs: [forwardedRef],
|
|
185
|
+
props: [defaultProps, elementProps],
|
|
186
|
+
loopFocus,
|
|
187
|
+
enableHomeAndEndKeys: true,
|
|
188
|
+
orientation
|
|
189
|
+
})
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
if (process.env.NODE_ENV !== "production") ToggleGroup.displayName = "ToggleGroup";
|
|
193
|
+
const segmentedControlVariants = cva(
|
|
194
|
+
"inline-flex w-fit items-center gap-space-2 bg-background-surface-raised p-space-4 inset-ring inset-ring-border-subtle",
|
|
195
|
+
{
|
|
196
|
+
variants: {
|
|
197
|
+
size: {
|
|
198
|
+
sm: "h-7",
|
|
199
|
+
md: "h-8",
|
|
200
|
+
lg: "h-9"
|
|
201
|
+
},
|
|
202
|
+
roundness: {
|
|
203
|
+
default: "rounded-sm",
|
|
204
|
+
pill: "rounded-pill"
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
defaultVariants: { size: "md", roundness: "default" }
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
const segmentVariants = cva(
|
|
211
|
+
"inline-flex items-center justify-center gap-space-6 text-text-secondary transition-colors focus-ring focus-visible:outline-offset-4 not-data-pressed:hover:bg-background-fill-ghost-hover data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
212
|
+
{
|
|
213
|
+
variants: {
|
|
214
|
+
size: {
|
|
215
|
+
sm: "h-5 px-space-8 text-label-sm",
|
|
216
|
+
md: "h-6 px-space-10 text-label-md",
|
|
217
|
+
lg: "h-7 px-space-12 text-label-md"
|
|
218
|
+
},
|
|
219
|
+
tone: {
|
|
220
|
+
solid: "data-pressed:bg-segmented-segment-solid-background-selected data-pressed:text-segmented-segment-solid-text-selected",
|
|
221
|
+
tinted: "data-pressed:bg-segmented-segment-tinted-background-selected data-pressed:text-segmented-segment-tinted-text-selected",
|
|
222
|
+
brand: "data-pressed:bg-segmented-segment-brand-background-selected data-pressed:text-segmented-segment-brand-text-selected"
|
|
223
|
+
},
|
|
224
|
+
roundness: {
|
|
225
|
+
default: "rounded-sm",
|
|
226
|
+
pill: "rounded-pill"
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
defaultVariants: { size: "md", tone: "solid", roundness: "default" }
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
const SegmentedControlContext = React.createContext(null);
|
|
233
|
+
function SegmentedControl({
|
|
234
|
+
className,
|
|
235
|
+
size = "md",
|
|
236
|
+
tone = "solid",
|
|
237
|
+
roundness = "default",
|
|
238
|
+
value,
|
|
239
|
+
defaultValue,
|
|
240
|
+
onValueChange,
|
|
241
|
+
children,
|
|
242
|
+
onKeyDownCapture,
|
|
243
|
+
...props
|
|
244
|
+
}) {
|
|
245
|
+
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue);
|
|
246
|
+
const selectedValue = value ?? uncontrolledValue;
|
|
247
|
+
const selectOnFocusRef = React.useRef(false);
|
|
248
|
+
const contextValue = React.useMemo(
|
|
249
|
+
() => ({
|
|
250
|
+
size: size ?? "md",
|
|
251
|
+
tone,
|
|
252
|
+
roundness: roundness ?? "default",
|
|
253
|
+
selectOnFocusRef,
|
|
254
|
+
selectedValue
|
|
255
|
+
}),
|
|
256
|
+
[roundness, selectedValue, size, tone]
|
|
257
|
+
);
|
|
258
|
+
return /* @__PURE__ */ jsx(SegmentedControlContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
259
|
+
ToggleGroup,
|
|
260
|
+
{
|
|
261
|
+
"data-slot": "segmented-control",
|
|
262
|
+
value: selectedValue == null ? [] : [selectedValue],
|
|
263
|
+
multiple: false,
|
|
264
|
+
...props,
|
|
265
|
+
className: classNames(segmentedControlVariants({ size, roundness }), className),
|
|
266
|
+
onValueChange: (nextValue, eventDetails) => {
|
|
267
|
+
if (nextValue[0] == null) {
|
|
268
|
+
eventDetails.cancel();
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (value === void 0) setUncontrolledValue(nextValue[0]);
|
|
272
|
+
onValueChange == null ? void 0 : onValueChange(nextValue[0], eventDetails);
|
|
273
|
+
},
|
|
274
|
+
onKeyDownCapture: (event) => {
|
|
275
|
+
onKeyDownCapture == null ? void 0 : onKeyDownCapture(event);
|
|
276
|
+
if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
277
|
+
selectOnFocusRef.current = ["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key);
|
|
278
|
+
},
|
|
279
|
+
children
|
|
280
|
+
}
|
|
281
|
+
) });
|
|
282
|
+
}
|
|
283
|
+
function SegmentedControlItem({
|
|
284
|
+
className,
|
|
285
|
+
icon,
|
|
286
|
+
children,
|
|
287
|
+
"aria-label": ariaLabel,
|
|
288
|
+
onFocus,
|
|
289
|
+
tabIndex,
|
|
290
|
+
value,
|
|
291
|
+
...props
|
|
292
|
+
}) {
|
|
293
|
+
const context = React.useContext(SegmentedControlContext);
|
|
294
|
+
if (!context) throw new Error("SegmentedControlItem must be used within SegmentedControl");
|
|
295
|
+
return /* @__PURE__ */ jsxs(
|
|
296
|
+
Toggle,
|
|
297
|
+
{
|
|
298
|
+
"data-slot": "segmented-control-item",
|
|
299
|
+
"aria-label": ariaLabel ?? (typeof children === "string" ? children : void 0),
|
|
300
|
+
...props,
|
|
301
|
+
value,
|
|
302
|
+
tabIndex: tabIndex ?? (context.selectedValue == null ? void 0 : context.selectedValue === value ? 0 : -1),
|
|
303
|
+
className: classNames(segmentVariants(context), className),
|
|
304
|
+
onFocus: (event) => {
|
|
305
|
+
onFocus == null ? void 0 : onFocus(event);
|
|
306
|
+
if (!context.selectOnFocusRef.current || event.defaultPrevented) return;
|
|
307
|
+
context.selectOnFocusRef.current = false;
|
|
308
|
+
const item = event.currentTarget;
|
|
309
|
+
queueMicrotask(() => {
|
|
310
|
+
if (item.isConnected && item.getAttribute("aria-pressed") !== "true") item.click();
|
|
311
|
+
});
|
|
312
|
+
},
|
|
313
|
+
children: [
|
|
314
|
+
icon && /* @__PURE__ */ jsx(IconProvider, { "aria-hidden": true, icon, size: context.size === "sm" ? 0.75 : 1 }),
|
|
315
|
+
children != null && /* @__PURE__ */ jsx("span", { children })
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
export {
|
|
321
|
+
SegmentedControlItem,
|
|
322
|
+
SegmentedControl as default,
|
|
323
|
+
segmentVariants,
|
|
324
|
+
segmentedControlVariants
|
|
325
|
+
};
|
|
326
|
+
//# sourceMappingURL=SegmentedControl.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.es.js","sources":["../../../node_modules/@base-ui/react/toggle-group/ToggleGroupContext.mjs","../../../node_modules/@base-ui/react/toggle/Toggle.mjs","../../../node_modules/@base-ui/react/toolbar/group/ToolbarGroupContext.mjs","../../../node_modules/@base-ui/react/toggle-group/ToggleGroup.mjs","../../../src/new-components/atoms/SegmentedControl.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nexport const ToggleGroupContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ToggleGroupContext.displayName = \"ToggleGroupContext\";\nexport function useToggleGroupContext() {\n return React.useContext(ToggleGroupContext);\n}","'use client';\n\nimport * as React from 'react';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { error } from '@base-ui/utils/error';\nimport { useBaseUiId } from \"../internals/useBaseUiId.mjs\";\nimport { useRenderElement } from \"../internals/useRenderElement.mjs\";\nimport { useToggleGroupContext } from \"../toggle-group/ToggleGroupContext.mjs\";\nimport { useButton } from \"../internals/use-button/useButton.mjs\";\nimport { CompositeItem } from \"../internals/composite/item/CompositeItem.mjs\";\nimport { createChangeEventDetails } from \"../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../internals/reasons.mjs\";\n\n/**\n * A two-state button that can be on or off.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Toggle](https://base-ui.com/react/components/toggle)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const Toggle = /*#__PURE__*/React.forwardRef(function Toggle(componentProps, forwardedRef) {\n const {\n className,\n defaultPressed = false,\n disabled: disabledProp = false,\n form,\n // never participates in form validation\n onPressedChange,\n pressed: pressedProp,\n render,\n type,\n // cannot change button type\n value: valueProp,\n nativeButton = true,\n style,\n ...elementProps\n } = componentProps;\n\n // `|| undefined` handles cases, where value is falsy (i.e. \"\")\n const value = useBaseUiId(valueProp || undefined);\n const groupContext = useToggleGroupContext();\n const groupValue = groupContext?.value ?? [];\n const disabled = (disabledProp || groupContext?.disabled) ?? false;\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (groupContext && valueProp === undefined && groupContext.isValueInitialized) {\n error('A `<Toggle>` component rendered in a `<ToggleGroup>` has no explicit `value` prop.', 'This will cause issues between the Toggle Group and Toggle values.', 'Provide the `<Toggle>` with a `value` prop matching the `<ToggleGroup>` values prop type.');\n }\n }, [groupContext, valueProp, groupContext?.isValueInitialized]);\n }\n const [pressed, setPressedState] = useControlled({\n controlled: groupContext ? value !== undefined && groupValue.indexOf(value) > -1 : pressedProp,\n default: defaultPressed,\n name: 'Toggle',\n state: 'pressed'\n });\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n native: nativeButton\n });\n const state = {\n disabled,\n pressed\n };\n const refs = [buttonRef, forwardedRef];\n const props = [{\n 'aria-pressed': pressed,\n onClick(event) {\n const nextPressed = !pressed;\n const details = createChangeEventDetails(REASONS.none, event.nativeEvent);\n\n // `onPressedChange` runs before the group commits so that canceling here\n // can also veto the group value change, which shares this `details` object.\n onPressedChange?.(nextPressed, details);\n if (details.isCanceled) {\n return;\n }\n if (value) {\n groupContext?.setGroupValue?.(value, nextPressed, details);\n }\n if (details.isCanceled) {\n return;\n }\n setPressedState(nextPressed);\n }\n }, elementProps, getButtonProps];\n const element = useRenderElement('button', componentProps, {\n enabled: !groupContext,\n state,\n ref: refs,\n props\n });\n\n // A disabled toggle is natively disabled and cannot hold roving focus.\n // Toolbar reads this metadata to compute its `disabledIndices`.\n const itemMetadata = React.useMemo(() => ({\n disabled,\n focusableWhenDisabled: false\n }), [disabled]);\n if (groupContext) {\n return /*#__PURE__*/_jsx(CompositeItem, {\n tag: \"button\",\n render: render,\n className: className,\n style: style,\n metadata: itemMetadata,\n state: state,\n refs: refs,\n props: props\n });\n }\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") Toggle.displayName = \"Toggle\";","'use client';\n\nimport * as React from 'react';\nexport const ToolbarGroupContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ToolbarGroupContext.displayName = \"ToolbarGroupContext\";\nexport function useToolbarGroupContext() {\n return React.useContext(ToolbarGroupContext);\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { EMPTY_ARRAY } from '@base-ui/utils/empty';\nimport { useRenderElement } from \"../internals/useRenderElement.mjs\";\nimport { CompositeRoot } from \"../internals/composite/root/CompositeRoot.mjs\";\nimport { useToolbarRootContext } from \"../toolbar/root/ToolbarRootContext.mjs\";\nimport { useToolbarGroupContext } from \"../toolbar/group/ToolbarGroupContext.mjs\";\nimport { ToggleGroupContext } from \"./ToggleGroupContext.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Provides a shared state to a series of toggle buttons.\n *\n * Documentation: [Base UI Toggle Group](https://base-ui.com/react/components/toggle-group)\n */\nexport const ToggleGroup = /*#__PURE__*/React.forwardRef(function ToggleGroup(componentProps, forwardedRef) {\n const {\n defaultValue: defaultValueProp,\n disabled: disabledProp = false,\n loopFocus = true,\n onValueChange,\n orientation = 'horizontal',\n multiple = false,\n value: valueProp,\n className,\n render,\n style,\n ...elementProps\n } = componentProps;\n const toolbarContext = useToolbarRootContext(true);\n const toolbarGroupContext = useToolbarGroupContext();\n const defaultValue = defaultValueProp ?? EMPTY_ARRAY;\n // Use the raw prop to distinguish an omitted value from the empty default.\n const isValueInitialized = valueProp !== undefined || defaultValueProp !== undefined;\n const disabled = (toolbarContext?.disabled ?? false) || (toolbarGroupContext?.disabled ?? false) || disabledProp;\n const [groupValue, setValueState] = useControlled({\n controlled: valueProp,\n default: defaultValue,\n name: 'ToggleGroup',\n state: 'value'\n });\n const setGroupValue = useStableCallback((newValue, nextPressed, eventDetails) => {\n let newGroupValue;\n if (multiple) {\n newGroupValue = groupValue.slice();\n if (nextPressed) {\n newGroupValue.push(newValue);\n } else {\n newGroupValue.splice(groupValue.indexOf(newValue), 1);\n }\n } else {\n newGroupValue = nextPressed ? [newValue] : [];\n }\n onValueChange?.(newGroupValue, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setValueState(newGroupValue);\n });\n const state = {\n disabled,\n multiple,\n orientation\n };\n const contextValue = React.useMemo(() => ({\n disabled,\n setGroupValue,\n value: groupValue,\n isValueInitialized\n }), [disabled, setGroupValue, groupValue, isValueInitialized]);\n const defaultProps = {\n role: 'group'\n };\n const element = useRenderElement('div', componentProps, {\n enabled: Boolean(toolbarContext),\n state,\n ref: forwardedRef,\n props: [defaultProps, elementProps]\n });\n return /*#__PURE__*/_jsx(ToggleGroupContext.Provider, {\n value: contextValue,\n children: toolbarContext ? element : /*#__PURE__*/_jsx(CompositeRoot, {\n render: render,\n className: className,\n style: style,\n state: state,\n refs: [forwardedRef],\n props: [defaultProps, elementProps],\n loopFocus: loopFocus,\n enableHomeAndEndKeys: true,\n orientation: orientation\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") ToggleGroup.displayName = \"ToggleGroup\";","import * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { Toggle } from '@base-ui/react/toggle'\nimport { ToggleGroup } from '@base-ui/react/toggle-group'\n\nimport IconProvider, { type IconProp } from '@/components/atoms/IconProvider'\nimport { cn } from '@/lib/utils'\n\nconst segmentedControlVariants = cva(\n 'inline-flex w-fit items-center gap-space-2 bg-background-surface-raised p-space-4 inset-ring inset-ring-border-subtle',\n {\n variants: {\n size: {\n sm: 'h-7',\n md: 'h-8',\n lg: 'h-9',\n },\n roundness: {\n default: 'rounded-sm',\n pill: 'rounded-pill',\n },\n },\n defaultVariants: { size: 'md', roundness: 'default' },\n },\n)\n\nconst segmentVariants = cva(\n 'inline-flex items-center justify-center gap-space-6 text-text-secondary transition-colors focus-ring focus-visible:outline-offset-4 not-data-pressed:hover:bg-background-fill-ghost-hover data-disabled:pointer-events-none data-disabled:opacity-50',\n {\n variants: {\n size: {\n sm: 'h-5 px-space-8 text-label-sm',\n md: 'h-6 px-space-10 text-label-md',\n lg: 'h-7 px-space-12 text-label-md',\n },\n tone: {\n solid:\n 'data-pressed:bg-segmented-segment-solid-background-selected data-pressed:text-segmented-segment-solid-text-selected',\n tinted:\n 'data-pressed:bg-segmented-segment-tinted-background-selected data-pressed:text-segmented-segment-tinted-text-selected',\n brand:\n 'data-pressed:bg-segmented-segment-brand-background-selected data-pressed:text-segmented-segment-brand-text-selected',\n },\n roundness: {\n default: 'rounded-sm',\n pill: 'rounded-pill',\n },\n },\n defaultVariants: { size: 'md', tone: 'solid', roundness: 'default' },\n },\n)\n\ntype SegmentedControlContextValue = {\n size: NonNullable<VariantProps<typeof segmentedControlVariants>['size']>\n tone: NonNullable<VariantProps<typeof segmentVariants>['tone']>\n roundness: NonNullable<VariantProps<typeof segmentedControlVariants>['roundness']>\n selectOnFocusRef: React.RefObject<boolean>\n selectedValue: string | undefined\n}\n\nconst SegmentedControlContext = React.createContext<SegmentedControlContextValue | null>(null)\n\nexport type SegmentedControlProps = Omit<\n ToggleGroup.Props<string>,\n 'value' | 'defaultValue' | 'onValueChange' | 'multiple'\n> &\n VariantProps<typeof segmentedControlVariants> & {\n tone?: NonNullable<VariantProps<typeof segmentVariants>['tone']>\n value?: string\n defaultValue?: string\n onValueChange?: (value: string, eventDetails: ToggleGroup.ChangeEventDetails) => void\n }\n\nfunction SegmentedControl({\n className,\n size = 'md',\n tone = 'solid',\n roundness = 'default',\n value,\n defaultValue,\n onValueChange,\n children,\n onKeyDownCapture,\n ...props\n}: SegmentedControlProps) {\n const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue)\n const selectedValue = value ?? uncontrolledValue\n const selectOnFocusRef = React.useRef(false)\n const contextValue = React.useMemo(\n () => ({\n size: size ?? 'md',\n tone,\n roundness: roundness ?? 'default',\n selectOnFocusRef,\n selectedValue,\n }),\n [roundness, selectedValue, size, tone],\n )\n\n return (\n <SegmentedControlContext.Provider value={contextValue}>\n <ToggleGroup\n data-slot=\"segmented-control\"\n value={selectedValue == null ? [] : [selectedValue]}\n multiple={false}\n {...props}\n className={cn(segmentedControlVariants({ size, roundness }), className)}\n onValueChange={(nextValue, eventDetails) => {\n if (nextValue[0] == null) {\n eventDetails.cancel()\n return\n }\n if (value === undefined) setUncontrolledValue(nextValue[0])\n onValueChange?.(nextValue[0], eventDetails)\n }}\n onKeyDownCapture={(event) => {\n onKeyDownCapture?.(event)\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return\n\n selectOnFocusRef.current = ['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)\n }}\n >\n {children}\n </ToggleGroup>\n </SegmentedControlContext.Provider>\n )\n}\n\nexport type SegmentedControlItemProps = Omit<Toggle.Props<string>, 'children'> & {\n icon?: IconProp\n children?: React.ReactNode\n}\n\nfunction SegmentedControlItem({\n className,\n icon,\n children,\n 'aria-label': ariaLabel,\n onFocus,\n tabIndex,\n value,\n ...props\n}: SegmentedControlItemProps) {\n const context = React.useContext(SegmentedControlContext)\n if (!context) throw new Error('SegmentedControlItem must be used within SegmentedControl')\n\n return (\n <Toggle\n data-slot=\"segmented-control-item\"\n aria-label={ariaLabel ?? (typeof children === 'string' ? children : undefined)}\n {...props}\n value={value}\n tabIndex={tabIndex ?? (context.selectedValue == null ? undefined : context.selectedValue === value ? 0 : -1)}\n className={cn(segmentVariants(context), className)}\n onFocus={(event) => {\n onFocus?.(event)\n if (!context.selectOnFocusRef.current || event.defaultPrevented) return\n\n context.selectOnFocusRef.current = false\n const item = event.currentTarget\n queueMicrotask(() => {\n if (item.isConnected && item.getAttribute('aria-pressed') !== 'true') item.click()\n })\n }}\n >\n {icon && <IconProvider aria-hidden icon={icon} size={context.size === 'sm' ? 0.75 : 1} />}\n {children != null && <span>{children}</span>}\n </Toggle>\n )\n}\n\nexport { SegmentedControlItem, segmentedControlVariants, segmentVariants }\nexport default SegmentedControl\n"],"names":["Toggle","REASONS.none","_jsx","ToggleGroup","cn"],"mappings":";;;;;;;;;;;;;AAGO,MAAM,qBAAkC,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ACJ;AAAA,MACA,UAAU,aAAa,QAAQ,iBAAiB,OAAO,SAAY,QAAQ,kBAAkB,QAAQ,IAAI;AAAA,MACzG,WAAWA,WAAG,gBAAgB,OAAO,GAAG,SAAS;AAAA,MACjD,SAAS,CAAC,UAAU;AAClB,2CAAU;AACV,YAAI,CAAC,QAAQ,iBAAiB,WAAW,MAAM,iBAAkB;AAEjE,gBAAQ,iBAAiB,UAAU;AACnC,cAAM,OAAO,MAAM;AACnB,uBAAe,MAAM;AACnB,cAAI,KAAK,eAAe,KAAK,aAAa,cAAc,MAAM,aAAa,MAAA;AAAA,QAC7E,CAAC;AAAA,MACH;AAAA,MAEC,UAAA;AAAA,QAAA,QAAQ,oBAAC,cAAA,EAAa,eAAW,MAAC,MAAY,MAAM,QAAQ,SAAS,OAAO,OAAO,EAAA,CAAG;AAAA,QACtF,YAAY,QAAQ,oBAAC,QAAA,EAAM,SAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG3C;","x_google_ignoreList":[0,1,2,3]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Slider as SliderPrimitive } from '@base-ui/react/slider';
|
|
3
|
+
export type SliderProps = SliderPrimitive.Root.Props<number | readonly number[]> & {
|
|
4
|
+
thumbLabels?: readonly string[];
|
|
5
|
+
thumbClassName?: string | ((index: number) => string);
|
|
6
|
+
};
|
|
7
|
+
declare function Slider({ className, orientation, value, defaultValue, thumbLabels, thumbClassName, ...props }: SliderProps): React.JSX.Element;
|
|
8
|
+
export default Slider;
|