@weni/unnnic-system 3.33.1 → 3.34.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "3.33.1",
3
+ "version": "3.34.0",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <UiTable v-if="version === '2'">
2
+ <UiTable
3
+ v-if="version === '2'"
4
+ v-bind="$attrs"
5
+ >
3
6
  <slot />
4
7
  </UiTable>
5
8
 
@@ -48,6 +51,8 @@ export default {
48
51
  };
49
52
  },
50
53
 
54
+ inheritAttrs: false,
55
+
51
56
  props: {
52
57
  items: {
53
58
  type: Array,
@@ -20,6 +20,7 @@ const props = defineProps<{
20
20
 
21
21
  .unnnic-table {
22
22
  border-collapse: collapse;
23
+ table-layout: fixed;
23
24
  width: 100%;
24
25
  caption-side: bottom;
25
26
 
@@ -2,13 +2,29 @@
2
2
  import type { HTMLAttributes } from 'vue';
3
3
  import { cn } from '@/lib/utils';
4
4
 
5
- const props = defineProps<{
6
- class?: HTMLAttributes['class'];
7
- }>();
5
+ const props = withDefaults(
6
+ defineProps<{
7
+ class?: HTMLAttributes['class'];
8
+ ellipsis?: boolean;
9
+ width?: string;
10
+ }>(),
11
+ {
12
+ ellipsis: false,
13
+ },
14
+ );
8
15
  </script>
9
16
 
10
17
  <template>
11
- <td :class="cn('unnnic-table-cell', props.class)">
18
+ <td
19
+ :class="
20
+ cn(
21
+ 'unnnic-table-cell',
22
+ { 'unnnic-table-cell--ellipsis': props.ellipsis },
23
+ props.class,
24
+ )
25
+ "
26
+ :style="{ width: props.width }"
27
+ >
12
28
  <slot />
13
29
  </td>
14
30
  </template>
@@ -24,5 +40,11 @@ const props = defineProps<{
24
40
  &:not(:last-child) {
25
41
  padding-right: $unnnic-space-4;
26
42
  }
43
+
44
+ &--ellipsis {
45
+ overflow: hidden;
46
+ text-overflow: ellipsis;
47
+ white-space: nowrap;
48
+ }
27
49
  }
28
50
  </style>
@@ -2,13 +2,29 @@
2
2
  import type { HTMLAttributes } from 'vue';
3
3
  import { cn } from '@/lib/utils';
4
4
 
5
- const props = defineProps<{
6
- class?: HTMLAttributes['class'];
7
- }>();
5
+ const props = withDefaults(
6
+ defineProps<{
7
+ class?: HTMLAttributes['class'];
8
+ ellipsis?: boolean;
9
+ width?: string;
10
+ }>(),
11
+ {
12
+ ellipsis: false,
13
+ },
14
+ );
8
15
  </script>
9
16
 
10
17
  <template>
11
- <th :class="cn('unnnic-table-head', props.class)">
18
+ <th
19
+ :class="
20
+ cn(
21
+ 'unnnic-table-head',
22
+ { 'unnnic-table-head--ellipsis': props.ellipsis },
23
+ props.class,
24
+ )
25
+ "
26
+ :style="{ width: props.width }"
27
+ >
12
28
  <slot />
13
29
  </th>
14
30
  </template>
@@ -23,5 +39,11 @@ const props = defineProps<{
23
39
  align-items: center;
24
40
 
25
41
  pointer-events: none;
42
+
43
+ &--ellipsis {
44
+ overflow: hidden;
45
+ text-overflow: ellipsis;
46
+ white-space: nowrap;
47
+ }
26
48
  }
27
49
  </style>
@@ -3,6 +3,10 @@ import type { HTMLAttributes } from 'vue';
3
3
  import { computed, useAttrs } from 'vue';
4
4
  import { cn } from '@/lib/utils';
5
5
 
6
+ defineEmits<{
7
+ (e: 'click', event: KeyboardEvent | MouseEvent): void;
8
+ }>();
9
+
6
10
  const props = defineProps<{
7
11
  class?: HTMLAttributes['class'];
8
12
  }>();
@@ -180,20 +180,20 @@ export const Version2 = {
180
180
  <unnnic-table version="2">
181
181
  <TableHeader>
182
182
  <unnnic-table-row>
183
- <TableHead>
183
+ <TableHead width="50%">
184
184
  Invoice
185
185
  </TableHead>
186
- <TableHead>Status</TableHead>
187
- <TableHead>Method</TableHead>
188
- <TableHead>
186
+ <TableHead width="20%">Status</TableHead>
187
+ <TableHead width="15%">Method</TableHead>
188
+ <TableHead width="15%">
189
189
  Amount
190
190
  </TableHead>
191
191
  </unnnic-table-row>
192
192
  </TableHeader>
193
193
  <TableBody>
194
194
  <unnnic-table-row>
195
- <TableCell>
196
- INV001
195
+ <TableCell ellipsis>
196
+ INV001 — With ellipsis lorem ipsum dolor sit amet, consectetur adipiscing elit.
197
197
  </TableCell>
198
198
  <TableCell><UnnnicTag scheme="green" text="Paid" /></TableCell>
199
199
  <TableCell>Credit Card</TableCell>
@@ -203,7 +203,7 @@ export const Version2 = {
203
203
  </unnnic-table-row>
204
204
  <unnnic-table-row @click="onRowClick">
205
205
  <TableCell>
206
- INV002
206
+ INV002 — Without ellipsis lorem ipsum dolor sit amet, consectetur adipiscing elit.
207
207
  </TableCell>
208
208
  <TableCell><UnnnicTag scheme="red" text="Pending" /></TableCell>
209
209
  <TableCell>Bank Transfer</TableCell>