tide-design-system 2.4.5 → 2.4.6

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 (45) hide show
  1. package/dist/css/reset.css +1 -1
  2. package/dist/css/utilities-responsive.css +0 -546
  3. package/dist/style.css +1 -1
  4. package/dist/tide-design-system.cjs +2 -2
  5. package/dist/tide-design-system.esm.d.ts +19 -6
  6. package/dist/tide-design-system.esm.js +1201 -1170
  7. package/dist/utilities/storybook.ts +6 -2
  8. package/dist/utilities/validation.ts +1 -1
  9. package/index.ts +4 -4
  10. package/package.json +1 -1
  11. package/src/assets/css/reset.css +1 -1
  12. package/src/assets/css/utilities-responsive.css +0 -546
  13. package/src/components/TideButton.vue +14 -4
  14. package/src/components/TideButtonIcon.vue +12 -2
  15. package/src/components/TideButtonPagination.vue +11 -16
  16. package/src/components/TideButtonSegmented.vue +1 -0
  17. package/src/components/TideCard.vue +11 -2
  18. package/src/components/TideCarousel.vue +9 -4
  19. package/src/components/TideChipAction.vue +1 -0
  20. package/src/components/TideChipFilter.vue +1 -0
  21. package/src/components/TideChipInput.vue +1 -0
  22. package/src/components/TideIcon.vue +1 -1
  23. package/src/components/TideImage.vue +9 -9
  24. package/src/components/TideInputText.vue +2 -0
  25. package/src/components/TideInputTextDeprecated.vue +2 -0
  26. package/src/components/TideInputTextarea.vue +2 -2
  27. package/src/components/TideLink.vue +2 -1
  28. package/src/components/TideModal.vue +91 -85
  29. package/src/components/TideSwitch.vue +1 -0
  30. package/src/stories/TideButtonPagination.stories.ts +6 -6
  31. package/src/stories/TideCarousel.stories.ts +0 -1
  32. package/src/stories/TideInputCheckbox.stories.ts +58 -23
  33. package/src/stories/TideInputRadio.stories.ts +39 -30
  34. package/src/stories/TideInputSelect.stories.ts +51 -27
  35. package/src/stories/TideInputText.stories.ts +83 -23
  36. package/src/stories/TideInputTextarea.stories.ts +66 -17
  37. package/src/stories/TideLink.stories.ts +1 -14
  38. package/src/stories/TidePagination.stories.ts +2 -2
  39. package/src/stories/TidePopover.stories.ts +1 -1
  40. package/src/types/Badge.ts +4 -0
  41. package/src/types/Element.ts +2 -2
  42. package/src/types/Storybook.ts +4 -6
  43. package/src/types/Type.ts +6 -0
  44. package/src/utilities/storybook.ts +6 -2
  45. package/src/utilities/validation.ts +1 -1
@@ -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,
@@ -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
 
@@ -3,11 +3,11 @@ export const ELEMENT = {
3
3
  LINK: 'a',
4
4
  } as const;
5
5
 
6
- export const ELEMENT_TEXT_AS_ICON = {
6
+ export const ELEMENT_BROAD = {
7
7
  BUTTON: 'button',
8
8
  DIV: 'div',
9
9
  LINK: 'a',
10
10
  } as const;
11
11
 
12
12
  export type Element = (typeof ELEMENT)[keyof typeof ELEMENT];
13
- export type ElementTextAsIcon = (typeof ELEMENT_TEXT_AS_ICON)[keyof typeof ELEMENT_TEXT_AS_ICON];
13
+ export type ElementBroad = (typeof ELEMENT_BROAD)[keyof typeof ELEMENT_BROAD];
@@ -22,6 +22,10 @@ export const BADGE_TRUSTED = {
22
22
  YEARS_5: '5',
23
23
  YEARS_10: '10',
24
24
  YEARS_15: '15',
25
+ YEARS_20: '20',
26
+ YEARS_25: '25',
27
+ YEARS_30: '30',
28
+ YEARS_35: '35',
25
29
  };
26
30
 
27
31
  export const BG = {
@@ -115,12 +119,6 @@ export const GAP = {
115
119
  '0.25 REM': CSS.GAP.QUARTER,
116
120
  };
117
121
 
118
- export const LINK_SIZE = {
119
- TWELVE: CSS.FONT.SIZE.TWELVE,
120
- FOURTEEN: CSS.FONT.SIZE.FOURTEEN,
121
- SIXTEEN: CSS.FONT.SIZE.SIXTEEN,
122
- };
123
-
124
122
  export const MARGIN = {
125
123
  'Full 4 REM': CSS.MARGIN.FULL.FOUR,
126
124
  'Full 2 REM': CSS.MARGIN.FULL.TWO,
@@ -0,0 +1,6 @@
1
+ export const BUTTON_TYPE = {
2
+ BUTTON: 'button',
3
+ SUBMIT: 'submit',
4
+ } as const;
5
+
6
+ export type ButtonType = (typeof BUTTON_TYPE)[keyof typeof BUTTON_TYPE];
@@ -1,4 +1,4 @@
1
- import { ELEMENT, ELEMENT_TEXT_AS_ICON } from '@/types/Element';
1
+ import { ELEMENT, ELEMENT_BROAD } from '@/types/Element';
2
2
  import { BOOLEAN, BOOLEAN_UNREQUIRED, NoneAsEmpty, NoneAsUndefined } from '@/types/Storybook';
3
3
  import { CSS } from '@/types/Styles';
4
4
  import { formatKebabCase } from '@/utilities/format';
@@ -61,6 +61,7 @@ export const change = {
61
61
  isEmit: true,
62
62
  name: 'change',
63
63
  table: {
64
+ category: 'Events',
64
65
  defaultValue: { summary: 'None' },
65
66
  type: { summary: '() => void' },
66
67
  },
@@ -71,6 +72,7 @@ export const click = {
71
72
  description: 'JS code or function to execute on click event',
72
73
  isEmit: true,
73
74
  table: {
75
+ category: 'Events',
74
76
  defaultValue: { summary: 'None' },
75
77
  type: { summary: '() => void' },
76
78
  },
@@ -81,6 +83,7 @@ export const close = {
81
83
  description: 'JS code or function to execute on close event',
82
84
  isEmit: true,
83
85
  table: {
86
+ category: 'Events',
84
87
  defaultValue: { summary: 'None' },
85
88
  type: { summary: '() => void' },
86
89
  },
@@ -90,6 +93,7 @@ export const dataTrack = {
90
93
  control: 'text',
91
94
  description: 'Data attribute for external tracking',
92
95
  table: {
96
+ category: 'Native',
93
97
  defaultValue: { summary: 'None' },
94
98
  type: { summary: 'string' },
95
99
  },
@@ -252,7 +256,7 @@ export const formatSnippet = (code: string, context: StoryContext) => {
252
256
  if (
253
257
  isClick &&
254
258
  value &&
255
- (!args.element || args.element === ELEMENT.BUTTON || args.element === ELEMENT_TEXT_AS_ICON.BUTTON)
259
+ (!args.element || args.element === ELEMENT.BUTTON || args.element === ELEMENT_BROAD.BUTTON)
256
260
  ) {
257
261
  return `@click="${value}"`;
258
262
  }
@@ -70,7 +70,7 @@ export const getFieldValidationResult = ({
70
70
  }
71
71
 
72
72
  // all other prop-based errors come last
73
- if (required && value.value.trim() === '') {
73
+ if (required && value.value?.trim() === '') {
74
74
  return VALIDATION_RESULT.REQUIRED;
75
75
  }
76
76