@newtonedev/components 0.1.12 → 0.1.14

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 (227) hide show
  1. package/dist/_COMPONENT_TEMPLATE/ComponentName.styles.d.ts +4 -3
  2. package/dist/_COMPONENT_TEMPLATE/ComponentName.styles.d.ts.map +1 -1
  3. package/dist/_COMPONENT_TEMPLATE/ComponentName.types.d.ts +1 -1
  4. package/dist/_COMPONENT_TEMPLATE/ComponentName.types.d.ts.map +1 -1
  5. package/dist/composites/actions/Button/Button.d.ts +11 -1
  6. package/dist/composites/actions/Button/Button.d.ts.map +1 -1
  7. package/dist/composites/actions/Button/Button.styles.d.ts +1 -1
  8. package/dist/composites/actions/Button/Button.styles.d.ts.map +1 -1
  9. package/dist/composites/actions/Button/Button.types.d.ts +11 -1
  10. package/dist/composites/actions/Button/Button.types.d.ts.map +1 -1
  11. package/dist/composites/branding/LogoMonogram/LogoMonogram.d.ts +10 -0
  12. package/dist/composites/branding/LogoMonogram/LogoMonogram.d.ts.map +1 -0
  13. package/dist/composites/branding/LogoMonogram/LogoMonogram.types.d.ts +35 -0
  14. package/dist/composites/branding/LogoMonogram/LogoMonogram.types.d.ts.map +1 -0
  15. package/dist/composites/branding/LogoMonogram/index.d.ts +3 -0
  16. package/dist/composites/branding/LogoMonogram/index.d.ts.map +1 -0
  17. package/dist/composites/branding/LogoWordmark/LogoWordmark.d.ts +9 -0
  18. package/dist/composites/branding/LogoWordmark/LogoWordmark.d.ts.map +1 -0
  19. package/dist/composites/branding/LogoWordmark/LogoWordmark.types.d.ts +26 -0
  20. package/dist/composites/branding/LogoWordmark/LogoWordmark.types.d.ts.map +1 -0
  21. package/dist/composites/branding/LogoWordmark/index.d.ts +3 -0
  22. package/dist/composites/branding/LogoWordmark/index.d.ts.map +1 -0
  23. package/dist/composites/display/Chip/Chip.d.ts +25 -0
  24. package/dist/composites/display/Chip/Chip.d.ts.map +1 -0
  25. package/dist/composites/display/Chip/Chip.styles.d.ts +29 -0
  26. package/dist/composites/display/Chip/Chip.styles.d.ts.map +1 -0
  27. package/dist/composites/display/Chip/Chip.types.d.ts +63 -0
  28. package/dist/composites/display/Chip/Chip.types.d.ts.map +1 -0
  29. package/dist/composites/display/Chip/index.d.ts +3 -0
  30. package/dist/composites/display/Chip/index.d.ts.map +1 -0
  31. package/dist/composites/form-controls/Select/Select.d.ts.map +1 -1
  32. package/dist/composites/form-controls/Select/Select.styles.d.ts +2 -2
  33. package/dist/composites/form-controls/Select/Select.styles.d.ts.map +1 -1
  34. package/dist/composites/form-controls/Select/SelectOption.d.ts.map +1 -1
  35. package/dist/composites/form-controls/TextInput/TextInput.d.ts.map +1 -1
  36. package/dist/composites/form-controls/TextInput/TextInput.styles.d.ts +2 -2
  37. package/dist/composites/form-controls/TextInput/TextInput.styles.d.ts.map +1 -1
  38. package/dist/composites/form-controls/Toggle/Toggle.d.ts.map +1 -1
  39. package/dist/composites/form-controls/Toggle/Toggle.styles.d.ts +2 -2
  40. package/dist/composites/form-controls/Toggle/Toggle.styles.d.ts.map +1 -1
  41. package/dist/composites/layout/AppShell/AppShell.d.ts.map +1 -1
  42. package/dist/composites/layout/AppShell/AppShell.styles.d.ts +2 -2
  43. package/dist/composites/layout/AppShell/AppShell.styles.d.ts.map +1 -1
  44. package/dist/composites/layout/Card/Card.d.ts.map +1 -1
  45. package/dist/composites/layout/Card/Card.styles.d.ts +2 -2
  46. package/dist/composites/layout/Card/Card.styles.d.ts.map +1 -1
  47. package/dist/composites/layout/Card/Card.types.d.ts +1 -1
  48. package/dist/composites/layout/Card/Card.types.d.ts.map +1 -1
  49. package/dist/composites/layout/ContentCard/ContentCard.d.ts +33 -0
  50. package/dist/composites/layout/ContentCard/ContentCard.d.ts.map +1 -0
  51. package/dist/composites/layout/ContentCard/ContentCard.styles.d.ts +10 -0
  52. package/dist/composites/layout/ContentCard/ContentCard.styles.d.ts.map +1 -0
  53. package/dist/composites/layout/ContentCard/ContentCard.types.d.ts +52 -0
  54. package/dist/composites/layout/ContentCard/ContentCard.types.d.ts.map +1 -0
  55. package/dist/composites/layout/ContentCard/index.d.ts +3 -0
  56. package/dist/composites/layout/ContentCard/index.d.ts.map +1 -0
  57. package/dist/composites/layout/Divider/Divider.d.ts +25 -0
  58. package/dist/composites/layout/Divider/Divider.d.ts.map +1 -0
  59. package/dist/composites/layout/Divider/Divider.styles.d.ts +8 -0
  60. package/dist/composites/layout/Divider/Divider.styles.d.ts.map +1 -0
  61. package/dist/composites/layout/Divider/Divider.types.d.ts +25 -0
  62. package/dist/composites/layout/Divider/Divider.types.d.ts.map +1 -0
  63. package/dist/composites/layout/Divider/index.d.ts +3 -0
  64. package/dist/composites/layout/Divider/index.d.ts.map +1 -0
  65. package/dist/composites/layout/Navbar/Navbar.d.ts.map +1 -1
  66. package/dist/composites/layout/Navbar/Navbar.styles.d.ts +4 -2
  67. package/dist/composites/layout/Navbar/Navbar.styles.d.ts.map +1 -1
  68. package/dist/composites/layout/Sidebar/Sidebar.d.ts.map +1 -1
  69. package/dist/composites/layout/Sidebar/Sidebar.styles.d.ts +4 -2
  70. package/dist/composites/layout/Sidebar/Sidebar.styles.d.ts.map +1 -1
  71. package/dist/composites/overlays/Popover/Popover.d.ts.map +1 -1
  72. package/dist/composites/overlays/Popover/Popover.styles.d.ts +2 -2
  73. package/dist/composites/overlays/Popover/Popover.styles.d.ts.map +1 -1
  74. package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.d.ts +1 -1
  75. package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.d.ts.map +1 -1
  76. package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.d.ts +1 -1
  77. package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.d.ts.map +1 -1
  78. package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.types.d.ts +2 -0
  79. package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.types.d.ts.map +1 -1
  80. package/dist/composites/range-inputs/HueSlider/HueSlider.d.ts +3 -4
  81. package/dist/composites/range-inputs/HueSlider/HueSlider.d.ts.map +1 -1
  82. package/dist/composites/range-inputs/HueSlider/HueSlider.styles.d.ts +3 -3
  83. package/dist/composites/range-inputs/HueSlider/HueSlider.styles.d.ts.map +1 -1
  84. package/dist/composites/range-inputs/Slider/Slider.styles.d.ts +1 -1
  85. package/dist/composites/range-inputs/Slider/Slider.styles.d.ts.map +1 -1
  86. package/dist/index.cjs +1609 -1693
  87. package/dist/index.cjs.map +1 -1
  88. package/dist/index.d.ts +22 -24
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +1454 -1621
  91. package/dist/index.js.map +1 -1
  92. package/dist/primitives/Frame/Frame.d.ts +1 -35
  93. package/dist/primitives/Frame/Frame.d.ts.map +1 -1
  94. package/dist/primitives/Frame/Frame.styles.d.ts +13 -3
  95. package/dist/primitives/Frame/Frame.styles.d.ts.map +1 -1
  96. package/dist/primitives/Frame/Frame.types.d.ts +99 -1
  97. package/dist/primitives/Frame/Frame.types.d.ts.map +1 -1
  98. package/dist/primitives/Frame/Frame.utils.d.ts +1 -1
  99. package/dist/primitives/Frame/Frame.utils.d.ts.map +1 -1
  100. package/dist/primitives/Frame/index.d.ts +1 -1
  101. package/dist/primitives/Frame/index.d.ts.map +1 -1
  102. package/dist/primitives/Icon/Icon.d.ts.map +1 -1
  103. package/dist/primitives/Icon/Icon.types.d.ts +2 -2
  104. package/dist/primitives/Icon/Icon.types.d.ts.map +1 -1
  105. package/dist/primitives/Text/Text.d.ts +6 -4
  106. package/dist/primitives/Text/Text.d.ts.map +1 -1
  107. package/dist/primitives/Text/Text.spans.d.ts.map +1 -1
  108. package/dist/primitives/Text/Text.types.d.ts +4 -7
  109. package/dist/primitives/Text/Text.types.d.ts.map +1 -1
  110. package/dist/primitives/Wrapper/Wrapper.d.ts +1 -1
  111. package/dist/primitives/Wrapper/Wrapper.d.ts.map +1 -1
  112. package/dist/primitives/Wrapper/Wrapper.styles.d.ts +10 -2
  113. package/dist/primitives/Wrapper/Wrapper.styles.d.ts.map +1 -1
  114. package/dist/primitives/Wrapper/Wrapper.types.d.ts +31 -1
  115. package/dist/primitives/Wrapper/Wrapper.types.d.ts.map +1 -1
  116. package/package.json +3 -2
  117. package/src/_COMPONENT_TEMPLATE/ComponentName.styles.ts +4 -4
  118. package/src/_COMPONENT_TEMPLATE/ComponentName.tsx +2 -2
  119. package/src/_COMPONENT_TEMPLATE/ComponentName.types.ts +1 -1
  120. package/src/composites/actions/Button/Button.styles.ts +72 -55
  121. package/src/composites/actions/Button/Button.tsx +35 -14
  122. package/src/composites/actions/Button/Button.types.ts +13 -1
  123. package/src/composites/branding/LogoMonogram/LogoMonogram.tsx +29 -0
  124. package/src/composites/branding/LogoMonogram/LogoMonogram.types.ts +35 -0
  125. package/src/composites/branding/LogoMonogram/index.ts +2 -0
  126. package/src/composites/branding/LogoWordmark/LogoWordmark.tsx +29 -0
  127. package/src/composites/branding/LogoWordmark/LogoWordmark.types.ts +25 -0
  128. package/src/composites/branding/LogoWordmark/index.ts +2 -0
  129. package/src/composites/display/Chip/Chip.styles.ts +189 -0
  130. package/src/composites/display/Chip/Chip.tsx +97 -0
  131. package/src/composites/display/Chip/Chip.types.ts +74 -0
  132. package/src/composites/display/Chip/index.ts +2 -0
  133. package/src/composites/form-controls/Select/Select.styles.ts +10 -10
  134. package/src/composites/form-controls/Select/Select.tsx +9 -7
  135. package/src/composites/form-controls/Select/SelectOption.tsx +10 -8
  136. package/src/composites/form-controls/TextInput/TextInput.styles.ts +12 -9
  137. package/src/composites/form-controls/TextInput/TextInput.tsx +7 -5
  138. package/src/composites/form-controls/Toggle/Toggle.styles.ts +10 -7
  139. package/src/composites/form-controls/Toggle/Toggle.tsx +4 -3
  140. package/src/composites/layout/AppShell/AppShell.styles.ts +8 -4
  141. package/src/composites/layout/AppShell/AppShell.tsx +6 -2
  142. package/src/composites/layout/Card/Card.styles.ts +10 -5
  143. package/src/composites/layout/Card/Card.tsx +4 -3
  144. package/src/composites/layout/Card/Card.types.ts +1 -1
  145. package/src/composites/layout/ContentCard/ContentCard.styles.ts +44 -0
  146. package/src/composites/layout/ContentCard/ContentCard.tsx +71 -0
  147. package/src/composites/layout/ContentCard/ContentCard.types.ts +60 -0
  148. package/src/composites/layout/ContentCard/index.ts +2 -0
  149. package/src/composites/layout/Divider/Divider.styles.ts +30 -0
  150. package/src/composites/layout/Divider/Divider.tsx +46 -0
  151. package/src/composites/layout/Divider/Divider.types.ts +28 -0
  152. package/src/composites/layout/Divider/index.ts +2 -0
  153. package/src/composites/layout/Navbar/Navbar.styles.ts +7 -5
  154. package/src/composites/layout/Navbar/Navbar.tsx +4 -3
  155. package/src/composites/layout/Sidebar/Sidebar.styles.ts +7 -5
  156. package/src/composites/layout/Sidebar/Sidebar.tsx +4 -3
  157. package/src/composites/overlays/Popover/Popover.styles.ts +7 -5
  158. package/src/composites/overlays/Popover/Popover.tsx +4 -3
  159. package/src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.ts +4 -5
  160. package/src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.tsx +6 -2
  161. package/src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.types.ts +2 -0
  162. package/src/composites/range-inputs/HueSlider/HueSlider.styles.ts +13 -20
  163. package/src/composites/range-inputs/HueSlider/HueSlider.tsx +7 -8
  164. package/src/composites/range-inputs/Slider/Slider.styles.ts +8 -9
  165. package/src/composites/range-inputs/Slider/Slider.tsx +1 -1
  166. package/src/index.ts +108 -61
  167. package/src/primitives/Frame/Frame.styles.ts +55 -11
  168. package/src/primitives/Frame/Frame.tsx +140 -142
  169. package/src/primitives/Frame/Frame.types.ts +119 -1
  170. package/src/primitives/Frame/Frame.utils.ts +1 -1
  171. package/src/primitives/Frame/index.ts +4 -0
  172. package/src/primitives/Icon/Icon.tsx +9 -7
  173. package/src/primitives/Icon/Icon.types.ts +2 -2
  174. package/src/primitives/Text/Text.spans.ts +9 -5
  175. package/src/primitives/Text/Text.tsx +33 -22
  176. package/src/primitives/Text/Text.types.ts +4 -7
  177. package/src/primitives/Wrapper/Wrapper.styles.ts +33 -1
  178. package/src/primitives/Wrapper/Wrapper.tsx +23 -4
  179. package/src/primitives/Wrapper/Wrapper.types.ts +45 -0
  180. package/dist/fonts/GoogleFontLoader.d.ts +0 -20
  181. package/dist/fonts/GoogleFontLoader.d.ts.map +0 -1
  182. package/dist/fonts/IconFontLoader.d.ts +0 -13
  183. package/dist/fonts/IconFontLoader.d.ts.map +0 -1
  184. package/dist/fonts/SelfHostedFontLoader.d.ts +0 -14
  185. package/dist/fonts/SelfHostedFontLoader.d.ts.map +0 -1
  186. package/dist/fonts/buildGoogleFontsUrl.d.ts +0 -2
  187. package/dist/fonts/buildGoogleFontsUrl.d.ts.map +0 -1
  188. package/dist/fonts/measureFont.d.ts +0 -19
  189. package/dist/fonts/measureFont.d.ts.map +0 -1
  190. package/dist/fonts/reportQueue.d.ts +0 -7
  191. package/dist/fonts/reportQueue.d.ts.map +0 -1
  192. package/dist/fonts/useLocalCalibration.d.ts +0 -19
  193. package/dist/fonts/useLocalCalibration.d.ts.map +0 -1
  194. package/dist/fonts/useTypographyCalibrations.d.ts +0 -11
  195. package/dist/fonts/useTypographyCalibrations.d.ts.map +0 -1
  196. package/dist/theme/FrameContext.d.ts +0 -26
  197. package/dist/theme/FrameContext.d.ts.map +0 -1
  198. package/dist/theme/NewtoneProvider.d.ts +0 -40
  199. package/dist/theme/NewtoneProvider.d.ts.map +0 -1
  200. package/dist/theme/defaults.d.ts +0 -8
  201. package/dist/theme/defaults.d.ts.map +0 -1
  202. package/dist/theme/types.d.ts +0 -156
  203. package/dist/theme/types.d.ts.map +0 -1
  204. package/dist/theme/useBreakpoint.d.ts +0 -9
  205. package/dist/theme/useBreakpoint.d.ts.map +0 -1
  206. package/dist/tokens/computeTokens.d.ts +0 -151
  207. package/dist/tokens/computeTokens.d.ts.map +0 -1
  208. package/dist/tokens/types.d.ts +0 -162
  209. package/dist/tokens/types.d.ts.map +0 -1
  210. package/dist/tokens/useTokens.d.ts +0 -26
  211. package/dist/tokens/useTokens.d.ts.map +0 -1
  212. package/src/fonts/GoogleFontLoader.tsx +0 -80
  213. package/src/fonts/IconFontLoader.tsx +0 -51
  214. package/src/fonts/SelfHostedFontLoader.tsx +0 -44
  215. package/src/fonts/buildGoogleFontsUrl.ts +0 -2
  216. package/src/fonts/measureFont.ts +0 -55
  217. package/src/fonts/reportQueue.ts +0 -54
  218. package/src/fonts/useLocalCalibration.ts +0 -97
  219. package/src/fonts/useTypographyCalibrations.ts +0 -15
  220. package/src/theme/FrameContext.tsx +0 -31
  221. package/src/theme/NewtoneProvider.tsx +0 -84
  222. package/src/theme/defaults.ts +0 -71
  223. package/src/theme/types.ts +0 -191
  224. package/src/theme/useBreakpoint.ts +0 -14
  225. package/src/tokens/computeTokens.ts +0 -516
  226. package/src/tokens/types.ts +0 -146
  227. package/src/tokens/useTokens.ts +0 -62
package/dist/index.js CHANGED
@@ -1,782 +1,544 @@
1
- import React14, { createContext, useState, useMemo, useEffect, useContext, useCallback, useRef } from 'react';
2
- import { srgbToHex, getColor, DEFAULT_NEUTRAL_SATURATION, DEFAULT_NEUTRAL_HUE, DEFAULT_ACCENT_SATURATION, DEFAULT_ACCENT_HUE, DEFAULT_SUCCESS_SATURATION, DEFAULT_SUCCESS_HUE, DEFAULT_WARNING_SATURATION, DEFAULT_WARNING_HUE, DEFAULT_ERROR_SATURATION, DEFAULT_ERROR_HUE } from 'newtone';
3
- import { SEMANTIC_WEIGHT_MAP, ROLE_DEFAULT_WEIGHTS, BREAKPOINT_ROLE_SCALE, scaleRoleStep, resolveResponsiveSize, estimateLineWidths, REFERENCE_LINE_HEIGHT_RATIO, buildFontFeatureSettings, getBreakpointForWidth, fontConfigToFamily, DEFAULT_ROLE_SCALES, DEFAULT_LINE_HEIGHTS, DEFAULT_FONT_SIZES, DEFAULT_FONT_SLOTS, buildGoogleFontsUrl } from '@newtonedev/fonts';
4
- export { DEFAULT_FONT_SIZES, DEFAULT_LINE_HEIGHTS, DEFAULT_ROLE_SCALES, buildGoogleFontsUrl } from '@newtonedev/fonts';
5
- import { Text, View, useWindowDimensions, Pressable, TextInput as TextInput$1, ScrollView, PanResponder, Animated, StyleSheet } from 'react-native';
1
+ import { useTokens, useNewtoneTheme, useFrameContext, useBreakpoint, useTypographyCalibrations, useLocalCalibration, enqueueObservation, computeTokens, _ThemeContext, FrameContext } from 'newtone-api';
2
+ export { DEFAULT_FONT_SIZES, DEFAULT_LINE_HEIGHTS, DEFAULT_ROLE_SCALES, DEFAULT_THEME_CONFIG, DEFAULT_THEME_MAPPINGS, ERROR_DEFAULTS, FrameContext, NewtoneProvider, PRIMARY_DEFAULTS, SECONDARY_DEFAULTS, SUCCESS_DEFAULTS, TERTIARY_DEFAULTS, WARNING_DEFAULTS, buildGoogleFontsUrl, computeColors, computeSwatches, computeTokens, enqueueObservation, measureAvgCharWidth, resolveTheme, useBreakpoint, useFrameContext, useLocalCalibration, useNewtoneTheme, useScheme, useTokens, useTypographyCalibrations } from 'newtone-api';
3
+ import React16, { createContext, useState, useMemo, useEffect, useContext, useCallback, useRef } from 'react';
4
+ import { Text, View, Pressable, TextInput as TextInput$1, ScrollView, PanResponder, Animated, StyleSheet } from 'react-native';
5
+ import { SEMANTIC_WEIGHT_MAP, ROLE_DEFAULT_WEIGHTS, BREAKPOINT_ROLE_SCALE, scaleRoleStep, resolveResponsiveSize, estimateLineWidths, REFERENCE_LINE_HEIGHT_RATIO, buildFontFeatureSettings } from '@newtonedev/fonts';
6
+ import { srgbToHex, gamutMapToSrgb } from 'newtone';
6
7
 
