tide-design-system 2.4.4 → 2.4.7

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 (58) hide show
  1. package/.storybook/main.ts +1 -0
  2. package/dist/css/reset.css +1 -1
  3. package/dist/css/utilities-responsive.css +0 -546
  4. package/dist/style.css +1 -1
  5. package/dist/tide-design-system.cjs +2 -2
  6. package/dist/tide-design-system.esm.d.ts +85 -11
  7. package/dist/tide-design-system.esm.js +1769 -1617
  8. package/dist/utilities/storybook.ts +6 -2
  9. package/dist/utilities/validation.ts +1 -1
  10. package/index.ts +10 -5
  11. package/package.json +1 -1
  12. package/src/assets/css/reset.css +1 -1
  13. package/src/assets/css/utilities-responsive.css +0 -546
  14. package/src/components/InternalBaseLink.vue +11 -0
  15. package/src/components/TideAlert.vue +46 -3
  16. package/src/components/TideBreadCrumbs.vue +3 -2
  17. package/src/components/TideButton.vue +17 -4
  18. package/src/components/TideButtonIcon.vue +15 -2
  19. package/src/components/TideButtonPagination.vue +16 -16
  20. package/src/components/TideButtonSegmented.vue +1 -0
  21. package/src/components/TideCard.vue +12 -2
  22. package/src/components/TideCarousel.vue +10 -5
  23. package/src/components/TideChipAction.vue +7 -1
  24. package/src/components/TideChipFilter.vue +1 -0
  25. package/src/components/TideChipInput.vue +1 -0
  26. package/src/components/TideIcon.vue +8 -9
  27. package/src/components/TideImage.vue +9 -9
  28. package/src/components/TideInputText.vue +2 -0
  29. package/src/components/TideInputTextDeprecated.vue +2 -0
  30. package/src/components/TideInputTextarea.vue +2 -2
  31. package/src/components/TideLink.vue +7 -1
  32. package/src/components/TideMenuItem.vue +83 -0
  33. package/src/components/TideModal.vue +91 -85
  34. package/src/components/TideSeoLinks.vue +3 -2
  35. package/src/components/TideSheet.vue +5 -3
  36. package/src/components/TideSwitch.vue +1 -0
  37. package/src/composables/useTideConfig.ts +23 -0
  38. package/src/stories/TideAlert.stories.ts +37 -1
  39. package/src/stories/TideButtonPagination.stories.ts +6 -6
  40. package/src/stories/TideCarousel.stories.ts +0 -1
  41. package/src/stories/TideInputCheckbox.stories.ts +58 -23
  42. package/src/stories/TideInputRadio.stories.ts +39 -30
  43. package/src/stories/TideInputSelect.stories.ts +51 -27
  44. package/src/stories/TideInputText.stories.ts +83 -23
  45. package/src/stories/TideInputTextarea.stories.ts +66 -17
  46. package/src/stories/TideLink.stories.ts +1 -14
  47. package/src/stories/TideMenuItem.stories.ts +117 -0
  48. package/src/stories/TidePagination.stories.ts +2 -2
  49. package/src/stories/TidePopover.stories.ts +1 -1
  50. package/src/types/Badge.ts +4 -0
  51. package/src/types/Element.ts +2 -2
  52. package/src/types/Formatted.ts +1 -0
  53. package/src/types/Storybook.ts +4 -6
  54. package/src/types/Type.ts +6 -0
  55. package/src/types/Validation.ts +1 -0
  56. package/src/utilities/storybook.ts +6 -2
  57. package/src/utilities/validation.ts +1 -1
  58. package/tests/InternalBaseLink.spec.ts +61 -0
@@ -1,14 +1,16 @@
1
1
  import { action } from '@storybook/addon-actions';
2
2
 
3
3
  import TideInputSelect from '@/components/TideInputSelect.vue';
4
+ import * as STANDARD_ERROR_DISPLAY from '@/types/Validation';
4
5
  import {
5
6
  argTypeBooleanUnrequired,
6
7
  change,
7
8
  dataTrack,
9
+ disabledArgType,
8
10
  doSomething,
9
11
  formatArgType,
10
- getLabelsFromOptions,
11
12
  parameters,
13
+ prependNoneAsUndefined,
12
14
  } from '@/utilities/storybook';
13
15
 
14
16
  import type { SelectOption, SelectOptionGroup } from '@/types/Select';
