@react-xp/design-system 1.0.0-beta.0 → 1.0.0-beta.2

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 (167) hide show
  1. package/dist/cjs/components/button/button.native.js +31 -0
  2. package/dist/cjs/components/button/button.shared.js +59 -0
  3. package/dist/cjs/{styles/buttons.js → components/button/button.styles.js} +24 -13
  4. package/dist/cjs/components/button/button.types.js +2 -0
  5. package/dist/cjs/components/button/button.web.js +46 -0
  6. package/dist/cjs/components/button/index.js +18 -0
  7. package/dist/cjs/components/index.js +17 -0
  8. package/dist/cjs/helpers/styles.js +18 -2
  9. package/dist/cjs/index.js +3 -0
  10. package/dist/cjs/showcase/buttons/buttons.web.js +10 -0
  11. package/dist/cjs/showcase/buttons/index.js +17 -0
  12. package/dist/cjs/showcase/index.js +17 -0
  13. package/dist/cjs/showcase/themeWrapper.native.js +40 -0
  14. package/dist/cjs/showcase/themeWrapper.web.js +42 -0
  15. package/dist/cjs/styles/index.js +0 -1
  16. package/dist/cjs/theme/index.js +19 -0
  17. package/dist/cjs/theme/themeContext.js +5 -0
  18. package/dist/cjs/theme/themeProvider.js +9 -0
  19. package/dist/cjs/theme/themes/corporate/colors.js +45 -0
  20. package/dist/cjs/theme/themes/corporate/index.js +17 -0
  21. package/dist/cjs/theme/useTheme.js +13 -0
  22. package/dist/cjs/theme/useTokens.js +6 -0
  23. package/dist/cjs/types/states.js +1 -4
  24. package/dist/esm/components/button/button.native.js +27 -0
  25. package/dist/esm/components/button/button.shared.js +54 -0
  26. package/dist/esm/{styles/buttons.js → components/button/button.styles.js} +24 -13
  27. package/dist/esm/components/button/button.types.js +1 -0
  28. package/dist/esm/components/button/button.web.js +42 -0
  29. package/dist/esm/components/button/index.js +2 -0
  30. package/dist/esm/components/index.js +1 -0
  31. package/dist/esm/helpers/styles.js +16 -2
  32. package/dist/esm/index.js +3 -0
  33. package/dist/esm/showcase/buttons/buttons.web.js +6 -0
  34. package/dist/esm/showcase/buttons/index.js +1 -0
  35. package/dist/esm/showcase/index.js +1 -0
  36. package/dist/esm/showcase/themeWrapper.native.js +36 -0
  37. package/dist/esm/showcase/themeWrapper.web.js +38 -0
  38. package/dist/esm/styles/cards.js +1 -1
  39. package/dist/esm/styles/checkboxes.js +1 -1
  40. package/dist/esm/styles/chips.js +1 -1
  41. package/dist/esm/styles/datePickers.js +1 -1
  42. package/dist/esm/styles/index.js +0 -1
  43. package/dist/esm/styles/inputs.js +1 -1
  44. package/dist/esm/styles/listItems.js +1 -1
  45. package/dist/esm/styles/popovers.js +1 -1
  46. package/dist/esm/styles/radios.js +1 -1
  47. package/dist/esm/styles/selects.js +1 -1
  48. package/dist/esm/styles/steppers.js +1 -1
  49. package/dist/esm/styles/switches.js +1 -1
  50. package/dist/esm/styles/tabs.js +1 -1
  51. package/dist/esm/styles/toasts.js +1 -1
  52. package/dist/esm/styles/tooltips.js +1 -1
  53. package/dist/esm/theme/index.js +3 -0
  54. package/dist/esm/theme/themeContext.js +2 -0
  55. package/dist/esm/theme/themeProvider.js +5 -0
  56. package/dist/esm/theme/themes/corporate/colors.js +42 -0
  57. package/dist/esm/theme/themes/corporate/index.js +1 -0
  58. package/dist/esm/theme/useTheme.js +9 -0
  59. package/dist/esm/theme/useTokens.js +2 -0
  60. package/dist/esm/types/states.js +0 -2
  61. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  62. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  63. package/dist/types/components/button/button.native.d.ts +3 -0
  64. package/dist/types/components/button/button.native.d.ts.map +1 -0
  65. package/dist/types/components/button/button.shared.d.ts +27 -0
  66. package/dist/types/components/button/button.shared.d.ts.map +1 -0
  67. package/dist/types/components/button/button.styles.d.ts +20 -0
  68. package/dist/types/components/button/button.styles.d.ts.map +1 -0
  69. package/dist/types/components/button/button.types.d.ts +19 -0
  70. package/dist/types/components/button/button.types.d.ts.map +1 -0
  71. package/dist/types/components/button/button.web.d.ts +3 -0
  72. package/dist/types/components/button/button.web.d.ts.map +1 -0
  73. package/dist/types/components/button/index.d.ts +3 -0
  74. package/dist/types/components/button/index.d.ts.map +1 -0
  75. package/dist/types/components/index.d.ts +2 -0
  76. package/dist/types/components/index.d.ts.map +1 -0
  77. package/dist/types/helpers/a11y.d.ts +5 -5
  78. package/dist/types/helpers/a11y.d.ts.map +1 -1
  79. package/dist/types/helpers/styles.d.ts +12 -9
  80. package/dist/types/helpers/styles.d.ts.map +1 -1
  81. package/dist/types/index.d.ts +3 -0
  82. package/dist/types/index.d.ts.map +1 -1
  83. package/dist/types/showcase/buttons/buttons.web.d.ts +2 -0
  84. package/dist/types/showcase/buttons/buttons.web.d.ts.map +1 -0
  85. package/dist/types/showcase/buttons/index.d.ts +2 -0
  86. package/dist/types/showcase/buttons/index.d.ts.map +1 -0
  87. package/dist/types/showcase/index.d.ts +2 -0
  88. package/dist/types/showcase/index.d.ts.map +1 -0
  89. package/dist/types/showcase/themeWrapper.native.d.ts +5 -0
  90. package/dist/types/showcase/themeWrapper.native.d.ts.map +1 -0
  91. package/dist/types/showcase/themeWrapper.web.d.ts +5 -0
  92. package/dist/types/showcase/themeWrapper.web.d.ts.map +1 -0
  93. package/dist/types/styles/avatars.d.ts +2 -2
  94. package/dist/types/styles/avatars.d.ts.map +1 -1
  95. package/dist/types/styles/badges.d.ts +2 -2
  96. package/dist/types/styles/badges.d.ts.map +1 -1
  97. package/dist/types/styles/bottomSheets.d.ts +2 -2
  98. package/dist/types/styles/bottomSheets.d.ts.map +1 -1
  99. package/dist/types/styles/cards.d.ts +2 -2
  100. package/dist/types/styles/cards.d.ts.map +1 -1
  101. package/dist/types/styles/checkboxes.d.ts +2 -2
  102. package/dist/types/styles/checkboxes.d.ts.map +1 -1
  103. package/dist/types/styles/chips.d.ts +2 -2
  104. package/dist/types/styles/chips.d.ts.map +1 -1
  105. package/dist/types/styles/datePickers.d.ts +3 -3
  106. package/dist/types/styles/datePickers.d.ts.map +1 -1
  107. package/dist/types/styles/dividers.d.ts +2 -2
  108. package/dist/types/styles/dividers.d.ts.map +1 -1
  109. package/dist/types/styles/emptyStates.d.ts +2 -2
  110. package/dist/types/styles/emptyStates.d.ts.map +1 -1
  111. package/dist/types/styles/forms.d.ts +2 -2
  112. package/dist/types/styles/forms.d.ts.map +1 -1
  113. package/dist/types/styles/headers.d.ts +2 -2
  114. package/dist/types/styles/headers.d.ts.map +1 -1
  115. package/dist/types/styles/index.d.ts +0 -1
  116. package/dist/types/styles/index.d.ts.map +1 -1
  117. package/dist/types/styles/inputs.d.ts +2 -2
  118. package/dist/types/styles/inputs.d.ts.map +1 -1
  119. package/dist/types/styles/listItems.d.ts +2 -2
  120. package/dist/types/styles/listItems.d.ts.map +1 -1
  121. package/dist/types/styles/modals.d.ts +2 -2
  122. package/dist/types/styles/modals.d.ts.map +1 -1
  123. package/dist/types/styles/pagination.d.ts +2 -2
  124. package/dist/types/styles/pagination.d.ts.map +1 -1
  125. package/dist/types/styles/popovers.d.ts +2 -2
  126. package/dist/types/styles/popovers.d.ts.map +1 -1
  127. package/dist/types/styles/progress.d.ts +4 -4
  128. package/dist/types/styles/progress.d.ts.map +1 -1
  129. package/dist/types/styles/radios.d.ts +2 -2
  130. package/dist/types/styles/radios.d.ts.map +1 -1
  131. package/dist/types/styles/selects.d.ts +2 -2
  132. package/dist/types/styles/selects.d.ts.map +1 -1
  133. package/dist/types/styles/skeletons.d.ts +3 -3
  134. package/dist/types/styles/skeletons.d.ts.map +1 -1
  135. package/dist/types/styles/steppers.d.ts +3 -3
  136. package/dist/types/styles/steppers.d.ts.map +1 -1
  137. package/dist/types/styles/switches.d.ts +2 -2
  138. package/dist/types/styles/switches.d.ts.map +1 -1
  139. package/dist/types/styles/tables.d.ts +2 -2
  140. package/dist/types/styles/tables.d.ts.map +1 -1
  141. package/dist/types/styles/tabs.d.ts +3 -3
  142. package/dist/types/styles/tabs.d.ts.map +1 -1
  143. package/dist/types/styles/toasts.d.ts +3 -3
  144. package/dist/types/styles/toasts.d.ts.map +1 -1
  145. package/dist/types/styles/tooltips.d.ts +2 -2
  146. package/dist/types/styles/tooltips.d.ts.map +1 -1
  147. package/dist/types/theme/index.d.ts +4 -0
  148. package/dist/types/theme/index.d.ts.map +1 -0
  149. package/dist/types/theme/themeContext.d.ts +6 -0
  150. package/dist/types/theme/themeContext.d.ts.map +1 -0
  151. package/dist/types/theme/themeProvider.d.ts +6 -0
  152. package/dist/types/theme/themeProvider.d.ts.map +1 -0
  153. package/dist/types/theme/themes/corporate/colors.d.ts +8 -0
  154. package/dist/types/theme/themes/corporate/colors.d.ts.map +1 -0
  155. package/dist/types/theme/themes/corporate/index.d.ts +2 -0
  156. package/dist/types/theme/themes/corporate/index.d.ts.map +1 -0
  157. package/dist/types/theme/useTheme.d.ts +2 -0
  158. package/dist/types/theme/useTheme.d.ts.map +1 -0
  159. package/dist/types/theme/useTokens.d.ts +2 -0
  160. package/dist/types/theme/useTokens.d.ts.map +1 -0
  161. package/dist/types/types/states.d.ts +3 -9
  162. package/dist/types/types/states.d.ts.map +1 -1
  163. package/dist/types/types/tokens.d.ts +5 -6
  164. package/dist/types/types/tokens.d.ts.map +1 -1
  165. package/package.json +10 -3
  166. package/dist/types/styles/buttons.d.ts +0 -22
  167. package/dist/types/styles/buttons.d.ts.map +0 -1
