@castui/cast-ui 2.0.0 → 3.1.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.
Files changed (151) hide show
  1. package/README.md +20 -570
  2. package/dist/components/Button/Button.d.ts +36 -14
  3. package/dist/components/Button/Button.d.ts.map +1 -1
  4. package/dist/components/Button/Button.js +87 -66
  5. package/dist/components/Button/Button.js.map +1 -1
  6. package/dist/components/Button/index.d.ts +2 -0
  7. package/dist/components/Button/index.d.ts.map +1 -0
  8. package/dist/components/Button/index.js +2 -0
  9. package/dist/components/Button/index.js.map +1 -0
  10. package/dist/components/Icon/Icon.d.ts +22 -8
  11. package/dist/components/Icon/Icon.d.ts.map +1 -1
  12. package/dist/components/Icon/Icon.js +25 -26
  13. package/dist/components/Icon/Icon.js.map +1 -1
  14. package/dist/components/Icon/index.d.ts +2 -0
  15. package/dist/components/Icon/index.d.ts.map +1 -0
  16. package/dist/components/Icon/index.js +2 -0
  17. package/dist/components/Icon/index.js.map +1 -0
  18. package/dist/index.d.ts +4 -51
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +8 -31
  21. package/dist/index.js.map +1 -1
  22. package/dist/theme/ThemeContext.d.ts +59 -0
  23. package/dist/theme/ThemeContext.d.ts.map +1 -0
  24. package/dist/theme/ThemeContext.js +92 -0
  25. package/dist/theme/ThemeContext.js.map +1 -0
  26. package/dist/theme/index.d.ts +3 -6
  27. package/dist/theme/index.d.ts.map +1 -1
  28. package/dist/theme/index.js +2 -3
  29. package/dist/theme/index.js.map +1 -1
  30. package/dist/theme/themes.d.ts +14 -0
  31. package/dist/theme/themes.d.ts.map +1 -0
  32. package/dist/theme/themes.js +98 -0
  33. package/dist/theme/themes.js.map +1 -0
  34. package/dist/theme/types.d.ts +30 -467
  35. package/dist/theme/types.d.ts.map +1 -1
  36. package/dist/theme/types.js +3 -7
  37. package/dist/theme/types.js.map +1 -1
  38. package/dist/tokens/colors.d.ts +35 -0
  39. package/dist/tokens/colors.d.ts.map +1 -0
  40. package/dist/tokens/colors.js +74 -0
  41. package/dist/tokens/colors.js.map +1 -0
  42. package/dist/tokens/index.d.ts +3 -0
  43. package/dist/tokens/index.d.ts.map +1 -0
  44. package/dist/tokens/index.js +3 -0
  45. package/dist/tokens/index.js.map +1 -0
  46. package/dist/tokens/typography.d.ts +27 -0
  47. package/dist/tokens/typography.d.ts.map +1 -0
  48. package/dist/tokens/typography.js +30 -0
  49. package/dist/tokens/typography.js.map +1 -0
  50. package/package.json +2 -7
  51. package/dist/components/Alert/Alert.d.ts +0 -14
  52. package/dist/components/Alert/Alert.d.ts.map +0 -1
  53. package/dist/components/Alert/Alert.js +0 -57
  54. package/dist/components/Alert/Alert.js.map +0 -1
  55. package/dist/components/AppBar/AppBar.d.ts +0 -11
  56. package/dist/components/AppBar/AppBar.d.ts.map +0 -1
  57. package/dist/components/AppBar/AppBar.js +0 -32
  58. package/dist/components/AppBar/AppBar.js.map +0 -1
  59. package/dist/components/Autocomplete/Autocomplete.d.ts +0 -18
  60. package/dist/components/Autocomplete/Autocomplete.d.ts.map +0 -1
  61. package/dist/components/Autocomplete/Autocomplete.js +0 -72
  62. package/dist/components/Autocomplete/Autocomplete.js.map +0 -1
  63. package/dist/components/Backdrop/Backdrop.d.ts +0 -8
  64. package/dist/components/Backdrop/Backdrop.d.ts.map +0 -1
  65. package/dist/components/Backdrop/Backdrop.js +0 -25
  66. package/dist/components/Backdrop/Backdrop.js.map +0 -1
  67. package/dist/components/Badge/Badge.d.ts +0 -11
  68. package/dist/components/Badge/Badge.d.ts.map +0 -1
  69. package/dist/components/Badge/Badge.js +0 -42
  70. package/dist/components/Badge/Badge.js.map +0 -1
  71. package/dist/components/Card/Card.d.ts +0 -20
  72. package/dist/components/Card/Card.d.ts.map +0 -1
  73. package/dist/components/Card/Card.js +0 -58
  74. package/dist/components/Card/Card.js.map +0 -1
  75. package/dist/components/Checkbox/Checkbox.d.ts +0 -12
  76. package/dist/components/Checkbox/Checkbox.d.ts.map +0 -1
  77. package/dist/components/Checkbox/Checkbox.js +0 -39
  78. package/dist/components/Checkbox/Checkbox.js.map +0 -1
  79. package/dist/components/Chip/Chip.d.ts +0 -13
  80. package/dist/components/Chip/Chip.d.ts.map +0 -1
  81. package/dist/components/Chip/Chip.js +0 -29
  82. package/dist/components/Chip/Chip.js.map +0 -1
  83. package/dist/components/Dialog/Dialog.d.ts +0 -15
  84. package/dist/components/Dialog/Dialog.d.ts.map +0 -1
  85. package/dist/components/Dialog/Dialog.js +0 -41
  86. package/dist/components/Dialog/Dialog.js.map +0 -1
  87. package/dist/components/Divider/Divider.d.ts +0 -6
  88. package/dist/components/Divider/Divider.d.ts.map +0 -1
  89. package/dist/components/Divider/Divider.js +0 -25
  90. package/dist/components/Divider/Divider.js.map +0 -1
  91. package/dist/components/FAB/FAB.d.ts +0 -14
  92. package/dist/components/FAB/FAB.d.ts.map +0 -1
  93. package/dist/components/FAB/FAB.js +0 -55
  94. package/dist/components/FAB/FAB.js.map +0 -1
  95. package/dist/components/Link/Link.d.ts +0 -11
  96. package/dist/components/Link/Link.d.ts.map +0 -1
  97. package/dist/components/Link/Link.js +0 -26
  98. package/dist/components/Link/Link.js.map +0 -1
  99. package/dist/components/Select/Select.d.ts +0 -18
  100. package/dist/components/Select/Select.d.ts.map +0 -1
  101. package/dist/components/Select/Select.js +0 -72
  102. package/dist/components/Select/Select.js.map +0 -1
  103. package/dist/components/Skeleton/Skeleton.d.ts +0 -11
  104. package/dist/components/Skeleton/Skeleton.d.ts.map +0 -1
  105. package/dist/components/Skeleton/Skeleton.js +0 -27
  106. package/dist/components/Skeleton/Skeleton.js.map +0 -1
  107. package/dist/components/Snackbar/Snackbar.d.ts +0 -14
  108. package/dist/components/Snackbar/Snackbar.d.ts.map +0 -1
  109. package/dist/components/Snackbar/Snackbar.js +0 -40
  110. package/dist/components/Snackbar/Snackbar.js.map +0 -1
  111. package/dist/components/SpeedDial/SpeedDial.d.ts +0 -18
  112. package/dist/components/SpeedDial/SpeedDial.d.ts.map +0 -1
  113. package/dist/components/SpeedDial/SpeedDial.js +0 -55
  114. package/dist/components/SpeedDial/SpeedDial.js.map +0 -1
  115. package/dist/components/Switch/Switch.d.ts +0 -12
  116. package/dist/components/Switch/Switch.d.ts.map +0 -1
  117. package/dist/components/Switch/Switch.js +0 -39
  118. package/dist/components/Switch/Switch.js.map +0 -1
  119. package/dist/components/Table/Table.d.ts +0 -15
  120. package/dist/components/Table/Table.d.ts.map +0 -1
  121. package/dist/components/Table/Table.js +0 -62
  122. package/dist/components/Table/Table.js.map +0 -1
  123. package/dist/components/TextField/TextField.d.ts +0 -19
  124. package/dist/components/TextField/TextField.d.ts.map +0 -1
  125. package/dist/components/TextField/TextField.js +0 -60
  126. package/dist/components/TextField/TextField.js.map +0 -1
  127. package/dist/components/Typography/Typography.d.ts +0 -21
  128. package/dist/components/Typography/Typography.d.ts.map +0 -1
  129. package/dist/components/Typography/Typography.js +0 -41
  130. package/dist/components/Typography/Typography.js.map +0 -1
  131. package/dist/default.reference.json +0 -421
  132. package/dist/theme/ThemeProvider.d.ts +0 -34
  133. package/dist/theme/ThemeProvider.d.ts.map +0 -1
  134. package/dist/theme/ThemeProvider.js +0 -41
  135. package/dist/theme/ThemeProvider.js.map +0 -1
  136. package/dist/theme/createTheme.d.ts +0 -49
  137. package/dist/theme/createTheme.d.ts.map +0 -1
  138. package/dist/theme/createTheme.js +0 -85
  139. package/dist/theme/createTheme.js.map +0 -1
  140. package/dist/theme/fonts.d.ts +0 -96
  141. package/dist/theme/fonts.d.ts.map +0 -1
  142. package/dist/theme/fonts.js +0 -148
  143. package/dist/theme/fonts.js.map +0 -1
  144. package/dist/tokens/generated/default.d.ts +0 -3
  145. package/dist/tokens/generated/default.d.ts.map +0 -1
  146. package/dist/tokens/generated/default.js +0 -422
  147. package/dist/tokens/generated/default.js.map +0 -1
  148. package/dist/tokens/generated/index.d.ts +0 -2
  149. package/dist/tokens/generated/index.d.ts.map +0 -1
  150. package/dist/tokens/generated/index.js +0 -3
  151. package/dist/tokens/generated/index.js.map +0 -1
