@finhay-pro/leaf-design-system 0.1.6 → 0.1.8

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 (122) hide show
  1. package/README.md +352 -163
  2. package/dist/button.css +12 -15
  3. package/dist/calendar.css +325 -0
  4. package/dist/cdn/leaf-0.1.8.min.css +2 -0
  5. package/dist/cdn/leaf-0.1.8.min.js +2 -0
  6. package/dist/checkbox.css +132 -0
  7. package/dist/classes.css +2256 -1513
  8. package/dist/color.css +27 -32
  9. package/dist/components/Calendar/Calendar.d.ts +49 -0
  10. package/dist/components/Calendar/Calendar.d.ts.map +1 -0
  11. package/dist/components/Calendar/Calendar.js +167 -0
  12. package/dist/components/Calendar/Calendar.js.map +1 -0
  13. package/dist/components/Calendar/index.d.ts +2 -0
  14. package/dist/components/Calendar/index.d.ts.map +1 -0
  15. package/dist/components/Calendar/index.js +2 -0
  16. package/dist/components/Calendar/index.js.map +1 -0
  17. package/dist/components/Checkbox/Checkbox.d.ts +25 -0
  18. package/dist/components/Checkbox/Checkbox.d.ts.map +1 -0
  19. package/dist/components/Checkbox/Checkbox.js +40 -0
  20. package/dist/components/Checkbox/Checkbox.js.map +1 -0
  21. package/dist/components/Checkbox/index.d.ts +2 -0
  22. package/dist/components/Checkbox/index.d.ts.map +1 -0
  23. package/dist/components/Checkbox/index.js +2 -0
  24. package/dist/components/Checkbox/index.js.map +1 -0
  25. package/dist/components/Dropdown/Dropdown.d.ts +62 -0
  26. package/dist/components/Dropdown/Dropdown.d.ts.map +1 -0
  27. package/dist/components/Dropdown/Dropdown.js +197 -0
  28. package/dist/components/Dropdown/Dropdown.js.map +1 -0
  29. package/dist/components/Dropdown/LanguageDropdown.d.ts +15 -0
  30. package/dist/components/Dropdown/LanguageDropdown.d.ts.map +1 -0
  31. package/dist/components/Dropdown/LanguageDropdown.js +18 -0
  32. package/dist/components/Dropdown/LanguageDropdown.js.map +1 -0
  33. package/dist/components/Dropdown/index.d.ts +4 -0
  34. package/dist/components/Dropdown/index.d.ts.map +1 -0
  35. package/dist/components/Dropdown/index.js +5 -0
  36. package/dist/components/Dropdown/index.js.map +1 -0
  37. package/dist/components/Input/Input.d.ts +57 -0
  38. package/dist/components/Input/Input.d.ts.map +1 -0
  39. package/dist/components/Input/Input.js +78 -0
  40. package/dist/components/Input/Input.js.map +1 -0
  41. package/dist/components/Input/InputDate.d.ts +56 -0
  42. package/dist/components/Input/InputDate.d.ts.map +1 -0
  43. package/dist/components/Input/InputDate.js +119 -0
  44. package/dist/components/Input/InputDate.js.map +1 -0
  45. package/dist/components/Input/InputOtp.d.ts +33 -0
  46. package/dist/components/Input/InputOtp.d.ts.map +1 -0
  47. package/dist/components/Input/InputOtp.js +96 -0
  48. package/dist/components/Input/InputOtp.js.map +1 -0
  49. package/dist/components/Input/InputStepper.d.ts +42 -0
  50. package/dist/components/Input/InputStepper.d.ts.map +1 -0
  51. package/dist/components/Input/InputStepper.js +86 -0
  52. package/dist/components/Input/InputStepper.js.map +1 -0
  53. package/dist/components/Input/index.d.ts +5 -0
  54. package/dist/components/Input/index.d.ts.map +1 -0
  55. package/dist/components/Input/index.js +5 -0
  56. package/dist/components/Input/index.js.map +1 -0
  57. package/dist/components/Radio/Radio.d.ts +39 -0
  58. package/dist/components/Radio/Radio.d.ts.map +1 -0
  59. package/dist/components/Radio/Radio.js +50 -0
  60. package/dist/components/Radio/Radio.js.map +1 -0
  61. package/dist/components/Radio/index.d.ts +2 -0
  62. package/dist/components/Radio/index.d.ts.map +1 -0
  63. package/dist/components/Radio/index.js +2 -0
  64. package/dist/components/Radio/index.js.map +1 -0
  65. package/dist/components/Toast/Toast.d.ts +66 -0
  66. package/dist/components/Toast/Toast.d.ts.map +1 -0
  67. package/dist/components/Toast/Toast.js +77 -0
  68. package/dist/components/Toast/Toast.js.map +1 -0
  69. package/dist/components/Toast/index.d.ts +2 -0
  70. package/dist/components/Toast/index.d.ts.map +1 -0
  71. package/dist/components/Toast/index.js +2 -0
  72. package/dist/components/Toast/index.js.map +1 -0
  73. package/dist/core/calendar.d.ts +36 -0
  74. package/dist/core/calendar.d.ts.map +1 -0
  75. package/dist/core/calendar.js +65 -0
  76. package/dist/core/calendar.js.map +1 -0
  77. package/dist/core/dropdown.d.ts +66 -0
  78. package/dist/core/dropdown.d.ts.map +1 -0
  79. package/dist/core/dropdown.js +131 -0
  80. package/dist/core/dropdown.js.map +1 -0
  81. package/dist/core/language.d.ts +25 -0
  82. package/dist/core/language.d.ts.map +1 -0
  83. package/dist/core/language.js +17 -0
  84. package/dist/core/language.js.map +1 -0
  85. package/dist/core/otp.d.ts +30 -0
  86. package/dist/core/otp.d.ts.map +1 -0
  87. package/dist/core/otp.js +65 -0
  88. package/dist/core/otp.js.map +1 -0
  89. package/dist/core/stepper.d.ts +39 -0
  90. package/dist/core/stepper.d.ts.map +1 -0
  91. package/dist/core/stepper.js +109 -0
  92. package/dist/core/stepper.js.map +1 -0
  93. package/dist/core/toast.d.ts +67 -0
  94. package/dist/core/toast.d.ts.map +1 -0
  95. package/dist/core/toast.js +102 -0
  96. package/dist/core/toast.js.map +1 -0
  97. package/dist/dialog.css +15 -9
  98. package/dist/dropdown.css +303 -0
  99. package/dist/index.d.ts +6 -0
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +6 -0
  102. package/dist/index.js.map +1 -1
  103. package/dist/input-date.css +49 -0
  104. package/dist/input-otp.css +76 -0
  105. package/dist/input-stepper.css +179 -0
  106. package/dist/input.css +218 -0
  107. package/dist/logo.css +2 -2
  108. package/dist/radio.css +124 -0
  109. package/dist/slider.css +16 -14
  110. package/dist/spinner.css +3 -3
  111. package/dist/styles.css +2255 -1545
  112. package/dist/tabs.css +5 -4
  113. package/dist/toast.css +234 -0
  114. package/dist/toggle.css +4 -3
  115. package/dist/tokens.css +0 -33
  116. package/dist/tooltip.css +13 -12
  117. package/dist/typography.css +1 -3
  118. package/package.json +10 -3
  119. package/dist/border.css +0 -45
  120. package/dist/cdn/leaf-0.1.6.min.css +0 -2
  121. package/dist/cdn/leaf-0.1.6.min.js +0 -2
  122. package/dist/spacing.css +0 -839
