tide-design-system 2.0.22 → 2.0.23

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 (216) hide show
  1. package/.eslintrc.cjs +90 -0
  2. package/.storybook/main.ts +60 -0
  3. package/.storybook/preview.ts +252 -0
  4. package/dist/css/grid-layout.css +7 -3
  5. package/dist/tide-design-system.js +45 -39
  6. package/index.ts +122 -0
  7. package/package.json +8 -12
  8. package/src/assets/css/animation.css +14 -0
  9. package/src/assets/css/dynamic-buttons.css +79 -0
  10. package/src/assets/css/dynamic-utilities.css +39 -0
  11. package/src/assets/css/grid-layout.css +71 -0
  12. package/src/assets/css/main.css +5 -0
  13. package/src/assets/css/realm/aero.css +42 -0
  14. package/src/assets/css/realm/atv.css +43 -0
  15. package/src/assets/css/realm/boatmart.css +42 -0
  16. package/src/assets/css/realm/cycle.css +42 -0
  17. package/src/assets/css/realm/equip.css +42 -0
  18. package/src/assets/css/realm/pwc.css +42 -0
  19. package/src/assets/css/realm/rv.css +50 -0
  20. package/src/assets/css/realm/snow.css +42 -0
  21. package/src/assets/css/realm/truck.css +42 -0
  22. package/src/assets/css/reset.css +79 -0
  23. package/src/assets/css/storybook.css +9 -0
  24. package/src/assets/css/utilities.css +1602 -0
  25. package/src/assets/css/variables.css +118 -0
  26. package/src/assets/svg/icons/IconAccountBalance.svg +5 -0
  27. package/src/assets/svg/icons/IconAdd.svg +3 -0
  28. package/src/assets/svg/icons/IconAiDescription.svg +7 -0
  29. package/src/assets/svg/icons/IconAlignSpace.svg +3 -0
  30. package/src/assets/svg/icons/IconApplePay.svg +5 -0
  31. package/src/assets/svg/icons/IconArrowBack.svg +3 -0
  32. package/src/assets/svg/icons/IconArrowForward.svg +3 -0
  33. package/src/assets/svg/icons/IconArrowRight.svg +3 -0
  34. package/src/assets/svg/icons/IconAssignment.svg +5 -0
  35. package/src/assets/svg/icons/IconAwardStar.svg +5 -0
  36. package/src/assets/svg/icons/IconBookmark.svg +5 -0
  37. package/src/assets/svg/icons/IconCalendarMonth.svg +5 -0
  38. package/src/assets/svg/icons/IconCall.svg +5 -0
  39. package/src/assets/svg/icons/IconCheck.svg +3 -0
  40. package/src/assets/svg/icons/IconChevronLeft.svg +3 -0
  41. package/src/assets/svg/icons/IconChevronRight.svg +3 -0
  42. package/src/assets/svg/icons/IconClear.svg +5 -0
  43. package/src/assets/svg/icons/IconClose.svg +3 -0
  44. package/src/assets/svg/icons/IconCycle.svg +5 -0
  45. package/src/assets/svg/icons/IconDelete.svg +5 -0
  46. package/src/assets/svg/icons/IconDiamond.svg +5 -0
  47. package/src/assets/svg/icons/IconDraft.svg +3 -0
  48. package/src/assets/svg/icons/IconEdit.svg +5 -0
  49. package/src/assets/svg/icons/IconError.svg +5 -0
  50. package/src/assets/svg/icons/IconExpandContent.svg +3 -0
  51. package/src/assets/svg/icons/IconExpandLess.svg +3 -0
  52. package/src/assets/svg/icons/IconExpandMore.svg +3 -0
  53. package/src/assets/svg/icons/IconFacebook.svg +5 -0
  54. package/src/assets/svg/icons/IconFavorite.svg +5 -0
  55. package/src/assets/svg/icons/IconFavoriteFilled.svg +5 -0
  56. package/src/assets/svg/icons/IconFormatBold.svg +5 -0
  57. package/src/assets/svg/icons/IconFormatItalic.svg +3 -0
  58. package/src/assets/svg/icons/IconFormatListBulleted.svg +5 -0
  59. package/src/assets/svg/icons/IconForum.svg +5 -0
  60. package/src/assets/svg/icons/IconGavel.svg +5 -0
  61. package/src/assets/svg/icons/IconGoogle.svg +18 -0
  62. package/src/assets/svg/icons/IconGooglePay.svg +5 -0
  63. package/src/assets/svg/icons/IconGrid.svg +3 -0
  64. package/src/assets/svg/icons/IconHeight.svg +3 -0
  65. package/src/assets/svg/icons/IconHelp.svg +5 -0
  66. package/src/assets/svg/icons/IconInfo.svg +5 -0
  67. package/src/assets/svg/icons/IconInsertText.svg +5 -0
  68. package/src/assets/svg/icons/IconInstagram.svg +5 -0
  69. package/src/assets/svg/icons/IconIosShare.svg +5 -0
  70. package/src/assets/svg/icons/IconLayout.svg +5 -0
  71. package/src/assets/svg/icons/IconLinkedIn.svg +5 -0
  72. package/src/assets/svg/icons/IconLocalShipping.svg +5 -0
  73. package/src/assets/svg/icons/IconLock.svg +5 -0
  74. package/src/assets/svg/icons/IconMail.svg +5 -0
  75. package/src/assets/svg/icons/IconMenu.svg +3 -0
  76. package/src/assets/svg/icons/IconMoreHoriz.svg +5 -0
  77. package/src/assets/svg/icons/IconNotifications.svg +5 -0
  78. package/src/assets/svg/icons/IconOpenInNew.svg +5 -0
  79. package/src/assets/svg/icons/IconPalette.svg +5 -0
  80. package/src/assets/svg/icons/IconPaypal.svg +5 -0
  81. package/src/assets/svg/icons/IconPerson.svg +5 -0
  82. package/src/assets/svg/icons/IconPhotoCamera.svg +5 -0
  83. package/src/assets/svg/icons/IconPinterest.svg +5 -0
  84. package/src/assets/svg/icons/IconPlayArrow.svg +3 -0
  85. package/src/assets/svg/icons/IconRemove.svg +3 -0
  86. package/src/assets/svg/icons/IconRoundedCorners.svg +5 -0
  87. package/src/assets/svg/icons/IconRuler.svg +3 -0
  88. package/src/assets/svg/icons/IconSearch.svg +5 -0
  89. package/src/assets/svg/icons/IconSeating.svg +3 -0
  90. package/src/assets/svg/icons/IconSell.svg +5 -0
  91. package/src/assets/svg/icons/IconShare.svg +5 -0
  92. package/src/assets/svg/icons/IconShoppingCart.svg +5 -0
  93. package/src/assets/svg/icons/IconSms.svg +5 -0
  94. package/src/assets/svg/icons/IconStar.svg +5 -0
  95. package/src/assets/svg/icons/IconSwapVert.svg +5 -0
  96. package/src/assets/svg/icons/IconThreeDRotation.svg +18 -0
  97. package/src/assets/svg/icons/IconTrophy.svg +5 -0
  98. package/src/assets/svg/icons/IconTune.svg +5 -0
  99. package/src/assets/svg/icons/IconTwitter.svg +5 -0
  100. package/src/assets/svg/icons/IconVideocam.svg +5 -0
  101. package/src/assets/svg/icons/IconViewInAr.svg +5 -0
  102. package/src/assets/svg/icons/IconVisibility.svg +5 -0
  103. package/src/assets/svg/icons/IconVolumeOff.svg +5 -0
  104. package/src/assets/svg/icons/IconVolumeOn.svg +5 -0
  105. package/src/assets/svg/icons/IconWarning.svg +5 -0
  106. package/src/assets/svg/icons/IconWeight.svg +3 -0
  107. package/src/assets/svg/icons/IconWidth.svg +3 -0
  108. package/src/assets/svg/icons/IconYoutube.svg +5 -0
  109. package/src/components/TideAccordionItem.vue +105 -0
  110. package/src/components/TideAlert.vue +124 -0
  111. package/src/components/TideBackgroundImage.vue +44 -0
  112. package/src/components/TideBadge.vue +30 -0
  113. package/src/components/TideBadgePremium.vue +31 -0
  114. package/src/components/TideBadgeTrustedPartner.vue +38 -0
  115. package/src/components/TideBreadCrumbs.vue +53 -0
  116. package/src/components/TideButton.vue +67 -0
  117. package/src/components/TideButtonIcon.vue +52 -0
  118. package/src/components/TideButtonPagination.vue +71 -0
  119. package/src/components/TideCard.vue +19 -0
  120. package/src/components/TideCarousel.vue +188 -0
  121. package/src/components/TideChipAction.vue +48 -0
  122. package/src/components/TideChipFilter.vue +55 -0
  123. package/src/components/TideChipInput.vue +44 -0
  124. package/src/components/TideColumns.vue +53 -0
  125. package/src/components/TideDivider.vue +24 -0
  126. package/src/components/TideIcon.vue +58 -0
  127. package/src/components/TideImage.vue +44 -0
  128. package/src/components/TideIndicator.vue +57 -0
  129. package/src/components/TideInputCheckbox.vue +145 -0
  130. package/src/components/TideInputRadio.vue +87 -0
  131. package/src/components/TideInputSelect.vue +204 -0
  132. package/src/components/TideInputText.vue +292 -0
  133. package/src/components/TideInputTextarea.vue +196 -0
  134. package/src/components/TideLink.vue +66 -0
  135. package/src/components/TideModal.vue +187 -0
  136. package/src/components/TidePagination.vue +67 -0
  137. package/src/components/TideSeoLinks.vue +58 -0
  138. package/src/components/TideTabs.vue +89 -0
  139. package/src/components/TideToggle.vue +95 -0
  140. package/src/docs/development.md +51 -0
  141. package/src/docs/integration.md +79 -0
  142. package/src/docs/storybook.md +39 -0
  143. package/src/stories/DemoCssUtilities.stories.ts +154 -0
  144. package/src/stories/DemoCssUtilitiesByTextInput.stories.ts +61 -0
  145. package/src/stories/FoundationsBorder.stories.ts +230 -0
  146. package/src/stories/FoundationsGap.stories.ts +180 -0
  147. package/src/stories/FoundationsMargin.stories.ts +155 -0
  148. package/src/stories/FoundationsPadding.stories.ts +108 -0
  149. package/src/stories/FoundationsShadow.stories.ts +84 -0
  150. package/src/stories/FoundationsTypography.stories.ts +172 -0
  151. package/src/stories/Template.stories.ts +71 -0
  152. package/src/stories/TideAccordionItem.stories.ts +68 -0
  153. package/src/stories/TideAlert.stories.ts +58 -0
  154. package/src/stories/TideBackgroundImage.stories.ts +53 -0
  155. package/src/stories/TideBadge.stories.ts +31 -0
  156. package/src/stories/TideBadgePremium.stories.ts +31 -0
  157. package/src/stories/TideBadgeTrustedPartner.stories.ts +33 -0
  158. package/src/stories/TideBreadCrumbs.stories.ts +43 -0
  159. package/src/stories/TideButton.stories.ts +118 -0
  160. package/src/stories/TideButtonIcon.stories.ts +103 -0
  161. package/src/stories/TideButtonPagination.stories.ts +99 -0
  162. package/src/stories/TideCard.stories.ts +38 -0
  163. package/src/stories/TideCarousel.stories.ts +130 -0
  164. package/src/stories/TideChipAction.stories.ts +46 -0
  165. package/src/stories/TideChipFilter.stories.ts +59 -0
  166. package/src/stories/TideChipInput.stories.ts +42 -0
  167. package/src/stories/TideColumns.stories.ts +90 -0
  168. package/src/stories/TideDivider.stories.ts +46 -0
  169. package/src/stories/TideIcon.stories.ts +29 -0
  170. package/src/stories/TideIndicator.stories.ts +31 -0
  171. package/src/stories/TideInputCheckbox.stories.ts +86 -0
  172. package/src/stories/TideInputRadio.stories.ts +71 -0
  173. package/src/stories/TideInputSelect.stories.ts +145 -0
  174. package/src/stories/TideInputText.stories.ts +181 -0
  175. package/src/stories/TideInputTextarea.stories.ts +116 -0
  176. package/src/stories/TideLink.stories.ts +137 -0
  177. package/src/stories/TideModal.stories.ts +122 -0
  178. package/src/stories/TidePagination.stories.ts +83 -0
  179. package/src/stories/TideSeoLinks.stories.ts +67 -0
  180. package/src/stories/TideTabs.stories.ts +100 -0
  181. package/src/stories/TideToggle.stories.ts +69 -0
  182. package/src/stories/Welcome.mdx +17 -0
  183. package/src/types/Alert.ts +8 -0
  184. package/src/types/Badge.ts +21 -0
  185. package/src/types/BreadCrumb.ts +5 -0
  186. package/src/types/Detail.ts +4 -0
  187. package/src/types/Element.ts +13 -0
  188. package/src/types/FacetRange.ts +84 -0
  189. package/src/types/Field.ts +54 -0
  190. package/src/types/Form.ts +58 -0
  191. package/src/types/Formatted.ts +22 -0
  192. package/src/types/Icon.ts +87 -0
  193. package/src/types/Link.ts +5 -0
  194. package/src/types/ListingMedia.ts +43 -0
  195. package/src/types/Orientation.ts +6 -0
  196. package/src/types/Priority.ts +11 -0
  197. package/src/types/Raw.ts +5 -0
  198. package/src/types/Realm.ts +13 -0
  199. package/src/types/RealmConfig.ts +14 -0
  200. package/src/types/Select.ts +10 -0
  201. package/src/types/Size.ts +6 -0
  202. package/src/types/Storybook.ts +219 -0
  203. package/src/types/Styles.ts +590 -0
  204. package/src/types/Tab.ts +5 -0
  205. package/src/types/Target.ts +6 -0
  206. package/src/types/TextInput.ts +16 -0
  207. package/src/types/Validation.ts +24 -0
  208. package/src/utilities/format.ts +184 -0
  209. package/src/utilities/storybook.ts +295 -0
  210. package/src/utilities/validation.ts +197 -0
  211. package/tests/utilities-format.spec.ts +430 -0
  212. package/tsconfig.app.json +14 -0
  213. package/tsconfig.config.json +12 -0
  214. package/tsconfig.json +22 -0
  215. package/tsconfig.vitest.json +10 -0
  216. package/vite.config.ts +43 -0
