ctc-component-library 0.3.0 → 1.0.0-alpha.3

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 (235) hide show
  1. package/DESIGN.md +408 -0
  2. package/MIGRATION.md +301 -0
  3. package/README.md +41 -72
  4. package/dist/components/Alert/Alert.d.ts +14 -0
  5. package/dist/components/Alert/Alert.js +73 -0
  6. package/dist/components/Alert/index.d.ts +1 -0
  7. package/dist/components/Alert/index.js +2 -0
  8. package/dist/components/Avatar/Avatar.d.ts +5 -0
  9. package/dist/components/Avatar/Avatar.js +25 -0
  10. package/dist/components/Avatar/index.d.ts +1 -0
  11. package/dist/components/Avatar/index.js +2 -0
  12. package/dist/components/Badge/Badge.d.ts +23 -0
  13. package/dist/components/Badge/Badge.js +159 -0
  14. package/dist/components/Badge/index.d.ts +2 -0
  15. package/dist/components/Badge/index.js +2 -0
  16. package/dist/components/Button/Button.d.ts +7 -0
  17. package/dist/components/Button/Button.js +44 -0
  18. package/dist/components/Button/button.variants.d.ts +22 -0
  19. package/dist/components/Button/button.variants.js +62 -0
  20. package/dist/components/Button/index.d.ts +2 -0
  21. package/dist/components/Button/index.js +3 -0
  22. package/dist/components/Checkbox/Checkbox.d.ts +7 -0
  23. package/dist/components/Checkbox/Checkbox.js +23 -0
  24. package/dist/components/Checkbox/index.d.ts +1 -0
  25. package/dist/components/Checkbox/index.js +2 -0
  26. package/dist/components/Chip/Chip.d.ts +17 -0
  27. package/dist/components/Chip/Chip.js +59 -0
  28. package/dist/components/Chip/index.d.ts +2 -0
  29. package/dist/components/Chip/index.js +2 -0
  30. package/dist/components/Combobox/Combobox.d.ts +31 -0
  31. package/dist/components/Combobox/Combobox.js +98 -0
  32. package/dist/components/Combobox/index.d.ts +1 -0
  33. package/dist/components/Combobox/index.js +2 -0
  34. package/dist/components/DataTable/DataTable.d.ts +24 -0
  35. package/dist/components/DataTable/DataTable.js +74 -0
  36. package/dist/components/DataTable/Table.d.ts +9 -0
  37. package/dist/components/DataTable/Table.js +57 -0
  38. package/dist/components/DataTable/index.d.ts +3 -0
  39. package/dist/components/DataTable/index.js +3 -0
  40. package/dist/components/DatePicker/DatePicker.d.ts +20 -0
  41. package/dist/components/DatePicker/DatePicker.js +74 -0
  42. package/dist/components/DatePicker/index.d.ts +1 -0
  43. package/dist/components/DatePicker/index.js +2 -0
  44. package/dist/components/Dialog/Dialog.d.ts +21 -0
  45. package/dist/components/Dialog/Dialog.js +50 -0
  46. package/dist/components/Dialog/index.d.ts +1 -0
  47. package/dist/components/Dialog/index.js +2 -0
  48. package/dist/components/Field/Field.d.ts +22 -0
  49. package/dist/components/Field/Field.js +43 -0
  50. package/dist/components/Field/index.d.ts +1 -0
  51. package/dist/components/Field/index.js +2 -0
  52. package/dist/components/Icon/Icon.d.ts +7 -0
  53. package/dist/components/Icon/Icon.js +13 -0
  54. package/dist/components/Icon/index.d.ts +13 -0
  55. package/dist/components/Icon/index.js +2 -0
  56. package/dist/components/Input/Input.d.ts +41 -0
  57. package/dist/components/Input/Input.js +87 -0
  58. package/dist/components/Input/index.d.ts +1 -0
  59. package/dist/components/Input/index.js +2 -0
  60. package/dist/components/Label/Label.d.ts +3 -0
  61. package/dist/components/Label/Label.js +13 -0
  62. package/dist/components/Label/index.js +2 -0
  63. package/dist/components/MultiSelect/MultiSelect.d.ts +23 -0
  64. package/dist/components/MultiSelect/MultiSelect.js +99 -0
  65. package/dist/components/MultiSelect/index.d.ts +1 -0
  66. package/dist/components/MultiSelect/index.js +2 -0
  67. package/dist/components/NumberInput/NumberInput.d.ts +11 -0
  68. package/dist/components/NumberInput/NumberInput.js +58 -0
  69. package/dist/components/NumberInput/index.d.ts +1 -0
  70. package/dist/components/NumberInput/index.js +2 -0
  71. package/dist/components/Popover/Popover.d.ts +12 -0
  72. package/dist/components/Popover/Popover.js +20 -0
  73. package/dist/components/Popover/index.d.ts +1 -0
  74. package/dist/components/Popover/index.js +2 -0
  75. package/dist/components/RadioGroup/RadioGroup.d.ts +8 -0
  76. package/dist/components/RadioGroup/RadioGroup.js +30 -0
  77. package/dist/components/RadioGroup/index.d.ts +1 -0
  78. package/dist/components/RadioGroup/index.js +2 -0
  79. package/dist/components/Select/Select.d.ts +15 -0
  80. package/dist/components/Select/Select.js +83 -0
  81. package/dist/components/Select/index.d.ts +1 -0
  82. package/dist/components/Select/index.js +2 -0
  83. package/dist/components/Spinner/Spinner.d.ts +9 -0
  84. package/dist/components/Spinner/Spinner.js +24 -0
  85. package/dist/components/Spinner/index.d.ts +1 -0
  86. package/dist/components/Spinner/index.js +2 -0
  87. package/dist/components/Switch/Switch.d.ts +7 -0
  88. package/dist/components/Switch/Switch.js +23 -0
  89. package/dist/components/Switch/index.d.ts +1 -0
  90. package/dist/components/Switch/index.js +2 -0
  91. package/dist/components/Tabs/Tabs.d.ts +17 -0
  92. package/dist/components/Tabs/Tabs.js +78 -0
  93. package/dist/components/Tabs/index.d.ts +1 -0
  94. package/dist/components/Tabs/index.js +2 -0
  95. package/dist/components/TimePicker/TimePicker.d.ts +20 -0
  96. package/dist/components/TimePicker/TimePicker.js +62 -0
  97. package/dist/components/TimePicker/index.d.ts +1 -0
  98. package/dist/components/TimePicker/index.js +2 -0
  99. package/dist/components/Toast/Toast.d.ts +57 -0
  100. package/dist/components/Toast/Toast.js +40 -0
  101. package/dist/components/Toast/index.d.ts +1 -0
  102. package/dist/components/Toast/index.js +2 -0
  103. package/dist/components/Tooltip/Tooltip.d.ts +12 -0
  104. package/dist/components/Tooltip/Tooltip.js +23 -0
  105. package/dist/components/Tooltip/index.d.ts +1 -0
  106. package/dist/components/Tooltip/index.js +2 -0
  107. package/dist/components/Typography/Typography.d.ts +13 -0
  108. package/dist/components/Typography/Typography.js +63 -0
  109. package/dist/components/Typography/index.d.ts +1 -0
  110. package/dist/components/Typography/index.js +2 -0
  111. package/dist/lib/cn.d.ts +2 -0
  112. package/dist/lib/cn.js +6 -0
  113. package/dist/presets/SelectCountry/SelectCountry.d.ts +16 -0
  114. package/dist/presets/SelectCountry/SelectCountry.js +21 -0
  115. package/dist/presets/SelectCountry/countries.d.ts +11 -0
  116. package/dist/presets/SelectCountry/countries.js +120 -0
  117. package/dist/presets/SelectCountry/index.d.ts +2 -0
  118. package/dist/presets/SelectCountry/index.js +3 -0
  119. package/dist/presets/SelectPhone/SelectPhone.d.ts +15 -0
  120. package/dist/presets/SelectPhone/SelectPhone.js +21 -0
  121. package/dist/presets/SelectPhone/index.d.ts +2 -0
  122. package/dist/presets/SelectPhone/index.js +3 -0
  123. package/dist/presets/SelectPhone/phoneCodes.d.ts +7 -0
  124. package/dist/presets/SelectPhone/phoneCodes.js +131 -0
  125. package/dist/tailwind-preset.d.ts +10 -0
  126. package/dist/tailwind-preset.js +4 -0
  127. package/dist/test-setup.d.ts +0 -0
  128. package/dist/theme/colors.d.ts +57 -0
  129. package/dist/theme/colors.js +59 -0
  130. package/dist/theme/index.d.ts +3 -0
  131. package/dist/theme/index.js +4 -0
  132. package/dist/theme/shapes.d.ts +17 -0
  133. package/dist/theme/shapes.js +18 -0
  134. package/dist/theme/spacing.d.ts +18 -0
  135. package/dist/theme/spacing.js +19 -0
  136. package/dist/theme.css +2 -0
  137. package/llms.txt +296 -736
  138. package/package.json +193 -69
  139. package/dist/index.css +0 -1
  140. package/dist/index.d.ts +0 -9
  141. package/dist/index.es.js +0 -45363
  142. package/dist/src/commons/colors.d.ts +0 -47
  143. package/dist/src/commons/colors.es.js +0 -50
  144. package/dist/src/commons/shapes.d.ts +0 -15
  145. package/dist/src/commons/shapes.es.js +0 -18
  146. package/dist/src/commons/spacing.d.ts +0 -15
  147. package/dist/src/commons/spacing.es.js +0 -18
  148. package/dist/src/components/atoms/Avatar/Avatar.d.ts +0 -2
  149. package/dist/src/components/atoms/Avatar/index.d.ts +0 -2
  150. package/dist/src/components/atoms/Avatar/types.d.ts +0 -7
  151. package/dist/src/components/atoms/Badge/Badge.d.ts +0 -3
  152. package/dist/src/components/atoms/Badge/index.d.ts +0 -2
  153. package/dist/src/components/atoms/Badge/types.d.ts +0 -18
  154. package/dist/src/components/atoms/Button/Button.d.ts +0 -3
  155. package/dist/src/components/atoms/Button/ButtonV2.d.ts +0 -4
  156. package/dist/src/components/atoms/Button/index.d.ts +0 -4
  157. package/dist/src/components/atoms/Button/types.d.ts +0 -35
  158. package/dist/src/components/atoms/Checkbox/Checkbox.d.ts +0 -3
  159. package/dist/src/components/atoms/Checkbox/index.d.ts +0 -2
  160. package/dist/src/components/atoms/Checkbox/types.d.ts +0 -18
  161. package/dist/src/components/atoms/Datepicker/Datepicker.d.ts +0 -3
  162. package/dist/src/components/atoms/Datepicker/index.d.ts +0 -2
  163. package/dist/src/components/atoms/Datepicker/types.d.ts +0 -9
  164. package/dist/src/components/atoms/Icon/Icon.d.ts +0 -3
  165. package/dist/src/components/atoms/Icon/index.d.ts +0 -3
  166. package/dist/src/components/atoms/Icon/types.d.ts +0 -11
  167. package/dist/src/components/atoms/InputNumber/InputNumber.d.ts +0 -3
  168. package/dist/src/components/atoms/InputNumber/index.d.ts +0 -2
  169. package/dist/src/components/atoms/InputNumber/types.d.ts +0 -7
  170. package/dist/src/components/atoms/Label/Label.d.ts +0 -9
  171. package/dist/src/components/atoms/Popover/Popover.d.ts +0 -2
  172. package/dist/src/components/atoms/Popover/index.d.ts +0 -2
  173. package/dist/src/components/atoms/Popover/types.d.ts +0 -8
  174. package/dist/src/components/atoms/RadioButton/RadioButton.d.ts +0 -3
  175. package/dist/src/components/atoms/RadioButton/index.d.ts +0 -2
  176. package/dist/src/components/atoms/RadioButton/types.d.ts +0 -20
  177. package/dist/src/components/atoms/TextInput/TextInput.d.ts +0 -12
  178. package/dist/src/components/atoms/TextInput/index.d.ts +0 -1
  179. package/dist/src/components/atoms/TextInput/types.d.ts +0 -5
  180. package/dist/src/components/atoms/Timepicker/TimePicker.d.ts +0 -3
  181. package/dist/src/components/atoms/Timepicker/index.d.ts +0 -2
  182. package/dist/src/components/atoms/Timepicker/types.d.ts +0 -15
  183. package/dist/src/components/atoms/Toast/Toast.d.ts +0 -20
  184. package/dist/src/components/atoms/Toast/index.d.ts +0 -1
  185. package/dist/src/components/atoms/Toggle/Toggle.d.ts +0 -3
  186. package/dist/src/components/atoms/Toggle/index.d.ts +0 -2
  187. package/dist/src/components/atoms/Toggle/types.d.ts +0 -6
  188. package/dist/src/components/atoms/Typography/Typography.d.ts +0 -7
  189. package/dist/src/components/atoms/Typography/index.d.ts +0 -2
  190. package/dist/src/components/atoms/Typography/types.d.ts +0 -38
  191. package/dist/src/components/atoms/index.d.ts +0 -16
  192. package/dist/src/components/atoms/tooltips/Tooltip/Tooltip.d.ts +0 -2
  193. package/dist/src/components/atoms/tooltips/Tooltip/index.d.ts +0 -2
  194. package/dist/src/components/atoms/tooltips/Tooltip/types.d.ts +0 -10
  195. package/dist/src/components/atoms/tooltips/TooltipWrapper/TooltipWrapper.d.ts +0 -2
  196. package/dist/src/components/atoms/tooltips/TooltipWrapper/index.d.ts +0 -2
  197. package/dist/src/components/atoms/tooltips/TooltipWrapper/types.d.ts +0 -11
  198. package/dist/src/components/atoms/tooltips/index.d.ts +0 -2
  199. package/dist/src/components/index.d.ts +0 -3
  200. package/dist/src/components/molecules/Table/Table.d.ts +0 -3
  201. package/dist/src/components/molecules/Table/index.d.ts +0 -2
  202. package/dist/src/components/molecules/Table/types.d.ts +0 -28
  203. package/dist/src/components/molecules/alert/Alert.d.ts +0 -15
  204. package/dist/src/components/molecules/alert/index.d.ts +0 -1
  205. package/dist/src/components/molecules/dropdowns/Dropdown/Dropdown.d.ts +0 -3
  206. package/dist/src/components/molecules/dropdowns/Dropdown/index.d.ts +0 -2
  207. package/dist/src/components/molecules/dropdowns/Dropdown/types.d.ts +0 -33
  208. package/dist/src/components/molecules/dropdowns/DropdownCountry/DropdownCountry.d.ts +0 -5
  209. package/dist/src/components/molecules/dropdowns/DropdownCountry/index.d.ts +0 -1
  210. package/dist/src/components/molecules/dropdowns/DropdownFilter/DropdownFilter.d.ts +0 -3
  211. package/dist/src/components/molecules/dropdowns/DropdownFilter/index.d.ts +0 -1
  212. package/dist/src/components/molecules/dropdowns/DropdownFilter/types.d.ts +0 -38
  213. package/dist/src/components/molecules/dropdowns/DropdownMultiple/DropdownMultiple.d.ts +0 -3
  214. package/dist/src/components/molecules/dropdowns/DropdownMultiple/index.d.ts +0 -2
  215. package/dist/src/components/molecules/dropdowns/DropdownMultiple/types.d.ts +0 -11
  216. package/dist/src/components/molecules/dropdowns/DropdownPhone/DropdownPhone.d.ts +0 -6
  217. package/dist/src/components/molecules/dropdowns/DropdownPhone/index.d.ts +0 -1
  218. package/dist/src/components/molecules/dropdowns/index.d.ts +0 -5
  219. package/dist/src/components/molecules/index.d.ts +0 -4
  220. package/dist/src/components/molecules/tabs/Tab/Tab.d.ts +0 -3
  221. package/dist/src/components/molecules/tabs/Tab/index.d.ts +0 -2
  222. package/dist/src/components/molecules/tabs/Tab/types.d.ts +0 -16
  223. package/dist/src/components/molecules/tabs/TabButton/TabButton.d.ts +0 -3
  224. package/dist/src/components/molecules/tabs/TabButton/index.d.ts +0 -2
  225. package/dist/src/components/molecules/tabs/TabButton/types.d.ts +0 -15
  226. package/dist/src/components/molecules/tabs/index.d.ts +0 -2
  227. package/dist/src/components/organisms/Modal/Modal.d.ts +0 -3
  228. package/dist/src/components/organisms/Modal/ModalV2.d.ts +0 -53
  229. package/dist/src/components/organisms/Modal/index.d.ts +0 -3
  230. package/dist/src/components/organisms/Modal/types.d.ts +0 -24
  231. package/dist/src/components/organisms/index.d.ts +0 -1
  232. package/dist/src/constants/countries.d.ts +0 -7
  233. package/dist/src/hooks/useClickOutside.d.ts +0 -2
  234. package/dist/src/vite-env.d.ts +0 -1
  235. /package/dist/{src/components/atoms → components}/Label/index.d.ts +0 -0
