@oxyhq/bloom 0.19.1 → 0.20.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 (170) hide show
  1. package/lib/commonjs/benefit-list/index.js +119 -0
  2. package/lib/commonjs/benefit-list/index.js.map +1 -0
  3. package/lib/commonjs/benefit-list/types.js +6 -0
  4. package/lib/commonjs/benefit-list/types.js.map +1 -0
  5. package/lib/commonjs/connection-dots/ConnectionDots.js +112 -0
  6. package/lib/commonjs/connection-dots/ConnectionDots.js.map +1 -0
  7. package/lib/commonjs/connection-dots/ConnectionDots.web.js +116 -0
  8. package/lib/commonjs/connection-dots/ConnectionDots.web.js.map +1 -0
  9. package/lib/commonjs/connection-dots/ConnectionDotsBase.js +55 -0
  10. package/lib/commonjs/connection-dots/ConnectionDotsBase.js.map +1 -0
  11. package/lib/commonjs/connection-dots/index.js +13 -0
  12. package/lib/commonjs/connection-dots/index.js.map +1 -0
  13. package/lib/commonjs/connection-dots/index.web.js +13 -0
  14. package/lib/commonjs/connection-dots/index.web.js.map +1 -0
  15. package/lib/commonjs/connection-dots/types.js +6 -0
  16. package/lib/commonjs/connection-dots/types.js.map +1 -0
  17. package/lib/commonjs/design-tokens/color-roles.js +112 -0
  18. package/lib/commonjs/design-tokens/color-roles.js.map +1 -0
  19. package/lib/commonjs/design-tokens/index.js +89 -0
  20. package/lib/commonjs/design-tokens/index.js.map +1 -0
  21. package/lib/commonjs/design-tokens/scales.js +168 -0
  22. package/lib/commonjs/design-tokens/scales.js.map +1 -0
  23. package/lib/commonjs/design-tokens/shadows.js +48 -0
  24. package/lib/commonjs/design-tokens/shadows.js.map +1 -0
  25. package/lib/commonjs/design-tokens/shadows.native.js +53 -0
  26. package/lib/commonjs/design-tokens/shadows.native.js.map +1 -0
  27. package/lib/commonjs/design-tokens/tailwind-preset.js +139 -0
  28. package/lib/commonjs/design-tokens/tailwind-preset.js.map +1 -0
  29. package/lib/commonjs/design-tokens/theme-css.js +98 -0
  30. package/lib/commonjs/design-tokens/theme-css.js.map +1 -0
  31. package/lib/commonjs/index.js +208 -93
  32. package/lib/commonjs/index.js.map +1 -1
  33. package/lib/commonjs/index.web.js +223 -108
  34. package/lib/commonjs/index.web.js.map +1 -1
  35. package/lib/commonjs/text-field/index.js +156 -0
  36. package/lib/commonjs/text-field/index.js.map +1 -1
  37. package/lib/module/benefit-list/index.js +114 -0
  38. package/lib/module/benefit-list/index.js.map +1 -0
  39. package/lib/module/benefit-list/types.js +4 -0
  40. package/lib/module/benefit-list/types.js.map +1 -0
  41. package/lib/module/connection-dots/ConnectionDots.js +107 -0
  42. package/lib/module/connection-dots/ConnectionDots.js.map +1 -0
  43. package/lib/module/connection-dots/ConnectionDots.web.js +111 -0
  44. package/lib/module/connection-dots/ConnectionDots.web.js.map +1 -0
  45. package/lib/module/connection-dots/ConnectionDotsBase.js +50 -0
  46. package/lib/module/connection-dots/ConnectionDotsBase.js.map +1 -0
  47. package/lib/module/connection-dots/index.js +4 -0
  48. package/lib/module/connection-dots/index.js.map +1 -0
  49. package/lib/module/connection-dots/index.web.js +4 -0
  50. package/lib/module/connection-dots/index.web.js.map +1 -0
  51. package/lib/module/connection-dots/types.js +4 -0
  52. package/lib/module/connection-dots/types.js.map +1 -0
  53. package/lib/module/design-tokens/color-roles.js +108 -0
  54. package/lib/module/design-tokens/color-roles.js.map +1 -0
  55. package/lib/module/design-tokens/index.js +27 -0
  56. package/lib/module/design-tokens/index.js.map +1 -0
  57. package/lib/module/design-tokens/scales.js +164 -0
  58. package/lib/module/design-tokens/scales.js.map +1 -0
  59. package/lib/module/design-tokens/shadows.js +43 -0
  60. package/lib/module/design-tokens/shadows.js.map +1 -0
  61. package/lib/module/design-tokens/shadows.native.js +48 -0
  62. package/lib/module/design-tokens/shadows.native.js.map +1 -0
  63. package/lib/module/design-tokens/tailwind-preset.js +136 -0
  64. package/lib/module/design-tokens/tailwind-preset.js.map +1 -0
  65. package/lib/module/design-tokens/theme-css.js +94 -0
  66. package/lib/module/design-tokens/theme-css.js.map +1 -0
  67. package/lib/module/index.js +6 -1
  68. package/lib/module/index.js.map +1 -1
  69. package/lib/module/index.web.js +6 -1
  70. package/lib/module/index.web.js.map +1 -1
  71. package/lib/module/text-field/index.js +158 -2
  72. package/lib/module/text-field/index.js.map +1 -1
  73. package/lib/typescript/commonjs/benefit-list/index.d.ts +6 -0
  74. package/lib/typescript/commonjs/benefit-list/index.d.ts.map +1 -0
  75. package/lib/typescript/commonjs/benefit-list/types.d.ts +35 -0
  76. package/lib/typescript/commonjs/benefit-list/types.d.ts.map +1 -0
  77. package/lib/typescript/commonjs/connection-dots/ConnectionDots.d.ts +4 -0
  78. package/lib/typescript/commonjs/connection-dots/ConnectionDots.d.ts.map +1 -0
  79. package/lib/typescript/commonjs/connection-dots/ConnectionDots.web.d.ts +14 -0
  80. package/lib/typescript/commonjs/connection-dots/ConnectionDots.web.d.ts.map +1 -0
  81. package/lib/typescript/commonjs/connection-dots/ConnectionDotsBase.d.ts +18 -0
  82. package/lib/typescript/commonjs/connection-dots/ConnectionDotsBase.d.ts.map +1 -0
  83. package/lib/typescript/commonjs/connection-dots/index.d.ts +3 -0
  84. package/lib/typescript/commonjs/connection-dots/index.d.ts.map +1 -0
  85. package/lib/typescript/commonjs/connection-dots/index.web.d.ts +3 -0
  86. package/lib/typescript/commonjs/connection-dots/index.web.d.ts.map +1 -0
  87. package/lib/typescript/commonjs/connection-dots/types.d.ts +41 -0
  88. package/lib/typescript/commonjs/connection-dots/types.d.ts.map +1 -0
  89. package/lib/typescript/commonjs/design-tokens/color-roles.d.ts +102 -0
  90. package/lib/typescript/commonjs/design-tokens/color-roles.d.ts.map +1 -0
  91. package/lib/typescript/commonjs/design-tokens/index.d.ts +28 -0
  92. package/lib/typescript/commonjs/design-tokens/index.d.ts.map +1 -0
  93. package/lib/typescript/commonjs/design-tokens/scales.d.ts +152 -0
  94. package/lib/typescript/commonjs/design-tokens/scales.d.ts.map +1 -0
  95. package/lib/typescript/commonjs/design-tokens/shadows.d.ts +34 -0
  96. package/lib/typescript/commonjs/design-tokens/shadows.d.ts.map +1 -0
  97. package/lib/typescript/commonjs/design-tokens/shadows.native.d.ts +19 -0
  98. package/lib/typescript/commonjs/design-tokens/shadows.native.d.ts.map +1 -0
  99. package/lib/typescript/commonjs/design-tokens/tailwind-preset.d.ts +59 -0
  100. package/lib/typescript/commonjs/design-tokens/tailwind-preset.d.ts.map +1 -0
  101. package/lib/typescript/commonjs/design-tokens/theme-css.d.ts +39 -0
  102. package/lib/typescript/commonjs/design-tokens/theme-css.d.ts.map +1 -0
  103. package/lib/typescript/commonjs/index.d.ts +6 -0
  104. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  105. package/lib/typescript/commonjs/index.web.d.ts +6 -0
  106. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  107. package/lib/typescript/commonjs/text-field/index.d.ts +14 -1
  108. package/lib/typescript/commonjs/text-field/index.d.ts.map +1 -1
  109. package/lib/typescript/module/benefit-list/index.d.ts +6 -0
  110. package/lib/typescript/module/benefit-list/index.d.ts.map +1 -0
  111. package/lib/typescript/module/benefit-list/types.d.ts +35 -0
  112. package/lib/typescript/module/benefit-list/types.d.ts.map +1 -0
  113. package/lib/typescript/module/connection-dots/ConnectionDots.d.ts +4 -0
  114. package/lib/typescript/module/connection-dots/ConnectionDots.d.ts.map +1 -0
  115. package/lib/typescript/module/connection-dots/ConnectionDots.web.d.ts +14 -0
  116. package/lib/typescript/module/connection-dots/ConnectionDots.web.d.ts.map +1 -0
  117. package/lib/typescript/module/connection-dots/ConnectionDotsBase.d.ts +18 -0
  118. package/lib/typescript/module/connection-dots/ConnectionDotsBase.d.ts.map +1 -0
  119. package/lib/typescript/module/connection-dots/index.d.ts +3 -0
  120. package/lib/typescript/module/connection-dots/index.d.ts.map +1 -0
  121. package/lib/typescript/module/connection-dots/index.web.d.ts +3 -0
  122. package/lib/typescript/module/connection-dots/index.web.d.ts.map +1 -0
  123. package/lib/typescript/module/connection-dots/types.d.ts +41 -0
  124. package/lib/typescript/module/connection-dots/types.d.ts.map +1 -0
  125. package/lib/typescript/module/design-tokens/color-roles.d.ts +102 -0
  126. package/lib/typescript/module/design-tokens/color-roles.d.ts.map +1 -0
  127. package/lib/typescript/module/design-tokens/index.d.ts +28 -0
  128. package/lib/typescript/module/design-tokens/index.d.ts.map +1 -0
  129. package/lib/typescript/module/design-tokens/scales.d.ts +152 -0
  130. package/lib/typescript/module/design-tokens/scales.d.ts.map +1 -0
  131. package/lib/typescript/module/design-tokens/shadows.d.ts +34 -0
  132. package/lib/typescript/module/design-tokens/shadows.d.ts.map +1 -0
  133. package/lib/typescript/module/design-tokens/shadows.native.d.ts +19 -0
  134. package/lib/typescript/module/design-tokens/shadows.native.d.ts.map +1 -0
  135. package/lib/typescript/module/design-tokens/tailwind-preset.d.ts +59 -0
  136. package/lib/typescript/module/design-tokens/tailwind-preset.d.ts.map +1 -0
  137. package/lib/typescript/module/design-tokens/theme-css.d.ts +39 -0
  138. package/lib/typescript/module/design-tokens/theme-css.d.ts.map +1 -0
  139. package/lib/typescript/module/index.d.ts +6 -0
  140. package/lib/typescript/module/index.d.ts.map +1 -1
  141. package/lib/typescript/module/index.web.d.ts +6 -0
  142. package/lib/typescript/module/index.web.d.ts.map +1 -1
  143. package/lib/typescript/module/text-field/index.d.ts +14 -1
  144. package/lib/typescript/module/text-field/index.d.ts.map +1 -1
  145. package/package.json +50 -1
  146. package/src/__tests__/BenefitList.test.tsx +108 -0
  147. package/src/__tests__/ConnectionDots.test.tsx +86 -0
  148. package/src/__tests__/TextFieldFloatingLabel.test.tsx +93 -0
  149. package/src/__tests__/design-tokens.test.ts +169 -0
  150. package/src/benefit-list/BenefitList.stories.tsx +50 -0
  151. package/src/benefit-list/index.tsx +133 -0
  152. package/src/benefit-list/types.ts +36 -0
  153. package/src/connection-dots/ConnectionDots.stories.tsx +54 -0
  154. package/src/connection-dots/ConnectionDots.tsx +139 -0
  155. package/src/connection-dots/ConnectionDots.web.tsx +122 -0
  156. package/src/connection-dots/ConnectionDotsBase.tsx +62 -0
  157. package/src/connection-dots/index.ts +2 -0
  158. package/src/connection-dots/index.web.ts +2 -0
  159. package/src/connection-dots/types.ts +41 -0
  160. package/src/design-tokens/color-roles.ts +110 -0
  161. package/src/design-tokens/index.ts +45 -0
  162. package/src/design-tokens/scales.ts +134 -0
  163. package/src/design-tokens/shadows.native.ts +44 -0
  164. package/src/design-tokens/shadows.ts +42 -0
  165. package/src/design-tokens/tailwind-preset.ts +139 -0
  166. package/src/design-tokens/theme-css.ts +99 -0
  167. package/src/index.ts +33 -0
  168. package/src/index.web.ts +33 -0
  169. package/src/text-field/TextField.stories.tsx +46 -0
  170. package/src/text-field/index.tsx +212 -1
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Semantic color-role vocabulary for the Oxy Unified Design Language.
3
+ *
4
+ * Every role is an ALIAS onto one of Bloom's existing canonical theme tokens
5
+ * (`--background`, `--surface`, `--primary`, …) — the SINGLE source of resolved
6
+ * color values produced by `getResolvedTokens` and written to the document root
7
+ * (web) / `rootVariables` (native) by `BloomThemeProvider`. No color VALUE is
8
+ * invented here: a role's value is the `var(--canonical)` reference, so it stays
9
+ * driven by the active light/dark mode and color preset automatically.
10
+ *
11
+ * The maps are consumed by the Bloom Tailwind preset (`tailwind-preset.ts`),
12
+ * which slots them into `theme.extend.{backgroundColor,textColor,borderColor}`.
13
+ * Because the values are `var(--x)` strings, the SAME class names resolve on
14
+ * Tailwind (web) and NativeWind (native): web reads the CSS custom property from
15
+ * `document.documentElement`; native reads it from react-native-css's
16
+ * `rootVariables` family — both populated by Bloom from one pipeline.
17
+ *
18
+ * Web CSS-var contract (see Bloom AGENTS.md): base `--x` tokens already resolve
19
+ * to a FULL `rgb(...)` color at runtime, so the role values reference them with
20
+ * `var(--x)` directly — NEVER `hsl(var(--x))`.
21
+ *
22
+ * ADDITIVE: these are NEW utility names (`bg-fill`, `text-text-tertiary`,
23
+ * `border-border-image`, …). They do not touch the existing app-defined color
24
+ * utilities (`bg-background`, `text-muted-foreground`, …), which keep working.
25
+ */
26
+
27
+ /** A `var(--canonical-token)` reference string. */
28
+ type TokenRef = `var(--${string})`;
29
+
30
+ const ref = (token: string): TokenRef => `var(--${token})`;
31
+
32
+ /**
33
+ * Surface / fill roles → background-color utilities (`bg-<role>`).
34
+ *
35
+ * | role | utility | canonical token | rationale |
36
+ * | ----------------- | ------------------ | ----------------- | ------------------------------------------- |
37
+ * | bg | bg-bg | --background | the page background |
38
+ * | fill | bg-fill | --card | default raised surface (cards/sheets) |
39
+ * | fill-secondary | bg-fill-secondary | --muted | muted/secondary fill |
40
+ * | fill-hover | bg-fill-hover | --accent | hover state of a secondary fill |
41
+ * | fill-brand | bg-fill-brand | --primary | brand-colored fill |
42
+ * | fill-brand-hover | bg-fill-brand-hover| --ring | hover of brand fill (ring == primary hue) |
43
+ * | fill-inverse | bg-fill-inverse | --foreground | inverse (high-contrast) fill |
44
+ * | fill-inverse-hover| bg-fill-inverse-hov| --muted-foreground| hover of inverse fill |
45
+ * | fill-placeholder | bg-fill-placeholder| --muted | disabled/placeholder surface |
46
+ */
47
+ export const FILL_ROLES = {
48
+ bg: ref('background'),
49
+ fill: ref('card'),
50
+ 'fill-secondary': ref('muted'),
51
+ 'fill-hover': ref('accent'),
52
+ 'fill-brand': ref('primary'),
53
+ 'fill-brand-hover': ref('ring'),
54
+ 'fill-inverse': ref('foreground'),
55
+ 'fill-inverse-hover': ref('muted-foreground'),
56
+ 'fill-placeholder': ref('muted'),
57
+ } as const;
58
+
59
+ /**
60
+ * Text roles → text-color utilities (`text-<role>`).
61
+ *
62
+ * Tailwind prefixes text-color utilities with `text-`, so a role literally
63
+ * named `text` becomes the utility `text-text`, `text-secondary` → the utility
64
+ * `text-text-secondary`, etc. (matches the namespaced spec).
65
+ *
66
+ * | role | utility | canonical token | rationale |
67
+ * | ---------------- | --------------------- | --------------------- | ---------------------------------- |
68
+ * | text | text-text | --foreground | primary text |
69
+ * | text-secondary | text-text-secondary | --muted-foreground | secondary text |
70
+ * | text-tertiary | text-text-tertiary | --muted-foreground | tertiary/least-emphasis text |
71
+ * | text-inverse | text-text-inverse | --primary-foreground | text on a brand fill |
72
+ * | text-fixed-light | text-text-fixed-light | --primary-foreground | always-light text (on brand) |
73
+ * | text-placeholder | text-text-placeholder | --muted-foreground | placeholder/input hint |
74
+ */
75
+ export const TEXT_ROLES = {
76
+ text: ref('foreground'),
77
+ 'text-secondary': ref('muted-foreground'),
78
+ 'text-tertiary': ref('muted-foreground'),
79
+ 'text-inverse': ref('primary-foreground'),
80
+ 'text-fixed-light': ref('primary-foreground'),
81
+ 'text-placeholder': ref('muted-foreground'),
82
+ } as const;
83
+
84
+ /**
85
+ * Border roles → border-color utilities (`border-<role>`).
86
+ *
87
+ * | role | utility | canonical token | rationale |
88
+ * | ------------------ | ----------------------- | --------------- | ------------------------------------------ |
89
+ * | border | border-border | --border | default border |
90
+ * | border-image | border-border-image | --border | hairline border color (0.5px width helper) |
91
+ * | border-secondary | border-border-secondary | --input | secondary/softer border |
92
+ * | border-input | border-border-input | --input | input field border |
93
+ * | border-input-active| border-border-input-active | --ring | focused input border (== primary) |
94
+ *
95
+ * NOTE: the hairline 0.5px WIDTH for `border-image` is shipped as a separate
96
+ * `borderWidth` scale entry (`border-hairline`) in the preset; the color role
97
+ * above only provides the matching color. Consumers compose them:
98
+ * `border-hairline border-border-image`.
99
+ */
100
+ export const BORDER_ROLES = {
101
+ border: ref('border'),
102
+ 'border-image': ref('border'),
103
+ 'border-secondary': ref('input'),
104
+ 'border-input': ref('input'),
105
+ 'border-input-active': ref('ring'),
106
+ } as const;
107
+
108
+ export type FillRole = keyof typeof FILL_ROLES;
109
+ export type TextRole = keyof typeof TEXT_ROLES;
110
+ export type BorderRole = keyof typeof BORDER_ROLES;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * `@oxyhq/bloom/design-tokens` — the centralized, semantic design-token
3
+ * vocabulary for the Oxy Unified Design Language.
4
+ *
5
+ * Exposes:
6
+ * - `bloomTailwindPreset` — the Tailwind/NativeWind preset (web + native) that
7
+ * adds the semantic utility classes (`bg-fill`, `text-text-tertiary`,
8
+ * `p-space-8`, `rounded-radius-20`, `text-body`, `font-body`, `shadow-s`).
9
+ * - `bloomThemeCss` / `bloomThemeBlock` — the Tailwind v4 `@theme` equivalent
10
+ * for CSS-configured web apps.
11
+ * - The raw token maps (`FILL_ROLES`, `TEXT_ROLES`, `BORDER_ROLES`, `SPACING`,
12
+ * `RADIUS`, `TYPOGRAPHY`, `SHADOW_BOX`) for direct programmatic use.
13
+ * - `bloomShadowStyle` — platform-correct shadow style object (web box-shadow /
14
+ * native elevation) so a consumer writes one call for both platforms.
15
+ *
16
+ * Additive and non-breaking: every export here is NEW. It does not change any
17
+ * existing Bloom token, theme value, or utility class.
18
+ */
19
+
20
+ export { bloomTailwindPreset } from './tailwind-preset';
21
+ export type {
22
+ TailwindPreset,
23
+ TailwindPresetThemeExtend,
24
+ } from './tailwind-preset';
25
+
26
+ export { bloomThemeCss, bloomThemeBlock } from './theme-css';
27
+
28
+ export {
29
+ FILL_ROLES,
30
+ TEXT_ROLES,
31
+ BORDER_ROLES,
32
+ } from './color-roles';
33
+ export type { FillRole, TextRole, BorderRole } from './color-roles';
34
+
35
+ export {
36
+ SPACING,
37
+ RADIUS,
38
+ BORDER_WIDTH,
39
+ TYPOGRAPHY,
40
+ FONT_FAMILY_VARS,
41
+ } from './scales';
42
+ export type { TypeRole, TypeRoleName } from './scales';
43
+
44
+ export { SHADOW_BOX, bloomShadowStyle } from './shadows';
45
+ export type { ShadowRole } from './shadows';
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Numeric design-token scales for the Oxy Unified Design Language.
3
+ *
4
+ * These are platform-agnostic plain numbers / CSS strings consumed by the Bloom
5
+ * Tailwind preset (`tailwind-preset.ts`). The SAME keys produce the SAME utility
6
+ * class names on Tailwind (web) and NativeWind (native):
7
+ * - spacing → `p-space-8`, `gap-space-20`, `px-screen-margin`, `m-space-16`
8
+ * - radius → `rounded-radius-20`
9
+ * - type → `font-body` (family/weight) + `text-body` (size/lineHeight)
10
+ * - shadow → `shadow-s`, `shadow-m`
11
+ *
12
+ * ADDITIVE: every key is namespaced (`space-*`, `radius-*`, the typography role
13
+ * names, `shadow-s/m`) and does not collide with Tailwind's built-in numeric
14
+ * scale (`p-4`, `rounded-lg`, `text-sm`) — those keep working unchanged.
15
+ */
16
+
17
+ /* -------------------------------------------------------------------------- */
18
+ /* Spacing */
19
+ /* -------------------------------------------------------------------------- */
20
+
21
+ /**
22
+ * Spacing scale (px). Consumed via every Tailwind spacing utility:
23
+ * `p-space-8`, `px-space-16`, `gap-space-20`, `m-space-24`, `py-space-12`, …
24
+ *
25
+ * `screen-margin` is the standard page gutter (left/right inset). Default 20px —
26
+ * matches Bloom's existing `space.xl` and the `Dialog` default `contentPadding`.
27
+ */
28
+ export const SPACING = {
29
+ 'space-2': 2,
30
+ 'space-4': 4,
31
+ 'space-8': 8,
32
+ 'space-12': 12,
33
+ 'space-16': 16,
34
+ 'space-20': 20,
35
+ 'space-24': 24,
36
+ 'space-32': 32,
37
+ 'screen-margin': 20,
38
+ } as const;
39
+
40
+ /* -------------------------------------------------------------------------- */
41
+ /* Radius */
42
+ /* -------------------------------------------------------------------------- */
43
+
44
+ /**
45
+ * Corner-radius scale (px). Consumed via `rounded-radius-*`:
46
+ * `rounded-radius-8`, `rounded-radius-12`, `rounded-radius-20`,
47
+ * `rounded-radius-28`, `rounded-radius-max` (pill / circle).
48
+ */
49
+ export const RADIUS = {
50
+ 'radius-8': 8,
51
+ 'radius-12': 12,
52
+ 'radius-20': 20,
53
+ 'radius-28': 28,
54
+ 'radius-max': 9999,
55
+ } as const;
56
+
57
+ /* -------------------------------------------------------------------------- */
58
+ /* Border width (hairline) */
59
+ /* -------------------------------------------------------------------------- */
60
+
61
+ /**
62
+ * Border-width helpers. `border-hairline` is the 0.5px hairline that pairs with
63
+ * the `border-border-image` color role. (Tailwind's default `border` = 1px
64
+ * stays untouched.)
65
+ */
66
+ export const BORDER_WIDTH = {
67
+ hairline: 0.5,
68
+ } as const;
69
+
70
+ /* -------------------------------------------------------------------------- */
71
+ /* Typography */
72
+ /* -------------------------------------------------------------------------- */
73
+
74
+ /**
75
+ * One typography role. `size`/`lineHeight` are px; `weight` is a CSS font-weight
76
+ * string; `family` selects the Bloom font CSS var (`sans` = body/UI,
77
+ * `display` = headings/serif).
78
+ *
79
+ * The Tailwind preset splits each role into TWO utilities so a consumer can
80
+ * apply the size/leading and the family/weight independently or together:
81
+ * - `text-<role>` → `fontSize` + `lineHeight` (via theme.fontSize)
82
+ * - `font-<role>` → `fontFamily` + `fontWeight` (via theme.fontFamily, which
83
+ * maps a key to a [family, { fontWeight }] tuple)
84
+ */
85
+ export interface TypeRole {
86
+ /** Font size in px. */
87
+ size: number;
88
+ /** Line height in px. */
89
+ lineHeight: number;
90
+ /** CSS font-weight (string for Tailwind/RN parity). */
91
+ weight: '400' | '500' | '600' | '700';
92
+ /** Which Bloom font family CSS var to use. */
93
+ family: 'sans' | 'display';
94
+ }
95
+
96
+ /**
97
+ * The coherent Oxy type scale. Sizes climb 11 → 28; line-heights use a ~1.3–1.5
98
+ * leading for body roles and tighter leading for large titles.
99
+ *
100
+ * | role | size/line | weight | family | usage |
101
+ * | --------------- | --------- | ------ | ------- | ------------------------------ |
102
+ * | caption | 11 / 14 | 400 | sans | timestamps, meta, fine print |
103
+ * | bodySmall | 13 / 18 | 400 | sans | secondary body, captions |
104
+ * | bodyTitleSmall | 13 / 18 | 600 | sans | small emphasized labels |
105
+ * | body | 15 / 22 | 400 | sans | default body text |
106
+ * | subtitle | 17 / 24 | 500 | sans | list subtitles, lead-ins |
107
+ * | sectionTitle | 20 / 26 | 600 | sans | section headers |
108
+ * | headerBold | 28 / 34 | 700 | display | screen / page titles |
109
+ * | buttonLarge | 17 / 22 | 600 | sans | primary button label |
110
+ */
111
+ export const TYPOGRAPHY = {
112
+ caption: { size: 11, lineHeight: 14, weight: '400', family: 'sans' },
113
+ bodySmall: { size: 13, lineHeight: 18, weight: '400', family: 'sans' },
114
+ bodyTitleSmall: { size: 13, lineHeight: 18, weight: '600', family: 'sans' },
115
+ body: { size: 15, lineHeight: 22, weight: '400', family: 'sans' },
116
+ subtitle: { size: 17, lineHeight: 24, weight: '500', family: 'sans' },
117
+ sectionTitle: { size: 20, lineHeight: 26, weight: '600', family: 'sans' },
118
+ headerBold: { size: 28, lineHeight: 34, weight: '700', family: 'display' },
119
+ buttonLarge: { size: 17, lineHeight: 22, weight: '600', family: 'sans' },
120
+ } as const satisfies Record<string, TypeRole>;
121
+
122
+ export type TypeRoleName = keyof typeof TYPOGRAPHY;
123
+
124
+ /**
125
+ * Bloom font-family CSS-var stacks, keyed by the `family` field above. Web reads
126
+ * `var(--bloom-font-*)` (set by `applyFontFaces`); the preset falls back to the
127
+ * literal stack so utilities still resolve before the vars are injected and on
128
+ * native (where NativeWind passes the family string straight through).
129
+ */
130
+ export const FONT_FAMILY_VARS = {
131
+ sans: 'var(--bloom-font-sans)',
132
+ display: 'var(--bloom-font-display)',
133
+ mono: 'var(--bloom-font-mono)',
134
+ } as const;
@@ -0,0 +1,44 @@
1
+ import { type ViewStyle } from 'react-native';
2
+
3
+ /**
4
+ * NATIVE variant of the shadow tokens (see `shadows.ts` for the rationale and
5
+ * the web `box-shadow` path). Metro selects this file on iOS/Android.
6
+ *
7
+ * The `SHADOW_BOX` map is kept identical to the web file so any code that reads
8
+ * the raw string (e.g. to feed a NativeWind `boxShadow` utility on a host that
9
+ * supports it) stays in lockstep; the canonical native styling path is
10
+ * `bloomShadowStyle`, which returns RN elevation + shadow props tuned to match
11
+ * the web `shadow-s` / `shadow-m` visual weight.
12
+ */
13
+
14
+ export type ShadowRole = 's' | 'm';
15
+
16
+ export const SHADOW_BOX: Record<ShadowRole, string> = {
17
+ s: '0 1px 2px rgb(0 0 0 / 0.06), 0 1px 3px rgb(0 0 0 / 0.10)',
18
+ m: '0 4px 12px rgb(0 0 0 / 0.08), 0 2px 6px rgb(0 0 0 / 0.12)',
19
+ };
20
+
21
+ const NATIVE_SHADOWS: Record<ShadowRole, ViewStyle> = {
22
+ s: {
23
+ shadowColor: '#000000',
24
+ shadowOffset: { width: 0, height: 1 },
25
+ shadowOpacity: 0.12,
26
+ shadowRadius: 3,
27
+ elevation: 2,
28
+ },
29
+ m: {
30
+ shadowColor: '#000000',
31
+ shadowOffset: { width: 0, height: 4 },
32
+ shadowOpacity: 0.16,
33
+ shadowRadius: 12,
34
+ elevation: 6,
35
+ },
36
+ };
37
+
38
+ /**
39
+ * RN shadow/elevation style matching the web `shadow-<role>` weight. Apply to a
40
+ * React Native `View`/surface: `style={bloomShadowStyle('m')}`.
41
+ */
42
+ export function bloomShadowStyle(role: ShadowRole): ViewStyle {
43
+ return NATIVE_SHADOWS[role];
44
+ }
@@ -0,0 +1,42 @@
1
+ import { type ViewStyle } from 'react-native';
2
+
3
+ /**
4
+ * Elevation / shadow tokens for the Oxy Unified Design Language.
5
+ *
6
+ * Two roles: `shadow-s` (subtle raise — cards, chips) and `shadow-m` (overlays —
7
+ * menus, popovers, dialogs). Consumers write ONE class (`shadow-s` / `shadow-m`)
8
+ * and Bloom owns the platform split:
9
+ * - Web: the Bloom Tailwind preset registers `boxShadow.s` / `boxShadow.m`
10
+ * (the `SHADOW_BOX` strings below) → `shadow-s` / `shadow-m` utilities.
11
+ * - Native: NativeWind cannot translate a multi-layer web `box-shadow` to RN
12
+ * elevation reliably, so apps that need the shadow on a React Native surface
13
+ * apply the matching style object from `bloomShadowStyle('s' | 'm')` (this
14
+ * module is platform-forked: `.native.ts` returns RN `shadow*`/`elevation`).
15
+ *
16
+ * This default file is the WEB / consumer-tsc variant. Metro selects the sibling
17
+ * `shadows.native.ts` on iOS/Android. Web bundlers and a consumer's `tsc` see
18
+ * this file (the `box-shadow` CSS string path), matching Bloom's existing
19
+ * `.native`/`.web` split convention.
20
+ */
21
+
22
+ export type ShadowRole = 's' | 'm';
23
+
24
+ /**
25
+ * Web `box-shadow` strings. Subtle, brand-neutral elevation that reads on both
26
+ * light and dark surfaces. Registered by the Tailwind preset as `boxShadow.s/m`.
27
+ */
28
+ export const SHADOW_BOX: Record<ShadowRole, string> = {
29
+ s: '0 1px 2px rgb(0 0 0 / 0.06), 0 1px 3px rgb(0 0 0 / 0.10)',
30
+ m: '0 4px 12px rgb(0 0 0 / 0.08), 0 2px 6px rgb(0 0 0 / 0.12)',
31
+ };
32
+
33
+ /**
34
+ * Return the platform-appropriate shadow style for a role.
35
+ *
36
+ * On WEB this returns a `{ boxShadow }` style object (so it can also be applied
37
+ * inline without Tailwind). The `.native.ts` fork returns RN
38
+ * `shadowColor/shadowOffset/shadowOpacity/shadowRadius/elevation`.
39
+ */
40
+ export function bloomShadowStyle(role: ShadowRole): ViewStyle {
41
+ return { boxShadow: SHADOW_BOX[role] } as ViewStyle;
42
+ }
@@ -0,0 +1,139 @@
1
+ /**
2
+ * The Bloom Tailwind / NativeWind preset — the SINGLE opt-in that gives every
3
+ * Oxy app the same semantic design-token utility classes.
4
+ *
5
+ * Consumers add it to their Tailwind config:
6
+ *
7
+ * // tailwind.config.js (web Tailwind v3/v4 AND native NativeWind)
8
+ * const { bloomTailwindPreset } = require('@oxyhq/bloom/tailwind-preset');
9
+ * module.exports = {
10
+ * presets: [bloomTailwindPreset],
11
+ * content: [ ...existing globs ],
12
+ * theme: { extend: { ...existing app overrides } },
13
+ * };
14
+ *
15
+ * The preset only EXTENDS `theme` (everything lives under `theme.extend`), so it
16
+ * is purely additive: existing Tailwind built-ins (`p-4`, `rounded-lg`,
17
+ * `text-sm`) and the app's own `var(--x)`-backed color utilities keep working.
18
+ *
19
+ * Cross-platform: NativeWind reads the same `tailwind.config.js`, so the SAME
20
+ * class names (`bg-fill`, `text-text-tertiary`, `p-space-8`, `rounded-radius-20`,
21
+ * `text-body`, `font-body`, `shadow-s`) resolve on web (Tailwind → CSS) and
22
+ * native (NativeWind → react-native-css). Color roles are `var(--x)` references
23
+ * that Bloom's `BloomThemeProvider` populates at runtime on both platforms.
24
+ *
25
+ * Type: returned as a `TailwindPreset` (a structural subset of Tailwind's
26
+ * `Config`) so Bloom does not need to depend on `tailwindcss` types.
27
+ */
28
+
29
+ import { BORDER_ROLES, FILL_ROLES, TEXT_ROLES } from './color-roles';
30
+ import {
31
+ BORDER_WIDTH,
32
+ FONT_FAMILY_VARS,
33
+ RADIUS,
34
+ SPACING,
35
+ TYPOGRAPHY,
36
+ type TypeRoleName,
37
+ } from './scales';
38
+ import { SHADOW_BOX } from './shadows';
39
+
40
+ /** A Tailwind `fontSize` value: `[size, { lineHeight }]`. */
41
+ type FontSizeValue = [string, { lineHeight: string }];
42
+ /** A Tailwind `fontFamily` value: `[family, { fontWeight }]`. */
43
+ type FontFamilyValue = [string, { fontWeight: string }];
44
+
45
+ export interface TailwindPresetThemeExtend {
46
+ colors: Record<string, string>;
47
+ backgroundColor: Record<string, string>;
48
+ textColor: Record<string, string>;
49
+ borderColor: Record<string, string>;
50
+ spacing: Record<string, string>;
51
+ borderRadius: Record<string, string>;
52
+ borderWidth: Record<string, string>;
53
+ fontSize: Record<string, FontSizeValue>;
54
+ fontFamily: Record<string, FontFamilyValue>;
55
+ boxShadow: Record<string, string>;
56
+ }
57
+
58
+ export interface TailwindPreset {
59
+ theme: { extend: TailwindPresetThemeExtend };
60
+ }
61
+
62
+ const px = (n: number): string => `${n}px`;
63
+
64
+ /** `{ 'space-8': 8 }` → `{ 'space-8': '8px' }`. */
65
+ function toPxMap(scale: Record<string, number>): Record<string, string> {
66
+ const out: Record<string, string> = {};
67
+ for (const [key, value] of Object.entries(scale)) {
68
+ // 9999 (radius-max) and large values are still valid px; pill shapes clamp.
69
+ out[key] = px(value);
70
+ }
71
+ return out;
72
+ }
73
+
74
+ /** Build the `fontSize` extension: `text-<role>` → `[size, { lineHeight }]`. */
75
+ function buildFontSize(): Record<string, FontSizeValue> {
76
+ const out: Record<string, FontSizeValue> = {};
77
+ for (const name of Object.keys(TYPOGRAPHY) as TypeRoleName[]) {
78
+ const role = TYPOGRAPHY[name];
79
+ out[name] = [px(role.size), { lineHeight: px(role.lineHeight) }];
80
+ }
81
+ return out;
82
+ }
83
+
84
+ /** Build the `fontFamily` extension: `font-<role>` → `[family, { fontWeight }]`. */
85
+ function buildFontFamily(): Record<string, FontFamilyValue> {
86
+ const out: Record<string, FontFamilyValue> = {};
87
+ for (const name of Object.keys(TYPOGRAPHY) as TypeRoleName[]) {
88
+ const role = TYPOGRAPHY[name];
89
+ out[name] = [FONT_FAMILY_VARS[role.family], { fontWeight: role.weight }];
90
+ }
91
+ // Also expose the raw Bloom families directly: `font-bloom-sans`, etc.
92
+ out['bloom-sans'] = [FONT_FAMILY_VARS.sans, { fontWeight: '400' }];
93
+ out['bloom-display'] = [FONT_FAMILY_VARS.display, { fontWeight: '700' }];
94
+ out['bloom-mono'] = [FONT_FAMILY_VARS.mono, { fontWeight: '400' }];
95
+ return out;
96
+ }
97
+
98
+ const SPACING_PX = toPxMap(SPACING);
99
+ const RADIUS_PX = toPxMap({ ...RADIUS });
100
+ const BORDER_WIDTH_PX = toPxMap(BORDER_WIDTH);
101
+
102
+ /**
103
+ * Color roles are exposed via `colors` (so they reach `bg-*`, `text-*`,
104
+ * `border-*`, `ring-*`, `divide-*`, `fill-*` …) AND via the dedicated
105
+ * `backgroundColor` / `textColor` / `borderColor` maps (so the namespaced roles
106
+ * land on exactly the intended utility families even where the role name would
107
+ * otherwise be ambiguous). All values are `var(--canonical)` references.
108
+ */
109
+ const COLOR_ROLES: Record<string, string> = {
110
+ ...FILL_ROLES,
111
+ ...TEXT_ROLES,
112
+ ...BORDER_ROLES,
113
+ };
114
+
115
+ /**
116
+ * The Bloom Tailwind/NativeWind preset. Frozen so accidental mutation by a
117
+ * consumer's config merge cannot corrupt the shared vocabulary.
118
+ */
119
+ export const bloomTailwindPreset: TailwindPreset = Object.freeze({
120
+ theme: {
121
+ extend: {
122
+ // Generic color bucket — feeds every color utility family.
123
+ colors: { ...COLOR_ROLES },
124
+ // Targeted buckets so the namespaced roles resolve on the right utility.
125
+ backgroundColor: { ...FILL_ROLES },
126
+ textColor: { ...TEXT_ROLES },
127
+ borderColor: { ...BORDER_ROLES },
128
+
129
+ spacing: SPACING_PX,
130
+ borderRadius: RADIUS_PX,
131
+ borderWidth: BORDER_WIDTH_PX,
132
+
133
+ fontSize: buildFontSize(),
134
+ fontFamily: buildFontFamily(),
135
+
136
+ boxShadow: { s: SHADOW_BOX.s, m: SHADOW_BOX.m },
137
+ },
138
+ },
139
+ });
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Tailwind v4 `@theme` block generator for the Oxy Unified Design Language.
3
+ *
4
+ * Tailwind v4 web apps (auth, console, website) configure their design tokens in
5
+ * CSS via `@theme { --color-X: var(--X); … }` rather than a JS preset. This
6
+ * module produces the exact `@theme` body that mirrors `bloomTailwindPreset`, so
7
+ * a v4 app gets the SAME semantic utilities (`bg-fill`, `text-text-tertiary`,
8
+ * `p-space-8`, `rounded-radius-20`, `text-body`, `font-body`, `shadow-s`) as the
9
+ * NativeWind/Tailwind-v3 apps that consume the JS preset.
10
+ *
11
+ * Each color role is emitted as a `--color-<role>: var(--canonical)` alias.
12
+ * Per Bloom's web CSS-var contract, the canonical `--x` token already resolves
13
+ * to a full `rgb(...)` color at runtime, so the alias is a direct `var(--x)`
14
+ * reference — NEVER `hsl(var(--x))`.
15
+ *
16
+ * Usage (web Tailwind v4, in the app's global stylesheet):
17
+ *
18
+ * import { bloomThemeCss } from '@oxyhq/bloom/design-tokens';
19
+ * // build-time: write `@theme { ${bloomThemeCss()} }` into global.css, OR
20
+ * // paste the generated block once (see docs/design-tokens.md).
21
+ *
22
+ * A consumer that prefers a static stylesheet can copy the output of
23
+ * `bloomThemeCss()` directly into their `@theme { … }` — the values are stable.
24
+ */
25
+
26
+ import { BORDER_ROLES, FILL_ROLES, TEXT_ROLES } from './color-roles';
27
+ import {
28
+ BORDER_WIDTH,
29
+ FONT_FAMILY_VARS,
30
+ RADIUS,
31
+ SPACING,
32
+ TYPOGRAPHY,
33
+ type TypeRoleName,
34
+ } from './scales';
35
+ import { SHADOW_BOX } from './shadows';
36
+
37
+ /**
38
+ * Produce the BODY of a Tailwind v4 `@theme` block (no surrounding braces) that
39
+ * registers the full Bloom semantic vocabulary.
40
+ *
41
+ * - Colors → `--color-<role>: var(--canonical);`
42
+ * - Spacing → `--spacing-<key>: <px>;`
43
+ * - Radius → `--radius-<key>: <px>;`
44
+ * - Type → `--text-<role>: <size>; --text-<role>--line-height: <lh>;`
45
+ * `--font-<role>: var(--bloom-font-*);` (+ weight via utility doc)
46
+ * - Shadow → `--shadow-<s|m>: <box-shadow>;`
47
+ */
48
+ export function bloomThemeCss(): string {
49
+ const lines: string[] = [];
50
+
51
+ // Color roles.
52
+ for (const [role, value] of Object.entries({
53
+ ...FILL_ROLES,
54
+ ...TEXT_ROLES,
55
+ ...BORDER_ROLES,
56
+ })) {
57
+ lines.push(` --color-${role}: ${value};`);
58
+ }
59
+
60
+ // Spacing.
61
+ for (const [key, value] of Object.entries(SPACING)) {
62
+ lines.push(` --spacing-${key}: ${value}px;`);
63
+ }
64
+
65
+ // Radius.
66
+ for (const [key, value] of Object.entries(RADIUS)) {
67
+ lines.push(` --radius-${key}: ${value}px;`);
68
+ }
69
+
70
+ // Hairline border width.
71
+ for (const [key, value] of Object.entries(BORDER_WIDTH)) {
72
+ lines.push(` --border-width-${key}: ${value}px;`);
73
+ }
74
+
75
+ // Typography: size + line-height + family per role.
76
+ for (const name of Object.keys(TYPOGRAPHY) as TypeRoleName[]) {
77
+ const role = TYPOGRAPHY[name];
78
+ lines.push(` --text-${name}: ${role.size}px;`);
79
+ lines.push(` --text-${name}--line-height: ${role.lineHeight}px;`);
80
+ lines.push(` --text-${name}--font-weight: ${role.weight};`);
81
+ lines.push(` --font-${name}: ${FONT_FAMILY_VARS[role.family]};`);
82
+ }
83
+
84
+ // Bloom raw families.
85
+ lines.push(` --font-bloom-sans: ${FONT_FAMILY_VARS.sans};`);
86
+ lines.push(` --font-bloom-display: ${FONT_FAMILY_VARS.display};`);
87
+ lines.push(` --font-bloom-mono: ${FONT_FAMILY_VARS.mono};`);
88
+
89
+ // Shadows.
90
+ lines.push(` --shadow-s: ${SHADOW_BOX.s};`);
91
+ lines.push(` --shadow-m: ${SHADOW_BOX.m};`);
92
+
93
+ return lines.join('\n');
94
+ }
95
+
96
+ /** The full `@theme { … }` block, ready to inject into a v4 stylesheet. */
97
+ export function bloomThemeBlock(): string {
98
+ return `@theme {\n${bloomThemeCss()}\n}`;
99
+ }
package/src/index.ts CHANGED
@@ -7,6 +7,35 @@ export type { ViewStyleProp, TextStyleProp } from './styles';
7
7
  export * as tokens from './styles/tokens';
8
8
  export { web, native, ios, android, platform, select } from './styles/platform';
9
9
 
10
+ // Design tokens (Oxy Unified Design Language) — semantic Tailwind/NativeWind
11
+ // vocabulary. The Tailwind preset is consumed from `@oxyhq/bloom/tailwind-preset`
12
+ // in a config file; these named exports cover programmatic/runtime use.
13
+ export {
14
+ bloomTailwindPreset,
15
+ bloomThemeCss,
16
+ bloomThemeBlock,
17
+ FILL_ROLES,
18
+ TEXT_ROLES,
19
+ BORDER_ROLES,
20
+ SPACING,
21
+ RADIUS,
22
+ BORDER_WIDTH,
23
+ TYPOGRAPHY,
24
+ FONT_FAMILY_VARS,
25
+ SHADOW_BOX,
26
+ bloomShadowStyle,
27
+ } from './design-tokens';
28
+ export type {
29
+ TailwindPreset,
30
+ TailwindPresetThemeExtend,
31
+ FillRole,
32
+ TextRole,
33
+ BorderRole,
34
+ TypeRole,
35
+ TypeRoleName,
36
+ ShadowRole,
37
+ } from './design-tokens';
38
+
10
39
  // Hooks
11
40
  export { useInteractionState } from './hooks/useInteractionState';
12
41
  export { useDelayedLoading } from './hooks/useDelayedLoading';
@@ -69,6 +98,10 @@ export * as Skeleton from './skeleton';
69
98
  export * as Grid from './grid';
70
99
  export { Fill } from './fill';
71
100
  export { IconCircle } from './icon-circle';
101
+ export { ConnectionDots } from './connection-dots';
102
+ export type { ConnectionDotsProps } from './connection-dots';
103
+ export { BenefitRow, BenefitList } from './benefit-list';
104
+ export type { BenefitRowProps, BenefitListProps } from './benefit-list';
72
105
 
73
106
  // Form components
74
107
  export * from './text-field';