@castui/cast-ui 4.3.0 → 4.5.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/README.md +3 -1
- package/dist/components/Badge/Badge.js +4 -6
- package/dist/components/Button/Button.d.ts +5 -0
- package/dist/components/Button/Button.js +7 -4
- package/dist/components/Icon/Icon.d.ts +3 -2
- package/dist/components/Icon/Icon.js +7 -5
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/components/Input/Input.js +6 -5
- package/dist/components/Progress/Progress.d.ts +41 -0
- package/dist/components/Progress/Progress.js +93 -0
- package/dist/components/Progress/index.d.ts +1 -0
- package/dist/components/Progress/index.js +5 -0
- package/dist/components/Select/Select.js +9 -8
- package/dist/index.d.ts +3 -2
- package/dist/index.js +6 -2
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/themes.js +27 -9
- package/dist/theme/types.d.ts +14 -0
- package/dist/tokens/colors.d.ts +8 -0
- package/dist/tokens/colors.js +5 -1
- package/dist/tokens/icon.d.ts +8 -0
- package/dist/tokens/icon.js +15 -0
- package/dist/tokens/index.d.ts +2 -1
- package/dist/tokens/index.js +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,8 +15,6 @@ const LABEL_SCALE = {
|
|
|
15
15
|
default: 'md',
|
|
16
16
|
large: 'lg',
|
|
17
17
|
};
|
|
18
|
-
/** Icon size — fixed at 16px, matched to the label baseline. */
|
|
19
|
-
const ICON_SIZE = 16;
|
|
20
18
|
function resolveColors(intent, variant, intentColors) {
|
|
21
19
|
const clrs = intentColors[intent];
|
|
22
20
|
switch (variant) {
|
|
@@ -38,8 +36,8 @@ function Badge({ children, intent = 'neutral', variant = 'solid', size = 'defaul
|
|
|
38
36
|
const sizeTokens = components.badge[size];
|
|
39
37
|
const labelTokens = tokens_1.label[LABEL_SCALE[size]];
|
|
40
38
|
const colors = resolveColors(intent, variant, scheme.intents);
|
|
41
|
-
const resolvedLeading = typeof leadingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: leadingIcon, size:
|
|
42
|
-
const resolvedTrailing = typeof trailingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: trailingIcon, size:
|
|
39
|
+
const resolvedLeading = typeof leadingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: leadingIcon, size: size, color: colors.fg })) : (leadingIcon);
|
|
40
|
+
const resolvedTrailing = typeof trailingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: trailingIcon, size: size, color: colors.fg })) : (trailingIcon);
|
|
43
41
|
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { accessibilityRole: "text", accessibilityLabel: accessibilityLabel || children, style: [
|
|
44
42
|
{
|
|
45
43
|
flexDirection: 'row',
|
|
@@ -60,12 +58,12 @@ function Badge({ children, intent = 'neutral', variant = 'solid', size = 'defaul
|
|
|
60
58
|
height: sizeTokens.dotSize,
|
|
61
59
|
borderRadius: sizeTokens.dotSize / 2,
|
|
62
60
|
backgroundColor: colors.fg,
|
|
63
|
-
} })) : null, resolvedLeading ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width:
|
|
61
|
+
} })) : null, resolvedLeading ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width: tokens_1.iconSize[size], height: tokens_1.iconSize[size] }, children: resolvedLeading })) : null, (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
64
62
|
fontFamily: tokens_1.fontFamily.sans,
|
|
65
63
|
fontWeight: tokens_1.fontWeight.medium,
|
|
66
64
|
fontSize: labelTokens.fontSize,
|
|
67
65
|
lineHeight: labelTokens.lineHeight,
|
|
68
66
|
letterSpacing: labelTokens.letterSpacing,
|
|
69
67
|
color: colors.fg,
|
|
70
|
-
}, selectable: false, children: children }), resolvedTrailing ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width:
|
|
68
|
+
}, selectable: false, children: children }), resolvedTrailing ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width: tokens_1.iconSize[size], height: tokens_1.iconSize[size] }, children: resolvedTrailing })) : null] }));
|
|
71
69
|
}
|
|
@@ -36,4 +36,9 @@ export type ButtonProps = {
|
|
|
36
36
|
/** Accessibility label — falls back to children text if not provided. */
|
|
37
37
|
accessibilityLabel?: string;
|
|
38
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Icon size scales with the button size, matching the Figma <Icon> size
|
|
41
|
+
* variant 1:1 (small→16, default→20, large→24). Button's size names
|
|
42
|
+
* are a subset of the Icon named scale, so `size` is passed straight through.
|
|
43
|
+
*/
|
|
39
44
|
export declare function Button({ children, intent, prominence, size, disabled, leadingIcon, trailingIcon, onPress, style, accessibilityLabel, }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -28,8 +28,11 @@ const LABEL_SCALE = {
|
|
|
28
28
|
default: 'md',
|
|
29
29
|
large: 'lg',
|
|
30
30
|
};
|
|
31
|
-
/**
|
|
32
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Icon size scales with the button size, matching the Figma <Icon> size
|
|
33
|
+
* variant 1:1 (small→16, default→20, large→24). Button's size names
|
|
34
|
+
* are a subset of the Icon named scale, so `size` is passed straight through.
|
|
35
|
+
*/
|
|
33
36
|
// ---------------------------------------------------------------------------
|
|
34
37
|
// Component
|
|
35
38
|
// ---------------------------------------------------------------------------
|
|
@@ -71,8 +74,8 @@ function Button({ children, intent = 'neutral', prominence = 'default', size = '
|
|
|
71
74
|
backgroundColor: stateColors.bg,
|
|
72
75
|
};
|
|
73
76
|
// Resolve icon props — strings become <Icon> with auto-matched colour
|
|
74
|
-
const resolvedLeading = typeof leadingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: leadingIcon, size:
|
|
75
|
-
const resolvedTrailing = typeof trailingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: trailingIcon, size:
|
|
77
|
+
const resolvedLeading = typeof leadingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: leadingIcon, size: size, color: stateColors.fg })) : (leadingIcon);
|
|
78
|
+
const resolvedTrailing = typeof trailingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: trailingIcon, size: size, color: stateColors.fg })) : (trailingIcon);
|
|
76
79
|
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: containerStyle, children: [resolvedLeading, (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
77
80
|
fontFamily: tokens_1.fontFamily.sans,
|
|
78
81
|
fontWeight: tokens_1.fontWeight.medium,
|
|
@@ -24,11 +24,12 @@
|
|
|
24
24
|
* font is loaded). On native they require a matching static/variable font cut.
|
|
25
25
|
*/
|
|
26
26
|
import { type TextStyle, type StyleProp } from 'react-native';
|
|
27
|
+
import { type IconSize } from '../../tokens';
|
|
27
28
|
export type IconProps = {
|
|
28
29
|
/** Material Symbols icon name (e.g., "star", "close", "settings"). */
|
|
29
30
|
name: string;
|
|
30
|
-
/** Icon size
|
|
31
|
-
size?: number;
|
|
31
|
+
/** Icon size — a named scale ('xs' | 'small' | 'default' | 'large' = 12/16/20/24) or an explicit pixel number. Defaults to 20. */
|
|
32
|
+
size?: IconSize | number;
|
|
32
33
|
/** Icon colour. Defaults to "#374151" (neutral fg). */
|
|
33
34
|
color?: string;
|
|
34
35
|
/** Filled vs outlined glyph (FILL axis, 0–1). Defaults to false (outlined). */
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Icon = Icon;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_native_1 = require("react-native");
|
|
6
|
+
const tokens_1 = require("../../tokens");
|
|
6
7
|
// Web accepts both family names so the Google-Fonts CSS path (spaced name)
|
|
7
8
|
// and the expo-font/useFonts path (unspaced key) work without consumer
|
|
8
9
|
// configuration. Fonts registered via expo-font on web keep their object key
|
|
@@ -12,8 +13,9 @@ const FONT_FAMILY = react_native_1.Platform.select({
|
|
|
12
13
|
default: 'MaterialSymbolsOutlined',
|
|
13
14
|
});
|
|
14
15
|
function Icon({ name, size = 20, color = '#374151', fill = false, weight = 400, grade = 0, opticalSize, style, }) {
|
|
16
|
+
const px = typeof size === 'number' ? size : tokens_1.iconSize[size];
|
|
15
17
|
// Material Symbols variable-font axes — applied on web via fontVariationSettings.
|
|
16
|
-
const opsz = Math.min(48, Math.max(20, opticalSize ??
|
|
18
|
+
const opsz = Math.min(48, Math.max(20, opticalSize ?? px));
|
|
17
19
|
const variationStyle = react_native_1.Platform.OS === 'web'
|
|
18
20
|
? {
|
|
19
21
|
fontVariationSettings: `'FILL' ${fill ? 1 : 0}, 'wght' ${weight}, 'GRAD' ${grade}, 'opsz' ${opsz}`,
|
|
@@ -22,12 +24,12 @@ function Icon({ name, size = 20, color = '#374151', fill = false, weight = 400,
|
|
|
22
24
|
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { selectable: false, accessibilityElementsHidden: true, importantForAccessibility: "no", style: [
|
|
23
25
|
{
|
|
24
26
|
fontFamily: FONT_FAMILY,
|
|
25
|
-
fontSize:
|
|
26
|
-
lineHeight:
|
|
27
|
+
fontSize: px,
|
|
28
|
+
lineHeight: px,
|
|
27
29
|
color,
|
|
28
30
|
// Prevent ligature text from taking extra space
|
|
29
|
-
width:
|
|
30
|
-
height:
|
|
31
|
+
width: px,
|
|
32
|
+
height: px,
|
|
31
33
|
textAlign: 'center',
|
|
32
34
|
// Reset any inherited text styles
|
|
33
35
|
fontWeight: '400',
|
|
@@ -26,7 +26,8 @@ const tokens_1 = require("../../tokens");
|
|
|
26
26
|
// ---------------------------------------------------------------------------
|
|
27
27
|
// Constants
|
|
28
28
|
// ---------------------------------------------------------------------------
|
|
29
|
-
|
|
29
|
+
/** Icon size scales with the input size, matching the Figma <Icon> size
|
|
30
|
+
* variant 1:1 (small→16, default→20, large→24) via the shared `iconSize` scale. */
|
|
30
31
|
/** Maps input size → label typography scale (form label text) */
|
|
31
32
|
const LABEL_SCALE = {
|
|
32
33
|
small: 'sm',
|
|
@@ -90,8 +91,8 @@ function Input({ label: formLabel, helperText, placeholder, value, defaultValue,
|
|
|
90
91
|
? errorTokens.fg
|
|
91
92
|
: textTokens.description;
|
|
92
93
|
const iconColor = disabled ? disabledColors.fg : neutral.default.fg;
|
|
93
|
-
const resolvedLeading = typeof leadingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: leadingIcon, size:
|
|
94
|
-
const resolvedTrailing = typeof trailingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: trailingIcon, size:
|
|
94
|
+
const resolvedLeading = typeof leadingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: leadingIcon, size: size, color: iconColor })) : (leadingIcon);
|
|
95
|
+
const resolvedTrailing = typeof trailingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: trailingIcon, size: size, color: iconColor })) : (trailingIcon);
|
|
95
96
|
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
96
97
|
{ alignSelf: 'stretch', gap: components.input.fieldGap },
|
|
97
98
|
style,
|
|
@@ -112,7 +113,7 @@ function Input({ label: formLabel, helperText, placeholder, value, defaultValue,
|
|
|
112
113
|
borderWidth,
|
|
113
114
|
borderColor,
|
|
114
115
|
backgroundColor: bg,
|
|
115
|
-
}, children: [resolvedLeading ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width:
|
|
116
|
+
}, children: [resolvedLeading ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width: tokens_1.iconSize[size], height: tokens_1.iconSize[size] }, children: resolvedLeading })) : null, (0, jsx_runtime_1.jsx)(react_native_1.TextInput, { value: value, defaultValue: defaultValue, onChangeText: onChangeText, placeholder: placeholder, placeholderTextColor: textTokens.placeholder, editable: !disabled, secureTextEntry: secureTextEntry, keyboardType: keyboardType, autoCapitalize: autoCapitalize, returnKeyType: returnKeyType, onSubmitEditing: onSubmitEditing, onFocus: () => {
|
|
116
117
|
setIsFocused(true);
|
|
117
118
|
onFocus?.();
|
|
118
119
|
}, onBlur: () => {
|
|
@@ -130,7 +131,7 @@ function Input({ label: formLabel, helperText, placeholder, value, defaultValue,
|
|
|
130
131
|
...(react_native_1.Platform.OS === 'web'
|
|
131
132
|
? { outlineWidth: 0 }
|
|
132
133
|
: {}),
|
|
133
|
-
} }), resolvedTrailing ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width:
|
|
134
|
+
} }), resolvedTrailing ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width: tokens_1.iconSize[size], height: tokens_1.iconSize[size] }, children: resolvedTrailing })) : null] }), helperText ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
134
135
|
fontFamily: tokens_1.fontFamily.sans,
|
|
135
136
|
fontWeight: tokens_1.fontWeight.regular,
|
|
136
137
|
fontSize: tokens_1.caption.fontSize,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress — linear progress indicator (determinate + indeterminate).
|
|
3
|
+
*
|
|
4
|
+
* Maps 1:1 to the Figma <Progress> component:
|
|
5
|
+
* intent → neutral | brand | danger (fill colour)
|
|
6
|
+
* size → small | default | large (track thickness)
|
|
7
|
+
* value → 0–100 (determinate fill; omit for indeterminate)
|
|
8
|
+
*
|
|
9
|
+
* The track thickness is the one genuinely new token this component introduces
|
|
10
|
+
* (`progress/{size}/track-height`): it is keyed by the `size` prop and is
|
|
11
|
+
* constant across the three densities — like Badge's dot-size or Toggle's
|
|
12
|
+
* track. The pill radius is constant. Progress therefore reads no
|
|
13
|
+
* density-varying spacing.
|
|
14
|
+
*
|
|
15
|
+
* Colours: the fill binds to the intent system
|
|
16
|
+
* (`colors[intent].bold.default.bg`) so it tracks the host intent and any
|
|
17
|
+
* ThemeProvider colour overrides; the track background is the dedicated
|
|
18
|
+
* `control/progress/track/bg` semantic (cool-grey/200 light, cool-grey/700
|
|
19
|
+
* dark, matching the Toggle off-track), so it follows light/dark colour mode.
|
|
20
|
+
*
|
|
21
|
+
* When `value` is omitted (or null) the bar renders an indeterminate sweep.
|
|
22
|
+
*/
|
|
23
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
24
|
+
import type { IntentName } from '../../tokens';
|
|
25
|
+
export type ProgressSize = 'small' | 'default' | 'large';
|
|
26
|
+
export type ProgressProps = {
|
|
27
|
+
/**
|
|
28
|
+
* Completion percentage (0–100). Omit (or pass null) for an indeterminate
|
|
29
|
+
* animated sweep.
|
|
30
|
+
*/
|
|
31
|
+
value?: number | null;
|
|
32
|
+
/** Semantic intent — drives the fill colour. */
|
|
33
|
+
intent?: IntentName;
|
|
34
|
+
/** Size variant — controls track thickness. */
|
|
35
|
+
size?: ProgressSize;
|
|
36
|
+
/** Outer style — use for positioning (margin, width, alignSelf). */
|
|
37
|
+
style?: StyleProp<ViewStyle>;
|
|
38
|
+
/** Accessibility label — describes what is loading. */
|
|
39
|
+
accessibilityLabel?: string;
|
|
40
|
+
};
|
|
41
|
+
export declare function Progress({ value, intent, size, style, accessibilityLabel, }: ProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Progress = Progress;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/**
|
|
6
|
+
* Progress — linear progress indicator (determinate + indeterminate).
|
|
7
|
+
*
|
|
8
|
+
* Maps 1:1 to the Figma <Progress> component:
|
|
9
|
+
* intent → neutral | brand | danger (fill colour)
|
|
10
|
+
* size → small | default | large (track thickness)
|
|
11
|
+
* value → 0–100 (determinate fill; omit for indeterminate)
|
|
12
|
+
*
|
|
13
|
+
* The track thickness is the one genuinely new token this component introduces
|
|
14
|
+
* (`progress/{size}/track-height`): it is keyed by the `size` prop and is
|
|
15
|
+
* constant across the three densities — like Badge's dot-size or Toggle's
|
|
16
|
+
* track. The pill radius is constant. Progress therefore reads no
|
|
17
|
+
* density-varying spacing.
|
|
18
|
+
*
|
|
19
|
+
* Colours: the fill binds to the intent system
|
|
20
|
+
* (`colors[intent].bold.default.bg`) so it tracks the host intent and any
|
|
21
|
+
* ThemeProvider colour overrides; the track background is the dedicated
|
|
22
|
+
* `control/progress/track/bg` semantic (cool-grey/200 light, cool-grey/700
|
|
23
|
+
* dark, matching the Toggle off-track), so it follows light/dark colour mode.
|
|
24
|
+
*
|
|
25
|
+
* When `value` is omitted (or null) the bar renders an indeterminate sweep.
|
|
26
|
+
*/
|
|
27
|
+
const react_1 = require("react");
|
|
28
|
+
const react_native_1 = require("react-native");
|
|
29
|
+
const theme_1 = require("../../theme");
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// Constants
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
/** Fraction of the track the indeterminate sweep bar occupies. */
|
|
34
|
+
const INDETERMINATE_BAR_FRACTION = 0.4;
|
|
35
|
+
const clamp = (n) => Math.max(0, Math.min(100, n));
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// Component
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
function Progress({ value, intent = 'brand', size = 'default', style, accessibilityLabel = 'Loading', }) {
|
|
40
|
+
const { components, colors, scheme } = (0, theme_1.useTheme)();
|
|
41
|
+
const { trackHeight } = components.progress[size];
|
|
42
|
+
const borderRadius = components.progress.borderRadius;
|
|
43
|
+
const fill = colors[intent].bold.default.bg;
|
|
44
|
+
const trackBg = scheme.progress.track;
|
|
45
|
+
const isIndeterminate = value === undefined || value === null;
|
|
46
|
+
const pct = isIndeterminate ? 0 : clamp(value);
|
|
47
|
+
// Track width is needed to drive the indeterminate translateX in px
|
|
48
|
+
// (useNativeDriver can't animate a percentage width).
|
|
49
|
+
const [trackWidth, setTrackWidth] = (0, react_1.useState)(0);
|
|
50
|
+
const onLayout = (e) => setTrackWidth(e.nativeEvent.layout.width);
|
|
51
|
+
const slide = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
|
|
52
|
+
(0, react_1.useEffect)(() => {
|
|
53
|
+
if (!isIndeterminate || trackWidth === 0)
|
|
54
|
+
return;
|
|
55
|
+
slide.setValue(0);
|
|
56
|
+
const loop = react_native_1.Animated.loop(react_native_1.Animated.timing(slide, {
|
|
57
|
+
toValue: 1,
|
|
58
|
+
duration: 1200,
|
|
59
|
+
easing: react_native_1.Easing.inOut(react_native_1.Easing.ease),
|
|
60
|
+
useNativeDriver: true,
|
|
61
|
+
}));
|
|
62
|
+
loop.start();
|
|
63
|
+
return () => loop.stop();
|
|
64
|
+
}, [isIndeterminate, trackWidth, slide]);
|
|
65
|
+
const barWidth = trackWidth * INDETERMINATE_BAR_FRACTION;
|
|
66
|
+
const translateX = slide.interpolate({
|
|
67
|
+
inputRange: [0, 1],
|
|
68
|
+
outputRange: [-barWidth, trackWidth],
|
|
69
|
+
});
|
|
70
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { onLayout: onLayout, accessibilityRole: "progressbar", accessibilityLabel: accessibilityLabel, accessibilityValue: isIndeterminate ? undefined : { min: 0, max: 100, now: Math.round(pct) }, accessibilityState: isIndeterminate ? { busy: true } : undefined, style: [
|
|
71
|
+
{
|
|
72
|
+
width: '100%',
|
|
73
|
+
height: trackHeight,
|
|
74
|
+
borderRadius,
|
|
75
|
+
backgroundColor: trackBg,
|
|
76
|
+
overflow: 'hidden',
|
|
77
|
+
},
|
|
78
|
+
style,
|
|
79
|
+
], children: isIndeterminate ? ((0, jsx_runtime_1.jsx)(react_native_1.Animated.View, { style: {
|
|
80
|
+
position: 'absolute',
|
|
81
|
+
top: 0,
|
|
82
|
+
bottom: 0,
|
|
83
|
+
width: barWidth,
|
|
84
|
+
borderRadius,
|
|
85
|
+
backgroundColor: fill,
|
|
86
|
+
transform: [{ translateX }],
|
|
87
|
+
} })) : ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
|
|
88
|
+
width: `${pct}%`,
|
|
89
|
+
height: '100%',
|
|
90
|
+
borderRadius,
|
|
91
|
+
backgroundColor: fill,
|
|
92
|
+
} })) }));
|
|
93
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Progress, type ProgressProps, type ProgressSize } from './Progress';
|
|
@@ -41,8 +41,9 @@ function useSelectContext() {
|
|
|
41
41
|
// ---------------------------------------------------------------------------
|
|
42
42
|
// Constants
|
|
43
43
|
// ---------------------------------------------------------------------------
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
/** Icon sizes scale with the select size via the shared `iconSize` scale
|
|
45
|
+
* (small→16, default→20, large→24): trigger leading icon, dropdown chevron,
|
|
46
|
+
* and option row icons all track the control size. Tag close uses `closeSize`. */
|
|
46
47
|
const CONTENT_MAX_HEIGHT = 240;
|
|
47
48
|
/** Maps select size → label typography scale (for form label text) */
|
|
48
49
|
const LABEL_SCALE = {
|
|
@@ -153,7 +154,7 @@ function SelectOption({ value, children: optionLabel, description, icon, disable
|
|
|
153
154
|
: isHovered
|
|
154
155
|
? selectColors.option.hover
|
|
155
156
|
: selectColors.option.default;
|
|
156
|
-
const resolvedIcon = typeof icon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: icon, size:
|
|
157
|
+
const resolvedIcon = typeof icon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: icon, size: ctx.size, color: colors.fg })) : (icon);
|
|
157
158
|
return ((0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { onPress: () => {
|
|
158
159
|
if (!disabled)
|
|
159
160
|
ctx.onSelect(value);
|
|
@@ -165,7 +166,7 @@ function SelectOption({ value, children: optionLabel, description, icon, disable
|
|
|
165
166
|
paddingVertical: tokens.paddingY,
|
|
166
167
|
borderRadius: tokens.borderRadius,
|
|
167
168
|
backgroundColor: colors.bg,
|
|
168
|
-
}, children: [resolvedIcon ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width:
|
|
169
|
+
}, children: [resolvedIcon ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width: tokens_1.iconSize[ctx.size], height: tokens_1.iconSize[ctx.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
170
|
fontFamily: tokens_1.fontFamily.sans,
|
|
170
171
|
fontWeight: tokens_1.fontWeight.medium,
|
|
171
172
|
fontSize: labelTokens.fontSize,
|
|
@@ -179,7 +180,7 @@ function SelectOption({ value, children: optionLabel, description, icon, disable
|
|
|
179
180
|
lineHeight: bodyTokens.lineHeight,
|
|
180
181
|
letterSpacing: bodyTokens.letterSpacing,
|
|
181
182
|
color: disabled ? colors.fg : textTokens.description,
|
|
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:
|
|
183
|
+
}, numberOfLines: 1, selectable: false, children: description })) : null] }), isSelected && !disabled ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width: tokens_1.iconSize[ctx.size], height: tokens_1.iconSize[ctx.size] }, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "check", size: ctx.size, color: colors.fg }) })) : null] }));
|
|
183
184
|
}
|
|
184
185
|
function SelectContent({ children, style }) {
|
|
185
186
|
const { components, scheme } = (0, theme_1.useTheme)();
|
|
@@ -265,7 +266,7 @@ function Select({ type = 'single', size = 'default', label: formLabel, helperTex
|
|
|
265
266
|
? disabledColors.fg
|
|
266
267
|
: intentColors.neutral.default.default.fg;
|
|
267
268
|
// Resolve leading icon
|
|
268
|
-
const resolvedLeadingIcon = typeof leadingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: leadingIcon, size:
|
|
269
|
+
const resolvedLeadingIcon = typeof leadingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: leadingIcon, size: size, color: triggerFgColor })) : (leadingIcon);
|
|
269
270
|
// Get display text for single select
|
|
270
271
|
const getSelectedLabel = () => {
|
|
271
272
|
if (type === 'single' || type === 'combobox') {
|
|
@@ -313,7 +314,7 @@ function Select({ type = 'single', size = 'default', label: formLabel, helperTex
|
|
|
313
314
|
borderWidth: tokens_1.controlTokens.borderWidth,
|
|
314
315
|
borderColor: triggerBorderColor,
|
|
315
316
|
backgroundColor: triggerBgColor,
|
|
316
|
-
}, children: [resolvedLeadingIcon ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width:
|
|
317
|
+
}, children: [resolvedLeadingIcon ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width: tokens_1.iconSize[size], height: tokens_1.iconSize[size] }, children: resolvedLeadingIcon })) : null, type === 'multi' ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
|
|
317
318
|
flex: 1,
|
|
318
319
|
flexDirection: 'row',
|
|
319
320
|
flexWrap: 'wrap',
|
|
@@ -359,7 +360,7 @@ function Select({ type = 'single', size = 'default', label: formLabel, helperTex
|
|
|
359
360
|
: textTokens.description,
|
|
360
361
|
}, selectable: false, children: displayText ?? placeholder }) })), (0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: isOpen
|
|
361
362
|
? { transform: [{ rotate: '180deg' }] }
|
|
362
|
-
: undefined, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "
|
|
363
|
+
: undefined, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "arrow_drop_down", size: 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({
|
|
363
364
|
web: {
|
|
364
365
|
position: 'fixed',
|
|
365
366
|
top: 0,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { lightColors, darkColors, colorSchemes, intentColors, disabledColors, controlTokens, surfaceTokens, textTokens, overlayTokens, selectColors, tagTokens, errorTokens, listColors, checkboxColors, toggleColors, radioColors, avatarColors, skeletonColors, fontFamily, fontWeight, label, title, body, heading, display, caption, type IntentName, type ProminenceName, type StateName, type ColorMode, type ColorScheme, type LabelSize, } from './tokens';
|
|
2
|
-
export { ThemeProvider, useTheme, themes, type Theme, type ThemeProviderProps, type DensityTheme, type ComponentTokens, type ButtonSizeTokens, type ButtonThemeTokens, type DialogSizeTokens, type DialogThemeTokens, type InputSizeTokens, type InputThemeTokens, type SelectContentTokens, type SelectOptionTokens, type SelectGroupTokens, type SelectSeparatorTokens, type SelectThemeTokens, type ListItemTokens, type ListSubheaderTokens, type ListThemeTokens, type CheckboxSizeTokens, type CheckboxThemeTokens, type AlertSizeTokens, type AlertThemeTokens, type ToggleSizeTokens, type ToggleThemeTokens, type CardSizeTokens, type CardThemeTokens, type BadgeSizeTokens, type BadgeThemeTokens, type RadioSizeTokens, type RadioThemeTokens, type ToastSizeTokens, type ToastThemeTokens, type ChipSizeTokens, type ChipThemeTokens, type AvatarSizeTokens, type AvatarThemeTokens, type PopoverSizeTokens, type PopoverThemeTokens, type TooltipSizeTokens, type TooltipThemeTokens, type DeepPartial, } from './theme';
|
|
1
|
+
export { lightColors, darkColors, colorSchemes, intentColors, disabledColors, controlTokens, surfaceTokens, textTokens, overlayTokens, selectColors, tagTokens, errorTokens, listColors, checkboxColors, toggleColors, progressColors, radioColors, avatarColors, skeletonColors, fontFamily, fontWeight, label, title, body, heading, display, caption, type IntentName, type ProminenceName, type StateName, type ColorMode, type ColorScheme, type LabelSize, iconSize, type IconSize, } from './tokens';
|
|
2
|
+
export { ThemeProvider, useTheme, themes, type Theme, type ThemeProviderProps, type DensityTheme, type ComponentTokens, type ButtonSizeTokens, type ButtonThemeTokens, type DialogSizeTokens, type DialogThemeTokens, type InputSizeTokens, type InputThemeTokens, type SelectContentTokens, type SelectOptionTokens, type SelectGroupTokens, type SelectSeparatorTokens, type SelectThemeTokens, type ListItemTokens, type ListSubheaderTokens, type ListThemeTokens, type CheckboxSizeTokens, type CheckboxThemeTokens, type AlertSizeTokens, type AlertThemeTokens, type ToggleSizeTokens, type ToggleThemeTokens, type CardSizeTokens, type CardThemeTokens, type BadgeSizeTokens, type BadgeThemeTokens, type RadioSizeTokens, type RadioThemeTokens, type ToastSizeTokens, type ToastThemeTokens, type ChipSizeTokens, type ChipThemeTokens, type AvatarSizeTokens, type AvatarThemeTokens, type PopoverSizeTokens, type PopoverThemeTokens, type TooltipSizeTokens, type TooltipThemeTokens, type ProgressSizeTokens, type ProgressThemeTokens, type DeepPartial, } from './theme';
|
|
3
3
|
export { Button, type ButtonProps, type ButtonSize } from './components/Button';
|
|
4
4
|
export { Icon, type IconProps } from './components/Icon';
|
|
5
5
|
export { Dialog, DialogContent, type DialogProps, type DialogContentProps, type DialogAction, type DialogSize, } from './components/Dialog';
|
|
@@ -20,3 +20,4 @@ export { Popover, type PopoverProps, type PopoverSize, type PopoverDirection, }
|
|
|
20
20
|
export { Skeleton, type SkeletonProps, type SkeletonShape, } from './components/Skeleton';
|
|
21
21
|
export { Tooltip, type TooltipProps, type TooltipSize, type TooltipDirection, } from './components/Tooltip';
|
|
22
22
|
export { Text, type TextProps, type TextType } from './components/Text';
|
|
23
|
+
export { Progress, type ProgressProps, type ProgressSize } from './components/Progress';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.Text = exports.Tooltip = exports.Skeleton = exports.Popover = exports.Avatar = exports.Divider = exports.Chip = exports.Toast = exports.RadioGroup = void 0;
|
|
3
|
+
exports.Badge = exports.Card = exports.Toggle = exports.Alert = exports.Checkbox = exports.ListDivider = exports.ListSubheader = exports.ListItem = exports.List = exports.SelectDropdown = exports.SelectTag = exports.SelectSeparator = exports.SelectGroup = exports.SelectOption = exports.Select = exports.DialogContent = exports.Dialog = exports.Icon = exports.Button = exports.themes = exports.useTheme = exports.ThemeProvider = exports.iconSize = exports.caption = exports.display = exports.heading = exports.body = exports.title = exports.label = exports.fontWeight = exports.fontFamily = exports.skeletonColors = exports.avatarColors = exports.radioColors = exports.progressColors = exports.toggleColors = exports.checkboxColors = exports.listColors = exports.errorTokens = exports.tagTokens = exports.selectColors = exports.overlayTokens = exports.textTokens = exports.surfaceTokens = exports.controlTokens = exports.disabledColors = exports.intentColors = exports.colorSchemes = exports.darkColors = exports.lightColors = void 0;
|
|
4
|
+
exports.Progress = exports.Text = exports.Tooltip = exports.Skeleton = exports.Popover = exports.Avatar = exports.Divider = exports.Chip = exports.Toast = exports.RadioGroup = exports.Radio = exports.Input = void 0;
|
|
5
5
|
// Cast UI — Cross-platform design system component library
|
|
6
6
|
//
|
|
7
7
|
// Tokens
|
|
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "errorTokens", { enumerable: true, get: function
|
|
|
21
21
|
Object.defineProperty(exports, "listColors", { enumerable: true, get: function () { return tokens_1.listColors; } });
|
|
22
22
|
Object.defineProperty(exports, "checkboxColors", { enumerable: true, get: function () { return tokens_1.checkboxColors; } });
|
|
23
23
|
Object.defineProperty(exports, "toggleColors", { enumerable: true, get: function () { return tokens_1.toggleColors; } });
|
|
24
|
+
Object.defineProperty(exports, "progressColors", { enumerable: true, get: function () { return tokens_1.progressColors; } });
|
|
24
25
|
Object.defineProperty(exports, "radioColors", { enumerable: true, get: function () { return tokens_1.radioColors; } });
|
|
25
26
|
Object.defineProperty(exports, "avatarColors", { enumerable: true, get: function () { return tokens_1.avatarColors; } });
|
|
26
27
|
Object.defineProperty(exports, "skeletonColors", { enumerable: true, get: function () { return tokens_1.skeletonColors; } });
|
|
@@ -32,6 +33,7 @@ Object.defineProperty(exports, "body", { enumerable: true, get: function () { re
|
|
|
32
33
|
Object.defineProperty(exports, "heading", { enumerable: true, get: function () { return tokens_1.heading; } });
|
|
33
34
|
Object.defineProperty(exports, "display", { enumerable: true, get: function () { return tokens_1.display; } });
|
|
34
35
|
Object.defineProperty(exports, "caption", { enumerable: true, get: function () { return tokens_1.caption; } });
|
|
36
|
+
Object.defineProperty(exports, "iconSize", { enumerable: true, get: function () { return tokens_1.iconSize; } });
|
|
35
37
|
// Theme
|
|
36
38
|
var theme_1 = require("./theme");
|
|
37
39
|
Object.defineProperty(exports, "ThemeProvider", { enumerable: true, get: function () { return theme_1.ThemeProvider; } });
|
|
@@ -88,3 +90,5 @@ var Tooltip_1 = require("./components/Tooltip");
|
|
|
88
90
|
Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return Tooltip_1.Tooltip; } });
|
|
89
91
|
var Text_1 = require("./components/Text");
|
|
90
92
|
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return Text_1.Text; } });
|
|
93
|
+
var Progress_1 = require("./components/Progress");
|
|
94
|
+
Object.defineProperty(exports, "Progress", { enumerable: true, get: function () { return Progress_1.Progress; } });
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { ThemeProvider, useTheme, type ThemeProviderProps, type Theme } from './ThemeContext';
|
|
2
2
|
export { themes } from './themes';
|
|
3
|
-
export type { DensityTheme, ComponentTokens, ButtonSizeTokens, ButtonThemeTokens, DialogSizeTokens, DialogThemeTokens, InputSizeTokens, InputThemeTokens, SelectContentTokens, SelectOptionTokens, SelectGroupTokens, SelectSeparatorTokens, SelectThemeTokens, ListItemTokens, ListSubheaderTokens, ListThemeTokens, CheckboxSizeTokens, CheckboxThemeTokens, AlertSizeTokens, AlertThemeTokens, ToggleSizeTokens, ToggleThemeTokens, CardSizeTokens, CardThemeTokens, BadgeSizeTokens, BadgeThemeTokens, RadioSizeTokens, RadioThemeTokens, ToastSizeTokens, ToastThemeTokens, ChipSizeTokens, ChipThemeTokens, AvatarSizeTokens, AvatarThemeTokens, PopoverSizeTokens, PopoverThemeTokens, TooltipSizeTokens, TooltipThemeTokens, DeepPartial, } from './types';
|
|
3
|
+
export type { DensityTheme, ComponentTokens, ButtonSizeTokens, ButtonThemeTokens, DialogSizeTokens, DialogThemeTokens, InputSizeTokens, InputThemeTokens, SelectContentTokens, SelectOptionTokens, SelectGroupTokens, SelectSeparatorTokens, SelectThemeTokens, ListItemTokens, ListSubheaderTokens, ListThemeTokens, CheckboxSizeTokens, CheckboxThemeTokens, AlertSizeTokens, AlertThemeTokens, ToggleSizeTokens, ToggleThemeTokens, CardSizeTokens, CardThemeTokens, BadgeSizeTokens, BadgeThemeTokens, RadioSizeTokens, RadioThemeTokens, ToastSizeTokens, ToastThemeTokens, ChipSizeTokens, ChipThemeTokens, AvatarSizeTokens, AvatarThemeTokens, PopoverSizeTokens, PopoverThemeTokens, TooltipSizeTokens, TooltipThemeTokens, ProgressSizeTokens, ProgressThemeTokens, DeepPartial, } from './types';
|
package/dist/theme/themes.js
CHANGED
|
@@ -43,9 +43,9 @@ exports.themes = {
|
|
|
43
43
|
},
|
|
44
44
|
checkbox: {
|
|
45
45
|
gap: 4, borderRadius: 4, focusRingWidth: 2,
|
|
46
|
-
small: { indicatorSize: 16, iconSize:
|
|
47
|
-
default: { indicatorSize: 20, iconSize:
|
|
48
|
-
large: { indicatorSize: 24, iconSize:
|
|
46
|
+
small: { indicatorSize: 16, iconSize: 16 },
|
|
47
|
+
default: { indicatorSize: 20, iconSize: 20 },
|
|
48
|
+
large: { indicatorSize: 24, iconSize: 24 },
|
|
49
49
|
},
|
|
50
50
|
alert: {
|
|
51
51
|
borderRadius: 8,
|
|
@@ -106,6 +106,12 @@ exports.themes = {
|
|
|
106
106
|
small: { paddingX: 4, paddingY: 1 },
|
|
107
107
|
default: { paddingX: 6, paddingY: 2 },
|
|
108
108
|
},
|
|
109
|
+
progress: {
|
|
110
|
+
borderRadius: 9999,
|
|
111
|
+
small: { trackHeight: 4 },
|
|
112
|
+
default: { trackHeight: 8 },
|
|
113
|
+
large: { trackHeight: 12 },
|
|
114
|
+
},
|
|
109
115
|
},
|
|
110
116
|
default: {
|
|
111
117
|
dialog: {
|
|
@@ -137,9 +143,9 @@ exports.themes = {
|
|
|
137
143
|
},
|
|
138
144
|
checkbox: {
|
|
139
145
|
gap: 8, borderRadius: 4, focusRingWidth: 2,
|
|
140
|
-
small: { indicatorSize: 16, iconSize:
|
|
141
|
-
default: { indicatorSize: 20, iconSize:
|
|
142
|
-
large: { indicatorSize: 24, iconSize:
|
|
146
|
+
small: { indicatorSize: 16, iconSize: 16 },
|
|
147
|
+
default: { indicatorSize: 20, iconSize: 20 },
|
|
148
|
+
large: { indicatorSize: 24, iconSize: 24 },
|
|
143
149
|
},
|
|
144
150
|
alert: {
|
|
145
151
|
borderRadius: 8,
|
|
@@ -200,6 +206,12 @@ exports.themes = {
|
|
|
200
206
|
small: { paddingX: 6, paddingY: 2 },
|
|
201
207
|
default: { paddingX: 8, paddingY: 4 },
|
|
202
208
|
},
|
|
209
|
+
progress: {
|
|
210
|
+
borderRadius: 9999,
|
|
211
|
+
small: { trackHeight: 4 },
|
|
212
|
+
default: { trackHeight: 8 },
|
|
213
|
+
large: { trackHeight: 12 },
|
|
214
|
+
},
|
|
203
215
|
},
|
|
204
216
|
comfortable: {
|
|
205
217
|
dialog: {
|
|
@@ -231,9 +243,9 @@ exports.themes = {
|
|
|
231
243
|
},
|
|
232
244
|
checkbox: {
|
|
233
245
|
gap: 12, borderRadius: 4, focusRingWidth: 2,
|
|
234
|
-
small: { indicatorSize: 16, iconSize:
|
|
235
|
-
default: { indicatorSize: 20, iconSize:
|
|
236
|
-
large: { indicatorSize: 24, iconSize:
|
|
246
|
+
small: { indicatorSize: 16, iconSize: 16 },
|
|
247
|
+
default: { indicatorSize: 20, iconSize: 20 },
|
|
248
|
+
large: { indicatorSize: 24, iconSize: 24 },
|
|
237
249
|
},
|
|
238
250
|
alert: {
|
|
239
251
|
borderRadius: 8,
|
|
@@ -294,5 +306,11 @@ exports.themes = {
|
|
|
294
306
|
small: { paddingX: 8, paddingY: 4 },
|
|
295
307
|
default: { paddingX: 10, paddingY: 6 },
|
|
296
308
|
},
|
|
309
|
+
progress: {
|
|
310
|
+
borderRadius: 9999,
|
|
311
|
+
small: { trackHeight: 4 },
|
|
312
|
+
default: { trackHeight: 8 },
|
|
313
|
+
large: { trackHeight: 12 },
|
|
314
|
+
},
|
|
297
315
|
},
|
|
298
316
|
};
|
package/dist/theme/types.d.ts
CHANGED
|
@@ -242,6 +242,19 @@ export type TooltipThemeTokens = {
|
|
|
242
242
|
small: TooltipSizeTokens;
|
|
243
243
|
default: TooltipSizeTokens;
|
|
244
244
|
};
|
|
245
|
+
/** Progress track thickness for one size variant (constant across density,
|
|
246
|
+
* keyed by the `size` prop like Badge dot-size / Toggle track). */
|
|
247
|
+
export type ProgressSizeTokens = {
|
|
248
|
+
trackHeight: number;
|
|
249
|
+
};
|
|
250
|
+
/** Progress tokens — track thickness varies by the `size` prop; the pill
|
|
251
|
+
* radius is constant. No density-varying spacing. */
|
|
252
|
+
export type ProgressThemeTokens = {
|
|
253
|
+
borderRadius: number;
|
|
254
|
+
small: ProgressSizeTokens;
|
|
255
|
+
default: ProgressSizeTokens;
|
|
256
|
+
large: ProgressSizeTokens;
|
|
257
|
+
};
|
|
245
258
|
/**
|
|
246
259
|
* Component-level tokens that vary by density theme.
|
|
247
260
|
* Extended as new components are added to the library.
|
|
@@ -263,6 +276,7 @@ export type ComponentTokens = {
|
|
|
263
276
|
avatar: AvatarThemeTokens;
|
|
264
277
|
popover: PopoverThemeTokens;
|
|
265
278
|
tooltip: TooltipThemeTokens;
|
|
279
|
+
progress: ProgressThemeTokens;
|
|
266
280
|
};
|
|
267
281
|
/** Utility type for partial overrides at any depth */
|
|
268
282
|
export type DeepPartial<T> = {
|
package/dist/tokens/colors.d.ts
CHANGED
|
@@ -188,6 +188,10 @@ export type ColorScheme = {
|
|
|
188
188
|
disabled: string;
|
|
189
189
|
};
|
|
190
190
|
};
|
|
191
|
+
/** Progress colours — track background (the fill uses the intent system) */
|
|
192
|
+
progress: {
|
|
193
|
+
track: string;
|
|
194
|
+
};
|
|
191
195
|
/** Avatar colours — initials/icon fallback surface + foreground */
|
|
192
196
|
avatar: {
|
|
193
197
|
bg: string;
|
|
@@ -348,6 +352,10 @@ export declare const toggleColors: {
|
|
|
348
352
|
disabled: string;
|
|
349
353
|
};
|
|
350
354
|
};
|
|
355
|
+
/** Progress colours — track background (fill comes from the intent system) */
|
|
356
|
+
export declare const progressColors: {
|
|
357
|
+
track: string;
|
|
358
|
+
};
|
|
351
359
|
/** Avatar colours — initials/icon fallback surface + foreground */
|
|
352
360
|
export declare const avatarColors: {
|
|
353
361
|
bg: string;
|
package/dist/tokens/colors.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* the light-scheme values, kept for backwards compatibility.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.listColors = exports.skeletonColors = exports.avatarColors = exports.toggleColors = exports.radioColors = exports.checkboxColors = exports.errorTokens = exports.tagTokens = exports.selectColors = exports.overlayTokens = exports.textTokens = exports.surfaceTokens = exports.controlTokens = exports.disabledColors = exports.intentColors = exports.colorSchemes = exports.darkColors = exports.lightColors = void 0;
|
|
18
|
+
exports.listColors = exports.skeletonColors = exports.avatarColors = exports.progressColors = exports.toggleColors = exports.radioColors = exports.checkboxColors = exports.errorTokens = exports.tagTokens = exports.selectColors = exports.overlayTokens = exports.textTokens = exports.surfaceTokens = exports.controlTokens = exports.disabledColors = exports.intentColors = exports.colorSchemes = exports.darkColors = exports.lightColors = void 0;
|
|
19
19
|
// ---------------------------------------------------------------------------
|
|
20
20
|
// Light scheme — semantic-light mode
|
|
21
21
|
// ---------------------------------------------------------------------------
|
|
@@ -139,6 +139,7 @@ exports.lightColors = {
|
|
|
139
139
|
thumb: '#FFFFFF',
|
|
140
140
|
label: { default: '#374151', disabled: '#9CA3AF' },
|
|
141
141
|
},
|
|
142
|
+
progress: { track: '#E5E7EB' }, // control/progress/track/bg → cool-grey/200
|
|
142
143
|
avatar: { bg: '#F3F4F6', fg: '#374151' },
|
|
143
144
|
skeleton: { bg: '#F3F4F6', highlight: '#E5E7EB' },
|
|
144
145
|
list: {
|
|
@@ -280,6 +281,7 @@ exports.darkColors = {
|
|
|
280
281
|
thumb: '#FFFFFF',
|
|
281
282
|
label: { default: '#E5E7EB', disabled: '#6B7280' },
|
|
282
283
|
},
|
|
284
|
+
progress: { track: '#374151' }, // control/progress/track/bg → cool-grey/700
|
|
283
285
|
avatar: { bg: '#374151', fg: '#E5E7EB' },
|
|
284
286
|
skeleton: { bg: '#1F2937', highlight: '#374151' },
|
|
285
287
|
list: {
|
|
@@ -338,6 +340,8 @@ exports.checkboxColors = exports.lightColors.checkbox;
|
|
|
338
340
|
exports.radioColors = exports.lightColors.radio;
|
|
339
341
|
/** Toggle colours — track (on/off/disabled) + thumb + label */
|
|
340
342
|
exports.toggleColors = exports.lightColors.toggle;
|
|
343
|
+
/** Progress colours — track background (fill comes from the intent system) */
|
|
344
|
+
exports.progressColors = exports.lightColors.progress;
|
|
341
345
|
/** Avatar colours — initials/icon fallback surface + foreground */
|
|
342
346
|
exports.avatarColors = exports.lightColors.avatar;
|
|
343
347
|
/** Skeleton colours — placeholder surface for loading states */
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon size scale — mirrors the Figma `icon/{xs,small,default,large}/size`
|
|
3
|
+
* variables (component collection, aliasing the primitive size scale).
|
|
4
|
+
* Standalone/decorative icons use this named scale; control-embedded icons are
|
|
5
|
+
* sized by their host component's density tokens.
|
|
6
|
+
*/
|
|
7
|
+
export type IconSize = 'xs' | 'small' | 'default' | 'large';
|
|
8
|
+
export declare const iconSize: Record<IconSize, number>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Icon size scale — mirrors the Figma `icon/{xs,small,default,large}/size`
|
|
4
|
+
* variables (component collection, aliasing the primitive size scale).
|
|
5
|
+
* Standalone/decorative icons use this named scale; control-embedded icons are
|
|
6
|
+
* sized by their host component's density tokens.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.iconSize = void 0;
|
|
10
|
+
exports.iconSize = {
|
|
11
|
+
xs: 12,
|
|
12
|
+
small: 16,
|
|
13
|
+
default: 20,
|
|
14
|
+
large: 24,
|
|
15
|
+
};
|
package/dist/tokens/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { lightColors, darkColors, colorSchemes, intentColors, disabledColors, controlTokens, surfaceTokens, textTokens, overlayTokens, selectColors, tagTokens, errorTokens, listColors, checkboxColors, toggleColors, radioColors, avatarColors, skeletonColors, type IntentName, type ProminenceName, type StateName, type ColorMode, type ColorScheme, } from './colors';
|
|
1
|
+
export { lightColors, darkColors, colorSchemes, intentColors, disabledColors, controlTokens, surfaceTokens, textTokens, overlayTokens, selectColors, tagTokens, errorTokens, listColors, checkboxColors, toggleColors, progressColors, radioColors, avatarColors, skeletonColors, type IntentName, type ProminenceName, type StateName, type ColorMode, type ColorScheme, } from './colors';
|
|
2
2
|
export { fontFamily, fontWeight, label, title, body, heading, display, caption, type LabelSize, } from './typography';
|
|
3
|
+
export { iconSize, type IconSize } from './icon';
|
package/dist/tokens/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.caption = exports.display = exports.heading = exports.body = exports.title = exports.label = exports.fontWeight = exports.fontFamily = exports.skeletonColors = exports.avatarColors = exports.radioColors = exports.toggleColors = exports.checkboxColors = exports.listColors = exports.errorTokens = exports.tagTokens = exports.selectColors = exports.overlayTokens = exports.textTokens = exports.surfaceTokens = exports.controlTokens = exports.disabledColors = exports.intentColors = exports.colorSchemes = exports.darkColors = exports.lightColors = void 0;
|
|
3
|
+
exports.iconSize = exports.caption = exports.display = exports.heading = exports.body = exports.title = exports.label = exports.fontWeight = exports.fontFamily = exports.skeletonColors = exports.avatarColors = exports.radioColors = exports.progressColors = exports.toggleColors = exports.checkboxColors = exports.listColors = exports.errorTokens = exports.tagTokens = exports.selectColors = exports.overlayTokens = exports.textTokens = exports.surfaceTokens = exports.controlTokens = exports.disabledColors = exports.intentColors = exports.colorSchemes = exports.darkColors = exports.lightColors = void 0;
|
|
4
4
|
var colors_1 = require("./colors");
|
|
5
5
|
Object.defineProperty(exports, "lightColors", { enumerable: true, get: function () { return colors_1.lightColors; } });
|
|
6
6
|
Object.defineProperty(exports, "darkColors", { enumerable: true, get: function () { return colors_1.darkColors; } });
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "errorTokens", { enumerable: true, get: function
|
|
|
17
17
|
Object.defineProperty(exports, "listColors", { enumerable: true, get: function () { return colors_1.listColors; } });
|
|
18
18
|
Object.defineProperty(exports, "checkboxColors", { enumerable: true, get: function () { return colors_1.checkboxColors; } });
|
|
19
19
|
Object.defineProperty(exports, "toggleColors", { enumerable: true, get: function () { return colors_1.toggleColors; } });
|
|
20
|
+
Object.defineProperty(exports, "progressColors", { enumerable: true, get: function () { return colors_1.progressColors; } });
|
|
20
21
|
Object.defineProperty(exports, "radioColors", { enumerable: true, get: function () { return colors_1.radioColors; } });
|
|
21
22
|
Object.defineProperty(exports, "avatarColors", { enumerable: true, get: function () { return colors_1.avatarColors; } });
|
|
22
23
|
Object.defineProperty(exports, "skeletonColors", { enumerable: true, get: function () { return colors_1.skeletonColors; } });
|
|
@@ -29,3 +30,5 @@ Object.defineProperty(exports, "body", { enumerable: true, get: function () { re
|
|
|
29
30
|
Object.defineProperty(exports, "heading", { enumerable: true, get: function () { return typography_1.heading; } });
|
|
30
31
|
Object.defineProperty(exports, "display", { enumerable: true, get: function () { return typography_1.display; } });
|
|
31
32
|
Object.defineProperty(exports, "caption", { enumerable: true, get: function () { return typography_1.caption; } });
|
|
33
|
+
var icon_1 = require("./icon");
|
|
34
|
+
Object.defineProperty(exports, "iconSize", { enumerable: true, get: function () { return icon_1.iconSize; } });
|
package/package.json
CHANGED