ctc-component-library 0.3.0 → 1.0.0-alpha.4
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 +46 -0
- package/dist/components/Button/button.variants.d.ts +22 -0
- package/dist/components/Button/button.variants.js +61 -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 +9 -0
- package/dist/components/Checkbox/Checkbox.js +36 -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 +97 -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 +73 -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 +51 -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 +98 -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 +12 -0
- package/dist/components/RadioGroup/RadioGroup.js +42 -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 +82 -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 +310 -748
- package/package.json +193 -69
- package/dist/index.css +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.es.js +0 -45363
- 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 -35
- 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/DESIGN.md
ADDED
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
---
|
|
2
|
+
version: alpha
|
|
3
|
+
name: CTC Component Library
|
|
4
|
+
description: Dual-brand (B2B green / B2C blue) React + TypeScript + SCSS atomic design system. Source of truth for tokens lives in src/foundationTokens/*.scss; the public TS exports under src/commons/* mirror the same scales (with a few documented drifts).
|
|
5
|
+
colors:
|
|
6
|
+
gray-100: "#171a1a"
|
|
7
|
+
gray-80: "#303333"
|
|
8
|
+
gray-60: "#494d4b"
|
|
9
|
+
gray-40: "#b9bfbd"
|
|
10
|
+
gray-20: "#edf2f0"
|
|
11
|
+
gray-00: "#fcfffe"
|
|
12
|
+
primary-dark: "#001f19"
|
|
13
|
+
primary: "#1e5349"
|
|
14
|
+
primary-light: "#6be3d7"
|
|
15
|
+
primary-lighter: "#daf2f0"
|
|
16
|
+
secondary-dark: "#1d5bbc"
|
|
17
|
+
secondary: "#1d5bbc"
|
|
18
|
+
secondary-light: "#bfe1fc"
|
|
19
|
+
secondary-lighter: "#e2f2ff"
|
|
20
|
+
secondary-b2c: "#468eff"
|
|
21
|
+
secondary-b2c-hover: "#84b2fb"
|
|
22
|
+
purple-dark: "#5a52ad"
|
|
23
|
+
purple: "#756dc8"
|
|
24
|
+
purple-light: "#aea7f9"
|
|
25
|
+
purple-lighter: "#dddaff"
|
|
26
|
+
orange-dark: "#ac5734"
|
|
27
|
+
orange: "#e57b43"
|
|
28
|
+
orange-light: "#ffaa7d"
|
|
29
|
+
orange-lighter: "#ffefe7"
|
|
30
|
+
error: "#c00808"
|
|
31
|
+
error-hover: "#cc3939"
|
|
32
|
+
error-light: "#ffe5e5"
|
|
33
|
+
success: "#206614"
|
|
34
|
+
success-hover: "#4c8543"
|
|
35
|
+
success-light: "#e5ffea"
|
|
36
|
+
alert: "#9f760b"
|
|
37
|
+
alert-light: "#fff1cc"
|
|
38
|
+
typography:
|
|
39
|
+
h1:
|
|
40
|
+
fontFamily: Roca One
|
|
41
|
+
fontSize: 56px
|
|
42
|
+
fontWeight: 300
|
|
43
|
+
lineHeight: 60px
|
|
44
|
+
letterSpacing: 1.5px
|
|
45
|
+
h2:
|
|
46
|
+
fontFamily: Roca One
|
|
47
|
+
fontSize: 48px
|
|
48
|
+
fontWeight: 300
|
|
49
|
+
lineHeight: 55px
|
|
50
|
+
letterSpacing: 1.2px
|
|
51
|
+
h3:
|
|
52
|
+
fontFamily: Roca One
|
|
53
|
+
fontSize: 34px
|
|
54
|
+
fontWeight: 300
|
|
55
|
+
lineHeight: 40px
|
|
56
|
+
letterSpacing: 1px
|
|
57
|
+
h4:
|
|
58
|
+
fontFamily: Roca One
|
|
59
|
+
fontSize: 24px
|
|
60
|
+
fontWeight: 300
|
|
61
|
+
lineHeight: 30px
|
|
62
|
+
letterSpacing: 0.8px
|
|
63
|
+
h5:
|
|
64
|
+
fontFamily: Roca One
|
|
65
|
+
fontSize: 20px
|
|
66
|
+
fontWeight: 300
|
|
67
|
+
lineHeight: 25px
|
|
68
|
+
letterSpacing: 0.6px
|
|
69
|
+
body-1:
|
|
70
|
+
fontFamily: NT Bau
|
|
71
|
+
fontSize: 24px
|
|
72
|
+
fontWeight: 400
|
|
73
|
+
lineHeight: 30px
|
|
74
|
+
letterSpacing: -0.5px
|
|
75
|
+
body-2:
|
|
76
|
+
fontFamily: NT Bau
|
|
77
|
+
fontSize: 20px
|
|
78
|
+
fontWeight: 400
|
|
79
|
+
lineHeight: 24px
|
|
80
|
+
letterSpacing: -0.5px
|
|
81
|
+
body-3:
|
|
82
|
+
fontFamily: NT Bau
|
|
83
|
+
fontSize: 18px
|
|
84
|
+
fontWeight: 400
|
|
85
|
+
lineHeight: 24px
|
|
86
|
+
letterSpacing: -0.5px
|
|
87
|
+
body-4:
|
|
88
|
+
fontFamily: NT Bau
|
|
89
|
+
fontSize: 16px
|
|
90
|
+
fontWeight: 400
|
|
91
|
+
lineHeight: 22px
|
|
92
|
+
letterSpacing: -0.5px
|
|
93
|
+
body-5:
|
|
94
|
+
fontFamily: NT Bau
|
|
95
|
+
fontSize: 14px
|
|
96
|
+
fontWeight: 400
|
|
97
|
+
lineHeight: 20px
|
|
98
|
+
letterSpacing: -0.5px
|
|
99
|
+
body-6:
|
|
100
|
+
fontFamily: NT Bau
|
|
101
|
+
fontSize: 12px
|
|
102
|
+
fontWeight: 400
|
|
103
|
+
lineHeight: 16px
|
|
104
|
+
letterSpacing: -0.5px
|
|
105
|
+
button-1:
|
|
106
|
+
fontFamily: NT Bau
|
|
107
|
+
fontSize: 18px
|
|
108
|
+
fontWeight: 400
|
|
109
|
+
lineHeight: 1
|
|
110
|
+
letterSpacing: -0.5px
|
|
111
|
+
button-2:
|
|
112
|
+
fontFamily: NT Bau
|
|
113
|
+
fontSize: 16px
|
|
114
|
+
fontWeight: 400
|
|
115
|
+
lineHeight: 1
|
|
116
|
+
letterSpacing: -0.5px
|
|
117
|
+
motion:
|
|
118
|
+
ease-out: "cubic-bezier(0.23, 1, 0.32, 1)"
|
|
119
|
+
ease-in-out: "cubic-bezier(0.77, 0, 0.175, 1)"
|
|
120
|
+
ease-drawer: "cubic-bezier(0.32, 0.72, 0, 1)"
|
|
121
|
+
duration-instant: 100ms
|
|
122
|
+
duration-fast: 160ms
|
|
123
|
+
duration-base: 200ms
|
|
124
|
+
duration-slow: 280ms
|
|
125
|
+
stagger-step: 35ms
|
|
126
|
+
press-scale: 0.97
|
|
127
|
+
spacing:
|
|
128
|
+
zero: 0px
|
|
129
|
+
x1: 4px
|
|
130
|
+
x2: 8px
|
|
131
|
+
x3: 12px
|
|
132
|
+
x4: 16px
|
|
133
|
+
x5: 20px
|
|
134
|
+
x6: 24px
|
|
135
|
+
x8: 32px
|
|
136
|
+
x10: 40px
|
|
137
|
+
x12: 48px
|
|
138
|
+
x14: 56px
|
|
139
|
+
x16: 64px
|
|
140
|
+
x18: 72px
|
|
141
|
+
x20: 80px
|
|
142
|
+
rounded:
|
|
143
|
+
x1: 4px
|
|
144
|
+
x2: 8px
|
|
145
|
+
x3: 12px
|
|
146
|
+
x4: 16px
|
|
147
|
+
x5: 20px
|
|
148
|
+
x6: 24px
|
|
149
|
+
x8: 32px
|
|
150
|
+
x10: 40px
|
|
151
|
+
x12: 48px
|
|
152
|
+
x14: 56px
|
|
153
|
+
x16: 64px
|
|
154
|
+
x18: 72px
|
|
155
|
+
x20: 80px
|
|
156
|
+
components:
|
|
157
|
+
button-primary:
|
|
158
|
+
backgroundColor: "{colors.primary-light}"
|
|
159
|
+
textColor: "{colors.gray-80}"
|
|
160
|
+
rounded: "{rounded.x8}"
|
|
161
|
+
typography: "{typography.button-2}"
|
|
162
|
+
button-primary-hover:
|
|
163
|
+
backgroundColor: "{colors.primary-lighter}"
|
|
164
|
+
textColor: "{colors.gray-60}"
|
|
165
|
+
button-primary-disabled:
|
|
166
|
+
backgroundColor: "{colors.gray-20}"
|
|
167
|
+
textColor: "{colors.gray-40}"
|
|
168
|
+
button-primary-neutral:
|
|
169
|
+
backgroundColor: "{colors.gray-80}"
|
|
170
|
+
textColor: "{colors.gray-00}"
|
|
171
|
+
button-primary-neutral-hover:
|
|
172
|
+
backgroundColor: "{colors.gray-60}"
|
|
173
|
+
textColor: "{colors.gray-20}"
|
|
174
|
+
button-primary-success:
|
|
175
|
+
backgroundColor: "{colors.success}"
|
|
176
|
+
textColor: "{colors.gray-00}"
|
|
177
|
+
button-primary-success-hover:
|
|
178
|
+
backgroundColor: "{colors.success-hover}"
|
|
179
|
+
textColor: "{colors.gray-20}"
|
|
180
|
+
button-primary-error:
|
|
181
|
+
backgroundColor: "{colors.error}"
|
|
182
|
+
textColor: "{colors.gray-00}"
|
|
183
|
+
button-primary-error-hover:
|
|
184
|
+
backgroundColor: "{colors.error-hover}"
|
|
185
|
+
textColor: "{colors.gray-20}"
|
|
186
|
+
button-primary-skyblue:
|
|
187
|
+
backgroundColor: "{colors.secondary-b2c}"
|
|
188
|
+
textColor: "{colors.gray-00}"
|
|
189
|
+
button-primary-skyblue-hover:
|
|
190
|
+
backgroundColor: "{colors.secondary-b2c-hover}"
|
|
191
|
+
textColor: "{colors.gray-00}"
|
|
192
|
+
button-secondary:
|
|
193
|
+
backgroundColor: transparent
|
|
194
|
+
textColor: "{colors.gray-80}"
|
|
195
|
+
borderColor: "{colors.gray-80}"
|
|
196
|
+
borderWidth: 2px
|
|
197
|
+
rounded: "{rounded.x8}"
|
|
198
|
+
typography: "{typography.button-2}"
|
|
199
|
+
button-secondary-hover:
|
|
200
|
+
backgroundColor: "{colors.gray-20}"
|
|
201
|
+
borderColor: "{colors.gray-60}"
|
|
202
|
+
button-secondary-skyblue:
|
|
203
|
+
backgroundColor: transparent
|
|
204
|
+
textColor: "{colors.secondary-b2c}"
|
|
205
|
+
borderColor: "{colors.secondary-b2c}"
|
|
206
|
+
borderWidth: 2px
|
|
207
|
+
rounded: "{rounded.x8}"
|
|
208
|
+
button-secondary-skyblue-hover:
|
|
209
|
+
backgroundColor: "{colors.secondary-lighter}"
|
|
210
|
+
borderColor: "{colors.secondary-b2c}"
|
|
211
|
+
button-tertiary:
|
|
212
|
+
backgroundColor: transparent
|
|
213
|
+
textColor: "{colors.gray-80}"
|
|
214
|
+
rounded: "{rounded.x8}"
|
|
215
|
+
typography: "{typography.button-2}"
|
|
216
|
+
button-size-small:
|
|
217
|
+
padding: "4px 16px"
|
|
218
|
+
gap: "{spacing.x2}"
|
|
219
|
+
button-size-medium:
|
|
220
|
+
padding: "12px 24px"
|
|
221
|
+
gap: "{spacing.x2}"
|
|
222
|
+
button-size-big:
|
|
223
|
+
padding: "16px 32px"
|
|
224
|
+
gap: "{spacing.x2}"
|
|
225
|
+
button-icon-only:
|
|
226
|
+
padding: "{spacing.zero}"
|
|
227
|
+
width: 32px
|
|
228
|
+
height: 32px
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
# CTC Component Library — Design System
|
|
232
|
+
|
|
233
|
+
## Overview
|
|
234
|
+
|
|
235
|
+
CTC is an educational platform with two surfaces: **B2B (institutions)** anchored in deep forest green, and **B2C (learners)** anchored in a brighter sky blue. The system is built atomic-style (atoms → molecules → organisms) on React 18 + TypeScript, with SCSS BEM as the styling layer and Ant Design 5 as a low-level primitive base. Tailwind 3 is loaded but intentionally unconfigured (no `theme.extend`) — it is used only for utility resets, not as a token source.
|
|
236
|
+
|
|
237
|
+
The visual tone is **calm, literate, professional**. The serif display face (Roca One Light) gives headings an editorial feel, while a geometric sans (NT Bau) keeps body and UI copy efficient. The palette pairs muted neutrals with one saturated brand color per surface so that a single primary action is always unambiguous on screen.
|
|
238
|
+
|
|
239
|
+
Token source of truth: `src/foundationTokens/*.scss` (consumed by all components via `@use`). The mirror under `src/commons/*.ts` is the public NPM export (`ctc-component-library/theme/{colors,shapes,spacing}`) — see _Do's and Don'ts_ for known TS↔SCSS drift.
|
|
240
|
+
|
|
241
|
+
## Colors
|
|
242
|
+
|
|
243
|
+
The palette is grouped into a 6-step neutral ramp, two brand families (B2B green, B2C blue), two accent families (purple, orange), and four status colors. Each brand and accent family is layered as `dark → default → light → lighter` to support emphasis and tonal backgrounds without shadows.
|
|
244
|
+
|
|
245
|
+
- **Neutrals (`gray-100` `#171a1a` → `gray-00` `#fcfffe`):** Six-step ramp covering body text, UI chrome, dividers, surfaces, and disabled states. `gray-80` is the canonical body-text color; `gray-20` is the canonical disabled background; `gray-40` the canonical disabled text.
|
|
246
|
+
- **Primary / B2B Green (`primary` `#1e5349`):** Identity color for institutional and B2B surfaces. `primary-light` `#6be3d7` is the default primary-button fill; `primary-lighter` `#daf2f0` is its hover.
|
|
247
|
+
- **Secondary / B2C Blue:** Two parallel sub-palettes. `secondary` `#1d5bbc` (deep) is used for B2C headings and accents. `secondary-b2c` `#468eff` (sky) is the dedicated _skyblue_ button family for consumer flows, with `secondary-b2c-hover` `#84b2fb`.
|
|
248
|
+
- **Purple (`purple` `#756dc8`):** Accent for non-status decorative emphasis (illustrations, secondary highlights).
|
|
249
|
+
- **Orange (`orange` `#e57b43`):** Warm accent. Reserved for marketing surfaces and onboarding moments — not a status color.
|
|
250
|
+
- **Status:** `error` `#c00808`, `success` `#206614`, `alert` `#9f760b`, each with a `-light` tonal background for inline messages and an `-hover` step where applicable.
|
|
251
|
+
|
|
252
|
+
Opacity scale (`1, 0.8, 0.6, 0.4, 0.2`) is exposed in `src/commons/colors.ts` as `Opacidad100…Opacidad20` for use in overlays and disabled compositions; not surfaced in tokens above because it modulates any color rather than naming one.
|
|
253
|
+
|
|
254
|
+
## Typography
|
|
255
|
+
|
|
256
|
+
Two families, two roles:
|
|
257
|
+
|
|
258
|
+
- **Roca One** (serif, weight 300 "Light") — every heading `h1`–`h5`. Larger sizes carry positive letter-spacing (1.5px → 0.6px) to keep the light weight readable. Files: `public/fonts/RocaOneLight.ttf`, `RocaOneRegular.ttf`.
|
|
259
|
+
- **NT Bau** (geometric sans, weight 400 "Regular") — every body and button level. All non-display text uses a small **negative** `letter-spacing` (`-0.5px`) for tighter, denser running copy. Files: `public/fonts/NTBauRegular.otf`, `NTBauBold.otf`.
|
|
260
|
+
|
|
261
|
+
The scale is opinionated: 5 heading levels, 6 body levels, 2 button levels. Bodies range 12px → 24px; defaults are `body-4` (16px) for paragraph copy, `body-5` (14px) for UI labels, `body-6` (12px) for metadata. Buttons use `button-2` (16px) at all sizes by default; `button-1` (18px) is reserved for the `big` button size when extra emphasis is desired.
|
|
262
|
+
|
|
263
|
+
`bolder` is exposed as a Typography prop modifier — when on, it overrides the inherited weight rather than introducing a new typography token.
|
|
264
|
+
|
|
265
|
+
## Layout
|
|
266
|
+
|
|
267
|
+
A strict **4px base scale** drives every spacing and radius decision. The scale is keyed `x1`…`x20` where the number is the multiplier: `x1=4`, `x2=8`, `x4=16`, `x8=32`, `x20=80`. Token `zero` (`0px`) is provided for explicit zeroing in token-driven SCSS (`#{spacingTokens.$zero}`).
|
|
268
|
+
|
|
269
|
+
There is no prescriptive grid — components are self-sized and composed by the host application. What the system does prescribe is rhythm:
|
|
270
|
+
|
|
271
|
+
- **Default gap** between adjacent atoms: `spacing.x2` (8px).
|
|
272
|
+
- **Component internal padding** is one of three steps: small (`4px / 16px`), medium (`12px / 24px`), big (`16px / 32px`) — see Button.
|
|
273
|
+
- **Section-level spacing** typically uses `x6` (24px) and `x10` (40px).
|
|
274
|
+
|
|
275
|
+
Tailwind is present but its theme is _not_ extended — do not rely on Tailwind utility classes for spacing/colors when authoring library components; consume the SCSS tokens instead.
|
|
276
|
+
|
|
277
|
+
## Motion
|
|
278
|
+
|
|
279
|
+
Animations follow Emil Kowalski's design engineering philosophy: every motion has a clear purpose, easings are custom (built-in CSS easings lack punch), durations stay under 300ms for UI, and only `transform`/`opacity` are animated (GPU, no layout/paint).
|
|
280
|
+
|
|
281
|
+
**Custom easings** (defined in `theme.css`):
|
|
282
|
+
- `--ease-out: cubic-bezier(0.23, 1, 0.32, 1)` — entrances, color transitions, hover. Starts fast for instant feedback.
|
|
283
|
+
- `--ease-in-out: cubic-bezier(0.77, 0, 0.175, 1)` — on-screen movement (drawer slides, layout shifts).
|
|
284
|
+
- `--ease-drawer: cubic-bezier(0.32, 0.72, 0, 1)` — iOS-like drawer curve.
|
|
285
|
+
|
|
286
|
+
**Never `ease-in`** for UI — feels sluggish at the moment the user is watching most closely.
|
|
287
|
+
|
|
288
|
+
**Duration scale** (token → use):
|
|
289
|
+
- `--duration-instant: 100ms` — button press feedback.
|
|
290
|
+
- `--duration-fast: 160ms` — color transitions, hover, small popovers.
|
|
291
|
+
- `--duration-base: 200ms` — selects, dropdowns, popovers, tooltips.
|
|
292
|
+
- `--duration-slow: 280ms` — modals, drawers.
|
|
293
|
+
|
|
294
|
+
**Press feedback**: every pressable element scales to `--press-scale: 0.97` on `:active`. Implemented via `data-pressable` attribute or component-level `active:scale-[var(--press-scale)]`.
|
|
295
|
+
|
|
296
|
+
**Stagger**: list items in selects/comboboxes/dropdowns reveal with `--stagger-step: 35ms` between siblings. Apply via `.ctc-stagger` utility class on the list container; first 12 children get auto delays.
|
|
297
|
+
|
|
298
|
+
**Asymmetric timing**: enter animations are slightly slower than exits. A modal opens at 280ms but closes at 160ms — slow when the user is deciding, snappy when the system is responding.
|
|
299
|
+
|
|
300
|
+
**Origin awareness**:
|
|
301
|
+
- Popover/Tooltip/Select content scales from the trigger via Radix's `--radix-*-content-transform-origin` CSS variable.
|
|
302
|
+
- Modals are the exception: `transform-origin: center` because they are not anchored to a specific trigger.
|
|
303
|
+
|
|
304
|
+
**Reduced motion** (`prefers-reduced-motion: reduce`): all animations and transitions drop to 0.01ms; press scale is disabled. Opacity transitions are preserved for state comprehension.
|
|
305
|
+
|
|
306
|
+
**Touch hover guard**: hover-only effects gate behind `@media (hover: hover) and (pointer: fine)` to avoid false positives on tap.
|
|
307
|
+
|
|
308
|
+
**Per-component application**:
|
|
309
|
+
|
|
310
|
+
| Component | Motion |
|
|
311
|
+
|---|---|
|
|
312
|
+
| Button | `:active scale(0.97)`, color/transform transitions 160ms ease-out, loading spinner 700ms linear |
|
|
313
|
+
| Dialog | overlay fade 220ms ease-out, content scale 0.96 → 1 + opacity, **origin center**, exit 160ms |
|
|
314
|
+
| Popover | scale 0.96 → 1 + opacity, origin Radix var, 200ms ease-out, exit 160ms |
|
|
315
|
+
| Tooltip | scale 0.97 → 1, 125ms ease-out, origin Radix var, instant on subsequent hovers (Provider `skipDelayDuration: 200`) |
|
|
316
|
+
| Select / Combobox / MultiSelect | trigger press scale, content scale 0.96 → 1 origin Radix var, **items stagger 35ms** with `ctc-fade-rise` (translateY(4px) → 0 + opacity), caret rotates 180° on open |
|
|
317
|
+
| Tabs | trigger smooth color, **underline indicator slides via scaleX origin center**, content fades + rises 200ms ease-out on activation |
|
|
318
|
+
| Toast | sonner default (Emil-approved) |
|
|
319
|
+
| Switch | thumb translate 200ms ease-out, `:active scale(0.95)` |
|
|
320
|
+
| Checkbox | indicator scale 0 → 1 enter, `:active scale(0.92)` |
|
|
321
|
+
| RadioGroup | indicator scale 0 → 1 + opacity, `:active scale(0.92)` |
|
|
322
|
+
| Avatar | image fade + rise on `data-state=loaded` |
|
|
323
|
+
| Alert | enter `ctc-fade-rise` 200ms ease-out |
|
|
324
|
+
| Spinner | spin 700ms linear (faster than Tailwind default; perceived performance) |
|
|
325
|
+
| Input | border-color transition 160ms ease-out on focus/invalid |
|
|
326
|
+
| NumberInput | stepper buttons `:active scale(0.85)`, color transition |
|
|
327
|
+
| DatePicker | calendar reveals via Popover anim, day buttons `:active scale(0.92)` + smooth bg, trigger press feedback |
|
|
328
|
+
| TimePicker | inherits Select |
|
|
329
|
+
| DataTable | row bg transition 160ms ease-out, expand caret rotates 90°, sub-row `ctc-fade-rise` enter |
|
|
330
|
+
| Field | invalid-state color transition 160ms ease-out |
|
|
331
|
+
|
|
332
|
+
## Elevation & Depth
|
|
333
|
+
|
|
334
|
+
The system is **flat**. Hierarchy is conveyed through:
|
|
335
|
+
|
|
336
|
+
1. **Tonal contrast** — surfaces step through `gray-00 → gray-20 → gray-100`; raised content sits on a lighter neutral than its container.
|
|
337
|
+
2. **Borders** — secondary buttons and inputs use 1–2px borders in `gray-80` or the relevant brand color, switching to `gray-40` when disabled.
|
|
338
|
+
3. **Color emphasis** — a saturated brand fill (e.g. `primary-light`, `secondary-b2c`) is itself the elevation cue for a primary action.
|
|
339
|
+
|
|
340
|
+
No `box-shadow` tokens are defined and components do not apply drop shadows. If a future surface needs a shadow (e.g. floating popover), introduce it as a new `elevation` token group rather than ad-hoc.
|
|
341
|
+
|
|
342
|
+
## Shapes
|
|
343
|
+
|
|
344
|
+
Radii share the same numeric scale as spacing (`x1=4` … `x20=80`) but are semantically about corner softness, not gap. The default for interactive containers (buttons, inputs) is `rounded.x8` (32px) — this is the system's signature, large enough to read as soft and friendly without becoming a pill at common widths. Cards and modals typically step down to `rounded.x4` (16px) or `rounded.x3` (12px). Avoid sharp (0px) corners and full-pill (`9999px`) radii — neither belongs to the language.
|
|
345
|
+
|
|
346
|
+
## Components
|
|
347
|
+
|
|
348
|
+
Atomic structure:
|
|
349
|
+
|
|
350
|
+
- **Atoms:** `Avatar`, `Badge`, `Button` (+ `ButtonV2`), `Checkbox`, `Datepicker`, `Icon`, `InputNumber`, `Label`, `Popover`, `RadioButton`, `TextInput`, `Timepicker`, `Toast`, `Toggle`, `Typography`, `tooltips`.
|
|
351
|
+
- **Molecules:** `Table`, `alert`, `dropdowns`, `tabs`.
|
|
352
|
+
- **Organisms:** `Modal` (+ `ModalV2`).
|
|
353
|
+
|
|
354
|
+
Author all new components with: `<Component>.tsx`, `<Component>.scss` (BEM, `@use` of foundation tokens), `types.ts`, `index.ts`, `<Component>.test.tsx`, optional `<Component>.stories.ts`. Re-export from `src/components/<layer>/index.ts`.
|
|
355
|
+
|
|
356
|
+
### Button
|
|
357
|
+
|
|
358
|
+
Three variants × three sizes × four primary color modes. Default radius `rounded.x8`. Default gap between icon and label `spacing.x2`. Icons are 24×24 from `@material-symbols/font-400` (`outlined` | `rounded` | `sharp`).
|
|
359
|
+
|
|
360
|
+
| Token | Value |
|
|
361
|
+
|---|---|
|
|
362
|
+
| `button-primary` | green default — `{colors.primary-light}` on `{colors.gray-80}` |
|
|
363
|
+
| `button-primary-neutral` | dark CTA — `{colors.gray-80}` on `{colors.gray-00}` |
|
|
364
|
+
| `button-primary-success` / `-error` | semantic CTAs (status colors on `gray-00`) |
|
|
365
|
+
| `button-primary-skyblue` | B2C primary — `{colors.secondary-b2c}` on `{colors.gray-00}` |
|
|
366
|
+
| `button-secondary` | transparent fill, 2px `gray-80` border |
|
|
367
|
+
| `button-secondary-skyblue` | transparent fill, 2px `secondary-b2c` border |
|
|
368
|
+
| `button-tertiary` | text-only, no border, no fill |
|
|
369
|
+
| `button-size-small` | padding `4px 16px` |
|
|
370
|
+
| `button-size-medium` | padding `12px 24px` |
|
|
371
|
+
| `button-size-big` | padding `16px 32px` |
|
|
372
|
+
| `button-icon-only` | square 32×32, padding 0 |
|
|
373
|
+
|
|
374
|
+
All variants share `rounded.x8` and `typography.button-2`. Disabled state across primary variants: `gray-20` background + `gray-40` text. Loading state spins an icon (1s linear infinite).
|
|
375
|
+
|
|
376
|
+
### Input fields (`TextInput`, `InputNumber`, `Datepicker`, `Timepicker`)
|
|
377
|
+
|
|
378
|
+
Borders in `gray-40` default → `gray-80` focus → `error` invalid. Use `body-5` for the value text and `body-6` for helper/error captions. Radius `rounded.x2` (8px) — tighter than buttons because inputs are read as containers, not actions.
|
|
379
|
+
|
|
380
|
+
### Selection (`Checkbox`, `RadioButton`, `Toggle`)
|
|
381
|
+
|
|
382
|
+
Selected state uses `primary` (B2B contexts) or `secondary-b2c` (B2C contexts). Focus ring uses the same color at 0.2 opacity. Labels in `body-5`.
|
|
383
|
+
|
|
384
|
+
### Feedback (`Toast`, `alert`, `Badge`)
|
|
385
|
+
|
|
386
|
+
Backgrounds use the `-light` step of a status color, text the `-main` step. Toasts use `body-5`; badges use `body-6`. Radius `rounded.x4` (16px) for toasts, `rounded.x8` for badges (pill-like).
|
|
387
|
+
|
|
388
|
+
### Surface (`Modal`, `Popover`, `tooltips`)
|
|
389
|
+
|
|
390
|
+
Modals: `gray-00` surface, `rounded.x4` corners, padding `x6` (24px). Popovers and tooltips: `gray-100` background with `gray-00` text, `rounded.x2`, padding `x2`/`x3`.
|
|
391
|
+
|
|
392
|
+
### Composition (`Table`, `tabs`, `dropdowns`)
|
|
393
|
+
|
|
394
|
+
Tables use 1px `gray-20` row dividers, header text in `body-6` uppercase. Tabs use `body-4` with a 2px `primary` (or `secondary-b2c`) bottom border on active. Dropdown menus use a `gray-00` surface with `rounded.x2` and items in `body-5`.
|
|
395
|
+
|
|
396
|
+
## Do's and Don'ts
|
|
397
|
+
|
|
398
|
+
- **Do** import token values from SCSS via `@use '../../../foundationTokens/{colors|shapes|spacing}.scss' as ...` — never hardcode hex or px in component styles.
|
|
399
|
+
- **Do** name SCSS classes with BEM: `.block`, `.block__element`, `.block--modifier` (mirror the pattern in `Button.scss` / `ButtonV2.scss`).
|
|
400
|
+
- **Do** keep all spacing and radii on the 4px scale (`x1`…`x20`). If a value isn't on the scale, you are probably solving the wrong problem.
|
|
401
|
+
- **Do** pair each heading with `Roca One` and each body/UI string with `NT Bau`. Never the reverse.
|
|
402
|
+
- **Do** render icons via `@material-symbols/font-400` at 24×24, with `iconType` `outlined | rounded | sharp` matching the surrounding component's tone.
|
|
403
|
+
- **Do** ship a `dataTestid` prop on every interactive component for QA hooks.
|
|
404
|
+
- **Don't** introduce drop shadows or blur-based elevation. The system is flat — convey depth with tonal contrast or borders instead.
|
|
405
|
+
- **Don't** mix Tailwind utility classes for color or spacing into library components. Tailwind's theme is intentionally not extended; SCSS tokens are the source of truth.
|
|
406
|
+
- **Don't** trust the public TS export (`src/commons/colors.ts`) blindly — there are known drifts vs. the SCSS source: `MainGreenLight` (TS `#6be3cd` vs SCSS `#6be3d7`), `SecondaryPurpleDefault` (TS `#c15cff` vs SCSS `#756dc8`), `MainBlueDefault` (TS `#468eff` vs SCSS `#1d5bbc`), `SuccessLight` (TS `#c15cff` vs SCSS `#e5ffea`). The values in this DESIGN.md follow the SCSS file, which is what components actually render.
|
|
407
|
+
- **Don't** use `secondary-b2c` (sky blue) on B2B surfaces or `primary` (forest green) on B2C surfaces — the brand split is meaningful.
|
|
408
|
+
- **Don't** introduce a fourth button variant or a new size step without updating both `Button.scss` and this file. The (3 variants × 3 sizes × 4 color modes) matrix is intentionally finite.
|