@@ -1,72 +1,93 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { Pressable, Text, } from 'react-native';
4
- import { useTheme, resolveFont } from '../../theme';
5
- // ---------------------------------------------------------------------------
6
- // Component
7
- // ---------------------------------------------------------------------------
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
2
  /**
9
- * Primary UI component for user interaction.
3
+ * Button the foundational interactive component of Cast UI.
10
4
  *
11
- * Renders as a React Native `Pressable` with `Text` – works identically
12
- * on iOS, Android, and Web (via React Native Web).
5
+ * Maps 1:1 to the Figma <Button> component:
6
+ * intent → neutral | brand | danger
7
+ * prominence → default | bold | subtle
8
+ * size → small | default | large
9
+ *
10
+ * Spacing tokens come from the density theme (compact/default/comfortable).
11
+ * Colours come from the semantic intent system (constant across densities).
12
+ * Typography uses the label scale (sm/md/lg) matched to the button size.
13
13
  */
14
- export function Button({ label, variant = 'filled', backgroundColor, disabled = false, ...pressableProps }) {
15
- const theme = useTheme();
16
- const bt = theme.component.button;
17
- const [hovered, setHovered] = useState(false);
18
- // --- resolve colours per variant + state -----------------------------------
19
- const resolveBackground = () => {
20
- if (disabled)
21
- return bt.state.disabledBackground;
22
- if (backgroundColor)
23
- return backgroundColor;
24
- const variantTokens = bt[variant];
25
- const base = variantTokens.background;
14
+ import { useState, useCallback } from 'react';
15
+ import { Pressable, Text, View, Platform, } from 'react-native';
16
+ import { useTheme } from '../../theme';
17
+ import { fontFamily, fontWeight, label, controlTokens } from '../../tokens';
18
+ import { Icon } from '../Icon';
19
+ // ---------------------------------------------------------------------------
20
+ // Constants
21
+ // ---------------------------------------------------------------------------
22
+ /** Maps button size → label typography scale */
23
+ const LABEL_SCALE = {
24
+ small: 'sm',
25
+ default: 'md',
26
+ large: 'lg',
27
+ };
28
+ /** Icon size — fixed at 16px per Figma spec, all button sizes. */
29
+ const ICON_SIZE = 16;
30
+ // ---------------------------------------------------------------------------
31
+ // Component
32
+ // ---------------------------------------------------------------------------
33
+ export function Button({ children, intent = 'neutral', prominence = 'default', size = 'default', disabled = false, leadingIcon, trailingIcon, onPress, style, accessibilityLabel, }) {
34
+ const { components, colors } = useTheme();
35
+ const [isFocused, setIsFocused] = useState(false);
36
+ const [isHovered, setIsHovered] = useState(false);
37
+ // Resolve tokens for current size + density
38
+ const sizeTokens = components.button[size];
39
+ const labelTokens = label[LABEL_SCALE[size]];
40
+ const intentClrs = colors[intent];
41
+ // Resolve colours based on interaction state
42
+ const getStateColors = useCallback((pressed, hovered) => {
43
+ if (disabled) {
44
+ return {
45
+ bg: '#F3F4F6',
46
+ fg: '#9CA3AF',
47
+ border: '#E5E7EB',
48
+ };
49
+ }
50
+ if (pressed)
51
+ return intentClrs[prominence].active;
26
52
  if (hovered)
27
- return bt.state.hoverBackground;
28
- return base;
29
- };
30
- const resolveContent = () => {
31
- if (disabled)
32
- return bt.state.disabledContent;
33
- return bt[variant].content;
34
- };
35
- const resolveBorder = () => {
36
- if (variant !== 'outline')
37
- return undefined;
38
- if (disabled)
39
- return bt.state.disabledContent;
40
- return bt.outline.border;
41
- };
42
- // --- build styles ----------------------------------------------------------
43
- const containerStyle = {
44
- flexDirection: 'row',
45
- alignItems: 'center',
46
- justifyContent: 'center',
47
- gap: bt.gap,
48
- paddingHorizontal: bt.paddingHorizontal,
49
- paddingVertical: bt.paddingVertical,
50
- borderRadius: bt.cornerRadius,
51
- backgroundColor: resolveBackground(),
52
- ...(variant === 'outline' && {
53
- borderWidth: bt.borderWidth,
54
- borderColor: resolveBorder(),
55
- }),
56
- ...(variant === 'text' && {
57
- backgroundColor: 'transparent',
58
- }),
59
- opacity: disabled ? 0.6 : 1,
60
- };
61
- const textStyle = {
62
- color: resolveContent(),
63
- fontSize: bt.textSize,
64
- lineHeight: bt.lineHeight,
65
- ...resolveFont(bt.fontFamily, bt.fontWeight),
66
- };
67
- return (_jsx(Pressable, { ...pressableProps, disabled: disabled, style: containerStyle, ...{
68
- onHoverIn: () => setHovered(true),
69
- onHoverOut: () => setHovered(false),
70
- }, accessibilityRole: "button", children: _jsx(Text, { style: textStyle, children: label }) }));
53
+ return intentClrs[prominence].hover;
54
+ return intentClrs[prominence].default;
55
+ }, [disabled, intentClrs, prominence]);
56
+ return (_jsx(Pressable, { onPress: onPress, disabled: disabled, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), onHoverIn: () => setIsHovered(true), onHoverOut: () => setIsHovered(false), accessibilityRole: "button", accessibilityLabel: accessibilityLabel || children, accessibilityState: { disabled }, style: style, children: ({ pressed }) => {
57
+ const stateColors = getStateColors(pressed, isHovered);
58
+ const containerStyle = {
59
+ flexDirection: 'row',
60
+ alignItems: 'center',
61
+ justifyContent: 'center',
62
+ alignSelf: 'flex-start',
63
+ gap: sizeTokens.gap,
64
+ paddingHorizontal: sizeTokens.paddingX,
65
+ paddingVertical: sizeTokens.paddingY,
66
+ borderRadius: sizeTokens.borderRadius,
67
+ borderWidth: controlTokens.borderWidth,
68
+ borderColor: stateColors.border,
69
+ backgroundColor: stateColors.bg,
70
+ };
71
+ // Web-only: focus ring via CSS outline
72
+ const focusStyle = isFocused && !disabled && Platform.OS === 'web'
73
+ ? {
74
+ outlineWidth: sizeTokens.focusRingWidth,
75
+ outlineColor: intentClrs.ringColour,
76
+ outlineStyle: 'solid',
77
+ outlineOffset: sizeTokens.focusRingOffset,
78
+ }
79
+ : {};
80
+ // Resolve icon props — strings become <Icon> with auto-matched colour
81
+ const resolvedLeading = typeof leadingIcon === 'string' ? (_jsx(Icon, { name: leadingIcon, size: ICON_SIZE, color: stateColors.fg })) : (leadingIcon);
82
+ const resolvedTrailing = typeof trailingIcon === 'string' ? (_jsx(Icon, { name: trailingIcon, size: ICON_SIZE, color: stateColors.fg })) : (trailingIcon);
83
+ return (_jsxs(View, { style: [containerStyle, focusStyle], children: [resolvedLeading, _jsx(Text, { style: {
84
+ fontFamily: fontFamily.sans,
85
+ fontWeight: fontWeight.medium,
86
+ fontSize: labelTokens.fontSize,
87
+ lineHeight: labelTokens.lineHeight,
88
+ letterSpacing: labelTokens.letterSpacing,
89
+ color: stateColors.fg,
90
+ }, selectable: false, children: children }), resolvedTrailing] }));
91
+ } }));
71
92
  }