@@ -0,0 +1,54 @@
1
+ import { cloneElement } from 'react';
2
+ import { getFocusRingSx, getFocusWrapperSx, normalizeSxForPlatform, pickSxForPlatform, } from '../../helpers';
3
+ import { getButtonParts } from './button.styles';
4
+ export const resolveButtonStyles = ({ platform, tokens, variant, size, props, }) => {
5
+ const parts = getButtonParts(tokens, {
6
+ variant,
7
+ size,
8
+ props,
9
+ });
10
+ // foco: wrapper + ring cross-platform (para ser consistente)
11
+ const radius = parts.container.borderRadius;
12
+ // filtra props web-only/native-only e normaliza px->number no native
13
+ const container = normalizeSxForPlatform(platform, pickSxForPlatform(platform, parts.container));
14
+ const label = normalizeSxForPlatform(platform, pickSxForPlatform(platform, parts.label));
15
+ const icon = normalizeSxForPlatform(platform, pickSxForPlatform(platform, parts.icon));
16
+ return {
17
+ interactionStyle: {
18
+ focusRing: {
19
+ focused: normalizeSxForPlatform(platform, pickSxForPlatform(platform, getFocusRingSx(tokens, platform, {
20
+ borderRadius: radius,
21
+ }))),
22
+ },
23
+ focusWrapper: {
24
+ focused: normalizeSxForPlatform(platform, pickSxForPlatform(platform, getFocusWrapperSx(tokens, platform, {
25
+ borderRadius: radius,
26
+ }))),
27
+ },
28
+ },
29
+ style: {
30
+ container,
31
+ label,
32
+ icon,
33
+ },
34
+ };
35
+ };
36
+ export const applyIconStyle = (node, iconSx) => {
37
+ if (!node)
38
+ return null;
39
+ // Se for ReactElement, tentamos clonar com props/style
40
+ if (typeof node === 'object' && node && 'type' in node) {
41
+ const el = node;
42
+ const prevStyle = el.props?.style;
43
+ return cloneElement(el, {
44
+ ...el.props,
45
+ style: Array.isArray(prevStyle)
46
+ ? [...prevStyle, iconSx]
47
+ : prevStyle
48
+ ? [prevStyle, iconSx]
49
+ : iconSx,
50
+ });
51
+ }
52
+ // Se for string/number/etc, devolve como está
53
+ return node;
54
+ };
@@ -1,5 +1,5 @@
1
1
  // styles/buttons.ts
