@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.cjs CHANGED
@@ -1,787 +1,549 @@
1
1
  'use strict';
2
2
 
3
- var React14 = require('react');
4
- var newtone = require('newtone');
5
- var fonts = require('@newtonedev/fonts');
3
+ var newtoneApi = require('newtone-api');
4
+ var React16 = require('react');
6
5
  var reactNative = require('react-native');
6
+ var fonts = require('@newtonedev/fonts');
7
+ var newtone = require('newtone');
7
8
 
8
9
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
10
 
10
- var React14__default = /*#__PURE__*/_interopDefault(React14);
11
-
12
- // src/theme/NewtoneProvider.tsx
13
- var DEFAULT_THEME_CONFIG = {
14
- colorSystem: {
15
- dynamicRange: {
16
- lightest: 1,
17
- darkest: 1
18
- },
19
- palettes: [
20
- { hue: newtone.DEFAULT_NEUTRAL_HUE, saturation: newtone.DEFAULT_NEUTRAL_SATURATION },
21
- { hue: newtone.DEFAULT_ACCENT_HUE, saturation: newtone.DEFAULT_ACCENT_SATURATION },
22
- { hue: newtone.DEFAULT_SUCCESS_HUE, saturation: newtone.DEFAULT_SUCCESS_SATURATION },
23
- { hue: newtone.DEFAULT_WARNING_HUE, saturation: newtone.DEFAULT_WARNING_SATURATION },
24
- { hue: newtone.DEFAULT_ERROR_HUE, saturation: newtone.DEFAULT_ERROR_SATURATION }
25
- ]
26
- },
27
- spacing: {
28
- "00": 0,
29
- // base * 0
30
- "02": 2,
31
- // base * 0.25
32
- "04": 4,
33
- // base * 0.5
34
- "06": 6,
35
- // base * 0.75
36
- "08": 8,
37
- // base * 1 (Medium preset, 8px base)
38
- "10": 10,
39
- // base * 1.25
40
- "12": 12,
41
- // base * 1.5
42
- "16": 16,
43
- // base * 2
44
- "20": 20,
45
- // base * 2.5
46
- "24": 24,
47
- // base * 3
48
- "32": 32,
49
- // base * 4
50
- "40": 40,
51
- // base * 5
52
- "48": 48
53
- // base * 6
54
- },
55
- radius: {
56
- none: 0,
57
- sm: 4,
58
- md: 6,
59
- lg: 8,
60
- xl: 12,
61
- pill: 999
62
- },
63
- typography: {
64
- fonts: fonts.DEFAULT_FONT_SLOTS,
65
- fontSizes: fonts.DEFAULT_FONT_SIZES,
66
- lineHeights: fonts.DEFAULT_LINE_HEIGHTS,
67
- roles: fonts.DEFAULT_ROLE_SCALES
68
- },
69
- icons: {
70
- variant: "rounded",
71
- // Material Design 3 aesthetic
72
- weight: 400,
73
- // Normal weight
74
- autoGrade: true
75
- // Enable mode-aware grade
76
- }
77
- };
11
+ var React16__default = /*#__PURE__*/_interopDefault(React16);
78
12
 
