@castui/cast-ui 4.1.1 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -19
- package/dist/components/Alert/Alert.d.ts +40 -0
- package/dist/components/Alert/Alert.js +71 -0
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/Alert/index.js +5 -0
- package/dist/components/Avatar/Avatar.d.ts +31 -0
- package/dist/components/Avatar/Avatar.js +55 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Avatar/index.js +5 -0
- package/dist/components/Badge/Badge.d.ts +41 -0
- package/dist/components/Badge/Badge.js +71 -0
- package/dist/components/Badge/index.d.ts +1 -0
- package/dist/components/Badge/index.js +5 -0
- package/dist/components/Button/Button.d.ts +0 -1
- package/dist/components/Button/Button.js +21 -19
- package/dist/components/Button/index.d.ts +0 -1
- package/dist/components/Button/index.js +5 -2
- package/dist/components/Card/Card.d.ts +41 -0
- package/dist/components/Card/Card.js +91 -0
- package/dist/components/Card/index.d.ts +1 -0
- package/dist/components/Card/index.js +5 -0
- package/dist/components/Checkbox/Checkbox.d.ts +32 -0
- package/dist/components/Checkbox/Checkbox.js +107 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/index.js +5 -0
- package/dist/components/Chip/Chip.d.ts +46 -0
- package/dist/components/Chip/Chip.js +82 -0
- package/dist/components/Chip/index.d.ts +1 -0
- package/dist/components/Chip/index.js +5 -0
- package/dist/components/Dialog/Dialog.d.ts +0 -1
- package/dist/components/Dialog/Dialog.js +33 -26
- package/dist/components/Dialog/index.d.ts +0 -1
- package/dist/components/Dialog/index.js +6 -2
- package/dist/components/Divider/Divider.d.ts +22 -0
- package/dist/components/Divider/Divider.js +19 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/Divider/index.js +5 -0
- package/dist/components/Icon/Icon.d.ts +26 -9
- package/dist/components/Icon/Icon.js +16 -6
- package/dist/components/Icon/index.d.ts +0 -1
- package/dist/components/Icon/index.js +5 -2
- package/dist/components/Input/Input.d.ts +62 -0
- package/dist/components/Input/Input.js +141 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/Input/index.js +5 -0
- package/dist/components/List/List.d.ts +58 -0
- package/dist/components/List/List.js +116 -0
- package/dist/components/List/index.d.ts +1 -0
- package/dist/components/List/index.js +8 -0
- package/dist/components/Popover/Popover.d.ts +34 -0
- package/dist/components/Popover/Popover.js +62 -0
- package/dist/components/Popover/index.d.ts +1 -0
- package/dist/components/Popover/index.js +5 -0
- package/dist/components/Radio/Radio.d.ts +52 -0
- package/dist/components/Radio/Radio.js +127 -0
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/Radio/index.js +6 -0
- package/dist/components/Select/Select.d.ts +0 -1
- package/dist/components/Select/Select.js +114 -96
- package/dist/components/Select/index.d.ts +0 -1
- package/dist/components/Select/index.js +10 -2
- package/dist/components/Skeleton/Skeleton.d.ts +33 -0
- package/dist/components/Skeleton/Skeleton.js +66 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Skeleton/index.js +5 -0
- package/dist/components/Toast/Toast.d.ts +35 -0
- package/dist/components/Toast/Toast.js +79 -0
- package/dist/components/Toast/index.d.ts +1 -0
- package/dist/components/Toast/index.js +5 -0
- package/dist/components/Toggle/Toggle.d.ts +31 -0
- package/dist/components/Toggle/Toggle.js +91 -0
- package/dist/components/Toggle/index.d.ts +1 -0
- package/dist/components/Toggle/index.js +5 -0
- package/dist/components/Tooltip/Tooltip.d.ts +34 -0
- package/dist/components/Tooltip/Tooltip.js +67 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Tooltip/index.js +5 -0
- package/dist/index.d.ts +17 -3
- package/dist/index.js +81 -7
- package/dist/theme/ThemeContext.d.ts +24 -8
- package/dist/theme/ThemeContext.js +41 -22
- package/dist/theme/index.d.ts +1 -2
- package/dist/theme/index.js +8 -3
- package/dist/theme/themes.d.ts +0 -1
- package/dist/theme/themes.js +214 -2
- package/dist/theme/types.d.ts +183 -1
- package/dist/theme/types.js +2 -2
- package/dist/tokens/colors.d.ts +294 -26
- package/dist/tokens/colors.js +324 -99
- package/dist/tokens/index.d.ts +1 -2
- package/dist/tokens/index.js +29 -3
- package/dist/tokens/typography.d.ts +0 -1
- package/dist/tokens/typography.js +13 -11
- package/package.json +13 -2
- package/dist/components/Button/Button.d.ts.map +0 -1
- package/dist/components/Button/Button.js.map +0 -1
- package/dist/components/Button/index.d.ts.map +0 -1
- package/dist/components/Button/index.js.map +0 -1
- package/dist/components/Dialog/Dialog.d.ts.map +0 -1
- package/dist/components/Dialog/Dialog.js.map +0 -1
- package/dist/components/Dialog/index.d.ts.map +0 -1
- package/dist/components/Dialog/index.js.map +0 -1
- package/dist/components/Icon/Icon.d.ts.map +0 -1
- package/dist/components/Icon/Icon.js.map +0 -1
- package/dist/components/Icon/index.d.ts.map +0 -1
- package/dist/components/Icon/index.js.map +0 -1
- package/dist/components/Select/Select.d.ts.map +0 -1
- package/dist/components/Select/Select.js.map +0 -1
- package/dist/components/Select/index.d.ts.map +0 -1
- package/dist/components/Select/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/theme/ThemeContext.d.ts.map +0 -1
- package/dist/theme/ThemeContext.js.map +0 -1
- package/dist/theme/index.d.ts.map +0 -1
- package/dist/theme/index.js.map +0 -1
- package/dist/theme/themes.d.ts.map +0 -1
- package/dist/theme/themes.js.map +0 -1
- package/dist/theme/types.d.ts.map +0 -1
- package/dist/theme/types.js.map +0 -1
- package/dist/tokens/colors.d.ts.map +0 -1
- package/dist/tokens/colors.js.map +0 -1
- package/dist/tokens/index.d.ts.map +0 -1
- package/dist/tokens/index.js.map +0 -1
- package/dist/tokens/typography.d.ts.map +0 -1
- package/dist/tokens/typography.js.map +0 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Radio — single-choice control, used individually or within a RadioGroup.
|
|
3
|
+
*
|
|
4
|
+
* Maps to the Figma <Radio> component (node 307:3477):
|
|
5
|
+
* checked → boolean
|
|
6
|
+
* size → small | default | large
|
|
7
|
+
* state → default | hover | focus | disabled (interaction-driven)
|
|
8
|
+
*
|
|
9
|
+
* Indicator + dot sizes come from the density theme's `radio` tokens (sizes
|
|
10
|
+
* track the `size` prop; gap tracks density). Colours come from the active
|
|
11
|
+
* theme scheme's `radio` set + the focus-ring colour.
|
|
12
|
+
*
|
|
13
|
+
* RadioGroup provides single-selection semantics: each child Radio with a
|
|
14
|
+
* `value` reflects `group.value === value` and reports selection upward.
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import { type ViewStyle, type StyleProp } from 'react-native';
|
|
18
|
+
export type RadioSize = 'small' | 'default' | 'large';
|
|
19
|
+
export type RadioProps = {
|
|
20
|
+
/** Identifier — required when used inside a RadioGroup. */
|
|
21
|
+
value?: string;
|
|
22
|
+
/** Selected state (standalone use / controlled). */
|
|
23
|
+
checked?: boolean;
|
|
24
|
+
/** Change handler — receives the next checked value (standalone use). */
|
|
25
|
+
onChange?: (checked: boolean) => void;
|
|
26
|
+
/** Optional label rendered beside the indicator. */
|
|
27
|
+
children?: string;
|
|
28
|
+
/** Size variant — controls indicator + dot size. Inherited from RadioGroup. */
|
|
29
|
+
size?: RadioSize;
|
|
30
|
+
/** Disables interaction and applies muted styling. */
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Style override for the outer row. */
|
|
33
|
+
style?: StyleProp<ViewStyle>;
|
|
34
|
+
/** Accessibility label — falls back to the label text. */
|
|
35
|
+
accessibilityLabel?: string;
|
|
36
|
+
};
|
|
37
|
+
export type RadioGroupProps = {
|
|
38
|
+
/** Selected value. */
|
|
39
|
+
value?: string;
|
|
40
|
+
/** Selection change handler. */
|
|
41
|
+
onValueChange?: (value: string) => void;
|
|
42
|
+
/** Default size applied to all child radios. */
|
|
43
|
+
size?: RadioSize;
|
|
44
|
+
/** Disables every radio in the group. */
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
/** Radio children. */
|
|
47
|
+
children: React.ReactNode;
|
|
48
|
+
/** Style override for the group container. */
|
|
49
|
+
style?: StyleProp<ViewStyle>;
|
|
50
|
+
};
|
|
51
|
+
export declare function RadioGroup({ value, onValueChange, size, disabled, children, style, }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
export declare function Radio({ value, checked, onChange, children, size, disabled, style, accessibilityLabel, }: RadioProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RadioGroup = RadioGroup;
|
|
4
|
+
exports.Radio = Radio;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
/**
|
|
7
|
+
* Radio — single-choice control, used individually or within a RadioGroup.
|
|
8
|
+
*
|
|
9
|
+
* Maps to the Figma <Radio> component (node 307:3477):
|
|
10
|
+
* checked → boolean
|
|
11
|
+
* size → small | default | large
|
|
12
|
+
* state → default | hover | focus | disabled (interaction-driven)
|
|
13
|
+
*
|
|
14
|
+
* Indicator + dot sizes come from the density theme's `radio` tokens (sizes
|
|
15
|
+
* track the `size` prop; gap tracks density). Colours come from the active
|
|
16
|
+
* theme scheme's `radio` set + the focus-ring colour.
|
|
17
|
+
*
|
|
18
|
+
* RadioGroup provides single-selection semantics: each child Radio with a
|
|
19
|
+
* `value` reflects `group.value === value` and reports selection upward.
|
|
20
|
+
*/
|
|
21
|
+
const react_1 = require("react");
|
|
22
|
+
const react_native_1 = require("react-native");
|
|
23
|
+
const theme_1 = require("../../theme");
|
|
24
|
+
const tokens_1 = require("../../tokens");
|
|
25
|
+
const RadioGroupCtx = (0, react_1.createContext)(null);
|
|
26
|
+
/** Maps radio size → label typography scale */
|
|
27
|
+
const LABEL_SCALE = {
|
|
28
|
+
small: 'sm',
|
|
29
|
+
default: 'md',
|
|
30
|
+
large: 'lg',
|
|
31
|
+
};
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
// RadioGroup
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
function RadioGroup({ value, onValueChange, size = 'default', disabled = false, children, style, }) {
|
|
36
|
+
const { components } = (0, theme_1.useTheme)();
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(RadioGroupCtx.Provider, { value: { value, onValueChange, size, disabled }, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityRole: "radiogroup", style: [{ gap: components.radio.gap }, style], children: children }) }));
|
|
38
|
+
}
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// Radio
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
function Radio({ value, checked, onChange, children, size, disabled, style, accessibilityLabel, }) {
|
|
43
|
+
const { components, scheme } = (0, theme_1.useTheme)();
|
|
44
|
+
const radioColors = scheme.radio;
|
|
45
|
+
const group = (0, react_1.useContext)(RadioGroupCtx);
|
|
46
|
+
const resolvedSize = size ?? group?.size ?? 'default';
|
|
47
|
+
const resolvedDisabled = disabled ?? group?.disabled ?? false;
|
|
48
|
+
const isChecked = group != null && value != null ? group.value === value : checked === true;
|
|
49
|
+
const tokens = components.radio;
|
|
50
|
+
const sizeTokens = tokens[resolvedSize];
|
|
51
|
+
const labelTokens = tokens_1.label[LABEL_SCALE[resolvedSize]];
|
|
52
|
+
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
53
|
+
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
54
|
+
const handlePress = (0, react_1.useCallback)(() => {
|
|
55
|
+
if (resolvedDisabled)
|
|
56
|
+
return;
|
|
57
|
+
if (group != null && value != null) {
|
|
58
|
+
group.onValueChange?.(value);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
onChange?.(!isChecked);
|
|
62
|
+
}
|
|
63
|
+
}, [resolvedDisabled, group, value, onChange, isChecked]);
|
|
64
|
+
// Resolve indicator fill + border. Priority: disabled > focus > checked > hover > default
|
|
65
|
+
let ringBg;
|
|
66
|
+
let ringBorderColor;
|
|
67
|
+
let ringBorderWidth;
|
|
68
|
+
if (resolvedDisabled) {
|
|
69
|
+
ringBg = radioColors.indicator.disabled.bg;
|
|
70
|
+
ringBorderColor = radioColors.indicator.disabled.border;
|
|
71
|
+
ringBorderWidth = tokens_1.controlTokens.borderWidth;
|
|
72
|
+
}
|
|
73
|
+
else if (isChecked) {
|
|
74
|
+
ringBg = isHovered
|
|
75
|
+
? radioColors.indicator.checkedHover.bg
|
|
76
|
+
: radioColors.indicator.checked.bg;
|
|
77
|
+
ringBorderColor = isFocused
|
|
78
|
+
? scheme.focusRing.color
|
|
79
|
+
: radioColors.indicator.checked.border;
|
|
80
|
+
ringBorderWidth = isFocused ? tokens.focusRingWidth : 0;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
ringBg = radioColors.indicator.uncheckedDefault.bg;
|
|
84
|
+
if (isFocused) {
|
|
85
|
+
ringBorderColor = scheme.focusRing.color;
|
|
86
|
+
ringBorderWidth = tokens.focusRingWidth;
|
|
87
|
+
}
|
|
88
|
+
else if (isHovered) {
|
|
89
|
+
ringBorderColor = radioColors.indicator.uncheckedHover.border;
|
|
90
|
+
ringBorderWidth = tokens_1.controlTokens.borderWidth;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
ringBorderColor = radioColors.indicator.uncheckedDefault.border;
|
|
94
|
+
ringBorderWidth = tokens_1.controlTokens.borderWidth;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const dotColor = resolvedDisabled
|
|
98
|
+
? radioColors.dot.disabled
|
|
99
|
+
: radioColors.dot.default;
|
|
100
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { onPress: handlePress, disabled: resolvedDisabled, onHoverIn: () => setIsHovered(true), onHoverOut: () => setIsHovered(false), onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), accessibilityRole: "radio", accessibilityLabel: accessibilityLabel || children, accessibilityState: { checked: isChecked, disabled: resolvedDisabled }, style: [
|
|
101
|
+
{ flexDirection: 'row', alignItems: 'flex-start', gap: tokens.gap },
|
|
102
|
+
style,
|
|
103
|
+
], children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
|
|
104
|
+
width: sizeTokens.indicatorSize,
|
|
105
|
+
height: sizeTokens.indicatorSize,
|
|
106
|
+
borderRadius: tokens.borderRadius,
|
|
107
|
+
backgroundColor: ringBg,
|
|
108
|
+
borderWidth: ringBorderWidth,
|
|
109
|
+
borderColor: ringBorderColor,
|
|
110
|
+
alignItems: 'center',
|
|
111
|
+
justifyContent: 'center',
|
|
112
|
+
}, children: isChecked ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
|
|
113
|
+
width: sizeTokens.dotSize,
|
|
114
|
+
height: sizeTokens.dotSize,
|
|
115
|
+
borderRadius: sizeTokens.dotSize / 2,
|
|
116
|
+
backgroundColor: dotColor,
|
|
117
|
+
} })) : null }), children ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
118
|
+
fontFamily: tokens_1.fontFamily.sans,
|
|
119
|
+
fontWeight: tokens_1.fontWeight.medium,
|
|
120
|
+
fontSize: labelTokens.fontSize,
|
|
121
|
+
lineHeight: labelTokens.lineHeight,
|
|
122
|
+
letterSpacing: labelTokens.letterSpacing,
|
|
123
|
+
color: resolvedDisabled
|
|
124
|
+
? radioColors.label.disabled
|
|
125
|
+
: radioColors.label.default,
|
|
126
|
+
}, selectable: false, children: children })) : null] }));
|
|
127
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Radio, RadioGroup, type RadioProps, type RadioGroupProps, type RadioSize, } from './Radio';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RadioGroup = exports.Radio = void 0;
|
|
4
|
+
var Radio_1 = require("./Radio");
|
|
5
|
+
Object.defineProperty(exports, "Radio", { enumerable: true, get: function () { return Radio_1.Radio; } });
|
|
6
|
+
Object.defineProperty(exports, "RadioGroup", { enumerable: true, get: function () { return Radio_1.RadioGroup; } });
|
|
@@ -93,4 +93,3 @@ export type SelectContentProps = {
|
|
|
93
93
|
};
|
|
94
94
|
export declare function SelectContent({ children, style }: SelectContentProps): import("react/jsx-runtime").JSX.Element;
|
|
95
95
|
export declare function Select({ type, size, label: formLabel, helperText, placeholder, leadingIcon, disabled, error, value, onValueChange, values, onValuesChange, searchValue, onSearchChange, children, style, accessibilityLabel, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
96
|
-
//# sourceMappingURL=Select.d.ts.map
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SelectTag = SelectTag;
|
|
4
|
+
exports.SelectSeparator = SelectSeparator;
|
|
5
|
+
exports.SelectGroup = SelectGroup;
|
|
6
|
+
exports.SelectOption = SelectOption;
|
|
7
|
+
exports.SelectContent = SelectContent;
|
|
8
|
+
exports.Select = Select;
|
|
9
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
2
10
|
/**
|
|
3
11
|
* Select — form control for choosing from a list of options.
|
|
4
12
|
*
|
|
@@ -18,14 +26,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
18
26
|
* SelectTag — pill badge for multi-select (exported for standalone use)
|
|
19
27
|
* SelectContent — the dropdown card (exported for custom overlay use)
|
|
20
28
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const SelectCtx = createContext(null);
|
|
29
|
+
const react_1 = require("react");
|
|
30
|
+
const react_native_1 = require("react-native");
|
|
31
|
+
const theme_1 = require("../../theme");
|
|
32
|
+
const Icon_1 = require("../Icon");
|
|
33
|
+
const tokens_1 = require("../../tokens");
|
|
34
|
+
const SelectCtx = (0, react_1.createContext)(null);
|
|
27
35
|
function useSelectContext() {
|
|
28
|
-
const ctx = useContext(SelectCtx);
|
|
36
|
+
const ctx = (0, react_1.useContext)(SelectCtx);
|
|
29
37
|
if (!ctx)
|
|
30
38
|
throw new Error('Select sub-components must be used within <Select>');
|
|
31
39
|
return ctx;
|
|
@@ -63,8 +71,10 @@ const SHADOW_NATIVE = {
|
|
|
63
71
|
// ---------------------------------------------------------------------------
|
|
64
72
|
// SelectTag — pill badge for multi-select
|
|
65
73
|
// ---------------------------------------------------------------------------
|
|
66
|
-
|
|
67
|
-
|
|
74
|
+
function SelectTag({ children, onRemove, disabled = false }) {
|
|
75
|
+
const { scheme } = (0, theme_1.useTheme)();
|
|
76
|
+
const tagTokens = scheme.tag;
|
|
77
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: {
|
|
68
78
|
flexDirection: 'row',
|
|
69
79
|
alignItems: 'center',
|
|
70
80
|
gap: tagTokens.gap,
|
|
@@ -72,22 +82,23 @@ export function SelectTag({ children, onRemove, disabled = false }) {
|
|
|
72
82
|
borderRadius: tagTokens.borderRadius,
|
|
73
83
|
paddingHorizontal: tagTokens.paddingX,
|
|
74
84
|
paddingVertical: tagTokens.paddingY,
|
|
75
|
-
}, children: [
|
|
76
|
-
fontFamily: fontFamily.sans,
|
|
77
|
-
fontWeight: fontWeight.regular,
|
|
78
|
-
fontSize: caption.fontSize,
|
|
79
|
-
lineHeight: caption.lineHeight,
|
|
80
|
-
letterSpacing: caption.letterSpacing,
|
|
85
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
86
|
+
fontFamily: tokens_1.fontFamily.sans,
|
|
87
|
+
fontWeight: tokens_1.fontWeight.regular,
|
|
88
|
+
fontSize: tokens_1.caption.fontSize,
|
|
89
|
+
lineHeight: tokens_1.caption.lineHeight,
|
|
90
|
+
letterSpacing: tokens_1.caption.letterSpacing,
|
|
81
91
|
color: tagTokens.fg,
|
|
82
|
-
}, selectable: false, children: children }), onRemove && !disabled ? (
|
|
92
|
+
}, selectable: false, children: children }), onRemove && !disabled ? ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: onRemove, hitSlop: 4, accessibilityRole: "button", accessibilityLabel: `Remove ${children}`, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "close", size: tagTokens.closeSize, color: tagTokens.fg }) })) : null] }));
|
|
83
93
|
}
|
|
84
94
|
// ---------------------------------------------------------------------------
|
|
85
95
|
// SelectSeparator — visual divider
|
|
86
96
|
// ---------------------------------------------------------------------------
|
|
87
|
-
|
|
88
|
-
const { components } = useTheme();
|
|
97
|
+
function SelectSeparator() {
|
|
98
|
+
const { components, scheme } = (0, theme_1.useTheme)();
|
|
89
99
|
const tokens = components.select.separator;
|
|
90
|
-
|
|
100
|
+
const selectColors = scheme.select;
|
|
101
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: { paddingVertical: tokens.marginY }, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
|
|
91
102
|
height: 1,
|
|
92
103
|
backgroundColor: selectColors.separator,
|
|
93
104
|
} }) }));
|
|
@@ -95,18 +106,19 @@ export function SelectSeparator() {
|
|
|
95
106
|
// ---------------------------------------------------------------------------
|
|
96
107
|
// SelectGroup — labelled group of options
|
|
97
108
|
// ---------------------------------------------------------------------------
|
|
98
|
-
|
|
99
|
-
const { components } = useTheme();
|
|
109
|
+
function SelectGroup({ label: groupLabel, children }) {
|
|
110
|
+
const { components, scheme } = (0, theme_1.useTheme)();
|
|
100
111
|
const tokens = components.select.group;
|
|
101
|
-
|
|
112
|
+
const textTokens = scheme.text;
|
|
113
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
|
|
102
114
|
paddingHorizontal: tokens.paddingX,
|
|
103
115
|
paddingVertical: tokens.labelPaddingY,
|
|
104
|
-
}, children:
|
|
105
|
-
fontFamily: fontFamily.sans,
|
|
106
|
-
fontWeight: fontWeight.regular,
|
|
107
|
-
fontSize: caption.fontSize,
|
|
108
|
-
lineHeight: caption.lineHeight,
|
|
109
|
-
letterSpacing: caption.letterSpacing,
|
|
116
|
+
}, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
117
|
+
fontFamily: tokens_1.fontFamily.sans,
|
|
118
|
+
fontWeight: tokens_1.fontWeight.regular,
|
|
119
|
+
fontSize: tokens_1.caption.fontSize,
|
|
120
|
+
lineHeight: tokens_1.caption.lineHeight,
|
|
121
|
+
letterSpacing: tokens_1.caption.letterSpacing,
|
|
110
122
|
color: textTokens.description,
|
|
111
123
|
textTransform: 'uppercase',
|
|
112
124
|
}, selectable: false, children: groupLabel }) }), children] }));
|
|
@@ -114,16 +126,18 @@ export function SelectGroup({ label: groupLabel, children }) {
|
|
|
114
126
|
// ---------------------------------------------------------------------------
|
|
115
127
|
// SelectOption — individual option row
|
|
116
128
|
// ---------------------------------------------------------------------------
|
|
117
|
-
|
|
129
|
+
function SelectOption({ value, children: optionLabel, description, icon, disabled = false, }) {
|
|
118
130
|
const ctx = useSelectContext();
|
|
119
|
-
const { components } = useTheme();
|
|
131
|
+
const { components, scheme } = (0, theme_1.useTheme)();
|
|
120
132
|
const tokens = components.select.option;
|
|
121
|
-
const
|
|
133
|
+
const selectColors = scheme.select;
|
|
134
|
+
const textTokens = scheme.text;
|
|
135
|
+
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
122
136
|
const isSelected = ctx.selectedValues.includes(value);
|
|
123
|
-
const labelTokens = label[BODY_SCALE[ctx.size]];
|
|
124
|
-
const bodyTokens = body[BODY_SCALE[ctx.size]];
|
|
137
|
+
const labelTokens = tokens_1.label[BODY_SCALE[ctx.size]];
|
|
138
|
+
const bodyTokens = tokens_1.body[BODY_SCALE[ctx.size]];
|
|
125
139
|
// Register this option with the parent Select
|
|
126
|
-
useEffect(() => {
|
|
140
|
+
(0, react_1.useEffect)(() => {
|
|
127
141
|
ctx.registerOption(value, { label: optionLabel, icon });
|
|
128
142
|
return () => ctx.unregisterOption(value);
|
|
129
143
|
// Only re-register when value or label change
|
|
@@ -139,8 +153,8 @@ export function SelectOption({ value, children: optionLabel, description, icon,
|
|
|
139
153
|
: isHovered
|
|
140
154
|
? selectColors.option.hover
|
|
141
155
|
: selectColors.option.default;
|
|
142
|
-
const resolvedIcon = typeof icon === 'string' ? (
|
|
143
|
-
return (
|
|
156
|
+
const resolvedIcon = typeof icon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: icon, size: ICON_SIZE, color: colors.fg })) : (icon);
|
|
157
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { onPress: () => {
|
|
144
158
|
if (!disabled)
|
|
145
159
|
ctx.onSelect(value);
|
|
146
160
|
}, onHoverIn: () => setIsHovered(true), onHoverOut: () => setIsHovered(false), disabled: disabled, accessibilityRole: "menuitem", accessibilityLabel: optionLabel, accessibilityState: { selected: isSelected, disabled }, style: {
|
|
@@ -151,54 +165,59 @@ export function SelectOption({ value, children: optionLabel, description, icon,
|
|
|
151
165
|
paddingVertical: tokens.paddingY,
|
|
152
166
|
borderRadius: tokens.borderRadius,
|
|
153
167
|
backgroundColor: colors.bg,
|
|
154
|
-
}, children: [resolvedIcon ? (
|
|
155
|
-
fontFamily: fontFamily.sans,
|
|
156
|
-
fontWeight: fontWeight.medium,
|
|
168
|
+
}, children: [resolvedIcon ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width: ICON_SIZE, height: ICON_SIZE }, children: resolvedIcon })) : null, (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: { flex: 1, justifyContent: 'center' }, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
169
|
+
fontFamily: tokens_1.fontFamily.sans,
|
|
170
|
+
fontWeight: tokens_1.fontWeight.medium,
|
|
157
171
|
fontSize: labelTokens.fontSize,
|
|
158
172
|
lineHeight: labelTokens.lineHeight,
|
|
159
173
|
letterSpacing: labelTokens.letterSpacing,
|
|
160
174
|
color: colors.fg,
|
|
161
|
-
}, selectable: false, children: optionLabel }), description ? (
|
|
162
|
-
fontFamily: fontFamily.sans,
|
|
163
|
-
fontWeight: fontWeight.regular,
|
|
175
|
+
}, selectable: false, children: optionLabel }), description ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
176
|
+
fontFamily: tokens_1.fontFamily.sans,
|
|
177
|
+
fontWeight: tokens_1.fontWeight.regular,
|
|
164
178
|
fontSize: bodyTokens.fontSize,
|
|
165
179
|
lineHeight: bodyTokens.lineHeight,
|
|
166
180
|
letterSpacing: bodyTokens.letterSpacing,
|
|
167
181
|
color: disabled ? colors.fg : textTokens.description,
|
|
168
|
-
}, numberOfLines: 1, selectable: false, children: description })) : null] }), isSelected && !disabled ? (
|
|
182
|
+
}, numberOfLines: 1, selectable: false, children: description })) : null] }), isSelected && !disabled ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width: ICON_SIZE, height: ICON_SIZE }, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "check", size: ICON_SIZE, color: colors.fg }) })) : null] }));
|
|
169
183
|
}
|
|
170
|
-
|
|
171
|
-
const { components } = useTheme();
|
|
184
|
+
function SelectContent({ children, style }) {
|
|
185
|
+
const { components, scheme } = (0, theme_1.useTheme)();
|
|
172
186
|
const tokens = components.select.content;
|
|
173
|
-
|
|
187
|
+
const surfaceTokens = scheme.surface;
|
|
188
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
174
189
|
{
|
|
175
190
|
backgroundColor: surfaceTokens.overlay.bg,
|
|
176
|
-
borderWidth: controlTokens.borderWidth,
|
|
191
|
+
borderWidth: tokens_1.controlTokens.borderWidth,
|
|
177
192
|
borderColor: surfaceTokens.overlay.border,
|
|
178
193
|
borderRadius: surfaceTokens.overlay.borderRadius,
|
|
179
194
|
paddingVertical: tokens.paddingY,
|
|
180
195
|
maxHeight: CONTENT_MAX_HEIGHT,
|
|
181
|
-
...(Platform.OS === 'web' ? SHADOW_WEB : SHADOW_NATIVE),
|
|
196
|
+
...(react_native_1.Platform.OS === 'web' ? SHADOW_WEB : SHADOW_NATIVE),
|
|
182
197
|
},
|
|
183
198
|
style,
|
|
184
|
-
], children:
|
|
199
|
+
], children: (0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { nestedScrollEnabled: true, keyboardShouldPersistTaps: "handled", showsVerticalScrollIndicator: true, children: children }) }));
|
|
185
200
|
}
|
|
186
201
|
// ---------------------------------------------------------------------------
|
|
187
202
|
// Select — main component (trigger + dropdown overlay)
|
|
188
203
|
// ---------------------------------------------------------------------------
|
|
189
|
-
|
|
190
|
-
const { components } = useTheme();
|
|
204
|
+
function Select({ type = 'single', size = 'default', label: formLabel, helperText, placeholder = 'Select...', leadingIcon, disabled = false, error = false, value, onValueChange, values, onValuesChange, searchValue, onSearchChange, children, style, accessibilityLabel, }) {
|
|
205
|
+
const { components, scheme } = (0, theme_1.useTheme)();
|
|
191
206
|
const inputTokens = components.input[size];
|
|
192
|
-
const
|
|
193
|
-
const
|
|
194
|
-
const
|
|
195
|
-
const
|
|
196
|
-
const
|
|
207
|
+
const intentColors = scheme.intents;
|
|
208
|
+
const disabledColors = scheme.disabled;
|
|
209
|
+
const errorTokens = scheme.error;
|
|
210
|
+
const textTokens = scheme.text;
|
|
211
|
+
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
212
|
+
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
213
|
+
const optionRegistry = (0, react_1.useRef)(new Map());
|
|
214
|
+
const [, forceUpdate] = (0, react_1.useState)(0);
|
|
215
|
+
const selectedValues = (0, react_1.useMemo)(() => {
|
|
197
216
|
if (type === 'multi')
|
|
198
217
|
return values ?? [];
|
|
199
218
|
return value != null ? [value] : [];
|
|
200
219
|
}, [type, value, values]);
|
|
201
|
-
const handleSelect = useCallback((optionValue) => {
|
|
220
|
+
const handleSelect = (0, react_1.useCallback)((optionValue) => {
|
|
202
221
|
if (type === 'multi') {
|
|
203
222
|
const current = values ?? [];
|
|
204
223
|
const next = current.includes(optionValue)
|
|
@@ -211,14 +230,14 @@ export function Select({ type = 'single', size = 'default', label: formLabel, he
|
|
|
211
230
|
setIsOpen(false);
|
|
212
231
|
}
|
|
213
232
|
}, [type, values, onValueChange, onValuesChange]);
|
|
214
|
-
const registerOption = useCallback((val, info) => {
|
|
233
|
+
const registerOption = (0, react_1.useCallback)((val, info) => {
|
|
215
234
|
optionRegistry.current.set(val, info);
|
|
216
235
|
forceUpdate((n) => n + 1);
|
|
217
236
|
}, []);
|
|
218
|
-
const unregisterOption = useCallback((val) => {
|
|
237
|
+
const unregisterOption = (0, react_1.useCallback)((val) => {
|
|
219
238
|
optionRegistry.current.delete(val);
|
|
220
239
|
}, []);
|
|
221
|
-
const ctxValue = useMemo(() => ({
|
|
240
|
+
const ctxValue = (0, react_1.useMemo)(() => ({
|
|
222
241
|
type,
|
|
223
242
|
size,
|
|
224
243
|
selectedValues,
|
|
@@ -227,8 +246,8 @@ export function Select({ type = 'single', size = 'default', label: formLabel, he
|
|
|
227
246
|
unregisterOption,
|
|
228
247
|
}), [type, size, selectedValues, handleSelect, registerOption, unregisterOption]);
|
|
229
248
|
// Resolve typography scales
|
|
230
|
-
const labelTypo = label[LABEL_SCALE[size]];
|
|
231
|
-
const bodyTypo = body[BODY_SCALE[size]];
|
|
249
|
+
const labelTypo = tokens_1.label[LABEL_SCALE[size]];
|
|
250
|
+
const bodyTypo = tokens_1.body[BODY_SCALE[size]];
|
|
232
251
|
// Resolve trigger border colour
|
|
233
252
|
const triggerBorderColor = disabled
|
|
234
253
|
? disabledColors.border
|
|
@@ -246,7 +265,7 @@ export function Select({ type = 'single', size = 'default', label: formLabel, he
|
|
|
246
265
|
? disabledColors.fg
|
|
247
266
|
: intentColors.neutral.default.default.fg;
|
|
248
267
|
// Resolve leading icon
|
|
249
|
-
const resolvedLeadingIcon = typeof leadingIcon === 'string' ? (
|
|
268
|
+
const resolvedLeadingIcon = typeof leadingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: leadingIcon, size: ICON_SIZE, color: triggerFgColor })) : (leadingIcon);
|
|
250
269
|
// Get display text for single select
|
|
251
270
|
const getSelectedLabel = () => {
|
|
252
271
|
if (type === 'single' || type === 'combobox') {
|
|
@@ -259,8 +278,8 @@ export function Select({ type = 'single', size = 'default', label: formLabel, he
|
|
|
259
278
|
};
|
|
260
279
|
const displayText = getSelectedLabel();
|
|
261
280
|
// Escape key dismisses the dropdown (web)
|
|
262
|
-
useEffect(() => {
|
|
263
|
-
if (!isOpen || Platform.OS !== 'web')
|
|
281
|
+
(0, react_1.useEffect)(() => {
|
|
282
|
+
if (!isOpen || react_native_1.Platform.OS !== 'web')
|
|
264
283
|
return;
|
|
265
284
|
const handleKeyDown = (e) => {
|
|
266
285
|
if (e.key === 'Escape') {
|
|
@@ -271,17 +290,17 @@ export function Select({ type = 'single', size = 'default', label: formLabel, he
|
|
|
271
290
|
document.addEventListener('keydown', handleKeyDown);
|
|
272
291
|
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
273
292
|
}, [isOpen]);
|
|
274
|
-
return (
|
|
293
|
+
return ((0, jsx_runtime_1.jsx)(SelectCtx.Provider, { value: ctxValue, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
275
294
|
{ alignSelf: 'stretch', gap: components.input.fieldGap, zIndex: isOpen ? 1000 : 0 },
|
|
276
295
|
style,
|
|
277
|
-
], children: [formLabel ? (
|
|
278
|
-
fontFamily: fontFamily.sans,
|
|
279
|
-
fontWeight: fontWeight.medium,
|
|
296
|
+
], children: [formLabel ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
297
|
+
fontFamily: tokens_1.fontFamily.sans,
|
|
298
|
+
fontWeight: tokens_1.fontWeight.medium,
|
|
280
299
|
fontSize: labelTypo.fontSize,
|
|
281
300
|
lineHeight: labelTypo.lineHeight,
|
|
282
301
|
letterSpacing: labelTypo.letterSpacing,
|
|
283
302
|
color: triggerFgColor,
|
|
284
|
-
}, selectable: false, children: formLabel })) : null,
|
|
303
|
+
}, selectable: false, children: formLabel })) : null, (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: { position: 'relative' }, children: [(0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { onPress: () => {
|
|
285
304
|
if (!disabled)
|
|
286
305
|
setIsOpen(!isOpen);
|
|
287
306
|
}, onHoverIn: () => setIsHovered(true), onHoverOut: () => setIsHovered(false), disabled: disabled, accessibilityRole: "button", accessibilityLabel: accessibilityLabel || formLabel || 'Select option', accessibilityState: { disabled, expanded: isOpen }, style: {
|
|
@@ -291,10 +310,10 @@ export function Select({ type = 'single', size = 'default', label: formLabel, he
|
|
|
291
310
|
paddingHorizontal: inputTokens.paddingX,
|
|
292
311
|
paddingVertical: inputTokens.paddingY,
|
|
293
312
|
borderRadius: inputTokens.borderRadius,
|
|
294
|
-
borderWidth: controlTokens.borderWidth,
|
|
313
|
+
borderWidth: tokens_1.controlTokens.borderWidth,
|
|
295
314
|
borderColor: triggerBorderColor,
|
|
296
315
|
backgroundColor: triggerBgColor,
|
|
297
|
-
}, children: [resolvedLeadingIcon ? (
|
|
316
|
+
}, children: [resolvedLeadingIcon ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width: ICON_SIZE, height: ICON_SIZE }, children: resolvedLeadingIcon })) : null, type === 'multi' ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
|
|
298
317
|
flex: 1,
|
|
299
318
|
flexDirection: 'row',
|
|
300
319
|
flexWrap: 'wrap',
|
|
@@ -303,14 +322,14 @@ export function Select({ type = 'single', size = 'default', label: formLabel, he
|
|
|
303
322
|
}, children: selectedValues.length > 0
|
|
304
323
|
? selectedValues.map((val) => {
|
|
305
324
|
const info = optionRegistry.current.get(val);
|
|
306
|
-
return (
|
|
325
|
+
return ((0, jsx_runtime_1.jsx)(SelectTag, { disabled: disabled, onRemove: disabled
|
|
307
326
|
? undefined
|
|
308
327
|
: () => {
|
|
309
328
|
const next = selectedValues.filter((v) => v !== val);
|
|
310
329
|
onValuesChange?.(next);
|
|
311
330
|
}, children: info?.label ?? val }, val));
|
|
312
331
|
})
|
|
313
|
-
: renderPlaceholder(placeholder, bodyTypo) })) : type === 'combobox' ? (
|
|
332
|
+
: renderPlaceholder(placeholder, bodyTypo, textTokens.description) })) : type === 'combobox' ? ((0, jsx_runtime_1.jsx)(react_native_1.TextInput, { value: searchValue ?? displayText ?? '', onChangeText: (text) => {
|
|
314
333
|
onSearchChange?.(text);
|
|
315
334
|
if (!isOpen)
|
|
316
335
|
setIsOpen(true);
|
|
@@ -319,28 +338,28 @@ export function Select({ type = 'single', size = 'default', label: formLabel, he
|
|
|
319
338
|
setIsOpen(true);
|
|
320
339
|
}, placeholder: placeholder, placeholderTextColor: textTokens.description, editable: !disabled, style: {
|
|
321
340
|
flex: 1,
|
|
322
|
-
fontFamily: fontFamily.sans,
|
|
323
|
-
fontWeight: fontWeight.regular,
|
|
341
|
+
fontFamily: tokens_1.fontFamily.sans,
|
|
342
|
+
fontWeight: tokens_1.fontWeight.regular,
|
|
324
343
|
fontSize: bodyTypo.fontSize,
|
|
325
344
|
lineHeight: bodyTypo.lineHeight,
|
|
326
345
|
letterSpacing: bodyTypo.letterSpacing,
|
|
327
346
|
color: triggerFgColor,
|
|
328
347
|
padding: 0,
|
|
329
|
-
...(Platform.OS === 'web'
|
|
348
|
+
...(react_native_1.Platform.OS === 'web'
|
|
330
349
|
? { outlineWidth: 0 }
|
|
331
350
|
: {}),
|
|
332
|
-
}, accessibilityLabel: accessibilityLabel || formLabel || 'Search' })) : (
|
|
333
|
-
fontFamily: fontFamily.sans,
|
|
334
|
-
fontWeight: fontWeight.regular,
|
|
351
|
+
}, accessibilityLabel: accessibilityLabel || formLabel || 'Search' })) : ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: { flex: 1 }, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { numberOfLines: 1, style: {
|
|
352
|
+
fontFamily: tokens_1.fontFamily.sans,
|
|
353
|
+
fontWeight: tokens_1.fontWeight.regular,
|
|
335
354
|
fontSize: bodyTypo.fontSize,
|
|
336
355
|
lineHeight: bodyTypo.lineHeight,
|
|
337
356
|
letterSpacing: bodyTypo.letterSpacing,
|
|
338
357
|
color: displayText
|
|
339
358
|
? triggerFgColor
|
|
340
359
|
: textTokens.description,
|
|
341
|
-
}, selectable: false, children: displayText ?? placeholder }) })),
|
|
360
|
+
}, selectable: false, children: displayText ?? placeholder }) })), (0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: isOpen
|
|
342
361
|
? { transform: [{ rotate: '180deg' }] }
|
|
343
|
-
: undefined, children:
|
|
362
|
+
: undefined, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "keyboard_arrow_down", size: CHEVRON_SIZE, color: triggerFgColor }) })] }), isOpen ? ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: () => setIsOpen(false), accessibilityRole: "button", accessibilityLabel: "Close select", style: react_native_1.Platform.select({
|
|
344
363
|
web: {
|
|
345
364
|
position: 'fixed',
|
|
346
365
|
top: 0,
|
|
@@ -356,7 +375,7 @@ export function Select({ type = 'single', size = 'default', label: formLabel, he
|
|
|
356
375
|
width: 99999,
|
|
357
376
|
height: 99999,
|
|
358
377
|
},
|
|
359
|
-
}) })) : null,
|
|
378
|
+
}) })) : null, (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
360
379
|
{
|
|
361
380
|
position: 'absolute',
|
|
362
381
|
top: '100%',
|
|
@@ -366,26 +385,25 @@ export function Select({ type = 'single', size = 'default', label: formLabel, he
|
|
|
366
385
|
zIndex: 1,
|
|
367
386
|
},
|
|
368
387
|
!isOpen && { display: 'none' },
|
|
369
|
-
], children:
|
|
370
|
-
fontFamily: fontFamily.sans,
|
|
371
|
-
fontWeight: fontWeight.regular,
|
|
372
|
-
fontSize: caption.fontSize,
|
|
373
|
-
lineHeight: caption.lineHeight,
|
|
374
|
-
letterSpacing: caption.letterSpacing,
|
|
388
|
+
], children: (0, jsx_runtime_1.jsx)(SelectContent, { children: children }) })] }), helperText ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
389
|
+
fontFamily: tokens_1.fontFamily.sans,
|
|
390
|
+
fontWeight: tokens_1.fontWeight.regular,
|
|
391
|
+
fontSize: tokens_1.caption.fontSize,
|
|
392
|
+
lineHeight: tokens_1.caption.lineHeight,
|
|
393
|
+
letterSpacing: tokens_1.caption.letterSpacing,
|
|
375
394
|
color: error ? errorTokens.fg : textTokens.description,
|
|
376
395
|
}, selectable: false, children: helperText })) : null] }) }));
|
|
377
396
|
}
|
|
378
397
|
// ---------------------------------------------------------------------------
|
|
379
398
|
// Helpers
|
|
380
399
|
// ---------------------------------------------------------------------------
|
|
381
|
-
function renderPlaceholder(text, typo) {
|
|
382
|
-
return (
|
|
383
|
-
fontFamily: fontFamily.sans,
|
|
384
|
-
fontWeight: fontWeight.regular,
|
|
400
|
+
function renderPlaceholder(text, typo, color) {
|
|
401
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
402
|
+
fontFamily: tokens_1.fontFamily.sans,
|
|
403
|
+
fontWeight: tokens_1.fontWeight.regular,
|
|
385
404
|
fontSize: typo.fontSize,
|
|
386
405
|
lineHeight: typo.lineHeight,
|
|
387
406
|
letterSpacing: typo.letterSpacing,
|
|
388
|
-
color
|
|
407
|
+
color,
|
|
389
408
|
}, selectable: false, children: text }));
|
|
390
409
|
}
|
|
391
|
-
//# sourceMappingURL=Select.js.map
|
|
@@ -1,2 +1 @@
|
|
|
1
1
|
export { Select, SelectOption, SelectGroup, SelectSeparator, SelectTag, SelectContent, type SelectProps, type SelectSize, type SelectType, type SelectOptionProps, type SelectGroupProps, type SelectTagProps, type SelectContentProps, } from './Select';
|
|
2
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SelectContent = exports.SelectTag = exports.SelectSeparator = exports.SelectGroup = exports.SelectOption = exports.Select = void 0;
|
|
4
|
+
var Select_1 = require("./Select");
|
|
5
|
+
Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return Select_1.Select; } });
|
|
6
|
+
Object.defineProperty(exports, "SelectOption", { enumerable: true, get: function () { return Select_1.SelectOption; } });
|
|
7
|
+
Object.defineProperty(exports, "SelectGroup", { enumerable: true, get: function () { return Select_1.SelectGroup; } });
|
|
8
|
+
Object.defineProperty(exports, "SelectSeparator", { enumerable: true, get: function () { return Select_1.SelectSeparator; } });
|
|
9
|
+
Object.defineProperty(exports, "SelectTag", { enumerable: true, get: function () { return Select_1.SelectTag; } });
|
|
10
|
+
Object.defineProperty(exports, "SelectContent", { enumerable: true, get: function () { return Select_1.SelectContent; } });
|