@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.
Files changed (126) hide show
  1. package/README.md +129 -19
  2. package/dist/components/Alert/Alert.d.ts +40 -0
  3. package/dist/components/Alert/Alert.js +71 -0
  4. package/dist/components/Alert/index.d.ts +1 -0
  5. package/dist/components/Alert/index.js +5 -0
  6. package/dist/components/Avatar/Avatar.d.ts +31 -0
  7. package/dist/components/Avatar/Avatar.js +55 -0
  8. package/dist/components/Avatar/index.d.ts +1 -0
  9. package/dist/components/Avatar/index.js +5 -0
  10. package/dist/components/Badge/Badge.d.ts +41 -0
  11. package/dist/components/Badge/Badge.js +71 -0
  12. package/dist/components/Badge/index.d.ts +1 -0
  13. package/dist/components/Badge/index.js +5 -0
  14. package/dist/components/Button/Button.d.ts +0 -1
  15. package/dist/components/Button/Button.js +21 -19
  16. package/dist/components/Button/index.d.ts +0 -1
  17. package/dist/components/Button/index.js +5 -2
  18. package/dist/components/Card/Card.d.ts +41 -0
  19. package/dist/components/Card/Card.js +91 -0
  20. package/dist/components/Card/index.d.ts +1 -0
  21. package/dist/components/Card/index.js +5 -0
  22. package/dist/components/Checkbox/Checkbox.d.ts +32 -0
  23. package/dist/components/Checkbox/Checkbox.js +107 -0
  24. package/dist/components/Checkbox/index.d.ts +1 -0
  25. package/dist/components/Checkbox/index.js +5 -0
  26. package/dist/components/Chip/Chip.d.ts +46 -0
  27. package/dist/components/Chip/Chip.js +82 -0
  28. package/dist/components/Chip/index.d.ts +1 -0
  29. package/dist/components/Chip/index.js +5 -0
  30. package/dist/components/Dialog/Dialog.d.ts +0 -1
  31. package/dist/components/Dialog/Dialog.js +33 -26
  32. package/dist/components/Dialog/index.d.ts +0 -1
  33. package/dist/components/Dialog/index.js +6 -2
  34. package/dist/components/Divider/Divider.d.ts +22 -0
  35. package/dist/components/Divider/Divider.js +19 -0
  36. package/dist/components/Divider/index.d.ts +1 -0
  37. package/dist/components/Divider/index.js +5 -0
  38. package/dist/components/Icon/Icon.d.ts +26 -9
  39. package/dist/components/Icon/Icon.js +16 -6
  40. package/dist/components/Icon/index.d.ts +0 -1
  41. package/dist/components/Icon/index.js +5 -2
  42. package/dist/components/Input/Input.d.ts +62 -0
  43. package/dist/components/Input/Input.js +141 -0
  44. package/dist/components/Input/index.d.ts +1 -0
  45. package/dist/components/Input/index.js +5 -0
  46. package/dist/components/List/List.d.ts +58 -0
  47. package/dist/components/List/List.js +116 -0
  48. package/dist/components/List/index.d.ts +1 -0
  49. package/dist/components/List/index.js +8 -0
  50. package/dist/components/Popover/Popover.d.ts +34 -0
  51. package/dist/components/Popover/Popover.js +62 -0
  52. package/dist/components/Popover/index.d.ts +1 -0
  53. package/dist/components/Popover/index.js +5 -0
  54. package/dist/components/Radio/Radio.d.ts +52 -0
  55. package/dist/components/Radio/Radio.js +127 -0
  56. package/dist/components/Radio/index.d.ts +1 -0
  57. package/dist/components/Radio/index.js +6 -0
  58. package/dist/components/Select/Select.d.ts +0 -1
  59. package/dist/components/Select/Select.js +114 -96
  60. package/dist/components/Select/index.d.ts +0 -1
  61. package/dist/components/Select/index.js +10 -2
  62. package/dist/components/Skeleton/Skeleton.d.ts +33 -0
  63. package/dist/components/Skeleton/Skeleton.js +66 -0
  64. package/dist/components/Skeleton/index.d.ts +1 -0
  65. package/dist/components/Skeleton/index.js +5 -0
  66. package/dist/components/Toast/Toast.d.ts +35 -0
  67. package/dist/components/Toast/Toast.js +79 -0
  68. package/dist/components/Toast/index.d.ts +1 -0
  69. package/dist/components/Toast/index.js +5 -0
  70. package/dist/components/Toggle/Toggle.d.ts +31 -0
  71. package/dist/components/Toggle/Toggle.js +91 -0
  72. package/dist/components/Toggle/index.d.ts +1 -0
  73. package/dist/components/Toggle/index.js +5 -0
  74. package/dist/components/Tooltip/Tooltip.d.ts +34 -0
  75. package/dist/components/Tooltip/Tooltip.js +67 -0
  76. package/dist/components/Tooltip/index.d.ts +1 -0
  77. package/dist/components/Tooltip/index.js +5 -0
  78. package/dist/index.d.ts +17 -3
  79. package/dist/index.js +81 -7
  80. package/dist/theme/ThemeContext.d.ts +24 -8
  81. package/dist/theme/ThemeContext.js +41 -22
  82. package/dist/theme/index.d.ts +1 -2
  83. package/dist/theme/index.js +8 -3
  84. package/dist/theme/themes.d.ts +0 -1
  85. package/dist/theme/themes.js +214 -2
  86. package/dist/theme/types.d.ts +183 -1
  87. package/dist/theme/types.js +2 -2
  88. package/dist/tokens/colors.d.ts +294 -26
  89. package/dist/tokens/colors.js +324 -99
  90. package/dist/tokens/index.d.ts +1 -2
  91. package/dist/tokens/index.js +29 -3
  92. package/dist/tokens/typography.d.ts +0 -1
  93. package/dist/tokens/typography.js +13 -11
  94. package/package.json +13 -2
  95. package/dist/components/Button/Button.d.ts.map +0 -1
  96. package/dist/components/Button/Button.js.map +0 -1
  97. package/dist/components/Button/index.d.ts.map +0 -1
  98. package/dist/components/Button/index.js.map +0 -1
  99. package/dist/components/Dialog/Dialog.d.ts.map +0 -1
  100. package/dist/components/Dialog/Dialog.js.map +0 -1
  101. package/dist/components/Dialog/index.d.ts.map +0 -1
  102. package/dist/components/Dialog/index.js.map +0 -1
  103. package/dist/components/Icon/Icon.d.ts.map +0 -1
  104. package/dist/components/Icon/Icon.js.map +0 -1
  105. package/dist/components/Icon/index.d.ts.map +0 -1
  106. package/dist/components/Icon/index.js.map +0 -1
  107. package/dist/components/Select/Select.d.ts.map +0 -1
  108. package/dist/components/Select/Select.js.map +0 -1
  109. package/dist/components/Select/index.d.ts.map +0 -1
  110. package/dist/components/Select/index.js.map +0 -1
  111. package/dist/index.d.ts.map +0 -1
  112. package/dist/index.js.map +0 -1
  113. package/dist/theme/ThemeContext.d.ts.map +0 -1
  114. package/dist/theme/ThemeContext.js.map +0 -1
  115. package/dist/theme/index.d.ts.map +0 -1
  116. package/dist/theme/index.js.map +0 -1
  117. package/dist/theme/themes.d.ts.map +0 -1
  118. package/dist/theme/themes.js.map +0 -1
  119. package/dist/theme/types.d.ts.map +0 -1
  120. package/dist/theme/types.js.map +0 -1
  121. package/dist/tokens/colors.d.ts.map +0 -1
  122. package/dist/tokens/colors.js.map +0 -1
  123. package/dist/tokens/index.d.ts.map +0 -1
  124. package/dist/tokens/index.js.map +0 -1
  125. package/dist/tokens/typography.d.ts.map +0 -1
  126. package/dist/tokens/typography.js.map +0 -1
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Skeleton — a placeholder block shown while content loads.
3
+ *
4
+ * Maps to the Figma <Skeleton> component (node 307:4191):
5
+ * shape → text | circle | rectangle
6
+ *
7
+ * Each shape sets a sensible default size and corner radius (text: 12×120,
8
+ * 4px radius; circle: 40×40, full radius; rectangle: 80×120, 8px radius). Pass
9
+ * `width`/`height`/`radius` to override. The fill is the cool-grey/100 surface;
10
+ * a subtle opacity pulse runs by default and can be disabled with `animated`.
11
+ *
12
+ * Sizing is intentionally constant across densities — skeletons mirror the
13
+ * layout of the real content they stand in for.
14
+ */
15
+ import { type ViewStyle, type StyleProp, type DimensionValue } from 'react-native';
16
+ export type SkeletonShape = 'text' | 'circle' | 'rectangle';
17
+ export type SkeletonProps = {
18
+ /** Shape preset — sets default size and corner radius. */
19
+ shape?: SkeletonShape;
20
+ /** Width override (number of px or a percentage string). */
21
+ width?: DimensionValue;
22
+ /** Height override (number of px or a percentage string). */
23
+ height?: DimensionValue;
24
+ /** Corner radius override. */
25
+ radius?: number;
26
+ /** Run the opacity pulse animation. Defaults to true. */
27
+ animated?: boolean;
28
+ /** Outer style — use for positioning (margin, flex, alignSelf). */
29
+ style?: StyleProp<ViewStyle>;
30
+ /** Accessibility label. Defaults to "Loading". */
31
+ accessibilityLabel?: string;
32
+ };
33
+ export declare function Skeleton({ shape, width, height, radius, animated, style, accessibilityLabel, }: SkeletonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Skeleton = Skeleton;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ /**
6
+ * Skeleton — a placeholder block shown while content loads.
7
+ *
8
+ * Maps to the Figma <Skeleton> component (node 307:4191):
9
+ * shape → text | circle | rectangle
10
+ *
11
+ * Each shape sets a sensible default size and corner radius (text: 12×120,
12
+ * 4px radius; circle: 40×40, full radius; rectangle: 80×120, 8px radius). Pass
13
+ * `width`/`height`/`radius` to override. The fill is the cool-grey/100 surface;
14
+ * a subtle opacity pulse runs by default and can be disabled with `animated`.
15
+ *
16
+ * Sizing is intentionally constant across densities — skeletons mirror the
17
+ * layout of the real content they stand in for.
18
+ */
19
+ const react_1 = require("react");
20
+ const react_native_1 = require("react-native");
21
+ const theme_1 = require("../../theme");
22
+ /** Default size + corner radius per shape (radius/2, surface/overlay/radius, radius/full). */
23
+ const SHAPE_DEFAULTS = {
24
+ text: { width: 120, height: 12, radius: 4 },
25
+ circle: { width: 40, height: 40, radius: 9999 },
26
+ rectangle: { width: 120, height: 80, radius: 8 },
27
+ };
28
+ // ---------------------------------------------------------------------------
29
+ // Component
30
+ // ---------------------------------------------------------------------------
31
+ function Skeleton({ shape = 'text', width, height, radius, animated = true, style, accessibilityLabel = 'Loading', }) {
32
+ const { scheme } = (0, theme_1.useTheme)();
33
+ const skeletonColors = scheme.skeleton;
34
+ const defaults = SHAPE_DEFAULTS[shape];
35
+ const opacity = (0, react_1.useRef)(new react_native_1.Animated.Value(1)).current;
36
+ (0, react_1.useEffect)(() => {
37
+ if (!animated) {
38
+ opacity.setValue(1);
39
+ return;
40
+ }
41
+ const loop = react_native_1.Animated.loop(react_native_1.Animated.sequence([
42
+ react_native_1.Animated.timing(opacity, {
43
+ toValue: 0.5,
44
+ duration: 700,
45
+ useNativeDriver: true,
46
+ }),
47
+ react_native_1.Animated.timing(opacity, {
48
+ toValue: 1,
49
+ duration: 700,
50
+ useNativeDriver: true,
51
+ }),
52
+ ]));
53
+ loop.start();
54
+ return () => loop.stop();
55
+ }, [animated, opacity]);
56
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Animated.View, { accessibilityRole: "image", accessibilityLabel: accessibilityLabel, style: [
57
+ {
58
+ width: width ?? defaults.width,
59
+ height: height ?? defaults.height,
60
+ borderRadius: radius ?? defaults.radius,
61
+ backgroundColor: skeletonColors.bg,
62
+ opacity,
63
+ },
64
+ style,
65
+ ] }));
66
+ }
@@ -0,0 +1 @@
1
+ export { Skeleton, type SkeletonProps, type SkeletonShape } from './Skeleton';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Skeleton = void 0;
4
+ var Skeleton_1 = require("./Skeleton");
5
+ Object.defineProperty(exports, "Skeleton", { enumerable: true, get: function () { return Skeleton_1.Skeleton; } });
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Toast — transient notification surface with title, description, and dismiss.
3
+ *
4
+ * Maps to the Figma <Toast> component (node 307:3478):
5
+ * intent → neutral | brand | danger (colours the icon + text)
6
+ * size → small | default | large
7
+ *
8
+ * Padding/gap come from the density theme's `toast` tokens (vary by size AND
9
+ * density); icon/close sizes track the `size` prop. The surface uses the
10
+ * overlay tokens (white bg, subtle border, 8px radius); the intent system
11
+ * colours the leading icon, title, description, and close affordance.
12
+ */
13
+ import React from 'react';
14
+ import { type ViewStyle, type StyleProp } from 'react-native';
15
+ import type { IntentName } from '../../tokens';
16
+ export type ToastSize = 'small' | 'default' | 'large';
17
+ export type ToastProps = {
18
+ /** Heading text. */
19
+ title: string;
20
+ /** Supporting description text below the title. */
21
+ children?: string;
22
+ /** Semantic intent — colours the icon and text. */
23
+ intent?: IntentName;
24
+ /** Size variant — controls padding, gap, and typography scale. */
25
+ size?: ToastSize;
26
+ /** Leading icon — Material Symbols name string or a ReactNode. */
27
+ icon?: string | React.ReactNode;
28
+ /** Dismiss handler — renders a close button when provided. */
29
+ onClose?: () => void;
30
+ /** Style override for the outer surface. */
31
+ style?: StyleProp<ViewStyle>;
32
+ /** Accessibility label — falls back to the title text. */
33
+ accessibilityLabel?: string;
34
+ };
35
+ export declare function Toast({ title, children, intent, size, icon, onClose, style, accessibilityLabel, }: ToastProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Toast = Toast;
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 Icon_1 = require("../Icon");
8
+ const tokens_1 = require("../../tokens");
9
+ // ---------------------------------------------------------------------------
10
+ // Constants
11
+ // ---------------------------------------------------------------------------
12
+ /** Maps toast size → title typography scale */
13
+ const TITLE_SCALE = {
14
+ small: 'sm',
15
+ default: 'md',
16
+ large: 'lg',
17
+ };
18
+ /** Maps toast size → body typography scale (description) */
19
+ const BODY_SCALE = {
20
+ small: 'sm',
21
+ default: 'md',
22
+ large: 'lg',
23
+ };
24
+ /** Shadow for web — matches Figma shadow/md */
25
+ const SHADOW_WEB = {
26
+ boxShadow: '0px 2px 4px -2px rgba(0,0,0,0.05), 0px 4px 6px -1px rgba(0,0,0,0.07)',
27
+ };
28
+ /** Shadow for native */
29
+ const SHADOW_NATIVE = {
30
+ shadowColor: '#000000',
31
+ shadowOffset: { width: 0, height: 4 },
32
+ shadowOpacity: 0.07,
33
+ shadowRadius: 6,
34
+ elevation: 4,
35
+ };
36
+ // ---------------------------------------------------------------------------
37
+ // Component
38
+ // ---------------------------------------------------------------------------
39
+ function Toast({ title, children, intent = 'neutral', size = 'default', icon, onClose, style, accessibilityLabel, }) {
40
+ const { components, scheme } = (0, theme_1.useTheme)();
41
+ const intentColors = scheme.intents;
42
+ const surfaceTokens = scheme.surface;
43
+ const tokens = components.toast;
44
+ const sizeTokens = tokens[size];
45
+ const titleTokens = tokens_1.title[TITLE_SCALE[size]];
46
+ const bodyTokens = tokens_1.body[BODY_SCALE[size]];
47
+ const fg = intentColors[intent].default.default.fg;
48
+ const resolvedIcon = typeof icon === 'string' ? ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: icon, size: sizeTokens.iconSize, color: fg })) : (icon);
49
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { accessibilityRole: "alert", accessibilityLabel: accessibilityLabel || title, style: [
50
+ {
51
+ flexDirection: 'row',
52
+ alignItems: 'flex-start',
53
+ gap: sizeTokens.gap,
54
+ padding: sizeTokens.padding,
55
+ minWidth: tokens.minWidth,
56
+ maxWidth: tokens.maxWidth,
57
+ borderRadius: tokens.borderRadius,
58
+ borderWidth: tokens_1.controlTokens.borderWidth,
59
+ borderColor: surfaceTokens.overlay.border,
60
+ backgroundColor: surfaceTokens.overlay.bg,
61
+ ...(react_native_1.Platform.OS === 'web' ? SHADOW_WEB : SHADOW_NATIVE),
62
+ },
63
+ style,
64
+ ], children: [resolvedIcon ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { width: sizeTokens.iconSize, height: sizeTokens.iconSize }, children: resolvedIcon })) : null, (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
65
+ fontFamily: tokens_1.fontFamily.sans,
66
+ fontWeight: tokens_1.fontWeight.medium,
67
+ fontSize: titleTokens.fontSize,
68
+ lineHeight: titleTokens.lineHeight,
69
+ letterSpacing: titleTokens.letterSpacing,
70
+ color: fg,
71
+ }, selectable: false, children: title }), children ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
72
+ fontFamily: tokens_1.fontFamily.sans,
73
+ fontWeight: tokens_1.fontWeight.regular,
74
+ fontSize: bodyTokens.fontSize,
75
+ lineHeight: bodyTokens.lineHeight,
76
+ letterSpacing: bodyTokens.letterSpacing,
77
+ color: fg,
78
+ }, selectable: false, children: children })) : null] }), onClose ? ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: onClose, hitSlop: 8, accessibilityRole: "button", accessibilityLabel: "Dismiss", style: { width: sizeTokens.closeSize, height: sizeTokens.closeSize }, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "close", size: sizeTokens.closeSize, color: fg }) })) : null] }));
79
+ }
@@ -0,0 +1 @@
1
+ export { Toast, type ToastProps, type ToastSize } from './Toast';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Toast = void 0;
4
+ var Toast_1 = require("./Toast");
5
+ Object.defineProperty(exports, "Toast", { enumerable: true, get: function () { return Toast_1.Toast; } });
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Toggle — on/off switch control.
3
+ *
4
+ * Maps to the Figma <Toggle> component (node 275:9974):
5
+ * checked → boolean
6
+ * size → small | default | large
7
+ * state → default | hover | focus | disabled (interaction-driven)
8
+ *
9
+ * Track/thumb sizes come from the density theme's `toggle` tokens (sizes track
10
+ * the `size` prop; gap tracks density). Colours come from the theme's colour
11
+ * scheme (`scheme.toggle` + `scheme.focusRing`).
12
+ */
13
+ import { type ViewStyle, type StyleProp } from 'react-native';
14
+ export type ToggleSize = 'small' | 'default' | 'large';
15
+ export type ToggleProps = {
16
+ /** On/off state. */
17
+ checked?: boolean;
18
+ /** Change handler — receives the next checked value. */
19
+ onChange?: (checked: boolean) => void;
20
+ /** Optional label rendered beside the switch. */
21
+ children?: string;
22
+ /** Size variant — controls track + thumb size. */
23
+ size?: ToggleSize;
24
+ /** Disables interaction and applies muted styling. */
25
+ disabled?: boolean;
26
+ /** Style override for the outer row. */
27
+ style?: StyleProp<ViewStyle>;
28
+ /** Accessibility label — falls back to the label text. */
29
+ accessibilityLabel?: string;
30
+ };
31
+ export declare function Toggle({ checked, onChange, children, size, disabled, style, accessibilityLabel, }: ToggleProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Toggle = Toggle;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ /**
6
+ * Toggle — on/off switch control.
7
+ *
8
+ * Maps to the Figma <Toggle> component (node 275:9974):
9
+ * checked → boolean
10
+ * size → small | default | large
11
+ * state → default | hover | focus | disabled (interaction-driven)
12
+ *
13
+ * Track/thumb sizes come from the density theme's `toggle` tokens (sizes track
14
+ * the `size` prop; gap tracks density). Colours come from the theme's colour
15
+ * scheme (`scheme.toggle` + `scheme.focusRing`).
16
+ */
17
+ const react_1 = require("react");
18
+ const react_native_1 = require("react-native");
19
+ const theme_1 = require("../../theme");
20
+ const tokens_1 = require("../../tokens");
21
+ /** Maps toggle size → label typography scale */
22
+ const LABEL_SCALE = {
23
+ small: 'sm',
24
+ default: 'md',
25
+ large: 'lg',
26
+ };
27
+ function Toggle({ checked = false, onChange, children, size = 'default', disabled = false, style, accessibilityLabel, }) {
28
+ const { components, scheme } = (0, theme_1.useTheme)();
29
+ const toggleColors = scheme.toggle;
30
+ const tokens = components.toggle;
31
+ const sizeTokens = tokens[size];
32
+ const labelTokens = tokens_1.label[LABEL_SCALE[size]];
33
+ const [isHovered, setIsHovered] = (0, react_1.useState)(false);
34
+ const [isFocused, setIsFocused] = (0, react_1.useState)(false);
35
+ const handlePress = (0, react_1.useCallback)(() => {
36
+ if (!disabled)
37
+ onChange?.(!checked);
38
+ }, [disabled, onChange, checked]);
39
+ // Resolve track fill.
40
+ let trackBg;
41
+ if (disabled) {
42
+ trackBg = checked
43
+ ? toggleColors.track.disabledOn
44
+ : toggleColors.track.disabledOff;
45
+ }
46
+ else if (checked) {
47
+ trackBg = isHovered ? toggleColors.track.onHover : toggleColors.track.on;
48
+ }
49
+ else {
50
+ trackBg =
51
+ isHovered || isFocused
52
+ ? toggleColors.track.offHover
53
+ : toggleColors.track.off;
54
+ }
55
+ const showFocusRing = isFocused && !disabled;
56
+ 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: "switch", accessibilityLabel: accessibilityLabel || children, accessibilityState: { checked, disabled }, style: [
57
+ {
58
+ flexDirection: 'row',
59
+ alignItems: 'flex-start',
60
+ gap: tokens.gap,
61
+ },
62
+ style,
63
+ ], children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
64
+ width: sizeTokens.trackWidth,
65
+ height: sizeTokens.trackHeight,
66
+ borderRadius: sizeTokens.trackHeight / 2,
67
+ backgroundColor: trackBg,
68
+ padding: tokens.thumbOffset,
69
+ flexDirection: 'row',
70
+ justifyContent: checked ? 'flex-end' : 'flex-start',
71
+ alignItems: 'center',
72
+ borderWidth: showFocusRing ? tokens.focusRingWidth : 0,
73
+ borderColor: showFocusRing
74
+ ? scheme.focusRing.color
75
+ : 'transparent',
76
+ }, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
77
+ width: sizeTokens.thumbSize,
78
+ height: sizeTokens.thumbSize,
79
+ borderRadius: sizeTokens.thumbSize / 2,
80
+ backgroundColor: toggleColors.thumb,
81
+ } }) }), children ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
82
+ fontFamily: tokens_1.fontFamily.sans,
83
+ fontWeight: tokens_1.fontWeight.medium,
84
+ fontSize: labelTokens.fontSize,
85
+ lineHeight: labelTokens.lineHeight,
86
+ letterSpacing: labelTokens.letterSpacing,
87
+ color: disabled
88
+ ? toggleColors.label.disabled
89
+ : toggleColors.label.default,
90
+ }, selectable: false, children: children })) : null] }));
91
+ }
@@ -0,0 +1 @@
1
+ export { Toggle, type ToggleProps, type ToggleSize } from './Toggle';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Toggle = void 0;
4
+ var Toggle_1 = require("./Toggle");
5
+ Object.defineProperty(exports, "Toggle", { enumerable: true, get: function () { return Toggle_1.Toggle; } });
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Tooltip — a small dark label that points at an anchor with an arrow.
3
+ *
4
+ * Maps to the Figma <Tooltip> component (node 307:4225):
5
+ * direction → top | bottom | left | right (the edge the arrow sits on)
6
+ * size → small | default (drives padding + type scale)
7
+ * hasArrow → toggles the directional arrow
8
+ *
9
+ * This is the presentational bubble only: it renders the dark surface
10
+ * (neutral/bold) with white text and an optional arrow. Positioning relative
11
+ * to a trigger is the caller's job — wrap it in a positioned container or pass
12
+ * a `style` with absolute coordinates.
13
+ *
14
+ * Padding comes from the `tooltip` density theme (size × density); the radius
15
+ * and arrow size are constant across densities.
16
+ */
17
+ import { type ViewStyle, type StyleProp } from 'react-native';
18
+ export type TooltipSize = 'small' | 'default';
19
+ export type TooltipDirection = 'top' | 'bottom' | 'left' | 'right';
20
+ export type TooltipProps = {
21
+ /** The tooltip label text. */
22
+ children: string;
23
+ /** The edge the arrow sits on (points away from the bubble). */
24
+ direction?: TooltipDirection;
25
+ /** Size variant — controls padding and typography scale. */
26
+ size?: TooltipSize;
27
+ /** Show the directional arrow. Defaults to true. */
28
+ hasArrow?: boolean;
29
+ /** Outer style — use for positioning (absolute coords, margin). */
30
+ style?: StyleProp<ViewStyle>;
31
+ /** Accessibility label — falls back to the children text. */
32
+ accessibilityLabel?: string;
33
+ };
34
+ export declare function Tooltip({ children, direction, size, hasArrow, style, accessibilityLabel, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tooltip = Tooltip;
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
+ // ---------------------------------------------------------------------------
9
+ // Constants
10
+ // ---------------------------------------------------------------------------
11
+ /** Maps tooltip size → label typography scale */
12
+ const LABEL_SCALE = {
13
+ small: 'sm',
14
+ default: 'md',
15
+ };
16
+ // ---------------------------------------------------------------------------
17
+ // Component
18
+ // ---------------------------------------------------------------------------
19
+ /** Positions the rotated-square arrow on the requested edge, centred. */
20
+ function arrowStyle(direction, arrowSize, backgroundColor) {
21
+ const half = arrowSize / 2;
22
+ const base = {
23
+ position: 'absolute',
24
+ width: arrowSize,
25
+ height: arrowSize,
26
+ backgroundColor,
27
+ transform: [{ rotate: '45deg' }],
28
+ };
29
+ switch (direction) {
30
+ case 'top':
31
+ return { ...base, top: -half, left: '50%', marginLeft: -half };
32
+ case 'left':
33
+ return { ...base, left: -half, top: '50%', marginTop: -half };
34
+ case 'right':
35
+ return { ...base, right: -half, top: '50%', marginTop: -half };
36
+ case 'bottom':
37
+ default:
38
+ return { ...base, bottom: -half, left: '50%', marginLeft: -half };
39
+ }
40
+ }
41
+ function Tooltip({ children, direction = 'bottom', size = 'small', hasArrow = true, style, accessibilityLabel, }) {
42
+ const { components, scheme } = (0, theme_1.useTheme)();
43
+ const tokens = components.tooltip;
44
+ const sizeTokens = tokens[size];
45
+ const labelTokens = tokens_1.label[LABEL_SCALE[size]];
46
+ /** Surface = neutral/bold (dark) — bg #374151, fg #FFFFFF. */
47
+ const SURFACE = scheme.intents.neutral.bold.default;
48
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { accessibilityRole: "text", accessibilityLabel: accessibilityLabel || children, style: [
49
+ {
50
+ alignSelf: 'flex-start',
51
+ alignItems: 'center',
52
+ justifyContent: 'center',
53
+ backgroundColor: SURFACE.bg,
54
+ borderRadius: tokens.borderRadius,
55
+ paddingHorizontal: sizeTokens.paddingX,
56
+ paddingVertical: sizeTokens.paddingY,
57
+ },
58
+ style,
59
+ ], children: [hasArrow ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: arrowStyle(direction, tokens.arrowSize, SURFACE.bg) })) : null, (0, jsx_runtime_1.jsx)(react_native_1.Text, { selectable: false, style: {
60
+ fontFamily: tokens_1.fontFamily.sans,
61
+ fontWeight: tokens_1.fontWeight.medium,
62
+ fontSize: labelTokens.fontSize,
63
+ lineHeight: labelTokens.lineHeight,
64
+ letterSpacing: labelTokens.letterSpacing,
65
+ color: SURFACE.fg,
66
+ }, children: children })] }));
67
+ }
@@ -0,0 +1 @@
1
+ export { Tooltip, type TooltipProps, type TooltipSize, type TooltipDirection, } from './Tooltip';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tooltip = void 0;
4
+ var Tooltip_1 = require("./Tooltip");
5
+ Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return Tooltip_1.Tooltip; } });
package/dist/index.d.ts CHANGED
@@ -1,7 +1,21 @@
1
- export { intentColors, disabledColors, controlTokens, surfaceTokens, textTokens, overlayTokens, selectColors, tagTokens, errorTokens, fontFamily, fontWeight, label, title, body, caption, type IntentName, type ProminenceName, type StateName, 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 DeepPartial, } from './theme';
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, 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';
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';
6
6
  export { Select, SelectOption, SelectGroup, SelectSeparator, SelectTag, SelectContent as SelectDropdown, type SelectProps, type SelectSize, type SelectType, type SelectOptionProps, type SelectGroupProps, type SelectTagProps, type SelectContentProps, } from './components/Select';
