@weni/unnnic-system 3.28.2-alpha.3 → 3.29.0
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/dist/index.d.ts +12 -324
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +7345 -7474
- package/dist/unnnic.umd.js +29 -29
- package/package.json +2 -2
- package/src/components/Button/__tests__/Button.spec.js +81 -0
- package/src/components/Button/__tests__/ButtonIcon.spec.js +56 -0
- package/src/components/Carousel/TagCarousel.vue +8 -2
- package/src/components/Carousel/__tests__/TagCarousel.spec.js +258 -0
- package/src/components/ChartLine/__tests__/ChartLine.spec.js +170 -0
- package/src/components/Checkbox/__tests__/Checkbox.spec.js +14 -0
- package/src/components/CheckboxGroup/__tests__/CheckboxGroup.spec.js +62 -0
- package/src/components/DatePicker/DatePicker.vue +1 -0
- package/src/components/DatePicker/__tests__/DatePicker.spec.js +364 -0
- package/src/components/Disclaimer/__tests__/Disclaimer.spec.js +16 -0
- package/src/components/DropArea/DropArea.vue +1 -2
- package/src/components/DropArea/__tests__/DropArea.spec.js +333 -0
- package/src/components/MultiSelect/__tests__/MultiSelect.spec.js +109 -2
- package/src/components/MultiSelect/index.vue +1 -1
- package/src/components/PageHeader/__tests__/PageHeader.spec.js +97 -0
- package/src/components/Pagination/__tests__/Pagination.spec.js +99 -0
- package/src/components/Radio/__test__/Radio.spec.js +67 -0
- package/src/components/RadioGroup/__tests__/RadioGroup.spec.js +100 -0
- package/src/components/Slider/__tests__/Slider.spec.js +321 -0
- package/src/components/Table/Table.vue +2 -21
- package/src/components/Table/TableRow.vue +3 -28
- package/src/components/Tag/DefaultTag.vue +4 -3
- package/src/components/Tag/__tests__/DefaultTag.spec.js +51 -0
- package/src/components/Tag/__tests__/Tag.spec.js +82 -0
- package/src/components/TextArea/__test__/TextArea.spec.js +19 -0
- package/src/components/ToolTip/__tests__/ToolTip.spec.js +82 -1
- package/src/components/index.ts +0 -13
- package/src/stories/Table.stories.js +2 -75
- package/src/components/ui/table/Table.vue +0 -29
- package/src/components/ui/table/TableBody.vue +0 -14
- package/src/components/ui/table/TableCell.vue +0 -28
- package/src/components/ui/table/TableHead.vue +0 -27
- package/src/components/ui/table/TableHeader.vue +0 -24
- package/src/components/ui/table/TableRow.vue +0 -47
- package/src/components/ui/table/index.ts +0 -6
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
|
|
4
|
+
import Tag from '../Tag.vue';
|
|
5
|
+
import DefaultTag from '../DefaultTag.vue';
|
|
6
|
+
import Chip from '../../Chip/Chip.vue';
|
|
7
|
+
|
|
8
|
+
const mountTag = (props = {}) =>
|
|
9
|
+
mount(Tag, {
|
|
10
|
+
props: {
|
|
11
|
+
text: 'Tag label',
|
|
12
|
+
...props,
|
|
13
|
+
},
|
|
14
|
+
global: {
|
|
15
|
+
stubs: {
|
|
16
|
+
UnnnicIcon: true,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('Tag', () => {
|
|
22
|
+
it('renders DefaultTag for default type', () => {
|
|
23
|
+
const wrapper = mountTag({ type: 'default' });
|
|
24
|
+
|
|
25
|
+
expect(wrapper.findComponent(DefaultTag).exists()).toBe(true);
|
|
26
|
+
expect(wrapper.text()).toContain('Tag label');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('renders Chip for brand type', () => {
|
|
30
|
+
const wrapper = mountTag({ type: 'brand' });
|
|
31
|
+
|
|
32
|
+
expect(wrapper.findComponent(Chip).exists()).toBe(true);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('renders Chip when hasCloseIcon is true', () => {
|
|
36
|
+
const wrapper = mountTag({ hasCloseIcon: true });
|
|
37
|
+
|
|
38
|
+
expect(wrapper.findComponent(Chip).exists()).toBe(true);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('emits close when chip with close icon is clicked', async () => {
|
|
42
|
+
const wrapper = mountTag({ hasCloseIcon: true });
|
|
43
|
+
|
|
44
|
+
await wrapper.find('.chip').trigger('click');
|
|
45
|
+
|
|
46
|
+
expect(wrapper.emitted('close')).toBeTruthy();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('emits click for brand type chip', async () => {
|
|
50
|
+
const wrapper = mountTag({ type: 'brand' });
|
|
51
|
+
|
|
52
|
+
await wrapper.find('.chip').trigger('click');
|
|
53
|
+
|
|
54
|
+
expect(wrapper.emitted('click')).toBeTruthy();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('passes small size for next type', () => {
|
|
58
|
+
const wrapper = mountTag({ type: 'next' });
|
|
59
|
+
|
|
60
|
+
expect(wrapper.findComponent(DefaultTag).props('size')).toBe('small');
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe('DefaultTag', () => {
|
|
65
|
+
it('renders left icon when provided', () => {
|
|
66
|
+
const wrapper = mount(DefaultTag, {
|
|
67
|
+
props: { text: 'Label', leftIcon: 'info' },
|
|
68
|
+
global: { stubs: { UnnnicIcon: true } },
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
expect(wrapper.find('.unnnic-tag__icon').exists()).toBe(true);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('applies small size class', () => {
|
|
75
|
+
const wrapper = mount(DefaultTag, {
|
|
76
|
+
props: { text: 'Label', size: 'small' },
|
|
77
|
+
global: { stubs: { UnnnicIcon: true } },
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
expect(wrapper.classes()).toContain('unnnic-tag--small');
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -57,6 +57,18 @@ describe('TextArea.vue', () => {
|
|
|
57
57
|
expect(wrapper.emitted('update:modelValue')[0]).toEqual(['new text']);
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
+
test('applies resize none class binding', async () => {
|
|
61
|
+
await wrapper.setProps({ resize: 'none' });
|
|
62
|
+
expect(wrapper.find('textarea').exists()).toBe(true);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('returns empty error string for non-string non-array errors', async () => {
|
|
66
|
+
await wrapper.setProps({ type: 'error', errors: null });
|
|
67
|
+
expect(
|
|
68
|
+
wrapper.findComponent({ name: 'UnnnicFormElement' }).props('error'),
|
|
69
|
+
).toBe('');
|
|
70
|
+
});
|
|
71
|
+
|
|
60
72
|
test('displays errors when type is error', async () => {
|
|
61
73
|
await wrapper.setProps({ type: 'error', errors: ['Error 1', 'Error 2'] });
|
|
62
74
|
expect(
|
|
@@ -64,6 +76,13 @@ describe('TextArea.vue', () => {
|
|
|
64
76
|
).toBe('Error 1, Error 2');
|
|
65
77
|
});
|
|
66
78
|
|
|
79
|
+
test('displays string error when errors is a string', async () => {
|
|
80
|
+
await wrapper.setProps({ type: 'error', errors: 'Single error' });
|
|
81
|
+
expect(
|
|
82
|
+
wrapper.findComponent({ name: 'UnnnicFormElement' }).props('error'),
|
|
83
|
+
).toBe('Single error');
|
|
84
|
+
});
|
|
85
|
+
|
|
67
86
|
test('applies disabled class and disables textarea when disabled is true', async () => {
|
|
68
87
|
await wrapper.setProps({ disabled: true });
|
|
69
88
|
expect(
|
|
@@ -9,7 +9,7 @@ globalThis.ResizeObserver = vi.fn().mockImplementation(() => ({
|
|
|
9
9
|
disconnect: vi.fn(),
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
|
-
const createWrapper = (props = {}, slots = {}) => {
|
|
12
|
+
const createWrapper = (props = {}, slots = {}, options = {}) => {
|
|
13
13
|
return mount(ToolTip, {
|
|
14
14
|
props,
|
|
15
15
|
slots: {
|
|
@@ -20,11 +20,41 @@ const createWrapper = (props = {}, slots = {}) => {
|
|
|
20
20
|
global: {
|
|
21
21
|
stubs: {
|
|
22
22
|
teleport: true,
|
|
23
|
+
...options.stubs,
|
|
23
24
|
},
|
|
24
25
|
},
|
|
25
26
|
});
|
|
26
27
|
};
|
|
27
28
|
|
|
29
|
+
const createOpenWrapper = (props = {}, slots = {}) =>
|
|
30
|
+
mount(ToolTip, {
|
|
31
|
+
props: {
|
|
32
|
+
forceOpen: true,
|
|
33
|
+
enabled: true,
|
|
34
|
+
...props,
|
|
35
|
+
},
|
|
36
|
+
slots: {
|
|
37
|
+
default: '<button data-testid="trigger-button">Hover me</button>',
|
|
38
|
+
...slots,
|
|
39
|
+
},
|
|
40
|
+
attachTo: document.body,
|
|
41
|
+
global: {
|
|
42
|
+
stubs: {
|
|
43
|
+
Tooltip: {
|
|
44
|
+
template: '<div data-testid="tooltip-wrapper"><slot /></div>',
|
|
45
|
+
},
|
|
46
|
+
TooltipTrigger: {
|
|
47
|
+
template: '<div data-testid="tooltip-trigger"><slot /></div>',
|
|
48
|
+
},
|
|
49
|
+
TooltipContent: {
|
|
50
|
+
props: ['side', 'style', 'class'],
|
|
51
|
+
template:
|
|
52
|
+
'<div data-testid="tooltip-content" :style="style"><slot /></div>',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
28
58
|
describe('ToolTip', () => {
|
|
29
59
|
let wrapper;
|
|
30
60
|
|
|
@@ -367,4 +397,55 @@ describe('ToolTip', () => {
|
|
|
367
397
|
forceOpenWrapper.unmount();
|
|
368
398
|
});
|
|
369
399
|
});
|
|
400
|
+
|
|
401
|
+
describe('Close button', () => {
|
|
402
|
+
it('emits click:close when close icon is clicked', async () => {
|
|
403
|
+
const closeWrapper = createOpenWrapper({
|
|
404
|
+
text: 'Text',
|
|
405
|
+
showClose: true,
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
await closeWrapper.find('.unnnic-tooltip__close').trigger('click');
|
|
409
|
+
|
|
410
|
+
expect(closeWrapper.emitted('click:close')).toBeTruthy();
|
|
411
|
+
closeWrapper.unmount();
|
|
412
|
+
});
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
describe('Content rendering with forceOpen', () => {
|
|
416
|
+
it('renders multiline text content', async () => {
|
|
417
|
+
const multilineWrapper = createOpenWrapper({
|
|
418
|
+
text: 'Line one\nLine two',
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
const content = multilineWrapper.find('[data-testid="tooltip-content"]');
|
|
422
|
+
expect(content.text()).toContain('Line one');
|
|
423
|
+
expect(content.text()).toContain('Line two');
|
|
424
|
+
multilineWrapper.unmount();
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
it('renders HTML content when enableHtml is true', async () => {
|
|
428
|
+
const htmlWrapper = createOpenWrapper({
|
|
429
|
+
text: '<strong>Bold</strong>',
|
|
430
|
+
enableHtml: true,
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
expect(
|
|
434
|
+
htmlWrapper.find('[data-testid="tooltip-html-content"]').exists(),
|
|
435
|
+
).toBe(true);
|
|
436
|
+
htmlWrapper.unmount();
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
it('applies default maxWidth of 320px when not provided', async () => {
|
|
440
|
+
const defaultWidthWrapper = createOpenWrapper({
|
|
441
|
+
text: 'Text',
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
const content = defaultWidthWrapper.find(
|
|
445
|
+
'[data-testid="tooltip-content"]',
|
|
446
|
+
);
|
|
447
|
+
expect(content.attributes('style')).toContain('max-width: 320px');
|
|
448
|
+
defaultWidthWrapper.unmount();
|
|
449
|
+
});
|
|
450
|
+
});
|
|
370
451
|
});
|
package/src/components/index.ts
CHANGED
|
@@ -10,7 +10,6 @@ import sidebar from './Sidebar/index.vue';
|
|
|
10
10
|
import sidebarItem from './Sidebar/SidebarItem.vue';
|
|
11
11
|
import table from './Table/Table.vue';
|
|
12
12
|
import tableRow from './Table/TableRow.vue';
|
|
13
|
-
import { TableBody, TableCell, TableHead, TableHeader } from './ui/table';
|
|
14
13
|
import dropdown from './Dropdown/Dropdown.vue';
|
|
15
14
|
import dropdownItem from './Dropdown/DropdownItem.vue';
|
|
16
15
|
import avatarIcon from './AvatarIcon/AvatarIcon.vue';
|
|
@@ -139,10 +138,6 @@ export const components: ComponentsMap = {
|
|
|
139
138
|
unnnicSidebarItem: sidebarItem,
|
|
140
139
|
unnnicTable: table,
|
|
141
140
|
unnnicTableRow: tableRow,
|
|
142
|
-
unnnicTableBody: TableBody,
|
|
143
|
-
unnnicTableCell: TableCell,
|
|
144
|
-
unnnicTableHead: TableHead,
|
|
145
|
-
unnnicTableHeader: TableHeader,
|
|
146
141
|
unnnicAvatarIcon: avatarIcon,
|
|
147
142
|
unnnicIcon: icon,
|
|
148
143
|
unnnicIconSvg: icon,
|
|
@@ -266,10 +261,6 @@ export const unnnicSidebar = sidebar;
|
|
|
266
261
|
export const unnnicSidebarItem = sidebarItem;
|
|
267
262
|
export const unnnicTable = table;
|
|
268
263
|
export const unnnicTableRow = tableRow;
|
|
269
|
-
export const unnnicTableBody = TableBody;
|
|
270
|
-
export const unnnicTableCell = TableCell;
|
|
271
|
-
export const unnnicTableHead = TableHead;
|
|
272
|
-
export const unnnicTableHeader = TableHeader;
|
|
273
264
|
export const unnnicDropdown = dropdown as VueComponent;
|
|
274
265
|
export const unnnicDropdownItem = dropdownItem;
|
|
275
266
|
export const unnnicAvatarIcon = avatarIcon;
|
|
@@ -392,10 +383,6 @@ export const UnnnicSidebar = sidebar;
|
|
|
392
383
|
export const UnnnicSidebarItem = sidebarItem;
|
|
393
384
|
export const UnnnicTable = table;
|
|
394
385
|
export const UnnnicTableRow = tableRow;
|
|
395
|
-
export const UnnnicTableBody = TableBody;
|
|
396
|
-
export const UnnnicTableCell = TableCell;
|
|
397
|
-
export const UnnnicTableHead = TableHead;
|
|
398
|
-
export const UnnnicTableHeader = TableHeader;
|
|
399
386
|
export const UnnnicDropdown = dropdown as VueComponent;
|
|
400
387
|
export const UnnnicDropdownItem = dropdownItem;
|
|
401
388
|
export const UnnnicAvatarIcon = avatarIcon;
|
|
@@ -2,24 +2,11 @@ import unnnicTable from '../components/Table/Table.vue';
|
|
|
2
2
|
import unnnicTableRow from '../components/Table/TableRow.vue';
|
|
3
3
|
import unnnicButton from '../components/Button/Button.vue';
|
|
4
4
|
import unnnicCheckbox from '../components/Checkbox/Checkbox.vue';
|
|
5
|
-
import {
|
|
6
|
-
TableHeader,
|
|
7
|
-
TableBody,
|
|
8
|
-
TableHead,
|
|
9
|
-
TableCell,
|
|
10
|
-
} from '@/components/ui/table';
|
|
11
|
-
import UnnnicTag from '@/components/Tag/Tag.vue';
|
|
12
|
-
import { action } from 'storybook/actions';
|
|
13
5
|
|
|
14
6
|
export default {
|
|
15
7
|
title: 'example/Table',
|
|
16
8
|
component: unnnicTable,
|
|
17
|
-
argTypes: {
|
|
18
|
-
version: {
|
|
19
|
-
control: { type: 'select' },
|
|
20
|
-
options: ['1', '2'],
|
|
21
|
-
},
|
|
22
|
-
},
|
|
9
|
+
argTypes: {},
|
|
23
10
|
};
|
|
24
11
|
|
|
25
12
|
const Template = (args, { argTypes }) => ({
|
|
@@ -34,7 +21,6 @@ const Template = (args, { argTypes }) => ({
|
|
|
34
21
|
<div>
|
|
35
22
|
<unnnic-table
|
|
36
23
|
v-bind="$props"
|
|
37
|
-
version="1"
|
|
38
24
|
:items="table.items"
|
|
39
25
|
:style="{ maxHeight: '280px', maxWidth: '800px', }"
|
|
40
26
|
>
|
|
@@ -156,63 +142,4 @@ const Template = (args, { argTypes }) => ({
|
|
|
156
142
|
});
|
|
157
143
|
|
|
158
144
|
export const Default = Template.bind({});
|
|
159
|
-
Default.args = {
|
|
160
|
-
version: '1',
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
export const Version2 = {
|
|
164
|
-
render: () => ({
|
|
165
|
-
components: {
|
|
166
|
-
unnnicTable,
|
|
167
|
-
unnnicTableRow,
|
|
168
|
-
TableHeader,
|
|
169
|
-
TableBody,
|
|
170
|
-
TableHead,
|
|
171
|
-
TableCell,
|
|
172
|
-
UnnnicTag,
|
|
173
|
-
},
|
|
174
|
-
setup() {
|
|
175
|
-
return {
|
|
176
|
-
onRowClick: action('click'),
|
|
177
|
-
};
|
|
178
|
-
},
|
|
179
|
-
template: `
|
|
180
|
-
<unnnic-table version="2">
|
|
181
|
-
<TableHeader>
|
|
182
|
-
<unnnic-table-row>
|
|
183
|
-
<TableHead>
|
|
184
|
-
Invoice
|
|
185
|
-
</TableHead>
|
|
186
|
-
<TableHead>Status</TableHead>
|
|
187
|
-
<TableHead>Method</TableHead>
|
|
188
|
-
<TableHead>
|
|
189
|
-
Amount
|
|
190
|
-
</TableHead>
|
|
191
|
-
</unnnic-table-row>
|
|
192
|
-
</TableHeader>
|
|
193
|
-
<TableBody>
|
|
194
|
-
<unnnic-table-row>
|
|
195
|
-
<TableCell>
|
|
196
|
-
INV001
|
|
197
|
-
</TableCell>
|
|
198
|
-
<TableCell><UnnnicTag scheme="green" text="Paid" /></TableCell>
|
|
199
|
-
<TableCell>Credit Card</TableCell>
|
|
200
|
-
<TableCell>
|
|
201
|
-
$250.00
|
|
202
|
-
</TableCell>
|
|
203
|
-
</unnnic-table-row>
|
|
204
|
-
<unnnic-table-row @click="onRowClick">
|
|
205
|
-
<TableCell>
|
|
206
|
-
INV002
|
|
207
|
-
</TableCell>
|
|
208
|
-
<TableCell><UnnnicTag scheme="red" text="Pending" /></TableCell>
|
|
209
|
-
<TableCell>Bank Transfer</TableCell>
|
|
210
|
-
<TableCell>
|
|
211
|
-
$199.00
|
|
212
|
-
</TableCell>
|
|
213
|
-
</unnnic-table-row>
|
|
214
|
-
</TableBody>
|
|
215
|
-
</unnnic-table>
|
|
216
|
-
`,
|
|
217
|
-
}),
|
|
218
|
-
};
|
|
145
|
+
Default.args = {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { HTMLAttributes } from 'vue';
|
|
3
|
-
import { cn } from '@/lib/utils';
|
|
4
|
-
|
|
5
|
-
const props = defineProps<{
|
|
6
|
-
class?: HTMLAttributes['class'];
|
|
7
|
-
}>();
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<div class="relative w-full overflow-auto">
|
|
12
|
-
<table :class="cn('unnnic-table', props.class)">
|
|
13
|
-
<slot />
|
|
14
|
-
</table>
|
|
15
|
-
</div>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<style lang="scss" scoped>
|
|
19
|
-
@use '@/assets/scss/unnnic' as *;
|
|
20
|
-
|
|
21
|
-
.unnnic-table {
|
|
22
|
-
border-collapse: collapse;
|
|
23
|
-
width: 100%;
|
|
24
|
-
caption-side: bottom;
|
|
25
|
-
|
|
26
|
-
@include unnnic-font-body;
|
|
27
|
-
color: $unnnic-color-fg-base;
|
|
28
|
-
}
|
|
29
|
-
</style>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { HTMLAttributes } from 'vue';
|
|
3
|
-
import { cn } from '@/lib/utils';
|
|
4
|
-
|
|
5
|
-
const props = defineProps<{
|
|
6
|
-
class?: HTMLAttributes['class'];
|
|
7
|
-
}>();
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<tbody :class="cn(props.class)">
|
|
12
|
-
<slot />
|
|
13
|
-
</tbody>
|
|
14
|
-
</template>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { HTMLAttributes } from 'vue';
|
|
3
|
-
import { cn } from '@/lib/utils';
|
|
4
|
-
|
|
5
|
-
const props = defineProps<{
|
|
6
|
-
class?: HTMLAttributes['class'];
|
|
7
|
-
}>();
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<td :class="cn('unnnic-table-cell', props.class)">
|
|
12
|
-
<slot />
|
|
13
|
-
</td>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<style lang="scss" scoped>
|
|
17
|
-
@use '@/assets/scss/unnnic' as *;
|
|
18
|
-
|
|
19
|
-
.unnnic-table-cell {
|
|
20
|
-
vertical-align: middle;
|
|
21
|
-
|
|
22
|
-
padding: $unnnic-space-4 0;
|
|
23
|
-
|
|
24
|
-
&:not(:last-child) {
|
|
25
|
-
padding-right: $unnnic-space-4;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
</style>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { HTMLAttributes } from 'vue';
|
|
3
|
-
import { cn } from '@/lib/utils';
|
|
4
|
-
|
|
5
|
-
const props = defineProps<{
|
|
6
|
-
class?: HTMLAttributes['class'];
|
|
7
|
-
}>();
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<th :class="cn('unnnic-table-head', props.class)">
|
|
12
|
-
<slot />
|
|
13
|
-
</th>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<style lang="scss" scoped>
|
|
17
|
-
@use '@/assets/scss/unnnic' as *;
|
|
18
|
-
|
|
19
|
-
.unnnic-table-head {
|
|
20
|
-
@include unnnic-font-caption-1;
|
|
21
|
-
color: $unnnic-color-fg-base;
|
|
22
|
-
text-align: left;
|
|
23
|
-
align-items: center;
|
|
24
|
-
|
|
25
|
-
pointer-events: none;
|
|
26
|
-
}
|
|
27
|
-
</style>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { HTMLAttributes } from 'vue';
|
|
3
|
-
import { cn } from '@/lib/utils';
|
|
4
|
-
|
|
5
|
-
const props = defineProps<{
|
|
6
|
-
class?: HTMLAttributes['class'];
|
|
7
|
-
}>();
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<thead :class="cn('unnnic-table-header', props.class)">
|
|
12
|
-
<slot />
|
|
13
|
-
</thead>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<style lang="scss" scoped>
|
|
17
|
-
@use '@/assets/scss/unnnic' as *;
|
|
18
|
-
|
|
19
|
-
.unnnic-table-header {
|
|
20
|
-
* {
|
|
21
|
-
padding-bottom: $unnnic-space-2;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
</style>
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { HTMLAttributes } from 'vue';
|
|
3
|
-
import { computed, useAttrs } from 'vue';
|
|
4
|
-
import { cn } from '@/lib/utils';
|
|
5
|
-
|
|
6
|
-
const props = defineProps<{
|
|
7
|
-
class?: HTMLAttributes['class'];
|
|
8
|
-
}>();
|
|
9
|
-
|
|
10
|
-
const attrs = useAttrs();
|
|
11
|
-
const isClickable = computed(() => Boolean(attrs.onClick));
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<template>
|
|
15
|
-
<tr
|
|
16
|
-
:class="
|
|
17
|
-
cn(
|
|
18
|
-
'unnnic-table-row',
|
|
19
|
-
'transition-colors data-[state=selected]:bg-muted',
|
|
20
|
-
isClickable && 'cursor-pointer',
|
|
21
|
-
props.class,
|
|
22
|
-
)
|
|
23
|
-
"
|
|
24
|
-
>
|
|
25
|
-
<slot />
|
|
26
|
-
</tr>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<style lang="scss" scoped>
|
|
30
|
-
@use '@/assets/scss/unnnic' as *;
|
|
31
|
-
|
|
32
|
-
.unnnic-table-row {
|
|
33
|
-
& > :first-child {
|
|
34
|
-
padding-left: $unnnic-space-3;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
& > :last-child {
|
|
38
|
-
padding-right: $unnnic-space-3;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
border-bottom: 1px solid $unnnic-color-border-base;
|
|
42
|
-
|
|
43
|
-
&:hover {
|
|
44
|
-
background-color: $unnnic-color-bg-soft;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
</style>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default as Table } from './Table.vue';
|
|
2
|
-
export { default as TableBody } from './TableBody.vue';
|
|
3
|
-
export { default as TableCell } from './TableCell.vue';
|
|
4
|
-
export { default as TableHead } from './TableHead.vue';
|
|
5
|
-
export { default as TableHeader } from './TableHeader.vue';
|
|
6
|
-
export { default as TableRow } from './TableRow.vue';
|