7
- // src/theme/NewtoneProvider.tsx
8
- var DEFAULT_THEME_CONFIG = {
9
- colorSystem: {
10
- dynamicRange: {
11
- lightest: 1,
12
- darkest: 1
13
- },
14
- palettes: [
15
- { hue: DEFAULT_NEUTRAL_HUE, saturation: DEFAULT_NEUTRAL_SATURATION },
16
- { hue: DEFAULT_ACCENT_HUE, saturation: DEFAULT_ACCENT_SATURATION },
17
- { hue: DEFAULT_SUCCESS_HUE, saturation: DEFAULT_SUCCESS_SATURATION },
18
- { hue: DEFAULT_WARNING_HUE, saturation: DEFAULT_WARNING_SATURATION },
19
- { hue: DEFAULT_ERROR_HUE, saturation: DEFAULT_ERROR_SATURATION }
20
- ]
21
- },
22
- spacing: {
23
- "00": 0,
24
- // base * 0
25
- "02": 2,
26
- // base * 0.25
27
- "04": 4,
28
- // base * 0.5
29
- "06": 6,
30
- // base * 0.75
31
- "08": 8,
32
- // base * 1 (Medium preset, 8px base)
33
- "10": 10,
34
- // base * 1.25
35
- "12": 12,
36
- // base * 1.5
37
- "16": 16,
38
- // base * 2
39
- "20": 20,
40
- // base * 2.5
41
- "24": 24,
42
- // base * 3
43
- "32": 32,
44
- // base * 4
45
- "40": 40,
46
- // base * 5
47
- "48": 48
48
- // base * 6
49
- },
50
- radius: {
51
- none: 0,
52
- sm: 4,
53
- md: 6,
54
- lg: 8,
55
- xl: 12,
56
- pill: 999
57
- },
58
- typography: {
59
- fonts: DEFAULT_FONT_SLOTS,
60
- fontSizes: DEFAULT_FONT_SIZES,
61
- lineHeights: DEFAULT_LINE_HEIGHTS,
62
- roles: DEFAULT_ROLE_SCALES
63
- },
64
- icons: {
65
- variant: "rounded",
66
- // Material Design 3 aesthetic
67
- weight: 400,
68
- // Normal weight
69
- autoGrade: true
70
- // Enable mode-aware grade
71
- }
72
- };
73
-
74
- // src/fonts/GoogleFontLoader.tsx
75
- function GoogleFontLoader({ fonts }) {
76
- const linkRef = useRef(null);
77
- useEffect(() => {
78
- if (typeof document === "undefined") return;
79
- const url = buildGoogleFontsUrl(fonts);
80
- if (linkRef.current) {
81
- linkRef.current.remove();
82
- linkRef.current = null;
83
- }
84
- if (!url) return;
85
- const links = Array.from(document.head.querySelectorAll('link[rel="stylesheet"]'));
86
- if (links.some((el) => el.href === url)) return;
87
- const link = document.createElement("link");
88
- link.rel = "stylesheet";
89
- link.href = url;
90
- document.head.appendChild(link);
91
- linkRef.current = link;
92
- return () => {
93
- if (linkRef.current) {
94
- linkRef.current.remove();
95
- linkRef.current = null;
96
- }
97
- };
98
- }, [
99
- fonts.main.config.family,
100
- fonts.main.config.type,
101
- fonts.main.weights.regular,
102
- fonts.main.weights.medium,
103
- fonts.main.weights.bold,
104
- fonts.display.config.family,
105
- fonts.display.config.type,
106
- fonts.display.weights.regular,
107
- fonts.display.weights.medium,
108
- fonts.display.weights.bold,
109
- fonts.mono.config.family,
110
- fonts.mono.config.type,
111
- fonts.mono.weights.regular,
112
- fonts.mono.weights.medium,
113
- fonts.mono.weights.bold,
114
- fonts.currency.config.family,
115
- fonts.currency.config.type,
116
- fonts.currency.weights.regular,
117
- fonts.currency.weights.medium,
118
- fonts.currency.weights.bold
8
+ // src/index.ts
9
+ var hadKeyboardEvent = false;
10
+ var isListenerSetup = false;
11
+ function setupModality() {
12
+ if (isListenerSetup || typeof document === "undefined") return;
13
+ isListenerSetup = true;
14
+ const NAVIGATION_KEYS = /* @__PURE__ */ new Set([
15
+ "Tab",
16
+ "ArrowUp",
17
+ "ArrowDown",
18
+ "ArrowLeft",
19
+ "ArrowRight",
20
+ "Enter",
21
+ " ",
22
+ "Escape"
119
23
  ]);
120
- return null;
121
- }
122
- function SelfHostedFontLoader({ fontFaceCss }) {
123
- const styleRef = useRef(null);
124
- useEffect(() => {
125
- if (typeof document === "undefined") return;
126
- if (styleRef.current) {
127
- styleRef.current.remove();
128
- styleRef.current = null;
24
+ document.addEventListener("keydown", (e) => {
25
+ if (NAVIGATION_KEYS.has(e.key)) {
26
+ hadKeyboardEvent = true;
129
27
  }
130
- if (!fontFaceCss) return;
131
- const style = document.createElement("style");
132
- style.setAttribute("data-newtone-fonts", "self-hosted");
133
- style.textContent = fontFaceCss;
134
- document.head.appendChild(style);
135
- styleRef.current = style;
136
- return () => {
137
- if (styleRef.current) {
138
- styleRef.current.remove();
139
- styleRef.current = null;
140
- }
141
- };
142
- }, [fontFaceCss]);
143
- return null;
28
+ }, true);
29
+ document.addEventListener("pointerdown", () => {
30
+ hadKeyboardEvent = false;
31
+ }, true);
32
+ document.addEventListener("mousedown", () => {
33
+ hadKeyboardEvent = false;
34
+ }, true);
144
35
  }
145
- function IconFontLoader({ icons }) {
146
- const linkRef = useRef(null);
36
+ function useFocusVisible() {
37
+ const [isFocusVisible, setIsFocusVisible] = useState(false);
147
38
  useEffect(() => {
148
- if (typeof document === "undefined") return;
149
- const variantName = icons.variant.charAt(0).toUpperCase() + icons.variant.slice(1);
150
- const family = `Material+Symbols+${variantName}`;
151
- const url = `https://fonts.googleapis.com/css2?family=${family}:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=block`;
152
- if (linkRef.current) {
153
- linkRef.current.remove();
154
- linkRef.current = null;
39
+ setupModality();
40
+ }, []);
41
+ const onFocus = useCallback(() => {
42
+ if (hadKeyboardEvent) {
43
+ setIsFocusVisible(true);
155
44
  }
156
- const links = Array.from(document.head.querySelectorAll('link[rel="stylesheet"]'));
157
- if (links.some((el) => el.href === url)) return;
158
- const link = document.createElement("link");
159
- link.rel = "stylesheet";
160
- link.href = url;
161
- document.head.appendChild(link);
162
- linkRef.current = link;
163
- return () => {
164
- if (linkRef.current) {
165
- linkRef.current.remove();
166
- linkRef.current = null;
167
- }
168
- };
169
- }, [icons.variant]);
170
- return null;
45
+ }, []);
46
+ const onBlur = useCallback(() => {
47
+ setIsFocusVisible(false);
48
+ }, []);
49
+ const focusProps = { onFocus, onBlur };
50
+ return { isFocusVisible, focusProps };
171
51
  }
172
52
 
173
- // src/theme/NewtoneProvider.tsx
174
- var ThemeContext = createContext(null);
175
- function NewtoneProvider({
176
- config = DEFAULT_THEME_CONFIG,
177
- initialMode = "light",
178
- children,
179
- reportingEndpoint,
180
- fontFaceCss
181
- }) {
182
- const [mode, setMode] = useState(initialMode);
183
- const value = useMemo(
184
- () => ({
185
- config,
186
- mode,
187
- setMode,
188
- reportingEndpoint
189
- }),
190
- [config, mode, reportingEndpoint]
191
- );
192
- return /* @__PURE__ */ React14.createElement(ThemeContext.Provider, { value }, fontFaceCss ? /* @__PURE__ */ React14.createElement(SelfHostedFontLoader, { fontFaceCss }) : /* @__PURE__ */ React14.createElement(GoogleFontLoader, { fonts: config.typography.fonts }), /* @__PURE__ */ React14.createElement(IconFontLoader, { icons: config.icons }), children);
53
+ // src/primitives/Frame/Frame.utils.ts
54
+ function resolveSpacing(value, tokens) {
55
+ if (typeof value === "number") return value;
56
+ return tokens.spacing[value];
193
57
  }
194
- function useNewtoneTheme() {
195
- const context = useContext(ThemeContext);
196
- if (!context) {
197
- throw new Error("useNewtoneTheme must be used within NewtoneProvider");
198
- }
199
- return context;
200
- }
201
- var FrameContext = createContext(null);
202
- function useFrameContext() {
203
- return useContext(FrameContext);
204
- }
205
- var NEUTRAL_DEFAULTS = {
206
- light: {
207
- background: { elevated: 0, ground: 0.03, sunken: 0.06 },
208
- text: { primary: 0.9, secondary: 0.7, tertiary: 0.5, disabled: 0.3 },
209
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
210
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
211
- },
212
- dark: {
213
- background: { elevated: 0.24, ground: 0.2, sunken: 0.16 },
214
- text: { primary: 1, secondary: 0.85, tertiary: 0.7, disabled: 0.55 },
215
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
216
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
217
- }
218
- };
219
- var ACCENT_DEFAULTS = {
220
- light: {
221
- background: { elevated: 0, ground: 0.03, sunken: 0.06 },
222
- text: { primary: 0.9, secondary: 0.7, tertiary: 0.5, disabled: 0.3 },
223
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
224
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
225
- },
226
- dark: {
227
- background: { elevated: 0.24, ground: 0.2, sunken: 0.16 },
228
- text: { primary: 1, secondary: 0.85, tertiary: 0.7, disabled: 0.55 },
229
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
230
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
231
- }
232
- };
233
- var SUCCESS_DEFAULTS = {
234
- light: {
235
- background: { elevated: 0, ground: 0.03, sunken: 0.06 },
236
- text: { primary: 0.9, secondary: 0.7, tertiary: 0.5, disabled: 0.3 },
237
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
238
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
239
- },
240
- dark: {
241
- background: { elevated: 0.24, ground: 0.2, sunken: 0.16 },
242
- text: { primary: 1, secondary: 0.85, tertiary: 0.7, disabled: 0.55 },
243
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
244
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
245
- }
246
- };
247
- var WARNING_DEFAULTS = {
248
- light: {
249
- background: { elevated: 0, ground: 0.03, sunken: 0.06 },
250
- text: { primary: 0.9, secondary: 0.7, tertiary: 0.5, disabled: 0.3 },
251
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
252
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
253
- },
254
- dark: {
255
- background: { elevated: 0.24, ground: 0.2, sunken: 0.16 },
256
- text: { primary: 1, secondary: 0.85, tertiary: 0.7, disabled: 0.55 },
257
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
258
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
58
+ function resolvePadding(prop, tokens) {
59
+ if (typeof prop === "string" || typeof prop === "number") {
60
+ const px = resolveSpacing(prop, tokens);
61
+ return { top: px, right: px, bottom: px, left: px };
259
62
  }
260
- };
261
- var ERROR_DEFAULTS = {
262
- light: {
263
- background: { elevated: 0, ground: 0.03, sunken: 0.06 },
264
- text: { primary: 0.9, secondary: 0.7, tertiary: 0.5, disabled: 0.3 },
265
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
266
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
267
- },
268
- dark: {
269
- background: { elevated: 0.24, ground: 0.2, sunken: 0.16 },
270
- text: { primary: 1, secondary: 0.85, tertiary: 0.7, disabled: 0.55 },
271
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
272
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
63
+ if ("x" in prop || "y" in prop) {
64
+ const axes = prop;
65
+ const x = axes.x !== void 0 ? resolveSpacing(axes.x, tokens) : 0;
66
+ const y = axes.y !== void 0 ? resolveSpacing(axes.y, tokens) : 0;
67
+ return { top: y, right: x, bottom: y, left: x };
273
68
  }
274
- };
275
- var clamp = (n) => Math.max(0, Math.min(1, n));
276
- function computePaletteTokens(palette, defaults, mode, elevation, dynamicRange, elevationDelta, effectiveTextMode, autoAccentNv, neutralTextPrimary, neutralBgElevated) {
277
- const modeDefaults = defaults[mode];
278
- const toEngineNv = (nv) => mode === "light" ? 1 - nv : nv;
279
- const textToEngineNv = (nv) => effectiveTextMode === "light" ? 1 - nv : nv;
280
- const colorAt = (engineNv) => getColor(
281
- palette.hue,
282
- palette.saturation,
283
- dynamicRange,
284
- clamp(engineNv),
285
- palette.desaturation,
286
- palette.paletteHueGrading
287
- );
288
- const resolveKeyNv = (p) => mode === "dark" ? p.keyNormalizedValueDark : p.keyNormalizedValue;
289
- const keyNv = resolveKeyNv(palette);
290
- const fillBaseNv = keyNv ?? autoAccentNv;
291
- const fillNv = clamp(fillBaseNv + elevationDelta);
292
- const fill = colorAt(fillNv);
293
- const hoverDir = effectiveTextMode === "light" ? -modeDefaults.action.hovered : modeDefaults.action.hovered;
294
- const activeDir = effectiveTextMode === "light" ? -modeDefaults.action.pressed : modeDefaults.action.pressed;
295
- const fillHover = colorAt(clamp(fillNv + hoverDir));
296
- const fillActive = colorAt(clamp(fillNv + activeDir));
297
- const onFill = fill.oklch.L > 0.6 ? neutralTextPrimary : neutralBgElevated;
298
- const bgNormalized = elevation === 2 ? modeDefaults.background.elevated : elevation === 1 ? modeDefaults.background.ground : modeDefaults.background.sunken;
299
- const bgNv = clamp(toEngineNv(bgNormalized));
300
- const background = colorAt(bgNv);
301
- const backgroundElevated = colorAt(clamp(toEngineNv(modeDefaults.background.elevated)));
302
- const backgroundSunken = colorAt(clamp(toEngineNv(modeDefaults.background.sunken)));
303
- const interactiveOffset = modeDefaults.action.enabled;
304
- const interactiveNv = clamp(bgNv + (effectiveTextMode === "light" ? -interactiveOffset : interactiveOffset));
305
- const backgroundInteractive = colorAt(interactiveNv);
306
- const hoverShift = modeDefaults.action.hovered;
307
- const activeShift = modeDefaults.action.pressed;
308
- const backgroundInteractiveHover = colorAt(clamp(interactiveNv + (effectiveTextMode === "light" ? -hoverShift : hoverShift)));
309
- const backgroundInteractiveActive = colorAt(clamp(interactiveNv + (effectiveTextMode === "light" ? -activeShift : activeShift)));
310
- const textPrimary = colorAt(clamp(textToEngineNv(modeDefaults.text.primary) + elevationDelta));
311
- const textSecondary = colorAt(clamp(textToEngineNv(modeDefaults.text.secondary) + elevationDelta));
312
- const textTertiary = colorAt(clamp(textToEngineNv(modeDefaults.text.tertiary) + elevationDelta));
313
- const textDisabled = colorAt(clamp(textToEngineNv(modeDefaults.text.disabled) + elevationDelta));
314
- const borderOffset = modeDefaults.border.enabled;
315
- const borderNv = effectiveTextMode === "light" ? bgNv - borderOffset : bgNv + borderOffset;
316
- const border = colorAt(clamp(borderNv));
69
+ const sides = prop;
317
70
  return {
318
- fill,
319
- fillHover,
320
- fillActive,
321
- onFill,
322
- background,
323
- backgroundElevated,
324
- backgroundSunken,
325
- backgroundInteractive,
326
- backgroundInteractiveHover,
327
- backgroundInteractiveActive,
328
- textPrimary,
329
- textSecondary,
330
- textTertiary,
331
- textDisabled,
332
- border
71
+ top: sides.top !== void 0 ? resolveSpacing(sides.top, tokens) : 0,
72
+ right: sides.right !== void 0 ? resolveSpacing(sides.right, tokens) : 0,
73
+ bottom: sides.bottom !== void 0 ? resolveSpacing(sides.bottom, tokens) : 0,
74
+ left: sides.left !== void 0 ? resolveSpacing(sides.left, tokens) : 0
333
75
  };
334
76
  }
335
- function computeTokens(config, mode, elevation, spacing, radius, typography, icons, tokenOverrides) {
336
- const { dynamicRange, palettes } = config;
337
- const palette = palettes[0];
338
- if (!palette) {
339
- throw new Error("Neutral palette (index 0) not found");
340
- }
341
- const neutralDefaults = NEUTRAL_DEFAULTS[mode];
342
- const toEngineNv = (nv) => mode === "light" ? 1 - nv : nv;
343
- const bgElevatedNorm = mode === "light" ? tokenOverrides?.backgroundElevated : tokenOverrides?.backgroundElevatedDark;
344
- const bgDefaultNorm = mode === "light" ? tokenOverrides?.backgroundDefault : tokenOverrides?.backgroundDefaultDark;
345
- const bgSunkenNorm = mode === "light" ? tokenOverrides?.backgroundSunken : tokenOverrides?.backgroundSunkenDark;
346
- const textPrimaryNorm = mode === "light" ? tokenOverrides?.textPrimaryNormalized : tokenOverrides?.textPrimaryNormalizedDark;
347
- const textSecondaryNorm = mode === "light" ? tokenOverrides?.textSecondaryNormalized : tokenOverrides?.textSecondaryNormalizedDark;
348
- const textTertiaryNorm = mode === "light" ? tokenOverrides?.textTertiaryNormalized : tokenOverrides?.textTertiaryNormalizedDark;
349
- const textDisabledNorm = mode === "light" ? tokenOverrides?.textDisabledNormalized : tokenOverrides?.textDisabledNormalizedDark;
350
- const bgNormalized = elevation === 2 ? bgElevatedNorm ?? neutralDefaults.background.elevated : elevation === 1 ? bgDefaultNorm ?? neutralDefaults.background.ground : bgSunkenNorm ?? neutralDefaults.background.sunken;
351
- const backgroundNv = clamp(toEngineNv(bgNormalized));
352
- const elevatedNv = clamp(toEngineNv(bgElevatedNorm ?? neutralDefaults.background.elevated));
353
- const sunkenNv = clamp(toEngineNv(bgSunkenNorm ?? neutralDefaults.background.sunken));
354
- const elevationDelta = backgroundNv - elevatedNv;
355
- const effectiveTextMode = backgroundNv >= 0.5 ? "light" : "dark";
356
- const background = getColor(
357
- palette.hue,
358
- palette.saturation,
359
- dynamicRange,
360
- backgroundNv,
361
- palette.desaturation,
362
- palette.paletteHueGrading
363
- );
364
- const backgroundElevated = getColor(
365
- palette.hue,
366
- palette.saturation,
367
- dynamicRange,
368
- elevatedNv,
369
- palette.desaturation,
370
- palette.paletteHueGrading
371
- );
372
- const backgroundSunken = getColor(
373
- palette.hue,
374
- palette.saturation,
375
- dynamicRange,
376
- sunkenNv,
377
- palette.desaturation,
378
- palette.paletteHueGrading
379
- );
380
- const INTERACTIVE_COMPONENT_OFFSET = mode === "light" ? tokenOverrides?.interactiveComponentOffset ?? neutralDefaults.action.enabled : tokenOverrides?.interactiveComponentOffsetDark ?? neutralDefaults.action.enabled;
381
- const HOVER_SHIFT = mode === "light" ? tokenOverrides?.hoverShift ?? neutralDefaults.action.hovered : tokenOverrides?.hoverShiftDark ?? neutralDefaults.action.hovered;
382
- const ACTIVE_SHIFT = mode === "light" ? tokenOverrides?.activeShift ?? neutralDefaults.action.pressed : tokenOverrides?.activeShiftDark ?? neutralDefaults.action.pressed;
383
- const BORDER_OFFSET = mode === "light" ? tokenOverrides?.borderOffset ?? neutralDefaults.border.enabled : tokenOverrides?.borderOffsetDark ?? neutralDefaults.border.enabled;
384
- const interactiveComponentNv = clamp(backgroundNv + (effectiveTextMode === "light" ? -INTERACTIVE_COMPONENT_OFFSET : INTERACTIVE_COMPONENT_OFFSET));
385
- const backgroundInteractive = getColor(
386
- palette.hue,
387
- palette.saturation,
388
- dynamicRange,
389
- interactiveComponentNv,
390
- palette.desaturation,
391
- palette.paletteHueGrading
392
- );
393
- const neutralHoverNv = clamp(interactiveComponentNv + (effectiveTextMode === "light" ? -HOVER_SHIFT : HOVER_SHIFT));
394
- const backgroundInteractiveHover = getColor(
395
- palette.hue,
396
- palette.saturation,
397
- dynamicRange,
398
- neutralHoverNv,
399
- palette.desaturation,
400
- palette.paletteHueGrading
401
- );
402
- const neutralActiveNv = clamp(interactiveComponentNv + (effectiveTextMode === "light" ? -ACTIVE_SHIFT : ACTIVE_SHIFT));
403
- const backgroundInteractiveActive = getColor(
404
- palette.hue,
405
- palette.saturation,
406
- dynamicRange,
407
- neutralActiveNv,
408
- palette.desaturation,
409
- palette.paletteHueGrading
410
- );
411
- const textToEngineNv = (nv) => effectiveTextMode === "light" ? 1 - nv : nv;
412
- const textPrimary = getColor(
413
- palette.hue,
414
- palette.saturation,
415
- dynamicRange,
416
- clamp(textToEngineNv(textPrimaryNorm ?? neutralDefaults.text.primary) + elevationDelta),
417
- palette.desaturation,
418
- palette.paletteHueGrading
419
- );
420
- const textSecondary = getColor(
421
- palette.hue,
422
- palette.saturation,
423
- dynamicRange,
424
- clamp(textToEngineNv(textSecondaryNorm ?? neutralDefaults.text.secondary) + elevationDelta),
425
- palette.desaturation,
426
- palette.paletteHueGrading
427
- );
428
- const textTertiary = getColor(
429
- palette.hue,
430
- palette.saturation,
431
- dynamicRange,
432
- clamp(textToEngineNv(textTertiaryNorm ?? neutralDefaults.text.tertiary) + elevationDelta),
433
- palette.desaturation,
434
- palette.paletteHueGrading
435
- );
436
- const textDisabled = getColor(
437
- palette.hue,
438
- palette.saturation,
439
- dynamicRange,
440
- clamp(textToEngineNv(textDisabledNorm ?? neutralDefaults.text.disabled) + elevationDelta),
441
- palette.desaturation,
442
- palette.paletteHueGrading
443
- );
444
- const borderNv = effectiveTextMode === "light" ? backgroundNv - BORDER_OFFSET : backgroundNv + BORDER_OFFSET;
445
- const border = getColor(
446
- palette.hue,
447
- palette.saturation,
448
- dynamicRange,
449
- clamp(borderNv),
450
- palette.desaturation,
451
- palette.paletteHueGrading
452
- );
453
- const autoAccentNv = clamp(textToEngineNv(textPrimaryNorm ?? neutralDefaults.text.primary));
454
- const accentPalette = palettes[1];
455
- if (!accentPalette) {
456
- throw new Error("Accent palette (index 1) not found");
77
+ function resolveGap(prop, tokens) {
78
+ if (typeof prop === "string" || typeof prop === "number") {
79
+ const px = resolveSpacing(prop, tokens);
80
+ return { rowGap: px, columnGap: px };
457
81
  }
458
- const accent = computePaletteTokens(
459
- accentPalette,
460
- ACCENT_DEFAULTS,
461
- mode,
462
- elevation,
463
- dynamicRange,
464
- elevationDelta,
465
- effectiveTextMode,
466
- autoAccentNv,
467
- textPrimary,
468
- backgroundElevated
469
- );
470
- const successPalette = palettes[2];
471
- const warningPalette = palettes[3];
472
- const errorPalette = palettes[4];
473
- const success = successPalette ? computePaletteTokens(
474
- successPalette,
475
- SUCCESS_DEFAULTS,
476
- mode,
477
- elevation,
478
- dynamicRange,
479
- elevationDelta,
480
- effectiveTextMode,
481
- autoAccentNv,
482
- textPrimary,
483
- backgroundElevated
484
- ) : accent;
485
- const warning = warningPalette ? computePaletteTokens(
486
- warningPalette,
487
- WARNING_DEFAULTS,
488
- mode,
489
- elevation,
490
- dynamicRange,
491
- elevationDelta,
492
- effectiveTextMode,
493
- autoAccentNv,
494
- textPrimary,
495
- backgroundElevated
496
- ) : accent;
497
- const error = errorPalette ? computePaletteTokens(
498
- errorPalette,
499
- ERROR_DEFAULTS,
500
- mode,
501
- elevation,
502
- dynamicRange,
503
- elevationDelta,
504
- effectiveTextMode,
505
- autoAccentNv,
506
- textPrimary,
507
- backgroundElevated
508
- ) : accent;
509
82
  return {
510
- background,
511
- backgroundElevated,
512
- backgroundSunken,
513
- backgroundInteractive,
514
- backgroundInteractiveHover,
515
- backgroundInteractiveActive,
516
- textPrimary,
517
- textSecondary,
518
- textTertiary,
519
- textDisabled,
520
- border,
521
- accent,
522
- success,
523
- warning,
524
- error,
525
- spacing,
526
- radius,
527
- typography: {
528
- fonts: {
529
- main: {
530
- family: fontConfigToFamily(typography.fonts.main.config),
531
- weights: typography.fonts.main.weights
532
- },
533
- display: {
534
- family: fontConfigToFamily(typography.fonts.display.config),
535
- weights: typography.fonts.display.weights
536
- },
537
- mono: {
538
- family: fontConfigToFamily(typography.fonts.mono.config),
539
- weights: typography.fonts.mono.weights
540
- },
541
- currency: {
542
- family: fontConfigToFamily(typography.fonts.currency.config),
543
- weights: typography.fonts.currency.weights
544
- }
545
- },
546
- fontSizes: typography.fontSizes,
547
- lineHeights: typography.lineHeights
548
- },
549
- icons: {
550
- variant: icons.variant,
551
- weight: icons.weight,
552
- grade: icons.autoGrade ? mode === "light" ? -25 : 200 : 0
553
- }
83
+ rowGap: prop.row !== void 0 ? resolveSpacing(prop.row, tokens) : 0,
84
+ columnGap: prop.column !== void 0 ? resolveSpacing(prop.column, tokens) : 0
554
85
  };
555
86
  }
556
-
557
- // src/tokens/useTokens.ts
558
- function useTokens(elevation) {
559
- const { config, mode } = useNewtoneTheme();
560
- const frameCtx = useFrameContext();
561
- const resolvedElevation = elevation ?? frameCtx?.elevation ?? 1;
562
- const canReuse = frameCtx !== null && elevation === void 0 && frameCtx.elevation === resolvedElevation;
563
- return useMemo(() => {
564
- if (canReuse) {
565
- return { ...frameCtx.tokens, elevation: resolvedElevation };
566
- }
567
- const tokens = computeTokens(
568
- config.colorSystem,
569
- mode,
570
- resolvedElevation,
571
- config.spacing,
572
- config.radius,
573
- config.typography,
574
- config.icons,
575
- config.tokenOverrides
576
- );
577
- return { ...tokens, elevation: resolvedElevation };
578
- }, [config, mode, resolvedElevation, canReuse, frameCtx?.tokens]);
87
+ function resolveRadius(value, tokens) {
88
+ if (typeof value === "number") return value;
89
+ return tokens.radius[value];
579
90
  }
580
- function computeButtonPadding(size, hasIcon, hasText, iconPosition) {
581
- const basePadding = {
582
- sm: 8,
583
- md: 12,
584
- lg: 16
585
- };
586
- const base = basePadding[size];
587
- const textExtra = 8;
588
- if (!hasText && hasIcon) {
589
- return {
590
- paddingLeft: base,
591
- paddingRight: base,
592
- paddingTop: base,
593
- paddingBottom: base
594
- };
595
- }
596
- if (hasText && !hasIcon) {
597
- return {
598
- paddingLeft: base + textExtra,
599
- paddingRight: base + textExtra,
600
- paddingTop: base,
601
- paddingBottom: base
602
- };
603
- }
604
- if (hasText && hasIcon) {
605
- if (iconPosition === "left") {
606
- return {
607
- paddingLeft: base,
608
- paddingRight: base + textExtra,
609
- paddingTop: base,
610
- paddingBottom: base
611
- };
612
- } else {
613
- return {
614
- paddingLeft: base + textExtra,
615
- paddingRight: base,
616
- paddingTop: base,
617
- paddingBottom: base
618
- };
619
- }
91
+ function resolveRadiusCorners(prop, tokens) {
92
+ if (typeof prop === "string" || typeof prop === "number") {
93
+ const px = resolveRadius(prop, tokens);
94
+ return { topLeft: px, topRight: px, bottomLeft: px, bottomRight: px };
620
95
  }
621
96
  return {
622
- paddingLeft: base,
623
- paddingRight: base,
624
- paddingTop: base,
625
- paddingBottom: base
97
+ topLeft: prop.topLeft !== void 0 ? resolveRadius(prop.topLeft, tokens) : 0,
98
+ topRight: prop.topRight !== void 0 ? resolveRadius(prop.topRight, tokens) : 0,
99
+ bottomLeft: prop.bottomLeft !== void 0 ? resolveRadius(prop.bottomLeft, tokens) : 0,
100
+ bottomRight: prop.bottomRight !== void 0 ? resolveRadius(prop.bottomRight, tokens) : 0
626
101
  };
627
102
  }
628
- function getPaletteTokens(semantic, tokens) {
629
- switch (semantic) {
630
- case "accent":
631
- return tokens.accent;
632
- case "success":
633
- return tokens.success;
634
- case "error":
635
- return tokens.error;
636
- case "warning":
637
- return tokens.warning;
638
- default:
639
- return void 0;
640
- }
103
+ function hasPositiveRadius(corners) {
104
+ return corners.topLeft > 0 || corners.topRight > 0 || corners.bottomLeft > 0 || corners.bottomRight > 0;
641
105
  }
642
- function getButtonConfig(variant, semantic, size, disabled, tokens) {
643
- const sizeConfig = getSizeConfig(size, tokens);
644
- const variantColors = getVariantColors(variant, semantic, disabled, tokens);
645
- return {
646
- variantColors,
647
- sizeTokens: {
648
- padding: sizeConfig.padding,
649
- gap: sizeConfig.gap,
650
- borderRadius: sizeConfig.borderRadius,
651
- textSize: sizeConfig.textSize,
652
- iconSize: sizeConfig.iconSize
106
+ function resolveSizing(width, height) {
107
+ const style = {};
108
+ if (width !== void 0) {
109
+ if (width === "fill") {
110
+ style.flexGrow = 1;
111
+ style.width = "100%";
112
+ } else if (typeof width === "number") {
113
+ style.width = width;
653
114
  }
654
- };
655
- }
656
- function getSizeConfig(size, tokens) {
657
- const configs = {
658
- sm: {
659
- padding: 8,
660
- gap: tokens.spacing["08"],
661
- borderRadius: 8,
662
- textSize: "md",
663
- // 16px
664
- iconSize: 24
665
- },
666
- md: {
667
- padding: 12,
668
- gap: tokens.spacing["08"],
669
- borderRadius: 12,
670
- textSize: "md",
671
- // 16px
672
- iconSize: 24
673
- },
674
- lg: {
675
- padding: 16,
676
- gap: tokens.spacing["08"],
677
- borderRadius: 16,
678
- textSize: "md",
679
- // 16px
680
- iconSize: 24
115
+ }
116
+ if (height !== void 0) {
117
+ if (height === "fill") {
118
+ style.flexGrow = 1;
119
+ style.height = "100%";
120
+ } else if (typeof height === "number") {
121
+ style.height = height;
681
122
  }
682
- };
683
- return configs[size];
123
+ }
124
+ return style;
684
125
  }
685
- function getVariantColors(variant, semantic, disabled, tokens) {
686
- if (disabled) {
687
- const baseColors = getVariantColorsForState(variant, semantic, tokens);
688
- const disabledBg = srgbToHex(tokens.backgroundSunken.srgb);
689
- return {
690
- ...baseColors,
691
- bg: disabledBg,
692
- hoveredBg: disabledBg,
693
- pressedBg: disabledBg,
694
- textColor: srgbToHex(tokens.textSecondary.srgb),
695
- iconColor: srgbToHex(tokens.textSecondary.srgb)
696
- };
126
+ var ALIGN_MAP = {
127
+ start: "flex-start",
128
+ center: "center",
129
+ end: "flex-end",
130
+ stretch: "stretch",
131
+ baseline: "baseline"
132
+ };
133
+ var JUSTIFY_MAP = {
134
+ start: "flex-start",
135
+ center: "center",
136
+ end: "flex-end",
137
+ between: "space-between",
138
+ around: "space-around",
139
+ evenly: "space-evenly"
140
+ };
141
+ function resolveAlignment(align) {
142
+ return ALIGN_MAP[align];
143
+ }
144
+ function resolveJustification(justify) {
145
+ return JUSTIFY_MAP[justify];
146
+ }
147
+ function resolveFlexDirection(direction, reverse) {
148
+ if (direction === "horizontal") {
149
+ return reverse ? "row-reverse" : "row";
697
150
  }
698
- return getVariantColorsForState(variant, semantic, tokens);
151
+ return reverse ? "column-reverse" : "column";
699
152
  }
700
- function getVariantColorsForState(variant, semantic, tokens) {
701
- const paletteTokens = getPaletteTokens(semantic, tokens);
702
- if (variant === "primary") {
703
- if (semantic === "neutral") {
704
- return {
705
- bg: srgbToHex(tokens.backgroundInteractive.srgb),
706
- hoveredBg: srgbToHex(tokens.backgroundInteractiveHover.srgb),
707
- pressedBg: srgbToHex(tokens.backgroundInteractiveActive.srgb),
708
- textColor: srgbToHex(tokens.textPrimary.srgb),
709
- iconColor: srgbToHex(tokens.textPrimary.srgb),
710
- borderWidth: 1,
711
- borderColor: "transparent"
712
- };
153
+
154
+ // src/primitives/Frame/Frame.styles.ts
155
+ function getFrameStyles(input) {
156
+ const {
157
+ tokens,
158
+ frameElevation,
159
+ theme = "primary",
160
+ appearance = "main",
161
+ layout = "flex",
162
+ direction = "vertical",
163
+ wrap = false,
164
+ reverse = false,
165
+ columns,
166
+ rows,
167
+ align,
168
+ justify,
169
+ padding,
170
+ gap,
171
+ width,
172
+ height,
173
+ minWidth,
174
+ maxWidth,
175
+ minHeight,
176
+ maxHeight,
177
+ position,
178
+ top,
179
+ right,
180
+ bottom,
181
+ left,
182
+ zIndex,
183
+ overflow,
184
+ opacity,
185
+ radius,
186
+ bordered = false,
187
+ disabled = false
188
+ } = input;
189
+ const container = {};
190
+ const appearanceTokens = tokens.colors[theme][appearance];
191
+ container.backgroundColor = appearanceTokens.background;
192
+ container.color = appearanceTokens.fontPrimary;
193
+ if (layout === "flex") {
194
+ container.display = "flex";
195
+ container.flexDirection = resolveFlexDirection(direction, reverse);
196
+ if (wrap) container.flexWrap = "wrap";
197
+ }
198
+ if (layout === "grid") {
199
+ container.display = "flex";
200
+ container.flexDirection = "row";
201
+ container.flexWrap = "wrap";
202
+ }
203
+ if (align) container.alignItems = resolveAlignment(align);
204
+ if (justify) container.justifyContent = resolveJustification(justify);
205
+ if (padding !== void 0) {
206
+ const p = resolvePadding(padding, tokens);
207
+ container.paddingTop = p.top;
208
+ container.paddingRight = p.right;
209
+ container.paddingBottom = p.bottom;
210
+ container.paddingLeft = p.left;
211
+ }
212
+ if (gap !== void 0) {
213
+ const g = resolveGap(gap, tokens);
214
+ container.rowGap = g.rowGap;
215
+ container.columnGap = g.columnGap;
216
+ }
217
+ const sizing = resolveSizing(width, height);
218
+ Object.assign(container, sizing);
219
+ if (minWidth !== void 0) container.minWidth = minWidth;
220
+ if (maxWidth !== void 0) container.maxWidth = maxWidth;
221
+ if (minHeight !== void 0) container.minHeight = minHeight;
222
+ if (maxHeight !== void 0) container.maxHeight = maxHeight;
223
+ if (position) container.position = position;
224
+ if (top !== void 0) container.top = top;
225
+ if (right !== void 0) container.right = right;
226
+ if (bottom !== void 0) container.bottom = bottom;
227
+ if (left !== void 0) container.left = left;
228
+ if (zIndex !== void 0) container.zIndex = zIndex;
229
+ if (radius !== void 0) {
230
+ const corners = resolveRadiusCorners(radius, tokens);
231
+ container.borderTopLeftRadius = corners.topLeft;
232
+ container.borderTopRightRadius = corners.topRight;
233
+ container.borderBottomLeftRadius = corners.bottomLeft;
234
+ container.borderBottomRightRadius = corners.bottomRight;
235
+ if (hasPositiveRadius(corners)) {
236
+ container.overflow = "hidden";
713
237
  }
714
- return {
715
- bg: srgbToHex(paletteTokens.fill.srgb),
716
- hoveredBg: srgbToHex(paletteTokens.fillHover.srgb),
717
- pressedBg: srgbToHex(paletteTokens.fillActive.srgb),
718
- textColor: srgbToHex(paletteTokens.onFill.srgb),
719
- iconColor: srgbToHex(paletteTokens.onFill.srgb),
720
- borderWidth: 1,
721
- borderColor: "transparent"
238
+ }
239
+ if (overflow) container.overflow = overflow;
240
+ if (bordered) {
241
+ container.borderWidth = 1;
242
+ container.borderColor = appearanceTokens.fontTertiary;
243
+ }
244
+ if (frameElevation === 2) {
245
+ container.shadowColor = "#000";
246
+ container.shadowOffset = { width: 0, height: 2 };
247
+ container.shadowOpacity = 0.12;
248
+ container.shadowRadius = 6;
249
+ container.elevation = 4;
250
+ }
251
+ if (opacity !== void 0) {
252
+ container.opacity = opacity;
253
+ } else if (disabled) {
254
+ container.opacity = 0.5;
255
+ }
256
+ const pressed = StyleSheet.create({
257
+ s: { backgroundColor: appearanceTokens.fontSecondary }
258
+ }).s;
259
+ let gridWebStyle = null;
260
+ if (layout === "grid") {
261
+ gridWebStyle = {
262
+ display: "grid",
263
+ // Divide into equal-width columns (e.g. 3 columns → "repeat(3, 1fr)").
264
+ gridTemplateColumns: columns ? `repeat(${columns}, 1fr)` : void 0,
265
+ gridTemplateRows: rows ? `repeat(${rows}, 1fr)` : void 0
722
266
  };
723
267
  }
724
- if (variant === "secondary") {
725
- if (semantic === "neutral") {
726
- return {
727
- bg: "transparent",
728
- hoveredBg: srgbToHex(tokens.backgroundInteractive.srgb),
729
- pressedBg: srgbToHex(tokens.backgroundInteractiveHover.srgb),
730
- textColor: srgbToHex(tokens.textPrimary.srgb),
731
- iconColor: srgbToHex(tokens.textPrimary.srgb),
732
- borderWidth: 1,
733
- borderColor: srgbToHex(tokens.border.srgb)
734
- };
268
+ const insetBoxShadow = frameElevation === -2 ? "inset 0 2px 4px rgba(0,0,0,0.12)" : null;
269
+ return {
270
+ // Validate and optimize the container styles through StyleSheet.create(),
271
+ // then extract the single style object with `.c`.
272
+ container: StyleSheet.create({ c: container }).c,
273
+ pressed,
274
+ gridWebStyle,
275
+ insetBoxShadow
276
+ };
277
+ }
278
+
279
+ // src/primitives/Frame/Frame.tsx
280
+ function wrapTextChildren(children, textStyle) {
281
+ return React16.Children.map(children, (child) => {
282
+ if (typeof child === "string" || typeof child === "number") {
283
+ return /* @__PURE__ */ React16.createElement(Text, { style: textStyle }, child);
284
+ }
285
+ return child;
286
+ });
287
+ }
288
+ var ELEVATION_MAP = {
289
+ 0: "sunken",
290
+ 1: "grounded",
291
+ 2: "elevated"
292
+ };
293
+ function toElevationLevel(frameElevation) {
294
+ if (frameElevation <= -1) return 0;
295
+ if (frameElevation === 0) return 1;
296
+ return 2;
297
+ }
298
+ function Frame({
299
+ children,
300
+ // Elevation
301
+ elevation,
302
+ // Scheme
303
+ scheme,
304
+ // Theme / Appearance
305
+ theme,
306
+ appearance,
307
+ // Layout
308
+ layout,
309
+ direction,
310
+ wrap,
311
+ reverse,
312
+ columns,
313
+ rows,
314
+ // Alignment
315
+ align,
316
+ justify,
317
+ // Spacing
318
+ padding,
319
+ gap,
320
+ // Sizing
321
+ width,
322
+ height,
323
+ minWidth,
324
+ maxWidth,
325
+ minHeight,
326
+ maxHeight,
327
+ // Positioning
328
+ position,
329
+ top,
330
+ right,
331
+ bottom,
332
+ left,
333
+ zIndex,
334
+ overflow,
335
+ pointerEvents,
336
+ opacity,
337
+ // Appearance
338
+ radius,
339
+ bordered,
340
+ // Interactivity
341
+ onPress,
342
+ href,
343
+ disabled = false,
344
+ // Accessibility
345
+ accessibilityLabel,
346
+ accessibilityHint,
347
+ // Testing & platform
348
+ testID,
349
+ nativeID,
350
+ ref,
351
+ // Style override
352
+ style
353
+ }) {
354
+ const themeCtx = useNewtoneTheme();
355
+ const { mode, gamut } = themeCtx;
356
+ const parentFrameCtx = useFrameContext();
357
+ const resolvedConfig = useMemo(() => {
358
+ if (scheme && themeCtx.schemes) {
359
+ const schemeConfig = themeCtx.schemes[scheme];
360
+ if (schemeConfig) return schemeConfig;
735
361
  }
362
+ return themeCtx.config;
363
+ }, [scheme, themeCtx.schemes, themeCtx.config]);
364
+ const isSchemeOverride = resolvedConfig !== themeCtx.config;
365
+ const resolvedTheme = theme ?? parentFrameCtx?.theme ?? "primary";
366
+ const resolvedAppearance = appearance ?? parentFrameCtx?.appearance ?? "main";
367
+ const resolvedFrameElevation = elevation ?? 0;
368
+ const resolvedElevation = elevation !== void 0 ? toElevationLevel(elevation) : parentFrameCtx?.elevation ?? 1;
369
+ const tokens = useMemo(() => {
370
+ return computeTokens(
371
+ resolvedConfig.colorSystem,
372
+ mode,
373
+ gamut,
374
+ ELEVATION_MAP[resolvedElevation],
375
+ resolvedConfig.spacing,
376
+ resolvedConfig.radius,
377
+ resolvedConfig.typography,
378
+ resolvedConfig.icons,
379
+ resolvedConfig.themeMappings,
380
+ resolvedConfig.swatchDefaults
381
+ );
382
+ }, [resolvedConfig, mode, gamut, resolvedElevation]);
383
+ const styles = useMemo(
384
+ () => getFrameStyles({
385
+ tokens,
386
+ frameElevation: resolvedFrameElevation,
387
+ theme: resolvedTheme,
388
+ appearance: resolvedAppearance,
389
+ layout,
390
+ direction,
391
+ wrap,
392
+ reverse,
393
+ columns,
394
+ rows,
395
+ align,
396
+ justify,
397
+ padding,
398
+ gap,
399
+ width,
400
+ height,
401
+ minWidth,
402
+ maxWidth,
403
+ minHeight,
404
+ maxHeight,
405
+ position,
406
+ top,
407
+ right,
408
+ bottom,
409
+ left,
410
+ zIndex,
411
+ overflow,
412
+ opacity,
413
+ radius,
414
+ bordered,
415
+ disabled
416
+ }),
417
+ [
418
+ tokens,
419
+ resolvedFrameElevation,
420
+ resolvedTheme,
421
+ resolvedAppearance,
422
+ layout,
423
+ direction,
424
+ wrap,
425
+ reverse,
426
+ columns,
427
+ rows,
428
+ align,
429
+ justify,
430
+ padding,
431
+ gap,
432
+ width,
433
+ height,
434
+ minWidth,
435
+ maxWidth,
436
+ minHeight,
437
+ maxHeight,
438
+ position,
439
+ top,
440
+ right,
441
+ bottom,
442
+ left,
443
+ zIndex,
444
+ overflow,
445
+ opacity,
446
+ radius,
447
+ bordered,
448
+ disabled
449
+ ]
450
+ );
451
+ const resolvedScheme = scheme ?? parentFrameCtx?.scheme;
452
+ const contextValue = useMemo(
453
+ () => ({
454
+ elevation: resolvedElevation,
455
+ tokens,
456
+ scheme: resolvedScheme,
457
+ theme: resolvedTheme,
458
+ appearance: resolvedAppearance
459
+ }),
460
+ [resolvedElevation, tokens, resolvedScheme, resolvedTheme, resolvedAppearance]
461
+ );
462
+ const schemeThemeCtx = useMemo(() => {
463
+ if (!isSchemeOverride) return null;
736
464
  return {
737
- bg: srgbToHex(paletteTokens.background.srgb),
738
- hoveredBg: srgbToHex(paletteTokens.backgroundInteractive.srgb),
739
- pressedBg: srgbToHex(paletteTokens.backgroundInteractiveHover.srgb),
740
- textColor: srgbToHex(paletteTokens.fill.srgb),
741
- iconColor: srgbToHex(paletteTokens.fill.srgb),
742
- borderWidth: 1,
743
- borderColor: "transparent"
465
+ ...themeCtx,
466
+ config: resolvedConfig,
467
+ activeScheme: scheme ?? themeCtx.activeScheme
744
468
  };
469
+ }, [isSchemeOverride, themeCtx, resolvedConfig, scheme]);
470
+ const webOverrides = [];
471
+ if (styles.gridWebStyle) {
472
+ webOverrides.push(styles.gridWebStyle);
745
473
  }
746
- if (variant === "tertiary") {
747
- if (semantic === "neutral") {
748
- return {
749
- bg: "transparent",
750
- hoveredBg: srgbToHex(tokens.backgroundInteractive.srgb),
751
- pressedBg: srgbToHex(tokens.backgroundInteractiveHover.srgb),
752
- textColor: srgbToHex(tokens.textPrimary.srgb),
753
- iconColor: srgbToHex(tokens.textPrimary.srgb),
754
- borderWidth: 1,
755
- borderColor: "transparent"
756
- };
757
- }
758
- return {
759
- bg: "transparent",
760
- hoveredBg: srgbToHex(paletteTokens.background.srgb),
761
- pressedBg: srgbToHex(paletteTokens.backgroundInteractive.srgb),
762
- textColor: srgbToHex(paletteTokens.fill.srgb),
763
- iconColor: srgbToHex(paletteTokens.fill.srgb),
764
- borderWidth: 1,
765
- borderColor: "transparent"
766
- };
474
+ if (styles.insetBoxShadow) {
475
+ webOverrides.push({ boxShadow: styles.insetBoxShadow });
767
476
  }
768
- return {
769
- bg: "transparent",
770
- hoveredBg: "transparent",
771
- pressedBg: "transparent",
772
- textColor: srgbToHex(tokens.textPrimary.srgb),
773
- iconColor: srgbToHex(tokens.textPrimary.srgb),
774
- borderWidth: 0
775
- };
477
+ const userStyles = Array.isArray(style) ? style : style ? [style] : [];
478
+ const isInteractive = onPress !== void 0 || href !== void 0;
479
+ const { isFocusVisible, focusProps } = useFocusVisible();
480
+ const focusRingStyle = isFocusVisible && !disabled ? {
481
+ outlineWidth: 2,
482
+ outlineStyle: "solid",
483
+ outlineColor: tokens.colors[resolvedTheme].emphasis.background,
484
+ outlineOffset: 2
485
+ } : void 0;
486
+ const webFocusProps = isInteractive ? focusProps : {};
487
+ const textStyle = useMemo(
488
+ () => ({
489
+ color: tokens.colors[resolvedTheme][resolvedAppearance].fontPrimary,
490
+ fontSize: tokens.typography.fontSizes["05"],
491
+ fontFamily: tokens.typography.fonts.main.family,
492
+ lineHeight: tokens.typography.lineHeights["06"]
493
+ }),
494
+ [tokens, resolvedTheme, resolvedAppearance]
495
+ );
496
+ const wrappedChildren = useMemo(
497
+ () => wrapTextChildren(children, textStyle),
498
+ [children, textStyle]
499
+ );
500
+ const content = isInteractive ? /* @__PURE__ */ React16.createElement(
501
+ Pressable,
502
+ {
503
+ ref,
504
+ testID,
505
+ nativeID,
506
+ pointerEvents,
507
+ accessibilityLabel,
508
+ accessibilityHint,
509
+ accessibilityState: disabled ? { disabled: true } : void 0,
510
+ onPress,
511
+ disabled,
512
+ ...href ? { href, accessibilityRole: "link" } : { accessibilityRole: "button" },
513
+ ...webFocusProps,
514
+ style: ({ pressed }) => [
515
+ styles.container,
516
+ pressed && !disabled && styles.pressed,
517
+ focusRingStyle,
518
+ ...webOverrides,
519
+ ...userStyles
520
+ ]
521
+ },
522
+ wrappedChildren
523
+ ) : /* @__PURE__ */ React16.createElement(
524
+ View,
525
+ {
526
+ ref,
527
+ testID,
528
+ nativeID,
529
+ pointerEvents,
530
+ accessibilityLabel,
531
+ accessibilityHint,
532
+ style: [styles.container, ...webOverrides, ...userStyles]
533
+ },
534
+ wrappedChildren
535
+ );
536
+ const wrappedContent = schemeThemeCtx ? /* @__PURE__ */ React16.createElement(_ThemeContext.Provider, { value: schemeThemeCtx }, content) : content;
537
+ return /* @__PURE__ */ React16.createElement(FrameContext.Provider, { value: contextValue }, wrappedContent);
776
538
  }
777
539
  function Icon({
778
- name,
779
- size,
540
+ name = "add",
541
+ size = 24,
780
542
  opticalSize,
781
543
  fill = 0,
782
544
  color,
@@ -789,6 +551,9 @@ function Icon({
789
551
  ref
790
552
  }) {
791
553
  const tokens = useTokens();
554
+ const frameCtx = useFrameContext();
555
+ const resolvedTheme = frameCtx?.theme ?? "primary";
556
+ const resolvedAppearance = frameCtx?.appearance ?? "main";
792
557
  const iconStyle = useMemo(() => {
793
558
  const fontSize = size ?? tokens.typography.fontSizes["05"];
794
559
  const getOpticalSize = (size2) => {
@@ -798,7 +563,7 @@ function Icon({
798
563
  return 48;
799
564
  };
800
565
  const opsz = opticalSize ?? getOpticalSize(fontSize);
801
- const iconColor = color ?? srgbToHex(tokens.textPrimary.srgb);
566
+ const iconColor = color ?? tokens.colors[resolvedTheme][resolvedAppearance].fontPrimary;
802
567
  const fontFamily = `Material Symbols ${tokens.icons.variant.charAt(0).toUpperCase() + tokens.icons.variant.slice(1)}`;
803
568
  const fillValue = typeof fill === "boolean" ? fill ? 1 : 0 : fill;
804
569
  const fontVariationSettings = `'FILL' ${fillValue}, 'wght' ${tokens.icons.weight}, 'GRAD' ${tokens.icons.grade}, 'opsz' ${opsz}`;
@@ -818,8 +583,8 @@ function Icon({
818
583
  // web-only: controls the variable font axes listed above
819
584
  ...style
820
585
  };
821
- }, [tokens, size, opticalSize, fill, color, style]);
822
- return /* @__PURE__ */ React14.createElement(
586
+ }, [tokens, size, opticalSize, fill, color, style, resolvedTheme, resolvedAppearance]);
587
+ return /* @__PURE__ */ React16.createElement(
823
588
  Text,
824
589
  {
825
590
  ref,
@@ -832,146 +597,173 @@ function Icon({
832
597
  name
833
598
  );
834
599
  }
835
-
836
- // src/fonts/measureFont.ts
837
- var REF_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ";
838
- function withTimeout(promise, ms, fallback) {
839
- return Promise.race([
840
- promise,
841
- new Promise((resolve) => setTimeout(() => resolve(fallback), ms))
842
- ]);
843
- }
844
- async function measureAvgCharWidth(fontFamily, fontWeight, fallback, fontSize = 16) {
845
- if (typeof document === "undefined") return 0.55;
846
- try {
847
- await withTimeout(
848
- document.fonts.load(`${fontWeight} ${fontSize}px "${fontFamily}"`),
849
- 3e3,
850
- []
851
- );
852
- const canvas = document.createElement("canvas");
853
- const ctx = canvas.getContext("2d");
854
- if (!ctx) return 0.55;
855
- ctx.font = `${fontWeight} ${fontSize}px "${fontFamily}", ${fallback}`;
856
- const ratio = ctx.measureText(REF_STRING).width / REF_STRING.length / fontSize;
857
- return Math.round(ratio * 1e3) / 1e3;
858
- } catch {
859
- return 0.55;
860
- }
861
- }
862
-
863
- // src/fonts/useLocalCalibration.ts
864
- var STORAGE_KEY = "newtone:font-metrics:v1";
865
- var TTL_MS = 7 * 24 * 60 * 60 * 1e3;
866
- function readCache() {
867
- if (typeof localStorage === "undefined") return {};
868
- try {
869
- const raw = localStorage.getItem(STORAGE_KEY);
870
- return raw ? JSON.parse(raw) : {};
871
- } catch {
872
- return {};
873
- }
874
- }
875
- function writeCache(cache) {
876
- if (typeof localStorage === "undefined") return;
877
- try {
878
- localStorage.setItem(STORAGE_KEY, JSON.stringify(cache));
879
- } catch {
880
- }
881
- }
882
- function cacheKey(fontFamily, fontWeight) {
883
- return `${fontFamily}:${fontWeight}`;
884
- }
885
- function useLocalCalibration(fontFamily, fontWeight, fallback, baseCalibration) {
886
- const key = cacheKey(fontFamily, fontWeight);
887
- const [ratio, setRatio] = useState(() => {
888
- const cache = readCache();
889
- const entry = cache[key];
890
- if (entry && Date.now() - entry.measuredAt < TTL_MS) {
891
- return entry.ratio;
892
- }
893
- return baseCalibration ?? 0.55;
894
- });
895
- useEffect(() => {
896
- const cache = readCache();
897
- const entry = cache[key];
898
- if (entry && Date.now() - entry.measuredAt < TTL_MS) {
899
- if (entry.ratio !== ratio) setRatio(entry.ratio);
900
- return;
901
- }
902
- let cancelled = false;
903
- measureAvgCharWidth(fontFamily, fontWeight, fallback).then((measured) => {
904
- if (cancelled) return;
905
- const updated = { ...readCache(), [key]: { ratio: measured, measuredAt: Date.now() } };
906
- writeCache(updated);
907
- setRatio(measured);
908
- });
909
- return () => {
910
- cancelled = true;
911
- };
912
- }, [key, fontFamily, fontWeight, fallback]);
913
- return ratio;
914
- }
915
-
916
- // src/fonts/useTypographyCalibrations.ts
917
- function useTypographyCalibrations() {
918
- const { config } = useNewtoneTheme();
919
- return config.typography.calibrations ?? {};
920
- }
921
-
922
- // src/fonts/reportQueue.ts
923
- var queue = [];
924
- var flushTimer;
925
- function flush() {
926
- if (queue.length === 0) return;
927
- const byEndpoint = /* @__PURE__ */ new Map();
928
- for (const item of queue) {
929
- const group = byEndpoint.get(item.endpoint) ?? [];
930
- group.push(item.payload);
931
- byEndpoint.set(item.endpoint, group);
600
+ function getWrapperStyles(input) {
601
+ const {
602
+ tokens,
603
+ direction = "vertical",
604
+ wrap = false,
605
+ reverse = false,
606
+ align,
607
+ justify,
608
+ padding,
609
+ gap,
610
+ width,
611
+ height,
612
+ minWidth,
613
+ maxWidth,
614
+ minHeight,
615
+ maxHeight,
616
+ position,
617
+ top,
618
+ right,
619
+ bottom,
620
+ left,
621
+ zIndex,
622
+ overflow,
623
+ opacity
624
+ } = input;
625
+ const container = {};
626
+ container.flexDirection = resolveFlexDirection(direction, reverse);
627
+ if (wrap) container.flexWrap = "wrap";
628
+ if (align) container.alignItems = resolveAlignment(align);
629
+ if (justify) container.justifyContent = resolveJustification(justify);
630
+ if (padding !== void 0) {
631
+ const p = resolvePadding(padding, tokens);
632
+ container.paddingTop = p.top;
633
+ container.paddingRight = p.right;
634
+ container.paddingBottom = p.bottom;
635
+ container.paddingLeft = p.left;
932
636
  }
933
- queue.length = 0;
934
- for (const [endpoint, observations] of byEndpoint) {
935
- fetch(endpoint, {
936
- method: "POST",
937
- headers: { "Content-Type": "application/json" },
938
- body: JSON.stringify({ observations }),
939
- // keepalive: true allows the request to outlive the page
940
- keepalive: true
941
- }).catch(() => {
942
- });
637
+ if (gap !== void 0) {
638
+ const g = resolveGap(gap, tokens);
639
+ container.rowGap = g.rowGap;
640
+ container.columnGap = g.columnGap;
943
641
  }
642
+ Object.assign(container, resolveSizing(width, height));
643
+ if (minWidth !== void 0) container.minWidth = minWidth;
644
+ if (maxWidth !== void 0) container.maxWidth = maxWidth;
645
+ if (minHeight !== void 0) container.minHeight = minHeight;
646
+ if (maxHeight !== void 0) container.maxHeight = maxHeight;
647
+ if (position) container.position = position;
648
+ if (top !== void 0) container.top = top;
649
+ if (right !== void 0) container.right = right;
650
+ if (bottom !== void 0) container.bottom = bottom;
651
+ if (left !== void 0) container.left = left;
652
+ if (zIndex !== void 0) container.zIndex = zIndex;
653
+ if (overflow) container.overflow = overflow;
654
+ if (opacity !== void 0) container.opacity = opacity;
655
+ return StyleSheet.create({ c: container }).c;
944
656
  }
945
- function enqueueObservation(endpoint, payload) {
946
- queue.push({ endpoint, payload });
947
- if (flushTimer !== void 0) clearTimeout(flushTimer);
948
- flushTimer = setTimeout(flush, 2e3);
949
- }
950
- function useBreakpoint() {
951
- const { width } = useWindowDimensions();
952
- return getBreakpointForWidth(width);
657
+ function Wrapper({
658
+ children,
659
+ direction,
660
+ wrap,
661
+ reverse,
662
+ align,
663
+ justify,
664
+ padding,
665
+ gap,
666
+ width,
667
+ height,
668
+ minWidth,
669
+ maxWidth,
670
+ minHeight,
671
+ maxHeight,
672
+ // Positioning
673
+ position,
674
+ top,
675
+ right,
676
+ bottom,
677
+ left,
678
+ zIndex,
679
+ overflow,
680
+ pointerEvents,
681
+ opacity,
682
+ style,
683
+ // Testing & platform
684
+ testID,
685
+ nativeID,
686
+ ref
687
+ }) {
688
+ const tokens = useTokens();
689
+ const containerStyle = useMemo(
690
+ () => getWrapperStyles({
691
+ tokens,
692
+ direction,
693
+ wrap,
694
+ reverse,
695
+ align,
696
+ justify,
697
+ padding,
698
+ gap,
699
+ width,
700
+ height,
701
+ minWidth,
702
+ maxWidth,
703
+ minHeight,
704
+ maxHeight,
705
+ position,
706
+ top,
707
+ right,
708
+ bottom,
709
+ left,
710
+ zIndex,
711
+ overflow,
712
+ opacity
713
+ }),
714
+ [
715
+ tokens,
716
+ direction,
717
+ wrap,
718
+ reverse,
719
+ align,
720
+ justify,
721
+ padding,
722
+ gap,
723
+ width,
724
+ height,
725
+ minWidth,
726
+ maxWidth,
727
+ minHeight,
728
+ maxHeight,
729
+ position,
730
+ top,
731
+ right,
732
+ bottom,
733
+ left,
734
+ zIndex,
735
+ overflow,
736
+ opacity
737
+ ]
738
+ );
739
+ const userStyles = Array.isArray(style) ? style : style ? [style] : [];
740
+ return /* @__PURE__ */ React16.createElement(
741
+ View,
742
+ {
743
+ ref,
744
+ testID,
745
+ nativeID,
746
+ pointerEvents,
747
+ accessibilityRole: "none",
748
+ style: [containerStyle, ...userStyles]
749
+ },
750
+ children
751
+ );
953
752
  }
954
-
955
- // src/primitives/Text/Text.tsx
956
753
  var TextScopeContext = createContext(null);
957
- function resolveTextColor(color, tokens) {
754
+ var LARGE_TEXT_ROLES = /* @__PURE__ */ new Set(["headline", "title", "heading", "subheading"]);
755
+ function resolveTextColor(color, tokens, theme = "primary", appearance = "main", role = "body") {
958
756
  switch (color) {
959
757
  case "primary":
960
- return srgbToHex(tokens.textPrimary.srgb);
758
+ return tokens.colors[theme][appearance].fontPrimary;
961
759
  case "secondary":
962
- return srgbToHex(tokens.textSecondary.srgb);
760
+ return tokens.colors[theme][appearance].fontSecondary;
963
761
  case "tertiary":
964
- return srgbToHex(tokens.textTertiary.srgb);
762
+ return tokens.colors[theme][appearance].fontTertiary;
965
763
  case "disabled":
966
- return srgbToHex(tokens.textDisabled.srgb);
764
+ return tokens.colors[theme][appearance].fontDisabled;
967
765
  case "accent":
968
- return srgbToHex(tokens.accent.fill.srgb);
969
- case "success":
970
- return srgbToHex(tokens.success.fill.srgb);
971
- case "warning":
972
- return srgbToHex(tokens.warning.fill.srgb);
973
- case "error":
974
- return srgbToHex(tokens.error.fill.srgb);
766
+ return tokens.colors[theme][appearance][LARGE_TEXT_ROLES.has(role) ? "accentLarge" : "accentSmall"];
975
767
  }
976
768
  }
977
769
  var ADAPTIVE_ROLES = /* @__PURE__ */ new Set(["headline", "title", "heading", "subheading"]);
@@ -1001,7 +793,7 @@ function TextBase({
1001
793
  weight: weightOverride,
1002
794
  align,
1003
795
  numberOfLines,
1004
- elevation = 1,
796
+ elevation,
1005
797
  style,
1006
798
  accessibilityRole: accessibilityRoleOverride,
1007
799
  testID,
@@ -1013,6 +805,9 @@ function TextBase({
1013
805
  }) {
1014
806
  const tokens = useTokens(elevation);
1015
807
  const { config, reportingEndpoint } = useNewtoneTheme();
808
+ const frameCtx = useFrameContext();
809
+ const resolvedTheme = frameCtx?.theme ?? "primary";
810
+ const resolvedAppearance = frameCtx?.appearance ?? "main";
1016
811
  const size = sizeOverride ?? "md";
1017
812
  const fontSlot = tokens.typography.fonts[scope];
1018
813
  const resolvedFontWeight = weightOverride ? SEMANTIC_WEIGHT_MAP[weightOverride] : config.typography.roleWeights?.[role] ?? ROLE_DEFAULT_WEIGHTS[role];
@@ -1075,18 +870,18 @@ function TextBase({
1075
870
  fontFamily: fontSlot.family,
1076
871
  fontSize: activeStep.fontSize,
1077
872
  fontWeight: String(resolvedFontWeight),
1078
- color: resolveTextColor(color, tokens),
873
+ color: resolveTextColor(color, tokens, resolvedTheme, resolvedAppearance, role),
1079
874
  lineHeight: correctedLineHeight,
1080
875
  textAlign: align,
1081
876
  ...vcOffset !== 0 ? { transform: [{ translateY: vcOffset }] } : {},
1082
877
  ...featureSettings ? { fontFeatureSettings: featureSettings } : {}
1083
878
  };
1084
- }, [tokens, fontSlot, step, resolvedStep, responsive, isAdaptive, resolvedFontWeight, color, align, config.typography.fontMetrics, centerVertically, features]);
879
+ }, [tokens, fontSlot, step, resolvedStep, responsive, isAdaptive, resolvedFontWeight, color, align, config.typography.fontMetrics, centerVertically, features, resolvedTheme, resolvedAppearance]);
1085
880
  const inferredA11yRole = role === "headline" || role === "title" || role === "heading" ? "header" : void 0;
1086
881
  const effectiveA11yRole = accessibilityRoleOverride ?? inferredA11yRole;
1087
882
  const ariaLevel = effectiveA11yRole === "header" ? ROLE_HEADING_LEVEL[role] : void 0;
1088
883
  const scopeCtx = useMemo(() => ({ weights: SEMANTIC_WEIGHT_MAP }), []);
1089
- const textNode = /* @__PURE__ */ React14.createElement(TextScopeContext.Provider, { value: scopeCtx }, /* @__PURE__ */ React14.createElement(
884
+ const textNode = /* @__PURE__ */ React16.createElement(TextScopeContext.Provider, { value: scopeCtx }, /* @__PURE__ */ React16.createElement(
1090
885
  Text,
1091
886
  {
1092
887
  ref,
@@ -1100,7 +895,7 @@ function TextBase({
1100
895
  children
1101
896
  ));
1102
897
  if (responsive && isAdaptive) {
1103
- return /* @__PURE__ */ React14.createElement(
898
+ return /* @__PURE__ */ React16.createElement(
1104
899
  View,
1105
900
  {
1106
901
  onLayout: (e) => {
@@ -1115,41 +910,44 @@ function TextBase({
1115
910
  return textNode;
1116
911
  }
1117
912
  function TextSpan({ children, color, weight, italic, underline, highlight, style }) {
1118
- const tokens = useTokens(1);
913
+ const tokens = useTokens();
1119
914
  const scopeCtx = useContext(TextScopeContext);
915
+ const frameCtx = useFrameContext();
916
+ const resolvedTheme = frameCtx?.theme ?? "primary";
917
+ const resolvedAppearance = frameCtx?.appearance ?? "main";
1120
918
  const spanStyle = useMemo(() => {
1121
919
  const s = {};
1122
- if (color) s.color = resolveTextColor(color, tokens);
920
+ if (color) s.color = resolveTextColor(color, tokens, resolvedTheme, resolvedAppearance);
1123
921
  if (weight && scopeCtx) s.fontWeight = String(scopeCtx.weights[weight]);
1124
922
  if (italic) s.fontStyle = "italic";
1125
923
  if (underline) s.textDecorationLine = "underline";
1126
- if (highlight) s.backgroundColor = resolveTextColor(highlight, tokens);
924
+ if (highlight) s.backgroundColor = resolveTextColor(highlight, tokens, resolvedTheme, resolvedAppearance);
1127
925
  return s;
1128
- }, [tokens, scopeCtx, color, weight, italic, underline, highlight]);
1129
- return React14.createElement(
926
+ }, [tokens, scopeCtx, color, weight, italic, underline, highlight, resolvedTheme, resolvedAppearance]);
927
+ return React16.createElement(
1130
928
  Text,
1131
929
  { style: style ? [spanStyle, ...Array.isArray(style) ? style : [style]] : spanStyle },
1132
930
  children
1133
931
  );
1134
932
  }
1135
933
  function TextBold(props) {
1136
- return React14.createElement(TextSpan, { ...props, weight: "bold" });
934
+ return React16.createElement(TextSpan, { ...props, weight: "bold" });
1137
935
  }
1138
936
  function TextMedium(props) {
1139
- return React14.createElement(TextSpan, { ...props, weight: "medium" });
937
+ return React16.createElement(TextSpan, { ...props, weight: "medium" });
1140
938
  }
1141
939
  function TextItalic(props) {
1142
- return React14.createElement(TextSpan, { ...props, italic: true });
940
+ return React16.createElement(TextSpan, { ...props, italic: true });
1143
941
  }
1144
942
  function TextUnderline(props) {
1145
- return React14.createElement(TextSpan, { ...props, underline: true });
943
+ return React16.createElement(TextSpan, { ...props, underline: true });
1146
944
  }
1147
945
  function TextHighlight(props) {
1148
- return React14.createElement(TextSpan, props);
946
+ return React16.createElement(TextSpan, props);
1149
947
  }
1150
948
 
1151
949
  // src/primitives/Text/index.ts
1152
- var Text2 = Object.assign(TextBase, {
950
+ var Text3 = Object.assign(TextBase, {
1153
951
  Span: TextSpan,
1154
952
  Bold: TextBold,
1155
953
  Medium: TextMedium,
@@ -1158,222 +956,219 @@ var Text2 = Object.assign(TextBase, {
1158
956
  Highlight: TextHighlight
1159
957
  });
1160
958
 
1161
- // src/primitives/Frame/Frame.utils.ts
1162
- function resolveSpacing(value, tokens) {
1163
- if (typeof value === "number") return value;
1164
- return tokens.spacing[value];
1165
- }
1166
- function resolvePadding(prop, tokens) {
1167
- if (typeof prop === "string" || typeof prop === "number") {
1168
- const px = resolveSpacing(prop, tokens);
1169
- return { top: px, right: px, bottom: px, left: px };
959
+ // src/composites/actions/Button/Button.styles.ts
960
+ function computeButtonPadding(size, hasIcon, hasText, iconPosition) {
961
+ const basePadding = {
962
+ sm: 8,
963
+ md: 12,
964
+ lg: 16
965
+ };
966
+ const base = basePadding[size];
967
+ const textExtra = 8;
968
+ if (!hasText && hasIcon) {
969
+ return {
970
+ paddingLeft: base,
971
+ paddingRight: base,
972
+ paddingTop: base,
973
+ paddingBottom: base
974
+ };
1170
975
  }
1171
- if ("x" in prop || "y" in prop) {
1172
- const axes = prop;
1173
- const x = axes.x !== void 0 ? resolveSpacing(axes.x, tokens) : 0;
1174
- const y = axes.y !== void 0 ? resolveSpacing(axes.y, tokens) : 0;
1175
- return { top: y, right: x, bottom: y, left: x };
976
+ if (hasText && !hasIcon) {
977
+ return {
978
+ paddingLeft: base + textExtra,
979
+ paddingRight: base + textExtra,
980
+ paddingTop: base,
981
+ paddingBottom: base
982
+ };
1176
983
  }
1177
- const sides = prop;
1178
- return {
1179
- top: sides.top !== void 0 ? resolveSpacing(sides.top, tokens) : 0,
1180
- right: sides.right !== void 0 ? resolveSpacing(sides.right, tokens) : 0,
1181
- bottom: sides.bottom !== void 0 ? resolveSpacing(sides.bottom, tokens) : 0,
1182
- left: sides.left !== void 0 ? resolveSpacing(sides.left, tokens) : 0
1183
- };
1184
- }
1185
- function resolveGap(prop, tokens) {
1186
- if (typeof prop === "string" || typeof prop === "number") {
1187
- const px = resolveSpacing(prop, tokens);
1188
- return { rowGap: px, columnGap: px };
984
+ if (hasText && hasIcon) {
985
+ if (iconPosition === "left") {
986
+ return {
987
+ paddingLeft: base,
988
+ paddingRight: base + textExtra,
989
+ paddingTop: base,
990
+ paddingBottom: base
991
+ };
992
+ } else {
993
+ return {
994
+ paddingLeft: base + textExtra,
995
+ paddingRight: base,
996
+ paddingTop: base,
997
+ paddingBottom: base
998
+ };
999
+ }
1189
1000
  }
1190
1001
  return {
1191
- rowGap: prop.row !== void 0 ? resolveSpacing(prop.row, tokens) : 0,
1192
- columnGap: prop.column !== void 0 ? resolveSpacing(prop.column, tokens) : 0
1002
+ paddingLeft: base,
1003
+ paddingRight: base,
1004
+ paddingTop: base,
1005
+ paddingBottom: base
1193
1006
  };
1194
1007
  }
1195
- function resolveRadius(value, tokens) {
1196
- if (typeof value === "number") return value;
1197
- return tokens.radius[value];
1008
+ function semanticToTheme(semantic) {
1009
+ if (semantic === "accent") return "primary";
1010
+ return semantic;
1198
1011
  }
1199
- function resolveRadiusCorners(prop, tokens) {
1200
- if (typeof prop === "string" || typeof prop === "number") {
1201
- const px = resolveRadius(prop, tokens);
1202
- return { topLeft: px, topRight: px, bottomLeft: px, bottomRight: px };
1203
- }
1012
+ function getButtonConfig(variant, semantic, size, disabled, tokens) {
1013
+ const sizeConfig = getSizeConfig(size, tokens);
1014
+ const variantColors = getVariantColors(variant, semantic, disabled, tokens);
1204
1015
  return {
1205
- topLeft: prop.topLeft !== void 0 ? resolveRadius(prop.topLeft, tokens) : 0,
1206
- topRight: prop.topRight !== void 0 ? resolveRadius(prop.topRight, tokens) : 0,
1207
- bottomLeft: prop.bottomLeft !== void 0 ? resolveRadius(prop.bottomLeft, tokens) : 0,
1208
- bottomRight: prop.bottomRight !== void 0 ? resolveRadius(prop.bottomRight, tokens) : 0
1016
+ variantColors,
1017
+ sizeTokens: {
1018
+ padding: sizeConfig.padding,
1019
+ gap: sizeConfig.gap,
1020
+ borderRadius: sizeConfig.borderRadius,
1021
+ textSize: sizeConfig.textSize,
1022
+ iconSize: sizeConfig.iconSize
1023
+ }
1209
1024
  };
1210
1025
  }
1211
- function hasPositiveRadius(corners) {
1212
- return corners.topLeft > 0 || corners.topRight > 0 || corners.bottomLeft > 0 || corners.bottomRight > 0;
1213
- }
1214
- function resolveSizing(width, height) {
1215
- const style = {};
1216
- if (width !== void 0) {
1217
- if (width === "fill") {
1218
- style.flexGrow = 1;
1219
- style.width = "100%";
1220
- } else if (typeof width === "number") {
1221
- style.width = width;
1222
- }
1223
- }
1224
- if (height !== void 0) {
1225
- if (height === "fill") {
1226
- style.flexGrow = 1;
1227
- style.height = "100%";
1228
- } else if (typeof height === "number") {
1229
- style.height = height;
1026
+ function getSizeConfig(size, tokens) {
1027
+ const configs = {
1028
+ sm: {
1029
+ padding: 8,
1030
+ gap: tokens.spacing["08"],
1031
+ borderRadius: 8,
1032
+ textSize: "md",
1033
+ // 16px
1034
+ iconSize: 24
1035
+ },
1036
+ md: {
1037
+ padding: 12,
1038
+ gap: tokens.spacing["08"],
1039
+ borderRadius: 12,
1040
+ textSize: "md",
1041
+ // 16px
1042
+ iconSize: 24
1043
+ },
1044
+ lg: {
1045
+ padding: 16,
1046
+ gap: tokens.spacing["08"],
1047
+ borderRadius: 16,
1048
+ textSize: "md",
1049
+ // 16px
1050
+ iconSize: 24
1230
1051
  }
1231
- }
1232
- return style;
1233
- }
1234
- var ALIGN_MAP = {
1235
- start: "flex-start",
1236
- center: "center",
1237
- end: "flex-end",
1238
- stretch: "stretch",
1239
- baseline: "baseline"
1240
- };
1241
- var JUSTIFY_MAP = {
1242
- start: "flex-start",
1243
- center: "center",
1244
- end: "flex-end",
1245
- between: "space-between",
1246
- around: "space-around",
1247
- evenly: "space-evenly"
1248
- };
1249
- function resolveAlignment(align) {
1250
- return ALIGN_MAP[align];
1251
- }
1252
- function resolveJustification(justify) {
1253
- return JUSTIFY_MAP[justify];
1052
+ };
1053
+ return configs[size];
1254
1054
  }
1255
- function resolveFlexDirection(direction, reverse) {
1256
- if (direction === "horizontal") {
1257
- return reverse ? "row-reverse" : "row";
1055
+ function getVariantColors(variant, semantic, disabled, tokens) {
1056
+ if (disabled) {
1057
+ const baseColors = getVariantColorsForState(variant, semantic, tokens);
1058
+ const disabledBg = tokens.colors.primary.main.fontSecondary;
1059
+ return {
1060
+ ...baseColors,
1061
+ bg: disabledBg,
1062
+ hoveredBg: disabledBg,
1063
+ pressedBg: disabledBg,
1064
+ textColor: tokens.colors.primary.main.fontTertiary,
1065
+ iconColor: tokens.colors.primary.main.fontTertiary
1066
+ };
1258
1067
  }
1259
- return reverse ? "column-reverse" : "column";
1068
+ return getVariantColorsForState(variant, semantic, tokens);
1260
1069
  }
1261
-
1262
- // src/primitives/Wrapper/Wrapper.styles.ts
1263
- function getWrapperStyles(input) {
1264
- const {
1265
- tokens,
1266
- direction = "vertical",
1267
- wrap = false,
1268
- reverse = false,
1269
- align,
1270
- justify,
1271
- padding,
1272
- gap,
1273
- width,
1274
- height,
1275
- minWidth,
1276
- maxWidth,
1277
- minHeight,
1278
- maxHeight
1279
- } = input;
1280
- const container = {};
1281
- container.flexDirection = resolveFlexDirection(direction, reverse);
1282
- if (wrap) container.flexWrap = "wrap";
1283
- if (align) container.alignItems = resolveAlignment(align);
1284
- if (justify) container.justifyContent = resolveJustification(justify);
1285
- if (padding !== void 0) {
1286
- const p = resolvePadding(padding, tokens);
1287
- container.paddingTop = p.top;
1288
- container.paddingRight = p.right;
1289
- container.paddingBottom = p.bottom;
1290
- container.paddingLeft = p.left;
1070
+ function getVariantColorsForState(variant, semantic, tokens) {
1071
+ if (variant === "primary") {
1072
+ if (semantic === "neutral") {
1073
+ return {
1074
+ bg: tokens.colors.primary.main.fontPrimary,
1075
+ hoveredBg: tokens.colors.primary.main.fontSecondary,
1076
+ pressedBg: tokens.colors.primary.main.fontPrimary,
1077
+ textColor: tokens.colors.primary.main.divider,
1078
+ iconColor: tokens.colors.primary.main.divider,
1079
+ borderWidth: 1,
1080
+ borderColor: "transparent"
1081
+ };
1082
+ }
1083
+ const t = tokens.colors[semanticToTheme(semantic)];
1084
+ return {
1085
+ bg: t.emphasis.background,
1086
+ hoveredBg: t.emphasis.fontPrimary,
1087
+ pressedBg: t.emphasis.fontSecondary,
1088
+ textColor: t.main.background,
1089
+ iconColor: t.main.background,
1090
+ borderWidth: 1,
1091
+ borderColor: "transparent"
1092
+ };
1093
+ }
1094
+ if (variant === "secondary") {
1095
+ if (semantic === "neutral") {
1096
+ return {
1097
+ bg: "transparent",
1098
+ hoveredBg: tokens.colors.primary.main.fontPrimary,
1099
+ pressedBg: tokens.colors.primary.main.fontSecondary,
1100
+ textColor: tokens.colors.primary.main.divider,
1101
+ iconColor: tokens.colors.primary.main.divider,
1102
+ borderWidth: 1,
1103
+ borderColor: tokens.colors.primary.main.fontSecondary
1104
+ };
1105
+ }
1106
+ const t = tokens.colors[semanticToTheme(semantic)];
1107
+ return {
1108
+ bg: t.tinted.background,
1109
+ hoveredBg: t.tinted.fontPrimary,
1110
+ pressedBg: t.tinted.fontSecondary,
1111
+ textColor: t.emphasis.divider,
1112
+ iconColor: t.emphasis.divider,
1113
+ borderWidth: 1,
1114
+ borderColor: "transparent"
1115
+ };
1291
1116
  }
1292
- if (gap !== void 0) {
1293
- const g = resolveGap(gap, tokens);
1294
- container.rowGap = g.rowGap;
1295
- container.columnGap = g.columnGap;
1117
+ if (variant === "tertiary") {
1118
+ if (semantic === "neutral") {
1119
+ return {
1120
+ bg: "transparent",
1121
+ hoveredBg: tokens.colors.primary.main.fontPrimary,
1122
+ pressedBg: tokens.colors.primary.main.fontSecondary,
1123
+ textColor: tokens.colors.primary.main.divider,
1124
+ iconColor: tokens.colors.primary.main.divider,
1125
+ borderWidth: 1,
1126
+ borderColor: "transparent"
1127
+ };
1128
+ }
1129
+ const t = tokens.colors[semanticToTheme(semantic)];
1130
+ return {
1131
+ bg: "transparent",
1132
+ hoveredBg: t.tinted.background,
1133
+ pressedBg: t.tinted.fontPrimary,
1134
+ textColor: t.emphasis.divider,
1135
+ iconColor: t.emphasis.divider,
1136
+ borderWidth: 1,
1137
+ borderColor: "transparent"
1138
+ };
1296
1139
  }
1297
- Object.assign(container, resolveSizing(width, height));
1298
- if (minWidth !== void 0) container.minWidth = minWidth;
1299
- if (maxWidth !== void 0) container.maxWidth = maxWidth;
1300
- if (minHeight !== void 0) container.minHeight = minHeight;
1301
- if (maxHeight !== void 0) container.maxHeight = maxHeight;
1302
- return StyleSheet.create({ c: container }).c;
1303
- }
1304
-
1305
- // src/primitives/Wrapper/Wrapper.tsx
1306
- function Wrapper({
1307
- children,
1308
- direction,
1309
- wrap,
1310
- reverse,
1311
- align,
1312
- justify,
1313
- padding,
1314
- gap,
1315
- width,
1316
- height,
1317
- minWidth,
1318
- maxWidth,
1319
- minHeight,
1320
- maxHeight,
1321
- style,
1322
- // Testing & platform
1323
- testID,
1324
- nativeID,
1325
- ref
1326
- }) {
1327
- const tokens = useTokens(1);
1328
- const containerStyle = useMemo(
1329
- () => getWrapperStyles({
1330
- tokens,
1331
- direction,
1332
- wrap,
1333
- reverse,
1334
- align,
1335
- justify,
1336
- padding,
1337
- gap,
1338
- width,
1339
- height,
1340
- minWidth,
1341
- maxWidth,
1342
- minHeight,
1343
- maxHeight
1344
- }),
1345
- [
1346
- tokens,
1347
- direction,
1348
- wrap,
1349
- reverse,
1350
- align,
1351
- justify,
1352
- padding,
1353
- gap,
1354
- width,
1355
- height,
1356
- minWidth,
1357
- maxWidth,
1358
- minHeight,
1359
- maxHeight
1360
- ]
1361
- );
1362
- const userStyles = Array.isArray(style) ? style : style ? [style] : [];
1363
- return /* @__PURE__ */ React14.createElement(
1364
- View,
1365
- {
1366
- ref,
1367
- testID,
1368
- nativeID,
1369
- accessibilityRole: "none",
1370
- style: [containerStyle, ...userStyles]
1371
- },
1372
- children
1373
- );
1140
+ if (variant === "link") {
1141
+ if (semantic === "neutral") {
1142
+ return {
1143
+ bg: "transparent",
1144
+ hoveredBg: "transparent",
1145
+ pressedBg: "transparent",
1146
+ textColor: tokens.colors.primary.main.fontSecondary,
1147
+ iconColor: tokens.colors.primary.main.fontSecondary,
1148
+ borderWidth: 0,
1149
+ borderColor: "transparent"
1150
+ };
1151
+ }
1152
+ const t = tokens.colors[semanticToTheme(semantic)];
1153
+ return {
1154
+ bg: "transparent",
1155
+ hoveredBg: "transparent",
1156
+ pressedBg: "transparent",
1157
+ textColor: t.emphasis.divider,
1158
+ iconColor: t.emphasis.divider,
1159
+ borderWidth: 0,
1160
+ borderColor: "transparent"
1161
+ };
1162
+ }
1163
+ return {
1164
+ bg: "transparent",
1165
+ hoveredBg: "transparent",
1166
+ pressedBg: "transparent",
1167
+ textColor: tokens.colors.primary.main.divider,
1168
+ iconColor: tokens.colors.primary.main.divider,
1169
+ borderWidth: 0
1170
+ };
1374
1171
  }
1375
-
1376
- // src/composites/actions/Button/Button.tsx
1377
1172
  function Button({
1378
1173
  children,
1379
1174
  icon,
@@ -1382,22 +1177,25 @@ function Button({
1382
1177
  semantic = "neutral",
1383
1178
  size = "md",
1384
1179
  disabled = false,
1180
+ loading = false,
1181
+ fullWidth = false,
1385
1182
  style,
1386
1183
  textStyle,
1387
1184
  ...pressableProps
1388
1185
  }) {
1389
1186
  const tokens = useTokens();
1390
- const { variantColors, sizeTokens } = React14.useMemo(
1391
- () => getButtonConfig(variant, semantic, size, disabled, tokens),
1392
- [variant, semantic, size, disabled, tokens]
1187
+ const isDisabled = disabled || loading;
1188
+ const { variantColors, sizeTokens } = React16.useMemo(
1189
+ () => getButtonConfig(variant, semantic, size, isDisabled, tokens),
1190
+ [variant, semantic, size, isDisabled, tokens]
1393
1191
  );
1394
- const padding = React14.useMemo(
1395
- () => computeButtonPadding(size, !!icon, !!children, iconPosition),
1396
- [size, icon, children, iconPosition]
1192
+ const padding = React16.useMemo(
1193
+ () => variant === "link" ? { paddingLeft: 0, paddingRight: 0, paddingTop: 0, paddingBottom: 0 } : computeButtonPadding(size, !!icon, !!children, iconPosition),
1194
+ [size, icon, children, iconPosition, variant]
1397
1195
  );
1398
- return /* @__PURE__ */ React14.createElement(Pressable, { disabled, ...pressableProps }, ({ pressed, hovered }) => (
1196
+ return /* @__PURE__ */ React16.createElement(Pressable, { disabled: isDisabled, ...pressableProps }, ({ pressed, hovered }) => (
1399
1197
  // Wrapper handles layout: direction, gap, alignment (padding via style)
1400
- /* @__PURE__ */ React14.createElement(
1198
+ /* @__PURE__ */ React16.createElement(
1401
1199
  Wrapper,
1402
1200
  {
1403
1201
  direction: "horizontal",
@@ -1408,41 +1206,45 @@ function Button({
1408
1206
  {
1409
1207
  ...padding,
1410
1208
  // Asymmetric horizontal padding for text optical balance
1411
- backgroundColor: pressed && !disabled ? variantColors.pressedBg : hovered && !disabled ? variantColors.hoveredBg : variantColors.bg,
1412
- borderRadius: sizeTokens.borderRadius,
1209
+ backgroundColor: pressed && !isDisabled ? variantColors.pressedBg : hovered && !isDisabled ? variantColors.hoveredBg : variantColors.bg,
1210
+ borderRadius: variant === "link" ? 0 : sizeTokens.borderRadius,
1413
1211
  borderWidth: variantColors.borderWidth,
1414
- // Always 1 for consistent sizing
1415
1212
  borderColor: variantColors.borderColor || "transparent",
1416
- opacity: disabled ? 0.4 : 1
1213
+ opacity: isDisabled ? loading ? 0.6 : 0.4 : variant === "link" && pressed ? 0.7 : 1,
1214
+ ...fullWidth && { width: "100%", alignSelf: "stretch" }
1417
1215
  },
1418
1216
  ...Array.isArray(style) ? style : style ? [style] : []
1419
1217
  ]
1420
1218
  },
1421
- icon && iconPosition === "left" && /* @__PURE__ */ React14.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor }),
1219
+ icon && iconPosition === "left" && /* @__PURE__ */ React16.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor }),
1422
1220
  children && // Text primitive with semantic props + color style override
1423
- /* @__PURE__ */ React14.createElement(
1424
- Text2,
1221
+ /* @__PURE__ */ React16.createElement(
1222
+ Text3,
1425
1223
  {
1426
1224
  role: "label",
1427
1225
  size: sizeTokens.textSize,
1428
1226
  centerVertically: true,
1429
1227
  style: [
1430
- { color: variantColors.textColor },
1228
+ {
1229
+ color: variantColors.textColor,
1230
+ ...variant === "link" && hovered && { textDecorationLine: "underline" }
1231
+ },
1431
1232
  ...Array.isArray(textStyle) ? textStyle : textStyle ? [textStyle] : []
1432
1233
  ]
1433
1234
  },
1434
1235
  children
1435
1236
  ),
1436
- icon && iconPosition === "right" && /* @__PURE__ */ React14.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor })
1237
+ icon && iconPosition === "right" && /* @__PURE__ */ React16.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor })
1437
1238
  )
1438
1239
  ));
1439
1240
  }
1440
- function getCardStyles(tokens, disabled) {
1241
+ function getCardStyles(tokens, disabled, theme = "primary", appearance = "main") {
1242
+ const at = tokens.colors[theme][appearance];
1441
1243
  return StyleSheet.create({
1442
1244
  container: {
1443
- backgroundColor: srgbToHex(tokens.background.srgb),
1245
+ backgroundColor: at.background,
1444
1246
  borderWidth: 1,
1445
- borderColor: srgbToHex(tokens.border.srgb),
1247
+ borderColor: at.fontSecondary,
1446
1248
  borderRadius: tokens.radius.lg,
1447
1249
  padding: tokens.spacing["16"],
1448
1250
  opacity: disabled ? 0.5 : 1
@@ -1458,355 +1260,286 @@ function Card({
1458
1260
  disabled = false
1459
1261
  }) {
1460
1262
  const tokens = useTokens(elevation);
1461
- const styles = React14.useMemo(
1462
- () => getCardStyles(tokens, disabled),
1463
- [tokens, disabled]
1263
+ const frameCtx = useFrameContext();
1264
+ const styles = React16.useMemo(
1265
+ () => getCardStyles(tokens, disabled, frameCtx?.theme, frameCtx?.appearance),
1266
+ [tokens, disabled, frameCtx?.theme, frameCtx?.appearance]
1464
1267
  );
1465
- return /* @__PURE__ */ React14.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, children);
1268
+ return /* @__PURE__ */ React16.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, children);
1466
1269
  }
1467
- var hadKeyboardEvent = false;
1468
- var isListenerSetup = false;
1469
- function setupModality() {
1470
- if (isListenerSetup || typeof document === "undefined") return;
1471
- isListenerSetup = true;
1472
- const NAVIGATION_KEYS = /* @__PURE__ */ new Set([
1473
- "Tab",
1474
- "ArrowUp",
1475
- "ArrowDown",
1476
- "ArrowLeft",
1477
- "ArrowRight",
1478
- "Enter",
1479
- " ",
1480
- "Escape"
1481
- ]);
1482
- document.addEventListener("keydown", (e) => {
1483
- if (NAVIGATION_KEYS.has(e.key)) {
1484
- hadKeyboardEvent = true;
1485
- }
1486
- }, true);
1487
- document.addEventListener("pointerdown", () => {
1488
- hadKeyboardEvent = false;
1489
- }, true);
1490
- document.addEventListener("mousedown", () => {
1491
- hadKeyboardEvent = false;
1492
- }, true);
1270
+
1271
+ // src/composites/display/Chip/Chip.styles.ts
1272
+ function semanticToTheme2(semantic) {
1273
+ if (semantic === "accent") return "primary";
1274
+ return semantic;
1275
+ }
1276
+ function getSizeConfig2(size) {
1277
+ if (size === "sm") {
1278
+ return { paddingX: 10, paddingY: 3, gap: 4, textRole: "caption", iconSize: 16 };
1279
+ }
1280
+ return { paddingX: 16, paddingY: 8, gap: 6, textRole: "label", iconSize: 20 };
1493
1281
  }
1494
- function useFocusVisible() {
1495
- const [isFocusVisible, setIsFocusVisible] = useState(false);
1496
- useEffect(() => {
1497
- setupModality();
1498
- }, []);
1499
- const onFocus = useCallback(() => {
1500
- if (hadKeyboardEvent) {
1501
- setIsFocusVisible(true);
1282
+ function getVariantColors2(variant, semantic, selected, disabled, tokens) {
1283
+ if (selected) {
1284
+ if (semantic === "neutral") {
1285
+ return {
1286
+ bg: tokens.colors.primary.strong.background,
1287
+ hoveredBg: tokens.colors.primary.strong.fontPrimary,
1288
+ pressedBg: tokens.colors.primary.strong.background,
1289
+ textColor: tokens.colors.primary.strong.fontPrimary,
1290
+ iconColor: tokens.colors.primary.strong.fontPrimary,
1291
+ borderWidth: 1,
1292
+ borderColor: "transparent"
1293
+ };
1502
1294
  }
1503
- }, []);
1504
- const onBlur = useCallback(() => {
1505
- setIsFocusVisible(false);
1506
- }, []);
1507
- const focusProps = { onFocus, onBlur };
1508
- return { isFocusVisible, focusProps };
1509
- }
1510
- function getFrameStyles(input) {
1511
- const {
1512
- tokens,
1513
- frameElevation,
1514
- layout = "flex",
1515
- direction = "vertical",
1516
- wrap = false,
1517
- reverse = false,
1518
- columns,
1519
- rows,
1520
- align,
1521
- justify,
1522
- padding,
1523
- gap,
1524
- width,
1525
- height,
1526
- minWidth,
1527
- maxWidth,
1528
- minHeight,
1529
- maxHeight,
1530
- radius,
1531
- bordered = false,
1532
- disabled = false
1533
- } = input;
1534
- const container = {};
1535
- container.backgroundColor = srgbToHex(tokens.background.srgb);
1536
- container.color = srgbToHex(tokens.textPrimary.srgb);
1537
- if (layout === "flex") {
1538
- container.display = "flex";
1539
- container.flexDirection = resolveFlexDirection(direction, reverse);
1540
- if (wrap) container.flexWrap = "wrap";
1541
- }
1542
- if (layout === "grid") {
1543
- container.display = "flex";
1544
- container.flexDirection = "row";
1545
- container.flexWrap = "wrap";
1546
- }
1547
- if (align) container.alignItems = resolveAlignment(align);
1548
- if (justify) container.justifyContent = resolveJustification(justify);
1549
- if (padding !== void 0) {
1550
- const p = resolvePadding(padding, tokens);
1551
- container.paddingTop = p.top;
1552
- container.paddingRight = p.right;
1553
- container.paddingBottom = p.bottom;
1554
- container.paddingLeft = p.left;
1295
+ const t2 = tokens.colors[semanticToTheme2(semantic)];
1296
+ return {
1297
+ bg: t2.emphasis.background,
1298
+ hoveredBg: t2.emphasis.fontPrimary,
1299
+ pressedBg: t2.emphasis.background,
1300
+ textColor: t2.main.background,
1301
+ iconColor: t2.main.background,
1302
+ borderWidth: 1,
1303
+ borderColor: "transparent"
1304
+ };
1555
1305
  }
1556
- if (gap !== void 0) {
1557
- const g = resolveGap(gap, tokens);
1558
- container.rowGap = g.rowGap;
1559
- container.columnGap = g.columnGap;
1306
+ if (disabled) {
1307
+ return {
1308
+ bg: "transparent",
1309
+ hoveredBg: "transparent",
1310
+ pressedBg: "transparent",
1311
+ textColor: tokens.colors.primary.main.fontTertiary,
1312
+ iconColor: tokens.colors.primary.main.fontTertiary,
1313
+ borderWidth: 1,
1314
+ borderColor: tokens.colors.primary.main.divider
1315
+ };
1560
1316
  }
1561
- const sizing = resolveSizing(width, height);
1562
- Object.assign(container, sizing);
1563
- if (minWidth !== void 0) container.minWidth = minWidth;
1564
- if (maxWidth !== void 0) container.maxWidth = maxWidth;
1565
- if (minHeight !== void 0) container.minHeight = minHeight;
1566
- if (maxHeight !== void 0) container.maxHeight = maxHeight;
1567
- if (radius !== void 0) {
1568
- const corners = resolveRadiusCorners(radius, tokens);
1569
- container.borderTopLeftRadius = corners.topLeft;
1570
- container.borderTopRightRadius = corners.topRight;
1571
- container.borderBottomLeftRadius = corners.bottomLeft;
1572
- container.borderBottomRightRadius = corners.bottomRight;
1573
- if (hasPositiveRadius(corners)) {
1574
- container.overflow = "hidden";
1317
+ if (variant === "filled") {
1318
+ if (semantic === "neutral") {
1319
+ return {
1320
+ bg: tokens.colors.primary.main.fontPrimary,
1321
+ hoveredBg: tokens.colors.primary.main.fontSecondary,
1322
+ pressedBg: tokens.colors.primary.main.fontPrimary,
1323
+ textColor: tokens.colors.primary.main.divider,
1324
+ iconColor: tokens.colors.primary.main.divider,
1325
+ borderWidth: 1,
1326
+ borderColor: "transparent"
1327
+ };
1575
1328
  }
1329
+ const t2 = tokens.colors[semanticToTheme2(semantic)];
1330
+ return {
1331
+ bg: t2.emphasis.background,
1332
+ hoveredBg: t2.emphasis.fontPrimary,
1333
+ pressedBg: t2.emphasis.fontSecondary,
1334
+ textColor: t2.main.background,
1335
+ iconColor: t2.main.background,
1336
+ borderWidth: 1,
1337
+ borderColor: "transparent"
1338
+ };
1576
1339
  }
1577
- if (bordered) {
1578
- container.borderWidth = 1;
1579
- container.borderColor = srgbToHex(tokens.border.srgb);
1580
- }
1581
- if (frameElevation === 2) {
1582
- container.shadowColor = "#000";
1583
- container.shadowOffset = { width: 0, height: 2 };
1584
- container.shadowOpacity = 0.12;
1585
- container.shadowRadius = 6;
1586
- container.elevation = 4;
1587
- }
1588
- if (disabled) {
1589
- container.opacity = 0.5;
1340
+ if (variant === "tinted") {
1341
+ if (semantic === "neutral") {
1342
+ return {
1343
+ bg: tokens.colors.primary.tinted.background,
1344
+ hoveredBg: tokens.colors.primary.tinted.fontPrimary,
1345
+ pressedBg: tokens.colors.primary.tinted.fontSecondary,
1346
+ textColor: tokens.colors.primary.main.fontPrimary,
1347
+ iconColor: tokens.colors.primary.main.fontPrimary,
1348
+ borderWidth: 1,
1349
+ borderColor: "transparent"
1350
+ };
1351
+ }
1352
+ const t2 = tokens.colors[semanticToTheme2(semantic)];
1353
+ return {
1354
+ bg: t2.tinted.background,
1355
+ hoveredBg: t2.tinted.fontPrimary,
1356
+ pressedBg: t2.tinted.fontSecondary,
1357
+ textColor: t2.emphasis.divider,
1358
+ iconColor: t2.emphasis.divider,
1359
+ borderWidth: 1,
1360
+ borderColor: "transparent"
1361
+ };
1590
1362
  }
1591
- const pressed = StyleSheet.create({
1592
- s: { backgroundColor: srgbToHex(tokens.backgroundSunken.srgb) }
1593
- }).s;
1594
- let gridWebStyle = null;
1595
- if (layout === "grid") {
1596
- gridWebStyle = {
1597
- display: "grid",
1598
- // Divide into equal-width columns (e.g. 3 columns → "repeat(3, 1fr)").
1599
- gridTemplateColumns: columns ? `repeat(${columns}, 1fr)` : void 0,
1600
- gridTemplateRows: rows ? `repeat(${rows}, 1fr)` : void 0
1363
+ if (semantic === "neutral") {
1364
+ return {
1365
+ bg: "transparent",
1366
+ hoveredBg: tokens.colors.primary.tinted.background,
1367
+ pressedBg: tokens.colors.primary.tinted.fontPrimary,
1368
+ textColor: tokens.colors.primary.main.fontPrimary,
1369
+ iconColor: tokens.colors.primary.main.fontPrimary,
1370
+ borderWidth: 1,
1371
+ borderColor: tokens.colors.primary.main.divider
1601
1372
  };
1602
1373
  }
1603
- const insetBoxShadow = frameElevation === -2 ? "inset 0 2px 4px rgba(0,0,0,0.12)" : null;
1374
+ const t = tokens.colors[semanticToTheme2(semantic)];
1604
1375
  return {
1605
- // Validate and optimize the container styles through StyleSheet.create(),
1606
- // then extract the single style object with `.c`.
1607
- container: StyleSheet.create({ c: container }).c,
1608
- pressed,
1609
- gridWebStyle,
1610
- insetBoxShadow
1376
+ bg: "transparent",
1377
+ hoveredBg: t.tinted.background,
1378
+ pressedBg: t.tinted.fontPrimary,
1379
+ textColor: t.emphasis.divider,
1380
+ iconColor: t.emphasis.divider,
1381
+ borderWidth: 1,
1382
+ borderColor: t.tinted.fontSecondary
1611
1383
  };
1612
1384
  }
1613
-
1614
- // src/primitives/Frame/Frame.tsx
1615
- function wrapTextChildren(children, textStyle) {
1616
- return React14.Children.map(children, (child) => {
1617
- if (typeof child === "string" || typeof child === "number") {
1618
- return /* @__PURE__ */ React14.createElement(Text, { style: textStyle }, child);
1619
- }
1620
- return child;
1621
- });
1622
- }
1623
- function toElevationLevel(frameElevation) {
1624
- if (frameElevation <= -1) return 0;
1625
- if (frameElevation === 0) return 1;
1626
- return 2;
1385
+ function getChipConfig(variant, semantic, size, selected, disabled, tokens) {
1386
+ return {
1387
+ colors: getVariantColors2(variant, semantic, selected, disabled, tokens),
1388
+ sizeTokens: getSizeConfig2(size)
1389
+ };
1627
1390
  }
1628
- function Frame({
1391
+ function Chip({
1629
1392
  children,
1630
- // Elevation
1631
- elevation,
1632
- // Layout
1633
- layout,
1634
- direction,
1635
- wrap,
1636
- reverse,
1637
- columns,
1638
- rows,
1639
- // Alignment
1640
- align,
1641
- justify,
1642
- // Spacing
1643
- padding,
1644
- gap,
1645
- // Sizing
1646
- width,
1647
- height,
1648
- minWidth,
1649
- maxWidth,
1650
- minHeight,
1651
- maxHeight,
1652
- // Appearance
1653
- radius,
1654
- bordered,
1655
- // Interactivity
1393
+ variant = "tinted",
1394
+ size = "md",
1395
+ semantic = "neutral",
1396
+ selected = false,
1656
1397
  onPress,
1657
- href,
1658
1398
  disabled = false,
1659
- // Accessibility
1660
- accessibilityLabel,
1661
- accessibilityHint,
1662
- // Testing & platform
1663
- testID,
1664
- nativeID,
1665
- ref,
1666
- // Style override
1399
+ icon,
1667
1400
  style
1668
1401
  }) {
1669
- const { config, mode } = useNewtoneTheme();
1670
- const parentFrameCtx = useFrameContext();
1671
- const resolvedFrameElevation = elevation ?? 0;
1672
- const resolvedElevation = elevation !== void 0 ? toElevationLevel(elevation) : parentFrameCtx?.elevation ?? 1;
1673
- const tokens = useMemo(() => {
1674
- return computeTokens(
1675
- config.colorSystem,
1676
- mode,
1677
- resolvedElevation,
1678
- config.spacing,
1679
- config.radius,
1680
- config.typography,
1681
- config.icons,
1682
- config.tokenOverrides
1683
- );
1684
- }, [config, mode, resolvedElevation]);
1685
- const styles = useMemo(
1686
- () => getFrameStyles({
1687
- tokens,
1688
- frameElevation: resolvedFrameElevation,
1689
- layout,
1690
- direction,
1691
- wrap,
1692
- reverse,
1693
- columns,
1694
- rows,
1695
- align,
1696
- justify,
1697
- padding,
1698
- gap,
1699
- width,
1700
- height,
1701
- minWidth,
1702
- maxWidth,
1703
- minHeight,
1704
- maxHeight,
1705
- radius,
1706
- bordered,
1707
- disabled
1708
- }),
1709
- [
1710
- tokens,
1711
- resolvedFrameElevation,
1712
- layout,
1713
- direction,
1714
- wrap,
1715
- reverse,
1716
- columns,
1717
- rows,
1718
- align,
1719
- justify,
1720
- padding,
1721
- gap,
1722
- width,
1723
- height,
1724
- minWidth,
1725
- maxWidth,
1726
- minHeight,
1727
- maxHeight,
1728
- radius,
1729
- bordered,
1730
- disabled
1731
- ]
1402
+ const tokens = useTokens();
1403
+ const { colors, sizeTokens } = React16.useMemo(
1404
+ () => getChipConfig(variant, semantic, size, selected, disabled, tokens),
1405
+ [variant, semantic, size, selected, disabled, tokens]
1732
1406
  );
1733
- const contextValue = useMemo(
1734
- () => ({ elevation: resolvedElevation, tokens }),
1735
- [resolvedElevation, tokens]
1407
+ const content = (state) => /* @__PURE__ */ React16.createElement(
1408
+ Wrapper,
1409
+ {
1410
+ direction: "horizontal",
1411
+ align: "center",
1412
+ gap: sizeTokens.gap,
1413
+ style: [
1414
+ {
1415
+ paddingLeft: sizeTokens.paddingX,
1416
+ paddingRight: sizeTokens.paddingX,
1417
+ paddingTop: sizeTokens.paddingY,
1418
+ paddingBottom: sizeTokens.paddingY,
1419
+ backgroundColor: state?.pressed && !disabled ? colors.pressedBg : state?.hovered && !disabled ? colors.hoveredBg : colors.bg,
1420
+ borderRadius: 99,
1421
+ borderWidth: colors.borderWidth,
1422
+ borderColor: colors.borderColor || "transparent",
1423
+ opacity: disabled ? 0.4 : 1
1424
+ },
1425
+ ...Array.isArray(style) ? style : style ? [style] : []
1426
+ ]
1427
+ },
1428
+ icon && /* @__PURE__ */ React16.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: colors.iconColor }),
1429
+ /* @__PURE__ */ React16.createElement(
1430
+ Text3,
1431
+ {
1432
+ role: sizeTokens.textRole,
1433
+ weight: selected ? "bold" : "medium",
1434
+ style: { color: colors.textColor }
1435
+ },
1436
+ children
1437
+ )
1736
1438
  );
1737
- const webOverrides = [];
1738
- if (styles.gridWebStyle) {
1739
- webOverrides.push(styles.gridWebStyle);
1439
+ if (onPress) {
1440
+ return /* @__PURE__ */ React16.createElement(Pressable, { onPress, disabled }, ({ pressed, hovered }) => content({ pressed, hovered }));
1740
1441
  }
1741
- if (styles.insetBoxShadow) {
1742
- webOverrides.push({ boxShadow: styles.insetBoxShadow });
1442
+ return content();
1443
+ }
1444
+
1445
+ // src/composites/layout/Divider/Divider.styles.ts
1446
+ function getDividerStyles(orientation, spacing, tokens) {
1447
+ const color = tokens.colors.primary.main.divider;
1448
+ if (orientation === "vertical") {
1449
+ return {
1450
+ width: 1,
1451
+ height: "100%",
1452
+ backgroundColor: color,
1453
+ ...spacing != null && { marginLeft: spacing, marginRight: spacing }
1454
+ };
1743
1455
  }
1744
- const userStyles = Array.isArray(style) ? style : style ? [style] : [];
1745
- const isInteractive = onPress !== void 0 || href !== void 0;
1746
- const { isFocusVisible, focusProps } = useFocusVisible();
1747
- const focusRingStyle = isFocusVisible && !disabled ? {
1748
- outlineWidth: 2,
1749
- outlineStyle: "solid",
1750
- outlineColor: srgbToHex(tokens.accent.fill.srgb),
1751
- outlineOffset: 2
1752
- } : void 0;
1753
- const webFocusProps = isInteractive ? focusProps : {};
1754
- const textStyle = useMemo(
1755
- () => ({
1756
- color: srgbToHex(tokens.textPrimary.srgb),
1757
- fontSize: tokens.typography.fontSizes["05"],
1758
- fontFamily: tokens.typography.fonts.main.family,
1759
- lineHeight: tokens.typography.lineHeights["06"]
1760
- }),
1761
- [tokens]
1456
+ return {
1457
+ height: 1,
1458
+ width: "100%",
1459
+ backgroundColor: color,
1460
+ ...spacing != null && { marginTop: spacing, marginBottom: spacing }
1461
+ };
1462
+ }
1463
+ function Divider({
1464
+ orientation = "horizontal",
1465
+ spacing,
1466
+ style
1467
+ }) {
1468
+ const tokens = useTokens();
1469
+ const dividerStyle = React16.useMemo(
1470
+ () => getDividerStyles(orientation, spacing, tokens),
1471
+ [orientation, spacing, tokens]
1762
1472
  );
1763
- const wrappedChildren = useMemo(
1764
- () => wrapTextChildren(children, textStyle),
1765
- [children, textStyle]
1473
+ return /* @__PURE__ */ React16.createElement(
1474
+ View,
1475
+ {
1476
+ style: [dividerStyle, ...Array.isArray(style) ? style : style ? [style] : []],
1477
+ accessibilityRole: "none"
1478
+ }
1479
+ );
1480
+ }
1481
+
1482
+ // src/composites/layout/ContentCard/ContentCard.styles.ts
1483
+ function getContentCardStyles(variant, isInteractive, tokens) {
1484
+ const dividerColor = tokens.colors.primary.main.divider;
1485
+ const interactiveStyles = isInteractive ? { cursor: "pointer", textDecorationLine: "none" } : {};
1486
+ if (variant === "elevated") {
1487
+ return {
1488
+ borderRadius: 12,
1489
+ ...interactiveStyles
1490
+ };
1491
+ }
1492
+ if (variant === "bordered") {
1493
+ return {
1494
+ borderWidth: 1,
1495
+ borderColor: dividerColor,
1496
+ borderStyle: "solid",
1497
+ borderRadius: 12,
1498
+ ...interactiveStyles
1499
+ };
1500
+ }
1501
+ return {
1502
+ borderBottomWidth: 1,
1503
+ borderBottomColor: dividerColor,
1504
+ ...interactiveStyles
1505
+ };
1506
+ }
1507
+ function ContentCard({
1508
+ children,
1509
+ variant = "bordered",
1510
+ href,
1511
+ onPress,
1512
+ padding = 20,
1513
+ gap = 8,
1514
+ disabled = false,
1515
+ style
1516
+ }) {
1517
+ const tokens = useTokens();
1518
+ const isInteractive = !!(href || onPress);
1519
+ const variantStyles = React16.useMemo(
1520
+ () => getContentCardStyles(variant, isInteractive, tokens),
1521
+ [variant, isInteractive, tokens]
1522
+ );
1523
+ return /* @__PURE__ */ React16.createElement(
1524
+ Frame,
1525
+ {
1526
+ elevation: variant === "elevated" ? 2 : void 0,
1527
+ appearance: variant === "elevated" ? "tinted" : void 0,
1528
+ href,
1529
+ onPress,
1530
+ disabled,
1531
+ padding,
1532
+ gap,
1533
+ style: [
1534
+ variantStyles,
1535
+ ...Array.isArray(style) ? style : style ? [style] : []
1536
+ ]
1537
+ },
1538
+ children
1766
1539
  );
1767
- return /* @__PURE__ */ React14.createElement(FrameContext.Provider, { value: contextValue }, isInteractive ? (
1768
- // Pressable handles taps. When href is set, react-native-web renders
1769
- // it as an <a> tag so it works like a regular link on the web.
1770
- /* @__PURE__ */ React14.createElement(
1771
- Pressable,
1772
- {
1773
- ref,
1774
- testID,
1775
- nativeID,
1776
- accessibilityLabel,
1777
- accessibilityHint,
1778
- accessibilityState: disabled ? { disabled: true } : void 0,
1779
- onPress,
1780
- disabled,
1781
- ...href ? { href, accessibilityRole: "link" } : { accessibilityRole: "button" },
1782
- ...webFocusProps,
1783
- style: ({ pressed }) => [
1784
- styles.container,
1785
- pressed && !disabled && styles.pressed,
1786
- focusRingStyle,
1787
- ...webOverrides,
1788
- ...userStyles
1789
- ]
1790
- },
1791
- wrappedChildren
1792
- )
1793
- ) : (
1794
- // Non-interactive Frame: just a plain View with no tap handling.
1795
- /* @__PURE__ */ React14.createElement(
1796
- View,
1797
- {
1798
- ref,
1799
- testID,
1800
- nativeID,
1801
- accessibilityLabel,
1802
- accessibilityHint,
1803
- style: [styles.container, ...webOverrides, ...userStyles]
1804
- },
1805
- wrappedChildren
1806
- )
1807
- ));
1808
1540
  }
1809
- function getTextInputStyles(tokens, disabled) {
1541
+ function getTextInputStyles(tokens, disabled, theme = "primary", appearance = "main") {
1542
+ const at = tokens.colors[theme][appearance];
1810
1543
  return StyleSheet.create({
1811
1544
  container: {
1812
1545
  gap: tokens.spacing["04"]
@@ -1815,22 +1548,24 @@ function getTextInputStyles(tokens, disabled) {
1815
1548
  fontFamily: tokens.typography.fonts.main.family,
1816
1549
  fontSize: tokens.typography.fontSizes["04"],
1817
1550
  fontWeight: tokens.typography.fonts.main.weights.medium,
1818
- color: srgbToHex(tokens.textSecondary.srgb)
1551
+ color: at.fontTertiary
1819
1552
  },
1820
1553
  input: {
1821
1554
  fontFamily: tokens.typography.fonts.main.family,
1822
- backgroundColor: srgbToHex(tokens.backgroundSunken.srgb),
1555
+ backgroundColor: at.fontSecondary,
1823
1556
  borderWidth: 1,
1824
- borderColor: srgbToHex(tokens.border.srgb),
1557
+ borderColor: at.fontSecondary,
1825
1558
  borderRadius: tokens.radius.md,
1826
1559
  paddingVertical: tokens.spacing["08"],
1827
1560
  paddingHorizontal: tokens.spacing["12"],
1828
1561
  fontSize: tokens.typography.fontSizes["05"],
1829
- color: disabled ? srgbToHex(tokens.textSecondary.srgb) : srgbToHex(tokens.textPrimary.srgb),
1562
+ color: disabled ? at.fontTertiary : at.divider,
1830
1563
  opacity: disabled ? 0.5 : 1
1831
1564
  }
1832
1565
  });
1833
1566
  }
1567
+
1568
+ // src/composites/form-controls/TextInput/TextInput.tsx
1834
1569
  function TextInput({
1835
1570
  label,
1836
1571
  disabled = false,
@@ -1838,21 +1573,25 @@ function TextInput({
1838
1573
  ...textInputProps
1839
1574
  }) {
1840
1575
  const tokens = useTokens(1);
1841
- const styles = React14.useMemo(
1842
- () => getTextInputStyles(tokens, disabled),
1843
- [tokens, disabled]
1576
+ const frameCtx = useFrameContext();
1577
+ const theme = frameCtx?.theme ?? "primary";
1578
+ const appearance = frameCtx?.appearance ?? "main";
1579
+ const styles = React16.useMemo(
1580
+ () => getTextInputStyles(tokens, disabled, theme, appearance),
1581
+ [tokens, disabled, theme, appearance]
1844
1582
  );
1845
- return /* @__PURE__ */ React14.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React14.createElement(Text, { style: styles.label }, label), /* @__PURE__ */ React14.createElement(
1583
+ return /* @__PURE__ */ React16.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React16.createElement(Text, { style: styles.label }, label), /* @__PURE__ */ React16.createElement(
1846
1584
  TextInput$1,
1847
1585
  {
1848
1586
  style: styles.input,
1849
1587
  editable: !disabled,
1850
- placeholderTextColor: srgbToHex(tokens.textSecondary.srgb),
1588
+ placeholderTextColor: tokens.colors[theme][appearance].fontTertiary,
1851
1589
  ...textInputProps
1852
1590
  }
1853
1591
  ));
1854
1592
  }
1855
- function getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpen) {
1593
+ function getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpen, theme = "primary", appearance = "main") {
1594
+ const at = tokens.colors[theme][appearance];
1856
1595
  const widthStyle = width === "trigger" ? { left: 0, right: 0 } : typeof width === "number" ? { width, left: 0 } : { left: 0 };
1857
1596
  return StyleSheet.create({
1858
1597
  container: {
@@ -1863,9 +1602,9 @@ function getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpe
1863
1602
  position: "absolute",
1864
1603
  top: triggerHeight + offset,
1865
1604
  ...widthStyle,
1866
- backgroundColor: srgbToHex(tokens.backgroundElevated.srgb),
1605
+ backgroundColor: at.fontPrimary,
1867
1606
  borderWidth: 1,
1868
- borderColor: srgbToHex(tokens.border.srgb),
1607
+ borderColor: at.fontSecondary,
1869
1608
  borderRadius: tokens.radius.md,
1870
1609
  maxHeight,
1871
1610
  zIndex: 1e3,
@@ -1894,6 +1633,7 @@ function Popover({
1894
1633
  contentStyle
1895
1634
  }) {
1896
1635
  const tokens = useTokens(1);
1636
+ const frameCtx = useFrameContext();
1897
1637
  const containerRef = useRef(null);
1898
1638
  const [triggerHeight, setTriggerHeight] = useState(0);
1899
1639
  const onTriggerLayout = useCallback(
@@ -1933,8 +1673,8 @@ function Popover({
1933
1673
  [closeOnEscape, onClose]
1934
1674
  );
1935
1675
  const styles = useMemo(
1936
- () => getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpen),
1937
- [tokens, triggerHeight, offset, maxHeight, width, isOpen]
1676
+ () => getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpen, frameCtx?.theme, frameCtx?.appearance),
1677
+ [tokens, triggerHeight, offset, maxHeight, width, isOpen, frameCtx?.theme, frameCtx?.appearance]
1938
1678
  );
1939
1679
  const containerStyles = useMemo(
1940
1680
  () => [styles.container, ...Array.isArray(style) ? style : style ? [style] : []],
@@ -1945,15 +1685,15 @@ function Popover({
1945
1685
  [styles.content, contentStyle]
1946
1686
  );
1947
1687
  const webProps = { onKeyDown: handleKeyDown };
1948
- return /* @__PURE__ */ React14.createElement(
1688
+ return /* @__PURE__ */ React16.createElement(
1949
1689
  View,
1950
1690
  {
1951
1691
  ref: containerRef,
1952
1692
  style: containerStyles,
1953
1693
  ...webProps
1954
1694
  },
1955
- /* @__PURE__ */ React14.createElement(View, { onLayout: onTriggerLayout }, trigger),
1956
- isOpen && /* @__PURE__ */ React14.createElement(View, { style: mergedContentStyles }, children)
1695
+ /* @__PURE__ */ React16.createElement(View, { onLayout: onTriggerLayout }, trigger),
1696
+ isOpen && /* @__PURE__ */ React16.createElement(View, { style: mergedContentStyles }, children)
1957
1697
  );
1958
1698
  }
1959
1699
  function usePopover(options) {
@@ -1980,7 +1720,8 @@ function usePopover(options) {
1980
1720
  function isOptionGroup(item) {
1981
1721
  return "options" in item;
1982
1722
  }
1983
- function getSelectStyles(tokens, disabled, size, isOpen) {
1723
+ function getSelectStyles(tokens, disabled, size, isOpen, theme = "primary", appearance = "main") {
1724
+ const at = tokens.colors[theme][appearance];
1984
1725
  const isSm = size === "sm";
1985
1726
  const fontSize = isSm ? tokens.typography.fontSizes["04"] : tokens.typography.fontSizes["05"];
1986
1727
  const iconSize = fontSize + 2;
@@ -1996,14 +1737,14 @@ function getSelectStyles(tokens, disabled, size, isOpen) {
1996
1737
  fontFamily: tokens.typography.fonts.main.family,
1997
1738
  fontSize: tokens.typography.fontSizes["04"],
1998
1739
  fontWeight: tokens.typography.fonts.main.weights.medium,
1999
- color: srgbToHex(tokens.textSecondary.srgb)
1740
+ color: at.fontTertiary
2000
1741
  },
2001
1742
  trigger: {
2002
1743
  flexDirection: "row",
2003
1744
  alignItems: "center",
2004
- backgroundColor: srgbToHex(tokens.backgroundSunken.srgb),
1745
+ backgroundColor: at.fontSecondary,
2005
1746
  borderWidth: 1,
2006
- borderColor: srgbToHex(tokens.border.srgb),
1747
+ borderColor: at.fontSecondary,
2007
1748
  borderRadius: tokens.radius.md,
2008
1749
  paddingVertical,
2009
1750
  paddingLeft: paddingHorizontal,
@@ -2014,7 +1755,7 @@ function getSelectStyles(tokens, disabled, size, isOpen) {
2014
1755
  flex: 1,
2015
1756
  fontFamily: tokens.typography.fonts.main.family,
2016
1757
  fontSize,
2017
- color: disabled ? srgbToHex(tokens.textSecondary.srgb) : srgbToHex(tokens.textPrimary.srgb)
1758
+ color: disabled ? at.fontTertiary : at.divider
2018
1759
  },
2019
1760
  iconWrapper: {
2020
1761
  position: "absolute",
@@ -2027,7 +1768,7 @@ function getSelectStyles(tokens, disabled, size, isOpen) {
2027
1768
  fontFamily: tokens.typography.fonts.main.family,
2028
1769
  fontSize: tokens.typography.fontSizes["01"],
2029
1770
  fontWeight: tokens.typography.fonts.main.weights.medium,
2030
- color: srgbToHex(tokens.textSecondary.srgb),
1771
+ color: at.fontTertiary,
2031
1772
  textTransform: "uppercase",
2032
1773
  letterSpacing: 0.5,
2033
1774
  paddingVertical: tokens.spacing["04"],
@@ -2146,11 +1887,14 @@ function SelectOptionRow({
2146
1887
  size
2147
1888
  }) {
2148
1889
  const tokens = useTokens(1);
1890
+ const frameCtx = useFrameContext();
1891
+ const at = tokens.colors[frameCtx?.theme ?? "primary"][frameCtx?.appearance ?? "main"];
1892
+ const emphasisAt = tokens.colors[frameCtx?.theme ?? "primary"].emphasis;
2149
1893
  const paddingVertical = size === "sm" ? tokens.spacing["04"] : tokens.spacing["08"];
2150
1894
  const paddingHorizontal = size === "sm" ? tokens.spacing["08"] : tokens.spacing["12"];
2151
1895
  const fontSize = size === "sm" ? tokens.typography.fontSizes["04"] : tokens.typography.fontSizes["05"];
2152
1896
  if (renderOption) {
2153
- return /* @__PURE__ */ React14.createElement(
1897
+ return /* @__PURE__ */ React16.createElement(
2154
1898
  Pressable,
2155
1899
  {
2156
1900
  onPress: option.disabled ? void 0 : onSelect,
@@ -2161,7 +1905,7 @@ function SelectOptionRow({
2161
1905
  renderOption(option, { isSelected, isFocused })
2162
1906
  );
2163
1907
  }
2164
- return /* @__PURE__ */ React14.createElement(
1908
+ return /* @__PURE__ */ React16.createElement(
2165
1909
  Pressable,
2166
1910
  {
2167
1911
  onPress: option.disabled ? void 0 : onSelect,
@@ -2177,10 +1921,10 @@ function SelectOptionRow({
2177
1921
  paddingHorizontal
2178
1922
  },
2179
1923
  isSelected && {
2180
- backgroundColor: srgbToHex(tokens.backgroundSunken.srgb)
1924
+ backgroundColor: at.fontSecondary
2181
1925
  },
2182
1926
  isFocused && !isSelected && {
2183
- backgroundColor: `${srgbToHex(tokens.border.srgb)}20`
1927
+ backgroundColor: `${at.fontSecondary}20`
2184
1928
  },
2185
1929
  option.disabled && {
2186
1930
  opacity: 0.5
@@ -2190,7 +1934,7 @@ function SelectOptionRow({
2190
1934
  }
2191
1935
  ]
2192
1936
  },
2193
- /* @__PURE__ */ React14.createElement(
1937
+ /* @__PURE__ */ React16.createElement(
2194
1938
  Text,
2195
1939
  {
2196
1940
  style: [
@@ -2198,30 +1942,32 @@ function SelectOptionRow({
2198
1942
  flex: 1,
2199
1943
  fontFamily: tokens.typography.fonts.main.family,
2200
1944
  fontSize,
2201
- color: srgbToHex(tokens.textPrimary.srgb)
1945
+ color: at.divider
2202
1946
  },
2203
1947
  isSelected && {
2204
1948
  fontWeight: tokens.typography.fonts.main.weights.medium,
2205
- color: srgbToHex(tokens.accent.fill.srgb)
1949
+ color: emphasisAt.divider
2206
1950
  },
2207
1951
  option.disabled && {
2208
- color: srgbToHex(tokens.textSecondary.srgb)
1952
+ color: at.fontTertiary
2209
1953
  }
2210
1954
  ],
2211
1955
  numberOfLines: 1
2212
1956
  },
2213
1957
  option.label
2214
1958
  ),
2215
- isSelected && /* @__PURE__ */ React14.createElement(View, { style: { marginLeft: tokens.spacing["08"] } }, /* @__PURE__ */ React14.createElement(
1959
+ isSelected && /* @__PURE__ */ React16.createElement(View, { style: { marginLeft: tokens.spacing["08"] } }, /* @__PURE__ */ React16.createElement(
2216
1960
  Icon,
2217
1961
  {
2218
1962
  name: "check",
2219
1963
  size: fontSize,
2220
- color: srgbToHex(tokens.accent.fill.srgb)
1964
+ color: emphasisAt.divider
2221
1965
  }
2222
1966
  ))
2223
1967
  );
2224
1968
  }
1969
+
1970
+ // src/composites/form-controls/Select/Select.tsx
2225
1971
  function flattenOptions(items) {
2226
1972
  const result = [];
2227
1973
  for (const item of items) {
@@ -2246,6 +1992,7 @@ function Select({
2246
1992
  style
2247
1993
  }) {
2248
1994
  const tokens = useTokens(1);
1995
+ const frameCtx = useFrameContext();
2249
1996
  const { isOpen, open, close, toggle } = usePopover();
2250
1997
  const flatOptions = useMemo(() => flattenOptions(options), [options]);
2251
1998
  const { focusedIndex, handleKeyDown } = useSelect({
@@ -2259,15 +2006,18 @@ function Select({
2259
2006
  onClose: close,
2260
2007
  onOpen: open
2261
2008
  });
2009
+ const inheritedTheme = frameCtx?.theme;
2010
+ const inheritedAppearance = frameCtx?.appearance;
2262
2011
  const styles = useMemo(
2263
- () => getSelectStyles(tokens, disabled, size, isOpen),
2264
- [tokens, disabled, size, isOpen]
2012
+ () => getSelectStyles(tokens, disabled, size, isOpen, inheritedTheme, inheritedAppearance),
2013
+ [tokens, disabled, size, isOpen, inheritedTheme, inheritedAppearance]
2265
2014
  );
2266
2015
  const selectedOption = flatOptions.find((o) => o.value === value);
2267
2016
  const displayLabel = selectedOption?.label ?? placeholder ?? value;
2268
- const iconColor = disabled ? srgbToHex(tokens.textSecondary.srgb) : srgbToHex(tokens.textPrimary.srgb);
2017
+ const at = tokens.colors[inheritedTheme ?? "primary"][inheritedAppearance ?? "main"];
2018
+ const iconColor = disabled ? at.fontTertiary : at.divider;
2269
2019
  const triggerWebProps = { onKeyDown: handleKeyDown };
2270
- const trigger = /* @__PURE__ */ React14.createElement(
2020
+ const trigger = /* @__PURE__ */ React16.createElement(
2271
2021
  Pressable,
2272
2022
  {
2273
2023
  onPress: disabled ? void 0 : toggle,
@@ -2277,8 +2027,8 @@ function Select({
2277
2027
  ...triggerWebProps,
2278
2028
  style: styles.trigger
2279
2029
  },
2280
- renderValue ? renderValue(selectedOption) : /* @__PURE__ */ React14.createElement(Text, { style: styles.triggerText, numberOfLines: 1 }, displayLabel),
2281
- /* @__PURE__ */ React14.createElement(View, { style: styles.iconWrapper, pointerEvents: "none" }, /* @__PURE__ */ React14.createElement(
2030
+ renderValue ? renderValue(selectedOption) : /* @__PURE__ */ React16.createElement(Text, { style: styles.triggerText, numberOfLines: 1 }, displayLabel),
2031
+ /* @__PURE__ */ React16.createElement(View, { style: styles.iconWrapper, pointerEvents: "none" }, /* @__PURE__ */ React16.createElement(
2282
2032
  Icon,
2283
2033
  {
2284
2034
  name: isOpen ? "expand_less" : "expand_more",
@@ -2287,14 +2037,14 @@ function Select({
2287
2037
  }
2288
2038
  ))
2289
2039
  );
2290
- return /* @__PURE__ */ React14.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : style ? [style] : []] }, label && /* @__PURE__ */ React14.createElement(Text, { style: styles.label }, label), /* @__PURE__ */ React14.createElement(
2040
+ return /* @__PURE__ */ React16.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : style ? [style] : []] }, label && /* @__PURE__ */ React16.createElement(Text, { style: styles.label }, label), /* @__PURE__ */ React16.createElement(
2291
2041
  Popover,
2292
2042
  {
2293
2043
  isOpen: isOpen && !disabled,
2294
2044
  onClose: close,
2295
2045
  trigger
2296
2046
  },
2297
- /* @__PURE__ */ React14.createElement(
2047
+ /* @__PURE__ */ React16.createElement(
2298
2048
  ScrollView,
2299
2049
  {
2300
2050
  bounces: false,
@@ -2303,7 +2053,7 @@ function Select({
2303
2053
  },
2304
2054
  options.map((item) => {
2305
2055
  if (isOptionGroup(item)) {
2306
- return /* @__PURE__ */ React14.createElement(View, { key: item.label }, /* @__PURE__ */ React14.createElement(Text, { style: styles.groupLabel }, item.label), item.options.map((opt) => /* @__PURE__ */ React14.createElement(
2056
+ return /* @__PURE__ */ React16.createElement(View, { key: item.label }, /* @__PURE__ */ React16.createElement(Text, { style: styles.groupLabel }, item.label), item.options.map((opt) => /* @__PURE__ */ React16.createElement(
2307
2057
  SelectOptionRow,
2308
2058
  {
2309
2059
  key: opt.value,
@@ -2319,7 +2069,7 @@ function Select({
2319
2069
  }
2320
2070
  )));
2321
2071
  }
2322
- return /* @__PURE__ */ React14.createElement(
2072
+ return /* @__PURE__ */ React16.createElement(
2323
2073
  SelectOptionRow,
2324
2074
  {
2325
2075
  key: item.value,
@@ -2342,7 +2092,9 @@ var TRACK_WIDTH = 40;
2342
2092
  var TRACK_HEIGHT = 22;
2343
2093
  var THUMB_SIZE = 18;
2344
2094
  var THUMB_OFFSET = 2;
2345
- function getToggleStyles(tokens, value, disabled) {
2095
+ function getToggleStyles(tokens, value, disabled, theme = "primary", appearance = "main") {
2096
+ const at = tokens.colors[theme][appearance];
2097
+ const emphasisAt = tokens.colors[theme].emphasis;
2346
2098
  return StyleSheet.create({
2347
2099
  container: {
2348
2100
  flexDirection: "row",
@@ -2354,13 +2106,13 @@ function getToggleStyles(tokens, value, disabled) {
2354
2106
  fontFamily: tokens.typography.fonts.main.family,
2355
2107
  fontSize: tokens.typography.fontSizes["04"],
2356
2108
  fontWeight: tokens.typography.fonts.main.weights.medium,
2357
- color: srgbToHex(tokens.textSecondary.srgb)
2109
+ color: at.fontTertiary
2358
2110
  },
2359
2111
  track: {
2360
2112
  width: TRACK_WIDTH,
2361
2113
  height: TRACK_HEIGHT,
2362
2114
  borderRadius: TRACK_HEIGHT / 2,
2363
- backgroundColor: value ? srgbToHex(tokens.accent.fill.srgb) : srgbToHex(tokens.border.srgb),
2115
+ backgroundColor: value ? emphasisAt.divider : at.fontSecondary,
2364
2116
  justifyContent: "center",
2365
2117
  paddingHorizontal: THUMB_OFFSET
2366
2118
  },
@@ -2368,7 +2120,7 @@ function getToggleStyles(tokens, value, disabled) {
2368
2120
  width: THUMB_SIZE,
2369
2121
  height: THUMB_SIZE,
2370
2122
  borderRadius: THUMB_SIZE / 2,
2371
- backgroundColor: srgbToHex(tokens.background.srgb),
2123
+ backgroundColor: at.background,
2372
2124
  alignSelf: value ? "flex-end" : "flex-start"
2373
2125
  }
2374
2126
  });
@@ -2383,16 +2135,17 @@ function Toggle({
2383
2135
  style
2384
2136
  }) {
2385
2137
  const tokens = useTokens(1);
2386
- const styles = React14.useMemo(
2387
- () => getToggleStyles(tokens, value, disabled),
2388
- [tokens, value, disabled]
2138
+ const frameCtx = useFrameContext();
2139
+ const styles = React16.useMemo(
2140
+ () => getToggleStyles(tokens, value, disabled, frameCtx?.theme, frameCtx?.appearance),
2141
+ [tokens, value, disabled, frameCtx?.theme, frameCtx?.appearance]
2389
2142
  );
2390
- const handlePress = React14.useCallback(() => {
2143
+ const handlePress = React16.useCallback(() => {
2391
2144
  if (!disabled) {
2392
2145
  onValueChange(!value);
2393
2146
  }
2394
2147
  }, [disabled, value, onValueChange]);
2395
- return /* @__PURE__ */ React14.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React14.createElement(Text, { style: styles.label }, label), /* @__PURE__ */ React14.createElement(
2148
+ return /* @__PURE__ */ React16.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React16.createElement(Text, { style: styles.label }, label), /* @__PURE__ */ React16.createElement(
2396
2149
  Pressable,
2397
2150
  {
2398
2151
  onPress: handlePress,
@@ -2400,7 +2153,7 @@ function Toggle({
2400
2153
  accessibilityRole: "switch",
2401
2154
  accessibilityState: { checked: value, disabled }
2402
2155
  },
2403
- /* @__PURE__ */ React14.createElement(View, { style: styles.track }, /* @__PURE__ */ React14.createElement(View, { style: styles.thumb }))
2156
+ /* @__PURE__ */ React16.createElement(View, { style: styles.track }, /* @__PURE__ */ React16.createElement(View, { style: styles.thumb }))
2404
2157
  ));
2405
2158
  }
2406
2159
  var TRACK_HEIGHT2 = 6;
@@ -2420,23 +2173,23 @@ function getSliderStyles(tokens, disabled) {
2420
2173
  fontFamily: tokens.typography.fonts.main.family,
2421
2174
  fontSize: tokens.typography.fontSizes["04"],
2422
2175
  fontWeight: tokens.typography.fonts.main.weights.medium,
2423
- color: srgbToHex(tokens.textSecondary.srgb)
2176
+ color: tokens.colors.primary.main.fontTertiary
2424
2177
  },
2425
2178
  value: {
2426
2179
  fontFamily: tokens.typography.fonts.main.family,
2427
2180
  fontSize: tokens.typography.fontSizes["04"],
2428
2181
  fontWeight: tokens.typography.fonts.main.weights.medium,
2429
- color: srgbToHex(tokens.textPrimary.srgb)
2182
+ color: tokens.colors.primary.main.divider
2430
2183
  },
2431
2184
  valueInput: {
2432
2185
  width: 48,
2433
2186
  paddingVertical: 0,
2434
2187
  paddingHorizontal: 4,
2435
2188
  borderWidth: 1,
2436
- borderColor: srgbToHex(tokens.border.srgb),
2189
+ borderColor: tokens.colors.primary.main.fontSecondary,
2437
2190
  borderRadius: 4,
2438
2191
  backgroundColor: "transparent",
2439
- color: srgbToHex(tokens.textPrimary.srgb),
2192
+ color: tokens.colors.primary.main.divider,
2440
2193
  fontFamily: tokens.typography.fonts.main.family,
2441
2194
  fontSize: tokens.typography.fontSizes["04"],
2442
2195
  fontWeight: tokens.typography.fonts.main.weights.medium,
@@ -2453,21 +2206,21 @@ function getSliderStyles(tokens, disabled) {
2453
2206
  right: 0,
2454
2207
  height: TRACK_HEIGHT2,
2455
2208
  borderRadius: TRACK_HEIGHT2 / 2,
2456
- backgroundColor: srgbToHex(tokens.border.srgb)
2209
+ backgroundColor: tokens.colors.primary.main.fontSecondary
2457
2210
  },
2458
2211
  trackFill: {
2459
2212
  position: "absolute",
2460
2213
  left: 0,
2461
2214
  height: TRACK_HEIGHT2,
2462
2215
  borderRadius: TRACK_HEIGHT2 / 2,
2463
- backgroundColor: srgbToHex(tokens.accent.fill.srgb)
2216
+ backgroundColor: tokens.colors.primary.emphasis.divider
2464
2217
  },
2465
2218
  thumb: {
2466
2219
  position: "absolute",
2467
2220
  width: THUMB_SIZE2,
2468
2221
  height: THUMB_SIZE2,
2469
2222
  borderRadius: THUMB_SIZE2 / 2,
2470
- backgroundColor: srgbToHex(tokens.accent.fill.srgb)
2223
+ backgroundColor: tokens.colors.primary.emphasis.divider
2471
2224
  }
2472
2225
  });
2473
2226
  }
@@ -2486,42 +2239,42 @@ function Slider({
2486
2239
  style
2487
2240
  }) {
2488
2241
  const tokens = useTokens(1);
2489
- const styles = React14.useMemo(
2242
+ const styles = React16.useMemo(
2490
2243
  () => getSliderStyles(tokens, disabled),
2491
2244
  [tokens, disabled]
2492
2245
  );
2493
- const trackRef = React14.useRef(null);
2494
- const trackWidth = React14.useRef(0);
2495
- const trackPageX = React14.useRef(0);
2496
- const [layoutWidth, setLayoutWidth] = React14.useState(0);
2497
- const onValueChangeRef = React14.useRef(onValueChange);
2498
- const minRef = React14.useRef(min);
2499
- const maxRef = React14.useRef(max);
2500
- const stepRef = React14.useRef(step);
2501
- const disabledRef = React14.useRef(disabled);
2502
- React14.useEffect(() => {
2246
+ const trackRef = React16.useRef(null);
2247
+ const trackWidth = React16.useRef(0);
2248
+ const trackPageX = React16.useRef(0);
2249
+ const [layoutWidth, setLayoutWidth] = React16.useState(0);
2250
+ const onValueChangeRef = React16.useRef(onValueChange);
2251
+ const minRef = React16.useRef(min);
2252
+ const maxRef = React16.useRef(max);
2253
+ const stepRef = React16.useRef(step);
2254
+ const disabledRef = React16.useRef(disabled);
2255
+ React16.useEffect(() => {
2503
2256
  onValueChangeRef.current = onValueChange;
2504
2257
  }, [onValueChange]);
2505
- React14.useEffect(() => {
2258
+ React16.useEffect(() => {
2506
2259
  minRef.current = min;
2507
2260
  }, [min]);
2508
- React14.useEffect(() => {
2261
+ React16.useEffect(() => {
2509
2262
  maxRef.current = max;
2510
2263
  }, [max]);
2511
- React14.useEffect(() => {
2264
+ React16.useEffect(() => {
2512
2265
  stepRef.current = step;
2513
2266
  }, [step]);
2514
- React14.useEffect(() => {
2267
+ React16.useEffect(() => {
2515
2268
  disabledRef.current = disabled;
2516
2269
  }, [disabled]);
2517
- const computeValue = React14.useCallback((pageX) => {
2270
+ const computeValue = React16.useCallback((pageX) => {
2518
2271
  const localX = pageX - trackPageX.current;
2519
2272
  const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
2520
2273
  const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
2521
2274
  const stepped = Math.round(raw / stepRef.current) * stepRef.current;
2522
2275
  return Math.min(maxRef.current, Math.max(minRef.current, stepped));
2523
2276
  }, []);
2524
- const panResponder = React14.useRef(
2277
+ const panResponder = React16.useRef(
2525
2278
  PanResponder.create({
2526
2279
  onStartShouldSetPanResponder: () => !disabledRef.current,
2527
2280
  onMoveShouldSetPanResponder: () => !disabledRef.current,
@@ -2549,7 +2302,7 @@ function Slider({
2549
2302
  fillLeft = 0;
2550
2303
  fillWidth = thumbLeft + THUMB_SIZE2 / 2;
2551
2304
  }
2552
- const handleValueTextSubmit = React14.useCallback(
2305
+ const handleValueTextSubmit = React16.useCallback(
2553
2306
  (text) => {
2554
2307
  const raw = Number(text);
2555
2308
  if (!Number.isNaN(raw)) {
@@ -2558,12 +2311,12 @@ function Slider({
2558
2311
  },
2559
2312
  [onValueChange, min, max]
2560
2313
  );
2561
- const [editText, setEditText] = React14.useState(String(value));
2562
- React14.useEffect(() => {
2314
+ const [editText, setEditText] = React16.useState(String(value));
2315
+ React16.useEffect(() => {
2563
2316
  setEditText(String(value));
2564
2317
  }, [value]);
2565
2318
  const showLabel = label || showValue || editableValue;
2566
- return /* @__PURE__ */ React14.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React14.createElement(View, { style: styles.labelRow }, label && /* @__PURE__ */ React14.createElement(Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React14.createElement(
2319
+ return /* @__PURE__ */ React16.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React16.createElement(View, { style: styles.labelRow }, label && /* @__PURE__ */ React16.createElement(Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React16.createElement(
2567
2320
  TextInput$1,
2568
2321
  {
2569
2322
  style: styles.valueInput,
@@ -2575,7 +2328,7 @@ function Slider({
2575
2328
  selectTextOnFocus: true,
2576
2329
  editable: !disabled
2577
2330
  }
2578
- ) : showValue && /* @__PURE__ */ React14.createElement(Text, { style: styles.value }, value)), /* @__PURE__ */ React14.createElement(
2331
+ ) : showValue && /* @__PURE__ */ React16.createElement(Text, { style: styles.value }, value)), /* @__PURE__ */ React16.createElement(
2579
2332
  View,
2580
2333
  {
2581
2334
  ref: trackRef,
@@ -2590,45 +2343,19 @@ function Slider({
2590
2343
  },
2591
2344
  ...panResponder.panHandlers
2592
2345
  },
2593
- /* @__PURE__ */ React14.createElement(View, { style: styles.trackRail }),
2594
- /* @__PURE__ */ React14.createElement(View, { style: [styles.trackFill, { left: fillLeft, width: fillWidth }] }),
2595
- /* @__PURE__ */ React14.createElement(View, { style: [styles.thumb, { left: thumbLeft }] })
2346
+ /* @__PURE__ */ React16.createElement(View, { style: styles.trackRail }),
2347
+ /* @__PURE__ */ React16.createElement(View, { style: [styles.trackFill, { left: fillLeft, width: fillWidth }] }),
2348
+ /* @__PURE__ */ React16.createElement(View, { style: [styles.thumb, { left: thumbLeft }] })
2596
2349
  ));
2597
2350
  }
2598
2351
  var TRACK_HEIGHT3 = 22;
2599
2352
  var THUMB_SIZE3 = 18;
2600
2353
  var SEGMENT_COUNT = 48;
2601
- function hueToHex(hue) {
2602
- const h = (hue % 360 + 360) % 360;
2603
- const x = 1 - Math.abs(h / 60 % 2 - 1);
2604
- let r, g, b;
2605
- if (h < 60) {
2606
- r = 1;
2607
- g = x;
2608
- b = 0;
2609
- } else if (h < 120) {
2610
- r = x;
2611
- g = 1;
2612
- b = 0;
2613
- } else if (h < 180) {
2614
- r = 0;
2615
- g = 1;
2616
- b = x;
2617
- } else if (h < 240) {
2618
- r = 0;
2619
- g = x;
2620
- b = 1;
2621
- } else if (h < 300) {
2622
- r = x;
2623
- g = 0;
2624
- b = 1;
2625
- } else {
2626
- r = 1;
2627
- g = 0;
2628
- b = x;
2629
- }
2630
- const toHex = (v) => Math.round(v * 255).toString(16).padStart(2, "0");
2631
- return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
2354
+ var OKLCH_L = 0.7;
2355
+ var OKLCH_C = 0.4;
2356
+ function hueToHex(oklchHue) {
2357
+ const { color } = gamutMapToSrgb({ L: OKLCH_L, C: OKLCH_C, h: oklchHue });
2358
+ return srgbToHex(color);
2632
2359
  }
2633
2360
  function buildHueSegments(min, max) {
2634
2361
  return Array.from({ length: SEGMENT_COUNT }, (_, i) => {
@@ -2651,23 +2378,23 @@ function getHueSliderStyles(tokens, disabled) {
2651
2378
  fontFamily: tokens.typography.fonts.main.family,
2652
2379
  fontSize: tokens.typography.fontSizes["04"],
2653
2380
  fontWeight: tokens.typography.fonts.main.weights.medium,
2654
- color: srgbToHex(tokens.textSecondary.srgb)
2381
+ color: tokens.colors.primary.main.fontTertiary
2655
2382
  },
2656
2383
  value: {
2657
2384
  fontFamily: tokens.typography.fonts.main.family,
2658
2385
  fontSize: tokens.typography.fontSizes["04"],
2659
2386
  fontWeight: tokens.typography.fonts.main.weights.medium,
2660
- color: srgbToHex(tokens.textPrimary.srgb)
2387
+ color: tokens.colors.primary.main.divider
2661
2388
  },
2662
2389
  valueInput: {
2663
2390
  width: 48,
2664
2391
  paddingVertical: 0,
2665
2392
  paddingHorizontal: 4,
2666
2393
  borderWidth: 1,
2667
- borderColor: srgbToHex(tokens.border.srgb),
2394
+ borderColor: tokens.colors.primary.main.fontSecondary,
2668
2395
  borderRadius: 4,
2669
2396
  backgroundColor: "transparent",
2670
- color: srgbToHex(tokens.textPrimary.srgb),
2397
+ color: tokens.colors.primary.main.divider,
2671
2398
  fontFamily: tokens.typography.fonts.main.family,
2672
2399
  fontSize: tokens.typography.fontSizes["04"],
2673
2400
  fontWeight: tokens.typography.fonts.main.weights.medium,
@@ -2697,7 +2424,7 @@ function getHueSliderStyles(tokens, disabled) {
2697
2424
  borderRadius: THUMB_SIZE3 / 2,
2698
2425
  backgroundColor: "#ffffff",
2699
2426
  borderWidth: 2,
2700
- borderColor: srgbToHex(tokens.border.srgb)
2427
+ borderColor: tokens.colors.primary.main.fontSecondary
2701
2428
  }
2702
2429
  });
2703
2430
  }
@@ -2707,7 +2434,7 @@ function HueSlider({
2707
2434
  value,
2708
2435
  onValueChange,
2709
2436
  min = 0,
2710
- max = 359,
2437
+ max = 360,
2711
2438
  label,
2712
2439
  showValue = false,
2713
2440
  editableValue = false,
@@ -2715,42 +2442,42 @@ function HueSlider({
2715
2442
  style
2716
2443
  }) {
2717
2444
  const tokens = useTokens(1);
2718
- const styles = React14.useMemo(
2445
+ const styles = React16.useMemo(
2719
2446
  () => getHueSliderStyles(tokens, disabled),
2720
2447
  [tokens, disabled]
2721
2448
  );
2722
- const segments = React14.useMemo(
2449
+ const segments = React16.useMemo(
2723
2450
  () => buildHueSegments(min, max),
2724
2451
  [min, max]
2725
2452
  );
2726
- const trackRef = React14.useRef(null);
2727
- const trackWidth = React14.useRef(0);
2728
- const trackPageX = React14.useRef(0);
2729
- const [layoutWidth, setLayoutWidth] = React14.useState(0);
2730
- const onValueChangeRef = React14.useRef(onValueChange);
2731
- const minRef = React14.useRef(min);
2732
- const maxRef = React14.useRef(max);
2733
- const disabledRef = React14.useRef(disabled);
2734
- React14.useEffect(() => {
2453
+ const trackRef = React16.useRef(null);
2454
+ const trackWidth = React16.useRef(0);
2455
+ const trackPageX = React16.useRef(0);
2456
+ const [layoutWidth, setLayoutWidth] = React16.useState(0);
2457
+ const onValueChangeRef = React16.useRef(onValueChange);
2458
+ const minRef = React16.useRef(min);
2459
+ const maxRef = React16.useRef(max);
2460
+ const disabledRef = React16.useRef(disabled);
2461
+ React16.useEffect(() => {
2735
2462
  onValueChangeRef.current = onValueChange;
2736
2463
  }, [onValueChange]);
2737
- React14.useEffect(() => {
2464
+ React16.useEffect(() => {
2738
2465
  minRef.current = min;
2739
2466
  }, [min]);
2740
- React14.useEffect(() => {
2467
+ React16.useEffect(() => {
2741
2468
  maxRef.current = max;
2742
2469
  }, [max]);
2743
- React14.useEffect(() => {
2470
+ React16.useEffect(() => {
2744
2471
  disabledRef.current = disabled;
2745
2472
  }, [disabled]);
2746
- const computeHue = React14.useCallback((pageX) => {
2473
+ const computeHue = React16.useCallback((pageX) => {
2747
2474
  const localX = pageX - trackPageX.current;
2748
2475
  const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
2749
2476
  const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
2750
2477
  const stepped = Math.round(raw);
2751
2478
  return (stepped % 360 + 360) % 360;
2752
2479
  }, []);
2753
- const panResponder = React14.useRef(
2480
+ const panResponder = React16.useRef(
2754
2481
  PanResponder.create({
2755
2482
  onStartShouldSetPanResponder: () => !disabledRef.current,
2756
2483
  onMoveShouldSetPanResponder: () => !disabledRef.current,
@@ -2762,11 +2489,11 @@ function HueSlider({
2762
2489
  }
2763
2490
  })
2764
2491
  ).current;
2765
- const sliderValue = max > 359 && value < min ? value + 360 : value;
2492
+ const sliderValue = max > 360 && value < min ? value + 360 : value;
2766
2493
  const ratio = max > min ? (sliderValue - min) / (max - min) : 0;
2767
2494
  const usableWidth = Math.max(0, layoutWidth - THUMB_SIZE3);
2768
2495
  const thumbLeft = ratio * usableWidth;
2769
- const handleValueTextSubmit = React14.useCallback(
2496
+ const handleValueTextSubmit = React16.useCallback(
2770
2497
  (text) => {
2771
2498
  const raw = Number(text);
2772
2499
  if (!Number.isNaN(raw)) {
@@ -2775,12 +2502,12 @@ function HueSlider({
2775
2502
  },
2776
2503
  [onValueChange]
2777
2504
  );
2778
- const [editText, setEditText] = React14.useState(String(value));
2779
- React14.useEffect(() => {
2505
+ const [editText, setEditText] = React16.useState(String(value));
2506
+ React16.useEffect(() => {
2780
2507
  setEditText(String(value));
2781
2508
  }, [value]);
2782
2509
  const showLabel = label || showValue || editableValue;
2783
- return /* @__PURE__ */ React14.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React14.createElement(View, { style: styles.labelRow }, label && /* @__PURE__ */ React14.createElement(Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React14.createElement(
2510
+ return /* @__PURE__ */ React16.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React16.createElement(View, { style: styles.labelRow }, label && /* @__PURE__ */ React16.createElement(Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React16.createElement(
2784
2511
  TextInput$1,
2785
2512
  {
2786
2513
  style: styles.valueInput,
@@ -2792,7 +2519,7 @@ function HueSlider({
2792
2519
  selectTextOnFocus: true,
2793
2520
  editable: !disabled
2794
2521
  }
2795
- ) : showValue && /* @__PURE__ */ React14.createElement(Text, { style: styles.value }, value, "\xB0")), /* @__PURE__ */ React14.createElement(
2522
+ ) : showValue && /* @__PURE__ */ React16.createElement(Text, { style: styles.value }, value, "\xB0")), /* @__PURE__ */ React16.createElement(
2796
2523
  View,
2797
2524
  {
2798
2525
  ref: trackRef,
@@ -2807,10 +2534,66 @@ function HueSlider({
2807
2534
  },
2808
2535
  ...panResponder.panHandlers
2809
2536
  },
2810
- /* @__PURE__ */ React14.createElement(View, { style: styles.gradientTrack }, segments.map((color, i) => /* @__PURE__ */ React14.createElement(View, { key: i, style: [styles.segment, { backgroundColor: color }] }))),
2811
- /* @__PURE__ */ React14.createElement(View, { style: [styles.thumb, { left: thumbLeft }] })
2537
+ /* @__PURE__ */ React16.createElement(View, { style: styles.gradientTrack }, segments.map((color, i) => /* @__PURE__ */ React16.createElement(View, { key: i, style: [styles.segment, { backgroundColor: color }] }))),
2538
+ /* @__PURE__ */ React16.createElement(View, { style: [styles.thumb, { left: thumbLeft }] })
2812
2539
  ));
2813
2540
  }
2541
+
2542
+ // node_modules/@newtonedev/colors/dist/index.js
2543
+ var SRGB_GAMMA_THRESHOLD_LINEAR = 31308e-7;
2544
+ var SRGB_GAMMA_SLOPE = 12.92;
2545
+ var SRGB_GAMMA_EXPONENT = 2.4;
2546
+ var SRGB_GAMMA_OFFSET = 0.055;
2547
+ var SRGB_GAMMA_SCALE = 1.055;
2548
+ var OKLAB_TO_LMS_PRIME = [
2549
+ [1, 0.3963377774, 0.2158037573],
2550
+ [1, -0.1055613458, -0.0638541728],
2551
+ [1, -0.0894841775, -1.291485548]
2552
+ ];
2553
+ var LMS_TO_LINEAR_P3 = [
2554
+ [3.127769439, -2.2570600176, 0.1291828502],
2555
+ [-1.0910091977, 2.4133065499, -0.3222615148],
2556
+ [-0.0260108068, -0.5080402362, 1.5340494942]
2557
+ ];
2558
+ var DEG_TO_RAD = Math.PI / 180;
2559
+ function oklchToOklab(lch) {
2560
+ const hRad = lch.h * DEG_TO_RAD;
2561
+ return {
2562
+ L: lch.L,
2563
+ a: lch.C * Math.cos(hRad),
2564
+ b: lch.C * Math.sin(hRad)
2565
+ };
2566
+ }
2567
+ function oklabToLinearP3(color) {
2568
+ const lp = OKLAB_TO_LMS_PRIME[0][0] * color.L + OKLAB_TO_LMS_PRIME[0][1] * color.a + OKLAB_TO_LMS_PRIME[0][2] * color.b;
2569
+ const mp = OKLAB_TO_LMS_PRIME[1][0] * color.L + OKLAB_TO_LMS_PRIME[1][1] * color.a + OKLAB_TO_LMS_PRIME[1][2] * color.b;
2570
+ const sp = OKLAB_TO_LMS_PRIME[2][0] * color.L + OKLAB_TO_LMS_PRIME[2][1] * color.a + OKLAB_TO_LMS_PRIME[2][2] * color.b;
2571
+ const l = lp * lp * lp;
2572
+ const m = mp * mp * mp;
2573
+ const s = sp * sp * sp;
2574
+ return {
2575
+ r: LMS_TO_LINEAR_P3[0][0] * l + LMS_TO_LINEAR_P3[0][1] * m + LMS_TO_LINEAR_P3[0][2] * s,
2576
+ g: LMS_TO_LINEAR_P3[1][0] * l + LMS_TO_LINEAR_P3[1][1] * m + LMS_TO_LINEAR_P3[1][2] * s,
2577
+ b: LMS_TO_LINEAR_P3[2][0] * l + LMS_TO_LINEAR_P3[2][1] * m + LMS_TO_LINEAR_P3[2][2] * s
2578
+ };
2579
+ }
2580
+ function linearChannelToSrgb(value) {
2581
+ return value <= SRGB_GAMMA_THRESHOLD_LINEAR ? value * SRGB_GAMMA_SLOPE : SRGB_GAMMA_SCALE * value ** (1 / SRGB_GAMMA_EXPONENT) - SRGB_GAMMA_OFFSET;
2582
+ }
2583
+ function linearSrgbToSrgb(color) {
2584
+ return {
2585
+ r: linearChannelToSrgb(color.r),
2586
+ g: linearChannelToSrgb(color.g),
2587
+ b: linearChannelToSrgb(color.b)
2588
+ };
2589
+ }
2590
+ function oklchToP3(color) {
2591
+ return linearSrgbToSrgb(oklabToLinearP3(oklchToOklab(color)));
2592
+ }
2593
+ function oklchToP3Css(color) {
2594
+ const { r, g, b } = oklchToP3(color);
2595
+ return `color(display-p3 ${r} ${g} ${b})`;
2596
+ }
2814
2597
  var TRACK_HEIGHT4 = 22;
2815
2598
  var THUMB_SIZE4 = 18;
2816
2599
  function getColorScaleSliderStyles(tokens, disabled) {
@@ -2828,7 +2611,7 @@ function getColorScaleSliderStyles(tokens, disabled) {
2828
2611
  fontFamily: tokens.typography.fonts.main.family,
2829
2612
  fontSize: tokens.typography.fontSizes["04"],
2830
2613
  fontWeight: tokens.typography.fonts.main.weights.medium,
2831
- color: srgbToHex(tokens.textSecondary.srgb)
2614
+ color: tokens.colors.primary.main.fontTertiary
2832
2615
  },
2833
2616
  trackContainer: {
2834
2617
  height: TRACK_HEIGHT4 + THUMB_SIZE4,
@@ -2854,13 +2637,13 @@ function getColorScaleSliderStyles(tokens, disabled) {
2854
2637
  borderRadius: THUMB_SIZE4 / 2,
2855
2638
  backgroundColor: "#ffffff",
2856
2639
  borderWidth: 2,
2857
- borderColor: srgbToHex(tokens.border.srgb)
2640
+ borderColor: tokens.colors.primary.main.fontSecondary
2858
2641
  },
2859
2642
  warning: {
2860
2643
  fontFamily: tokens.typography.fonts.main.family,
2861
2644
  fontSize: tokens.typography.fontSizes["01"],
2862
2645
  fontWeight: tokens.typography.fonts.main.weights.medium,
2863
- color: srgbToHex(tokens.error.fill.srgb)
2646
+ color: tokens.colors.error.emphasis.divider
2864
2647
  }
2865
2648
  });
2866
2649
  }
@@ -2876,40 +2659,42 @@ function ColorScaleSlider({
2876
2659
  snap = false,
2877
2660
  disabled = false,
2878
2661
  animateValue = false,
2662
+ useP3: _useP3,
2879
2663
  style
2880
2664
  }) {
2881
2665
  const tokens = useTokens(1);
2882
- const styles = React14.useMemo(
2666
+ const { gamut } = useNewtoneTheme();
2667
+ const styles = React16.useMemo(
2883
2668
  () => getColorScaleSliderStyles(tokens, disabled),
2884
2669
  [tokens, disabled]
2885
2670
  );
2886
- const trackRef = React14.useRef(null);
2887
- const trackWidth = React14.useRef(0);
2888
- const trackPageX = React14.useRef(0);
2889
- const isDragging = React14.useRef(false);
2890
- const thumbAnim = React14.useRef(new Animated.Value(0)).current;
2891
- const [layoutWidth, setLayoutWidth] = React14.useState(0);
2892
- const onValueChangeRef = React14.useRef(onValueChange);
2893
- const disabledRef = React14.useRef(disabled);
2894
- const colorsLengthRef = React14.useRef(colors.length);
2895
- const trimEndsRef = React14.useRef(trimEnds);
2896
- const snapRef = React14.useRef(snap);
2897
- React14.useEffect(() => {
2671
+ const trackRef = React16.useRef(null);
2672
+ const trackWidth = React16.useRef(0);
2673
+ const trackPageX = React16.useRef(0);
2674
+ const isDragging = React16.useRef(false);
2675
+ const thumbAnim = React16.useRef(new Animated.Value(0)).current;
2676
+ const [layoutWidth, setLayoutWidth] = React16.useState(0);
2677
+ const onValueChangeRef = React16.useRef(onValueChange);
2678
+ const disabledRef = React16.useRef(disabled);
2679
+ const colorsLengthRef = React16.useRef(colors.length);
2680
+ const trimEndsRef = React16.useRef(trimEnds);
2681
+ const snapRef = React16.useRef(snap);
2682
+ React16.useEffect(() => {
2898
2683
  onValueChangeRef.current = onValueChange;
2899
2684
  }, [onValueChange]);
2900
- React14.useEffect(() => {
2685
+ React16.useEffect(() => {
2901
2686
  disabledRef.current = disabled;
2902
2687
  }, [disabled]);
2903
- React14.useEffect(() => {
2688
+ React16.useEffect(() => {
2904
2689
  colorsLengthRef.current = colors.length;
2905
2690
  }, [colors.length]);
2906
- React14.useEffect(() => {
2691
+ React16.useEffect(() => {
2907
2692
  trimEndsRef.current = trimEnds;
2908
2693
  }, [trimEnds]);
2909
- React14.useEffect(() => {
2694
+ React16.useEffect(() => {
2910
2695
  snapRef.current = snap;
2911
2696
  }, [snap]);
2912
- const computeNv = React14.useCallback((pageX) => {
2697
+ const computeNv = React16.useCallback((pageX) => {
2913
2698
  const localX = pageX - trackPageX.current;
2914
2699
  const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
2915
2700
  const totalSteps2 = colorsLengthRef.current - 1;
@@ -2924,7 +2709,7 @@ function ColorScaleSlider({
2924
2709
  }
2925
2710
  return nv;
2926
2711
  }, []);
2927
- const panResponder = React14.useRef(
2712
+ const panResponder = React16.useRef(
2928
2713
  PanResponder.create({
2929
2714
  onStartShouldSetPanResponder: () => !disabledRef.current,
2930
2715
  onMoveShouldSetPanResponder: () => !disabledRef.current,
@@ -2952,7 +2737,7 @@ function ColorScaleSlider({
2952
2737
  const ratio = range > 0 ? (maxNV - clampedValue) / range : 0.5;
2953
2738
  const usableWidth = Math.max(0, layoutWidth - THUMB_SIZE4);
2954
2739
  const thumbLeft = ratio * usableWidth;
2955
- React14.useEffect(() => {
2740
+ React16.useEffect(() => {
2956
2741
  if (isDragging.current || !animateValue) {
2957
2742
  thumbAnim.setValue(thumbLeft);
2958
2743
  } else {
@@ -2963,7 +2748,7 @@ function ColorScaleSlider({
2963
2748
  }).start();
2964
2749
  }
2965
2750
  }, [thumbLeft, animateValue, thumbAnim]);
2966
- return /* @__PURE__ */ React14.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React14.createElement(View, { style: styles.labelRow }, /* @__PURE__ */ React14.createElement(Text, { style: styles.label }, label)), /* @__PURE__ */ React14.createElement(
2751
+ return /* @__PURE__ */ React16.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React16.createElement(View, { style: styles.labelRow }, /* @__PURE__ */ React16.createElement(Text, { style: styles.label }, label)), /* @__PURE__ */ React16.createElement(
2967
2752
  View,
2968
2753
  {
2969
2754
  ref: trackRef,
@@ -2978,17 +2763,18 @@ function ColorScaleSlider({
2978
2763
  },
2979
2764
  ...panResponder.panHandlers
2980
2765
  },
2981
- /* @__PURE__ */ React14.createElement(View, { style: styles.gradientTrack }, visibleColors.map((color, i) => /* @__PURE__ */ React14.createElement(View, { key: i, style: [styles.segment, { backgroundColor: srgbToHex(color.srgb) }] }))),
2982
- /* @__PURE__ */ React14.createElement(Animated.View, { style: [styles.thumb, { left: thumbAnim }] })
2983
- ), warning && /* @__PURE__ */ React14.createElement(Text, { style: styles.warning }, warning));
2766
+ /* @__PURE__ */ React16.createElement(View, { style: styles.gradientTrack }, visibleColors.map((color, i) => /* @__PURE__ */ React16.createElement(View, { key: i, style: [styles.segment, { backgroundColor: gamut === "p3" ? oklchToP3Css(color.oklch) : srgbToHex(color.srgb) }] }))),
2767
+ /* @__PURE__ */ React16.createElement(Animated.View, { style: [styles.thumb, { left: thumbAnim }] })
2768
+ ), warning && /* @__PURE__ */ React16.createElement(Text, { style: styles.warning }, warning));
2984
2769
  }
2985
- function getAppShellStyles(tokens) {
2770
+ function getAppShellStyles(tokens, theme = "primary", appearance = "main") {
2771
+ const at = tokens.colors[theme][appearance];
2986
2772
  return StyleSheet.create({
2987
2773
  container: {
2988
2774
  flex: 1,
2989
2775
  flexDirection: "row",
2990
2776
  overflow: "hidden",
2991
- backgroundColor: srgbToHex(tokens.background.srgb)
2777
+ backgroundColor: at.background
2992
2778
  },
2993
2779
  main: {
2994
2780
  flex: 1,
@@ -3002,17 +2788,22 @@ function getAppShellStyles(tokens) {
3002
2788
  // src/composites/layout/AppShell/AppShell.tsx
3003
2789
  function AppShell({ sidebar, children }) {
3004
2790
  const tokens = useTokens();
3005
- const styles = React14.useMemo(() => getAppShellStyles(tokens), [tokens]);
3006
- return /* @__PURE__ */ React14.createElement(View, { style: styles.container }, sidebar, /* @__PURE__ */ React14.createElement(View, { style: styles.main }, children));
2791
+ const frameCtx = useFrameContext();
2792
+ const styles = React16.useMemo(
2793
+ () => getAppShellStyles(tokens, frameCtx?.theme, frameCtx?.appearance),
2794
+ [tokens, frameCtx?.theme, frameCtx?.appearance]
2795
+ );
2796
+ return /* @__PURE__ */ React16.createElement(View, { style: styles.container }, sidebar, /* @__PURE__ */ React16.createElement(View, { style: styles.main }, children));
3007
2797
  }
3008
- function getSidebarStyles({ tokens, width, bordered }) {
3009
- const borderColor = srgbToHex(tokens.border.srgb);
2798
+ function getSidebarStyles({ tokens, width, bordered, theme = "primary", appearance = "main" }) {
2799
+ const at = tokens.colors[theme][appearance];
2800
+ const borderColor = at.fontSecondary;
3010
2801
  return StyleSheet.create({
3011
2802
  container: {
3012
2803
  width,
3013
2804
  flexShrink: 0,
3014
2805
  flexDirection: "column",
3015
- backgroundColor: srgbToHex(tokens.background.srgb),
2806
+ backgroundColor: at.background,
3016
2807
  borderRightWidth: bordered ? 1 : 0,
3017
2808
  borderRightColor: borderColor
3018
2809
  },
@@ -3041,14 +2832,16 @@ function Sidebar({
3041
2832
  bordered = true
3042
2833
  }) {
3043
2834
  const tokens = useTokens();
3044
- const styles = React14.useMemo(
3045
- () => getSidebarStyles({ tokens, width, bordered }),
3046
- [tokens, width, bordered]
2835
+ const frameCtx = useFrameContext();
2836
+ const styles = React16.useMemo(
2837
+ () => getSidebarStyles({ tokens, width, bordered, theme: frameCtx?.theme, appearance: frameCtx?.appearance }),
2838
+ [tokens, width, bordered, frameCtx?.theme, frameCtx?.appearance]
3047
2839
  );
3048
- return /* @__PURE__ */ React14.createElement(View, { style: styles.container }, header && /* @__PURE__ */ React14.createElement(View, { style: styles.header }, header), /* @__PURE__ */ React14.createElement(ScrollView, { style: styles.body }, children), footer && /* @__PURE__ */ React14.createElement(View, { style: styles.footer }, footer));
2840
+ return /* @__PURE__ */ React16.createElement(View, { style: styles.container }, header && /* @__PURE__ */ React16.createElement(View, { style: styles.header }, header), /* @__PURE__ */ React16.createElement(ScrollView, { style: styles.body }, children), footer && /* @__PURE__ */ React16.createElement(View, { style: styles.footer }, footer));
3049
2841
  }
3050
- function getNavbarStyles({ tokens, height, bordered }) {
3051
- const borderColor = srgbToHex(tokens.border.srgb);
2842
+ function getNavbarStyles({ tokens, height, bordered, theme = "primary", appearance = "main" }) {
2843
+ const at = tokens.colors[theme][appearance];
2844
+ const borderColor = at.fontSecondary;
3052
2845
  return StyleSheet.create({
3053
2846
  container: {
3054
2847
  flexDirection: "row",
@@ -3056,7 +2849,7 @@ function getNavbarStyles({ tokens, height, bordered }) {
3056
2849
  height,
3057
2850
  flexShrink: 0,
3058
2851
  paddingHorizontal: 24,
3059
- backgroundColor: srgbToHex(tokens.background.srgb),
2852
+ backgroundColor: at.background,
3060
2853
  borderBottomWidth: bordered ? 1 : 0,
3061
2854
  borderBottomColor: borderColor
3062
2855
  },
@@ -3083,11 +2876,51 @@ function Navbar({
3083
2876
  bordered = true
3084
2877
  }) {
3085
2878
  const tokens = useTokens();
3086
- const styles = React14.useMemo(
3087
- () => getNavbarStyles({ tokens, height, bordered }),
3088
- [tokens, height, bordered]
2879
+ const frameCtx = useFrameContext();
2880
+ const styles = React16.useMemo(
2881
+ () => getNavbarStyles({ tokens, height, bordered, theme: frameCtx?.theme, appearance: frameCtx?.appearance }),
2882
+ [tokens, height, bordered, frameCtx?.theme, frameCtx?.appearance]
2883
+ );
2884
+ return /* @__PURE__ */ React16.createElement(View, { style: styles.container }, children ? children : /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(View, { style: styles.left }, left), /* @__PURE__ */ React16.createElement(View, { style: styles.right }, right)));
2885
+ }
2886
+ function LogoMonogram({ colorValue = 0, size = 32 }) {
2887
+ const fg = `rgb(${colorValue}, ${colorValue}, ${colorValue})`;
2888
+ return /* @__PURE__ */ React16.createElement(
2889
+ "svg",
2890
+ {
2891
+ width: size,
2892
+ height: size,
2893
+ viewBox: "0 0 168 168",
2894
+ fill: "none",
2895
+ xmlns: "http://www.w3.org/2000/svg"
2896
+ },
2897
+ /* @__PURE__ */ React16.createElement("path", { d: "M39.3574 70H12L20 84H36L30.2681 94.0309C28.8627 96.4903 28.8627 99.5096 30.2681 101.969L36 112L49.7319 87.9691C51.1373 85.5097 51.1373 82.4903 49.7319 80.0309L46.3034 74.0309C44.879 71.5383 42.2283 70 39.3574 70Z", fill: fg }),
2898
+ /* @__PURE__ */ React16.createElement("path", { d: "M84 112H36L41.6966 121.969C43.121 124.462 45.7717 126 48.6426 126H79.3574C82.2283 126 84.879 124.462 86.3034 121.969L93.7319 108.969C95.1373 106.51 95.1373 103.49 93.7319 101.031L84 84L76 98L84 112Z", fill: fg }),
2899
+ /* @__PURE__ */ React16.createElement("path", { d: "M76 70L84 84H64.6426C61.7717 84 59.121 82.4617 57.6966 79.9691L50.268 66.9691C48.8626 64.5097 48.8626 61.4903 50.268 59.0309L65.6966 32.0309C67.121 29.5383 69.7717 28 72.6426 28H84L60 70H76Z", fill: fg }),
2900
+ /* @__PURE__ */ React16.createElement("path", { d: "M95.3574 28H84L132 112L137.732 101.969C139.137 99.5097 139.137 96.4903 137.732 94.0309L102.303 32.0309C100.879 29.5383 98.2283 28 95.3574 28Z", fill: fg }),
2901
+ /* @__PURE__ */ React16.createElement("path", { d: "M104.643 112H132L126.303 121.969C124.879 124.462 122.228 126 119.357 126H108L116 140L108 154L94.268 129.969C92.8626 127.51 92.8626 124.49 94.268 122.031L97.6966 116.031C99.121 113.538 101.772 112 104.643 112Z", fill: fg })
2902
+ );
2903
+ }
2904
+ function LogoWordmark({ fill = "black" }) {
2905
+ return /* @__PURE__ */ React16.createElement(
2906
+ "svg",
2907
+ {
2908
+ height: 32,
2909
+ viewBox: "0 0 504 168",
2910
+ fill: "none",
2911
+ xmlns: "http://www.w3.org/2000/svg"
2912
+ },
2913
+ /* @__PURE__ */ React16.createElement("path", { d: "M8 126H22V42H14.4C12.1598 42 11.0397 42 10.184 42.436C9.43139 42.8195 8.81947 43.4314 8.43597 44.184C8 45.0397 8 46.1598 8 48.4V126Z", fill }),
2914
+ /* @__PURE__ */ React16.createElement("path", { d: "M76 108.5V42H90V119.6C90 121.84 90 122.96 89.564 123.816C89.1805 124.569 88.5686 125.181 87.816 125.564C86.9603 126 85.8402 126 83.6 126H77.4281C74.7227 126 73.37 126 72.1603 125.605C71.0899 125.256 70.1054 124.684 69.271 123.928C68.328 123.074 67.6569 121.9 66.3146 119.551L22 42H30.5719C33.2773 42 34.63 42 35.8397 42.3949C36.9101 42.7442 37.8946 43.3156 38.729 44.0716C39.672 44.926 40.3431 46.1005 41.6854 48.4494L76 108.5Z", fill }),
2915
+ /* @__PURE__ */ React16.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M152.208 68.2077C153.395 69.3951 153.989 69.9888 154.439 70.6738C154.838 71.2814 155.152 71.9406 155.374 72.6332C155.623 73.4139 155.711 74.2489 155.886 75.9189L156.884 85.3951C157.27 89.0678 157.464 90.9042 156.867 92.3245C156.343 93.5721 155.412 94.6057 154.226 95.2577C152.876 96 151.03 96 147.337 96H112V114H154V126H115.302C113.345 126 112.367 126 111.446 125.779C110.63 125.583 109.849 125.26 109.134 124.821C108.326 124.326 107.635 123.635 106.251 122.251L101.749 117.749C100.365 116.365 99.6736 115.674 99.1789 114.866C98.7402 114.151 98.417 113.37 98.221 112.554C98 111.633 98 110.655 98 108.698V75.3019C98 73.3452 98 72.3668 98.221 71.4461C98.417 70.6299 98.7402 69.8495 99.1789 69.1337C99.6736 68.3264 100.365 67.6346 101.749 66.251L106.251 61.749C107.635 60.3654 108.326 59.6736 109.134 59.1789C109.849 58.7402 110.63 58.417 111.446 58.221C112.367 58 113.345 58 115.302 58H136.698C138.655 58 139.633 58 140.554 58.221C141.37 58.417 142.151 58.7402 142.866 59.1789C143.674 59.6736 144.365 60.3654 145.749 61.749L152.208 68.2077ZM112 70V87.5332L144.492 86.4502L141.895 70H112Z", fill }),
2916
+ /* @__PURE__ */ React16.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M492.208 68.2077C493.395 69.3951 493.989 69.9888 494.439 70.6738C494.838 71.2814 495.152 71.9406 495.374 72.6332C495.623 73.4139 495.711 74.2489 495.886 75.9189L496.884 85.3951C497.27 89.0678 497.464 90.9042 496.867 92.3245C496.343 93.5721 495.412 94.6057 494.226 95.2577C492.876 96 491.03 96 487.337 96H452V114H494V126H455.302C453.345 126 452.367 126 451.446 125.779C450.63 125.583 449.849 125.26 449.134 124.821C448.326 124.326 447.635 123.635 446.251 122.251L441.749 117.749C440.365 116.365 439.674 115.674 439.179 114.866C438.74 114.151 438.417 113.37 438.221 112.554C438 111.633 438 110.655 438 108.698V75.3019C438 73.3452 438 72.3668 438.221 71.4461C438.417 70.6299 438.74 69.8495 439.179 69.1337C439.674 68.3264 440.365 67.6346 441.749 66.251L446.251 61.749C447.635 60.3654 448.326 59.6736 449.134 59.1789C449.849 58.7402 450.63 58.417 451.446 58.221C452.367 58 453.345 58 455.302 58H476.698C478.655 58 479.633 58 480.554 58.221C481.37 58.417 482.151 58.7402 482.866 59.1789C483.674 59.6736 484.365 60.3654 485.749 61.749L492.208 68.2077ZM452 70V87.5332L484.492 86.4502L481.895 70H452Z", fill }),
2917
+ /* @__PURE__ */ React16.createElement("path", { d: "M168.794 117.797L160 58H174L184 126H178.291C175.35 126 173.88 126 172.695 125.46C171.651 124.984 170.765 124.219 170.142 123.255C169.435 122.161 169.222 120.706 168.794 117.797Z", fill }),
2918
+ /* @__PURE__ */ React16.createElement("path", { d: "M192.794 66.2033L184 126H187.674C190.626 126 192.102 126 193.29 125.457C194.337 124.979 195.224 124.209 195.846 123.241C196.551 122.141 196.76 120.68 197.177 117.758L204 70L210.823 117.758C211.24 120.68 211.449 122.141 212.154 123.241C212.776 124.209 213.663 124.979 214.71 125.457C215.898 126 217.374 126 220.326 126H224L215.206 66.2033C214.778 63.2936 214.565 61.8387 213.858 60.7448C213.235 59.7808 212.349 59.0155 211.305 58.5398C210.12 58 208.65 58 205.709 58H202.291C199.35 58 197.88 58 196.695 58.5398C195.651 59.0155 194.765 59.7808 194.142 60.7448C193.435 61.8387 193.222 63.2936 192.794 66.2033Z", fill }),
2919
+ /* @__PURE__ */ React16.createElement("path", { d: "M224 126H229.709C232.65 126 234.12 126 235.305 125.46C236.349 124.984 237.235 124.219 237.858 123.255C238.565 122.161 238.778 120.706 239.206 117.797L246.235 70H298V58H251.302C249.345 58 248.367 58 247.446 58.221C246.63 58.417 245.849 58.7402 245.134 59.1789C244.326 59.6736 243.635 60.3654 242.251 61.749L234.927 69.0727C233.815 70.1845 233.26 70.7405 232.829 71.3785C232.447 71.9446 232.139 72.5573 231.913 73.2016C231.658 73.9277 231.543 74.7056 231.315 76.2613L224 126Z", fill }),
2920
+ /* @__PURE__ */ React16.createElement("path", { d: "M264.251 122.251L259.749 117.749C258.365 116.365 257.674 115.674 257.179 114.866C256.74 114.151 256.417 113.37 256.221 112.554C256 111.633 256 110.655 256 108.698V69.2L260 42H270V114H298V126H273.302C271.345 126 270.367 126 269.446 125.779C268.63 125.583 267.849 125.26 267.134 124.821C266.326 124.326 265.635 123.635 264.251 122.251Z", fill }),
2921
+ /* @__PURE__ */ React16.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M358.251 66.251C359.635 67.6346 360.326 68.3264 360.821 69.1337C361.26 69.8495 361.583 70.6299 361.779 71.4461C362 72.3668 362 73.3452 362 75.3019V108.698C362 110.655 362 111.633 361.779 112.554C361.583 113.37 361.26 114.151 360.821 114.866C360.326 115.674 359.635 116.365 358.251 117.749L353.749 122.251C352.365 123.635 351.674 124.326 350.866 124.821C350.151 125.26 349.37 125.583 348.554 125.779C347.633 126 346.655 126 344.698 126H319.302C317.345 126 316.367 126 315.446 125.779C314.63 125.583 313.849 125.26 313.134 124.821C312.326 124.326 311.635 123.635 310.251 122.251L305.749 117.749C304.365 116.365 303.674 115.674 303.179 114.866C302.74 114.151 302.417 113.37 302.221 112.554C302 111.633 302 110.655 302 108.698V75.3019C302 73.3452 302 72.3668 302.221 71.4461C302.417 70.6299 302.74 69.8495 303.179 69.1337C303.674 68.3264 304.365 67.6346 305.749 66.251L310.224 61.7757C311.606 60.3937 312.297 59.7027 313.104 59.2083C313.818 58.77 314.598 58.4468 315.413 58.2506C316.333 58.0292 317.31 58.0284 319.264 58.0267L344.692 58.0046C346.651 58.0029 347.63 58.0021 348.552 58.2228C349.369 58.4185 350.151 58.7417 350.867 59.1807C351.676 59.6757 352.368 60.3684 353.754 61.7536L358.251 66.251ZM316 70V114H348V70H316Z", fill }),
2922
+ /* @__PURE__ */ React16.createElement("path", { d: "M370 64.4V126H384V70H416V126H430V75.3019C430 73.3452 430 72.3668 429.779 71.4461C429.583 70.6299 429.26 69.8495 428.821 69.1337C428.326 68.3264 427.635 67.6346 426.251 66.251L421.749 61.749C420.365 60.3654 419.674 59.6736 418.866 59.1789C418.151 58.7402 417.37 58.417 416.554 58.221C415.633 58 414.655 58 412.698 58H376.4C374.16 58 373.04 58 372.184 58.436C371.431 58.8195 370.819 59.4314 370.436 60.184C370 61.0397 370 62.1598 370 64.4Z", fill })
3089
2923
  );
3090
- return /* @__PURE__ */ React14.createElement(View, { style: styles.container }, children ? children : /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(View, { style: styles.left }, left), /* @__PURE__ */ React14.createElement(View, { style: styles.right }, right)));
3091
2924
  }
3092
2925
 
3093
2926
  // src/registry/registry.ts
@@ -4035,6 +3868,6 @@ var ICON_CATALOG = [
4035
3868
  }
4036
3869
  ];
4037
3870
 
4038
- export { ACCENT_DEFAULTS, AppShell, Button, CATEGORIES, COMPONENTS, Card, ColorScaleSlider, DEFAULT_THEME_CONFIG, ERROR_DEFAULTS, Frame, HueSlider, ICON_CATALOG, Icon, NEUTRAL_DEFAULTS, Navbar, NewtoneProvider, Popover, SUCCESS_DEFAULTS, Select, Sidebar, Slider, Text2 as Text, TextInput, Toggle, WARNING_DEFAULTS, Wrapper, computeTokens, generateComponentCode, getCategory, getComponent, getComponentsByCategory, isOptionGroup, measureAvgCharWidth, useFocusVisible, useFrameContext, useLocalCalibration, useNewtoneTheme, usePopover, useTokens, useTypographyCalibrations };
3871
+ export { AppShell, Button, CATEGORIES, COMPONENTS, Card, Chip, ColorScaleSlider, ContentCard, Divider, Frame, HueSlider, ICON_CATALOG, Icon, LogoMonogram, LogoWordmark, Navbar, Popover, Select, Sidebar, Slider, Text3 as Text, TextInput, Toggle, Wrapper, generateComponentCode, getCategory, getComponent, getComponentsByCategory, isOptionGroup, useFocusVisible, usePopover };
4039
3872
  //# sourceMappingURL=index.js.map
4040
3873
  //# sourceMappingURL=index.js.map