7
- //# sourceMappingURL=index.d.ts.map
7
+ export { List, ListItem, ListSubheader, ListDivider, type ListProps, type ListItemProps, type ListSubheaderProps, type ListDividerProps, } from './components/List';
8
+ export { Checkbox, type CheckboxProps, type CheckboxSize, type CheckboxChecked, } from './components/Checkbox';
9
+ export { Alert, type AlertProps, type AlertSize, type AlertVariant, } from './components/Alert';
10
+ export { Toggle, type ToggleProps, type ToggleSize } from './components/Toggle';
11
+ export { Card, type CardProps, type CardSize, type CardVariant, } from './components/Card';
12
+ export { Badge, type BadgeProps, type BadgeSize, type BadgeVariant, } from './components/Badge';
13
+ export { Input, type InputProps, type InputSize } from './components/Input';
14
+ export { Radio, RadioGroup, type RadioProps, type RadioGroupProps, type RadioSize, } from './components/Radio';
15
+ export { Toast, type ToastProps, type ToastSize, } from './components/Toast';
16
+ export { Chip, type ChipProps, type ChipSize, type ChipVariant, } from './components/Chip';
17
+ export { Divider, type DividerProps, type DividerOrientation, } from './components/Divider';
18
+ export { Avatar, type AvatarProps, type AvatarSize, type AvatarType, } from './components/Avatar';
19
+ export { Popover, type PopoverProps, type PopoverSize, type PopoverDirection, } from './components/Popover';
20
+ export { Skeleton, type SkeletonProps, type SkeletonShape, } from './components/Skeleton';
21
+ export { Tooltip, type TooltipProps, type TooltipSize, type TooltipDirection, } from './components/Tooltip';
package/dist/index.js CHANGED
@@ -1,12 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Toast = exports.RadioGroup = exports.Radio = exports.Input = 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.caption = 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;
4
+ exports.Tooltip = exports.Skeleton = exports.Popover = exports.Avatar = exports.Divider = exports.Chip = void 0;
1
5
  // Cast UI — Cross-platform design system component library