package/MIGRATION.md ADDED
@@ -0,0 +1,301 @@
1
+ # Migration Guide: v0.x → v1.0
2
+
3
+ > ctc-component-library v1.0 reescribe la librería sobre **shadcn/ui + Radix + Tailwind v4 + cva**, drop completo de **antd** y **SCSS**, y rediseña la distribución con **subpath exports por componente** para tree-shaking real.
4
+
5
+ ## TL;DR
6
+
7
+ ```diff
8
+ - import { Button, Modal } from 'ctc-component-library';
9
+ + import { Button } from 'ctc-component-library/button';
10
+ + import { Dialog } from 'ctc-component-library/dialog';
11
+ - import 'ctc-component-library/dist/styles.css';
12
+ + import 'ctc-component-library/theme.css';
13
+ ```
14
+
15
+ Bundle resultante (proyecto Vite consumiendo 5 componentes): **~95% más chico** vs v0.3.
16
+
17
+ ## Estado del rewrite
18
+
19
+ Marcado en orden de implementación:
20
+
21
+ ### Tier 1 — Drop-in atoms
22
+
23
+ - [x] `Button`
24
+ - [x] `Avatar` (`Avatar`, `AvatarImage`, `AvatarFallback`)
25
+ - [x] `Badge`
26
+ - [x] `Label`
27
+ - [x] `Spinner`
28
+ - [x] `Typography`
29
+ - [x] `Alert` (`Alert`, `AlertTitle`, `AlertDescription`)
30
+ - [x] `Icon` (wrapper `@phosphor-icons/react`)
31
+ - [x] `Checkbox`
32
+ - [x] `Switch` (ex `Toggle`)
33
+ - [x] `RadioGroup` (ex `RadioButton`)
34
+
35
+ ### Tier 2 — Forms
36
+
37
+ - [x] `Field`/`FieldGroup`/`FieldLabel`/`FieldDescription`/`FieldSet`/`FieldLegend`
38
+ - [x] `Input` (ex `TextInput`)
39
+ - [x] `NumberInput` (ex `InputNumber`)
40
+ - [x] `DatePicker` (ex `Datepicker`)
41
+ - [x] `TimePicker` (ex `Timepicker`)
42
+
43
+ ### Tier 3 — Overlays
44
+
45
+ - [x] `Dialog` (ex `Modal`/`ModalV2`)
46
+ - [x] `Popover` (con Arrow heredada de `ModalV2.arrow`)
47
+ - [x] `Tooltip`
48
+ - [x] `Tabs` (unifica `Tab`+`TabButton`, variant `segmented` | `underline`)
49
+ - [x] `Toast` (sonner re-export)
50
+
51
+ ### Tier 4 — Selection
52
+
53
+ - [x] `Select` (ex `Dropdown`)
54
+ - [x] `Combobox` (ex `DropdownFilter` con async/infinite)
55
+ - [x] `MultiSelect` (ex `DropdownMultiple`)
56
+ - [x] `SelectCountry` (preset, ex `DropdownCountry`)
57
+ - [x] `SelectPhone` (preset, ex `DropdownPhone`)
58
+
59
+ ### Tier 5 — Data
60
+
61
+ - [x] `DataTable` (TanStack + shadcn Table primitives, ex `Table`)
62
+
63
+ ### Estado
64
+
65
+ - [x] Codemod `barrel-to-subpath` (`codemods/barrel-to-subpath.cjs`)
66
+ - [x] Codemod `v0-to-v1` (`codemods/v0-to-v1.cjs`) + `icon-mapping.json`
67
+ - [x] Stories: 28/28 componentes + presets
68
+ - [x] Tests: 27 archivos / 73 tests pasando (todos los componentes y presets)
69
+ - [x] Build verde (`bun run build`) — 28 chunks, dist 536KB total
70
+ - [x] `bunx tsc --noEmit` clean
71
+ - [x] Motion / microinteractions (Emil Kowalski philosophy): custom easings, stagger en selects/combobox/multi-select (35ms entre items), press feedback en todos los pressables, asymmetric enter/exit, origin-aware popovers/tooltips/selects, reduced-motion guard. Ver DESIGN.md § Motion.
72
+ - [ ] Visual regression (Chromatic) reset baseline
73
+ - [ ] `axe-core` integration en Storybook
74
+ - [ ] Push a remote + CI pipeline para v1
75
+
76
+ ## Cambios por componente
77
+
78
+ ### Button
79
+
80
+ ```diff
81
+ - import { ButtonV2 as Button } from 'ctc-component-library';
82
+ + import { Button } from 'ctc-component-library/button';
83
+
84
+ - <Button type="primary" primaryVariant="success" size="big" iconOnly>...</Button>
85
+ + <Button variant="success" size="lg">...</Button>
86
+
87
+ - <Button type="secondary" secondaryVariant="skyblue" />
88
+ + <Button variant="outline-skyblue" />
89
+
90
+ - <Button preffix={<Icon iconName="check" />} text="OK" />
91
+ + <Button><Check data-icon="inline-start" />OK</Button>
92
+
93
+ - <Button fullWidth />
94
+ + <Button className="w-full" />
95
+ ```
96
+
97
+ **Variants nuevas** (una sola prop `variant`, sin `primaryVariant`/`secondaryVariant`):
98
+
99
+ | v0 | v1 |
100
+ |---|---|
101
+ | `type=primary` | `variant=brand` |
102
+ | `type=primary` `primaryVariant=neutral` | `variant=default` |
103
+ | `type=primary` `primaryVariant=skyblue` | `variant=skyblue` |
104
+ | `type=primary` `primaryVariant=success` | `variant=success` |
105
+ | `type=primary` `primaryVariant=error` | `variant=destructive` |
106
+ | `type=secondary` | `variant=outline` |
107
+ | `type=secondary` `secondaryVariant=skyblue` | `variant=outline-skyblue` |
108
+ | `type=tertiary` | `variant=ghost` |
109
+
110
+ **Size**: `small`/`medium`/`big` → `sm`/`md`/`lg` (heights 32/48/56px). `iconOnly` se mantiene como boolean prop separado; combinado con size produce dimensiones cuadradas: `sm`+`iconOnly`=24×24, `md`+`iconOnly`=32×32, `lg`+`iconOnly`=40×40.
111
+ **Loading**: `loading` se mantiene (built-in Spinner). **Iconos**: children con `data-icon="inline-start"` o `"inline-end"` (no más `preffix`/`suffix`).
112
+
113
+ ### Toast
114
+
115
+ ```diff
116
+ - import { ToastContextProvider, useToast } from 'ctc-component-library';
117
+ + import { Toaster, toast } from 'ctc-component-library/toast';
118
+
119
+ // Root del app:
120
+ - <ToastContextProvider>{children}</ToastContextProvider>
121
+ + <Toaster />
122
+ + {children}
123
+
124
+ // En cualquier módulo:
125
+ - const { toast } = useToast();
126
+ - toast.success('Guardado');
127
+ + toast.success('Guardado');
128
+
129
+ // Action:
130
+ - toast.success(msg, { action: <Button onClick={...}>Deshacer</Button> })
131
+ + toast.success(msg, { action: { label: 'Deshacer', onClick } })
132
+ ```
133
+
134
+ `useToast()`/`ToastContextProvider`/`contextHolder` desaparecen. sonner no requiere context ni hook.
135
+
136
+ ### Modal → Dialog
137
+
138
+ ```diff
139
+ - import { ModalV2 as Modal, ModalContent, ModalTrigger, ... } from 'ctc-component-library';
140
+ + import { Dialog, DialogContent, DialogTrigger, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose } from 'ctc-component-library/dialog';
141
+
142
+ - <Modal isOpen={open} onOpenChange={set}>
143
+ - <ModalTrigger><Button>Open</Button></ModalTrigger>
144
+ - <ModalContent>
145
+ - <ModalTitle>Title</ModalTitle>
146
+ - <ModalDescription>...</ModalDescription>
147
+ - <ModalBody>...</ModalBody>
148
+ - <ModalFooter>
149
+ - <ModalCloseButton>Cancel</ModalCloseButton>
150
+ - <ModalActionButton onClick={(e, close) => { do(); close(); }}>Confirm</ModalActionButton>
151
+ - </ModalFooter>
152
+ - </ModalContent>
153
+ - </Modal>
154
+
155
+ + <Dialog open={open} onOpenChange={set}>
156
+ + <DialogTrigger asChild><Button>Open</Button></DialogTrigger>
157
+ + <DialogContent>
158
+ + <DialogHeader>
159
+ + <DialogTitle>Title</DialogTitle>
160
+ + <DialogDescription>...</DialogDescription>
161
+ + </DialogHeader>
162
+ + {/* body inline, sin wrapper */}
163
+ + <DialogFooter>
164
+ + <DialogClose asChild><Button variant="ghost">Cancel</Button></DialogClose>
165
+ + <Button onClick={async () => { await action(); set(false); }}>Confirm</Button>
166
+ + </DialogFooter>
167
+ + </DialogContent>
168
+ + </Dialog>
169
+ ```
170
+
171
+ **Drops**: `Modal` V1 (deprecated en v0.x), `ModalBody`, `ModalActionButton`, `ModalCloseButton` (usar `<DialogClose asChild><Button/></DialogClose>`).
172
+ **Arrow**: `ModalV2 arrow={true} arrowPosition=...` se migra a **`Popover`** (semánticamente correcto).
173
+
174
+ ### Dropdowns
175
+
176
+ ```diff
177
+ - import { Dropdown } from 'ctc-component-library';
178
+ + import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from 'ctc-component-library/select';
179
+
180
+ - import { DropdownFilter } from 'ctc-component-library';
181
+ + import { Combobox } from 'ctc-component-library/combobox';
182
+
183
+ - import { DropdownMultiple } from 'ctc-component-library';
184
+ + import { MultiSelect } from 'ctc-component-library/multi-select';
185
+
186
+ - import { DropdownCountry } from 'ctc-component-library';
187
+ + import { SelectCountry } from 'ctc-component-library/select-country';
188
+
189
+ - import { DropdownPhone } from 'ctc-component-library';
190
+ + import { SelectPhone } from 'ctc-component-library/select-phone';
191
+ ```
192
+
193
+ API array `options=[]` → JSX compound. Codemod expande automáticamente.
194
+
195
+ ### Tabs
196
+
197
+ ```diff
198
+ - import { Tab } from 'ctc-component-library';
199
+ + import { Tabs, TabsList, TabsTrigger, TabsContent } from 'ctc-component-library/tabs';
200
+
201
+ - <Tab tabs={[{label: 'A', content: <A/>}, {label: 'B', content: <B/>}]} defaultActiveKey={0} />
202
+ + <Tabs defaultValue="a" variant="underline">
203
+ + <TabsList>
204
+ + <TabsTrigger value="a">A</TabsTrigger>
205
+ + <TabsTrigger value="b">B</TabsTrigger>
206
+ + </TabsList>
207
+ + <TabsContent value="a"><A/></TabsContent>
208
+ + <TabsContent value="b"><B/></TabsContent>
209
+ + </Tabs>
210
+ ```
211
+
212
+ `Tab` (underline) y `TabButton` (segmented) se unifican en `Tabs` con `variant="underline" | "segmented"`.
213
+
214
+ ### Toggle → Switch
215
+
216
+ ```diff
217
+ - import { Toggle } from 'ctc-component-library';
218
+ + import { Switch } from 'ctc-component-library/switch';
219
+ ```
220
+
221
+ ### RadioButton → RadioGroup
222
+
223
+ ```diff
224
+ - import { RadioButton } from 'ctc-component-library';
225
+ + import { RadioGroup, RadioGroupItem } from 'ctc-component-library/radio-group';
226
+ ```
227
+
228
+ ### TextInput / InputNumber
229
+
230
+ Ambos se envuelven obligatoriamente en `Field`:
231
+
232
+ ```diff
233
+ - <TextInput label="Email" errors={[err]} value={x} onChange={...} />
234
+ + <FieldGroup>
235
+ + <Field data-invalid={!!err}>
236
+ + <FieldLabel>Email</FieldLabel>
237
+ + <Input value={x} onChange={...} aria-invalid={!!err} />
238
+ + {err && <FieldDescription>{err}</FieldDescription>}
239
+ + </Field>
240
+ + </FieldGroup>
241
+ ```
242
+
243
+ ### Table → DataTable
244
+
245
+ ```diff
246
+ - import { Table } from 'ctc-component-library';
247
+ + import { DataTable } from 'ctc-component-library/data-table';
248
+ + import type { ColumnDef } from '@tanstack/react-table';
249
+
250
+ - <Table columns={antdColumns} data={rows} expandable={{ expandedRowData, expandedRowColumns }} />
251
+ + <DataTable<Row> columns={columns} data={rows} expandable={{ expandedRowData, expandedRowColumns }} />
252
+ ```
253
+
254
+ Columns ahora son `ColumnDef<T>[]` (TanStack). API `expandedRowData`/`expandedRowColumns`/`alignSubRowsWithParent` se preserva tal cual.
255
+
256
+ ### Iconos
257
+
258
+ ```diff
259
+ - import { Icon } from 'ctc-component-library';
260
+ - <Icon iconName="check_circle" size="24" />
261
+ + import { CheckCircle } from '@phosphor-icons/react';
262
+ + <CheckCircle size={24} />
263
+ ```
264
+
265
+ `@material-symbols/font-400` se remueve de deps. Tabla de mapping Material Symbols → Phosphor disponible en `codemods/icon-mapping.json`. Faltantes (~15%) marcados como TODO por el codemod.
266
+
267
+ ## Tokens (theme)
268
+
269
+ ```diff
270
+ - import { colors, shapes, spacing } from 'ctc-component-library/theme/colors';
271
+ + import { colors, shapes, spacing } from 'ctc-component-library/theme';
272
+ ```
273
+
274
+ Estructura sigue compatible. Drift TS↔SCSS desaparece (un solo origen: `src/theme.css` con `@theme inline`).
275
+
276
+ ## Estilos
277
+
278
+ ```diff
279
+ - import 'ctc-component-library/dist/styles.css';
280
+ + import 'ctc-component-library/theme.css';
281
+ ```
282
+
283
+ Tailwind v4 requerido en el consumer. Si seguís en Tailwind v3, instalar `@tailwindcss/postcss-v3-bridge` (ver docs Tailwind).
284
+
285
+ ## Codemods
286
+
287
+ ```bash
288
+ # Fase 0 (sobre v0.99): mueve imports a subpath sin cambiar comportamiento.
289
+ npx ctc-component-library codemod barrel-to-subpath --path src/
290
+
291
+ # Fase 2 (al adoptar v1.0): renames + props + Modal→Dialog + Toast→sonner + etc.
292
+ npx ctc-component-library codemod v0-to-v1 --path src/
293
+ ```
294
+
295
+ Idempotentes. Generan diff revisable. TODO comments donde no pueden inferir automáticamente.
296
+
297
+ ## Out of scope en v1.0
298
+
299
+ - Light/dark themes (planeado v1.1).
300
+ - React 19 / RSC (lib sigue client-only).
301
+ - i18n / RTL.
package/README.md CHANGED
@@ -1,101 +1,70 @@
1
1
  # ctc-component-library
