@yahoo/uds 3.157.1 → 3.158.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/generated/autoVariants.cjs +26 -0
- package/dist/automated-config/dist/generated/autoVariants.d.cts +17 -0
- package/dist/automated-config/dist/generated/autoVariants.d.ts +17 -0
- package/dist/automated-config/dist/generated/autoVariants.js +26 -0
- package/dist/automated-config/dist/generated/generatedConfigs.cjs +3220 -545
- package/dist/automated-config/dist/generated/generatedConfigs.d.cts +335 -11
- package/dist/automated-config/dist/generated/generatedConfigs.d.ts +335 -11
- package/dist/automated-config/dist/generated/generatedConfigs.js +3218 -546
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +275 -44
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +4 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +4 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +275 -44
- package/dist/automated-config/dist/types/ComponentConfig.d.cts +3 -1
- package/dist/automated-config/dist/types/ComponentConfig.d.ts +3 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.cjs +43 -35
- package/dist/automated-config/dist/utils/buildConfigSchema.d.cts +4 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.d.ts +4 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.js +44 -36
- package/dist/automated-config/dist/utils/componentStatePseudoStates.cjs +4 -0
- package/dist/automated-config/dist/utils/componentStatePseudoStates.js +4 -1
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.cjs +5 -2
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.js +6 -3
- package/dist/automated-config/dist/utils/index.cjs +21 -5
- package/dist/automated-config/dist/utils/index.d.cts +1 -0
- package/dist/automated-config/dist/utils/index.d.ts +1 -0
- package/dist/automated-config/dist/utils/index.js +22 -6
- package/dist/automated-config/dist/utils/pseudoStateSelectors.cjs +6 -3
- package/dist/automated-config/dist/utils/pseudoStateSelectors.d.cts +1 -1
- package/dist/automated-config/dist/utils/pseudoStateSelectors.d.ts +1 -1
- package/dist/automated-config/dist/utils/pseudoStateSelectors.js +6 -3
- package/dist/components/client/Input/Input.cjs +1 -1
- package/dist/components/client/Input/Input.js +1 -1
- package/dist/components/client/Menu/Menu.Item.cjs +1 -0
- package/dist/components/client/Menu/Menu.Item.js +1 -0
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
- package/dist/components/client/Select/Select.cjs +179 -0
- package/dist/components/client/Select/Select.d.cts +55 -0
- package/dist/components/client/Select/Select.d.ts +56 -0
- package/dist/components/client/Select/Select.js +176 -0
- package/dist/components/client/Select/SelectContent.cjs +75 -0
- package/dist/components/client/Select/SelectContent.d.cts +44 -0
- package/dist/components/client/Select/SelectContent.d.ts +45 -0
- package/dist/components/client/Select/SelectContent.js +73 -0
- package/dist/components/client/Select/SelectDivider.cjs +63 -0
- package/dist/components/client/Select/SelectDivider.d.cts +44 -0
- package/dist/components/client/Select/SelectDivider.d.ts +45 -0
- package/dist/components/client/Select/SelectDivider.js +61 -0
- package/dist/components/client/Select/SelectHelpText.cjs +51 -0
- package/dist/components/client/Select/SelectHelpText.d.cts +27 -0
- package/dist/components/client/Select/SelectHelpText.d.ts +28 -0
- package/dist/components/client/Select/SelectHelpText.js +48 -0
- package/dist/components/client/Select/SelectItem.cjs +172 -0
- package/dist/components/client/Select/SelectItem.d.cts +29 -0
- package/dist/components/client/Select/SelectItem.d.ts +30 -0
- package/dist/components/client/Select/SelectItem.js +170 -0
- package/dist/components/client/Select/SelectTrigger.cjs +138 -0
- package/dist/components/client/Select/SelectTrigger.d.cts +27 -0
- package/dist/components/client/Select/SelectTrigger.d.ts +28 -0
- package/dist/components/client/Select/SelectTrigger.js +136 -0
- package/dist/components/client/Select/SelectValue.cjs +28 -0
- package/dist/components/client/Select/SelectValue.d.cts +19 -0
- package/dist/components/client/Select/SelectValue.d.ts +20 -0
- package/dist/components/client/Select/SelectValue.js +26 -0
- package/dist/components/client/Select/index.cjs +11 -0
- package/dist/components/client/Select/index.d.cts +6 -0
- package/dist/components/client/Select/index.d.ts +7 -0
- package/dist/components/client/Select/index.js +7 -0
- package/dist/components/client/Select/selectContext.cjs +20 -0
- package/dist/components/client/Select/selectContext.d.cts +23 -0
- package/dist/components/client/Select/selectContext.d.ts +24 -0
- package/dist/components/client/Select/selectContext.js +16 -0
- package/dist/components/client/Select/selectFieldStyles.cjs +85 -0
- package/dist/components/client/Select/selectFieldStyles.d.cts +37 -0
- package/dist/components/client/Select/selectFieldStyles.d.ts +38 -0
- package/dist/components/client/Select/selectFieldStyles.js +75 -0
- package/dist/components/client/index.cjs +8 -0
- package/dist/components/client/index.d.cts +5 -1
- package/dist/components/client/index.d.ts +5 -1
- package/dist/components/client/index.js +5 -1
- package/dist/components/index.cjs +8 -0
- package/dist/components/index.d.cts +5 -1
- package/dist/components/index.d.ts +5 -1
- package/dist/components/index.js +5 -1
- package/dist/config/dist/index.cjs +380 -70
- package/dist/config/dist/index.js +380 -70
- package/dist/css/dist/css/utils.cjs +3 -0
- package/dist/css/dist/css/utils.js +3 -0
- package/dist/css/dist/packages/config/dist/index.cjs +380 -70
- package/dist/css/dist/packages/config/dist/index.js +380 -70
- package/dist/index.cjs +11 -0
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +6 -2
- package/dist/styles/styler.d.cts +17 -0
- package/dist/styles/styler.d.ts +17 -0
- package/dist/styles/variants.d.cts +54 -0
- package/dist/styles/variants.d.ts +54 -0
- package/dist/tailwind/utils/index.cjs +3 -0
- package/dist/tailwind/utils/index.d.cts +2 -1
- package/dist/tailwind/utils/index.d.ts +2 -1
- package/dist/tailwind/utils/index.js +2 -1
- package/dist/tailwind-internal/dist/base/addColorModeVars.cjs +1 -1
- package/dist/tailwind-internal/dist/base/addColorModeVars.js +1 -1
- package/dist/tailwind-internal/dist/base/addColorModeVarsV2.cjs +1 -1
- package/dist/tailwind-internal/dist/base/addColorModeVarsV2.js +1 -1
- package/dist/tailwind-internal/dist/components/getFocusRingStyles.cjs +74 -6
- package/dist/tailwind-internal/dist/components/getFocusRingStyles.d.cts +14 -0
- package/dist/tailwind-internal/dist/components/getFocusRingStyles.d.ts +14 -0
- package/dist/tailwind-internal/dist/components/getFocusRingStyles.js +74 -7
- package/dist/tailwind-internal/dist/components/getResponsiveTextStyles.cjs +1 -1
- package/dist/tailwind-internal/dist/components/getResponsiveTextStyles.js +1 -1
- package/dist/tailwind-internal/dist/index.d.cts +1 -0
- package/dist/tailwind-internal/dist/index.d.ts +1 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.cjs +3220 -545
- package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.js +3218 -546
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/componentStatePseudoStates.cjs +4 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/componentStatePseudoStates.js +4 -1
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.cjs +21 -5
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.js +22 -6
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/pseudoStateSelectors.cjs +6 -3
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/pseudoStateSelectors.js +6 -3
- package/dist/tailwind-internal/dist/packages/config/dist/index.cjs +380 -70
- package/dist/tailwind-internal/dist/packages/config/dist/index.js +380 -70
- package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.cjs +10 -10
- package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.js +1 -1
- package/dist/tailwind-internal/dist/plugins/a11y.cjs +6 -2
- package/dist/tailwind-internal/dist/plugins/a11y.js +6 -2
- package/dist/tailwind-internal/dist/plugins/blurBgFallback.cjs +1 -1
- package/dist/tailwind-internal/dist/plugins/blurBgFallback.js +1 -1
- package/dist/tailwind-internal/dist/plugins/borderRadius.cjs +1 -1
- package/dist/tailwind-internal/dist/plugins/borderRadius.js +1 -1
- package/dist/tailwind-internal/dist/plugins/borderWidth.cjs +1 -1
- package/dist/tailwind-internal/dist/plugins/borderWidth.js +1 -1
- package/dist/tailwind-internal/dist/plugins/colors.cjs +2 -2
- package/dist/tailwind-internal/dist/plugins/colors.js +2 -2
- package/dist/tailwind-internal/dist/plugins/components.cjs +4 -1
- package/dist/tailwind-internal/dist/plugins/components.js +5 -2
- package/dist/tailwind-internal/dist/plugins/elevation.cjs +1 -1
- package/dist/tailwind-internal/dist/plugins/elevation.js +1 -1
- package/dist/tailwind-internal/dist/plugins/shadows.cjs +1 -1
- package/dist/tailwind-internal/dist/plugins/shadows.js +1 -1
- package/dist/tailwind-internal/dist/plugins/typography.cjs +2 -2
- package/dist/tailwind-internal/dist/plugins/typography.js +2 -2
- package/dist/tailwind-internal/dist/utils/getElevationStyles.cjs +1 -1
- package/dist/tailwind-internal/dist/utils/getElevationStyles.js +1 -1
- package/dist/tailwind-internal/dist/utils/getFontStyles.cjs +1 -1
- package/dist/tailwind-internal/dist/utils/getFontStyles.js +1 -1
- package/dist/tailwind-internal/dist/utils/getMotionStyles.cjs +1 -1
- package/dist/tailwind-internal/dist/utils/getMotionStyles.js +1 -1
- package/dist/tailwind-internal/dist/utils/getShadowPresetValues.cjs +1 -1
- package/dist/tailwind-internal/dist/utils/getShadowPresetValues.js +1 -1
- package/dist/tailwind-internal/dist/utils/getShadowStyles.cjs +1 -1
- package/dist/tailwind-internal/dist/utils/getShadowStyles.js +1 -1
- package/dist/tailwind-internal/dist/utils/parseTokens.cjs +2 -2
- package/dist/tailwind-internal/dist/utils/parseTokens.js +2 -2
- package/dist/tokens/automation/configs/index.cjs +3 -0
- package/dist/tokens/automation/configs/index.d.cts +2 -2
- package/dist/tokens/automation/configs/index.d.ts +2 -2
- package/dist/tokens/automation/configs/index.js +2 -2
- package/dist/tokens/automation/index.cjs +3 -0
- package/dist/tokens/automation/index.d.cts +2 -2
- package/dist/tokens/automation/index.d.ts +2 -2
- package/dist/tokens/automation/index.js +2 -2
- package/dist/tokens/index.cjs +3 -0
- package/dist/tokens/index.d.cts +3 -3
- package/dist/tokens/index.d.ts +3 -3
- package/dist/tokens/index.js +2 -2
- package/dist/tokens/types.d.cts +2 -2
- package/dist/tokens/types.d.ts +2 -2
- package/dist/types/dist/index.d.cts +36 -1
- package/dist/types/dist/index.d.ts +36 -1
- package/dist/uds/generated/componentData.cjs +407 -0
- package/dist/uds/generated/componentData.js +407 -0
- package/dist/uds/generated/migrationSchemaVersion.cjs +1 -1
- package/dist/uds/generated/migrationSchemaVersion.js +1 -1
- package/dist/uds/generated/tailwindPurge.cjs +1501 -315
- package/dist/uds/generated/tailwindPurge.js +1501 -315
- package/generated/componentData.json +496 -0
- package/generated/migrationSchemaVersion.ts +1 -1
- package/generated/tailwindPurge.ts +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { UniversalSelectProps } from "../../../types/dist/index.js";
|
|
4
|
+
import { IconPropsWithSVGProps } from "../../../tokens/types.js";
|
|
5
|
+
import { SelectTriggerProps } from "./SelectTrigger.js";
|
|
6
|
+
import * as _$react from "react";
|
|
7
|
+
import { SelectProviderProps } from "@ariakit/react";
|
|
8
|
+
|
|
9
|
+
//#region src/components/client/Select/Select.d.ts
|
|
10
|
+
type DataAttributes = {
|
|
11
|
+
[name: `data-${string}`]: string;
|
|
12
|
+
};
|
|
13
|
+
interface SelectProps extends Pick<UniversalSelectProps, 'label' | 'disabled' | 'required' | 'helpText' | 'helperTextIcon' | 'hasError' | 'size' | 'startIcon' | 'endIcon' | 'reduceMotion' | 'readOnly' | 'width'>, Omit<SelectProviderProps, 'children' | 'setValue'> {
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
/** Placeholder text shown when no value is selected. */
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
/** Native form field name. Renders a hidden `<select>` for form submission. */
|
|
18
|
+
name?: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
/** Called when the selected value changes. Alias for Ariakit `setValue`. */
|
|
22
|
+
onChange?: (value: string) => void;
|
|
23
|
+
setValue?: SelectProviderProps['setValue'];
|
|
24
|
+
slotProps?: {
|
|
25
|
+
root?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
26
|
+
label?: Partial<React.LabelHTMLAttributes<HTMLLabelElement> & DataAttributes>;
|
|
27
|
+
trigger?: SelectTriggerProps['slotProps'];
|
|
28
|
+
helperText?: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
|
|
29
|
+
helperTextIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* **⚙️ A composable Select component**
|
|
34
|
+
*
|
|
35
|
+
* @componentType Client component
|
|
36
|
+
*
|
|
37
|
+
* @description
|
|
38
|
+
* Select lets users pick one value from a list. Compose with `SelectContent` and
|
|
39
|
+
* `SelectItem`, similar to `Tabs` with `TabList` and `Tab`.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* 'use client';
|
|
44
|
+
* import { Select, SelectContent, SelectItem } from '@yahoo/uds';
|
|
45
|
+
*
|
|
46
|
+
* <Select label="Country" placeholder="Select a country" defaultValue="us">
|
|
47
|
+
* <SelectContent>
|
|
48
|
+
* <SelectItem value="us">United States</SelectItem>
|
|
49
|
+
* <SelectItem value="ca">Canada</SelectItem>
|
|
50
|
+
* </SelectContent>
|
|
51
|
+
* </Select>
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
declare const Select: _$react.ForwardRefExoticComponent<SelectProps & _$react.RefAttributes<HTMLButtonElement>>;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { Select, type SelectProps };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
import { cx } from "../../../styles/styler.js";
|
|
5
|
+
import { Box } from "../../Box.js";
|
|
6
|
+
import { VStack } from "../../VStack.js";
|
|
7
|
+
import { SpringMotionConfig } from "../SpringMotionConfig.js";
|
|
8
|
+
import { SelectFieldContext } from "./selectContext.js";
|
|
9
|
+
import { getSelectLabelClassName, getSelectLabelRequiredClassName, getSelectRootClassName } from "./selectFieldStyles.js";
|
|
10
|
+
import { SelectHelpText } from "./SelectHelpText.js";
|
|
11
|
+
import { SelectTrigger } from "./SelectTrigger.js";
|
|
12
|
+
import { forwardRef, useCallback, useId, useMemo, useRef, useState } from "react";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { isFunction } from "lodash-es";
|
|
15
|
+
import { SelectProvider, useSelectContext, useStoreState } from "@ariakit/react";
|
|
16
|
+
//#region src/components/client/Select/Select.tsx
|
|
17
|
+
const SelectRoot = forwardRef(function SelectRoot({ children, label, helpText, helperTextIcon, placeholder, name, size = "md", disabled, required, hasError, readOnly, width = "full", reduceMotion: forceReduceMotion, startIcon, endIcon, className, style, slotProps }, ref) {
|
|
18
|
+
const value = useStoreState(useSelectContext(), "value");
|
|
19
|
+
const hasValue = value != null && value !== "";
|
|
20
|
+
const hasHelpText = Boolean(helpText || helperTextIcon);
|
|
21
|
+
const uid = `uds-select-${useId()}`;
|
|
22
|
+
const helpTextId = hasHelpText ? `${uid}-help-text` : void 0;
|
|
23
|
+
const triggerWrapperRef = useRef(null);
|
|
24
|
+
const contextValue = useMemo(() => ({
|
|
25
|
+
size,
|
|
26
|
+
disabled,
|
|
27
|
+
readOnly,
|
|
28
|
+
required,
|
|
29
|
+
hasError,
|
|
30
|
+
width,
|
|
31
|
+
reduceMotion: forceReduceMotion,
|
|
32
|
+
uid,
|
|
33
|
+
helpTextId,
|
|
34
|
+
triggerWrapperRef
|
|
35
|
+
}), [
|
|
36
|
+
size,
|
|
37
|
+
disabled,
|
|
38
|
+
readOnly,
|
|
39
|
+
required,
|
|
40
|
+
hasError,
|
|
41
|
+
width,
|
|
42
|
+
forceReduceMotion,
|
|
43
|
+
uid,
|
|
44
|
+
helpTextId
|
|
45
|
+
]);
|
|
46
|
+
const { className: rootSlotClassName, ...rootSlotProps } = slotProps?.root ?? {};
|
|
47
|
+
return /* @__PURE__ */ jsx(SelectFieldContext.Provider, {
|
|
48
|
+
value: contextValue,
|
|
49
|
+
children: /* @__PURE__ */ jsxs(VStack, {
|
|
50
|
+
width,
|
|
51
|
+
className: cx(getSelectRootClassName({
|
|
52
|
+
size,
|
|
53
|
+
hasValue,
|
|
54
|
+
disabled,
|
|
55
|
+
className
|
|
56
|
+
}), rootSlotClassName),
|
|
57
|
+
style,
|
|
58
|
+
...rootSlotProps,
|
|
59
|
+
children: [
|
|
60
|
+
label && /* @__PURE__ */ jsxs(Box, {
|
|
61
|
+
spacingBottom: "2",
|
|
62
|
+
columnGap: "0.5",
|
|
63
|
+
alignItems: "flex-end",
|
|
64
|
+
className: getSelectLabelClassName(size, hasValue),
|
|
65
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
66
|
+
htmlFor: uid,
|
|
67
|
+
...slotProps?.label,
|
|
68
|
+
children: isFunction(label) ? label() : label
|
|
69
|
+
}), required && /* @__PURE__ */ jsx("span", {
|
|
70
|
+
className: getSelectLabelRequiredClassName(hasValue),
|
|
71
|
+
children: "*"
|
|
72
|
+
})]
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ jsx(SelectTrigger, {
|
|
75
|
+
ref,
|
|
76
|
+
placeholder,
|
|
77
|
+
name,
|
|
78
|
+
startIcon,
|
|
79
|
+
endIcon,
|
|
80
|
+
disabled,
|
|
81
|
+
slotProps: slotProps?.trigger
|
|
82
|
+
}),
|
|
83
|
+
hasHelpText && /* @__PURE__ */ jsx(SelectHelpText, {
|
|
84
|
+
helpText,
|
|
85
|
+
helperTextIcon,
|
|
86
|
+
slotProps: {
|
|
87
|
+
helperText: slotProps?.helperText,
|
|
88
|
+
helperTextIcon: slotProps?.helperTextIcon
|
|
89
|
+
}
|
|
90
|
+
}),
|
|
91
|
+
children
|
|
92
|
+
]
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
SelectRoot.displayName = "SelectRoot";
|
|
97
|
+
/**
|
|
98
|
+
* **⚙️ A composable Select component**
|
|
99
|
+
*
|
|
100
|
+
* @componentType Client component
|
|
101
|
+
*
|
|
102
|
+
* @description
|
|
103
|
+
* Select lets users pick one value from a list. Compose with `SelectContent` and
|
|
104
|
+
* `SelectItem`, similar to `Tabs` with `TabList` and `Tab`.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```tsx
|
|
108
|
+
* 'use client';
|
|
109
|
+
* import { Select, SelectContent, SelectItem } from '@yahoo/uds';
|
|
110
|
+
*
|
|
111
|
+
* <Select label="Country" placeholder="Select a country" defaultValue="us">
|
|
112
|
+
* <SelectContent>
|
|
113
|
+
* <SelectItem value="us">United States</SelectItem>
|
|
114
|
+
* <SelectItem value="ca">Canada</SelectItem>
|
|
115
|
+
* </SelectContent>
|
|
116
|
+
* </Select>
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
const Select = forwardRef(function Select({ children, label, helpText, helperTextIcon, placeholder, name, size, disabled, required, hasError, readOnly, width, reduceMotion, startIcon, endIcon, className, style, slotProps, defaultValue = "", value, setValue: setValueProp, onChange, open: openProp, defaultOpen, setOpen: setOpenProp, ...providerProps }, ref) {
|
|
120
|
+
const setValue = setValueProp ?? onChange;
|
|
121
|
+
const isOpenControlled = openProp !== void 0;
|
|
122
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen ?? false);
|
|
123
|
+
const open = isOpenControlled ? openProp : uncontrolledOpen;
|
|
124
|
+
const handleSetOpen = useCallback((nextOpen) => {
|
|
125
|
+
if (readOnly && isOpenControlled) return;
|
|
126
|
+
if (nextOpen && (readOnly || disabled)) return;
|
|
127
|
+
if (!isOpenControlled) setUncontrolledOpen(nextOpen);
|
|
128
|
+
setOpenProp?.(nextOpen);
|
|
129
|
+
}, [
|
|
130
|
+
disabled,
|
|
131
|
+
isOpenControlled,
|
|
132
|
+
readOnly,
|
|
133
|
+
setOpenProp
|
|
134
|
+
]);
|
|
135
|
+
return /* @__PURE__ */ jsx(SpringMotionConfig, {
|
|
136
|
+
reducedMotion: "user",
|
|
137
|
+
children: /* @__PURE__ */ jsx(SelectProvider, {
|
|
138
|
+
...value !== void 0 ? {
|
|
139
|
+
...providerProps,
|
|
140
|
+
value,
|
|
141
|
+
setValue,
|
|
142
|
+
open,
|
|
143
|
+
setOpen: handleSetOpen
|
|
144
|
+
} : {
|
|
145
|
+
...providerProps,
|
|
146
|
+
defaultValue,
|
|
147
|
+
open,
|
|
148
|
+
setOpen: handleSetOpen
|
|
149
|
+
},
|
|
150
|
+
children: /* @__PURE__ */ jsx(SelectRoot, {
|
|
151
|
+
ref,
|
|
152
|
+
label,
|
|
153
|
+
helpText,
|
|
154
|
+
helperTextIcon,
|
|
155
|
+
placeholder,
|
|
156
|
+
name,
|
|
157
|
+
size,
|
|
158
|
+
disabled,
|
|
159
|
+
required,
|
|
160
|
+
hasError,
|
|
161
|
+
readOnly,
|
|
162
|
+
width,
|
|
163
|
+
reduceMotion,
|
|
164
|
+
startIcon,
|
|
165
|
+
endIcon,
|
|
166
|
+
className,
|
|
167
|
+
style,
|
|
168
|
+
slotProps,
|
|
169
|
+
children
|
|
170
|
+
})
|
|
171
|
+
})
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
Select.displayName = "Select";
|
|
175
|
+
//#endregion
|
|
176
|
+
export { Select };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
5
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
6
|
+
const require_styles_styler = require("../../../styles/styler.cjs");
|
|
7
|
+
const require_components_VStack = require("../../VStack.cjs");
|
|
8
|
+
const require_utils_getUnscaledAnchorRect = require("../../../utils/getUnscaledAnchorRect.cjs");
|
|
9
|
+
const require_components_client_Select_selectContext = require("./selectContext.cjs");
|
|
10
|
+
let react = require("react");
|
|
11
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
|
+
let _ariakit_react = require("@ariakit/react");
|
|
13
|
+
//#region src/components/client/Select/SelectContent.tsx
|
|
14
|
+
/**
|
|
15
|
+
* **▾ Select content panel**
|
|
16
|
+
*
|
|
17
|
+
* @componentType Client component
|
|
18
|
+
*
|
|
19
|
+
* @description
|
|
20
|
+
* The floating listbox container. Renders Ariakit `SelectPopover` with UDS
|
|
21
|
+
* styling.
|
|
22
|
+
*/
|
|
23
|
+
const SelectContent = (0, react.forwardRef)(function SelectContent({ children, className, size = "default", variant = "default", slotProps, gutter = 4, sameWidth = true, portal = true, unmountOnHide = false, keepOpenOnInteractOutside = false, maxHeight = 240, disableAutoBorderRadius, nestedBorderRadius = !disableAutoBorderRadius, nestedBorderRadiusSize, nestedBorderRadiusSpacing, nestedBorderRadiusWidth, ...props }, ref) {
|
|
24
|
+
const { className: rootClassName, style: rootStyle, ...rootSlotProps } = slotProps?.root ?? {};
|
|
25
|
+
const resolvedMaxHeight = typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight;
|
|
26
|
+
const select = (0, _ariakit_react.useSelectContext)();
|
|
27
|
+
const { triggerWrapperRef } = require_components_client_Select_selectContext.useSelectFieldContext();
|
|
28
|
+
const mounted = (0, _ariakit_react.useStoreState)(select, "mounted");
|
|
29
|
+
const hasResetActiveItemRef = (0, react.useRef)(false);
|
|
30
|
+
const getAnchorRect = (0, react.useCallback)((anchor) => {
|
|
31
|
+
const wrapper = triggerWrapperRef.current;
|
|
32
|
+
if (wrapper) return require_utils_getUnscaledAnchorRect.getUnscaledAnchorRect(wrapper);
|
|
33
|
+
return require_utils_getUnscaledAnchorRect.getUnscaledAnchorRect(anchor);
|
|
34
|
+
}, [triggerWrapperRef]);
|
|
35
|
+
(0, react.useLayoutEffect)(() => {
|
|
36
|
+
if (!select) return;
|
|
37
|
+
if (mounted && !hasResetActiveItemRef.current) {
|
|
38
|
+
select.setActiveId(null);
|
|
39
|
+
hasResetActiveItemRef.current = true;
|
|
40
|
+
}
|
|
41
|
+
if (!mounted) hasResetActiveItemRef.current = false;
|
|
42
|
+
}, [mounted, select]);
|
|
43
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.SelectPopover, {
|
|
44
|
+
ref,
|
|
45
|
+
render: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_VStack.VStack, {
|
|
46
|
+
elevation: "3",
|
|
47
|
+
overflow: "auto",
|
|
48
|
+
borderRadius: "md",
|
|
49
|
+
nestedBorderRadius,
|
|
50
|
+
nestedBorderRadiusSize,
|
|
51
|
+
nestedBorderRadiusSpacing,
|
|
52
|
+
nestedBorderRadiusWidth,
|
|
53
|
+
...rootSlotProps,
|
|
54
|
+
style: {
|
|
55
|
+
maxHeight: resolvedMaxHeight,
|
|
56
|
+
...rootStyle
|
|
57
|
+
},
|
|
58
|
+
className: require_styles_styler.cx(require_styles_styler.getStyles({
|
|
59
|
+
selectcontentSizeRoot: size,
|
|
60
|
+
selectcontentVariantRoot: variant
|
|
61
|
+
}), "z-50", "focus:outline-none", className, rootClassName),
|
|
62
|
+
children
|
|
63
|
+
}),
|
|
64
|
+
...props,
|
|
65
|
+
gutter,
|
|
66
|
+
sameWidth,
|
|
67
|
+
getAnchorRect,
|
|
68
|
+
portal,
|
|
69
|
+
unmountOnHide,
|
|
70
|
+
hideOnInteractOutside: !keepOpenOnInteractOutside
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
SelectContent.displayName = "SelectContent";
|
|
74
|
+
//#endregion
|
|
75
|
+
exports.SelectContent = SelectContent;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
|
|
2
|
+
import { VStackProps } from "../../VStack.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
import { PropsWithChildren } from "react";
|
|
5
|
+
import { SelectPopoverProps } from "@ariakit/react";
|
|
6
|
+
|
|
7
|
+
//#region src/components/client/Select/SelectContent.d.ts
|
|
8
|
+
type DataAttributes = {
|
|
9
|
+
[name: `data-${string}`]: string;
|
|
10
|
+
};
|
|
11
|
+
interface SelectContentProps extends PropsWithChildren, Omit<SelectPopoverProps, 'render' | 'hideOnInteractOutside'>, Pick<VStackProps, 'nestedBorderRadius' | 'nestedBorderRadiusSize' | 'nestedBorderRadiusSpacing' | 'nestedBorderRadiusWidth'> {
|
|
12
|
+
size?: 'default';
|
|
13
|
+
variant?: 'default';
|
|
14
|
+
/** When true, the panel stays open when the user clicks or focuses outside. */
|
|
15
|
+
keepOpenOnInteractOutside?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Maximum height of the options list. Accepts a number in pixels or a string in
|
|
18
|
+
* CSS units.
|
|
19
|
+
*
|
|
20
|
+
* @default 240
|
|
21
|
+
*/
|
|
22
|
+
maxHeight?: string | number;
|
|
23
|
+
/** UDS handles nested border radius for the first and last item for you to prevent clipping and visual jank.
|
|
24
|
+
* If you need to disable this, set this prop to true.
|
|
25
|
+
*
|
|
26
|
+
* @link https://github.com/yahoo-uds/uds/blob/main/packages/uds/src/tailwind/utils/getNestedBorderRadiusUtilities.ts
|
|
27
|
+
**/
|
|
28
|
+
disableAutoBorderRadius?: boolean;
|
|
29
|
+
slotProps?: {
|
|
30
|
+
root?: Partial<VStackProps & DataAttributes>;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* **▾ Select content panel**
|
|
35
|
+
*
|
|
36
|
+
* @componentType Client component
|
|
37
|
+
*
|
|
38
|
+
* @description
|
|
39
|
+
* The floating listbox container. Renders Ariakit `SelectPopover` with UDS
|
|
40
|
+
* styling.
|
|
41
|
+
*/
|
|
42
|
+
declare const SelectContent: _$react.ForwardRefExoticComponent<Omit<SelectContentProps, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { SelectContent, type SelectContentProps };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { VStackProps } from "../../VStack.js";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
import { PropsWithChildren } from "react";
|
|
6
|
+
import { SelectPopoverProps } from "@ariakit/react";
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/Select/SelectContent.d.ts
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string;
|
|
11
|
+
};
|
|
12
|
+
interface SelectContentProps extends PropsWithChildren, Omit<SelectPopoverProps, 'render' | 'hideOnInteractOutside'>, Pick<VStackProps, 'nestedBorderRadius' | 'nestedBorderRadiusSize' | 'nestedBorderRadiusSpacing' | 'nestedBorderRadiusWidth'> {
|
|
13
|
+
size?: 'default';
|
|
14
|
+
variant?: 'default';
|
|
15
|
+
/** When true, the panel stays open when the user clicks or focuses outside. */
|
|
16
|
+
keepOpenOnInteractOutside?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Maximum height of the options list. Accepts a number in pixels or a string in
|
|
19
|
+
* CSS units.
|
|
20
|
+
*
|
|
21
|
+
* @default 240
|
|
22
|
+
*/
|
|
23
|
+
maxHeight?: string | number;
|
|
24
|
+
/** UDS handles nested border radius for the first and last item for you to prevent clipping and visual jank.
|
|
25
|
+
* If you need to disable this, set this prop to true.
|
|
26
|
+
*
|
|
27
|
+
* @link https://github.com/yahoo-uds/uds/blob/main/packages/uds/src/tailwind/utils/getNestedBorderRadiusUtilities.ts
|
|
28
|
+
**/
|
|
29
|
+
disableAutoBorderRadius?: boolean;
|
|
30
|
+
slotProps?: {
|
|
31
|
+
root?: Partial<VStackProps & DataAttributes>;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* **▾ Select content panel**
|
|
36
|
+
*
|
|
37
|
+
* @componentType Client component
|
|
38
|
+
*
|
|
39
|
+
* @description
|
|
40
|
+
* The floating listbox container. Renders Ariakit `SelectPopover` with UDS
|
|
41
|
+
* styling.
|
|
42
|
+
*/
|
|
43
|
+
declare const SelectContent: _$react.ForwardRefExoticComponent<Omit<SelectContentProps, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { SelectContent, type SelectContentProps };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
import { cx, getStyles } from "../../../styles/styler.js";
|
|
5
|
+
import { VStack } from "../../VStack.js";
|
|
6
|
+
import { getUnscaledAnchorRect } from "../../../utils/getUnscaledAnchorRect.js";
|
|
7
|
+
import { useSelectFieldContext } from "./selectContext.js";
|
|
8
|
+
import { forwardRef, useCallback, useLayoutEffect, useRef } from "react";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
import { SelectPopover, useSelectContext, useStoreState } from "@ariakit/react";
|
|
11
|
+
//#region src/components/client/Select/SelectContent.tsx
|
|
12
|
+
/**
|
|
13
|
+
* **▾ Select content panel**
|
|
14
|
+
*
|
|
15
|
+
* @componentType Client component
|
|
16
|
+
*
|
|
17
|
+
* @description
|
|
18
|
+
* The floating listbox container. Renders Ariakit `SelectPopover` with UDS
|
|
19
|
+
* styling.
|
|
20
|
+
*/
|
|
21
|
+
const SelectContent = forwardRef(function SelectContent({ children, className, size = "default", variant = "default", slotProps, gutter = 4, sameWidth = true, portal = true, unmountOnHide = false, keepOpenOnInteractOutside = false, maxHeight = 240, disableAutoBorderRadius, nestedBorderRadius = !disableAutoBorderRadius, nestedBorderRadiusSize, nestedBorderRadiusSpacing, nestedBorderRadiusWidth, ...props }, ref) {
|
|
22
|
+
const { className: rootClassName, style: rootStyle, ...rootSlotProps } = slotProps?.root ?? {};
|
|
23
|
+
const resolvedMaxHeight = typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight;
|
|
24
|
+
const select = useSelectContext();
|
|
25
|
+
const { triggerWrapperRef } = useSelectFieldContext();
|
|
26
|
+
const mounted = useStoreState(select, "mounted");
|
|
27
|
+
const hasResetActiveItemRef = useRef(false);
|
|
28
|
+
const getAnchorRect = useCallback((anchor) => {
|
|
29
|
+
const wrapper = triggerWrapperRef.current;
|
|
30
|
+
if (wrapper) return getUnscaledAnchorRect(wrapper);
|
|
31
|
+
return getUnscaledAnchorRect(anchor);
|
|
32
|
+
}, [triggerWrapperRef]);
|
|
33
|
+
useLayoutEffect(() => {
|
|
34
|
+
if (!select) return;
|
|
35
|
+
if (mounted && !hasResetActiveItemRef.current) {
|
|
36
|
+
select.setActiveId(null);
|
|
37
|
+
hasResetActiveItemRef.current = true;
|
|
38
|
+
}
|
|
39
|
+
if (!mounted) hasResetActiveItemRef.current = false;
|
|
40
|
+
}, [mounted, select]);
|
|
41
|
+
return /* @__PURE__ */ jsx(SelectPopover, {
|
|
42
|
+
ref,
|
|
43
|
+
render: /* @__PURE__ */ jsx(VStack, {
|
|
44
|
+
elevation: "3",
|
|
45
|
+
overflow: "auto",
|
|
46
|
+
borderRadius: "md",
|
|
47
|
+
nestedBorderRadius,
|
|
48
|
+
nestedBorderRadiusSize,
|
|
49
|
+
nestedBorderRadiusSpacing,
|
|
50
|
+
nestedBorderRadiusWidth,
|
|
51
|
+
...rootSlotProps,
|
|
52
|
+
style: {
|
|
53
|
+
maxHeight: resolvedMaxHeight,
|
|
54
|
+
...rootStyle
|
|
55
|
+
},
|
|
56
|
+
className: cx(getStyles({
|
|
57
|
+
selectcontentSizeRoot: size,
|
|
58
|
+
selectcontentVariantRoot: variant
|
|
59
|
+
}), "z-50", "focus:outline-none", className, rootClassName),
|
|
60
|
+
children
|
|
61
|
+
}),
|
|
62
|
+
...props,
|
|
63
|
+
gutter,
|
|
64
|
+
sameWidth,
|
|
65
|
+
getAnchorRect,
|
|
66
|
+
portal,
|
|
67
|
+
unmountOnHide,
|
|
68
|
+
hideOnInteractOutside: !keepOpenOnInteractOutside
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
SelectContent.displayName = "SelectContent";
|
|
72
|
+
//#endregion
|
|
73
|
+
export { SelectContent };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
5
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
6
|
+
const require_styles_styler = require("../../../styles/styler.cjs");
|
|
7
|
+
const require_components_Divider_Divider = require("../../Divider/Divider.cjs");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
//#region src/components/client/Select/SelectDivider.tsx
|
|
11
|
+
/**
|
|
12
|
+
* **▾ Select divider**
|
|
13
|
+
*
|
|
14
|
+
* @componentType Client component
|
|
15
|
+
*
|
|
16
|
+
* @description
|
|
17
|
+
* A divider for separating groups of select options inside `SelectContent`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* 'use client';
|
|
22
|
+
*
|
|
23
|
+
* import { Select, SelectContent, SelectDivider, SelectItem } from '@yahoo/uds';
|
|
24
|
+
*
|
|
25
|
+
* <Select label="Country" placeholder="Select a country" defaultValue="us">
|
|
26
|
+
* <SelectContent>
|
|
27
|
+
* <SelectItem value="us">United States</SelectItem>
|
|
28
|
+
* <SelectItem value="ca">Canada</SelectItem>
|
|
29
|
+
* <SelectDivider>Other regions</SelectDivider>
|
|
30
|
+
* <SelectItem value="mx">Mexico</SelectItem>
|
|
31
|
+
* </SelectContent>
|
|
32
|
+
* </Select>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @usage
|
|
36
|
+
* Use `SelectDivider` to separate groups of select options.
|
|
37
|
+
*
|
|
38
|
+
* @related [Select](https://uds.build/docs/components/select), [SelectItem](https://uds.build/docs/components/select-item), [Divider](https://uds.build/docs/components/divider)
|
|
39
|
+
*/
|
|
40
|
+
const SelectDivider = (0, react.forwardRef)(function SelectDivider({ "aria-hidden": ariaHidden = true, contentPosition = "start", gap = "4", children, spacingVertical = children ? "2" : "0", spacingHorizontal = children ? "4" : "0", className, ...props }, ref) {
|
|
41
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Divider_Divider.Divider, {
|
|
42
|
+
ref,
|
|
43
|
+
"aria-hidden": ariaHidden,
|
|
44
|
+
variant: "inherit",
|
|
45
|
+
contentPosition,
|
|
46
|
+
gap,
|
|
47
|
+
spacingVertical,
|
|
48
|
+
spacingHorizontal,
|
|
49
|
+
slotProps: {
|
|
50
|
+
root: { className: require_styles_styler.getStyles({
|
|
51
|
+
selectitemDividerVariantRoot: "default",
|
|
52
|
+
className
|
|
53
|
+
}) },
|
|
54
|
+
label: { className: require_styles_styler.getStyles({ selectitemDividerVariantText: "default" }) },
|
|
55
|
+
line: { className: require_styles_styler.getStyles({ selectitemDividerVariantLine: "default" }) }
|
|
56
|
+
},
|
|
57
|
+
...props,
|
|
58
|
+
children
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
SelectDivider.displayName = "SelectDivider";
|
|
62
|
+
//#endregion
|
|
63
|
+
exports.SelectDivider = SelectDivider;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
|
|
2
|
+
import { DividerProps } from "../../Divider/Divider.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Select/SelectDivider.d.ts
|
|
6
|
+
interface SelectDividerProps extends Omit<DividerProps, 'variant' | 'role'> {
|
|
7
|
+
/**
|
|
8
|
+
* Select content uses `role="listbox"`, which does not allow `role="separator"`
|
|
9
|
+
* children. Dividers are visual-only and hidden from the accessibility tree.
|
|
10
|
+
*/
|
|
11
|
+
'aria-hidden'?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* **▾ Select divider**
|
|
15
|
+
*
|
|
16
|
+
* @componentType Client component
|
|
17
|
+
*
|
|
18
|
+
* @description
|
|
19
|
+
* A divider for separating groups of select options inside `SelectContent`.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* 'use client';
|
|
24
|
+
*
|
|
25
|
+
* import { Select, SelectContent, SelectDivider, SelectItem } from '@yahoo/uds';
|
|
26
|
+
*
|
|
27
|
+
* <Select label="Country" placeholder="Select a country" defaultValue="us">
|
|
28
|
+
* <SelectContent>
|
|
29
|
+
* <SelectItem value="us">United States</SelectItem>
|
|
30
|
+
* <SelectItem value="ca">Canada</SelectItem>
|
|
31
|
+
* <SelectDivider>Other regions</SelectDivider>
|
|
32
|
+
* <SelectItem value="mx">Mexico</SelectItem>
|
|
33
|
+
* </SelectContent>
|
|
34
|
+
* </Select>
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @usage
|
|
38
|
+
* Use `SelectDivider` to separate groups of select options.
|
|
39
|
+
*
|
|
40
|
+
* @related [Select](https://uds.build/docs/components/select), [SelectItem](https://uds.build/docs/components/select-item), [Divider](https://uds.build/docs/components/divider)
|
|
41
|
+
*/
|
|
42
|
+
declare const SelectDivider: _$react.ForwardRefExoticComponent<SelectDividerProps & _$react.RefAttributes<HTMLDivElement>>;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { SelectDivider, type SelectDividerProps };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { DividerProps } from "../../Divider/Divider.js";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/Select/SelectDivider.d.ts
|
|
7
|
+
interface SelectDividerProps extends Omit<DividerProps, 'variant' | 'role'> {
|
|
8
|
+
/**
|
|
9
|
+
* Select content uses `role="listbox"`, which does not allow `role="separator"`
|
|
10
|
+
* children. Dividers are visual-only and hidden from the accessibility tree.
|
|
11
|
+
*/
|
|
12
|
+
'aria-hidden'?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* **▾ Select divider**
|
|
16
|
+
*
|
|
17
|
+
* @componentType Client component
|
|
18
|
+
*
|
|
19
|
+
* @description
|
|
20
|
+
* A divider for separating groups of select options inside `SelectContent`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* 'use client';
|
|
25
|
+
*
|
|
26
|
+
* import { Select, SelectContent, SelectDivider, SelectItem } from '@yahoo/uds';
|
|
27
|
+
*
|
|
28
|
+
* <Select label="Country" placeholder="Select a country" defaultValue="us">
|
|
29
|
+
* <SelectContent>
|
|
30
|
+
* <SelectItem value="us">United States</SelectItem>
|
|
31
|
+
* <SelectItem value="ca">Canada</SelectItem>
|
|
32
|
+
* <SelectDivider>Other regions</SelectDivider>
|
|
33
|
+
* <SelectItem value="mx">Mexico</SelectItem>
|
|
34
|
+
* </SelectContent>
|
|
35
|
+
* </Select>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @usage
|
|
39
|
+
* Use `SelectDivider` to separate groups of select options.
|
|
40
|
+
*
|
|
41
|
+
* @related [Select](https://uds.build/docs/components/select), [SelectItem](https://uds.build/docs/components/select-item), [Divider](https://uds.build/docs/components/divider)
|
|
42
|
+
*/
|
|
43
|
+
declare const SelectDivider: _$react.ForwardRefExoticComponent<SelectDividerProps & _$react.RefAttributes<HTMLDivElement>>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { SelectDivider, type SelectDividerProps };
|