2
6
  //
3
7
  // Tokens
4
- export { intentColors, disabledColors, controlTokens, surfaceTokens, textTokens, overlayTokens, selectColors, tagTokens, errorTokens, fontFamily, fontWeight, label, title, body, caption, } from './tokens';
8
+ var tokens_1 = require("./tokens");
9
+ Object.defineProperty(exports, "lightColors", { enumerable: true, get: function () { return tokens_1.lightColors; } });
10
+ Object.defineProperty(exports, "darkColors", { enumerable: true, get: function () { return tokens_1.darkColors; } });
11
+ Object.defineProperty(exports, "colorSchemes", { enumerable: true, get: function () { return tokens_1.colorSchemes; } });
12
+ Object.defineProperty(exports, "intentColors", { enumerable: true, get: function () { return tokens_1.intentColors; } });
13
+ Object.defineProperty(exports, "disabledColors", { enumerable: true, get: function () { return tokens_1.disabledColors; } });
14
+ Object.defineProperty(exports, "controlTokens", { enumerable: true, get: function () { return tokens_1.controlTokens; } });
15
+ Object.defineProperty(exports, "surfaceTokens", { enumerable: true, get: function () { return tokens_1.surfaceTokens; } });
16
+ Object.defineProperty(exports, "textTokens", { enumerable: true, get: function () { return tokens_1.textTokens; } });
17
+ Object.defineProperty(exports, "overlayTokens", { enumerable: true, get: function () { return tokens_1.overlayTokens; } });
18
+ Object.defineProperty(exports, "selectColors", { enumerable: true, get: function () { return tokens_1.selectColors; } });
19
+ Object.defineProperty(exports, "tagTokens", { enumerable: true, get: function () { return tokens_1.tagTokens; } });
20
+ Object.defineProperty(exports, "errorTokens", { enumerable: true, get: function () { return tokens_1.errorTokens; } });
21
+ Object.defineProperty(exports, "listColors", { enumerable: true, get: function () { return tokens_1.listColors; } });
22
+ Object.defineProperty(exports, "checkboxColors", { enumerable: true, get: function () { return tokens_1.checkboxColors; } });
23
+ Object.defineProperty(exports, "toggleColors", { enumerable: true, get: function () { return tokens_1.toggleColors; } });
24
+ Object.defineProperty(exports, "radioColors", { enumerable: true, get: function () { return tokens_1.radioColors; } });
25
+ Object.defineProperty(exports, "avatarColors", { enumerable: true, get: function () { return tokens_1.avatarColors; } });
26
+ Object.defineProperty(exports, "skeletonColors", { enumerable: true, get: function () { return tokens_1.skeletonColors; } });
27
+ Object.defineProperty(exports, "fontFamily", { enumerable: true, get: function () { return tokens_1.fontFamily; } });
28
+ Object.defineProperty(exports, "fontWeight", { enumerable: true, get: function () { return tokens_1.fontWeight; } });
29
+ Object.defineProperty(exports, "label", { enumerable: true, get: function () { return tokens_1.label; } });
30
+ Object.defineProperty(exports, "title", { enumerable: true, get: function () { return tokens_1.title; } });
31
+ Object.defineProperty(exports, "body", { enumerable: true, get: function () { return tokens_1.body; } });
32
+ Object.defineProperty(exports, "caption", { enumerable: true, get: function () { return tokens_1.caption; } });
5
33
  // Theme