package/dist/button.css CHANGED
@@ -23,9 +23,9 @@
23
23
  /* Mặc định: size lg — Figma Large: h 56 · px XL · py S · gap L · icon 30 */
24
24
  /* --leaf-button-width chỉ set khi prop width; không set → auto / icon-only = height */
25
25
  --leaf-button-height: 56px;
26
- --leaf-button-padding: var(--spacing-s) var(--spacing-xl);
27
- --leaf-button-icon-only-padding: var(--spacing-s);
28
- --leaf-button-gap: var(--spacing-l);
26
+ --leaf-button-padding: 8px 24px;
27
+ --leaf-button-icon-only-padding: 8px;
28
+ --leaf-button-gap: 16px;
29
29
  --leaf-button-icon-size: 30px;
30
30
  --leaf-button-font-size: var(--body-1-size);
31
31
  --leaf-button-line-height: var(--body-1-line-height);
@@ -50,16 +50,16 @@
50
50
  border-radius: 1000px;
51
51
  background-color: var(--leaf-button-bg);
52
52
  color: var(--leaf-button-fg);
53
- text-align: center;
54
- white-space: nowrap;
55
53
  font: inherit;
56
54
  font-family: var(--font-sans);
57
55
  font-size: var(--leaf-button-font-size);
58
56
  line-height: var(--leaf-button-line-height);
