tide-design-system 2.3.0 → 2.3.1

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 (43) hide show
  1. package/README.md +1 -0
  2. package/dist/css/variables.css +1 -1
  3. package/dist/style.css +1 -1
  4. package/dist/tide-design-system.cjs +2 -2
  5. package/dist/tide-design-system.esm.js +471 -455
  6. package/package.json +1 -1
  7. package/src/assets/css/variables.css +1 -1
  8. package/src/components/TideAlert.vue +2 -4
  9. package/src/components/TideInputCheckbox.vue +2 -2
  10. package/src/components/TideInputRadio.vue +4 -4
  11. package/src/components/TideModal.vue +18 -6
  12. package/src/components/TideSheet.vue +11 -1
  13. package/src/docs/upgrading.md +29 -0
  14. package/src/stories/Template.stories.ts +4 -2
  15. package/src/stories/TideAccordionItem.stories.ts +7 -1
  16. package/src/stories/TideAlert.stories.ts +5 -1
  17. package/src/stories/TideBadge.stories.ts +3 -1
  18. package/src/stories/TideBadgeTrustedPartner.stories.ts +3 -1
  19. package/src/stories/TideBadgeVerifiedVehicle.stories.ts +3 -1
  20. package/src/stories/TideButton.stories.ts +5 -1
  21. package/src/stories/TideButtonIcon.stories.ts +5 -1
  22. package/src/stories/TideButtonPagination.stories.ts +5 -1
  23. package/src/stories/TideButtonSegmented.stories.ts +7 -2
  24. package/src/stories/TideCard.stories.ts +5 -1
  25. package/src/stories/TideCarousel.stories.ts +8 -2
  26. package/src/stories/TideChipAction.stories.ts +3 -1
  27. package/src/stories/TideChipFilter.stories.ts +8 -2
  28. package/src/stories/TideChipInput.stories.ts +5 -1
  29. package/src/stories/TideDivider.stories.ts +6 -2
  30. package/src/stories/TideImageBackground.stories.ts +3 -1
  31. package/src/stories/TideIndicator.stories.ts +3 -1
  32. package/src/stories/TideInputCheckbox.stories.ts +8 -2
  33. package/src/stories/TideInputRadio.stories.ts +8 -2
  34. package/src/stories/TideInputSelect.stories.ts +7 -2
  35. package/src/stories/TideInputText.stories.ts +6 -2
  36. package/src/stories/TideInputTextarea.stories.ts +6 -2
  37. package/src/stories/TideLink.stories.ts +7 -3
  38. package/src/stories/TideModal.stories.ts +85 -44
  39. package/src/stories/TidePagination.stories.ts +8 -2
  40. package/src/stories/TidePopover.stories.ts +6 -1
  41. package/src/stories/TideSeoLinks.stories.ts +3 -1
  42. package/src/stories/TideSheet.stories.ts +9 -3
  43. package/src/stories/TideSwitch.stories.ts +7 -1
