@korsolutions/ui 0.0.87 → 0.0.88

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 (200) hide show
  1. package/dist/module/components/alert/variants/default.js +2 -1
  2. package/dist/module/components/alert/variants/default.js.map +1 -1
  3. package/dist/module/components/alert/variants/destructive.js +2 -1
  4. package/dist/module/components/alert/variants/destructive.js.map +1 -1
  5. package/dist/module/components/alert-dialog/variants/default.js +4 -1
  6. package/dist/module/components/alert-dialog/variants/default.js.map +1 -1
  7. package/dist/module/components/avatar/variants/default.js +1 -0
  8. package/dist/module/components/avatar/variants/default.js.map +1 -1
  9. package/dist/module/components/badge/variants/default.js +1 -0
  10. package/dist/module/components/badge/variants/default.js.map +1 -1
  11. package/dist/module/components/badge/variants/secondary.js +1 -0
  12. package/dist/module/components/badge/variants/secondary.js.map +1 -1
  13. package/dist/module/components/button/button.js +3 -2
  14. package/dist/module/components/button/button.js.map +1 -1
  15. package/dist/module/components/button/variants/default.js +1 -0
  16. package/dist/module/components/button/variants/default.js.map +1 -1
  17. package/dist/module/components/button/variants/ghost.js +1 -0
  18. package/dist/module/components/button/variants/ghost.js.map +1 -1
  19. package/dist/module/components/button/variants/secondary.js +1 -0
  20. package/dist/module/components/button/variants/secondary.js.map +1 -1
  21. package/dist/module/components/calendar/calendar/variants/default.js +3 -0
  22. package/dist/module/components/calendar/calendar/variants/default.js.map +1 -1
  23. package/dist/module/components/calendar/timeline/variants/default.js +1 -0
  24. package/dist/module/components/calendar/timeline/variants/default.js.map +1 -1
  25. package/dist/module/components/calendar/week-calendar/variants/default.js +3 -0
  26. package/dist/module/components/calendar/week-calendar/variants/default.js.map +1 -1
  27. package/dist/module/components/card/variants/default.js +1 -0
  28. package/dist/module/components/card/variants/default.js.map +1 -1
  29. package/dist/module/components/checkbox/variants/default.js +2 -0
  30. package/dist/module/components/checkbox/variants/default.js.map +1 -1
  31. package/dist/module/components/checkbox/variants/outlined.js +2 -0
  32. package/dist/module/components/checkbox/variants/outlined.js.map +1 -1
  33. package/dist/module/components/combobox/variants/default.js +3 -0
  34. package/dist/module/components/combobox/variants/default.js.map +1 -1
  35. package/dist/module/components/empty/variants/default.js +2 -0
  36. package/dist/module/components/empty/variants/default.js.map +1 -1
  37. package/dist/module/components/field/variants/default.js +3 -0
  38. package/dist/module/components/field/variants/default.js.map +1 -1
  39. package/dist/module/components/input/variants/default.js +1 -0
  40. package/dist/module/components/input/variants/default.js.map +1 -1
  41. package/dist/module/components/input/variants/secondary.js +1 -0
  42. package/dist/module/components/input/variants/secondary.js.map +1 -1
  43. package/dist/module/components/link/variants/default.js +1 -0
  44. package/dist/module/components/link/variants/default.js.map +1 -1
  45. package/dist/module/components/menu/variants/default.js +3 -0
  46. package/dist/module/components/menu/variants/default.js.map +1 -1
  47. package/dist/module/components/phone-input/variants/default.js +4 -0
  48. package/dist/module/components/phone-input/variants/default.js.map +1 -1
  49. package/dist/module/components/portal/portal.web.js +15 -0
  50. package/dist/module/components/portal/portal.web.js.map +1 -1
  51. package/dist/module/components/radio-group/variants/default.js +2 -0
  52. package/dist/module/components/radio-group/variants/default.js.map +1 -1
  53. package/dist/module/components/radio-group/variants/outlined.js +2 -0
  54. package/dist/module/components/radio-group/variants/outlined.js.map +1 -1
  55. package/dist/module/components/select/variants/default.js +3 -0
  56. package/dist/module/components/select/variants/default.js.map +1 -1
  57. package/dist/module/components/sidebar/variants/default.js +1 -0
  58. package/dist/module/components/sidebar/variants/default.js.map +1 -1
  59. package/dist/module/components/tabs/variants/default.js +1 -0
  60. package/dist/module/components/tabs/variants/default.js.map +1 -1
  61. package/dist/module/components/tabs/variants/line.js +1 -0
  62. package/dist/module/components/tabs/variants/line.js.map +1 -1
  63. package/dist/module/components/textarea/variants/default.js +1 -0
  64. package/dist/module/components/textarea/variants/default.js.map +1 -1
  65. package/dist/module/components/toast/variants/danger.js +2 -0
  66. package/dist/module/components/toast/variants/danger.js.map +1 -1
  67. package/dist/module/components/toast/variants/default.js +2 -0
  68. package/dist/module/components/toast/variants/default.js.map +1 -1
  69. package/dist/module/components/toast/variants/success.js +2 -0
  70. package/dist/module/components/toast/variants/success.js.map +1 -1
  71. package/dist/module/components/typography/typography.js +7 -2
  72. package/dist/module/components/typography/typography.js.map +1 -1
  73. package/dist/module/components/typography/variants/body.js +28 -0
  74. package/dist/module/components/typography/variants/body.js.map +1 -0
  75. package/dist/module/components/typography/variants/heading.js +29 -0
  76. package/dist/module/components/typography/variants/heading.js.map +1 -0
  77. package/dist/module/components/typography/variants/index.js +4 -12
  78. package/dist/module/components/typography/variants/index.js.map +1 -1
  79. package/dist/module/utils/size-scale.js +3 -1
  80. package/dist/module/utils/size-scale.js.map +1 -1
  81. package/dist/typescript/src/components/alert/variants/default.d.ts.map +1 -1
  82. package/dist/typescript/src/components/alert/variants/destructive.d.ts.map +1 -1
  83. package/dist/typescript/src/components/alert-dialog/variants/default.d.ts.map +1 -1
  84. package/dist/typescript/src/components/avatar/variants/default.d.ts.map +1 -1
  85. package/dist/typescript/src/components/badge/variants/default.d.ts.map +1 -1
  86. package/dist/typescript/src/components/badge/variants/secondary.d.ts.map +1 -1
  87. package/dist/typescript/src/components/button/button.d.ts.map +1 -1
  88. package/dist/typescript/src/components/button/types.d.ts +3 -2
  89. package/dist/typescript/src/components/button/types.d.ts.map +1 -1
  90. package/dist/typescript/src/components/button/variants/default.d.ts.map +1 -1
  91. package/dist/typescript/src/components/button/variants/ghost.d.ts.map +1 -1
  92. package/dist/typescript/src/components/button/variants/secondary.d.ts.map +1 -1
  93. package/dist/typescript/src/components/calendar/calendar/variants/default.d.ts.map +1 -1
  94. package/dist/typescript/src/components/calendar/timeline/variants/default.d.ts.map +1 -1
  95. package/dist/typescript/src/components/calendar/week-calendar/variants/default.d.ts.map +1 -1
  96. package/dist/typescript/src/components/card/variants/default.d.ts.map +1 -1
  97. package/dist/typescript/src/components/checkbox/variants/default.d.ts.map +1 -1
  98. package/dist/typescript/src/components/checkbox/variants/outlined.d.ts.map +1 -1
  99. package/dist/typescript/src/components/combobox/variants/default.d.ts.map +1 -1
  100. package/dist/typescript/src/components/empty/variants/default.d.ts.map +1 -1
  101. package/dist/typescript/src/components/field/variants/default.d.ts.map +1 -1
  102. package/dist/typescript/src/components/input/variants/default.d.ts.map +1 -1
  103. package/dist/typescript/src/components/input/variants/secondary.d.ts.map +1 -1
  104. package/dist/typescript/src/components/link/variants/default.d.ts.map +1 -1
  105. package/dist/typescript/src/components/menu/variants/default.d.ts.map +1 -1
  106. package/dist/typescript/src/components/phone-input/variants/default.d.ts.map +1 -1
  107. package/dist/typescript/src/components/portal/portal.web.d.ts.map +1 -1
  108. package/dist/typescript/src/components/radio-group/variants/default.d.ts.map +1 -1
  109. package/dist/typescript/src/components/radio-group/variants/outlined.d.ts.map +1 -1
  110. package/dist/typescript/src/components/select/variants/default.d.ts.map +1 -1
  111. package/dist/typescript/src/components/sidebar/variants/default.d.ts.map +1 -1
  112. package/dist/typescript/src/components/tabs/variants/default.d.ts.map +1 -1
  113. package/dist/typescript/src/components/tabs/variants/line.d.ts.map +1 -1
  114. package/dist/typescript/src/components/textarea/variants/default.d.ts.map +1 -1
  115. package/dist/typescript/src/components/toast/variants/danger.d.ts.map +1 -1
  116. package/dist/typescript/src/components/toast/variants/default.d.ts.map +1 -1
  117. package/dist/typescript/src/components/toast/variants/success.d.ts.map +1 -1
  118. package/dist/typescript/src/components/typography/typography.d.ts +2 -0
  119. package/dist/typescript/src/components/typography/typography.d.ts.map +1 -1
  120. package/dist/typescript/src/components/typography/variants/body.d.ts +4 -0
  121. package/dist/typescript/src/components/typography/variants/body.d.ts.map +1 -0
  122. package/dist/typescript/src/components/typography/variants/heading.d.ts +4 -0
  123. package/dist/typescript/src/components/typography/variants/heading.d.ts.map +1 -0
  124. package/dist/typescript/src/components/typography/variants/index.d.ts +4 -12
  125. package/dist/typescript/src/components/typography/variants/index.d.ts.map +1 -1
  126. package/dist/typescript/src/utils/size-scale.d.ts +3 -1
  127. package/dist/typescript/src/utils/size-scale.d.ts.map +1 -1
  128. package/package.json +4 -5
  129. package/src/components/alert/variants/default.tsx +2 -1
  130. package/src/components/alert/variants/destructive.tsx +2 -1
  131. package/src/components/alert-dialog/variants/default.tsx +4 -1
  132. package/src/components/avatar/variants/default.tsx +1 -0
  133. package/src/components/badge/variants/default.tsx +1 -0
  134. package/src/components/badge/variants/secondary.tsx +1 -0
  135. package/src/components/button/button.tsx +2 -2
  136. package/src/components/button/types.ts +3 -2
  137. package/src/components/button/variants/default.tsx +1 -0
  138. package/src/components/button/variants/ghost.tsx +1 -0
  139. package/src/components/button/variants/secondary.tsx +1 -0
  140. package/src/components/calendar/calendar/variants/default.tsx +3 -0
  141. package/src/components/calendar/timeline/variants/default.tsx +1 -0
  142. package/src/components/calendar/week-calendar/variants/default.tsx +3 -0
  143. package/src/components/card/variants/default.tsx +1 -0
  144. package/src/components/checkbox/variants/default.tsx +2 -0
  145. package/src/components/checkbox/variants/outlined.tsx +2 -0
  146. package/src/components/combobox/variants/default.tsx +3 -0
  147. package/src/components/empty/variants/default.tsx +2 -0
  148. package/src/components/field/variants/default.tsx +3 -0
  149. package/src/components/input/variants/default.tsx +1 -0
  150. package/src/components/input/variants/secondary.tsx +1 -0
  151. package/src/components/link/variants/default.tsx +1 -0
  152. package/src/components/menu/variants/default.tsx +3 -0
  153. package/src/components/phone-input/variants/default.tsx +4 -0
  154. package/src/components/portal/portal.web.tsx +15 -0
  155. package/src/components/radio-group/variants/default.tsx +2 -0
  156. package/src/components/radio-group/variants/outlined.tsx +2 -0
  157. package/src/components/select/variants/default.tsx +3 -0
  158. package/src/components/sidebar/variants/default.tsx +1 -0
  159. package/src/components/tabs/variants/default.tsx +1 -0
  160. package/src/components/tabs/variants/line.tsx +1 -0
  161. package/src/components/textarea/variants/default.tsx +1 -0
  162. package/src/components/toast/variants/danger.tsx +2 -0
  163. package/src/components/toast/variants/default.tsx +2 -0
  164. package/src/components/toast/variants/success.tsx +2 -0
  165. package/src/components/typography/typography.tsx +5 -2
  166. package/src/components/typography/variants/body.tsx +26 -0
  167. package/src/components/typography/variants/heading.tsx +27 -0
  168. package/src/components/typography/variants/index.ts +4 -12
  169. package/src/utils/size-scale.ts +6 -2
  170. package/README.md +0 -4
  171. package/dist/module/components/typography/variants/body-lg.js +0 -18
  172. package/dist/module/components/typography/variants/body-lg.js.map +0 -1
  173. package/dist/module/components/typography/variants/body-md.js +0 -18
  174. package/dist/module/components/typography/variants/body-md.js.map +0 -1
  175. package/dist/module/components/typography/variants/body-sm.js +0 -18
  176. package/dist/module/components/typography/variants/body-sm.js.map +0 -1
  177. package/dist/module/components/typography/variants/heading-lg.js +0 -19
  178. package/dist/module/components/typography/variants/heading-lg.js.map +0 -1
  179. package/dist/module/components/typography/variants/heading-md.js +0 -19
  180. package/dist/module/components/typography/variants/heading-md.js.map +0 -1
  181. package/dist/module/components/typography/variants/heading-sm.js +0 -19
  182. package/dist/module/components/typography/variants/heading-sm.js.map +0 -1
  183. package/dist/typescript/src/components/typography/variants/body-lg.d.ts +0 -3
  184. package/dist/typescript/src/components/typography/variants/body-lg.d.ts.map +0 -1
  185. package/dist/typescript/src/components/typography/variants/body-md.d.ts +0 -3
  186. package/dist/typescript/src/components/typography/variants/body-md.d.ts.map +0 -1
  187. package/dist/typescript/src/components/typography/variants/body-sm.d.ts +0 -3
  188. package/dist/typescript/src/components/typography/variants/body-sm.d.ts.map +0 -1
  189. package/dist/typescript/src/components/typography/variants/heading-lg.d.ts +0 -3
  190. package/dist/typescript/src/components/typography/variants/heading-lg.d.ts.map +0 -1
  191. package/dist/typescript/src/components/typography/variants/heading-md.d.ts +0 -3
  192. package/dist/typescript/src/components/typography/variants/heading-md.d.ts.map +0 -1
  193. package/dist/typescript/src/components/typography/variants/heading-sm.d.ts +0 -3
  194. package/dist/typescript/src/components/typography/variants/heading-sm.d.ts.map +0 -1
  195. package/src/components/typography/variants/body-lg.tsx +0 -14
  196. package/src/components/typography/variants/body-md.tsx +0 -14
  197. package/src/components/typography/variants/body-sm.tsx +0 -14
  198. package/src/components/typography/variants/heading-lg.tsx +0 -15
  199. package/src/components/typography/variants/heading-md.tsx +0 -15
  200. package/src/components/typography/variants/heading-sm.tsx +0 -15