2
2
 
3
- ## Requirements
3
+ > v1.0 — React + TypeScript + **Tailwind v4** + **shadcn/Radix**.
4
+ > Branch en migración. Ver [MIGRATION.md](./MIGRATION.md) para v0.x → v1.0 y [DESIGN.md](./DESIGN.md) para tokens.
4
5
 
5
- ```
6
- node v18.19.1 or above
7
- ```
6
+ ## Requisitos
8
7
 
9
- ## Install
8
+ - Node ≥ 18.19.1
9
+ - React 18 o 19
10
+ - Tailwind CSS v4 (en el consumer)
10
11
 
11
- ```
12
- npm install --save @ctc-component-library
13
- ```
14
-
15
- ## Run local
16
-
17
- ```
18
- - npm install
19
- - npm run storybook
20
- ```
21
-
22
- ## To publish
23
-
24
- ```
25
- - Increase the version on package.json
26
- - Push to main branch, the actions to publish and deploy will be run
27
- ```
28
-
29
- ## Material Symbols demo
30
-
31
- ```
32
- - Here you can preview all the icons
33
- https://marella.me/material-symbols/demo/
12
+ ## Install
34
13
 
35
- - Usage
36
- https://github.com/marella/material-symbols/tree/main/material-symbols#usage
14
+ ```bash
15
+ npm install ctc-component-library
37
16
  ```
38
17
 
39
- ### Installing `yalc` on Your Machine
18
+ ## Uso
40
19
 
41
- Using NPM:
20
+ Importar el theme una vez en el root del consumer:
42
21
 
43
- ```
44
- npm i yalc -g
45
- ```
46
-
47
- Using Yarn:
48
-
49
- ```
50
- yarn global add yalc
22
+ ```ts
23
+ import 'ctc-component-library/theme.css';
51
24
  ```
