@utilitywarehouse/hearth-react-native 0.20.0 → 0.22.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 (143) hide show
  1. package/.storybook/manager.ts +1 -0
  2. package/.storybook/preview.tsx +1 -0
  3. package/.turbo/turbo-build.log +1 -1
  4. package/.turbo/turbo-lint.log +13 -13
  5. package/CHANGELOG.md +272 -0
  6. package/build/components/BodyText/BodyText.js +12 -5
  7. package/build/components/BodyText/BodyText.props.d.ts +5 -19
  8. package/build/components/Box/Box.js +23 -3
  9. package/build/components/Box/Box.props.d.ts +3 -95
  10. package/build/components/Card/Card.props.d.ts +4 -11
  11. package/build/components/Card/CardRoot.js +0 -1
  12. package/build/components/Checkbox/Checkbox.d.ts +1 -1
  13. package/build/components/Checkbox/Checkbox.js +2 -2
  14. package/build/components/Checkbox/Checkbox.props.d.ts +2 -0
  15. package/build/components/Container/Container.props.d.ts +2 -78
  16. package/build/components/DateInput/DateInput.d.ts +1 -1
  17. package/build/components/DateInput/DateInput.js +2 -2
  18. package/build/components/DateInput/DateInput.props.d.ts +15 -1
  19. package/build/components/DateInput/DateInputSegment.d.ts +1 -1
  20. package/build/components/DateInput/DateInputSegment.js +2 -2
  21. package/build/components/DetailText/DetailText.js +14 -13
  22. package/build/components/DetailText/DetailText.props.d.ts +4 -17
  23. package/build/components/Flex/Flex.js +3 -1
  24. package/build/components/Flex/Flex.props.d.ts +2 -2
  25. package/build/components/Heading/Heading.js +34 -13
  26. package/build/components/Heading/Heading.props.d.ts +4 -18
  27. package/build/components/Modal/Modal.js +1 -1
  28. package/build/components/Radio/Radio.d.ts +1 -1
  29. package/build/components/Radio/Radio.js +2 -2
  30. package/build/components/Radio/Radio.props.d.ts +2 -0
  31. package/build/core/themes.d.ts +188 -8
  32. package/build/core/themes.js +18 -2
  33. package/build/hooks/useStyleProps.js +22 -5
  34. package/build/tokens/color.d.ts +4 -0
  35. package/build/tokens/color.js +2 -0
  36. package/build/tokens/components/dark/modal.d.ts +6 -0
  37. package/build/tokens/components/dark/modal.js +6 -0
  38. package/build/tokens/components/dark/navigation.d.ts +1 -0
  39. package/build/tokens/components/dark/navigation.js +1 -0
  40. package/build/tokens/components/light/modal.d.ts +6 -0
  41. package/build/tokens/components/light/modal.js +6 -0
  42. package/build/tokens/components/light/navigation.d.ts +1 -0
  43. package/build/tokens/components/light/navigation.js +1 -0
  44. package/build/tokens/components/light/skeleton.d.ts +1 -1
  45. package/build/tokens/components/light/skeleton.js +1 -1
  46. package/build/tokens/font.d.ts +2 -0
  47. package/build/tokens/font.js +2 -0
  48. package/build/tokens/line-height.d.ts +2 -0
  49. package/build/tokens/line-height.js +2 -0
  50. package/build/tokens/primitive.d.ts +4 -0
  51. package/build/tokens/primitive.js +4 -0
  52. package/build/tokens/semantic-dark.d.ts +1 -0
  53. package/build/tokens/semantic-dark.js +1 -0
  54. package/build/tokens/semantic-light.d.ts +1 -0
  55. package/build/tokens/semantic-light.js +1 -0
  56. package/build/tokens/typography.d.ts +30 -0
  57. package/build/tokens/typography.js +15 -0
  58. package/build/types/index.d.ts +4 -2
  59. package/build/types/index.js +4 -2
  60. package/build/types/semanticColorValues.d.ts +22 -0
  61. package/build/types/semanticColorValues.js +1 -0
  62. package/build/types/utilityProps.d.ts +326 -0
  63. package/build/types/utilityProps.js +1 -0
  64. package/build/types/values.d.ts +4 -3
  65. package/build/utils/coloursAsArray.d.ts +4 -0
  66. package/build/utils/coloursAsArray.js +5 -0
  67. package/build/utils/index.d.ts +1 -1
  68. package/build/utils/index.js +1 -1
  69. package/build/utils/styleUtils.d.ts +26 -2
  70. package/build/utils/styleUtils.js +42 -13
  71. package/build/utils/themeValueHelpers.d.ts +13 -0
  72. package/build/utils/themeValueHelpers.js +29 -0
  73. package/docs/changelog.mdx +74 -2
  74. package/docs/components/AllComponents.web.tsx +23 -24
  75. package/docs/components/NextPrevPage.tsx +2 -2
  76. package/docs/components/UsageWrap.tsx +2 -2
  77. package/docs/introduction.mdx +0 -7
  78. package/package.json +8 -6
  79. package/src/components/BodyText/BodyText.props.ts +5 -19
  80. package/src/components/BodyText/BodyText.stories.tsx +2 -1
  81. package/src/components/BodyText/BodyText.tsx +17 -6
  82. package/src/components/Box/Box.docs.mdx +5 -4
  83. package/src/components/Box/Box.props.ts +3 -231
  84. package/src/components/Box/Box.stories.tsx +2 -2
  85. package/src/components/Box/Box.tsx +38 -9
  86. package/src/components/Button/Button.docs.mdx +46 -1
  87. package/src/components/Card/Card.docs.mdx +1 -1
  88. package/src/components/Card/Card.props.ts +5 -11
  89. package/src/components/Card/Card.stories.tsx +54 -23
  90. package/src/components/Card/CardRoot.tsx +0 -1
  91. package/src/components/Carousel/Carousel.docs.mdx +49 -44
  92. package/src/components/Center/Center.docs.mdx +6 -4
  93. package/src/components/Checkbox/Checkbox.docs.mdx +1 -0
  94. package/src/components/Checkbox/Checkbox.props.ts +2 -0
  95. package/src/components/Checkbox/Checkbox.stories.tsx +26 -0
  96. package/src/components/Checkbox/Checkbox.tsx +2 -0
  97. package/src/components/Container/Container.docs.mdx +13 -8
  98. package/src/components/Container/Container.props.ts +9 -80
  99. package/src/components/Container/Container.stories.tsx +81 -65
  100. package/src/components/DateInput/DateInput.docs.mdx +43 -0
  101. package/src/components/DateInput/DateInput.props.ts +15 -1
  102. package/src/components/DateInput/DateInput.stories.tsx +37 -2
  103. package/src/components/DateInput/DateInput.tsx +6 -0
  104. package/src/components/DateInput/DateInputSegment.tsx +2 -0
  105. package/src/components/DetailText/DetailText.props.ts +4 -17
  106. package/src/components/DetailText/DetailText.stories.tsx +2 -3
  107. package/src/components/DetailText/DetailText.tsx +16 -17
  108. package/src/components/Flex/Flex.props.ts +2 -2
  109. package/src/components/Flex/Flex.stories.tsx +1 -1
  110. package/src/components/Flex/Flex.tsx +4 -1
  111. package/src/components/Grid/Grid.docs.mdx +53 -49
  112. package/src/components/Heading/Heading.props.ts +4 -18
  113. package/src/components/Heading/Heading.stories.tsx +2 -1
  114. package/src/components/Heading/Heading.tsx +40 -18
  115. package/src/components/Modal/Modal.tsx +1 -1
  116. package/src/components/Radio/Radio.docs.mdx +1 -0
  117. package/src/components/Radio/Radio.props.ts +2 -0
  118. package/src/components/Radio/Radio.stories.tsx +22 -0
  119. package/src/components/Radio/Radio.tsx +2 -0
  120. package/src/components/Radio/RadioTile.figma.tsx +4 -0
  121. package/src/components/Toast/ToastItem.figma.tsx +1 -8
  122. package/src/core/themes.ts +19 -2
  123. package/src/hooks/useStyleProps.ts +40 -5
  124. package/src/tokens/color.ts +2 -0
  125. package/src/tokens/components/dark/modal.ts +6 -0
  126. package/src/tokens/components/dark/navigation.ts +1 -0
  127. package/src/tokens/components/light/modal.ts +6 -0
  128. package/src/tokens/components/light/navigation.ts +1 -0
  129. package/src/tokens/components/light/skeleton.ts +1 -1
  130. package/src/tokens/font.ts +2 -0
  131. package/src/tokens/line-height.ts +2 -0
  132. package/src/tokens/primitive.ts +4 -0
  133. package/src/tokens/semantic-dark.ts +1 -0
  134. package/src/tokens/semantic-light.ts +1 -0
  135. package/src/tokens/typography.ts +15 -0
  136. package/src/types/index.ts +4 -2
  137. package/src/types/semanticColorValues.ts +26 -0
  138. package/src/types/utilityProps.ts +410 -0
  139. package/src/types/values.ts +4 -7
  140. package/src/utils/coloursAsArray.ts +6 -0
  141. package/src/utils/index.ts +8 -1
  142. package/src/utils/styleUtils.ts +45 -14
  143. package/src/utils/themeValueHelpers.ts +38 -0