@@ -15,6 +15,10 @@ import {
15
15
 
16
16
  import type { StoryContext } from '@storybook/vue3';
17
17
 
18
+ type Args = InstanceType<typeof TideLink>['$props'] & {
19
+ click: string;
20
+ };
21
+
18
22
  const ELEMENT = prependNoneAsUndefined(STANDARD_ELEMENT.ELEMENT);
19
23
  const ICON = prependNoneAsUndefined(STANDARD_ICON.ICON);
20
24
  const LINK_SIZE = prependNoneAsUndefined(STANDARD_LINK_SIZE.LINK_SIZE);
@@ -29,7 +33,7 @@ const formatSnippet = (code: string, context: StoryContext) => {
29
33
  if (args.dataTrack !== '') argsWithValues.push(`:data-track="${args.dataTrack}"`);
30
34
  if (args.element !== undefined)
31
35
  argsWithValues.push(`:element="${formatValueAsConstant({ element: element }, argTypes)}"`);
32
- if (args.href !== undefined) argsWithValues.push(`:href="${args.href}"`);
36
+ if (args.href !== undefined && args.element !== ELEMENT.BUTTON) argsWithValues.push(`:href="${args.href}"`);
33
37
  if (args.iconLeading !== undefined)
34
38
  argsWithValues.push(`:icon-leading="${formatValueAsConstant({ iconLeading }, argTypes)}"`);
35
39
  if (args.iconTrailing !== undefined)
@@ -37,7 +41,7 @@ const formatSnippet = (code: string, context: StoryContext) => {
37
41
  if (args.isNewTab !== undefined) argsWithValues.push(`:is-new-tab="${args.isNewTab}"`);
38
42
  if (args.label !== undefined) argsWithValues.push(`:label="${args.label}"`);
39
43
  if (args.subtle !== undefined) argsWithValues.push(`:subtle="${args.subtle}"`);
40
- if (args.click !== undefined) argsWithValues.push(`@click="${args.click}"`);
44
+ if (args.click !== undefined && args.element === ELEMENT.BUTTON) argsWithValues.push(`@click="${args.click}"`);
41
45
 
42
46
  return `<TideLink ${argsWithValues.join(' ')} />`;
43
47
  };
@@ -52,7 +56,7 @@ const parameters = {
52
56
  },
53
57
  };
54
58
 
55
- const render = (args: any) => ({
59
+ const render = (args: Args) => ({
56
60
  components: { TideLink },
57
61
  methods: {
58
62
  handleClick: () => {
@@ -1,7 +1,16 @@
1
1
  import { action } from '@storybook/addon-actions';
2
+ import { compile, h } from 'vue';
2
3
 
3
4
  import TideButton from '@/components/TideButton.vue';
5
+ import TideIcon from '@/components/TideIcon.vue';
6
+ import TideLink from '@/components/TideLink.vue';
4
7
  import TideModal from '@/components/TideModal.vue';
8
+ import { ELEMENT } from '@/types/Element';
9
+ import { ICON } from '@/types/Icon';
10
+ import { PRIORITY } from '@/types/Priority';
11
+ import { SIZE, SIZE_BUTTON } from '@/types/Size';
12
+ import { CSS } from '@/types/Styles';
13
+ import { TARGET } from '@/types/Target';
5
14
  import {
6
15
  argTypeBooleanUnrequired,
7
16
  disabledArgType,
@@ -13,6 +22,14 @@ import {
13
22
 
14
23
  import type { StoryContext } from '@storybook/vue3';
15
24
 
25
+ type Args = InstanceType<typeof TideModal>['$props'] & {
26
+ default: string;
27
+ footer: string;
28
+ handleBack: string;
29
+ handleChange: string;
30
+ handleClose: string;
31
+ };
32
+
16
33
  const formatSnippet = (code: string, context: StoryContext) => {
17
34
  const { args } = context;
18
35
 
@@ -47,50 +64,74 @@ const parameters = {
47
64
  },
48
65
  };
49
66
 
50
- const render = (args: any, { updateArgs }: any) => ({
51
- components: { TideButton, TideModal },
52
- methods: {
53
- doSomething,
54
- doSomethingElse,
55
- handleBack: () => {
56
- action('Back button pressed')({});
57
-
58
- try {
59
- const callback = eval(args.handleBack);
60
-
61
- if (callback) {
62
- callback();
63
- }
64
- } catch {
65
- alert('Please specify a valid handler in the "back" control.');
66
- }
67
- },
68
- handleClose: () => {
69
- action('Modal closed')({});
70
- updateArgs({ ...args, isOpen: false });
71
-
72
- try {
73
- const callback = eval(args.handleClose);
74
-
75
- if (callback) {
76
- callback();
77
- }
78
- } catch {
79
- alert('Please specify a valid handler in the "close" control.');
80
- }
67
+ const render = (args: Args, context: StoryContext) => {
68
+ const handleBack = () => {
69
+ action('Back button pressed')({});
70
+ try {
71
+ const callback = eval(args.handleBack);
72
+ if (callback) callback();
73
+ } catch {
74
+ alert('Please specify a valid handler in the "back" control.');
75
+ }
76
+ };
77
+
78
+ const handleClose = () => {
79
+ action('Modal closed')({});
80
+ context.updateArgs({ ...args, isOpen: false });
81
+ try {
82
+ const callback = eval(args.handleClose);
83
+ if (callback) callback();
84
+ } catch {
85
+ alert('Please specify a valid handler in the "close" control.');
86
+ }
87
+ };
88
+
89
+ const handleOpenModalClick = () => {
90
+ context.updateArgs({ ...args, isOpen: true });
91
+ };
92
+
93
+ return {
94
+ components: { TideButton, TideModal },
95
+ methods: {
96
+ doSomething,
97
+ doSomethingElse,
98
+ handleBack,
99
+ handleClose,
100
+ handleOpenModalClick,
81
101
  },
82
- handleOpenModalClick: () => {
83
- updateArgs({ ...args, isOpen: true });
102
+ render: () => {
103
+ // Wrap compiled footer in a component with TideButton registered
104
+ const Footer = args.footer
105
+ ? {
106
+ components: { CSS, TideButton, TideIcon, TideLink },
107
+ render: compile(`<div class="tide-display-flex tide-axis1-end tide-width-full">${args.footer}</div>`),
108
+ setup: () => ({ CSS, ELEMENT, ICON, PRIORITY, SIZE, SIZE_BUTTON, TARGET }),
109
+ }
110
+ : null;
111
+
112
+ // Render function cannot use "template" method if required to compile Vue components.
113
+ return h('div', [
114
+ h(TideButton, {
115
+ label: 'Open Modal',
116
+ onClick: handleOpenModalClick,
117
+ }),
118
+ h(
119
+ TideModal,
120
+ {
121
+ ...args,
122
+ onBack: handleBack,
123
+ onClose: handleClose,
124
+ },
125
+ {
126
+ default: () => h('div', { innerHTML: args.default }),
127
+ footer: () => (Footer ? h(Footer) : null),
128
+ }
129
+ ),
130
+ ]);
84
131
  },
85
- },
86
- setup: () => ({ args }),
87
- template: `
88
- <TideButton label="Open Modal" @click="handleOpenModalClick" />
89
- <TideModal v-bind="args" @close="handleClose" @back="handleBack">
90
- ${args.default}
91
- <template #footer>${args.footer}</template>
92
- </TideModal>`,
93
- });
132
+ setup: () => ({ args }),
133
+ };
134
+ };
94
135
 
95
136
  export default {
96
137
  argTypes: {
@@ -109,7 +150,7 @@ export default {
109
150
  description: 'Footer content',
110
151
  table: {
111
152
  defaultValue: { summary: 'None' },
112
- type: { summary: 'HTML' },
153
+ type: { summary: 'HTML, TideButton, TideLink' },
113
154
  },
114
155
  },
115
156
  handleBack: {
@@ -166,7 +207,7 @@ export default {
166
207
  },
167
208
  },
168
209
  args: {
169
- default: `<div>${lineBreak}${tab}Default Slot Demo${lineBreak}</div>`,
210
+ default: `Default Slot Demo`,
170
211
  footer: '<TideButton label="Footer Slot Demo" />',
171
212
  handleBack: 'doSomething',
172
213
  handleClose: 'doSomethingElse',
@@ -11,15 +11,21 @@ import {
11
11
  prependNoneAsUndefined,
12
12
  } from '@/utilities/storybook';
13
13
 
14
+ import type { StoryContext } from '@storybook/vue3';
15
+
16
+ type Args = InstanceType<typeof TidePagination>['$props'] & {
17
+ handleChange: string;
18
+ };
19
+
14
20
  const ELEMENT_TEXT_AS_ICON = prependNoneAsUndefined(STANDARD_ELEMENT.ELEMENT_TEXT_AS_ICON);
15
21
 
16
- const render = (args: any, { updateArgs }: any) => ({
22
+ const render = (args: Args, context: StoryContext) => ({
17
23
  components: { TidePagination },
18
24
  methods: {
19
25
  doSomething,
20
26
  handleChange: (_event: Event, index: number) => {
21
27
  action(`Current page ${index}`)(index);
22
- updateArgs({ ...args, pageCurrent: index });
28
+ context.updateArgs({ ...args, pageCurrent: index });
23
29
 
24
30
  try {
25
31
  const callback = eval(args.handleChange);
@@ -5,6 +5,11 @@ import { lineBreak, tab } from '@/utilities/storybook';
5
5
 
6
6
  import type { StoryContext } from '@storybook/vue3';
7
7
 
8
+ type Args = InstanceType<typeof TidePopover>['$props'] & {
9
+ default: string;
10
+ offset: string;
11
+ };
12
+
8
13
  const formatSnippet = (code: string, context: StoryContext) => {
9
14
  const { args } = context;
10
15
 
@@ -31,7 +36,7 @@ const parameters = {
31
36
  },
32
37
  };
33
38
 
34
- const render = (args: any) => ({
39
+ const render = (args: Args) => ({
35
40
  components: { TideIcon, TidePopover },
36
41
  setup: () => {
37
42
  if (args.offset === '') {
@@ -3,6 +3,8 @@ import TideSeoLinks from '@/components/TideSeoLinks.vue';
3
3
  import type { Link } from '@/types/Link';
4
4
  import type { StoryContext } from '@storybook/vue3';
5
5
 
6
+ type Args = InstanceType<typeof TideSeoLinks>['$props'];
7
+
6
8
  const links: Link[] = new Array(12).fill({}).map((link, index) => {
7
9
  return {
8
10
  isNewTab: false,
@@ -27,7 +29,7 @@ const parameters = {
27
29
  },
28
30
  };
29
31
 
30
- const render = (args: any) => ({
32
+ const render = (args: Args) => ({
31
33
  components: { TideSeoLinks },
32
34
  setup: () => ({ args }),
33
35
  template: '<TideSeoLinks v-bind="args" />',
@@ -13,6 +13,12 @@ import {
13
13
 
14
14
  import type { StoryContext } from '@storybook/vue3';
15
15
 
16
+ type Args = InstanceType<typeof TideSheet>['$props'] & {
17
+ default: string;
18
+ handleBack: string;
19
+ handleClose: string;
20
+ };
21
+
16
22
  const formatSnippet = (code: string, context: StoryContext) => {
17
23
  const { args } = context;
18
24
 
@@ -35,7 +41,7 @@ const parameters = {
35
41
  },
36
42
  };
37
43
 
38
- const render = (args: any, { updateArgs }: any) => ({
44
+ const render = (args: Args, context: StoryContext) => ({
39
45
  components: { TideButton, TideSheet },
40
46
  methods: {
41
47
  doSomething,
@@ -55,7 +61,7 @@ const render = (args: any, { updateArgs }: any) => ({
55
61
  },
56
62
  handleClose: () => {
57
63
  action('Sheet closed')({});
58
- updateArgs({ ...args, isOpen: false });
64
+ context.updateArgs({ ...args, isOpen: false });
59
65
 
60
66
  try {
61
67
  const callback = eval(args.handleClose);
@@ -68,7 +74,7 @@ const render = (args: any, { updateArgs }: any) => ({
68
74
  }
69
75
  },
70
76
  handleOpenSheetClick: () => {
71
- updateArgs({ ...args, isOpen: true });
77
+ context.updateArgs({ ...args, isOpen: true });
72
78
  },
73
79
  },
74
80
  setup: () => ({ args }),
@@ -10,7 +10,13 @@ import {
10
10
  parameters,
11
11
  } from '@/utilities/storybook';
12
12
 
13
- const render = (args: any, context: any) => ({
13
+ import type { StoryContext } from '@storybook/vue3';
14
+
15
+ type Args = InstanceType<typeof TideSwitch>['$props'] & {
16
+ handleChange: string;
17
+ };
18
+
19
+ const render = (args: Args, context: StoryContext) => ({
14
20
  components: { TideSwitch },
15
21
  methods: {
16
22
  doSomething,