72
93
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EACL,SAAS,EACT,IAAI,GAIL,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAiBpD,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,EACrB,KAAK,EACL,OAAO,GAAG,QAAQ,EAClB,eAAe,EACf,QAAQ,GAAG,KAAK,EAChB,GAAG,cAAc,EACL;IACZ,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;IAElC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,8EAA8E;IAC9E,MAAM,iBAAiB,GAAG,GAAW,EAAE;QACrC,IAAI,QAAQ;YAAE,OAAO,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC;QACjD,IAAI,eAAe;YAAE,OAAO,eAAe,CAAC;QAE5C,MAAM,aAAa,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC;QAClC,MAAM,IAAI,GAAG,aAAa,CAAC,UAAU,CAAC;QAEtC,IAAI,OAAO;YAAE,OAAO,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,GAAW,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C,IAAI,IAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,CAAC,EAAE,GAAI,CACrE,CAAC,CAAC,CAAC,CACF,YAAY,CACb,CAAC;YAEJ,OAAO,CACL,MAAC,IAAI,IAAC,KAAK,EAAE,CAAC,cAAc,EAAE,UAAuB,CAAC,aACnD,eAAe,EAChB,KAAC,IAAI,IACH,KAAK,EAAE;4BACL,UAAU,EAAE,UAAU,CAAC,IAAI;4BAC3B,UAAU,EAAE,UAAU,CAAC,MAAM;4BAC7B,QAAQ,EAAE,WAAW,CAAC,QAAQ;4BAC9B,UAAU,EAAE,WAAW,CAAC,UAAU;4BAClC,aAAa,EAAE,WAAW,CAAC,aAAa;4BACxC,KAAK,EAAE,WAAW,CAAC,EAAE;yBACtB,EACD,UAAU,EAAE,KAAK,YAEhB,QAAQ,GACJ,EACN,gBAAgB,IACZ,CACR,CAAC;QACJ,CAAC,GACS,CACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Button, type ButtonProps, type ButtonSize } from './Button';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Button } from './Button';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqC,MAAM,UAAU,CAAC"}
@@ -1,11 +1,25 @@
1
- export type IconSize = 'small' | 'medium' | 'large';
2
- export interface IconProps {
3
- /** Icon identifier (rendered as text for now; swap with icon library). */
1
+ /**
2
+ * Icon — renders a Material Symbols Outlined icon by name.
3
+ *
4
+ * Uses the Material Symbols font with ligature rendering.
5
+ * The `name` prop matches Material Symbols names exactly
6
+ * (e.g., "star", "close", "chevron_right", "add").
7
+ *
8
+ * Requires the MaterialSymbolsOutlined font to be loaded:
9
+ * - Web: Google Fonts CSS import
10
+ * - Expo: expo-font
11
+ * - Bare RN: font asset linking
12
+ */
13
+ import { type TextStyle, type StyleProp } from 'react-native';
14
+ export type IconProps = {
15
+ /** Material Symbols icon name (e.g., "star", "close", "settings"). */
4
16
  name: string;
5
- /** Icon size. @default 'medium' */
6
- size?: IconSize;
7
- /** Icon color. */
17
+ /** Icon size in pixels. Defaults to 20. */
18
+ size?: number;
19
+ /** Icon colour. Defaults to "#374151" (neutral fg). */
8
20
  color?: string;
9
- }
10
- export declare function Icon({ name, size, color, }: IconProps): import("react/jsx-runtime").JSX.Element;
21
+ /** Additional style overrides. */
22
+ style?: StyleProp<TextStyle>;
23
+ };
24
+ export declare function Icon({ name, size, color, style }: IconProps): import("react/jsx-runtime").JSX.Element;
11
25
  //# sourceMappingURL=Icon.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":"AAQA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEpD,MAAM,WAAW,SAAS;IACxB,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAgBD,wBAAgB,IAAI,CAAC,EACnB,IAAI,EACJ,IAAe,EACf,KAAK,GACN,EAAE,SAAS,2CAmBX"}