@@ -58,3 +58,41 @@ export const resolveThemeValue = (value: any, themeMapping: any): any => {
58
58
  // If none of the approaches work, return the original value
59
59
  return value;
60
60
  };
61
+
62
+ /**
63
+ * Resolve a dot-notation key against the theme object.
64
+ * e.g., 'semanticColor.text' -> theme.semanticColor.text
65
+ * Simple keys like 'space' are resolved via direct bracket access.
66
+ */
67
+ export const resolveThemeKey = (theme: Record<string, any>, key: string): any => {
68
+ if (key.includes('.')) {
69
+ return key.split('.').reduce((obj, k) => obj?.[k], theme);
70
+ }
71
+ return theme[key];
72
+ };
73
+
74
+ /**
75
+ * Resolve a theme value with a fallback theme mapping.
76
+ * First tries the primary mapping (e.g., theme.semanticColor.background for simplified tokens).
77
+ * If not found, falls back to the secondary mapping (e.g., theme.color for full color values).
78
+ * This ensures backward compatibility while supporting simplified token names.
79
+ */
80
+ export const resolveThemeValueWithFallback = (
81
+ value: any,
82
+ primaryMapping: any,
83
+ fallbackMapping?: any
84
+ ): any => {
85
+ const resolved = resolveThemeValue(value, primaryMapping);
86
+
87
+ // If the value was resolved (changed from input), return it
88
+ if (resolved !== value) {
89
+ return resolved;
90
+ }
91
+
92
+ // If we have a fallback mapping and the primary didn't resolve, try the fallback
93
+ if (fallbackMapping) {
94
+ return resolveThemeValue(value, fallbackMapping);
95
+ }
96
+
97
+ return resolved;
98
+ };