@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
@@ -2,6 +2,7 @@
2
2
 
3
3
  var reactNative = require('react-native');
4
4
  var nativewind = require('nativewind');
5
+ var react = require('react');
5
6
  var jsxRuntime = require('react/jsx-runtime');
6
7
 
7
8
  // src/theme/tokens/primitives.ts
@@ -78,6 +79,21 @@ var primitiveColors = {
78
79
  black: "#000000",
79
80
  transparent: "transparent"
80
81
  };
82
+ var surfaceRampDark = {
83
+ inset: "#13100D",
84
+ // L*4.5 — sub-shell well / pressed
85
+ background: "#1C1916",
86
+ // L*9 — shell / frame
87
+ base: "#252321",
88
+ // L*13.5 — main content plane
89
+ elevated: "#2C2A28",
90
+ // L*17 — nav / rail
91
+ raised: "#31302F",
92
+ // L*20 — cards
93
+ overlay: "#373635"
94
+ // L*22.5 — hero / popover
95
+ };
96
+ var backgroundFrameDark = "#100D0A";
81
97
  var primitiveRamps = {
82
98
  red: {
83
99
  50: "#FFF4F4",
@@ -545,10 +561,19 @@ var semanticColorsLight = {
545
561
  "surface-overlay": primitiveColors.white,
546
562
  "surface-input": primitiveColors.neutral[50],
547
563
  // Input field background (filled variant)
564
+ // Deepest pressed pit (TD-surface-tokens, S-3) — light-mode counterpart of
565
+ // the dark ramp's `inset` plane; a placeholder pairing, not part of the
566
+ // dark-ramp investigation (surface.contract.test.ts is dark-mode only).
567
+ "surface-inset": primitiveColors.neutral[300],
548
568
  // Background colors (background-*)
549
569
  "background-base": "#EBEBEB",
550
570
  "background-default": primitiveColors.white,
551
571
  "background-subtle": primitiveColors.neutral[50],
572
+ // Frame/bezel chrome (TD-surface-tokens, S-3) — top bar + side nav shell,
573
+ // one step below `background-base` (darker still than `surface-inset`
574
+ // above, mirroring the dark-mode ordering). Placeholder pairing for light
575
+ // mode (see dark-mode note on `surface-inset` above).
576
+ "background-frame": primitiveColors.neutral[400],
552
577
  // Border colors (border-*)
553
578
  "border-default": "#E8E9EB",
554
579
  "border-subtle": primitiveColors.neutral[100],
@@ -564,6 +589,11 @@ var semanticColorsLight = {
564
589
  // Input field border on focus
565
590
  "border-input-error": primitiveColors.red[600],
566
591
  // Input field border on error
592
+ // Alpha hairline separators (surface-independent — composite toward black on
593
+ // light surfaces, mirroring the dark-mode white-alpha family). See §4/S-2.
594
+ "hairline-subtle": "rgba(0, 0, 0, 0.06)",
595
+ "hairline-default": "rgba(0, 0, 0, 0.09)",
596
+ "hairline-strong": "rgba(0, 0, 0, 0.14)",
567
597
  // Interactive states (interactive-*)
568
598
  "interactive-hover": "rgba(55, 65, 81, 0.04)",
569
599
  "interactive-focus": "rgba(55, 65, 81, 0.12)",
@@ -656,25 +686,46 @@ var semanticColorsDark = {
656
686
  "text-inverse": primitiveColors.neutral[900],
657
687
  "text-link": "#828DF8",
658
688
  "text-link-hover": primitiveColors.blue[400],
659
- // Surface colors - dark backgrounds
660
- "surface-base": primitiveColors.charcoal[700],
661
- // main surface
662
- "surface-elevated": primitiveColors.charcoal[600],
663
- // elevated surface
664
- "surface-raised": primitiveColors.charcoal[500],
665
- // raised surface
666
- "surface-overlay": primitiveColors.charcoal[600],
667
- // overlay surface
668
- "surface-input": primitiveColors.charcoal[600],
669
- // input surface
670
- // Background colors
671
- "background-base": primitiveColors.charcoal[900],
672
- // darkest charcoal
673
- "background-default": primitiveColors.charcoal[700],
674
- // main background
675
- "background-subtle": primitiveColors.charcoal[500],
676
- // subtle background
677
- // Border colors
689
+ // Surface colors - dark backgrounds — warm-tapered DERIVED ramp (TD-surface-tokens,
690
+ // S-1, re-spaced S-3). Shipped verbatim from `deriveSurfaceRamp()` — see
691
+ // `surfaceRampDark` in primitives.ts for the full derivation note. `surface-overlay`
692
+ // and `surface-elevated` are distinct (were both #191919 pre-S-1); `surface-input`
693
+ // tracks one plane above `surface-base`, same relative position as before the remap.
694
+ // `background-base` backs `Surface level="background"` (SurfaceContext.SURFACE_LEVEL_TOKEN),
695
+ // so it takes the ramp's `background` (shell/frame) role, NOT `inset`. The ramp's
696
+ // deepest `inset` plane is now promoted to `surface-inset` below (S-3) — still no
697
+ // `SurfaceLevel` member for it (follow-up, alongside the elevation.ts -1/-2 pressed
698
+ // levels — parallel workstream, not this branch).
699
+ "surface-base": surfaceRampDark.base,
700
+ // main surface (#252321, L*13.5)
701
+ "surface-elevated": surfaceRampDark.elevated,
702
+ // elevated surface (#2C2A28, L*17 — nav/rail)
703
+ "surface-raised": surfaceRampDark.raised,
704
+ // raised surface (#31302F, L*20 — cards)
705
+ "surface-overlay": surfaceRampDark.overlay,
706
+ // overlay surface (#373635, L*22.5 — hero/popover)
707
+ "surface-input": surfaceRampDark.elevated,
708
+ // input surface (#2C2A28 — one plane above base)
709
+ "surface-inset": surfaceRampDark.inset,
710
+ // deepest pressed pit (#13100D, L*4.5 — sub-shell well)
711
+ // Background colors — same ramp, the frame/shell end of it.
712
+ "background-base": surfaceRampDark.background,
713
+ // shell / frame (#1C1916, L*9 — Surface level="background")
714
+ "background-default": surfaceRampDark.base,
715
+ // main background (#252321, L*13.5 — matches surface-base)
716
+ "background-subtle": surfaceRampDark.elevated,
717
+ // subtle background (#2C2A28, L*17 — matches surface-elevated)
718
+ // Frame/bezel chrome (S-3) — the top bar + side nav shell; one step BELOW
719
+ // `background-base`, darker even than `surface-inset` — it exits the content
720
+ // ramp entirely rather than sitting in it. See `backgroundFrameDark` in
721
+ // primitives.ts.
722
+ "background-frame": backgroundFrameDark,
723
+ // frame / bezel (#100D0A, L*3.79)
724
+ // Border colors — `border-subtle` (#1C1C1C) previously collided with
725
+ // `surface-raised` (also #1C1C1C, an invisible border on raised cards). The
726
+ // re-spaced ramp above moved `surface-raised` to #2D2C2B, so this value is now
727
+ // distinct from every surface hex without needing to change it — see
728
+ // `surface.contract.test.ts` R2/R4.
678
729
  "border-default": primitiveColors.charcoal[400],
679
730
  // default border
680
731
  "border-subtle": primitiveColors.charcoal[500],
@@ -688,6 +739,14 @@ var semanticColorsDark = {
688
739
  "border-input-hover": primitiveColors.neutral[500],
689
740
  "border-input-focus": "#828DF8",
690
741
  "border-input-error": primitiveColors.red[500],
742
+ // Alpha hairline separators — the primary separation cue (§4/S-2). Self-
743
+ // normalizing: composites toward white by ~the same amount on ANY plane, so
744
+ // one family works at every elevation instead of per-surface border tokens.
745
+ // Shadows are demoted to floating-overlay use only (not shipped as a fill
746
+ // separator here — see elevation.ts, follow-up S-4).
747
+ "hairline-subtle": "rgba(255, 255, 255, 0.06)",
748
+ "hairline-default": "rgba(255, 255, 255, 0.09)",
749
+ "hairline-strong": "rgba(255, 255, 255, 0.14)",
691
750
  // Interactive states
692
751
  "interactive-hover": "rgba(255, 255, 255, 0.04)",
693
752
  "interactive-focus": "rgba(255, 255, 255, 0.12)",
@@ -865,9 +924,11 @@ var lightThemeCSSVars = {
865
924
  "--color-surface-base": semanticColorsLight["surface-base"],
866
925
  "--color-surface-elevated": semanticColorsLight["surface-elevated"],
867
926
  "--color-surface-raised": semanticColorsLight["surface-raised"],
927
+ "--color-surface-inset": semanticColorsLight["surface-inset"],
868
928
  "--color-background-base": semanticColorsLight["background-base"],
869
929
  "--color-background-default": semanticColorsLight["background-default"],
870
930
  "--color-background-subtle": semanticColorsLight["background-subtle"],
931
+ "--color-background-frame": semanticColorsLight["background-frame"],
871
932
  "--color-border-default": semanticColorsLight["border-default"],
872
933
  "--color-border-subtle": semanticColorsLight["border-subtle"],
873
934
  "--color-border-strong": semanticColorsLight["border-strong"],
@@ -924,6 +985,9 @@ var lightThemeCSSVars = {
924
985
  "--color-border-input-hover": semanticColorsLight["border-input-hover"],
925
986
  "--color-border-input-focus": semanticColorsLight["border-input-focus"],
926
987
  "--color-border-input-error": semanticColorsLight["border-input-error"],
988
+ "--color-hairline-subtle": semanticColorsLight["hairline-subtle"],
989
+ "--color-hairline-default": semanticColorsLight["hairline-default"],
990
+ "--color-hairline-strong": semanticColorsLight["hairline-strong"],
927
991
  "--color-interactive-disabled-text": semanticColorsLight["interactive-disabled-text"],
928
992
  "--color-avatar-background": semanticColorsLight["avatar-background"],
929
993
  "--color-avatar-text": semanticColorsLight["avatar-text"],
@@ -963,9 +1027,11 @@ var darkThemeCSSVars = {
963
1027
  "--color-surface-base": semanticColorsDark["surface-base"],
964
1028
  "--color-surface-elevated": semanticColorsDark["surface-elevated"],
965
1029
  "--color-surface-raised": semanticColorsDark["surface-raised"],
1030
+ "--color-surface-inset": semanticColorsDark["surface-inset"],
966
1031
  "--color-background-base": semanticColorsDark["background-base"],
967
1032
  "--color-background-default": semanticColorsDark["background-default"],
968
1033
  "--color-background-subtle": semanticColorsDark["background-subtle"],
1034
+ "--color-background-frame": semanticColorsDark["background-frame"],
969
1035
  "--color-border-default": semanticColorsDark["border-default"],
970
1036
  "--color-border-subtle": semanticColorsDark["border-subtle"],
971
1037
  "--color-border-strong": semanticColorsDark["border-strong"],
@@ -1022,6 +1088,9 @@ var darkThemeCSSVars = {
1022
1088
  "--color-border-input-hover": semanticColorsDark["border-input-hover"],
1023
1089
  "--color-border-input-focus": semanticColorsDark["border-input-focus"],
1024
1090
  "--color-border-input-error": semanticColorsDark["border-input-error"],
1091
+ "--color-hairline-subtle": semanticColorsDark["hairline-subtle"],
1092
+ "--color-hairline-default": semanticColorsDark["hairline-default"],
1093
+ "--color-hairline-strong": semanticColorsDark["hairline-strong"],
1025
1094
  "--color-interactive-disabled-text": semanticColorsDark["interactive-disabled-text"],
1026
1095
  "--color-avatar-background": semanticColorsDark["avatar-background"],
1027
1096
  "--color-avatar-text": semanticColorsDark["avatar-text"],
@@ -1656,6 +1725,10 @@ function getElevationShadow(baseColor, level, theme, isHovered = false) {
1656
1725
  elevationShadowCache.set(cacheKey, result);
1657
1726
  return result;
1658
1727
  }
1728
+ var PRESSED_ELEVATION_LEVEL = -1;
1729
+ function getPressedRecessShadow(fillColor, theme) {
1730
+ return getElevationShadow(fillColor, PRESSED_ELEVATION_LEVEL, theme);
1731
+ }
1659
1732
  function getBaseSurfaceColor(theme) {
1660
1733
  return theme === "light" ? semanticColorsLight["surface-raised"] : semanticColorsDark["surface-elevated"];
1661
1734
  }
@@ -1951,6 +2024,8 @@ var audiobookPreset = {
1951
2024
  },
1952
2025
  rootClasses: ["atmosphere-warm", "grain"]
1953
2026
  };
2027
+ var DEFAULT_CONTEXT = { mode: "dark", level: "base" };
2028
+ var SurfaceContext = react.createContext(DEFAULT_CONTEXT);
1954
2029
  function wrapJsx(fn) {
1955
2030
  return function(type, props, ...rest) {
1956
2031
  if (props && typeof props.className === "string" && props.className) {
@@ -1979,13 +2054,17 @@ function ThemeProvider({
1979
2054
  children,
1980
2055
  ...props
1981
2056
  }) {
1982
- return /* @__PURE__ */ jsx(reactNative.View, { style: [MODE_VARS[mode], { flex: 1 }, style], ...props, children });
2057
+ const { colorScheme } = nativewind.useColorScheme();
2058
+ const resolved = mode === "system" ? colorScheme ?? "dark" : mode;
2059
+ return /* @__PURE__ */ jsx(SurfaceContext.Provider, { value: { mode: resolved, level: "base" }, children: /* @__PURE__ */ jsx(reactNative.View, { style: [MODE_VARS[resolved], { flex: 1 }, style], ...props, children }) });
1983
2060
  }
1984
2061
 
1985
2062
  exports.CATEGORICAL_CVD_SAFE_MAX = CATEGORICAL_CVD_SAFE_MAX;
2063
+ exports.PRESSED_ELEVATION_LEVEL = PRESSED_ELEVATION_LEVEL;
1986
2064
  exports.ThemeProvider = ThemeProvider;
1987
2065
  exports.applyThemePreset = applyThemePreset;
1988
2066
  exports.audiobookPreset = audiobookPreset;
2067
+ exports.backgroundFrameDark = backgroundFrameDark;
1989
2068
  exports.bestTextColor = bestTextColor;
1990
2069
  exports.buttonSizes = buttonSizes;
1991
2070
  exports.categoricalPalette = categoricalPalette;
@@ -2009,6 +2088,7 @@ exports.getElevationShadow = getElevationShadow;
2009
2088
  exports.getElevationSurface = getElevationSurface;
2010
2089
  exports.getGlowShadow = getGlowShadow;
2011
2090
  exports.getHoverColors = getHoverColors;
2091
+ exports.getPressedRecessShadow = getPressedRecessShadow;
2012
2092
  exports.getSemanticColors = getSemanticColors;
2013
2093
  exports.getThemeCSSVars = getThemeCSSVars;
2014
2094
  exports.getValidatedElevation = getValidatedElevation;
@@ -2038,6 +2118,7 @@ exports.semanticTypography = semanticTypography;
2038
2118
  exports.sequentialEffort = sequentialEffort;
2039
2119
  exports.shadowColors = shadowColors;
2040
2120
  exports.surfaceGradient = surfaceGradient;
2121
+ exports.surfaceRampDark = surfaceRampDark;
2041
2122
  exports.validateCssPropertyManifest = validateCssPropertyManifest;
2042
2123
  //# sourceMappingURL=index.js.map
2043
2124
  //# sourceMappingURL=index.js.map