52
25
 
53
- ## Updating the Library with yalc
26
+ Importar componentes desde subpath (tree-shaking real):
54
27
 
55
- Once yalc is installed, navigate to the root of the library and execute:
28
+ ```tsx
29
+ import { Button } from 'ctc-component-library/button';
30
+ import { Dialog, DialogContent, DialogTrigger } from 'ctc-component-library/dialog';
31
+ import { toast, Toaster } from 'ctc-component-library/toast';
56
32
 
33
+ <Button variant="brand" size="md">Send</Button>
57
34
  ```
58
- ctc-component-library % yarn yalc:update
59
- ```
60
-
61
- Then, in the root of the project where the library will be installed (e.g., Backoffice), execute:
62
35
 
63
- ```
64
- ctc-backoffice-frontend % yalc add ctc-component-library
65
- ```
36
+ > **Solo subpath imports.** No hay barrel raíz: `import … from 'ctc-component-library'` no existe. Cada componente se importa desde su subpath (`/button`, `/dialog`, …) para tree-shaking real. Ver `llms.txt` para el catálogo completo (import path + props + variantes).
66
37
 
67
- ## Using the Components
38
+ ## Desarrollo local
68
39
 
69
- Now you can use the components, for example:
70
-
71
- ```
72
- import { Button } from 'ctc-component-library';
73
-
74
- const SomeForm: React.FC = () => (
75
- <Button type="primary" text="Send" />
76
- );
40
+ ```bash
41
+ pnpm install
42
+ pnpm storybook # http://localhost:6006
43
+ pnpm build
44
+ pnpm test
77
45
  ```