@@ -16,20 +18,10 @@ import type { StoryContext } from '@storybook/vue3';
16
18
 
17
19
  type Args = InstanceType<typeof TideInputSelect>['$props'] & {
18
20
  change: string;
21
+ handleValid: string;
22
+ vModel: string;
19
23
  };
20
-
21
- const options = {
22
- 'Any': '',
23
- 'Option 1': 1,
24
- 'Option 2': 2,
25
- 'Option 3': 3,
26
- 'Option A1': 'A1',
27
- 'Option A2': 'A2',
28
- 'Option A3': 'A3',
29
- 'Option B1': 'B1',
30
- 'Option B2': 'B2',
31
- 'Option B3': 'B3',
32
- };
24
+ const ERROR_DISPLAY = prependNoneAsUndefined(STANDARD_ERROR_DISPLAY.ERROR_DISPLAY);
33
25
 
34
26
  const selectOptionGroups: (SelectOption | SelectOptionGroup)[] = [
35
27
  {
@@ -107,9 +99,22 @@ const render = (args: Args, context: StoryContext) => ({
107
99
  alert('Please specify a valid handler in the "change" control.');
108
100
  }
109
101
  },
102
+ handleValid: () => {
103
+ action('TideInputSelect valid was emitted')({});
104
+
105
+ try {
106
+ const callback = eval(args.handleValid);
107
+
108
+ if (callback) {
109
+ callback();
110
+ }
111
+ } catch {
112
+ alert('Please specify a valid handler in the "valid" control.');
113
+ }
114
+ },
110
115
  },
111
116
  setup: () => ({ args }),
112
- template: `<TideInputSelect @change="handleChange" v-bind="args" />`,
117
+ template: `<TideInputSelect @change="handleChange" @valid="handleValid" v-bind="args" />`,
113
118
  });
114
119
 