6
- export { ThemeProvider, useTheme, themes, } from './theme';
34
+ var theme_1 = require("./theme");
35
+ Object.defineProperty(exports, "ThemeProvider", { enumerable: true, get: function () { return theme_1.ThemeProvider; } });
36
+ Object.defineProperty(exports, "useTheme", { enumerable: true, get: function () { return theme_1.useTheme; } });
37
+ Object.defineProperty(exports, "themes", { enumerable: true, get: function () { return theme_1.themes; } });
7
38
  // Components
8
- export { Button } from './components/Button';
9
- export { Icon } from './components/Icon';
10
- export { Dialog, DialogContent, } from './components/Dialog';
11
- export { Select, SelectOption, SelectGroup, SelectSeparator, SelectTag, SelectContent as SelectDropdown, } from './components/Select';
12
- //# sourceMappingURL=index.js.map
39
+ var Button_1 = require("./components/Button");
40
+ Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return Button_1.Button; } });
41
+ var Icon_1 = require("./components/Icon");
42
+ Object.defineProperty(exports, "Icon", { enumerable: true, get: function () { return Icon_1.Icon; } });
43
+ var Dialog_1 = require("./components/Dialog");
44
+ Object.defineProperty(exports, "Dialog", { enumerable: true, get: function () { return Dialog_1.Dialog; } });
45
+ Object.defineProperty(exports, "DialogContent", { enumerable: true, get: function () { return Dialog_1.DialogContent; } });
46
+ var Select_1 = require("./components/Select");
47
+ Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return Select_1.Select; } });
48
+ Object.defineProperty(exports, "SelectOption", { enumerable: true, get: function () { return Select_1.SelectOption; } });
49
+ Object.defineProperty(exports, "SelectGroup", { enumerable: true, get: function () { return Select_1.SelectGroup; } });
50
+ Object.defineProperty(exports, "SelectSeparator", { enumerable: true, get: function () { return Select_1.SelectSeparator; } });
51
+ Object.defineProperty(exports, "SelectTag", { enumerable: true, get: function () { return Select_1.SelectTag; } });
52
+ Object.defineProperty(exports, "SelectDropdown", { enumerable: true, get: function () { return Select_1.SelectContent; } });
53
+ var List_1 = require("./components/List");
54
+ Object.defineProperty(exports, "List", { enumerable: true, get: function () { return List_1.List; } });
55
+ Object.defineProperty(exports, "ListItem", { enumerable: true, get: function () { return List_1.ListItem; } });
56
+ Object.defineProperty(exports, "ListSubheader", { enumerable: true, get: function () { return List_1.ListSubheader; } });
57
+ Object.defineProperty(exports, "ListDivider", { enumerable: true, get: function () { return List_1.ListDivider; } });
58
+ var Checkbox_1 = require("./components/Checkbox");
59
+ Object.defineProperty(exports, "Checkbox", { enumerable: true, get: function () { return Checkbox_1.Checkbox; } });
60
+ var Alert_1 = require("./components/Alert");
61
+ Object.defineProperty(exports, "Alert", { enumerable: true, get: function () { return Alert_1.Alert; } });
62
+ var Toggle_1 = require("./components/Toggle");
63
+ Object.defineProperty(exports, "Toggle", { enumerable: true, get: function () { return Toggle_1.Toggle; } });
64
+ var Card_1 = require("./components/Card");
65
+ Object.defineProperty(exports, "Card", { enumerable: true, get: function () { return Card_1.Card; } });
66
+ var Badge_1 = require("./components/Badge");
67
+ Object.defineProperty(exports, "Badge", { enumerable: true, get: function () { return Badge_1.Badge; } });
68
+ var Input_1 = require("./components/Input");
69
+ Object.defineProperty(exports, "Input", { enumerable: true, get: function () { return Input_1.Input; } });
70
+ var Radio_1 = require("./components/Radio");
71
+ Object.defineProperty(exports, "Radio", { enumerable: true, get: function () { return Radio_1.Radio; } });
72
+ Object.defineProperty(exports, "RadioGroup", { enumerable: true, get: function () { return Radio_1.RadioGroup; } });
73
+ var Toast_1 = require("./components/Toast");
74
+ Object.defineProperty(exports, "Toast", { enumerable: true, get: function () { return Toast_1.Toast; } });
75
+ var Chip_1 = require("./components/Chip");
76
+ Object.defineProperty(exports, "Chip", { enumerable: true, get: function () { return Chip_1.Chip; } });
77
+ var Divider_1 = require("./components/Divider");
78
+ Object.defineProperty(exports, "Divider", { enumerable: true, get: function () { return Divider_1.Divider; } });
79
+ var Avatar_1 = require("./components/Avatar");
80
+ Object.defineProperty(exports, "Avatar", { enumerable: true, get: function () { return Avatar_1.Avatar; } });
81
+ var Popover_1 = require("./components/Popover");
82
+ Object.defineProperty(exports, "Popover", { enumerable: true, get: function () { return Popover_1.Popover; } });
83
+ var Skeleton_1 = require("./components/Skeleton");
84
+ Object.defineProperty(exports, "Skeleton", { enumerable: true, get: function () { return Skeleton_1.Skeleton; } });
85
+ var Tooltip_1 = require("./components/Tooltip");
86
+ Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return Tooltip_1.Tooltip; } });