59
57
  font-weight: var(--leaf-button-font-weight);
60
58
  letter-spacing: var(--leaf-button-letter-spacing);
61
- text-decoration: none;
59
+ text-align: center;
60
+ white-space: nowrap;
62
61
  vertical-align: middle;
62
+ text-decoration: none;
63
63
  appearance: none;
64
64
  }
65
65
 
@@ -80,10 +80,7 @@
80
80
  height: 1em;
81
81
  }
82
82
 
83
- /*
84
- * `display` ở trên thắng `[hidden]` của trình duyệt — khai báo lại để `hidden` luôn ẩn
85
- * (bản vanilla ẩn leading icon khi loading), không trông vào preflight của Tailwind.
86
- */
83
+ /* `hidden` luôn ẩn — rule trên set display; selector `[hidden]` specificity cao hơn nên thắng. */
87
84
  .leaf-button[hidden],
88
85
  .leaf-button__icon[hidden] {
89
86
  display: none;
@@ -96,8 +93,8 @@
96
93
  .leaf-button[data-size="md"] {
97
94
  /* Medium: px L · py S · gap M · icon 24 · frame 40 */
98
95
  --leaf-button-height: 40px;
99
- --leaf-button-padding: var(--spacing-s) var(--spacing-l);
100
- --leaf-button-gap: var(--spacing-m);
96
+ --leaf-button-padding: 8px 16px;
97
+ --leaf-button-gap: 12px;
101
98
  --leaf-button-icon-size: 24px;
102
99
  --leaf-button-font-size: var(--body-3-size);
103
100
  --leaf-button-line-height: var(--body-3-line-height);
@@ -108,9 +105,9 @@
108
105
  .leaf-button[data-size="sm"] {
109
106
  /* Small: px M · py XS · gap S · icon 20 · frame 28 */
110
107
  --leaf-button-height: 28px;
111
- --leaf-button-padding: var(--spacing-xs) var(--spacing-m);
112
- --leaf-button-icon-only-padding: var(--spacing-xs);
113
- --leaf-button-gap: var(--spacing-s);
108
+ --leaf-button-padding: 4px 12px;
109
+ --leaf-button-icon-only-padding: 4px;
110
+ --leaf-button-gap: 8px;
114
111
  --leaf-button-icon-size: 20px;
115
112
  --leaf-button-font-size: var(--body-4-size);
116
113
  --leaf-button-line-height: var(--body-4-line-height);
@@ -0,0 +1,325 @@
1
+ /* @finhay-pro/leaf-design-system — generated by scripts/build-css.mjs. Do not edit. */
2
+ @layer theme, base, components, utilities;
3
+
4
+ /* --- src/components/Calendar/calendar.css --- */
5
+
6
+ /*
7
+ * Calendar — port từ vnsc Calendar (panel chọn ngày / giờ).
8
+ *
9
+ * Typography và màu tĩnh (nền, màu viền) là class Leaf trên markup. File này giữ khung
10
+ * (padding, radius, độ dày viền), layout, size cố định (panel 256, ô 28, select 64), hover,
11
+ * trạng thái ngày (data-selected / data-today / :disabled), vị trí dropdown
12
+ * (data-placement), bóng đổ, reset button. Footer là `Button` (cần button.css).
13
+ */
14
+
15
+ @layer components {
16
+ .leaf-calendar {
17
+ --leaf-calendar-width: 256px;
18
+ --leaf-calendar-cell: 28px;
19
+
20
+ display: flex;
21
+ flex-direction: column;
22
+ gap: 8px;
23
+ box-sizing: border-box;
24
+ width: var(--leaf-calendar-width);
25
+ max-width: 100%;
26
+ padding: 12px;
27
+ border-width: 1px;
28
+ border-style: solid;
29
+ border-radius: 12px;
30
+ }
31
+
32
+ .leaf-calendar__header {
33
+ position: relative;
34
+ display: flex;
35
+ align-items: center;
36
+ justify-content: space-between;
37
+ }
38
+
39
+ .leaf-calendar[data-time-only="true"] {
40
+ --leaf-calendar-width: auto;
41
+ }
42
+
43
+ /* Reset button của panel — không đụng footer `.leaf-button` (tự reset trong button.css). */
44
+ :is(
45
+ .leaf-calendar__nav,
46
+ .leaf-calendar__title,
47
+ .leaf-calendar__day,
48
+ .leaf-calendar__option,
49
+ .leaf-calendar__select
50
+ ) {
51
+ margin: 0;
52
+ font-family: var(--font-sans);
53
+ appearance: none;
54
+ cursor: pointer;
55
+ }
56
+
57
+ .leaf-calendar__nav {
58
+ display: inline-flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ border-radius: 8px;
62
+ width: var(--leaf-calendar-cell);
63
+ height: var(--leaf-calendar-cell);
64
+ padding: 0;
65
+ border: none;
66
+ background-color: var(--base-tertiary);
67
+ font-size: 16px;
68
+ line-height: 1;
69
+ transition: background-color 0.15s ease;
70
+ }
71
+
72
+ .leaf-calendar__nav[data-size="sm"] {
73
+ width: 24px;
74
+ height: 24px;
75
+ font-size: 14px;
76
+ }
77
+
78
+ .leaf-calendar__nav:hover {
79
+ background-color: var(--base-quaternary);
80
+ }
81
+
82
+ .leaf-calendar__nav > svg,
83
+ .leaf-calendar__caret > svg {
84
+ display: block;
85
+ width: 1em;
86
+ height: 1em;
87
+ }
88
+
89
+ .leaf-calendar__title {
90
+ display: inline-flex;
91
+ align-items: center;
92
+ gap: 4px;
93
+ border-radius: 8px;
94
+ padding: 2px 8px;
95
+ border: none;
96
+ background-color: transparent;
97
+ transition: background-color 0.15s ease;
98
+ }
99
+
100
+ .leaf-calendar__title:hover,
101
+ .leaf-calendar__title[aria-expanded="true"] {
102
+ background-color: var(--base-tertiary);
103
+ }
104
+
105
+ .leaf-calendar__heading {
106
+ display: flex;
107
+ flex-direction: column;
108
+ align-items: center;
109
+ }
110
+
111
+ .leaf-calendar__caret {
112
+ display: inline-flex;
113
+ font-size: 12px;
114
+ color: var(--text-tertiary);
115
+ }
116
+
117
+ .leaf-calendar__months,
118
+ .leaf-calendar__list {
119
+ box-shadow: 0 16px 40px rgb(0 0 0 / 0.35);
120
+ }
121
+
122
+ .leaf-calendar__months {
123
+ position: absolute;
124
+ top: 100%;
125
+ right: 0;
126
+ left: 0;
127
+ z-index: 30;
128
+ display: flex;
129
+ flex-direction: column;
130
+ gap: 8px;
131
+ margin-top: 6px;
132
+ padding: 8px;
133
+ border-width: 1px;
134
+ border-style: solid;
135
+ border-radius: 12px;
136
+ }
137
+
138
+ .leaf-calendar__months-header {
139
+ display: flex;
140
+ align-items: center;
141
+ justify-content: space-between;
142
+ }
143
+
144
+ .leaf-calendar__months-grid {
145
+ display: grid;
146
+ grid-template-columns: repeat(3, minmax(0, 1fr));
147
+ gap: 4px;
148
+ }
149
+
150
+ .leaf-calendar__weekdays,
151
+ .leaf-calendar__days {
152
+ display: grid;
153
+ grid-template-columns: repeat(7, minmax(0, 1fr));
154
+ gap: 2px;
155
+ }
156
+
157
+ .leaf-calendar__weekday {
158
+ padding-block: 2px;
159
+ text-align: center;
160
+ }
161
+
162
+ .leaf-calendar__num,
163
+ .leaf-calendar__select,
164
+ .leaf-calendar__option--time {
165
+ font-variant-numeric: tabular-nums;
166
+ }
167
+
168
+ /* Ô ngày / tháng / giờ — màu theo state nên nằm ở đây, không gắn class màu trên markup. */
169
+ .leaf-calendar__day,
170
+ .leaf-calendar__option {
171
+ display: inline-flex;
172
+ align-items: center;
173
+ justify-content: center;
174
+ border-radius: 8px;
175
+ height: var(--leaf-calendar-cell);
176
+ padding: 0;
177
+ border: 1px solid transparent;
178
+ background-color: transparent;
179
+ color: var(--text-primary);
180
+ transition:
181
+ background-color 0.15s ease,
182
+ color 0.15s ease;
183
+ }
184
+
185
+ .leaf-calendar__option--time {
186
+ flex-shrink: 0;
187
+ height: 24px;
188
+ }
189
+
190
+ .leaf-calendar__day:not(:disabled):not([data-selected="true"]):hover,
191
+ .leaf-calendar__option:not([data-selected="true"]):hover {
192
+ background-color: var(--base-tertiary);
193
+ }
194
+
195
+ .leaf-calendar__day[data-today="true"] {
196
+ border-color: var(--text-highlight);
197
+ color: var(--text-highlight);
198
+ }
199
+
200
+ .leaf-calendar__day[data-selected="true"],
201
+ .leaf-calendar__option[data-selected="true"] {
202
+ border-color: transparent;
203
+ background-color: var(--text-highlight);
204
+ color: var(--text-quaternary);
205
+ font-weight: var(--body-5-highlight-weight);
206
+ }
207
+
208
+ .leaf-calendar__day:disabled {
209
+ border-color: transparent;
210
+ background-color: transparent;
211
+ color: var(--text-tertiary);
212
+ opacity: 0.5;
213
+ cursor: not-allowed;
214
+ }
215
+
216
+ .leaf-calendar__day:focus-visible,
217
+ .leaf-calendar__option:focus-visible,
218
+ .leaf-calendar__nav:focus-visible,
219
+ .leaf-calendar__title:focus-visible,
220
+ .leaf-calendar__select:focus-visible {
221
+ outline: 2px solid var(--text-highlight);
222
+ outline-offset: 1px;
223
+ }
224
+
225
+ .leaf-calendar__empty {
226
+ height: var(--leaf-calendar-cell);
227
+ }
228
+
229
+ .leaf-calendar__divider {
230
+ height: 1px;
231
+ }
232
+
233
+ .leaf-calendar__time {
234
+ display: flex;
235
+ align-items: center;
236
+ justify-content: space-between;
237
+ gap: 8px;
238
+ }
239
+
240
+ .leaf-calendar__time-group {
241
+ display: flex;
242
+ align-items: center;
243
+ gap: 4px;
244
+ }
245
+
246
+ .leaf-calendar__select-wrap {
247
+ position: relative;
248
+ }
249
+
250
+ .leaf-calendar__select {
251
+ display: inline-flex;
252
+ align-items: center;
253
+ justify-content: space-between;
254
+ padding-inline: 8px;
255
+ border-radius: 8px;
256
+ box-sizing: border-box;
257
+ width: 64px;
258
+ height: var(--leaf-calendar-cell);
259
+ padding-block: 0;
260
+ border: 1px solid var(--base-quaternary);
261
+ background-color: var(--base-tertiary);
262
+ color: var(--text-primary);
263
+ }
264
+
265
+ .leaf-calendar__select[aria-expanded="true"] {
266
+ border-color: var(--text-highlight);
267
+ }
268
+
269
+ .leaf-calendar__list {
270
+ position: absolute;
271
+ left: 0;
272
+ z-index: 20;
273
+ display: flex;
274
+ flex-direction: column;
275
+ gap: 2px;
276
+ padding: 4px;
277
+ border-width: 1px;
278
+ border-style: solid;
279
+ border-radius: 8px;
280
+ overflow-y: auto;
281
+ box-sizing: border-box;
282
+ width: 64px;
283
+ max-height: 160px;
284
+ }
285
+
286
+ .leaf-calendar__list[data-placement="bottom"] {
287
+ top: 100%;
288
+ margin-top: 4px;
289
+ }
290
+
291
+ .leaf-calendar__list[data-placement="top"] {
292
+ bottom: 100%;
293
+ margin-bottom: 4px;
294
+ }
295
+
296
+ .leaf-calendar__footer {
297
+ display: flex;
298
+ gap: 8px;
299
+ }
300
+
301
+ .leaf-calendar__footer > .leaf-button {
302
+ flex: 1;
303
+ }
304
+
305
+ .leaf-calendar[hidden],
306
+ .leaf-calendar__header[hidden],
307
+ .leaf-calendar__nav[hidden],
308
+ .leaf-calendar__title[hidden],
309
+ .leaf-calendar__heading[hidden],
310
+ .leaf-calendar__caret[hidden],
311
+ .leaf-calendar__months[hidden],
312
+ .leaf-calendar__months-header[hidden],
313
+ .leaf-calendar__months-grid[hidden],
314
+ .leaf-calendar__weekdays[hidden],
315
+ .leaf-calendar__days[hidden],
316
+ .leaf-calendar__time[hidden],
317
+ .leaf-calendar__time-group[hidden],
318
+ .leaf-calendar__select[hidden],
319
+ .leaf-calendar__footer[hidden],
320
+ .leaf-calendar__list[hidden],
321
+ .leaf-calendar__day[hidden],
322
+ .leaf-calendar__option[hidden] {
323
+ display: none;
324
+ }
325
+ }