tandd-ui 0.2.0 → 0.2.2
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/CHANGELOG.md +16 -0
- package/README.md +73 -59
- package/dist/components/select/DTSelect.vue.d.ts +5 -0
- package/dist/components/tree-select/DTTreeSelect.vue.d.ts +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/tandd-ui.css +131 -0
- package/dist/tandd-ui.js +4148 -4146
- package/package.json +1 -1
- package/src/components/select/DTSelect.scss +150 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tandd-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Vue 3 component library from the TanDD UI design reference: light and dark themes, localization, and accessible components.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "TanDD (https://tandd.dev)",
|
|
@@ -179,6 +179,90 @@
|
|
|
179
179
|
@include dt-visually-hidden($reset-box: false);
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
// Variants, matching DTInput (owner 2026-11-11: "select component ko có variant"). The trigger is
|
|
183
|
+
// the field box: soft is a muted fill that turns to the surface on focus; outlined has a larger
|
|
184
|
+
// radius and a 2 px focus border; filled has a bottom border only; underlined and plain have no
|
|
185
|
+
// fill and no side padding. Focus recolours the border, as in DTInput; plain, with no border, gets
|
|
186
|
+
// an inset underline instead.
|
|
187
|
+
.dt-select--soft .dt-select__trigger {
|
|
188
|
+
background: var(--dt-color-surface-muted);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.dt-select--soft .dt-select__trigger:focus-visible,
|
|
192
|
+
.dt-select--soft.is-open .dt-select__trigger {
|
|
193
|
+
background: var(--dt-color-surface);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.dt-select--outlined .dt-select__trigger {
|
|
197
|
+
border-radius: var(--dt-radius-md);
|
|
198
|
+
background: var(--dt-color-surface);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.dt-select--outlined .dt-select__trigger:focus-visible,
|
|
202
|
+
.dt-select--outlined.is-open .dt-select__trigger {
|
|
203
|
+
box-shadow: inset 0 0 0 1px var(--dt-color-primary);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.dt-select--filled .dt-select__trigger {
|
|
207
|
+
border-width: 0 0 2px;
|
|
208
|
+
border-radius: var(--dt-radius-sm) var(--dt-radius-sm) 0 0;
|
|
209
|
+
background: var(--dt-color-surface-muted);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.dt-select--underlined .dt-select__trigger,
|
|
213
|
+
.dt-select--plain .dt-select__trigger {
|
|
214
|
+
padding-inline: 0;
|
|
215
|
+
border-radius: 0;
|
|
216
|
+
background: transparent;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.dt-select--underlined .dt-select__trigger {
|
|
220
|
+
border-width: 0 0 1px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.dt-select--underlined .dt-select__trigger:focus-visible,
|
|
224
|
+
.dt-select--underlined.is-open .dt-select__trigger {
|
|
225
|
+
box-shadow: inset 0 -1px 0 var(--dt-color-primary);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.dt-select--plain .dt-select__trigger {
|
|
229
|
+
border-width: 0;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.dt-select--plain .dt-select__trigger:focus-visible,
|
|
233
|
+
.dt-select--plain.is-open .dt-select__trigger {
|
|
234
|
+
box-shadow: inset 0 -2px 0 var(--dt-color-primary);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.dt-select--plain.is-invalid .dt-select__trigger {
|
|
238
|
+
box-shadow: inset 0 -2px 0 var(--dt-color-danger);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Disabled keeps the muted fill on the variants that have a fill (beats outlined's surface).
|
|
242
|
+
.dt-select .dt-select__trigger:disabled {
|
|
243
|
+
background: var(--dt-color-surface-muted);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// No fill to lift on hover where the variant has none; the border shows the hover instead.
|
|
247
|
+
.dt-select:is(.dt-select--underlined, .dt-select--plain) .dt-select__trigger:hover:not(:disabled) {
|
|
248
|
+
background: transparent;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Chips and the clear button follow the side padding of underlined and plain.
|
|
252
|
+
.dt-select:is(.dt-select--underlined, .dt-select--plain) .dt-select__chips {
|
|
253
|
+
padding-inline-start: 0;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.dt-select:is(.dt-select--underlined, .dt-select--plain) .dt-select__clear {
|
|
257
|
+
inset-inline-end: 22px;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Disabled and read-only keep each variant's shape; the muted fill stays off where there is none.
|
|
261
|
+
.dt-select:is(.dt-select--underlined, .dt-select--plain) .dt-select__trigger:disabled,
|
|
262
|
+
.dt-select.is-readonly:is(.dt-select--underlined, .dt-select--plain) .dt-select__trigger {
|
|
263
|
+
background: transparent;
|
|
264
|
+
}
|
|
265
|
+
|
|
182
266
|
// Sizes: the trigger matches DTInput (32, 40, 48 px); md is the base rule above.
|
|
183
267
|
.dt-select--sm .dt-select__trigger {
|
|
184
268
|
height: 32px;
|
|
@@ -216,6 +300,72 @@
|
|
|
216
300
|
height: 100%;
|
|
217
301
|
}
|
|
218
302
|
|
|
303
|
+
// Floating label (owner 2026-11-11: "outlined label vẫn chưa đúng vị trí"). Outlined, underlined,
|
|
304
|
+
// and plain draw the label on the field like a DTInput with a value: outlined on a surface-coloured
|
|
305
|
+
// notch over the top border, underlined and plain just above the line. The label keeps its element
|
|
306
|
+
// (the trigger is labelled by it); only its position changes. Values match DTInput's floated label.
|
|
307
|
+
.dt-select--floating {
|
|
308
|
+
position: relative;
|
|
309
|
+
gap: 0;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Taken out of the column and drawn over the trigger's top edge (the root's padding-top leaves room
|
|
313
|
+
// above the trigger for its upper half, as DTInput's --dt-field-float-space does).
|
|
314
|
+
.dt-select--floating .dt-select__label {
|
|
315
|
+
position: absolute;
|
|
316
|
+
z-index: 2;
|
|
317
|
+
left: 0;
|
|
318
|
+
max-width: calc(100% - 24px);
|
|
319
|
+
overflow: hidden;
|
|
320
|
+
font-size: 11px;
|
|
321
|
+
line-height: 1.2;
|
|
322
|
+
white-space: nowrap;
|
|
323
|
+
text-overflow: ellipsis;
|
|
324
|
+
pointer-events: none;
|
|
325
|
+
transform: translateY(-50%);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// Outlined: centred on the top border (7 px float space), 9 px in, with a 4 px notch each side.
|
|
329
|
+
.dt-select--floating.dt-select--outlined {
|
|
330
|
+
padding-top: 7px;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.dt-select--floating.dt-select--outlined .dt-select__label {
|
|
334
|
+
top: 7px;
|
|
335
|
+
left: 9px;
|
|
336
|
+
padding: 0 4px;
|
|
337
|
+
background: var(--dt-color-surface);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// Underlined and plain: 10 px float space, label just above the value, flush with it.
|
|
341
|
+
.dt-select--floating:is(.dt-select--underlined, .dt-select--plain) {
|
|
342
|
+
padding-top: 10px;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.dt-select--floating:is(.dt-select--underlined, .dt-select--plain) .dt-select__label {
|
|
346
|
+
top: 8px;
|
|
347
|
+
font-size: 12px;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// Focus and errors recolour the floated label, as in DTInput.
|
|
351
|
+
.dt-select--floating:has(.dt-select__trigger:focus-visible) .dt-select__label,
|
|
352
|
+
.dt-select--floating.is-open .dt-select__label {
|
|
353
|
+
color: var(--dt-color-primary);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.dt-select--floating.is-invalid .dt-select__label {
|
|
357
|
+
color: var(--dt-color-danger);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.dt-select--floating.is-disabled .dt-select__label {
|
|
361
|
+
color: var(--dt-color-text-disabled);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// The size rules above set side padding; underlined and plain keep none.
|
|
365
|
+
.dt-select:is(.dt-select--underlined, .dt-select--plain) .dt-select__trigger {
|
|
366
|
+
padding-inline: 0;
|
|
367
|
+
}
|
|
368
|
+
|
|
219
369
|
// Read-only: the value reads normally on a muted surface, like a read-only DTInput.
|
|
220
370
|
.dt-select.is-readonly .dt-select__trigger {
|
|
221
371
|
background: var(--dt-color-surface-muted);
|