@titan-design/react-ui 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/bodymap.js +78 -24
  2. package/dist/bodymap.js.map +1 -1
  3. package/dist/bodymap.mjs +78 -24
  4. package/dist/bodymap.mjs.map +1 -1
  5. package/dist/index.d.mts +215 -123
  6. package/dist/index.d.ts +215 -123
  7. package/dist/index.js +408 -259
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +258 -121
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/pages.js +214 -157
  12. package/dist/pages.js.map +1 -1
  13. package/dist/pages.mjs +214 -157
  14. package/dist/pages.mjs.map +1 -1
  15. package/dist/theme/index.d.mts +895 -795
  16. package/dist/theme/index.d.ts +895 -795
  17. package/dist/theme/index.js +101 -20
  18. package/dist/theme/index.js.map +1 -1
  19. package/dist/theme/index.mjs +99 -22
  20. package/dist/theme/index.mjs.map +1 -1
  21. package/dist/theme/tokens-css.js +88 -24
  22. package/dist/theme/tokens-css.js.map +1 -1
  23. package/dist/theme/tokens-css.mjs +88 -24
  24. package/dist/theme/tokens-css.mjs.map +1 -1
  25. package/package.json +1 -1
  26. package/src/components/custom/Workout/BaseBadge.tsx +5 -5
  27. package/src/components/custom/Workout/RowInventory.stories.tsx +5 -2
  28. package/src/components/custom/Workout/S3FullRail.stories.tsx +13 -1
  29. package/src/components/custom/Workout/SessionHeader.tsx +11 -13
  30. package/src/components/custom/Workout/SessionRail.stories.tsx +4 -1
  31. package/src/components/custom/Workout/SessionRail.tsx +16 -14
  32. package/src/components/custom/Workout/SupersetWrapper.stories.tsx +16 -25
  33. package/src/components/custom/Workout/SupersetWrapper.tsx +1 -1
  34. package/src/components/custom/Workout/TempoDisplay.tsx +3 -7
  35. package/src/components/custom/Workout/VolumeLandmarkBar.stories.tsx +4 -1
  36. package/src/components/custom/Workout/WorkoutPill.tsx +2 -2
  37. package/src/components/shell/DashboardShell.tsx +6 -3
  38. package/src/components/ui/surface/Surface.stories.tsx +244 -1
  39. package/src/components/ui/surface/Surface.test.tsx +244 -1
  40. package/src/components/ui/surface/Surface.tsx +98 -20
  41. package/src/components/ui/surface/SurfaceContext.ts +126 -0
  42. package/src/components/ui/surface/index.ts +13 -0
  43. package/src/components/ui/surface/surface.contract.test.ts +283 -0
  44. package/src/test/nativewind-stub.ts +13 -0
  45. package/src/theme/ColorSystem.stories.tsx +232 -47
  46. package/src/theme/ThemeProvider.test.tsx +24 -0
  47. package/src/theme/ThemeProvider.tsx +23 -6
  48. package/src/theme/config.ts +12 -0
  49. package/src/theme/elevation.ts +90 -67
  50. package/src/theme/global.css +35 -9
  51. package/src/theme/tokens/primitives.ts +40 -0
  52. package/src/theme/tokens/semantic.ts +63 -14
  53. package/tailwind.config.js +8 -0
@@ -1,5 +1,6 @@
1
1
  import { Platform, View } from 'react-native';
2
- import { vars } from 'nativewind';
2
+ import { vars, useColorScheme } from 'nativewind';
3
+ import { createContext } from 'react';
3
4
  import { jsx as jsx$1 } from 'react/jsx-runtime';
4
5
 
5
6
  // src/theme/tokens/primitives.ts
@@ -76,6 +77,21 @@ var primitiveColors = {
76
77
  black: "#000000",
77
78
  transparent: "transparent"
78
79
  };