78
46
 
79
- This allows you to have the library installed locally, make changes or adjustments to any component in the library, and validate them immediately without having to go through the process of pull requests, merges, and deployment to NPM.
80
-
81
- ## Updating the Library in a Project
47
+ ### yalc (probar contra consumer local)
82
48
 
83
- After making a change to a component in the library, and if you need to see this change in the project consuming the library, you must build and update the package in the local yalc repository. Then, remove and add the library package again in the consuming project. To do this:
49
+ ```bash
50
+ # Lib:
51
+ pnpm yalc:update
84
52
 
85
- Navigate to the root of the library and execute:
86
-
87
- ```
88
- ctc-component-library % yarn yalc:update
53
+ # Consumer:
54
+ yalc add ctc-component-library
89
55
  ```
90
56
 
91
- Navigate to the root of the project consuming the library (e.g., Backoffice) and to remove the library, execute:
57
+ ## Estructura
92
58
 
93
59
  ```
94
- ctc-backoffice-frontend % yalc remove ctc-component-library
60
+ src/
61
+ components/ # un dir por componente, exporta vía /button, /dialog, etc.
62
+ presets/ # composiciones pre-armadas (SelectCountry, SelectPhone)
63
+ lib/cn.ts # clsx + tailwind-merge
64
+ theme/ # tokens TS (colors, spacing, shapes)
65
+ theme.css # @theme tokens (Tailwind v4)
95
66
  ```
96
67
 
97
- Then, to add the library, execute:
68
+ ## Estado del rewrite
98
69
 
99
- ```
100
- ctc-backoffice-frontend % yalc add ctc-component-library
101
- ```
70
+ Ver checklist en [MIGRATION.md](./MIGRATION.md#estado-del-rewrite).
@@ -0,0 +1,14 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import * as React from 'react';
3
+ declare const alertVariants: (props?: ({
4
+ variant?: "success" | "destructive" | "info" | "warning" | null | undefined;
5
+ size?: "sm" | "lg" | null | undefined;
6
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
+ export interface AlertProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof alertVariants> {
8
+ hideIcon?: boolean;
9
+ onDismiss?: () => void;
10
+ }
11
+ export declare const Alert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<HTMLDivElement>>;
12
+ export declare const AlertTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLHeadingElement>>;
13
+ export declare const AlertDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
14
+ export {};
@@ -0,0 +1,73 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import * as t from "react";
3
+ import { cva as n } from "class-variance-authority";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ import { CheckCircle as a, Info as o, Warning as s, WarningCircle as c, X as l } from "@phosphor-icons/react";
6
+ //#region src/components/Alert/Alert.tsx
7
+ var u = n(["relative w-full rounded-x2 p-x3 flex gap-x4 items-center font-sans", "[animation:ctc-fade-rise_var(--duration-base)_var(--ease-out)]"], {
8
+ variants: {
9
+ variant: {
10
+ info: "bg-skyblue-lighter text-secondary",
11
+ success: "bg-success-light text-success",
12
+ warning: "bg-alert-light text-alert",
13
+ destructive: "bg-error-light text-error"
14
+ },
15
+ size: {
16
+ sm: "",
17
+ lg: "shadow-[0px_1px_25px_0px_rgba(0,0,0,0.04)]"
18
+ }
19
+ },
20
+ defaultVariants: {
21
+ variant: "info",
22
+ size: "lg"
23
+ }
24
+ }), d = {
25
+ info: o,
26
+ success: a,
27
+ warning: s,
28
+ destructive: c
29
+ }, f = t.forwardRef(({ className: t, variant: n = "info", size: a = "lg", hideIcon: o = !1, onDismiss: s, children: c, ...f }, p) => {
30
+ let m = d[n];
31
+ return /* @__PURE__ */ i("div", {
32
+ ref: p,
33
+ role: "alert",
34
+ className: e(u({
35
+ variant: n,
36
+ size: a
37
+ }), t),
38
+ ...f,
39
+ children: [
40
+ !o && /* @__PURE__ */ r(m, {
41
+ weight: "fill",
42
+ className: "size-6 shrink-0"
43
+ }),
44
+ /* @__PURE__ */ r("div", {
45
+ className: e("flex-1", a === "lg" ? "font-medium text-[16px] leading-[24px] tracking-[-0.5px]" : "text-[12px] leading-[16px] tracking-[-0.5px]"),
46
+ children: c
47
+ }),
48
+ s && /* @__PURE__ */ r("button", {
49
+ type: "button",
50
+ onClick: s,
51
+ "aria-label": "Cerrar",
52
+ "data-pressable": "",
53
+ className: e("shrink-0 inline-flex items-center justify-center size-6 rounded-x1", "opacity-60 hover:opacity-100", "active:scale-[var(--press-scale)]", "[transition:opacity_var(--duration-fast)_var(--ease-out),transform_var(--duration-fast)_var(--ease-out)]"),
54
+ children: /* @__PURE__ */ r(l, { className: "size-6" })
55
+ })
56
+ ]
57
+ });
58
+ });
59
+ f.displayName = "Alert";
60
+ var p = t.forwardRef(({ className: t, ...n }, i) => /* @__PURE__ */ r("h5", {
61
+ ref: i,
62
+ className: e("font-sans font-bold text-[16px] leading-[24px] tracking-[-0.5px]", t),
63
+ ...n
64
+ }));
65
+ p.displayName = "AlertTitle";
66
+ var m = t.forwardRef(({ className: t, ...n }, i) => /* @__PURE__ */ r("div", {
67
+ ref: i,
68
+ className: e("text-[12px] leading-[16px] tracking-[-0.5px]", t),
69
+ ...n
70
+ }));
71
+ m.displayName = "AlertDescription";
72
+ //#endregion
73
+ export { f as Alert, m as AlertDescription, p as AlertTitle };
@@ -0,0 +1 @@
1
+ export { Alert, AlertTitle, AlertDescription, type AlertProps } from './Alert';
@@ -0,0 +1,2 @@
1
+ import { Alert as e, AlertDescription as t, AlertTitle as n } from "./Alert.js";
2
+ export { e as Alert, t as AlertDescription, n as AlertTitle };
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import * as AvatarPrimitive from '@radix-ui/react-avatar';
3
+ export declare const Avatar: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
4
+ export declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
5
+ export declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,25 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import * as t from "react";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ import * as r from "@radix-ui/react-avatar";
5
+ //#region src/components/Avatar/Avatar.tsx
6
+ var i = t.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ n(r.Root, {
7
+ ref: a,
8
+ className: e("relative flex size-10 shrink-0 overflow-hidden rounded-full bg-gray-20", t),
9
+ ...i
10
+ }));
11
+ i.displayName = "Avatar";
12
+ var a = t.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ n(r.Image, {
13
+ ref: a,
14
+ className: e("aspect-square size-full object-cover", "data-[state=loaded]:[animation:ctc-fade-rise_var(--duration-base)_var(--ease-out)]", t),
15
+ ...i
16
+ }));
17
+ a.displayName = "AvatarImage";
18
+ var o = t.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ n(r.Fallback, {
19
+ ref: a,
20
+ className: e("flex size-full items-center justify-center text-gray-80 font-sans text-sm", t),
21
+ ...i
22
+ }));
23
+ o.displayName = "AvatarFallback";
24
+ //#endregion
25
+ export { i as Avatar, o as AvatarFallback, a as AvatarImage };
@@ -0,0 +1 @@
1
+ export { Avatar, AvatarImage, AvatarFallback } from './Avatar';
@@ -0,0 +1,2 @@
1
+ import { Avatar as e, AvatarFallback as t, AvatarImage as n } from "./Avatar.js";
2
+ export { e as Avatar, t as AvatarFallback, n as AvatarImage };
@@ -0,0 +1,23 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import * as React from 'react';
3
+ declare const badgeVariants: (props?: ({
4
+ variant?: "alert" | "success" | "destructive" | "purple" | "brand" | "skyblue" | "neutral" | "outline" | null | undefined;
5
+ tone?: "quiet" | "loud" | null | undefined;
6
+ size?: "sm" | "lg" | "md" | null | undefined;
7
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
8
+ export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof badgeVariants> {
9
+ /** Optional leading icon (Phosphor or any svg). Sized via parent CSS. */
10
+ icon?: React.ReactNode;
11
+ }
12
+ export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
13
+ export interface BadgeDotProps extends React.HTMLAttributes<HTMLSpanElement> {
14
+ variant?: NonNullable<BadgeProps['variant']>;
15
+ size?: 'sm' | 'md';
16
+ }
17
+ export declare const BadgeDot: React.ForwardRefExoticComponent<BadgeDotProps & React.RefAttributes<HTMLSpanElement>>;
18
+ export interface BadgeMinimalProps extends React.HTMLAttributes<HTMLSpanElement> {
19
+ variant?: NonNullable<BadgeProps['variant']>;
20
+ size?: 'sm' | 'md';
21
+ }
22
+ export declare const BadgeMinimal: React.ForwardRefExoticComponent<BadgeMinimalProps & React.RefAttributes<HTMLSpanElement>>;
23
+ export {};