@yahoo/uds 3.131.0-beta.2 → 3.132.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automated-config/dist/properties.d.cts +1 -1
- package/dist/automated-config/dist/properties.d.ts +1 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.d.cts +1 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.d.ts +1 -1
- package/dist/components/Banner/Banner.cjs +5 -2
- package/dist/components/Banner/Banner.d.cts +10 -1
- package/dist/components/Banner/Banner.d.ts +10 -1
- package/dist/components/Banner/Banner.js +5 -2
- package/dist/components/Banner/utils.d.cts +1 -1
- package/dist/components/Banner/utils.d.ts +1 -1
- package/dist/components/Box.d.cts +1 -1
- package/dist/components/Box.d.ts +1 -1
- package/dist/components/Divider/Divider.d.cts +2 -2
- package/dist/components/Divider/Divider.d.ts +2 -2
- package/dist/components/Divider/DividerCore.cjs +17 -10
- package/dist/components/Divider/DividerCore.d.cts +11 -5
- package/dist/components/Divider/DividerCore.d.ts +11 -5
- package/dist/components/Divider/DividerCore.js +17 -10
- package/dist/components/Divider/DividerInternal.cjs +15 -11
- package/dist/components/Divider/DividerInternal.d.cts +1 -1
- package/dist/components/Divider/DividerInternal.d.ts +1 -1
- package/dist/components/Divider/DividerInternal.js +15 -11
- package/dist/components/FormLabel.d.cts +1 -1
- package/dist/components/FormLabel.d.ts +1 -1
- package/dist/components/HStack.d.cts +1 -1
- package/dist/components/HStack.d.ts +1 -1
- package/dist/components/Icon.cjs +6 -15
- package/dist/components/Icon.d.cts +1 -0
- package/dist/components/Icon.d.ts +1 -0
- package/dist/components/Icon.js +7 -16
- package/dist/components/IconSlot.cjs +6 -25
- package/dist/components/IconSlot.d.cts +2 -3
- package/dist/components/IconSlot.d.ts +2 -3
- package/dist/components/IconSlot.js +5 -25
- package/dist/components/Image.d.cts +1 -1
- package/dist/components/Image.d.ts +1 -1
- package/dist/components/Link.cjs +13 -6
- package/dist/components/Link.d.cts +11 -1
- package/dist/components/Link.d.ts +11 -1
- package/dist/components/Link.js +13 -6
- package/dist/components/Text.d.cts +1 -1
- package/dist/components/Text.d.ts +1 -1
- package/dist/components/VStack.d.cts +1 -1
- package/dist/components/VStack.d.ts +1 -1
- package/dist/components/client/Avatar/AvatarIcon.d.cts +1 -1
- package/dist/components/client/Avatar/AvatarIcon.d.ts +1 -1
- package/dist/components/client/Avatar/AvatarImage.d.cts +1 -1
- package/dist/components/client/Avatar/AvatarImage.d.ts +1 -1
- package/dist/components/client/Avatar/AvatarText.d.cts +1 -1
- package/dist/components/client/Avatar/AvatarText.d.ts +1 -1
- package/dist/components/client/Avatar/utils.d.cts +1 -1
- package/dist/components/client/Avatar/utils.d.ts +1 -1
- package/dist/components/client/Badge.cjs +10 -4
- package/dist/components/client/Badge.d.cts +13 -2
- package/dist/components/client/Badge.d.ts +13 -2
- package/dist/components/client/Badge.js +10 -4
- package/dist/components/client/BottomSheet/BottomSheet.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheet.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetContent.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetContent.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHandle.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHandle.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHeader.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHeader.d.ts +1 -1
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.d.cts +1 -1
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.d.ts +1 -1
- package/dist/components/client/BottomSheet/utils.d.cts +1 -1
- package/dist/components/client/BottomSheet/utils.d.ts +1 -1
- package/dist/components/client/Button.cjs +20 -9
- package/dist/components/client/Button.d.cts +13 -2
- package/dist/components/client/Button.d.ts +13 -2
- package/dist/components/client/Button.js +20 -9
- package/dist/components/client/Checkbox.cjs +14 -6
- package/dist/components/client/Checkbox.d.cts +10 -5
- package/dist/components/client/Checkbox.d.ts +10 -5
- package/dist/components/client/Checkbox.js +14 -6
- package/dist/components/client/Chip/Chip.d.cts +1 -1
- package/dist/components/client/Chip/Chip.d.ts +1 -1
- package/dist/components/client/Chip/ChipBase.d.cts +1 -1
- package/dist/components/client/Chip/ChipBase.d.ts +1 -1
- package/dist/components/client/Chip/ChipButton.d.cts +1 -1
- package/dist/components/client/Chip/ChipButton.d.ts +1 -1
- package/dist/components/client/Chip/ChipDismissible.d.cts +1 -1
- package/dist/components/client/Chip/ChipDismissible.d.ts +1 -1
- package/dist/components/client/Chip/ChipLink.d.cts +1 -1
- package/dist/components/client/Chip/ChipLink.d.ts +1 -1
- package/dist/components/client/Chip/ChipToggle.d.cts +1 -1
- package/dist/components/client/Chip/ChipToggle.d.ts +1 -1
- package/dist/components/client/IconButton.cjs +5 -8
- package/dist/components/client/IconButton.d.cts +10 -2
- package/dist/components/client/IconButton.d.ts +10 -2
- package/dist/components/client/IconButton.js +5 -8
- package/dist/components/client/Input/Input.cjs +8 -2
- package/dist/components/client/Input/Input.d.cts +4 -1
- package/dist/components/client/Input/Input.d.ts +4 -1
- package/dist/components/client/Input/Input.js +8 -2
- package/dist/components/client/Input/InputHelpTextInternal.cjs +16 -6
- package/dist/components/client/Input/InputHelpTextInternal.d.cts +11 -1
- package/dist/components/client/Input/InputHelpTextInternal.d.ts +11 -1
- package/dist/components/client/Input/InputHelpTextInternal.js +16 -6
- package/dist/components/client/Menu/Menu.Content.cjs +2 -1
- package/dist/components/client/Menu/Menu.Content.d.cts +8 -1
- package/dist/components/client/Menu/Menu.Content.d.ts +8 -1
- package/dist/components/client/Menu/Menu.Content.js +2 -1
- package/dist/components/client/Menu/Menu.Divider.cjs +8 -10
- package/dist/components/client/Menu/Menu.Divider.js +8 -10
- package/dist/components/client/Menu/Menu.Item.cjs +23 -14
- package/dist/components/client/Menu/Menu.Item.d.cts +12 -1
- package/dist/components/client/Menu/Menu.Item.d.ts +12 -1
- package/dist/components/client/Menu/Menu.Item.js +24 -15
- package/dist/components/client/Menu/Menu.ItemBase.cjs +17 -9
- package/dist/components/client/Menu/Menu.ItemBase.d.cts +10 -6
- package/dist/components/client/Menu/Menu.ItemBase.d.ts +10 -6
- package/dist/components/client/Menu/Menu.ItemBase.js +17 -9
- package/dist/components/client/Menu/Menu.ItemCheckbox.cjs +10 -10
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +2 -2
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +2 -2
- package/dist/components/client/Menu/Menu.ItemCheckbox.js +10 -10
- package/dist/components/client/Popover/Popover.d.cts +1 -1
- package/dist/components/client/Popover/Popover.d.ts +1 -1
- package/dist/components/client/Popover/PopoverContent.cjs +4 -1
- package/dist/components/client/Popover/PopoverContent.d.cts +4 -1
- package/dist/components/client/Popover/PopoverContent.d.ts +4 -1
- package/dist/components/client/Popover/PopoverContent.js +4 -1
- package/dist/components/client/Popover/PopoverTrigger.d.cts +1 -1
- package/dist/components/client/Popover/PopoverTrigger.d.ts +1 -1
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.cts +2 -2
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +2 -2
- package/dist/components/client/Popover/index.d.cts +1 -1
- package/dist/components/client/Popover/index.d.ts +1 -1
- package/dist/components/client/Pressable.d.cts +1 -1
- package/dist/components/client/Pressable.d.ts +1 -1
- package/dist/components/client/Radio/Radio.cjs +18 -15
- package/dist/components/client/Radio/Radio.d.cts +10 -5
- package/dist/components/client/Radio/Radio.d.ts +10 -5
- package/dist/components/client/Radio/Radio.js +18 -15
- package/dist/components/client/Radio/RadioGroupProvider.d.cts +1 -1
- package/dist/components/client/Radio/RadioGroupProvider.d.ts +1 -1
- package/dist/components/client/SpringMotionConfig.d.cts +1 -1
- package/dist/components/client/SpringMotionConfig.d.ts +1 -1
- package/dist/components/client/Switch.cjs +14 -6
- package/dist/components/client/Switch.d.cts +10 -6
- package/dist/components/client/Switch.d.ts +10 -6
- package/dist/components/client/Switch.js +14 -6
- package/dist/components/client/Tabs/Tab.cjs +11 -5
- package/dist/components/client/Tabs/Tab.d.cts +14 -3
- package/dist/components/client/Tabs/Tab.d.ts +14 -3
- package/dist/components/client/Tabs/Tab.js +11 -5
- package/dist/components/client/Tabs/TabList.d.cts +1 -1
- package/dist/components/client/Tabs/TabList.d.ts +1 -1
- package/dist/components/client/Tabs/TabPanel.d.cts +1 -1
- package/dist/components/client/Tabs/TabPanel.d.ts +1 -1
- package/dist/components/client/Tabs/Tabs.d.cts +1 -1
- package/dist/components/client/Tabs/Tabs.d.ts +1 -1
- package/dist/components/client/Tabs/tabsContext.d.cts +1 -1
- package/dist/components/client/Tabs/tabsContext.d.ts +1 -1
- package/dist/components/client/Toast/Toast.d.cts +1 -1
- package/dist/components/client/Toast/Toast.d.ts +1 -1
- package/dist/components/client/Toast/ToastContainer.d.cts +1 -1
- package/dist/components/client/Toast/ToastContainer.d.ts +1 -1
- package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +1 -1
- package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +1 -1
- package/dist/components/client/Toast/createToast.d.cts +1 -1
- package/dist/components/client/Toast/createToast.d.ts +1 -1
- package/dist/components/client/Tooltip/Tooltip.d.cts +1 -1
- package/dist/components/client/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/client/Tooltip/TooltipContent.cjs +9 -3
- package/dist/components/client/Tooltip/TooltipContent.d.cts +14 -3
- package/dist/components/client/Tooltip/TooltipContent.d.ts +14 -3
- package/dist/components/client/Tooltip/TooltipContent.js +9 -3
- package/dist/components/client/Tooltip/TooltipTrigger.d.cts +1 -1
- package/dist/components/client/Tooltip/TooltipTrigger.d.ts +1 -1
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.d.cts +1 -1
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.d.ts +1 -1
- package/dist/components/client/Tooltip/index.d.cts +1 -1
- package/dist/components/client/Tooltip/index.d.ts +1 -1
- package/dist/components/client/buttonConstants.d.cts +1 -1
- package/dist/components/client/buttonConstants.d.ts +1 -1
- package/dist/components/client/index.d.cts +1 -1
- package/dist/components/client/index.d.ts +1 -1
- package/dist/components/client/providers/UDSBreakpointsConfigProvider.d.cts +1 -1
- package/dist/components/client/providers/UDSBreakpointsConfigProvider.d.ts +1 -1
- package/dist/components/experimental/Table.d.cts +1 -1
- package/dist/components/experimental/Table.d.ts +1 -1
- package/dist/components/experimental/client/SwitchV2.cjs +14 -6
- package/dist/components/experimental/client/SwitchV2.d.cts +10 -6
- package/dist/components/experimental/client/SwitchV2.d.ts +10 -6
- package/dist/components/experimental/client/SwitchV2.js +14 -6
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/config/dist/index.d.cts +1 -1
- package/dist/config/dist/index.d.ts +1 -1
- package/dist/css-tokens/dist/index.d.cts +1 -1
- package/dist/css-tokens/dist/index.d.ts +1 -1
- package/dist/fixtures/dist/index.d.cts +1 -1
- package/dist/fixtures/dist/index.d.ts +1 -1
- package/dist/fixtures/index.d.cts +1 -1
- package/dist/fixtures/index.d.ts +1 -1
- package/dist/fonts/dist/index.d.cts +1 -1
- package/dist/fonts/dist/index.d.ts +1 -1
- package/dist/icons/dist/types.d.cts +30 -0
- package/dist/icons/dist/types.d.ts +30 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/modes/dist/index.d.cts +1 -1
- package/dist/modes/dist/index.d.ts +1 -1
- package/dist/motion-tokens/dist/index.d.cts +1 -1
- package/dist/motion-tokens/dist/index.d.ts +1 -1
- package/dist/providers/ColorModeProvider.d.cts +1 -1
- package/dist/providers/ColorModeProvider.d.ts +1 -1
- package/dist/providers/ScaleModeProvider.d.cts +1 -1
- package/dist/providers/ScaleModeProvider.d.ts +1 -1
- package/dist/providers/ThemeProvider.d.cts +1 -1
- package/dist/providers/ThemeProvider.d.ts +1 -1
- package/dist/runtime/bottomSheetConfig.d.cts +1 -1
- package/dist/runtime/bottomSheetConfig.d.ts +1 -1
- package/dist/runtime/breakpointsConfig.d.cts +1 -1
- package/dist/runtime/breakpointsConfig.d.ts +1 -1
- package/dist/runtime/popoverConfig.d.cts +1 -1
- package/dist/runtime/popoverConfig.d.ts +1 -1
- package/dist/runtime/toastConfig.d.cts +1 -1
- package/dist/runtime/toastConfig.d.ts +1 -1
- package/dist/runtime/tooltipConfig.d.cts +1 -1
- package/dist/runtime/tooltipConfig.d.ts +1 -1
- package/dist/styles/styler.d.cts +76 -76
- package/dist/styles/styler.d.ts +76 -76
- package/dist/styles/stylerTypes.d.cts +1 -1
- package/dist/styles/stylerTypes.d.ts +1 -1
- package/dist/tailwind/dist/types/dist/index.d.cts.map +1 -1
- package/dist/tailwind/dist/types/dist/index.d.ts.map +1 -1
- package/dist/tokens/configs/borderRadius.d.cts +1 -1
- package/dist/tokens/configs/borderRadius.d.ts +1 -1
- package/dist/tokens/configs/borderWidth.d.cts +1 -1
- package/dist/tokens/configs/borderWidth.d.ts +1 -1
- package/dist/tokens/configs/font.d.cts +1 -1
- package/dist/tokens/configs/font.d.ts +1 -1
- package/dist/tokens/configs/scaleMode.d.cts +1 -1
- package/dist/tokens/configs/scaleMode.d.ts +1 -1
- package/dist/tokens/configs/shadow.d.cts +1 -1
- package/dist/tokens/configs/shadow.d.ts +1 -1
- package/dist/tokens/configs/sizes.d.cts +1 -1
- package/dist/tokens/configs/sizes.d.ts +1 -1
- package/dist/tokens/configs/typography.d.cts +1 -1
- package/dist/tokens/configs/typography.d.ts +1 -1
- package/dist/tokens/index.d.cts +2 -2
- package/dist/tokens/index.d.ts +2 -2
- package/dist/tokens/parseButtonVariants.d.cts +1 -1
- package/dist/tokens/parseButtonVariants.d.ts +1 -1
- package/dist/tokens/types.d.cts +7 -7
- package/dist/tokens/types.d.ts +7 -7
- package/dist/tokens/utils/spectrum.d.cts +1 -1
- package/dist/tokens/utils/spectrum.d.ts +1 -1
- package/dist/types/{src → dist}/index.d.cts +26 -38
- package/dist/types/{src → dist}/index.d.ts +26 -38
- package/dist/uds/generated/componentData.cjs +109 -106
- package/dist/uds/generated/componentData.js +109 -106
- package/dist/uds/generated/tailwindPurge.cjs +73 -73
- package/dist/uds/generated/tailwindPurge.js +73 -73
- package/dist/uds/package.cjs +1 -1
- package/dist/uds/package.js +1 -1
- package/dist/utils/isElevationAlias.d.cts +1 -1
- package/dist/utils/isElevationAlias.d.ts +1 -1
- package/generated/componentData.json +135 -124
- package/generated/tailwindPurge.ts +1 -1
- package/package.json +2 -2
|
@@ -52,9 +52,13 @@ const pressTransition = {
|
|
|
52
52
|
*
|
|
53
53
|
* @related [Radio](https://uds.build/docs/components/Radio).
|
|
54
54
|
**/
|
|
55
|
-
const Radio = (0, react.forwardRef)(function Radio({ id, name: nameProp, label, labelPosition = "start", variant: variantProp = "primary", size = "md", reduceMotion: forceReduceMotion, value: valueProp = "", checked: checkedProp, defaultChecked, disabled, hasError, onChange, onFocus, onBlur, className, style,
|
|
55
|
+
const Radio = (0, react.forwardRef)(function Radio({ id, name: nameProp, label, labelPosition = "start", variant: variantProp = "primary", size = "md", reduceMotion: forceReduceMotion, value: valueProp = "", checked: checkedProp, defaultChecked, disabled, hasError, onChange, onFocus, onBlur, className, style, slotProps, ...radioProps }, parentRef) {
|
|
56
56
|
const generatedId = (0, react.useId)();
|
|
57
57
|
const uid = id ?? `uds-radio-${generatedId}`;
|
|
58
|
+
const rootSlotProps = slotProps?.root ?? {};
|
|
59
|
+
const radioSlotProps = slotProps?.radio ?? {};
|
|
60
|
+
const radioIconSlotProps = slotProps?.radioIcon ?? {};
|
|
61
|
+
const labelSlotProps = slotProps?.label ?? {};
|
|
58
62
|
const innerRef = (0, react.useRef)(null);
|
|
59
63
|
/**
|
|
60
64
|
* State
|
|
@@ -125,15 +129,11 @@ const Radio = (0, react.forwardRef)(function Radio({ id, name: nameProp, label,
|
|
|
125
129
|
display: "flex",
|
|
126
130
|
flexDirection: labelPosition === "start" ? "row" : "row-reverse",
|
|
127
131
|
alignItems: "center",
|
|
128
|
-
className: require_styles_styler.cx([
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
className,
|
|
135
|
-
layerClassNames?.root
|
|
136
|
-
])
|
|
132
|
+
className: require_styles_styler.cx([{
|
|
133
|
+
"cursor-pointer": !disabled,
|
|
134
|
+
"cursor-default": disabled,
|
|
135
|
+
"opacity-50": disabled
|
|
136
|
+
}, className])
|
|
137
137
|
}),
|
|
138
138
|
radio: require_styles_styler.getStyles({
|
|
139
139
|
radioSizeRadio: size,
|
|
@@ -145,8 +145,7 @@ const Radio = (0, react.forwardRef)(function Radio({ id, name: nameProp, label,
|
|
|
145
145
|
"uds-ring-within",
|
|
146
146
|
cssAnimationDuration,
|
|
147
147
|
"transition-[background-color,border-color]",
|
|
148
|
-
"transition-shadow"
|
|
149
|
-
layerClassNames?.radio
|
|
148
|
+
"transition-shadow"
|
|
150
149
|
])
|
|
151
150
|
}),
|
|
152
151
|
radioCircle: require_styles_styler.getStyles({
|
|
@@ -162,7 +161,7 @@ const Radio = (0, react.forwardRef)(function Radio({ id, name: nameProp, label,
|
|
|
162
161
|
])
|
|
163
162
|
}),
|
|
164
163
|
htmlRadio: require_styles_styler.cx("cursor-[inherit]", "absolute", "opacity-0", "top-1/2", "left-1/2", "w-[calc(100%+2px)]", "h-[calc(100%+2px)]", "transform", "translate-x-[-50%]", "translate-y-[-50%]"),
|
|
165
|
-
label: require_styles_styler.cx(labelPosition === "start" ? "text-start" : "text-end"
|
|
164
|
+
label: require_styles_styler.cx(labelPosition === "start" ? "text-start" : "text-end")
|
|
166
165
|
};
|
|
167
166
|
const RootElement = label ? motion_react.m.label : motion_react.m.div;
|
|
168
167
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
|
|
@@ -178,6 +177,7 @@ const Radio = (0, react.forwardRef)(function Radio({ id, name: nameProp, label,
|
|
|
178
177
|
onTap: handleTapEnd,
|
|
179
178
|
onTapCancel: handleTapEnd,
|
|
180
179
|
tabIndex: -1,
|
|
180
|
+
...rootSlotProps,
|
|
181
181
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(MotionBox, {
|
|
182
182
|
position: "relative",
|
|
183
183
|
borderRadius: "full",
|
|
@@ -187,6 +187,7 @@ const Radio = (0, react.forwardRef)(function Radio({ id, name: nameProp, label,
|
|
|
187
187
|
className: classNames.radio,
|
|
188
188
|
animate: motionAnimate,
|
|
189
189
|
insetShadow: showShadow ? "lg-invert" : "none",
|
|
190
|
+
...radioSlotProps,
|
|
190
191
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
191
192
|
type: "radio",
|
|
192
193
|
tabIndex: 0,
|
|
@@ -208,14 +209,16 @@ const Radio = (0, react.forwardRef)(function Radio({ id, name: nameProp, label,
|
|
|
208
209
|
className: classNames.htmlRadio
|
|
209
210
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
210
211
|
borderRadius: "full",
|
|
211
|
-
className: classNames.radioCircle
|
|
212
|
+
className: classNames.radioCircle,
|
|
213
|
+
...radioIconSlotProps
|
|
212
214
|
})]
|
|
213
215
|
}), label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_FormLabel.FormLabel, {
|
|
214
216
|
as: "div",
|
|
215
217
|
variant: "inherit",
|
|
216
218
|
color: "inherit",
|
|
217
219
|
label,
|
|
218
|
-
className: classNames.label
|
|
220
|
+
className: classNames.label,
|
|
221
|
+
...labelSlotProps
|
|
219
222
|
})]
|
|
220
223
|
})
|
|
221
224
|
});
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
|
|
2
|
-
import { RadioSize, RadioVariant, UniversalRadioProps } from "../../../types/
|
|
2
|
+
import { RadioSize, RadioVariant, UniversalRadioProps } from "../../../types/dist/index.cjs";
|
|
3
3
|
import "../../../tokens/index.cjs";
|
|
4
4
|
import React from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/components/client/Radio/Radio.d.ts
|
|
7
7
|
type NativeInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'checked' | 'value' | 'size' | 'height' | 'width' | 'color' | 'required'>;
|
|
8
|
+
type DataAttributes = {
|
|
9
|
+
[name: `data-${string}`]: string;
|
|
10
|
+
};
|
|
8
11
|
interface RadioProps extends NativeInputProps, UniversalRadioProps {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
/** Props to be passed into various slots within the component. */
|
|
13
|
+
slotProps?: {
|
|
14
|
+
root?: DataAttributes;
|
|
15
|
+
radio?: DataAttributes;
|
|
16
|
+
radioIcon?: DataAttributes;
|
|
17
|
+
label?: DataAttributes;
|
|
13
18
|
};
|
|
14
19
|
}
|
|
15
20
|
declare const RADIO_VARIANTS: RadioVariant[];
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
-
import { RadioSize, RadioVariant, UniversalRadioProps } from "../../../types/
|
|
3
|
+
import { RadioSize, RadioVariant, UniversalRadioProps } from "../../../types/dist/index.js";
|
|
4
4
|
import "../../../tokens/index.js";
|
|
5
5
|
import React from "react";
|
|
6
6
|
|
|
7
7
|
//#region src/components/client/Radio/Radio.d.ts
|
|
8
8
|
type NativeInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'checked' | 'value' | 'size' | 'height' | 'width' | 'color' | 'required'>;
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string;
|
|
11
|
+
};
|
|
9
12
|
interface RadioProps extends NativeInputProps, UniversalRadioProps {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
/** Props to be passed into various slots within the component. */
|
|
14
|
+
slotProps?: {
|
|
15
|
+
root?: DataAttributes;
|
|
16
|
+
radio?: DataAttributes;
|
|
17
|
+
radioIcon?: DataAttributes;
|
|
18
|
+
label?: DataAttributes;
|
|
14
19
|
};
|
|
15
20
|
}
|
|
16
21
|
declare const RADIO_VARIANTS: RadioVariant[];
|
|
@@ -49,9 +49,13 @@ const pressTransition = {
|
|
|
49
49
|
*
|
|
50
50
|
* @related [Radio](https://uds.build/docs/components/Radio).
|
|
51
51
|
**/
|
|
52
|
-
const Radio = forwardRef(function Radio({ id, name: nameProp, label, labelPosition = "start", variant: variantProp = "primary", size = "md", reduceMotion: forceReduceMotion, value: valueProp = "", checked: checkedProp, defaultChecked, disabled, hasError, onChange, onFocus, onBlur, className, style,
|
|
52
|
+
const Radio = forwardRef(function Radio({ id, name: nameProp, label, labelPosition = "start", variant: variantProp = "primary", size = "md", reduceMotion: forceReduceMotion, value: valueProp = "", checked: checkedProp, defaultChecked, disabled, hasError, onChange, onFocus, onBlur, className, style, slotProps, ...radioProps }, parentRef) {
|
|
53
53
|
const generatedId = useId();
|
|
54
54
|
const uid = id ?? `uds-radio-${generatedId}`;
|
|
55
|
+
const rootSlotProps = slotProps?.root ?? {};
|
|
56
|
+
const radioSlotProps = slotProps?.radio ?? {};
|
|
57
|
+
const radioIconSlotProps = slotProps?.radioIcon ?? {};
|
|
58
|
+
const labelSlotProps = slotProps?.label ?? {};
|
|
55
59
|
const innerRef = useRef(null);
|
|
56
60
|
/**
|
|
57
61
|
* State
|
|
@@ -122,15 +126,11 @@ const Radio = forwardRef(function Radio({ id, name: nameProp, label, labelPositi
|
|
|
122
126
|
display: "flex",
|
|
123
127
|
flexDirection: labelPosition === "start" ? "row" : "row-reverse",
|
|
124
128
|
alignItems: "center",
|
|
125
|
-
className: cx([
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
className,
|
|
132
|
-
layerClassNames?.root
|
|
133
|
-
])
|
|
129
|
+
className: cx([{
|
|
130
|
+
"cursor-pointer": !disabled,
|
|
131
|
+
"cursor-default": disabled,
|
|
132
|
+
"opacity-50": disabled
|
|
133
|
+
}, className])
|
|
134
134
|
}),
|
|
135
135
|
radio: getStyles({
|
|
136
136
|
radioSizeRadio: size,
|
|
@@ -142,8 +142,7 @@ const Radio = forwardRef(function Radio({ id, name: nameProp, label, labelPositi
|
|
|
142
142
|
"uds-ring-within",
|
|
143
143
|
cssAnimationDuration,
|
|
144
144
|
"transition-[background-color,border-color]",
|
|
145
|
-
"transition-shadow"
|
|
146
|
-
layerClassNames?.radio
|
|
145
|
+
"transition-shadow"
|
|
147
146
|
])
|
|
148
147
|
}),
|
|
149
148
|
radioCircle: getStyles({
|
|
@@ -159,7 +158,7 @@ const Radio = forwardRef(function Radio({ id, name: nameProp, label, labelPositi
|
|
|
159
158
|
])
|
|
160
159
|
}),
|
|
161
160
|
htmlRadio: cx("cursor-[inherit]", "absolute", "opacity-0", "top-1/2", "left-1/2", "w-[calc(100%+2px)]", "h-[calc(100%+2px)]", "transform", "translate-x-[-50%]", "translate-y-[-50%]"),
|
|
162
|
-
label: cx(labelPosition === "start" ? "text-start" : "text-end"
|
|
161
|
+
label: cx(labelPosition === "start" ? "text-start" : "text-end")
|
|
163
162
|
};
|
|
164
163
|
const RootElement = label ? m.label : m.div;
|
|
165
164
|
return /* @__PURE__ */ jsx(SpringMotionConfig, {
|
|
@@ -175,6 +174,7 @@ const Radio = forwardRef(function Radio({ id, name: nameProp, label, labelPositi
|
|
|
175
174
|
onTap: handleTapEnd,
|
|
176
175
|
onTapCancel: handleTapEnd,
|
|
177
176
|
tabIndex: -1,
|
|
177
|
+
...rootSlotProps,
|
|
178
178
|
children: [/* @__PURE__ */ jsxs(MotionBox, {
|
|
179
179
|
position: "relative",
|
|
180
180
|
borderRadius: "full",
|
|
@@ -184,6 +184,7 @@ const Radio = forwardRef(function Radio({ id, name: nameProp, label, labelPositi
|
|
|
184
184
|
className: classNames.radio,
|
|
185
185
|
animate: motionAnimate,
|
|
186
186
|
insetShadow: showShadow ? "lg-invert" : "none",
|
|
187
|
+
...radioSlotProps,
|
|
187
188
|
children: [/* @__PURE__ */ jsx("input", {
|
|
188
189
|
type: "radio",
|
|
189
190
|
tabIndex: 0,
|
|
@@ -205,14 +206,16 @@ const Radio = forwardRef(function Radio({ id, name: nameProp, label, labelPositi
|
|
|
205
206
|
className: classNames.htmlRadio
|
|
206
207
|
}), /* @__PURE__ */ jsx(Box, {
|
|
207
208
|
borderRadius: "full",
|
|
208
|
-
className: classNames.radioCircle
|
|
209
|
+
className: classNames.radioCircle,
|
|
210
|
+
...radioIconSlotProps
|
|
209
211
|
})]
|
|
210
212
|
}), label && /* @__PURE__ */ jsx(FormLabel, {
|
|
211
213
|
as: "div",
|
|
212
214
|
variant: "inherit",
|
|
213
215
|
color: "inherit",
|
|
214
216
|
label,
|
|
215
|
-
className: classNames.label
|
|
217
|
+
className: classNames.label,
|
|
218
|
+
...labelSlotProps
|
|
216
219
|
})]
|
|
217
220
|
})
|
|
218
221
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { MotionVariant, MotionVariantSpeed } from "../../types/
|
|
2
|
+
import { MotionVariant, MotionVariantSpeed } from "../../types/dist/index.cjs";
|
|
3
3
|
import "../../tokens/index.cjs";
|
|
4
4
|
import { ReactNode } from "react";
|
|
5
5
|
import { LazyFeatureBundle, MotionConfigProps } from "motion/react";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
-
import { MotionVariant, MotionVariantSpeed } from "../../types/
|
|
3
|
+
import { MotionVariant, MotionVariantSpeed } from "../../types/dist/index.js";
|
|
4
4
|
import "../../tokens/index.js";
|
|
5
5
|
import { ReactNode } from "react";
|
|
6
6
|
import { LazyFeatureBundle, MotionConfigProps } from "motion/react";
|
|
@@ -46,9 +46,13 @@ const toggleTransition = {
|
|
|
46
46
|
*
|
|
47
47
|
* @related [Checkbox](https://uds.build/docs/components/checkbox).
|
|
48
48
|
**/
|
|
49
|
-
const Switch = (0, react.forwardRef)(function Switch({ id, isOn: isOnProp, defaultIsOn, onChange, label, labelPosition = "start", size = "md", onIcon, offIcon, reduceMotion: forceReduceMotion, disabled, required, onFocus, onBlur, className, style,
|
|
49
|
+
const Switch = (0, react.forwardRef)(function Switch({ id, isOn: isOnProp, defaultIsOn, onChange, label, labelPosition = "start", size = "md", onIcon, offIcon, reduceMotion: forceReduceMotion, disabled, required, onFocus, onBlur, className, style, slotProps, ...switchProps }, parentRef) {
|
|
50
50
|
const generatedId = (0, react.useId)();
|
|
51
51
|
const uid = id ?? `uds-input-${generatedId}`;
|
|
52
|
+
const rootSlotProps = slotProps?.root ?? {};
|
|
53
|
+
const switchSlotProps = slotProps?.switch ?? {};
|
|
54
|
+
const handleSlotProps = slotProps?.handle ?? {};
|
|
55
|
+
const labelSlotProps = slotProps?.label ?? {};
|
|
52
56
|
const innerRef = (0, react.useRef)(null);
|
|
53
57
|
/**
|
|
54
58
|
* State
|
|
@@ -117,7 +121,7 @@ const Switch = (0, react.forwardRef)(function Switch({ id, isOn: isOnProp, defau
|
|
|
117
121
|
"cursor-pointer": !disabled,
|
|
118
122
|
"cursor-default": disabled,
|
|
119
123
|
"opacity-50": disabled
|
|
120
|
-
},
|
|
124
|
+
}, className)
|
|
121
125
|
}),
|
|
122
126
|
switch: require_styles_styler.getStyles({
|
|
123
127
|
switchVariantSwitch: "default",
|
|
@@ -126,11 +130,11 @@ const Switch = (0, react.forwardRef)(function Switch({ id, isOn: isOnProp, defau
|
|
|
126
130
|
borderRadius: "full",
|
|
127
131
|
position: "relative",
|
|
128
132
|
alignItems: "center",
|
|
129
|
-
className: require_styles_styler.cx("uds-ring", "uds-ring-within", cssAnimationDuration, "transition-[background-color,box-shadow]"
|
|
133
|
+
className: require_styles_styler.cx("uds-ring", "uds-ring-within", cssAnimationDuration, "transition-[background-color,box-shadow]")
|
|
130
134
|
}),
|
|
131
135
|
handle: require_styles_styler.getStyles({
|
|
132
136
|
switchSizeHandle: size,
|
|
133
|
-
className: require_styles_styler.cx("relative", "pointer-events-none", "uds-border-radius-full", "overflow-hidden"
|
|
137
|
+
className: require_styles_styler.cx("relative", "pointer-events-none", "uds-border-radius-full", "overflow-hidden")
|
|
134
138
|
}),
|
|
135
139
|
handleCircle: require_styles_styler.getStyles({
|
|
136
140
|
switchVariantActiveHandle: isOn ? "on" : "off",
|
|
@@ -144,7 +148,7 @@ const Switch = (0, react.forwardRef)(function Switch({ id, isOn: isOnProp, defau
|
|
|
144
148
|
className: require_styles_styler.cx("absolute", "opacity-0", "top-1/2", "left-1/2", "transform", "translate-x-[-50%]", "translate-y-[-50%]", cssAnimationDuration, "transition-opacity")
|
|
145
149
|
}),
|
|
146
150
|
htmlCheckbox: require_styles_styler.cx("cursor-[inherit]", "absolute", "opacity-0", "top-1/2", "left-1/2", "w-[calc(100%+2px)]", "h-[calc(100%+2px)]", "transform", "translate-x-[-50%]", "translate-y-[-50%]"),
|
|
147
|
-
label: require_styles_styler.cx(labelPosition === "start" ? "text-start" : "text-end"
|
|
151
|
+
label: require_styles_styler.cx(labelPosition === "start" ? "text-start" : "text-end")
|
|
148
152
|
};
|
|
149
153
|
const RootElement = label ? motion_react.m.label : motion_react.m.div;
|
|
150
154
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
|
|
@@ -157,8 +161,10 @@ const Switch = (0, react.forwardRef)(function Switch({ id, isOn: isOnProp, defau
|
|
|
157
161
|
onHoverStart: handleHoverStart,
|
|
158
162
|
onHoverEnd: handleHoverEnd,
|
|
159
163
|
tabIndex: -1,
|
|
164
|
+
...rootSlotProps,
|
|
160
165
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(MotionBox, {
|
|
161
166
|
className: classNames.switch,
|
|
167
|
+
...switchSlotProps,
|
|
162
168
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
163
169
|
type: "checkbox",
|
|
164
170
|
tabIndex: 0,
|
|
@@ -180,6 +186,7 @@ const Switch = (0, react.forwardRef)(function Switch({ id, isOn: isOnProp, defau
|
|
|
180
186
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(MotionBox, {
|
|
181
187
|
className: classNames.handle,
|
|
182
188
|
...motionInitialAndAnimate,
|
|
189
|
+
...handleSlotProps,
|
|
183
190
|
children: [
|
|
184
191
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, { className: classNames.handleCircle }),
|
|
185
192
|
onIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
@@ -208,7 +215,8 @@ const Switch = (0, react.forwardRef)(function Switch({ id, isOn: isOnProp, defau
|
|
|
208
215
|
color: "inherit",
|
|
209
216
|
required,
|
|
210
217
|
label,
|
|
211
|
-
className: classNames.label
|
|
218
|
+
className: classNames.label,
|
|
219
|
+
...labelSlotProps
|
|
212
220
|
})]
|
|
213
221
|
})
|
|
214
222
|
});
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalSwitchProps } from "../../types/
|
|
2
|
+
import { UniversalSwitchProps } from "../../types/dist/index.cjs";
|
|
3
3
|
import "../../tokens/index.cjs";
|
|
4
4
|
import React from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/components/client/Switch.d.ts
|
|
7
7
|
type NativeInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'checked' | 'size' | 'height' | 'width' | 'color' | 'defaultChecked' | 'children'>;
|
|
8
|
+
type DataAttributes = {
|
|
9
|
+
[name: `data-${string}`]: string;
|
|
10
|
+
};
|
|
8
11
|
interface SwitchProps extends NativeInputProps, UniversalSwitchProps {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
/** Props to be passed into various slots within the component. */
|
|
13
|
+
slotProps?: {
|
|
14
|
+
root?: DataAttributes;
|
|
15
|
+
switch?: DataAttributes;
|
|
16
|
+
handle?: DataAttributes;
|
|
17
|
+
label?: DataAttributes;
|
|
14
18
|
};
|
|
15
19
|
}
|
|
16
20
|
/**
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
-
import { UniversalSwitchProps } from "../../types/
|
|
3
|
+
import { UniversalSwitchProps } from "../../types/dist/index.js";
|
|
4
4
|
import "../../tokens/index.js";
|
|
5
5
|
import React from "react";
|
|
6
6
|
|
|
7
7
|
//#region src/components/client/Switch.d.ts
|
|
8
8
|
type NativeInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'checked' | 'size' | 'height' | 'width' | 'color' | 'defaultChecked' | 'children'>;
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string;
|
|
11
|
+
};
|
|
9
12
|
interface SwitchProps extends NativeInputProps, UniversalSwitchProps {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
/** Props to be passed into various slots within the component. */
|
|
14
|
+
slotProps?: {
|
|
15
|
+
root?: DataAttributes;
|
|
16
|
+
switch?: DataAttributes;
|
|
17
|
+
handle?: DataAttributes;
|
|
18
|
+
label?: DataAttributes;
|
|
15
19
|
};
|
|
16
20
|
}
|
|
17
21
|
/**
|
|
@@ -43,9 +43,13 @@ const toggleTransition = {
|
|
|
43
43
|
*
|
|
44
44
|
* @related [Checkbox](https://uds.build/docs/components/checkbox).
|
|
45
45
|
**/
|
|
46
|
-
const Switch = forwardRef(function Switch({ id, isOn: isOnProp, defaultIsOn, onChange, label, labelPosition = "start", size = "md", onIcon, offIcon, reduceMotion: forceReduceMotion, disabled, required, onFocus, onBlur, className, style,
|
|
46
|
+
const Switch = forwardRef(function Switch({ id, isOn: isOnProp, defaultIsOn, onChange, label, labelPosition = "start", size = "md", onIcon, offIcon, reduceMotion: forceReduceMotion, disabled, required, onFocus, onBlur, className, style, slotProps, ...switchProps }, parentRef) {
|
|
47
47
|
const generatedId = useId();
|
|
48
48
|
const uid = id ?? `uds-input-${generatedId}`;
|
|
49
|
+
const rootSlotProps = slotProps?.root ?? {};
|
|
50
|
+
const switchSlotProps = slotProps?.switch ?? {};
|
|
51
|
+
const handleSlotProps = slotProps?.handle ?? {};
|
|
52
|
+
const labelSlotProps = slotProps?.label ?? {};
|
|
49
53
|
const innerRef = useRef(null);
|
|
50
54
|
/**
|
|
51
55
|
* State
|
|
@@ -114,7 +118,7 @@ const Switch = forwardRef(function Switch({ id, isOn: isOnProp, defaultIsOn, onC
|
|
|
114
118
|
"cursor-pointer": !disabled,
|
|
115
119
|
"cursor-default": disabled,
|
|
116
120
|
"opacity-50": disabled
|
|
117
|
-
},
|
|
121
|
+
}, className)
|
|
118
122
|
}),
|
|
119
123
|
switch: getStyles({
|
|
120
124
|
switchVariantSwitch: "default",
|
|
@@ -123,11 +127,11 @@ const Switch = forwardRef(function Switch({ id, isOn: isOnProp, defaultIsOn, onC
|
|
|
123
127
|
borderRadius: "full",
|
|
124
128
|
position: "relative",
|
|
125
129
|
alignItems: "center",
|
|
126
|
-
className: cx("uds-ring", "uds-ring-within", cssAnimationDuration, "transition-[background-color,box-shadow]"
|
|
130
|
+
className: cx("uds-ring", "uds-ring-within", cssAnimationDuration, "transition-[background-color,box-shadow]")
|
|
127
131
|
}),
|
|
128
132
|
handle: getStyles({
|
|
129
133
|
switchSizeHandle: size,
|
|
130
|
-
className: cx("relative", "pointer-events-none", "uds-border-radius-full", "overflow-hidden"
|
|
134
|
+
className: cx("relative", "pointer-events-none", "uds-border-radius-full", "overflow-hidden")
|
|
131
135
|
}),
|
|
132
136
|
handleCircle: getStyles({
|
|
133
137
|
switchVariantActiveHandle: isOn ? "on" : "off",
|
|
@@ -141,7 +145,7 @@ const Switch = forwardRef(function Switch({ id, isOn: isOnProp, defaultIsOn, onC
|
|
|
141
145
|
className: cx("absolute", "opacity-0", "top-1/2", "left-1/2", "transform", "translate-x-[-50%]", "translate-y-[-50%]", cssAnimationDuration, "transition-opacity")
|
|
142
146
|
}),
|
|
143
147
|
htmlCheckbox: cx("cursor-[inherit]", "absolute", "opacity-0", "top-1/2", "left-1/2", "w-[calc(100%+2px)]", "h-[calc(100%+2px)]", "transform", "translate-x-[-50%]", "translate-y-[-50%]"),
|
|
144
|
-
label: cx(labelPosition === "start" ? "text-start" : "text-end"
|
|
148
|
+
label: cx(labelPosition === "start" ? "text-start" : "text-end")
|
|
145
149
|
};
|
|
146
150
|
const RootElement = label ? m.label : m.div;
|
|
147
151
|
return /* @__PURE__ */ jsx(SpringMotionConfig, {
|
|
@@ -154,8 +158,10 @@ const Switch = forwardRef(function Switch({ id, isOn: isOnProp, defaultIsOn, onC
|
|
|
154
158
|
onHoverStart: handleHoverStart,
|
|
155
159
|
onHoverEnd: handleHoverEnd,
|
|
156
160
|
tabIndex: -1,
|
|
161
|
+
...rootSlotProps,
|
|
157
162
|
children: [/* @__PURE__ */ jsxs(MotionBox, {
|
|
158
163
|
className: classNames.switch,
|
|
164
|
+
...switchSlotProps,
|
|
159
165
|
children: [/* @__PURE__ */ jsx("input", {
|
|
160
166
|
type: "checkbox",
|
|
161
167
|
tabIndex: 0,
|
|
@@ -177,6 +183,7 @@ const Switch = forwardRef(function Switch({ id, isOn: isOnProp, defaultIsOn, onC
|
|
|
177
183
|
}), /* @__PURE__ */ jsxs(MotionBox, {
|
|
178
184
|
className: classNames.handle,
|
|
179
185
|
...motionInitialAndAnimate,
|
|
186
|
+
...handleSlotProps,
|
|
180
187
|
children: [
|
|
181
188
|
/* @__PURE__ */ jsx(Box, { className: classNames.handleCircle }),
|
|
182
189
|
onIcon && /* @__PURE__ */ jsx(IconSlot, {
|
|
@@ -205,7 +212,8 @@ const Switch = forwardRef(function Switch({ id, isOn: isOnProp, defaultIsOn, onC
|
|
|
205
212
|
color: "inherit",
|
|
206
213
|
required,
|
|
207
214
|
label,
|
|
208
|
-
className: classNames.label
|
|
215
|
+
className: classNames.label,
|
|
216
|
+
...labelSlotProps
|
|
209
217
|
})]
|
|
210
218
|
})
|
|
211
219
|
});
|
|
@@ -13,7 +13,7 @@ let _ariakit_react = require("@ariakit/react");
|
|
|
13
13
|
//#region src/components/client/Tabs/Tab.tsx
|
|
14
14
|
/** Matches {@link TabList} sliding-indicator underline (token CSS variables on the tab root). */
|
|
15
15
|
const tabRootUnderlineClassName = require_styles_styler.cx("pointer-events-none absolute bottom-0 left-0 right-0", "h-[var(--uds-tab-underline-width,0px)] bg-[var(--uds-tab-underline-color,transparent)]", "transition-[height,background-color] duration-[240ms] ease-[cubic-bezier(0.2,0,0,1)]");
|
|
16
|
-
function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, className }) {
|
|
16
|
+
function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, className, slotProps }) {
|
|
17
17
|
const generatedId = (0, react.useId)();
|
|
18
18
|
const uid = value ?? `uds-tab-${generatedId}`;
|
|
19
19
|
const { variant, disableMotion } = require_components_client_Tabs_tabsContext.useTabsContext();
|
|
@@ -39,13 +39,16 @@ function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, c
|
|
|
39
39
|
});
|
|
40
40
|
const tabClass = require_styles_styler.cx(configClass, "inline-flex items-center shrink-0 box-border relative", !disableMotion && "z-[1]", "cursor-pointer select-none whitespace-nowrap", !disabled && "uds-ring", disabled && "opacity-50 cursor-default pointer-events-none", "border-solid border-b-solid", "transition-colors duration-[240ms] ease-[cubic-bezier(0.2,0,0,1)]", className);
|
|
41
41
|
const resolvedContent = asChild && (0, react.isValidElement)(children) ? children.props.children ?? null : children;
|
|
42
|
+
const resolvedRender = asChild && (0, react.isValidElement)(children) ? children : void 0;
|
|
43
|
+
const showPerTabUnderline = !(activeState === "on" && !disableMotion);
|
|
42
44
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_ariakit_react.Tab, {
|
|
43
45
|
id: uid,
|
|
44
46
|
disabled,
|
|
45
47
|
className: tabClass,
|
|
46
|
-
render:
|
|
48
|
+
render: resolvedRender,
|
|
49
|
+
...slotProps?.root,
|
|
47
50
|
children: [
|
|
48
|
-
|
|
51
|
+
showPerTabUnderline ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
49
52
|
"aria-hidden": true,
|
|
50
53
|
className: tabRootUnderlineClassName
|
|
51
54
|
}) : null,
|
|
@@ -55,12 +58,14 @@ function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, c
|
|
|
55
58
|
size: "sm",
|
|
56
59
|
color: "current"
|
|
57
60
|
},
|
|
58
|
-
className: iconConfigClass
|
|
61
|
+
className: iconConfigClass,
|
|
62
|
+
...slotProps?.startIcon
|
|
59
63
|
}),
|
|
60
64
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
|
|
61
65
|
variant: "inherit",
|
|
62
66
|
as: "span",
|
|
63
67
|
color: "current",
|
|
68
|
+
...slotProps?.content,
|
|
64
69
|
children: resolvedContent
|
|
65
70
|
}),
|
|
66
71
|
endIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
@@ -69,7 +74,8 @@ function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, c
|
|
|
69
74
|
size: "sm",
|
|
70
75
|
color: "current"
|
|
71
76
|
},
|
|
72
|
-
className: iconConfigClass
|
|
77
|
+
className: iconConfigClass,
|
|
78
|
+
...slotProps?.endIcon
|
|
73
79
|
})
|
|
74
80
|
]
|
|
75
81
|
});
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalTabProps } from "../../../types/
|
|
2
|
+
import { IconPropsWithSVGProps, UniversalTabProps } from "../../../types/dist/index.cjs";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/components/client/Tabs/Tab.d.ts
|
|
6
|
-
type
|
|
6
|
+
type DataAttributes = {
|
|
7
|
+
[name: `data-${string}`]: string;
|
|
8
|
+
};
|
|
9
|
+
type TabProps = UniversalTabProps & {
|
|
10
|
+
slotProps?: {
|
|
11
|
+
root?: DataAttributes;
|
|
12
|
+
startIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
13
|
+
content?: Partial<Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'> & DataAttributes>;
|
|
14
|
+
endIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
7
17
|
declare function Tab({
|
|
8
18
|
value,
|
|
9
19
|
children,
|
|
@@ -11,7 +21,8 @@ declare function Tab({
|
|
|
11
21
|
endIcon,
|
|
12
22
|
disabled,
|
|
13
23
|
asChild,
|
|
14
|
-
className
|
|
24
|
+
className,
|
|
25
|
+
slotProps
|
|
15
26
|
}: TabProps): react_jsx_runtime0.JSX.Element;
|
|
16
27
|
declare namespace Tab {
|
|
17
28
|
var displayName: string;
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
-
import { UniversalTabProps } from "../../../types/
|
|
3
|
+
import { IconPropsWithSVGProps, UniversalTabProps } from "../../../types/dist/index.js";
|
|
4
4
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/components/client/Tabs/Tab.d.ts
|
|
7
|
-
type
|
|
7
|
+
type DataAttributes = {
|
|
8
|
+
[name: `data-${string}`]: string;
|
|
9
|
+
};
|
|
10
|
+
type TabProps = UniversalTabProps & {
|
|
11
|
+
slotProps?: {
|
|
12
|
+
root?: DataAttributes;
|
|
13
|
+
startIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
14
|
+
content?: Partial<Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'> & DataAttributes>;
|
|
15
|
+
endIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
8
18
|
declare function Tab({
|
|
9
19
|
value,
|
|
10
20
|
children,
|
|
@@ -12,7 +22,8 @@ declare function Tab({
|
|
|
12
22
|
endIcon,
|
|
13
23
|
disabled,
|
|
14
24
|
asChild,
|
|
15
|
-
className
|
|
25
|
+
className,
|
|
26
|
+
slotProps
|
|
16
27
|
}: TabProps): react_jsx_runtime0.JSX.Element;
|
|
17
28
|
declare namespace Tab {
|
|
18
29
|
var displayName: string;
|
|
@@ -11,7 +11,7 @@ import { Tab as Tab$1, useStoreState, useTabContext } from "@ariakit/react";
|
|
|
11
11
|
//#region src/components/client/Tabs/Tab.tsx
|
|
12
12
|
/** Matches {@link TabList} sliding-indicator underline (token CSS variables on the tab root). */
|
|
13
13
|
const tabRootUnderlineClassName = cx("pointer-events-none absolute bottom-0 left-0 right-0", "h-[var(--uds-tab-underline-width,0px)] bg-[var(--uds-tab-underline-color,transparent)]", "transition-[height,background-color] duration-[240ms] ease-[cubic-bezier(0.2,0,0,1)]");
|
|
14
|
-
function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, className }) {
|
|
14
|
+
function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, className, slotProps }) {
|
|
15
15
|
const generatedId = useId();
|
|
16
16
|
const uid = value ?? `uds-tab-${generatedId}`;
|
|
17
17
|
const { variant, disableMotion } = useTabsContext();
|
|
@@ -37,13 +37,16 @@ function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, c
|
|
|
37
37
|
});
|
|
38
38
|
const tabClass = cx(configClass, "inline-flex items-center shrink-0 box-border relative", !disableMotion && "z-[1]", "cursor-pointer select-none whitespace-nowrap", !disabled && "uds-ring", disabled && "opacity-50 cursor-default pointer-events-none", "border-solid border-b-solid", "transition-colors duration-[240ms] ease-[cubic-bezier(0.2,0,0,1)]", className);
|
|
39
39
|
const resolvedContent = asChild && isValidElement(children) ? children.props.children ?? null : children;
|
|
40
|
+
const resolvedRender = asChild && isValidElement(children) ? children : void 0;
|
|
41
|
+
const showPerTabUnderline = !(activeState === "on" && !disableMotion);
|
|
40
42
|
return /* @__PURE__ */ jsxs(Tab$1, {
|
|
41
43
|
id: uid,
|
|
42
44
|
disabled,
|
|
43
45
|
className: tabClass,
|
|
44
|
-
render:
|
|
46
|
+
render: resolvedRender,
|
|
47
|
+
...slotProps?.root,
|
|
45
48
|
children: [
|
|
46
|
-
|
|
49
|
+
showPerTabUnderline ? /* @__PURE__ */ jsx("div", {
|
|
47
50
|
"aria-hidden": true,
|
|
48
51
|
className: tabRootUnderlineClassName
|
|
49
52
|
}) : null,
|
|
@@ -53,12 +56,14 @@ function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, c
|
|
|
53
56
|
size: "sm",
|
|
54
57
|
color: "current"
|
|
55
58
|
},
|
|
56
|
-
className: iconConfigClass
|
|
59
|
+
className: iconConfigClass,
|
|
60
|
+
...slotProps?.startIcon
|
|
57
61
|
}),
|
|
58
62
|
/* @__PURE__ */ jsx(Text, {
|
|
59
63
|
variant: "inherit",
|
|
60
64
|
as: "span",
|
|
61
65
|
color: "current",
|
|
66
|
+
...slotProps?.content,
|
|
62
67
|
children: resolvedContent
|
|
63
68
|
}),
|
|
64
69
|
endIcon && /* @__PURE__ */ jsx(IconSlot, {
|
|
@@ -67,7 +72,8 @@ function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, c
|
|
|
67
72
|
size: "sm",
|
|
68
73
|
color: "current"
|
|
69
74
|
},
|
|
70
|
-
className: iconConfigClass
|
|
75
|
+
className: iconConfigClass,
|
|
76
|
+
...slotProps?.endIcon
|
|
71
77
|
})
|
|
72
78
|
]
|
|
73
79
|
});
|