@antify/ui 2.2.1 → 2.2.3

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 (147) hide show
  1. package/dist/components/AntAccordion.vue +25 -12
  2. package/dist/components/AntAccordionItem.vue +28 -13
  3. package/dist/components/AntAlert.vue +25 -15
  4. package/dist/components/AntCard.vue +26 -14
  5. package/dist/components/AntContent.vue +4 -4
  6. package/dist/components/AntDropdown.vue +41 -23
  7. package/dist/components/AntIcon.vue +18 -6
  8. package/dist/components/AntKeycap.vue +31 -16
  9. package/dist/components/AntListGroup.vue +13 -11
  10. package/dist/components/AntListGroupItem.vue +19 -9
  11. package/dist/components/AntModal.vue +26 -15
  12. package/dist/components/AntPagination.vue +28 -15
  13. package/dist/components/AntPopover.vue +74 -51
  14. package/dist/components/AntSkeleton.vue +8 -4
  15. package/dist/components/AntSpinner.vue +14 -6
  16. package/dist/components/AntTag.vue +25 -13
  17. package/dist/components/AntToast.vue +19 -11
  18. package/dist/components/AntToaster.vue +13 -5
  19. package/dist/components/AntTooltip.vue +78 -54
  20. package/dist/components/__stories/AntAccordion.stories.js +4 -4
  21. package/dist/components/__stories/AntAccordion.stories.mjs +50 -17
  22. package/dist/components/__stories/AntAlert.stories.mjs +18 -5
  23. package/dist/components/__stories/AntCard.stories.mjs +36 -10
  24. package/dist/components/__stories/AntContent.stories.mjs +14 -4
  25. package/dist/components/__stories/AntDropdown.stories.mjs +20 -4
  26. package/dist/components/__stories/AntIcon.stories.mjs +38 -12
  27. package/dist/components/__stories/AntKeycap.stories.mjs +35 -10
  28. package/dist/components/__stories/AntListGroup.stories.d.ts +1 -1
  29. package/dist/components/__stories/AntListGroup.stories.mjs +22 -4
  30. package/dist/components/__stories/AntListGroupItem.stories.mjs +27 -8
  31. package/dist/components/__stories/AntModal.stories.mjs +17 -4
  32. package/dist/components/__stories/AntPagination.stories.mjs +21 -6
  33. package/dist/components/__stories/AntPopover.stories.mjs +20 -4
  34. package/dist/components/__stories/AntSkeleton.stories.mjs +17 -5
  35. package/dist/components/__stories/AntSpinner.stories.mjs +33 -9
  36. package/dist/components/__stories/AntTag.stories.mjs +28 -8
  37. package/dist/components/__stories/AntToast.stories.mjs +19 -5
  38. package/dist/components/__stories/AntToaster.stories.d.ts +1 -1
  39. package/dist/components/__stories/AntToaster.stories.mjs +35 -9
  40. package/dist/components/__stories/AntTooltip.stories.js +1 -1
  41. package/dist/components/__stories/AntTooltip.stories.mjs +44 -13
  42. package/dist/components/buttons/AntActionButton.vue +38 -29
  43. package/dist/components/buttons/AntButton.vue +34 -13
  44. package/dist/components/buttons/AntCreateButton.vue +11 -4
  45. package/dist/components/buttons/AntDeleteButton.vue +11 -4
  46. package/dist/components/buttons/AntDuplicateButton.vue +11 -4
  47. package/dist/components/buttons/AntEditButton.vue +11 -4
  48. package/dist/components/buttons/AntSaveAndNewButton.vue +11 -4
  49. package/dist/components/buttons/AntSaveButton.vue +11 -4
  50. package/dist/components/buttons/__stories/AntActionButton.stories.mjs +35 -10
  51. package/dist/components/buttons/__stories/AntButton.stories.mjs +77 -23
  52. package/dist/components/buttons/__stories/AntCreateButton.stories.mjs +25 -7
  53. package/dist/components/buttons/__stories/AntDeleteButton.stories.mjs +25 -7
  54. package/dist/components/buttons/__stories/AntDuplicateButton.stories.mjs +25 -7
  55. package/dist/components/buttons/__stories/AntEditButton.stories.mjs +25 -7
  56. package/dist/components/buttons/__stories/AntSaveAndNewButton.stories.mjs +25 -7
  57. package/dist/components/buttons/__stories/AntSaveButton.stories.mjs +25 -7
  58. package/dist/components/crud/AntCrud.vue +6 -6
  59. package/dist/components/crud/AntCrudDetail.vue +8 -5
  60. package/dist/components/crud/AntCrudDetailActions.vue +14 -8
  61. package/dist/components/crud/AntCrudDetailNav.vue +21 -13
  62. package/dist/components/crud/AntCrudTableFilter.vue +29 -17
  63. package/dist/components/crud/AntCrudTableNav.vue +36 -22
  64. package/dist/components/crud/__stories/AntCrud.stories.mjs +17 -5
  65. package/dist/components/crud/__stories/AntCrudDetail.stories.mjs +11 -3
  66. package/dist/components/crud/__stories/AntCrudDetailActions.stories.mjs +10 -2
  67. package/dist/components/crud/__stories/AntCrudDetailNav.stories.mjs +11 -3
  68. package/dist/components/crud/__stories/AntCrudTableFilter.stories.mjs +17 -5
  69. package/dist/components/crud/__stories/AntCrudTableNav.stories.mjs +23 -7
  70. package/dist/components/dialogs/AntDeleteDialog.vue +13 -5
  71. package/dist/components/dialogs/AntDialog.vue +23 -13
  72. package/dist/components/dialogs/__stories/AndDeleteDialog.stories.mjs +12 -3
  73. package/dist/components/dialogs/__stories/AntDialog.stories.mjs +28 -7
  74. package/dist/components/forms/AntField.vue +18 -7
  75. package/dist/components/forms/AntFormGroup.vue +9 -5
  76. package/dist/components/forms/AntFormGroupLabel.vue +1 -1
  77. package/dist/components/forms/__stories/AntField.stories.mjs +37 -9
  78. package/dist/components/forms/__stories/AntFormGroup.stories.mjs +20 -5
  79. package/dist/components/forms/__stories/AntFormGroupLabel.stories.mjs +11 -3
  80. package/dist/components/index.d.ts +1 -1
  81. package/dist/components/inputs/AntCheckbox.vue +60 -36
  82. package/dist/components/inputs/AntCheckboxGroup.vue +39 -15
  83. package/dist/components/inputs/AntDateInput.vue +35 -12
  84. package/dist/components/inputs/AntNumberInput.vue +33 -12
  85. package/dist/components/inputs/AntPasswordInput.vue +32 -11
  86. package/dist/components/inputs/AntRadio.vue +57 -34
  87. package/dist/components/inputs/AntRadioGroup.vue +60 -35
  88. package/dist/components/inputs/AntRangeSlider.vue +31 -12
  89. package/dist/components/inputs/AntSearch.vue +19 -7
  90. package/dist/components/inputs/AntSelect.vue +107 -83
  91. package/dist/components/inputs/AntSwitch.vue +35 -18
  92. package/dist/components/inputs/AntSwitcher.vue +30 -15
  93. package/dist/components/inputs/AntTagInput.vue +91 -61
  94. package/dist/components/inputs/AntTextInput.vue +31 -11
  95. package/dist/components/inputs/AntTextarea.vue +53 -25
  96. package/dist/components/inputs/AntUnitInput.vue +33 -12
  97. package/dist/components/inputs/Elements/AntBaseInput.vue +47 -18
  98. package/dist/components/inputs/Elements/AntInputDescription.vue +16 -8
  99. package/dist/components/inputs/Elements/AntInputLabel.vue +13 -5
  100. package/dist/components/inputs/Elements/AntInputLimiter.vue +13 -5
  101. package/dist/components/inputs/Elements/AntSelectMenu.vue +65 -41
  102. package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.mjs +104 -27
  103. package/dist/components/inputs/Elements/__stories/AntInputDescription.stories.mjs +33 -9
  104. package/dist/components/inputs/Elements/__stories/AntInputLabel.stories.mjs +34 -9
  105. package/dist/components/inputs/Elements/__stories/AntInputLimiter.stories.mjs +33 -9
  106. package/dist/components/inputs/Elements/index.d.ts +1 -1
  107. package/dist/components/inputs/__stories/AntCheckbox.stories.mjs +34 -9
  108. package/dist/components/inputs/__stories/AntCheckboxGroup.stories.mjs +45 -21
  109. package/dist/components/inputs/__stories/AntDateInput.stories.mjs +52 -14
  110. package/dist/components/inputs/__stories/AntNumberInput.stories.mjs +66 -17
  111. package/dist/components/inputs/__stories/AntPasswordInput.stories.mjs +51 -13
  112. package/dist/components/inputs/__stories/AntRadioGroup.stories.mjs +45 -12
  113. package/dist/components/inputs/__stories/AntRangeSlider.stories.mjs +16 -5
  114. package/dist/components/inputs/__stories/AntSearch.stories.mjs +41 -10
  115. package/dist/components/inputs/__stories/AntSelect.stories.mjs +59 -15
  116. package/dist/components/inputs/__stories/AntSwitch.stories.js +126 -102
  117. package/dist/components/inputs/__stories/AntSwitch.stories.mjs +162 -112
  118. package/dist/components/inputs/__stories/AntSwitcher.stories.mjs +38 -10
  119. package/dist/components/inputs/__stories/AntTagInput.stories.mjs +46 -12
  120. package/dist/components/inputs/__stories/AntTextInput.stories.mjs +59 -16
  121. package/dist/components/inputs/__stories/AntTextarea.stories.mjs +47 -13
  122. package/dist/components/inputs/__stories/AntUnitInput.stories.mjs +46 -12
  123. package/dist/components/layouts/AntNavLeftLayout.vue +12 -6
  124. package/dist/components/layouts/__stories/AntNavLeftLayout.stories.mjs +10 -2
  125. package/dist/components/navbar/AntNavbar.vue +7 -3
  126. package/dist/components/navbar/AntNavbarItem.vue +12 -6
  127. package/dist/components/navbar/__stories/AntNavbar.stories.mjs +59 -37
  128. package/dist/components/table/AntCollapsibleTableRowContent.vue +7 -5
  129. package/dist/components/table/AntTable.vue +210 -165
  130. package/dist/components/table/AntTableSkeleton.vue +126 -0
  131. package/dist/components/table/AntTableSortButton.vue +22 -13
  132. package/dist/components/table/AntTd.vue +21 -17
  133. package/dist/components/table/AntTh.vue +19 -12
  134. package/dist/components/table/__stories/AntTable.stories.js +1 -1
  135. package/dist/components/table/__stories/AntTable.stories.mjs +190 -62
  136. package/dist/components/tabs/AntTabItem.vue +20 -8
  137. package/dist/components/tabs/AntTabs.vue +35 -21
  138. package/dist/components/tabs/__stories/AntTabItem.stories.mjs +23 -7
  139. package/dist/components/tabs/__stories/AntTabs.stories.mjs +45 -13
  140. package/dist/components/transitions/AntTransitionCollapseHeight.vue +1 -1
  141. package/dist/composables/useToaster.mjs +25 -7
  142. package/dist/index.css +1 -0
  143. package/dist/utils.mjs +3 -1
  144. package/package.json +23 -16
  145. package/dist/tailwind.config.d.ts +0 -3
  146. package/dist/tailwind.config.js +0 -198
  147. package/dist/tailwind.config.mjs +0 -189