@@ -48,6 +48,7 @@ export const useCheckboxVariantDefault = (): CheckboxStyles => {
48
48
  default: {
49
49
  color: colors.foreground,
50
50
  fontSize,
51
+ lineHeight: Math.round(fontSize * 1.25),
51
52
  fontFamily,
52
53
  fontWeight: "500",
53
54
  },
@@ -59,6 +60,7 @@ export const useCheckboxVariantDefault = (): CheckboxStyles => {
59
60
  default: {
60
61
  color: colors.mutedForeground,
61
62
  fontSize: fontSize * 0.875,
63
+ lineHeight: Math.round(fontSize * 0.875 * 1.25),
62
64
  fontFamily,
63
65
  marginTop: 2,
64
66
  },
@@ -63,6 +63,7 @@ export const useCheckboxVariantOutlined = (): CheckboxStyles => {
63
63
  default: {
64
64
  color: colors.foreground,
65
65
  fontSize,
66
+ lineHeight: Math.round(fontSize * 1.25),
66
67
  fontFamily,
67
68
  fontWeight: "500",
68
69
  },
@@ -74,6 +75,7 @@ export const useCheckboxVariantOutlined = (): CheckboxStyles => {
74
75
  default: {
75
76
  color: colors.mutedForeground,
76
77
  fontSize: fontSize * 0.875,
78
+ lineHeight: Math.round(fontSize * 0.875 * 1.25),
77
79
  fontFamily,
78
80
  marginTop: 2,
79
81
  },
@@ -27,6 +27,7 @@ export function useComboboxVariantDefault(size: Size): ComboboxStyles {
27
27
  minHeight: s.height,
28
28
  fontFamily,
29
29
  fontSize: s.fontSize,
30
+ lineHeight: s.lineHeight,
30
31
  color: colors.foreground,
31
32
  outlineWidth: 0,
32
33
  pointerEvents: "auto",
@@ -76,6 +77,7 @@ export function useComboboxVariantDefault(size: Size): ComboboxStyles {
76
77
  paddingHorizontal: s.paddingHorizontal,
77
78
  fontFamily,
78
79
  fontSize: s.fontSize,
80
+ lineHeight: s.lineHeight,
79
81
  color: colors.foreground,
80
82
  borderRadius: radius / 2,
81
83
  },
@@ -95,6 +97,7 @@ export function useComboboxVariantDefault(size: Size): ComboboxStyles {
95
97
  paddingHorizontal: s.paddingHorizontal,
96
98
  fontFamily,
97
99
  fontSize: s.fontSize,
100
+ lineHeight: s.lineHeight,
98
101
  color: colors.mutedForeground,
99
102
  textAlign: "center",
100
103
  },
@@ -20,6 +20,7 @@ export function useEmptyVariantDefault(): EmptyStyles {
20
20
  title: {
21
21
  fontFamily: fontFamily,
22
22
  fontSize: fontSize,
23
+ lineHeight: Math.round(fontSize * 1.25),
23
24
  color: colors.foreground,
24
25
  textAlign: "center",
25
26
  fontWeight: "600",
@@ -27,6 +28,7 @@ export function useEmptyVariantDefault(): EmptyStyles {
27
28
  description: {
28
29
  fontFamily: fontFamily,
29
30
  fontSize: fontSize * 0.875,
31
+ lineHeight: Math.round(fontSize * 0.875 * 1.25),
30
32
  color: colors.mutedForeground,
31
33
  textAlign: "center",
32
34
  },
@@ -11,17 +11,20 @@ export const useFieldVariantDefault = (): FieldStyles => {
11
11
  label: {
12
12
  fontFamily,
13
13
  fontSize: fontSize * 0.875,
14
+ lineHeight: Math.round(fontSize * 0.875 * 1.25),
14
15
  fontWeight: "600",
15
16
  color: colors.foreground,
16
17
  },
17
18
  description: {
18
19
  fontFamily,
19
20
  fontSize: fontSize * 0.875,
21
+ lineHeight: Math.round(fontSize * 0.875 * 1.25),
20
22
  color: colors.mutedForeground,
21
23
  },
22
24
  error: {
23
25
  fontFamily,
24
26
  fontSize: fontSize * 0.875,
27
+ lineHeight: Math.round(fontSize * 0.875 * 1.25),
25
28
  color: colors.danger,
26
29
  },
27
30
  }),
@@ -19,6 +19,7 @@ export function useInputVariantDefault(size: Size): InputStyles {
19
19
  paddingHorizontal: s.paddingHorizontal,
20
20
  fontFamily,
21
21
  fontSize: s.fontSize,
22
+ lineHeight: s.lineHeight,
22
23
  height: s.height,
23
24
  color: colors.foreground,
24
25
  outlineWidth: 0,
@@ -19,6 +19,7 @@ export function useInputVariantSecondary(size: Size): InputStyles {
19
19
  paddingHorizontal: s.paddingHorizontal,
20
20
  fontFamily,
21
21
  fontSize: s.fontSize,
22
+ lineHeight: s.lineHeight,
22
23
  height: s.height,
23
24
  color: colors.foreground,
24
25
  outlineWidth: 0,
@@ -6,6 +6,7 @@ export function useLinkVariantDefault(): TextStyle {
6
6
  ({ colors, fontFamily, letterSpacing, fontSize }): TextStyle => ({
7
7
  color: colors.primary,
8
8
  fontSize,
9
+ lineHeight: Math.round(fontSize * 1.25),
9
10
  fontFamily,
10
11
  textDecorationLine: "underline",
11
12
  letterSpacing,
@@ -32,6 +32,7 @@ export const useMenuVariantDefault = (): MenuStyles => {
32
32
  itemText: {
33
33
  fontFamily: fontFamily,
34
34
  fontSize: fontSize,
35
+ lineHeight: Math.round(fontSize * 1.25),
35
36
  color: colors.foreground,
36
37
  },
37
38
  itemIcon: {
@@ -43,6 +44,7 @@ export const useMenuVariantDefault = (): MenuStyles => {
43
44
  paddingHorizontal: 16,
44
45
  fontFamily: fontFamily,
45
46
  fontSize: fontSize * 0.75,
47
+ lineHeight: Math.round(fontSize * 0.75 * 1.25),
46
48
  fontWeight: "600",
47
49
  color: colors.mutedForeground,
48
50
  },
@@ -89,6 +91,7 @@ export const useMenuVariantDefault = (): MenuStyles => {
89
91
  },
90
92
  shortcut: {
91
93
  fontSize: fontSize * 0.75,
94
+ lineHeight: Math.round(fontSize * 0.75 * 1.25),
92
95
  fontFamily: fontFamily,
93
96
  color: colors.mutedForeground,
94
97
  },
@@ -41,6 +41,7 @@ export function usePhoneInputVariantDefault(size: Size): PhoneInputStyles {
41
41
  default: {
42
42
  fontFamily,
43
43
  fontSize: s.fontSize,
44
+ lineHeight: s.lineHeight,
44
45
  color: colors.foreground,
45
46
  },
46
47
  disabled: {
@@ -61,6 +62,7 @@ export function usePhoneInputVariantDefault(size: Size): PhoneInputStyles {
61
62
  paddingHorizontal: s.paddingHorizontal,
62
63
  fontFamily,
63
64
  fontSize: s.fontSize,
65
+ lineHeight: s.lineHeight,
64
66
  color: colors.foreground,
65
67
  height: "100%",
66
68
  outlineWidth: 0,
@@ -105,6 +107,7 @@ export function usePhoneInputVariantDefault(size: Size): PhoneInputStyles {
105
107
  default: {
106
108
  fontFamily,
107
109
  fontSize: s.fontSize,
110
+ lineHeight: s.lineHeight,
108
111
  color: colors.foreground,
109
112
  },
110
113
  },
@@ -117,6 +120,7 @@ export function usePhoneInputVariantDefault(size: Size): PhoneInputStyles {
117
120
  paddingHorizontal: s.paddingHorizontal * 0.75,
118
121
  fontFamily,
119
122
  fontSize: s.fontSize * 0.875,
123
+ lineHeight: Math.round(s.fontSize * 0.875 * 1.25),
120
124
  color: colors.foreground,
121
125
  marginBottom: 4,
122
126
  outlineWidth: 0,
@@ -6,6 +6,20 @@ export function PortalHost() {
6
6
  return <></>;
7
7
  }
8
8
 
9
+ /**
10
+ * Prevent scroll-lock libraries (e.g. react-remove-scroll used by Radix/Vaul
11
+ * modals) from blocking scroll events inside the portal. These libraries
12
+ * register document-level wheel/touchmove listeners that call
13
+ * preventDefault() on events originating outside their managed "shards".
14
+ * Stopping propagation at the portal container keeps those handlers from
15
+ * firing while still allowing native scroll within the portal content.
16
+ */
17
+ function preventScrollLock(container: HTMLElement) {
18
+ const stop = (e: Event) => e.stopPropagation();
19
+ container.addEventListener("wheel", stop);
20
+ container.addEventListener("touchmove", stop);
21
+ }
22
+
9
23
  export function Portal({ name, hostName = DEFAULT_PORTAL_HOST, children }: PortalProps) {
10
24
  const [container] = useState(() => {
11
25
  let container = document.getElementById(hostName);
@@ -15,6 +29,7 @@ export function Portal({ name, hostName = DEFAULT_PORTAL_HOST, children }: Porta
15
29
  container.id = hostName;
16
30
  container.style.pointerEvents = "auto";
17
31
  document.body.appendChild(container);
32
+ preventScrollLock(container);
18
33
  }
19
34
  return container;
20
35
  });
@@ -55,6 +55,7 @@ export const useRadioGroupVariantDefault = (): RadioGroupStyles => {
55
55
  default: {
56
56
  color: colors.foreground,
57
57
  fontSize,
58
+ lineHeight: Math.round(fontSize * 1.25),
58
59
  fontFamily,
59
60
  fontWeight: "500",
60
61
  },
@@ -66,6 +67,7 @@ export const useRadioGroupVariantDefault = (): RadioGroupStyles => {
66
67
  default: {
67
68
  color: colors.mutedForeground,
68
69
  fontSize: fontSize * 0.875,
70
+ lineHeight: Math.round(fontSize * 0.875 * 1.25),
69
71
  fontFamily,
70
72
  marginTop: 2,
71
73
  },
@@ -67,6 +67,7 @@ export const useRadioGroupVariantOutlined = (): RadioGroupStyles => {
67
67
  default: {
68
68
  color: colors.foreground,
69
69
  fontSize,
70
+ lineHeight: Math.round(fontSize * 1.25),
70
71
  fontFamily,
71
72
  fontWeight: "500",
72
73
  },
@@ -78,6 +79,7 @@ export const useRadioGroupVariantOutlined = (): RadioGroupStyles => {
78
79
  default: {
79
80
  color: colors.mutedForeground,
80
81
  fontSize: fontSize * 0.875,
82
+ lineHeight: Math.round(fontSize * 0.875 * 1.25),
81
83
  fontFamily,
82
84
  marginTop: 2,
83
85
  },
@@ -29,6 +29,7 @@ export function useSelectVariantDefault(size: Size): SelectStyles {
29
29
  default: {
30
30
  fontFamily,
31
31
  fontSize: s.fontSize,
32
+ lineHeight: s.lineHeight,
32
33
  color: colors.foreground,
33
34
  },
34
35
  disabled: {
@@ -39,6 +40,7 @@ export function useSelectVariantDefault(size: Size): SelectStyles {
39
40
  default: {
40
41
  fontFamily,
41
42
  fontSize: s.fontSize,
43
+ lineHeight: s.lineHeight,
42
44
  color: colors.mutedForeground,
43
45
  },
44
46
  disabled: {
@@ -69,6 +71,7 @@ export function useSelectVariantDefault(size: Size): SelectStyles {
69
71
  paddingHorizontal: s.paddingHorizontal,
70
72
  fontFamily,
71
73
  fontSize: s.fontSize,
74
+ lineHeight: s.lineHeight,
72
75
  color: colors.foreground,
73
76
  borderRadius: radius / 2,
74
77
  },
@@ -33,6 +33,7 @@ export function useSidebarVariantDefault(): SidebarStyles {
33
33
  groupLabel: {
34
34
  fontFamily,
35
35
  fontSize: fontSize * 0.75,
36
+ lineHeight: Math.round(fontSize * 0.75 * 1.25),
36
37
  fontWeight: "500",
37
38
  color: colors.mutedForeground,
38
39
  paddingHorizontal: spacing,
@@ -39,6 +39,7 @@ export const useTabsVariantDefault = (): TabsStyles => {
39
39
  default: {
40
40
  color: colors.mutedForeground,
41
41
  fontSize,
42
+ lineHeight: Math.round(fontSize * 1.25),
42
43
  fontFamily,
43
44
  fontWeight: "500",
44
45
  },
@@ -33,6 +33,7 @@ export const useTabsVariantLine = (): TabsStyles => {
33
33
  default: {
34
34
  color: colors.mutedForeground,
35
35
  fontSize,
36
+ lineHeight: Math.round(fontSize * 1.25),
36
37
  fontFamily,
37
38
  fontWeight: "500",
38
39
  },
@@ -24,6 +24,7 @@ export function useTextareaVariantDefault(): TextareaStyles {
24
24
  }),
25
25
  fontFamily,
26
26
  fontSize,
27
+ lineHeight: Math.round(fontSize * 1.25),
27
28
  minHeight: 120,
28
29
  textAlignVertical: "top",
29
30
  color: colors.foreground,
@@ -29,12 +29,14 @@ export const useToastVariantDanger = (): ToastStyles => {
29
29
  title: {
30
30
  color: colors.foreground,
31
31
  fontSize: fontSize,
32
+ lineHeight: Math.round(fontSize * 1.25),
32
33
  fontWeight: "600",
33
34
  fontFamily,
34
35
  },
35
36
  description: {
36
37
  color: colors.foreground,
37
38
  fontSize: fontSize * 0.875,
39
+ lineHeight: Math.round(fontSize * 0.875 * 1.25),
38
40
  fontFamily,
39
41
  opacity: 0.9,
40
42
  },
@@ -29,12 +29,14 @@ export const useToastVariantDefault = (): ToastStyles => {
29
29
  title: {
30
30
  color: colors.foreground,
31
31
  fontSize: fontSize,
32
+ lineHeight: Math.round(fontSize * 1.25),
32
33
  fontWeight: "600",
33
34
  fontFamily,
34
35
  },
35
36
  description: {
36
37
  color: colors.mutedForeground,
37
38
  fontSize: fontSize * 0.875,
39
+ lineHeight: Math.round(fontSize * 0.875 * 1.25),
38
40
  fontFamily,
39
41
  },
40
42
  }),
@@ -29,12 +29,14 @@ export const useToastVariantSuccess = (): ToastStyles => {
29
29
  title: {
30
30
  color: colors.foreground,
31
31
  fontSize: fontSize,
32
+ lineHeight: Math.round(fontSize * 1.25),
32
33
  fontWeight: "600",
33
34
  fontFamily,
34
35
  },
35
36
  description: {
36
37
  color: colors.foreground,
37
38
  fontSize: fontSize * 0.875,
39
+ lineHeight: Math.round(fontSize * 0.875 * 1.25),
38
40
  fontFamily,
39
41
  opacity: 0.9,
40
42
  },
@@ -1,15 +1,18 @@
1
1
  import React from "react";
2
2
  import { Text as RnText, StyleSheet, type TextProps as RnTextProps } from "react-native";
3
+ import type { Size } from "../../utils/size-scale";
3
4
  import { TypographyVariants } from "./variants";
4
5
 
5
6
  export interface TypographyProps extends RnTextProps {
6
7
  variant?: keyof typeof TypographyVariants;
8
+ size?: Size;
7
9
  }
8
10
 
9
11
  export function Typography(props: TypographyProps) {
10
- const variantStyles = TypographyVariants[props.variant ?? "body-md"]();
12
+ const { variant = "body", size = "md", ...rest } = props;
13
+ const variantStyles = TypographyVariants[variant](size);
11
14
 
12
15
  const combinedStyles = StyleSheet.flatten([variantStyles, props.style]);
13
16
 
14
- return <RnText {...props} style={combinedStyles} />;
17
+ return <RnText {...rest} style={combinedStyles} />;
15
18
  }
@@ -0,0 +1,26 @@
1
+ import { type TextStyle } from "react-native";
2
+ import type { Size } from "../../../utils/size-scale";
3
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
4
+
5
+ const bodyScale: Record<Size, number> = {
6
+ sm: 0.875,
7
+ md: 1,
8
+ lg: 1.25,
9
+ };
10
+
11
+ export function useTextVariantBody(size: Size): TextStyle {
12
+ return useThemedStyles(
13
+ ({ colors, fontFamily, letterSpacing, fontSize }): TextStyle => {
14
+ const scale = bodyScale[size];
15
+ const scaledFontSize = fontSize * scale;
16
+ const lineHeight = Math.round(scaledFontSize * 1.25);
17
+ return {
18
+ color: colors.foreground,
19
+ fontSize: scaledFontSize,
20
+ lineHeight,
21
+ fontFamily,
22
+ letterSpacing,
23
+ };
24
+ },
25
+ );
26
+ }
@@ -0,0 +1,27 @@
1
+ import { type TextStyle } from "react-native";
2
+ import type { Size } from "../../../utils/size-scale";
3
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
4
+
5
+ const headingScale: Record<Size, number> = {
6
+ sm: 1,
7
+ md: 1.25,
8
+ lg: 1.5,
9
+ };
10
+
11
+ export function useTextVariantHeading(size: Size): TextStyle {
12
+ return useThemedStyles(
13
+ ({ colors, fontFamily, letterSpacing, fontSize }): TextStyle => {
14
+ const scale = headingScale[size];
15
+ const scaledFontSize = fontSize * scale;
16
+ const lineHeight = Math.round(scaledFontSize * 1.25);
17
+ return {
18
+ color: colors.foreground,
19
+ fontSize: scaledFontSize,
20
+ lineHeight,
21
+ fontFamily,
22
+ letterSpacing,
23
+ fontWeight: "600",
24
+ };
25
+ },
26
+ );
27
+ }
@@ -1,15 +1,7 @@
1
- import { useTextVariantBodyLg } from "./body-lg";
2
- import { useTextVariantBodyMd } from "./body-md";
3
- import { useTextVariantBodySm } from "./body-sm";
4
- import { useTextVariantHeadingLg } from "./heading-lg";
5
- import { useTextVariantHeadingMd } from "./heading-md";
6
- import { useTextVariantHeadingSm } from "./heading-sm";
1
+ import { useTextVariantBody } from "./body";
2
+ import { useTextVariantHeading } from "./heading";
7
3
 
8
4
  export const TypographyVariants = {
9
- ["body-sm"]: useTextVariantBodySm,
10
- ["body-md"]: useTextVariantBodyMd,
11
- ["body-lg"]: useTextVariantBodyLg,
12
- ["heading-sm"]: useTextVariantHeadingSm,
13
- ["heading-md"]: useTextVariantHeadingMd,
14
- ["heading-lg"]: useTextVariantHeadingLg,
5
+ body: useTextVariantBody,
6
+ heading: useTextVariantHeading,
15
7
  };
@@ -9,7 +9,9 @@ interface SizeScaleValues {
9
9
  gap: number;
10
10
  /** fontSize * 0.875 | 1 | 1.125 */
11
11
  fontSize: number;
12
- /** fontSize * 0.875 | 1 | 1.125 (alias for icon sizing) */
12
+ /** fontSize * 1.25 (line height for text) */
13
+ lineHeight: number;
14
+ /** Equal to lineHeight (icons match text line height) */
13
15
  iconSize: number;
14
16
  /** 1.75 | 2 | 2.25 */
15
17
  strokeWidth: number;
@@ -33,12 +35,14 @@ export function getSizeScale(
33
35
  ): SizeScaleValues {
34
36
  const s = scales[size] ?? scales.md;
35
37
  const scaledFontSize = fontSize * s.fontScale;
38
+ const lineHeight = Math.round(scaledFontSize * 1.25);
36
39
  return {
37
40
  paddingVertical: spacing * s.pv,
38
41
  paddingHorizontal: spacing * s.ph,
39
42
  gap: spacing * s.gap,
40
43
  fontSize: scaledFontSize,
41
- iconSize: scaledFontSize,
44
+ lineHeight,
45
+ iconSize: lineHeight,
42
46
  strokeWidth: s.sw,
43
47
  height: spacing * s.h,
44
48
  };
package/README.md DELETED
@@ -1,4 +0,0 @@
1
- # TODO
2
-
3
- - [ ] Line height
4
- - [ ] Letter spacing
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- import { useThemedStyles } from "../../../utils/use-themed-styles.js";
4
- export function useTextVariantBodyLg() {
5
- return useThemedStyles(({
6
- colors,
7
- fontFamily,
8
- letterSpacing,
9
- fontSize
10
- }) => ({
11
- color: colors.foreground,
12
- fontSize: fontSize * 1.25,
13
- fontFamily,
14
- letterSpacing,
15
- lineHeight: fontSize * 1.5
16
- }));
17
- }
18
- //# sourceMappingURL=body-lg.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useThemedStyles","useTextVariantBodyLg","colors","fontFamily","letterSpacing","fontSize","color","foreground","lineHeight"],"sourceRoot":"../../../../../src","sources":["components/typography/variants/body-lg.tsx"],"mappings":";;AACA,SAASA,eAAe,QAAQ,qCAAkC;AAElE,OAAO,SAASC,oBAAoBA,CAAA,EAAc;EAChD,OAAOD,eAAe,CACpB,CAAC;IAAEE,MAAM;IAAEC,UAAU;IAAEC,aAAa;IAAEC;EAAS,CAAC,MAAiB;IAC/DC,KAAK,EAAEJ,MAAM,CAACK,UAAU;IACxBF,QAAQ,EAAEA,QAAQ,GAAG,IAAI;IACzBF,UAAU;IACVC,aAAa;IACbI,UAAU,EAAEH,QAAQ,GAAG;EACzB,CAAC,CACH,CAAC;AACH","ignoreList":[]}
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- import { useThemedStyles } from "../../../utils/use-themed-styles.js";
4
- export function useTextVariantBodyMd() {
5
- return useThemedStyles(({
6
- colors,
7
- fontFamily,
8
- letterSpacing,
9
- fontSize
10
- }) => ({
11
- color: colors.foreground,
12
- fontSize,
13
- fontFamily,
14
- letterSpacing,
15
- lineHeight: fontSize * 1.5
16
- }));
17
- }
18
- //# sourceMappingURL=body-md.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useThemedStyles","useTextVariantBodyMd","colors","fontFamily","letterSpacing","fontSize","color","foreground","lineHeight"],"sourceRoot":"../../../../../src","sources":["components/typography/variants/body-md.tsx"],"mappings":";;AACA,SAASA,eAAe,QAAQ,qCAAkC;AAElE,OAAO,SAASC,oBAAoBA,CAAA,EAAc;EAChD,OAAOD,eAAe,CACpB,CAAC;IAAEE,MAAM;IAAEC,UAAU;IAAEC,aAAa;IAAEC;EAAS,CAAC,MAAiB;IAC/DC,KAAK,EAAEJ,MAAM,CAACK,UAAU;IACxBF,QAAQ;IACRF,UAAU;IACVC,aAAa;IACbI,UAAU,EAAEH,QAAQ,GAAG;EACzB,CAAC,CACH,CAAC;AACH","ignoreList":[]}
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- import { useThemedStyles } from "../../../utils/use-themed-styles.js";
4
- export function useTextVariantBodySm() {
5
- return useThemedStyles(({
6
- colors,
7
- fontFamily,
8
- letterSpacing,
9
- fontSize
10
- }) => ({
11
- color: colors.foreground,
12
- fontSize: fontSize * 0.875,
13
- fontFamily,
14
- letterSpacing,
15
- lineHeight: fontSize * 1.5
16
- }));
17
- }
18
- //# sourceMappingURL=body-sm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useThemedStyles","useTextVariantBodySm","colors","fontFamily","letterSpacing","fontSize","color","foreground","lineHeight"],"sourceRoot":"../../../../../src","sources":["components/typography/variants/body-sm.tsx"],"mappings":";;AACA,SAASA,eAAe,QAAQ,qCAAkC;AAElE,OAAO,SAASC,oBAAoBA,CAAA,EAAc;EAChD,OAAOD,eAAe,CACpB,CAAC;IAAEE,MAAM;IAAEC,UAAU;IAAEC,aAAa;IAAEC;EAAS,CAAC,MAAiB;IAC/DC,KAAK,EAAEJ,MAAM,CAACK,UAAU;IACxBF,QAAQ,EAAEA,QAAQ,GAAG,KAAK;IAC1BF,UAAU;IACVC,aAAa;IACbI,UAAU,EAAEH,QAAQ,GAAG;EACzB,CAAC,CACH,CAAC;AACH","ignoreList":[]}
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- import { useThemedStyles } from "../../../utils/use-themed-styles.js";
4
- export function useTextVariantHeadingLg() {
5
- return useThemedStyles(({
6
- colors,
7
- fontFamily,
8
- letterSpacing,
9
- fontSize
10
- }) => ({
11
- color: colors.foreground,
12
- fontSize: fontSize * 1.5,
13
- fontFamily,
14
- letterSpacing,
15
- fontWeight: "600",
16
- lineHeight: fontSize * 1.75
17
- }));
18
- }
19
- //# sourceMappingURL=heading-lg.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useThemedStyles","useTextVariantHeadingLg","colors","fontFamily","letterSpacing","fontSize","color","foreground","fontWeight","lineHeight"],"sourceRoot":"../../../../../src","sources":["components/typography/variants/heading-lg.tsx"],"mappings":";;AACA,SAASA,eAAe,QAAQ,qCAAkC;AAElE,OAAO,SAASC,uBAAuBA,CAAA,EAAc;EACnD,OAAOD,eAAe,CACpB,CAAC;IAAEE,MAAM;IAAEC,UAAU;IAAEC,aAAa;IAAEC;EAAS,CAAC,MAAiB;IAC/DC,KAAK,EAAEJ,MAAM,CAACK,UAAU;IACxBF,QAAQ,EAAEA,QAAQ,GAAG,GAAG;IACxBF,UAAU;IACVC,aAAa;IACbI,UAAU,EAAE,KAAK;IACjBC,UAAU,EAAEJ,QAAQ,GAAG;EACzB,CAAC,CACH,CAAC;AACH","ignoreList":[]}
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- import { useThemedStyles } from "../../../utils/use-themed-styles.js";
4
- export function useTextVariantHeadingMd() {
5
- return useThemedStyles(({
6
- colors,
7
- fontFamily,
8
- letterSpacing,
9
- fontSize
10
- }) => ({
11
- color: colors.foreground,
12
- fontSize: fontSize * 1.25,
13
- fontFamily,
14
- letterSpacing,
15
- fontWeight: "600",
16
- lineHeight: fontSize * 1.5
17
- }));
18
- }
19
- //# sourceMappingURL=heading-md.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useThemedStyles","useTextVariantHeadingMd","colors","fontFamily","letterSpacing","fontSize","color","foreground","fontWeight","lineHeight"],"sourceRoot":"../../../../../src","sources":["components/typography/variants/heading-md.tsx"],"mappings":";;AACA,SAASA,eAAe,QAAQ,qCAAkC;AAElE,OAAO,SAASC,uBAAuBA,CAAA,EAAc;EACnD,OAAOD,eAAe,CACpB,CAAC;IAAEE,MAAM;IAAEC,UAAU;IAAEC,aAAa;IAAEC;EAAS,CAAC,MAAiB;IAC/DC,KAAK,EAAEJ,MAAM,CAACK,UAAU;IACxBF,QAAQ,EAAEA,QAAQ,GAAG,IAAI;IACzBF,UAAU;IACVC,aAAa;IACbI,UAAU,EAAE,KAAK;IACjBC,UAAU,EAAEJ,QAAQ,GAAG;EACzB,CAAC,CACH,CAAC;AACH","ignoreList":[]}
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- import { useThemedStyles } from "../../../utils/use-themed-styles.js";
4
- export function useTextVariantHeadingSm() {
5
- return useThemedStyles(({
6
- colors,
7
- fontFamily,
8
- letterSpacing,
9
- fontSize
10
- }) => ({
11
- color: colors.foreground,
12
- fontSize,
13
- fontFamily,
14
- letterSpacing,
15
- fontWeight: "600",
16
- lineHeight: fontSize * 1.2
17
- }));
18
- }
19
- //# sourceMappingURL=heading-sm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useThemedStyles","useTextVariantHeadingSm","colors","fontFamily","letterSpacing","fontSize","color","foreground","fontWeight","lineHeight"],"sourceRoot":"../../../../../src","sources":["components/typography/variants/heading-sm.tsx"],"mappings":";;AACA,SAASA,eAAe,QAAQ,qCAAkC;AAElE,OAAO,SAASC,uBAAuBA,CAAA,EAAc;EACnD,OAAOD,eAAe,CACpB,CAAC;IAAEE,MAAM;IAAEC,UAAU;IAAEC,aAAa;IAAEC;EAAS,CAAC,MAAiB;IAC/DC,KAAK,EAAEJ,MAAM,CAACK,UAAU;IACxBF,QAAQ;IACRF,UAAU;IACVC,aAAa;IACbI,UAAU,EAAE,KAAK;IACjBC,UAAU,EAAEJ,QAAQ,GAAG;EACzB,CAAC,CACH,CAAC;AACH","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import { type TextStyle } from "react-native";
2
- export declare function useTextVariantBodyLg(): TextStyle;
3
- //# sourceMappingURL=body-lg.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"body-lg.d.ts","sourceRoot":"","sources":["../../../../../../src/components/typography/variants/body-lg.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,wBAAgB,oBAAoB,IAAI,SAAS,CAUhD"}
@@ -1,3 +0,0 @@
1
- import { type TextStyle } from "react-native";
2
- export declare function useTextVariantBodyMd(): TextStyle;
3
- //# sourceMappingURL=body-md.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"body-md.d.ts","sourceRoot":"","sources":["../../../../../../src/components/typography/variants/body-md.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,wBAAgB,oBAAoB,IAAI,SAAS,CAUhD"}
@@ -1,3 +0,0 @@
1
- import { type TextStyle } from "react-native";
2
- export declare function useTextVariantBodySm(): TextStyle;
3
- //# sourceMappingURL=body-sm.d.ts.map