tide-design-system 2.2.16 → 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 (73) hide show
  1. package/README.md +1 -0
  2. package/dist/css/main.css +0 -6
  3. package/dist/css/utilities-base.css +541 -0
  4. package/dist/css/utilities-responsive.css +2717 -0
  5. package/dist/css/utilities.css +2 -446
  6. package/dist/css/variables.css +1 -1
  7. package/dist/style.css +1 -1
  8. package/dist/tide-design-system.cjs +2 -2
  9. package/dist/tide-design-system.esm.d.ts +0 -81
  10. package/dist/tide-design-system.esm.js +397 -389
  11. package/dist/utilities/validation.ts +5 -1
  12. package/index.ts +0 -17
  13. package/package.json +1 -1
  14. package/src/assets/css/main.css +0 -6
  15. package/src/assets/css/utilities-base.css +541 -0
  16. package/src/assets/css/utilities-responsive.css +2717 -0
  17. package/src/assets/css/utilities.css +2 -446
  18. package/src/assets/css/variables.css +1 -1
  19. package/src/components/TideAlert.vue +2 -4
  20. package/src/components/TideInputCheckbox.vue +2 -2
  21. package/src/components/TideInputRadio.vue +4 -4
  22. package/src/components/TideModal.vue +18 -6
  23. package/src/components/TideSheet.vue +11 -1
  24. package/src/docs/integration-partial.md +0 -7
  25. package/src/docs/upgrading.md +29 -0
  26. package/src/stories/Template.stories.ts +4 -2
  27. package/src/stories/TideAccordionItem.stories.ts +7 -1
  28. package/src/stories/TideAlert.stories.ts +5 -1
  29. package/src/stories/TideBadge.stories.ts +3 -1
  30. package/src/stories/TideBadgeTrustedPartner.stories.ts +3 -1
  31. package/src/stories/TideBadgeVerifiedVehicle.stories.ts +3 -1
  32. package/src/stories/TideButton.stories.ts +5 -1
  33. package/src/stories/TideButtonIcon.stories.ts +5 -1
  34. package/src/stories/TideButtonPagination.stories.ts +5 -1
  35. package/src/stories/TideButtonSegmented.stories.ts +7 -2
  36. package/src/stories/TideCard.stories.ts +5 -1
  37. package/src/stories/TideCarousel.stories.ts +8 -2
  38. package/src/stories/TideChipAction.stories.ts +3 -1
  39. package/src/stories/TideChipFilter.stories.ts +8 -2
  40. package/src/stories/TideChipInput.stories.ts +5 -1
  41. package/src/stories/TideDivider.stories.ts +6 -2
  42. package/src/stories/TideImageBackground.stories.ts +3 -1
  43. package/src/stories/TideIndicator.stories.ts +3 -1
  44. package/src/stories/TideInputCheckbox.stories.ts +8 -2
  45. package/src/stories/TideInputRadio.stories.ts +8 -2
  46. package/src/stories/TideInputSelect.stories.ts +7 -2
  47. package/src/stories/TideInputText.stories.ts +6 -2
  48. package/src/stories/TideInputTextarea.stories.ts +6 -2
  49. package/src/stories/TideLink.stories.ts +7 -3
  50. package/src/stories/TideModal.stories.ts +85 -44
  51. package/src/stories/TidePagination.stories.ts +8 -2
  52. package/src/stories/TidePopover.stories.ts +6 -1
  53. package/src/stories/TideSeoLinks.stories.ts +3 -1
  54. package/src/stories/TideSheet.stories.ts +9 -3
  55. package/src/stories/TideSwitch.stories.ts +7 -1
  56. package/src/utilities/validation.ts +5 -1
  57. package/dist/css/dynamic-buttons.css +0 -346
  58. package/dist/css/dynamic-utilities.css +0 -152
  59. package/dist/css/utilities-lg.css +0 -448
  60. package/dist/css/utilities-md.css +0 -448
  61. package/dist/css/utilities-sm.css +0 -448
  62. package/dist/css/utilities-xl.css +0 -448
  63. package/src/assets/css/dynamic-buttons.css +0 -346
  64. package/src/assets/css/dynamic-utilities.css +0 -152
  65. package/src/assets/css/utilities-lg.css +0 -448
  66. package/src/assets/css/utilities-md.css +0 -448
  67. package/src/assets/css/utilities-sm.css +0 -448
  68. package/src/assets/css/utilities-xl.css +0 -448
  69. package/src/types/Detail.ts +0 -4
  70. package/src/types/FacetRange.ts +0 -84
  71. package/src/types/ListingMedia.ts +0 -43
  72. package/src/types/Raw.ts +0 -5
  73. package/src/types/RealmConfig.ts +0 -14
