@newtonedev/components 0.1.4 → 0.1.6

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 (255) hide show
  1. package/dist/composites/actions/Button/Button.d.ts +37 -0
  2. package/dist/composites/actions/Button/Button.d.ts.map +1 -0
  3. package/dist/composites/actions/Button/Button.styles.d.ts +65 -0
  4. package/dist/composites/actions/Button/Button.styles.d.ts.map +1 -0
  5. package/dist/{Button → composites/actions/Button}/Button.types.d.ts +12 -3
  6. package/dist/composites/actions/Button/Button.types.d.ts.map +1 -0
  7. package/dist/composites/actions/Button/index.d.ts.map +1 -0
  8. package/dist/composites/form-controls/Select/Select.d.ts.map +1 -0
  9. package/dist/{Select → composites/form-controls/Select}/Select.styles.d.ts +1 -1
  10. package/dist/composites/form-controls/Select/Select.styles.d.ts.map +1 -0
  11. package/dist/composites/form-controls/Select/Select.types.d.ts.map +1 -0
  12. package/dist/composites/form-controls/Select/SelectOption.d.ts.map +1 -0
  13. package/dist/composites/form-controls/Select/index.d.ts.map +1 -0
  14. package/dist/composites/form-controls/Select/useSelect.d.ts.map +1 -0
  15. package/dist/composites/form-controls/TextInput/TextInput.d.ts.map +1 -0
  16. package/dist/{TextInput → composites/form-controls/TextInput}/TextInput.styles.d.ts +1 -1
  17. package/dist/composites/form-controls/TextInput/TextInput.styles.d.ts.map +1 -0
  18. package/dist/composites/form-controls/TextInput/TextInput.types.d.ts.map +1 -0
  19. package/dist/composites/form-controls/TextInput/index.d.ts.map +1 -0
  20. package/dist/composites/form-controls/Toggle/Toggle.d.ts.map +1 -0
  21. package/dist/{Toggle → composites/form-controls/Toggle}/Toggle.styles.d.ts +1 -1
  22. package/dist/composites/form-controls/Toggle/Toggle.styles.d.ts.map +1 -0
  23. package/dist/composites/form-controls/Toggle/Toggle.types.d.ts.map +1 -0
  24. package/dist/composites/form-controls/Toggle/index.d.ts.map +1 -0
  25. package/dist/composites/layout/AppShell/AppShell.d.ts.map +1 -0
  26. package/dist/{AppShell → composites/layout/AppShell}/AppShell.styles.d.ts +1 -1
  27. package/dist/composites/layout/AppShell/AppShell.styles.d.ts.map +1 -0
  28. package/dist/composites/layout/AppShell/AppShell.types.d.ts.map +1 -0
  29. package/dist/composites/layout/AppShell/index.d.ts.map +1 -0
  30. package/dist/composites/layout/Card/Card.d.ts.map +1 -0
  31. package/dist/{Card → composites/layout/Card}/Card.styles.d.ts +1 -1
  32. package/dist/composites/layout/Card/Card.styles.d.ts.map +1 -0
  33. package/dist/{Card → composites/layout/Card}/Card.types.d.ts +1 -1
  34. package/dist/composites/layout/Card/Card.types.d.ts.map +1 -0
  35. package/dist/composites/layout/Card/index.d.ts.map +1 -0
  36. package/dist/composites/layout/Navbar/Navbar.d.ts.map +1 -0
  37. package/dist/{Navbar → composites/layout/Navbar}/Navbar.styles.d.ts +1 -1
  38. package/dist/composites/layout/Navbar/Navbar.styles.d.ts.map +1 -0
  39. package/dist/composites/layout/Navbar/Navbar.types.d.ts.map +1 -0
  40. package/dist/composites/layout/Navbar/index.d.ts.map +1 -0
  41. package/dist/composites/layout/Sidebar/Sidebar.d.ts.map +1 -0
  42. package/dist/{Sidebar → composites/layout/Sidebar}/Sidebar.styles.d.ts +1 -1
  43. package/dist/composites/layout/Sidebar/Sidebar.styles.d.ts.map +1 -0
  44. package/dist/composites/layout/Sidebar/Sidebar.types.d.ts.map +1 -0
  45. package/dist/composites/layout/Sidebar/index.d.ts.map +1 -0
  46. package/dist/composites/overlays/Popover/Popover.d.ts.map +1 -0
  47. package/dist/{Popover → composites/overlays/Popover}/Popover.styles.d.ts +1 -1
  48. package/dist/composites/overlays/Popover/Popover.styles.d.ts.map +1 -0
  49. package/dist/composites/overlays/Popover/Popover.types.d.ts.map +1 -0
  50. package/dist/composites/overlays/Popover/index.d.ts.map +1 -0
  51. package/dist/composites/overlays/Popover/usePopover.d.ts.map +1 -0
  52. package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.d.ts.map +1 -0
  53. package/dist/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.styles.d.ts +1 -1
  54. package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.d.ts.map +1 -0
  55. package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.types.d.ts.map +1 -0
  56. package/dist/composites/range-inputs/ColorScaleSlider/index.d.ts.map +1 -0
  57. package/dist/composites/range-inputs/HueSlider/HueSlider.d.ts.map +1 -0
  58. package/dist/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.styles.d.ts +1 -1
  59. package/dist/composites/range-inputs/HueSlider/HueSlider.styles.d.ts.map +1 -0
  60. package/dist/composites/range-inputs/HueSlider/HueSlider.types.d.ts.map +1 -0
  61. package/dist/composites/range-inputs/HueSlider/index.d.ts.map +1 -0
  62. package/dist/composites/range-inputs/Slider/Slider.d.ts.map +1 -0
  63. package/dist/{Slider → composites/range-inputs/Slider}/Slider.styles.d.ts +1 -1
  64. package/dist/composites/range-inputs/Slider/Slider.styles.d.ts.map +1 -0
  65. package/dist/composites/range-inputs/Slider/Slider.types.d.ts.map +1 -0
  66. package/dist/composites/range-inputs/Slider/index.d.ts.map +1 -0
  67. package/dist/index.cjs +1277 -764
  68. package/dist/index.cjs.map +1 -1
  69. package/dist/index.d.ts +30 -29
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +1234 -726
  72. package/dist/index.js.map +1 -1
  73. package/dist/primitives/Frame/Frame.d.ts +2 -3
  74. package/dist/primitives/Frame/Frame.d.ts.map +1 -1
  75. package/dist/primitives/Frame/Frame.types.d.ts +4 -15
  76. package/dist/primitives/Frame/Frame.types.d.ts.map +1 -1
  77. package/dist/primitives/Icon/Icon.d.ts.map +1 -1
  78. package/dist/primitives/Text/Text.d.ts.map +1 -1
  79. package/dist/primitives/Text/Text.types.d.ts +9 -4
  80. package/dist/primitives/Text/Text.types.d.ts.map +1 -1
  81. package/dist/primitives/Wrapper/Wrapper.d.ts +1 -1
  82. package/dist/primitives/Wrapper/Wrapper.types.d.ts +1 -1
  83. package/dist/registry/registry.d.ts.map +1 -1
  84. package/dist/theme/FrameContext.d.ts +7 -5
  85. package/dist/theme/FrameContext.d.ts.map +1 -1
  86. package/dist/theme/NewtoneProvider.d.ts +5 -6
  87. package/dist/theme/NewtoneProvider.d.ts.map +1 -1
  88. package/dist/theme/defaults.d.ts.map +1 -1
  89. package/dist/theme/types.d.ts +38 -24
  90. package/dist/theme/types.d.ts.map +1 -1
  91. package/dist/tokens/computeTokens.d.ts +82 -7
  92. package/dist/tokens/computeTokens.d.ts.map +1 -1
  93. package/dist/tokens/types.d.ts +66 -14
  94. package/dist/tokens/types.d.ts.map +1 -1
  95. package/dist/tokens/useTokens.d.ts +11 -14
  96. package/dist/tokens/useTokens.d.ts.map +1 -1
  97. package/package.json +1 -1
  98. package/src/composites/actions/Button/Button.styles.ts +338 -0
  99. package/src/composites/actions/Button/Button.tsx +119 -0
  100. package/src/{Button → composites/actions/Button}/Button.types.ts +14 -3
  101. package/src/{Select → composites/form-controls/Select}/Select.styles.ts +1 -1
  102. package/src/{Select → composites/form-controls/Select}/Select.tsx +4 -4
  103. package/src/{Select → composites/form-controls/Select}/SelectOption.tsx +4 -4
  104. package/src/{TextInput → composites/form-controls/TextInput}/TextInput.styles.ts +1 -1
  105. package/src/{TextInput → composites/form-controls/TextInput}/TextInput.tsx +1 -1
  106. package/src/{Toggle → composites/form-controls/Toggle}/Toggle.styles.ts +2 -2
  107. package/src/{Toggle → composites/form-controls/Toggle}/Toggle.tsx +1 -1
  108. package/src/{AppShell → composites/layout/AppShell}/AppShell.styles.ts +1 -1
  109. package/src/{AppShell → composites/layout/AppShell}/AppShell.tsx +1 -1
  110. package/src/{Card → composites/layout/Card}/Card.styles.ts +1 -1
  111. package/src/{Card → composites/layout/Card}/Card.tsx +1 -1
  112. package/src/{Card → composites/layout/Card}/Card.types.ts +1 -1
  113. package/src/{Navbar → composites/layout/Navbar}/Navbar.styles.ts +1 -1
  114. package/src/{Navbar → composites/layout/Navbar}/Navbar.tsx +1 -1
  115. package/src/{Sidebar → composites/layout/Sidebar}/Sidebar.styles.ts +1 -1
  116. package/src/{Sidebar → composites/layout/Sidebar}/Sidebar.tsx +1 -1
  117. package/src/{Popover → composites/overlays/Popover}/Popover.styles.ts +1 -1
  118. package/src/{Popover → composites/overlays/Popover}/Popover.tsx +1 -1
  119. package/src/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.styles.ts +2 -2
  120. package/src/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.tsx +1 -1
  121. package/src/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.styles.ts +1 -1
  122. package/src/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.tsx +1 -1
  123. package/src/{Slider → composites/range-inputs/Slider}/Slider.styles.ts +3 -3
  124. package/src/{Slider → composites/range-inputs/Slider}/Slider.tsx +1 -1
  125. package/src/index.ts +40 -33
  126. package/src/primitives/Frame/Frame.tsx +10 -18
  127. package/src/primitives/Frame/Frame.types.ts +5 -17
  128. package/src/primitives/Icon/Icon.tsx +16 -1
  129. package/src/primitives/Text/Text.tsx +18 -8
  130. package/src/primitives/Text/Text.types.ts +9 -4
  131. package/src/primitives/Wrapper/Wrapper.tsx +1 -1
  132. package/src/primitives/Wrapper/Wrapper.types.ts +1 -1
  133. package/src/registry/registry.ts +239 -6
  134. package/src/theme/FrameContext.tsx +7 -5
  135. package/src/theme/NewtoneProvider.tsx +5 -10
  136. package/src/theme/defaults.ts +0 -9
  137. package/src/theme/types.ts +53 -26
  138. package/src/tokens/computeTokens.ts +351 -113
  139. package/src/tokens/types.ts +82 -14
  140. package/src/tokens/useTokens.ts +29 -24
  141. package/dist/AppShell/AppShell.d.ts.map +0 -1
  142. package/dist/AppShell/AppShell.styles.d.ts.map +0 -1
  143. package/dist/AppShell/AppShell.types.d.ts.map +0 -1
  144. package/dist/AppShell/index.d.ts.map +0 -1
  145. package/dist/Button/Button.d.ts +0 -28
  146. package/dist/Button/Button.d.ts.map +0 -1
  147. package/dist/Button/Button.styles.d.ts +0 -46
  148. package/dist/Button/Button.styles.d.ts.map +0 -1
  149. package/dist/Button/Button.types.d.ts.map +0 -1
  150. package/dist/Button/index.d.ts.map +0 -1
  151. package/dist/Card/Card.d.ts.map +0 -1
  152. package/dist/Card/Card.styles.d.ts.map +0 -1
  153. package/dist/Card/Card.types.d.ts.map +0 -1
  154. package/dist/Card/index.d.ts.map +0 -1
  155. package/dist/ColorScaleSlider/ColorScaleSlider.d.ts.map +0 -1
  156. package/dist/ColorScaleSlider/ColorScaleSlider.styles.d.ts.map +0 -1
  157. package/dist/ColorScaleSlider/ColorScaleSlider.types.d.ts.map +0 -1
  158. package/dist/ColorScaleSlider/index.d.ts.map +0 -1
  159. package/dist/HueSlider/HueSlider.d.ts.map +0 -1
  160. package/dist/HueSlider/HueSlider.styles.d.ts.map +0 -1
  161. package/dist/HueSlider/HueSlider.types.d.ts.map +0 -1
  162. package/dist/HueSlider/index.d.ts.map +0 -1
  163. package/dist/Navbar/Navbar.d.ts.map +0 -1
  164. package/dist/Navbar/Navbar.styles.d.ts.map +0 -1
  165. package/dist/Navbar/Navbar.types.d.ts.map +0 -1
  166. package/dist/Navbar/index.d.ts.map +0 -1
  167. package/dist/Popover/Popover.d.ts.map +0 -1
  168. package/dist/Popover/Popover.styles.d.ts.map +0 -1
  169. package/dist/Popover/Popover.types.d.ts.map +0 -1
  170. package/dist/Popover/index.d.ts.map +0 -1
  171. package/dist/Popover/usePopover.d.ts.map +0 -1
  172. package/dist/Select/Select.d.ts.map +0 -1
  173. package/dist/Select/Select.styles.d.ts.map +0 -1
  174. package/dist/Select/Select.types.d.ts.map +0 -1
  175. package/dist/Select/SelectOption.d.ts.map +0 -1
  176. package/dist/Select/index.d.ts.map +0 -1
  177. package/dist/Select/useSelect.d.ts.map +0 -1
  178. package/dist/Sidebar/Sidebar.d.ts.map +0 -1
  179. package/dist/Sidebar/Sidebar.styles.d.ts.map +0 -1
  180. package/dist/Sidebar/Sidebar.types.d.ts.map +0 -1
  181. package/dist/Sidebar/index.d.ts.map +0 -1
  182. package/dist/Slider/Slider.d.ts.map +0 -1
  183. package/dist/Slider/Slider.styles.d.ts.map +0 -1
  184. package/dist/Slider/Slider.types.d.ts.map +0 -1
  185. package/dist/Slider/index.d.ts.map +0 -1
  186. package/dist/TextInput/TextInput.d.ts.map +0 -1
  187. package/dist/TextInput/TextInput.styles.d.ts.map +0 -1
  188. package/dist/TextInput/TextInput.types.d.ts.map +0 -1
  189. package/dist/TextInput/index.d.ts.map +0 -1
  190. package/dist/Toggle/Toggle.d.ts.map +0 -1
  191. package/dist/Toggle/Toggle.styles.d.ts.map +0 -1
  192. package/dist/Toggle/Toggle.types.d.ts.map +0 -1
  193. package/dist/Toggle/index.d.ts.map +0 -1
  194. package/src/Button/Button.styles.ts +0 -133
  195. package/src/Button/Button.tsx +0 -86
  196. /package/dist/{Button → composites/actions/Button}/index.d.ts +0 -0
  197. /package/dist/{Select → composites/form-controls/Select}/Select.d.ts +0 -0
  198. /package/dist/{Select → composites/form-controls/Select}/Select.types.d.ts +0 -0
  199. /package/dist/{Select → composites/form-controls/Select}/SelectOption.d.ts +0 -0
  200. /package/dist/{Select → composites/form-controls/Select}/index.d.ts +0 -0
  201. /package/dist/{Select → composites/form-controls/Select}/useSelect.d.ts +0 -0
  202. /package/dist/{TextInput → composites/form-controls/TextInput}/TextInput.d.ts +0 -0
  203. /package/dist/{TextInput → composites/form-controls/TextInput}/TextInput.types.d.ts +0 -0
  204. /package/dist/{TextInput → composites/form-controls/TextInput}/index.d.ts +0 -0
  205. /package/dist/{Toggle → composites/form-controls/Toggle}/Toggle.d.ts +0 -0
  206. /package/dist/{Toggle → composites/form-controls/Toggle}/Toggle.types.d.ts +0 -0
  207. /package/dist/{Toggle → composites/form-controls/Toggle}/index.d.ts +0 -0
  208. /package/dist/{AppShell → composites/layout/AppShell}/AppShell.d.ts +0 -0
  209. /package/dist/{AppShell → composites/layout/AppShell}/AppShell.types.d.ts +0 -0
  210. /package/dist/{AppShell → composites/layout/AppShell}/index.d.ts +0 -0
  211. /package/dist/{Card → composites/layout/Card}/Card.d.ts +0 -0
  212. /package/dist/{Card → composites/layout/Card}/index.d.ts +0 -0
  213. /package/dist/{Navbar → composites/layout/Navbar}/Navbar.d.ts +0 -0
  214. /package/dist/{Navbar → composites/layout/Navbar}/Navbar.types.d.ts +0 -0
  215. /package/dist/{Navbar → composites/layout/Navbar}/index.d.ts +0 -0
  216. /package/dist/{Sidebar → composites/layout/Sidebar}/Sidebar.d.ts +0 -0
  217. /package/dist/{Sidebar → composites/layout/Sidebar}/Sidebar.types.d.ts +0 -0
  218. /package/dist/{Sidebar → composites/layout/Sidebar}/index.d.ts +0 -0
  219. /package/dist/{Popover → composites/overlays/Popover}/Popover.d.ts +0 -0
  220. /package/dist/{Popover → composites/overlays/Popover}/Popover.types.d.ts +0 -0
  221. /package/dist/{Popover → composites/overlays/Popover}/index.d.ts +0 -0
  222. /package/dist/{Popover → composites/overlays/Popover}/usePopover.d.ts +0 -0
  223. /package/dist/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.d.ts +0 -0
  224. /package/dist/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.types.d.ts +0 -0
  225. /package/dist/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/index.d.ts +0 -0
  226. /package/dist/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.d.ts +0 -0
  227. /package/dist/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.types.d.ts +0 -0
  228. /package/dist/{HueSlider → composites/range-inputs/HueSlider}/index.d.ts +0 -0
  229. /package/dist/{Slider → composites/range-inputs/Slider}/Slider.d.ts +0 -0
  230. /package/dist/{Slider → composites/range-inputs/Slider}/Slider.types.d.ts +0 -0
  231. /package/dist/{Slider → composites/range-inputs/Slider}/index.d.ts +0 -0
  232. /package/src/{Button → composites/actions/Button}/index.ts +0 -0
  233. /package/src/{Select → composites/form-controls/Select}/Select.types.ts +0 -0
  234. /package/src/{Select → composites/form-controls/Select}/index.ts +0 -0
  235. /package/src/{Select → composites/form-controls/Select}/useSelect.ts +0 -0
  236. /package/src/{TextInput → composites/form-controls/TextInput}/TextInput.types.ts +0 -0
  237. /package/src/{TextInput → composites/form-controls/TextInput}/index.ts +0 -0
  238. /package/src/{Toggle → composites/form-controls/Toggle}/Toggle.types.ts +0 -0
  239. /package/src/{Toggle → composites/form-controls/Toggle}/index.ts +0 -0
  240. /package/src/{AppShell → composites/layout/AppShell}/AppShell.types.ts +0 -0
  241. /package/src/{AppShell → composites/layout/AppShell}/index.ts +0 -0
  242. /package/src/{Card → composites/layout/Card}/index.ts +0 -0
  243. /package/src/{Navbar → composites/layout/Navbar}/Navbar.types.ts +0 -0
  244. /package/src/{Navbar → composites/layout/Navbar}/index.ts +0 -0
  245. /package/src/{Sidebar → composites/layout/Sidebar}/Sidebar.types.ts +0 -0
  246. /package/src/{Sidebar → composites/layout/Sidebar}/index.ts +0 -0
  247. /package/src/{Popover → composites/overlays/Popover}/Popover.types.ts +0 -0
  248. /package/src/{Popover → composites/overlays/Popover}/index.ts +0 -0
  249. /package/src/{Popover → composites/overlays/Popover}/usePopover.ts +0 -0
  250. /package/src/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.types.ts +0 -0
  251. /package/src/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/index.ts +0 -0
  252. /package/src/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.types.ts +0 -0
  253. /package/src/{HueSlider → composites/range-inputs/HueSlider}/index.ts +0 -0
  254. /package/src/{Slider → composites/range-inputs/Slider}/Slider.types.ts +0 -0
  255. /package/src/{Slider → composites/range-inputs/Slider}/index.ts +0 -0
