@yahoo/uds 3.157.0 → 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 +3287 -596
- package/dist/automated-config/dist/generated/generatedConfigs.d.cts +350 -12
- package/dist/automated-config/dist/generated/generatedConfigs.d.ts +350 -12
- package/dist/automated-config/dist/generated/generatedConfigs.js +3285 -597
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +276 -45
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +8 -2
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +8 -2
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +276 -45
- package/dist/automated-config/dist/properties.cjs +8 -1
- package/dist/automated-config/dist/properties.d.cts +8 -0
- package/dist/automated-config/dist/properties.d.ts +8 -0
- package/dist/automated-config/dist/properties.js +8 -1
- 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 +48 -33
- package/dist/automated-config/dist/utils/buildConfigSchema.d.cts +14 -4
- package/dist/automated-config/dist/utils/buildConfigSchema.d.ts +14 -4
- package/dist/automated-config/dist/utils/buildConfigSchema.js +49 -34
- 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/getButtonControlHeight.cjs +129 -0
- package/dist/automated-config/dist/utils/getButtonControlHeight.d.cts +133 -0
- package/dist/automated-config/dist/utils/getButtonControlHeight.d.ts +133 -0
- package/dist/automated-config/dist/utils/getButtonControlHeight.js +122 -0
- package/dist/automated-config/dist/utils/getButtonControlHeightPx.cjs +114 -0
- package/dist/automated-config/dist/utils/getButtonControlHeightPx.d.cts +78 -0
- package/dist/automated-config/dist/utils/getButtonControlHeightPx.d.ts +78 -0
- package/dist/automated-config/dist/utils/getButtonControlHeightPx.js +108 -0
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.cts +2 -2
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.ts +2 -2
- 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/iconButtonMatchButtonHeight.cjs +110 -0
- package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.d.cts +19 -0
- package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.d.ts +19 -0
- package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.js +108 -0
- package/dist/automated-config/dist/utils/index.cjs +106 -33
- package/dist/automated-config/dist/utils/index.d.cts +16 -4
- package/dist/automated-config/dist/utils/index.d.ts +16 -4
- package/dist/automated-config/dist/utils/index.js +107 -34
- package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.cjs +15 -0
- package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.d.cts +20 -0
- package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.d.ts +20 -0
- package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.js +15 -0
- 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/Button.cjs +3 -3
- package/dist/components/client/Button.js +3 -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/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 +383 -73
- package/dist/config/dist/index.js +383 -73
- package/dist/css/dist/css/utils.cjs +3 -0
- package/dist/css/dist/css/utils.js +3 -0
- package/dist/css/dist/packages/automated-config/dist/properties.cjs +8 -1
- package/dist/css/dist/packages/automated-config/dist/properties.js +8 -1
- package/dist/css/dist/packages/config/dist/index.cjs +383 -73
- package/dist/css/dist/packages/config/dist/index.js +383 -73
- package/dist/css-tokens/dist/index.cjs +2 -0
- package/dist/css-tokens/dist/index.d.cts +2 -1
- package/dist/css-tokens/dist/index.d.ts +2 -1
- package/dist/css-tokens/dist/index.js +2 -1
- package/dist/index.cjs +34 -0
- package/dist/index.d.cts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +11 -3
- package/dist/styles/styler.d.cts +29 -12
- package/dist/styles/styler.d.ts +29 -12
- 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 +3287 -596
- package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.js +3285 -597
- package/dist/tailwind-internal/dist/packages/automated-config/dist/properties.cjs +8 -1
- package/dist/tailwind-internal/dist/packages/automated-config/dist/properties.js +8 -1
- 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/getButtonControlHeight.cjs +126 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/getButtonControlHeight.js +123 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/iconButtonMatchButtonHeight.cjs +20 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/iconButtonMatchButtonHeight.js +20 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.cjs +103 -33
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.js +104 -34
- 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 +383 -73
- package/dist/tailwind-internal/dist/packages/config/dist/index.js +383 -73
- package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.cjs +12 -10
- package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.js +3 -2
- 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 +5 -2
- package/dist/tailwind-internal/dist/plugins/components.js +6 -3
- 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 +25 -0
- package/dist/tokens/automation/index.d.cts +6 -2
- package/dist/tokens/automation/index.d.ts +6 -2
- package/dist/tokens/automation/index.js +6 -2
- package/dist/tokens/consts/cssTokens.cjs +1 -0
- package/dist/tokens/consts/cssTokens.d.cts +2 -2
- package/dist/tokens/consts/cssTokens.d.ts +2 -2
- package/dist/tokens/consts/cssTokens.js +2 -2
- package/dist/tokens/index.cjs +26 -0
- package/dist/tokens/index.d.cts +8 -4
- package/dist/tokens/index.d.ts +8 -4
- package/dist/tokens/index.js +7 -3
- 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 +718 -308
- package/dist/uds/generated/componentData.js +718 -308
- 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 +897 -398
- package/generated/migrationSchemaVersion.ts +1 -1
- package/generated/tailwindPurge.ts +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
5
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
6
|
+
const require_styles_styler = require("../../../styles/styler.cjs");
|
|
7
|
+
const require_components_Box = require("../../Box.cjs");
|
|
8
|
+
const require_components_VStack = require("../../VStack.cjs");
|
|
9
|
+
const require_components_client_SpringMotionConfig = require("../SpringMotionConfig.cjs");
|
|
10
|
+
const require_components_client_Select_selectContext = require("./selectContext.cjs");
|
|
11
|
+
const require_components_client_Select_selectFieldStyles = require("./selectFieldStyles.cjs");
|
|
12
|
+
const require_components_client_Select_SelectHelpText = require("./SelectHelpText.cjs");
|
|
13
|
+
const require_components_client_Select_SelectTrigger = require("./SelectTrigger.cjs");
|
|
14
|
+
let react = require("react");
|
|
15
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
16
|
+
let lodash_isFunction_js = require("lodash/isFunction.js");
|
|
17
|
+
lodash_isFunction_js = require_runtime.__toESM(lodash_isFunction_js);
|
|
18
|
+
let _ariakit_react = require("@ariakit/react");
|
|
19
|
+
//#region src/components/client/Select/Select.tsx
|
|
20
|
+
const SelectRoot = (0, react.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) {
|
|
21
|
+
const value = (0, _ariakit_react.useStoreState)((0, _ariakit_react.useSelectContext)(), "value");
|
|
22
|
+
const hasValue = value != null && value !== "";
|
|
23
|
+
const hasHelpText = Boolean(helpText || helperTextIcon);
|
|
24
|
+
const uid = `uds-select-${(0, react.useId)()}`;
|
|
25
|
+
const helpTextId = hasHelpText ? `${uid}-help-text` : void 0;
|
|
26
|
+
const triggerWrapperRef = (0, react.useRef)(null);
|
|
27
|
+
const contextValue = (0, react.useMemo)(() => ({
|
|
28
|
+
size,
|
|
29
|
+
disabled,
|
|
30
|
+
readOnly,
|
|
31
|
+
required,
|
|
32
|
+
hasError,
|
|
33
|
+
width,
|
|
34
|
+
reduceMotion: forceReduceMotion,
|
|
35
|
+
uid,
|
|
36
|
+
helpTextId,
|
|
37
|
+
triggerWrapperRef
|
|
38
|
+
}), [
|
|
39
|
+
size,
|
|
40
|
+
disabled,
|
|
41
|
+
readOnly,
|
|
42
|
+
required,
|
|
43
|
+
hasError,
|
|
44
|
+
width,
|
|
45
|
+
forceReduceMotion,
|
|
46
|
+
uid,
|
|
47
|
+
helpTextId
|
|
48
|
+
]);
|
|
49
|
+
const { className: rootSlotClassName, ...rootSlotProps } = slotProps?.root ?? {};
|
|
50
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Select_selectContext.SelectFieldContext.Provider, {
|
|
51
|
+
value: contextValue,
|
|
52
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_VStack.VStack, {
|
|
53
|
+
width,
|
|
54
|
+
className: require_styles_styler.cx(require_components_client_Select_selectFieldStyles.getSelectRootClassName({
|
|
55
|
+
size,
|
|
56
|
+
hasValue,
|
|
57
|
+
disabled,
|
|
58
|
+
className
|
|
59
|
+
}), rootSlotClassName),
|
|
60
|
+
style,
|
|
61
|
+
...rootSlotProps,
|
|
62
|
+
children: [
|
|
63
|
+
label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_Box.Box, {
|
|
64
|
+
spacingBottom: "2",
|
|
65
|
+
columnGap: "0.5",
|
|
66
|
+
alignItems: "flex-end",
|
|
67
|
+
className: require_components_client_Select_selectFieldStyles.getSelectLabelClassName(size, hasValue),
|
|
68
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
69
|
+
htmlFor: uid,
|
|
70
|
+
...slotProps?.label,
|
|
71
|
+
children: (0, lodash_isFunction_js.default)(label) ? label() : label
|
|
72
|
+
}), required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
73
|
+
className: require_components_client_Select_selectFieldStyles.getSelectLabelRequiredClassName(hasValue),
|
|
74
|
+
children: "*"
|
|
75
|
+
})]
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Select_SelectTrigger.SelectTrigger, {
|
|
78
|
+
ref,
|
|
79
|
+
placeholder,
|
|
80
|
+
name,
|
|
81
|
+
startIcon,
|
|
82
|
+
endIcon,
|
|
83
|
+
disabled,
|
|
84
|
+
slotProps: slotProps?.trigger
|
|
85
|
+
}),
|
|
86
|
+
hasHelpText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Select_SelectHelpText.SelectHelpText, {
|
|
87
|
+
helpText,
|
|
88
|
+
helperTextIcon,
|
|
89
|
+
slotProps: {
|
|
90
|
+
helperText: slotProps?.helperText,
|
|
91
|
+
helperTextIcon: slotProps?.helperTextIcon
|
|
92
|
+
}
|
|
93
|
+
}),
|
|
94
|
+
children
|
|
95
|
+
]
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
SelectRoot.displayName = "SelectRoot";
|
|
100
|
+
/**
|
|
101
|
+
* **⚙️ A composable Select component**
|
|
102
|
+
*
|
|
103
|
+
* @componentType Client component
|
|
104
|
+
*
|
|
105
|
+
* @description
|
|
106
|
+
* Select lets users pick one value from a list. Compose with `SelectContent` and
|
|
107
|
+
* `SelectItem`, similar to `Tabs` with `TabList` and `Tab`.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```tsx
|
|
111
|
+
* 'use client';
|
|
112
|
+
* import { Select, SelectContent, SelectItem } from '@yahoo/uds';
|
|
113
|
+
*
|
|
114
|
+
* <Select label="Country" placeholder="Select a country" defaultValue="us">
|
|
115
|
+
* <SelectContent>
|
|
116
|
+
* <SelectItem value="us">United States</SelectItem>
|
|
117
|
+
* <SelectItem value="ca">Canada</SelectItem>
|
|
118
|
+
* </SelectContent>
|
|
119
|
+
* </Select>
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
const Select = (0, react.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) {
|
|
123
|
+
const setValue = setValueProp ?? onChange;
|
|
124
|
+
const isOpenControlled = openProp !== void 0;
|
|
125
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, react.useState)(defaultOpen ?? false);
|
|
126
|
+
const open = isOpenControlled ? openProp : uncontrolledOpen;
|
|
127
|
+
const handleSetOpen = (0, react.useCallback)((nextOpen) => {
|
|
128
|
+
if (readOnly && isOpenControlled) return;
|
|
129
|
+
if (nextOpen && (readOnly || disabled)) return;
|
|
130
|
+
if (!isOpenControlled) setUncontrolledOpen(nextOpen);
|
|
131
|
+
setOpenProp?.(nextOpen);
|
|
132
|
+
}, [
|
|
133
|
+
disabled,
|
|
134
|
+
isOpenControlled,
|
|
135
|
+
readOnly,
|
|
136
|
+
setOpenProp
|
|
137
|
+
]);
|
|
138
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
|
|
139
|
+
reducedMotion: "user",
|
|
140
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.SelectProvider, {
|
|
141
|
+
...value !== void 0 ? {
|
|
142
|
+
...providerProps,
|
|
143
|
+
value,
|
|
144
|
+
setValue,
|
|
145
|
+
open,
|
|
146
|
+
setOpen: handleSetOpen
|
|
147
|
+
} : {
|
|
148
|
+
...providerProps,
|
|
149
|
+
defaultValue,
|
|
150
|
+
open,
|
|
151
|
+
setOpen: handleSetOpen
|
|
152
|
+
},
|
|
153
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectRoot, {
|
|
154
|
+
ref,
|
|
155
|
+
label,
|
|
156
|
+
helpText,
|
|
157
|
+
helperTextIcon,
|
|
158
|
+
placeholder,
|
|
159
|
+
name,
|
|
160
|
+
size,
|
|
161
|
+
disabled,
|
|
162
|
+
required,
|
|
163
|
+
hasError,
|
|
164
|
+
readOnly,
|
|
165
|
+
width,
|
|
166
|
+
reduceMotion,
|
|
167
|
+
startIcon,
|
|
168
|
+
endIcon,
|
|
169
|
+
className,
|
|
170
|
+
style,
|
|
171
|
+
slotProps,
|
|
172
|
+
children
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
Select.displayName = "Select";
|
|
178
|
+
//#endregion
|
|
179
|
+
exports.Select = Select;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalSelectProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import { IconPropsWithSVGProps } from "../../../tokens/types.cjs";
|
|
4
|
+
import { SelectTriggerProps } from "./SelectTrigger.cjs";
|
|
5
|
+
import * as _$react from "react";
|
|
6
|
+
import { SelectProviderProps } from "@ariakit/react";
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/Select/Select.d.ts
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string;
|
|
11
|
+
};
|
|
12
|
+
interface SelectProps extends Pick<UniversalSelectProps, 'label' | 'disabled' | 'required' | 'helpText' | 'helperTextIcon' | 'hasError' | 'size' | 'startIcon' | 'endIcon' | 'reduceMotion' | 'readOnly' | 'width'>, Omit<SelectProviderProps, 'children' | 'setValue'> {
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
/** Placeholder text shown when no value is selected. */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/** Native form field name. Renders a hidden `<select>` for form submission. */
|
|
17
|
+
name?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
style?: React.CSSProperties;
|
|
20
|
+
/** Called when the selected value changes. Alias for Ariakit `setValue`. */
|
|
21
|
+
onChange?: (value: string) => void;
|
|
22
|
+
setValue?: SelectProviderProps['setValue'];
|
|
23
|
+
slotProps?: {
|
|
24
|
+
root?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
25
|
+
label?: Partial<React.LabelHTMLAttributes<HTMLLabelElement> & DataAttributes>;
|
|
26
|
+
trigger?: SelectTriggerProps['slotProps'];
|
|
27
|
+
helperText?: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
|
|
28
|
+
helperTextIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* **⚙️ A composable Select component**
|
|
33
|
+
*
|
|
34
|
+
* @componentType Client component
|
|
35
|
+
*
|
|
36
|
+
* @description
|
|
37
|
+
* Select lets users pick one value from a list. Compose with `SelectContent` and
|
|
38
|
+
* `SelectItem`, similar to `Tabs` with `TabList` and `Tab`.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* 'use client';
|
|
43
|
+
* import { Select, SelectContent, SelectItem } from '@yahoo/uds';
|
|
44
|
+
*
|
|
45
|
+
* <Select label="Country" placeholder="Select a country" defaultValue="us">
|
|
46
|
+
* <SelectContent>
|
|
47
|
+
* <SelectItem value="us">United States</SelectItem>
|
|
48
|
+
* <SelectItem value="ca">Canada</SelectItem>
|
|
49
|
+
* </SelectContent>
|
|
50
|
+
* </Select>
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
declare const Select: _$react.ForwardRefExoticComponent<SelectProps & _$react.RefAttributes<HTMLButtonElement>>;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { Select, type SelectProps };
|
|
@@ -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 };
|