@newtonedev/components 0.1.5 → 0.1.7

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 (69) hide show
  1. package/dist/composites/actions/Button/Button.d.ts.map +1 -1
  2. package/dist/composites/actions/Button/Button.styles.d.ts +3 -1
  3. package/dist/composites/actions/Button/Button.styles.d.ts.map +1 -1
  4. package/dist/index.cjs +603 -249
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.ts +6 -5
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +599 -251
  9. package/dist/index.js.map +1 -1
  10. package/dist/primitives/Frame/Frame.d.ts +2 -3
  11. package/dist/primitives/Frame/Frame.d.ts.map +1 -1
  12. package/dist/primitives/Frame/Frame.types.d.ts +4 -15
  13. package/dist/primitives/Frame/Frame.types.d.ts.map +1 -1
  14. package/dist/primitives/Icon/Icon.d.ts +1 -1
  15. package/dist/primitives/Icon/Icon.d.ts.map +1 -1
  16. package/dist/primitives/Icon/Icon.types.d.ts +7 -12
  17. package/dist/primitives/Icon/Icon.types.d.ts.map +1 -1
  18. package/dist/primitives/Text/Text.d.ts.map +1 -1
  19. package/dist/primitives/Text/Text.types.d.ts +9 -4
  20. package/dist/primitives/Text/Text.types.d.ts.map +1 -1
  21. package/dist/primitives/Wrapper/Wrapper.d.ts +1 -1
  22. package/dist/primitives/Wrapper/Wrapper.types.d.ts +1 -1
  23. package/dist/registry/icons.d.ts +7 -0
  24. package/dist/registry/icons.d.ts.map +1 -0
  25. package/dist/registry/index.d.ts +2 -0
  26. package/dist/registry/index.d.ts.map +1 -1
  27. package/dist/registry/registry.d.ts.map +1 -1
  28. package/dist/registry/types.d.ts +1 -1
  29. package/dist/registry/types.d.ts.map +1 -1
  30. package/dist/theme/FrameContext.d.ts +7 -5
  31. package/dist/theme/FrameContext.d.ts.map +1 -1
  32. package/dist/theme/NewtoneProvider.d.ts +5 -6
  33. package/dist/theme/NewtoneProvider.d.ts.map +1 -1
  34. package/dist/theme/defaults.d.ts.map +1 -1
  35. package/dist/theme/types.d.ts +38 -24
  36. package/dist/theme/types.d.ts.map +1 -1
  37. package/dist/tokens/computeTokens.d.ts +82 -7
  38. package/dist/tokens/computeTokens.d.ts.map +1 -1
  39. package/dist/tokens/types.d.ts +58 -16
  40. package/dist/tokens/types.d.ts.map +1 -1
  41. package/dist/tokens/useTokens.d.ts +2 -23
  42. package/dist/tokens/useTokens.d.ts.map +1 -1
  43. package/package.json +1 -1
  44. package/src/composites/actions/Button/Button.styles.ts +53 -80
  45. package/src/composites/actions/Button/Button.tsx +6 -2
  46. package/src/composites/form-controls/Select/SelectOption.tsx +2 -2
  47. package/src/composites/form-controls/Toggle/Toggle.styles.ts +1 -1
  48. package/src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.ts +1 -1
  49. package/src/composites/range-inputs/Slider/Slider.styles.ts +2 -2
  50. package/src/index.ts +13 -4
  51. package/src/primitives/Frame/Frame.tsx +10 -18
  52. package/src/primitives/Frame/Frame.types.ts +5 -17
  53. package/src/primitives/Icon/Icon.tsx +4 -6
  54. package/src/primitives/Icon/Icon.types.ts +7 -14
  55. package/src/primitives/Text/Text.tsx +18 -8
  56. package/src/primitives/Text/Text.types.ts +9 -4
  57. package/src/primitives/Wrapper/Wrapper.tsx +1 -1
  58. package/src/primitives/Wrapper/Wrapper.types.ts +1 -1
  59. package/src/registry/icons.ts +111 -0
  60. package/src/registry/index.ts +3 -0
  61. package/src/registry/registry.ts +40 -24
  62. package/src/registry/types.ts +1 -1
  63. package/src/theme/FrameContext.tsx +7 -5
  64. package/src/theme/NewtoneProvider.tsx +5 -10
  65. package/src/theme/defaults.ts +0 -9
  66. package/src/theme/types.ts +53 -26
  67. package/src/tokens/computeTokens.ts +338 -116
  68. package/src/tokens/types.ts +74 -16
  69. package/src/tokens/useTokens.ts +16 -33
package/dist/index.cjs CHANGED
@@ -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
@@ -196,20 +186,16 @@ 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
191
  const [mode, setMode] = React13.useState(initialMode);
203
- const [theme, setTheme] = React13.useState(initialTheme);
204
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
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
  }
@@ -224,19 +210,160 @@ var FrameContext = React13.createContext(null);
224
210
  function useFrameContext() {
225
211
  return React13.useContext(FrameContext);
226
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,8 +389,11 @@ function computeTokens(config, mode, themeMapping, elevation, elevationOffsets,
264
389
  palette.desaturation,
265
390
  palette.paletteHueGrading
266
391
  );
267
- const INTERACTIVE_COMPONENT_OFFSET = -0.035;
268
- const interactiveComponentNv = Math.max(0, Math.min(1, backgroundNv + INTERACTIVE_COMPONENT_OFFSET));
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));
269
397
  const backgroundInteractive = newtone.getColor(
270
398
  palette.hue,
271
399
  palette.saturation,
@@ -274,143 +402,135 @@ function computeTokens(config, mode, themeMapping, elevation, elevationOffsets,
274
402
  palette.desaturation,
275
403
  palette.paletteHueGrading
276
404
  );
277
- const textPrimary = 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
- 4.5,
282
- effectiveTextMode,
410
+ neutralHoverNv,
283
411
  palette.desaturation,
284
- palette.paletteHueGrading,
285
- background
412
+ palette.paletteHueGrading
286
413
  );