package/dist/index.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var React11 = require('react');
3
+ var React13 = require('react');
4
4
  var newtone = require('newtone');
5
5
  var reactNative = require('react-native');
6
6
 
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
- var React11__default = /*#__PURE__*/_interopDefault(React11);
9
+ var React13__default = /*#__PURE__*/_interopDefault(React13);
10
10
 
11
11
  // src/theme/NewtoneProvider.tsx
12
12
  var DEFAULT_THEME_CONFIG = {
@@ -23,16 +23,6 @@ var DEFAULT_THEME_CONFIG = {
23
23
  { hue: newtone.DEFAULT_ERROR_HUE, saturation: newtone.DEFAULT_ERROR_SATURATION }
24
24
  ]
25
25
  },
26
- themes: {
27
- neutral: { paletteIndex: 0, lightModeNv: 0.95, darkModeNv: 0.1 },
28
- primary: { paletteIndex: 1, lightModeNv: 0.95, darkModeNv: 0.1 },
29
- secondary: { paletteIndex: 1, lightModeNv: 0.85, darkModeNv: 0.15 },
30
- strong: { paletteIndex: 0, lightModeNv: 0.1, darkModeNv: 0.95 }
31
- },
32
- elevation: {
33
- offsets: [-0.02, 0, 0.04]
34
- // [sunken, default, elevated]
35
- },
36
26
  spacing: {
37
27
  "00": 0,
38
28
  // base * 0
@@ -131,8 +121,8 @@ function buildGoogleFontsUrl(fonts) {
131
121
 
132
122
  // src/fonts/GoogleFontLoader.tsx
133
123
  function GoogleFontLoader({ fonts }) {
134
- const linkRef = React11.useRef(null);
135
- React11.useEffect(() => {
124
+ const linkRef = React13.useRef(null);
125
+ React13.useEffect(() => {
136
126
  if (typeof document === "undefined") return;
137
127
  const url = buildGoogleFontsUrl(fonts);
138
128
  if (linkRef.current) {
@@ -164,8 +154,8 @@ function GoogleFontLoader({ fonts }) {
164
154
  return null;
165
155
  }
166
156
  function IconFontLoader({ icons }) {
167
- const linkRef = React11.useRef(null);
168
- React11.useEffect(() => {
157
+ const linkRef = React13.useRef(null);
158
+ React13.useEffect(() => {
169
159
  if (typeof document === "undefined") return;
170
160
  const variantName = icons.variant.charAt(0).toUpperCase() + icons.variant.slice(1);
171
161
  const family = `Material+Symbols+${variantName}`;
@@ -192,51 +182,188 @@ function IconFontLoader({ icons }) {
192
182
  }
193
183
 
194
184
  // src/theme/NewtoneProvider.tsx
195
- var ThemeContext = React11.createContext(null);
185
+ var ThemeContext = React13.createContext(null);
196
186
  function NewtoneProvider({
197
187
  config = DEFAULT_THEME_CONFIG,
198
188
  initialMode = "light",
199
- initialTheme = "neutral",
200
189
  children
201
190
  }) {
202
- const [mode, setMode] = React11.useState(initialMode);
203
- const [theme, setTheme] = React11.useState(initialTheme);
204
- const value = React11.useMemo(
191
+ const [mode, setMode] = React13.useState(initialMode);
192
+ const value = React13.useMemo(
205
193
  () => ({
206
194
  config,
207
195
  mode,
208
- theme,
209
- setMode,
210
- setTheme
196
+ setMode
211
197
  }),
212
- [config, mode, theme]
198
+ [config, mode]
213
199
  );
214
- return /* @__PURE__ */ React11__default.default.createElement(ThemeContext.Provider, { value }, /* @__PURE__ */ React11__default.default.createElement(GoogleFontLoader, { fonts: config.typography.fonts }), /* @__PURE__ */ React11__default.default.createElement(IconFontLoader, { icons: config.icons }), children);
200
+ return /* @__PURE__ */ React13__default.default.createElement(ThemeContext.Provider, { value }, /* @__PURE__ */ React13__default.default.createElement(GoogleFontLoader, { fonts: config.typography.fonts }), /* @__PURE__ */ React13__default.default.createElement(IconFontLoader, { icons: config.icons }), children);
215
201
  }
216
202
  function useNewtoneTheme() {
217
- const context = React11.useContext(ThemeContext);
203
+ const context = React13.useContext(ThemeContext);
218
204
  if (!context) {
219
205
  throw new Error("useNewtoneTheme must be used within NewtoneProvider");
220
206
  }
221
207
  return context;
222
208
  }
223
- var FrameContext = React11.createContext(null);
209
+ var FrameContext = React13.createContext(null);
224
210
  function useFrameContext() {
225
- return React11.useContext(FrameContext);
226
- }
211
+ return React13.useContext(FrameContext);
212
+ }
213
+ var NEUTRAL_DEFAULTS = {
214
+ light: {
215
+ background: { elevated: 0, ground: 0.03, sunken: 0.06 },
216
+ text: { primary: 0.9, secondary: 0.7, tertiary: 0.5, disabled: 0.3 },
217
+ action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
218
+ border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
219
+ },
220
+ dark: {
221
+ background: { elevated: 0.24, ground: 0.2, sunken: 0.16 },
222
+ text: { primary: 1, secondary: 0.85, tertiary: 0.7, disabled: 0.55 },
223
+ action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
224
+ border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
225
+ }
226
+ };
227
+ var ACCENT_DEFAULTS = {
228
+ light: {
229
+ background: { elevated: 0, ground: 0.03, sunken: 0.06 },
230
+ text: { primary: 0.9, secondary: 0.7, tertiary: 0.5, disabled: 0.3 },
231
+ action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
232
+ border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
233
+ },
234
+ dark: {
235
+ background: { elevated: 0.24, ground: 0.2, sunken: 0.16 },
236
+ text: { primary: 1, secondary: 0.85, tertiary: 0.7, disabled: 0.55 },
237
+ action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
238
+ border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
239
+ }
240
+ };
241
+ var SUCCESS_DEFAULTS = {
242
+ light: {
243
+ background: { elevated: 0, ground: 0.03, sunken: 0.06 },
244
+ text: { primary: 0.9, secondary: 0.7, tertiary: 0.5, disabled: 0.3 },
245
+ action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
246
+ border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
247
+ },
248
+ dark: {
249
+ background: { elevated: 0.24, ground: 0.2, sunken: 0.16 },
250
+ text: { primary: 1, secondary: 0.85, tertiary: 0.7, disabled: 0.55 },
251
+ action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
252
+ border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
253
+ }
254
+ };
255
+ var WARNING_DEFAULTS = {
256
+ light: {
257
+ background: { elevated: 0, ground: 0.03, sunken: 0.06 },
258
+ text: { primary: 0.9, secondary: 0.7, tertiary: 0.5, disabled: 0.3 },
259
+ action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
260
+ border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
261
+ },
262
+ dark: {
263
+ background: { elevated: 0.24, ground: 0.2, sunken: 0.16 },
264
+ text: { primary: 1, secondary: 0.85, tertiary: 0.7, disabled: 0.55 },
265
+ action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
266
+ border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
267
+ }
268
+ };
269
+ var ERROR_DEFAULTS = {
270
+ light: {
271
+ background: { elevated: 0, ground: 0.03, sunken: 0.06 },
272
+ text: { primary: 0.9, secondary: 0.7, tertiary: 0.5, disabled: 0.3 },
273
+ action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
274
+ border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
275
+ },
276
+ dark: {
277
+ background: { elevated: 0.24, ground: 0.2, sunken: 0.16 },
278
+ text: { primary: 1, secondary: 0.85, tertiary: 0.7, disabled: 0.55 },
279
+ action: { enabled: 0.04, hovered: 0.06, pressed: 0.08 },
280
+ border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
281
+ }
282
+ };
227
283
  function fontConfigToFamily(font) {
228
284
  const family = font.family.includes(" ") ? `"${font.family}"` : font.family;
229
285
  return `${family}, ${font.fallback}`;
230
286
  }
231
- function computeTokens(config, mode, themeMapping, elevation, elevationOffsets, spacing, radius, typography, icons) {
287
+ var clamp = (n) => Math.max(0, Math.min(1, n));
288
+ function computePaletteTokens(palette, defaults, mode, elevation, dynamicRange, elevationDelta, effectiveTextMode, autoAccentNv, neutralTextPrimary, neutralBgElevated) {
289
+ const modeDefaults = defaults[mode];
290
+ const toEngineNv = (nv) => mode === "light" ? 1 - nv : nv;
291
+ const textToEngineNv = (nv) => effectiveTextMode === "light" ? 1 - nv : nv;
292
+ const colorAt = (engineNv) => newtone.getColor(
293
+ palette.hue,
294
+ palette.saturation,
295
+ dynamicRange,
296
+ clamp(engineNv),
297
+ palette.desaturation,
298
+ palette.paletteHueGrading
299
+ );
300
+ const resolveKeyNv = (p) => mode === "dark" ? p.keyNormalizedValueDark : p.keyNormalizedValue;
301
+ const keyNv = resolveKeyNv(palette);
302
+ const fillBaseNv = keyNv ?? autoAccentNv;
303
+ const fillNv = clamp(fillBaseNv + elevationDelta);
304
+ const fill = colorAt(fillNv);
305
+ const hoverDir = effectiveTextMode === "light" ? -modeDefaults.action.hovered : modeDefaults.action.hovered;
306
+ const activeDir = effectiveTextMode === "light" ? -modeDefaults.action.pressed : modeDefaults.action.pressed;
307
+ const fillHover = colorAt(clamp(fillNv + hoverDir));
308
+ const fillActive = colorAt(clamp(fillNv + activeDir));
309
+ const onFill = fill.oklch.L > 0.6 ? neutralTextPrimary : neutralBgElevated;
310
+ const bgNormalized = elevation === 2 ? modeDefaults.background.elevated : elevation === 1 ? modeDefaults.background.ground : modeDefaults.background.sunken;
311
+ const bgNv = clamp(toEngineNv(bgNormalized));
312
+ const background = colorAt(bgNv);
313
+ const backgroundElevated = colorAt(clamp(toEngineNv(modeDefaults.background.elevated)));
314
+ const backgroundSunken = colorAt(clamp(toEngineNv(modeDefaults.background.sunken)));
315
+ const interactiveOffset = modeDefaults.action.enabled;
316
+ const interactiveNv = clamp(bgNv + (effectiveTextMode === "light" ? -interactiveOffset : interactiveOffset));
317
+ const backgroundInteractive = colorAt(interactiveNv);
318
+ const hoverShift = modeDefaults.action.hovered;
319
+ const activeShift = modeDefaults.action.pressed;
320
+ const backgroundInteractiveHover = colorAt(clamp(interactiveNv + (effectiveTextMode === "light" ? -hoverShift : hoverShift)));
321
+ const backgroundInteractiveActive = colorAt(clamp(interactiveNv + (effectiveTextMode === "light" ? -activeShift : activeShift)));
322
+ const textPrimary = colorAt(clamp(textToEngineNv(modeDefaults.text.primary) + elevationDelta));
323
+ const textSecondary = colorAt(clamp(textToEngineNv(modeDefaults.text.secondary) + elevationDelta));
324
+ const textTertiary = colorAt(clamp(textToEngineNv(modeDefaults.text.tertiary) + elevationDelta));
325
+ const textDisabled = colorAt(clamp(textToEngineNv(modeDefaults.text.disabled) + elevationDelta));
326
+ const borderOffset = modeDefaults.border.enabled;
327
+ const borderNv = effectiveTextMode === "light" ? bgNv - borderOffset : bgNv + borderOffset;
328
+ const border = colorAt(clamp(borderNv));
329
+ return {
330
+ fill,
331
+ fillHover,
332
+ fillActive,
333
+ onFill,
334
+ background,
335
+ backgroundElevated,
336
+ backgroundSunken,
337
+ backgroundInteractive,
338
+ backgroundInteractiveHover,
339
+ backgroundInteractiveActive,
340
+ textPrimary,
341
+ textSecondary,
342
+ textTertiary,
343
+ textDisabled,
344
+ border
345
+ };
346
+ }
347
+ function computeTokens(config, mode, elevation, spacing, radius, typography, icons, tokenOverrides) {
232
348
  const { dynamicRange, palettes } = config;
233
- const palette = palettes[themeMapping.paletteIndex];
349
+ const palette = palettes[0];
234
350
  if (!palette) {
235
- throw new Error(`Palette at index ${themeMapping.paletteIndex} not found`);
351
+ throw new Error("Neutral palette (index 0) not found");
236
352
  }
237
- const baseNv = mode === "light" ? themeMapping.lightModeNv : themeMapping.darkModeNv;
238
- const elevationOffset = elevationOffsets[elevation];
239
- const backgroundNv = Math.max(0, Math.min(1, baseNv + elevationOffset));
353
+ const neutralDefaults = NEUTRAL_DEFAULTS[mode];
354
+ const toEngineNv = (nv) => mode === "light" ? 1 - nv : nv;
355
+ const bgElevatedNorm = mode === "light" ? tokenOverrides?.backgroundElevated : tokenOverrides?.backgroundElevatedDark;
356
+ const bgDefaultNorm = mode === "light" ? tokenOverrides?.backgroundDefault : tokenOverrides?.backgroundDefaultDark;
357
+ const bgSunkenNorm = mode === "light" ? tokenOverrides?.backgroundSunken : tokenOverrides?.backgroundSunkenDark;
358
+ const textPrimaryNorm = mode === "light" ? tokenOverrides?.textPrimaryNormalized : tokenOverrides?.textPrimaryNormalizedDark;
359
+ const textSecondaryNorm = mode === "light" ? tokenOverrides?.textSecondaryNormalized : tokenOverrides?.textSecondaryNormalizedDark;
360
+ const textTertiaryNorm = mode === "light" ? tokenOverrides?.textTertiaryNormalized : tokenOverrides?.textTertiaryNormalizedDark;
361
+ const textDisabledNorm = mode === "light" ? tokenOverrides?.textDisabledNormalized : tokenOverrides?.textDisabledNormalizedDark;
362
+ const bgNormalized = elevation === 2 ? bgElevatedNorm ?? neutralDefaults.background.elevated : elevation === 1 ? bgDefaultNorm ?? neutralDefaults.background.ground : bgSunkenNorm ?? neutralDefaults.background.sunken;
363
+ const backgroundNv = clamp(toEngineNv(bgNormalized));
364
+ const elevatedNv = clamp(toEngineNv(bgElevatedNorm ?? neutralDefaults.background.elevated));
365
+ const sunkenNv = clamp(toEngineNv(bgSunkenNorm ?? neutralDefaults.background.sunken));
366
+ const elevationDelta = backgroundNv - elevatedNv;
240
367
  const effectiveTextMode = backgroundNv >= 0.5 ? "light" : "dark";
241
368
  const background = newtone.getColor(
242
369
  palette.hue,
@@ -246,7 +373,6 @@ function computeTokens(config, mode, themeMapping, elevation, elevationOffsets,
246
373
  palette.desaturation,
247
374
  palette.paletteHueGrading
248
375
  );
249
- const elevatedNv = Math.max(0, Math.min(1, baseNv + elevationOffsets[2]));
250
376
  const backgroundElevated = newtone.getColor(
251
377
  palette.hue,
252
378
  palette.saturation,
@@ -255,7 +381,6 @@ function computeTokens(config, mode, themeMapping, elevation, elevationOffsets,
255
381
  palette.desaturation,
256
382
  palette.paletteHueGrading
257
383
  );
258
- const sunkenNv = Math.max(0, Math.min(1, baseNv + elevationOffsets[0]));
259
384
  const backgroundSunken = newtone.getColor(
260
385
  palette.hue,
261
386
  palette.saturation,
@@ -264,142 +389,148 @@ function computeTokens(config, mode, themeMapping, elevation, elevationOffsets,
264
389
  palette.desaturation,
265
390
  palette.paletteHueGrading
266
391
  );
267
- const textPrimary = newtone.getColorByContrast(
392
+ const INTERACTIVE_COMPONENT_OFFSET = mode === "light" ? tokenOverrides?.interactiveComponentOffset ?? neutralDefaults.action.enabled : tokenOverrides?.interactiveComponentOffsetDark ?? neutralDefaults.action.enabled;
393
+ const HOVER_SHIFT = mode === "light" ? tokenOverrides?.hoverShift ?? neutralDefaults.action.hovered : tokenOverrides?.hoverShiftDark ?? neutralDefaults.action.hovered;
394
+ const ACTIVE_SHIFT = mode === "light" ? tokenOverrides?.activeShift ?? neutralDefaults.action.pressed : tokenOverrides?.activeShiftDark ?? neutralDefaults.action.pressed;
395
+ const BORDER_OFFSET = mode === "light" ? tokenOverrides?.borderOffset ?? neutralDefaults.border.enabled : tokenOverrides?.borderOffsetDark ?? neutralDefaults.border.enabled;
396
+ const interactiveComponentNv = clamp(backgroundNv + (effectiveTextMode === "light" ? -INTERACTIVE_COMPONENT_OFFSET : INTERACTIVE_COMPONENT_OFFSET));
397
+ const backgroundInteractive = newtone.getColor(
268
398
  palette.hue,
269
399
  palette.saturation,
270
400
  dynamicRange,
271
- 4.5,
272
- effectiveTextMode,
401
+ interactiveComponentNv,
273
402
  palette.desaturation,
274
- palette.paletteHueGrading,
275
- background
403
+ palette.paletteHueGrading
276
404
  );
277
- const textSecondary = newtone.getColorByContrast(
405
+ const neutralHoverNv = clamp(interactiveComponentNv + (effectiveTextMode === "light" ? -HOVER_SHIFT : HOVER_SHIFT));
406
+ const backgroundInteractiveHover = newtone.getColor(
278
407
  palette.hue,
279
408
  palette.saturation,
280
409
  dynamicRange,
281
- 3,
282
- effectiveTextMode,
410
+ neutralHoverNv,
283
411
  palette.desaturation,
284
- palette.paletteHueGrading,
285
- background
412
+ palette.paletteHueGrading
286
413
  );
287
- const accentPalette = palettes[1];
288
- if (!accentPalette) {
289
- throw new Error("Accent palette (index 1) not found");
290
- }
291
- const resolveKeyNv = (p) => mode === "dark" ? p.keyNormalizedValueDark : p.keyNormalizedValue;
292
- const accentKeyNv = resolveKeyNv(accentPalette);
293
- const interactive = accentKeyNv !== void 0 ? newtone.getColor(
294
- accentPalette.hue,
295
- accentPalette.saturation,
414
+ const neutralActiveNv = clamp(interactiveComponentNv + (effectiveTextMode === "light" ? -ACTIVE_SHIFT : ACTIVE_SHIFT));
415
+ const backgroundInteractiveActive = newtone.getColor(
416
+ palette.hue,
417
+ palette.saturation,
296
418
  dynamicRange,
297
- accentKeyNv,
298
- accentPalette.desaturation,
299
- accentPalette.paletteHueGrading
300
- ) : newtone.getColorByContrast(
301
- accentPalette.hue,
302
- accentPalette.saturation,
419
+ neutralActiveNv,
420
+ palette.desaturation,
421
+ palette.paletteHueGrading
422
+ );
423
+ const textToEngineNv = (nv) => effectiveTextMode === "light" ? 1 - nv : nv;
424
+ const textPrimary = newtone.getColor(
425
+ palette.hue,
426
+ palette.saturation,
303
427
  dynamicRange,
304
- 4.5,
305
- effectiveTextMode,
306
- accentPalette.desaturation,
307
- accentPalette.paletteHueGrading,
308
- background
428
+ clamp(textToEngineNv(textPrimaryNorm ?? neutralDefaults.text.primary) + elevationDelta),
429
+ palette.desaturation,
430
+ palette.paletteHueGrading
309
431
  );
310
- const interactiveNv = accentKeyNv ?? (effectiveTextMode === "light" ? 0.3 : 0.7);
311
- const interactiveHover = newtone.getColor(
312
- accentPalette.hue,
313
- accentPalette.saturation,
432
+ const textSecondary = newtone.getColor(
433
+ palette.hue,
434
+ palette.saturation,
314
435
  dynamicRange,
315
- interactiveNv + (effectiveTextMode === "light" ? -0.05 : 0.05),
316
- accentPalette.desaturation,
317
- accentPalette.paletteHueGrading
436
+ clamp(textToEngineNv(textSecondaryNorm ?? neutralDefaults.text.secondary) + elevationDelta),
437
+ palette.desaturation,
438
+ palette.paletteHueGrading
318
439
  );
319
- const interactiveActive = newtone.getColor(
320
- accentPalette.hue,
321
- accentPalette.saturation,
440
+ const textTertiary = newtone.getColor(
441
+ palette.hue,
442
+ palette.saturation,
443
+ dynamicRange,
444
+ clamp(textToEngineNv(textTertiaryNorm ?? neutralDefaults.text.tertiary) + elevationDelta),
445
+ palette.desaturation,
446
+ palette.paletteHueGrading
447
+ );
448
+ const textDisabled = newtone.getColor(
449
+ palette.hue,
450
+ palette.saturation,
322
451
  dynamicRange,
323
- interactiveNv + (effectiveTextMode === "light" ? -0.1 : 0.1),
324
- accentPalette.desaturation,
325
- accentPalette.paletteHueGrading
452
+ clamp(textToEngineNv(textDisabledNorm ?? neutralDefaults.text.disabled) + elevationDelta),
453
+ palette.desaturation,
454
+ palette.paletteHueGrading
326
455
  );
327
- const borderNv = effectiveTextMode === "light" ? backgroundNv - 0.1 : backgroundNv + 0.1;
456
+ const borderNv = effectiveTextMode === "light" ? backgroundNv - BORDER_OFFSET : backgroundNv + BORDER_OFFSET;
328
457
  const border = newtone.getColor(
329
458
  palette.hue,
330
459
  palette.saturation,
331
460
  dynamicRange,
332
- Math.max(0, Math.min(1, borderNv)),
461
+ clamp(borderNv),
333
462
  palette.desaturation,
334
463
  palette.paletteHueGrading
335
464
  );
465
+ const autoAccentNv = clamp(textToEngineNv(textPrimaryNorm ?? neutralDefaults.text.primary));
466
+ const accentPalette = palettes[1];
467
+ if (!accentPalette) {
468
+ throw new Error("Accent palette (index 1) not found");
469
+ }
470
+ const accent = computePaletteTokens(
471
+ accentPalette,
472
+ ACCENT_DEFAULTS,
473
+ mode,
474
+ elevation,
475
+ dynamicRange,
476
+ elevationDelta,
477
+ effectiveTextMode,
478
+ autoAccentNv,
479
+ textPrimary,
480
+ backgroundElevated
481
+ );
336
482
  const successPalette = palettes[2];
337
483
  const warningPalette = palettes[3];
338
484
  const errorPalette = palettes[4];
339
- const successKeyNv = successPalette ? resolveKeyNv(successPalette) : void 0;
340
- const success = successPalette ? successKeyNv !== void 0 ? newtone.getColor(
341
- successPalette.hue,
342
- successPalette.saturation,
485
+ const success = successPalette ? computePaletteTokens(
486
+ successPalette,
487
+ SUCCESS_DEFAULTS,
488
+ mode,
489
+ elevation,
343
490
  dynamicRange,
344
- successKeyNv,
345
- successPalette.desaturation,
346
- successPalette.paletteHueGrading
347
- ) : newtone.getColorByContrast(
348
- successPalette.hue,
349
- successPalette.saturation,
350
- dynamicRange,
351
- 4.5,
491
+ elevationDelta,
352
492
  effectiveTextMode,
353
- successPalette.desaturation,
354
- successPalette.paletteHueGrading,
355
- background
356
- ) : interactive;
357
- const warningKeyNv = warningPalette ? resolveKeyNv(warningPalette) : void 0;
358
- const warning = warningPalette ? warningKeyNv !== void 0 ? newtone.getColor(
359
- warningPalette.hue,
360
- warningPalette.saturation,
361
- dynamicRange,
362
- warningKeyNv,
363
- warningPalette.desaturation,
364
- warningPalette.paletteHueGrading
365
- ) : newtone.getColorByContrast(
366
- warningPalette.hue,
367
- warningPalette.saturation,
493
+ autoAccentNv,
494
+ textPrimary,
495
+ backgroundElevated
496
+ ) : accent;
497
+ const warning = warningPalette ? computePaletteTokens(
498
+ warningPalette,
499
+ WARNING_DEFAULTS,
500
+ mode,
501
+ elevation,
368
502
  dynamicRange,
369
- 4.5,
503
+ elevationDelta,
370
504
  effectiveTextMode,
371
- warningPalette.desaturation,
372
- warningPalette.paletteHueGrading,
373
- background
374
- ) : interactive;
375
- const errorKeyNv = errorPalette ? resolveKeyNv(errorPalette) : void 0;
376
- const error = errorPalette ? errorKeyNv !== void 0 ? newtone.getColor(
377
- errorPalette.hue,
378
- errorPalette.saturation,
379
- dynamicRange,
380
- errorKeyNv,
381
- errorPalette.desaturation,
382
- errorPalette.paletteHueGrading
383
- ) : newtone.getColorByContrast(
384
- errorPalette.hue,
385
- errorPalette.saturation,
505
+ autoAccentNv,
506
+ textPrimary,
507
+ backgroundElevated
508
+ ) : accent;
509
+ const error = errorPalette ? computePaletteTokens(
510
+ errorPalette,
511
+ ERROR_DEFAULTS,
512
+ mode,
513
+ elevation,
386
514
  dynamicRange,
387
- 4.5,
515
+ elevationDelta,
388
516
  effectiveTextMode,
389
- errorPalette.desaturation,
390
- errorPalette.paletteHueGrading,
391
- background
392
- ) : interactive;
517
+ autoAccentNv,
518
+ textPrimary,
519
+ backgroundElevated
520
+ ) : accent;
393
521
  return {
394
522
  background,
395
523
  backgroundElevated,
396
524
  backgroundSunken,
525
+ backgroundInteractive,
526
+ backgroundInteractiveHover,
527
+ backgroundInteractiveActive,
397
528
  textPrimary,
398
529
  textSecondary,
399
- interactive,
400
- interactiveHover,
401
- interactiveActive,
530
+ textTertiary,
531
+ textDisabled,
402
532
  border,
533
+ accent,
403
534
  success,
404
535
  warning,
405
536
  error,
@@ -425,119 +556,222 @@ function computeTokens(config, mode, themeMapping, elevation, elevationOffsets,
425
556
 
426
557
  // src/tokens/useTokens.ts
427
558
  function useTokens(elevation) {
428
- const { config, mode, theme: providerTheme } = useNewtoneTheme();
559
+ const { config, mode } = useNewtoneTheme();
429
560
  const frameCtx = useFrameContext();
430
- const resolvedTheme = frameCtx?.theme ?? providerTheme;
431
561
  const resolvedElevation = elevation ?? frameCtx?.elevation ?? 1;
432
- return React11.useMemo(() => {
433
- const themeMapping = config.themes[resolvedTheme];
434
- return computeTokens(
562
+ const canReuse = frameCtx !== null && elevation === void 0 && frameCtx.elevation === resolvedElevation;
563
+ return React13.useMemo(() => {
564
+ if (canReuse) {
565
+ return { ...frameCtx.tokens, elevation: resolvedElevation };
566
+ }
567
+ const tokens = computeTokens(
435
568
  config.colorSystem,
436
569
  mode,
437
- themeMapping,
438
570
  resolvedElevation,
439
- config.elevation.offsets,
440
571
  config.spacing,
441
572
  config.radius,
442
573
  config.typography,
443
- config.icons
574
+ config.icons,
575
+ config.tokenOverrides
444
576
  );
445
- }, [config, mode, resolvedTheme, resolvedElevation]);
577
+ return { ...tokens, elevation: resolvedElevation };
578
+ }, [config, mode, resolvedElevation, canReuse, frameCtx?.tokens]);
579
+ }
580
+ function computeButtonPadding(size, hasIcon, hasText, iconPosition) {
581
+ const basePadding = {
582
+ sm: 8,
583
+ md: 12,
584
+ lg: 16
585
+ };
586
+ const base = basePadding[size];
587
+ const textExtra = 8;
588
+ if (!hasText && hasIcon) {
589
+ return {
590
+ paddingLeft: base,
591
+ paddingRight: base,
592
+ paddingTop: base,
593
+ paddingBottom: base
594
+ };
595
+ }
596
+ if (hasText && !hasIcon) {
597
+ return {
598
+ paddingLeft: base + textExtra,
599
+ paddingRight: base + textExtra,
600
+ paddingTop: base,
601
+ paddingBottom: base
602
+ };
603
+ }
604
+ if (hasText && hasIcon) {
605
+ if (iconPosition === "left") {
606
+ return {
607
+ paddingLeft: base,
608
+ paddingRight: base + textExtra,
609
+ paddingTop: base,
610
+ paddingBottom: base
611
+ };
612
+ } else {
613
+ return {
614
+ paddingLeft: base + textExtra,
615
+ paddingRight: base,
616
+ paddingTop: base,
617
+ paddingBottom: base
618
+ };
619
+ }
620
+ }
621
+ return {
622
+ paddingLeft: base,
623
+ paddingRight: base,
624
+ paddingTop: base,
625
+ paddingBottom: base
626
+ };
446
627
  }
447
- function getSizeConfig(tokens) {
628
+ function getPaletteTokens(semantic, tokens) {
629
+ switch (semantic) {
630
+ case "accent":
631
+ return tokens.accent;
632
+ case "success":
633
+ return tokens.success;
634
+ case "error":
635
+ return tokens.error;
636
+ case "warning":
637
+ return tokens.warning;
638
+ default:
639
+ return void 0;
640
+ }
641
+ }
642
+ function getButtonConfig(variant, semantic, size, disabled, tokens) {
643
+ const sizeConfig = getSizeConfig(size, tokens);
644
+ const variantColors = getVariantColors(variant, semantic, disabled, tokens);
448
645
  return {
646
+ variantColors,
647
+ sizeTokens: {
648
+ padding: sizeConfig.padding,
649
+ gap: sizeConfig.gap,
650
+ borderRadius: sizeConfig.borderRadius,
651
+ textSize: sizeConfig.textSize,
652
+ iconSize: sizeConfig.iconSize
653
+ }
654
+ };
655
+ }
656
+ function getSizeConfig(size, tokens) {
657
+ const configs = {
449
658
  sm: {
450
- paddingVertical: tokens.spacing["04"],
451
- paddingHorizontal: tokens.spacing["12"],
452
- fontSize: tokens.typography.size.sm,
453
- borderRadius: tokens.radius.sm,
454
- gap: tokens.spacing["04"],
455
- iconSize: tokens.typography.size.sm
659
+ padding: 8,
660
+ gap: tokens.spacing["08"],
661
+ borderRadius: 8,
662
+ textSize: "base",
663
+ // 16px
664
+ iconSize: 24
456
665
  },
457
666
  md: {
458
- paddingVertical: tokens.spacing["08"],
459
- paddingHorizontal: tokens.spacing["16"],
460
- fontSize: tokens.typography.size.base,
461
- borderRadius: tokens.radius.md,
667
+ padding: 12,
462
668
  gap: tokens.spacing["08"],
463
- iconSize: tokens.typography.size.base
669
+ borderRadius: 12,
670
+ textSize: "base",
671
+ // 16px
672
+ iconSize: 24
464
673
  },
465
674
  lg: {
466
- paddingVertical: tokens.spacing["12"],
467
- paddingHorizontal: tokens.spacing["24"],
468
- fontSize: tokens.typography.size.base,
469
- borderRadius: tokens.radius.lg,
675
+ padding: 16,
470
676
  gap: tokens.spacing["08"],
471
- iconSize: tokens.typography.size.base
677
+ borderRadius: 16,
678
+ textSize: "base",
679
+ // 16px
680
+ iconSize: 24
472
681
  }
473
682
  };
683
+ return configs[size];
474
684
  }
475
- function getButtonStyles(tokens, variant, size, disabled, isIconOnly) {
476
- const sizeConfig = getSizeConfig(tokens)[size];
477
- const base = {
478
- paddingVertical: sizeConfig.paddingVertical,
479
- paddingHorizontal: isIconOnly ? sizeConfig.paddingVertical : sizeConfig.paddingHorizontal,
480
- borderRadius: sizeConfig.borderRadius,
481
- alignItems: "center",
482
- justifyContent: "center",
483
- flexDirection: "row",
484
- gap: sizeConfig.gap
485
- };
486
- let backgroundColor;
487
- let textColor;
488
- let borderColor;
489
- let borderWidth = 0;
490
- switch (variant) {
491
- case "primary":
492
- backgroundColor = newtone.srgbToHex(tokens.interactive.srgb);
493
- textColor = newtone.srgbToHex(tokens.background.srgb);
494
- break;
495
- case "secondary":
496
- backgroundColor = newtone.srgbToHex(tokens.backgroundElevated.srgb);
497
- textColor = newtone.srgbToHex(tokens.textPrimary.srgb);
498
- break;
499
- case "outline":
500
- backgroundColor = "transparent";
501
- textColor = newtone.srgbToHex(tokens.interactive.srgb);
502
- borderColor = newtone.srgbToHex(tokens.border.srgb);
503
- borderWidth = 1;
504
- break;
505
- case "ghost":
506
- backgroundColor = "transparent";
507
- textColor = newtone.srgbToHex(tokens.interactive.srgb);
508
- break;
685
+ function getVariantColors(variant, semantic, disabled, tokens) {
686
+ if (disabled) {
687
+ const baseColors = getVariantColorsForState(variant, semantic, tokens);
688
+ const disabledBg = newtone.srgbToHex(tokens.backgroundSunken.srgb);
689
+ return {
690
+ ...baseColors,
691
+ bg: disabledBg,
692
+ hoveredBg: disabledBg,
693
+ pressedBg: disabledBg,
694
+ textColor: newtone.srgbToHex(tokens.textSecondary.srgb),
695
+ iconColor: newtone.srgbToHex(tokens.textSecondary.srgb)
696
+ };
697
+ }
698
+ return getVariantColorsForState(variant, semantic, tokens);
699
+ }
700
+ function getVariantColorsForState(variant, semantic, tokens) {
701
+ const paletteTokens = getPaletteTokens(semantic, tokens);
702
+ if (variant === "primary") {
703
+ if (semantic === "neutral") {
704
+ return {
705
+ bg: newtone.srgbToHex(tokens.backgroundInteractive.srgb),
706
+ hoveredBg: newtone.srgbToHex(tokens.backgroundInteractiveHover.srgb),
707
+ pressedBg: newtone.srgbToHex(tokens.backgroundInteractiveActive.srgb),
708
+ textColor: newtone.srgbToHex(tokens.textPrimary.srgb),
709
+ iconColor: newtone.srgbToHex(tokens.textPrimary.srgb),
710
+ borderWidth: 1,
711
+ borderColor: "transparent"
712
+ };
713
+ }
714
+ return {
715
+ bg: newtone.srgbToHex(paletteTokens.fill.srgb),
716
+ hoveredBg: newtone.srgbToHex(paletteTokens.fillHover.srgb),
717
+ pressedBg: newtone.srgbToHex(paletteTokens.fillActive.srgb),
718
+ textColor: newtone.srgbToHex(paletteTokens.onFill.srgb),
719
+ iconColor: newtone.srgbToHex(paletteTokens.onFill.srgb),
720
+ borderWidth: 1,
721
+ borderColor: "transparent"
722
+ };
723
+ }
724
+ if (variant === "secondary") {
725
+ if (semantic === "neutral") {
726
+ return {
727
+ bg: "transparent",
728
+ hoveredBg: newtone.srgbToHex(tokens.backgroundInteractive.srgb),
729
+ pressedBg: newtone.srgbToHex(tokens.backgroundInteractiveHover.srgb),
730
+ textColor: newtone.srgbToHex(tokens.textPrimary.srgb),
731
+ iconColor: newtone.srgbToHex(tokens.textPrimary.srgb),
732
+ borderWidth: 1,
733
+ borderColor: newtone.srgbToHex(tokens.border.srgb)
734
+ };
735
+ }
736
+ return {
737
+ bg: newtone.srgbToHex(paletteTokens.background.srgb),
738
+ hoveredBg: newtone.srgbToHex(paletteTokens.backgroundInteractive.srgb),
739
+ pressedBg: newtone.srgbToHex(paletteTokens.backgroundInteractiveHover.srgb),
740
+ textColor: newtone.srgbToHex(paletteTokens.fill.srgb),
741
+ iconColor: newtone.srgbToHex(paletteTokens.fill.srgb),
742
+ borderWidth: 1,
743
+ borderColor: "transparent"
744
+ };
745
+ }
746
+ if (variant === "tertiary") {
747
+ if (semantic === "neutral") {
748
+ return {
749
+ bg: "transparent",
750
+ hoveredBg: newtone.srgbToHex(tokens.backgroundInteractive.srgb),
751
+ pressedBg: newtone.srgbToHex(tokens.backgroundInteractiveHover.srgb),
752
+ textColor: newtone.srgbToHex(tokens.textPrimary.srgb),
753
+ iconColor: newtone.srgbToHex(tokens.textPrimary.srgb),
754
+ borderWidth: 1,
755
+ borderColor: "transparent"
756
+ };
757
+ }
758
+ return {
759
+ bg: "transparent",
760
+ hoveredBg: newtone.srgbToHex(paletteTokens.background.srgb),
761
+ pressedBg: newtone.srgbToHex(paletteTokens.backgroundInteractive.srgb),
762
+ textColor: newtone.srgbToHex(paletteTokens.fill.srgb),
763
+ iconColor: newtone.srgbToHex(paletteTokens.fill.srgb),
764
+ borderWidth: 1,
765
+ borderColor: "transparent"
766
+ };
509
767
  }
510
- const resolvedTextColor = disabled ? newtone.srgbToHex(tokens.textSecondary.srgb) : textColor;
511
768
  return {
512
- iconColor: resolvedTextColor,
513
- iconSize: sizeConfig.iconSize,
514
- styles: reactNative.StyleSheet.create({
515
- base: {
516
- ...base,
517
- backgroundColor: disabled ? newtone.srgbToHex(tokens.backgroundSunken.srgb) : backgroundColor,
518
- borderWidth,
519
- ...borderColor && { borderColor }
520
- },
521
- pressed: {
522
- backgroundColor: variant === "primary" ? newtone.srgbToHex(tokens.interactiveActive.srgb) : variant === "secondary" ? newtone.srgbToHex(tokens.backgroundSunken.srgb) : "transparent",
523
- opacity: variant === "ghost" || variant === "outline" ? 0.7 : 1
524
- },
525
- disabled: {
526
- opacity: 0.4
527
- },
528
- text: {
529
- fontFamily: tokens.typography.fonts.default,
530
- fontSize: sizeConfig.fontSize,
531
- fontWeight: tokens.typography.weight.semibold,
532
- color: resolvedTextColor
533
- },
534
- textPressed: {
535
- // Color changes handled by parent opacity
536
- },
537
- textDisabled: {
538
- // Color already set in text style via disabled check
539
- }
540
- })
769
+ bg: "transparent",
770
+ hoveredBg: "transparent",
771
+ pressedBg: "transparent",
772
+ textColor: newtone.srgbToHex(tokens.textPrimary.srgb),
773
+ iconColor: newtone.srgbToHex(tokens.textPrimary.srgb),
774
+ borderWidth: 0
541
775
  };
542
776
  }
543
777
  function Icon({
@@ -557,15 +791,27 @@ function Icon({
557
791
  ref
558
792
  }) {
559
793
  const tokens = useTokens(elevation);
560
- const iconStyle = React11.useMemo(() => {
794
+ const iconStyle = React13.useMemo(() => {
561
795
  const fontSize = size ?? tokens.typography.size.base;
562
- const opsz = opticalSize ?? fontSize;
796
+ const getOpticalSize = (size2) => {
797
+ if (size2 <= 22) return 20;
798
+ if (size2 <= 32) return 24;
799
+ if (size2 <= 44) return 40;
800
+ return 48;
801
+ };
802
+ const opsz = opticalSize ?? getOpticalSize(fontSize);
563
803
  const iconColor = color ?? newtone.srgbToHex(tokens.textPrimary.srgb);
564
804
  const fontFamily = `Material Symbols ${tokens.icons.variant.charAt(0).toUpperCase() + tokens.icons.variant.slice(1)}`;
565
805
  const fontVariationSettings = `'FILL' ${fill}, 'wght' ${tokens.icons.weight}, 'GRAD' ${tokens.icons.grade}, 'opsz' ${opsz}`;
566
806
  return {
567
807
  fontFamily,
568
808
  fontSize,
809
+ width: fontSize,
810
+ // Explicit width ensures square rendering
811
+ height: fontSize,
812
+ // Explicit height ensures square rendering
813
+ lineHeight: fontSize,
814
+ // Prevent text line-height from affecting total height
569
815
  color: iconColor,
570
816
  userSelect: "none",
571
817
  // web-only: prevents users from selecting the icon as text
@@ -574,7 +820,7 @@ function Icon({
574
820
  ...style
575
821
  };
576
822
  }, [tokens, size, opticalSize, fill, color, style]);
577
- return /* @__PURE__ */ React11__default.default.createElement(
823
+ return /* @__PURE__ */ React13__default.default.createElement(
578
824
  reactNative.Text,
579
825
  {
580
826
  ref,
@@ -588,121 +834,72 @@ function Icon({
588
834
  name
589
835
  );
590
836
  }
591
-
592
- // src/Button/Button.tsx
593
- function Button({
594
- children,
595
- icon,
596
- iconPosition = "left",
597
- variant = "primary",
598
- size = "md",
599
- disabled = false,
600
- style,
601
- textStyle,
602
- ...pressableProps
603
- }) {
604
- const tokens = useTokens(1);
605
- const isIconOnly = !!icon && !children;
606
- const { styles, iconColor, iconSize } = React11__default.default.useMemo(
607
- () => getButtonStyles(tokens, variant, size, disabled, isIconOnly),
608
- [tokens, variant, size, disabled, isIconOnly]
609
- );
610
- const renderIcon = () => /* @__PURE__ */ React11__default.default.createElement(Icon, { name: icon, size: iconSize, color: iconColor });
611
- return /* @__PURE__ */ React11__default.default.createElement(
612
- reactNative.Pressable,
613
- {
614
- style: ({ pressed }) => [
615
- styles.base,
616
- pressed && !disabled && styles.pressed,
617
- disabled && styles.disabled,
618
- ...Array.isArray(style) ? style : [style]
619
- ],
620
- disabled,
621
- ...pressableProps
622
- },
623
- ({ pressed }) => /* @__PURE__ */ React11__default.default.createElement(React11__default.default.Fragment, null, icon && iconPosition === "left" && renderIcon(), children != null && /* @__PURE__ */ React11__default.default.createElement(
624
- reactNative.Text,
625
- {
626
- style: [
627
- styles.text,
628
- pressed && !disabled && styles.textPressed,
629
- disabled && styles.textDisabled,
630
- ...Array.isArray(textStyle) ? textStyle : [textStyle]
631
- ]
632
- },
633
- children
634
- ), icon && iconPosition === "right" && renderIcon())
635
- );
636
- }
637
- function getCardStyles(tokens, disabled) {
638
- return reactNative.StyleSheet.create({
639
- container: {
640
- backgroundColor: newtone.srgbToHex(tokens.background.srgb),
641
- borderWidth: 1,
642
- borderColor: newtone.srgbToHex(tokens.border.srgb),
643
- borderRadius: tokens.radius.lg,
644
- padding: tokens.spacing["16"],
645
- opacity: disabled ? 0.5 : 1
646
- }
647
- });
837
+ function resolveTextColor(color, tokens) {
838
+ switch (color) {
839
+ case "primary":
840
+ return newtone.srgbToHex(tokens.textPrimary.srgb);
841
+ case "secondary":
842
+ return newtone.srgbToHex(tokens.textSecondary.srgb);
843
+ case "tertiary":
844
+ return newtone.srgbToHex(tokens.textTertiary.srgb);
845
+ case "disabled":
846
+ return newtone.srgbToHex(tokens.textDisabled.srgb);
847
+ case "accent":
848
+ return newtone.srgbToHex(tokens.accent.fill.srgb);
849
+ case "success":
850
+ return newtone.srgbToHex(tokens.success.fill.srgb);
851
+ case "warning":
852
+ return newtone.srgbToHex(tokens.warning.fill.srgb);
853
+ case "error":
854
+ return newtone.srgbToHex(tokens.error.fill.srgb);
855
+ }
648
856
  }
649
-
650
- // src/Card/Card.tsx
651
- function Card({
857
+ function Text2({
652
858
  children,
859
+ size = "base",
860
+ weight = "regular",
861
+ color = "primary",
862
+ font = "default",
863
+ lineHeight = "normal",
864
+ align,
865
+ numberOfLines,
653
866
  elevation = 1,
654
867
  style,
655
- disabled = false
868
+ // Accessibility
869
+ accessibilityRole,
870
+ // Testing & platform
871
+ testID,
872
+ nativeID,
873
+ ref
656
874
  }) {
657
875
  const tokens = useTokens(elevation);
658
- const styles = React11__default.default.useMemo(
659
- () => getCardStyles(tokens, disabled),
660
- [tokens, disabled]
876
+ const resolvedStyle = React13.useMemo(() => {
877
+ const fontSize = tokens.typography.size[size];
878
+ return {
879
+ // Font family from the theme (e.g. 'default' → 'Inter', 'mono' → 'JetBrains Mono').
880
+ fontFamily: tokens.typography.fonts[font],
881
+ fontSize,
882
+ // Font weight is stored as a number (e.g. 400, 600) but React Native expects a string.
883
+ fontWeight: String(tokens.typography.weight[weight]),
884
+ // Convert the theme color from internal sRGB format to a hex string (e.g. '#1a1a1a').
885
+ color: resolveTextColor(color, tokens),
886
+ // Line height = font size × multiplier (e.g. 16px × 1.5 = 24px line height).
887
+ lineHeight: fontSize * tokens.typography.lineHeight[lineHeight],
888
+ textAlign: align
889
+ };
890
+ }, [tokens, size, weight, color, font, lineHeight, align]);
891
+ return /* @__PURE__ */ React13__default.default.createElement(
892
+ reactNative.Text,
893
+ {
894
+ ref,
895
+ testID,
896
+ nativeID,
897
+ accessibilityRole,
898
+ style: style ? [resolvedStyle, ...Array.isArray(style) ? style : [style]] : resolvedStyle,
899
+ numberOfLines
900
+ },
901
+ children
661
902
  );
662
- return /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, children);
663
- }
664
- var hadKeyboardEvent = false;
665
- var isListenerSetup = false;
666
- function setupModality() {
667
- if (isListenerSetup || typeof document === "undefined") return;
668
- isListenerSetup = true;
669
- const NAVIGATION_KEYS = /* @__PURE__ */ new Set([
670
- "Tab",
671
- "ArrowUp",
672
- "ArrowDown",
673
- "ArrowLeft",
674
- "ArrowRight",
675
- "Enter",
676
- " ",
677
- "Escape"
678
- ]);
679
- document.addEventListener("keydown", (e) => {
680
- if (NAVIGATION_KEYS.has(e.key)) {
681
- hadKeyboardEvent = true;
682
- }
683
- }, true);
684
- document.addEventListener("pointerdown", () => {
685
- hadKeyboardEvent = false;
686
- }, true);
687
- document.addEventListener("mousedown", () => {
688
- hadKeyboardEvent = false;
689
- }, true);
690
- }
691
- function useFocusVisible() {
692
- const [isFocusVisible, setIsFocusVisible] = React11.useState(false);
693
- React11.useEffect(() => {
694
- setupModality();
695
- }, []);
696
- const onFocus = React11.useCallback(() => {
697
- if (hadKeyboardEvent) {
698
- setIsFocusVisible(true);
699
- }
700
- }, []);
701
- const onBlur = React11.useCallback(() => {
702
- setIsFocusVisible(false);
703
- }, []);
704
- const focusProps = { onFocus, onBlur };
705
- return { isFocusVisible, focusProps };
706
903
  }
707
904
 
708
905
  // src/primitives/Frame/Frame.utils.ts
@@ -799,14 +996,260 @@ function resolveAlignment(align) {
799
996
  function resolveJustification(justify) {
800
997
  return JUSTIFY_MAP[justify];
801
998
  }
802
- function resolveFlexDirection(direction, reverse) {
803
- if (direction === "horizontal") {
804
- return reverse ? "row-reverse" : "row";
805
- }
806
- return reverse ? "column-reverse" : "column";
999
+ function resolveFlexDirection(direction, reverse) {
1000
+ if (direction === "horizontal") {
1001
+ return reverse ? "row-reverse" : "row";
1002
+ }
1003
+ return reverse ? "column-reverse" : "column";
1004
+ }
1005
+
1006
+ // src/primitives/Wrapper/Wrapper.styles.ts
1007
+ function getWrapperStyles(input) {
1008
+ const {
1009
+ tokens,
1010
+ direction = "vertical",
1011
+ wrap = false,
1012
+ reverse = false,
1013
+ align,
1014
+ justify,
1015
+ padding,
1016
+ gap,
1017
+ width,
1018
+ height,
1019
+ minWidth,
1020
+ maxWidth,
1021
+ minHeight,
1022
+ maxHeight
1023
+ } = input;
1024
+ const container = {};
1025
+ container.flexDirection = resolveFlexDirection(direction, reverse);
1026
+ if (wrap) container.flexWrap = "wrap";
1027
+ if (align) container.alignItems = resolveAlignment(align);
1028
+ if (justify) container.justifyContent = resolveJustification(justify);
1029
+ if (padding !== void 0) {
1030
+ const p = resolvePadding(padding, tokens);
1031
+ container.paddingTop = p.top;
1032
+ container.paddingRight = p.right;
1033
+ container.paddingBottom = p.bottom;
1034
+ container.paddingLeft = p.left;
1035
+ }
1036
+ if (gap !== void 0) {
1037
+ const g = resolveGap(gap, tokens);
1038
+ container.rowGap = g.rowGap;
1039
+ container.columnGap = g.columnGap;
1040
+ }
1041
+ Object.assign(container, resolveSizing(width, height));
1042
+ if (minWidth !== void 0) container.minWidth = minWidth;
1043
+ if (maxWidth !== void 0) container.maxWidth = maxWidth;
1044
+ if (minHeight !== void 0) container.minHeight = minHeight;
1045
+ if (maxHeight !== void 0) container.maxHeight = maxHeight;
1046
+ return reactNative.StyleSheet.create({ c: container }).c;
1047
+ }
1048
+
1049
+ // src/primitives/Wrapper/Wrapper.tsx
1050
+ function Wrapper({
1051
+ children,
1052
+ direction,
1053
+ wrap,
1054
+ reverse,
1055
+ align,
1056
+ justify,
1057
+ padding,
1058
+ gap,
1059
+ width,
1060
+ height,
1061
+ minWidth,
1062
+ maxWidth,
1063
+ minHeight,
1064
+ maxHeight,
1065
+ style,
1066
+ // Testing & platform
1067
+ testID,
1068
+ nativeID,
1069
+ ref
1070
+ }) {
1071
+ const tokens = useTokens(1);
1072
+ const containerStyle = React13.useMemo(
1073
+ () => getWrapperStyles({
1074
+ tokens,
1075
+ direction,
1076
+ wrap,
1077
+ reverse,
1078
+ align,
1079
+ justify,
1080
+ padding,
1081
+ gap,
1082
+ width,
1083
+ height,
1084
+ minWidth,
1085
+ maxWidth,
1086
+ minHeight,
1087
+ maxHeight
1088
+ }),
1089
+ [
1090
+ tokens,
1091
+ direction,
1092
+ wrap,
1093
+ reverse,
1094
+ align,
1095
+ justify,
1096
+ padding,
1097
+ gap,
1098
+ width,
1099
+ height,
1100
+ minWidth,
1101
+ maxWidth,
1102
+ minHeight,
1103
+ maxHeight
1104
+ ]
1105
+ );
1106
+ const userStyles = Array.isArray(style) ? style : style ? [style] : [];
1107
+ return /* @__PURE__ */ React13__default.default.createElement(
1108
+ reactNative.View,
1109
+ {
1110
+ ref,
1111
+ testID,
1112
+ nativeID,
1113
+ accessibilityRole: "none",
1114
+ style: [containerStyle, ...userStyles]
1115
+ },
1116
+ children
1117
+ );
1118
+ }
1119
+
1120
+ // src/composites/actions/Button/Button.tsx
1121
+ function Button({
1122
+ children,
1123
+ icon,
1124
+ iconPosition = "left",
1125
+ variant = "primary",
1126
+ semantic = "neutral",
1127
+ size = "md",
1128
+ disabled = false,
1129
+ style,
1130
+ textStyle,
1131
+ ...pressableProps
1132
+ }) {
1133
+ const tokens = useTokens();
1134
+ const { variantColors, sizeTokens } = React13__default.default.useMemo(
1135
+ () => getButtonConfig(variant, semantic, size, disabled, tokens),
1136
+ [variant, semantic, size, disabled, tokens]
1137
+ );
1138
+ const padding = React13__default.default.useMemo(
1139
+ () => computeButtonPadding(size, !!icon, !!children, iconPosition),
1140
+ [size, icon, children, iconPosition]
1141
+ );
1142
+ return /* @__PURE__ */ React13__default.default.createElement(reactNative.Pressable, { disabled, ...pressableProps }, ({ pressed, hovered }) => (
1143
+ // Wrapper handles layout: direction, gap, alignment (padding via style)
1144
+ /* @__PURE__ */ React13__default.default.createElement(
1145
+ Wrapper,
1146
+ {
1147
+ direction: "horizontal",
1148
+ align: "center",
1149
+ justify: "center",
1150
+ gap: sizeTokens.gap,
1151
+ style: [
1152
+ {
1153
+ ...padding,
1154
+ // Asymmetric horizontal padding for text optical balance
1155
+ backgroundColor: pressed && !disabled ? variantColors.pressedBg : hovered && !disabled ? variantColors.hoveredBg : variantColors.bg,
1156
+ borderRadius: sizeTokens.borderRadius,
1157
+ borderWidth: variantColors.borderWidth,
1158
+ // Always 1 for consistent sizing
1159
+ borderColor: variantColors.borderColor || "transparent",
1160
+ opacity: disabled ? 0.4 : 1
1161
+ },
1162
+ ...Array.isArray(style) ? style : style ? [style] : []
1163
+ ]
1164
+ },
1165
+ icon && iconPosition === "left" && /* @__PURE__ */ React13__default.default.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor }),
1166
+ children && // Text primitive with semantic props + color style override
1167
+ /* @__PURE__ */ React13__default.default.createElement(
1168
+ Text2,
1169
+ {
1170
+ size: sizeTokens.textSize,
1171
+ weight: "semibold",
1172
+ style: [
1173
+ { color: variantColors.textColor },
1174
+ ...Array.isArray(textStyle) ? textStyle : textStyle ? [textStyle] : []
1175
+ ]
1176
+ },
1177
+ children
1178
+ ),
1179
+ icon && iconPosition === "right" && /* @__PURE__ */ React13__default.default.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor })
1180
+ )
1181
+ ));
1182
+ }
1183
+ function getCardStyles(tokens, disabled) {
1184
+ return reactNative.StyleSheet.create({
1185
+ container: {
1186
+ backgroundColor: newtone.srgbToHex(tokens.background.srgb),
1187
+ borderWidth: 1,
1188
+ borderColor: newtone.srgbToHex(tokens.border.srgb),
1189
+ borderRadius: tokens.radius.lg,
1190
+ padding: tokens.spacing["16"],
1191
+ opacity: disabled ? 0.5 : 1
1192
+ }
1193
+ });
1194
+ }
1195
+
1196
+ // src/composites/layout/Card/Card.tsx
1197
+ function Card({
1198
+ children,
1199
+ elevation = 1,
1200
+ style,
1201
+ disabled = false
1202
+ }) {
1203
+ const tokens = useTokens(elevation);
1204
+ const styles = React13__default.default.useMemo(
1205
+ () => getCardStyles(tokens, disabled),
1206
+ [tokens, disabled]
1207
+ );
1208
+ return /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, children);
1209
+ }
1210
+ var hadKeyboardEvent = false;
1211
+ var isListenerSetup = false;
1212
+ function setupModality() {
1213
+ if (isListenerSetup || typeof document === "undefined") return;
1214
+ isListenerSetup = true;
1215
+ const NAVIGATION_KEYS = /* @__PURE__ */ new Set([
1216
+ "Tab",
1217
+ "ArrowUp",
1218
+ "ArrowDown",
1219
+ "ArrowLeft",
1220
+ "ArrowRight",
1221
+ "Enter",
1222
+ " ",
1223
+ "Escape"
1224
+ ]);
1225
+ document.addEventListener("keydown", (e) => {
1226
+ if (NAVIGATION_KEYS.has(e.key)) {
1227
+ hadKeyboardEvent = true;
1228
+ }
1229
+ }, true);
1230
+ document.addEventListener("pointerdown", () => {
1231
+ hadKeyboardEvent = false;
1232
+ }, true);
1233
+ document.addEventListener("mousedown", () => {
1234
+ hadKeyboardEvent = false;
1235
+ }, true);
1236
+ }
1237
+ function useFocusVisible() {
1238
+ const [isFocusVisible, setIsFocusVisible] = React13.useState(false);
1239
+ React13.useEffect(() => {
1240
+ setupModality();
1241
+ }, []);
1242
+ const onFocus = React13.useCallback(() => {
1243
+ if (hadKeyboardEvent) {
1244
+ setIsFocusVisible(true);
1245
+ }
1246
+ }, []);
1247
+ const onBlur = React13.useCallback(() => {
1248
+ setIsFocusVisible(false);
1249
+ }, []);
1250
+ const focusProps = { onFocus, onBlur };
1251
+ return { isFocusVisible, focusProps };
807
1252
  }
808
-
809
- // src/primitives/Frame/Frame.styles.ts
810
1253
  function getFrameStyles(input) {
811
1254
  const {
812
1255
  tokens,
@@ -913,9 +1356,9 @@ function getFrameStyles(input) {
913
1356
 
914
1357
  // src/primitives/Frame/Frame.tsx
915
1358
  function wrapTextChildren(children, textStyle) {
916
- return React11__default.default.Children.map(children, (child) => {
1359
+ return React13__default.default.Children.map(children, (child) => {
917
1360
  if (typeof child === "string" || typeof child === "number") {
918
- return /* @__PURE__ */ React11__default.default.createElement(reactNative.Text, { style: textStyle }, child);
1361
+ return /* @__PURE__ */ React13__default.default.createElement(reactNative.Text, { style: textStyle }, child);
919
1362
  }
920
1363
  return child;
921
1364
  });
@@ -927,8 +1370,7 @@ function toElevationLevel(frameElevation) {
927
1370
  }
928
1371
  function Frame({
929
1372
  children,
930
- // Theme & elevation
931
- theme,
1373
+ // Elevation
932
1374
  elevation,
933
1375
  // Layout
934
1376
  layout,
@@ -967,26 +1409,23 @@ function Frame({
967
1409
  // Style override
968
1410
  style
969
1411
  }) {
970
- const { config, mode, theme: providerTheme } = useNewtoneTheme();
1412
+ const { config, mode } = useNewtoneTheme();
971
1413
  const parentFrameCtx = useFrameContext();
972
- const resolvedTheme = theme ?? parentFrameCtx?.theme ?? providerTheme;
973
1414
  const resolvedFrameElevation = elevation ?? 0;
974
1415
  const resolvedElevation = elevation !== void 0 ? toElevationLevel(elevation) : parentFrameCtx?.elevation ?? 1;
975
- const tokens = React11.useMemo(() => {
976
- const themeMapping = config.themes[resolvedTheme];
1416
+ const tokens = React13.useMemo(() => {
977
1417
  return computeTokens(
978
1418
  config.colorSystem,
979
1419
  mode,
980
- themeMapping,
981
1420
  resolvedElevation,
982
- config.elevation.offsets,
983
1421
  config.spacing,
984
1422
  config.radius,
985
1423
  config.typography,
986
- config.icons
1424
+ config.icons,
1425
+ config.tokenOverrides
987
1426
  );
988
- }, [config, mode, resolvedTheme, resolvedElevation]);
989
- const styles = React11.useMemo(
1427
+ }, [config, mode, resolvedElevation]);
1428
+ const styles = React13.useMemo(
990
1429
  () => getFrameStyles({
991
1430
  tokens,
992
1431
  frameElevation: resolvedFrameElevation,
@@ -1034,9 +1473,9 @@ function Frame({
1034
1473
  disabled
1035
1474
  ]
1036
1475
  );
1037
- const contextValue = React11.useMemo(
1038
- () => ({ theme: resolvedTheme, elevation: resolvedElevation }),
1039
- [resolvedTheme, resolvedElevation]
1476
+ const contextValue = React13.useMemo(
1477
+ () => ({ elevation: resolvedElevation, tokens }),
1478
+ [resolvedElevation, tokens]
1040
1479
  );
1041
1480
  const webOverrides = [];
1042
1481
  if (styles.gridWebStyle) {
@@ -1051,11 +1490,11 @@ function Frame({
1051
1490
  const focusRingStyle = isFocusVisible && !disabled ? {
1052
1491
  outlineWidth: 2,
1053
1492
  outlineStyle: "solid",
1054
- outlineColor: newtone.srgbToHex(tokens.interactive.srgb),
1493
+ outlineColor: newtone.srgbToHex(tokens.accent.fill.srgb),
1055
1494
  outlineOffset: 2
1056
1495
  } : void 0;
1057
1496
  const webFocusProps = isInteractive ? focusProps : {};
1058
- const textStyle = React11.useMemo(
1497
+ const textStyle = React13.useMemo(
1059
1498
  () => ({
1060
1499
  color: newtone.srgbToHex(tokens.textPrimary.srgb),
1061
1500
  fontSize: tokens.typography.size.base,
@@ -1064,14 +1503,14 @@ function Frame({
1064
1503
  }),
1065
1504
  [tokens]
1066
1505
  );
1067
- const wrappedChildren = React11.useMemo(
1506
+ const wrappedChildren = React13.useMemo(
1068
1507
  () => wrapTextChildren(children, textStyle),
1069
1508
  [children, textStyle]
1070
1509
  );
1071
- return /* @__PURE__ */ React11__default.default.createElement(FrameContext.Provider, { value: contextValue }, isInteractive ? (
1510
+ return /* @__PURE__ */ React13__default.default.createElement(FrameContext.Provider, { value: contextValue }, isInteractive ? (
1072
1511
  // Pressable handles taps. When href is set, react-native-web renders
1073
1512
  // it as an <a> tag so it works like a regular link on the web.
1074
- /* @__PURE__ */ React11__default.default.createElement(
1513
+ /* @__PURE__ */ React13__default.default.createElement(
1075
1514
  reactNative.Pressable,
1076
1515
  {
1077
1516
  ref,
@@ -1096,7 +1535,7 @@ function Frame({
1096
1535
  )
1097
1536
  ) : (
1098
1537
  // Non-interactive Frame: just a plain View with no tap handling.
1099
- /* @__PURE__ */ React11__default.default.createElement(
1538
+ /* @__PURE__ */ React13__default.default.createElement(
1100
1539
  reactNative.View,
1101
1540
  {
1102
1541
  ref,
@@ -1142,11 +1581,11 @@ function TextInput({
1142
1581
  ...textInputProps
1143
1582
  }) {
1144
1583
  const tokens = useTokens(1);
1145
- const styles = React11__default.default.useMemo(
1584
+ const styles = React13__default.default.useMemo(
1146
1585
  () => getTextInputStyles(tokens, disabled),
1147
1586
  [tokens, disabled]
1148
1587
  );
1149
- return /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React11__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React11__default.default.createElement(
1588
+ return /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React13__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React13__default.default.createElement(
1150
1589
  reactNative.TextInput,
1151
1590
  {
1152
1591
  style: styles.input,
@@ -1183,7 +1622,7 @@ function getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpe
1183
1622
  });
1184
1623
  }
1185
1624
 
1186
- // src/Popover/Popover.tsx
1625
+ // src/composites/overlays/Popover/Popover.tsx
1187
1626
  var openPopovers = /* @__PURE__ */ new Set();
1188
1627
  function Popover({
1189
1628
  isOpen,
@@ -1198,15 +1637,15 @@ function Popover({
1198
1637
  contentStyle
1199
1638
  }) {
1200
1639
  const tokens = useTokens(1);
1201
- const containerRef = React11.useRef(null);
1202
- const [triggerHeight, setTriggerHeight] = React11.useState(0);
1203
- const onTriggerLayout = React11.useCallback(
1640
+ const containerRef = React13.useRef(null);
1641
+ const [triggerHeight, setTriggerHeight] = React13.useState(0);
1642
+ const onTriggerLayout = React13.useCallback(
1204
1643
  (e) => {
1205
1644
  setTriggerHeight(e.nativeEvent.layout.height);
1206
1645
  },
1207
1646
  []
1208
1647
  );
1209
- React11.useEffect(() => {
1648
+ React13.useEffect(() => {
1210
1649
  if (!isOpen) return;
1211
1650
  openPopovers.forEach((closeFn) => closeFn());
1212
1651
  openPopovers.clear();
@@ -1215,7 +1654,7 @@ function Popover({
1215
1654
  openPopovers.delete(onClose);
1216
1655
  };
1217
1656
  }, [isOpen, onClose]);
1218
- React11.useEffect(() => {
1657
+ React13.useEffect(() => {
1219
1658
  if (!isOpen) return;
1220
1659
  if (typeof document === "undefined") return;
1221
1660
  const handleMouseDown = (e) => {
@@ -1227,7 +1666,7 @@ function Popover({
1227
1666
  document.addEventListener("mousedown", handleMouseDown, true);
1228
1667
  return () => document.removeEventListener("mousedown", handleMouseDown, true);
1229
1668
  }, [isOpen, onClose]);
1230
- const handleKeyDown = React11.useCallback(
1669
+ const handleKeyDown = React13.useCallback(
1231
1670
  (e) => {
1232
1671
  if (closeOnEscape && e.key === "Escape") {
1233
1672
  e.stopPropagation();
@@ -1236,41 +1675,41 @@ function Popover({
1236
1675
  },
1237
1676
  [closeOnEscape, onClose]
1238
1677
  );
1239
- const styles = React11.useMemo(
1678
+ const styles = React13.useMemo(
1240
1679
  () => getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpen),
1241
1680
  [tokens, triggerHeight, offset, maxHeight, width, isOpen]
1242
1681
  );
1243
- const containerStyles = React11.useMemo(
1682
+ const containerStyles = React13.useMemo(
1244
1683
  () => [styles.container, ...Array.isArray(style) ? style : style ? [style] : []],
1245
1684
  [styles.container, style]
1246
1685
  );
1247
- const mergedContentStyles = React11.useMemo(
1686
+ const mergedContentStyles = React13.useMemo(
1248
1687
  () => [styles.content, ...Array.isArray(contentStyle) ? contentStyle : contentStyle ? [contentStyle] : []],
1249
1688
  [styles.content, contentStyle]
1250
1689
  );
1251
1690
  const webProps = { onKeyDown: handleKeyDown };
1252
- return /* @__PURE__ */ React11__default.default.createElement(
1691
+ return /* @__PURE__ */ React13__default.default.createElement(
1253
1692
  reactNative.View,
1254
1693
  {
1255
1694
  ref: containerRef,
1256
1695
  style: containerStyles,
1257
1696
  ...webProps
1258
1697
  },
1259
- /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { onLayout: onTriggerLayout }, trigger),
1260
- isOpen && /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: mergedContentStyles }, children)
1698
+ /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { onLayout: onTriggerLayout }, trigger),
1699
+ isOpen && /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: mergedContentStyles }, children)
1261
1700
  );
1262
1701
  }
1263
1702
  function usePopover(options) {
1264
- const [isOpen, setIsOpen] = React11.useState(options?.initialOpen ?? false);
1265
- const open = React11.useCallback(() => {
1703
+ const [isOpen, setIsOpen] = React13.useState(options?.initialOpen ?? false);
1704
+ const open = React13.useCallback(() => {
1266
1705
  setIsOpen(true);
1267
1706
  options?.onOpenChange?.(true);
1268
1707
  }, [options]);
1269
- const close = React11.useCallback(() => {
1708
+ const close = React13.useCallback(() => {
1270
1709
  setIsOpen(false);
1271
1710
  options?.onOpenChange?.(false);
1272
1711
  }, [options]);
1273
- const toggle = React11.useCallback(() => {
1712
+ const toggle = React13.useCallback(() => {
1274
1713
  setIsOpen((prev) => {
1275
1714
  const next = !prev;
1276
1715
  options?.onOpenChange?.(next);
@@ -1280,7 +1719,7 @@ function usePopover(options) {
1280
1719
  return { isOpen, open, close, toggle };
1281
1720
  }
1282
1721
 
1283
- // src/Select/Select.types.ts
1722
+ // src/composites/form-controls/Select/Select.types.ts
1284
1723
  function isOptionGroup(item) {
1285
1724
  return "options" in item;
1286
1725
  }
@@ -1357,10 +1796,10 @@ function useSelect({
1357
1796
  onClose,
1358
1797
  onOpen
1359
1798
  }) {
1360
- const [focusedIndex, setFocusedIndex] = React11.useState(-1);
1361
- const typeAheadRef = React11.useRef("");
1362
- const typeAheadTimerRef = React11.useRef();
1363
- React11.useEffect(() => {
1799
+ const [focusedIndex, setFocusedIndex] = React13.useState(-1);
1800
+ const typeAheadRef = React13.useRef("");
1801
+ const typeAheadTimerRef = React13.useRef();
1802
+ React13.useEffect(() => {
1364
1803
  if (isOpen) {
1365
1804
  const selectedIdx = flatOptions.findIndex((o) => o.value === value);
1366
1805
  if (selectedIdx >= 0 && !flatOptions[selectedIdx].disabled) {
@@ -1373,7 +1812,7 @@ function useSelect({
1373
1812
  setFocusedIndex(-1);
1374
1813
  }
1375
1814
  }, [isOpen, flatOptions, value]);
1376
- const handleKeyDown = React11.useCallback(
1815
+ const handleKeyDown = React13.useCallback(
1377
1816
  (e) => {
1378
1817
  const key = e.key;
1379
1818
  if (!isOpen) {
@@ -1454,7 +1893,7 @@ function SelectOptionRow({
1454
1893
  const paddingHorizontal = size === "sm" ? tokens.spacing["08"] : tokens.spacing["12"];
1455
1894
  const fontSize = size === "sm" ? tokens.typography.size.sm : tokens.typography.size.base;
1456
1895
  if (renderOption) {
1457
- return /* @__PURE__ */ React11__default.default.createElement(
1896
+ return /* @__PURE__ */ React13__default.default.createElement(
1458
1897
  reactNative.Pressable,
1459
1898
  {
1460
1899
  onPress: option.disabled ? void 0 : onSelect,
@@ -1465,7 +1904,7 @@ function SelectOptionRow({
1465
1904
  renderOption(option, { isSelected, isFocused })
1466
1905
  );
1467
1906
  }
1468
- return /* @__PURE__ */ React11__default.default.createElement(
1907
+ return /* @__PURE__ */ React13__default.default.createElement(
1469
1908
  reactNative.Pressable,
1470
1909
  {
1471
1910
  onPress: option.disabled ? void 0 : onSelect,
@@ -1494,7 +1933,7 @@ function SelectOptionRow({
1494
1933
  }
1495
1934
  ]
1496
1935
  },
1497
- /* @__PURE__ */ React11__default.default.createElement(
1936
+ /* @__PURE__ */ React13__default.default.createElement(
1498
1937
  reactNative.Text,
1499
1938
  {
1500
1939
  style: [
@@ -1506,7 +1945,7 @@ function SelectOptionRow({
1506
1945
  },
1507
1946
  isSelected && {
1508
1947
  fontWeight: tokens.typography.weight.semibold,
1509
- color: newtone.srgbToHex(tokens.interactive.srgb)
1948
+ color: newtone.srgbToHex(tokens.accent.fill.srgb)
1510
1949
  },
1511
1950
  option.disabled && {
1512
1951
  color: newtone.srgbToHex(tokens.textSecondary.srgb)
@@ -1516,12 +1955,12 @@ function SelectOptionRow({
1516
1955
  },
1517
1956
  option.label
1518
1957
  ),
1519
- isSelected && /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: { marginLeft: tokens.spacing["08"] } }, /* @__PURE__ */ React11__default.default.createElement(
1958
+ isSelected && /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: { marginLeft: tokens.spacing["08"] } }, /* @__PURE__ */ React13__default.default.createElement(
1520
1959
  Icon,
1521
1960
  {
1522
1961
  name: "check",
1523
1962
  size: fontSize,
1524
- color: newtone.srgbToHex(tokens.interactive.srgb)
1963
+ color: newtone.srgbToHex(tokens.accent.fill.srgb)
1525
1964
  }
1526
1965
  ))
1527
1966
  );
@@ -1551,7 +1990,7 @@ function Select({
1551
1990
  }) {
1552
1991
  const tokens = useTokens(1);
1553
1992
  const { isOpen, open, close, toggle } = usePopover();
1554
- const flatOptions = React11.useMemo(() => flattenOptions(options), [options]);
1993
+ const flatOptions = React13.useMemo(() => flattenOptions(options), [options]);
1555
1994
  const { focusedIndex, handleKeyDown } = useSelect({
1556
1995
  flatOptions,
1557
1996
  value,
@@ -1563,7 +2002,7 @@ function Select({
1563
2002
  onClose: close,
1564
2003
  onOpen: open
1565
2004
  });
1566
- const styles = React11.useMemo(
2005
+ const styles = React13.useMemo(
1567
2006
  () => getSelectStyles(tokens, disabled, size, isOpen),
1568
2007
  [tokens, disabled, size, isOpen]
1569
2008
  );
@@ -1571,7 +2010,7 @@ function Select({
1571
2010
  const displayLabel = selectedOption?.label ?? placeholder ?? value;
1572
2011
  const iconColor = disabled ? newtone.srgbToHex(tokens.textSecondary.srgb) : newtone.srgbToHex(tokens.textPrimary.srgb);
1573
2012
  const triggerWebProps = { onKeyDown: handleKeyDown };
1574
- const trigger = /* @__PURE__ */ React11__default.default.createElement(
2013
+ const trigger = /* @__PURE__ */ React13__default.default.createElement(
1575
2014
  reactNative.Pressable,
1576
2015
  {
1577
2016
  onPress: disabled ? void 0 : toggle,
@@ -1581,8 +2020,8 @@ function Select({
1581
2020
  ...triggerWebProps,
1582
2021
  style: styles.trigger
1583
2022
  },
1584
- renderValue ? renderValue(selectedOption) : /* @__PURE__ */ React11__default.default.createElement(reactNative.Text, { style: styles.triggerText, numberOfLines: 1 }, displayLabel),
1585
- /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.iconWrapper, pointerEvents: "none" }, /* @__PURE__ */ React11__default.default.createElement(
2023
+ renderValue ? renderValue(selectedOption) : /* @__PURE__ */ React13__default.default.createElement(reactNative.Text, { style: styles.triggerText, numberOfLines: 1 }, displayLabel),
2024
+ /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.iconWrapper, pointerEvents: "none" }, /* @__PURE__ */ React13__default.default.createElement(
1586
2025
  Icon,
1587
2026
  {
1588
2027
  name: isOpen ? "expand_less" : "expand_more",
@@ -1591,14 +2030,14 @@ function Select({
1591
2030
  }
1592
2031
  ))
1593
2032
  );
1594
- return /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : style ? [style] : []] }, label && /* @__PURE__ */ React11__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React11__default.default.createElement(
2033
+ return /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : style ? [style] : []] }, label && /* @__PURE__ */ React13__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React13__default.default.createElement(
1595
2034
  Popover,
1596
2035
  {
1597
2036
  isOpen: isOpen && !disabled,
1598
2037
  onClose: close,
1599
2038
  trigger
1600
2039
  },
1601
- /* @__PURE__ */ React11__default.default.createElement(
2040
+ /* @__PURE__ */ React13__default.default.createElement(
1602
2041
  reactNative.ScrollView,
1603
2042
  {
1604
2043
  bounces: false,
@@ -1607,7 +2046,7 @@ function Select({
1607
2046
  },
1608
2047
  options.map((item) => {
1609
2048
  if (isOptionGroup(item)) {
1610
- return /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { key: item.label }, /* @__PURE__ */ React11__default.default.createElement(reactNative.Text, { style: styles.groupLabel }, item.label), item.options.map((opt) => /* @__PURE__ */ React11__default.default.createElement(
2049
+ return /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { key: item.label }, /* @__PURE__ */ React13__default.default.createElement(reactNative.Text, { style: styles.groupLabel }, item.label), item.options.map((opt) => /* @__PURE__ */ React13__default.default.createElement(
1611
2050
  SelectOptionRow,
1612
2051
  {
1613
2052
  key: opt.value,
@@ -1623,7 +2062,7 @@ function Select({
1623
2062
  }
1624
2063
  )));
1625
2064
  }
1626
- return /* @__PURE__ */ React11__default.default.createElement(
2065
+ return /* @__PURE__ */ React13__default.default.createElement(
1627
2066
  SelectOptionRow,
1628
2067
  {
1629
2068
  key: item.value,
@@ -1664,7 +2103,7 @@ function getToggleStyles(tokens, value, disabled) {
1664
2103
  width: TRACK_WIDTH,
1665
2104
  height: TRACK_HEIGHT,
1666
2105
  borderRadius: TRACK_HEIGHT / 2,
1667
- backgroundColor: value ? newtone.srgbToHex(tokens.interactive.srgb) : newtone.srgbToHex(tokens.border.srgb),
2106
+ backgroundColor: value ? newtone.srgbToHex(tokens.accent.fill.srgb) : newtone.srgbToHex(tokens.border.srgb),
1668
2107
  justifyContent: "center",
1669
2108
  paddingHorizontal: THUMB_OFFSET
1670
2109
  },
@@ -1678,7 +2117,7 @@ function getToggleStyles(tokens, value, disabled) {
1678
2117
  });
1679
2118
  }
1680
2119
 
1681
- // src/Toggle/Toggle.tsx
2120
+ // src/composites/form-controls/Toggle/Toggle.tsx
1682
2121
  function Toggle({
1683
2122
  value,
1684
2123
  onValueChange,
@@ -1687,16 +2126,16 @@ function Toggle({
1687
2126
  style
1688
2127
  }) {
1689
2128
  const tokens = useTokens(1);
1690
- const styles = React11__default.default.useMemo(
2129
+ const styles = React13__default.default.useMemo(
1691
2130
  () => getToggleStyles(tokens, value, disabled),
1692
2131
  [tokens, value, disabled]
1693
2132
  );
1694
- const handlePress = React11__default.default.useCallback(() => {
2133
+ const handlePress = React13__default.default.useCallback(() => {
1695
2134
  if (!disabled) {
1696
2135
  onValueChange(!value);
1697
2136
  }
1698
2137
  }, [disabled, value, onValueChange]);
1699
- return /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React11__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React11__default.default.createElement(
2138
+ return /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React13__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React13__default.default.createElement(
1700
2139
  reactNative.Pressable,
1701
2140
  {
1702
2141
  onPress: handlePress,
@@ -1704,7 +2143,7 @@ function Toggle({
1704
2143
  accessibilityRole: "switch",
1705
2144
  accessibilityState: { checked: value, disabled }
1706
2145
  },
1707
- /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.track }, /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.thumb }))
2146
+ /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.track }, /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.thumb }))
1708
2147
  ));
1709
2148
  }
1710
2149
  var TRACK_HEIGHT2 = 6;
@@ -1764,19 +2203,19 @@ function getSliderStyles(tokens, disabled) {
1764
2203
  left: 0,
1765
2204
  height: TRACK_HEIGHT2,
1766
2205
  borderRadius: TRACK_HEIGHT2 / 2,
1767
- backgroundColor: newtone.srgbToHex(tokens.interactive.srgb)
2206
+ backgroundColor: newtone.srgbToHex(tokens.accent.fill.srgb)
1768
2207
  },
1769
2208
  thumb: {
1770
2209
  position: "absolute",
1771
2210
  width: THUMB_SIZE2,
1772
2211
  height: THUMB_SIZE2,
1773
2212
  borderRadius: THUMB_SIZE2 / 2,
1774
- backgroundColor: newtone.srgbToHex(tokens.interactive.srgb)
2213
+ backgroundColor: newtone.srgbToHex(tokens.accent.fill.srgb)
1775
2214
  }
1776
2215
  });
1777
2216
  }
1778
2217
 
1779
- // src/Slider/Slider.tsx
2218
+ // src/composites/range-inputs/Slider/Slider.tsx
1780
2219
  function Slider({
1781
2220
  value,
1782
2221
  onValueChange,
@@ -1790,41 +2229,41 @@ function Slider({
1790
2229
  style
1791
2230
  }) {
1792
2231
  const tokens = useTokens(1);
1793
- const styles = React11__default.default.useMemo(
2232
+ const styles = React13__default.default.useMemo(
1794
2233
  () => getSliderStyles(tokens, disabled),
1795
2234
  [tokens, disabled]
1796
2235
  );
1797
- const trackRef = React11__default.default.useRef(null);
1798
- const trackWidth = React11__default.default.useRef(0);
1799
- const trackPageX = React11__default.default.useRef(0);
1800
- const onValueChangeRef = React11__default.default.useRef(onValueChange);
1801
- const minRef = React11__default.default.useRef(min);
1802
- const maxRef = React11__default.default.useRef(max);
1803
- const stepRef = React11__default.default.useRef(step);
1804
- const disabledRef = React11__default.default.useRef(disabled);
1805
- React11__default.default.useEffect(() => {
2236
+ const trackRef = React13__default.default.useRef(null);
2237
+ const trackWidth = React13__default.default.useRef(0);
2238
+ const trackPageX = React13__default.default.useRef(0);
2239
+ const onValueChangeRef = React13__default.default.useRef(onValueChange);
2240
+ const minRef = React13__default.default.useRef(min);
2241
+ const maxRef = React13__default.default.useRef(max);
2242
+ const stepRef = React13__default.default.useRef(step);
2243
+ const disabledRef = React13__default.default.useRef(disabled);
2244
+ React13__default.default.useEffect(() => {
1806
2245
  onValueChangeRef.current = onValueChange;
1807
2246
  }, [onValueChange]);
1808
- React11__default.default.useEffect(() => {
2247
+ React13__default.default.useEffect(() => {
1809
2248
  minRef.current = min;
1810
2249
  }, [min]);
1811
- React11__default.default.useEffect(() => {
2250
+ React13__default.default.useEffect(() => {
1812
2251
  maxRef.current = max;
1813
2252
  }, [max]);
1814
- React11__default.default.useEffect(() => {
2253
+ React13__default.default.useEffect(() => {
1815
2254
  stepRef.current = step;
1816
2255
  }, [step]);
1817
- React11__default.default.useEffect(() => {
2256
+ React13__default.default.useEffect(() => {
1818
2257
  disabledRef.current = disabled;
1819
2258
  }, [disabled]);
1820
- const computeValue = React11__default.default.useCallback((pageX) => {
2259
+ const computeValue = React13__default.default.useCallback((pageX) => {
1821
2260
  const localX = pageX - trackPageX.current;
1822
2261
  const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
1823
2262
  const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
1824
2263
  const stepped = Math.round(raw / stepRef.current) * stepRef.current;
1825
2264
  return Math.min(maxRef.current, Math.max(minRef.current, stepped));
1826
2265
  }, []);
1827
- const panResponder = React11__default.default.useRef(
2266
+ const panResponder = React13__default.default.useRef(
1828
2267
  reactNative.PanResponder.create({
1829
2268
  onStartShouldSetPanResponder: () => !disabledRef.current,
1830
2269
  onMoveShouldSetPanResponder: () => !disabledRef.current,
@@ -1840,7 +2279,7 @@ function Slider({
1840
2279
  const usableWidth = Math.max(0, trackWidth.current - THUMB_SIZE2);
1841
2280
  const thumbLeft = ratio * usableWidth;
1842
2281
  const fillWidth = thumbLeft + THUMB_SIZE2 / 2;
1843
- const handleValueTextSubmit = React11__default.default.useCallback(
2282
+ const handleValueTextSubmit = React13__default.default.useCallback(
1844
2283
  (text) => {
1845
2284
  const raw = Number(text);
1846
2285
  if (!Number.isNaN(raw)) {
@@ -1849,12 +2288,12 @@ function Slider({
1849
2288
  },
1850
2289
  [onValueChange, min, max]
1851
2290
  );
1852
- const [editText, setEditText] = React11__default.default.useState(String(value));
1853
- React11__default.default.useEffect(() => {
2291
+ const [editText, setEditText] = React13__default.default.useState(String(value));
2292
+ React13__default.default.useEffect(() => {
1854
2293
  setEditText(String(value));
1855
2294
  }, [value]);
1856
2295
  const showLabel = label || showValue || editableValue;
1857
- return /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.labelRow }, label && /* @__PURE__ */ React11__default.default.createElement(reactNative.Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React11__default.default.createElement(
2296
+ return /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.labelRow }, label && /* @__PURE__ */ React13__default.default.createElement(reactNative.Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React13__default.default.createElement(
1858
2297
  reactNative.TextInput,
1859
2298
  {
1860
2299
  style: styles.valueInput,
@@ -1866,7 +2305,7 @@ function Slider({
1866
2305
  selectTextOnFocus: true,
1867
2306
  editable: !disabled
1868
2307
  }
1869
- ) : showValue && /* @__PURE__ */ React11__default.default.createElement(reactNative.Text, { style: styles.value }, value)), /* @__PURE__ */ React11__default.default.createElement(
2308
+ ) : showValue && /* @__PURE__ */ React13__default.default.createElement(reactNative.Text, { style: styles.value }, value)), /* @__PURE__ */ React13__default.default.createElement(
1870
2309
  reactNative.View,
1871
2310
  {
1872
2311
  ref: trackRef,
@@ -1879,9 +2318,9 @@ function Slider({
1879
2318
  },
1880
2319
  ...panResponder.panHandlers
1881
2320
  },
1882
- /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.trackRail }),
1883
- /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: [styles.trackFill, { width: fillWidth }] }),
1884
- /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: [styles.thumb, { left: thumbLeft }] })
2321
+ /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.trackRail }),
2322
+ /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: [styles.trackFill, { width: fillWidth }] }),
2323
+ /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: [styles.thumb, { left: thumbLeft }] })
1885
2324
  ));
1886
2325
  }
1887
2326
  var TRACK_HEIGHT3 = 22;
@@ -1991,7 +2430,7 @@ function getHueSliderStyles(tokens, disabled) {
1991
2430
  });
1992
2431
  }
1993
2432
 
1994
- // src/HueSlider/HueSlider.tsx
2433
+ // src/composites/range-inputs/HueSlider/HueSlider.tsx
1995
2434
  function HueSlider({
1996
2435
  value,
1997
2436
  onValueChange,
@@ -2004,41 +2443,41 @@ function HueSlider({
2004
2443
  style
2005
2444
  }) {
2006
2445
  const tokens = useTokens(1);
2007
- const styles = React11__default.default.useMemo(
2446
+ const styles = React13__default.default.useMemo(
2008
2447
  () => getHueSliderStyles(tokens, disabled),
2009
2448
  [tokens, disabled]
2010
2449
  );
2011
- const segments = React11__default.default.useMemo(
2450
+ const segments = React13__default.default.useMemo(
2012
2451
  () => buildHueSegments(min, max),
2013
2452
  [min, max]
2014
2453
  );
2015
- const trackRef = React11__default.default.useRef(null);
2016
- const trackWidth = React11__default.default.useRef(0);
2017
- const trackPageX = React11__default.default.useRef(0);
2018
- const onValueChangeRef = React11__default.default.useRef(onValueChange);
2019
- const minRef = React11__default.default.useRef(min);
2020
- const maxRef = React11__default.default.useRef(max);
2021
- const disabledRef = React11__default.default.useRef(disabled);
2022
- React11__default.default.useEffect(() => {
2454
+ const trackRef = React13__default.default.useRef(null);
2455
+ const trackWidth = React13__default.default.useRef(0);
2456
+ const trackPageX = React13__default.default.useRef(0);
2457
+ const onValueChangeRef = React13__default.default.useRef(onValueChange);
2458
+ const minRef = React13__default.default.useRef(min);
2459
+ const maxRef = React13__default.default.useRef(max);
2460
+ const disabledRef = React13__default.default.useRef(disabled);
2461
+ React13__default.default.useEffect(() => {
2023
2462
  onValueChangeRef.current = onValueChange;
2024
2463
  }, [onValueChange]);
2025
- React11__default.default.useEffect(() => {
2464
+ React13__default.default.useEffect(() => {
2026
2465
  minRef.current = min;
2027
2466
  }, [min]);
2028
- React11__default.default.useEffect(() => {
2467
+ React13__default.default.useEffect(() => {
2029
2468
  maxRef.current = max;
2030
2469
  }, [max]);
2031
- React11__default.default.useEffect(() => {
2470
+ React13__default.default.useEffect(() => {
2032
2471
  disabledRef.current = disabled;
2033
2472
  }, [disabled]);
2034
- const computeHue = React11__default.default.useCallback((pageX) => {
2473
+ const computeHue = React13__default.default.useCallback((pageX) => {
2035
2474
  const localX = pageX - trackPageX.current;
2036
2475
  const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
2037
2476
  const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
2038
2477
  const stepped = Math.round(raw);
2039
2478
  return (stepped % 360 + 360) % 360;
2040
2479
  }, []);
2041
- const panResponder = React11__default.default.useRef(
2480
+ const panResponder = React13__default.default.useRef(
2042
2481
  reactNative.PanResponder.create({
2043
2482
  onStartShouldSetPanResponder: () => !disabledRef.current,
2044
2483
  onMoveShouldSetPanResponder: () => !disabledRef.current,
@@ -2054,7 +2493,7 @@ function HueSlider({
2054
2493
  const ratio = max > min ? (sliderValue - min) / (max - min) : 0;
2055
2494
  const usableWidth = Math.max(0, trackWidth.current - THUMB_SIZE3);
2056
2495
  const thumbLeft = ratio * usableWidth;
2057
- const handleValueTextSubmit = React11__default.default.useCallback(
2496
+ const handleValueTextSubmit = React13__default.default.useCallback(
2058
2497
  (text) => {
2059
2498
  const raw = Number(text);
2060
2499
  if (!Number.isNaN(raw)) {
@@ -2063,12 +2502,12 @@ function HueSlider({
2063
2502
  },
2064
2503
  [onValueChange]
2065
2504
  );
2066
- const [editText, setEditText] = React11__default.default.useState(String(value));
2067
- React11__default.default.useEffect(() => {
2505
+ const [editText, setEditText] = React13__default.default.useState(String(value));
2506
+ React13__default.default.useEffect(() => {
2068
2507
  setEditText(String(value));
2069
2508
  }, [value]);
2070
2509
  const showLabel = label || showValue || editableValue;
2071
- return /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.labelRow }, label && /* @__PURE__ */ React11__default.default.createElement(reactNative.Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React11__default.default.createElement(
2510
+ return /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.labelRow }, label && /* @__PURE__ */ React13__default.default.createElement(reactNative.Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React13__default.default.createElement(
2072
2511
  reactNative.TextInput,
2073
2512
  {
2074
2513
  style: styles.valueInput,
@@ -2080,7 +2519,7 @@ function HueSlider({
2080
2519
  selectTextOnFocus: true,
2081
2520
  editable: !disabled
2082
2521
  }
2083
- ) : showValue && /* @__PURE__ */ React11__default.default.createElement(reactNative.Text, { style: styles.value }, value, "\xB0")), /* @__PURE__ */ React11__default.default.createElement(
2522
+ ) : showValue && /* @__PURE__ */ React13__default.default.createElement(reactNative.Text, { style: styles.value }, value, "\xB0")), /* @__PURE__ */ React13__default.default.createElement(
2084
2523
  reactNative.View,
2085
2524
  {
2086
2525
  ref: trackRef,
@@ -2093,8 +2532,8 @@ function HueSlider({
2093
2532
  },
2094
2533
  ...panResponder.panHandlers
2095
2534
  },
2096
- /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.gradientTrack }, segments.map((color, i) => /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { key: i, style: [styles.segment, { backgroundColor: color }] }))),
2097
- /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: [styles.thumb, { left: thumbLeft }] })
2535
+ /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.gradientTrack }, segments.map((color, i) => /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { key: i, style: [styles.segment, { backgroundColor: color }] }))),
2536
+ /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: [styles.thumb, { left: thumbLeft }] })
2098
2537
  ));
2099
2538
  }
2100
2539
  var TRACK_HEIGHT4 = 22;
@@ -2140,296 +2579,132 @@ function getColorScaleSliderStyles(tokens, disabled) {
2140
2579
  borderRadius: THUMB_SIZE4 / 2,
2141
2580
  backgroundColor: "#ffffff",
2142
2581
  borderWidth: 2,
2143
- borderColor: newtone.srgbToHex(tokens.border.srgb)
2144
- },
2145
- warning: {
2146
- fontFamily: tokens.typography.fonts.default,
2147
- fontSize: tokens.typography.size.xs,
2148
- fontWeight: tokens.typography.weight.medium,
2149
- color: newtone.srgbToHex(tokens.error.srgb)
2150
- }
2151
- });
2152
- }
2153
-
2154
- // src/ColorScaleSlider/ColorScaleSlider.tsx
2155
- function ColorScaleSlider({
2156
- colors,
2157
- value,
2158
- onValueChange,
2159
- label,
2160
- warning,
2161
- trimEnds = false,
2162
- snap = false,
2163
- disabled = false,
2164
- animateValue = false,
2165
- style
2166
- }) {
2167
- const tokens = useTokens(1);
2168
- const styles = React11__default.default.useMemo(
2169
- () => getColorScaleSliderStyles(tokens, disabled),
2170
- [tokens, disabled]
2171
- );
2172
- const trackRef = React11__default.default.useRef(null);
2173
- const trackWidth = React11__default.default.useRef(0);
2174
- const trackPageX = React11__default.default.useRef(0);
2175
- const isDragging = React11__default.default.useRef(false);
2176
- const thumbAnim = React11__default.default.useRef(new reactNative.Animated.Value(0)).current;
2177
- const onValueChangeRef = React11__default.default.useRef(onValueChange);
2178
- const disabledRef = React11__default.default.useRef(disabled);
2179
- const colorsLengthRef = React11__default.default.useRef(colors.length);
2180
- const trimEndsRef = React11__default.default.useRef(trimEnds);
2181
- const snapRef = React11__default.default.useRef(snap);
2182
- React11__default.default.useEffect(() => {
2183
- onValueChangeRef.current = onValueChange;
2184
- }, [onValueChange]);
2185
- React11__default.default.useEffect(() => {
2186
- disabledRef.current = disabled;
2187
- }, [disabled]);
2188
- React11__default.default.useEffect(() => {
2189
- colorsLengthRef.current = colors.length;
2190
- }, [colors.length]);
2191
- React11__default.default.useEffect(() => {
2192
- trimEndsRef.current = trimEnds;
2193
- }, [trimEnds]);
2194
- React11__default.default.useEffect(() => {
2195
- snapRef.current = snap;
2196
- }, [snap]);
2197
- const computeNv = React11__default.default.useCallback((pageX) => {
2198
- const localX = pageX - trackPageX.current;
2199
- const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
2200
- const totalSteps2 = colorsLengthRef.current - 1;
2201
- const minNV2 = trimEndsRef.current ? 1 / totalSteps2 : 0;
2202
- const maxNV2 = trimEndsRef.current ? 1 - 1 / totalSteps2 : 1;
2203
- const range2 = maxNV2 - minNV2;
2204
- let nv = maxNV2 - ratio2 * range2;
2205
- if (snapRef.current && totalSteps2 > 0) {
2206
- const stepNv = 1 / totalSteps2;
2207
- nv = Math.round(nv / stepNv) * stepNv;
2208
- nv = Math.min(maxNV2, Math.max(minNV2, nv));
2209
- }
2210
- return nv;
2211
- }, []);
2212
- const panResponder = React11__default.default.useRef(
2213
- reactNative.PanResponder.create({
2214
- onStartShouldSetPanResponder: () => !disabledRef.current,
2215
- onMoveShouldSetPanResponder: () => !disabledRef.current,
2216
- onPanResponderGrant: (evt) => {
2217
- isDragging.current = true;
2218
- onValueChangeRef.current(computeNv(evt.nativeEvent.pageX));
2219
- },
2220
- onPanResponderMove: (_evt, gestureState) => {
2221
- onValueChangeRef.current(computeNv(gestureState.moveX));
2222
- },
2223
- onPanResponderRelease: () => {
2224
- isDragging.current = false;
2225
- },
2226
- onPanResponderTerminate: () => {
2227
- isDragging.current = false;
2228
- }
2229
- })
2230
- ).current;
2231
- const visibleColors = trimEnds ? colors.slice(1, -1) : colors;
2232
- const totalSteps = colors.length - 1;
2233
- const minNV = trimEnds ? 1 / totalSteps : 0;
2234
- const maxNV = trimEnds ? 1 - 1 / totalSteps : 1;
2235
- const range = maxNV - minNV;
2236
- const clampedValue = value !== void 0 ? Math.min(maxNV, Math.max(minNV, value)) : (maxNV + minNV) / 2;
2237
- const ratio = range > 0 ? (maxNV - clampedValue) / range : 0.5;
2238
- const usableWidth = Math.max(0, trackWidth.current - THUMB_SIZE4);
2239
- const thumbLeft = ratio * usableWidth;
2240
- React11__default.default.useEffect(() => {
2241
- if (isDragging.current || !animateValue) {
2242
- thumbAnim.setValue(thumbLeft);
2243
- } else {
2244
- reactNative.Animated.timing(thumbAnim, {
2245
- toValue: thumbLeft,
2246
- duration: 300,
2247
- useNativeDriver: false
2248
- }).start();
2249
- }
2250
- }, [thumbLeft, animateValue, thumbAnim]);
2251
- return /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.labelRow }, /* @__PURE__ */ React11__default.default.createElement(reactNative.Text, { style: styles.label }, label)), /* @__PURE__ */ React11__default.default.createElement(
2252
- reactNative.View,
2253
- {
2254
- ref: trackRef,
2255
- style: styles.trackContainer,
2256
- onLayout: (e) => {
2257
- trackWidth.current = e.nativeEvent.layout.width;
2258
- const newUsableWidth = Math.max(0, e.nativeEvent.layout.width - THUMB_SIZE4);
2259
- thumbAnim.setValue(ratio * newUsableWidth);
2260
- trackRef.current?.measure((_x, _y, _w, _h, pageX) => {
2261
- if (pageX != null) trackPageX.current = pageX;
2262
- });
2263
- },
2264
- ...panResponder.panHandlers
2265
- },
2266
- /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.gradientTrack }, visibleColors.map((color, i) => /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { key: i, style: [styles.segment, { backgroundColor: newtone.srgbToHex(color.srgb) }] }))),
2267
- /* @__PURE__ */ React11__default.default.createElement(reactNative.Animated.View, { style: [styles.thumb, { left: thumbAnim }] })
2268
- ), warning && /* @__PURE__ */ React11__default.default.createElement(reactNative.Text, { style: styles.warning }, warning));
2269
- }
2270
- function getWrapperStyles(input) {
2271
- const {
2272
- tokens,
2273
- direction = "vertical",
2274
- wrap = false,
2275
- reverse = false,
2276
- align,
2277
- justify,
2278
- padding,
2279
- gap,
2280
- width,
2281
- height,
2282
- minWidth,
2283
- maxWidth,
2284
- minHeight,
2285
- maxHeight
2286
- } = input;
2287
- const container = {};
2288
- container.flexDirection = resolveFlexDirection(direction, reverse);
2289
- if (wrap) container.flexWrap = "wrap";
2290
- if (align) container.alignItems = resolveAlignment(align);
2291
- if (justify) container.justifyContent = resolveJustification(justify);
2292
- if (padding !== void 0) {
2293
- const p = resolvePadding(padding, tokens);
2294
- container.paddingTop = p.top;
2295
- container.paddingRight = p.right;
2296
- container.paddingBottom = p.bottom;
2297
- container.paddingLeft = p.left;
2298
- }
2299
- if (gap !== void 0) {
2300
- const g = resolveGap(gap, tokens);
2301
- container.rowGap = g.rowGap;
2302
- container.columnGap = g.columnGap;
2303
- }
2304
- Object.assign(container, resolveSizing(width, height));
2305
- if (minWidth !== void 0) container.minWidth = minWidth;
2306
- if (maxWidth !== void 0) container.maxWidth = maxWidth;
2307
- if (minHeight !== void 0) container.minHeight = minHeight;
2308
- if (maxHeight !== void 0) container.maxHeight = maxHeight;
2309
- return reactNative.StyleSheet.create({ c: container }).c;
2310
- }
2311
-
2312
- // src/primitives/Wrapper/Wrapper.tsx
2313
- function Wrapper({
2314
- children,
2315
- direction,
2316
- wrap,
2317
- reverse,
2318
- align,
2319
- justify,
2320
- padding,
2321
- gap,
2322
- width,
2323
- height,
2324
- minWidth,
2325
- maxWidth,
2326
- minHeight,
2327
- maxHeight,
2328
- style,
2329
- // Testing & platform
2330
- testID,
2331
- nativeID,
2332
- ref
2333
- }) {
2334
- const tokens = useTokens(1);
2335
- const containerStyle = React11.useMemo(
2336
- () => getWrapperStyles({
2337
- tokens,
2338
- direction,
2339
- wrap,
2340
- reverse,
2341
- align,
2342
- justify,
2343
- padding,
2344
- gap,
2345
- width,
2346
- height,
2347
- minWidth,
2348
- maxWidth,
2349
- minHeight,
2350
- maxHeight
2351
- }),
2352
- [
2353
- tokens,
2354
- direction,
2355
- wrap,
2356
- reverse,
2357
- align,
2358
- justify,
2359
- padding,
2360
- gap,
2361
- width,
2362
- height,
2363
- minWidth,
2364
- maxWidth,
2365
- minHeight,
2366
- maxHeight
2367
- ]
2368
- );
2369
- const userStyles = Array.isArray(style) ? style : style ? [style] : [];
2370
- return /* @__PURE__ */ React11__default.default.createElement(
2371
- reactNative.View,
2372
- {
2373
- ref,
2374
- testID,
2375
- nativeID,
2376
- accessibilityRole: "none",
2377
- style: [containerStyle, ...userStyles]
2378
- },
2379
- children
2380
- );
2381
- }
2382
- var COLOR_MAP = {
2383
- primary: "textPrimary",
2384
- secondary: "textSecondary",
2385
- interactive: "interactive"
2386
- };
2387
- function Text11({
2388
- children,
2389
- size = "base",
2390
- weight = "regular",
2391
- color = "primary",
2392
- font = "default",
2393
- lineHeight = "normal",
2394
- align,
2395
- numberOfLines,
2396
- elevation = 1,
2397
- style,
2398
- // Accessibility
2399
- accessibilityRole,
2400
- // Testing & platform
2401
- testID,
2402
- nativeID,
2403
- ref
2582
+ borderColor: newtone.srgbToHex(tokens.border.srgb)
2583
+ },
2584
+ warning: {
2585
+ fontFamily: tokens.typography.fonts.default,
2586
+ fontSize: tokens.typography.size.xs,
2587
+ fontWeight: tokens.typography.weight.medium,
2588
+ color: newtone.srgbToHex(tokens.error.fill.srgb)
2589
+ }
2590
+ });
2591
+ }
2592
+
2593
+ // src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.tsx
2594
+ function ColorScaleSlider({
2595
+ colors,
2596
+ value,
2597
+ onValueChange,
2598
+ label,
2599
+ warning,
2600
+ trimEnds = false,
2601
+ snap = false,
2602
+ disabled = false,
2603
+ animateValue = false,
2604
+ style
2404
2605
  }) {
2405
- const tokens = useTokens(elevation);
2406
- const resolvedStyle = React11.useMemo(() => {
2407
- const fontSize = tokens.typography.size[size];
2408
- return {
2409
- // Font family from the theme (e.g. 'default' → 'Inter', 'mono' → 'JetBrains Mono').
2410
- fontFamily: tokens.typography.fonts[font],
2411
- fontSize,
2412
- // Font weight is stored as a number (e.g. 400, 600) but React Native expects a string.
2413
- fontWeight: String(tokens.typography.weight[weight]),
2414
- // Convert the theme color from internal sRGB format to a hex string (e.g. '#1a1a1a').
2415
- color: newtone.srgbToHex(tokens[COLOR_MAP[color]].srgb),
2416
- // Line height = font size × multiplier (e.g. 16px × 1.5 = 24px line height).
2417
- lineHeight: fontSize * tokens.typography.lineHeight[lineHeight],
2418
- textAlign: align
2419
- };
2420
- }, [tokens, size, weight, color, font, lineHeight, align]);
2421
- return /* @__PURE__ */ React11__default.default.createElement(
2422
- reactNative.Text,
2606
+ const tokens = useTokens(1);
2607
+ const styles = React13__default.default.useMemo(
2608
+ () => getColorScaleSliderStyles(tokens, disabled),
2609
+ [tokens, disabled]
2610
+ );
2611
+ const trackRef = React13__default.default.useRef(null);
2612
+ const trackWidth = React13__default.default.useRef(0);
2613
+ const trackPageX = React13__default.default.useRef(0);
2614
+ const isDragging = React13__default.default.useRef(false);
2615
+ const thumbAnim = React13__default.default.useRef(new reactNative.Animated.Value(0)).current;
2616
+ const onValueChangeRef = React13__default.default.useRef(onValueChange);
2617
+ const disabledRef = React13__default.default.useRef(disabled);
2618
+ const colorsLengthRef = React13__default.default.useRef(colors.length);
2619
+ const trimEndsRef = React13__default.default.useRef(trimEnds);
2620
+ const snapRef = React13__default.default.useRef(snap);
2621
+ React13__default.default.useEffect(() => {
2622
+ onValueChangeRef.current = onValueChange;
2623
+ }, [onValueChange]);
2624
+ React13__default.default.useEffect(() => {
2625
+ disabledRef.current = disabled;
2626
+ }, [disabled]);
2627
+ React13__default.default.useEffect(() => {
2628
+ colorsLengthRef.current = colors.length;
2629
+ }, [colors.length]);
2630
+ React13__default.default.useEffect(() => {
2631
+ trimEndsRef.current = trimEnds;
2632
+ }, [trimEnds]);
2633
+ React13__default.default.useEffect(() => {
2634
+ snapRef.current = snap;
2635
+ }, [snap]);
2636
+ const computeNv = React13__default.default.useCallback((pageX) => {
2637
+ const localX = pageX - trackPageX.current;
2638
+ const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
2639
+ const totalSteps2 = colorsLengthRef.current - 1;
2640
+ const minNV2 = trimEndsRef.current ? 1 / totalSteps2 : 0;
2641
+ const maxNV2 = trimEndsRef.current ? 1 - 1 / totalSteps2 : 1;
2642
+ const range2 = maxNV2 - minNV2;
2643
+ let nv = maxNV2 - ratio2 * range2;
2644
+ if (snapRef.current && totalSteps2 > 0) {
2645
+ const stepNv = 1 / totalSteps2;
2646
+ nv = Math.round(nv / stepNv) * stepNv;
2647
+ nv = Math.min(maxNV2, Math.max(minNV2, nv));
2648
+ }
2649
+ return nv;
2650
+ }, []);
2651
+ const panResponder = React13__default.default.useRef(
2652
+ reactNative.PanResponder.create({
2653
+ onStartShouldSetPanResponder: () => !disabledRef.current,
2654
+ onMoveShouldSetPanResponder: () => !disabledRef.current,
2655
+ onPanResponderGrant: (evt) => {
2656
+ isDragging.current = true;
2657
+ onValueChangeRef.current(computeNv(evt.nativeEvent.pageX));
2658
+ },
2659
+ onPanResponderMove: (_evt, gestureState) => {
2660
+ onValueChangeRef.current(computeNv(gestureState.moveX));
2661
+ },
2662
+ onPanResponderRelease: () => {
2663
+ isDragging.current = false;
2664
+ },
2665
+ onPanResponderTerminate: () => {
2666
+ isDragging.current = false;
2667
+ }
2668
+ })
2669
+ ).current;
2670
+ const visibleColors = trimEnds ? colors.slice(1, -1) : colors;
2671
+ const totalSteps = colors.length - 1;
2672
+ const minNV = trimEnds ? 1 / totalSteps : 0;
2673
+ const maxNV = trimEnds ? 1 - 1 / totalSteps : 1;
2674
+ const range = maxNV - minNV;
2675
+ const clampedValue = value !== void 0 ? Math.min(maxNV, Math.max(minNV, value)) : (maxNV + minNV) / 2;
2676
+ const ratio = range > 0 ? (maxNV - clampedValue) / range : 0.5;
2677
+ const usableWidth = Math.max(0, trackWidth.current - THUMB_SIZE4);
2678
+ const thumbLeft = ratio * usableWidth;
2679
+ React13__default.default.useEffect(() => {
2680
+ if (isDragging.current || !animateValue) {
2681
+ thumbAnim.setValue(thumbLeft);
2682
+ } else {
2683
+ reactNative.Animated.timing(thumbAnim, {
2684
+ toValue: thumbLeft,
2685
+ duration: 300,
2686
+ useNativeDriver: false
2687
+ }).start();
2688
+ }
2689
+ }, [thumbLeft, animateValue, thumbAnim]);
2690
+ return /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.labelRow }, /* @__PURE__ */ React13__default.default.createElement(reactNative.Text, { style: styles.label }, label)), /* @__PURE__ */ React13__default.default.createElement(
2691
+ reactNative.View,
2423
2692
  {
2424
- ref,
2425
- testID,
2426
- nativeID,
2427
- accessibilityRole,
2428
- style: style ? [resolvedStyle, ...Array.isArray(style) ? style : [style]] : resolvedStyle,
2429
- numberOfLines
2693
+ ref: trackRef,
2694
+ style: styles.trackContainer,
2695
+ onLayout: (e) => {
2696
+ trackWidth.current = e.nativeEvent.layout.width;
2697
+ const newUsableWidth = Math.max(0, e.nativeEvent.layout.width - THUMB_SIZE4);
2698
+ thumbAnim.setValue(ratio * newUsableWidth);
2699
+ trackRef.current?.measure((_x, _y, _w, _h, pageX) => {
2700
+ if (pageX != null) trackPageX.current = pageX;
2701
+ });
2702
+ },
2703
+ ...panResponder.panHandlers
2430
2704
  },
2431
- children
2432
- );
2705
+ /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.gradientTrack }, visibleColors.map((color, i) => /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { key: i, style: [styles.segment, { backgroundColor: newtone.srgbToHex(color.srgb) }] }))),
2706
+ /* @__PURE__ */ React13__default.default.createElement(reactNative.Animated.View, { style: [styles.thumb, { left: thumbAnim }] })
2707
+ ), warning && /* @__PURE__ */ React13__default.default.createElement(reactNative.Text, { style: styles.warning }, warning));
2433
2708
  }
2434
2709
  function getAppShellStyles(tokens) {
2435
2710
  return reactNative.StyleSheet.create({
@@ -2448,11 +2723,11 @@ function getAppShellStyles(tokens) {
2448
2723
  });
2449
2724
  }
2450
2725
 
2451
- // src/AppShell/AppShell.tsx
2726
+ // src/composites/layout/AppShell/AppShell.tsx
2452
2727
  function AppShell({ sidebar, children }) {
2453
2728
  const tokens = useTokens();
2454
- const styles = React11__default.default.useMemo(() => getAppShellStyles(tokens), [tokens]);
2455
- return /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.container }, sidebar, /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.main }, children));
2729
+ const styles = React13__default.default.useMemo(() => getAppShellStyles(tokens), [tokens]);
2730
+ return /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.container }, sidebar, /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.main }, children));
2456
2731
  }
2457
2732
  function getSidebarStyles({ tokens, width, bordered }) {
2458
2733
  const borderColor = newtone.srgbToHex(tokens.border.srgb);
@@ -2481,7 +2756,7 @@ function getSidebarStyles({ tokens, width, bordered }) {
2481
2756
  });
2482
2757
  }
2483
2758
 
2484
- // src/Sidebar/Sidebar.tsx
2759
+ // src/composites/layout/Sidebar/Sidebar.tsx
2485
2760
  function Sidebar({
2486
2761
  children,
2487
2762
  header,
@@ -2490,11 +2765,11 @@ function Sidebar({
2490
2765
  bordered = true
2491
2766
  }) {
2492
2767
  const tokens = useTokens();
2493
- const styles = React11__default.default.useMemo(
2768
+ const styles = React13__default.default.useMemo(
2494
2769
  () => getSidebarStyles({ tokens, width, bordered }),
2495
2770
  [tokens, width, bordered]
2496
2771
  );
2497
- return /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.container }, header && /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.header }, header), /* @__PURE__ */ React11__default.default.createElement(reactNative.ScrollView, { style: styles.body }, children), footer && /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.footer }, footer));
2772
+ return /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.container }, header && /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.header }, header), /* @__PURE__ */ React13__default.default.createElement(reactNative.ScrollView, { style: styles.body }, children), footer && /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.footer }, footer));
2498
2773
  }
2499
2774
  function getNavbarStyles({ tokens, height, bordered }) {
2500
2775
  const borderColor = newtone.srgbToHex(tokens.border.srgb);
@@ -2523,7 +2798,7 @@ function getNavbarStyles({ tokens, height, bordered }) {
2523
2798
  });
2524
2799
  }
2525
2800
 
2526
- // src/Navbar/Navbar.tsx
2801
+ // src/composites/layout/Navbar/Navbar.tsx
2527
2802
  function Navbar({
2528
2803
  children,
2529
2804
  left,
@@ -2532,19 +2807,21 @@ function Navbar({
2532
2807
  bordered = true
2533
2808
  }) {
2534
2809
  const tokens = useTokens();
2535
- const styles = React11__default.default.useMemo(
2810
+ const styles = React13__default.default.useMemo(
2536
2811
  () => getNavbarStyles({ tokens, height, bordered }),
2537
2812
  [tokens, height, bordered]
2538
2813
  );
2539
- return /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.container }, children ? children : /* @__PURE__ */ React11__default.default.createElement(React11__default.default.Fragment, null, /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.left }, left), /* @__PURE__ */ React11__default.default.createElement(reactNative.View, { style: styles.right }, right)));
2814
+ return /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.container }, children ? children : /* @__PURE__ */ React13__default.default.createElement(React13__default.default.Fragment, null, /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.left }, left), /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.right }, right)));
2540
2815
  }
2541
2816
 
2542
2817
  // src/registry/registry.ts
2543
2818
  var CATEGORIES = [
2819
+ { id: "primitives", name: "Design Primitives", description: "Core building blocks for theme-aware layouts and typography" },
2544
2820
  { id: "actions", name: "Actions", description: "Interactive elements that trigger actions" },
2545
2821
  { id: "form-controls", name: "Form Controls", description: "Input elements for user data entry" },
2546
- { id: "range-inputs", name: "Range Inputs", description: "Slider controls for numeric values" },
2547
- { id: "layout", name: "Layout", description: "Structural and container components" }
2822
+ { id: "range-inputs", name: "Range Inputs", description: "Slider controls for numeric and continuous values" },
2823
+ { id: "layout", name: "Layout", description: "Structural and container components" },
2824
+ { id: "overlays", name: "Overlays", description: "Floating and portal-based UI elements" }
2548
2825
  ];
2549
2826
  var COMPONENTS = [
2550
2827
  {
@@ -2557,13 +2834,17 @@ var COMPONENTS = [
2557
2834
  variants: [
2558
2835
  { id: "primary-md", label: "Primary", props: { variant: "primary", size: "md" } },
2559
2836
  { id: "secondary-md", label: "Secondary", props: { variant: "secondary", size: "md" } },
2560
- { id: "ghost-md", label: "Ghost", props: { variant: "ghost", size: "md" } },
2561
- { id: "outline-md", label: "Outline", props: { variant: "outline", size: "md" } },
2837
+ { id: "tertiary-md", label: "Tertiary", props: { variant: "tertiary", size: "md" } },
2562
2838
  { id: "primary-sm", label: "Primary Small", props: { variant: "primary", size: "sm" } },
2563
2839
  { id: "primary-lg", label: "Primary Large", props: { variant: "primary", size: "lg" } },
2840
+ { id: "accent-primary", label: "Accent Primary", props: { variant: "primary", size: "md", semantic: "accent" } },
2841
+ { id: "accent-secondary", label: "Accent Secondary", props: { variant: "secondary", size: "md", semantic: "accent" } },
2842
+ { id: "success-primary", label: "Success Primary", props: { variant: "primary", size: "md", semantic: "success" } },
2843
+ { id: "error-primary", label: "Error Primary", props: { variant: "primary", size: "md", semantic: "error" } },
2844
+ { id: "warning-primary", label: "Warning Primary", props: { variant: "primary", size: "md", semantic: "warning" } },
2564
2845
  { id: "icon-left", label: "Icon Left", props: { variant: "primary", size: "md", icon: "add" } },
2565
2846
  { id: "icon-right", label: "Icon Right", props: { variant: "primary", size: "md", icon: "arrow_forward", iconPosition: "right" } },
2566
- { id: "icon-only", label: "Icon Only", props: { variant: "ghost", size: "md", icon: "settings" } }
2847
+ { id: "icon-only", label: "Icon Only", props: { variant: "tertiary", size: "md", icon: "settings" } }
2567
2848
  ],
2568
2849
  editableProps: [
2569
2850
  {
@@ -2573,11 +2854,23 @@ var COMPONENTS = [
2573
2854
  options: [
2574
2855
  { label: "Primary", value: "primary" },
2575
2856
  { label: "Secondary", value: "secondary" },
2576
- { label: "Ghost", value: "ghost" },
2577
- { label: "Outline", value: "outline" }
2857
+ { label: "Tertiary", value: "tertiary" }
2578
2858
  ],
2579
2859
  defaultValue: "primary"
2580
2860
  },
2861
+ {
2862
+ name: "semantic",
2863
+ label: "Semantic",
2864
+ control: "select",
2865
+ options: [
2866
+ { label: "Neutral", value: "neutral" },
2867
+ { label: "Accent", value: "accent" },
2868
+ { label: "Success", value: "success" },
2869
+ { label: "Warning", value: "warning" },
2870
+ { label: "Error", value: "error" }
2871
+ ],
2872
+ defaultValue: "neutral"
2873
+ },
2581
2874
  {
2582
2875
  name: "size",
2583
2876
  label: "Size",
@@ -2925,6 +3218,221 @@ var COMPONENTS = [
2925
3218
  defaultValue: false
2926
3219
  }
2927
3220
  ]
3221
+ },
3222
+ // ── Design Primitives ──
3223
+ {
3224
+ id: "text",
3225
+ name: "Text",
3226
+ importName: "Text",
3227
+ categoryId: "primitives",
3228
+ description: "Typography primitive with semantic size, weight, color, font, and lineHeight",
3229
+ hasChildren: true,
3230
+ variants: [
3231
+ { id: "default", label: "Default", props: {} },
3232
+ { id: "heading", label: "Heading", props: { size: "xl", weight: "bold" } },
3233
+ { id: "subheading", label: "Subheading", props: { size: "lg", weight: "semibold" } },
3234
+ { id: "body", label: "Body", props: { size: "base" } },
3235
+ { id: "caption", label: "Caption", props: { size: "sm", color: "secondary" } },
3236
+ { id: "accent", label: "Accent", props: { color: "accent", weight: "medium" } },
3237
+ { id: "mono", label: "Monospace", props: { font: "mono", size: "sm" } }
3238
+ ],
3239
+ editableProps: [
3240
+ {
3241
+ name: "size",
3242
+ label: "Size",
3243
+ control: "select",
3244
+ options: [
3245
+ { label: "Extra Small", value: "xs" },
3246
+ { label: "Small", value: "sm" },
3247
+ { label: "Base", value: "base" },
3248
+ { label: "Medium", value: "md" },
3249
+ { label: "Large", value: "lg" },
3250
+ { label: "Extra Large", value: "xl" },
3251
+ { label: "XXL", value: "xxl" }
3252
+ ],
3253
+ defaultValue: "base"
3254
+ },
3255
+ {
3256
+ name: "weight",
3257
+ label: "Weight",
3258
+ control: "select",
3259
+ options: [
3260
+ { label: "Regular", value: "regular" },
3261
+ { label: "Medium", value: "medium" },
3262
+ { label: "Semibold", value: "semibold" },
3263
+ { label: "Bold", value: "bold" }
3264
+ ],
3265
+ defaultValue: "regular"
3266
+ },
3267
+ {
3268
+ name: "color",
3269
+ label: "Color",
3270
+ control: "select",
3271
+ options: [
3272
+ { label: "Primary", value: "primary" },
3273
+ { label: "Secondary", value: "secondary" },
3274
+ { label: "Tertiary", value: "tertiary" },
3275
+ { label: "Disabled", value: "disabled" },
3276
+ { label: "Accent", value: "accent" },
3277
+ { label: "Success", value: "success" },
3278
+ { label: "Warning", value: "warning" },
3279
+ { label: "Error", value: "error" }
3280
+ ],
3281
+ defaultValue: "primary"
3282
+ },
3283
+ {
3284
+ name: "font",
3285
+ label: "Font",
3286
+ control: "select",
3287
+ options: [
3288
+ { label: "Default", value: "default" },
3289
+ { label: "Display", value: "display" },
3290
+ { label: "Mono", value: "mono" }
3291
+ ],
3292
+ defaultValue: "default"
3293
+ }
3294
+ ]
3295
+ },
3296
+ {
3297
+ id: "icon",
3298
+ name: "Icon",
3299
+ importName: "Icon",
3300
+ categoryId: "primitives",
3301
+ description: "Material Symbols icon with size, fill, and color",
3302
+ hasChildren: false,
3303
+ variants: [
3304
+ { id: "home", label: "Home", props: { name: "home" } },
3305
+ { id: "settings", label: "Settings", props: { name: "settings" } },
3306
+ { id: "check", label: "Check", props: { name: "check" } },
3307
+ { id: "add", label: "Add", props: { name: "add" } },
3308
+ { id: "delete", label: "Delete", props: { name: "delete" } },
3309
+ { id: "search", label: "Search", props: { name: "search" } },
3310
+ { id: "filled", label: "Filled Icon", props: { name: "favorite", fill: 1 } },
3311
+ { id: "large", label: "Large Icon", props: { name: "star", size: 32 } }
3312
+ ],
3313
+ editableProps: [
3314
+ {
3315
+ name: "name",
3316
+ label: "Icon Name",
3317
+ control: "text",
3318
+ defaultValue: "home"
3319
+ },
3320
+ {
3321
+ name: "size",
3322
+ label: "Size",
3323
+ control: "number",
3324
+ defaultValue: 24
3325
+ },
3326
+ {
3327
+ name: "fill",
3328
+ label: "Fill",
3329
+ control: "select",
3330
+ options: [
3331
+ { label: "Outlined", value: 0 },
3332
+ { label: "Filled", value: 1 }
3333
+ ],
3334
+ defaultValue: 0
3335
+ }
3336
+ ]
3337
+ },
3338
+ {
3339
+ id: "wrapper",
3340
+ name: "Wrapper",
3341
+ importName: "Wrapper",
3342
+ categoryId: "primitives",
3343
+ description: "Lightweight layout container with direction, spacing, and alignment (no theming)",
3344
+ hasChildren: true,
3345
+ variants: [
3346
+ { id: "vertical", label: "Vertical Stack", props: { direction: "vertical", gap: "md" } },
3347
+ { id: "horizontal", label: "Horizontal Row", props: { direction: "horizontal", gap: "md", align: "center" } },
3348
+ { id: "padded", label: "Padded", props: { padding: "lg", gap: "md" } },
3349
+ { id: "centered", label: "Centered", props: { align: "center", justify: "center", padding: "xl" } }
3350
+ ],
3351
+ editableProps: [
3352
+ {
3353
+ name: "direction",
3354
+ label: "Direction",
3355
+ control: "select",
3356
+ options: [
3357
+ { label: "Vertical", value: "vertical" },
3358
+ { label: "Horizontal", value: "horizontal" }
3359
+ ],
3360
+ defaultValue: "vertical"
3361
+ },
3362
+ {
3363
+ name: "gap",
3364
+ label: "Gap",
3365
+ control: "select",
3366
+ options: [
3367
+ { label: "None", value: "" },
3368
+ { label: "Small", value: "sm" },
3369
+ { label: "Medium", value: "md" },
3370
+ { label: "Large", value: "lg" }
3371
+ ],
3372
+ defaultValue: ""
3373
+ },
3374
+ {
3375
+ name: "padding",
3376
+ label: "Padding",
3377
+ control: "select",
3378
+ options: [
3379
+ { label: "None", value: "" },
3380
+ { label: "Small", value: "sm" },
3381
+ { label: "Medium", value: "md" },
3382
+ { label: "Large", value: "lg" }
3383
+ ],
3384
+ defaultValue: ""
3385
+ },
3386
+ {
3387
+ name: "align",
3388
+ label: "Align",
3389
+ control: "select",
3390
+ options: [
3391
+ { label: "Start", value: "start" },
3392
+ { label: "Center", value: "center" },
3393
+ { label: "End", value: "end" }
3394
+ ],
3395
+ defaultValue: "start"
3396
+ },
3397
+ {
3398
+ name: "justify",
3399
+ label: "Justify",
3400
+ control: "select",
3401
+ options: [
3402
+ { label: "Start", value: "start" },
3403
+ { label: "Center", value: "center" },
3404
+ { label: "End", value: "end" },
3405
+ { label: "Space Between", value: "space-between" }
3406
+ ],
3407
+ defaultValue: "start"
3408
+ }
3409
+ ]
3410
+ },
3411
+ // ── Range Inputs (Addition: ColorScaleSlider) ──
3412
+ {
3413
+ id: "color-scale-slider",
3414
+ name: "ColorScaleSlider",
3415
+ importName: "ColorScaleSlider",
3416
+ categoryId: "range-inputs",
3417
+ description: "Interactive palette preview slider with color segments",
3418
+ hasChildren: false,
3419
+ variants: [
3420
+ { id: "default", label: "Default", props: { label: "Key Color" } }
3421
+ ],
3422
+ editableProps: [
3423
+ {
3424
+ name: "label",
3425
+ label: "Label",
3426
+ control: "text",
3427
+ defaultValue: "Key Color"
3428
+ },
3429
+ {
3430
+ name: "disabled",
3431
+ label: "Disabled",
3432
+ control: "toggle",
3433
+ defaultValue: false
3434
+ }
3435
+ ]
2928
3436
  }
2929
3437
  ];
2930
3438
  function getComponent(id) {
@@ -3093,6 +3601,7 @@ var SYSTEM_FONTS = [
3093
3601
  }
3094
3602
  ];
3095
3603
 
3604
+ exports.ACCENT_DEFAULTS = ACCENT_DEFAULTS;
3096
3605
  exports.AppShell = AppShell;
3097
3606
  exports.Button = Button;
3098
3607
  exports.CATEGORIES = CATEGORIES;
@@ -3100,20 +3609,24 @@ exports.COMPONENTS = COMPONENTS;
3100
3609
  exports.Card = Card;
3101
3610
  exports.ColorScaleSlider = ColorScaleSlider;
3102
3611
  exports.DEFAULT_THEME_CONFIG = DEFAULT_THEME_CONFIG;
3612
+ exports.ERROR_DEFAULTS = ERROR_DEFAULTS;
3103
3613
  exports.Frame = Frame;
3104
3614
  exports.GOOGLE_FONTS = GOOGLE_FONTS;
3105
3615
  exports.HueSlider = HueSlider;
3106
3616
  exports.Icon = Icon;
3617
+ exports.NEUTRAL_DEFAULTS = NEUTRAL_DEFAULTS;
3107
3618
  exports.Navbar = Navbar;
3108
3619
  exports.NewtoneProvider = NewtoneProvider;
3109
3620
  exports.Popover = Popover;
3621
+ exports.SUCCESS_DEFAULTS = SUCCESS_DEFAULTS;
3110
3622
  exports.SYSTEM_FONTS = SYSTEM_FONTS;
3111
3623
  exports.Select = Select;
3112
3624
  exports.Sidebar = Sidebar;
3113
3625
  exports.Slider = Slider;
3114
- exports.Text = Text11;
3626
+ exports.Text = Text2;
3115
3627
  exports.TextInput = TextInput;
3116
3628
  exports.Toggle = Toggle;
3629
+ exports.WARNING_DEFAULTS = WARNING_DEFAULTS;
3117
3630
  exports.Wrapper = Wrapper;
3118
3631
  exports.buildGoogleFontsUrl = buildGoogleFontsUrl;
3119
3632
  exports.computeTokens = computeTokens;