ctc-component-library 0.2.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.
- package/DESIGN.md +408 -0
- package/MIGRATION.md +301 -0
- package/README.md +41 -72
- package/dist/components/Alert/Alert.d.ts +14 -0
- package/dist/components/Alert/Alert.js +73 -0
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/Alert/index.js +2 -0
- package/dist/components/Avatar/Avatar.d.ts +5 -0
- package/dist/components/Avatar/Avatar.js +25 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/Badge/Badge.d.ts +23 -0
- package/dist/components/Badge/Badge.js +159 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Button/Button.d.ts +7 -0
- package/dist/components/Button/Button.js +44 -0
- package/dist/components/Button/button.variants.d.ts +22 -0
- package/dist/components/Button/button.variants.js +62 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.js +3 -0
- package/dist/components/Checkbox/Checkbox.d.ts +7 -0
- package/dist/components/Checkbox/Checkbox.js +23 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/index.js +2 -0
- package/dist/components/Chip/Chip.d.ts +17 -0
- package/dist/components/Chip/Chip.js +59 -0
- package/dist/components/Chip/index.d.ts +2 -0
- package/dist/components/Chip/index.js +2 -0
- package/dist/components/Combobox/Combobox.d.ts +31 -0
- package/dist/components/Combobox/Combobox.js +98 -0
- package/dist/components/Combobox/index.d.ts +1 -0
- package/dist/components/Combobox/index.js +2 -0
- package/dist/components/DataTable/DataTable.d.ts +24 -0
- package/dist/components/DataTable/DataTable.js +74 -0
- package/dist/components/DataTable/Table.d.ts +9 -0
- package/dist/components/DataTable/Table.js +57 -0
- package/dist/components/DataTable/index.d.ts +3 -0
- package/dist/components/DataTable/index.js +3 -0
- package/dist/components/DatePicker/DatePicker.d.ts +20 -0
- package/dist/components/DatePicker/DatePicker.js +74 -0
- package/dist/components/DatePicker/index.d.ts +1 -0
- package/dist/components/DatePicker/index.js +2 -0
- package/dist/components/Dialog/Dialog.d.ts +21 -0
- package/dist/components/Dialog/Dialog.js +50 -0
- package/dist/components/Dialog/index.d.ts +1 -0
- package/dist/components/Dialog/index.js +2 -0
- package/dist/components/Field/Field.d.ts +22 -0
- package/dist/components/Field/Field.js +43 -0
- package/dist/components/Field/index.d.ts +1 -0
- package/dist/components/Field/index.js +2 -0
- package/dist/components/Icon/Icon.d.ts +7 -0
- package/dist/components/Icon/Icon.js +13 -0
- package/dist/components/Icon/index.d.ts +13 -0
- package/dist/components/Icon/index.js +2 -0
- package/dist/components/Input/Input.d.ts +41 -0
- package/dist/components/Input/Input.js +87 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Label/Label.d.ts +3 -0
- package/dist/components/Label/Label.js +13 -0
- package/dist/components/Label/index.js +2 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +23 -0
- package/dist/components/MultiSelect/MultiSelect.js +99 -0
- package/dist/components/MultiSelect/index.d.ts +1 -0
- package/dist/components/MultiSelect/index.js +2 -0
- package/dist/components/NumberInput/NumberInput.d.ts +11 -0
- package/dist/components/NumberInput/NumberInput.js +58 -0
- package/dist/components/NumberInput/index.d.ts +1 -0
- package/dist/components/NumberInput/index.js +2 -0
- package/dist/components/Popover/Popover.d.ts +12 -0
- package/dist/components/Popover/Popover.js +20 -0
- package/dist/components/Popover/index.d.ts +1 -0
- package/dist/components/Popover/index.js +2 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +8 -0
- package/dist/components/RadioGroup/RadioGroup.js +30 -0
- package/dist/components/RadioGroup/index.d.ts +1 -0
- package/dist/components/RadioGroup/index.js +2 -0
- package/dist/components/Select/Select.d.ts +15 -0
- package/dist/components/Select/Select.js +83 -0
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/Spinner/Spinner.d.ts +9 -0
- package/dist/components/Spinner/Spinner.js +24 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Spinner/index.js +2 -0
- package/dist/components/Switch/Switch.d.ts +7 -0
- package/dist/components/Switch/Switch.js +23 -0
- package/dist/components/Switch/index.d.ts +1 -0
- package/dist/components/Switch/index.js +2 -0
- package/dist/components/Tabs/Tabs.d.ts +17 -0
- package/dist/components/Tabs/Tabs.js +78 -0
- package/dist/components/Tabs/index.d.ts +1 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/TimePicker/TimePicker.d.ts +20 -0
- package/dist/components/TimePicker/TimePicker.js +62 -0
- package/dist/components/TimePicker/index.d.ts +1 -0
- package/dist/components/TimePicker/index.js +2 -0
- package/dist/components/Toast/Toast.d.ts +57 -0
- package/dist/components/Toast/Toast.js +40 -0
- package/dist/components/Toast/index.d.ts +1 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/Tooltip/Tooltip.d.ts +12 -0
- package/dist/components/Tooltip/Tooltip.js +23 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Tooltip/index.js +2 -0
- package/dist/components/Typography/Typography.d.ts +13 -0
- package/dist/components/Typography/Typography.js +63 -0
- package/dist/components/Typography/index.d.ts +1 -0
- package/dist/components/Typography/index.js +2 -0
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/cn.js +6 -0
- package/dist/presets/SelectCountry/SelectCountry.d.ts +16 -0
- package/dist/presets/SelectCountry/SelectCountry.js +21 -0
- package/dist/presets/SelectCountry/countries.d.ts +11 -0
- package/dist/presets/SelectCountry/countries.js +120 -0
- package/dist/presets/SelectCountry/index.d.ts +2 -0
- package/dist/presets/SelectCountry/index.js +3 -0
- package/dist/presets/SelectPhone/SelectPhone.d.ts +15 -0
- package/dist/presets/SelectPhone/SelectPhone.js +21 -0
- package/dist/presets/SelectPhone/index.d.ts +2 -0
- package/dist/presets/SelectPhone/index.js +3 -0
- package/dist/presets/SelectPhone/phoneCodes.d.ts +7 -0
- package/dist/presets/SelectPhone/phoneCodes.js +131 -0
- package/dist/tailwind-preset.d.ts +10 -0
- package/dist/tailwind-preset.js +4 -0
- package/dist/test-setup.d.ts +0 -0
- package/dist/theme/colors.d.ts +57 -0
- package/dist/theme/colors.js +59 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.js +4 -0
- package/dist/theme/shapes.d.ts +17 -0
- package/dist/theme/shapes.js +18 -0
- package/dist/theme/spacing.d.ts +18 -0
- package/dist/theme/spacing.js +19 -0
- package/dist/theme.css +2 -0
- package/llms.txt +296 -736
- package/package.json +193 -69
- package/dist/index.css +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.es.js +0 -45361
- package/dist/src/commons/colors.d.ts +0 -47
- package/dist/src/commons/colors.es.js +0 -50
- package/dist/src/commons/shapes.d.ts +0 -15
- package/dist/src/commons/shapes.es.js +0 -18
- package/dist/src/commons/spacing.d.ts +0 -15
- package/dist/src/commons/spacing.es.js +0 -18
- package/dist/src/components/atoms/Avatar/Avatar.d.ts +0 -2
- package/dist/src/components/atoms/Avatar/index.d.ts +0 -2
- package/dist/src/components/atoms/Avatar/types.d.ts +0 -7
- package/dist/src/components/atoms/Badge/Badge.d.ts +0 -3
- package/dist/src/components/atoms/Badge/index.d.ts +0 -2
- package/dist/src/components/atoms/Badge/types.d.ts +0 -18
- package/dist/src/components/atoms/Button/Button.d.ts +0 -3
- package/dist/src/components/atoms/Button/ButtonV2.d.ts +0 -4
- package/dist/src/components/atoms/Button/index.d.ts +0 -4
- package/dist/src/components/atoms/Button/types.d.ts +0 -33
- package/dist/src/components/atoms/Checkbox/Checkbox.d.ts +0 -3
- package/dist/src/components/atoms/Checkbox/index.d.ts +0 -2
- package/dist/src/components/atoms/Checkbox/types.d.ts +0 -18
- package/dist/src/components/atoms/Datepicker/Datepicker.d.ts +0 -3
- package/dist/src/components/atoms/Datepicker/index.d.ts +0 -2
- package/dist/src/components/atoms/Datepicker/types.d.ts +0 -9
- package/dist/src/components/atoms/Icon/Icon.d.ts +0 -3
- package/dist/src/components/atoms/Icon/index.d.ts +0 -3
- package/dist/src/components/atoms/Icon/types.d.ts +0 -11
- package/dist/src/components/atoms/InputNumber/InputNumber.d.ts +0 -3
- package/dist/src/components/atoms/InputNumber/index.d.ts +0 -2
- package/dist/src/components/atoms/InputNumber/types.d.ts +0 -7
- package/dist/src/components/atoms/Label/Label.d.ts +0 -9
- package/dist/src/components/atoms/Popover/Popover.d.ts +0 -2
- package/dist/src/components/atoms/Popover/index.d.ts +0 -2
- package/dist/src/components/atoms/Popover/types.d.ts +0 -8
- package/dist/src/components/atoms/RadioButton/RadioButton.d.ts +0 -3
- package/dist/src/components/atoms/RadioButton/index.d.ts +0 -2
- package/dist/src/components/atoms/RadioButton/types.d.ts +0 -20
- package/dist/src/components/atoms/TextInput/TextInput.d.ts +0 -12
- package/dist/src/components/atoms/TextInput/index.d.ts +0 -1
- package/dist/src/components/atoms/TextInput/types.d.ts +0 -5
- package/dist/src/components/atoms/Timepicker/TimePicker.d.ts +0 -3
- package/dist/src/components/atoms/Timepicker/index.d.ts +0 -2
- package/dist/src/components/atoms/Timepicker/types.d.ts +0 -15
- package/dist/src/components/atoms/Toast/Toast.d.ts +0 -20
- package/dist/src/components/atoms/Toast/index.d.ts +0 -1
- package/dist/src/components/atoms/Toggle/Toggle.d.ts +0 -3
- package/dist/src/components/atoms/Toggle/index.d.ts +0 -2
- package/dist/src/components/atoms/Toggle/types.d.ts +0 -6
- package/dist/src/components/atoms/Typography/Typography.d.ts +0 -7
- package/dist/src/components/atoms/Typography/index.d.ts +0 -2
- package/dist/src/components/atoms/Typography/types.d.ts +0 -38
- package/dist/src/components/atoms/index.d.ts +0 -16
- package/dist/src/components/atoms/tooltips/Tooltip/Tooltip.d.ts +0 -2
- package/dist/src/components/atoms/tooltips/Tooltip/index.d.ts +0 -2
- package/dist/src/components/atoms/tooltips/Tooltip/types.d.ts +0 -10
- package/dist/src/components/atoms/tooltips/TooltipWrapper/TooltipWrapper.d.ts +0 -2
- package/dist/src/components/atoms/tooltips/TooltipWrapper/index.d.ts +0 -2
- package/dist/src/components/atoms/tooltips/TooltipWrapper/types.d.ts +0 -11
- package/dist/src/components/atoms/tooltips/index.d.ts +0 -2
- package/dist/src/components/index.d.ts +0 -3
- package/dist/src/components/molecules/Table/Table.d.ts +0 -3
- package/dist/src/components/molecules/Table/index.d.ts +0 -2
- package/dist/src/components/molecules/Table/types.d.ts +0 -28
- package/dist/src/components/molecules/alert/Alert.d.ts +0 -15
- package/dist/src/components/molecules/alert/index.d.ts +0 -1
- package/dist/src/components/molecules/dropdowns/Dropdown/Dropdown.d.ts +0 -3
- package/dist/src/components/molecules/dropdowns/Dropdown/index.d.ts +0 -2
- package/dist/src/components/molecules/dropdowns/Dropdown/types.d.ts +0 -33
- package/dist/src/components/molecules/dropdowns/DropdownCountry/DropdownCountry.d.ts +0 -5
- package/dist/src/components/molecules/dropdowns/DropdownCountry/index.d.ts +0 -1
- package/dist/src/components/molecules/dropdowns/DropdownFilter/DropdownFilter.d.ts +0 -3
- package/dist/src/components/molecules/dropdowns/DropdownFilter/index.d.ts +0 -1
- package/dist/src/components/molecules/dropdowns/DropdownFilter/types.d.ts +0 -38
- package/dist/src/components/molecules/dropdowns/DropdownMultiple/DropdownMultiple.d.ts +0 -3
- package/dist/src/components/molecules/dropdowns/DropdownMultiple/index.d.ts +0 -2
- package/dist/src/components/molecules/dropdowns/DropdownMultiple/types.d.ts +0 -11
- package/dist/src/components/molecules/dropdowns/DropdownPhone/DropdownPhone.d.ts +0 -6
- package/dist/src/components/molecules/dropdowns/DropdownPhone/index.d.ts +0 -1
- package/dist/src/components/molecules/dropdowns/index.d.ts +0 -5
- package/dist/src/components/molecules/index.d.ts +0 -4
- package/dist/src/components/molecules/tabs/Tab/Tab.d.ts +0 -3
- package/dist/src/components/molecules/tabs/Tab/index.d.ts +0 -2
- package/dist/src/components/molecules/tabs/Tab/types.d.ts +0 -16
- package/dist/src/components/molecules/tabs/TabButton/TabButton.d.ts +0 -3
- package/dist/src/components/molecules/tabs/TabButton/index.d.ts +0 -2
- package/dist/src/components/molecules/tabs/TabButton/types.d.ts +0 -15
- package/dist/src/components/molecules/tabs/index.d.ts +0 -2
- package/dist/src/components/organisms/Modal/Modal.d.ts +0 -3
- package/dist/src/components/organisms/Modal/ModalV2.d.ts +0 -53
- package/dist/src/components/organisms/Modal/index.d.ts +0 -3
- package/dist/src/components/organisms/Modal/types.d.ts +0 -24
- package/dist/src/components/organisms/index.d.ts +0 -1
- package/dist/src/constants/countries.d.ts +0 -7
- package/dist/src/hooks/useClickOutside.d.ts +0 -2
- package/dist/src/vite-env.d.ts +0 -1
- /package/dist/{src/components/atoms → components}/Label/index.d.ts +0 -0
package/llms.txt
CHANGED
|
@@ -1,782 +1,342 @@
|
|
|
1
|
-
# ctc-component-library
|
|
2
|
-
|
|
3
|
-
> CTC's React component library built with TypeScript, SCSS, and Ant Design foundations.
|
|
4
|
-
> Provides atoms, molecules, and organisms following atomic design principles.
|
|
5
|
-
|
|
6
|
-
> Generated on 2026-03-05
|
|
7
|
-
|
|
8
|
-
## Installation & Usage
|
|
9
|
-
|
|
10
|
-
```tsx
|
|
11
|
-
import { ComponentName } from 'ctc-component-library';
|
|
12
|
-
import 'ctc-component-library/dist/styles.css';
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Theme Imports
|
|
16
|
-
|
|
17
|
-
```tsx
|
|
18
|
-
import { colors } from 'ctc-component-library/theme/colors';
|
|
19
|
-
import { shapes } from 'ctc-component-library/theme/shapes';
|
|
20
|
-
import { spacing } from 'ctc-component-library/theme/spacing';
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Component Index
|
|
24
|
-
|
|
25
|
-
### Atoms
|
|
26
|
-
- Avatar
|
|
27
|
-
- Badge
|
|
28
|
-
- Button (has V2)
|
|
29
|
-
- Checkbox
|
|
30
|
-
- Datepicker
|
|
31
|
-
- Icon
|
|
32
|
-
- InputNumber
|
|
33
|
-
- Label
|
|
34
|
-
- Popover
|
|
35
|
-
- RadioButton
|
|
36
|
-
- TextInput
|
|
37
|
-
- Timepicker
|
|
38
|
-
- Toast
|
|
39
|
-
- Toggle
|
|
40
|
-
- Typography
|
|
41
|
-
- tooltips
|
|
42
|
-
|
|
43
|
-
### Molecules
|
|
44
|
-
- Table
|
|
45
|
-
- alert
|
|
46
|
-
- dropdowns
|
|
47
|
-
- tabs
|
|
48
|
-
|
|
49
|
-
### Organisms
|
|
50
|
-
- Modal (has V2)
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## Design Tokens
|
|
55
|
-
|
|
56
|
-
### Colors (`colors`)
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
export const colors = {
|
|
60
|
-
neutrals: {
|
|
61
|
-
Gray100: '#171a1a',
|
|
62
|
-
Gray80: '#303333',
|
|
63
|
-
Gray60: '#494d4b',
|
|
64
|
-
Gray40: '#b9bfbd',
|
|
65
|
-
Gray20: '#edf2f0',
|
|
66
|
-
Gray00: '#fcfffe'
|
|
67
|
-
},
|
|
68
|
-
mainB2B: {
|
|
69
|
-
MainGreenDark: '#001f19',
|
|
70
|
-
MainGreenDefault: '#1e5349',
|
|
71
|
-
MainGreenLight: '#6be3cd',
|
|
72
|
-
MainGreenLighter: '#d9fff5'
|
|
73
|
-
},
|
|
74
|
-
mainB2C: {
|
|
75
|
-
MainBlueDark: '#1d5bbc',
|
|
76
|
-
MainBlueDefault: '#468eff',
|
|
77
|
-
MainBlueLight: '#abccff',
|
|
78
|
-
MainBlueLighter: '#e2edff'
|
|
79
|
-
},
|
|
80
|
-
secondary: {
|
|
81
|
-
SecondaryPurpleDark: '#9335cc',
|
|
82
|
-
SecondayPurpleDefault: '#c15cff',
|
|
83
|
-
SecondayPurpleLight: '#dea8ff',
|
|
84
|
-
SecondayPurpleLighter: '#f9eeff',
|
|
85
|
-
SecondaryOrangeDark: '#ac5734',
|
|
86
|
-
SecondaryOrangeDefault: '#e57b43',
|
|
87
|
-
SecondaryOrangeLight: '#ffaa7d',
|
|
88
|
-
SecondaryOrangeLighter: '#ffefe7'
|
|
89
|
-
},
|
|
90
|
-
status: {
|
|
91
|
-
ErrorMain: '#c00808',
|
|
92
|
-
ErrorLight: '#ffe5e5',
|
|
93
|
-
SuccessMain: '#206614',
|
|
94
|
-
SuccessLight: '#c15cff',
|
|
95
|
-
AlertMain: '#9f760b',
|
|
96
|
-
AlertLight: '#fff1cc'
|
|
97
|
-
},
|
|
98
|
-
opacity: {
|
|
99
|
-
Opacidad100: 1,
|
|
100
|
-
Opacidad80: 0.8,
|
|
101
|
-
Opacidad60: 0.6,
|
|
102
|
-
Opacidad40: 0.4,
|
|
103
|
-
Opacidad20: 0.2
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Shapes (`shapes`) — border-radius values in px
|
|
109
|
-
|
|
110
|
-
```ts
|
|
111
|
-
export const shapes = {
|
|
112
|
-
x1: 4,
|
|
113
|
-
x2: 8,
|
|
114
|
-
x3: 12,
|
|
115
|
-
x4: 16,
|
|
116
|
-
x5: 20,
|
|
117
|
-
x6: 24,
|
|
118
|
-
x8: 32,
|
|
119
|
-
x10: 40,
|
|
120
|
-
x12: 48,
|
|
121
|
-
x14: 56,
|
|
122
|
-
x16: 64,
|
|
123
|
-
x18: 72,
|
|
124
|
-
x20: 80
|
|
125
|
-
};
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### Spacing (`spacing`) — spacing values in px
|
|
129
|
-
|
|
130
|
-
```ts
|
|
131
|
-
export const spacing = {
|
|
132
|
-
x1: 4,
|
|
133
|
-
x2: 8,
|
|
134
|
-
x3: 12,
|
|
135
|
-
x4: 16,
|
|
136
|
-
x5: 20,
|
|
137
|
-
x6: 24,
|
|
138
|
-
x8: 32,
|
|
139
|
-
x10: 40,
|
|
140
|
-
x12: 48,
|
|
141
|
-
x14: 56,
|
|
142
|
-
x16: 64,
|
|
143
|
-
x18: 72,
|
|
144
|
-
x20: 80
|
|
145
|
-
};
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
## Atoms
|
|
1
|
+
# ctc-component-library
|
|
151
2
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
**Path:** `src/components/atoms/Avatar`
|
|
155
|
-
|
|
156
|
-
**Exported types:** `AvatarProps`
|
|
157
|
-
|
|
158
|
-
<details>
|
|
159
|
-
<summary>Type definitions</summary>
|
|
3
|
+
> Librería de componentes React de Crack the Code — v1.0.0-alpha.3. React + TypeScript + Tailwind v4 + Radix + class-variance-authority (cva). **Solo subpath imports** (sin barrel raíz) para tree-shaking real. Este archivo se regenera en cada build desde el código fuente.
|
|
160
4
|
|
|
161
|
-
|
|
162
|
-
export interface AvatarProps {
|
|
163
|
-
text: string;
|
|
164
|
-
textColor?: string;
|
|
165
|
-
dataTestid?: string;
|
|
166
|
-
backgroundColor: string;
|
|
167
|
-
customClassName?: string;
|
|
168
|
-
}
|
|
169
|
-
```
|
|
5
|
+
## Cómo están construidos los componentes
|
|
170
6
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
7
|
+
- **Import por subpath:** cada componente vive en su propio entrypoint, ej. `import { Button } from 'ctc-component-library/button'`. No existe `import … from 'ctc-component-library'`.
|
|
8
|
+
- **Theme:** importar una vez en el root del consumer: `import 'ctc-component-library/theme.css'` (tokens + base + fuentes + utilities precompiladas). Consumers con Tailwind v4 pueden además usar el preset `ctc-component-library/tw-preset`.
|
|
9
|
+
- **Tokens en TS:** `ctc-component-library/theme` exporta `colors`, `spacing`, `shapes` (y sus tipos) para codegen/lógica.
|
|
10
|
+
- **Estilos:** Tailwind v4 utility classes + `class-variance-authority` para variantes. `cn()` (clsx + tailwind-merge) para componer clases.
|
|
11
|
+
- **Primitivos:** los compound components (Dialog, Select, Tabs, Popover, Tooltip…) envuelven Radix UI; respetan su API de partes (Trigger/Content/…).
|
|
12
|
+
- **Peer deps:** React `^18.2 || ^19`, react-dom idem.
|
|
176
13
|
|
|
177
|
-
|
|
14
|
+
## Componentes (26)
|
|
178
15
|
|
|
179
|
-
|
|
16
|
+
### Alert
|
|
180
17
|
|
|
181
|
-
|
|
182
|
-
|
|
18
|
+
- **Import:** `import { Alert, AlertTitle, AlertDescription } from 'ctc-component-library/alert'`
|
|
19
|
+
- **Exports:** `Alert`, `AlertTitle`, `AlertDescription`, `type AlertProps`
|
|
20
|
+
- **Variantes (cva):**
|
|
21
|
+
- `variant`: `info` | `success` | `warning` | `destructive` — default `info`
|
|
22
|
+
- `size`: `sm` | `lg` — default `lg`
|
|
23
|
+
- **AlertProps** (extends `React.HTMLAttributes<HTMLDivElement>`, `VariantProps<typeof alertVariants>`):
|
|
24
|
+
- `hideIcon?: boolean`
|
|
25
|
+
- `onDismiss?: () => void`
|
|
183
26
|
|
|
184
|
-
|
|
185
|
-
import { IconProps } from '../Icon/types';
|
|
186
|
-
|
|
187
|
-
export interface BadgeProps {
|
|
188
|
-
text?: string | React.ReactNode;
|
|
189
|
-
icon?: boolean;
|
|
190
|
-
dataTestid?: string;
|
|
191
|
-
type: 'quiet' | 'loud';
|
|
192
|
-
customClassName?: string;
|
|
193
|
-
iconType?: IconProps['type'];
|
|
194
|
-
iconName?: IconProps['iconName'];
|
|
195
|
-
customStyles?: React.CSSProperties;
|
|
196
|
-
version?: 'full' | 'minimal' | 'dot';
|
|
197
|
-
variant?: 'big' | 'medium' | 'small';
|
|
198
|
-
status: 'active' | 'inactive' | 'risk' | 'new';
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export type BadgePropsStatusText = {
|
|
202
|
-
[key in BadgeProps['status']]: string;
|
|
203
|
-
};
|
|
204
|
-
```
|
|
27
|
+
### Avatar
|
|
205
28
|
|
|
206
|
-
|
|
29
|
+
- **Import:** `import { Avatar, AvatarImage, AvatarFallback } from 'ctc-component-library/avatar'`
|
|
30
|
+
- **Exports:** `Avatar`, `AvatarImage`, `AvatarFallback`
|
|
207
31
|
|
|
208
|
-
|
|
32
|
+
### Badge
|
|
33
|
+
Badge — pixel-perfect to Figma
|
|
34
|
+
|
|
35
|
+
- **Import:** `import { Badge, BadgeDot, BadgeMinimal } from 'ctc-component-library/badge'`
|
|
36
|
+
- **Exports:** `Badge`, `BadgeDot`, `BadgeMinimal`, `type BadgeProps`, `type BadgeDotProps`, `type BadgeMinimalProps`
|
|
37
|
+
- **Variantes (cva):**
|
|
38
|
+
- `variant`: `success` | `destructive` | `alert` | `purple` | `brand` | `skyblue` | `neutral` | `outline` — default `neutral`
|
|
39
|
+
- `tone`: `quiet` | `loud` — default `quiet`
|
|
40
|
+
- `size`: `sm` | `md` | `lg` — default `md`
|
|
41
|
+
- **BadgeProps** (extends `React.HTMLAttributes<HTMLSpanElement>`, `VariantProps<typeof badgeVariants>`):
|
|
42
|
+
- `icon?: React.ReactNode`
|
|
43
|
+
- **BadgeDotProps** (extends `React.HTMLAttributes<HTMLSpanElement>`):
|
|
44
|
+
- `variant?: NonNullable<BadgeProps['variant']>`
|
|
45
|
+
- `size?: 'sm' | 'md'`
|
|
46
|
+
- **BadgeMinimalProps** (extends `React.HTMLAttributes<HTMLSpanElement>`):
|
|
47
|
+
- `variant?: NonNullable<BadgeProps['variant']>`
|
|
48
|
+
- `size?: 'sm' | 'md'`
|
|
209
49
|
|
|
210
50
|
### Button
|
|
211
51
|
|
|
212
|
-
**
|
|
213
|
-
|
|
214
|
-
**
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
export interface ButtonProps {
|
|
223
|
-
btnType?: 'button' | 'submit' | 'reset' | undefined;
|
|
224
|
-
icon?: MaterialSymbol;
|
|
225
|
-
text?: string;
|
|
226
|
-
primaryVariant?: 'neutral' | 'success' | 'error';
|
|
227
|
-
disabled?: boolean;
|
|
228
|
-
dataTestid?: string;
|
|
229
|
-
underline?: boolean;
|
|
230
|
-
customBtnClassName?: string;
|
|
231
|
-
iconPosition?: 'left' | 'right';
|
|
232
|
-
customStyles?: React.CSSProperties;
|
|
233
|
-
type: 'primary' | 'secondary' | 'tertiary';
|
|
234
|
-
iconType?: 'outlined' | 'rounded' | 'sharp';
|
|
235
|
-
size?: 'small' | 'medium' | 'big';
|
|
236
|
-
onClick?: () => void;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// v2
|
|
240
|
-
type PrimaryVariant = 'neutral' | 'success' | 'error' | 'skyblue';
|
|
241
|
-
|
|
242
|
-
export interface ButtonPropsV2
|
|
243
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
244
|
-
variant?: 'primary' | 'secondary' | 'tertiary';
|
|
245
|
-
primaryVariant?: PrimaryVariant;
|
|
246
|
-
size?: 'small' | 'medium' | 'big';
|
|
247
|
-
disabled?: boolean;
|
|
248
|
-
preffix?: React.ReactNode;
|
|
249
|
-
suffix?: React.ReactNode;
|
|
250
|
-
dataTestid?: string;
|
|
251
|
-
loading?: boolean;
|
|
252
|
-
iconOnly?: boolean;
|
|
253
|
-
underline?: boolean;
|
|
254
|
-
fullWidth?: boolean;
|
|
255
|
-
}
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
</details>
|
|
259
|
-
|
|
260
|
-
> **Note:** This component has a V2 version. Prefer V2 for new implementations.
|
|
261
|
-
|
|
262
|
-
---
|
|
52
|
+
- **Import:** `import { Button, buttonVariants } from 'ctc-component-library/button'`
|
|
53
|
+
- **Exports:** `Button`, `type ButtonProps`, `buttonVariants`, `type ButtonVariants`
|
|
54
|
+
- **Variantes (cva):**
|
|
55
|
+
- `variant`: `brand` | `skyblue` | `default` | `success` | `destructive` | `outline` | `outline-skyblue` | `ghost` — default `brand`
|
|
56
|
+
- `size`: `sm` | `md` | `lg` — default `md`
|
|
57
|
+
- `iconOnly`: `true` | `false` — default `false`
|
|
58
|
+
- `fullWidth`: `true` | `false` — default `false`
|
|
59
|
+
- **ButtonProps** (extends `React.ButtonHTMLAttributes<HTMLButtonElement>`, `ButtonVariants`):
|
|
60
|
+
- `asChild?: boolean`
|
|
61
|
+
- `loading?: boolean`
|
|
263
62
|
|
|
264
63
|
### Checkbox
|
|
265
64
|
|
|
266
|
-
**
|
|
267
|
-
|
|
268
|
-
**
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
65
|
+
- **Import:** `import { Checkbox } from 'ctc-component-library/checkbox'`
|
|
66
|
+
- **Exports:** `Checkbox`, `type CheckboxProps`
|
|
67
|
+
- **CheckboxProps** (extends `React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Roo…`):
|
|
68
|
+
- `size?: 'sm' | 'lg'`
|
|
69
|
+
|
|
70
|
+
### Chip
|
|
71
|
+
|
|
72
|
+
- **Import:** `import { Chip, ChipGroup } from 'ctc-component-library/chip'`
|
|
73
|
+
- **Exports:** `Chip`, `ChipGroup`, `type ChipProps`, `type DismissibleChipProps`, `type SelectableChipProps`
|
|
74
|
+
- **DismissibleChipProps** (extends `React.HTMLAttributes<HTMLDivElement>`):
|
|
75
|
+
- `variant: 'dismissible'`
|
|
76
|
+
- `disabled?: boolean`
|
|
77
|
+
- `onDismiss?: () => void`
|
|
78
|
+
- **SelectableChipProps** (extends `React.ButtonHTMLAttributes<HTMLButtonElement>`):
|
|
79
|
+
- `variant?: 'choice' | 'multi'`
|
|
80
|
+
- `selected?: boolean`
|
|
81
|
+
- **ChipProps:** `DismissibleChipProps | SelectableChipProps`
|
|
82
|
+
- **ChipGroupProps** (extends `React.HTMLAttributes<HTMLDivElement>`):
|
|
83
|
+
- `stagger?: boolean`
|
|
84
|
+
|
|
85
|
+
### Combobox
|
|
86
|
+
|
|
87
|
+
- **Import:** `import { Combobox } from 'ctc-component-library/combobox'`
|
|
88
|
+
- **Exports:** `Combobox`, `type ComboboxProps`, `type ComboboxOption`
|
|
89
|
+
- **ComboboxProps**:
|
|
90
|
+
- `options: ComboboxOption[]`
|
|
91
|
+
- `value?: string`
|
|
92
|
+
- `defaultValue?: string`
|
|
93
|
+
- `onValueChange?: (value: string) => void`
|
|
94
|
+
- `placeholder?: string`
|
|
95
|
+
- `searchPlaceholder?: string`
|
|
96
|
+
- `emptyText?: string`
|
|
97
|
+
- `disabled?: boolean`
|
|
98
|
+
- `size?: 'sm' | 'lg'`
|
|
99
|
+
- `className?: string`
|
|
100
|
+
- `onSearch?: (query: string) => void`
|
|
101
|
+
- `searching?: boolean`
|
|
102
|
+
- `hasMore?: boolean`
|
|
103
|
+
- `onEndReached?: () => void`
|
|
104
|
+
- `loading?: boolean`
|
|
105
|
+
|
|
106
|
+
### DataTable
|
|
107
|
+
|
|
108
|
+
- **Import:** `import { DataTable, Table, TableHeader, TableBody, … } from 'ctc-component-library/data-table'`
|
|
109
|
+
- **Exports:** `DataTable`, `type DataTableProps`, `type ExpandableConfig`, `Table`, `TableHeader`, `TableBody`, `TableFooter`, `TableHead`, `TableRow`, `TableCell`, `TableCaption`, `type ColumnDef`, `type ColumnFiltersState`, `type SortingState`
|
|
110
|
+
- **DataTableProps**:
|
|
111
|
+
- `columns: ColumnDef<T>[]`
|
|
112
|
+
- `data: T[]`
|
|
113
|
+
- `expandable?: ExpandableConfig<T>`
|
|
114
|
+
- `className?: string`
|
|
115
|
+
- `emptyText?: string`
|
|
116
|
+
- `loading?: boolean`
|
|
117
|
+
- `'data-testid'?: string`
|
|
118
|
+
|
|
119
|
+
### DatePicker
|
|
120
|
+
Capitalize first letter of weekday name (e.g. "lun." → "Lun") and trim trailing periods
|
|
121
|
+
|
|
122
|
+
- **Import:** `import { DatePicker } from 'ctc-component-library/date-picker'`
|
|
123
|
+
- **Exports:** `DatePicker`, `type DatePickerProps`
|
|
124
|
+
- **DatePickerProps**:
|
|
125
|
+
- `value?: Date`
|
|
126
|
+
- `defaultValue?: Date`
|
|
127
|
+
- `onValueChange?: (date: Date | undefined) => void`
|
|
128
|
+
- `placeholder?: string`
|
|
129
|
+
- `disabled?: boolean`
|
|
130
|
+
- `locale?: string`
|
|
131
|
+
- `size?: 'sm' | 'lg'`
|
|
132
|
+
- `className?: string`
|
|
133
|
+
- `calendarProps?: Omit<DayPickerProps, 'mode' | 'selected' | 'onSelect'>`
|
|
134
|
+
- `'data-testid'?: string`
|
|
135
|
+
|
|
136
|
+
### Dialog
|
|
137
|
+
|
|
138
|
+
- **Import:** `import { Dialog, DialogTrigger, DialogPortal, DialogClose, … } from 'ctc-component-library/dialog'`
|
|
139
|
+
- **Exports:** `Dialog`, `DialogTrigger`, `DialogPortal`, `DialogClose`, `DialogOverlay`, `DialogContent`, `DialogHeader`, `DialogFooter`, `DialogTitle`, `DialogDescription`, `type DialogContentProps`
|
|
140
|
+
- **DialogContentProps** (extends `React.ComponentPropsWithoutRef<typeof DialogPrimitive.Conte…`):
|
|
141
|
+
- `hideCloseButton?: boolean`
|
|
142
|
+
|
|
143
|
+
### Field
|
|
144
|
+
Visual size, paired with the input it labels
|
|
145
|
+
|
|
146
|
+
- **Import:** `import { FieldGroup, Field, FieldLabel, FieldDescription, … } from 'ctc-component-library/field'`
|
|
147
|
+
- **Exports:** `FieldGroup`, `Field`, `FieldLabel`, `FieldDescription`, `FieldSet`, `FieldLegend`, `type FieldProps`, `type FieldLabelProps`
|
|
148
|
+
- **FieldProps** (extends `React.HTMLAttributes<HTMLDivElement>`):
|
|
149
|
+
- `asChild?: boolean`
|
|
150
|
+
- `'data-invalid'?: boolean`
|
|
151
|
+
- `'data-disabled'?: boolean`
|
|
152
|
+
- **FieldLabelProps** (extends `React.LabelHTMLAttributes<HTMLLabelElement>`):
|
|
153
|
+
- `size?: 'sm' | 'lg'`
|
|
322
154
|
|
|
323
155
|
### Icon
|
|
324
156
|
|
|
325
|
-
**
|
|
326
|
-
|
|
327
|
-
**
|
|
328
|
-
|
|
329
|
-
<details>
|
|
330
|
-
<summary>Type definitions</summary>
|
|
157
|
+
- **Import:** `import { Icon } from 'ctc-component-library/icon'`
|
|
158
|
+
- **Exports:** `Icon`, `type IconProps`, `type PhosphorIconType`, `type PhosphorIconProps`
|
|
159
|
+
- **IconProps** (extends `Omit<PhosphorIconProps, 'ref'>`):
|
|
160
|
+
- `icon: PhosphorIconType`
|
|
331
161
|
|
|
332
|
-
|
|
333
|
-
|
|
162
|
+
### Input
|
|
163
|
+
Input — pixel-perfect to Figma spec
|
|
334
164
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
</details>
|
|
347
|
-
|
|
348
|
-
---
|
|
349
|
-
|
|
350
|
-
### InputNumber
|
|
351
|
-
|
|
352
|
-
**Path:** `src/components/atoms/InputNumber`
|
|
353
|
-
|
|
354
|
-
**Exported types:** `InputNumberProps`
|
|
355
|
-
|
|
356
|
-
<details>
|
|
357
|
-
<summary>Type definitions</summary>
|
|
358
|
-
|
|
359
|
-
```typescript
|
|
360
|
-
import { InputProps } from 'antd';
|
|
361
|
-
|
|
362
|
-
export interface InputNumberProps extends InputProps {
|
|
363
|
-
customClassName?: string;
|
|
364
|
-
disabled?: boolean;
|
|
365
|
-
dataTestid?: string;
|
|
366
|
-
numberType?: 'decimal' | 'integer';
|
|
367
|
-
}
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
</details>
|
|
371
|
-
|
|
372
|
-
---
|
|
165
|
+
- **Import:** `import { Input, inputVariants, InputGroup, InputGroupInput, … } from 'ctc-component-library/input'`
|
|
166
|
+
- **Exports:** `Input`, `inputVariants`, `InputGroup`, `InputGroupInput`, `InputGroupPrefix`, `InputGroupSuffix`, `InputGroupBadge`, `type InputProps`, `type InputGroupProps`
|
|
167
|
+
- **Variantes (cva):**
|
|
168
|
+
- `size`: `sm` | `lg` — default `sm`
|
|
169
|
+
- **InputProps** (extends `Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>`, `VariantProps<typeof inputVariants>`)
|
|
170
|
+
- **InputGroupProps** (extends `React.HTMLAttributes<HTMLDivElement>`):
|
|
171
|
+
- `size?: 'sm' | 'lg'`
|
|
172
|
+
- `disabled?: boolean`
|
|
173
|
+
- `invalid?: boolean`
|
|
373
174
|
|
|
374
175
|
### Label
|
|
375
176
|
|
|
376
|
-
**
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
type
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
177
|
+
- **Import:** `import { Label } from 'ctc-component-library/label'`
|
|
178
|
+
- **Exports:** `Label`
|
|
179
|
+
|
|
180
|
+
### MultiSelect
|
|
181
|
+
|
|
182
|
+
- **Import:** `import { MultiSelect } from 'ctc-component-library/multi-select'`
|
|
183
|
+
- **Exports:** `MultiSelect`, `type MultiSelectProps`, `type MultiSelectOption`
|
|
184
|
+
- **MultiSelectProps**:
|
|
185
|
+
- `options: MultiSelectOption[]`
|
|
186
|
+
- `value?: string[]`
|
|
187
|
+
- `defaultValue?: string[]`
|
|
188
|
+
- `onValueChange?: (value: string[]) => void`
|
|
189
|
+
- `placeholder?: string`
|
|
190
|
+
- `searchPlaceholder?: string`
|
|
191
|
+
- `emptyText?: string`
|
|
192
|
+
- `maxTags?: number`
|
|
193
|
+
- `disabled?: boolean`
|
|
194
|
+
- `size?: 'sm' | 'lg'`
|
|
195
|
+
- `className?: string`
|
|
196
|
+
|
|
197
|
+
### NumberInput
|
|
198
|
+
|
|
199
|
+
- **Import:** `import { NumberInput } from 'ctc-component-library/number-input'`
|
|
200
|
+
- **Exports:** `NumberInput`, `type NumberInputProps`
|
|
201
|
+
- **NumberInputProps** (extends `Omit<InputProps, 'type' | 'value' | 'defaultValue' | 'onCha…`):
|
|
202
|
+
- `value?: number`
|
|
203
|
+
- `defaultValue?: number`
|
|
204
|
+
- `min?: number`
|
|
205
|
+
- `max?: number`
|
|
206
|
+
- `step?: number`
|
|
207
|
+
- `onValueChange?: (value: number | undefined) => void`
|
|
394
208
|
|
|
395
209
|
### Popover
|
|
396
210
|
|
|
397
|
-
**
|
|
398
|
-
|
|
399
|
-
**
|
|
400
|
-
|
|
401
|
-
<details>
|
|
402
|
-
<summary>Type definitions</summary>
|
|
403
|
-
|
|
404
|
-
```typescript
|
|
405
|
-
import {PopoverProps as AntDPopoverProps} from 'antd'
|
|
406
|
-
|
|
407
|
-
export interface PopoverProps extends AntDPopoverProps{
|
|
408
|
-
dataTestid?: string;
|
|
409
|
-
customClassName?: string;
|
|
410
|
-
children: React.ReactNode;
|
|
411
|
-
customStyles?: React.CSSProperties;
|
|
412
|
-
}
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
</details>
|
|
416
|
-
|
|
417
|
-
---
|
|
418
|
-
|
|
419
|
-
### RadioButton
|
|
420
|
-
|
|
421
|
-
**Path:** `src/components/atoms/RadioButton`
|
|
422
|
-
|
|
423
|
-
**Exported types:** `RadioOption`, `RadioButtonProps`
|
|
424
|
-
|
|
425
|
-
<details>
|
|
426
|
-
<summary>Type definitions</summary>
|
|
427
|
-
|
|
428
|
-
```typescript
|
|
429
|
-
import { RadioChangeEvent, RadioGroupProps } from 'antd';
|
|
211
|
+
- **Import:** `import { Popover, PopoverTrigger, PopoverAnchor, PopoverClose, … } from 'ctc-component-library/popover'`
|
|
212
|
+
- **Exports:** `Popover`, `PopoverTrigger`, `PopoverAnchor`, `PopoverClose`, `PopoverPortal`, `PopoverContent`, `type PopoverContentProps`
|
|
213
|
+
- **PopoverContentProps** (extends `React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Cont…`):
|
|
214
|
+
- `arrow?: boolean`
|
|
430
215
|
|
|
431
|
-
|
|
432
|
-
label: string | number | boolean;
|
|
433
|
-
value: string | number | boolean;
|
|
434
|
-
disabled?: boolean;
|
|
435
|
-
checked?: boolean;
|
|
436
|
-
defaultChecked?: boolean;
|
|
437
|
-
}
|
|
216
|
+
### RadioGroup
|
|
438
217
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
defaultCheckedItem?: string;
|
|
444
|
-
checkedItem?: string;
|
|
445
|
-
customClassName?: string;
|
|
446
|
-
customStyles?: React.CSSProperties;
|
|
447
|
-
disabledGroup?: boolean;
|
|
448
|
-
onChange?: (e: RadioChangeEvent) => void;
|
|
449
|
-
}
|
|
450
|
-
```
|
|
218
|
+
- **Import:** `import { RadioGroup, RadioGroupItem } from 'ctc-component-library/radio-group'`
|
|
219
|
+
- **Exports:** `RadioGroup`, `RadioGroupItem`
|
|
220
|
+
- **RadioGroupProps** (extends `React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.R…`):
|
|
221
|
+
- `size?: 'sm' | 'lg'`
|
|
451
222
|
|
|
452
|
-
|
|
223
|
+
### Select
|
|
453
224
|
|
|
454
|
-
|
|
225
|
+
- **Import:** `import { Select, SelectGroup, SelectValue, SelectTrigger, … } from 'ctc-component-library/select'`
|
|
226
|
+
- **Exports:** `Select`, `SelectGroup`, `SelectValue`, `SelectTrigger`, `SelectContent`, `SelectLabel`, `SelectItem`, `SelectSeparator`, `SelectScrollUpButton`, `SelectScrollDownButton`, `type SelectTriggerProps`
|
|
227
|
+
- **SelectTriggerProps** (extends `React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigg…`):
|
|
228
|
+
- `size?: 'sm' | 'lg'`
|
|
455
229
|
|
|
456
|
-
###
|
|
230
|
+
### Spinner
|
|
457
231
|
|
|
458
|
-
**
|
|
232
|
+
- **Import:** `import { Spinner } from 'ctc-component-library/spinner'`
|
|
233
|
+
- **Exports:** `Spinner`, `type SpinnerProps`
|
|
234
|
+
- **Variantes (cva):**
|
|
235
|
+
- `size`: `sm` | `md` | `lg` — default `md`
|
|
236
|
+
- **SpinnerProps** (extends `React.SVGAttributes<SVGSVGElement>`, `VariantProps<typeof spinnerVariants>`)
|
|
459
237
|
|
|
460
|
-
|
|
238
|
+
### Switch
|
|
461
239
|
|
|
462
|
-
|
|
463
|
-
|
|
240
|
+
- **Import:** `import { Switch } from 'ctc-component-library/switch'`
|
|
241
|
+
- **Exports:** `Switch`, `type SwitchProps`
|
|
242
|
+
- **SwitchProps** (extends `React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>`):
|
|
243
|
+
- `size?: 'sm' | 'lg'`
|
|
464
244
|
|
|
465
|
-
|
|
466
|
-
export const INPUT_SIZE = {
|
|
467
|
-
small: 'small',
|
|
468
|
-
big: 'big'
|
|
469
|
-
} as const;
|
|
245
|
+
### Tabs
|
|
470
246
|
|
|
471
|
-
|
|
472
|
-
|
|
247
|
+
- **Import:** `import { Tabs, TabsList, TabsTrigger, TabsContent } from 'ctc-component-library/tabs'`
|
|
248
|
+
- **Exports:** `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`, `type TabsProps`
|
|
249
|
+
- **TabsProps** (extends `React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root>`):
|
|
250
|
+
- `variant?: TabsVariant`
|
|
251
|
+
- `size?: TabsSize`
|
|
252
|
+
- `spacing?: TabsSpacing`
|
|
473
253
|
|
|
474
|
-
|
|
254
|
+
### TimePicker
|
|
475
255
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
export interface TimepickerProps {
|
|
489
|
-
dataTestId?: string;
|
|
490
|
-
disabled?: boolean;
|
|
491
|
-
customClassName?: string;
|
|
492
|
-
customStyles?: React.CSSProperties;
|
|
493
|
-
time?: { hour: string | number; minutes: string | number };
|
|
494
|
-
onTimeChange?: (newTime: {
|
|
495
|
-
hour: string | number;
|
|
496
|
-
minutes: string | number;
|
|
497
|
-
}) => void;
|
|
498
|
-
}
|
|
499
|
-
```
|
|
500
|
-
|
|
501
|
-
</details>
|
|
502
|
-
|
|
503
|
-
---
|
|
256
|
+
- **Import:** `import { TimePicker } from 'ctc-component-library/time-picker'`
|
|
257
|
+
- **Exports:** `TimePicker`, `type TimePickerProps`, `type TimeValue`
|
|
258
|
+
- **TimePickerProps**:
|
|
259
|
+
- `value?: TimeValue`
|
|
260
|
+
- `defaultValue?: TimeValue`
|
|
261
|
+
- `onValueChange?: (value: TimeValue) => void`
|
|
262
|
+
- `minuteStep?: number`
|
|
263
|
+
- `hour12?: boolean`
|
|
264
|
+
- `disabled?: boolean`
|
|
265
|
+
- `size?: 'sm' | 'lg'`
|
|
266
|
+
- `className?: string`
|
|
267
|
+
- `'data-testid'?: string`
|
|
504
268
|
|
|
505
269
|
### Toast
|
|
270
|
+
CTC-themed Toaster. Mount once at the root of the app
|
|
506
271
|
|
|
507
|
-
**
|
|
508
|
-
|
|
509
|
-
<details>
|
|
510
|
-
<summary>Type definitions</summary>
|
|
511
|
-
|
|
512
|
-
```typescript
|
|
513
|
-
type NotificationType = 'success' | 'error' | 'loading';
|
|
514
|
-
|
|
515
|
-
type Toast = Omit<ArgsProps, 'message'> & {
|
|
516
|
-
debug?: boolean;
|
|
517
|
-
action?: React.ReactNode;
|
|
518
|
-
};
|
|
519
|
-
|
|
520
|
-
interface ToastContextProps {
|
|
521
|
-
toast: {
|
|
522
|
-
contextHolder: React.ReactNode;
|
|
523
|
-
success: (message: React.ReactNode, props?: Toast) => void;
|
|
524
|
-
error: (message: React.ReactNode, props?: Toast) => void;
|
|
525
|
-
loading: (message: React.ReactNode, props?: Toast) => void;
|
|
526
|
-
close: () => void;
|
|
527
|
-
};
|
|
528
|
-
}
|
|
529
|
-
```
|
|
530
|
-
|
|
531
|
-
</details>
|
|
532
|
-
|
|
533
|
-
---
|
|
272
|
+
- **Import:** `import { Toaster, toast } from 'ctc-component-library/toast'`
|
|
273
|
+
- **Exports:** `Toaster`, `toast`, `type ToasterProps`
|
|
534
274
|
|
|
535
|
-
###
|
|
275
|
+
### Tooltip
|
|
276
|
+
TooltipProvider with CTC defaults: 400ms delay before showing,
|
|
536
277
|
|
|
537
|
-
**
|
|
538
|
-
|
|
539
|
-
**Exported types:** `ToggleProps`
|
|
540
|
-
|
|
541
|
-
<details>
|
|
542
|
-
<summary>Type definitions</summary>
|
|
543
|
-
|
|
544
|
-
```typescript
|
|
545
|
-
import { SwitchProps } from 'antd';
|
|
546
|
-
|
|
547
|
-
export interface ToggleProps extends SwitchProps {
|
|
548
|
-
dataTestId?: string;
|
|
549
|
-
disabled?: boolean;
|
|
550
|
-
customClassName?: string;
|
|
551
|
-
}
|
|
552
|
-
```
|
|
553
|
-
|
|
554
|
-
</details>
|
|
555
|
-
|
|
556
|
-
---
|
|
278
|
+
- **Import:** `import { TooltipProvider, Tooltip, TooltipTrigger, TooltipPortal, … } from 'ctc-component-library/tooltip'`
|
|
279
|
+
- **Exports:** `TooltipProvider`, `Tooltip`, `TooltipTrigger`, `TooltipPortal`, `TooltipContent`
|
|
557
280
|
|
|
558
281
|
### Typography
|
|
559
282
|
|
|
560
|
-
**
|
|
561
|
-
|
|
562
|
-
**
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
</details>
|
|
621
|
-
|
|
622
|
-
---
|
|
623
|
-
|
|
624
|
-
### tooltips
|
|
625
|
-
|
|
626
|
-
**Path:** `src/components/atoms/tooltips`
|
|
627
|
-
|
|
628
|
-
---
|
|
629
|
-
|
|
630
|
-
## Molecules
|
|
631
|
-
|
|
632
|
-
### Table
|
|
633
|
-
|
|
634
|
-
**Path:** `src/components/molecules/Table`
|
|
635
|
-
|
|
636
|
-
**Exported types:** `TableExpandableConfig`, `TableProps`
|
|
637
|
-
|
|
638
|
-
<details>
|
|
639
|
-
<summary>Type definitions</summary>
|
|
640
|
-
|
|
641
|
-
```typescript
|
|
642
|
-
import { ColumnsType } from 'antd/es/table';
|
|
643
|
-
import { TableProps as TablePropsAntD } from 'antd';
|
|
644
|
-
import { TablePaginationConfig } from 'antd/es/table';
|
|
645
|
-
import { FilterValue, SorterResult } from 'antd/es/table/interface';
|
|
646
|
-
import type { ExpandableConfig } from 'antd/es/table/interface';
|
|
647
|
-
|
|
648
|
-
export type { ExpandableConfig };
|
|
649
|
-
|
|
650
|
-
export interface TableExpandableConfig<T> extends ExpandableConfig<T> {
|
|
651
|
-
expandedRowData?: (record: T) => T[];
|
|
652
|
-
expandedRowColumns?: ColumnsType<T>;
|
|
653
|
-
alignSubRowsWithParent?: boolean;
|
|
654
|
-
expandedRowNestedClassName?: string;
|
|
655
|
-
expandedRowNestedStyle?: React.CSSProperties;
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
export interface TableProps<T>
|
|
659
|
-
extends Omit<TablePropsAntD<T>, 'columns' | 'data' | 'onChange'> {
|
|
660
|
-
columns: ColumnsType<T>;
|
|
661
|
-
heightBodyScrollable?: number;
|
|
662
|
-
widthBodyScrollable?: number;
|
|
663
|
-
onChange?: (
|
|
664
|
-
pagination: TablePaginationConfig,
|
|
665
|
-
filters: Record<string, FilterValue | null>,
|
|
666
|
-
sorter: SorterResult<T> | SorterResult<T>[],
|
|
667
|
-
extra: { currentDataSource: T[]; action: 'paginate' | 'sort' | 'filter' }
|
|
668
|
-
) => void;
|
|
669
|
-
data: T[];
|
|
670
|
-
dataTestid?: string;
|
|
671
|
-
className?: string;
|
|
672
|
-
customStyles?: React.CSSProperties;
|
|
673
|
-
expandable?: TableExpandableConfig<T>;
|
|
674
|
-
}
|
|
675
|
-
```
|
|
676
|
-
|
|
677
|
-
</details>
|
|
678
|
-
|
|
679
|
-
---
|
|
680
|
-
|
|
681
|
-
### alert
|
|
682
|
-
|
|
683
|
-
**Path:** `src/components/molecules/alert`
|
|
684
|
-
|
|
685
|
-
**Exported types:** `AlertVariant`, `AlertSize`
|
|
686
|
-
|
|
687
|
-
<details>
|
|
688
|
-
<summary>Type definitions</summary>
|
|
689
|
-
|
|
690
|
-
```typescript
|
|
691
|
-
type AlertVariant = 'destructive' | 'warning' | 'success' | 'info';
|
|
692
|
-
|
|
693
|
-
type AlertSize = 'small' | 'big';
|
|
694
|
-
|
|
695
|
-
type AlertChildrenProps<T extends React.ElementType> =
|
|
696
|
-
React.ComponentProps<T> & {
|
|
697
|
-
children: ReactNode;
|
|
698
|
-
};
|
|
699
|
-
|
|
700
|
-
type AlertProps = AlertChildrenProps<'div'> & {
|
|
701
|
-
variant?: AlertVariant;
|
|
702
|
-
size?: AlertSize;
|
|
703
|
-
};
|
|
704
|
-
```
|
|
705
|
-
|
|
706
|
-
</details>
|
|
707
|
-
|
|
708
|
-
---
|
|
709
|
-
|
|
710
|
-
### dropdowns
|
|
711
|
-
|
|
712
|
-
**Path:** `src/components/molecules/dropdowns`
|
|
713
|
-
|
|
714
|
-
---
|
|
715
|
-
|
|
716
|
-
### tabs
|
|
717
|
-
|
|
718
|
-
**Path:** `src/components/molecules/tabs`
|
|
719
|
-
|
|
720
|
-
---
|
|
721
|
-
|
|
722
|
-
## Organisms
|
|
723
|
-
|
|
724
|
-
### Modal
|
|
725
|
-
|
|
726
|
-
**Path:** `src/components/organisms/Modal`
|
|
727
|
-
|
|
728
|
-
**Exported types:** `ModalProps`
|
|
729
|
-
|
|
730
|
-
<details>
|
|
731
|
-
<summary>Type definitions</summary>
|
|
732
|
-
|
|
733
|
-
```typescript
|
|
734
|
-
import { ModalProps as AntDModalProps } from 'antd';
|
|
735
|
-
|
|
736
|
-
import { ButtonProps } from '../../atoms/Button/types';
|
|
737
|
-
|
|
738
|
-
export interface ModalProps extends AntDModalProps {
|
|
739
|
-
title?: string;
|
|
740
|
-
description?: string;
|
|
741
|
-
linkButtonUnderline?: boolean;
|
|
742
|
-
type?: 'big' | 'small';
|
|
743
|
-
isModalOpen: boolean;
|
|
744
|
-
primaryButtonText?: string;
|
|
745
|
-
primaryButtonVariant?: 'neutral' | 'success' | 'error';
|
|
746
|
-
primaryButtonSize?: ButtonProps['size'];
|
|
747
|
-
linkButtonText?: string;
|
|
748
|
-
bodyContent?: React.ReactNode;
|
|
749
|
-
bigTypeContent?: React.ReactNode;
|
|
750
|
-
customStyles?: React.CSSProperties;
|
|
751
|
-
primaryButtonIsDisabled?: boolean;
|
|
752
|
-
dataTestId?: string;
|
|
753
|
-
customClassName?: string;
|
|
754
|
-
handlePrimaryButton?: () => void;
|
|
755
|
-
handleLinkButton?: () => void;
|
|
756
|
-
handleClose?: () => void;
|
|
757
|
-
maskClosable?: boolean;
|
|
758
|
-
}
|
|
759
|
-
```
|
|
760
|
-
|
|
761
|
-
</details>
|
|
762
|
-
|
|
763
|
-
> **Note:** This component has a V2 version. Prefer V2 for new implementations.
|
|
764
|
-
|
|
765
|
-
---
|
|
766
|
-
|
|
767
|
-
## Common Patterns
|
|
768
|
-
|
|
769
|
-
### Error handling
|
|
770
|
-
Most form components accept `errors: string | string[]` to display validation messages.
|
|
771
|
-
|
|
772
|
-
### Sizes
|
|
773
|
-
Most components support `size: "small" | "big"` (default: `"small"`). Buttons also support `"medium"`.
|
|
774
|
-
|
|
775
|
-
### Custom styling
|
|
776
|
-
All components accept `customClassName` and `customStyles` for overrides.
|
|
777
|
-
|
|
778
|
-
### Testing
|
|
779
|
-
All components expose `dataTestid` (or `dataTestId`) for test selectors.
|
|
780
|
-
|
|
781
|
-
### CSS classes
|
|
782
|
-
BEM convention: `ctc-{component}`, `ctc-{component}--{modifier}`.
|
|
283
|
+
- **Import:** `import { Typography } from 'ctc-component-library/typography'`
|
|
284
|
+
- **Exports:** `Typography`, `type TypographyProps`
|
|
285
|
+
- **Variantes (cva):**
|
|
286
|
+
- `variant`: `h1` | `h2` | `h3` | `h4` | `h5` | `body-1` | `body-2` | `body-3` | `body-4` | `body-5` | `body-6` | `button-1` | `button-2` — default `body-4`
|
|
287
|
+
- `underline`: `true` | `false` — default `false`
|
|
288
|
+
- `bolder`: `true` | `false` — default `false`
|
|
289
|
+
- **TypographyProps** (extends `React.HTMLAttributes<HTMLElement>`, `VariantProps<typeof typographyVariants>`):
|
|
290
|
+
- `asChild?: boolean`
|
|
291
|
+
- `as?: keyof React.JSX.IntrinsicElements`
|
|
292
|
+
|
|
293
|
+
## Presets (2)
|
|
294
|
+
|
|
295
|
+
Composiciones pre-armadas sobre los componentes base.
|
|
296
|
+
|
|
297
|
+
### SelectCountry
|
|
298
|
+
|
|
299
|
+
- **Import:** `import { SelectCountry, countries } from 'ctc-component-library/select-country'`
|
|
300
|
+
- **Exports:** `SelectCountry`, `type SelectCountryProps`, `countries`, `type Country`
|
|
301
|
+
- **SelectCountryProps**:
|
|
302
|
+
- `value?: string`
|
|
303
|
+
- `defaultValue?: string`
|
|
304
|
+
- `onValueChange?: (code: string) => void`
|
|
305
|
+
- `countries?: Country[]`
|
|
306
|
+
- `placeholder?: string`
|
|
307
|
+
- `disabled?: boolean`
|
|
308
|
+
- `size?: 'sm' | 'lg'`
|
|
309
|
+
- `className?: string`
|
|
310
|
+
|
|
311
|
+
### SelectPhone
|
|
312
|
+
|
|
313
|
+
- **Import:** `import { SelectPhone, phoneCodes } from 'ctc-component-library/select-phone'`
|
|
314
|
+
- **Exports:** `SelectPhone`, `type SelectPhoneProps`, `phoneCodes`, `type PhoneCode`
|
|
315
|
+
- **SelectPhoneProps**:
|
|
316
|
+
- `value?: string`
|
|
317
|
+
- `defaultValue?: string`
|
|
318
|
+
- `onValueChange?: (code: string) => void`
|
|
319
|
+
- `codes?: PhoneCode[]`
|
|
320
|
+
- `placeholder?: string`
|
|
321
|
+
- `disabled?: boolean`
|
|
322
|
+
- `size?: 'sm' | 'lg'`
|
|
323
|
+
- `className?: string`
|
|
324
|
+
|
|
325
|
+
## Theme tokens
|
|
326
|
+
|
|
327
|
+
### TS (`ctc-component-library/theme`)
|
|
328
|
+
- `colors`: `{"neutrals":{"Gray100":"#171a1a","Gray80":"#303333","Gray60":"#494d4b","Gray40":"#b9bfbd","Gray20":"#edf2f0","Gray00":"#fcfffe"},"primary":{"Dark":"#001f19","Default":"#1e5349","Light":"#6be3d7","Lighter":"#daf2f0"},"skyblue":{"Default":"#468eff","Hover":"#84b2fb","Lighter":"#e2f2ff"},"secondary":{"Dark":"#1d5bbc","Default":"#1d5bbc","Light":"#bfe1fc","Lighter":"#e2f2ff"},"purple":{"Dark":"#5a52ad","Default":"#756dc8","Light":"#aea7f9","Lighter":"#dddaff"},"orange":{"Dark":"#ac5734","Default":"#e57b43","Light":"#ffaa7d","Lighter":"#ffefe7"},"status":{"Error":"#c00808","ErrorHover":"#cc3939","ErrorLight":"#ffe5e5","Success":"#206614","SuccessHover":"#4c8543","SuccessLight":"#e5ffea","Alert":"#9f760b","AlertLight":"#fff1cc"},"opacity":{"Opacidad100":1,"Opacidad80":0.8,"Opacidad60":0.6,"Opacidad40":0.4,"Opacidad20":0.2}}`
|
|
329
|
+
- `spacing`: `{"zero":0,"x1":4,"x2":8,"x3":12,"x4":16,"x5":20,"x6":24,"x8":32,"x10":40,"x12":48,"x14":56,"x16":64,"x18":72,"x20":80}`
|
|
330
|
+
- `shapes`: `{"x1":4,"x2":8,"x3":12,"x4":16,"x5":20,"x6":24,"x8":32,"x10":40,"x12":48,"x14":56,"x16":64,"x18":72,"x20":80}`
|
|
331
|
+
|
|
332
|
+
### CSS custom properties (`@theme` en theme.css)
|
|
333
|
+
- **color** (42): `--color-gray-100`, `--color-gray-80`, `--color-gray-60`, `--color-gray-40`, `--color-gray-20`, `--color-gray-00`, `--color-primary-dark`, `--color-primary`, `--color-primary-light`, `--color-primary-lighter`, `--color-skyblue`, `--color-skyblue-hover`, `--color-skyblue-lighter`, `--color-secondary-dark`, `--color-secondary`, `--color-secondary-light`, `--color-secondary-lighter`, `--color-purple-dark`, `--color-purple`, `--color-purple-light`, `--color-purple-lighter`, `--color-orange-dark`, `--color-orange`, `--color-orange-light`, …
|
|
334
|
+
- **spacing** (13): `--spacing-x1`, `--spacing-x2`, `--spacing-x3`, `--spacing-x4`, `--spacing-x5`, `--spacing-x6`, `--spacing-x8`, `--spacing-x10`, `--spacing-x12`, `--spacing-x14`, `--spacing-x16`, `--spacing-x18`, `--spacing-x20`
|
|
335
|
+
- **radius** (13): `--radius-x1`, `--radius-x2`, `--radius-x3`, `--radius-x4`, `--radius-x5`, `--radius-x6`, `--radius-x8`, `--radius-x10`, `--radius-x12`, `--radius-x14`, `--radius-x16`, `--radius-x18`, `--radius-x20`
|
|
336
|
+
- **font** (2): `--font-display`, `--font-sans`
|
|
337
|
+
- **motion** (20): `--ease-out`, `--ease-in-out`, `--ease-drawer`, `--ease-back`, `--duration-instant`, `--duration-fast`, `--duration-base`, `--duration-slow`, `--stagger-step`, `--press-scale`, `--modal-open-dur`, `--modal-close-dur`, `--modal-scale`, `--modal-scale-close`, `--modal-ease`, `--dropdown-open-dur`, `--dropdown-close-dur`, `--dropdown-pre-scale`, `--dropdown-closing-scale`, `--dropdown-ease`
|
|
338
|
+
|
|
339
|
+
## Referencias
|
|
340
|
+
|
|
341
|
+
- [DESIGN.md](./DESIGN.md) — spec del design system (paletas, tipografía, escalas).
|
|
342
|
+
- [MIGRATION.md](./MIGRATION.md) — guía de migración v0.x → v1.
|