@@ -1,19 +1,24 @@
1
1
  <script setup lang="ts">
2
- import {AntTableAlign, AntTableRowTypes, AntTableSize, type TableHeader} from './__types/TableHeader.types';
3
- import {computed} from 'vue';
4
- import {type RouteLocationRaw, RouterLink} from 'vue-router';
2
+ import {
3
+ AntTableAlign, AntTableRowTypes, AntTableSize, type TableHeader,
4
+ } from './__types/TableHeader.types';
5
+ import {
6
+ computed,
7
+ } from 'vue';
8
+ import {
9
+ type RouteLocationRaw, RouterLink,
10
+ } from 'vue-router';
5
11
 
6
12
  const props =
7
- withDefaults(
8
- defineProps<{
9
- element: Record<string, unknown>;
10
- header: TableHeader;
11
- align?: AntTableAlign
12
- size?: AntTableSize
13
- }>(), {
14
- align: AntTableAlign.left,
15
- size: AntTableSize.md
16
- });
13
+ withDefaults(defineProps<{
14
+ element: Record<string, unknown>;
15
+ header: TableHeader;
16
+ align?: AntTableAlign;
17
+ size?: AntTableSize;
18
+ }>(), {
19
+ align: AntTableAlign.left,
20
+ size: AntTableSize.md,
21
+ });
17
22
 