@@ -0,0 +1,53 @@
1
+ import { parameters, argTypeBooleanUnrequired } from '@/utilities/storybook';
2
+ import TideBackgroundImage from '@/components/TideBackgroundImage.vue';
3
+
4
+ const render = (args: any) => ({
5
+ components: { TideBackgroundImage },
6
+ setup() {
7
+ return { args };
8
+ },
9
+ template: `
10
+ <TideBackgroundImage v-bind="args">
11
+ <div class="tide-padding-4 tide-font-700 tide-font-20">
12
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque est nibh, convallis vel aliquam non, elementum a lorem.
13
+ </div>
14
+ </TideBackgroundImage>
15
+ `,
16
+ });
17
+
18
+ export default {
19
+ argTypes: {
20
+ alt: {
21
+ control: 'text',
22
+ description: 'Button text',
23
+ table: {
24
+ defaultValue: { summary: 'None' },
25
+ type: { summary: 'string' },
26
+ },
27
+ },
28
+ isLazy: {
29
+ ...argTypeBooleanUnrequired,
30
+ description: 'Determines if the image should be lazy-loaded',
31
+ },
32
+ src: {
33
+ control: 'text',
34
+ description: 'Source URL for the background image',
35
+ table: {
36
+ defaultValue: { summary: 'None' },
37
+ type: { summary: 'string' },
38
+ },
39
+ },
40
+ },
41
+ args: {
42
+ alt: '',
43
+ isLazy: true,
44
+ src: 'https://placedog.net/500/400',
45
+ },
46
+ component: TideBackgroundImage,
47
+ parameters,
48
+ render,
49
+ tags: ['autodocs'],
50
+ title: 'Basic Components/TideBackgroundImage',
51
+ };
52
+
53
+ export const Demo = {};
@@ -0,0 +1,31 @@
1
+ import TideBadge from '@/components/TideBadge.vue';
2
+ import { parameters } from '@/utilities/storybook';
3
+
4
+ const render = (args: any) => ({
5
+ components: { TideBadge },
6
+ setup: () => ({ args }),
7
+ template: `<TideBadge class="tide-shadow-bottom" v-bind="args" />`,
8
+ });
9
+
10
+ export default {
11
+ argTypes: {
12
+ label: {
13
+ control: 'text',
14
+ description: 'Badge text',
15
+ table: {
16
+ defaultValue: { summary: 'None' },
17
+ type: { summary: 'string' },
18
+ },
19
+ },
20
+ },
21
+ args: {
22
+ label: 'Demo',
23
+ },
24
+ component: TideBadge,
25
+ parameters,
26
+ render,
27
+ tags: ['autodocs'],
28
+ title: 'Basic Components/TideBadge',
29
+ };
30
+
31
+ export const Demo = {};
@@ -0,0 +1,31 @@
1
+ import TideBadgePremium from '@/components/TideBadgePremium.vue';
2
+ import { BADGE_PREMIUM } from '@/types/Badge';
3
+ import { formatArgType, parameters } from '@/utilities/storybook';
4
+
5
+ const render = (args: any) => ({
6
+ components: { TideBadgePremium },
7
+ setup: () => ({ args }),
8
+ template: `<TideBadgePremium v-bind="args" />`,
9
+ });
10
+
11
+ export default {
12
+ argTypes: {
13
+ label: {
14
+ ...formatArgType({ BADGE_PREMIUM }),
15
+ description: 'Badge text',
16
+ table: {
17
+ defaultValue: { summary: 'Premium' },
18
+ },
19
+ },
20
+ },
21
+ args: {
22
+ label: BADGE_PREMIUM.PREMIUM,
23
+ },
24
+ component: TideBadgePremium,
25
+ parameters,
26
+ render,
27
+ tags: ['autodocs'],
28
+ title: 'Basic Components/TideBadgePremium',
29
+ };
30
+
31
+ export const Demo = {};
@@ -0,0 +1,33 @@
1
+ import * as STANDARD_BADGE from '@/types/Storybook';
2
+ import TideBadgeTrustedPartner from '@/components/TideBadgeTrustedPartner.vue';
3
+ import { formatArgType, parameters, prependNoneAsUndefined } from '@/utilities/storybook';
4
+
5
+ const BADGE_TRUSTED = prependNoneAsUndefined(STANDARD_BADGE.BADGE_TRUSTED);
6
+
7
+ const render = (args: any) => ({
8
+ components: { TideBadgeTrustedPartner },
9
+ setup: () => ({ args }),
10
+ template: `<TideBadgeTrustedPartner v-bind="args" />`,
11
+ });
12
+
13
+ export default {
14
+ argTypes: {
15
+ years: {
16
+ ...formatArgType({ BADGE_TRUSTED }),
17
+ description: 'Badge text',
18
+ table: {
19
+ defaultValue: { summary: BADGE_TRUSTED.YEARS_5 },
20
+ },
21
+ },
22
+ },
23
+ args: {
24
+ years: undefined,
25
+ },
26
+ component: TideBadgeTrustedPartner,
27
+ parameters,
28
+ render,
29
+ tags: ['autodocs'],
30
+ title: 'Basic Components/TideBadgeTrustedPartner',
31
+ };
32
+
33
+ export const Demo = {};
@@ -0,0 +1,43 @@
1
+ import type { BreadCrumb } from '@/types/BreadCrumb';
2
+
3
+ import TideBreadCrumbs from '@/components/TideBreadCrumbs.vue';
4
+ import { parameters } from '@/utilities/storybook';
5
+
6
+ const breadCrumbs: BreadCrumb[] = [
7
+ {
8
+ dataTrack: 'Home Bread Crumb Click',
9
+ label: 'Home',
10
+ url: '/',
11
+ },
12
+ {
13
+ dataTrack: 'SRP Bread Crumb Click',
14
+ label: 'Search results',
15
+ url: '/rvs-for-sale',
16
+ },
17
+ {
18
+ label: 'Vehicle details',
19
+ },
20
+ ];
21
+
22
+ export default {
23
+ argTypes: {
24
+ breadCrumbs: {
25
+ control: 'object',
26
+ description: 'Determines label and optional URL for each bread crumb',
27
+ isCustom: true,
28
+ table: {
29
+ defaultValue: { summary: '[]' },
30
+ type: { summary: 'BreadCrumb[]' },
31
+ },
32
+ },
33
+ },
34
+ args: {
35
+ breadCrumbs: breadCrumbs,
36
+ },
37
+ component: TideBreadCrumbs,
38
+ parameters,
39
+ tags: ['autodocs'],
40
+ title: 'Basic Components/TideBreadCrumbs',
41
+ };
42
+
43
+ export const Demo = {};
@@ -0,0 +1,118 @@
1
+ import { action } from '@storybook/addon-actions';
2
+
3
+ import * as STANDARD_ELEMENT from '@/types/Element';
4
+ import * as STANDARD_ICON from '@/types/Icon';
5
+ import * as STANDARD_PRIORITY from '@/types/Priority';
6
+ import TideButton from '@/components/TideButton.vue';
7
+ import {
8
+ argTypeBooleanUnrequired,
9
+ click,
10
+ dataTrack,
11
+ doSomething,
12
+ formatArgType,
13
+ parameters,
14
+ prependNoneAsUndefined,
15
+ } from '@/utilities/storybook';
16
+
17
+ const ELEMENT = prependNoneAsUndefined(STANDARD_ELEMENT.ELEMENT);
18
+ const ICON = prependNoneAsUndefined(STANDARD_ICON.ICON);
19
+ const PRIORITY = prependNoneAsUndefined(STANDARD_PRIORITY.PRIORITY);
20
+
21
+ const render = (args: any) => ({
22
+ components: { TideButton },
23
+ methods: {
24
+ doSomething,
25
+ handleClick: (event: Event) => {
26
+ action('TideButton clicked')(event);
27
+
28
+ try {
29
+ const buttonClick = eval(args.click);
30
+
31
+ if (buttonClick) {
32
+ buttonClick();
33
+ }
34
+ } catch {
35
+ alert('Please specify a valid handler in the "click" control.');
36
+ }
37
+ },
38
+ },
39
+ setup: () => ({ args }),
40
+ template: `<TideButton @click="handleClick" v-bind="args" />`,
41
+ });
42
+
43
+ export default {
44
+ argTypes: {
45
+ click: {
46
+ ...click,
47
+ if: { arg: 'element', neq: ELEMENT.LINK },
48
+ },
49
+ dataTrack,
50
+ disabled: {
51
+ ...argTypeBooleanUnrequired,
52
+ description: 'Determines clickability<br />(Button only)',
53
+ if: { arg: 'element', neq: ELEMENT.LINK },
54
+ },
55
+ element: {
56
+ ...formatArgType({ ELEMENT }),
57
+ description: 'HTML tag type',
58
+ table: {
59
+ defaultValue: { summary: 'BUTTON' },
60
+ },
61
+ },
62
+ href: {
63
+ description: 'URL to open<br />(Link only)',
64
+ if: { arg: 'element', eq: ELEMENT.LINK },
65
+ table: {
66
+ defaultValue: { summary: 'None' },
67
+ type: { summary: 'string' },
68
+ },
69
+ },
70
+ iconLeading: {
71
+ ...formatArgType({ ICON }),
72
+ description: 'Icon to left of label',
73
+ },
74
+ iconTrailing: {
75
+ ...formatArgType({ ICON }),
76
+ description: 'Icon to right of label',
77
+ },
78
+ isNewTab: {
79
+ ...argTypeBooleanUnrequired,
80
+ description: 'Determines whether to target a new browser tab<br />(Link only)',
81
+ if: { arg: 'element', eq: ELEMENT.LINK },
82
+ },
83
+ label: {
84
+ control: 'text',
85
+ description: 'Button text',
86
+ table: {
87
+ defaultValue: { summary: 'None' },
88
+ type: { summary: 'string' },
89
+ },
90
+ },
91
+ priority: {
92
+ ...formatArgType({ PRIORITY }),
93
+ description: 'Determines visual prominence',
94
+ table: {
95
+ defaultValue: { summary: 'PRIMARY' },
96
+ },
97
+ },
98
+ },
99
+ args: {
100
+ click: 'doSomething',
101
+ dataTrack: '',
102
+ disabled: undefined,
103
+ element: undefined,
104
+ href: 'https://www.sample.com',
105
+ iconLeading: undefined,
106
+ iconTrailing: undefined,
107
+ isNewTab: undefined,
108
+ label: 'Demo',
109
+ priority: undefined,
110
+ },
111
+ component: TideButton,
112
+ parameters,
113
+ render,
114
+ tags: ['autodocs'],
115
+ title: 'Basic Components/TideButton',
116
+ };
117
+
118
+ export const Demo = {};
@@ -0,0 +1,103 @@
1
+ import { action } from '@storybook/addon-actions';
2
+
3
+ import * as STANDARD_ELEMENT from '@/types/Element';
4
+ import * as STANDARD_PRIORITY from '@/types/Priority';
5
+ import TideButtonIcon from '@/components/TideButtonIcon.vue';
6
+ import { ICON } from '@/types/Icon';
7
+ import {
8
+ argTypeBooleanUnrequired,
9
+ click,
10
+ dataTrack,
11
+ doSomething,
12
+ formatArgType,
13
+ parameters,
14
+ prependNoneAsUndefined,
15
+ } from '@/utilities/storybook';
16
+
17
+ const ELEMENT = prependNoneAsUndefined(STANDARD_ELEMENT.ELEMENT);
18
+ const PRIORITY = prependNoneAsUndefined(STANDARD_PRIORITY.PRIORITY);
19
+
20
+ const render = (args: any) => ({
21
+ components: { TideButtonIcon },
22
+ methods: {
23
+ doSomething,
24
+ handleClick: (event: Event) => {
25
+ action('TideButtonIcon clicked')(event);
26
+
27
+ try {
28
+ const buttonClick = eval(args.click);
29
+
30
+ if (buttonClick) {
31
+ buttonClick();
32
+ }
33
+ } catch {
34
+ alert('Please specify a valid handler in the "click" control.');
35
+ }
36
+ },
37
+ },
38
+ setup: () => ({ args }),
39
+ template: '<TideButtonIcon @click="handleClick" class="tide-display-inline-block" v-bind="args" />',
40
+ });
41
+
42
+ export default {
43
+ argTypes: {
44
+ click: {
45
+ ...click,
46
+ if: { arg: 'element', neq: ELEMENT.LINK },
47
+ },
48
+ dataTrack,
49
+ disabled: {
50
+ ...argTypeBooleanUnrequired,
51
+ description: 'Determines clickability<br />(Button only)',
52
+ if: { arg: 'element', neq: ELEMENT.LINK },
53
+ },
54
+ element: {
55
+ ...formatArgType({ ELEMENT }),
56
+ description: 'HTML tag type',
57
+ table: {
58
+ defaultValue: { summary: 'BUTTON' },
59
+ },
60
+ },
61
+ href: {
62
+ description: 'URL to open<br />(Link only)',
63
+ if: { arg: 'element', eq: ELEMENT.LINK },
64
+ table: {
65
+ defaultValue: { summary: 'None' },
66
+ type: { summary: 'string' },
67
+ },
68
+ },
69
+ icon: {
70
+ ...formatArgType({ ICON }),
71
+ description: 'Icon',
72
+ },
73
+ isNewTab: {
74
+ ...argTypeBooleanUnrequired,
75
+ description: 'Determines whether to target a new browser tab<br />(Link only)',
76
+ if: { arg: 'element', eq: ELEMENT.LINK },
77
+ },
78
+ priority: {
79
+ ...formatArgType({ PRIORITY }),
80
+ description: 'Determines visual prominence',
81
+ table: {
82
+ defaultValue: { summary: 'PRIMARY' },
83
+ },
84
+ },
85
+ },
86
+ args: {
87
+ click: 'doSomething',
88
+ dataTrack: '',
89
+ disabled: undefined,
90
+ element: undefined,
91
+ href: 'https://www.sample.com',
92
+ icon: ICON.MAIL,
93
+ isNewTab: undefined,
94
+ priority: undefined,
95
+ },
96
+ component: TideButtonIcon,
97
+ parameters,
98
+ render,
99
+ tags: ['autodocs'],
100
+ title: 'Basic Components/TideButtonIcon',
101
+ };
102
+
103
+ export const Demo = {};
@@ -0,0 +1,99 @@
1
+ import { action } from '@storybook/addon-actions';
2
+
3
+ import * as STANDARD_ELEMENT from '@/types/Element';
4
+ import TideButtonPagination from '@/components/TideButtonPagination.vue';
5
+ import {
6
+ argTypeBooleanUnrequired,
7
+ click,
8
+ dataTrack,
9
+ doSomething,
10
+ formatArgType,
11
+ parameters,
12
+ prependNoneAsUndefined,
13
+ } from '@/utilities/storybook';
14
+
15
+ const ELEMENT_TEXT_AS_ICON = prependNoneAsUndefined(STANDARD_ELEMENT.ELEMENT_TEXT_AS_ICON);
16
+
17
+ const render = (args: any) => ({
18
+ components: { TideButtonPagination },
19
+ methods: {
20
+ doSomething,
21
+ handleClick: (event: Event) => {
22
+ action('TideButtonPagination clicked')(event);
23
+
24
+ try {
25
+ const buttonClick = eval(args.click);
26
+
27
+ if (buttonClick) {
28
+ buttonClick();
29
+ }
30
+ } catch {
31
+ alert('Please specify a valid handler in the "click" control.');
32
+ }
33
+ },
34
+ },
35
+ setup: () => ({ args }),
36
+ template: `<TideButtonPagination @click="handleClick" v-bind="args" />`,
37
+ });
38
+
39
+ export default {
40
+ argTypes: {
41
+ click: {
42
+ ...click,
43
+ if: { arg: 'element', neq: ELEMENT_TEXT_AS_ICON.LINK },
44
+ },
45
+ dataTrack,
46
+ disabled: {
47
+ ...argTypeBooleanUnrequired,
48
+ description: 'Indicates whether Pagination Button is associated with the displayed page',
49
+ if: {
50
+ arg: 'element',
51
+ eq: ELEMENT_TEXT_AS_ICON.BUTTON,
52
+ },
53
+ },
54
+ element: {
55
+ ...formatArgType({ ELEMENT_TEXT_AS_ICON }),
56
+ description: 'HTML tag type',
57
+ table: {
58
+ defaultValue: { summary: 'BUTTON' },
59
+ },
60
+ },
61
+ href: {
62
+ description: 'URL to open<br />(Link only)',
63
+ if: { arg: 'element', eq: ELEMENT_TEXT_AS_ICON.LINK },
64
+ table: {
65
+ defaultValue: { summary: 'None' },
66
+ type: { summary: 'string' },
67
+ },
68
+ },
69
+ isNewTab: {
70
+ ...argTypeBooleanUnrequired,
71
+ description: 'Determines whether to target a new browser tab<br />(Link only)',
72
+ if: { arg: 'element', eq: ELEMENT_TEXT_AS_ICON.LINK },
73
+ },
74
+ label: {
75
+ control: 'text',
76
+ description: 'Button text',
77
+ table: {
78
+ defaultValue: { summary: 'None' },
79
+ type: { summary: 'string' },
80
+ },
81
+ },
82
+ },
83
+ args: {
84
+ click: 'doSomething',
85
+ dataTrack: '',
86
+ disabled: undefined,
87
+ element: undefined,
88
+ href: 'https://www.sample.com',
89
+ isNewTab: undefined,
90
+ label: '1',
91
+ },
92
+ component: TideButtonPagination,
93
+ parameters,
94
+ render,
95
+ tags: ['autodocs'],
96
+ title: 'Basic Components/TideButtonPagination',
97
+ };
98
+
99
+ export const Demo = {};
@@ -0,0 +1,38 @@
1
+ import TideCard from '@/components/TideCard.vue';
2
+ import { dataTrack, parameters } from '@/utilities/storybook';
3
+
4
+ const render = (args: any) => ({
5
+ components: { TideCard },
6
+ setup: () => ({ args }),
7
+ template: `<TideCard class="tide-display-inline-block tide-padding-1">{{ args.default }}</TideCard>`,
8
+ });
9
+
10
+ export default {
11
+ argTypes: {
12
+ class: {
13
+ table: {
14
+ disable: true,
15
+ },
16
+ },
17
+ dataTrack,
18
+ default: {
19
+ control: 'text',
20
+ description: 'Card content',
21
+ table: {
22
+ defaultValue: { summary: 'None' },
23
+ type: { summary: 'HTML' },
24
+ },
25
+ },
26
+ },
27
+ args: {
28
+ dataTrack: '',
29
+ default: 'Demo',
30
+ },
31
+ component: TideCard,
32
+ parameters,
33
+ render,
34
+ tags: ['autodocs'],
35
+ title: 'Basic Components/TideCard',
36
+ };
37
+
38
+ export const Demo = {};
@@ -0,0 +1,130 @@
1
+ import { action } from '@storybook/addon-actions';
2
+
3
+ import type { StoryContext } from '@storybook/vue3';
4
+
5
+ import TideCard from '@/components/TideCard.vue';
6
+ import TideCarousel from '@/components/TideCarousel.vue';
7
+ import { argTypeBooleanUnrequired, change, disabledArgType, doSomething, lineBreak, tab } from '@/utilities/storybook';
8
+
9
+ const formatSnippet = (code: string, context: StoryContext) => {
10
+ const { args } = context;
11
+
12
+ const argsWithValues: string[] = [];
13
+
14
+ if (args.isTouchscreen !== undefined) argsWithValues.push(`:is-touchscreen="${args.isTouchscreen}"`);
15
+ if (args.offsetX) argsWithValues.push(`:offset-x="${args.offsetX}"`);
16
+ if (args.handleEmit) argsWithValues.push(`@change"${args.handleEmit}"`);
17
+
18
+ return (
19
+ `<TideCarousel ${argsWithValues.join(' ')}>${lineBreak}` +
20
+ `${tab}<li${lineBreak}` +
21
+ `${tab}${tab}:class="tide-shrink-none${args.hasPadding ? ' tide-padding-y-1' : ''}"${lineBreak}` +
22
+ `${tab}${tab}v-for="(_child, index) in new Array(12)"${lineBreak}` +
23
+ `${tab}>${lineBreak}` +
24
+ `${tab}${tab}<TideCard class="tide-padding-1">Card {{ index + 1 }}</TideCard>${lineBreak}` +
25
+ `${tab}</li>${lineBreak}` +
26
+ `</TideCarousel>`
27
+ );
28
+ };
29
+
30
+ const parameters = {
31
+ docs: {
32
+ source: {
33
+ format: 'vue',
34
+ language: 'html',
35
+ transform: formatSnippet,
36
+ },
37
+ },
38
+ };
39
+
40
+ const render = (args: any) => ({
41
+ components: { TideCard, TideCarousel },
42
+ methods: {
43
+ doSomething,
44
+ handleEmit: (index: number) => {
45
+ action(`Current slide ${index}`)({ index });
46
+
47
+ try {
48
+ const performCallback = eval(args.handleEmit);
49
+
50
+ if (performCallback) {
51
+ performCallback();
52
+ }
53
+ } catch {
54
+ alert('Please specify a valid handler in the "change" control.');
55
+ }
56
+ },
57
+ },
58
+ setup: () => ({ args }),
59
+ template: `<TideCarousel @change="handleEmit" v-bind="args"><li v-for="(_child, index) in new Array(12)" :class="['tide-shrink-none', args.hasPadding ? ' tide-padding-y-1' : '']"><TideCard class="tide-padding-1">Card {{ index + 1 }}</TideCard></li></TideCarousel>`,
60
+ });
61
+
62
+ export default {
63
+ argTypes: {
64
+ change: disabledArgType,
65
+ default: {
66
+ table: {
67
+ disable: true,
68
+ },
69
+ },
70
+ handleEmit: {
71
+ ...change,
72
+ table: {
73
+ defaultValue: { summary: 'None' },
74
+ type: { summary: '(event: Event, currentSlide: number) => void' },
75
+ },
76
+ },
77
+ // TODO: adapt via formatSnippet
78
+ hasPadding: {
79
+ control: 'boolean',
80
+ description: 'Demonstrates the box shadow',
81
+ name: 'Has Padding',
82
+ table: {
83
+ defaultValue: { summary: 'False' },
84
+ type: { summary: 'boolean' },
85
+ },
86
+ },
87
+ isTouchscreen: {
88
+ ...argTypeBooleanUnrequired,
89
+ description: 'Determines button and/or swipe control scheme<br />(Use reference to ViewportStore)',
90
+ table: {
91
+ defaultValue: { summary: 'None' },
92
+ },
93
+ },
94
+ offsetX: {
95
+ control: {
96
+ max: 72,
97
+ min: 0,
98
+ step: 24,
99
+ type: 'number',
100
+ },
101
+ description: 'Determines horizontal spacing around Carousel content',
102
+ table: {
103
+ defaultValue: { summary: 'None' },
104
+ type: { summary: 'number (px)' },
105
+ },
106
+ },
107
+ slideChange: {
108
+ control: 'text',
109
+ description: 'JS function to execute when current slide is updated',
110
+ table: {
111
+ defaultValue: { summary: 'None' },
112
+ type: { summary: '(event: Event, slideIndex: number) => void' },
113
+ },
114
+ },
115
+ },
116
+ args: {
117
+ handleEmit: 'doSomething',
118
+ hasPadding: false,
119
+ isTouchscreen: undefined,
120
+ offsetX: 0,
121
+ slideChange: 'doSomething',
122
+ },
123
+ component: TideCarousel,
124
+ parameters,
125
+ render,
126
+ tags: ['autodocs'],
127
+ title: 'Basic Components/TideCarousel',
128
+ };
129
+
130
+ export const Demo = {};