@@ -5,6 +5,8 @@ import { argTypeBooleanUnrequired, formatArgType, prependNoneAsUndefined } from
5
5
 
6
6
  import type { StoryContext } from '@storybook/vue3';
7
7
 
8
+ type Args = InstanceType<typeof TideBadge>['$props'];
9
+
8
10
  const BADGE_COLOR = prependNoneAsUndefined(STANDARD_BADGE_COLOR);
9
11
  const ICON = prependNoneAsUndefined(STANDARD_ICON.ICON);
10
12
 
@@ -34,7 +36,7 @@ const parameters = {
34
36
  },
35
37
  };
36
38
 
37
- const render = (args: any) => ({
39
+ const render = (args: Args) => ({
38
40
  components: { TideBadge },
39
41
  setup: () => ({ args }),
40
42
  template: `<TideBadge v-bind="args" />`,
@@ -2,9 +2,11 @@ import TideBadgeTrustedPartner from '@/components/TideBadgeTrustedPartner.vue';
2
2
  import * as STANDARD_BADGE from '@/types/Storybook';
3
3
  import { formatArgType, parameters, prependNoneAsUndefined } from '@/utilities/storybook';
4
4
 
5
+ type Args = InstanceType<typeof TideBadgeTrustedPartner>['$props'];
6
+
5
7
  const BADGE_TRUSTED = prependNoneAsUndefined(STANDARD_BADGE.BADGE_TRUSTED);
6
8
 
7
- const render = (args: any) => ({
9
+ const render = (args: Args) => ({
8
10
  components: { TideBadgeTrustedPartner },
9
11
  setup: () => ({ args }),
10
12
  template: `<TideBadgeTrustedPartner v-bind="args" />`,
@@ -1,7 +1,9 @@
1
1
  import TideBadgeVerifiedVehicle from '@/components/TideBadgeVerifiedVehicle.vue';
2
2
  import { parameters } from '@/utilities/storybook';
3
3
 
4
- const render = (args: any) => ({
4
+ type Args = InstanceType<typeof TideBadgeVerifiedVehicle>['$props'];
5
+
6
+ const render = (args: Args) => ({
5
7
  components: { TideBadgeVerifiedVehicle },
6
8
  setup: () => ({ args }),
7
9
  template: `<TideBadgeVerifiedVehicle v-bind="args" />`,
@@ -15,12 +15,16 @@ import {
15
15
  prependNoneAsUndefined,
16
16
  } from '@/utilities/storybook';
17
17
 
18
+ type Args = InstanceType<typeof TideButton>['$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 PRIORITY = prependNoneAsUndefined(STANDARD_PRIORITY.PRIORITY);
21
25
  const SIZE_BUTTON = prependNoneAsUndefined(STANDARD_SIZE_BUTTON.SIZE_BUTTON);
22
26
 
23
- const render = (args: any) => ({
27
+ const render = (args: Args) => ({
24
28
  components: { TideButton },
25
29
  methods: {
26
30
  doSomething,
@@ -14,10 +14,14 @@ import {
14
14
  prependNoneAsUndefined,
15
15
  } from '@/utilities/storybook';
16
16
 
17
+ type Args = InstanceType<typeof TideButtonIcon>['$props'] & {
18
+ click: string;
19
+ };
20
+
17
21
  const ELEMENT = prependNoneAsUndefined(STANDARD_ELEMENT.ELEMENT);
18
22
  const PRIORITY = prependNoneAsUndefined(STANDARD_PRIORITY.PRIORITY);
19
23
 
20
- const render = (args: any) => ({
24
+ const render = (args: Args) => ({
21
25
  components: { TideButtonIcon },
22
26
  methods: {
23
27
  doSomething,
@@ -12,9 +12,13 @@ import {
12
12
  prependNoneAsUndefined,
13
13
  } from '@/utilities/storybook';
14
14
 
15
+ type Args = InstanceType<typeof TideButtonPagination>['$props'] & {
16
+ click: string;
17
+ };
18
+
15
19
  const ELEMENT_TEXT_AS_ICON = prependNoneAsUndefined(STANDARD_ELEMENT.ELEMENT_TEXT_AS_ICON);
16
20
 
17
- const render = (args: any) => ({
21
+ const render = (args: Args) => ({
18
22
  components: { TideButtonPagination },
19
23
  methods: {
20
24
  doSomething,
@@ -4,6 +4,11 @@ import TideButtonSegmented from '@/components/TideButtonSegmented.vue';
4
4
  import { change, disabledArgType, doSomething, getLabelsFromOptions, parameters } from '@/utilities/storybook';
5
5
 
6
6
  import type { Tab } from '@/types/Tab';
7
+ import type { StoryContext } from '@storybook/vue3';
8
+
9
+ type Args = InstanceType<typeof TideButtonSegmented>['$props'] & {
10
+ handleChange: string;
11
+ };
7
12
 
8
13
  const options = {
9
14
  'None': undefined,
@@ -27,13 +32,13 @@ const tabs: Tab[] = [
27
32
  },
28
33
  ];
29
34
 
30
- const render = (args: any, { updateArgs }: any) => ({
35
+ const render = (args: Args, context: StoryContext) => ({
31
36
  components: { TideButtonSegmented },
32
37
  methods: {
33
38
  doSomething,
34
39
  handleChange: (index: number) => {
35
40
  action(`Current tab ${index}`)(index);
36
- updateArgs({ ...args, activeTab: index });
41
+ context.updateArgs({ ...args, activeTab: index });
37
42
 
38
43
  try {
39
44
  const callback = eval(args.handleChange);
@@ -12,10 +12,14 @@ import {
12
12
  prependNoneAsUndefined,
13
13
  } from '@/utilities/storybook';
14
14
 
15
+ type Args = InstanceType<typeof TideCard>['$props'] & {
16
+ click: string;
17
+ };
18
+
15
19
  const TYPE_CARD = prependNoneAsUndefined(STANDARD_TYPE_CARD);
16
20
  const CARD_ICON = prependNoneAsUndefined(ICON);
17
21
 
18
- const render = (args: any) => ({
22
+ const render = (args: Args) => ({
19
23
  components: { TideCard },
20
24
  methods: {
21
25
  doSomething,
@@ -6,6 +6,12 @@ import { argTypeBooleanUnrequired, disabledArgType, doSomething, lineBreak, tab
6
6
 
7
7
  import type { StoryContext } from '@storybook/vue3';
8
8
 
9
+ type Args = InstanceType<typeof TideCarousel>['$props'] & {
10
+ bleed: number | string;
11
+ handleSlideChange: string;
12
+ handleSlidesAddedToView: string;
13
+ };
14
+
9
15
  const formatSnippet = (code: string, context: StoryContext) => {
10
16
  const { args } = context;
11
17
 
@@ -44,7 +50,7 @@ const parameters = {
44
50
  },
45
51
  };
46
52
 
47
- const render = (args: any) => ({
53
+ const render = (args: Args) => ({
48
54
  components: { TideCard, TideCarousel },
49
55
  methods: {
50
56
  doSomething,
@@ -94,7 +100,7 @@ const render = (args: any) => ({
94
100
  </li>
95
101
  </TideCarousel>`,
96
102
  updated() {
97
- if (args.bleed === '') {
103
+ if (typeof args.bleed === 'string' && args.bleed === '') {
98
104
  args.bleed = 0;
99
105
  }
100
106
 
@@ -9,9 +9,11 @@ import {
9
9
  prependNoneAsUndefined,
10
10
  } from '@/utilities/storybook';
11
11
 
12
+ type Args = InstanceType<typeof TideChipAction>['$props'];
13
+
12
14
  const ELEMENT = prependNoneAsUndefined(STANDARD_ELEMENT.ELEMENT);
13
15
 
14
- const render = (args: any) => ({
16
+ const render = (args: Args) => ({
15
17
  components: { TideChipAction },
16
18
  setup: () => ({ args }),
17
19
  template: '<TideChipAction class="tide-display-inline-flex" v-bind="args" />',
@@ -3,13 +3,19 @@ import { action } from '@storybook/addon-actions';
3
3
  import TideChipFilter from '@/components/TideChipFilter.vue';
4
4
  import { argTypeBooleanUnrequired, click, dataTrack, doSomething, parameters } from '@/utilities/storybook';
5
5
 
6
- const render = (args: any, { updateArgs }: any) => ({
6
+ import type { StoryContext } from '@storybook/vue3';
7
+
8
+ type Args = InstanceType<typeof TideChipFilter>['$props'] & {
9
+ handleClose: string;
10
+ };
11
+
12
+ const render = (args: Args, context: StoryContext) => ({
7
13
  components: { TideChipFilter },
8
14
  methods: {
9
15
  doSomething,
10
16
  handleClick: () => {
11
17
  action('TideChipFilter clicked')({});
12
- updateArgs({ ...args, isActive: !args.isActive });
18
+ context.updateArgs({ ...args, isActive: !args.isActive });
13
19
 
14
20
  try {
15
21
  const callback = eval(args.handleClose);
@@ -3,7 +3,11 @@ import { action } from '@storybook/addon-actions';
3
3
  import TideChipInput from '@/components/TideChipInput.vue';
4
4
  import { click, dataTrack, doSomething, parameters } from '@/utilities/storybook';
5
5
 
6
- const render = (args: any) => ({
6
+ type Args = InstanceType<typeof TideChipInput>['$props'] & {
7
+ click: string;
8
+ };
9
+
10
+ const render = (args: Args) => ({
7
11
  components: { TideChipInput },
8
12
  methods: {
9
13
  doSomething,
@@ -2,13 +2,17 @@ import TideDivider from '@/components/TideDivider.vue';
2
2
  import { ORIENTATION as STANDARD_ORIENTATION } from '@/types/Orientation';
3
3
  import { disabledArgType, formatArgType, parameters, prependNoneAsUndefined } from '@/utilities/storybook';
4
4
 
5
- const formatArgs = (args: any) => {
5
+ type Args = InstanceType<typeof TideDivider>['$props'] & {
6
+ flexDirection: string;
7
+ };
8
+
9
+ const formatArgs = (args: Args) => {
6
10
  args.flexDirection = args.orientation === ORIENTATION.VERTICAL ? 'tide-flex-row' : 'tide-flex-column';
7
11
 
8
12
  return { args };
9
13
  };
10
14
 
11
- const render = (args: any) => ({
15
+ const render = (args: Args) => ({
12
16
  components: { TideDivider },
13
17
  setup: () => formatArgs(args),
14
18
  template: `<div :class="['tide-display-inline-flex', args.flexDirection]">
@@ -5,6 +5,8 @@ import { argTypeBooleanUnrequired } from '@/utilities/storybook';
5
5
  import type { Source } from '@/types/Source';
6
6
  import type { StoryContext } from '@storybook/vue3';
7
7
 
8
+ type Args = InstanceType<typeof TideImageBackground>['$props'];
9
+
8
10
  const formatSnippet = (_code: string, context: StoryContext) => {
9
11
  const { args } = context;
10
12
  const argsWithValues: string[] = [`alt="${args.alt}"`];
@@ -28,7 +30,7 @@ const parameters = {
28
30
  },
29
31
  };
30
32
 
31
- const render = (args: any) => ({
33
+ const render = (args: Args) => ({
32
34
  components: { TideImageBackground },
33
35
  setup() {
34
36
  return { args };
@@ -1,7 +1,9 @@
1
1
  import TideIndicator from '@/components/TideIndicator.vue';
2
2
  import { parameters } from '@/utilities/storybook';
3
3
 
4
- const render = (args: any) => ({
4
+ type Args = InstanceType<typeof TideIndicator>['$props'];
5
+
6
+ const render = (args: Args) => ({
5
7
  components: { TideIndicator },
6
8
  setup: () => ({ args }),
7
9
  template: `<TideIndicator v-bind="args" />`,
@@ -3,7 +3,13 @@ import { action } from '@storybook/addon-actions';
3
3
  import TideInputCheckbox from '@/components/TideInputCheckbox.vue';
4
4
  import { argTypeBooleanUnrequired, click, dataTrack, doSomething, parameters } from '@/utilities/storybook';
5
5
 
6
- const render = (args: any, context: any) => ({
6
+ import type { StoryContext } from '@storybook/vue3';
7
+
8
+ type Args = InstanceType<typeof TideInputCheckbox>['$props'] & {
9
+ click: string;
10
+ };
11
+
12
+ const render = (args: Args, context: StoryContext) => ({
7
13
  components: { TideInputCheckbox },
8
14
  methods: {
9
15
  doSomething,
@@ -11,7 +17,7 @@ const render = (args: any, context: any) => ({
11
17
  const input = context.canvasElement.querySelector('input');
12
18
 
13
19
  action('TideInputCheckbox clicked')({});
14
- context.updateArgs({ ...args, checked: !input.checked === true, indeterminate: undefined });
20
+ context.updateArgs({ ...args, checked: !input?.checked === true, indeterminate: undefined });
15
21
 
16
22
  try {
17
23
  const callback = eval(args.click);
@@ -3,7 +3,13 @@ import { action } from '@storybook/addon-actions';
3
3
  import TideInputRadio from '@/components/TideInputRadio.vue';
4
4
  import { argTypeBooleanUnrequired, click, dataTrack, doSomething, parameters } from '@/utilities/storybook';
5
5
 
6
- const render = (args: any, context: any) => ({
6
+ import type { StoryContext } from '@storybook/vue3';
7
+
8
+ type Args = InstanceType<typeof TideInputRadio>['$props'] & {
9
+ click: string;
10
+ };
11
+
12
+ const render = (args: Args, context: StoryContext) => ({
7
13
  components: { TideInputRadio },
8
14
  methods: {
9
15
  doSomething,
@@ -11,7 +17,7 @@ const render = (args: any, context: any) => ({
11
17
  const input = context.canvasElement.querySelector('input');
12
18
 
13
19
  action('TideInputRadio changed')({});
14
- context.updateArgs({ ...args, checked: !input.checked });
20
+ context.updateArgs({ ...args, checked: !input?.checked });
15
21
 
16
22
  try {
17
23
  const callback = eval(args.click);
@@ -12,6 +12,11 @@ import {
12
12
  } from '@/utilities/storybook';
13
13
 
14
14
  import type { SelectOption, SelectOptionGroup } from '@/types/Select';
15
+ import type { StoryContext } from '@storybook/vue3';
16
+
17
+ type Args = InstanceType<typeof TideInputSelect>['$props'] & {
18
+ change: string;
19
+ };
15
20
 
16
21
  const options = {
17
22
  'Any': '',
@@ -82,7 +87,7 @@ const selectOptions: SelectOption[] = [
82
87
  },
83
88
  ];
84
89
 
85
- const render = (args: any, { updateArgs }: any) => ({
90
+ const render = (args: Args, context: StoryContext) => ({
86
91
  components: { TideInputSelect },
87
92
  methods: {
88
93
  doSomething,
@@ -90,7 +95,7 @@ const render = (args: any, { updateArgs }: any) => ({
90
95
  const value = (event?.target as HTMLSelectElement).value;
91
96
 
92
97
  action('TideInputSelect changed')({});
93
- updateArgs({ ...args, value });
98
+ context.updateArgs({ ...args, value });
94
99
 
95
100
  try {
96
101
  const callback = eval(args.change);
@@ -15,18 +15,22 @@ import {
15
15
  prependNoneAsUndefined,
16
16
  } from '@/utilities/storybook';
17
17
 
18
+ import type { StoryContext } from '@storybook/vue3';
19
+
20
+ type Args = InstanceType<typeof TideInputText>['$props'];
21
+
18
22
  const FORMAT = prependNoneAsUndefined(STANDARD_FORMAT.FORMAT);
19
23
  const ICON = prependNoneAsUndefined(STANDARD_ICON.ICON);
20
24
  const TEXT_INPUT_TYPE = prependNoneAsUndefined(STANDARD_TEXT_INPUT_TYPE.TEXT_INPUT_TYPE);
21
25
 
22
- const render = (args: any, context: any) => ({
26
+ const render = (args: Args, context: StoryContext) => ({
23
27
  components: { TideInputText },
24
28
  methods: {
25
29
  handleChange: () => {
26
30
  const input = context.canvasElement.querySelector('input');
27
31
 
28
32
  action('TideInputText changed')({});
29
- context.updateArgs({ ...args, value: input.value });
33
+ context.updateArgs({ ...args, value: input?.value });
30
34
  },
31
35
  },
32
36
  setup: () => ({ args }),
@@ -3,14 +3,18 @@ import { action } from '@storybook/addon-actions';
3
3
  import TideInputTextarea from '@/components/TideInputTextarea.vue';
4
4
  import { argTypeBooleanUnrequired, dataTrack, parameters } from '@/utilities/storybook';
5
5
 
6
- const render = (args: any, context: any) => ({
6
+ import type { StoryContext } from '@storybook/vue3';
7
+
8
+ type Args = InstanceType<typeof TideInputTextarea>['$props'];
9
+
10
+ const render = (args: Args, context: StoryContext) => ({
7
11
  components: { TideInputTextarea },
8
12
  methods: {
9
13
  handleChange: () => {
10
14
  const input = context.canvasElement.querySelector('textarea');
11
15
 
12
16
  action('TideInputTextarea changed')({});
13
- context.updateArgs({ ...args, value: input.value });
17
+ context.updateArgs({ ...args, value: input?.value });
14
18
  },
15
19
  },
16
20
  setup: () => ({ args }),
@@ -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 === '') {