18
23
  const cellClasses = computed(() => ({
19
24
  'whitespace-nowrap text-sm font-medium relative': true,
@@ -21,7 +26,7 @@ const cellClasses = computed(() => ({
21
26
  'text-center': props.align === AntTableAlign.center,
22
27
  'px-2.5 py-0 h-10': props.size === AntTableSize.lg,
23
28
  'px-2 py-0 h-9': props.size === AntTableSize.md,
24
- 'px-1.5 py-0 h-8': props.size === AntTableSize.sm
29
+ 'px-1.5 py-0 h-8': props.size === AntTableSize.sm,
25
30
  }));
26
31
  </script>
27
32
 
@@ -47,8 +52,7 @@ const cellClasses = computed(() => ({
47
52
  <RouterLink
48
53
  :to="element[header.toProp] as RouteLocationRaw"
49
54
  class="absolute inset-0"
50
- >
51
- </RouterLink>
55
+ />
52
56
  {{ element[header.identifier] }}
53
57
  </div>
54
58
 
@@ -65,7 +69,7 @@ const cellClasses = computed(() => ({
65
69
  <slot
66
70
  name="cellContent"
67
71
  v-bind="{ element, header }"
68
- ></slot>
72
+ />
69
73
  </div>
70
74
 
71
75
  <slot
@@ -1,18 +1,22 @@
1
1
  <script setup lang="ts">
2
2
 
3
- import {AntTableAlign, AntTableSize, AntTableSortDirection, type TableHeader} from './__types/TableHeader.types';
4
- import {computed, ref, type Ref} from 'vue';
3
+ import {
4
+ AntTableAlign, AntTableSize, AntTableSortDirection, type TableHeader,
5
+ } from './__types/TableHeader.types';
6
+ import {
7
+ computed, ref, type Ref,
8
+ } from 'vue';
5
9
  import AntTableSortButton from './AntTableSortButton.vue';
6
10
 
7
- defineEmits(['sort']);
8
- const props = withDefaults(
9
- defineProps<{
10
- header: TableHeader
11
- size?: AntTableSize
12
- }>(), {
13
- size: AntTableSize.md
14
- }
15
- );
11
+ defineEmits([
12
+ 'sort',
13
+ ]);
14
+ const props = withDefaults(defineProps<{
15
+ header: TableHeader;
16
+ size?: AntTableSize;
17
+ }>(), {
18
+ size: AntTableSize.md,
19
+ });
16
20
 
17
21
  const headerClasses = computed(() => ({
18
22
  [props.header.headerClassList || '']: true,
@@ -22,7 +26,7 @@ const headerClasses = computed(() => ({
22
26
  'text-right': props.header.align === AntTableAlign.right,
23
27
  'px-2.5 py-0 h-10': props.size === AntTableSize.lg,
24
28
  'px-2 py-0 h-9': props.size === AntTableSize.md,
25
- 'px-1.5 py-0 h-8': props.size === AntTableSize.sm
29
+ 'px-1.5 py-0 h-8': props.size === AntTableSize.sm,
26
30
  }));
27
31
 
28
32
  const cellClasses = computed(() => ({
@@ -41,15 +45,18 @@ const sortDirection: Ref<AntTableSortDirection> = ref(AntTableSortDirection.neut
41
45
  function getNewSortDirection(): AntTableSortDirection {
42
46
  if (sortDirection.value === AntTableSortDirection.neutral) {
43
47
  sortDirection.value = AntTableSortDirection.asc;
48
+
44
49
  return AntTableSortDirection.asc;
45
50
  }
46
51
 
47
52
  if (sortDirection.value === AntTableSortDirection.asc) {
48
53
  sortDirection.value = AntTableSortDirection.desc;
54
+
49
55
  return AntTableSortDirection.desc;
50
56
  }
51
57
 
52
58
  sortDirection.value = AntTableSortDirection.neutral;
59
+
53
60
  return AntTableSortDirection.neutral;
54
61
  }
55
62
  </script>
@@ -533,7 +533,7 @@ const DefaultCollapseOpen = exports.DefaultCollapseOpen = {
533
533
  template: `
534
534
  <div class="h-96 border border-dashed border-base-300 flex flex-col gap-2">
535
535
  <AntButton state="primary" @click="addRandomEntry" filled>Add Random Entry</AntButton>
536
- <AntTable v-bind="args" :data="data" v-model="selected" :selected-row="selected" @row-click="(val) => selected = val" :rows-collapsed="false" collapse-strategy="multiple">
536
+ <AntTable v-bind="args" :data="data" v-model="selected" :selected-row="selected" @row-click="(val) => selected = val" collapse-strategy="multiple" expandedRows>
537
537
  <template #cellContent="{element: entry, header}">
538
538
  <div v-if="header.identifier === 'employed'">
539
539
  <AntSwitch v-model="entry.employed"/>
@@ -2,16 +2,35 @@ import AntTable from "../AntTable.vue";
2
2
  import AntButton from "../../buttons/AntButton.vue";
3
3
  import AntSelect from "../../inputs/AntSelect.vue";
4
4
  import AntCheckboxGroup from "../../inputs/AntCheckboxGroup.vue";
5
- import { AntTableAlign, AntTableRowTypes, AntTableSize } from "../__types/TableHeader.types.mjs";
6
- import { ref } from "vue";
7
- import { faker } from "@faker-js/faker";
5
+ import {
6
+ AntTableAlign,
7
+ AntTableRowTypes,
8
+ AntTableSize
9
+ } from "../__types/TableHeader.types.mjs";
10
+ import {
11
+ ref
12
+ } from "vue";
13
+ import {
14
+ faker
15
+ } from "@faker-js/faker";
8
16
  import AntSwitch from "../../inputs/AntSwitch.vue";
9
- import { expect, userEvent, waitFor } from "@storybook/test";
17
+ import {
18
+ expect,
19
+ userEvent,
20
+ waitFor
21
+ } from "@storybook/test";
10
22
  const meta = {
11
- components: { AntSelect, AntCheckboxGroup },
23
+ components: {
24
+ AntSelect,
25
+ AntCheckboxGroup
26
+ },
12
27
  title: "Components/Table",
13
28
  component: AntTable,
14
- parameters: { controls: { sort: "requiredFirst" } },
29
+ parameters: {
30
+ controls: {
31
+ sort: "requiredFirst"
32
+ }
33
+ },
15
34
  argTypes: {
16
35
  headers: {
17
36
  description: "List of header definitions. <br>If this value get changed from outside, because the table size should change, the change will take 350 ms to have a more smooth transition.",
@@ -46,46 +65,82 @@ const meta = {
46
65
  description: "If true will display skeleton rows instead of an empty table if there is no data provided, otherwise it will display an overlay."
47
66
  },
48
67
  size: {
49
- control: { type: "select" },
68
+ control: {
69
+ type: "select"
70
+ },
50
71
  options: Object.values(AntTableSize),
51
- table: { defaultValue: { summary: AntTableSize.md } }
72
+ table: {
73
+ defaultValue: {
74
+ summary: AntTableSize.md
75
+ }
76
+ }
52
77
  },
53
78
  // Slots
54
79
  afterCellContent: {
55
80
  description: "Slot to add custom elements to all cells. Gets {elem, header} as property.",
56
- table: { type: { summary: "HTML" } }
81
+ table: {
82
+ type: {
83
+ summary: "HTML"
84
+ }
85
+ }
57
86
  },
58
87
  beforeCellContent: {
59
88
  description: "Slot to add custom elements to all cells. Gets {elem, header} as property.",
60
- table: { type: { summary: "HTML" } }
89
+ table: {
90
+ type: {
91
+ summary: "HTML"
92
+ }
93
+ }
61
94
  },
62
95
  emptyState: {
63
96
  description: "Place for custom empty states.",
64
- table: { type: { summary: "HTML" } }
97
+ table: {
98
+ type: {
99
+ summary: "HTML"
100
+ }
101
+ }
65
102
  },
66
103
  headerContent: {
67
104
  description: "Overwrite for the default header items. Gets header as property.",
68
- table: { type: { summary: "HTML" } }
105
+ table: {
106
+ type: {
107
+ summary: "HTML"
108
+ }
109
+ }
69
110
  },
70
111
  headerFirstCell: {
71
112
  description: "Space to add cells to the header.",
72
- table: { type: { summary: "HTML" } }
113
+ table: {
114
+ type: {
115
+ summary: "HTML"
116
+ }
117
+ }
73
118
  },
74
119
  headerLastCell: {
75
120
  description: "Space to add cells to the header.",
76
- table: { type: { summary: "HTML" } }
121
+ table: {
122
+ type: {
123
+ summary: "HTML"
124
+ }
125
+ }
77
126
  },
78
127
  rowFirstCell: {
79
128
  description: "Space to add cells to the beginning of a row. Be aware that you have to add headerFirstCells as well otherwise the headers will not match up to your cells."
80
129
  },
81
130
  rowLastCell: {
82
131
  description: "Space to add cells to all rows. Gets the current element as property.",
83
- table: { type: { summary: "HTML" } }
132
+ table: {
133
+ type: {
134
+ summary: "HTML"
135
+ }
136
+ }
84
137
  },
85
138
  cellContent: {
86
139
  description: 'Is used if the ROW_TYPE = "SLOT". Gets the current element and the header element to identifier witch cell is currently displayed.',
87
140
  table: {
88
- type: { summary: "HTML" }
141
+ type: {
142
+ summary: "HTML"
143
+ }
89
144
  }
90
145
  },
91
146
  showLightVersion: {
@@ -97,10 +152,19 @@ export default meta;
97
152
  const testData = ref([]);
98
153
  function getRandomEntry() {
99
154
  const randomName = faker.person.firstName() + " " + faker.person.lastName();
100
- const randomNumber = faker.number.int({ min: 18, max: 60 });
155
+ const randomNumber = faker.number.int({
156
+ min: 18,
157
+ max: 60
158
+ });
101
159
  const randomEmail = faker.internet.email();
102
160
  const randomBoolean = faker.datatype.boolean();
103
- const randomPermissions = faker.helpers.arrayElements(["read", "write"], { min: 0, max: 2 });
161
+ const randomPermissions = faker.helpers.arrayElements([
162
+ "read",
163
+ "write"
164
+ ], {
165
+ min: 0,
166
+ max: 2
167
+ });
104
168
  return {
105
169
  name: randomName,
106
170
  age: randomNumber,
@@ -114,17 +178,28 @@ for (let i = 0; i < 100; i++) {
114
178
  }
115
179
  export const Docs = {
116
180
  render: (args) => ({
117
- components: { AntTable, AntSwitch, AntCheckboxGroup },
181
+ components: {
182
+ AntTable,
183
+ AntSwitch,
184
+ AntCheckboxGroup
185
+ },
118
186
  setup() {
119
187
  const selected = ref();
120
- const checkboxes = [{
121
- label: "Read",
122
- value: "read"
123
- }, {
124
- label: "Write",
125
- value: "write"
126
- }];
127
- return { args, selected, checkboxes };
188
+ const checkboxes = [
189
+ {
190
+ label: "Read",
191
+ value: "read"
192
+ },
193
+ {
194
+ label: "Write",
195
+ value: "write"
196
+ }
197
+ ];
198
+ return {
199
+ args,
200
+ selected,
201
+ checkboxes
202
+ };
128
203
  },
129
204
  template: `
130
205
  <div class="h-96 border border-dashed border-base-300">
@@ -142,7 +217,9 @@ export const Docs = {
142
217
  </div>
143
218
  `
144
219
  }),
145
- play: async ({ step }) => {
220
+ play: async ({
221
+ step
222
+ }) => {
146
223
  const firstRow = document.querySelectorAll('[data-e2e="table-row"]')[0];
147
224
  const employedCell = firstRow.querySelector('[data-e2e="table-cell-employed"]');
148
225
  const employedSwitch = employedCell?.querySelector('[data-e2e="switch"]')?.querySelector("button");
@@ -152,7 +229,9 @@ export const Docs = {
152
229
  const permissionLabel = permissionCheckboxWithLabel?.querySelector("label");
153
230
  await step("Click on a table cell and expect the row to be selected", async () => {
154
231
  await userEvent.click(employedCell);
155
- await waitFor(() => expect(firstRow).toHaveClass("bg-primary-200"), { timeout: 600 });
232
+ await waitFor(() => expect(firstRow).toHaveClass("bg-primary-200"), {
233
+ timeout: 600
234
+ });
156
235
  });
157
236
  await step("Click on employed switch and expect the value to toggle", async () => {
158
237
  const initialAriaChecked = JSON.parse(employedSwitch?.getAttribute("aria-checked"));
@@ -160,7 +239,9 @@ export const Docs = {
160
239
  await waitFor(() => {
161
240
  const toggledAriaChecked = JSON.parse(employedSwitch?.getAttribute("aria-checked"));
162
241
  expect(toggledAriaChecked).toBe(!initialAriaChecked);
163
- }, { timeout: 600 });
242
+ }, {
243
+ timeout: 600
244
+ });
164
245
  });
165
246
  await step("Click on one of the permissions and expect the value to toggle", async () => {
166
247
  const initialAriaChecked = JSON.parse(permissionCheckbox?.getAttribute("aria-checked"));
@@ -168,7 +249,9 @@ export const Docs = {
168
249
  await waitFor(() => {
169
250
  const toggledAriaChecked = JSON.parse(permissionCheckbox?.getAttribute("aria-checked"));
170
251
  expect(toggledAriaChecked).toBe(!initialAriaChecked);
171
- }, { timeout: 600 });
252
+ }, {
253
+ timeout: 600
254
+ });
172
255
  });
173
256
  },
174
257
  args: {
@@ -211,10 +294,16 @@ export const Docs = {
211
294
  };
212
295
  export const Empty = {
213
296
  render: (args) => ({
214
- components: { AntTable, AntSwitch },
297
+ components: {
298
+ AntTable,
299
+ AntSwitch
300
+ },
215
301
  setup() {
216
302
  const selected = ref();
217
- return { args, selected };
303
+ return {
304
+ args,
305
+ selected
306
+ };
218
307
  },
219
308
  template: `
220
309
  <div class="flex flex-col gap-2">
@@ -350,17 +439,28 @@ export const Loading = {
350
439
  };
351
440
  export const Collapsible = {
352
441
  render: (args) => ({
353
- components: { AntTable, AntSwitch, AntCheckboxGroup },
442
+ components: {
443
+ AntTable,
444
+ AntSwitch,
445
+ AntCheckboxGroup
446
+ },
354
447
  setup() {
355
448
  const selected = ref();
356
- const checkboxes = [{
357
- label: "Read",
358
- value: "read"
359
- }, {
360
- label: "Write",
361
- value: "write"
362
- }];
363
- return { args, selected, checkboxes };
449
+ const checkboxes = [
450
+ {
451
+ label: "Read",
452
+ value: "read"
453
+ },
454
+ {
455
+ label: "Write",
456
+ value: "write"
457
+ }
458
+ ];
459
+ return {
460
+ args,
461
+ selected,
462
+ checkboxes
463
+ };
364
464
  },
365
465
  template: `
366
466
  <div class="h-96 border border-dashed border-base-300">
@@ -390,17 +490,28 @@ export const Collapsible = {
390
490
  };
391
491
  export const MultipleCollapseStrategy = {
392
492
  render: (args) => ({
393
- components: { AntTable, AntSwitch, AntCheckboxGroup },
493
+ components: {
494
+ AntTable,
495
+ AntSwitch,
496
+ AntCheckboxGroup
497
+ },
394
498
  setup() {
395
499
  const selected = ref();
396
- const checkboxes = [{
397
- label: "Read",
398
- value: "read"
399
- }, {
400
- label: "Write",
401
- value: "write"
402
- }];
403
- return { args, selected, checkboxes };
500
+ const checkboxes = [
501
+ {
502
+ label: "Read",
503
+ value: "read"
504
+ },
505
+ {
506
+ label: "Write",
507
+ value: "write"
508
+ }
509
+ ];
510
+ return {
511
+ args,
512
+ selected,
513
+ checkboxes
514
+ };
404
515
  },
405
516
  template: `
406
517
  <div class="h-96 border border-dashed border-base-300">
@@ -430,26 +541,43 @@ export const MultipleCollapseStrategy = {
430
541
  };
431
542
  export const DefaultCollapseOpen = {
432
543
  render: (args) => ({
433
- components: { AntTable, AntSwitch, AntCheckboxGroup, AntButton },
544
+ components: {
545
+ AntTable,
546
+ AntSwitch,
547
+ AntCheckboxGroup,
548
+ AntButton
549
+ },
434
550
  setup() {
435
551
  const selected = ref();
436
552
  const data = ref(args.data.splice(0, 5));
437
- const checkboxes = [{
438
- label: "Read",
439
- value: "read"
440
- }, {
441
- label: "Write",
442
- value: "write"
443
- }];
553
+ const checkboxes = [
554
+ {
555
+ label: "Read",
556
+ value: "read"
557
+ },
558
+ {
559
+ label: "Write",
560
+ value: "write"
561
+ }
562
+ ];
444
563
  function addRandomEntry() {
445
- data.value = [...data.value, getRandomEntry()];
564
+ data.value = [
565
+ ...data.value,
566
+ getRandomEntry()
567
+ ];
446
568
  }
447
- return { args, data, selected, checkboxes, addRandomEntry };
569
+ return {
570
+ args,
571
+ data,
572
+ selected,
573
+ checkboxes,
574
+ addRandomEntry
575
+ };
448
576
  },
449
577
  template: `
450
578
  <div class="h-96 border border-dashed border-base-300 flex flex-col gap-2">
451
579
  <AntButton state="primary" @click="addRandomEntry" filled>Add Random Entry</AntButton>
452
- <AntTable v-bind="args" :data="data" v-model="selected" :selected-row="selected" @row-click="(val) => selected = val" :rows-collapsed="false" collapse-strategy="multiple">
580
+ <AntTable v-bind="args" :data="data" v-model="selected" :selected-row="selected" @row-click="(val) => selected = val" collapse-strategy="multiple" expandedRows>
453
581
  <template #cellContent="{element: entry, header}">
454
582
  <div v-if="header.identifier === 'employed'">
455
583
  <AntSwitch v-model="entry.employed"/>
@@ -4,18 +4,26 @@ import {
4
4
  faCircleInfo,
5
5
  faExclamationCircle,
6
6
  faExclamationTriangle,
7
- type IconDefinition
7
+ type IconDefinition,
8
8
  } from '@fortawesome/free-solid-svg-icons';
9
- import {computed} from 'vue';
10
- import {type RouteLocationRaw, useRoute} from 'vue-router';
11
- import {TabItemState} from './__types/AntTabItem.types';
12
- import {AntSkeleton} from "../../../dist";
9
+ import {
10
+ computed,
11
+ } from 'vue';
12
+ import {
13
+ type RouteLocationRaw, useRoute,
14
+ } from 'vue-router';
15
+ import {
16
+ TabItemState,
17
+ } from './__types/AntTabItem.types';
18
+ import {
19
+ AntSkeleton,
20
+ } from '../../../dist';
13
21
 
14
22
  const props = withDefaults(defineProps<{
15
23
  label: string;
16
24
  active: boolean;
17
25
  disabled?: boolean;
18
- state?: TabItemState
26
+ state?: TabItemState;
19
27
  showIcon?: boolean;
20
28
  icon?: IconDefinition;
21
29
  to?: RouteLocationRaw;
@@ -69,7 +77,7 @@ const containerClasses = computed(() => {
69
77
 
70
78
  return {
71
79
  'p-2 text-center flex items-center justify-center gap-2 bg-white transition-[background-color] relative text-sm text-nowrap': true,
72
- 'grow': props.expanded,
80
+ grow: props.expanded,
73
81
  [variants[props.state]]: !props.disabled,
74
82
  [activeVariants[props.state]]: _active.value,
75
83
  [notActiveVariants[props.state]]: !_active.value,
@@ -118,7 +126,11 @@ const iconColor = computed(() => {
118
126
 
119
127
  <div class="relative">
120
128
  <slot>{{ label }}</slot>
121
- <AntSkeleton v-if="skeleton" rounded absolute/>
129
+ <AntSkeleton
130
+ v-if="skeleton"
131
+ rounded
132
+ absolute
133
+ />
122
134
  </div>
123
135
 
124
136
  <AntIcon
@@ -1,10 +1,18 @@
1
1
  <script setup lang="ts">
2
2
  import AntTabItem from './AntTabItem.vue';
3
- import {type TabItem} from './__types/AntTabItem.types';
4
- import {useVModel} from '@vueuse/core';
5
- import {computed} from 'vue';
3
+ import {
4
+ type TabItem,
5
+ } from './__types/AntTabItem.types';
6
+ import {
7
+ useVModel,
8
+ } from '@vueuse/core';
9
+ import {
10
+ computed,
11
+ } from 'vue';
6
12
 
7
- const emits = defineEmits(['update:modelValue']);
13
+ const emits = defineEmits([
14
+ 'update:modelValue',
15
+ ]);
8
16
  const props = withDefaults(defineProps<{
9
17
  modelValue?: string;
10
18
  tabItems?: TabItem[];
@@ -29,8 +37,8 @@ function clickTab(tabItem: TabItem) {
29
37
  tabItem.clickHandler();
30
38
  }
31
39
 
32
- if (tabItem.disabled){
33
- return
40
+ if (tabItem.disabled) {
41
+ return;
34
42
  }
35
43
 
36
44
  currentActive.value = tabItem.id;
@@ -39,21 +47,27 @@ function clickTab(tabItem: TabItem) {
39
47
 
40
48
  <template>
41
49
  <div :class="containerClasses">
42
- <div class="flex gap-px bg-base-300 border-l border-r border-base-300 overflow-x-auto" :class="scrollContainerClasses">
43
- <slot>
44
- <AntTabItem
45
- v-for="(tabItem, index) in tabItems"
46
- :key="`tab-item-${index}`"
47
- v-bind="tabItem"
48
- @click="clickTab(tabItem)"
49
- :active="currentActive === tabItem.id"
50
- :expanded="expanded"
51
- :disabled="tabItem.disabled"
52
- :skeleton="skeleton"
53
- >
54
- <slot name="content" v-bind="{item: tabItem, isActive: currentActive === tabItem.id}"></slot>
55
- </AntTabItem>
56
- </slot>
50
+ <div
51
+ class="flex gap-px bg-base-300 border-l border-r border-base-300 overflow-x-auto"
52
+ :class="scrollContainerClasses"
53
+ >
54
+ <slot>
55
+ <AntTabItem
56
+ v-for="(tabItem, index) in tabItems"
57
+ :key="`tab-item-${index}`"
58
+ v-bind="tabItem"
59
+ :active="currentActive === tabItem.id"
60
+ :expanded="expanded"
61
+ :disabled="tabItem.disabled"
62
+ :skeleton="skeleton"
63
+ @click="clickTab(tabItem)"
64
+ >
65
+ <slot
66
+ name="content"
67
+ v-bind="{item: tabItem, isActive: currentActive === tabItem.id}"
68
+ />
69
+ </AntTabItem>
70
+ </slot>
57
71
  </div>
58
72
  </div>
59
73
  </template>