@castui/cast-ui 4.2.0 → 4.2.2
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 +45 -1
- package/dist/components/Alert/Alert.d.ts +0 -1
- package/dist/components/Alert/Alert.js +22 -20
- package/dist/components/Alert/index.d.ts +0 -1
- package/dist/components/Alert/index.js +5 -2
- package/dist/components/Avatar/Avatar.d.ts +0 -1
- package/dist/components/Avatar/Avatar.js +15 -13
- package/dist/components/Avatar/index.d.ts +0 -1
- package/dist/components/Avatar/index.js +5 -2
- package/dist/components/Badge/Badge.d.ts +0 -1
- package/dist/components/Badge/Badge.js +20 -18
- package/dist/components/Badge/index.d.ts +0 -1
- package/dist/components/Badge/index.js +5 -2
- 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 +0 -1
- package/dist/components/Card/Card.js +27 -25
- package/dist/components/Card/index.d.ts +0 -1
- package/dist/components/Card/index.js +5 -2
- package/dist/components/Checkbox/Checkbox.d.ts +0 -1
- package/dist/components/Checkbox/Checkbox.js +23 -21
- package/dist/components/Checkbox/index.d.ts +0 -1
- package/dist/components/Checkbox/index.js +5 -2
- package/dist/components/Chip/Chip.d.ts +0 -1
- package/dist/components/Chip/Chip.js +22 -20
- package/dist/components/Chip/index.d.ts +0 -1
- package/dist/components/Chip/index.js +5 -2
- package/dist/components/Dialog/Dialog.d.ts +0 -1
- package/dist/components/Dialog/Dialog.js +30 -27
- package/dist/components/Dialog/index.d.ts +0 -1
- package/dist/components/Dialog/index.js +6 -2
- package/dist/components/Divider/Divider.d.ts +0 -1
- package/dist/components/Divider/Divider.js +12 -10
- package/dist/components/Divider/index.d.ts +0 -1
- package/dist/components/Divider/index.js +5 -2
- package/dist/components/Icon/Icon.d.ts +5 -3
- package/dist/components/Icon/Icon.js +14 -8
- package/dist/components/Icon/index.d.ts +0 -1
- package/dist/components/Icon/index.js +5 -2
- package/dist/components/Input/Input.d.ts +0 -1
- package/dist/components/Input/Input.js +37 -35
- package/dist/components/Input/index.d.ts +0 -1
- package/dist/components/Input/index.js +5 -2
- package/dist/components/List/List.d.ts +0 -1
- package/dist/components/List/List.js +46 -41
- package/dist/components/List/index.d.ts +0 -1
- package/dist/components/List/index.js +8 -2
- package/dist/components/Popover/Popover.d.ts +0 -1
- package/dist/components/Popover/Popover.js +11 -9
- package/dist/components/Popover/index.d.ts +0 -1
- package/dist/components/Popover/index.js +5 -2
- package/dist/components/Radio/Radio.d.ts +0 -1
- package/dist/components/Radio/Radio.js +29 -26
- package/dist/components/Radio/index.d.ts +0 -1
- package/dist/components/Radio/index.js +6 -2
- package/dist/components/Select/Select.d.ts +0 -1
- package/dist/components/Select/Select.js +102 -95
- package/dist/components/Select/index.d.ts +0 -1
- package/dist/components/Select/index.js +10 -2
- package/dist/components/Skeleton/Skeleton.d.ts +0 -1
- package/dist/components/Skeleton/Skeleton.js +22 -15
- package/dist/components/Skeleton/index.d.ts +0 -1
- package/dist/components/Skeleton/index.js +5 -2
- package/dist/components/Toast/Toast.d.ts +0 -1
- package/dist/components/Toast/Toast.js +23 -21
- package/dist/components/Toast/index.d.ts +0 -1
- package/dist/components/Toast/index.js +5 -2
- package/dist/components/Toggle/Toggle.d.ts +0 -1
- package/dist/components/Toggle/Toggle.js +20 -18
- package/dist/components/Toggle/index.d.ts +0 -1
- package/dist/components/Toggle/index.js +5 -2
- package/dist/components/Tooltip/Tooltip.d.ts +0 -1
- package/dist/components/Tooltip/Tooltip.js +14 -12
- package/dist/components/Tooltip/index.d.ts +0 -1
- package/dist/components/Tooltip/index.js +5 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +81 -22
- package/dist/theme/ThemeContext.d.ts +0 -1
- package/dist/theme/ThemeContext.js +20 -17
- package/dist/theme/index.d.ts +0 -1
- package/dist/theme/index.js +8 -3
- package/dist/theme/themes.d.ts +0 -1
- package/dist/theme/themes.js +4 -2
- package/dist/theme/types.d.ts +0 -1
- package/dist/theme/types.js +2 -2
- package/dist/tokens/colors.d.ts +0 -1
- package/dist/tokens/colors.js +25 -23
- package/dist/tokens/index.d.ts +0 -1
- 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/Alert/Alert.d.ts.map +0 -1
- package/dist/components/Alert/Alert.js.map +0 -1
- package/dist/components/Alert/index.d.ts.map +0 -1
- package/dist/components/Alert/index.js.map +0 -1
- package/dist/components/Avatar/Avatar.d.ts.map +0 -1
- package/dist/components/Avatar/Avatar.js.map +0 -1
- package/dist/components/Avatar/index.d.ts.map +0 -1
- package/dist/components/Avatar/index.js.map +0 -1
- package/dist/components/Badge/Badge.d.ts.map +0 -1
- package/dist/components/Badge/Badge.js.map +0 -1
- package/dist/components/Badge/index.d.ts.map +0 -1
- package/dist/components/Badge/index.js.map +0 -1
- 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/Card/Card.d.ts.map +0 -1
- package/dist/components/Card/Card.js.map +0 -1
- package/dist/components/Card/index.d.ts.map +0 -1
- package/dist/components/Card/index.js.map +0 -1
- package/dist/components/Checkbox/Checkbox.d.ts.map +0 -1
- package/dist/components/Checkbox/Checkbox.js.map +0 -1
- package/dist/components/Checkbox/index.d.ts.map +0 -1
- package/dist/components/Checkbox/index.js.map +0 -1
- package/dist/components/Chip/Chip.d.ts.map +0 -1
- package/dist/components/Chip/Chip.js.map +0 -1
- package/dist/components/Chip/index.d.ts.map +0 -1
- package/dist/components/Chip/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/Divider/Divider.d.ts.map +0 -1
- package/dist/components/Divider/Divider.js.map +0 -1
- package/dist/components/Divider/index.d.ts.map +0 -1
- package/dist/components/Divider/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/Input/Input.d.ts.map +0 -1
- package/dist/components/Input/Input.js.map +0 -1
- package/dist/components/Input/index.d.ts.map +0 -1
- package/dist/components/Input/index.js.map +0 -1
- package/dist/components/List/List.d.ts.map +0 -1
- package/dist/components/List/List.js.map +0 -1
- package/dist/components/List/index.d.ts.map +0 -1
- package/dist/components/List/index.js.map +0 -1
- package/dist/components/Popover/Popover.d.ts.map +0 -1
- package/dist/components/Popover/Popover.js.map +0 -1
- package/dist/components/Popover/index.d.ts.map +0 -1
- package/dist/components/Popover/index.js.map +0 -1
- package/dist/components/Radio/Radio.d.ts.map +0 -1
- package/dist/components/Radio/Radio.js.map +0 -1
- package/dist/components/Radio/index.d.ts.map +0 -1
- package/dist/components/Radio/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/components/Skeleton/Skeleton.d.ts.map +0 -1
- package/dist/components/Skeleton/Skeleton.js.map +0 -1
- package/dist/components/Skeleton/index.d.ts.map +0 -1
- package/dist/components/Skeleton/index.js.map +0 -1
- package/dist/components/Toast/Toast.d.ts.map +0 -1
- package/dist/components/Toast/Toast.js.map +0 -1
- package/dist/components/Toast/index.d.ts.map +0 -1
- package/dist/components/Toast/index.js.map +0 -1
- package/dist/components/Toggle/Toggle.d.ts.map +0 -1
- package/dist/components/Toggle/Toggle.js.map +0 -1
- package/dist/components/Toggle/index.d.ts.map +0 -1
- package/dist/components/Toggle/index.js.map +0 -1
- package/dist/components/Tooltip/Tooltip.d.ts.map +0 -1
- package/dist/components/Tooltip/Tooltip.js.map +0 -1
- package/dist/components/Tooltip/index.d.ts.map +0 -1
- package/dist/components/Tooltip/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
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Checkbox = Checkbox;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
2
5
|
/**
|
|
3
6
|
* Checkbox — binary (or tri-state) choice control.
|
|
4
7
|
*
|
|
@@ -11,29 +14,29 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
14
|
* (sizes track the `size` prop; gap tracks density). Colours come from the
|
|
12
15
|
* active theme scheme's `checkbox` set + the focus-ring colour.
|
|
13
16
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const react_1 = require("react");
|
|
18
|
+
const react_native_1 = require("react-native");
|
|
19
|
+
const theme_1 = require("../../theme");
|
|
20
|
+
const Icon_1 = require("../Icon");
|
|
21
|
+
const tokens_1 = require("../../tokens");
|
|
19
22
|
/** Maps checkbox size → label typography scale */
|
|
20
23
|
const LABEL_SCALE = {
|
|
21
24
|
small: 'sm',
|
|
22
25
|
default: 'md',
|
|
23
26
|
large: 'lg',
|
|
24
27
|
};
|
|
25
|
-
|
|
26
|
-
const { components, scheme } = useTheme();
|
|
28
|
+
function Checkbox({ checked = false, onChange, children, size = 'default', disabled = false, style, accessibilityLabel, }) {
|
|
29
|
+
const { components, scheme } = (0, theme_1.useTheme)();
|
|
27
30
|
const checkboxColors = scheme.checkbox;
|
|
28
31
|
const tokens = components.checkbox;
|
|
29
32
|
const sizeTokens = tokens[size];
|
|
30
|
-
const labelTokens = label[LABEL_SCALE[size]];
|
|
31
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
32
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
33
|
+
const labelTokens = tokens_1.label[LABEL_SCALE[size]];
|
|
34
|
+
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
35
|
+
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
33
36
|
const isIndeterminate = checked === 'indeterminate';
|
|
34
37
|
const isChecked = checked === true;
|
|
35
38
|
const isOn = isChecked || isIndeterminate;
|
|
36
|
-
const handlePress = useCallback(() => {
|
|
39
|
+
const handlePress = (0, react_1.useCallback)(() => {
|
|
37
40
|
if (!disabled)
|
|
38
41
|
onChange?.(!isChecked);
|
|
39
42
|
}, [disabled, onChange, isChecked]);
|
|
@@ -45,7 +48,7 @@ export function Checkbox({ checked = false, onChange, children, size = 'default'
|
|
|
45
48
|
if (disabled) {
|
|
46
49
|
boxBg = checkboxColors.box.disabled.bg;
|
|
47
50
|
boxBorderColor = checkboxColors.box.disabled.border;
|
|
48
|
-
boxBorderWidth = controlTokens.borderWidth;
|
|
51
|
+
boxBorderWidth = tokens_1.controlTokens.borderWidth;
|
|
49
52
|
}
|
|
50
53
|
else if (isOn) {
|
|
51
54
|
boxBg = checkboxColors.box.checked.bg;
|
|
@@ -62,17 +65,17 @@ export function Checkbox({ checked = false, onChange, children, size = 'default'
|
|
|
62
65
|
}
|
|
63
66
|
else if (isHovered) {
|
|
64
67
|
boxBorderColor = checkboxColors.box.uncheckedHover.border;
|
|
65
|
-
boxBorderWidth = controlTokens.borderWidth;
|
|
68
|
+
boxBorderWidth = tokens_1.controlTokens.borderWidth;
|
|
66
69
|
}
|
|
67
70
|
else {
|
|
68
71
|
boxBorderColor = checkboxColors.box.uncheckedDefault.border;
|
|
69
|
-
boxBorderWidth = controlTokens.borderWidth;
|
|
72
|
+
boxBorderWidth = tokens_1.controlTokens.borderWidth;
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
const glyphColor = disabled
|
|
73
76
|
? checkboxColors.icon.disabled
|
|
74
77
|
: checkboxColors.icon.default;
|
|
75
|
-
return (
|
|
78
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { onPress: handlePress, disabled: disabled, onHoverIn: () => setIsHovered(true), onHoverOut: () => setIsHovered(false), onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), accessibilityRole: "checkbox", accessibilityLabel: accessibilityLabel || children, accessibilityState: {
|
|
76
79
|
checked: isIndeterminate ? 'mixed' : isChecked,
|
|
77
80
|
disabled,
|
|
78
81
|
}, style: [
|
|
@@ -82,7 +85,7 @@ export function Checkbox({ checked = false, onChange, children, size = 'default'
|
|
|
82
85
|
gap: tokens.gap,
|
|
83
86
|
},
|
|
84
87
|
style,
|
|
85
|
-
], children: [
|
|
88
|
+
], children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
|
|
86
89
|
width: sizeTokens.indicatorSize,
|
|
87
90
|
height: sizeTokens.indicatorSize,
|
|
88
91
|
borderRadius: tokens.borderRadius,
|
|
@@ -91,9 +94,9 @@ export function Checkbox({ checked = false, onChange, children, size = 'default'
|
|
|
91
94
|
borderColor: boxBorderColor,
|
|
92
95
|
alignItems: 'center',
|
|
93
96
|
justifyContent: 'center',
|
|
94
|
-
}, children: isChecked ? (
|
|
95
|
-
fontFamily: fontFamily.sans,
|
|
96
|
-
fontWeight: fontWeight.medium,
|
|
97
|
+
}, children: isChecked ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "check", size: sizeTokens.iconSize, color: glyphColor })) : isIndeterminate ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "remove", size: sizeTokens.iconSize, color: glyphColor })) : null }), children ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
98
|
+
fontFamily: tokens_1.fontFamily.sans,
|
|
99
|
+
fontWeight: tokens_1.fontWeight.medium,
|
|
97
100
|
fontSize: labelTokens.fontSize,
|
|
98
101
|
lineHeight: labelTokens.lineHeight,
|
|
99
102
|
letterSpacing: labelTokens.letterSpacing,
|
|
@@ -102,4 +105,3 @@ export function Checkbox({ checked = false, onChange, children, size = 'default'
|
|
|
102
105
|
: checkboxColors.label.default,
|
|
103
106
|
}, selectable: false, children: children })) : null] }));
|
|
104
107
|
}
|
|
105
|
-
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Checkbox = void 0;
|
|
4
|
+
var Checkbox_1 = require("./Checkbox");
|
|
5
|
+
Object.defineProperty(exports, "Checkbox", { enumerable: true, get: function () { return Checkbox_1.Checkbox; } });
|
|
@@ -44,4 +44,3 @@ export type ChipProps = {
|
|
|
44
44
|
accessibilityLabel?: string;
|
|
45
45
|
};
|
|
46
46
|
export declare function Chip({ children, intent, variant, size, selected, disabled, leadingIcon, onPress, onRemove, style, accessibilityLabel, }: ChipProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
-
//# sourceMappingURL=Chip.d.ts.map
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Chip = Chip;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
2
5
|
/**
|
|
3
6
|
* Chip — compact, interactive pill for filters, selections, and tokens.
|
|
4
7
|
*
|
|
@@ -15,11 +18,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
15
18
|
* subtle → intent subtle (transparent bg/border)
|
|
16
19
|
* The `selected` state renders the intent's active colours.
|
|
17
20
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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 Icon_1 = require("../Icon");
|
|
23
26
|
// ---------------------------------------------------------------------------
|
|
24
27
|
// Constants
|
|
25
28
|
// ---------------------------------------------------------------------------
|
|
@@ -32,16 +35,16 @@ const LABEL_SCALE = {
|
|
|
32
35
|
// ---------------------------------------------------------------------------
|
|
33
36
|
// Component
|
|
34
37
|
// ---------------------------------------------------------------------------
|
|
35
|
-
|
|
36
|
-
const { components, scheme } = useTheme();
|
|
38
|
+
function Chip({ children, intent = 'neutral', variant = 'outline', size = 'default', selected = false, disabled = false, leadingIcon, onPress, onRemove, style, accessibilityLabel, }) {
|
|
39
|
+
const { components, scheme } = (0, theme_1.useTheme)();
|
|
37
40
|
const intentColors = scheme.intents;
|
|
38
41
|
const disabledColors = scheme.disabled;
|
|
39
42
|
const sizeTokens = components.chip[size];
|
|
40
|
-
const labelTokens = label[LABEL_SCALE[size]];
|
|
41
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
43
|
+
const labelTokens = tokens_1.label[LABEL_SCALE[size]];
|
|
44
|
+
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
42
45
|
const prominence = variant === 'outline' ? 'default' : 'subtle';
|
|
43
46
|
// Resolve colours. Priority: disabled > selected/pressed > hover > default
|
|
44
|
-
const resolveColors = useCallback((pressed) => {
|
|
47
|
+
const resolveColors = (0, react_1.useCallback)((pressed) => {
|
|
45
48
|
if (disabled)
|
|
46
49
|
return disabledColors;
|
|
47
50
|
const states = intentColors[intent][prominence];
|
|
@@ -52,10 +55,10 @@ export function Chip({ children, intent = 'neutral', variant = 'outline', size =
|
|
|
52
55
|
return states.default;
|
|
53
56
|
}, [disabled, intent, prominence, selected, isHovered, intentColors, disabledColors]);
|
|
54
57
|
const isInteractive = !disabled && (onPress != null || onRemove != null);
|
|
55
|
-
return (
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: onPress, disabled: disabled || onPress == null, onHoverIn: () => setIsHovered(true), onHoverOut: () => setIsHovered(false), accessibilityRole: onPress ? 'button' : 'text', accessibilityLabel: accessibilityLabel || children, accessibilityState: { disabled, selected }, style: style, children: ({ pressed }) => {
|
|
56
59
|
const colors = resolveColors(pressed && isInteractive);
|
|
57
|
-
const resolvedLeading = typeof leadingIcon === 'string' ? (
|
|
58
|
-
return (
|
|
60
|
+
const resolvedLeading = typeof leadingIcon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: leadingIcon, size: sizeTokens.iconSize, color: colors.fg })) : (leadingIcon);
|
|
61
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: {
|
|
59
62
|
flexDirection: 'row',
|
|
60
63
|
alignItems: 'center',
|
|
61
64
|
justifyContent: 'center',
|
|
@@ -64,17 +67,16 @@ export function Chip({ children, intent = 'neutral', variant = 'outline', size =
|
|
|
64
67
|
paddingHorizontal: sizeTokens.paddingX,
|
|
65
68
|
paddingVertical: sizeTokens.paddingY,
|
|
66
69
|
borderRadius: components.chip.borderRadius,
|
|
67
|
-
borderWidth: controlTokens.borderWidth,
|
|
70
|
+
borderWidth: tokens_1.controlTokens.borderWidth,
|
|
68
71
|
borderColor: colors.border,
|
|
69
72
|
backgroundColor: colors.bg,
|
|
70
|
-
}, children: [resolvedLeading ? (
|
|
71
|
-
fontFamily: fontFamily.sans,
|
|
72
|
-
fontWeight: fontWeight.medium,
|
|
73
|
+
}, children: [resolvedLeading ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width: sizeTokens.iconSize, height: sizeTokens.iconSize }, children: resolvedLeading })) : null, (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
74
|
+
fontFamily: tokens_1.fontFamily.sans,
|
|
75
|
+
fontWeight: tokens_1.fontWeight.medium,
|
|
73
76
|
fontSize: labelTokens.fontSize,
|
|
74
77
|
lineHeight: labelTokens.lineHeight,
|
|
75
78
|
letterSpacing: labelTokens.letterSpacing,
|
|
76
79
|
color: colors.fg,
|
|
77
|
-
}, selectable: false, children: children }), onRemove ? (
|
|
80
|
+
}, selectable: false, children: children }), onRemove ? ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: disabled ? undefined : onRemove, disabled: disabled, hitSlop: 6, accessibilityRole: "button", accessibilityLabel: `Remove ${children}`, style: { width: sizeTokens.iconSize, height: sizeTokens.iconSize }, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "close", size: sizeTokens.iconSize, color: colors.fg }) })) : null] }));
|
|
78
81
|
} }));
|
|
79
82
|
}
|
|
80
|
-
//# sourceMappingURL=Chip.js.map
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Chip = void 0;
|
|
4
|
+
var Chip_1 = require("./Chip");
|
|
5
|
+
Object.defineProperty(exports, "Chip", { enumerable: true, get: function () { return Chip_1.Chip; } });
|
|
@@ -54,4 +54,3 @@ export type DialogProps = DialogContentProps & {
|
|
|
54
54
|
*/
|
|
55
55
|
export declare function DialogContent({ title: titleText, description, icon, size, children, primaryAction, secondaryAction, style, accessibilityLabel, }: DialogContentProps): import("react/jsx-runtime").JSX.Element;
|
|
56
56
|
export declare function Dialog({ open, onClose, ...contentProps }: DialogProps): import("react/jsx-runtime").JSX.Element;
|
|
57
|
-
//# sourceMappingURL=Dialog.d.ts.map
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DialogContent = DialogContent;
|
|
4
|
+
exports.Dialog = Dialog;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
const theme_1 = require("../../theme");
|
|
8
|
+
const Button_1 = require("../Button");
|
|
9
|
+
const Icon_1 = require("../Icon");
|
|
10
|
+
const tokens_1 = require("../../tokens");
|
|
7
11
|
// ---------------------------------------------------------------------------
|
|
8
12
|
// Constants
|
|
9
13
|
// ---------------------------------------------------------------------------
|
|
@@ -48,61 +52,60 @@ const SHADOW_NATIVE = {
|
|
|
48
52
|
* Use this for static display (e.g., Storybook visual stories)
|
|
49
53
|
* or when building custom overlay implementations.
|
|
50
54
|
*/
|
|
51
|
-
|
|
52
|
-
const { components, colors, scheme } = useTheme();
|
|
55
|
+
function DialogContent({ title: titleText, description, icon, size = 'default', children, primaryAction, secondaryAction, style, accessibilityLabel, }) {
|
|
56
|
+
const { components, colors, scheme } = (0, theme_1.useTheme)();
|
|
53
57
|
const surfaceTokens = scheme.surface;
|
|
54
58
|
const textTokens = scheme.text;
|
|
55
59
|
const sizeTokens = components.dialog[size];
|
|
56
|
-
const titleTokens = title[TYPO_SCALE[size]];
|
|
57
|
-
const bodyTokens = body[TYPO_SCALE[size]];
|
|
60
|
+
const titleTokens = tokens_1.title[TYPO_SCALE[size]];
|
|
61
|
+
const bodyTokens = tokens_1.body[TYPO_SCALE[size]];
|
|
58
62
|
const buttonSize = BUTTON_SIZE[size];
|
|
59
63
|
const fgColor = colors.neutral.default.default.fg;
|
|
60
|
-
const resolvedIcon = typeof icon === 'string' ? (
|
|
64
|
+
const resolvedIcon = typeof icon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: icon, size: sizeTokens.iconSize, color: fgColor })) : (icon);
|
|
61
65
|
const hasActions = primaryAction || secondaryAction;
|
|
62
|
-
return (
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { accessibilityRole: "alert", accessibilityLabel: accessibilityLabel || titleText, style: [
|
|
63
67
|
{
|
|
64
68
|
width: DIALOG_WIDTH[size],
|
|
65
69
|
maxWidth: '100%',
|
|
66
70
|
backgroundColor: surfaceTokens.overlay.bg,
|
|
67
|
-
borderWidth: controlTokens.borderWidth,
|
|
71
|
+
borderWidth: tokens_1.controlTokens.borderWidth,
|
|
68
72
|
borderColor: surfaceTokens.overlay.border,
|
|
69
73
|
borderRadius: surfaceTokens.overlay.borderRadius,
|
|
70
74
|
padding: sizeTokens.padding,
|
|
71
75
|
gap: sizeTokens.gap,
|
|
72
|
-
...(Platform.OS === 'web' ? SHADOW_WEB : SHADOW_NATIVE),
|
|
76
|
+
...(react_native_1.Platform.OS === 'web' ? SHADOW_WEB : SHADOW_NATIVE),
|
|
73
77
|
},
|
|
74
78
|
style,
|
|
75
|
-
], children: [
|
|
76
|
-
fontFamily: fontFamily.sans,
|
|
77
|
-
fontWeight: fontWeight.medium,
|
|
79
|
+
], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: { gap: TITLE_DESC_GAP }, children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: { gap: HEADER_ICON_GAP }, children: [resolvedIcon, (0, jsx_runtime_1.jsx)(react_native_1.Text, { accessibilityRole: "header", style: {
|
|
80
|
+
fontFamily: tokens_1.fontFamily.sans,
|
|
81
|
+
fontWeight: tokens_1.fontWeight.medium,
|
|
78
82
|
fontSize: titleTokens.fontSize,
|
|
79
83
|
lineHeight: titleTokens.lineHeight,
|
|
80
84
|
letterSpacing: titleTokens.letterSpacing,
|
|
81
85
|
color: fgColor,
|
|
82
|
-
}, children: titleText })] }), description ? (
|
|
83
|
-
fontFamily: fontFamily.sans,
|
|
84
|
-
fontWeight: fontWeight.regular,
|
|
86
|
+
}, children: titleText })] }), description ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
87
|
+
fontFamily: tokens_1.fontFamily.sans,
|
|
88
|
+
fontWeight: tokens_1.fontWeight.regular,
|
|
85
89
|
fontSize: bodyTokens.fontSize,
|
|
86
90
|
lineHeight: bodyTokens.lineHeight,
|
|
87
91
|
letterSpacing: bodyTokens.letterSpacing,
|
|
88
92
|
color: textTokens.description,
|
|
89
|
-
}, children: description })) : null] }), children, hasActions ? (
|
|
93
|
+
}, children: description })) : null] }), children, hasActions ? ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: {
|
|
90
94
|
flexDirection: 'row',
|
|
91
95
|
justifyContent: 'flex-end',
|
|
92
96
|
gap: sizeTokens.gap,
|
|
93
|
-
}, children: [secondaryAction ? (
|
|
97
|
+
}, children: [secondaryAction ? ((0, jsx_runtime_1.jsx)(Button_1.Button, { intent: "neutral", prominence: "default", size: buttonSize, onPress: secondaryAction.onPress, children: secondaryAction.label })) : null, primaryAction ? ((0, jsx_runtime_1.jsx)(Button_1.Button, { intent: "brand", prominence: "bold", size: buttonSize, onPress: primaryAction.onPress, children: primaryAction.label })) : null] })) : null] }));
|
|
94
98
|
}
|
|
95
99
|
// ---------------------------------------------------------------------------
|
|
96
100
|
// Dialog — full modal with backdrop
|
|
97
101
|
// ---------------------------------------------------------------------------
|
|
98
|
-
|
|
99
|
-
const { scheme } = useTheme();
|
|
102
|
+
function Dialog({ open, onClose, ...contentProps }) {
|
|
103
|
+
const { scheme } = (0, theme_1.useTheme)();
|
|
100
104
|
const overlayTokens = scheme.overlay;
|
|
101
|
-
return (
|
|
105
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { visible: open, transparent: true, animationType: "fade", onRequestClose: onClose, children: (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: onClose, accessibilityRole: "button", accessibilityLabel: "Close dialog", style: {
|
|
102
106
|
flex: 1,
|
|
103
107
|
backgroundColor: `rgba(0, 0, 0, ${overlayTokens.scrimOpacity})`,
|
|
104
108
|
justifyContent: 'center',
|
|
105
109
|
alignItems: 'center',
|
|
106
|
-
}, children:
|
|
110
|
+
}, children: (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: (e) => e.stopPropagation(), accessibilityRole: "none", style: { maxWidth: '90%' }, children: (0, jsx_runtime_1.jsx)(DialogContent, { ...contentProps }) }) }) }));
|
|
107
111
|
}
|
|
108
|
-
//# sourceMappingURL=Dialog.js.map
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DialogContent = exports.Dialog = void 0;
|
|
4
|
+
var Dialog_1 = require("./Dialog");
|
|
5
|
+
Object.defineProperty(exports, "Dialog", { enumerable: true, get: function () { return Dialog_1.Dialog; } });
|
|
6
|
+
Object.defineProperty(exports, "DialogContent", { enumerable: true, get: function () { return Dialog_1.DialogContent; } });
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Divider = Divider;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const theme_1 = require("../../theme");
|
|
7
|
+
const tokens_1 = require("../../tokens");
|
|
8
|
+
function Divider({ orientation = 'horizontal', color, style, }) {
|
|
9
|
+
const { scheme } = (0, theme_1.useTheme)();
|
|
7
10
|
const resolvedColor = color ?? scheme.surface.overlay.border;
|
|
8
11
|
const isVertical = orientation === 'vertical';
|
|
9
|
-
return (
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [
|
|
10
13
|
isVertical
|
|
11
|
-
? { alignSelf: 'stretch', width: controlTokens.borderWidth }
|
|
12
|
-
: { alignSelf: 'stretch', height: controlTokens.borderWidth },
|
|
14
|
+
? { alignSelf: 'stretch', width: tokens_1.controlTokens.borderWidth }
|
|
15
|
+
: { alignSelf: 'stretch', height: tokens_1.controlTokens.borderWidth },
|
|
13
16
|
{ backgroundColor: resolvedColor },
|
|
14
17
|
style,
|
|
15
18
|
] }));
|
|
16
19
|
}
|
|
17
|
-
//# sourceMappingURL=Divider.js.map
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Divider = void 0;
|
|
4
|
+
var Divider_1 = require("./Divider");
|
|
5
|
+
Object.defineProperty(exports, "Divider", { enumerable: true, get: function () { return Divider_1.Divider; } });
|
|
@@ -10,10 +10,13 @@
|
|
|
10
10
|
* runtime dependencies (no per-icon SVG packages, no vector-icons dep).
|
|
11
11
|
*
|
|
12
12
|
* Rendering uses font ligatures: the `name` text (e.g. "chevron_right") is
|
|
13
|
-
* shaped into the glyph by the font. Requires the font to be loaded
|
|
13
|
+
* shaped into the glyph by the font. Requires the font to be loaded — on web
|
|
14
|
+
* both the `MaterialSymbolsOutlined` and `Material Symbols Outlined` family
|
|
15
|
+
* names are accepted, so any one of these paths works:
|
|
14
16
|
* - Web: Google Fonts CSS import (see .storybook/preview-head.html), or
|
|
15
17
|
* self-host the same `Material Symbols Outlined` family.
|
|
16
|
-
* - Expo: load `MaterialSymbolsOutlined` via
|
|
18
|
+
* - Expo (iOS, Android, and web): load `MaterialSymbolsOutlined` via
|
|
19
|
+
* expo-font / useFonts — one registration covers all three platforms.
|
|
17
20
|
* - Bare RN: link the .ttf as a font asset (react-native.config.js / Xcode).
|
|
18
21
|
*
|
|
19
22
|
* The fill / weight / grade / opticalSize axes are applied via CSS
|
|
@@ -40,4 +43,3 @@ export type IconProps = {
|
|
|
40
43
|
style?: StyleProp<TextStyle>;
|
|
41
44
|
};
|
|
42
45
|
export declare function Icon({ name, size, color, fill, weight, grade, opticalSize, style, }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
-
//# sourceMappingURL=Icon.d.ts.map
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Icon = Icon;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
// Web accepts both family names so the Google-Fonts CSS path (spaced name)
|
|
7
|
+
// and the expo-font/useFonts path (unspaced key) work without consumer
|
|
8
|
+
// configuration. Fonts registered via expo-font on web keep their object key
|
|
9
|
+
// as the family name.
|
|
10
|
+
const FONT_FAMILY = react_native_1.Platform.select({
|
|
11
|
+
web: 'MaterialSymbolsOutlined, "Material Symbols Outlined", sans-serif',
|
|
5
12
|
default: 'MaterialSymbolsOutlined',
|
|
6
13
|
});
|
|
7
|
-
|
|
14
|
+
function Icon({ name, size = 20, color = '#374151', fill = false, weight = 400, grade = 0, opticalSize, style, }) {
|
|
8
15
|
// Material Symbols variable-font axes — applied on web via fontVariationSettings.
|
|
9
16
|
const opsz = Math.min(48, Math.max(20, opticalSize ?? size));
|
|
10
|
-
const variationStyle = Platform.OS === 'web'
|
|
17
|
+
const variationStyle = react_native_1.Platform.OS === 'web'
|
|
11
18
|
? {
|
|
12
19
|
fontVariationSettings: `'FILL' ${fill ? 1 : 0}, 'wght' ${weight}, 'GRAD' ${grade}, 'opsz' ${opsz}`,
|
|
13
20
|
}
|
|
14
21
|
: null;
|
|
15
|
-
return (
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { selectable: false, accessibilityElementsHidden: true, importantForAccessibility: "no", style: [
|
|
16
23
|
{
|
|
17
24
|
fontFamily: FONT_FAMILY,
|
|
18
25
|
fontSize: size,
|
|
@@ -33,4 +40,3 @@ export function Icon({ name, size = 20, color = '#374151', fill = false, weight
|
|
|
33
40
|
style,
|
|
34
41
|
], children: name }));
|
|
35
42
|
}
|
|
36
|
-
//# sourceMappingURL=Icon.js.map
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Icon = void 0;
|
|
4
|
+
var Icon_1 = require("./Icon");
|
|
5
|
+
Object.defineProperty(exports, "Icon", { enumerable: true, get: function () { return Icon_1.Icon; } });
|
|
@@ -60,4 +60,3 @@ export type InputProps = {
|
|
|
60
60
|
accessibilityLabel?: string;
|
|
61
61
|
};
|
|
62
62
|
export declare function Input({ label: formLabel, helperText, placeholder, value, defaultValue, onChangeText, size, error, disabled, leadingIcon, trailingIcon, secureTextEntry, keyboardType, autoCapitalize, returnKeyType, onSubmitEditing, onFocus, onBlur, style, accessibilityLabel, }: InputProps): import("react/jsx-runtime").JSX.Element;
|
|
63
|
-
//# sourceMappingURL=Input.d.ts.map
|