80
+ var surfaceRampDark = {
81
+ inset: "#13100D",
82
+ // L*4.5 — sub-shell well / pressed
83
+ background: "#1C1916",
84
+ // L*9 — shell / frame
85
+ base: "#252321",
86
+ // L*13.5 — main content plane
87
+ elevated: "#2C2A28",
88
+ // L*17 — nav / rail
89
+ raised: "#31302F",
90
+ // L*20 — cards
91
+ overlay: "#373635"
92
+ // L*22.5 — hero / popover
93
+ };
94
+ var backgroundFrameDark = "#100D0A";
79
95
  var primitiveRamps = {
80
96
  red: {
81
97
  50: "#FFF4F4",
@@ -543,10 +559,19 @@ var semanticColorsLight = {
543
559
  "surface-overlay": primitiveColors.white,
544
560
  "surface-input": primitiveColors.neutral[50],
545
561
  // Input field background (filled variant)
562
+ // Deepest pressed pit (TD-surface-tokens, S-3) — light-mode counterpart of
563
+ // the dark ramp's `inset` plane; a placeholder pairing, not part of the
564
+ // dark-ramp investigation (surface.contract.test.ts is dark-mode only).
565
+ "surface-inset": primitiveColors.neutral[300],
546
566
  // Background colors (background-*)
547
567
  "background-base": "#EBEBEB",
548
568
  "background-default": primitiveColors.white,
549
569
  "background-subtle": primitiveColors.neutral[50],
570
+ // Frame/bezel chrome (TD-surface-tokens, S-3) — top bar + side nav shell,
571
+ // one step below `background-base` (darker still than `surface-inset`
572
+ // above, mirroring the dark-mode ordering). Placeholder pairing for light
573
+ // mode (see dark-mode note on `surface-inset` above).
574
+ "background-frame": primitiveColors.neutral[400],
550
575
  // Border colors (border-*)
551
576
  "border-default": "#E8E9EB",
552
577
  "border-subtle": primitiveColors.neutral[100],
@@ -562,6 +587,11 @@ var semanticColorsLight = {
562
587
  // Input field border on focus
563
588
  "border-input-error": primitiveColors.red[600],
564
589
  // Input field border on error
590
+ // Alpha hairline separators (surface-independent — composite toward black on
591
+ // light surfaces, mirroring the dark-mode white-alpha family). See §4/S-2.
592
+ "hairline-subtle": "rgba(0, 0, 0, 0.06)",
593
+ "hairline-default": "rgba(0, 0, 0, 0.09)",
594
+ "hairline-strong": "rgba(0, 0, 0, 0.14)",
565
595
  // Interactive states (interactive-*)
566
596
  "interactive-hover": "rgba(55, 65, 81, 0.04)",
567
597
  "interactive-focus": "rgba(55, 65, 81, 0.12)",
@@ -654,25 +684,46 @@ var semanticColorsDark = {
654
684
  "text-inverse": primitiveColors.neutral[900],
655
685
  "text-link": "#828DF8",
656
686
  "text-link-hover": primitiveColors.blue[400],
657
- // Surface colors - dark backgrounds
658
- "surface-base": primitiveColors.charcoal[700],
659
- // main surface
660
- "surface-elevated": primitiveColors.charcoal[600],
661
- // elevated surface
662
- "surface-raised": primitiveColors.charcoal[500],
663
- // raised surface
664
- "surface-overlay": primitiveColors.charcoal[600],
665
- // overlay surface
666
- "surface-input": primitiveColors.charcoal[600],
667
- // input surface
668
- // Background colors
669
- "background-base": primitiveColors.charcoal[900],
670
- // darkest charcoal
671
- "background-default": primitiveColors.charcoal[700],
672
- // main background
673
- "background-subtle": primitiveColors.charcoal[500],
674
- // subtle background
675
- // Border colors
687
+ // Surface colors - dark backgrounds — warm-tapered DERIVED ramp (TD-surface-tokens,
688
+ // S-1, re-spaced S-3). Shipped verbatim from `deriveSurfaceRamp()` — see
689
+ // `surfaceRampDark` in primitives.ts for the full derivation note. `surface-overlay`
690
+ // and `surface-elevated` are distinct (were both #191919 pre-S-1); `surface-input`
691
+ // tracks one plane above `surface-base`, same relative position as before the remap.
692
+ // `background-base` backs `Surface level="background"` (SurfaceContext.SURFACE_LEVEL_TOKEN),
693
+ // so it takes the ramp's `background` (shell/frame) role, NOT `inset`. The ramp's
694
+ // deepest `inset` plane is now promoted to `surface-inset` below (S-3) — still no
695
+ // `SurfaceLevel` member for it (follow-up, alongside the elevation.ts -1/-2 pressed
696
+ // levels — parallel workstream, not this branch).
697
+ "surface-base": surfaceRampDark.base,
698
+ // main surface (#252321, L*13.5)
699
+ "surface-elevated": surfaceRampDark.elevated,
700
+ // elevated surface (#2C2A28, L*17 — nav/rail)
701
+ "surface-raised": surfaceRampDark.raised,
702
+ // raised surface (#31302F, L*20 — cards)
703
+ "surface-overlay": surfaceRampDark.overlay,
704
+ // overlay surface (#373635, L*22.5 — hero/popover)
705
+ "surface-input": surfaceRampDark.elevated,
706
+ // input surface (#2C2A28 — one plane above base)
707
+ "surface-inset": surfaceRampDark.inset,
708
+ // deepest pressed pit (#13100D, L*4.5 — sub-shell well)
709
+ // Background colors — same ramp, the frame/shell end of it.
710
+ "background-base": surfaceRampDark.background,
711
+ // shell / frame (#1C1916, L*9 — Surface level="background")
712
+ "background-default": surfaceRampDark.base,
713
+ // main background (#252321, L*13.5 — matches surface-base)
714
+ "background-subtle": surfaceRampDark.elevated,
715
+ // subtle background (#2C2A28, L*17 — matches surface-elevated)
716
+ // Frame/bezel chrome (S-3) — the top bar + side nav shell; one step BELOW
717
+ // `background-base`, darker even than `surface-inset` — it exits the content
718
+ // ramp entirely rather than sitting in it. See `backgroundFrameDark` in
719
+ // primitives.ts.
720
+ "background-frame": backgroundFrameDark,
721
+ // frame / bezel (#100D0A, L*3.79)
722
+ // Border colors — `border-subtle` (#1C1C1C) previously collided with
723
+ // `surface-raised` (also #1C1C1C, an invisible border on raised cards). The
724
+ // re-spaced ramp above moved `surface-raised` to #2D2C2B, so this value is now
725
+ // distinct from every surface hex without needing to change it — see
726
+ // `surface.contract.test.ts` R2/R4.
676
727
  "border-default": primitiveColors.charcoal[400],
677
728
  // default border
678
729
  "border-subtle": primitiveColors.charcoal[500],
@@ -686,6 +737,14 @@ var semanticColorsDark = {
686
737
  "border-input-hover": primitiveColors.neutral[500],
687
738
  "border-input-focus": "#828DF8",
688
739
  "border-input-error": primitiveColors.red[500],
740
+ // Alpha hairline separators — the primary separation cue (§4/S-2). Self-
741
+ // normalizing: composites toward white by ~the same amount on ANY plane, so
742
+ // one family works at every elevation instead of per-surface border tokens.
743
+ // Shadows are demoted to floating-overlay use only (not shipped as a fill
744
+ // separator here — see elevation.ts, follow-up S-4).
745
+ "hairline-subtle": "rgba(255, 255, 255, 0.06)",
746
+ "hairline-default": "rgba(255, 255, 255, 0.09)",
747
+ "hairline-strong": "rgba(255, 255, 255, 0.14)",
689
748
  // Interactive states
690
749
  "interactive-hover": "rgba(255, 255, 255, 0.04)",
691
750
  "interactive-focus": "rgba(255, 255, 255, 0.12)",
@@ -863,9 +922,11 @@ var lightThemeCSSVars = {
863
922
  "--color-surface-base": semanticColorsLight["surface-base"],
864
923
  "--color-surface-elevated": semanticColorsLight["surface-elevated"],
865
924
  "--color-surface-raised": semanticColorsLight["surface-raised"],
925
+ "--color-surface-inset": semanticColorsLight["surface-inset"],
866
926
  "--color-background-base": semanticColorsLight["background-base"],
867
927
  "--color-background-default": semanticColorsLight["background-default"],
868
928
  "--color-background-subtle": semanticColorsLight["background-subtle"],
929
+ "--color-background-frame": semanticColorsLight["background-frame"],
869
930
  "--color-border-default": semanticColorsLight["border-default"],
870
931
  "--color-border-subtle": semanticColorsLight["border-subtle"],
871
932
  "--color-border-strong": semanticColorsLight["border-strong"],
@@ -922,6 +983,9 @@ var lightThemeCSSVars = {
922
983
  "--color-border-input-hover": semanticColorsLight["border-input-hover"],
923
984
  "--color-border-input-focus": semanticColorsLight["border-input-focus"],
924
985
  "--color-border-input-error": semanticColorsLight["border-input-error"],
986
+ "--color-hairline-subtle": semanticColorsLight["hairline-subtle"],
987
+ "--color-hairline-default": semanticColorsLight["hairline-default"],
988
+ "--color-hairline-strong": semanticColorsLight["hairline-strong"],
925
989
  "--color-interactive-disabled-text": semanticColorsLight["interactive-disabled-text"],
926
990
  "--color-avatar-background": semanticColorsLight["avatar-background"],
927
991
  "--color-avatar-text": semanticColorsLight["avatar-text"],
@@ -961,9 +1025,11 @@ var darkThemeCSSVars = {
961
1025
  "--color-surface-base": semanticColorsDark["surface-base"],
962
1026
  "--color-surface-elevated": semanticColorsDark["surface-elevated"],
963
1027
  "--color-surface-raised": semanticColorsDark["surface-raised"],
1028
+ "--color-surface-inset": semanticColorsDark["surface-inset"],
964
1029
  "--color-background-base": semanticColorsDark["background-base"],
965
1030
  "--color-background-default": semanticColorsDark["background-default"],
966
1031
  "--color-background-subtle": semanticColorsDark["background-subtle"],
1032
+ "--color-background-frame": semanticColorsDark["background-frame"],
967
1033
  "--color-border-default": semanticColorsDark["border-default"],
968
1034
  "--color-border-subtle": semanticColorsDark["border-subtle"],
969
1035
  "--color-border-strong": semanticColorsDark["border-strong"],
@@ -1020,6 +1086,9 @@ var darkThemeCSSVars = {
1020
1086
  "--color-border-input-hover": semanticColorsDark["border-input-hover"],
1021
1087
  "--color-border-input-focus": semanticColorsDark["border-input-focus"],
1022
1088
  "--color-border-input-error": semanticColorsDark["border-input-error"],
1089
+ "--color-hairline-subtle": semanticColorsDark["hairline-subtle"],
1090
+ "--color-hairline-default": semanticColorsDark["hairline-default"],
1091
+ "--color-hairline-strong": semanticColorsDark["hairline-strong"],
1023
1092
  "--color-interactive-disabled-text": semanticColorsDark["interactive-disabled-text"],
1024
1093
  "--color-avatar-background": semanticColorsDark["avatar-background"],
1025
1094
  "--color-avatar-text": semanticColorsDark["avatar-text"],
@@ -1654,6 +1723,10 @@ function getElevationShadow(baseColor, level, theme, isHovered = false) {
1654
1723
  elevationShadowCache.set(cacheKey, result);
1655
1724
  return result;
1656
1725
  }
1726
+ var PRESSED_ELEVATION_LEVEL = -1;
1727
+ function getPressedRecessShadow(fillColor, theme) {
1728
+ return getElevationShadow(fillColor, PRESSED_ELEVATION_LEVEL, theme);
1729
+ }
1657
1730
  function getBaseSurfaceColor(theme) {
1658
1731
  return theme === "light" ? semanticColorsLight["surface-raised"] : semanticColorsDark["surface-elevated"];
1659
1732
  }
@@ -1949,6 +2022,8 @@ var audiobookPreset = {
1949
2022
  },
1950
2023
  rootClasses: ["atmosphere-warm", "grain"]
1951
2024
  };
2025
+ var DEFAULT_CONTEXT = { mode: "dark", level: "base" };
2026
+ var SurfaceContext = createContext(DEFAULT_CONTEXT);
1952
2027
  function wrapJsx(fn) {
1953
2028
  return function(type, props, ...rest) {
1954
2029
  if (props && typeof props.className === "string" && props.className) {
@@ -1977,9 +2052,11 @@ function ThemeProvider({
1977
2052
  children,
1978
2053
  ...props
1979
2054
  }) {
1980
- return /* @__PURE__ */ jsx(View, { style: [MODE_VARS[mode], { flex: 1 }, style], ...props, children });
2055
+ const { colorScheme } = useColorScheme();
2056
+ const resolved = mode === "system" ? colorScheme ?? "dark" : mode;
2057
+ return /* @__PURE__ */ jsx(SurfaceContext.Provider, { value: { mode: resolved, level: "base" }, children: /* @__PURE__ */ jsx(View, { style: [MODE_VARS[resolved], { flex: 1 }, style], ...props, children }) });
1981
2058
  }
1982
2059
 
1983
- export { CATEGORICAL_CVD_SAFE_MAX, ThemeProvider, applyThemePreset, audiobookPreset, bestTextColor, buttonSizes, categoricalPalette, componentElevationRanges, createFlatShadow, createPressedHoverShadow, createPressedShadow, createRaisedHoverShadow, createRaisedShadow, darkThemeCSSVars, darken, defaultPreset, discreteRainbow, divergingScale, elevationSystem, getBaseSurfaceColor, getCategoricalColor, getDiscreteRainbowColor, getElevationConfig, getElevationShadow, getElevationSurface, getGlowShadow, getHoverColors, getSemanticColors, getThemeCSSVars, getValidatedElevation, gluestackConfig, hexToRgb, hsvToRgb, isCssPropertyManifest, isDark, lightThemeCSSVars, lighten, linearGradient, neumorphicShadows, primitiveBorderRadius, primitiveBreakpoints, primitiveColors, primitiveRamps, primitiveShadows, primitiveSpacing, primitiveTypography, primitiveZIndex, resolveColor, rgbToHex, rgbToHsv, semanticColorsDark, semanticColorsLight, semanticTypography, sequentialEffort, shadowColors, surfaceGradient, validateCssPropertyManifest };
2060
+ export { CATEGORICAL_CVD_SAFE_MAX, PRESSED_ELEVATION_LEVEL, ThemeProvider, applyThemePreset, audiobookPreset, backgroundFrameDark, bestTextColor, buttonSizes, categoricalPalette, componentElevationRanges, createFlatShadow, createPressedHoverShadow, createPressedShadow, createRaisedHoverShadow, createRaisedShadow, darkThemeCSSVars, darken, defaultPreset, discreteRainbow, divergingScale, elevationSystem, getBaseSurfaceColor, getCategoricalColor, getDiscreteRainbowColor, getElevationConfig, getElevationShadow, getElevationSurface, getGlowShadow, getHoverColors, getPressedRecessShadow, getSemanticColors, getThemeCSSVars, getValidatedElevation, gluestackConfig, hexToRgb, hsvToRgb, isCssPropertyManifest, isDark, lightThemeCSSVars, lighten, linearGradient, neumorphicShadows, primitiveBorderRadius, primitiveBreakpoints, primitiveColors, primitiveRamps, primitiveShadows, primitiveSpacing, primitiveTypography, primitiveZIndex, resolveColor, rgbToHex, rgbToHsv, semanticColorsDark, semanticColorsLight, semanticTypography, sequentialEffort, shadowColors, surfaceGradient, surfaceRampDark, validateCssPropertyManifest };
1984
2061
  //# sourceMappingURL=index.mjs.map
1985
2062
  //# sourceMappingURL=index.mjs.map