vueless 0.0.175 → 0.0.177
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/package.json +2 -2
- package/ui.data-table/components/TableRow.vue +170 -0
- package/ui.data-table/composables/attrs.composable.js +30 -11
- package/ui.data-table/configs/default.config.js +27 -8
- package/ui.data-table/index.stories.js +106 -16
- package/ui.data-table/index.vue +49 -166
- package/ui.data-table/services/table.service.js +49 -9
- package/ui.dropdown-list/configs/default.config.js +2 -2
- package/ui.form-checkbox/configs/default.config.js +3 -2
- package/ui.form-checkbox/index.vue +3 -1
- package/ui.form-input/configs/default.config.js +3 -3
- package/ui.form-label/configs/default.config.js +31 -25
- package/ui.form-label/index.vue +3 -13
- package/ui.form-radio/configs/default.config.js +3 -0
- package/ui.form-radio/index.vue +1 -1
- package/ui.form-select/configs/default.config.js +8 -8
- package/ui.form-select/index.vue +13 -3
- package/ui.form-textarea/configs/default.config.js +10 -13
- package/ui.loader-rendering/Docs.mdx +2 -1
- package/ui.loader-rendering/index.stories.js +20 -15
- package/ui.loader-top/Docs.mdx +40 -8
- package/ui.loader-top/composables/useLoaderTop.js +10 -23
- package/ui.loader-top/index.stories.js +28 -23
- package/ui.loader-top/index.vue +21 -21
- package/web-types.json +100 -134
- package/ui.form-radio-card/Docs.mdx +0 -16
- package/ui.form-radio-card/composables/attrs.composable.js +0 -37
- package/ui.form-radio-card/configs/default.config.js +0 -31
- package/ui.form-radio-card/constants/index.js +0 -5
- package/ui.form-radio-card/index.stories.js +0 -152
- package/ui.form-radio-card/index.vue +0 -142
- package/ui.form-radio-card/services/variant.service.js +0 -15
package/ui.data-table/index.vue
CHANGED
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
|
|
68
68
|
<ULoaderTop
|
|
69
69
|
v-if="resource && isHeaderSticky"
|
|
70
|
-
:
|
|
70
|
+
:resources="resource"
|
|
71
71
|
v-bind="stickyHeaderLoaderAttrs"
|
|
72
72
|
/>
|
|
73
73
|
</div>
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
</th>
|
|
127
127
|
</tr>
|
|
128
128
|
|
|
129
|
-
<ULoaderTop v-if="resource" :
|
|
129
|
+
<ULoaderTop v-if="resource" :resources="resource" v-bind="headerLoaderAttrs" />
|
|
130
130
|
</thead>
|
|
131
131
|
|
|
132
132
|
<tbody v-if="tableRows.length" v-bind="bodyAttrs">
|
|
@@ -154,89 +154,33 @@
|
|
|
154
154
|
</td>
|
|
155
155
|
</tr>
|
|
156
156
|
|
|
157
|
-
<
|
|
158
|
-
v-if="!isShownRow(row)"
|
|
157
|
+
<TableRow
|
|
159
158
|
v-bind="bodyRowAttrs(getRowClasses(row))"
|
|
159
|
+
v-model:selectedRows="selectedRows"
|
|
160
|
+
:selectable="selectable"
|
|
160
161
|
:data-cy="`${dataCy}-row`"
|
|
161
|
-
|
|
162
|
+
:row="row"
|
|
163
|
+
:columns="columns"
|
|
164
|
+
:config="config"
|
|
165
|
+
:attrs="{
|
|
166
|
+
bodyCellAttrs,
|
|
167
|
+
bodyCellSecondaryAttrs,
|
|
168
|
+
bodyCellSecondaryEmptyAttrs,
|
|
169
|
+
bodyCellNestedCollapseIconAttrs,
|
|
170
|
+
bodyCellNestedExpandIconAttrs,
|
|
171
|
+
bodyCellNestedAttrs,
|
|
172
|
+
}"
|
|
173
|
+
@click="onClickRow"
|
|
174
|
+
@toggle-row-visibility="onToggleRowVisibility"
|
|
162
175
|
>
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
v-model="selectedRows"
|
|
166
|
-
:data-id="row.id"
|
|
167
|
-
:value="row.id"
|
|
168
|
-
size="sm"
|
|
169
|
-
:data-cy="`${dataCy}-body-checkbox`"
|
|
170
|
-
v-bind="bodyCheckboxAttrs"
|
|
171
|
-
@click.stop
|
|
172
|
-
/>
|
|
173
|
-
</td>
|
|
174
|
-
|
|
175
|
-
<td
|
|
176
|
-
v-for="(value, key, index) in TableService.getFilteredRow(row, columns)"
|
|
176
|
+
<template
|
|
177
|
+
v-for="(value, key, index) in getFilteredRow(row, columns)"
|
|
177
178
|
:key="index"
|
|
178
|
-
|
|
179
|
+
#[`cell-${key}`]="slotValues"
|
|
179
180
|
>
|
|
180
|
-
<
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
:style="getNestedShift(row.nestedLevel)"
|
|
184
|
-
v-bind="bodyCellNestedWrapperAttrs(index)"
|
|
185
|
-
@click="onClickNestedWrapper(row)"
|
|
186
|
-
>
|
|
187
|
-
<div v-if="isShownNestedIcon({ index, row })" v-bind="bodyCellNestedAttrs">
|
|
188
|
-
<UIcon
|
|
189
|
-
v-if="row.isHidden"
|
|
190
|
-
size="xs"
|
|
191
|
-
internal
|
|
192
|
-
interactive
|
|
193
|
-
:name="config.bodyCellNestedExpandIconName"
|
|
194
|
-
:color="isActiveNestedIcon(row)"
|
|
195
|
-
v-bind="bodyCellNestedExpandIconAttrs"
|
|
196
|
-
/>
|
|
197
|
-
|
|
198
|
-
<UIcon
|
|
199
|
-
v-else
|
|
200
|
-
size="xs"
|
|
201
|
-
internal
|
|
202
|
-
interactive
|
|
203
|
-
:name="config.bodyCellNestedCollapseIconName"
|
|
204
|
-
v-bind="bodyCellNestedCollapseIconAttrs"
|
|
205
|
-
/>
|
|
206
|
-
</div>
|
|
207
|
-
</div>
|
|
208
|
-
|
|
209
|
-
<!-- @slot Use it to customise table cell item (in whole column). -->
|
|
210
|
-
<slot :name="`cell-${key}`" :value="value" :row="row" />
|
|
211
|
-
</template>
|
|
212
|
-
|
|
213
|
-
<template v-else-if="value?.hasOwnProperty('secondary')">
|
|
214
|
-
<div :data-cy="`${dataCy}-${key}-cell`">
|
|
215
|
-
{{ value.primary || HYPHEN_SYMBOL }}
|
|
216
|
-
</div>
|
|
217
|
-
|
|
218
|
-
<div v-bind="bodyCellSecondaryAttrs">
|
|
219
|
-
<template v-if="Array.isArray(value.secondary)">
|
|
220
|
-
<div v-for="(secondary, idx) in value.secondary" :key="idx">
|
|
221
|
-
<span v-bind="bodyCellSecondaryEmptyAttrs">
|
|
222
|
-
{{ secondary }}
|
|
223
|
-
</span>
|
|
224
|
-
</div>
|
|
225
|
-
</template>
|
|
226
|
-
|
|
227
|
-
<template v-else>
|
|
228
|
-
{{ value.secondary }}
|
|
229
|
-
</template>
|
|
230
|
-
</div>
|
|
231
|
-
</template>
|
|
232
|
-
|
|
233
|
-
<template v-else>
|
|
234
|
-
<div :data-cy="`${dataCy}-${key}-cell`">
|
|
235
|
-
{{ value || HYPHEN_SYMBOL }}
|
|
236
|
-
</div>
|
|
237
|
-
</template>
|
|
238
|
-
</td>
|
|
239
|
-
</tr>
|
|
181
|
+
<slot :name="`cell-${key}`" :value="slotValues.value" :row="slotValues.row" />
|
|
182
|
+
</template>
|
|
183
|
+
</TableRow>
|
|
240
184
|
|
|
241
185
|
<tr
|
|
242
186
|
v-if="rowIndex === lastRow && hasSlotContent($slots['after-last-row'])"
|
|
@@ -300,18 +244,25 @@ import {
|
|
|
300
244
|
} from "vue";
|
|
301
245
|
import { merge } from "lodash-es";
|
|
302
246
|
|
|
303
|
-
import UIcon from "../ui.image-icon";
|
|
304
247
|
import UEmpty from "../ui.text-empty";
|
|
305
248
|
import UDivider from "../ui.container-divider";
|
|
306
249
|
import UCheckbox from "../ui.form-checkbox";
|
|
307
250
|
import ULoaderTop from "../ui.loader-top";
|
|
251
|
+
import TableRow from "./components/TableRow";
|
|
308
252
|
|
|
309
253
|
import UIService from "../service.ui";
|
|
310
254
|
|
|
311
255
|
import defaultConfig from "./configs/default.config";
|
|
312
|
-
import
|
|
313
|
-
|
|
314
|
-
|
|
256
|
+
import {
|
|
257
|
+
normalizeColumns,
|
|
258
|
+
getFilteredRow,
|
|
259
|
+
syncRowCheck,
|
|
260
|
+
toggleRowVisibility,
|
|
261
|
+
switchRowCheck,
|
|
262
|
+
getFlatRows,
|
|
263
|
+
} from "./services/table.service";
|
|
264
|
+
|
|
265
|
+
import { PX_IN_REM } from "../service.ui";
|
|
315
266
|
import { UTable } from "./constants";
|
|
316
267
|
import { useAttrs } from "./composables/attrs.composable";
|
|
317
268
|
import { useLocale } from "../composable.locale";
|
|
@@ -376,14 +327,6 @@ const props = defineProps({
|
|
|
376
327
|
default: UIService.get(defaultConfig, UTable).default.stickyFooter,
|
|
377
328
|
},
|
|
378
329
|
|
|
379
|
-
/**
|
|
380
|
-
* Sets the nesting level from which folding button need to be shown.
|
|
381
|
-
*/
|
|
382
|
-
nesting: {
|
|
383
|
-
type: [Number, Boolean],
|
|
384
|
-
default: UIService.get(defaultConfig, UTable).default.nesting,
|
|
385
|
-
},
|
|
386
|
-
|
|
387
330
|
/**
|
|
388
331
|
* Set loader resource name to activate table top loader exact for that resource.
|
|
389
332
|
*/
|
|
@@ -420,7 +363,6 @@ const selectAll = ref(false);
|
|
|
420
363
|
const canSelectAll = ref(true);
|
|
421
364
|
const selectedRows = ref([]);
|
|
422
365
|
const tableRows = ref([]);
|
|
423
|
-
const hiddenIds = ref([]);
|
|
424
366
|
const firstRow = ref(0);
|
|
425
367
|
const tableWidth = ref(0);
|
|
426
368
|
const tableHeight = ref(0);
|
|
@@ -443,11 +385,7 @@ const isFooterSticky = computed(
|
|
|
443
385
|
isCheckedMoreOneTableItems.value,
|
|
444
386
|
);
|
|
445
387
|
|
|
446
|
-
const normalizedColumns = computed(() =>
|
|
447
|
-
|
|
448
|
-
const isSelectedAllRows = computed(() => {
|
|
449
|
-
return selectedRows.value.length === tableRows.value.length;
|
|
450
|
-
});
|
|
388
|
+
const normalizedColumns = computed(() => normalizeColumns(props.columns));
|
|
451
389
|
|
|
452
390
|
const colsCount = computed(() => {
|
|
453
391
|
return props.columns.length + 1;
|
|
@@ -458,7 +396,7 @@ const lastRow = computed(() => {
|
|
|
458
396
|
});
|
|
459
397
|
|
|
460
398
|
const isShownActionsHeader = computed(
|
|
461
|
-
() => hasSlotContent(slots["header-actions"]) && selectedRows.value.length,
|
|
399
|
+
() => hasSlotContent(slots["header-actions"]) && Boolean(selectedRows.value.length),
|
|
462
400
|
);
|
|
463
401
|
|
|
464
402
|
const isHeaderSticky = computed(() => {
|
|
@@ -487,8 +425,10 @@ const hasSlotContentBeforeFirstRow = computed(() => {
|
|
|
487
425
|
: false;
|
|
488
426
|
});
|
|
489
427
|
|
|
490
|
-
const
|
|
491
|
-
|
|
428
|
+
const isSelectedAllRows = computed(() => {
|
|
429
|
+
const rows = getFlatRows(tableRows.value);
|
|
430
|
+
|
|
431
|
+
return selectedRows.value.length === rows.length;
|
|
492
432
|
});
|
|
493
433
|
|
|
494
434
|
const {
|
|
@@ -505,14 +445,12 @@ const {
|
|
|
505
445
|
bodyRowAttrs,
|
|
506
446
|
footerClassesAttrs,
|
|
507
447
|
bodyRowDateSeparatorAttrs,
|
|
508
|
-
bodyCellNestedWrapperAttrs,
|
|
509
448
|
headerCellAttrs,
|
|
510
449
|
bodyCellAttrs,
|
|
511
450
|
stickyHeaderActionsCheckboxAttrs,
|
|
512
451
|
stickyHeaderCheckboxAttrs,
|
|
513
452
|
headerCheckboxAttrs,
|
|
514
453
|
headerCounterAttrs,
|
|
515
|
-
bodyCheckboxAttrs,
|
|
516
454
|
bodyCellNestedCollapseIconAttrs,
|
|
517
455
|
bodyCellNestedExpandIconAttrs,
|
|
518
456
|
bodyEmptyStateAttrs,
|
|
@@ -533,7 +471,6 @@ const {
|
|
|
533
471
|
headerAttrs,
|
|
534
472
|
} = useAttrs(props, {
|
|
535
473
|
tableRows,
|
|
536
|
-
isNesting,
|
|
537
474
|
isShownActionsHeader,
|
|
538
475
|
isHeaderSticky,
|
|
539
476
|
isFooterSticky,
|
|
@@ -551,11 +488,7 @@ watch(isFooterSticky, (newValue) =>
|
|
|
551
488
|
watch(
|
|
552
489
|
() => selectedRows.value.length,
|
|
553
490
|
() => {
|
|
554
|
-
tableRows.value = tableRows.value.map((row) =>
|
|
555
|
-
row.isChecked = selectedRows.value.includes(row.id);
|
|
556
|
-
|
|
557
|
-
return row;
|
|
558
|
-
});
|
|
491
|
+
tableRows.value = tableRows.value.map((row) => syncRowCheck(row, selectedRows.value));
|
|
559
492
|
},
|
|
560
493
|
);
|
|
561
494
|
|
|
@@ -585,56 +518,12 @@ function onWindowResize() {
|
|
|
585
518
|
setFooterCellWidth();
|
|
586
519
|
}
|
|
587
520
|
|
|
588
|
-
function isShownNestedIcon({ index, row }) {
|
|
589
|
-
const nestedLevel = props.nesting === true ? 0 : Number(props.nesting);
|
|
590
|
-
const isWithinNestingLevel = row.nestedLevel >= nestedLevel;
|
|
591
|
-
const isChildren = row.childrenIds?.length > 0;
|
|
592
|
-
|
|
593
|
-
const isFirstRow = index === 0;
|
|
594
|
-
|
|
595
|
-
return isFirstRow && (isChildren || row.isNestingRow) && isNesting.value && isWithinNestingLevel;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
function isActiveNestedIcon(row) {
|
|
599
|
-
return !row.childrenIds?.length ? "grayscale" : "";
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
function onClickNestedWrapper(row) {
|
|
603
|
-
if (!isNesting.value || !row.childrenIds.length) return;
|
|
604
|
-
const [firstElement] = row.childrenIds;
|
|
605
|
-
|
|
606
|
-
row.isHidden = !row.isHidden;
|
|
607
|
-
|
|
608
|
-
if (row.isHidden && row.childrenIds.length) {
|
|
609
|
-
hiddenIds.value.push(...row.childrenIds);
|
|
610
|
-
} else {
|
|
611
|
-
const nestedLevel = props.nesting === true ? 0 : Number(props.nesting);
|
|
612
|
-
|
|
613
|
-
hiddenIds.value =
|
|
614
|
-
row.nestedLevel === nestedLevel
|
|
615
|
-
? row.childrenIds.filter((item) => !hiddenIds.value.includes(item))
|
|
616
|
-
: hiddenIds.value.filter((item) => item !== firstElement);
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
function getNestedShift(nestedLevel) {
|
|
621
|
-
return { marginLeft: `${nestedLevel * 1.5}rem` };
|
|
622
|
-
}
|
|
623
|
-
|
|
624
521
|
function getDateSeparatorLabel(separatorDate) {
|
|
625
522
|
return Array.isArray(props.dateDivider)
|
|
626
523
|
? props.dateDivider.find((dateItem) => dateItem.date === separatorDate)?.label || separatorDate
|
|
627
524
|
: separatorDate;
|
|
628
525
|
}
|
|
629
526
|
|
|
630
|
-
function isShownRow(row) {
|
|
631
|
-
if (hiddenIds.value.includes(row.id)) {
|
|
632
|
-
row.isHidden = true;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
return hiddenIds.value.includes(row.id);
|
|
636
|
-
}
|
|
637
|
-
|
|
638
527
|
function setFooterCellWidth(width) {
|
|
639
528
|
const ZERO_WIDTH = 0;
|
|
640
529
|
|
|
@@ -670,12 +559,6 @@ function synchronizeTableItemsWithProps() {
|
|
|
670
559
|
}
|
|
671
560
|
|
|
672
561
|
tableRows.value = props.rows;
|
|
673
|
-
|
|
674
|
-
tableRows.value.forEach((item) => {
|
|
675
|
-
if (isNesting.value && item.isHidden && item.childrenIds?.length) {
|
|
676
|
-
hiddenIds.value.push(...item.childrenIds);
|
|
677
|
-
}
|
|
678
|
-
});
|
|
679
562
|
}
|
|
680
563
|
|
|
681
564
|
function updateSelectedRows() {
|
|
@@ -715,19 +598,15 @@ function getRowClasses(row) {
|
|
|
715
598
|
return selectedRows.value.includes(row.id) ? config.value.bodyRowChecked : "";
|
|
716
599
|
}
|
|
717
600
|
|
|
718
|
-
function getCellClasses(key) {
|
|
719
|
-
return props.columns.find((column) => column.key === key)?.tdClass;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
601
|
function onChangeSelectAll(selectAll) {
|
|
723
602
|
if (selectAll && canSelectAll.value) {
|
|
724
|
-
selectedRows.value = tableRows.value.map((
|
|
603
|
+
selectedRows.value = getFlatRows(tableRows.value).map((row) => row.id);
|
|
725
604
|
|
|
726
|
-
tableRows.value.forEach((
|
|
605
|
+
tableRows.value.forEach((row) => switchRowCheck(row, true));
|
|
727
606
|
} else if (!selectAll) {
|
|
728
607
|
selectedRows.value = [];
|
|
729
608
|
|
|
730
|
-
tableRows.value.forEach((
|
|
609
|
+
tableRows.value.forEach((row) => switchRowCheck(row, false));
|
|
731
610
|
}
|
|
732
611
|
|
|
733
612
|
canSelectAll.value = true;
|
|
@@ -748,4 +627,8 @@ function onChangeSelectedRows(selectedRows) {
|
|
|
748
627
|
function clearSelectedItems() {
|
|
749
628
|
selectedRows.value = [];
|
|
750
629
|
}
|
|
630
|
+
|
|
631
|
+
function onToggleRowVisibility(rowId) {
|
|
632
|
+
tableRows.value.forEach((row) => toggleRowVisibility(row, rowId));
|
|
633
|
+
}
|
|
751
634
|
</script>
|
|
@@ -1,15 +1,55 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export function normalizeColumns(columns) {
|
|
2
|
+
return columns.map((column) => (typeof column === "string" ? { label: column } : column));
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function getFilteredRow(row, columns) {
|
|
6
|
+
const filteredRow = Object.entries(row).filter((item) => {
|
|
7
|
+
const isShownColumn = columns.some((column) => column.key === item[0]);
|
|
8
|
+
|
|
9
|
+
if (isShownColumn) return item;
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
return Object.fromEntries(filteredRow);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function syncRowCheck(row, selectedRows) {
|
|
16
|
+
row.isChecked = selectedRows.includes(row.id);
|
|
17
|
+
|
|
18
|
+
if (row.row) {
|
|
19
|
+
row.row = syncRowCheck(row.row, selectedRows);
|
|
4
20
|
}
|
|
5
21
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const isShownColumn = columns.some((column) => column.key === item[0]);
|
|
22
|
+
return row;
|
|
23
|
+
}
|
|
9
24
|
|
|
10
|
-
|
|
11
|
-
|
|
25
|
+
export function toggleRowVisibility(row, targetRowId) {
|
|
26
|
+
if (row.id === targetRowId) row.isHidden = !row.isHidden;
|
|
12
27
|
|
|
13
|
-
|
|
28
|
+
if (row.row) {
|
|
29
|
+
toggleRowVisibility(row.row, targetRowId);
|
|
14
30
|
}
|
|
15
31
|
}
|
|
32
|
+
|
|
33
|
+
export function switchRowCheck(row, isChecked) {
|
|
34
|
+
row.isChecked = isChecked;
|
|
35
|
+
|
|
36
|
+
if (row.row) {
|
|
37
|
+
switchRowCheck(row.row, isChecked);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function getFlatRows(tableRows) {
|
|
42
|
+
const rows = [];
|
|
43
|
+
|
|
44
|
+
function addRow(row) {
|
|
45
|
+
rows.push(row);
|
|
46
|
+
|
|
47
|
+
if (row.row) {
|
|
48
|
+
addRow(row.row);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
tableRows.forEach((row) => addRow(row));
|
|
53
|
+
|
|
54
|
+
return rows;
|
|
55
|
+
}
|
|
@@ -10,7 +10,7 @@ export default /*tw*/ {
|
|
|
10
10
|
hover:transition hover:duration-100 hover:ease-in-out bg-white opacity-1
|
|
11
11
|
`,
|
|
12
12
|
subGroupLabel: {
|
|
13
|
-
base: "pointer-events-none bg-transparent !font-medium leading-none !uppercase !text-gray-500/[85] pt-1",
|
|
13
|
+
base: "pointer-events-none bg-transparent !font-medium !leading-none !uppercase !text-gray-500/[85] pt-1",
|
|
14
14
|
variants: {
|
|
15
15
|
size: {
|
|
16
16
|
sm: "text-2xs",
|
|
@@ -20,7 +20,7 @@ export default /*tw*/ {
|
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
groupLabel: {
|
|
23
|
-
base: "pointer-events-none bg-transparent !font-medium leading-none !uppercase !text-gray-500/[85] pt-6 group-first/item:pt-2",
|
|
23
|
+
base: "pointer-events-none bg-transparent !font-medium !leading-none !uppercase !text-gray-500/[85] pt-6 group-first/item:pt-2",
|
|
24
24
|
variants: {
|
|
25
25
|
size: {
|
|
26
26
|
sm: "text-2xs pb-1 mt-4",
|
|
@@ -20,6 +20,7 @@ export default /*tw*/ {
|
|
|
20
20
|
icon: "",
|
|
21
21
|
checkbox: {
|
|
22
22
|
base: `
|
|
23
|
+
transition duration-100 ease-in-out
|
|
23
24
|
border border-solid rounded
|
|
24
25
|
border-gray-300 bg-white
|
|
25
26
|
hover:border-gray-400
|
|
@@ -34,11 +35,11 @@ export default /*tw*/ {
|
|
|
34
35
|
sm: "size-5 text-sm",
|
|
35
36
|
md: "size-6",
|
|
36
37
|
lg: "size-7 text-lg",
|
|
37
|
-
xl: "size-
|
|
38
|
+
xl: "size-8 text-xl",
|
|
38
39
|
},
|
|
39
40
|
color: {
|
|
40
41
|
grayscale: `
|
|
41
|
-
focus:border-gray-500 focus:ring-gray-
|
|
42
|
+
focus:border-gray-500 focus:ring-gray-500
|
|
42
43
|
checked:border-gray-900 checked:bg-gray-900 checked:text-gray-900
|
|
43
44
|
active:border-gray-900 active:bg-gray-900
|
|
44
45
|
`,
|
|
@@ -135,7 +135,7 @@ const props = defineProps({
|
|
|
135
135
|
|
|
136
136
|
/**
|
|
137
137
|
* Checkbox size.
|
|
138
|
-
* @values sm, md, lg
|
|
138
|
+
* @values xs, sm, md, lg, xl
|
|
139
139
|
*/
|
|
140
140
|
size: {
|
|
141
141
|
type: String,
|
|
@@ -192,9 +192,11 @@ const { config, checkboxAttrs, iconWrapperCellAttrs, labelAttrs, iconAttrs } = u
|
|
|
192
192
|
|
|
193
193
|
const iconSize = computed(() => {
|
|
194
194
|
const sizes = {
|
|
195
|
+
xs: "2xs",
|
|
195
196
|
sm: "xs",
|
|
196
197
|
md: "sm",
|
|
197
198
|
lg: "md",
|
|
199
|
+
xl: "lg",
|
|
198
200
|
};
|
|
199
201
|
|
|
200
202
|
return sizes[props.size];
|
|
@@ -49,9 +49,9 @@ export default /*tw*/ {
|
|
|
49
49
|
`,
|
|
50
50
|
},
|
|
51
51
|
compoundVariants: [
|
|
52
|
-
{ labelAlign: "topInside", label: true, size: "sm", class: "pt-
|
|
53
|
-
{ labelAlign: "topInside", label: true, size: "md", class: "pt-
|
|
54
|
-
{ labelAlign: "topInside", label: true, size: "lg", class: "pt-
|
|
52
|
+
{ labelAlign: "topInside", label: true, size: "sm", class: "pt-5 pb-1.5" },
|
|
53
|
+
{ labelAlign: "topInside", label: true, size: "md", class: "pt-6 pb-1.5" },
|
|
54
|
+
{ labelAlign: "topInside", label: true, size: "lg", class: "pt-7 pb-2" },
|
|
55
55
|
],
|
|
56
56
|
},
|
|
57
57
|
defaultVariants: {
|
|
@@ -3,38 +3,38 @@ export default /*tw*/ {
|
|
|
3
3
|
base: "flex",
|
|
4
4
|
variants: {
|
|
5
5
|
size: {
|
|
6
|
+
xs: "gap-2",
|
|
6
7
|
sm: "gap-2",
|
|
7
8
|
md: "gap-2.5",
|
|
8
9
|
lg: "gap-3",
|
|
10
|
+
xl: "gap-3.5",
|
|
9
11
|
},
|
|
10
12
|
align: {
|
|
11
13
|
top: "flex-col",
|
|
12
|
-
topInside: "flex-col",
|
|
14
|
+
topInside: "flex-col gap-0",
|
|
13
15
|
topWithDesc: "flex-col-reverse w-fit",
|
|
14
16
|
left: "flex-row w-fit",
|
|
15
17
|
right: "flex-row-reverse w-fit",
|
|
16
18
|
bottom: "flex-col-reverse w-fit",
|
|
17
19
|
},
|
|
18
20
|
},
|
|
19
|
-
compoundVariants: [
|
|
20
|
-
{ align: "topInside", size: "sm", class: "gap-0" },
|
|
21
|
-
{ align: "topInside", size: "md", class: "gap-0" },
|
|
22
|
-
{ align: "topInside", size: "lg", class: "gap-0" },
|
|
23
|
-
],
|
|
24
21
|
},
|
|
25
22
|
labelWrapper: "",
|
|
26
23
|
label: {
|
|
27
24
|
base: "text-gray-500 z-10 font-normal block !leading-none",
|
|
28
25
|
variants: {
|
|
29
26
|
size: {
|
|
27
|
+
xs: "text-2xs",
|
|
30
28
|
sm: "text-xs",
|
|
31
29
|
md: "text-sm",
|
|
32
30
|
lg: "text-base",
|
|
31
|
+
xl: "text-lg",
|
|
33
32
|
},
|
|
34
33
|
align: {
|
|
35
34
|
topInside: "absolute left-4",
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
topWithDesc: "pt-1 pb-1.5",
|
|
36
|
+
left: "pt-1 pb-1 text-gray-900",
|
|
37
|
+
right: "pt-1 pb-1 text-gray-900",
|
|
38
38
|
},
|
|
39
39
|
error: {
|
|
40
40
|
true: "text-red-500",
|
|
@@ -44,49 +44,55 @@ export default /*tw*/ {
|
|
|
44
44
|
},
|
|
45
45
|
},
|
|
46
46
|
compoundVariants: [
|
|
47
|
+
{ align: "topInside", size: "xs", class: "top-1.5" },
|
|
47
48
|
{ align: "topInside", size: "sm", class: "top-2" },
|
|
48
49
|
{ align: "topInside", size: "md", class: "top-2.5" },
|
|
49
50
|
{ align: "topInside", size: "lg", class: "top-3" },
|
|
50
|
-
{ align: "
|
|
51
|
-
{ align: "topWithDesc", size: "
|
|
52
|
-
{ align: "topWithDesc", size: "
|
|
53
|
-
{ align: "
|
|
54
|
-
{ align: "
|
|
55
|
-
{ align: "
|
|
56
|
-
{ align: "
|
|
57
|
-
{ align: "
|
|
58
|
-
{ align: "
|
|
51
|
+
{ align: "topInside", size: "xl", class: "top-3.5" },
|
|
52
|
+
{ align: "topWithDesc", size: "xs", class: "-mt-px" },
|
|
53
|
+
{ align: "topWithDesc", size: "sm", class: "" },
|
|
54
|
+
{ align: "topWithDesc", size: "md", class: "mt-px" },
|
|
55
|
+
{ align: "topWithDesc", size: "lg", class: "mt-0.5" },
|
|
56
|
+
{ align: "topWithDesc", size: "xl", class: "mt-1" },
|
|
57
|
+
{ align: "left", size: "xs", class: "-mt-0.5 text-sm" },
|
|
58
|
+
{ align: "left", size: "sm", class: "text-sm" },
|
|
59
|
+
{ align: "left", size: "md", class: "mt-px text-base" },
|
|
60
|
+
{ align: "left", size: "lg", class: "mt-0.5 text-lg" },
|
|
61
|
+
{ align: "left", size: "xl", class: "mt-1 text-xl" },
|
|
62
|
+
{ align: "right", size: "sm", class: "-mt-0.5 text-xs" },
|
|
63
|
+
{ align: "right", size: "sm", class: "text-sm" },
|
|
64
|
+
{ align: "right", size: "md", class: "mt-px text-base" },
|
|
65
|
+
{ align: "right", size: "lg", class: "mt-0.5 text-lg" },
|
|
66
|
+
{ align: "right", size: "xl", class: "mt-1 text-xl" },
|
|
59
67
|
],
|
|
60
68
|
},
|
|
61
69
|
description: {
|
|
62
70
|
base: "font-normal text-gray-500/[85] !leading-none",
|
|
63
71
|
variants: {
|
|
64
72
|
size: {
|
|
73
|
+
xs: "text-2xs",
|
|
65
74
|
sm: "text-2xs",
|
|
66
75
|
md: "text-xs",
|
|
67
76
|
lg: "text-sm",
|
|
77
|
+
xl: "text-base",
|
|
68
78
|
},
|
|
69
79
|
align: {
|
|
70
80
|
topInside: "pl-4",
|
|
71
|
-
top: "pl-0",
|
|
81
|
+
top: "pl-0 -mt-0.5",
|
|
72
82
|
left: "pl-0",
|
|
73
83
|
right: "pl-0",
|
|
74
|
-
bottom: "-order-1",
|
|
84
|
+
bottom: "-order-1 -mt-2",
|
|
75
85
|
},
|
|
76
86
|
error: {
|
|
77
87
|
true: "text-red-500",
|
|
78
88
|
},
|
|
79
89
|
},
|
|
80
90
|
compoundVariants: [
|
|
81
|
-
{ align: "
|
|
82
|
-
{ align: "bottom", size: "md", class: "-mt-2" },
|
|
83
|
-
{ align: "bottom", size: "lg", class: "-mt-2" },
|
|
84
|
-
{ align: "top", size: "sm", class: "-mt-0.5" },
|
|
85
|
-
{ align: "top", size: "md", class: "-mt-0.5" },
|
|
86
|
-
{ align: "top", size: "lg", class: "-mt-0.5" },
|
|
91
|
+
{ align: "topInside", size: "xs", class: "mt-1" },
|
|
87
92
|
{ align: "topInside", size: "sm", class: "mt-1.5" },
|
|
88
93
|
{ align: "topInside", size: "md", class: "mt-2" },
|
|
89
94
|
{ align: "topInside", size: "lg", class: "mt-2.5" },
|
|
95
|
+
{ align: "topInside", size: "xl", class: "mt-3" },
|
|
90
96
|
],
|
|
91
97
|
},
|
|
92
98
|
defaultVariants: {
|
package/ui.form-label/index.vue
CHANGED
|
@@ -16,12 +16,7 @@
|
|
|
16
16
|
v-text="label"
|
|
17
17
|
/>
|
|
18
18
|
|
|
19
|
-
<div
|
|
20
|
-
v-if="error"
|
|
21
|
-
:data-cy="`${dataCy}-error-message`"
|
|
22
|
-
v-bind="descriptionAttrs"
|
|
23
|
-
v-text="error"
|
|
24
|
-
/>
|
|
19
|
+
<div v-if="error" :data-cy="`${dataCy}-error`" v-bind="descriptionAttrs" v-text="error" />
|
|
25
20
|
|
|
26
21
|
<div
|
|
27
22
|
v-if="description && !error"
|
|
@@ -46,12 +41,7 @@
|
|
|
46
41
|
|
|
47
42
|
<slot />
|
|
48
43
|
|
|
49
|
-
<div
|
|
50
|
-
v-if="error"
|
|
51
|
-
:data-cy="`${dataCy}-error-message`"
|
|
52
|
-
v-bind="descriptionAttrs"
|
|
53
|
-
v-text="error"
|
|
54
|
-
/>
|
|
44
|
+
<div v-if="error" :data-cy="`${dataCy}-error`" v-bind="descriptionAttrs" v-text="error" />
|
|
55
45
|
|
|
56
46
|
<div
|
|
57
47
|
v-if="description && !error"
|
|
@@ -89,7 +79,7 @@ const props = defineProps({
|
|
|
89
79
|
|
|
90
80
|
/**
|
|
91
81
|
* Set label size.
|
|
92
|
-
* @values sm, md, lg
|
|
82
|
+
* @values xs, sm, md, lg, xl
|
|
93
83
|
*/
|
|
94
84
|
size: {
|
|
95
85
|
type: String,
|
|
@@ -2,6 +2,7 @@ export default /*tw*/ {
|
|
|
2
2
|
label: "inline-flex",
|
|
3
3
|
radio: {
|
|
4
4
|
base: `
|
|
5
|
+
transition duration-100 ease-in-out
|
|
5
6
|
border border-solid border-{color}-300 text-{color}-500
|
|
6
7
|
hover:border-{color}-400
|
|
7
8
|
active:border-{color}-500
|
|
@@ -10,9 +11,11 @@ export default /*tw*/ {
|
|
|
10
11
|
`,
|
|
11
12
|
variants: {
|
|
12
13
|
size: {
|
|
14
|
+
xs: "size-4",
|
|
13
15
|
sm: "size-5",
|
|
14
16
|
md: "size-6",
|
|
15
17
|
lg: "size-7",
|
|
18
|
+
xl: "size-8",
|
|
16
19
|
},
|
|
17
20
|
},
|
|
18
21
|
compoundVariants: [
|