@tpc-mare/mare-ui-components-react 1.0.3 → 1.0.5

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 (2) hide show
  1. package/README.md +1 -227
  2. package/package.json +2 -3
package/README.md CHANGED
@@ -1,227 +1 @@
1
- # @tpc-mare/mare-ui-components-react
2
-
3
- Adaptador React del Mare Design System — 47 componentes headless sobre
4
- [Ark UI](https://ark-ui.com), con tema por marca vía CSS variables y Tailwind CSS 4.
5
-
6
- Mismo sistema de diseño que el adaptador Vue (mismos tokens, mismos estilos base),
7
- componentes React puros: sin provider, sin registro global, sin wrapper.
8
-
9
- ```bash
10
- npm install @tpc-mare/mare-ui-components-react @ark-ui/react
11
- ```
12
-
13
- `@ark-ui/react` es peer dependency y debe instalarse explícitamente.
14
- React 18 o 19.
15
-
16
- ## Setup
17
-
18
- ### 1. CSS
19
-
20
- Los cuatro imports van en tu hoja de estilos global, **en este orden**:
21
-
22
- ```css
23
- @import 'tailwindcss';
24
- @import '@tpc-mare/mare-ui-components-react/theme.css';
25
- @import '@tpc-mare/mare-ui-components-react/styles.css';
26
- @import '@tpc-mare/mare-ui-components-react/themes/the-palace-company.css';
27
- ```
28
-
29
- El orden importa: el archivo de marca va **último**, porque carga los valores de
30
- color que los otros dos referencian en runtime vía CSS variables.
31
-
32
- | Archivo | Qué hace |
33
- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
34
- | `theme.css` | Scaffold de Tailwind sin prefijo (`@theme` + `@utility`). Es lo que habilita clases reales como `bg-default` o `rounded-container-m` en **tu propio** código. |
35
- | `styles.css` | Estilos compilados de los componentes de Mare (prefijados `mare:` internamente, no chocan con tu Tailwind). Incluye las clases `tpc-typography-*`. |
36
- | `themes/<marca>.css` | Los valores de color. Elige exactamente uno. |
37
-
38
- Marcas disponibles: `the-palace-company`, `palace`, `le-blanc`, `baglioni`,
39
- `baglioni-resorts`.
40
-
41
- **¿Tu proyecto no compila Tailwind?** Omite `theme.css` e importa
42
- `@tpc-mare/mare-ui-components-react/utilities-standalone.css`: las mismas
43
- utilidades ya precompiladas, con prefijo `mare-` (`mare-bg-default`,
44
- `mare-text-default`).
45
-
46
- ### 2. `data-theme` en la raíz
47
-
48
- ```tsx
49
- function App() {
50
- return (
51
- <div data-theme='the-palace-company'>
52
- <Routes />
53
- </div>
54
- );
55
- }
56
- ```
57
-
58
- Sin ese atributo las CSS variables no resuelven y los componentes salen sin color.
59
-
60
- ## Uso
61
-
62
- Cada componente se importa explícito — no hay registro global:
63
-
64
- ```tsx
65
- import {
66
- Button,
67
- InputText,
68
- FormField,
69
- HelperText,
70
- } from '@tpc-mare/mare-ui-components-react';
71
- import { useState } from 'react';
72
-
73
- function LoginForm() {
74
- const [email, setEmail] = useState('');
75
-
76
- return (
77
- <div className='flex min-h-screen items-center justify-center bg-default px-4'>
78
- <div className='w-full max-w-md space-y-6 rounded-container-m bg-raised p-8'>
79
- <h1 className='tpc-typography-title-l text-default'>
80
- Iniciar sesión
81
- </h1>
82
-
83
- <FormField>
84
- <HelperText>Email</HelperText>
85
- <InputText
86
- value={email}
87
- onValueChange={setEmail}
88
- type='email'
89
- />
90
- </FormField>
91
-
92
- <Button
93
- severity='primary'
94
- label='Ingresar'
95
- />
96
- </div>
97
- </div>
98
- );
99
- }
100
- ```
101
-
102
- ### Subpaths
103
-
104
- Cada componente tiene su propio entry point, con tipos incluidos:
105
-
106
- ```tsx
107
- import { Button } from '@tpc-mare/mare-ui-components-react/button';
108
- import { DatePicker } from '@tpc-mare/mare-ui-components-react/date-picker';
109
- import { useKeyboardCommands } from '@tpc-mare/mare-ui-components-react/keyboard-commands';
110
- ```
111
-
112
- El barrel principal también es tree-shakeable, así que los subpaths son
113
- sobre todo para dejar explícita la dependencia.
114
-
115
- ### Contenido sobre imágenes
116
-
117
- Para texto encima de una imagen o video, envuelve el contenedor con la variante
118
- `-media` de tu marca. Adapta **todas** las CSS variables del subárbol:
119
-
120
- ```tsx
121
- <section data-theme='the-palace-company-media'>
122
- <img
123
- src='/hero.jpg'
124
- alt=''
125
- />
126
- <h1 className='tpc-typography-display-l text-default'>Paradise Awaits</h1>
127
- </section>
128
- ```
129
-
130
- No uses `text-white`: es un hack que no reacciona al cambio de marca ni de
131
- contexto. Para secciones de fondo sólido oscuro sin imagen, usa la variante
132
- `-brand`.
133
-
134
- ### Iconos
135
-
136
- Los componentes reciben iconos como `ReactNode`, no como string. Usa la
137
- librería que quieras:
138
-
139
- ```tsx
140
- import { IconArrowRight } from '@tabler/icons-react';
141
-
142
- <Button
143
- label='Book Now'
144
- icon={<IconArrowRight />}
145
- />;
146
- ```
147
-
148
- ## Componentes
149
-
150
- Accordion · Avatar · Badge · Banner · Breadcrumbs · Button · Checkbox ·
151
- Combobox · ConfirmDialog · Counter · DatePicker · Dialog · Divider · Drawer ·
152
- ExpandableCounter · FilterChip · FilterChipDropdownMultiple ·
153
- FilterChipDropdownSingle · FilterChipGroup · FloatingActionButton · ImageItem ·
154
- ImageSlider · InputNumber · InputOtp · InputText · Menu · Message ·
155
- MultiSelect · OverlayBadge · Paginator · PanelMenu · Password · ProgressBar ·
156
- ProgressSpinner · RadioGroup · SearchField · SegmentedControl · SelectField ·
157
- Skeleton · Slider · Snackbar · Stepper · Switch · Tabs · Tag · TagChip ·
158
- Textarea
159
-
160
- La referencia de props de cada uno está en el Storybook:
161
-
162
- ```bash
163
- pnpm --filter @tpc-mare/mare-ui-components-react storybook # puerto 6100
164
- ```
165
-
166
- ## Requisitos
167
-
168
- | | |
169
- | --------------- | -------------------------------------------------------------------- |
170
- | React | `>=18` |
171
- | `@ark-ui/react` | `>=5.37.0` (peer, instalación explícita) |
172
- | Tailwind CSS | `^4.1` — opcional, solo si quieres escribir clases como `bg-default` |
173
- | TypeScript | `^5` — opcional |
174
-
175
- ## Formularios
176
-
177
- Los componentes interactivos forwardean `ref`, así que funcionan con
178
- `react-hook-form` tal cual:
179
-
180
- ```tsx
181
- import { useForm } from 'react-hook-form';
182
- import { InputText, Button } from '@tpc-mare/mare-ui-components-react';
183
-
184
- function Form() {
185
- const { register, handleSubmit } = useForm();
186
-
187
- return (
188
- <form onSubmit={handleSubmit(console.log)}>
189
- <InputText {...register('email')} />
190
- <Button
191
- type='submit'
192
- label='Enviar'
193
- />
194
- </form>
195
- );
196
- }
197
- ```
198
-
199
- Los campos de texto (`InputText`, `Textarea`, `Password`, `SearchField`,
200
- `InputNumber`) funcionan en los dos modos:
201
-
202
- - **uncontrolled** — omite `value`. El DOM guarda el valor y `defaultValue`
203
- aplica. Es lo que necesita `register()`.
204
- - **controlled** — pasa `value` + `onValueChange`. En `InputNumber`, `value={null}`
205
- significa "controlado y vacío"; omitir `value` por completo es lo que activa
206
- el modo uncontrolled.
207
-
208
- Los selects y pickers (`SelectField`, `Combobox`, `MultiSelect`, `DatePicker`,
209
- `RadioGroup`, `Slider`) son siempre controlados: van con `Controller`. Su `ref`
210
- apunta al contenedor, para `scrollIntoView` cuando la validación falla.
211
-
212
- Los presentacionales (`Badge`, `Tag`, `Divider`, `Skeleton`, `Avatar`…) no
213
- forwardean `ref` — no hay caso de uso que lo pida.
214
-
215
- ## Limitaciones conocidas
216
-
217
- - **Cobertura de tests parcial.** Hay 70 tests sobre el comportamiento núcleo
218
- (refs, controlled/uncontrolled, datos async, disabled/loading) pero no una
219
- suite por componente.
220
- - **Los `.d.ts` duplican los tipos del core** entre subpaths, porque se
221
- empaquetan con `rollupTypes`. Pesa en disco y descarga, no en el bundle.
222
- - **El paquete se publica sin minificar**, a propósito: tu bundler minifica y
223
- así se puede debuggear dentro de `node_modules`.
224
-
225
- ## Licencia
226
-
227
- MIT © The Palace Company
1
+ readme
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tpc-mare/mare-ui-components-react",
3
3
  "description": "Mare components for React (headless base, MIT). Framework-agnostic design system, React adapter.",
4
- "version": "1.0.3",
4
+ "version": "1.0.5",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "The Palace Company",
@@ -46,17 +46,16 @@
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@ark-ui/react": ">=5.37.0",
49
- "@tabler/icons-react": ">=3.0.0",
50
49
  "react": ">=18.0.0",
51
50
  "react-dom": ">=18.0.0"
52
51
  },
53
52
  "dependencies": {
54
53
  "@internationalized/date": "^3.12.0",
54
+ "@tabler/icons-react": "^3.44.0",
55
55
  "tailwind-merge": "^3.4.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@ark-ui/react": "^5.37.2",
59
- "@tabler/icons-react": "^3.44.0",
60
59
  "@storybook/react-vite": "10.5.10",
61
60
  "@tailwindcss/vite": "^4.1.17",
62
61
  "@testing-library/dom": "^10.4.1",