@weni/unnnic-system 2.14.2 → 2.15.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.
@@ -1,27 +1,36 @@
1
1
  <template>
2
- <div
2
+ <section
3
3
  :class="`unnnic-tag
4
4
  ${!disabled ? `unnnic-tag-scheme--${scheme}` : `unnnic-tag--disabled`}
5
5
  ${clickable ? 'unnnic-tag--clickable' : ''}`"
6
6
  >
7
+ <section
8
+ v-if="leftIcon"
9
+ class="unnnic-tag__icon"
10
+ >
11
+ <UnnnicIcon
12
+ :icon="leftIcon"
13
+ :scheme="scheme"
14
+ size="sm"
15
+ />
16
+ </section>
7
17
  <span
8
18
  :class="`unnnic-tag__label
9
- ${hasCloseIcon ? 'unnnic-tag__label--hasIcon' : ''}
10
19
  ${disabled ? 'unnnic-tag__label--disabled' : ''}`"
11
20
  >{{ text }}</span
12
21
  >
13
- <div
14
- v-if="hasCloseIcon"
15
- class="unnnic-tag__icon"
16
- @click.stop="emitClose"
22
+ <section
23
+ v-if="rightIcon || hasCloseIcon"
24
+ :class="{ 'unnnic-tag__icon': true, clickable: !rightIcon }"
25
+ @click.stop="hasCloseIcon ? emitClose() : () => {}"
17
26
  >
18
27
  <UnnnicIcon
19
- icon="close-1"
20
- scheme="neutral-darkest"
21
- size="xs"
28
+ :icon="rightIcon || 'close'"
29
+ :scheme="rightIcon ? scheme : 'neutral-darkest'"
30
+ size="sm"
22
31
  />
23
- </div>
24
- </div>
32
+ </section>
33
+ </section>
25
34
  </template>
26
35
 
27
36
  <script>
@@ -53,6 +62,14 @@ export default {
53
62
  type: String,
54
63
  default: 'aux-purple',
55
64
  },
65
+ leftIcon: {
66
+ type: String,
67
+ default: null,
68
+ },
69
+ rightIcon: {
70
+ type: String,
71
+ default: null,
72
+ },
56
73
  },
57
74
  methods: {
58
75
  closeClicked() {
@@ -84,6 +101,7 @@ export default {
84
101
  align-items: center;
85
102
  justify-content: center;
86
103
  border-radius: $unnnic-border-radius-pill;
104
+ padding: 0 $unnnic-spacing-xs;
87
105
 
88
106
  &--disabled {
89
107
  background-color: $unnnic-color-background-sky;
@@ -107,22 +125,19 @@ export default {
107
125
  font-size: $unnnic-font-size-body-md;
108
126
  font-weight: $unnnic-font-weight-regular;
109
127
  line-height: ($unnnic-font-size-body-md + $unnnic-line-height-medium);
110
- padding: $unnnic-spacing-stack-nano $unnnic-inline-ant;
128
+ padding: $unnnic-spacing-stack-nano;
111
129
  color: $unnnic-color-neutral-darkest;
112
130
 
113
131
  &--disabled {
114
132
  color: $unnnic-color-neutral-cloudy;
115
133
  }
116
-
117
- &--hasIcon {
118
- padding-left: $unnnic-inline-ant;
119
- padding-right: $unnnic-spacing-stack-nano;
120
- }
121
134
  }
122
135
 
123
136
  &__icon {
124
137
  display: flex;
125
- margin-right: $unnnic-inline-ant;
138
+ }
139
+
140
+ .clickable {
126
141
  cursor: pointer;
127
142
  }
128
143
  }
@@ -12,7 +12,8 @@
12
12
  :clickable="clickable"
13
13
  :tooltipText="tooltipText"
14
14
  :enableTooltip="enableTooltip"
15
- :icon="icon"
15
+ :leftIcon="leftIcon"
16
+ :rightIcon="rightIcon"
16
17
  />
17
18
  </template>
18
19
 
@@ -67,9 +68,13 @@ export default {
67
68
  type: Boolean,
68
69
  default: false,
69
70
  },
70
- icon: {
71
+ leftIcon: {
71
72
  type: String,
72
- default: null,
73
+ default: '',
74
+ },
75
+ rightIcon: {
76
+ type: String,
77
+ default: '',
73
78
  },
74
79
  },
75
80
  computed: {
@@ -2,9 +2,46 @@ import UnnnicTableNext from '../components/TableNext/TableNext.vue';
2
2
  import UnnnicButton from '../components/Button/Button.vue';
3
3
 
4
4
  export default {
5
- title: 'example/TableNext',
5
+ title: 'Data Display/TableNext',
6
6
  component: UnnnicTableNext,
7
- argTypes: {},
7
+ tags: ['autodocs'],
8
+ argTypes: {
9
+ headers: {
10
+ description:
11
+ 'Array of header items defining the structure of the table header.',
12
+ control: 'object',
13
+ },
14
+ rows: {
15
+ description: 'Array of row items defining the content of the table rows.',
16
+ control: 'object',
17
+ },
18
+ size: {
19
+ description:
20
+ 'The size of the table. Options are `sm` for small and `md` for medium.',
21
+ control: { type: 'select' },
22
+ options: ['sm', 'md'],
23
+ },
24
+ pagination: {
25
+ description: 'The current page number for pagination.',
26
+ control: 'number',
27
+ },
28
+ paginationTotal: {
29
+ description: 'The total number of pages available for pagination.',
30
+ control: 'number',
31
+ },
32
+ paginationInterval: {
33
+ description: 'The number of items displayed per page.',
34
+ control: 'number',
35
+ },
36
+ isLoading: {
37
+ description: 'Indicates whether the table data is loading.',
38
+ control: 'boolean',
39
+ },
40
+ hideHeaders: {
41
+ description: 'Determines if the table headers should be hidden.',
42
+ control: 'boolean',
43
+ },
44
+ },
8
45
  render: (args) => ({
9
46
  components: {
10
47
  UnnnicTableNext,
@@ -19,7 +56,7 @@ export default {
19
56
  headers: [
20
57
  {
21
58
  content: 'ID',
22
- size: 0.3,
59
+ size: 'auto',
23
60
  },
24
61
  {
25
62
  content: 'Name',
@@ -32,6 +69,7 @@ export default {
32
69
  },
33
70
  {
34
71
  content: 'Add with friend',
72
+ size: 0.5,
35
73
  },
36
74
  ],
37
75
  rows: [],
@@ -67,32 +105,48 @@ const addButton = {
67
105
  },
68
106
  };
69
107
 
108
+ const rows = [
109
+ {
110
+ content: ['1', 'Alice', '30', 'USA', addButton],
111
+ link: {
112
+ url: 'https://weni.ai/',
113
+ target: '_blank',
114
+ },
115
+ },
116
+ {
117
+ content: ['2', 'Bob', '25', 'Canada', addButton],
118
+ link: {
119
+ url: 'https://weni.ai/',
120
+ },
121
+ },
122
+ {
123
+ content: ['3', 'Charlie', '35', 'UK', addButton],
124
+ },
125
+ {
126
+ content: ['4', 'Diana', '28', 'Australia', addButton],
127
+ },
128
+ {
129
+ content: ['5', 'Ethan', '22', 'New Zealand', addButton],
130
+ },
131
+ ];
132
+
70
133
  export const Default = {
71
134
  args: {
72
- rows: [
73
- {
74
- content: ['1', 'Alice', '30', 'USA', addButton],
75
- link: {
76
- url: 'https://weni.ai/',
77
- target: '_blank',
78
- },
79
- },
80
- {
81
- content: ['2', 'Bob', '25', 'Canada', addButton],
82
- link: {
83
- url: 'https://weni.ai/',
84
- },
85
- },
86
- {
87
- content: ['3', 'Charlie', '35', 'UK', addButton],
88
- },
89
- {
90
- content: ['4', 'Diana', '28', 'Australia', addButton],
91
- },
92
- {
93
- content: ['5', 'Ethan', '22', 'New Zealand', addButton],
94
- },
95
- ],
135
+ rows,
136
+ },
137
+ };
138
+
139
+ export const Medium = {
140
+ args: {
141
+ rows,
142
+ size: 'md',
143
+ },
144
+ };
145
+
146
+ export const HideHeaders = {
147
+ args: {
148
+ rows,
149
+ hideHeaders: true,
96
150
  },
97
151
  };
98
152
 
@@ -1,9 +1,10 @@
1
- import unnnicTag from '../components/Tag/Tag.vue';
1
+ import UnnnicTag from '../components/Tag/Tag.vue';
2
2
  import colorsList from '../utils/colorsList';
3
3
 
4
4
  export default {
5
- title: 'Example/Tag',
6
- component: unnnicTag,
5
+ title: 'Data Display/Tag',
6
+ component: UnnnicTag,
7
+ tags: ['autodocs'],
7
8
  argTypes: {
8
9
  text: { control: { type: 'text' } },
9
10
  type: {
@@ -25,6 +26,30 @@ export const Default = {
25
26
  },
26
27
  };
27
28
 
29
+ export const LeftIcon = {
30
+ args: {
31
+ text: 'Label',
32
+ type: 'default',
33
+ leftIcon: 'check_circle',
34
+ },
35
+ };
36
+
37
+ export const RightIcon = {
38
+ args: {
39
+ text: 'Label',
40
+ type: 'default',
41
+ rightIcon: 'check_circle',
42
+ },
43
+ };
44
+
45
+ export const CloseIcon = {
46
+ args: {
47
+ text: 'Label',
48
+ type: 'default',
49
+ hasCloseIcon: true,
50
+ },
51
+ };
52
+
28
53
  export const Indicator = {
29
54
  args: {
30
55
  text: 'Tag Name',