79
- // src/fonts/GoogleFontLoader.tsx
80
- function GoogleFontLoader({ fonts: fonts$1 }) {
81
- const linkRef = React14.useRef(null);
82
- React14.useEffect(() => {
83
- if (typeof document === "undefined") return;
84
- const url = fonts.buildGoogleFontsUrl(fonts$1);
85
- if (linkRef.current) {
86
- linkRef.current.remove();
87
- linkRef.current = null;
88
- }
89
- if (!url) return;
90
- const links = Array.from(document.head.querySelectorAll('link[rel="stylesheet"]'));
91
- if (links.some((el) => el.href === url)) return;
92
- const link = document.createElement("link");
93
- link.rel = "stylesheet";
94
- link.href = url;
95
- document.head.appendChild(link);
96
- linkRef.current = link;
97
- return () => {
98
- if (linkRef.current) {
99
- linkRef.current.remove();
100
- linkRef.current = null;
101
- }
102
- };
103
- }, [
104
- fonts$1.main.config.family,
105
- fonts$1.main.config.type,
106
- fonts$1.main.weights.regular,
107
- fonts$1.main.weights.medium,
108
- fonts$1.main.weights.bold,
109
- fonts$1.display.config.family,
110
- fonts$1.display.config.type,
111
- fonts$1.display.weights.regular,
112
- fonts$1.display.weights.medium,
113
- fonts$1.display.weights.bold,
114
- fonts$1.mono.config.family,
115
- fonts$1.mono.config.type,
116
- fonts$1.mono.weights.regular,
117
- fonts$1.mono.weights.medium,
118
- fonts$1.mono.weights.bold,
119
- fonts$1.currency.config.family,
120
- fonts$1.currency.config.type,
121
- fonts$1.currency.weights.regular,
122
- fonts$1.currency.weights.medium,
123
- fonts$1.currency.weights.bold
13
+ // src/index.ts
14
+ var hadKeyboardEvent = false;
15
+ var isListenerSetup = false;
16
+ function setupModality() {
17
+ if (isListenerSetup || typeof document === "undefined") return;
18
+ isListenerSetup = true;
19
+ const NAVIGATION_KEYS = /* @__PURE__ */ new Set([
20
+ "Tab",
21
+ "ArrowUp",
22
+ "ArrowDown",
23
+ "ArrowLeft",
24
+ "ArrowRight",
25
+ "Enter",
26
+ " ",
27
+ "Escape"
124
28
  ]);
125
- return null;
126
- }
127
- function SelfHostedFontLoader({ fontFaceCss }) {
128
- const styleRef = React14.useRef(null);
129
- React14.useEffect(() => {
130
- if (typeof document === "undefined") return;
131
- if (styleRef.current) {
132
- styleRef.current.remove();
133
- styleRef.current = null;
29
+ document.addEventListener("keydown", (e) => {
30
+ if (NAVIGATION_KEYS.has(e.key)) {
31
+ hadKeyboardEvent = true;
134
32
  }
135
- if (!fontFaceCss) return;
136
- const style = document.createElement("style");
137
- style.setAttribute("data-newtone-fonts", "self-hosted");
138
- style.textContent = fontFaceCss;
139
- document.head.appendChild(style);
140
- styleRef.current = style;
141
- return () => {
142
- if (styleRef.current) {
143
- styleRef.current.remove();
144
- styleRef.current = null;
145
- }
146
- };
147
- }, [fontFaceCss]);
148
- return null;
33
+ }, true);
34
+ document.addEventListener("pointerdown", () => {
35
+ hadKeyboardEvent = false;
36
+ }, true);
37
+ document.addEventListener("mousedown", () => {
38
+ hadKeyboardEvent = false;
39
+ }, true);
149
40
  }
150
- function IconFontLoader({ icons }) {
151
- const linkRef = React14.useRef(null);
152
- React14.useEffect(() => {
153
- if (typeof document === "undefined") return;
154
- const variantName = icons.variant.charAt(0).toUpperCase() + icons.variant.slice(1);
155
- const family = `Material+Symbols+${variantName}`;
156
- const url = `https://fonts.googleapis.com/css2?family=${family}:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=block`;
157
- if (linkRef.current) {
158
- linkRef.current.remove();
159
- linkRef.current = null;
41
+ function useFocusVisible() {
42
+ const [isFocusVisible, setIsFocusVisible] = React16.useState(false);
43
+ React16.useEffect(() => {
44
+ setupModality();
45
+ }, []);
46
+ const onFocus = React16.useCallback(() => {
47
+ if (hadKeyboardEvent) {
48
+ setIsFocusVisible(true);
160
49
  }
161
- const links = Array.from(document.head.querySelectorAll('link[rel="stylesheet"]'));
162
- if (links.some((el) => el.href === url)) return;
163
- const link = document.createElement("link");
164
- link.rel = "stylesheet";
165
- link.href = url;
166
- document.head.appendChild(link);
167
- linkRef.current = link;
168
- return () => {
169
- if (linkRef.current) {
170
- linkRef.current.remove();
171
- linkRef.current = null;
172
- }
173
- };
174
- }, [icons.variant]);
175
- return null;
50
+ }, []);
51
+ const onBlur = React16.useCallback(() => {
52
+ setIsFocusVisible(false);
53
+ }, []);
54
+ const focusProps = { onFocus, onBlur };
55
+ return { isFocusVisible, focusProps };
176
56
  }
177
57
 
178
- // src/theme/NewtoneProvider.tsx
179
- var ThemeContext = React14.createContext(null);
180
- function NewtoneProvider({
181
- config = DEFAULT_THEME_CONFIG,
182
- initialMode = "light",
183
- children,
184
- reportingEndpoint,
185
- fontFaceCss
186
- }) {
187
- const [mode, setMode] = React14.useState(initialMode);
188
- const value = React14.useMemo(
189
- () => ({
190
- config,
191
- mode,
192
- setMode,
193
- reportingEndpoint
194
- }),
195
- [config, mode, reportingEndpoint]
196
- );
197
- return /* @__PURE__ */ React14__default.default.createElement(ThemeContext.Provider, { value }, fontFaceCss ? /* @__PURE__ */ React14__default.default.createElement(SelfHostedFontLoader, { fontFaceCss }) : /* @__PURE__ */ React14__default.default.createElement(GoogleFontLoader, { fonts: config.typography.fonts }), /* @__PURE__ */ React14__default.default.createElement(IconFontLoader, { icons: config.icons }), children);
198
- }
199
- function useNewtoneTheme() {
200
- const context = React14.useContext(ThemeContext);
201
- if (!context) {
202
- throw new Error("useNewtoneTheme must be used within NewtoneProvider");
203
- }
204
- return context;
205
- }
206
- var FrameContext = React14.createContext(null);
207
- function useFrameContext() {
208
- return React14.useContext(FrameContext);
58
+ // src/primitives/Frame/Frame.utils.ts
59
+ function resolveSpacing(value, tokens) {
60
+ if (typeof value === "number") return value;
61
+ return tokens.spacing[value];
209
62
  }
210
- var NEUTRAL_DEFAULTS = {
211
- light: {
212
- background: { elevated: 0, ground: 0.03, sunken: 0.06 },
213
- text: { primary: 0.9, secondary: 0.7, tertiary: 0.5, disabled: 0.3 },
214
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
215
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
216
- },
217
- dark: {
218
- background: { elevated: 0.24, ground: 0.2, sunken: 0.16 },
219
- text: { primary: 1, secondary: 0.85, tertiary: 0.7, disabled: 0.55 },
220
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
221
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
222
- }
223
- };
224
- var ACCENT_DEFAULTS = {
225
- light: {
226
- background: { elevated: 0, ground: 0.03, sunken: 0.06 },
227
- text: { primary: 0.9, secondary: 0.7, tertiary: 0.5, disabled: 0.3 },
228
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
229
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
230
- },
231
- dark: {
232
- background: { elevated: 0.24, ground: 0.2, sunken: 0.16 },
233
- text: { primary: 1, secondary: 0.85, tertiary: 0.7, disabled: 0.55 },
234
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
235
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
236
- }
237
- };
238
- var SUCCESS_DEFAULTS = {
239
- light: {
240
- background: { elevated: 0, ground: 0.03, sunken: 0.06 },
241
- text: { primary: 0.9, secondary: 0.7, tertiary: 0.5, disabled: 0.3 },
242
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
243
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
244
- },
245
- dark: {
246
- background: { elevated: 0.24, ground: 0.2, sunken: 0.16 },
247
- text: { primary: 1, secondary: 0.85, tertiary: 0.7, disabled: 0.55 },
248
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
249
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
250
- }
251
- };
252
- var WARNING_DEFAULTS = {
253
- light: {
254
- background: { elevated: 0, ground: 0.03, sunken: 0.06 },
255
- text: { primary: 0.9, secondary: 0.7, tertiary: 0.5, disabled: 0.3 },
256
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
257
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
258
- },
259
- dark: {
260
- background: { elevated: 0.24, ground: 0.2, sunken: 0.16 },
261
- text: { primary: 1, secondary: 0.85, tertiary: 0.7, disabled: 0.55 },
262
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
263
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
63
+ function resolvePadding(prop, tokens) {
64
+ if (typeof prop === "string" || typeof prop === "number") {
65
+ const px = resolveSpacing(prop, tokens);
66
+ return { top: px, right: px, bottom: px, left: px };
264
67
  }
265
- };
266
- var ERROR_DEFAULTS = {
267
- light: {
268
- background: { elevated: 0, ground: 0.03, sunken: 0.06 },
269
- text: { primary: 0.9, secondary: 0.7, tertiary: 0.5, disabled: 0.3 },
270
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
271
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
272
- },
273
- dark: {
274
- background: { elevated: 0.24, ground: 0.2, sunken: 0.16 },
275
- text: { primary: 1, secondary: 0.85, tertiary: 0.7, disabled: 0.55 },
276
- action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
277
- border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
68
+ if ("x" in prop || "y" in prop) {
69
+ const axes = prop;
70
+ const x = axes.x !== void 0 ? resolveSpacing(axes.x, tokens) : 0;
71
+ const y = axes.y !== void 0 ? resolveSpacing(axes.y, tokens) : 0;
72
+ return { top: y, right: x, bottom: y, left: x };
278
73
  }
279
- };
280
- var clamp = (n) => Math.max(0, Math.min(1, n));
281
- function computePaletteTokens(palette, defaults, mode, elevation, dynamicRange, elevationDelta, effectiveTextMode, autoAccentNv, neutralTextPrimary, neutralBgElevated) {
282
- const modeDefaults = defaults[mode];
283
- const toEngineNv = (nv) => mode === "light" ? 1 - nv : nv;
284
- const textToEngineNv = (nv) => effectiveTextMode === "light" ? 1 - nv : nv;
285
- const colorAt = (engineNv) => newtone.getColor(
286
- palette.hue,
287
- palette.saturation,
288
- dynamicRange,
289
- clamp(engineNv),
290
- palette.desaturation,
291
- palette.paletteHueGrading
292
- );
293
- const resolveKeyNv = (p) => mode === "dark" ? p.keyNormalizedValueDark : p.keyNormalizedValue;
294
- const keyNv = resolveKeyNv(palette);
295
- const fillBaseNv = keyNv ?? autoAccentNv;
296
- const fillNv = clamp(fillBaseNv + elevationDelta);
297
- const fill = colorAt(fillNv);
298
- const hoverDir = effectiveTextMode === "light" ? -modeDefaults.action.hovered : modeDefaults.action.hovered;
299
- const activeDir = effectiveTextMode === "light" ? -modeDefaults.action.pressed : modeDefaults.action.pressed;
300
- const fillHover = colorAt(clamp(fillNv + hoverDir));
301
- const fillActive = colorAt(clamp(fillNv + activeDir));
302
- const onFill = fill.oklch.L > 0.6 ? neutralTextPrimary : neutralBgElevated;
303
- const bgNormalized = elevation === 2 ? modeDefaults.background.elevated : elevation === 1 ? modeDefaults.background.ground : modeDefaults.background.sunken;
304
- const bgNv = clamp(toEngineNv(bgNormalized));
305
- const background = colorAt(bgNv);
306
- const backgroundElevated = colorAt(clamp(toEngineNv(modeDefaults.background.elevated)));
307
- const backgroundSunken = colorAt(clamp(toEngineNv(modeDefaults.background.sunken)));
308
- const interactiveOffset = modeDefaults.action.enabled;
309
- const interactiveNv = clamp(bgNv + (effectiveTextMode === "light" ? -interactiveOffset : interactiveOffset));
310
- const backgroundInteractive = colorAt(interactiveNv);
311
- const hoverShift = modeDefaults.action.hovered;
312
- const activeShift = modeDefaults.action.pressed;
313
- const backgroundInteractiveHover = colorAt(clamp(interactiveNv + (effectiveTextMode === "light" ? -hoverShift : hoverShift)));
314
- const backgroundInteractiveActive = colorAt(clamp(interactiveNv + (effectiveTextMode === "light" ? -activeShift : activeShift)));
315
- const textPrimary = colorAt(clamp(textToEngineNv(modeDefaults.text.primary) + elevationDelta));
316
- const textSecondary = colorAt(clamp(textToEngineNv(modeDefaults.text.secondary) + elevationDelta));
317
- const textTertiary = colorAt(clamp(textToEngineNv(modeDefaults.text.tertiary) + elevationDelta));
318
- const textDisabled = colorAt(clamp(textToEngineNv(modeDefaults.text.disabled) + elevationDelta));
319
- const borderOffset = modeDefaults.border.enabled;
320
- const borderNv = effectiveTextMode === "light" ? bgNv - borderOffset : bgNv + borderOffset;
321
- const border = colorAt(clamp(borderNv));
74
+ const sides = prop;
322
75
  return {
323
- fill,
324
- fillHover,
325
- fillActive,
326
- onFill,
327
- background,
328
- backgroundElevated,
329
- backgroundSunken,
330
- backgroundInteractive,
331
- backgroundInteractiveHover,
332
- backgroundInteractiveActive,
333
- textPrimary,
334
- textSecondary,
335
- textTertiary,
336
- textDisabled,
337
- border
76
+ top: sides.top !== void 0 ? resolveSpacing(sides.top, tokens) : 0,
77
+ right: sides.right !== void 0 ? resolveSpacing(sides.right, tokens) : 0,
78
+ bottom: sides.bottom !== void 0 ? resolveSpacing(sides.bottom, tokens) : 0,
79
+ left: sides.left !== void 0 ? resolveSpacing(sides.left, tokens) : 0
338
80
  };
339
81
  }
340
- function computeTokens(config, mode, elevation, spacing, radius, typography, icons, tokenOverrides) {
341
- const { dynamicRange, palettes } = config;
342
- const palette = palettes[0];
343
- if (!palette) {
344
- throw new Error("Neutral palette (index 0) not found");
345
- }
346
- const neutralDefaults = NEUTRAL_DEFAULTS[mode];
347
- const toEngineNv = (nv) => mode === "light" ? 1 - nv : nv;
348
- const bgElevatedNorm = mode === "light" ? tokenOverrides?.backgroundElevated : tokenOverrides?.backgroundElevatedDark;
349
- const bgDefaultNorm = mode === "light" ? tokenOverrides?.backgroundDefault : tokenOverrides?.backgroundDefaultDark;
350
- const bgSunkenNorm = mode === "light" ? tokenOverrides?.backgroundSunken : tokenOverrides?.backgroundSunkenDark;
351
- const textPrimaryNorm = mode === "light" ? tokenOverrides?.textPrimaryNormalized : tokenOverrides?.textPrimaryNormalizedDark;
352
- const textSecondaryNorm = mode === "light" ? tokenOverrides?.textSecondaryNormalized : tokenOverrides?.textSecondaryNormalizedDark;
353
- const textTertiaryNorm = mode === "light" ? tokenOverrides?.textTertiaryNormalized : tokenOverrides?.textTertiaryNormalizedDark;
354
- const textDisabledNorm = mode === "light" ? tokenOverrides?.textDisabledNormalized : tokenOverrides?.textDisabledNormalizedDark;
355
- const bgNormalized = elevation === 2 ? bgElevatedNorm ?? neutralDefaults.background.elevated : elevation === 1 ? bgDefaultNorm ?? neutralDefaults.background.ground : bgSunkenNorm ?? neutralDefaults.background.sunken;
356
- const backgroundNv = clamp(toEngineNv(bgNormalized));
357
- const elevatedNv = clamp(toEngineNv(bgElevatedNorm ?? neutralDefaults.background.elevated));
358
- const sunkenNv = clamp(toEngineNv(bgSunkenNorm ?? neutralDefaults.background.sunken));
359
- const elevationDelta = backgroundNv - elevatedNv;
360
- const effectiveTextMode = backgroundNv >= 0.5 ? "light" : "dark";
361
- const background = newtone.getColor(
362
- palette.hue,
363
- palette.saturation,
364
- dynamicRange,
365
- backgroundNv,
366
- palette.desaturation,
367
- palette.paletteHueGrading
368
- );
369
- const backgroundElevated = newtone.getColor(
370
- palette.hue,
371
- palette.saturation,
372
- dynamicRange,
373
- elevatedNv,
374
- palette.desaturation,
375
- palette.paletteHueGrading
376
- );
377
- const backgroundSunken = newtone.getColor(
378
- palette.hue,
379
- palette.saturation,
380
- dynamicRange,
381
- sunkenNv,
382
- palette.desaturation,
383
- palette.paletteHueGrading
384
- );
385
- const INTERACTIVE_COMPONENT_OFFSET = mode === "light" ? tokenOverrides?.interactiveComponentOffset ?? neutralDefaults.action.enabled : tokenOverrides?.interactiveComponentOffsetDark ?? neutralDefaults.action.enabled;
386
- const HOVER_SHIFT = mode === "light" ? tokenOverrides?.hoverShift ?? neutralDefaults.action.hovered : tokenOverrides?.hoverShiftDark ?? neutralDefaults.action.hovered;
387
- const ACTIVE_SHIFT = mode === "light" ? tokenOverrides?.activeShift ?? neutralDefaults.action.pressed : tokenOverrides?.activeShiftDark ?? neutralDefaults.action.pressed;
388
- const BORDER_OFFSET = mode === "light" ? tokenOverrides?.borderOffset ?? neutralDefaults.border.enabled : tokenOverrides?.borderOffsetDark ?? neutralDefaults.border.enabled;
389
- const interactiveComponentNv = clamp(backgroundNv + (effectiveTextMode === "light" ? -INTERACTIVE_COMPONENT_OFFSET : INTERACTIVE_COMPONENT_OFFSET));
390
- const backgroundInteractive = newtone.getColor(
391
- palette.hue,
392
- palette.saturation,
393
- dynamicRange,
394
- interactiveComponentNv,
395
- palette.desaturation,
396
- palette.paletteHueGrading
397
- );
398
- const neutralHoverNv = clamp(interactiveComponentNv + (effectiveTextMode === "light" ? -HOVER_SHIFT : HOVER_SHIFT));
399
- const backgroundInteractiveHover = newtone.getColor(
400
- palette.hue,
401
- palette.saturation,
402
- dynamicRange,
403
- neutralHoverNv,
404
- palette.desaturation,
405
- palette.paletteHueGrading
406
- );
407
- const neutralActiveNv = clamp(interactiveComponentNv + (effectiveTextMode === "light" ? -ACTIVE_SHIFT : ACTIVE_SHIFT));
408
- const backgroundInteractiveActive = newtone.getColor(
409
- palette.hue,
410
- palette.saturation,
411
- dynamicRange,
412
- neutralActiveNv,
413
- palette.desaturation,
414
- palette.paletteHueGrading
415
- );
416
- const textToEngineNv = (nv) => effectiveTextMode === "light" ? 1 - nv : nv;
417
- const textPrimary = newtone.getColor(
418
- palette.hue,
419
- palette.saturation,
420
- dynamicRange,
421
- clamp(textToEngineNv(textPrimaryNorm ?? neutralDefaults.text.primary) + elevationDelta),
422
- palette.desaturation,
423
- palette.paletteHueGrading
424
- );
425
- const textSecondary = newtone.getColor(
426
- palette.hue,
427
- palette.saturation,
428
- dynamicRange,
429
- clamp(textToEngineNv(textSecondaryNorm ?? neutralDefaults.text.secondary) + elevationDelta),
430
- palette.desaturation,
431
- palette.paletteHueGrading
432
- );
433
- const textTertiary = newtone.getColor(
434
- palette.hue,
435
- palette.saturation,
436
- dynamicRange,
437
- clamp(textToEngineNv(textTertiaryNorm ?? neutralDefaults.text.tertiary) + elevationDelta),
438
- palette.desaturation,
439
- palette.paletteHueGrading
440
- );
441
- const textDisabled = newtone.getColor(
442
- palette.hue,
443
- palette.saturation,
444
- dynamicRange,
445
- clamp(textToEngineNv(textDisabledNorm ?? neutralDefaults.text.disabled) + elevationDelta),
446
- palette.desaturation,
447
- palette.paletteHueGrading
448
- );
449
- const borderNv = effectiveTextMode === "light" ? backgroundNv - BORDER_OFFSET : backgroundNv + BORDER_OFFSET;
450
- const border = newtone.getColor(
451
- palette.hue,
452
- palette.saturation,
453
- dynamicRange,
454
- clamp(borderNv),
455
- palette.desaturation,
456
- palette.paletteHueGrading
457
- );
458
- const autoAccentNv = clamp(textToEngineNv(textPrimaryNorm ?? neutralDefaults.text.primary));
459
- const accentPalette = palettes[1];
460
- if (!accentPalette) {
461
- throw new Error("Accent palette (index 1) not found");
82
+ function resolveGap(prop, tokens) {
83
+ if (typeof prop === "string" || typeof prop === "number") {
84
+ const px = resolveSpacing(prop, tokens);
85
+ return { rowGap: px, columnGap: px };
462
86
  }
463
- const accent = computePaletteTokens(
464
- accentPalette,
465
- ACCENT_DEFAULTS,
466
- mode,
467
- elevation,
468
- dynamicRange,
469
- elevationDelta,
470
- effectiveTextMode,
471
- autoAccentNv,
472
- textPrimary,
473
- backgroundElevated
474
- );
475
- const successPalette = palettes[2];
476
- const warningPalette = palettes[3];
477
- const errorPalette = palettes[4];
478
- const success = successPalette ? computePaletteTokens(
479
- successPalette,
480
- SUCCESS_DEFAULTS,
481
- mode,
482
- elevation,
483
- dynamicRange,
484
- elevationDelta,
485
- effectiveTextMode,
486
- autoAccentNv,
487
- textPrimary,
488
- backgroundElevated
489
- ) : accent;
490
- const warning = warningPalette ? computePaletteTokens(
491
- warningPalette,
492
- WARNING_DEFAULTS,
493
- mode,
494
- elevation,
495
- dynamicRange,
496
- elevationDelta,
497
- effectiveTextMode,
498
- autoAccentNv,
499
- textPrimary,
500
- backgroundElevated
501
- ) : accent;
502
- const error = errorPalette ? computePaletteTokens(
503
- errorPalette,
504
- ERROR_DEFAULTS,
505
- mode,
506
- elevation,
507
- dynamicRange,
508
- elevationDelta,
509
- effectiveTextMode,
510
- autoAccentNv,
511
- textPrimary,
512
- backgroundElevated
513
- ) : accent;
514
87
  return {
515
- background,
516
- backgroundElevated,
517
- backgroundSunken,
518
- backgroundInteractive,
519
- backgroundInteractiveHover,
520
- backgroundInteractiveActive,
521
- textPrimary,
522
- textSecondary,
523
- textTertiary,
524
- textDisabled,
525
- border,
526
- accent,
527
- success,
528
- warning,
529
- error,
530
- spacing,
531
- radius,
532
- typography: {
533
- fonts: {
534
- main: {
535
- family: fonts.fontConfigToFamily(typography.fonts.main.config),
536
- weights: typography.fonts.main.weights
537
- },
538
- display: {
539
- family: fonts.fontConfigToFamily(typography.fonts.display.config),
540
- weights: typography.fonts.display.weights
541
- },
542
- mono: {
543
- family: fonts.fontConfigToFamily(typography.fonts.mono.config),
544
- weights: typography.fonts.mono.weights
545
- },
546
- currency: {
547
- family: fonts.fontConfigToFamily(typography.fonts.currency.config),
548
- weights: typography.fonts.currency.weights
549
- }
550
- },
551
- fontSizes: typography.fontSizes,
552
- lineHeights: typography.lineHeights
553
- },
554
- icons: {
555
- variant: icons.variant,
556
- weight: icons.weight,
557
- grade: icons.autoGrade ? mode === "light" ? -25 : 200 : 0
558
- }
88
+ rowGap: prop.row !== void 0 ? resolveSpacing(prop.row, tokens) : 0,
89
+ columnGap: prop.column !== void 0 ? resolveSpacing(prop.column, tokens) : 0
559
90
  };
560
91
  }
561
-
562
- // src/tokens/useTokens.ts
563
- function useTokens(elevation) {
564
- const { config, mode } = useNewtoneTheme();
565
- const frameCtx = useFrameContext();
566
- const resolvedElevation = elevation ?? frameCtx?.elevation ?? 1;
567
- const canReuse = frameCtx !== null && elevation === void 0 && frameCtx.elevation === resolvedElevation;
568
- return React14.useMemo(() => {
569
- if (canReuse) {
570
- return { ...frameCtx.tokens, elevation: resolvedElevation };
571
- }
572
- const tokens = computeTokens(
573
- config.colorSystem,
574
- mode,
575
- resolvedElevation,
576
- config.spacing,
577
- config.radius,
578
- config.typography,
579
- config.icons,
580
- config.tokenOverrides
581
- );
582
- return { ...tokens, elevation: resolvedElevation };
583
- }, [config, mode, resolvedElevation, canReuse, frameCtx?.tokens]);
92
+ function resolveRadius(value, tokens) {
93
+ if (typeof value === "number") return value;
94
+ return tokens.radius[value];
584
95
  }
585
- function computeButtonPadding(size, hasIcon, hasText, iconPosition) {
586
- const basePadding = {
587
- sm: 8,
588
- md: 12,
589
- lg: 16
590
- };
591
- const base = basePadding[size];
592
- const textExtra = 8;
593
- if (!hasText && hasIcon) {
594
- return {
595
- paddingLeft: base,
596
- paddingRight: base,
597
- paddingTop: base,
598
- paddingBottom: base
599
- };
600
- }
601
- if (hasText && !hasIcon) {
602
- return {
603
- paddingLeft: base + textExtra,
604
- paddingRight: base + textExtra,
605
- paddingTop: base,
606
- paddingBottom: base
607
- };
608
- }
609
- if (hasText && hasIcon) {
610
- if (iconPosition === "left") {
611
- return {
612
- paddingLeft: base,
613
- paddingRight: base + textExtra,
614
- paddingTop: base,
615
- paddingBottom: base
616
- };
617
- } else {
618
- return {
619
- paddingLeft: base + textExtra,
620
- paddingRight: base,
621
- paddingTop: base,
622
- paddingBottom: base
623
- };
624
- }
96
+ function resolveRadiusCorners(prop, tokens) {
97
+ if (typeof prop === "string" || typeof prop === "number") {
98
+ const px = resolveRadius(prop, tokens);
99
+ return { topLeft: px, topRight: px, bottomLeft: px, bottomRight: px };
625
100
  }
626
101
  return {
627
- paddingLeft: base,
628
- paddingRight: base,
629
- paddingTop: base,
630
- paddingBottom: base
102
+ topLeft: prop.topLeft !== void 0 ? resolveRadius(prop.topLeft, tokens) : 0,
103
+ topRight: prop.topRight !== void 0 ? resolveRadius(prop.topRight, tokens) : 0,
104
+ bottomLeft: prop.bottomLeft !== void 0 ? resolveRadius(prop.bottomLeft, tokens) : 0,
105
+ bottomRight: prop.bottomRight !== void 0 ? resolveRadius(prop.bottomRight, tokens) : 0
631
106
  };
632
107
  }
633
- function getPaletteTokens(semantic, tokens) {
634
- switch (semantic) {
635
- case "accent":
636
- return tokens.accent;
637
- case "success":
638
- return tokens.success;
639
- case "error":
640
- return tokens.error;
641
- case "warning":
642
- return tokens.warning;
643
- default:
644
- return void 0;
645
- }
108
+ function hasPositiveRadius(corners) {
109
+ return corners.topLeft > 0 || corners.topRight > 0 || corners.bottomLeft > 0 || corners.bottomRight > 0;
646
110
  }
647
- function getButtonConfig(variant, semantic, size, disabled, tokens) {
648
- const sizeConfig = getSizeConfig(size, tokens);
649
- const variantColors = getVariantColors(variant, semantic, disabled, tokens);
650
- return {
651
- variantColors,
652
- sizeTokens: {
653
- padding: sizeConfig.padding,
654
- gap: sizeConfig.gap,
655
- borderRadius: sizeConfig.borderRadius,
656
- textSize: sizeConfig.textSize,
657
- iconSize: sizeConfig.iconSize
111
+ function resolveSizing(width, height) {
112
+ const style = {};
113
+ if (width !== void 0) {
114
+ if (width === "fill") {
115
+ style.flexGrow = 1;
116
+ style.width = "100%";
117
+ } else if (typeof width === "number") {
118
+ style.width = width;
658
119
  }
659
- };
660
- }
661
- function getSizeConfig(size, tokens) {
662
- const configs = {
663
- sm: {
664
- padding: 8,
665
- gap: tokens.spacing["08"],
666
- borderRadius: 8,
667
- textSize: "md",
668
- // 16px
669
- iconSize: 24
670
- },
671
- md: {
672
- padding: 12,
673
- gap: tokens.spacing["08"],
674
- borderRadius: 12,
675
- textSize: "md",
676
- // 16px
677
- iconSize: 24
678
- },
679
- lg: {
680
- padding: 16,
681
- gap: tokens.spacing["08"],
682
- borderRadius: 16,
683
- textSize: "md",
684
- // 16px
685
- iconSize: 24
120
+ }
121
+ if (height !== void 0) {
122
+ if (height === "fill") {
123
+ style.flexGrow = 1;
124
+ style.height = "100%";
125
+ } else if (typeof height === "number") {
126
+ style.height = height;
686
127
  }
687
- };
688
- return configs[size];
128
+ }
129
+ return style;
689
130
  }
690
- function getVariantColors(variant, semantic, disabled, tokens) {
691
- if (disabled) {
692
- const baseColors = getVariantColorsForState(variant, semantic, tokens);
693
- const disabledBg = newtone.srgbToHex(tokens.backgroundSunken.srgb);
694
- return {
695
- ...baseColors,
696
- bg: disabledBg,
697
- hoveredBg: disabledBg,
698
- pressedBg: disabledBg,
699
- textColor: newtone.srgbToHex(tokens.textSecondary.srgb),
700
- iconColor: newtone.srgbToHex(tokens.textSecondary.srgb)
701
- };
131
+ var ALIGN_MAP = {
132
+ start: "flex-start",
133
+ center: "center",
134
+ end: "flex-end",
135
+ stretch: "stretch",
136
+ baseline: "baseline"
137
+ };
138
+ var JUSTIFY_MAP = {
139
+ start: "flex-start",
140
+ center: "center",
141
+ end: "flex-end",
142
+ between: "space-between",
143
+ around: "space-around",
144
+ evenly: "space-evenly"
145
+ };
146
+ function resolveAlignment(align) {
147
+ return ALIGN_MAP[align];
148
+ }
149
+ function resolveJustification(justify) {
150
+ return JUSTIFY_MAP[justify];
151
+ }
152
+ function resolveFlexDirection(direction, reverse) {
153
+ if (direction === "horizontal") {
154
+ return reverse ? "row-reverse" : "row";
702
155
  }
703
- return getVariantColorsForState(variant, semantic, tokens);
156
+ return reverse ? "column-reverse" : "column";
704
157
  }
705
- function getVariantColorsForState(variant, semantic, tokens) {
706
- const paletteTokens = getPaletteTokens(semantic, tokens);
707
- if (variant === "primary") {
708
- if (semantic === "neutral") {
709
- return {
710
- bg: newtone.srgbToHex(tokens.backgroundInteractive.srgb),
711
- hoveredBg: newtone.srgbToHex(tokens.backgroundInteractiveHover.srgb),
712
- pressedBg: newtone.srgbToHex(tokens.backgroundInteractiveActive.srgb),
713
- textColor: newtone.srgbToHex(tokens.textPrimary.srgb),
714
- iconColor: newtone.srgbToHex(tokens.textPrimary.srgb),
715
- borderWidth: 1,
716
- borderColor: "transparent"
717
- };
158
+
159
+ // src/primitives/Frame/Frame.styles.ts
160
+ function getFrameStyles(input) {
161
+ const {
162
+ tokens,
163
+ frameElevation,
164
+ theme = "primary",
165
+ appearance = "main",
166
+ layout = "flex",
167
+ direction = "vertical",
168
+ wrap = false,
169
+ reverse = false,
170
+ columns,
171
+ rows,
172
+ align,
173
+ justify,
174
+ padding,
175
+ gap,
176
+ width,
177
+ height,
178
+ minWidth,
179
+ maxWidth,
180
+ minHeight,
181
+ maxHeight,
182
+ position,
183
+ top,
184
+ right,
185
+ bottom,
186
+ left,
187
+ zIndex,
188
+ overflow,
189
+ opacity,
190
+ radius,
191
+ bordered = false,
192
+ disabled = false
193
+ } = input;
194
+ const container = {};
195
+ const appearanceTokens = tokens.colors[theme][appearance];
196
+ container.backgroundColor = appearanceTokens.background;
197
+ container.color = appearanceTokens.fontPrimary;
198
+ if (layout === "flex") {
199
+ container.display = "flex";
200
+ container.flexDirection = resolveFlexDirection(direction, reverse);
201
+ if (wrap) container.flexWrap = "wrap";
202
+ }
203
+ if (layout === "grid") {
204
+ container.display = "flex";
205
+ container.flexDirection = "row";
206
+ container.flexWrap = "wrap";
207
+ }
208
+ if (align) container.alignItems = resolveAlignment(align);
209
+ if (justify) container.justifyContent = resolveJustification(justify);
210
+ if (padding !== void 0) {
211
+ const p = resolvePadding(padding, tokens);
212
+ container.paddingTop = p.top;
213
+ container.paddingRight = p.right;
214
+ container.paddingBottom = p.bottom;
215
+ container.paddingLeft = p.left;
216
+ }
217
+ if (gap !== void 0) {
218
+ const g = resolveGap(gap, tokens);
219
+ container.rowGap = g.rowGap;
220
+ container.columnGap = g.columnGap;
221
+ }
222
+ const sizing = resolveSizing(width, height);
223
+ Object.assign(container, sizing);
224
+ if (minWidth !== void 0) container.minWidth = minWidth;
225
+ if (maxWidth !== void 0) container.maxWidth = maxWidth;
226
+ if (minHeight !== void 0) container.minHeight = minHeight;
227
+ if (maxHeight !== void 0) container.maxHeight = maxHeight;
228
+ if (position) container.position = position;
229
+ if (top !== void 0) container.top = top;
230
+ if (right !== void 0) container.right = right;
231
+ if (bottom !== void 0) container.bottom = bottom;
232
+ if (left !== void 0) container.left = left;
233
+ if (zIndex !== void 0) container.zIndex = zIndex;
234
+ if (radius !== void 0) {
235
+ const corners = resolveRadiusCorners(radius, tokens);
236
+ container.borderTopLeftRadius = corners.topLeft;
237
+ container.borderTopRightRadius = corners.topRight;
238
+ container.borderBottomLeftRadius = corners.bottomLeft;
239
+ container.borderBottomRightRadius = corners.bottomRight;
240
+ if (hasPositiveRadius(corners)) {
241
+ container.overflow = "hidden";
718
242
  }
719
- return {
720
- bg: newtone.srgbToHex(paletteTokens.fill.srgb),
721
- hoveredBg: newtone.srgbToHex(paletteTokens.fillHover.srgb),
722
- pressedBg: newtone.srgbToHex(paletteTokens.fillActive.srgb),
723
- textColor: newtone.srgbToHex(paletteTokens.onFill.srgb),
724
- iconColor: newtone.srgbToHex(paletteTokens.onFill.srgb),
725
- borderWidth: 1,
726
- borderColor: "transparent"
243
+ }
244
+ if (overflow) container.overflow = overflow;
245
+ if (bordered) {
246
+ container.borderWidth = 1;
247
+ container.borderColor = appearanceTokens.fontTertiary;
248
+ }
249
+ if (frameElevation === 2) {
250
+ container.shadowColor = "#000";
251
+ container.shadowOffset = { width: 0, height: 2 };
252
+ container.shadowOpacity = 0.12;
253
+ container.shadowRadius = 6;
254
+ container.elevation = 4;
255
+ }
256
+ if (opacity !== void 0) {
257
+ container.opacity = opacity;
258
+ } else if (disabled) {
259
+ container.opacity = 0.5;
260
+ }
261
+ const pressed = reactNative.StyleSheet.create({
262
+ s: { backgroundColor: appearanceTokens.fontSecondary }
263
+ }).s;
264
+ let gridWebStyle = null;
265
+ if (layout === "grid") {
266
+ gridWebStyle = {
267
+ display: "grid",
268
+ // Divide into equal-width columns (e.g. 3 columns → "repeat(3, 1fr)").
269
+ gridTemplateColumns: columns ? `repeat(${columns}, 1fr)` : void 0,
270
+ gridTemplateRows: rows ? `repeat(${rows}, 1fr)` : void 0
727
271
  };
728
272
  }
729
- if (variant === "secondary") {
730
- if (semantic === "neutral") {
731
- return {
732
- bg: "transparent",
733
- hoveredBg: newtone.srgbToHex(tokens.backgroundInteractive.srgb),
734
- pressedBg: newtone.srgbToHex(tokens.backgroundInteractiveHover.srgb),
735
- textColor: newtone.srgbToHex(tokens.textPrimary.srgb),
736
- iconColor: newtone.srgbToHex(tokens.textPrimary.srgb),
737
- borderWidth: 1,
738
- borderColor: newtone.srgbToHex(tokens.border.srgb)
739
- };
273
+ const insetBoxShadow = frameElevation === -2 ? "inset 0 2px 4px rgba(0,0,0,0.12)" : null;
274
+ return {
275
+ // Validate and optimize the container styles through StyleSheet.create(),
276
+ // then extract the single style object with `.c`.
277
+ container: reactNative.StyleSheet.create({ c: container }).c,
278
+ pressed,
279
+ gridWebStyle,
280
+ insetBoxShadow
281
+ };
282
+ }
283
+
284
+ // src/primitives/Frame/Frame.tsx
285
+ function wrapTextChildren(children, textStyle) {
286
+ return React16__default.default.Children.map(children, (child) => {
287
+ if (typeof child === "string" || typeof child === "number") {
288
+ return /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: textStyle }, child);
289
+ }
290
+ return child;
291
+ });
292
+ }
293
+ var ELEVATION_MAP = {
294
+ 0: "sunken",
295
+ 1: "grounded",
296
+ 2: "elevated"
297
+ };
298
+ function toElevationLevel(frameElevation) {
299
+ if (frameElevation <= -1) return 0;
300
+ if (frameElevation === 0) return 1;
301
+ return 2;
302
+ }
303
+ function Frame({
304
+ children,
305
+ // Elevation
306
+ elevation,
307
+ // Scheme
308
+ scheme,
309
+ // Theme / Appearance
310
+ theme,
311
+ appearance,
312
+ // Layout
313
+ layout,
314
+ direction,
315
+ wrap,
316
+ reverse,
317
+ columns,
318
+ rows,
319
+ // Alignment
320
+ align,
321
+ justify,
322
+ // Spacing
323
+ padding,
324
+ gap,
325
+ // Sizing
326
+ width,
327
+ height,
328
+ minWidth,
329
+ maxWidth,
330
+ minHeight,
331
+ maxHeight,
332
+ // Positioning
333
+ position,
334
+ top,
335
+ right,
336
+ bottom,
337
+ left,
338
+ zIndex,
339
+ overflow,
340
+ pointerEvents,
341
+ opacity,
342
+ // Appearance
343
+ radius,
344
+ bordered,
345
+ // Interactivity
346
+ onPress,
347
+ href,
348
+ disabled = false,
349
+ // Accessibility
350
+ accessibilityLabel,
351
+ accessibilityHint,
352
+ // Testing & platform
353
+ testID,
354
+ nativeID,
355
+ ref,
356
+ // Style override
357
+ style
358
+ }) {
359
+ const themeCtx = newtoneApi.useNewtoneTheme();
360
+ const { mode, gamut } = themeCtx;
361
+ const parentFrameCtx = newtoneApi.useFrameContext();
362
+ const resolvedConfig = React16.useMemo(() => {
363
+ if (scheme && themeCtx.schemes) {
364
+ const schemeConfig = themeCtx.schemes[scheme];
365
+ if (schemeConfig) return schemeConfig;
740
366
  }
367
+ return themeCtx.config;
368
+ }, [scheme, themeCtx.schemes, themeCtx.config]);
369
+ const isSchemeOverride = resolvedConfig !== themeCtx.config;
370
+ const resolvedTheme = theme ?? parentFrameCtx?.theme ?? "primary";
371
+ const resolvedAppearance = appearance ?? parentFrameCtx?.appearance ?? "main";
372
+ const resolvedFrameElevation = elevation ?? 0;
373
+ const resolvedElevation = elevation !== void 0 ? toElevationLevel(elevation) : parentFrameCtx?.elevation ?? 1;
374
+ const tokens = React16.useMemo(() => {
375
+ return newtoneApi.computeTokens(
376
+ resolvedConfig.colorSystem,
377
+ mode,
378
+ gamut,
379
+ ELEVATION_MAP[resolvedElevation],
380
+ resolvedConfig.spacing,
381
+ resolvedConfig.radius,
382
+ resolvedConfig.typography,
383
+ resolvedConfig.icons,
384
+ resolvedConfig.themeMappings,
385
+ resolvedConfig.swatchDefaults
386
+ );
387
+ }, [resolvedConfig, mode, gamut, resolvedElevation]);
388
+ const styles = React16.useMemo(
389
+ () => getFrameStyles({
390
+ tokens,
391
+ frameElevation: resolvedFrameElevation,
392
+ theme: resolvedTheme,
393
+ appearance: resolvedAppearance,
394
+ layout,
395
+ direction,
396
+ wrap,
397
+ reverse,
398
+ columns,
399
+ rows,
400
+ align,
401
+ justify,
402
+ padding,
403
+ gap,
404
+ width,
405
+ height,
406
+ minWidth,
407
+ maxWidth,
408
+ minHeight,
409
+ maxHeight,
410
+ position,
411
+ top,
412
+ right,
413
+ bottom,
414
+ left,
415
+ zIndex,
416
+ overflow,
417
+ opacity,
418
+ radius,
419
+ bordered,
420
+ disabled
421
+ }),
422
+ [
423
+ tokens,
424
+ resolvedFrameElevation,
425
+ resolvedTheme,
426
+ resolvedAppearance,
427
+ layout,
428
+ direction,
429
+ wrap,
430
+ reverse,
431
+ columns,
432
+ rows,
433
+ align,
434
+ justify,
435
+ padding,
436
+ gap,
437
+ width,
438
+ height,
439
+ minWidth,
440
+ maxWidth,
441
+ minHeight,
442
+ maxHeight,
443
+ position,
444
+ top,
445
+ right,
446
+ bottom,
447
+ left,
448
+ zIndex,
449
+ overflow,
450
+ opacity,
451
+ radius,
452
+ bordered,
453
+ disabled
454
+ ]
455
+ );
456
+ const resolvedScheme = scheme ?? parentFrameCtx?.scheme;
457
+ const contextValue = React16.useMemo(
458
+ () => ({
459
+ elevation: resolvedElevation,
460
+ tokens,
461
+ scheme: resolvedScheme,
462
+ theme: resolvedTheme,
463
+ appearance: resolvedAppearance
464
+ }),
465
+ [resolvedElevation, tokens, resolvedScheme, resolvedTheme, resolvedAppearance]
466
+ );
467
+ const schemeThemeCtx = React16.useMemo(() => {
468
+ if (!isSchemeOverride) return null;
741
469
  return {
742
- bg: newtone.srgbToHex(paletteTokens.background.srgb),
743
- hoveredBg: newtone.srgbToHex(paletteTokens.backgroundInteractive.srgb),
744
- pressedBg: newtone.srgbToHex(paletteTokens.backgroundInteractiveHover.srgb),
745
- textColor: newtone.srgbToHex(paletteTokens.fill.srgb),
746
- iconColor: newtone.srgbToHex(paletteTokens.fill.srgb),
747
- borderWidth: 1,
748
- borderColor: "transparent"
470
+ ...themeCtx,
471
+ config: resolvedConfig,
472
+ activeScheme: scheme ?? themeCtx.activeScheme
749
473
  };
474
+ }, [isSchemeOverride, themeCtx, resolvedConfig, scheme]);
475
+ const webOverrides = [];
476
+ if (styles.gridWebStyle) {
477
+ webOverrides.push(styles.gridWebStyle);
750
478
  }
751
- if (variant === "tertiary") {
752
- if (semantic === "neutral") {
753
- return {
754
- bg: "transparent",
755
- hoveredBg: newtone.srgbToHex(tokens.backgroundInteractive.srgb),
756
- pressedBg: newtone.srgbToHex(tokens.backgroundInteractiveHover.srgb),
757
- textColor: newtone.srgbToHex(tokens.textPrimary.srgb),
758
- iconColor: newtone.srgbToHex(tokens.textPrimary.srgb),
759
- borderWidth: 1,
760
- borderColor: "transparent"
761
- };
762
- }
763
- return {
764
- bg: "transparent",
765
- hoveredBg: newtone.srgbToHex(paletteTokens.background.srgb),
766
- pressedBg: newtone.srgbToHex(paletteTokens.backgroundInteractive.srgb),
767
- textColor: newtone.srgbToHex(paletteTokens.fill.srgb),
768
- iconColor: newtone.srgbToHex(paletteTokens.fill.srgb),
769
- borderWidth: 1,
770
- borderColor: "transparent"
771
- };
479
+ if (styles.insetBoxShadow) {
480
+ webOverrides.push({ boxShadow: styles.insetBoxShadow });
772
481
  }
773
- return {
774
- bg: "transparent",
775
- hoveredBg: "transparent",
776
- pressedBg: "transparent",
777
- textColor: newtone.srgbToHex(tokens.textPrimary.srgb),
778
- iconColor: newtone.srgbToHex(tokens.textPrimary.srgb),
779
- borderWidth: 0
780
- };
482
+ const userStyles = Array.isArray(style) ? style : style ? [style] : [];
483
+ const isInteractive = onPress !== void 0 || href !== void 0;
484
+ const { isFocusVisible, focusProps } = useFocusVisible();
485
+ const focusRingStyle = isFocusVisible && !disabled ? {
486
+ outlineWidth: 2,
487
+ outlineStyle: "solid",
488
+ outlineColor: tokens.colors[resolvedTheme].emphasis.background,
489
+ outlineOffset: 2
490
+ } : void 0;
491
+ const webFocusProps = isInteractive ? focusProps : {};
492
+ const textStyle = React16.useMemo(
493
+ () => ({
494
+ color: tokens.colors[resolvedTheme][resolvedAppearance].fontPrimary,
495
+ fontSize: tokens.typography.fontSizes["05"],
496
+ fontFamily: tokens.typography.fonts.main.family,
497
+ lineHeight: tokens.typography.lineHeights["06"]
498
+ }),
499
+ [tokens, resolvedTheme, resolvedAppearance]
500
+ );
501
+ const wrappedChildren = React16.useMemo(
502
+ () => wrapTextChildren(children, textStyle),
503
+ [children, textStyle]
504
+ );
505
+ const content = isInteractive ? /* @__PURE__ */ React16__default.default.createElement(
506
+ reactNative.Pressable,
507
+ {
508
+ ref,
509
+ testID,
510
+ nativeID,
511
+ pointerEvents,
512
+ accessibilityLabel,
513
+ accessibilityHint,
514
+ accessibilityState: disabled ? { disabled: true } : void 0,
515
+ onPress,
516
+ disabled,
517
+ ...href ? { href, accessibilityRole: "link" } : { accessibilityRole: "button" },
518
+ ...webFocusProps,
519
+ style: ({ pressed }) => [
520
+ styles.container,
521
+ pressed && !disabled && styles.pressed,
522
+ focusRingStyle,
523
+ ...webOverrides,
524
+ ...userStyles
525
+ ]
526
+ },
527
+ wrappedChildren
528
+ ) : /* @__PURE__ */ React16__default.default.createElement(
529
+ reactNative.View,
530
+ {
531
+ ref,
532
+ testID,
533
+ nativeID,
534
+ pointerEvents,
535
+ accessibilityLabel,
536
+ accessibilityHint,
537
+ style: [styles.container, ...webOverrides, ...userStyles]
538
+ },
539
+ wrappedChildren
540
+ );
541
+ const wrappedContent = schemeThemeCtx ? /* @__PURE__ */ React16__default.default.createElement(newtoneApi._ThemeContext.Provider, { value: schemeThemeCtx }, content) : content;
542
+ return /* @__PURE__ */ React16__default.default.createElement(newtoneApi.FrameContext.Provider, { value: contextValue }, wrappedContent);
781
543
  }
782
544
  function Icon({
783
- name,
784
- size,
545
+ name = "add",
546
+ size = 24,
785
547
  opticalSize,
786
548
  fill = 0,
787
549
  color,
@@ -793,8 +555,11 @@ function Icon({
793
555
  nativeID,
794
556
  ref
795
557
  }) {
796
- const tokens = useTokens();
797
- const iconStyle = React14.useMemo(() => {
558
+ const tokens = newtoneApi.useTokens();
559
+ const frameCtx = newtoneApi.useFrameContext();
560
+ const resolvedTheme = frameCtx?.theme ?? "primary";
561
+ const resolvedAppearance = frameCtx?.appearance ?? "main";
562
+ const iconStyle = React16.useMemo(() => {
798
563
  const fontSize = size ?? tokens.typography.fontSizes["05"];
799
564
  const getOpticalSize = (size2) => {
800
565
  if (size2 <= 22) return 20;
@@ -803,7 +568,7 @@ function Icon({
803
568
  return 48;
804
569
  };
805
570
  const opsz = opticalSize ?? getOpticalSize(fontSize);
806
- const iconColor = color ?? newtone.srgbToHex(tokens.textPrimary.srgb);
571
+ const iconColor = color ?? tokens.colors[resolvedTheme][resolvedAppearance].fontPrimary;
807
572
  const fontFamily = `Material Symbols ${tokens.icons.variant.charAt(0).toUpperCase() + tokens.icons.variant.slice(1)}`;
808
573
  const fillValue = typeof fill === "boolean" ? fill ? 1 : 0 : fill;
809
574
  const fontVariationSettings = `'FILL' ${fillValue}, 'wght' ${tokens.icons.weight}, 'GRAD' ${tokens.icons.grade}, 'opsz' ${opsz}`;
@@ -823,8 +588,8 @@ function Icon({
823
588
  // web-only: controls the variable font axes listed above
824
589
  ...style
825
590
  };
826
- }, [tokens, size, opticalSize, fill, color, style]);
827
- return /* @__PURE__ */ React14__default.default.createElement(
591
+ }, [tokens, size, opticalSize, fill, color, style, resolvedTheme, resolvedAppearance]);
592
+ return /* @__PURE__ */ React16__default.default.createElement(
828
593
  reactNative.Text,
829
594
  {
830
595
  ref,
@@ -837,146 +602,173 @@ function Icon({
837
602
  name
838
603
  );
839
604
  }
840
-
841
- // src/fonts/measureFont.ts
842
- var REF_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ";
843
- function withTimeout(promise, ms, fallback) {
844
- return Promise.race([
845
- promise,
846
- new Promise((resolve) => setTimeout(() => resolve(fallback), ms))
847
- ]);
848
- }
849
- async function measureAvgCharWidth(fontFamily, fontWeight, fallback, fontSize = 16) {
850
- if (typeof document === "undefined") return 0.55;
851
- try {
852
- await withTimeout(
853
- document.fonts.load(`${fontWeight} ${fontSize}px "${fontFamily}"`),
854
- 3e3,
855
- []
856
- );
857
- const canvas = document.createElement("canvas");
858
- const ctx = canvas.getContext("2d");
859
- if (!ctx) return 0.55;
860
- ctx.font = `${fontWeight} ${fontSize}px "${fontFamily}", ${fallback}`;
861
- const ratio = ctx.measureText(REF_STRING).width / REF_STRING.length / fontSize;
862
- return Math.round(ratio * 1e3) / 1e3;
863
- } catch {
864
- return 0.55;
865
- }
866
- }
867
-
868
- // src/fonts/useLocalCalibration.ts
869
- var STORAGE_KEY = "newtone:font-metrics:v1";
870
- var TTL_MS = 7 * 24 * 60 * 60 * 1e3;
871
- function readCache() {
872
- if (typeof localStorage === "undefined") return {};
873
- try {
874
- const raw = localStorage.getItem(STORAGE_KEY);
875
- return raw ? JSON.parse(raw) : {};
876
- } catch {
877
- return {};
878
- }
879
- }
880
- function writeCache(cache) {
881
- if (typeof localStorage === "undefined") return;
882
- try {
883
- localStorage.setItem(STORAGE_KEY, JSON.stringify(cache));
884
- } catch {
885
- }
886
- }
887
- function cacheKey(fontFamily, fontWeight) {
888
- return `${fontFamily}:${fontWeight}`;
889
- }
890
- function useLocalCalibration(fontFamily, fontWeight, fallback, baseCalibration) {
891
- const key = cacheKey(fontFamily, fontWeight);
892
- const [ratio, setRatio] = React14.useState(() => {
893
- const cache = readCache();
894
- const entry = cache[key];
895
- if (entry && Date.now() - entry.measuredAt < TTL_MS) {
896
- return entry.ratio;
897
- }
898
- return baseCalibration ?? 0.55;
899
- });
900
- React14.useEffect(() => {
901
- const cache = readCache();
902
- const entry = cache[key];
903
- if (entry && Date.now() - entry.measuredAt < TTL_MS) {
904
- if (entry.ratio !== ratio) setRatio(entry.ratio);
905
- return;
906
- }
907
- let cancelled = false;
908
- measureAvgCharWidth(fontFamily, fontWeight, fallback).then((measured) => {
909
- if (cancelled) return;
910
- const updated = { ...readCache(), [key]: { ratio: measured, measuredAt: Date.now() } };
911
- writeCache(updated);
912
- setRatio(measured);
913
- });
914
- return () => {
915
- cancelled = true;
916
- };
917
- }, [key, fontFamily, fontWeight, fallback]);
918
- return ratio;
919
- }
920
-
921
- // src/fonts/useTypographyCalibrations.ts
922
- function useTypographyCalibrations() {
923
- const { config } = useNewtoneTheme();
924
- return config.typography.calibrations ?? {};
925
- }
926
-
927
- // src/fonts/reportQueue.ts
928
- var queue = [];
929
- var flushTimer;
930
- function flush() {
931
- if (queue.length === 0) return;
932
- const byEndpoint = /* @__PURE__ */ new Map();
933
- for (const item of queue) {
934
- const group = byEndpoint.get(item.endpoint) ?? [];
935
- group.push(item.payload);
936
- byEndpoint.set(item.endpoint, group);
605
+ function getWrapperStyles(input) {
606
+ const {
607
+ tokens,
608
+ direction = "vertical",
609
+ wrap = false,
610
+ reverse = false,
611
+ align,
612
+ justify,
613
+ padding,
614
+ gap,
615
+ width,
616
+ height,
617
+ minWidth,
618
+ maxWidth,
619
+ minHeight,
620
+ maxHeight,
621
+ position,
622
+ top,
623
+ right,
624
+ bottom,
625
+ left,
626
+ zIndex,
627
+ overflow,
628
+ opacity
629
+ } = input;
630
+ const container = {};
631
+ container.flexDirection = resolveFlexDirection(direction, reverse);
632
+ if (wrap) container.flexWrap = "wrap";
633
+ if (align) container.alignItems = resolveAlignment(align);
634
+ if (justify) container.justifyContent = resolveJustification(justify);
635
+ if (padding !== void 0) {
636
+ const p = resolvePadding(padding, tokens);
637
+ container.paddingTop = p.top;
638
+ container.paddingRight = p.right;
639
+ container.paddingBottom = p.bottom;
640
+ container.paddingLeft = p.left;
937
641
  }
938
- queue.length = 0;
939
- for (const [endpoint, observations] of byEndpoint) {
940
- fetch(endpoint, {
941
- method: "POST",
942
- headers: { "Content-Type": "application/json" },
943
- body: JSON.stringify({ observations }),
944
- // keepalive: true allows the request to outlive the page
945
- keepalive: true
946
- }).catch(() => {
947
- });
642
+ if (gap !== void 0) {
643
+ const g = resolveGap(gap, tokens);
644
+ container.rowGap = g.rowGap;
645
+ container.columnGap = g.columnGap;
948
646
  }
647
+ Object.assign(container, resolveSizing(width, height));
648
+ if (minWidth !== void 0) container.minWidth = minWidth;
649
+ if (maxWidth !== void 0) container.maxWidth = maxWidth;
650
+ if (minHeight !== void 0) container.minHeight = minHeight;
651
+ if (maxHeight !== void 0) container.maxHeight = maxHeight;
652
+ if (position) container.position = position;
653
+ if (top !== void 0) container.top = top;
654
+ if (right !== void 0) container.right = right;
655
+ if (bottom !== void 0) container.bottom = bottom;
656
+ if (left !== void 0) container.left = left;
657
+ if (zIndex !== void 0) container.zIndex = zIndex;
658
+ if (overflow) container.overflow = overflow;
659
+ if (opacity !== void 0) container.opacity = opacity;
660
+ return reactNative.StyleSheet.create({ c: container }).c;
949
661
  }
950
- function enqueueObservation(endpoint, payload) {
951
- queue.push({ endpoint, payload });
952
- if (flushTimer !== void 0) clearTimeout(flushTimer);
953
- flushTimer = setTimeout(flush, 2e3);
954
- }
955
- function useBreakpoint() {
956
- const { width } = reactNative.useWindowDimensions();
957
- return fonts.getBreakpointForWidth(width);
662
+ function Wrapper({
663
+ children,
664
+ direction,
665
+ wrap,
666
+ reverse,
667
+ align,
668
+ justify,
669
+ padding,
670
+ gap,
671
+ width,
672
+ height,
673
+ minWidth,
674
+ maxWidth,
675
+ minHeight,
676
+ maxHeight,
677
+ // Positioning
678
+ position,
679
+ top,
680
+ right,
681
+ bottom,
682
+ left,
683
+ zIndex,
684
+ overflow,
685
+ pointerEvents,
686
+ opacity,
687
+ style,
688
+ // Testing & platform
689
+ testID,
690
+ nativeID,
691
+ ref
692
+ }) {
693
+ const tokens = newtoneApi.useTokens();
694
+ const containerStyle = React16.useMemo(
695
+ () => getWrapperStyles({
696
+ tokens,
697
+ direction,
698
+ wrap,
699
+ reverse,
700
+ align,
701
+ justify,
702
+ padding,
703
+ gap,
704
+ width,
705
+ height,
706
+ minWidth,
707
+ maxWidth,
708
+ minHeight,
709
+ maxHeight,
710
+ position,
711
+ top,
712
+ right,
713
+ bottom,
714
+ left,
715
+ zIndex,
716
+ overflow,
717
+ opacity
718
+ }),
719
+ [
720
+ tokens,
721
+ direction,
722
+ wrap,
723
+ reverse,
724
+ align,
725
+ justify,
726
+ padding,
727
+ gap,
728
+ width,
729
+ height,
730
+ minWidth,
731
+ maxWidth,
732
+ minHeight,
733
+ maxHeight,
734
+ position,
735
+ top,
736
+ right,
737
+ bottom,
738
+ left,
739
+ zIndex,
740
+ overflow,
741
+ opacity
742
+ ]
743
+ );
744
+ const userStyles = Array.isArray(style) ? style : style ? [style] : [];
745
+ return /* @__PURE__ */ React16__default.default.createElement(
746
+ reactNative.View,
747
+ {
748
+ ref,
749
+ testID,
750
+ nativeID,
751
+ pointerEvents,
752
+ accessibilityRole: "none",
753
+ style: [containerStyle, ...userStyles]
754
+ },
755
+ children
756
+ );
958
757
  }
959
-
960
- // src/primitives/Text/Text.tsx
961
- var TextScopeContext = React14.createContext(null);
962
- function resolveTextColor(color, tokens) {
758
+ var TextScopeContext = React16.createContext(null);
759
+ var LARGE_TEXT_ROLES = /* @__PURE__ */ new Set(["headline", "title", "heading", "subheading"]);
760
+ function resolveTextColor(color, tokens, theme = "primary", appearance = "main", role = "body") {
963
761
  switch (color) {
964
762
  case "primary":
965
- return newtone.srgbToHex(tokens.textPrimary.srgb);
763
+ return tokens.colors[theme][appearance].fontPrimary;
966
764
  case "secondary":
967
- return newtone.srgbToHex(tokens.textSecondary.srgb);
765
+ return tokens.colors[theme][appearance].fontSecondary;
968
766
  case "tertiary":
969
- return newtone.srgbToHex(tokens.textTertiary.srgb);
767
+ return tokens.colors[theme][appearance].fontTertiary;
970
768
  case "disabled":
971
- return newtone.srgbToHex(tokens.textDisabled.srgb);
769
+ return tokens.colors[theme][appearance].fontDisabled;
972
770
  case "accent":
973
- return newtone.srgbToHex(tokens.accent.fill.srgb);
974
- case "success":
975
- return newtone.srgbToHex(tokens.success.fill.srgb);
976
- case "warning":
977
- return newtone.srgbToHex(tokens.warning.fill.srgb);
978
- case "error":
979
- return newtone.srgbToHex(tokens.error.fill.srgb);
771
+ return tokens.colors[theme][appearance][LARGE_TEXT_ROLES.has(role) ? "accentLarge" : "accentSmall"];
980
772
  }
981
773
  }
982
774
  var ADAPTIVE_ROLES = /* @__PURE__ */ new Set(["headline", "title", "heading", "subheading"]);
@@ -1006,7 +798,7 @@ function TextBase({
1006
798
  weight: weightOverride,
1007
799
  align,
1008
800
  numberOfLines,
1009
- elevation = 1,
801
+ elevation,
1010
802
  style,
1011
803
  accessibilityRole: accessibilityRoleOverride,
1012
804
  testID,
@@ -1016,27 +808,30 @@ function TextBase({
1016
808
  centerVertically = false,
1017
809
  features
1018
810
  }) {
1019
- const tokens = useTokens(elevation);
1020
- const { config, reportingEndpoint } = useNewtoneTheme();
811
+ const tokens = newtoneApi.useTokens(elevation);
812
+ const { config, reportingEndpoint } = newtoneApi.useNewtoneTheme();
813
+ const frameCtx = newtoneApi.useFrameContext();
814
+ const resolvedTheme = frameCtx?.theme ?? "primary";
815
+ const resolvedAppearance = frameCtx?.appearance ?? "main";
1021
816
  const size = sizeOverride ?? "md";
1022
817
  const fontSlot = tokens.typography.fonts[scope];
1023
818
  const resolvedFontWeight = weightOverride ? fonts.SEMANTIC_WEIGHT_MAP[weightOverride] : config.typography.roleWeights?.[role] ?? fonts.ROLE_DEFAULT_WEIGHTS[role];
1024
- const breakpoint = useBreakpoint();
819
+ const breakpoint = newtoneApi.useBreakpoint();
1025
820
  const baseStep = config.typography.roles[role][size];
1026
821
  const bpScale = fonts.BREAKPOINT_ROLE_SCALE[breakpoint][role];
1027
822
  const step = bpScale === 1 ? baseStep : fonts.scaleRoleStep(baseStep, bpScale);
1028
- const calibrations = useTypographyCalibrations();
823
+ const calibrations = newtoneApi.useTypographyCalibrations();
1029
824
  const fontSlotFull = config.typography.fonts[scope];
1030
- const localRatio = useLocalCalibration(
825
+ const localRatio = newtoneApi.useLocalCalibration(
1031
826
  fontSlot.family,
1032
827
  fonts.SEMANTIC_WEIGHT_MAP.regular,
1033
828
  fontSlotFull.config.fallback,
1034
829
  calibrations[fontSlot.family]
1035
830
  );
1036
831
  const isAdaptive = ADAPTIVE_ROLES.has(role);
1037
- const [containerWidth, setContainerWidth] = React14.useState(null);
1038
- const characterCount = React14.useMemo(() => extractCharacterCount(children), [children]);
1039
- const resolvedStep = React14.useMemo(
832
+ const [containerWidth, setContainerWidth] = React16.useState(null);
833
+ const characterCount = React16.useMemo(() => extractCharacterCount(children), [children]);
834
+ const resolvedStep = React16.useMemo(
1040
835
  () => fonts.resolveResponsiveSize(
1041
836
  {
1042
837
  role,
@@ -1053,11 +848,11 @@ function TextBase({
1053
848
  // eslint-disable-next-line react-hooks/exhaustive-deps
1054
849
  [role, size, responsive, isAdaptive, fontSlot.family, step.fontSize, config.typography.roles, containerWidth, characterCount, localRatio]
1055
850
  );
1056
- React14.useEffect(() => {
851
+ React16.useEffect(() => {
1057
852
  if (!reportingEndpoint || !responsive || !isAdaptive || containerWidth == null) return;
1058
853
  const lineWidths = fonts.estimateLineWidths(characterCount, containerWidth, resolvedStep.fontSize, localRatio);
1059
854
  const lastLine = lineWidths[lineWidths.length - 1];
1060
- enqueueObservation(reportingEndpoint, {
855
+ newtoneApi.enqueueObservation(reportingEndpoint, {
1061
856
  fontFamily: fontSlot.family,
1062
857
  fontWeight: resolvedFontWeight,
1063
858
  role,
@@ -1069,7 +864,7 @@ function TextBase({
1069
864
  lastLineRatio: containerWidth > 0 ? lastLine / containerWidth : 1
1070
865
  });
1071
866
  }, [reportingEndpoint, resolvedStep.fontSize, containerWidth]);
1072
- const resolvedStyle = React14.useMemo(() => {
867
+ const resolvedStyle = React16.useMemo(() => {
1073
868
  const activeStep = responsive && isAdaptive ? resolvedStep : step;
1074
869
  const currentMetrics = config.typography.fontMetrics?.[fontSlot.family];
1075
870
  const correctedLineHeight = currentMetrics ? Math.round(activeStep.lineHeight * currentMetrics.naturalLineHeightRatio / fonts.REFERENCE_LINE_HEIGHT_RATIO / 4) * 4 : activeStep.lineHeight;
@@ -1080,18 +875,18 @@ function TextBase({
1080
875
  fontFamily: fontSlot.family,
1081
876
  fontSize: activeStep.fontSize,
1082
877
  fontWeight: String(resolvedFontWeight),
1083
- color: resolveTextColor(color, tokens),
878
+ color: resolveTextColor(color, tokens, resolvedTheme, resolvedAppearance, role),
1084
879
  lineHeight: correctedLineHeight,
1085
880
  textAlign: align,
1086
881
  ...vcOffset !== 0 ? { transform: [{ translateY: vcOffset }] } : {},
1087
882
  ...featureSettings ? { fontFeatureSettings: featureSettings } : {}
1088
883
  };
1089
- }, [tokens, fontSlot, step, resolvedStep, responsive, isAdaptive, resolvedFontWeight, color, align, config.typography.fontMetrics, centerVertically, features]);
884
+ }, [tokens, fontSlot, step, resolvedStep, responsive, isAdaptive, resolvedFontWeight, color, align, config.typography.fontMetrics, centerVertically, features, resolvedTheme, resolvedAppearance]);
1090
885
  const inferredA11yRole = role === "headline" || role === "title" || role === "heading" ? "header" : void 0;
1091
886
  const effectiveA11yRole = accessibilityRoleOverride ?? inferredA11yRole;
1092
887
  const ariaLevel = effectiveA11yRole === "header" ? ROLE_HEADING_LEVEL[role] : void 0;
1093
- const scopeCtx = React14.useMemo(() => ({ weights: fonts.SEMANTIC_WEIGHT_MAP }), []);
1094
- const textNode = /* @__PURE__ */ React14__default.default.createElement(TextScopeContext.Provider, { value: scopeCtx }, /* @__PURE__ */ React14__default.default.createElement(
888
+ const scopeCtx = React16.useMemo(() => ({ weights: fonts.SEMANTIC_WEIGHT_MAP }), []);
889
+ const textNode = /* @__PURE__ */ React16__default.default.createElement(TextScopeContext.Provider, { value: scopeCtx }, /* @__PURE__ */ React16__default.default.createElement(
1095
890
  reactNative.Text,
1096
891
  {
1097
892
  ref,
@@ -1105,7 +900,7 @@ function TextBase({
1105
900
  children
1106
901
  ));
1107
902
  if (responsive && isAdaptive) {
1108
- return /* @__PURE__ */ React14__default.default.createElement(
903
+ return /* @__PURE__ */ React16__default.default.createElement(
1109
904
  reactNative.View,
1110
905
  {
1111
906
  onLayout: (e) => {
@@ -1120,41 +915,44 @@ function TextBase({
1120
915
  return textNode;
1121
916
  }
1122
917
  function TextSpan({ children, color, weight, italic, underline, highlight, style }) {
1123
- const tokens = useTokens(1);
1124
- const scopeCtx = React14.useContext(TextScopeContext);
1125
- const spanStyle = React14.useMemo(() => {
918
+ const tokens = newtoneApi.useTokens();
919
+ const scopeCtx = React16.useContext(TextScopeContext);
920
+ const frameCtx = newtoneApi.useFrameContext();
921
+ const resolvedTheme = frameCtx?.theme ?? "primary";
922
+ const resolvedAppearance = frameCtx?.appearance ?? "main";
923
+ const spanStyle = React16.useMemo(() => {
1126
924
  const s = {};
1127
- if (color) s.color = resolveTextColor(color, tokens);
925
+ if (color) s.color = resolveTextColor(color, tokens, resolvedTheme, resolvedAppearance);
1128
926
  if (weight && scopeCtx) s.fontWeight = String(scopeCtx.weights[weight]);
1129
927
  if (italic) s.fontStyle = "italic";
1130
928
  if (underline) s.textDecorationLine = "underline";
1131
- if (highlight) s.backgroundColor = resolveTextColor(highlight, tokens);
929
+ if (highlight) s.backgroundColor = resolveTextColor(highlight, tokens, resolvedTheme, resolvedAppearance);
1132
930
  return s;
1133
- }, [tokens, scopeCtx, color, weight, italic, underline, highlight]);
1134
- return React14__default.default.createElement(
931
+ }, [tokens, scopeCtx, color, weight, italic, underline, highlight, resolvedTheme, resolvedAppearance]);
932
+ return React16__default.default.createElement(
1135
933
  reactNative.Text,
1136
934
  { style: style ? [spanStyle, ...Array.isArray(style) ? style : [style]] : spanStyle },
1137
935
  children
1138
936
  );
1139
937
  }
1140
938
  function TextBold(props) {
1141
- return React14__default.default.createElement(TextSpan, { ...props, weight: "bold" });
939
+ return React16__default.default.createElement(TextSpan, { ...props, weight: "bold" });
1142
940
  }
1143
941
  function TextMedium(props) {
1144
- return React14__default.default.createElement(TextSpan, { ...props, weight: "medium" });
942
+ return React16__default.default.createElement(TextSpan, { ...props, weight: "medium" });
1145
943
  }
1146
944
  function TextItalic(props) {
1147
- return React14__default.default.createElement(TextSpan, { ...props, italic: true });
945
+ return React16__default.default.createElement(TextSpan, { ...props, italic: true });
1148
946
  }
1149
947
  function TextUnderline(props) {
1150
- return React14__default.default.createElement(TextSpan, { ...props, underline: true });
948
+ return React16__default.default.createElement(TextSpan, { ...props, underline: true });
1151
949
  }
1152
950
  function TextHighlight(props) {
1153
- return React14__default.default.createElement(TextSpan, props);
951
+ return React16__default.default.createElement(TextSpan, props);
1154
952
  }
1155
953
 
1156
954
  // src/primitives/Text/index.ts
1157
- var Text2 = Object.assign(TextBase, {
955
+ var Text3 = Object.assign(TextBase, {
1158
956
  Span: TextSpan,
1159
957
  Bold: TextBold,
1160
958
  Medium: TextMedium,
@@ -1163,222 +961,219 @@ var Text2 = Object.assign(TextBase, {
1163
961
  Highlight: TextHighlight
1164
962
  });
1165
963
 
1166
- // src/primitives/Frame/Frame.utils.ts
1167
- function resolveSpacing(value, tokens) {
1168
- if (typeof value === "number") return value;
1169
- return tokens.spacing[value];
1170
- }
1171
- function resolvePadding(prop, tokens) {
1172
- if (typeof prop === "string" || typeof prop === "number") {
1173
- const px = resolveSpacing(prop, tokens);
1174
- return { top: px, right: px, bottom: px, left: px };
964
+ // src/composites/actions/Button/Button.styles.ts
965
+ function computeButtonPadding(size, hasIcon, hasText, iconPosition) {
966
+ const basePadding = {
967
+ sm: 8,
968
+ md: 12,
969
+ lg: 16
970
+ };
971
+ const base = basePadding[size];
972
+ const textExtra = 8;
973
+ if (!hasText && hasIcon) {
974
+ return {
975
+ paddingLeft: base,
976
+ paddingRight: base,
977
+ paddingTop: base,
978
+ paddingBottom: base
979
+ };
1175
980
  }
1176
- if ("x" in prop || "y" in prop) {
1177
- const axes = prop;
1178
- const x = axes.x !== void 0 ? resolveSpacing(axes.x, tokens) : 0;
1179
- const y = axes.y !== void 0 ? resolveSpacing(axes.y, tokens) : 0;
1180
- return { top: y, right: x, bottom: y, left: x };
981
+ if (hasText && !hasIcon) {
982
+ return {
983
+ paddingLeft: base + textExtra,
984
+ paddingRight: base + textExtra,
985
+ paddingTop: base,
986
+ paddingBottom: base
987
+ };
1181
988
  }
1182
- const sides = prop;
1183
- return {
1184
- top: sides.top !== void 0 ? resolveSpacing(sides.top, tokens) : 0,
1185
- right: sides.right !== void 0 ? resolveSpacing(sides.right, tokens) : 0,
1186
- bottom: sides.bottom !== void 0 ? resolveSpacing(sides.bottom, tokens) : 0,
1187
- left: sides.left !== void 0 ? resolveSpacing(sides.left, tokens) : 0
1188
- };
1189
- }
1190
- function resolveGap(prop, tokens) {
1191
- if (typeof prop === "string" || typeof prop === "number") {
1192
- const px = resolveSpacing(prop, tokens);
1193
- return { rowGap: px, columnGap: px };
989
+ if (hasText && hasIcon) {
990
+ if (iconPosition === "left") {
991
+ return {
992
+ paddingLeft: base,
993
+ paddingRight: base + textExtra,
994
+ paddingTop: base,
995
+ paddingBottom: base
996
+ };
997
+ } else {
998
+ return {
999
+ paddingLeft: base + textExtra,
1000
+ paddingRight: base,
1001
+ paddingTop: base,
1002
+ paddingBottom: base
1003
+ };
1004
+ }
1194
1005
  }
1195
1006
  return {
1196
- rowGap: prop.row !== void 0 ? resolveSpacing(prop.row, tokens) : 0,
1197
- columnGap: prop.column !== void 0 ? resolveSpacing(prop.column, tokens) : 0
1007
+ paddingLeft: base,
1008
+ paddingRight: base,
1009
+ paddingTop: base,
1010
+ paddingBottom: base
1198
1011
  };
1199
1012
  }
1200
- function resolveRadius(value, tokens) {
1201
- if (typeof value === "number") return value;
1202
- return tokens.radius[value];
1013
+ function semanticToTheme(semantic) {
1014
+ if (semantic === "accent") return "primary";
1015
+ return semantic;
1203
1016
  }
1204
- function resolveRadiusCorners(prop, tokens) {
1205
- if (typeof prop === "string" || typeof prop === "number") {
1206
- const px = resolveRadius(prop, tokens);
1207
- return { topLeft: px, topRight: px, bottomLeft: px, bottomRight: px };
1208
- }
1017
+ function getButtonConfig(variant, semantic, size, disabled, tokens) {
1018
+ const sizeConfig = getSizeConfig(size, tokens);
1019
+ const variantColors = getVariantColors(variant, semantic, disabled, tokens);
1209
1020
  return {
1210
- topLeft: prop.topLeft !== void 0 ? resolveRadius(prop.topLeft, tokens) : 0,
1211
- topRight: prop.topRight !== void 0 ? resolveRadius(prop.topRight, tokens) : 0,
1212
- bottomLeft: prop.bottomLeft !== void 0 ? resolveRadius(prop.bottomLeft, tokens) : 0,
1213
- bottomRight: prop.bottomRight !== void 0 ? resolveRadius(prop.bottomRight, tokens) : 0
1214
- };
1215
- }
1216
- function hasPositiveRadius(corners) {
1217
- return corners.topLeft > 0 || corners.topRight > 0 || corners.bottomLeft > 0 || corners.bottomRight > 0;
1218
- }
1219
- function resolveSizing(width, height) {
1220
- const style = {};
1221
- if (width !== void 0) {
1222
- if (width === "fill") {
1223
- style.flexGrow = 1;
1224
- style.width = "100%";
1225
- } else if (typeof width === "number") {
1226
- style.width = width;
1227
- }
1228
- }
1229
- if (height !== void 0) {
1230
- if (height === "fill") {
1231
- style.flexGrow = 1;
1232
- style.height = "100%";
1233
- } else if (typeof height === "number") {
1234
- style.height = height;
1021
+ variantColors,
1022
+ sizeTokens: {
1023
+ padding: sizeConfig.padding,
1024
+ gap: sizeConfig.gap,
1025
+ borderRadius: sizeConfig.borderRadius,
1026
+ textSize: sizeConfig.textSize,
1027
+ iconSize: sizeConfig.iconSize
1235
1028
  }
1236
- }
1237
- return style;
1238
- }
1239
- var ALIGN_MAP = {
1240
- start: "flex-start",
1241
- center: "center",
1242
- end: "flex-end",
1243
- stretch: "stretch",
1244
- baseline: "baseline"
1245
- };
1246
- var JUSTIFY_MAP = {
1247
- start: "flex-start",
1248
- center: "center",
1249
- end: "flex-end",
1250
- between: "space-between",
1251
- around: "space-around",
1252
- evenly: "space-evenly"
1253
- };
1254
- function resolveAlignment(align) {
1255
- return ALIGN_MAP[align];
1256
- }
1257
- function resolveJustification(justify) {
1258
- return JUSTIFY_MAP[justify];
1259
- }
1260
- function resolveFlexDirection(direction, reverse) {
1261
- if (direction === "horizontal") {
1262
- return reverse ? "row-reverse" : "row";
1263
- }
1264
- return reverse ? "column-reverse" : "column";
1265
- }
1266
-
1267
- // src/primitives/Wrapper/Wrapper.styles.ts
1268
- function getWrapperStyles(input) {
1269
- const {
1270
- tokens,
1271
- direction = "vertical",
1272
- wrap = false,
1273
- reverse = false,
1274
- align,
1275
- justify,
1276
- padding,
1277
- gap,
1278
- width,
1279
- height,
1280
- minWidth,
1281
- maxWidth,
1282
- minHeight,
1283
- maxHeight
1284
- } = input;
1285
- const container = {};
1286
- container.flexDirection = resolveFlexDirection(direction, reverse);
1287
- if (wrap) container.flexWrap = "wrap";
1288
- if (align) container.alignItems = resolveAlignment(align);
1289
- if (justify) container.justifyContent = resolveJustification(justify);
1290
- if (padding !== void 0) {
1291
- const p = resolvePadding(padding, tokens);
1292
- container.paddingTop = p.top;
1293
- container.paddingRight = p.right;
1294
- container.paddingBottom = p.bottom;
1295
- container.paddingLeft = p.left;
1296
- }
1297
- if (gap !== void 0) {
1298
- const g = resolveGap(gap, tokens);
1299
- container.rowGap = g.rowGap;
1300
- container.columnGap = g.columnGap;
1301
- }
1302
- Object.assign(container, resolveSizing(width, height));
1303
- if (minWidth !== void 0) container.minWidth = minWidth;
1304
- if (maxWidth !== void 0) container.maxWidth = maxWidth;
1305
- if (minHeight !== void 0) container.minHeight = minHeight;
1306
- if (maxHeight !== void 0) container.maxHeight = maxHeight;
1307
- return reactNative.StyleSheet.create({ c: container }).c;
1029
+ };
1308
1030
  }
1309
-
1310
- // src/primitives/Wrapper/Wrapper.tsx
1311
- function Wrapper({
1312
- children,
1313
- direction,
1314
- wrap,
1315
- reverse,
1316
- align,
1317
- justify,
1318
- padding,
1319
- gap,
1320
- width,
1321
- height,
1322
- minWidth,
1323
- maxWidth,
1324
- minHeight,
1325
- maxHeight,
1326
- style,
1327
- // Testing & platform
1328
- testID,
1329
- nativeID,
1330
- ref
1331
- }) {
1332
- const tokens = useTokens(1);
1333
- const containerStyle = React14.useMemo(
1334
- () => getWrapperStyles({
1335
- tokens,
1336
- direction,
1337
- wrap,
1338
- reverse,
1339
- align,
1340
- justify,
1341
- padding,
1342
- gap,
1343
- width,
1344
- height,
1345
- minWidth,
1346
- maxWidth,
1347
- minHeight,
1348
- maxHeight
1349
- }),
1350
- [
1351
- tokens,
1352
- direction,
1353
- wrap,
1354
- reverse,
1355
- align,
1356
- justify,
1357
- padding,
1358
- gap,
1359
- width,
1360
- height,
1361
- minWidth,
1362
- maxWidth,
1363
- minHeight,
1364
- maxHeight
1365
- ]
1366
- );
1367
- const userStyles = Array.isArray(style) ? style : style ? [style] : [];
1368
- return /* @__PURE__ */ React14__default.default.createElement(
1369
- reactNative.View,
1370
- {
1371
- ref,
1372
- testID,
1373
- nativeID,
1374
- accessibilityRole: "none",
1375
- style: [containerStyle, ...userStyles]
1031
+ function getSizeConfig(size, tokens) {
1032
+ const configs = {
1033
+ sm: {
1034
+ padding: 8,
1035
+ gap: tokens.spacing["08"],
1036
+ borderRadius: 8,
1037
+ textSize: "md",
1038
+ // 16px
1039
+ iconSize: 24
1040
+ },
1041
+ md: {
1042
+ padding: 12,
1043
+ gap: tokens.spacing["08"],
1044
+ borderRadius: 12,
1045
+ textSize: "md",
1046
+ // 16px
1047
+ iconSize: 24
1376
1048
  },
1377
- children
1378
- );
1049
+ lg: {
1050
+ padding: 16,
1051
+ gap: tokens.spacing["08"],
1052
+ borderRadius: 16,
1053
+ textSize: "md",
1054
+ // 16px
1055
+ iconSize: 24
1056
+ }
1057
+ };
1058
+ return configs[size];
1059
+ }
1060
+ function getVariantColors(variant, semantic, disabled, tokens) {
1061
+ if (disabled) {
1062
+ const baseColors = getVariantColorsForState(variant, semantic, tokens);
1063
+ const disabledBg = tokens.colors.primary.main.fontSecondary;
1064
+ return {
1065
+ ...baseColors,
1066
+ bg: disabledBg,
1067
+ hoveredBg: disabledBg,
1068
+ pressedBg: disabledBg,
1069
+ textColor: tokens.colors.primary.main.fontTertiary,
1070
+ iconColor: tokens.colors.primary.main.fontTertiary
1071
+ };
1072
+ }
1073
+ return getVariantColorsForState(variant, semantic, tokens);
1074
+ }
1075
+ function getVariantColorsForState(variant, semantic, tokens) {
1076
+ if (variant === "primary") {
1077
+ if (semantic === "neutral") {
1078
+ return {
1079
+ bg: tokens.colors.primary.main.fontPrimary,
1080
+ hoveredBg: tokens.colors.primary.main.fontSecondary,
1081
+ pressedBg: tokens.colors.primary.main.fontPrimary,
1082
+ textColor: tokens.colors.primary.main.divider,
1083
+ iconColor: tokens.colors.primary.main.divider,
1084
+ borderWidth: 1,
1085
+ borderColor: "transparent"
1086
+ };
1087
+ }
1088
+ const t = tokens.colors[semanticToTheme(semantic)];
1089
+ return {
1090
+ bg: t.emphasis.background,
1091
+ hoveredBg: t.emphasis.fontPrimary,
1092
+ pressedBg: t.emphasis.fontSecondary,
1093
+ textColor: t.main.background,
1094
+ iconColor: t.main.background,
1095
+ borderWidth: 1,
1096
+ borderColor: "transparent"
1097
+ };
1098
+ }
1099
+ if (variant === "secondary") {
1100
+ if (semantic === "neutral") {
1101
+ return {
1102
+ bg: "transparent",
1103
+ hoveredBg: tokens.colors.primary.main.fontPrimary,
1104
+ pressedBg: tokens.colors.primary.main.fontSecondary,
1105
+ textColor: tokens.colors.primary.main.divider,
1106
+ iconColor: tokens.colors.primary.main.divider,
1107
+ borderWidth: 1,
1108
+ borderColor: tokens.colors.primary.main.fontSecondary
1109
+ };
1110
+ }
1111
+ const t = tokens.colors[semanticToTheme(semantic)];
1112
+ return {
1113
+ bg: t.tinted.background,
1114
+ hoveredBg: t.tinted.fontPrimary,
1115
+ pressedBg: t.tinted.fontSecondary,
1116
+ textColor: t.emphasis.divider,
1117
+ iconColor: t.emphasis.divider,
1118
+ borderWidth: 1,
1119
+ borderColor: "transparent"
1120
+ };
1121
+ }
1122
+ if (variant === "tertiary") {
1123
+ if (semantic === "neutral") {
1124
+ return {
1125
+ bg: "transparent",
1126
+ hoveredBg: tokens.colors.primary.main.fontPrimary,
1127
+ pressedBg: tokens.colors.primary.main.fontSecondary,
1128
+ textColor: tokens.colors.primary.main.divider,
1129
+ iconColor: tokens.colors.primary.main.divider,
1130
+ borderWidth: 1,
1131
+ borderColor: "transparent"
1132
+ };
1133
+ }
1134
+ const t = tokens.colors[semanticToTheme(semantic)];
1135
+ return {
1136
+ bg: "transparent",
1137
+ hoveredBg: t.tinted.background,
1138
+ pressedBg: t.tinted.fontPrimary,
1139
+ textColor: t.emphasis.divider,
1140
+ iconColor: t.emphasis.divider,
1141
+ borderWidth: 1,
1142
+ borderColor: "transparent"
1143
+ };
1144
+ }
1145
+ if (variant === "link") {
1146
+ if (semantic === "neutral") {
1147
+ return {
1148
+ bg: "transparent",
1149
+ hoveredBg: "transparent",
1150
+ pressedBg: "transparent",
1151
+ textColor: tokens.colors.primary.main.fontSecondary,
1152
+ iconColor: tokens.colors.primary.main.fontSecondary,
1153
+ borderWidth: 0,
1154
+ borderColor: "transparent"
1155
+ };
1156
+ }
1157
+ const t = tokens.colors[semanticToTheme(semantic)];
1158
+ return {
1159
+ bg: "transparent",
1160
+ hoveredBg: "transparent",
1161
+ pressedBg: "transparent",
1162
+ textColor: t.emphasis.divider,
1163
+ iconColor: t.emphasis.divider,
1164
+ borderWidth: 0,
1165
+ borderColor: "transparent"
1166
+ };
1167
+ }
1168
+ return {
1169
+ bg: "transparent",
1170
+ hoveredBg: "transparent",
1171
+ pressedBg: "transparent",
1172
+ textColor: tokens.colors.primary.main.divider,
1173
+ iconColor: tokens.colors.primary.main.divider,
1174
+ borderWidth: 0
1175
+ };
1379
1176
  }
1380
-
1381
- // src/composites/actions/Button/Button.tsx
1382
1177
  function Button({
1383
1178
  children,
1384
1179
  icon,
@@ -1387,22 +1182,25 @@ function Button({
1387
1182
  semantic = "neutral",
1388
1183
  size = "md",
1389
1184
  disabled = false,
1185
+ loading = false,
1186
+ fullWidth = false,
1390
1187
  style,
1391
1188
  textStyle,
1392
1189
  ...pressableProps
1393
1190
  }) {
1394
- const tokens = useTokens();
1395
- const { variantColors, sizeTokens } = React14__default.default.useMemo(
1396
- () => getButtonConfig(variant, semantic, size, disabled, tokens),
1397
- [variant, semantic, size, disabled, tokens]
1191
+ const tokens = newtoneApi.useTokens();
1192
+ const isDisabled = disabled || loading;
1193
+ const { variantColors, sizeTokens } = React16__default.default.useMemo(
1194
+ () => getButtonConfig(variant, semantic, size, isDisabled, tokens),
1195
+ [variant, semantic, size, isDisabled, tokens]
1398
1196
  );
1399
- const padding = React14__default.default.useMemo(
1400
- () => computeButtonPadding(size, !!icon, !!children, iconPosition),
1401
- [size, icon, children, iconPosition]
1197
+ const padding = React16__default.default.useMemo(
1198
+ () => variant === "link" ? { paddingLeft: 0, paddingRight: 0, paddingTop: 0, paddingBottom: 0 } : computeButtonPadding(size, !!icon, !!children, iconPosition),
1199
+ [size, icon, children, iconPosition, variant]
1402
1200
  );
1403
- return /* @__PURE__ */ React14__default.default.createElement(reactNative.Pressable, { disabled, ...pressableProps }, ({ pressed, hovered }) => (
1201
+ return /* @__PURE__ */ React16__default.default.createElement(reactNative.Pressable, { disabled: isDisabled, ...pressableProps }, ({ pressed, hovered }) => (
1404
1202
  // Wrapper handles layout: direction, gap, alignment (padding via style)
1405
- /* @__PURE__ */ React14__default.default.createElement(
1203
+ /* @__PURE__ */ React16__default.default.createElement(
1406
1204
  Wrapper,
1407
1205
  {
1408
1206
  direction: "horizontal",
@@ -1413,41 +1211,45 @@ function Button({
1413
1211
  {
1414
1212
  ...padding,
1415
1213
  // Asymmetric horizontal padding for text optical balance
1416
- backgroundColor: pressed && !disabled ? variantColors.pressedBg : hovered && !disabled ? variantColors.hoveredBg : variantColors.bg,
1417
- borderRadius: sizeTokens.borderRadius,
1214
+ backgroundColor: pressed && !isDisabled ? variantColors.pressedBg : hovered && !isDisabled ? variantColors.hoveredBg : variantColors.bg,
1215
+ borderRadius: variant === "link" ? 0 : sizeTokens.borderRadius,
1418
1216
  borderWidth: variantColors.borderWidth,
1419
- // Always 1 for consistent sizing
1420
1217
  borderColor: variantColors.borderColor || "transparent",
1421
- opacity: disabled ? 0.4 : 1
1218
+ opacity: isDisabled ? loading ? 0.6 : 0.4 : variant === "link" && pressed ? 0.7 : 1,
1219
+ ...fullWidth && { width: "100%", alignSelf: "stretch" }
1422
1220
  },
1423
1221
  ...Array.isArray(style) ? style : style ? [style] : []
1424
1222
  ]
1425
1223
  },
1426
- icon && iconPosition === "left" && /* @__PURE__ */ React14__default.default.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor }),
1224
+ icon && iconPosition === "left" && /* @__PURE__ */ React16__default.default.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor }),
1427
1225
  children && // Text primitive with semantic props + color style override
1428
- /* @__PURE__ */ React14__default.default.createElement(
1429
- Text2,
1226
+ /* @__PURE__ */ React16__default.default.createElement(
1227
+ Text3,
1430
1228
  {
1431
1229
  role: "label",
1432
1230
  size: sizeTokens.textSize,
1433
1231
  centerVertically: true,
1434
1232
  style: [
1435
- { color: variantColors.textColor },
1233
+ {
1234
+ color: variantColors.textColor,
1235
+ ...variant === "link" && hovered && { textDecorationLine: "underline" }
1236
+ },
1436
1237
  ...Array.isArray(textStyle) ? textStyle : textStyle ? [textStyle] : []
1437
1238
  ]
1438
1239
  },
1439
1240
  children
1440
1241
  ),
1441
- icon && iconPosition === "right" && /* @__PURE__ */ React14__default.default.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor })
1242
+ icon && iconPosition === "right" && /* @__PURE__ */ React16__default.default.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor })
1442
1243
  )
1443
1244
  ));
1444
1245
  }
1445
- function getCardStyles(tokens, disabled) {
1246
+ function getCardStyles(tokens, disabled, theme = "primary", appearance = "main") {
1247
+ const at = tokens.colors[theme][appearance];
1446
1248
  return reactNative.StyleSheet.create({
1447
1249
  container: {
1448
- backgroundColor: newtone.srgbToHex(tokens.background.srgb),
1250
+ backgroundColor: at.background,
1449
1251
  borderWidth: 1,
1450
- borderColor: newtone.srgbToHex(tokens.border.srgb),
1252
+ borderColor: at.fontSecondary,
1451
1253
  borderRadius: tokens.radius.lg,
1452
1254
  padding: tokens.spacing["16"],
1453
1255
  opacity: disabled ? 0.5 : 1
@@ -1462,356 +1264,287 @@ function Card({
1462
1264
  style,
1463
1265
  disabled = false
1464
1266
  }) {
1465
- const tokens = useTokens(elevation);
1466
- const styles = React14__default.default.useMemo(
1467
- () => getCardStyles(tokens, disabled),
1468
- [tokens, disabled]
1267
+ const tokens = newtoneApi.useTokens(elevation);
1268
+ const frameCtx = newtoneApi.useFrameContext();
1269
+ const styles = React16__default.default.useMemo(
1270
+ () => getCardStyles(tokens, disabled, frameCtx?.theme, frameCtx?.appearance),
1271
+ [tokens, disabled, frameCtx?.theme, frameCtx?.appearance]
1469
1272
  );
1470
- return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, children);
1273
+ return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, children);
1471
1274
  }
1472
- var hadKeyboardEvent = false;
1473
- var isListenerSetup = false;
1474
- function setupModality() {
1475
- if (isListenerSetup || typeof document === "undefined") return;
1476
- isListenerSetup = true;
1477
- const NAVIGATION_KEYS = /* @__PURE__ */ new Set([
1478
- "Tab",
1479
- "ArrowUp",
1480
- "ArrowDown",
1481
- "ArrowLeft",
1482
- "ArrowRight",
1483
- "Enter",
1484
- " ",
1485
- "Escape"
1486
- ]);
1487
- document.addEventListener("keydown", (e) => {
1488
- if (NAVIGATION_KEYS.has(e.key)) {
1489
- hadKeyboardEvent = true;
1490
- }
1491
- }, true);
1492
- document.addEventListener("pointerdown", () => {
1493
- hadKeyboardEvent = false;
1494
- }, true);
1495
- document.addEventListener("mousedown", () => {
1496
- hadKeyboardEvent = false;
1497
- }, true);
1275
+
1276
+ // src/composites/display/Chip/Chip.styles.ts
1277
+ function semanticToTheme2(semantic) {
1278
+ if (semantic === "accent") return "primary";
1279
+ return semantic;
1280
+ }
1281
+ function getSizeConfig2(size) {
1282
+ if (size === "sm") {
1283
+ return { paddingX: 10, paddingY: 3, gap: 4, textRole: "caption", iconSize: 16 };
1284
+ }
1285
+ return { paddingX: 16, paddingY: 8, gap: 6, textRole: "label", iconSize: 20 };
1498
1286
  }
1499
- function useFocusVisible() {
1500
- const [isFocusVisible, setIsFocusVisible] = React14.useState(false);
1501
- React14.useEffect(() => {
1502
- setupModality();
1503
- }, []);
1504
- const onFocus = React14.useCallback(() => {
1505
- if (hadKeyboardEvent) {
1506
- setIsFocusVisible(true);
1287
+ function getVariantColors2(variant, semantic, selected, disabled, tokens) {
1288
+ if (selected) {
1289
+ if (semantic === "neutral") {
1290
+ return {
1291
+ bg: tokens.colors.primary.strong.background,
1292
+ hoveredBg: tokens.colors.primary.strong.fontPrimary,
1293
+ pressedBg: tokens.colors.primary.strong.background,
1294
+ textColor: tokens.colors.primary.strong.fontPrimary,
1295
+ iconColor: tokens.colors.primary.strong.fontPrimary,
1296
+ borderWidth: 1,
1297
+ borderColor: "transparent"
1298
+ };
1507
1299
  }
1508
- }, []);
1509
- const onBlur = React14.useCallback(() => {
1510
- setIsFocusVisible(false);
1511
- }, []);
1512
- const focusProps = { onFocus, onBlur };
1513
- return { isFocusVisible, focusProps };
1514
- }
1515
- function getFrameStyles(input) {
1516
- const {
1517
- tokens,
1518
- frameElevation,
1519
- layout = "flex",
1520
- direction = "vertical",
1521
- wrap = false,
1522
- reverse = false,
1523
- columns,
1524
- rows,
1525
- align,
1526
- justify,
1527
- padding,
1528
- gap,
1529
- width,
1530
- height,
1531
- minWidth,
1532
- maxWidth,
1533
- minHeight,
1534
- maxHeight,
1535
- radius,
1536
- bordered = false,
1537
- disabled = false
1538
- } = input;
1539
- const container = {};
1540
- container.backgroundColor = newtone.srgbToHex(tokens.background.srgb);
1541
- container.color = newtone.srgbToHex(tokens.textPrimary.srgb);
1542
- if (layout === "flex") {
1543
- container.display = "flex";
1544
- container.flexDirection = resolveFlexDirection(direction, reverse);
1545
- if (wrap) container.flexWrap = "wrap";
1546
- }
1547
- if (layout === "grid") {
1548
- container.display = "flex";
1549
- container.flexDirection = "row";
1550
- container.flexWrap = "wrap";
1551
- }
1552
- if (align) container.alignItems = resolveAlignment(align);
1553
- if (justify) container.justifyContent = resolveJustification(justify);
1554
- if (padding !== void 0) {
1555
- const p = resolvePadding(padding, tokens);
1556
- container.paddingTop = p.top;
1557
- container.paddingRight = p.right;
1558
- container.paddingBottom = p.bottom;
1559
- container.paddingLeft = p.left;
1300
+ const t2 = tokens.colors[semanticToTheme2(semantic)];
1301
+ return {
1302
+ bg: t2.emphasis.background,
1303
+ hoveredBg: t2.emphasis.fontPrimary,
1304
+ pressedBg: t2.emphasis.background,
1305
+ textColor: t2.main.background,
1306
+ iconColor: t2.main.background,
1307
+ borderWidth: 1,
1308
+ borderColor: "transparent"
1309
+ };
1560
1310
  }
1561
- if (gap !== void 0) {
1562
- const g = resolveGap(gap, tokens);
1563
- container.rowGap = g.rowGap;
1564
- container.columnGap = g.columnGap;
1311
+ if (disabled) {
1312
+ return {
1313
+ bg: "transparent",
1314
+ hoveredBg: "transparent",
1315
+ pressedBg: "transparent",
1316
+ textColor: tokens.colors.primary.main.fontTertiary,
1317
+ iconColor: tokens.colors.primary.main.fontTertiary,
1318
+ borderWidth: 1,
1319
+ borderColor: tokens.colors.primary.main.divider
1320
+ };
1565
1321
  }
1566
- const sizing = resolveSizing(width, height);
1567
- Object.assign(container, sizing);
1568
- if (minWidth !== void 0) container.minWidth = minWidth;
1569
- if (maxWidth !== void 0) container.maxWidth = maxWidth;
1570
- if (minHeight !== void 0) container.minHeight = minHeight;
1571
- if (maxHeight !== void 0) container.maxHeight = maxHeight;
1572
- if (radius !== void 0) {
1573
- const corners = resolveRadiusCorners(radius, tokens);
1574
- container.borderTopLeftRadius = corners.topLeft;
1575
- container.borderTopRightRadius = corners.topRight;
1576
- container.borderBottomLeftRadius = corners.bottomLeft;
1577
- container.borderBottomRightRadius = corners.bottomRight;
1578
- if (hasPositiveRadius(corners)) {
1579
- container.overflow = "hidden";
1322
+ if (variant === "filled") {
1323
+ if (semantic === "neutral") {
1324
+ return {
1325
+ bg: tokens.colors.primary.main.fontPrimary,
1326
+ hoveredBg: tokens.colors.primary.main.fontSecondary,
1327
+ pressedBg: tokens.colors.primary.main.fontPrimary,
1328
+ textColor: tokens.colors.primary.main.divider,
1329
+ iconColor: tokens.colors.primary.main.divider,
1330
+ borderWidth: 1,
1331
+ borderColor: "transparent"
1332
+ };
1580
1333
  }
1334
+ const t2 = tokens.colors[semanticToTheme2(semantic)];
1335
+ return {
1336
+ bg: t2.emphasis.background,
1337
+ hoveredBg: t2.emphasis.fontPrimary,
1338
+ pressedBg: t2.emphasis.fontSecondary,
1339
+ textColor: t2.main.background,
1340
+ iconColor: t2.main.background,
1341
+ borderWidth: 1,
1342
+ borderColor: "transparent"
1343
+ };
1581
1344
  }
1582
- if (bordered) {
1583
- container.borderWidth = 1;
1584
- container.borderColor = newtone.srgbToHex(tokens.border.srgb);
1345
+ if (variant === "tinted") {
1346
+ if (semantic === "neutral") {
1347
+ return {
1348
+ bg: tokens.colors.primary.tinted.background,
1349
+ hoveredBg: tokens.colors.primary.tinted.fontPrimary,
1350
+ pressedBg: tokens.colors.primary.tinted.fontSecondary,
1351
+ textColor: tokens.colors.primary.main.fontPrimary,
1352
+ iconColor: tokens.colors.primary.main.fontPrimary,
1353
+ borderWidth: 1,
1354
+ borderColor: "transparent"
1355
+ };
1356
+ }
1357
+ const t2 = tokens.colors[semanticToTheme2(semantic)];
1358
+ return {
1359
+ bg: t2.tinted.background,
1360
+ hoveredBg: t2.tinted.fontPrimary,
1361
+ pressedBg: t2.tinted.fontSecondary,
1362
+ textColor: t2.emphasis.divider,
1363
+ iconColor: t2.emphasis.divider,
1364
+ borderWidth: 1,
1365
+ borderColor: "transparent"
1366
+ };
1585
1367
  }
1586
- if (frameElevation === 2) {
1587
- container.shadowColor = "#000";
1588
- container.shadowOffset = { width: 0, height: 2 };
1589
- container.shadowOpacity = 0.12;
1590
- container.shadowRadius = 6;
1591
- container.elevation = 4;
1368
+ if (semantic === "neutral") {
1369
+ return {
1370
+ bg: "transparent",
1371
+ hoveredBg: tokens.colors.primary.tinted.background,
1372
+ pressedBg: tokens.colors.primary.tinted.fontPrimary,
1373
+ textColor: tokens.colors.primary.main.fontPrimary,
1374
+ iconColor: tokens.colors.primary.main.fontPrimary,
1375
+ borderWidth: 1,
1376
+ borderColor: tokens.colors.primary.main.divider
1377
+ };
1592
1378
  }
1593
- if (disabled) {
1594
- container.opacity = 0.5;
1379
+ const t = tokens.colors[semanticToTheme2(semantic)];
1380
+ return {
1381
+ bg: "transparent",
1382
+ hoveredBg: t.tinted.background,
1383
+ pressedBg: t.tinted.fontPrimary,
1384
+ textColor: t.emphasis.divider,
1385
+ iconColor: t.emphasis.divider,
1386
+ borderWidth: 1,
1387
+ borderColor: t.tinted.fontSecondary
1388
+ };
1389
+ }
1390
+ function getChipConfig(variant, semantic, size, selected, disabled, tokens) {
1391
+ return {
1392
+ colors: getVariantColors2(variant, semantic, selected, disabled, tokens),
1393
+ sizeTokens: getSizeConfig2(size)
1394
+ };
1395
+ }
1396
+ function Chip({
1397
+ children,
1398
+ variant = "tinted",
1399
+ size = "md",
1400
+ semantic = "neutral",
1401
+ selected = false,
1402
+ onPress,
1403
+ disabled = false,
1404
+ icon,
1405
+ style
1406
+ }) {
1407
+ const tokens = newtoneApi.useTokens();
1408
+ const { colors, sizeTokens } = React16__default.default.useMemo(
1409
+ () => getChipConfig(variant, semantic, size, selected, disabled, tokens),
1410
+ [variant, semantic, size, selected, disabled, tokens]
1411
+ );
1412
+ const content = (state) => /* @__PURE__ */ React16__default.default.createElement(
1413
+ Wrapper,
1414
+ {
1415
+ direction: "horizontal",
1416
+ align: "center",
1417
+ gap: sizeTokens.gap,
1418
+ style: [
1419
+ {
1420
+ paddingLeft: sizeTokens.paddingX,
1421
+ paddingRight: sizeTokens.paddingX,
1422
+ paddingTop: sizeTokens.paddingY,
1423
+ paddingBottom: sizeTokens.paddingY,
1424
+ backgroundColor: state?.pressed && !disabled ? colors.pressedBg : state?.hovered && !disabled ? colors.hoveredBg : colors.bg,
1425
+ borderRadius: 99,
1426
+ borderWidth: colors.borderWidth,
1427
+ borderColor: colors.borderColor || "transparent",
1428
+ opacity: disabled ? 0.4 : 1
1429
+ },
1430
+ ...Array.isArray(style) ? style : style ? [style] : []
1431
+ ]
1432
+ },
1433
+ icon && /* @__PURE__ */ React16__default.default.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: colors.iconColor }),
1434
+ /* @__PURE__ */ React16__default.default.createElement(
1435
+ Text3,
1436
+ {
1437
+ role: sizeTokens.textRole,
1438
+ weight: selected ? "bold" : "medium",
1439
+ style: { color: colors.textColor }
1440
+ },
1441
+ children
1442
+ )
1443
+ );
1444
+ if (onPress) {
1445
+ return /* @__PURE__ */ React16__default.default.createElement(reactNative.Pressable, { onPress, disabled }, ({ pressed, hovered }) => content({ pressed, hovered }));
1595
1446
  }
1596
- const pressed = reactNative.StyleSheet.create({
1597
- s: { backgroundColor: newtone.srgbToHex(tokens.backgroundSunken.srgb) }
1598
- }).s;
1599
- let gridWebStyle = null;
1600
- if (layout === "grid") {
1601
- gridWebStyle = {
1602
- display: "grid",
1603
- // Divide into equal-width columns (e.g. 3 columns → "repeat(3, 1fr)").
1604
- gridTemplateColumns: columns ? `repeat(${columns}, 1fr)` : void 0,
1605
- gridTemplateRows: rows ? `repeat(${rows}, 1fr)` : void 0
1447
+ return content();
1448
+ }
1449
+
1450
+ // src/composites/layout/Divider/Divider.styles.ts
1451
+ function getDividerStyles(orientation, spacing, tokens) {
1452
+ const color = tokens.colors.primary.main.divider;
1453
+ if (orientation === "vertical") {
1454
+ return {
1455
+ width: 1,
1456
+ height: "100%",
1457
+ backgroundColor: color,
1458
+ ...spacing != null && { marginLeft: spacing, marginRight: spacing }
1606
1459
  };
1607
1460
  }
1608
- const insetBoxShadow = frameElevation === -2 ? "inset 0 2px 4px rgba(0,0,0,0.12)" : null;
1609
1461
  return {
1610
- // Validate and optimize the container styles through StyleSheet.create(),
1611
- // then extract the single style object with `.c`.
1612
- container: reactNative.StyleSheet.create({ c: container }).c,
1613
- pressed,
1614
- gridWebStyle,
1615
- insetBoxShadow
1462
+ height: 1,
1463
+ width: "100%",
1464
+ backgroundColor: color,
1465
+ ...spacing != null && { marginTop: spacing, marginBottom: spacing }
1616
1466
  };
1617
1467
  }
1618
-
1619
- // src/primitives/Frame/Frame.tsx
1620
- function wrapTextChildren(children, textStyle) {
1621
- return React14__default.default.Children.map(children, (child) => {
1622
- if (typeof child === "string" || typeof child === "number") {
1623
- return /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: textStyle }, child);
1468
+ function Divider({
1469
+ orientation = "horizontal",
1470
+ spacing,
1471
+ style
1472
+ }) {
1473
+ const tokens = newtoneApi.useTokens();
1474
+ const dividerStyle = React16__default.default.useMemo(
1475
+ () => getDividerStyles(orientation, spacing, tokens),
1476
+ [orientation, spacing, tokens]
1477
+ );
1478
+ return /* @__PURE__ */ React16__default.default.createElement(
1479
+ reactNative.View,
1480
+ {
1481
+ style: [dividerStyle, ...Array.isArray(style) ? style : style ? [style] : []],
1482
+ accessibilityRole: "none"
1624
1483
  }
1625
- return child;
1626
- });
1484
+ );
1627
1485
  }
1628
- function toElevationLevel(frameElevation) {
1629
- if (frameElevation <= -1) return 0;
1630
- if (frameElevation === 0) return 1;
1631
- return 2;
1486
+
1487
+ // src/composites/layout/ContentCard/ContentCard.styles.ts
1488
+ function getContentCardStyles(variant, isInteractive, tokens) {
1489
+ const dividerColor = tokens.colors.primary.main.divider;
1490
+ const interactiveStyles = isInteractive ? { cursor: "pointer", textDecorationLine: "none" } : {};
1491
+ if (variant === "elevated") {
1492
+ return {
1493
+ borderRadius: 12,
1494
+ ...interactiveStyles
1495
+ };
1496
+ }
1497
+ if (variant === "bordered") {
1498
+ return {
1499
+ borderWidth: 1,
1500
+ borderColor: dividerColor,
1501
+ borderStyle: "solid",
1502
+ borderRadius: 12,
1503
+ ...interactiveStyles
1504
+ };
1505
+ }
1506
+ return {
1507
+ borderBottomWidth: 1,
1508
+ borderBottomColor: dividerColor,
1509
+ ...interactiveStyles
1510
+ };
1632
1511
  }
1633
- function Frame({
1512
+ function ContentCard({
1634
1513
  children,
1635
- // Elevation
1636
- elevation,
1637
- // Layout
1638
- layout,
1639
- direction,
1640
- wrap,
1641
- reverse,
1642
- columns,
1643
- rows,
1644
- // Alignment
1645
- align,
1646
- justify,
1647
- // Spacing
1648
- padding,
1649
- gap,
1650
- // Sizing
1651
- width,
1652
- height,
1653
- minWidth,
1654
- maxWidth,
1655
- minHeight,
1656
- maxHeight,
1657
- // Appearance
1658
- radius,
1659
- bordered,
1660
- // Interactivity
1661
- onPress,
1514
+ variant = "bordered",
1662
1515
  href,
1516
+ onPress,
1517
+ padding = 20,
1518
+ gap = 8,
1663
1519
  disabled = false,
1664
- // Accessibility
1665
- accessibilityLabel,
1666
- accessibilityHint,
1667
- // Testing & platform
1668
- testID,
1669
- nativeID,
1670
- ref,
1671
- // Style override
1672
1520
  style
1673
1521
  }) {
1674
- const { config, mode } = useNewtoneTheme();
1675
- const parentFrameCtx = useFrameContext();
1676
- const resolvedFrameElevation = elevation ?? 0;
1677
- const resolvedElevation = elevation !== void 0 ? toElevationLevel(elevation) : parentFrameCtx?.elevation ?? 1;
1678
- const tokens = React14.useMemo(() => {
1679
- return computeTokens(
1680
- config.colorSystem,
1681
- mode,
1682
- resolvedElevation,
1683
- config.spacing,
1684
- config.radius,
1685
- config.typography,
1686
- config.icons,
1687
- config.tokenOverrides
1688
- );
1689
- }, [config, mode, resolvedElevation]);
1690
- const styles = React14.useMemo(
1691
- () => getFrameStyles({
1692
- tokens,
1693
- frameElevation: resolvedFrameElevation,
1694
- layout,
1695
- direction,
1696
- wrap,
1697
- reverse,
1698
- columns,
1699
- rows,
1700
- align,
1701
- justify,
1702
- padding,
1703
- gap,
1704
- width,
1705
- height,
1706
- minWidth,
1707
- maxWidth,
1708
- minHeight,
1709
- maxHeight,
1710
- radius,
1711
- bordered,
1712
- disabled
1713
- }),
1714
- [
1715
- tokens,
1716
- resolvedFrameElevation,
1717
- layout,
1718
- direction,
1719
- wrap,
1720
- reverse,
1721
- columns,
1722
- rows,
1723
- align,
1724
- justify,
1522
+ const tokens = newtoneApi.useTokens();
1523
+ const isInteractive = !!(href || onPress);
1524
+ const variantStyles = React16__default.default.useMemo(
1525
+ () => getContentCardStyles(variant, isInteractive, tokens),
1526
+ [variant, isInteractive, tokens]
1527
+ );
1528
+ return /* @__PURE__ */ React16__default.default.createElement(
1529
+ Frame,
1530
+ {
1531
+ elevation: variant === "elevated" ? 2 : void 0,
1532
+ appearance: variant === "elevated" ? "tinted" : void 0,
1533
+ href,
1534
+ onPress,
1535
+ disabled,
1725
1536
  padding,
1726
1537
  gap,
1727
- width,
1728
- height,
1729
- minWidth,
1730
- maxWidth,
1731
- minHeight,
1732
- maxHeight,
1733
- radius,
1734
- bordered,
1735
- disabled
1736
- ]
1737
- );
1738
- const contextValue = React14.useMemo(
1739
- () => ({ elevation: resolvedElevation, tokens }),
1740
- [resolvedElevation, tokens]
1741
- );
1742
- const webOverrides = [];
1743
- if (styles.gridWebStyle) {
1744
- webOverrides.push(styles.gridWebStyle);
1745
- }
1746
- if (styles.insetBoxShadow) {
1747
- webOverrides.push({ boxShadow: styles.insetBoxShadow });
1748
- }
1749
- const userStyles = Array.isArray(style) ? style : style ? [style] : [];
1750
- const isInteractive = onPress !== void 0 || href !== void 0;
1751
- const { isFocusVisible, focusProps } = useFocusVisible();
1752
- const focusRingStyle = isFocusVisible && !disabled ? {
1753
- outlineWidth: 2,
1754
- outlineStyle: "solid",
1755
- outlineColor: newtone.srgbToHex(tokens.accent.fill.srgb),
1756
- outlineOffset: 2
1757
- } : void 0;
1758
- const webFocusProps = isInteractive ? focusProps : {};
1759
- const textStyle = React14.useMemo(
1760
- () => ({
1761
- color: newtone.srgbToHex(tokens.textPrimary.srgb),
1762
- fontSize: tokens.typography.fontSizes["05"],
1763
- fontFamily: tokens.typography.fonts.main.family,
1764
- lineHeight: tokens.typography.lineHeights["06"]
1765
- }),
1766
- [tokens]
1767
- );
1768
- const wrappedChildren = React14.useMemo(
1769
- () => wrapTextChildren(children, textStyle),
1770
- [children, textStyle]
1538
+ style: [
1539
+ variantStyles,
1540
+ ...Array.isArray(style) ? style : style ? [style] : []
1541
+ ]
1542
+ },
1543
+ children
1771
1544
  );
1772
- return /* @__PURE__ */ React14__default.default.createElement(FrameContext.Provider, { value: contextValue }, isInteractive ? (
1773
- // Pressable handles taps. When href is set, react-native-web renders
1774
- // it as an <a> tag so it works like a regular link on the web.
1775
- /* @__PURE__ */ React14__default.default.createElement(
1776
- reactNative.Pressable,
1777
- {
1778
- ref,
1779
- testID,
1780
- nativeID,
1781
- accessibilityLabel,
1782
- accessibilityHint,
1783
- accessibilityState: disabled ? { disabled: true } : void 0,
1784
- onPress,
1785
- disabled,
1786
- ...href ? { href, accessibilityRole: "link" } : { accessibilityRole: "button" },
1787
- ...webFocusProps,
1788
- style: ({ pressed }) => [
1789
- styles.container,
1790
- pressed && !disabled && styles.pressed,
1791
- focusRingStyle,
1792
- ...webOverrides,
1793
- ...userStyles
1794
- ]
1795
- },
1796
- wrappedChildren
1797
- )
1798
- ) : (
1799
- // Non-interactive Frame: just a plain View with no tap handling.
1800
- /* @__PURE__ */ React14__default.default.createElement(
1801
- reactNative.View,
1802
- {
1803
- ref,
1804
- testID,
1805
- nativeID,
1806
- accessibilityLabel,
1807
- accessibilityHint,
1808
- style: [styles.container, ...webOverrides, ...userStyles]
1809
- },
1810
- wrappedChildren
1811
- )
1812
- ));
1813
1545
  }
1814
- function getTextInputStyles(tokens, disabled) {
1546
+ function getTextInputStyles(tokens, disabled, theme = "primary", appearance = "main") {
1547
+ const at = tokens.colors[theme][appearance];
1815
1548
  return reactNative.StyleSheet.create({
1816
1549
  container: {
1817
1550
  gap: tokens.spacing["04"]
@@ -1820,44 +1553,50 @@ function getTextInputStyles(tokens, disabled) {
1820
1553
  fontFamily: tokens.typography.fonts.main.family,
1821
1554
  fontSize: tokens.typography.fontSizes["04"],
1822
1555
  fontWeight: tokens.typography.fonts.main.weights.medium,
1823
- color: newtone.srgbToHex(tokens.textSecondary.srgb)
1556
+ color: at.fontTertiary
1824
1557
  },
1825
1558
  input: {
1826
1559
  fontFamily: tokens.typography.fonts.main.family,
1827
- backgroundColor: newtone.srgbToHex(tokens.backgroundSunken.srgb),
1560
+ backgroundColor: at.fontSecondary,
1828
1561
  borderWidth: 1,
1829
- borderColor: newtone.srgbToHex(tokens.border.srgb),
1562
+ borderColor: at.fontSecondary,
1830
1563
  borderRadius: tokens.radius.md,
1831
1564
  paddingVertical: tokens.spacing["08"],
1832
1565
  paddingHorizontal: tokens.spacing["12"],
1833
1566
  fontSize: tokens.typography.fontSizes["05"],
1834
- color: disabled ? newtone.srgbToHex(tokens.textSecondary.srgb) : newtone.srgbToHex(tokens.textPrimary.srgb),
1567
+ color: disabled ? at.fontTertiary : at.divider,
1835
1568
  opacity: disabled ? 0.5 : 1
1836
1569
  }
1837
1570
  });
1838
1571
  }
1572
+
1573
+ // src/composites/form-controls/TextInput/TextInput.tsx
1839
1574
  function TextInput({
1840
1575
  label,
1841
1576
  disabled = false,
1842
1577
  style,
1843
1578
  ...textInputProps
1844
1579
  }) {
1845
- const tokens = useTokens(1);
1846
- const styles = React14__default.default.useMemo(
1847
- () => getTextInputStyles(tokens, disabled),
1848
- [tokens, disabled]
1580
+ const tokens = newtoneApi.useTokens(1);
1581
+ const frameCtx = newtoneApi.useFrameContext();
1582
+ const theme = frameCtx?.theme ?? "primary";
1583
+ const appearance = frameCtx?.appearance ?? "main";
1584
+ const styles = React16__default.default.useMemo(
1585
+ () => getTextInputStyles(tokens, disabled, theme, appearance),
1586
+ [tokens, disabled, theme, appearance]
1849
1587
  );
1850
- return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React14__default.default.createElement(
1588
+ return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React16__default.default.createElement(
1851
1589
  reactNative.TextInput,
1852
1590
  {
1853
1591
  style: styles.input,
1854
1592
  editable: !disabled,
1855
- placeholderTextColor: newtone.srgbToHex(tokens.textSecondary.srgb),
1593
+ placeholderTextColor: tokens.colors[theme][appearance].fontTertiary,
1856
1594
  ...textInputProps
1857
1595
  }
1858
1596
  ));
1859
1597
  }
1860
- function getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpen) {
1598
+ function getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpen, theme = "primary", appearance = "main") {
1599
+ const at = tokens.colors[theme][appearance];
1861
1600
  const widthStyle = width === "trigger" ? { left: 0, right: 0 } : typeof width === "number" ? { width, left: 0 } : { left: 0 };
1862
1601
  return reactNative.StyleSheet.create({
1863
1602
  container: {
@@ -1868,9 +1607,9 @@ function getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpe
1868
1607
  position: "absolute",
1869
1608
  top: triggerHeight + offset,
1870
1609
  ...widthStyle,
1871
- backgroundColor: newtone.srgbToHex(tokens.backgroundElevated.srgb),
1610
+ backgroundColor: at.fontPrimary,
1872
1611
  borderWidth: 1,
1873
- borderColor: newtone.srgbToHex(tokens.border.srgb),
1612
+ borderColor: at.fontSecondary,
1874
1613
  borderRadius: tokens.radius.md,
1875
1614
  maxHeight,
1876
1615
  zIndex: 1e3,
@@ -1898,16 +1637,17 @@ function Popover({
1898
1637
  style,
1899
1638
  contentStyle
1900
1639
  }) {
1901
- const tokens = useTokens(1);
1902
- const containerRef = React14.useRef(null);
1903
- const [triggerHeight, setTriggerHeight] = React14.useState(0);
1904
- const onTriggerLayout = React14.useCallback(
1640
+ const tokens = newtoneApi.useTokens(1);
1641
+ const frameCtx = newtoneApi.useFrameContext();
1642
+ const containerRef = React16.useRef(null);
1643
+ const [triggerHeight, setTriggerHeight] = React16.useState(0);
1644
+ const onTriggerLayout = React16.useCallback(
1905
1645
  (e) => {
1906
1646
  setTriggerHeight(e.nativeEvent.layout.height);
1907
1647
  },
1908
1648
  []
1909
1649
  );
1910
- React14.useEffect(() => {
1650
+ React16.useEffect(() => {
1911
1651
  if (!isOpen) return;
1912
1652
  openPopovers.forEach((closeFn) => closeFn());
1913
1653
  openPopovers.clear();
@@ -1916,7 +1656,7 @@ function Popover({
1916
1656
  openPopovers.delete(onClose);
1917
1657
  };
1918
1658
  }, [isOpen, onClose]);
1919
- React14.useEffect(() => {
1659
+ React16.useEffect(() => {
1920
1660
  if (!isOpen) return;
1921
1661
  if (typeof document === "undefined") return;
1922
1662
  const handleMouseDown = (e) => {
@@ -1928,7 +1668,7 @@ function Popover({
1928
1668
  document.addEventListener("mousedown", handleMouseDown, true);
1929
1669
  return () => document.removeEventListener("mousedown", handleMouseDown, true);
1930
1670
  }, [isOpen, onClose]);
1931
- const handleKeyDown = React14.useCallback(
1671
+ const handleKeyDown = React16.useCallback(
1932
1672
  (e) => {
1933
1673
  if (closeOnEscape && e.key === "Escape") {
1934
1674
  e.stopPropagation();
@@ -1937,41 +1677,41 @@ function Popover({
1937
1677
  },
1938
1678
  [closeOnEscape, onClose]
1939
1679
  );
1940
- const styles = React14.useMemo(
1941
- () => getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpen),
1942
- [tokens, triggerHeight, offset, maxHeight, width, isOpen]
1680
+ const styles = React16.useMemo(
1681
+ () => getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpen, frameCtx?.theme, frameCtx?.appearance),
1682
+ [tokens, triggerHeight, offset, maxHeight, width, isOpen, frameCtx?.theme, frameCtx?.appearance]
1943
1683
  );
1944
- const containerStyles = React14.useMemo(
1684
+ const containerStyles = React16.useMemo(
1945
1685
  () => [styles.container, ...Array.isArray(style) ? style : style ? [style] : []],
1946
1686
  [styles.container, style]
1947
1687
  );
1948
- const mergedContentStyles = React14.useMemo(
1688
+ const mergedContentStyles = React16.useMemo(
1949
1689
  () => [styles.content, ...Array.isArray(contentStyle) ? contentStyle : contentStyle ? [contentStyle] : []],
1950
1690
  [styles.content, contentStyle]
1951
1691
  );
1952
1692
  const webProps = { onKeyDown: handleKeyDown };
1953
- return /* @__PURE__ */ React14__default.default.createElement(
1693
+ return /* @__PURE__ */ React16__default.default.createElement(
1954
1694
  reactNative.View,
1955
1695
  {
1956
1696
  ref: containerRef,
1957
1697
  style: containerStyles,
1958
1698
  ...webProps
1959
1699
  },
1960
- /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { onLayout: onTriggerLayout }, trigger),
1961
- isOpen && /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: mergedContentStyles }, children)
1700
+ /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { onLayout: onTriggerLayout }, trigger),
1701
+ isOpen && /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: mergedContentStyles }, children)
1962
1702
  );
1963
1703
  }
1964
1704
  function usePopover(options) {
1965
- const [isOpen, setIsOpen] = React14.useState(options?.initialOpen ?? false);
1966
- const open = React14.useCallback(() => {
1705
+ const [isOpen, setIsOpen] = React16.useState(options?.initialOpen ?? false);
1706
+ const open = React16.useCallback(() => {
1967
1707
  setIsOpen(true);
1968
1708
  options?.onOpenChange?.(true);
1969
1709
  }, [options]);
1970
- const close = React14.useCallback(() => {
1710
+ const close = React16.useCallback(() => {
1971
1711
  setIsOpen(false);
1972
1712
  options?.onOpenChange?.(false);
1973
1713
  }, [options]);
1974
- const toggle = React14.useCallback(() => {
1714
+ const toggle = React16.useCallback(() => {
1975
1715
  setIsOpen((prev) => {
1976
1716
  const next = !prev;
1977
1717
  options?.onOpenChange?.(next);
@@ -1985,7 +1725,8 @@ function usePopover(options) {
1985
1725
  function isOptionGroup(item) {
1986
1726
  return "options" in item;
1987
1727
  }
1988
- function getSelectStyles(tokens, disabled, size, isOpen) {
1728
+ function getSelectStyles(tokens, disabled, size, isOpen, theme = "primary", appearance = "main") {
1729
+ const at = tokens.colors[theme][appearance];
1989
1730
  const isSm = size === "sm";
1990
1731
  const fontSize = isSm ? tokens.typography.fontSizes["04"] : tokens.typography.fontSizes["05"];
1991
1732
  const iconSize = fontSize + 2;
@@ -2001,14 +1742,14 @@ function getSelectStyles(tokens, disabled, size, isOpen) {
2001
1742
  fontFamily: tokens.typography.fonts.main.family,
2002
1743
  fontSize: tokens.typography.fontSizes["04"],
2003
1744
  fontWeight: tokens.typography.fonts.main.weights.medium,
2004
- color: newtone.srgbToHex(tokens.textSecondary.srgb)
1745
+ color: at.fontTertiary
2005
1746
  },
2006
1747
  trigger: {
2007
1748
  flexDirection: "row",
2008
1749
  alignItems: "center",
2009
- backgroundColor: newtone.srgbToHex(tokens.backgroundSunken.srgb),
1750
+ backgroundColor: at.fontSecondary,
2010
1751
  borderWidth: 1,
2011
- borderColor: newtone.srgbToHex(tokens.border.srgb),
1752
+ borderColor: at.fontSecondary,
2012
1753
  borderRadius: tokens.radius.md,
2013
1754
  paddingVertical,
2014
1755
  paddingLeft: paddingHorizontal,
@@ -2019,7 +1760,7 @@ function getSelectStyles(tokens, disabled, size, isOpen) {
2019
1760
  flex: 1,
2020
1761
  fontFamily: tokens.typography.fonts.main.family,
2021
1762
  fontSize,
2022
- color: disabled ? newtone.srgbToHex(tokens.textSecondary.srgb) : newtone.srgbToHex(tokens.textPrimary.srgb)
1763
+ color: disabled ? at.fontTertiary : at.divider
2023
1764
  },
2024
1765
  iconWrapper: {
2025
1766
  position: "absolute",
@@ -2032,7 +1773,7 @@ function getSelectStyles(tokens, disabled, size, isOpen) {
2032
1773
  fontFamily: tokens.typography.fonts.main.family,
2033
1774
  fontSize: tokens.typography.fontSizes["01"],
2034
1775
  fontWeight: tokens.typography.fonts.main.weights.medium,
2035
- color: newtone.srgbToHex(tokens.textSecondary.srgb),
1776
+ color: at.fontTertiary,
2036
1777
  textTransform: "uppercase",
2037
1778
  letterSpacing: 0.5,
2038
1779
  paddingVertical: tokens.spacing["04"],
@@ -2058,10 +1799,10 @@ function useSelect({
2058
1799
  onClose,
2059
1800
  onOpen
2060
1801
  }) {
2061
- const [focusedIndex, setFocusedIndex] = React14.useState(-1);
2062
- const typeAheadRef = React14.useRef("");
2063
- const typeAheadTimerRef = React14.useRef();
2064
- React14.useEffect(() => {
1802
+ const [focusedIndex, setFocusedIndex] = React16.useState(-1);
1803
+ const typeAheadRef = React16.useRef("");
1804
+ const typeAheadTimerRef = React16.useRef();
1805
+ React16.useEffect(() => {
2065
1806
  if (isOpen) {
2066
1807
  const selectedIdx = flatOptions.findIndex((o) => o.value === value);
2067
1808
  if (selectedIdx >= 0 && !flatOptions[selectedIdx].disabled) {
@@ -2074,7 +1815,7 @@ function useSelect({
2074
1815
  setFocusedIndex(-1);
2075
1816
  }
2076
1817
  }, [isOpen, flatOptions, value]);
2077
- const handleKeyDown = React14.useCallback(
1818
+ const handleKeyDown = React16.useCallback(
2078
1819
  (e) => {
2079
1820
  const key = e.key;
2080
1821
  if (!isOpen) {
@@ -2150,12 +1891,15 @@ function SelectOptionRow({
2150
1891
  renderOption,
2151
1892
  size
2152
1893
  }) {
2153
- const tokens = useTokens(1);
1894
+ const tokens = newtoneApi.useTokens(1);
1895
+ const frameCtx = newtoneApi.useFrameContext();
1896
+ const at = tokens.colors[frameCtx?.theme ?? "primary"][frameCtx?.appearance ?? "main"];
1897
+ const emphasisAt = tokens.colors[frameCtx?.theme ?? "primary"].emphasis;
2154
1898
  const paddingVertical = size === "sm" ? tokens.spacing["04"] : tokens.spacing["08"];
2155
1899
  const paddingHorizontal = size === "sm" ? tokens.spacing["08"] : tokens.spacing["12"];
2156
1900
  const fontSize = size === "sm" ? tokens.typography.fontSizes["04"] : tokens.typography.fontSizes["05"];
2157
1901
  if (renderOption) {
2158
- return /* @__PURE__ */ React14__default.default.createElement(
1902
+ return /* @__PURE__ */ React16__default.default.createElement(
2159
1903
  reactNative.Pressable,
2160
1904
  {
2161
1905
  onPress: option.disabled ? void 0 : onSelect,
@@ -2166,7 +1910,7 @@ function SelectOptionRow({
2166
1910
  renderOption(option, { isSelected, isFocused })
2167
1911
  );
2168
1912
  }
2169
- return /* @__PURE__ */ React14__default.default.createElement(
1913
+ return /* @__PURE__ */ React16__default.default.createElement(
2170
1914
  reactNative.Pressable,
2171
1915
  {
2172
1916
  onPress: option.disabled ? void 0 : onSelect,
@@ -2182,10 +1926,10 @@ function SelectOptionRow({
2182
1926
  paddingHorizontal
2183
1927
  },
2184
1928
  isSelected && {
2185
- backgroundColor: newtone.srgbToHex(tokens.backgroundSunken.srgb)
1929
+ backgroundColor: at.fontSecondary
2186
1930
  },
2187
1931
  isFocused && !isSelected && {
2188
- backgroundColor: `${newtone.srgbToHex(tokens.border.srgb)}20`
1932
+ backgroundColor: `${at.fontSecondary}20`
2189
1933
  },
2190
1934
  option.disabled && {
2191
1935
  opacity: 0.5
@@ -2195,7 +1939,7 @@ function SelectOptionRow({
2195
1939
  }
2196
1940
  ]
2197
1941
  },
2198
- /* @__PURE__ */ React14__default.default.createElement(
1942
+ /* @__PURE__ */ React16__default.default.createElement(
2199
1943
  reactNative.Text,
2200
1944
  {
2201
1945
  style: [
@@ -2203,30 +1947,32 @@ function SelectOptionRow({
2203
1947
  flex: 1,
2204
1948
  fontFamily: tokens.typography.fonts.main.family,
2205
1949
  fontSize,
2206
- color: newtone.srgbToHex(tokens.textPrimary.srgb)
1950
+ color: at.divider
2207
1951
  },
2208
1952
  isSelected && {
2209
1953
  fontWeight: tokens.typography.fonts.main.weights.medium,
2210
- color: newtone.srgbToHex(tokens.accent.fill.srgb)
1954
+ color: emphasisAt.divider
2211
1955
  },
2212
1956
  option.disabled && {
2213
- color: newtone.srgbToHex(tokens.textSecondary.srgb)
1957
+ color: at.fontTertiary
2214
1958
  }
2215
1959
  ],
2216
1960
  numberOfLines: 1
2217
1961
  },
2218
1962
  option.label
2219
1963
  ),
2220
- isSelected && /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: { marginLeft: tokens.spacing["08"] } }, /* @__PURE__ */ React14__default.default.createElement(
1964
+ isSelected && /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: { marginLeft: tokens.spacing["08"] } }, /* @__PURE__ */ React16__default.default.createElement(
2221
1965
  Icon,
2222
1966
  {
2223
1967
  name: "check",
2224
1968
  size: fontSize,
2225
- color: newtone.srgbToHex(tokens.accent.fill.srgb)
1969
+ color: emphasisAt.divider
2226
1970
  }
2227
1971
  ))
2228
1972
  );
2229
1973
  }
1974
+
1975
+ // src/composites/form-controls/Select/Select.tsx
2230
1976
  function flattenOptions(items) {
2231
1977
  const result = [];
2232
1978
  for (const item of items) {
@@ -2250,9 +1996,10 @@ function Select({
2250
1996
  size = "md",
2251
1997
  style
2252
1998
  }) {
2253
- const tokens = useTokens(1);
1999
+ const tokens = newtoneApi.useTokens(1);
2000
+ const frameCtx = newtoneApi.useFrameContext();
2254
2001
  const { isOpen, open, close, toggle } = usePopover();
2255
- const flatOptions = React14.useMemo(() => flattenOptions(options), [options]);
2002
+ const flatOptions = React16.useMemo(() => flattenOptions(options), [options]);
2256
2003
  const { focusedIndex, handleKeyDown } = useSelect({
2257
2004
  flatOptions,
2258
2005
  value,
@@ -2264,15 +2011,18 @@ function Select({
2264
2011
  onClose: close,
2265
2012
  onOpen: open
2266
2013
  });
2267
- const styles = React14.useMemo(
2268
- () => getSelectStyles(tokens, disabled, size, isOpen),
2269
- [tokens, disabled, size, isOpen]
2014
+ const inheritedTheme = frameCtx?.theme;
2015
+ const inheritedAppearance = frameCtx?.appearance;
2016
+ const styles = React16.useMemo(
2017
+ () => getSelectStyles(tokens, disabled, size, isOpen, inheritedTheme, inheritedAppearance),
2018
+ [tokens, disabled, size, isOpen, inheritedTheme, inheritedAppearance]
2270
2019
  );
2271
2020
  const selectedOption = flatOptions.find((o) => o.value === value);
2272
2021
  const displayLabel = selectedOption?.label ?? placeholder ?? value;
2273
- const iconColor = disabled ? newtone.srgbToHex(tokens.textSecondary.srgb) : newtone.srgbToHex(tokens.textPrimary.srgb);
2022
+ const at = tokens.colors[inheritedTheme ?? "primary"][inheritedAppearance ?? "main"];
2023
+ const iconColor = disabled ? at.fontTertiary : at.divider;
2274
2024
  const triggerWebProps = { onKeyDown: handleKeyDown };
2275
- const trigger = /* @__PURE__ */ React14__default.default.createElement(
2025
+ const trigger = /* @__PURE__ */ React16__default.default.createElement(
2276
2026
  reactNative.Pressable,
2277
2027
  {
2278
2028
  onPress: disabled ? void 0 : toggle,
@@ -2282,8 +2032,8 @@ function Select({
2282
2032
  ...triggerWebProps,
2283
2033
  style: styles.trigger
2284
2034
  },
2285
- renderValue ? renderValue(selectedOption) : /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.triggerText, numberOfLines: 1 }, displayLabel),
2286
- /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.iconWrapper, pointerEvents: "none" }, /* @__PURE__ */ React14__default.default.createElement(
2035
+ renderValue ? renderValue(selectedOption) : /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.triggerText, numberOfLines: 1 }, displayLabel),
2036
+ /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.iconWrapper, pointerEvents: "none" }, /* @__PURE__ */ React16__default.default.createElement(
2287
2037
  Icon,
2288
2038
  {
2289
2039
  name: isOpen ? "expand_less" : "expand_more",
@@ -2292,14 +2042,14 @@ function Select({
2292
2042
  }
2293
2043
  ))
2294
2044
  );
2295
- return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : style ? [style] : []] }, label && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React14__default.default.createElement(
2045
+ return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : style ? [style] : []] }, label && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React16__default.default.createElement(
2296
2046
  Popover,
2297
2047
  {
2298
2048
  isOpen: isOpen && !disabled,
2299
2049
  onClose: close,
2300
2050
  trigger
2301
2051
  },
2302
- /* @__PURE__ */ React14__default.default.createElement(
2052
+ /* @__PURE__ */ React16__default.default.createElement(
2303
2053
  reactNative.ScrollView,
2304
2054
  {
2305
2055
  bounces: false,
@@ -2308,7 +2058,7 @@ function Select({
2308
2058
  },
2309
2059
  options.map((item) => {
2310
2060
  if (isOptionGroup(item)) {
2311
- return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { key: item.label }, /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.groupLabel }, item.label), item.options.map((opt) => /* @__PURE__ */ React14__default.default.createElement(
2061
+ return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { key: item.label }, /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.groupLabel }, item.label), item.options.map((opt) => /* @__PURE__ */ React16__default.default.createElement(
2312
2062
  SelectOptionRow,
2313
2063
  {
2314
2064
  key: opt.value,
@@ -2324,7 +2074,7 @@ function Select({
2324
2074
  }
2325
2075
  )));
2326
2076
  }
2327
- return /* @__PURE__ */ React14__default.default.createElement(
2077
+ return /* @__PURE__ */ React16__default.default.createElement(
2328
2078
  SelectOptionRow,
2329
2079
  {
2330
2080
  key: item.value,
@@ -2347,7 +2097,9 @@ var TRACK_WIDTH = 40;
2347
2097
  var TRACK_HEIGHT = 22;
2348
2098
  var THUMB_SIZE = 18;
2349
2099
  var THUMB_OFFSET = 2;
2350
- function getToggleStyles(tokens, value, disabled) {
2100
+ function getToggleStyles(tokens, value, disabled, theme = "primary", appearance = "main") {
2101
+ const at = tokens.colors[theme][appearance];
2102
+ const emphasisAt = tokens.colors[theme].emphasis;
2351
2103
  return reactNative.StyleSheet.create({
2352
2104
  container: {
2353
2105
  flexDirection: "row",
@@ -2359,13 +2111,13 @@ function getToggleStyles(tokens, value, disabled) {
2359
2111
  fontFamily: tokens.typography.fonts.main.family,
2360
2112
  fontSize: tokens.typography.fontSizes["04"],
2361
2113
  fontWeight: tokens.typography.fonts.main.weights.medium,
2362
- color: newtone.srgbToHex(tokens.textSecondary.srgb)
2114
+ color: at.fontTertiary
2363
2115
  },
2364
2116
  track: {
2365
2117
  width: TRACK_WIDTH,
2366
2118
  height: TRACK_HEIGHT,
2367
2119
  borderRadius: TRACK_HEIGHT / 2,
2368
- backgroundColor: value ? newtone.srgbToHex(tokens.accent.fill.srgb) : newtone.srgbToHex(tokens.border.srgb),
2120
+ backgroundColor: value ? emphasisAt.divider : at.fontSecondary,
2369
2121
  justifyContent: "center",
2370
2122
  paddingHorizontal: THUMB_OFFSET
2371
2123
  },
@@ -2373,7 +2125,7 @@ function getToggleStyles(tokens, value, disabled) {
2373
2125
  width: THUMB_SIZE,
2374
2126
  height: THUMB_SIZE,
2375
2127
  borderRadius: THUMB_SIZE / 2,
2376
- backgroundColor: newtone.srgbToHex(tokens.background.srgb),
2128
+ backgroundColor: at.background,
2377
2129
  alignSelf: value ? "flex-end" : "flex-start"
2378
2130
  }
2379
2131
  });
@@ -2387,17 +2139,18 @@ function Toggle({
2387
2139
  disabled = false,
2388
2140
  style
2389
2141
  }) {
2390
- const tokens = useTokens(1);
2391
- const styles = React14__default.default.useMemo(
2392
- () => getToggleStyles(tokens, value, disabled),
2393
- [tokens, value, disabled]
2142
+ const tokens = newtoneApi.useTokens(1);
2143
+ const frameCtx = newtoneApi.useFrameContext();
2144
+ const styles = React16__default.default.useMemo(
2145
+ () => getToggleStyles(tokens, value, disabled, frameCtx?.theme, frameCtx?.appearance),
2146
+ [tokens, value, disabled, frameCtx?.theme, frameCtx?.appearance]
2394
2147
  );
2395
- const handlePress = React14__default.default.useCallback(() => {
2148
+ const handlePress = React16__default.default.useCallback(() => {
2396
2149
  if (!disabled) {
2397
2150
  onValueChange(!value);
2398
2151
  }
2399
2152
  }, [disabled, value, onValueChange]);
2400
- return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React14__default.default.createElement(
2153
+ return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React16__default.default.createElement(
2401
2154
  reactNative.Pressable,
2402
2155
  {
2403
2156
  onPress: handlePress,
@@ -2405,7 +2158,7 @@ function Toggle({
2405
2158
  accessibilityRole: "switch",
2406
2159
  accessibilityState: { checked: value, disabled }
2407
2160
  },
2408
- /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.track }, /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.thumb }))
2161
+ /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.track }, /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.thumb }))
2409
2162
  ));
2410
2163
  }
2411
2164
  var TRACK_HEIGHT2 = 6;
@@ -2425,23 +2178,23 @@ function getSliderStyles(tokens, disabled) {
2425
2178
  fontFamily: tokens.typography.fonts.main.family,
2426
2179
  fontSize: tokens.typography.fontSizes["04"],
2427
2180
  fontWeight: tokens.typography.fonts.main.weights.medium,
2428
- color: newtone.srgbToHex(tokens.textSecondary.srgb)
2181
+ color: tokens.colors.primary.main.fontTertiary
2429
2182
  },
2430
2183
  value: {
2431
2184
  fontFamily: tokens.typography.fonts.main.family,
2432
2185
  fontSize: tokens.typography.fontSizes["04"],
2433
2186
  fontWeight: tokens.typography.fonts.main.weights.medium,
2434
- color: newtone.srgbToHex(tokens.textPrimary.srgb)
2187
+ color: tokens.colors.primary.main.divider
2435
2188
  },
2436
2189
  valueInput: {
2437
2190
  width: 48,
2438
2191
  paddingVertical: 0,
2439
2192
  paddingHorizontal: 4,
2440
2193
  borderWidth: 1,
2441
- borderColor: newtone.srgbToHex(tokens.border.srgb),
2194
+ borderColor: tokens.colors.primary.main.fontSecondary,
2442
2195
  borderRadius: 4,
2443
2196
  backgroundColor: "transparent",
2444
- color: newtone.srgbToHex(tokens.textPrimary.srgb),
2197
+ color: tokens.colors.primary.main.divider,
2445
2198
  fontFamily: tokens.typography.fonts.main.family,
2446
2199
  fontSize: tokens.typography.fontSizes["04"],
2447
2200
  fontWeight: tokens.typography.fonts.main.weights.medium,
@@ -2458,21 +2211,21 @@ function getSliderStyles(tokens, disabled) {
2458
2211
  right: 0,
2459
2212
  height: TRACK_HEIGHT2,
2460
2213
  borderRadius: TRACK_HEIGHT2 / 2,
2461
- backgroundColor: newtone.srgbToHex(tokens.border.srgb)
2214
+ backgroundColor: tokens.colors.primary.main.fontSecondary
2462
2215
  },
2463
2216
  trackFill: {
2464
2217
  position: "absolute",
2465
2218
  left: 0,
2466
2219
  height: TRACK_HEIGHT2,
2467
2220
  borderRadius: TRACK_HEIGHT2 / 2,
2468
- backgroundColor: newtone.srgbToHex(tokens.accent.fill.srgb)
2221
+ backgroundColor: tokens.colors.primary.emphasis.divider
2469
2222
  },
2470
2223
  thumb: {
2471
2224
  position: "absolute",
2472
2225
  width: THUMB_SIZE2,
2473
2226
  height: THUMB_SIZE2,
2474
2227
  borderRadius: THUMB_SIZE2 / 2,
2475
- backgroundColor: newtone.srgbToHex(tokens.accent.fill.srgb)
2228
+ backgroundColor: tokens.colors.primary.emphasis.divider
2476
2229
  }
2477
2230
  });
2478
2231
  }
@@ -2490,43 +2243,43 @@ function Slider({
2490
2243
  disabled = false,
2491
2244
  style
2492
2245
  }) {
2493
- const tokens = useTokens(1);
2494
- const styles = React14__default.default.useMemo(
2246
+ const tokens = newtoneApi.useTokens(1);
2247
+ const styles = React16__default.default.useMemo(
2495
2248
  () => getSliderStyles(tokens, disabled),
2496
2249
  [tokens, disabled]
2497
2250
  );
2498
- const trackRef = React14__default.default.useRef(null);
2499
- const trackWidth = React14__default.default.useRef(0);
2500
- const trackPageX = React14__default.default.useRef(0);
2501
- const [layoutWidth, setLayoutWidth] = React14__default.default.useState(0);
2502
- const onValueChangeRef = React14__default.default.useRef(onValueChange);
2503
- const minRef = React14__default.default.useRef(min);
2504
- const maxRef = React14__default.default.useRef(max);
2505
- const stepRef = React14__default.default.useRef(step);
2506
- const disabledRef = React14__default.default.useRef(disabled);
2507
- React14__default.default.useEffect(() => {
2251
+ const trackRef = React16__default.default.useRef(null);
2252
+ const trackWidth = React16__default.default.useRef(0);
2253
+ const trackPageX = React16__default.default.useRef(0);
2254
+ const [layoutWidth, setLayoutWidth] = React16__default.default.useState(0);
2255
+ const onValueChangeRef = React16__default.default.useRef(onValueChange);
2256
+ const minRef = React16__default.default.useRef(min);
2257
+ const maxRef = React16__default.default.useRef(max);
2258
+ const stepRef = React16__default.default.useRef(step);
2259
+ const disabledRef = React16__default.default.useRef(disabled);
2260
+ React16__default.default.useEffect(() => {
2508
2261
  onValueChangeRef.current = onValueChange;
2509
2262
  }, [onValueChange]);
2510
- React14__default.default.useEffect(() => {
2263
+ React16__default.default.useEffect(() => {
2511
2264
  minRef.current = min;
2512
2265
  }, [min]);
2513
- React14__default.default.useEffect(() => {
2266
+ React16__default.default.useEffect(() => {
2514
2267
  maxRef.current = max;
2515
2268
  }, [max]);
2516
- React14__default.default.useEffect(() => {
2269
+ React16__default.default.useEffect(() => {
2517
2270
  stepRef.current = step;
2518
2271
  }, [step]);
2519
- React14__default.default.useEffect(() => {
2272
+ React16__default.default.useEffect(() => {
2520
2273
  disabledRef.current = disabled;
2521
2274
  }, [disabled]);
2522
- const computeValue = React14__default.default.useCallback((pageX) => {
2275
+ const computeValue = React16__default.default.useCallback((pageX) => {
2523
2276
  const localX = pageX - trackPageX.current;
2524
2277
  const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
2525
2278
  const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
2526
2279
  const stepped = Math.round(raw / stepRef.current) * stepRef.current;
2527
2280
  return Math.min(maxRef.current, Math.max(minRef.current, stepped));
2528
2281
  }, []);
2529
- const panResponder = React14__default.default.useRef(
2282
+ const panResponder = React16__default.default.useRef(
2530
2283
  reactNative.PanResponder.create({
2531
2284
  onStartShouldSetPanResponder: () => !disabledRef.current,
2532
2285
  onMoveShouldSetPanResponder: () => !disabledRef.current,
@@ -2554,7 +2307,7 @@ function Slider({
2554
2307
  fillLeft = 0;
2555
2308
  fillWidth = thumbLeft + THUMB_SIZE2 / 2;
2556
2309
  }
2557
- const handleValueTextSubmit = React14__default.default.useCallback(
2310
+ const handleValueTextSubmit = React16__default.default.useCallback(
2558
2311
  (text) => {
2559
2312
  const raw = Number(text);
2560
2313
  if (!Number.isNaN(raw)) {
@@ -2563,12 +2316,12 @@ function Slider({
2563
2316
  },
2564
2317
  [onValueChange, min, max]
2565
2318
  );
2566
- const [editText, setEditText] = React14__default.default.useState(String(value));
2567
- React14__default.default.useEffect(() => {
2319
+ const [editText, setEditText] = React16__default.default.useState(String(value));
2320
+ React16__default.default.useEffect(() => {
2568
2321
  setEditText(String(value));
2569
2322
  }, [value]);
2570
2323
  const showLabel = label || showValue || editableValue;
2571
- return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.labelRow }, label && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React14__default.default.createElement(
2324
+ return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.labelRow }, label && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React16__default.default.createElement(
2572
2325
  reactNative.TextInput,
2573
2326
  {
2574
2327
  style: styles.valueInput,
@@ -2580,7 +2333,7 @@ function Slider({
2580
2333
  selectTextOnFocus: true,
2581
2334
  editable: !disabled
2582
2335
  }
2583
- ) : showValue && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.value }, value)), /* @__PURE__ */ React14__default.default.createElement(
2336
+ ) : showValue && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.value }, value)), /* @__PURE__ */ React16__default.default.createElement(
2584
2337
  reactNative.View,
2585
2338
  {
2586
2339
  ref: trackRef,
@@ -2595,45 +2348,19 @@ function Slider({
2595
2348
  },
2596
2349
  ...panResponder.panHandlers
2597
2350
  },
2598
- /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.trackRail }),
2599
- /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.trackFill, { left: fillLeft, width: fillWidth }] }),
2600
- /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.thumb, { left: thumbLeft }] })
2351
+ /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.trackRail }),
2352
+ /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.trackFill, { left: fillLeft, width: fillWidth }] }),
2353
+ /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.thumb, { left: thumbLeft }] })
2601
2354
  ));
2602
2355
  }
2603
2356
  var TRACK_HEIGHT3 = 22;
2604
2357
  var THUMB_SIZE3 = 18;
2605
2358
  var SEGMENT_COUNT = 48;
2606
- function hueToHex(hue) {
2607
- const h = (hue % 360 + 360) % 360;
2608
- const x = 1 - Math.abs(h / 60 % 2 - 1);
2609
- let r, g, b;
2610
- if (h < 60) {
2611
- r = 1;
2612
- g = x;
2613
- b = 0;
2614
- } else if (h < 120) {
2615
- r = x;
2616
- g = 1;
2617
- b = 0;
2618
- } else if (h < 180) {
2619
- r = 0;
2620
- g = 1;
2621
- b = x;
2622
- } else if (h < 240) {
2623
- r = 0;
2624
- g = x;
2625
- b = 1;
2626
- } else if (h < 300) {
2627
- r = x;
2628
- g = 0;
2629
- b = 1;
2630
- } else {
2631
- r = 1;
2632
- g = 0;
2633
- b = x;
2634
- }
2635
- const toHex = (v) => Math.round(v * 255).toString(16).padStart(2, "0");
2636
- return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
2359
+ var OKLCH_L = 0.7;
2360
+ var OKLCH_C = 0.4;
2361
+ function hueToHex(oklchHue) {
2362
+ const { color } = newtone.gamutMapToSrgb({ L: OKLCH_L, C: OKLCH_C, h: oklchHue });
2363
+ return newtone.srgbToHex(color);
2637
2364
  }
2638
2365
  function buildHueSegments(min, max) {
2639
2366
  return Array.from({ length: SEGMENT_COUNT }, (_, i) => {
@@ -2656,23 +2383,23 @@ function getHueSliderStyles(tokens, disabled) {
2656
2383
  fontFamily: tokens.typography.fonts.main.family,
2657
2384
  fontSize: tokens.typography.fontSizes["04"],
2658
2385
  fontWeight: tokens.typography.fonts.main.weights.medium,
2659
- color: newtone.srgbToHex(tokens.textSecondary.srgb)
2386
+ color: tokens.colors.primary.main.fontTertiary
2660
2387
  },
2661
2388
  value: {
2662
2389
  fontFamily: tokens.typography.fonts.main.family,
2663
2390
  fontSize: tokens.typography.fontSizes["04"],
2664
2391
  fontWeight: tokens.typography.fonts.main.weights.medium,
2665
- color: newtone.srgbToHex(tokens.textPrimary.srgb)
2392
+ color: tokens.colors.primary.main.divider
2666
2393
  },
2667
2394
  valueInput: {
2668
2395
  width: 48,
2669
2396
  paddingVertical: 0,
2670
2397
  paddingHorizontal: 4,
2671
2398
  borderWidth: 1,
2672
- borderColor: newtone.srgbToHex(tokens.border.srgb),
2399
+ borderColor: tokens.colors.primary.main.fontSecondary,
2673
2400
  borderRadius: 4,
2674
2401
  backgroundColor: "transparent",
2675
- color: newtone.srgbToHex(tokens.textPrimary.srgb),
2402
+ color: tokens.colors.primary.main.divider,
2676
2403
  fontFamily: tokens.typography.fonts.main.family,
2677
2404
  fontSize: tokens.typography.fontSizes["04"],
2678
2405
  fontWeight: tokens.typography.fonts.main.weights.medium,
@@ -2702,7 +2429,7 @@ function getHueSliderStyles(tokens, disabled) {
2702
2429
  borderRadius: THUMB_SIZE3 / 2,
2703
2430
  backgroundColor: "#ffffff",
2704
2431
  borderWidth: 2,
2705
- borderColor: newtone.srgbToHex(tokens.border.srgb)
2432
+ borderColor: tokens.colors.primary.main.fontSecondary
2706
2433
  }
2707
2434
  });
2708
2435
  }
@@ -2712,50 +2439,50 @@ function HueSlider({
2712
2439
  value,
2713
2440
  onValueChange,
2714
2441
  min = 0,
2715
- max = 359,
2442
+ max = 360,
2716
2443
  label,
2717
2444
  showValue = false,
2718
2445
  editableValue = false,
2719
2446
  disabled = false,
2720
2447
  style
2721
2448
  }) {
2722
- const tokens = useTokens(1);
2723
- const styles = React14__default.default.useMemo(
2449
+ const tokens = newtoneApi.useTokens(1);
2450
+ const styles = React16__default.default.useMemo(
2724
2451
  () => getHueSliderStyles(tokens, disabled),
2725
2452
  [tokens, disabled]
2726
2453
  );
2727
- const segments = React14__default.default.useMemo(
2454
+ const segments = React16__default.default.useMemo(
2728
2455
  () => buildHueSegments(min, max),
2729
2456
  [min, max]
2730
2457
  );
2731
- const trackRef = React14__default.default.useRef(null);
2732
- const trackWidth = React14__default.default.useRef(0);
2733
- const trackPageX = React14__default.default.useRef(0);
2734
- const [layoutWidth, setLayoutWidth] = React14__default.default.useState(0);
2735
- const onValueChangeRef = React14__default.default.useRef(onValueChange);
2736
- const minRef = React14__default.default.useRef(min);
2737
- const maxRef = React14__default.default.useRef(max);
2738
- const disabledRef = React14__default.default.useRef(disabled);
2739
- React14__default.default.useEffect(() => {
2458
+ const trackRef = React16__default.default.useRef(null);
2459
+ const trackWidth = React16__default.default.useRef(0);
2460
+ const trackPageX = React16__default.default.useRef(0);
2461
+ const [layoutWidth, setLayoutWidth] = React16__default.default.useState(0);
2462
+ const onValueChangeRef = React16__default.default.useRef(onValueChange);
2463
+ const minRef = React16__default.default.useRef(min);
2464
+ const maxRef = React16__default.default.useRef(max);
2465
+ const disabledRef = React16__default.default.useRef(disabled);
2466
+ React16__default.default.useEffect(() => {
2740
2467
  onValueChangeRef.current = onValueChange;
2741
2468
  }, [onValueChange]);
2742
- React14__default.default.useEffect(() => {
2469
+ React16__default.default.useEffect(() => {
2743
2470
  minRef.current = min;
2744
2471
  }, [min]);
2745
- React14__default.default.useEffect(() => {
2472
+ React16__default.default.useEffect(() => {
2746
2473
  maxRef.current = max;
2747
2474
  }, [max]);
2748
- React14__default.default.useEffect(() => {
2475
+ React16__default.default.useEffect(() => {
2749
2476
  disabledRef.current = disabled;
2750
2477
  }, [disabled]);
2751
- const computeHue = React14__default.default.useCallback((pageX) => {
2478
+ const computeHue = React16__default.default.useCallback((pageX) => {
2752
2479
  const localX = pageX - trackPageX.current;
2753
2480
  const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
2754
2481
  const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
2755
2482
  const stepped = Math.round(raw);
2756
2483
  return (stepped % 360 + 360) % 360;
2757
2484
  }, []);
2758
- const panResponder = React14__default.default.useRef(
2485
+ const panResponder = React16__default.default.useRef(
2759
2486
  reactNative.PanResponder.create({
2760
2487
  onStartShouldSetPanResponder: () => !disabledRef.current,
2761
2488
  onMoveShouldSetPanResponder: () => !disabledRef.current,
@@ -2767,11 +2494,11 @@ function HueSlider({
2767
2494
  }
2768
2495
  })
2769
2496
  ).current;
2770
- const sliderValue = max > 359 && value < min ? value + 360 : value;
2497
+ const sliderValue = max > 360 && value < min ? value + 360 : value;
2771
2498
  const ratio = max > min ? (sliderValue - min) / (max - min) : 0;
2772
2499
  const usableWidth = Math.max(0, layoutWidth - THUMB_SIZE3);
2773
2500
  const thumbLeft = ratio * usableWidth;
2774
- const handleValueTextSubmit = React14__default.default.useCallback(
2501
+ const handleValueTextSubmit = React16__default.default.useCallback(
2775
2502
  (text) => {
2776
2503
  const raw = Number(text);
2777
2504
  if (!Number.isNaN(raw)) {
@@ -2780,12 +2507,12 @@ function HueSlider({
2780
2507
  },
2781
2508
  [onValueChange]
2782
2509
  );
2783
- const [editText, setEditText] = React14__default.default.useState(String(value));
2784
- React14__default.default.useEffect(() => {
2510
+ const [editText, setEditText] = React16__default.default.useState(String(value));
2511
+ React16__default.default.useEffect(() => {
2785
2512
  setEditText(String(value));
2786
2513
  }, [value]);
2787
2514
  const showLabel = label || showValue || editableValue;
2788
- return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.labelRow }, label && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React14__default.default.createElement(
2515
+ return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.labelRow }, label && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React16__default.default.createElement(
2789
2516
  reactNative.TextInput,
2790
2517
  {
2791
2518
  style: styles.valueInput,
@@ -2797,7 +2524,7 @@ function HueSlider({
2797
2524
  selectTextOnFocus: true,
2798
2525
  editable: !disabled
2799
2526
  }
2800
- ) : showValue && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.value }, value, "\xB0")), /* @__PURE__ */ React14__default.default.createElement(
2527
+ ) : showValue && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.value }, value, "\xB0")), /* @__PURE__ */ React16__default.default.createElement(
2801
2528
  reactNative.View,
2802
2529
  {
2803
2530
  ref: trackRef,
@@ -2812,10 +2539,66 @@ function HueSlider({
2812
2539
  },
2813
2540
  ...panResponder.panHandlers
2814
2541
  },
2815
- /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.gradientTrack }, segments.map((color, i) => /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { key: i, style: [styles.segment, { backgroundColor: color }] }))),
2816
- /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.thumb, { left: thumbLeft }] })
2542
+ /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.gradientTrack }, segments.map((color, i) => /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { key: i, style: [styles.segment, { backgroundColor: color }] }))),
2543
+ /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.thumb, { left: thumbLeft }] })
2817
2544
  ));
2818
2545
  }
2546
+
2547
+ // node_modules/@newtonedev/colors/dist/index.js
2548
+ var SRGB_GAMMA_THRESHOLD_LINEAR = 31308e-7;
2549
+ var SRGB_GAMMA_SLOPE = 12.92;
2550
+ var SRGB_GAMMA_EXPONENT = 2.4;
2551
+ var SRGB_GAMMA_OFFSET = 0.055;
2552
+ var SRGB_GAMMA_SCALE = 1.055;
2553
+ var OKLAB_TO_LMS_PRIME = [
2554
+ [1, 0.3963377774, 0.2158037573],
2555
+ [1, -0.1055613458, -0.0638541728],
2556
+ [1, -0.0894841775, -1.291485548]
2557
+ ];
2558
+ var LMS_TO_LINEAR_P3 = [
2559
+ [3.127769439, -2.2570600176, 0.1291828502],
2560
+ [-1.0910091977, 2.4133065499, -0.3222615148],
2561
+ [-0.0260108068, -0.5080402362, 1.5340494942]
2562
+ ];
2563
+ var DEG_TO_RAD = Math.PI / 180;
2564
+ function oklchToOklab(lch) {
2565
+ const hRad = lch.h * DEG_TO_RAD;
2566
+ return {
2567
+ L: lch.L,
2568
+ a: lch.C * Math.cos(hRad),
2569
+ b: lch.C * Math.sin(hRad)
2570
+ };
2571
+ }
2572
+ function oklabToLinearP3(color) {
2573
+ 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;
2574
+ 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;
2575
+ 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;
2576
+ const l = lp * lp * lp;
2577
+ const m = mp * mp * mp;
2578
+ const s = sp * sp * sp;
2579
+ return {
2580
+ r: LMS_TO_LINEAR_P3[0][0] * l + LMS_TO_LINEAR_P3[0][1] * m + LMS_TO_LINEAR_P3[0][2] * s,
2581
+ g: LMS_TO_LINEAR_P3[1][0] * l + LMS_TO_LINEAR_P3[1][1] * m + LMS_TO_LINEAR_P3[1][2] * s,
2582
+ b: LMS_TO_LINEAR_P3[2][0] * l + LMS_TO_LINEAR_P3[2][1] * m + LMS_TO_LINEAR_P3[2][2] * s
2583
+ };
2584
+ }
2585
+ function linearChannelToSrgb(value) {
2586
+ return value <= SRGB_GAMMA_THRESHOLD_LINEAR ? value * SRGB_GAMMA_SLOPE : SRGB_GAMMA_SCALE * value ** (1 / SRGB_GAMMA_EXPONENT) - SRGB_GAMMA_OFFSET;
2587
+ }
2588
+ function linearSrgbToSrgb(color) {
2589
+ return {
2590
+ r: linearChannelToSrgb(color.r),
2591
+ g: linearChannelToSrgb(color.g),
2592
+ b: linearChannelToSrgb(color.b)
2593
+ };
2594
+ }
2595
+ function oklchToP3(color) {
2596
+ return linearSrgbToSrgb(oklabToLinearP3(oklchToOklab(color)));
2597
+ }
2598
+ function oklchToP3Css(color) {
2599
+ const { r, g, b } = oklchToP3(color);
2600
+ return `color(display-p3 ${r} ${g} ${b})`;
2601
+ }
2819
2602
  var TRACK_HEIGHT4 = 22;
2820
2603
  var THUMB_SIZE4 = 18;
2821
2604
  function getColorScaleSliderStyles(tokens, disabled) {
@@ -2833,7 +2616,7 @@ function getColorScaleSliderStyles(tokens, disabled) {
2833
2616
  fontFamily: tokens.typography.fonts.main.family,
2834
2617
  fontSize: tokens.typography.fontSizes["04"],
2835
2618
  fontWeight: tokens.typography.fonts.main.weights.medium,
2836
- color: newtone.srgbToHex(tokens.textSecondary.srgb)
2619
+ color: tokens.colors.primary.main.fontTertiary
2837
2620
  },
2838
2621
  trackContainer: {
2839
2622
  height: TRACK_HEIGHT4 + THUMB_SIZE4,
@@ -2859,13 +2642,13 @@ function getColorScaleSliderStyles(tokens, disabled) {
2859
2642
  borderRadius: THUMB_SIZE4 / 2,
2860
2643
  backgroundColor: "#ffffff",
2861
2644
  borderWidth: 2,
2862
- borderColor: newtone.srgbToHex(tokens.border.srgb)
2645
+ borderColor: tokens.colors.primary.main.fontSecondary
2863
2646
  },
2864
2647
  warning: {
2865
2648
  fontFamily: tokens.typography.fonts.main.family,
2866
2649
  fontSize: tokens.typography.fontSizes["01"],
2867
2650
  fontWeight: tokens.typography.fonts.main.weights.medium,
2868
- color: newtone.srgbToHex(tokens.error.fill.srgb)
2651
+ color: tokens.colors.error.emphasis.divider
2869
2652
  }
2870
2653
  });
2871
2654
  }
@@ -2881,40 +2664,42 @@ function ColorScaleSlider({
2881
2664
  snap = false,
2882
2665
  disabled = false,
2883
2666
  animateValue = false,
2667
+ useP3: _useP3,
2884
2668
  style
2885
2669
  }) {
2886
- const tokens = useTokens(1);
2887
- const styles = React14__default.default.useMemo(
2670
+ const tokens = newtoneApi.useTokens(1);
2671
+ const { gamut } = newtoneApi.useNewtoneTheme();
2672
+ const styles = React16__default.default.useMemo(
2888
2673
  () => getColorScaleSliderStyles(tokens, disabled),
2889
2674
  [tokens, disabled]
2890
2675
  );
2891
- const trackRef = React14__default.default.useRef(null);
2892
- const trackWidth = React14__default.default.useRef(0);
2893
- const trackPageX = React14__default.default.useRef(0);
2894
- const isDragging = React14__default.default.useRef(false);
2895
- const thumbAnim = React14__default.default.useRef(new reactNative.Animated.Value(0)).current;
2896
- const [layoutWidth, setLayoutWidth] = React14__default.default.useState(0);
2897
- const onValueChangeRef = React14__default.default.useRef(onValueChange);
2898
- const disabledRef = React14__default.default.useRef(disabled);
2899
- const colorsLengthRef = React14__default.default.useRef(colors.length);
2900
- const trimEndsRef = React14__default.default.useRef(trimEnds);
2901
- const snapRef = React14__default.default.useRef(snap);
2902
- React14__default.default.useEffect(() => {
2676
+ const trackRef = React16__default.default.useRef(null);
2677
+ const trackWidth = React16__default.default.useRef(0);
2678
+ const trackPageX = React16__default.default.useRef(0);
2679
+ const isDragging = React16__default.default.useRef(false);
2680
+ const thumbAnim = React16__default.default.useRef(new reactNative.Animated.Value(0)).current;
2681
+ const [layoutWidth, setLayoutWidth] = React16__default.default.useState(0);
2682
+ const onValueChangeRef = React16__default.default.useRef(onValueChange);
2683
+ const disabledRef = React16__default.default.useRef(disabled);
2684
+ const colorsLengthRef = React16__default.default.useRef(colors.length);
2685
+ const trimEndsRef = React16__default.default.useRef(trimEnds);
2686
+ const snapRef = React16__default.default.useRef(snap);
2687
+ React16__default.default.useEffect(() => {
2903
2688
  onValueChangeRef.current = onValueChange;
2904
2689
  }, [onValueChange]);
2905
- React14__default.default.useEffect(() => {
2690
+ React16__default.default.useEffect(() => {
2906
2691
  disabledRef.current = disabled;
2907
2692
  }, [disabled]);
2908
- React14__default.default.useEffect(() => {
2693
+ React16__default.default.useEffect(() => {
2909
2694
  colorsLengthRef.current = colors.length;
2910
2695
  }, [colors.length]);
2911
- React14__default.default.useEffect(() => {
2696
+ React16__default.default.useEffect(() => {
2912
2697
  trimEndsRef.current = trimEnds;
2913
2698
  }, [trimEnds]);
2914
- React14__default.default.useEffect(() => {
2699
+ React16__default.default.useEffect(() => {
2915
2700
  snapRef.current = snap;
2916
2701
  }, [snap]);
2917
- const computeNv = React14__default.default.useCallback((pageX) => {
2702
+ const computeNv = React16__default.default.useCallback((pageX) => {
2918
2703
  const localX = pageX - trackPageX.current;
2919
2704
  const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
2920
2705
  const totalSteps2 = colorsLengthRef.current - 1;
@@ -2929,7 +2714,7 @@ function ColorScaleSlider({
2929
2714
  }
2930
2715
  return nv;
2931
2716
  }, []);
2932
- const panResponder = React14__default.default.useRef(
2717
+ const panResponder = React16__default.default.useRef(
2933
2718
  reactNative.PanResponder.create({
2934
2719
  onStartShouldSetPanResponder: () => !disabledRef.current,
2935
2720
  onMoveShouldSetPanResponder: () => !disabledRef.current,
@@ -2957,7 +2742,7 @@ function ColorScaleSlider({
2957
2742
  const ratio = range > 0 ? (maxNV - clampedValue) / range : 0.5;
2958
2743
  const usableWidth = Math.max(0, layoutWidth - THUMB_SIZE4);
2959
2744
  const thumbLeft = ratio * usableWidth;
2960
- React14__default.default.useEffect(() => {
2745
+ React16__default.default.useEffect(() => {
2961
2746
  if (isDragging.current || !animateValue) {
2962
2747
  thumbAnim.setValue(thumbLeft);
2963
2748
  } else {
@@ -2968,7 +2753,7 @@ function ColorScaleSlider({
2968
2753
  }).start();
2969
2754
  }
2970
2755
  }, [thumbLeft, animateValue, thumbAnim]);
2971
- return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.labelRow }, /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.label }, label)), /* @__PURE__ */ React14__default.default.createElement(
2756
+ return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.labelRow }, /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.label }, label)), /* @__PURE__ */ React16__default.default.createElement(
2972
2757
  reactNative.View,
2973
2758
  {
2974
2759
  ref: trackRef,
@@ -2983,17 +2768,18 @@ function ColorScaleSlider({
2983
2768
  },
2984
2769
  ...panResponder.panHandlers
2985
2770
  },
2986
- /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.gradientTrack }, visibleColors.map((color, i) => /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { key: i, style: [styles.segment, { backgroundColor: newtone.srgbToHex(color.srgb) }] }))),
2987
- /* @__PURE__ */ React14__default.default.createElement(reactNative.Animated.View, { style: [styles.thumb, { left: thumbAnim }] })
2988
- ), warning && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.warning }, warning));
2771
+ /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.gradientTrack }, visibleColors.map((color, i) => /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { key: i, style: [styles.segment, { backgroundColor: gamut === "p3" ? oklchToP3Css(color.oklch) : newtone.srgbToHex(color.srgb) }] }))),
2772
+ /* @__PURE__ */ React16__default.default.createElement(reactNative.Animated.View, { style: [styles.thumb, { left: thumbAnim }] })
2773
+ ), warning && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.warning }, warning));
2989
2774
  }
2990
- function getAppShellStyles(tokens) {
2775
+ function getAppShellStyles(tokens, theme = "primary", appearance = "main") {
2776
+ const at = tokens.colors[theme][appearance];
2991
2777
  return reactNative.StyleSheet.create({
2992
2778
  container: {
2993
2779
  flex: 1,
2994
2780
  flexDirection: "row",
2995
2781
  overflow: "hidden",
2996
- backgroundColor: newtone.srgbToHex(tokens.background.srgb)
2782
+ backgroundColor: at.background
2997
2783
  },
2998
2784
  main: {
2999
2785
  flex: 1,
@@ -3006,18 +2792,23 @@ function getAppShellStyles(tokens) {
3006
2792
 
3007
2793
  // src/composites/layout/AppShell/AppShell.tsx
3008
2794
  function AppShell({ sidebar, children }) {
3009
- const tokens = useTokens();
3010
- const styles = React14__default.default.useMemo(() => getAppShellStyles(tokens), [tokens]);
3011
- return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.container }, sidebar, /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.main }, children));
2795
+ const tokens = newtoneApi.useTokens();
2796
+ const frameCtx = newtoneApi.useFrameContext();
2797
+ const styles = React16__default.default.useMemo(
2798
+ () => getAppShellStyles(tokens, frameCtx?.theme, frameCtx?.appearance),
2799
+ [tokens, frameCtx?.theme, frameCtx?.appearance]
2800
+ );
2801
+ return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.container }, sidebar, /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.main }, children));
3012
2802
  }
3013
- function getSidebarStyles({ tokens, width, bordered }) {
3014
- const borderColor = newtone.srgbToHex(tokens.border.srgb);
2803
+ function getSidebarStyles({ tokens, width, bordered, theme = "primary", appearance = "main" }) {
2804
+ const at = tokens.colors[theme][appearance];
2805
+ const borderColor = at.fontSecondary;
3015
2806
  return reactNative.StyleSheet.create({
3016
2807
  container: {
3017
2808
  width,
3018
2809
  flexShrink: 0,
3019
2810
  flexDirection: "column",
3020
- backgroundColor: newtone.srgbToHex(tokens.background.srgb),
2811
+ backgroundColor: at.background,
3021
2812
  borderRightWidth: bordered ? 1 : 0,
3022
2813
  borderRightColor: borderColor
3023
2814
  },
@@ -3045,15 +2836,17 @@ function Sidebar({
3045
2836
  width = 260,
3046
2837
  bordered = true
3047
2838
  }) {
3048
- const tokens = useTokens();
3049
- const styles = React14__default.default.useMemo(
3050
- () => getSidebarStyles({ tokens, width, bordered }),
3051
- [tokens, width, bordered]
2839
+ const tokens = newtoneApi.useTokens();
2840
+ const frameCtx = newtoneApi.useFrameContext();
2841
+ const styles = React16__default.default.useMemo(
2842
+ () => getSidebarStyles({ tokens, width, bordered, theme: frameCtx?.theme, appearance: frameCtx?.appearance }),
2843
+ [tokens, width, bordered, frameCtx?.theme, frameCtx?.appearance]
3052
2844
  );
3053
- return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.container }, header && /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.header }, header), /* @__PURE__ */ React14__default.default.createElement(reactNative.ScrollView, { style: styles.body }, children), footer && /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.footer }, footer));
2845
+ return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.container }, header && /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.header }, header), /* @__PURE__ */ React16__default.default.createElement(reactNative.ScrollView, { style: styles.body }, children), footer && /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.footer }, footer));
3054
2846
  }
3055
- function getNavbarStyles({ tokens, height, bordered }) {
3056
- const borderColor = newtone.srgbToHex(tokens.border.srgb);
2847
+ function getNavbarStyles({ tokens, height, bordered, theme = "primary", appearance = "main" }) {
2848
+ const at = tokens.colors[theme][appearance];
2849
+ const borderColor = at.fontSecondary;
3057
2850
  return reactNative.StyleSheet.create({
3058
2851
  container: {
3059
2852
  flexDirection: "row",
@@ -3061,7 +2854,7 @@ function getNavbarStyles({ tokens, height, bordered }) {
3061
2854
  height,
3062
2855
  flexShrink: 0,
3063
2856
  paddingHorizontal: 24,
3064
- backgroundColor: newtone.srgbToHex(tokens.background.srgb),
2857
+ backgroundColor: at.background,
3065
2858
  borderBottomWidth: bordered ? 1 : 0,
3066
2859
  borderBottomColor: borderColor
3067
2860
  },
@@ -3087,12 +2880,52 @@ function Navbar({
3087
2880
  height = 56,
3088
2881
  bordered = true
3089
2882
  }) {
3090
- const tokens = useTokens();
3091
- const styles = React14__default.default.useMemo(
3092
- () => getNavbarStyles({ tokens, height, bordered }),
3093
- [tokens, height, bordered]
2883
+ const tokens = newtoneApi.useTokens();
2884
+ const frameCtx = newtoneApi.useFrameContext();
2885
+ const styles = React16__default.default.useMemo(
2886
+ () => getNavbarStyles({ tokens, height, bordered, theme: frameCtx?.theme, appearance: frameCtx?.appearance }),
2887
+ [tokens, height, bordered, frameCtx?.theme, frameCtx?.appearance]
2888
+ );
2889
+ return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.container }, children ? children : /* @__PURE__ */ React16__default.default.createElement(React16__default.default.Fragment, null, /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.left }, left), /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.right }, right)));
2890
+ }
2891
+ function LogoMonogram({ colorValue = 0, size = 32 }) {
2892
+ const fg = `rgb(${colorValue}, ${colorValue}, ${colorValue})`;
2893
+ return /* @__PURE__ */ React16__default.default.createElement(
2894
+ "svg",
2895
+ {
2896
+ width: size,
2897
+ height: size,
2898
+ viewBox: "0 0 168 168",
2899
+ fill: "none",
2900
+ xmlns: "http://www.w3.org/2000/svg"
2901
+ },
2902
+ /* @__PURE__ */ React16__default.default.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 }),
2903
+ /* @__PURE__ */ React16__default.default.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 }),
2904
+ /* @__PURE__ */ React16__default.default.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 }),
2905
+ /* @__PURE__ */ React16__default.default.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 }),
2906
+ /* @__PURE__ */ React16__default.default.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 })
2907
+ );
2908
+ }
2909
+ function LogoWordmark({ fill = "black" }) {
2910
+ return /* @__PURE__ */ React16__default.default.createElement(
2911
+ "svg",
2912
+ {
2913
+ height: 32,
2914
+ viewBox: "0 0 504 168",
2915
+ fill: "none",
2916
+ xmlns: "http://www.w3.org/2000/svg"
2917
+ },
2918
+ /* @__PURE__ */ React16__default.default.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 }),
2919
+ /* @__PURE__ */ React16__default.default.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 }),
2920
+ /* @__PURE__ */ React16__default.default.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 }),
2921
+ /* @__PURE__ */ React16__default.default.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 }),
2922
+ /* @__PURE__ */ React16__default.default.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 }),
2923
+ /* @__PURE__ */ React16__default.default.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 }),
2924
+ /* @__PURE__ */ React16__default.default.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 }),
2925
+ /* @__PURE__ */ React16__default.default.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 }),
2926
+ /* @__PURE__ */ React16__default.default.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 }),
2927
+ /* @__PURE__ */ React16__default.default.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 })
3094
2928
  );
3095
- return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.container }, children ? children : /* @__PURE__ */ React14__default.default.createElement(React14__default.default.Fragment, null, /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.left }, left), /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.right }, right)));
3096
2929
  }
3097
2930
 
3098
2931
  // src/registry/registry.ts
@@ -4042,59 +3875,142 @@ var ICON_CATALOG = [
4042
3875
 
4043
3876
  Object.defineProperty(exports, "DEFAULT_FONT_SIZES", {
4044
3877
  enumerable: true,
4045
- get: function () { return fonts.DEFAULT_FONT_SIZES; }
3878
+ get: function () { return newtoneApi.DEFAULT_FONT_SIZES; }
4046
3879
  });
4047
3880
  Object.defineProperty(exports, "DEFAULT_LINE_HEIGHTS", {
4048
3881
  enumerable: true,
4049
- get: function () { return fonts.DEFAULT_LINE_HEIGHTS; }
3882
+ get: function () { return newtoneApi.DEFAULT_LINE_HEIGHTS; }
4050
3883
  });
4051
3884
  Object.defineProperty(exports, "DEFAULT_ROLE_SCALES", {
4052
3885
  enumerable: true,
4053
- get: function () { return fonts.DEFAULT_ROLE_SCALES; }
3886
+ get: function () { return newtoneApi.DEFAULT_ROLE_SCALES; }
3887
+ });
3888
+ Object.defineProperty(exports, "DEFAULT_THEME_CONFIG", {
3889
+ enumerable: true,
3890
+ get: function () { return newtoneApi.DEFAULT_THEME_CONFIG; }
3891
+ });
3892
+ Object.defineProperty(exports, "DEFAULT_THEME_MAPPINGS", {
3893
+ enumerable: true,
3894
+ get: function () { return newtoneApi.DEFAULT_THEME_MAPPINGS; }
3895
+ });
3896
+ Object.defineProperty(exports, "ERROR_DEFAULTS", {
3897
+ enumerable: true,
3898
+ get: function () { return newtoneApi.ERROR_DEFAULTS; }
3899
+ });
3900
+ Object.defineProperty(exports, "FrameContext", {
3901
+ enumerable: true,
3902
+ get: function () { return newtoneApi.FrameContext; }
3903
+ });
3904
+ Object.defineProperty(exports, "NewtoneProvider", {
3905
+ enumerable: true,
3906
+ get: function () { return newtoneApi.NewtoneProvider; }
3907
+ });
3908
+ Object.defineProperty(exports, "PRIMARY_DEFAULTS", {
3909
+ enumerable: true,
3910
+ get: function () { return newtoneApi.PRIMARY_DEFAULTS; }
3911
+ });
3912
+ Object.defineProperty(exports, "SECONDARY_DEFAULTS", {
3913
+ enumerable: true,
3914
+ get: function () { return newtoneApi.SECONDARY_DEFAULTS; }
3915
+ });
3916
+ Object.defineProperty(exports, "SUCCESS_DEFAULTS", {
3917
+ enumerable: true,
3918
+ get: function () { return newtoneApi.SUCCESS_DEFAULTS; }
3919
+ });
3920
+ Object.defineProperty(exports, "TERTIARY_DEFAULTS", {
3921
+ enumerable: true,
3922
+ get: function () { return newtoneApi.TERTIARY_DEFAULTS; }
3923
+ });
3924
+ Object.defineProperty(exports, "WARNING_DEFAULTS", {
3925
+ enumerable: true,
3926
+ get: function () { return newtoneApi.WARNING_DEFAULTS; }
4054
3927
  });
4055
3928
  Object.defineProperty(exports, "buildGoogleFontsUrl", {
4056
3929
  enumerable: true,
4057
- get: function () { return fonts.buildGoogleFontsUrl; }
3930
+ get: function () { return newtoneApi.buildGoogleFontsUrl; }
3931
+ });
3932
+ Object.defineProperty(exports, "computeColors", {
3933
+ enumerable: true,
3934
+ get: function () { return newtoneApi.computeColors; }
3935
+ });
3936
+ Object.defineProperty(exports, "computeSwatches", {
3937
+ enumerable: true,
3938
+ get: function () { return newtoneApi.computeSwatches; }
3939
+ });
3940
+ Object.defineProperty(exports, "computeTokens", {
3941
+ enumerable: true,
3942
+ get: function () { return newtoneApi.computeTokens; }
3943
+ });
3944
+ Object.defineProperty(exports, "enqueueObservation", {
3945
+ enumerable: true,
3946
+ get: function () { return newtoneApi.enqueueObservation; }
3947
+ });
3948
+ Object.defineProperty(exports, "measureAvgCharWidth", {
3949
+ enumerable: true,
3950
+ get: function () { return newtoneApi.measureAvgCharWidth; }
3951
+ });
3952
+ Object.defineProperty(exports, "resolveTheme", {
3953
+ enumerable: true,
3954
+ get: function () { return newtoneApi.resolveTheme; }
3955
+ });
3956
+ Object.defineProperty(exports, "useBreakpoint", {
3957
+ enumerable: true,
3958
+ get: function () { return newtoneApi.useBreakpoint; }
3959
+ });
3960
+ Object.defineProperty(exports, "useFrameContext", {
3961
+ enumerable: true,
3962
+ get: function () { return newtoneApi.useFrameContext; }
3963
+ });
3964
+ Object.defineProperty(exports, "useLocalCalibration", {
3965
+ enumerable: true,
3966
+ get: function () { return newtoneApi.useLocalCalibration; }
3967
+ });
3968
+ Object.defineProperty(exports, "useNewtoneTheme", {
3969
+ enumerable: true,
3970
+ get: function () { return newtoneApi.useNewtoneTheme; }
3971
+ });
3972
+ Object.defineProperty(exports, "useScheme", {
3973
+ enumerable: true,
3974
+ get: function () { return newtoneApi.useScheme; }
3975
+ });
3976
+ Object.defineProperty(exports, "useTokens", {
3977
+ enumerable: true,
3978
+ get: function () { return newtoneApi.useTokens; }
3979
+ });
3980
+ Object.defineProperty(exports, "useTypographyCalibrations", {
3981
+ enumerable: true,
3982
+ get: function () { return newtoneApi.useTypographyCalibrations; }
4058
3983
  });
4059
- exports.ACCENT_DEFAULTS = ACCENT_DEFAULTS;
4060
3984
  exports.AppShell = AppShell;
4061
3985
  exports.Button = Button;
4062
3986
  exports.CATEGORIES = CATEGORIES;
4063
3987
  exports.COMPONENTS = COMPONENTS;
4064
3988
  exports.Card = Card;
3989
+ exports.Chip = Chip;
4065
3990
  exports.ColorScaleSlider = ColorScaleSlider;
4066
- exports.DEFAULT_THEME_CONFIG = DEFAULT_THEME_CONFIG;
4067
- exports.ERROR_DEFAULTS = ERROR_DEFAULTS;
3991
+ exports.ContentCard = ContentCard;
3992
+ exports.Divider = Divider;
4068
3993
  exports.Frame = Frame;
4069
3994
  exports.HueSlider = HueSlider;
4070
3995
  exports.ICON_CATALOG = ICON_CATALOG;
4071
3996
  exports.Icon = Icon;
4072
- exports.NEUTRAL_DEFAULTS = NEUTRAL_DEFAULTS;
3997
+ exports.LogoMonogram = LogoMonogram;
3998
+ exports.LogoWordmark = LogoWordmark;
4073
3999
  exports.Navbar = Navbar;
4074
- exports.NewtoneProvider = NewtoneProvider;
4075
4000
  exports.Popover = Popover;
4076
- exports.SUCCESS_DEFAULTS = SUCCESS_DEFAULTS;
4077
4001
  exports.Select = Select;
4078
4002
  exports.Sidebar = Sidebar;
4079
4003
  exports.Slider = Slider;
4080
- exports.Text = Text2;
4004
+ exports.Text = Text3;
4081
4005
  exports.TextInput = TextInput;
4082
4006
  exports.Toggle = Toggle;
4083
- exports.WARNING_DEFAULTS = WARNING_DEFAULTS;
4084
4007
  exports.Wrapper = Wrapper;
4085
- exports.computeTokens = computeTokens;
4086
4008
  exports.generateComponentCode = generateComponentCode;
4087
4009
  exports.getCategory = getCategory;
4088
4010
  exports.getComponent = getComponent;
4089
4011
  exports.getComponentsByCategory = getComponentsByCategory;
4090
4012
  exports.isOptionGroup = isOptionGroup;
4091
- exports.measureAvgCharWidth = measureAvgCharWidth;
4092
4013
  exports.useFocusVisible = useFocusVisible;
4093
- exports.useFrameContext = useFrameContext;
4094
- exports.useLocalCalibration = useLocalCalibration;
4095
- exports.useNewtoneTheme = useNewtoneTheme;
4096
4014
  exports.usePopover = usePopover;
4097
- exports.useTokens = useTokens;
4098
- exports.useTypographyCalibrations = useTypographyCalibrations;
4099
4015
  //# sourceMappingURL=index.cjs.map
4100
4016
  //# sourceMappingURL=index.cjs.map