2
- import { merge, tok, } from '../types/tokens';
2
+ import { merge, tok, } from '../../types/tokens';
3
3
  const variantStyles = (t) => ({
4
4
  primary: {
5
5
  container: {
@@ -74,10 +74,11 @@ const sizeStyles = (t) => ({
74
74
  },
75
75
  },
76
76
  });
77
- export const getButtonParts = (t, opts = {}) => {
77
+ export const getButtonParts = (t, opts = { props: {} }) => {
78
78
  const variant = opts.variant ?? 'primary';
79
79
  const size = opts.size ?? 'md';
80
- const isDisabled = Boolean(opts.disabled || opts.loading);
80
+ const disabled = opts.props.disabled ?? false;
81
+ const fullWidth = opts.props.fullWidth ?? false;
81
82
  const baseContainer = {
82
83
  borderWidth: tok(t, 'border-width-default'),
83
84
  borderRadius: tok(t, 'radius-3'),
@@ -106,20 +107,30 @@ export const getButtonParts = (t, opts = {}) => {
106
107
  label: { color: tok(t, 'color-state-disabled-fg') },
107
108
  };
108
109
  const interaction = {
109
- hovered: { container: { opacity: 0.96 } },
110
- pressed: { container: { opacity: tok(t, 'opacity-pressed') } },
110
+ hovered: { container: { opacity: 0.7 } },
111
+ pressed: {
112
+ container: { opacity: tok(t, 'opacity-pressed') },
113
+ },
111
114
  fullWidth: { container: { alignSelf: 'stretch' } },
112
115
  };
113
116
  const v = variantStyles(t)[variant];
114
117
  const s = sizeStyles(t)[size];
115
118
  return {
116
- container: merge(baseContainer, s.container, v.container, opts.fullWidth && interaction.fullWidth.container, opts.hovered && interaction.hovered.container, opts.pressed && interaction.pressed.container, isDisabled && disabledStyles.container),
117
- label: merge(baseLabel, s.label, v.label, isDisabled && disabledStyles.label),
118
- icon: merge(s.icon, {
119
- color: (isDisabled
120
- ? disabledStyles.label.color
121
- : v.label.color),
122
- }),
123
- focusRing: merge(opts.focusVisible ? focusRing : undefined),
119
+ container: {
120
+ ...merge(baseContainer, s.container, v.container, fullWidth && interaction.fullWidth.container, disabled && disabledStyles.container),
121
+ $hovered: interaction.hovered.container,
122
+ $pressed: interaction.pressed.container,
123
+ },
124
+ focusRing: {
125
+ $focused: focusRing,
126
+ },
127
+ icon: {
128
+ ...merge(s.icon, { color: v.label.color }),
129
+ $disabled: { color: disabledStyles.label.color },
130
+ },
131
+ label: {
132
+ ...merge(baseLabel, s.label, v.label),
133
+ $disabled: disabled && disabledStyles.label,
134
+ },
124
135
  };
125
136
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,42 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { A } from '@react-xp/aeiou';
3
+ import { useTokens } from '../../theme';
4
+ import { applyIconStyle, resolveButtonStyles } from './button.shared';
5
+ export const Button = (props) => {
6
+ const tokens = useTokens();
7
+ const { children, variant = 'primary', size = 'md', disabled, loading, fullWidth, leftIcon, rightIcon, type = 'button', onClick, onPress, accessibilityLabel, testId, } = props;
8
+ const isDisabled = Boolean(disabled || loading);
9
+ const st = resolveButtonStyles({
10
+ platform: 'web',
11
+ tokens,
12
+ variant,
13
+ size,
14
+ props,
15
+ });
16
+ // wrapper + ring (para "gap" + outline consistente)
17
+ const Wrapper = ({ children }) => {
18
+ // if (!st.focusWrapper || !st.focusRing) return <>{children}</>;
19
+ return (
20
+ // <span style={st.focusWrapper as TAny}>
21
+ // <span style={st.focusRing as TAny}>{children}</span>
22
+ // </span>
23
+ _jsx(_Fragment, { children: children }));
24
+ };
25
+ console.log('button web render', {
26
+ isDisabled,
27
+ loading,
28
+ st,
29
+ });
30
+ return (_jsx(Wrapper, { children: _jsxs(A, { disabled: isDisabled, loading: loading, accessibilityLabel: accessibilityLabel, testId: testId, style: st.style.container, onClick: onClick, onPress: onPress, children: [applyIconStyle(leftIcon, st.style.icon), _jsx("span", { style: st.style.label, children: children }), applyIconStyle(rightIcon, st.style.icon), loading ? (_jsx("span", { "aria-hidden": "true", style: {
31
+ marginLeft: 8,
32
+ display: 'inline-flex',
33
+ alignItems: 'center',
34
+ justifyContent: 'center',
35
+ }, children: _jsx("span", { style: {
36
+ width: 14,
37
+ height: 14,
38
+ borderRadius: 9999,
39
+ border: '2px solid currentColor',
40
+ borderTopColor: 'transparent',
41
+ } }) })) : null] }) }));
42
+ };
@@ -0,0 +1,2 @@
1
+ export * from './button.shared';
2
+ export * from './button.types';
@@ -0,0 +1 @@
1
+ export * from './button';
@@ -4,8 +4,7 @@
4
4
  // - filtrar props web-only/native-only
5
5
  // - mapear shadow tokens (CSS box-shadow) para RN shadow props
6
6
  // - focus ring cross-platform (wrapper approach)
7
- // Nota: aqui não dependemos das tuas primitives — isto é “infra” para o teu runtime/binding.
8
- import { tok, } from '../types';
7
+ import { tok } from '../types';
9
8
  /**
10
9
  * Tokens utilitários são string com px (ex.: "1px", "44px")
11
10
  * No RN queres number (dp), no Web queres string (px) — define UMA regra no teu binder.
@@ -156,3 +155,18 @@ export const getFocusWrapperSx = (t, platform, opts) => ({
156
155
  padding: getFocusRingGap(t, platform),
157
156
  borderRadius: opts?.borderRadius,
158
157
  });
158
+ const isPx = (v) => typeof v === 'string' && v.trim().endsWith('px');
159
+ const pxToNumber = (v) => Number.parseFloat(v);
160
+ export const normalizeSxForPlatform = (platform, sx) => {
161
+ if (platform === 'web')
162
+ return sx;
163
+ // native: converter strings "Npx" -> number
164
+ const out = {};
165
+ for (const [k, v] of Object.entries(sx)) {
166
+ if (v === undefined)
167
+ continue;
168
+ out[k] = isPx(v) ? pxToNumber(v) : v;
169
+ }
170
+ return out;
171
+ };
172
+ export const mergeSx = (...styles) => Object.assign({}, ...styles.filter(Boolean));
package/dist/esm/index.js CHANGED
@@ -1,3 +1,6 @@
1
+ export * from './components';
1
2
  export * from './helpers';
3
+ export * from './showcase';
2
4
  export * from './styles';
5
+ export * from './theme';
3
6
  export * from './types';
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Button } from '../../components/button/button.web';
3
+ import { ThemeWrapper } from '../themeWrapper.web';
4
+ export const ButtonsShowcase = () => {
5
+ return (_jsx(ThemeWrapper, { children: _jsx(Button, { children: "Button example" }) }));
6
+ };
@@ -0,0 +1 @@
1
+ export * from './buttons.web';
@@ -0,0 +1 @@
1
+ export * from './buttons';
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { styleguideBreakpoints, styleguideComponentPadding, styleguideLayoutGrid, styleguideMotionDuration, styleguideMotionEasing, styleguideMotionPreset, styleguideRadius, styleguideShadows, styleguideSpaceX, styleguideSpaceY, styleguideSpacing, styleguideTypography, styleguideUtils, styleguideZIndex, } from '@react-xp/styleguide';
3
+ import { useState } from 'react';
4
+ import { Button } from '../components/button/button.native';
5
+ import { ThemeProvider } from '../theme';
6
+ import { themeCorporateColors } from '../theme/themes/corporate';
7
+ export const ThemeWrapper = ({ children }) => {
8
+ const [currentTheme, setCurrentTheme] = useState('corporate');
9
+ const [currentThemeMode, setCurrentThemeMode] = useState('light');
10
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
11
+ const themeTokens = (() => {
12
+ switch (currentTheme) {
13
+ case 'corporate':
14
+ return currentThemeMode === 'light'
15
+ ? themeCorporateColors.light
16
+ : themeCorporateColors.dark;
17
+ }
18
+ })();
19
+ return (_jsxs(ThemeProvider, { tokens: {
20
+ ...styleguideBreakpoints,
21
+ ...styleguideComponentPadding,
22
+ ...styleguideLayoutGrid,
23
+ ...styleguideMotionDuration,
24
+ ...styleguideMotionEasing,
25
+ ...styleguideMotionPreset,
26
+ ...styleguideRadius,
27
+ ...styleguideShadows,
28
+ ...styleguideSpaceX,
29
+ ...styleguideSpaceY,
30
+ ...styleguideSpacing,
31
+ ...styleguideTypography,
32
+ ...styleguideUtils,
33
+ ...styleguideZIndex,
34
+ ...themeTokens,
35
+ }, children: [_jsx(Button, { onClick: () => setCurrentThemeMode(currentThemeMode === 'light' ? 'dark' : 'light'), children: "Toggle Theme Mode" }), children] }));
36
+ };
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { styleguideBreakpoints, styleguideComponentPadding, styleguideLayoutGrid, styleguideMotionDuration, styleguideMotionEasing, styleguideMotionPreset, styleguideRadius, styleguideShadows, styleguideSpaceX, styleguideSpaceY, styleguideSpacing, styleguideTypography, styleguideUtils, styleguideZIndex, } from '@react-xp/styleguide';
3
+ import { useState } from 'react';
4
+ import { Button } from '../components/button/button.web';
5
+ import { ThemeProvider } from '../theme';
6
+ import { themeCorporateColors } from '../theme/themes/corporate';
7
+ export const ThemeWrapper = ({ children }) => {
8
+ const [currentTheme, setCurrentTheme] = useState('corporate');
9
+ const [currentThemeMode, setCurrentThemeMode] = useState('light');
10
+ const themeTokens = (() => {
11
+ switch (currentTheme) {
12
+ case 'corporate':
13
+ return currentThemeMode === 'light'
14
+ ? themeCorporateColors.light
15
+ : themeCorporateColors.dark;
16
+ }
17
+ })();
18
+ console.log('themeTokens', themeTokens);
19
+ console.log('currentThemeMode', currentThemeMode);
20
+ return (_jsx(ThemeProvider, { tokens: {
21
+ ...styleguideBreakpoints,
22
+ ...styleguideComponentPadding,
23
+ ...styleguideLayoutGrid,
24
+ ...styleguideMotionDuration,
25
+ ...styleguideMotionEasing,
26
+ ...styleguideMotionPreset,
27
+ ...styleguideRadius,
28
+ ...styleguideShadows,
29
+ ...styleguideSpaceX,
30
+ ...styleguideSpaceY,
31
+ ...styleguideSpacing,
32
+ ...styleguideTypography,
33
+ ...styleguideUtils,
34
+ ...styleguideZIndex,
35
+ ...themeTokens,
36
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
37
+ }, children: _jsxs("div", { className: "flex m-4", style: { backgroundColor: themeTokens['color-bg-default'] }, children: [_jsx(Button, { onClick: () => setCurrentThemeMode(currentThemeMode === 'light' ? 'dark' : 'light'), children: "Toggle Theme Mode" }), children] }) }));
38
+ };
@@ -1,5 +1,5 @@
1
1
  // styles/cards.ts
2
- import { merge, tok, } from '../types/tokens';
2
+ import { merge, tok } from '../types/tokens';
3
3
  const variantStyles = (t) => ({
4
4
  default: {
5
5
  container: {
@@ -1,5 +1,5 @@
1
1
  // styles/checkboxes.ts
2
- import { merge, tok, } from '../types/tokens';
2
+ import { merge, tok } from '../types/tokens';
3
3
  export const getCheckboxParts = (t, s = {}) => {
4
4
  const isOn = Boolean(s.checked || s.indeterminate);
5
5
  const isDisabled = Boolean(s.disabled);
@@ -1,5 +1,5 @@
1
1
  // styles/chips.ts
2
- import { merge, tok, } from '../types/tokens';
2
+ import { merge, tok } from '../types/tokens';
3
3
  export const getChipParts = (t, opts = {}) => {
4
4
  const variant = opts.variant ?? 'filled';
5
5
  const selected = Boolean(opts.selected);
@@ -1,5 +1,5 @@
1
1
  // styles/datePickers.ts
2
- import { merge, tok, } from '../types/tokens';
2
+ import { merge, tok } from '../types/tokens';
3
3
  export const getDatePickerParts = (t) => {
4
4
  return {
5
5
  container: {
@@ -1,7 +1,6 @@
1
1
  export * from './avatars';
2
2
  export * from './badges';
3
3
  export * from './bottomSheets';
4
- export * from './buttons';
5
4
  export * from './cards';
6
5
  export * from './checkboxes';
7
6
  export * from './chips';
@@ -1,5 +1,5 @@
1
1
  // styles/inputs.ts
2
- import { merge, tok, } from '../types/tokens';
2
+ import { merge, tok } from '../types/tokens';
3
3
  const sizeStyles = (t) => ({
4
4
  sm: {
5
5
  fieldWrapper: {
@@ -1,5 +1,5 @@
1
1
  // styles/listItems.ts
2
- import { merge, tok, } from '../types/tokens';
2
+ import { merge, tok } from '../types/tokens';
3
3
  export const getListItemParts = (t, s = {}) => {
4
4
  const disabled = Boolean(s.disabled);
5
5
  const base = {
@@ -1,5 +1,5 @@
1
1
  // styles/popovers.ts
2
- import { motion, tok, } from '../types/tokens';
2
+ import { motion, tok } from '../types/tokens';
3
3
  export const getPopoverParts = (t) => {
4
4
  const m = motion(t, 'motion-emphasis-enter');
5
5
  return {
@@ -1,5 +1,5 @@
1
1
  // styles/radios.ts
2
- import { merge, tok, } from '../types/tokens';
2
+ import { merge, tok } from '../types/tokens';
3
3
  export const getRadioParts = (t, s = {}) => {
4
4
  const isOn = Boolean(s.selected);
5
5
  const isDisabled = Boolean(s.disabled);
@@ -1,5 +1,5 @@
1
1
  // styles/selects.ts
2
- import { merge, tok, } from '../types/tokens';
2
+ import { merge, tok } from '../types/tokens';
3
3
  const sizeStyles = (t) => ({
4
4
  sm: {
5
5
  trigger: {
@@ -1,5 +1,5 @@
1
1
  // styles/steppers.ts
2
- import { merge, tok, } from '../types/tokens';
2
+ import { merge, tok } from '../types/tokens';
3
3
  export const getStepperParts = (t) => ({
4
4
  container: {
5
5
  flexDirection: 'row',
@@ -1,5 +1,5 @@
1
1
  // styles/switches.ts
2
- import { merge, tok, } from '../types/tokens';
2
+ import { merge, tok } from '../types/tokens';
3
3
  export const getSwitchParts = (t, s = {}) => {
4
4
  const on = Boolean(s.on);
5
5
  const disabled = Boolean(s.disabled);
@@ -1,5 +1,5 @@
1
1
  // styles/tabs.ts
2
- import { merge, tok, } from '../types/tokens';
2
+ import { merge, tok } from '../types/tokens';
3
3
  export const getTabsListStyle = (t, variant = 'underline') => ({
4
4
  flexDirection: 'row',
5
5
  gap: tok(t, 'space-2'),
@@ -1,5 +1,5 @@
1
1
  // styles/toasts.ts
2
- import { motion, tok, } from '../types/tokens';
2
+ import { motion, tok } from '../types/tokens';
3
3
  const variantMap = (t) => ({
4
4
  info: {
5
5
  border: tok(t, 'color-status-info'),
@@ -1,5 +1,5 @@
1
1
  // styles/tooltips.ts
2
- import { motion, tok, } from '../types/tokens';
2
+ import { motion, tok } from '../types/tokens';
3
3
  export const getTooltipParts = (t) => {
4
4
  const m = motion(t, 'motion-emphasis-enter');
5
5
  return {
@@ -0,0 +1,3 @@
1
+ export * from './themeProvider';
2
+ export * from './useTheme';
3
+ export * from './useTokens';
@@ -0,0 +1,2 @@
1
+ import { createContext } from 'react';
2
+ export const ThemeContext = createContext(null);
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ThemeContext } from './themeContext';
3
+ export const ThemeProvider = ({ children, tokens, }) => {
4
+ return (_jsx(ThemeContext.Provider, { value: { tokens }, children: children }));
5
+ };
@@ -0,0 +1,42 @@
1
+ export const themeCorporateColors = {
2
+ dark: {
3
+ 'color-brand': '#60A5FA',
4
+ 'color-action-primary': '#60A5FA',
5
+ 'color-action-primary-fg': '#020617',
6
+ 'color-action-secondary': '#CBD5E1',
7
+ 'color-action-secondary-fg': '#020617',
8
+ 'color-accent': '#FDBA74',
9
+ 'color-accent-fg': '#111827',
10
+ 'color-bg-default': '#020617',
11
+ 'color-bg-subtle': '#111827',
12
+ 'color-surface': '#111827',
13
+ 'color-surface-alt': '#111827',
14
+ 'color-fg-default': '#E5E7EB',
15
+ 'color-fg-muted': '#9CA3AF',
16
+ 'color-fg-subtle': '#64748B',
17
+ 'color-fg-on-inverted': '#020617',
18
+ 'color-border-subtle': '#1E293B',
19
+ 'color-border-strong': '#475569',
20
+ 'color-focus-ring': '#F97316',
21
+ },
22
+ light: {
23
+ 'color-brand': '#1D4ED8',
24
+ 'color-action-primary': '#2563EB',
25
+ 'color-action-primary-fg': '#FFFFFF',
26
+ 'color-action-secondary': '#64748B',
27
+ 'color-action-secondary-fg': '#0F172A',
28
+ 'color-accent': '#F97316',
29
+ 'color-accent-fg': '#111827',
30
+ 'color-bg-default': '#F9FAFB',
31
+ 'color-bg-subtle': '#E5E7EB',
32
+ 'color-surface': '#FFFFFF',
33
+ 'color-surface-alt': '#F3F4F6',
34
+ 'color-fg-default': '#0F172A',
35
+ 'color-fg-muted': '#6B7280',
36
+ 'color-fg-subtle': '#9CA3AF',
37
+ 'color-fg-on-inverted': '#F9FAFB',
38
+ 'color-border-subtle': '#E5E7EB',
39
+ 'color-border-strong': '#9CA3AF',
40
+ 'color-focus-ring': '#2563EB',
41
+ },
42
+ };
@@ -0,0 +1 @@
1
+ export * from './colors';
@@ -0,0 +1,9 @@
1
+ import { useContext } from 'react';
2
+ import { ThemeContext } from './themeContext';
3
+ export const useTheme = () => {
4
+ const ctx = useContext(ThemeContext);
5
+ if (!ctx) {
6
+ throw new Error('useTheme must be used within <ThemeProvider>');
7
+ }
8
+ return ctx;
9
+ };
@@ -0,0 +1,2 @@
1
+ import { useTheme } from './useTheme';
2
+ export const useTokens = () => useTheme().tokens;
@@ -1,3 +1 @@
1
- // Helpers pequenos (opcionais)
2
- export const isDisabled = (s) => Boolean(s?.disabled || s?.loading);
3
1
  export const isInvalid = (s) => Boolean(s?.error || s?.invalid);