1
+ {"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAkB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9E,MAAM,MAAM,SAAS,GAAG;IACtB,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAOF,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,IAAS,EAAE,KAAiB,EAAE,KAAK,EAAE,EAAE,SAAS,2CA6B5E"}
@@ -1,29 +1,28 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Text } from 'react-native';
3
- import { useTheme } from '../../theme';
4
- // ---------------------------------------------------------------------------
5
- // Size → token key mapping
6
- // ---------------------------------------------------------------------------
7
- const SIZE_MAP = {
8
- small: 'sizeSmall',
9
- medium: 'sizeMedium',
10
- large: 'sizeLarge',
11
- };
12
- // ---------------------------------------------------------------------------
13
- // Component
14
- // ---------------------------------------------------------------------------
15
- export function Icon({ name, size = 'medium', color, }) {
16
- const theme = useTheme();
17
- const ic = theme.component.icon;
18
- const resolved = ic[SIZE_MAP[size]];
19
- const style = {
20
- fontSize: resolved,
21
- lineHeight: resolved,
22
- width: resolved,
23
- height: resolved,
24
- textAlign: 'center',
25
- color: color ?? theme.semantic.colour.onSurface,
26
- };
27
- return (_jsx(Text, { style: style, accessibilityRole: "image", accessibilityLabel: name, children: name }));
2
+ import { Text, Platform } from 'react-native';
3
+ const FONT_FAMILY = Platform.select({
4
+ web: '"Material Symbols Outlined", sans-serif',
5
+ default: 'MaterialSymbolsOutlined',
6
+ });
7
+ export function Icon({ name, size = 20, color = '#374151', style }) {
8
+ return (_jsx(Text, { selectable: false, accessibilityElementsHidden: true, importantForAccessibility: "no", style: [
9
+ {
10
+ fontFamily: FONT_FAMILY,
11
+ fontSize: size,
12
+ lineHeight: size,
13
+ color,
14
+ // Prevent ligature text from taking extra space
15
+ width: size,
16
+ height: size,
17
+ textAlign: 'center',
18
+ // Reset any inherited text styles
19
+ fontWeight: '400',
20
+ fontStyle: 'normal',
21
+ letterSpacing: 0,
22
+ textTransform: 'none',
23
+ textDecorationLine: 'none',
24
+ },
25
+ style,
26
+ ], children: name }));
28
27
  }
29
28
  //# sourceMappingURL=Icon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAiBvC,8EAA8E;AAC9E,2BAA2B;AAC3B,8EAA8E;AAE9E,MAAM,QAAQ,GAA+D;IAC3E,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,WAAW;CACnB,CAAC;AAEF,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,MAAM,UAAU,IAAI,CAAC,EACnB,IAAI,EACJ,IAAI,GAAG,QAAQ,EACf,KAAK,GACK;IACV,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;IAChC,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAEpC,MAAM,KAAK,GAAc;QACvB,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,QAAQ;QACnB,KAAK,EAAE,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS;KAChD,CAAC;IAEF,OAAO,CACL,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAC,OAAO,EAAC,kBAAkB,EAAE,IAAI,YACnE,IAAI,GACA,CACR,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAkC,MAAM,cAAc,CAAC;AAa9E,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC;IAClC,GAAG,EAAE,yCAAyC;IAC9C,OAAO,EAAE,yBAAyB;CACnC,CAAC,CAAC;AAEH,MAAM,UAAU,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,EAAa;IAC3E,OAAO,CACL,KAAC,IAAI,IACH,UAAU,EAAE,KAAK,EACjB,2BAA2B,QAC3B,yBAAyB,EAAC,IAAI,EAC9B,KAAK,EAAE;YACL;gBACE,UAAU,EAAE,WAAW;gBACvB,QAAQ,EAAE,IAAI;gBACd,UAAU,EAAE,IAAI;gBAChB,KAAK;gBACL,gDAAgD;gBAChD,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,IAAI;gBACZ,SAAS,EAAE,QAAQ;gBACnB,kCAAkC;gBAClC,UAAU,EAAE,KAAK;gBACjB,SAAS,EAAE,QAAQ;gBACnB,aAAa,EAAE,CAAC;gBAChB,aAAa,EAAE,MAAM;gBACrB,kBAAkB,EAAE,MAAM;aAC3B;YACD,KAAK;SACN,YAEA,IAAI,GACA,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Icon, type IconProps } from './Icon';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Icon } from './Icon';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Icon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,QAAQ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,52 +1,5 @@
1
- export { CastThemeProvider, useTheme } from './theme';
2
- export type { CastThemeProviderProps } from './theme';
3
- export type { CastTheme, ThemeName, SemanticTokens, ComponentTokens, ButtonTokens, CardTokens, TextFieldTokens, CheckboxTokens, FABTokens, AutocompleteTokens, SelectTokens, SwitchTokens, BadgeTokens, ChipTokens, DividerTokens, IconTokens, TableTokens, AlertTokens, BackdropTokens, SkeletonTokens, SnackbarTokens, DialogTokens, AppBarTokens, LinkTokens, SpeedDialTokens, } from './theme';
4
- export { createTheme } from './theme';
5
- export type { DeepPartial } from './theme';
6
- export { getThemeFontFamilies, googleFontsUrl, resolveFont, ANDROID_WEIGHT_SUFFIX } from './theme';
7
- export { defaultTheme } from './tokens/generated';
8
- export { Button } from './components/Button/Button';
9
- export type { ButtonProps, ButtonVariant } from './components/Button/Button';
10
- export { Card } from './components/Card/Card';
11
- export type { CardProps } from './components/Card/Card';
12
- export { Typography } from './components/Typography/Typography';
13
- export type { TypographyProps, TypographyVariant } from './components/Typography/Typography';
14
- export { TextField } from './components/TextField/TextField';
15
- export type { TextFieldProps } from './components/TextField/TextField';
16
- export { Checkbox } from './components/Checkbox/Checkbox';
17
- export type { CheckboxProps } from './components/Checkbox/Checkbox';
18
- export { FAB } from './components/FAB/FAB';
19
- export type { FABProps, FABVariant } from './components/FAB/FAB';
20
- export { Autocomplete } from './components/Autocomplete/Autocomplete';
21
- export type { AutocompleteProps, AutocompleteOption } from './components/Autocomplete/Autocomplete';
22
- export { Select } from './components/Select/Select';
23
- export type { SelectProps, SelectOption } from './components/Select/Select';
24
- export { Switch } from './components/Switch/Switch';
25
- export type { SwitchProps } from './components/Switch/Switch';
26
- export { Badge } from './components/Badge/Badge';
27
- export type { BadgeProps } from './components/Badge/Badge';
28
- export { Chip } from './components/Chip/Chip';
29
- export type { ChipProps } from './components/Chip/Chip';
30
- export { Divider } from './components/Divider/Divider';
31
- export type { DividerProps } from './components/Divider/Divider';
32
- export { Icon } from './components/Icon/Icon';
33
- export type { IconProps, IconSize } from './components/Icon/Icon';
34
- export { Table } from './components/Table/Table';
35
- export type { TableProps, TableColumn } from './components/Table/Table';
36
- export { Alert } from './components/Alert/Alert';
37
- export type { AlertProps, AlertSeverity } from './components/Alert/Alert';
38
- export { Backdrop } from './components/Backdrop/Backdrop';
39
- export type { BackdropProps } from './components/Backdrop/Backdrop';
40
- export { Skeleton } from './components/Skeleton/Skeleton';
41
- export type { SkeletonProps, SkeletonVariant } from './components/Skeleton/Skeleton';
42
- export { Snackbar } from './components/Snackbar/Snackbar';
43
- export type { SnackbarProps } from './components/Snackbar/Snackbar';
44
- export { Dialog } from './components/Dialog/Dialog';
45
- export type { DialogProps } from './components/Dialog/Dialog';
46
- export { AppBar } from './components/AppBar/AppBar';
47
- export type { AppBarProps } from './components/AppBar/AppBar';
48
- export { Link } from './components/Link/Link';
49
- export type { LinkProps } from './components/Link/Link';
50
- export { SpeedDial } from './components/SpeedDial/SpeedDial';
51
- export type { SpeedDialProps, SpeedDialAction } from './components/SpeedDial/SpeedDial';
1
+ export { intentColors, disabledColors, controlTokens, fontFamily, fontWeight, label, 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 DeepPartial, } from './theme';
3
+ export { Button, type ButtonProps, type ButtonSize } from './components/Button';
4
+ export { Icon, type IconProps } from './components/Icon';
52
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM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AAM,gCAAgC,CAAC;AAErF,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,UAAU,EACV,UAAU,EACV,KAAK,EACL,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,SAAS,GACf,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,aAAa,EACb,QAAQ,EACR,MAAM,EACN,KAAK,KAAK,EACV,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,WAAW,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -1,33 +1,10 @@
1
- // ---------------------------------------------------------------------------
2
- // Cast Design System – Public API
3
- // ---------------------------------------------------------------------------
4
- // Theme system
5
- export { CastThemeProvider, useTheme } from './theme';
6
- export { createTheme } from './theme';
7
- export { getThemeFontFamilies, googleFontsUrl, resolveFont, ANDROID_WEIGHT_SUFFIX } from './theme';
8
- // Theme objects
9
- export { defaultTheme } from './tokens/generated';
1
+ // Cast UI — Cross-platform design system component library
2
+ //
3
+ // Tokens
4
+ export { intentColors, disabledColors, controlTokens, fontFamily, fontWeight, label, } from './tokens';
5
+ // Theme
6
+ export { ThemeProvider, useTheme, themes, } from './theme';
10
7
  // Components
11
- export { Button } from './components/Button/Button';
12
- export { Card } from './components/Card/Card';
13
- export { Typography } from './components/Typography/Typography';
14
- export { TextField } from './components/TextField/TextField';
15
- export { Checkbox } from './components/Checkbox/Checkbox';
16
- export { FAB } from './components/FAB/FAB';
17
- export { Autocomplete } from './components/Autocomplete/Autocomplete';
18
- export { Select } from './components/Select/Select';
19
- export { Switch } from './components/Switch/Switch';
20
- export { Badge } from './components/Badge/Badge';
21
- export { Chip } from './components/Chip/Chip';
22
- export { Divider } from './components/Divider/Divider';
23
- export { Icon } from './components/Icon/Icon';
24
- export { Table } from './components/Table/Table';
25
- export { Alert } from './components/Alert/Alert';
26
- export { Backdrop } from './components/Backdrop/Backdrop';
27
- export { Skeleton } from './components/Skeleton/Skeleton';
28
- export { Snackbar } from './components/Snackbar/Snackbar';
29
- export { Dialog } from './components/Dialog/Dialog';
30
- export { AppBar } from './components/AppBar/AppBar';
31
- export { Link } from './components/Link/Link';
32
- export { SpeedDial } from './components/SpeedDial/SpeedDial';
8
+ export { Button } from './components/Button';
9
+ export { Icon } from './components/Icon';
33
10
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kCAAkC;AAClC,8EAA8E;AAE9E,eAAe;AACf,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,SAA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MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAG9C,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,EAAE;AACF,SAAS;AACT,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,UAAU,EACV,UAAU,EACV,KAAK,GAKN,MAAM,UAAU,CAAC;AAElB,QAAQ;AACR,OAAO,EACL,aAAa,EACb,QAAQ,EACR,MAAM,GAQP,MAAM,SAAS,CAAC;AAEjB,aAAa;AACb,OAAO,EAAE,MAAM,EAAqC,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,IAAI,EAAkB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * ThemeProvider — wraps your app to enable density theming and colour customisation.
3
+ *
4
+ * @example Basic usage — switch density
5
+ * ```tsx
6
+ * import { ThemeProvider } from '@castui/cast-ui';
7
+ *
8
+ * <ThemeProvider density="comfortable">
9
+ * <App />
10
+ * </ThemeProvider>
11
+ * ```
12
+ *
13
+ * @example Rebrand — override intent colours
14
+ * ```tsx
15
+ * <ThemeProvider
16
+ * density="default"
17
+ * colors={{
18
+ * brand: {
19
+ * bold: {
20
+ * default: { bg: '#7C3AED', fg: '#FFFFFF', border: '#7C3AED' },
21
+ * hover: { bg: '#6D28D9', fg: '#FFFFFF', border: '#6D28D9' },
22
+ * active: { bg: '#5B21B6', fg: '#FFFFFF', border: '#5B21B6' },
23
+ * },
24
+ * },
25
+ * }}
26
+ * >
27
+ * <App />
28
+ * </ThemeProvider>
29
+ * ```
30
+ */
31
+ import React from 'react';
32
+ import { intentColors as defaultIntentColors, disabledColors as defaultDisabledColors } from '../tokens/colors';
33
+ import type { IntentName } from '../tokens/colors';
34
+ import type { DensityTheme, ComponentTokens, DeepPartial } from './types';
35
+ type IntentColorMap = typeof defaultIntentColors;
36
+ export type Theme = {
37
+ density: DensityTheme;
38
+ components: ComponentTokens;
39
+ colors: IntentColorMap;
40
+ disabledColors: typeof defaultDisabledColors;
41
+ };
42
+ export type ThemeProviderProps = {
43
+ /** Density theme — controls spacing and padding across all components. */
44
+ density?: DensityTheme;
45
+ /**
46
+ * Partial colour overrides — deep-merged with the default intent colours.
47
+ * Only provide the values you want to change; everything else stays default.
48
+ */
49
+ colors?: Partial<Record<IntentName, DeepPartial<IntentColorMap[IntentName]>>>;
50
+ children: React.ReactNode;
51
+ };
52
+ export declare function ThemeProvider({ density, colors, children, }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
53
+ /**
54
+ * Access the current theme — density tokens, intent colours, and component tokens.
55
+ * Must be called within a ThemeProvider; falls back to the "default" density if not.
56
+ */
57
+ export declare function useTheme(): Theme;
58
+ export {};
59
+ //# sourceMappingURL=ThemeContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeContext.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeContext.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,OAAO,EACL,YAAY,IAAI,mBAAmB,EACnC,cAAc,IAAI,qBAAqB,EACxC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAM1E,KAAK,cAAc,GAAG,OAAO,mBAAmB,CAAC;AAEjD,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE,eAAe,CAAC;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB,cAAc,EAAE,OAAO,qBAAqB,CAAC;CAC9C,CAAC;AAkDF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,0EAA0E;IAC1E,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAC5B,OAAmB,EACnB,MAAM,EACN,QAAQ,GACT,EAAE,kBAAkB,2CAiBpB;AAMD;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,KAAK,CAEhC"}
@@ -0,0 +1,92 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * ThemeProvider — wraps your app to enable density theming and colour customisation.
4
+ *
5
+ * @example Basic usage — switch density
6
+ * ```tsx
7
+ * import { ThemeProvider } from '@castui/cast-ui';
8
+ *
9
+ * <ThemeProvider density="comfortable">
10
+ * <App />
11
+ * </ThemeProvider>
12
+ * ```
13
+ *
14
+ * @example Rebrand — override intent colours
15
+ * ```tsx
16
+ * <ThemeProvider
17
+ * density="default"
18
+ * colors={{
19
+ * brand: {
20
+ * bold: {
21
+ * default: { bg: '#7C3AED', fg: '#FFFFFF', border: '#7C3AED' },
22
+ * hover: { bg: '#6D28D9', fg: '#FFFFFF', border: '#6D28D9' },
23
+ * active: { bg: '#5B21B6', fg: '#FFFFFF', border: '#5B21B6' },
24
+ * },
25
+ * },
26
+ * }}
27
+ * >
28
+ * <App />
29
+ * </ThemeProvider>
30
+ * ```
31
+ */
32
+ import { createContext, useContext, useMemo } from 'react';
33
+ import { themes } from './themes';
34
+ import { intentColors as defaultIntentColors, disabledColors as defaultDisabledColors, } from '../tokens/colors';
35
+ // ---------------------------------------------------------------------------
36
+ // Deep merge utility (for partial colour overrides)
37
+ // ---------------------------------------------------------------------------
38
+ function deepMerge(base, overrides) {
39
+ const result = { ...base };
40
+ for (const key of Object.keys(overrides)) {
41
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype')
42
+ continue;
43
+ const baseVal = base[key];
44
+ const overVal = overrides[key];
45
+ if (overVal &&
46
+ typeof overVal === 'object' &&
47
+ !Array.isArray(overVal) &&
48
+ baseVal &&
49
+ typeof baseVal === 'object') {
50
+ result[key] = deepMerge(baseVal, overVal);
51
+ }
52
+ else {
53
+ result[key] = overVal;
54
+ }
55
+ }
56
+ return result;
57
+ }
58
+ // ---------------------------------------------------------------------------
59
+ // Context
60
+ // ---------------------------------------------------------------------------
61
+ const defaultTheme = {
62
+ density: 'default',
63
+ components: themes.default,
64
+ colors: defaultIntentColors,
65
+ disabledColors: defaultDisabledColors,
66
+ };
67
+ const ThemeContext = createContext(defaultTheme);
68
+ export function ThemeProvider({ density = 'default', colors, children, }) {
69
+ const theme = useMemo(() => {
70
+ const resolvedColors = colors
71
+ ? deepMerge(defaultIntentColors, colors)
72
+ : defaultIntentColors;
73
+ return {
74
+ density,
75
+ components: themes[density],
76
+ colors: resolvedColors,
77
+ disabledColors: defaultDisabledColors,
78
+ };
79
+ }, [density, colors]);
80
+ return (_jsx(ThemeContext.Provider, { value: theme, children: children }));
81
+ }
82
+ // ---------------------------------------------------------------------------
83
+ // Hook
84
+ // ---------------------------------------------------------------------------
85
+ /**
86
+ * Access the current theme — density tokens, intent colours, and component tokens.
87
+ * Must be called within a ThemeProvider; falls back to the "default" density if not.
88
+ */
89
+ export function useTheme() {
90
+ return useContext(ThemeContext);
91
+ }
92
+ //# sourceMappingURL=ThemeContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeContext.js","sourceRoot":"","sources":["../../src/theme/ThemeContext.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,C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