287
- const textSecondary = newtone.getColorByContrast(
414
+ const neutralActiveNv = clamp(interactiveComponentNv + (effectiveTextMode === "light" ? -ACTIVE_SHIFT : ACTIVE_SHIFT));
415
+ const backgroundInteractiveActive = newtone.getColor(
288
416
  palette.hue,
289
417
  palette.saturation,
290
418
  dynamicRange,
291
- 3,
292
- effectiveTextMode,
419
+ neutralActiveNv,
293
420
  palette.desaturation,
294
- palette.paletteHueGrading,
295
- background
421
+ palette.paletteHueGrading
296
422
  );
297
- const accentPalette = palettes[1];
298
- if (!accentPalette) {
299
- throw new Error("Accent palette (index 1) not found");
300
- }
301
- const resolveKeyNv = (p) => mode === "dark" ? p.keyNormalizedValueDark : p.keyNormalizedValue;
302
- const accentKeyNv = resolveKeyNv(accentPalette);
303
- const interactive = accentKeyNv !== void 0 ? newtone.getColor(
304
- accentPalette.hue,
305
- accentPalette.saturation,
423
+ const textToEngineNv = (nv) => effectiveTextMode === "light" ? 1 - nv : nv;
424
+ const textPrimary = newtone.getColor(
425
+ palette.hue,
426
+ palette.saturation,
306
427
  dynamicRange,
307
- accentKeyNv,
308
- accentPalette.desaturation,
309
- accentPalette.paletteHueGrading
310
- ) : newtone.getColorByContrast(
311
- accentPalette.hue,
312
- accentPalette.saturation,
428
+ clamp(textToEngineNv(textPrimaryNorm ?? neutralDefaults.text.primary) + elevationDelta),
429
+ palette.desaturation,
430
+ palette.paletteHueGrading
431
+ );
432
+ const textSecondary = newtone.getColor(
433
+ palette.hue,
434
+ palette.saturation,
313
435
  dynamicRange,
314
- 4.5,
315
- effectiveTextMode,
316
- accentPalette.desaturation,
317
- accentPalette.paletteHueGrading,
318
- background
436
+ clamp(textToEngineNv(textSecondaryNorm ?? neutralDefaults.text.secondary) + elevationDelta),
437
+ palette.desaturation,
438
+ palette.paletteHueGrading
319
439
  );
320
- const interactiveNv = accentKeyNv ?? (effectiveTextMode === "light" ? 0.3 : 0.7);
321
- const interactiveHover = newtone.getColor(
322
- accentPalette.hue,
323
- accentPalette.saturation,
440
+ const textTertiary = newtone.getColor(
441
+ palette.hue,
442
+ palette.saturation,
324
443
  dynamicRange,
325
- interactiveNv + (effectiveTextMode === "light" ? -0.05 : 0.05),
326
- accentPalette.desaturation,
327
- accentPalette.paletteHueGrading
444
+ clamp(textToEngineNv(textTertiaryNorm ?? neutralDefaults.text.tertiary) + elevationDelta),
445
+ palette.desaturation,
446
+ palette.paletteHueGrading
328
447
  );
329
- const interactiveActive = newtone.getColor(
330
- accentPalette.hue,
331
- accentPalette.saturation,
448
+ const textDisabled = newtone.getColor(
449
+ palette.hue,
450
+ palette.saturation,
332
451
  dynamicRange,
333
- interactiveNv + (effectiveTextMode === "light" ? -0.1 : 0.1),
334
- accentPalette.desaturation,
335
- accentPalette.paletteHueGrading
452
+ clamp(textToEngineNv(textDisabledNorm ?? neutralDefaults.text.disabled) + elevationDelta),
453
+ palette.desaturation,
454
+ palette.paletteHueGrading
336
455
  );
337
- const borderNv = effectiveTextMode === "light" ? backgroundNv - 0.1 : backgroundNv + 0.1;
456
+ const borderNv = effectiveTextMode === "light" ? backgroundNv - BORDER_OFFSET : backgroundNv + BORDER_OFFSET;
338
457
  const border = newtone.getColor(
339
458
  palette.hue,
340
459
  palette.saturation,
341
460
  dynamicRange,
342
- Math.max(0, Math.min(1, borderNv)),
461
+ clamp(borderNv),
343
462
  palette.desaturation,
344
463
  palette.paletteHueGrading
345
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
+ );
346
482
  const successPalette = palettes[2];
347
483
  const warningPalette = palettes[3];
348
484
  const errorPalette = palettes[4];
349
- const successKeyNv = successPalette ? resolveKeyNv(successPalette) : void 0;
350
- const success = successPalette ? successKeyNv !== void 0 ? newtone.getColor(
351
- successPalette.hue,
352
- successPalette.saturation,
485
+ const success = successPalette ? computePaletteTokens(
486
+ successPalette,
487
+ SUCCESS_DEFAULTS,
488
+ mode,
489
+ elevation,
353
490
  dynamicRange,
354
- successKeyNv,
355
- successPalette.desaturation,
356
- successPalette.paletteHueGrading
357
- ) : newtone.getColorByContrast(
358
- successPalette.hue,
359
- successPalette.saturation,
360
- dynamicRange,
361
- 4.5,
491
+ elevationDelta,
362
492
  effectiveTextMode,
363
- successPalette.desaturation,
364
- successPalette.paletteHueGrading,
365
- background
366
- ) : interactive;
367
- const warningKeyNv = warningPalette ? resolveKeyNv(warningPalette) : void 0;
368
- const warning = warningPalette ? warningKeyNv !== void 0 ? newtone.getColor(
369
- warningPalette.hue,
370
- warningPalette.saturation,
371
- dynamicRange,
372
- warningKeyNv,
373
- warningPalette.desaturation,
374
- warningPalette.paletteHueGrading
375
- ) : newtone.getColorByContrast(
376
- warningPalette.hue,
377
- warningPalette.saturation,
493
+ autoAccentNv,
494
+ textPrimary,
495
+ backgroundElevated
496
+ ) : accent;
497
+ const warning = warningPalette ? computePaletteTokens(
498
+ warningPalette,
499
+ WARNING_DEFAULTS,
500
+ mode,
501
+ elevation,
378
502
  dynamicRange,
379
- 4.5,
503
+ elevationDelta,
380
504
  effectiveTextMode,
381
- warningPalette.desaturation,
382
- warningPalette.paletteHueGrading,
383
- background
384
- ) : interactive;
385
- const errorKeyNv = errorPalette ? resolveKeyNv(errorPalette) : void 0;
386
- const error = errorPalette ? errorKeyNv !== void 0 ? newtone.getColor(
387
- errorPalette.hue,
388
- errorPalette.saturation,
389
- dynamicRange,
390
- errorKeyNv,
391
- errorPalette.desaturation,
392
- errorPalette.paletteHueGrading
393
- ) : newtone.getColorByContrast(
394
- errorPalette.hue,
395
- errorPalette.saturation,
505
+ autoAccentNv,
506
+ textPrimary,
507
+ backgroundElevated
508
+ ) : accent;
509
+ const error = errorPalette ? computePaletteTokens(
510
+ errorPalette,
511
+ ERROR_DEFAULTS,
512
+ mode,
513
+ elevation,
396
514
  dynamicRange,
397
- 4.5,
515
+ elevationDelta,
398
516
  effectiveTextMode,
399
- errorPalette.desaturation,
400
- errorPalette.paletteHueGrading,
401
- background
402
- ) : interactive;
517
+ autoAccentNv,
518
+ textPrimary,
519
+ backgroundElevated
520
+ ) : accent;
403
521
  return {
404
522
  background,
405
523
  backgroundElevated,
406
524
  backgroundSunken,
407
525
  backgroundInteractive,
526
+ backgroundInteractiveHover,
527
+ backgroundInteractiveActive,
408
528
  textPrimary,
409
529
  textSecondary,
410
- interactive,
411
- interactiveHover,
412
- interactiveActive,
530
+ textTertiary,
531
+ textDisabled,
413
532
  border,
533
+ accent,
414
534
  success,
415
535
  warning,
416
536
  error,
@@ -436,29 +556,26 @@ function computeTokens(config, mode, themeMapping, elevation, elevationOffsets,
436
556
 
437
557
  // src/tokens/useTokens.ts
438
558
  function useTokens(elevation) {
439
- const { config, mode, theme: providerTheme } = useNewtoneTheme();
559
+ const { config, mode } = useNewtoneTheme();
440
560
  const frameCtx = useFrameContext();
441
- const resolvedTheme = frameCtx?.theme ?? providerTheme;
442
561
  const resolvedElevation = elevation ?? frameCtx?.elevation ?? 1;
562
+ const canReuse = frameCtx !== null && elevation === void 0 && frameCtx.elevation === resolvedElevation;
443
563
  return React13.useMemo(() => {
444
- const themeMapping = config.themes[resolvedTheme];
564
+ if (canReuse) {
565
+ return { ...frameCtx.tokens, elevation: resolvedElevation };
566
+ }
445
567
  const tokens = computeTokens(
446
568
  config.colorSystem,
447
569
  mode,
448
- themeMapping,
449
570
  resolvedElevation,
450
- config.elevation.offsets,
451
571
  config.spacing,
452
572
  config.radius,
453
573
  config.typography,
454
- config.icons
574
+ config.icons,
575
+ config.tokenOverrides
455
576
  );
456
577
  return { ...tokens, elevation: resolvedElevation };
457
- }, [config, mode, resolvedTheme, resolvedElevation]);
458
- }
459
- function withOpacity(hexColor, opacity) {
460
- const alpha = Math.round(opacity * 255).toString(16).padStart(2, "0");
461
- return `${hexColor}${alpha}`;
578
+ }, [config, mode, resolvedElevation, canReuse, frameCtx?.tokens]);
462
579
  }
463
580
  function computeButtonPadding(size, hasIcon, hasText, iconPosition) {
464
581
  const basePadding = {
@@ -508,8 +625,19 @@ function computeButtonPadding(size, hasIcon, hasText, iconPosition) {
508
625
  paddingBottom: base
509
626
  };
510
627
  }
511
- function getNeutralPrimaryBg(tokens) {
512
- return newtone.srgbToHex(tokens.backgroundInteractive.srgb);
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
+ }
513
641
  }
514
642
  function getButtonConfig(variant, semantic, size, disabled, tokens) {
515
643
  const sizeConfig = getSizeConfig(size, tokens);
@@ -557,10 +685,12 @@ function getSizeConfig(size, tokens) {
557
685
  function getVariantColors(variant, semantic, disabled, tokens) {
558
686
  if (disabled) {
559
687
  const baseColors = getVariantColorsForState(variant, semantic, tokens);
688
+ const disabledBg = newtone.srgbToHex(tokens.backgroundSunken.srgb);
560
689
  return {
561
690
  ...baseColors,
562
- bg: newtone.srgbToHex(tokens.backgroundSunken.srgb),
563
- pressedBg: newtone.srgbToHex(tokens.backgroundSunken.srgb),
691
+ bg: disabledBg,
692
+ hoveredBg: disabledBg,
693
+ pressedBg: disabledBg,
564
694
  textColor: newtone.srgbToHex(tokens.textSecondary.srgb),
565
695
  iconColor: newtone.srgbToHex(tokens.textSecondary.srgb)
566
696
  };
@@ -568,109 +698,76 @@ function getVariantColors(variant, semantic, disabled, tokens) {
568
698
  return getVariantColorsForState(variant, semantic, tokens);
569
699
  }
570
700
  function getVariantColorsForState(variant, semantic, tokens) {
571
- const getSemanticColor = () => {
572
- switch (semantic) {
573
- case "accent":
574
- return newtone.srgbToHex(tokens.interactive.srgb);
575
- case "success":
576
- return newtone.srgbToHex(tokens.success.srgb);
577
- case "error":
578
- return newtone.srgbToHex(tokens.error.srgb);
579
- case "warning":
580
- return newtone.srgbToHex(tokens.warning.srgb);
581
- default:
582
- return newtone.srgbToHex(tokens.textPrimary.srgb);
583
- }
584
- };
701
+ const paletteTokens = getPaletteTokens(semantic, tokens);
585
702
  if (variant === "primary") {
586
703
  if (semantic === "neutral") {
587
- const bg = getNeutralPrimaryBg(tokens);
588
704
  return {
589
- bg,
590
- pressedBg: withOpacity(bg, 0.8),
591
- // Slightly darker on press
705
+ bg: newtone.srgbToHex(tokens.backgroundInteractive.srgb),
706
+ hoveredBg: newtone.srgbToHex(tokens.backgroundInteractiveHover.srgb),
707
+ pressedBg: newtone.srgbToHex(tokens.backgroundInteractiveActive.srgb),
592
708
  textColor: newtone.srgbToHex(tokens.textPrimary.srgb),
593
709
  iconColor: newtone.srgbToHex(tokens.textPrimary.srgb),
594
710
  borderWidth: 1,
595
711
  borderColor: "transparent"
596
- // Invisible border for consistent sizing
597
712
  };
598
713
  }
599
- if (semantic === "accent") {
600
- return {
601
- bg: newtone.srgbToHex(tokens.interactive.srgb),
602
- pressedBg: newtone.srgbToHex(tokens.interactiveActive.srgb),
603
- textColor: newtone.srgbToHex(tokens.background.srgb),
604
- // Contrast inversion
605
- iconColor: newtone.srgbToHex(tokens.background.srgb),
606
- borderWidth: 1,
607
- borderColor: "transparent"
608
- // Invisible border for consistent sizing
609
- };
610
- }
611
- const semanticColor = getSemanticColor();
612
714
  return {
613
- bg: semanticColor,
614
- pressedBg: withOpacity(semanticColor, 0.8),
615
- // Darken on press
616
- textColor: newtone.srgbToHex(tokens.background.srgb),
617
- // Contrast text
618
- iconColor: newtone.srgbToHex(tokens.background.srgb),
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),
619
720
  borderWidth: 1,
620
721
  borderColor: "transparent"
621
- // Invisible border for consistent sizing
622
722
  };
623
723
  }
624
724
  if (variant === "secondary") {
625
725
  if (semantic === "neutral") {
626
726
  return {
627
727
  bg: "transparent",
628
- pressedBg: newtone.srgbToHex(tokens.backgroundSunken.srgb),
728
+ hoveredBg: newtone.srgbToHex(tokens.backgroundInteractive.srgb),
729
+ pressedBg: newtone.srgbToHex(tokens.backgroundInteractiveHover.srgb),
629
730
  textColor: newtone.srgbToHex(tokens.textPrimary.srgb),
630
731
  iconColor: newtone.srgbToHex(tokens.textPrimary.srgb),
631
732
  borderWidth: 1,
632
733
  borderColor: newtone.srgbToHex(tokens.border.srgb)
633
734
  };
634
735
  }
635
- const semanticColor = getSemanticColor();
636
736
  return {
637
- bg: withOpacity(semanticColor, 0.1),
638
- // Light background tint
639
- pressedBg: withOpacity(semanticColor, 0.15),
640
- // Slightly darker on press
641
- textColor: semanticColor,
642
- iconColor: semanticColor,
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),
643
742
  borderWidth: 1,
644
743
  borderColor: "transparent"
645
- // Invisible border for consistent sizing
646
744
  };
647
745
  }
648
746
  if (variant === "tertiary") {
649
747
  if (semantic === "neutral") {
650
748
  return {
651
749
  bg: "transparent",
652
- pressedBg: newtone.srgbToHex(tokens.backgroundSunken.srgb),
750
+ hoveredBg: newtone.srgbToHex(tokens.backgroundInteractive.srgb),
751
+ pressedBg: newtone.srgbToHex(tokens.backgroundInteractiveHover.srgb),
653
752
  textColor: newtone.srgbToHex(tokens.textPrimary.srgb),
654
753
  iconColor: newtone.srgbToHex(tokens.textPrimary.srgb),
655
754
  borderWidth: 1,
656
755
  borderColor: "transparent"
657
- // Invisible border for consistent sizing
658
756
  };
659
757
  }
660
- const semanticColor = getSemanticColor();
661
758
  return {
662
759
  bg: "transparent",
663
- pressedBg: withOpacity(semanticColor, 0.1),
664
- // Subtle background tint
665
- textColor: semanticColor,
666
- iconColor: semanticColor,
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),
667
764
  borderWidth: 1,
668
765
  borderColor: "transparent"
669
- // Invisible border for consistent sizing
670
766
  };
671
767
  }
672
768
  return {
673
769
  bg: "transparent",
770
+ hoveredBg: "transparent",
674
771
  pressedBg: "transparent",
675
772
  textColor: newtone.srgbToHex(tokens.textPrimary.srgb),
676
773
  iconColor: newtone.srgbToHex(tokens.textPrimary.srgb),
@@ -683,9 +780,7 @@ function Icon({
683
780
  opticalSize,
684
781
  fill = 0,
685
782
  color,
686
- elevation = 1,
687
783
  style,
688
- onPress,
689
784
  // Accessibility
690
785
  accessibilityLabel,
691
786
  // Testing & platform
@@ -693,7 +788,7 @@ function Icon({
693
788
  nativeID,
694
789
  ref
695
790
  }) {
696
- const tokens = useTokens(elevation);
791
+ const tokens = useTokens();
697
792
  const iconStyle = React13.useMemo(() => {
698
793
  const fontSize = size ?? tokens.typography.size.base;
699
794
  const getOpticalSize = (size2) => {
@@ -705,7 +800,8 @@ function Icon({
705
800
  const opsz = opticalSize ?? getOpticalSize(fontSize);
706
801
  const iconColor = color ?? newtone.srgbToHex(tokens.textPrimary.srgb);
707
802
  const fontFamily = `Material Symbols ${tokens.icons.variant.charAt(0).toUpperCase() + tokens.icons.variant.slice(1)}`;
708
- const fontVariationSettings = `'FILL' ${fill}, 'wght' ${tokens.icons.weight}, 'GRAD' ${tokens.icons.grade}, 'opsz' ${opsz}`;
803
+ const fillValue = typeof fill === "boolean" ? fill ? 1 : 0 : fill;
804
+ const fontVariationSettings = `'FILL' ${fillValue}, 'wght' ${tokens.icons.weight}, 'GRAD' ${tokens.icons.grade}, 'opsz' ${opsz}`;
709
805
  return {
710
806
  fontFamily,
711
807
  fontSize,
@@ -731,17 +827,31 @@ function Icon({
731
827
  nativeID,
732
828
  accessibilityLabel,
733
829
  importantForAccessibility: accessibilityLabel ? "yes" : "no-hide-descendants",
734
- style: iconStyle,
735
- onPress
830
+ style: iconStyle
736
831
  },
737
832
  name
738
833
  );
739
834
  }
740
- var COLOR_MAP = {
741
- primary: "textPrimary",
742
- secondary: "textSecondary",
743
- interactive: "interactive"
744
- };
835
+ function resolveTextColor(color, tokens) {
836
+ switch (color) {
837
+ case "primary":
838
+ return newtone.srgbToHex(tokens.textPrimary.srgb);
839
+ case "secondary":
840
+ return newtone.srgbToHex(tokens.textSecondary.srgb);
841
+ case "tertiary":
842
+ return newtone.srgbToHex(tokens.textTertiary.srgb);
843
+ case "disabled":
844
+ return newtone.srgbToHex(tokens.textDisabled.srgb);
845
+ case "accent":
846
+ return newtone.srgbToHex(tokens.accent.fill.srgb);
847
+ case "success":
848
+ return newtone.srgbToHex(tokens.success.fill.srgb);
849
+ case "warning":
850
+ return newtone.srgbToHex(tokens.warning.fill.srgb);
851
+ case "error":
852
+ return newtone.srgbToHex(tokens.error.fill.srgb);
853
+ }
854
+ }
745
855
  function Text2({
746
856
  children,
747
857
  size = "base",
@@ -770,7 +880,7 @@ function Text2({
770
880
  // Font weight is stored as a number (e.g. 400, 600) but React Native expects a string.
771
881
  fontWeight: String(tokens.typography.weight[weight]),
772
882
  // Convert the theme color from internal sRGB format to a hex string (e.g. '#1a1a1a').
773
- color: newtone.srgbToHex(tokens[COLOR_MAP[color]].srgb),
883
+ color: resolveTextColor(color, tokens),
774
884
  // Line height = font size × multiplier (e.g. 16px × 1.5 = 24px line height).
775
885
  lineHeight: fontSize * tokens.typography.lineHeight[lineHeight],
776
886
  textAlign: align
@@ -1027,7 +1137,7 @@ function Button({
1027
1137
  () => computeButtonPadding(size, !!icon, !!children, iconPosition),
1028
1138
  [size, icon, children, iconPosition]
1029
1139
  );
1030
- return /* @__PURE__ */ React13__default.default.createElement(reactNative.Pressable, { disabled, ...pressableProps }, ({ pressed }) => (
1140
+ return /* @__PURE__ */ React13__default.default.createElement(reactNative.Pressable, { disabled, ...pressableProps }, ({ pressed, hovered }) => (
1031
1141
  // Wrapper handles layout: direction, gap, alignment (padding via style)
1032
1142
  /* @__PURE__ */ React13__default.default.createElement(
1033
1143
  Wrapper,
@@ -1040,7 +1150,7 @@ function Button({
1040
1150
  {
1041
1151
  ...padding,
1042
1152
  // Asymmetric horizontal padding for text optical balance
1043
- backgroundColor: pressed && !disabled ? variantColors.pressedBg : variantColors.bg,
1153
+ backgroundColor: pressed && !disabled ? variantColors.pressedBg : hovered && !disabled ? variantColors.hoveredBg : variantColors.bg,
1044
1154
  borderRadius: sizeTokens.borderRadius,
1045
1155
  borderWidth: variantColors.borderWidth,
1046
1156
  // Always 1 for consistent sizing
@@ -1258,8 +1368,7 @@ function toElevationLevel(frameElevation) {
1258
1368
  }
1259
1369
  function Frame({
1260
1370
  children,
1261
- // Theme & elevation
1262
- theme,
1371
+ // Elevation
1263
1372
  elevation,
1264
1373
  // Layout
1265
1374
  layout,
@@ -1298,25 +1407,22 @@ function Frame({
1298
1407
  // Style override
1299
1408
  style
1300
1409
  }) {
1301
- const { config, mode, theme: providerTheme } = useNewtoneTheme();
1410
+ const { config, mode } = useNewtoneTheme();
1302
1411
  const parentFrameCtx = useFrameContext();
1303
- const resolvedTheme = theme ?? parentFrameCtx?.theme ?? providerTheme;
1304
1412
  const resolvedFrameElevation = elevation ?? 0;
1305
1413
  const resolvedElevation = elevation !== void 0 ? toElevationLevel(elevation) : parentFrameCtx?.elevation ?? 1;
1306
1414
  const tokens = React13.useMemo(() => {
1307
- const themeMapping = config.themes[resolvedTheme];
1308
1415
  return computeTokens(
1309
1416
  config.colorSystem,
1310
1417
  mode,
1311
- themeMapping,
1312
1418
  resolvedElevation,
1313
- config.elevation.offsets,
1314
1419
  config.spacing,
1315
1420
  config.radius,
1316
1421
  config.typography,
1317
- config.icons
1422
+ config.icons,
1423
+ config.tokenOverrides
1318
1424
  );
1319
- }, [config, mode, resolvedTheme, resolvedElevation]);
1425
+ }, [config, mode, resolvedElevation]);
1320
1426
  const styles = React13.useMemo(
1321
1427
  () => getFrameStyles({
1322
1428
  tokens,
@@ -1366,8 +1472,8 @@ function Frame({
1366
1472
  ]
1367
1473
  );
1368
1474
  const contextValue = React13.useMemo(
1369
- () => ({ theme: resolvedTheme, elevation: resolvedElevation }),
1370
- [resolvedTheme, resolvedElevation]
1475
+ () => ({ elevation: resolvedElevation, tokens }),
1476
+ [resolvedElevation, tokens]
1371
1477
  );
1372
1478
  const webOverrides = [];
1373
1479
  if (styles.gridWebStyle) {
@@ -1382,7 +1488,7 @@ function Frame({
1382
1488
  const focusRingStyle = isFocusVisible && !disabled ? {
1383
1489
  outlineWidth: 2,
1384
1490
  outlineStyle: "solid",
1385
- outlineColor: newtone.srgbToHex(tokens.interactive.srgb),
1491
+ outlineColor: newtone.srgbToHex(tokens.accent.fill.srgb),
1386
1492
  outlineOffset: 2
1387
1493
  } : void 0;
1388
1494
  const webFocusProps = isInteractive ? focusProps : {};
@@ -1837,7 +1943,7 @@ function SelectOptionRow({
1837
1943
  },
1838
1944
  isSelected && {
1839
1945
  fontWeight: tokens.typography.weight.semibold,
1840
- color: newtone.srgbToHex(tokens.interactive.srgb)
1946
+ color: newtone.srgbToHex(tokens.accent.fill.srgb)
1841
1947
  },
1842
1948
  option.disabled && {
1843
1949
  color: newtone.srgbToHex(tokens.textSecondary.srgb)
@@ -1852,7 +1958,7 @@ function SelectOptionRow({
1852
1958
  {
1853
1959
  name: "check",
1854
1960
  size: fontSize,
1855
- color: newtone.srgbToHex(tokens.interactive.srgb)
1961
+ color: newtone.srgbToHex(tokens.accent.fill.srgb)
1856
1962
  }
1857
1963
  ))
1858
1964
  );
@@ -1995,7 +2101,7 @@ function getToggleStyles(tokens, value, disabled) {
1995
2101
  width: TRACK_WIDTH,
1996
2102
  height: TRACK_HEIGHT,
1997
2103
  borderRadius: TRACK_HEIGHT / 2,
1998
- backgroundColor: value ? newtone.srgbToHex(tokens.interactive.srgb) : newtone.srgbToHex(tokens.border.srgb),
2104
+ backgroundColor: value ? newtone.srgbToHex(tokens.accent.fill.srgb) : newtone.srgbToHex(tokens.border.srgb),
1999
2105
  justifyContent: "center",
2000
2106
  paddingHorizontal: THUMB_OFFSET
2001
2107
  },
@@ -2095,14 +2201,14 @@ function getSliderStyles(tokens, disabled) {
2095
2201
  left: 0,
2096
2202
  height: TRACK_HEIGHT2,
2097
2203
  borderRadius: TRACK_HEIGHT2 / 2,
2098
- backgroundColor: newtone.srgbToHex(tokens.interactive.srgb)
2204
+ backgroundColor: newtone.srgbToHex(tokens.accent.fill.srgb)
2099
2205
  },
2100
2206
  thumb: {
2101
2207
  position: "absolute",
2102
2208
  width: THUMB_SIZE2,
2103
2209
  height: THUMB_SIZE2,
2104
2210
  borderRadius: THUMB_SIZE2 / 2,
2105
- backgroundColor: newtone.srgbToHex(tokens.interactive.srgb)
2211
+ backgroundColor: newtone.srgbToHex(tokens.accent.fill.srgb)
2106
2212
  }
2107
2213
  });
2108
2214
  }
@@ -2477,7 +2583,7 @@ function getColorScaleSliderStyles(tokens, disabled) {
2477
2583
  fontFamily: tokens.typography.fonts.default,
2478
2584
  fontSize: tokens.typography.size.xs,
2479
2585
  fontWeight: tokens.typography.weight.medium,
2480
- color: newtone.srgbToHex(tokens.error.srgb)
2586
+ color: newtone.srgbToHex(tokens.error.fill.srgb)
2481
2587
  }
2482
2588
  });
2483
2589
  }
@@ -2726,13 +2832,17 @@ var COMPONENTS = [
2726
2832
  variants: [
2727
2833
  { id: "primary-md", label: "Primary", props: { variant: "primary", size: "md" } },
2728
2834
  { id: "secondary-md", label: "Secondary", props: { variant: "secondary", size: "md" } },
2729
- { id: "ghost-md", label: "Ghost", props: { variant: "ghost", size: "md" } },
2730
- { id: "outline-md", label: "Outline", props: { variant: "outline", size: "md" } },
2835
+ { id: "tertiary-md", label: "Tertiary", props: { variant: "tertiary", size: "md" } },
2731
2836
  { id: "primary-sm", label: "Primary Small", props: { variant: "primary", size: "sm" } },
2732
2837
  { id: "primary-lg", label: "Primary Large", props: { variant: "primary", size: "lg" } },
2838
+ { id: "accent-primary", label: "Accent Primary", props: { variant: "primary", size: "md", semantic: "accent" } },
2839
+ { id: "accent-secondary", label: "Accent Secondary", props: { variant: "secondary", size: "md", semantic: "accent" } },
2840
+ { id: "success-primary", label: "Success Primary", props: { variant: "primary", size: "md", semantic: "success" } },
2841
+ { id: "error-primary", label: "Error Primary", props: { variant: "primary", size: "md", semantic: "error" } },
2842
+ { id: "warning-primary", label: "Warning Primary", props: { variant: "primary", size: "md", semantic: "warning" } },
2733
2843
  { id: "icon-left", label: "Icon Left", props: { variant: "primary", size: "md", icon: "add" } },
2734
2844
  { id: "icon-right", label: "Icon Right", props: { variant: "primary", size: "md", icon: "arrow_forward", iconPosition: "right" } },
2735
- { id: "icon-only", label: "Icon Only", props: { variant: "ghost", size: "md", icon: "settings" } }
2845
+ { id: "icon-only", label: "Icon Only", props: { variant: "tertiary", size: "md", icon: "settings" } }
2736
2846
  ],
2737
2847
  editableProps: [
2738
2848
  {
@@ -2742,11 +2852,23 @@ var COMPONENTS = [
2742
2852
  options: [
2743
2853
  { label: "Primary", value: "primary" },
2744
2854
  { label: "Secondary", value: "secondary" },
2745
- { label: "Ghost", value: "ghost" },
2746
- { label: "Outline", value: "outline" }
2855
+ { label: "Tertiary", value: "tertiary" }
2747
2856
  ],
2748
2857
  defaultValue: "primary"
2749
2858
  },
2859
+ {
2860
+ name: "semantic",
2861
+ label: "Semantic",
2862
+ control: "select",
2863
+ options: [
2864
+ { label: "Neutral", value: "neutral" },
2865
+ { label: "Accent", value: "accent" },
2866
+ { label: "Success", value: "success" },
2867
+ { label: "Warning", value: "warning" },
2868
+ { label: "Error", value: "error" }
2869
+ ],
2870
+ defaultValue: "neutral"
2871
+ },
2750
2872
  {
2751
2873
  name: "size",
2752
2874
  label: "Size",
@@ -3109,7 +3231,7 @@ var COMPONENTS = [
3109
3231
  { id: "subheading", label: "Subheading", props: { size: "lg", weight: "semibold" } },
3110
3232
  { id: "body", label: "Body", props: { size: "base" } },
3111
3233
  { id: "caption", label: "Caption", props: { size: "sm", color: "secondary" } },
3112
- { id: "link", label: "Link", props: { color: "interactive", weight: "medium" } },
3234
+ { id: "accent", label: "Accent", props: { color: "accent", weight: "medium" } },
3113
3235
  { id: "mono", label: "Monospace", props: { font: "mono", size: "sm" } }
3114
3236
  ],
3115
3237
  editableProps: [
@@ -3147,7 +3269,12 @@ var COMPONENTS = [
3147
3269
  options: [
3148
3270
  { label: "Primary", value: "primary" },
3149
3271
  { label: "Secondary", value: "secondary" },
3150
- { label: "Interactive", value: "interactive" }
3272
+ { label: "Tertiary", value: "tertiary" },
3273
+ { label: "Disabled", value: "disabled" },
3274
+ { label: "Accent", value: "accent" },
3275
+ { label: "Success", value: "success" },
3276
+ { label: "Warning", value: "warning" },
3277
+ { label: "Error", value: "error" }
3151
3278
  ],
3152
3279
  defaultValue: "primary"
3153
3280
  },
@@ -3169,40 +3296,35 @@ var COMPONENTS = [
3169
3296
  name: "Icon",
3170
3297
  importName: "Icon",
3171
3298
  categoryId: "primitives",
3172
- description: "Material Symbols icon with size, fill, and color",
3299
+ description: "Material Symbols icon with size and fill",
3173
3300
  hasChildren: false,
3174
3301
  variants: [
3175
- { id: "home", label: "Home", props: { name: "home" } },
3176
- { id: "settings", label: "Settings", props: { name: "settings" } },
3177
- { id: "check", label: "Check", props: { name: "check" } },
3178
- { id: "add", label: "Add", props: { name: "add" } },
3179
- { id: "delete", label: "Delete", props: { name: "delete" } },
3180
- { id: "search", label: "Search", props: { name: "search" } },
3181
- { id: "filled", label: "Filled Icon", props: { name: "favorite", fill: 1 } },
3182
- { id: "large", label: "Large Icon", props: { name: "star", size: 32 } }
3302
+ { id: "default", label: "Default", props: { name: "add" } }
3183
3303
  ],
3184
3304
  editableProps: [
3185
3305
  {
3186
3306
  name: "name",
3187
3307
  label: "Icon Name",
3188
3308
  control: "text",
3189
- defaultValue: "home"
3309
+ defaultValue: "add"
3190
3310
  },
3191
3311
  {
3192
3312
  name: "size",
3193
3313
  label: "Size",
3194
- control: "number",
3314
+ control: "discrete-slider",
3315
+ options: [
3316
+ { label: "20", value: 20 },
3317
+ { label: "24", value: 24 },
3318
+ { label: "40", value: 40 },
3319
+ { label: "48", value: 48 }
3320
+ ],
3195
3321
  defaultValue: 24
3196
3322
  },
3197
3323
  {
3198
3324
  name: "fill",
3199
3325
  label: "Fill",
3200
- control: "select",
3201
- options: [
3202
- { label: "Outlined", value: 0 },
3203
- { label: "Filled", value: 1 }
3204
- ],
3205
- defaultValue: 0
3326
+ control: "toggle",
3327
+ defaultValue: false
3206
3328
  }
3207
3329
  ]
3208
3330
  },
@@ -3406,6 +3528,232 @@ function formatProp(name, value) {
3406
3528
  return `${name}={${JSON.stringify(value)}}`;
3407
3529
  }
3408
3530
 
3531
+ // src/registry/icons.ts
3532
+ var ICON_CATALOG = [
3533
+ {
3534
+ id: "navigation",
3535
+ label: "Navigation",
3536
+ icons: [
3537
+ "home",
3538
+ "menu",
3539
+ "close",
3540
+ "arrow_back",
3541
+ "arrow_forward",
3542
+ "arrow_upward",
3543
+ "arrow_downward",
3544
+ "chevron_left",
3545
+ "chevron_right",
3546
+ "expand_more",
3547
+ "expand_less",
3548
+ "first_page",
3549
+ "last_page",
3550
+ "more_vert",
3551
+ "more_horiz",
3552
+ "unfold_more",
3553
+ "unfold_less",
3554
+ "subdirectory_arrow_right"
3555
+ ]
3556
+ },
3557
+ {
3558
+ id: "actions",
3559
+ label: "Actions",
3560
+ icons: [
3561
+ "search",
3562
+ "settings",
3563
+ "done",
3564
+ "add",
3565
+ "remove",
3566
+ "delete",
3567
+ "edit",
3568
+ "save",
3569
+ "refresh",
3570
+ "undo",
3571
+ "redo",
3572
+ "download",
3573
+ "upload",
3574
+ "share",
3575
+ "print",
3576
+ "content_copy",
3577
+ "content_paste",
3578
+ "open_in_new",
3579
+ "launch",
3580
+ "drag_indicator",
3581
+ "tune",
3582
+ "sort",
3583
+ "filter_list"
3584
+ ]
3585
+ },
3586
+ {
3587
+ id: "communication",
3588
+ label: "Communication",
3589
+ icons: [
3590
+ "mail",
3591
+ "chat",
3592
+ "call",
3593
+ "notifications",
3594
+ "forum",
3595
+ "send",
3596
+ "inbox",
3597
+ "drafts",
3598
+ "mark_email_read",
3599
+ "contact_mail",
3600
+ "alternate_email",
3601
+ "comment",
3602
+ "chat_bubble",
3603
+ "sms",
3604
+ "voicemail"
3605
+ ]
3606
+ },
3607
+ {
3608
+ id: "content",
3609
+ label: "Content",
3610
+ icons: [
3611
+ "add_circle",
3612
+ "remove_circle",
3613
+ "check_circle",
3614
+ "cancel",
3615
+ "flag",
3616
+ "bookmark",
3617
+ "star",
3618
+ "favorite",
3619
+ "thumb_up",
3620
+ "thumb_down",
3621
+ "push_pin",
3622
+ "link",
3623
+ "link_off",
3624
+ "bolt",
3625
+ "label",
3626
+ "inventory_2",
3627
+ "visibility",
3628
+ "visibility_off"
3629
+ ]
3630
+ },
3631
+ {
3632
+ id: "media",
3633
+ label: "Media",
3634
+ icons: [
3635
+ "play_arrow",
3636
+ "pause",
3637
+ "stop",
3638
+ "skip_next",
3639
+ "skip_previous",
3640
+ "fast_forward",
3641
+ "fast_rewind",
3642
+ "replay",
3643
+ "shuffle",
3644
+ "repeat",
3645
+ "volume_up",
3646
+ "volume_off",
3647
+ "music_note",
3648
+ "image",
3649
+ "photo_camera",
3650
+ "videocam",
3651
+ "mic"
3652
+ ]
3653
+ },
3654
+ {
3655
+ id: "file",
3656
+ label: "File & Folder",
3657
+ icons: [
3658
+ "folder",
3659
+ "folder_open",
3660
+ "create_new_folder",
3661
+ "description",
3662
+ "file_copy",
3663
+ "attach_file",
3664
+ "cloud",
3665
+ "cloud_upload",
3666
+ "cloud_download",
3667
+ "cloud_off",
3668
+ "storage",
3669
+ "snippet_folder"
3670
+ ]
3671
+ },
3672
+ {
3673
+ id: "social",
3674
+ label: "Social & People",
3675
+ icons: [
3676
+ "person",
3677
+ "group",
3678
+ "person_add",
3679
+ "person_remove",
3680
+ "people",
3681
+ "face",
3682
+ "sentiment_satisfied",
3683
+ "sentiment_dissatisfied",
3684
+ "public",
3685
+ "workspace_premium",
3686
+ "emoji_events",
3687
+ "military_tech"
3688
+ ]
3689
+ },
3690
+ {
3691
+ id: "alerts",
3692
+ label: "Alerts & Status",
3693
+ icons: [
3694
+ "error",
3695
+ "warning",
3696
+ "info",
3697
+ "help",
3698
+ "check_circle",
3699
+ "report",
3700
+ "new_releases",
3701
+ "notification_important",
3702
+ "priority_high",
3703
+ "verified",
3704
+ "shield",
3705
+ "security",
3706
+ "lock",
3707
+ "lock_open"
3708
+ ]
3709
+ },
3710
+ {
3711
+ id: "device",
3712
+ label: "Device & Hardware",
3713
+ icons: [
3714
+ "phone_android",
3715
+ "computer",
3716
+ "tablet_mac",
3717
+ "watch",
3718
+ "keyboard",
3719
+ "mouse",
3720
+ "headphones",
3721
+ "speaker",
3722
+ "monitor",
3723
+ "devices",
3724
+ "memory",
3725
+ "battery_full",
3726
+ "wifi",
3727
+ "bluetooth",
3728
+ "usb",
3729
+ "dark_mode",
3730
+ "light_mode"
3731
+ ]
3732
+ },
3733
+ {
3734
+ id: "editor",
3735
+ label: "Editor & Formatting",
3736
+ icons: [
3737
+ "format_bold",
3738
+ "format_italic",
3739
+ "format_underlined",
3740
+ "format_list_bulleted",
3741
+ "format_list_numbered",
3742
+ "format_quote",
3743
+ "format_align_left",
3744
+ "format_align_center",
3745
+ "format_align_right",
3746
+ "title",
3747
+ "text_fields",
3748
+ "code",
3749
+ "palette",
3750
+ "color_lens",
3751
+ "brush",
3752
+ "auto_fix_high"
3753
+ ]
3754
+ }
3755
+ ];
3756
+
3409
3757
  // src/fonts/googleFonts.ts
3410
3758
  var GOOGLE_FONTS = [
3411
3759
  // Sans-serif
@@ -3472,6 +3820,7 @@ var SYSTEM_FONTS = [
3472
3820
  }
3473
3821
  ];
3474
3822
 
3823
+ exports.ACCENT_DEFAULTS = ACCENT_DEFAULTS;
3475
3824
  exports.AppShell = AppShell;
3476
3825
  exports.Button = Button;
3477
3826
  exports.CATEGORIES = CATEGORIES;
@@ -3479,13 +3828,17 @@ exports.COMPONENTS = COMPONENTS;
3479
3828
  exports.Card = Card;
3480
3829
  exports.ColorScaleSlider = ColorScaleSlider;
3481
3830
  exports.DEFAULT_THEME_CONFIG = DEFAULT_THEME_CONFIG;
3831
+ exports.ERROR_DEFAULTS = ERROR_DEFAULTS;
3482
3832
  exports.Frame = Frame;
3483
3833
  exports.GOOGLE_FONTS = GOOGLE_FONTS;
3484
3834
  exports.HueSlider = HueSlider;
3835
+ exports.ICON_CATALOG = ICON_CATALOG;
3485
3836
  exports.Icon = Icon;
3837
+ exports.NEUTRAL_DEFAULTS = NEUTRAL_DEFAULTS;
3486
3838
  exports.Navbar = Navbar;
3487
3839
  exports.NewtoneProvider = NewtoneProvider;
3488
3840
  exports.Popover = Popover;
3841
+ exports.SUCCESS_DEFAULTS = SUCCESS_DEFAULTS;
3489
3842
  exports.SYSTEM_FONTS = SYSTEM_FONTS;
3490
3843
  exports.Select = Select;
3491
3844
  exports.Sidebar = Sidebar;
@@ -3493,6 +3846,7 @@ exports.Slider = Slider;
3493
3846
  exports.Text = Text2;
3494
3847
  exports.TextInput = TextInput;
3495
3848
  exports.Toggle = Toggle;
3849
+ exports.WARNING_DEFAULTS = WARNING_DEFAULTS;
3496
3850
  exports.Wrapper = Wrapper;
3497
3851
  exports.buildGoogleFontsUrl = buildGoogleFontsUrl;
3498
3852
  exports.computeTokens = computeTokens;