115
120
  export default {
@@ -121,8 +126,27 @@ export default {
121
126
  description: 'Determines whether Select is interactable',
122
127
  },
123
128
  error: {
124
- ...argTypeBooleanUnrequired,
125
- description: 'Reflects whether the Select value is valid',
129
+ control: 'text',
130
+ description: 'Overrides the default error message and valid state',
131
+ table: {
132
+ defaultValue: { summary: 'None' },
133
+ type: { summary: 'string' },
134
+ },
135
+ },
136
+ errorDisplay: {
137
+ ...formatArgType({ ERROR_DISPLAY }),
138
+ description: 'Determines whether errors display prior to blur',
139
+ },
140
+ handleValid: {
141
+ control: 'text',
142
+ description: 'JS code or function to execute on valid event',
143
+ isEmit: true,
144
+ name: 'valid',
145
+ table: {
146
+ category: 'Events',
147
+ defaultValue: { summary: 'None' },
148
+ type: { summary: '(isValid: boolean) => void' },
149
+ },
126
150
  },
127
151
  inputId: {
128
152
  control: 'text',
@@ -180,24 +204,24 @@ export default {
180
204
  type: { summary: 'string' },
181
205
  },
182
206
  },
183
- value: {
184
- control: {
185
- labels: getLabelsFromOptions(options),
186
- type: 'select',
187
- },
188
- description: 'Determines which tab should be active by default<br />(Subsequently managed within component)',
189
- options: Object.values(options),
207
+ vModel: {
208
+ control: 'text',
209
+ description: 'Data binding to Vue ref',
190
210
  table: {
211
+ category: 'Native',
191
212
  defaultValue: { summary: 'None' },
192
- type: { summary: 'SelectOption' },
213
+ type: { summary: 'Ref' },
193
214
  },
194
215
  },
216
+ valid: disabledArgType,
195
217
  },
196
218
  args: {
197
219
  change: 'doSomething',
198
220
  dataTrack: '',
199
221
  disabled: undefined,
200
- error: undefined,
222
+ error: '',
223
+ errorDisplay: undefined,
224
+ handleValid: 'doSomething',
201
225
  inputId: '',
202
226
  label: 'Input label',
203
227
  name: '',
@@ -205,7 +229,7 @@ export default {
205
229
  options: selectOptions,
206
230
  required: undefined,
207
231
  supportingText: '',
208
- value: undefined,
232
+ vModel: '',
209
233
  },
210
234
  component: TideInputSelect,
211
235
  parameters,
@@ -3,38 +3,51 @@ import { action } from '@storybook/addon-actions';
3
3
  import TideInputText from '@/components/TideInputText.vue';
4
4
  import * as STANDARD_FORMAT from '@/types/Formatted';
5
5
  import * as STANDARD_ICON from '@/types/Icon';
6
- import * as STANDARD_TEXT_INPUT_TYPE from '@/types/TextInput';
6
+ import * as STANDARD_TEXT_INPUT from '@/types/TextInput';
7
+ import * as STANDARD_ERROR_DISPLAY from '@/types/Validation';
7
8
  import { VALIDATOR } from '@/types/Validation';
8
9
  import {
9
10
  argTypeBooleanUnrequired,
10
11
  dataTrack,
11
12
  disabledArgType,
13
+ doSomething,
12
14
  formatArgType,
13
15
  formatArgTypeCheck,
14
16
  parameters,
15
17
  prependNoneAsUndefined,
16
18
  } from '@/utilities/storybook';
17
19
 
18
- import type { StoryContext } from '@storybook/vue3';
19
-
20
- type Args = InstanceType<typeof TideInputText>['$props'];
20
+ type Args = InstanceType<typeof TideInputText>['$props'] & {
21
+ handleValid: string;
22
+ vModel: string;
23
+ };
21
24
 
25
+ const ERROR_DISPLAY = prependNoneAsUndefined(STANDARD_ERROR_DISPLAY.ERROR_DISPLAY);
22
26
  const FORMAT = prependNoneAsUndefined(STANDARD_FORMAT.FORMAT);
23
27
  const ICON = prependNoneAsUndefined(STANDARD_ICON.ICON);
24
- const TEXT_INPUT_TYPE = prependNoneAsUndefined(STANDARD_TEXT_INPUT_TYPE.TEXT_INPUT_TYPE);
28
+ const TEXT_INPUT_TYPE = prependNoneAsUndefined(STANDARD_TEXT_INPUT.TEXT_INPUT_TYPE);
29
+ const INPUT_MODE = prependNoneAsUndefined(STANDARD_TEXT_INPUT.INPUT_MODE);
25
30
 
26
- const render = (args: Args, context: StoryContext) => ({
31
+ const render = (args: Args) => ({
27
32
  components: { TideInputText },
28
33
  methods: {
29
- handleChange: () => {
30
- const input = context.canvasElement.querySelector('input');
34
+ doSomething,
35
+ handleValid: () => {
36
+ action('TideInputText valid was emitted')({});
37
+
38
+ try {
39
+ const callback = eval(args.handleValid);
31
40
 
32
- action('TideInputText changed')({});
33
- context.updateArgs({ ...args, value: input?.value });
41
+ if (callback) {
42
+ callback();
43
+ }
44
+ } catch {
45
+ alert('Please specify a valid handler in the "valid" control.');
46
+ }
34
47
  },
35
48
  },
36
49
  setup: () => ({ args }),
37
- template: `<TideInputText @change="handleChange" v-bind="args" />`,
50
+ template: `<TideInputText @valid="handleValid" v-bind="args" />`,
38
51
  });
39
52
 
40
53
  export default {
@@ -47,10 +60,33 @@ export default {
47
60
  disabled: {
48
61
  ...argTypeBooleanUnrequired,
49
62
  description: 'Determines whether input is interactable',
63
+ table: {
64
+ ...argTypeBooleanUnrequired.table,
65
+ category: 'Native',
66
+ },
50
67
  },
51
68
  error: {
52
- ...argTypeBooleanUnrequired,
53
- description: 'Reflects whether the input value is valid',
69
+ control: 'text',
70
+ description: 'Overrides the default error message and valid state',
71
+ table: {
72
+ defaultValue: { summary: 'None' },
73
+ type: { summary: 'string' },
74
+ },
75
+ },
76
+ errorDisplay: {
77
+ ...formatArgType({ ERROR_DISPLAY }),
78
+ description: 'Determines whether errors display prior to blur',
79
+ },
80
+ handleValid: {
81
+ control: 'text',
82
+ description: 'JS code or function to execute on valid event',
83
+ isEmit: true,
84
+ name: 'valid',
85
+ table: {
86
+ category: 'Events',
87
+ defaultValue: { summary: 'None' },
88
+ type: { summary: '(isValid: boolean) => void' },
89
+ },
54
90
  },
55
91
  hasClear: {
56
92
  ...argTypeBooleanUnrequired,
@@ -69,6 +105,15 @@ export default {
69
105
  type: { summary: 'string' },
70
106
  },
71
107
  },
108
+ inputmode: {
109
+ ...formatArgType({ INPUT_MODE }),
110
+ description: 'Determines the input editing features offered by the browser',
111
+ table: {
112
+ category: 'Native',
113
+ defaultValue: { summary: 'None' },
114
+ type: { summary: 'string' },
115
+ },
116
+ },
72
117
  label: {
73
118
  control: 'text',
74
119
  description: 'Label content',
@@ -81,6 +126,7 @@ export default {
81
126
  control: 'text',
82
127
  description: 'Applies a maximum character count to the input',
83
128
  table: {
129
+ category: 'Native',
84
130
  defaultValue: { summary: 'None' },
85
131
  type: { summary: 'number' },
86
132
  },
@@ -89,6 +135,7 @@ export default {
89
135
  control: 'text',
90
136
  description: 'Applies a minimum character count to the input',
91
137
  table: {
138
+ category: 'Native',
92
139
  defaultValue: { summary: 'None' },
93
140
  type: { summary: 'number' },
94
141
  },
@@ -97,6 +144,7 @@ export default {
97
144
  control: 'text',
98
145
  description: 'Name attribute',
99
146
  table: {
147
+ category: 'Native',
100
148
  defaultValue: { summary: 'None' },
101
149
  type: { summary: 'string' },
102
150
  },
@@ -112,6 +160,10 @@ export default {
112
160
  required: {
113
161
  ...argTypeBooleanUnrequired,
114
162
  description: 'Determines whether input is required',
163
+ table: {
164
+ ...argTypeBooleanUnrequired.table,
165
+ category: 'Native',
166
+ },
115
167
  },
116
168
  suffix: {
117
169
  control: 'text',
@@ -136,29 +188,37 @@ export default {
136
188
  type: {
137
189
  ...formatArgType({ TEXT_INPUT_TYPE }),
138
190
  description: 'Determines the type(s) of values expected by the input',
191
+ table: {
192
+ ...formatArgType({ TEXT_INPUT_TYPE }).table,
193
+ category: 'Native',
194
+ },
139
195
  },
140
- updateValue: disabledArgType,
141
- validators: {
142
- ...formatArgTypeCheck({ VALIDATOR }),
143
- description: 'Determines method(s) used to check for valid input value upon invoking relevant listener event(s)',
144
- },
145
- value: {
196
+ vModel: {
146
197
  control: 'text',
147
- description: 'input value',
198
+ description: 'Data binding to Vue ref',
148
199
  table: {
200
+ category: 'Native',
149
201
  defaultValue: { summary: 'None' },
150
- type: { summary: 'string' },
202
+ type: { summary: 'Ref' },
151
203
  },
152
204
  },
205
+ valid: disabledArgType,
206
+ validators: {
207
+ ...formatArgTypeCheck({ VALIDATOR }),
208
+ description: 'Determines method(s) used to check for valid input value upon invoking relevant listener event(s)',
209
+ },
153
210
  },
154
211
  args: {
155
212
  autocomplete: undefined,
156
213
  dataTrack: '',
157
214
  disabled: undefined,
158
- error: undefined,
215
+ error: '',
216
+ errorDisplay: undefined,
217
+ handleValid: 'doSomething',
159
218
  hasClear: undefined,
160
219
  iconLeading: undefined,
161
220
  inputId: '',
221
+ inputmode: undefined,
162
222
  label: 'Input label',
163
223
  maxlength: '',
164
224
  minlength: '',
@@ -169,8 +229,8 @@ export default {
169
229
  supportingText: '',
170
230
  transformValue: undefined,
171
231
  type: undefined,
232
+ vModel: '',
172
233
  validators: [],
173
- value: '',
174
234
  },
175
235
  component: TideInputText,
176
236
  parameters,
@@ -1,32 +1,73 @@
1
1
  import { action } from '@storybook/addon-actions';
2
2
 
3
3
  import TideInputTextarea from '@/components/TideInputTextarea.vue';
4
- import { argTypeBooleanUnrequired, dataTrack, parameters } from '@/utilities/storybook';
4
+ import * as STANDARD_ERROR_DISPLAY from '@/types/Validation';
5
+ import { VALIDATOR } from '@/types/Validation';
6
+ import {
7
+ argTypeBooleanUnrequired,
8
+ dataTrack,
9
+ disabledArgType,
10
+ doSomething,
11
+ formatArgType,
12
+ formatArgTypeCheck,
13
+ parameters,
14
+ prependNoneAsUndefined,
15
+ } from '@/utilities/storybook';
5
16
 
6
- import type { StoryContext } from '@storybook/vue3';
17
+ type Args = InstanceType<typeof TideInputTextarea>['$props'] & {
18
+ handleValid: string;
19
+ vModel: string;
20
+ };
7
21
 
8
- type Args = InstanceType<typeof TideInputTextarea>['$props'];
22
+ const ERROR_DISPLAY = prependNoneAsUndefined(STANDARD_ERROR_DISPLAY.ERROR_DISPLAY);
9
23
 
10
- const render = (args: Args, context: StoryContext) => ({
24
+ const render = (args: Args) => ({
11
25
  components: { TideInputTextarea },
12
26
  methods: {
13
- handleChange: () => {
14
- const input = context.canvasElement.querySelector('textarea');
27
+ doSomething,
28
+ handleValid: () => {
29
+ action('TideInputText valid was emitted')({});
30
+
31
+ try {
32
+ const callback = eval(args.handleValid);
15
33
 
16
- action('TideInputTextarea changed')({});
17
- context.updateArgs({ ...args, value: input?.value });
34
+ if (callback) {
35
+ callback();
36
+ }
37
+ } catch {
38
+ alert('Please specify a valid handler in the "valid" control.');
39
+ }
18
40
  },
19
41
  },
20
42
  setup: () => ({ args }),
21
- template: `<TideInputTextarea @change="handleChange" v-bind="args" />`,
43
+ template: `<TideInputTextarea @valid="handleValid" v-bind="args" />`,
22
44
  });
23
45
 
24
46
  export default {
25
47
  argTypes: {
26
48
  dataTrack,
27
49
  error: {
28
- ...argTypeBooleanUnrequired,
29
- description: 'Reflects whether the input value is valid',
50
+ control: 'text',
51
+ description: 'Overrides the default error message and valid state',
52
+ table: {
53
+ defaultValue: { summary: 'None' },
54
+ type: { summary: 'string' },
55
+ },
56
+ },
57
+ errorDisplay: {
58
+ ...formatArgType({ ERROR_DISPLAY }),
59
+ description: 'Determines whether errors display prior to blur',
60
+ },
61
+ handleValid: {
62
+ control: 'text',
63
+ description: 'JS code or function to execute on valid event',
64
+ isEmit: true,
65
+ name: 'valid',
66
+ table: {
67
+ category: 'Events',
68
+ defaultValue: { summary: 'None' },
69
+ type: { summary: '(isValid: boolean) => void' },
70
+ },
30
71
  },
31
72
  inputId: {
32
73
  control: 'text',
@@ -88,27 +129,35 @@ export default {
88
129
  type: { summary: 'string' },
89
130
  },
90
131
  },
91
- value: {
132
+ vModel: {
92
133
  control: 'text',
93
- description: 'input value',
134
+ description: 'Data binding to Vue ref',
94
135
  table: {
136
+ category: 'Native',
95
137
  defaultValue: { summary: 'None' },
96
- type: { summary: 'string' },
138
+ type: { summary: 'Ref' },
97
139
  },
98
140
  },
141
+ valid: disabledArgType,
142
+ validators: {
143
+ ...formatArgTypeCheck({ VALIDATOR }),
144
+ description: 'Determines method(s) used to check for valid input value upon invoking relevant listener event(s)',
145
+ },
99
146
  },
100
147
  args: {
101
148
  dataTrack: '',
102
- error: undefined,
149
+ error: '',
150
+ errorDisplay: undefined,
151
+ handleValid: 'doSomething',
103
152
  inputId: '',
104
153
  label: 'Input label',
105
154
  maxlength: '',
106
155
  minlength: '',
107
156
  name: '',
108
157
  required: undefined,
109
- rows: undefined,
158
+ rows: '',
110
159
  supportingText: '',
111
- value: '',
160
+ vModel: '',
112
161
  },
113
162
  component: TideInputTextarea,
114
163
  parameters,
@@ -3,7 +3,6 @@ import { action } from '@storybook/addon-actions';
3
3
  import TideLink from '@/components/TideLink.vue';
4
4
  import * as STANDARD_ELEMENT from '@/types/Element';
5
5
  import * as STANDARD_ICON from '@/types/Icon';
6
- import * as STANDARD_LINK_SIZE from '@/types/Storybook';
7
6
  import {
8
7
  argTypeBooleanUnrequired,
9
8
  click,
@@ -21,7 +20,6 @@ type Args = InstanceType<typeof TideLink>['$props'] & {
21
20
 
22
21
  const ELEMENT = prependNoneAsUndefined(STANDARD_ELEMENT.ELEMENT);
23
22
  const ICON = prependNoneAsUndefined(STANDARD_ICON.ICON);
24
- const LINK_SIZE = prependNoneAsUndefined(STANDARD_LINK_SIZE.LINK_SIZE);
25
23
 
26
24
  const formatSnippet = (code: string, context: StoryContext) => {
27
25
  const { args, argTypes } = context;
@@ -29,7 +27,6 @@ const formatSnippet = (code: string, context: StoryContext) => {
29
27
  const argsWithValues: string[] = [];
30
28
  const { element, iconLeading, iconTrailing } = args;
31
29
 
32
- if (args.size !== undefined) argsWithValues.push(`:class="${args.size}"`);
33
30
  if (args.dataTrack !== '') argsWithValues.push(`:data-track="${args.dataTrack}"`);
34
31
  if (args.element !== undefined)
35
32
  argsWithValues.push(`:element="${formatValueAsConstant({ element: element }, argTypes)}"`);
@@ -66,7 +63,7 @@ const render = (args: Args) => ({
66
63
  },
67
64
  },
68
65
  setup: () => ({ args }),
69
- template: '<TideLink :class="args.size" @click="handleClick" v-bind="args" />',
66
+ template: '<TideLink @click="handleClick" v-bind="args" />',
70
67
  });
71
68
 
72
69
  export default {
@@ -113,15 +110,6 @@ export default {
113
110
  type: { summary: 'string' },
114
111
  },
115
112
  },
116
- size: {
117
- control: 'select',
118
- description: 'Link text size',
119
- options: LINK_SIZE,
120
- table: {
121
- defaultValue: { summary: 'None' },
122
- type: { summary: 'string' },
123
- },
124
- },
125
113
  subtle: {
126
114
  ...argTypeBooleanUnrequired,
127
115
  description: 'Hides the underline until hovered, de-emphasizing the link',
@@ -136,7 +124,6 @@ export default {
136
124
  iconTrailing: undefined,
137
125
  isNewTab: undefined,
138
126
  label: 'Demo',
139
- size: undefined,
140
127
  subtle: undefined,
141
128
  },
142
129
  component: TideLink,
@@ -0,0 +1,117 @@
1
+ import { action } from '@storybook/addon-actions';
2
+
3
+ import TideMenuItem from '@/components/TideMenuItem.vue';
4
+ import * as STANDARD_ELEMENT from '@/types/Element';
5
+ import * as STANDARD_ICON from '@/types/Icon';
6
+ import {
7
+ argTypeBooleanUnrequired,
8
+ click,
9
+ dataTrack,
10
+ formatArgType,
11
+ formatValueAsConstant,
12
+ prependNoneAsUndefined,
13
+ } from '@/utilities/storybook';
14
+
15
+ import type { StoryContext } from '@storybook/vue3';
16
+
17
+ type Args = InstanceType<typeof TideMenuItem>['$props'] & {
18
+ click: string;
19
+ };
20
+
21
+ const ELEMENT = prependNoneAsUndefined(STANDARD_ELEMENT.ELEMENT);
22
+ const ICON = prependNoneAsUndefined(STANDARD_ICON.ICON);
23
+
24
+ const formatSnippet = (code: string, context: StoryContext) => {
25
+ const { args, argTypes } = context;
26
+
27
+ const argsWithValues: string[] = [];
28
+ const { element, iconTrailing } = args;
29
+
30
+ if (args.dataTrack !== '') argsWithValues.push(`data-track="${args.dataTrack}"`);
31
+ if (args.element !== undefined)
32
+ argsWithValues.push(`:element="${formatValueAsConstant({ element: element }, argTypes)}"`);
33
+ if (args.href !== undefined && args.element !== ELEMENT.BUTTON) argsWithValues.push(`href="${args.href}"`);
34
+ if (args.iconTrailing !== undefined)
35
+ argsWithValues.push(`:icon-trailing="${formatValueAsConstant({ iconTrailing }, argTypes)}"`);
36
+ if (args.isNewTab !== undefined) argsWithValues.push(`:is-new-tab="${args.isNewTab}"`);
37
+ if (args.label !== undefined) argsWithValues.push(`label="${args.label}"`);
38
+ if (args.click !== undefined && args.element === ELEMENT.BUTTON) argsWithValues.push(`@click="${args.click}"`);
39
+
40
+ return `<TideMenuItem ${argsWithValues.join(' ')} />`;
41
+ };
42
+
43
+ const parameters = {
44
+ docs: {
45
+ source: {
46
+ format: 'vue',
47
+ language: 'html',
48
+ transform: formatSnippet,
49
+ },
50
+ },
51
+ };
52
+
53
+ const render = (args: Args) => ({
54
+ components: { TideMenuItem },
55
+ methods: {
56
+ handleClick: () => {
57
+ if (args.element !== ELEMENT.LINK && args.click) {
58
+ action('TideMenuItem clicked')({});
59
+ }
60
+ },
61
+ },
62
+ setup: () => ({ args }),
63
+ template: '<TideMenuItem @click="handleClick" v-bind="args" />',
64
+ });
65
+
66
+ export default {
67
+ argTypes: {
68
+ click: {
69
+ ...click,
70
+ if: { arg: 'element', eq: ELEMENT.BUTTON },
71
+ },
72
+ dataTrack,
73
+ element: {
74
+ ...formatArgType({ ELEMENT }),
75
+ table: {
76
+ defaultValue: { summary: 'LINK' },
77
+ type: { summary: 'Element' },
78
+ },
79
+ },
80
+ href: {
81
+ table: {
82
+ defaultValue: { summary: 'None' },
83
+ type: { summary: 'string' },
84
+ },
85
+ },
86
+ iconTrailing: {
87
+ ...formatArgType({ ICON }),
88
+ },
89
+ isNewTab: {
90
+ ...argTypeBooleanUnrequired,
91
+ if: { arg: 'element', eq: ELEMENT.LINK },
92
+ },
93
+ label: {
94
+ control: 'text',
95
+ table: {
96
+ defaultValue: { summary: 'None' },
97
+ type: { summary: 'string' },
98
+ },
99
+ },
100
+ },
101
+ args: {
102
+ click: 'doSomething',
103
+ dataTrack: '',
104
+ element: undefined,
105
+ href: '#',
106
+ iconTrailing: undefined,
107
+ isNewTab: undefined,
108
+ label: 'Demo',
109
+ },
110
+ component: TideMenuItem,
111
+ parameters,
112
+ render,
113
+ tags: ['autodocs'],
114
+ title: 'Components/TideMenuItem',
115
+ };
116
+
117
+ export const Demo = {};
@@ -17,7 +17,7 @@ type Args = InstanceType<typeof TidePagination>['$props'] & {
17
17
  handleChange: string;
18
18
  };
19
19
 
20
- const ELEMENT_TEXT_AS_ICON = prependNoneAsUndefined(STANDARD_ELEMENT.ELEMENT_TEXT_AS_ICON);
20
+ const ELEMENT_BROAD = prependNoneAsUndefined(STANDARD_ELEMENT.ELEMENT_BROAD);
21
21
 
22
22
  const render = (args: Args, context: StoryContext) => ({
23
23
  components: { TidePagination },
@@ -50,7 +50,7 @@ export default {
50
50
  description: 'Determines clickability<br />(Button only)',
51
51
  if: {
52
52
  arg: 'element',
53
- eq: ELEMENT_TEXT_AS_ICON.BUTTON,
53
+ eq: ELEMENT_BROAD.BUTTON,
54
54
  },
55
55
  },
56
56
  handleChange: {
@@ -52,7 +52,7 @@ const render = (args: Args) => ({
52
52
  ${args.default}
53
53
  </TidePopover>
54
54
  `,
55
- updated: () => {
55
+ updated() {
56
56
  if (args.offset === '') {
57
57
  delete args.offset;
58
58
  }
@@ -65,6 +65,10 @@ export const BADGE_COLOR_DETAILS: Record<
65
65
  export const BADGE_TRUSTED = {
66
66
  YEARS_10: '10',
67
67
  YEARS_15: '15',
68
+ YEARS_20: '20',
69
+ YEARS_25: '25',
70
+ YEARS_30: '30',
71
+ YEARS_35: '35',
68
72
  YEARS_5: '5',
69
73
  } as const;
70
74