tide-design-system 2.2.10 → 2.2.11

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 (76) hide show
  1. package/.storybook/main.ts +1 -0
  2. package/dist/IconArrowUp-75edebad.js +16 -0
  3. package/dist/IconArrowUp-c0afd43d.cjs +2 -0
  4. package/dist/IconAssignment-7171d067.cjs +2 -0
  5. package/dist/IconAssignment-b1d2ffa2.js +16 -0
  6. package/dist/IconClear-4db1f7d4.cjs +2 -0
  7. package/dist/IconClear-5cf9e8be.js +16 -0
  8. package/dist/IconFacebook-a83c1949.cjs +2 -0
  9. package/dist/IconFacebook-fb3f93e3.js +16 -0
  10. package/dist/IconInstagram-9f642623.cjs +2 -0
  11. package/dist/IconInstagram-db345e15.js +16 -0
  12. package/dist/IconLayout-6963184f.js +16 -0
  13. package/dist/IconLayout-d0d278c5.cjs +2 -0
  14. package/dist/IconLinkedIn-2fa1ac20.cjs +2 -0
  15. package/dist/IconLinkedIn-9c4740a6.js +16 -0
  16. package/dist/IconStarFilled-9f4d0d62.cjs +2 -0
  17. package/dist/IconStarFilled-b73e12dc.js +16 -0
  18. package/dist/IconStarHalf-0b663cd6.js +16 -0
  19. package/dist/IconStarHalf-65db4ff6.cjs +2 -0
  20. package/dist/css/dynamic-utilities.css +30 -30
  21. package/dist/css/utilities-lg.css +43 -1
  22. package/dist/css/utilities-md.css +43 -1
  23. package/dist/css/utilities-sm.css +43 -1
  24. package/dist/css/utilities-xl.css +43 -1
  25. package/dist/css/utilities.css +43 -1
  26. package/dist/css/variables.css +3 -0
  27. package/dist/style.css +1 -1
  28. package/dist/tide-design-system.cjs +2 -2
  29. package/dist/tide-design-system.esm.d.ts +111 -5
  30. package/dist/tide-design-system.esm.js +1591 -1396
  31. package/index.ts +6 -2
  32. package/package.json +1 -1
  33. package/src/assets/css/dynamic-utilities.css +30 -30
  34. package/src/assets/css/utilities-lg.css +43 -1
  35. package/src/assets/css/utilities-md.css +43 -1
  36. package/src/assets/css/utilities-sm.css +43 -1
  37. package/src/assets/css/utilities-xl.css +43 -1
  38. package/src/assets/css/utilities.css +43 -1
  39. package/src/assets/css/variables.css +3 -0
  40. package/src/assets/svg/icons/IconArrowUp.svg +3 -0
  41. package/src/assets/svg/icons/IconAssignment.svg +1 -3
  42. package/src/assets/svg/icons/IconClear.svg +1 -3
  43. package/src/assets/svg/icons/IconFacebook.svg +1 -3
  44. package/src/assets/svg/icons/IconInstagram.svg +1 -3
  45. package/src/assets/svg/icons/IconLayout.svg +1 -3
  46. package/src/assets/svg/icons/IconLinkedIn.svg +1 -3
  47. package/src/assets/svg/icons/IconStarFilled.svg +3 -0
  48. package/src/assets/svg/icons/IconStarHalf.svg +3 -0
  49. package/src/components/TideBadge.vue +7 -2
  50. package/src/components/TideChipAction.vue +10 -3
  51. package/src/components/TideImage.vue +19 -2
  52. package/src/components/TideImageBackground.vue +2 -0
  53. package/src/components/TideModal.vue +2 -2
  54. package/src/components/TidePopover.vue +4 -1
  55. package/src/components/TideSheet.vue +166 -0
  56. package/src/stories/FoundationsColor.stories.ts +161 -13
  57. package/src/stories/TideBadge.stories.ts +51 -1
  58. package/src/stories/TideChipAction.stories.ts +28 -1
  59. package/src/stories/TideImage.stories.ts +22 -2
  60. package/src/stories/TideSheet.stories.ts +142 -0
  61. package/src/types/Badge.ts +65 -0
  62. package/src/types/Image.ts +7 -0
  63. package/src/types/Styles.ts +42 -2
  64. package/tests/svg-icons.spec.ts +74 -0
  65. package/dist/IconAssignment-1983e555.js +0 -16
  66. package/dist/IconAssignment-915702cc.cjs +0 -2
  67. package/dist/IconClear-489c5a46.cjs +0 -2
  68. package/dist/IconClear-9419bf17.js +0 -16
  69. package/dist/IconFacebook-4658b533.js +0 -16
  70. package/dist/IconFacebook-9c43095a.cjs +0 -2
  71. package/dist/IconInstagram-43bb02ea.cjs +0 -2
  72. package/dist/IconInstagram-57188d29.js +0 -16
  73. package/dist/IconLayout-2865e0eb.js +0 -16
  74. package/dist/IconLayout-e663120e.cjs +0 -2
  75. package/dist/IconLinkedIn-088a3792.cjs +0 -2
  76. package/dist/IconLinkedIn-f29c217d.js +0 -16
@@ -1,16 +1,20 @@
1
1
  <script lang="ts" setup>
2
2
  import TideIcon from '@/components/TideIcon.vue';
3
+ import { BADGE_COLOR_DETAILS } from '@/types/Badge';
3
4
  import { CSS } from '@/types/Styles';
4
5
 
6
+ import type { BadgeColor } from '@/types/Badge';
5
7
  import type { Icon } from '@/types/Icon';
6
8
 
7
9
  type Props = {
10
+ color?: BadgeColor;
8
11
  iconLeading?: Icon;
9
12
  isFloating?: boolean;
10
13
  label: string;
11
14
  };
12
15
 
13
16
  const props = withDefaults(defineProps<Props>(), {
17
+ color: undefined,
14
18
  iconLeading: undefined,
15
19
  isFloating: false,
16
20
  });
@@ -20,20 +24,21 @@
20
24
  <div
21
25
  :class="[
22
26
  'tide-badge',
23
- props.isFloating ? [CSS.BG.SURFACE.FLOATING, CSS.SHADOW.BOTTOM] : [CSS.BG.SURFACE.VARIANT],
27
+ props.isFloating || props.color ? [CSS.BG.SURFACE.FLOATING, CSS.SHADOW.BOTTOM] : [CSS.BG.SURFACE.VARIANT],
24
28
  CSS.DISPLAY.INLINE_FLEX,
25
29
  CSS.AXIS2.CENTER,
26
30
  CSS.GAP.QUARTER,
27
31
  CSS.BORDER.RADIUS.QUARTER,
28
32
  CSS.PADDING.Y.QUARTER,
29
33
  CSS.PADDING.X.HALF,
34
+ props.color && [CSS.BORDER.LEFT.TWO, BADGE_COLOR_DETAILS[props.color].borderColor],
30
35
  CSS.ELLIPSIS,
31
36
  CSS.FONT.ROLE.LABEL_2,
32
37
  CSS.WHITESPACE_WRAP.OFF,
33
38
  ]"
34
39
  >
35
40
  <TideIcon
36
- :class="[CSS.FLEX.SHRINK.OFF]"
41
+ :class="[CSS.FLEX.SHRINK.OFF, props.color && BADGE_COLOR_DETAILS[props.color].iconColor]"
37
42
  :icon="props.iconLeading"
38
43
  v-if="props.iconLeading"
39
44
  />
@@ -1,22 +1,28 @@
1
1
  <script lang="ts" setup>
2
2
  import TideIcon from '@/components/TideIcon.vue';
3
+ import { ELEMENT } from '@/types/Element';
3
4
  import { ICON } from '@/types/Icon';
4
5
  import { CSS } from '@/types/Styles';
5
6
  import { TARGET } from '@/types/Target';
6
7
 
8
+ import type { Element } from '@/types/Element';
9
+
7
10
  type Props = {
8
- href: string;
11
+ element: Element;
12
+ href?: string;
9
13
  isNewTab?: boolean;
10
14
  label: string;
11
15
  };
12
16
 
13
17
  const props = withDefaults(defineProps<Props>(), {
18
+ element: ELEMENT.LINK,
19
+ href: undefined,
14
20
  isNewTab: false,
15
21
  });
16
22
  </script>
17
23
 
18
24
  <template>
19
- <a
25
+ <component
20
26
  :class="[
21
27
  'tide-chip-action',
22
28
  CSS.DISPLAY.FLEX,
@@ -33,11 +39,12 @@
33
39
  ]"
34
40
  :href="props.href"
35
41
  :target="props.isNewTab ? TARGET.BLANK : TARGET.SELF"
42
+ :is="element"
36
43
  >
37
44
  <TideIcon :icon="ICON.SEARCH" />
38
45
 
39
46
  <span>{{ props.label }}</span>
40
- </a>
47
+ </component>
41
48
  </template>
42
49
 
43
50
  <style scoped>
@@ -1,14 +1,17 @@
1
1
  <script lang="ts" setup>
2
- import { ref } from 'vue';
2
+ import { computed, ref } from 'vue';
3
3
 
4
+ import { OBJECT_FIT } from '@/types/Image';
4
5
  import { CSS } from '@/types/Styles';
5
6
 
7
+ import type { ObjectFit } from '@/types/Image';
6
8
  import type { Source } from '@/types/Source';
7
9
 
8
10
  type Props = {
9
11
  alt: string;
10
12
  height?: string;
11
13
  isLazy?: boolean;
14
+ objectFit?: ObjectFit;
12
15
  sources?: Source[];
13
16
  src?: string;
14
17
  width?: string;
@@ -18,6 +21,7 @@
18
21
  alt: '',
19
22
  height: undefined,
20
23
  isLazy: true,
24
+ objectFit: OBJECT_FIT.COVER,
21
25
  sources: () => [],
22
26
  src: undefined,
23
27
  width: undefined,
@@ -28,6 +32,19 @@
28
32
 
29
33
  const imageDefault = 'https://cdn-static.tilabs.io/marketplace/common/image-coming-soon.svg';
30
34
 
35
+ const objectFitClassName = computed<string>(() => {
36
+ switch (props.objectFit) {
37
+ case OBJECT_FIT.CONTAIN:
38
+ return CSS.OBJECT.CONTAIN;
39
+ case OBJECT_FIT.COVER:
40
+ return CSS.OBJECT.COVER;
41
+ case OBJECT_FIT.SCALE_DOWN:
42
+ return CSS.OBJECT.SCALE_DOWN;
43
+ default:
44
+ return OBJECT_FIT.COVER;
45
+ }
46
+ });
47
+
31
48
  const setImageFromDefault = () => {
32
49
  const currentSrc = img.value?.currentSrc;
33
50
  const pictureSource = picture.value?.querySelector(`source[srcset="${currentSrc}"]`);
@@ -62,7 +79,7 @@
62
79
 
63
80
  <img
64
81
  :alt="alt"
65
- :class="[CSS.WIDTH.FULL, CSS.HEIGHT.FULL, CSS.OBJECT.CENTER, CSS.OBJECT.COVER]"
82
+ :class="[CSS.WIDTH.FULL, CSS.HEIGHT.FULL, CSS.OBJECT.CENTER, objectFitClassName]"
66
83
  :fetchpriority="isLazy ? undefined : 'high'"
67
84
  :loading="props.isLazy ? 'lazy' : 'eager'"
68
85
  ref="img"
@@ -1,5 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import TideImage from '@/components/TideImage.vue';
3
+ import { OBJECT_FIT } from '@/types/Image';
3
4
  import { CSS } from '@/types/Styles';
4
5
 
5
6
  import type { Source } from '@/types/Source';
@@ -35,6 +36,7 @@
35
36
  :alt="props.alt"
36
37
  :class="[CSS.WIDTH.FULL, CSS.HEIGHT.FULL]"
37
38
  :is-lazy="props.isLazy"
39
+ :object-fit="OBJECT_FIT.COVER"
38
40
  :sources="props.sources"
39
41
  :src="props.src"
40
42
  />
@@ -173,7 +173,7 @@
173
173
  }
174
174
  .tide-modal[open]::backdrop {
175
175
  background-color: var(--tide-transparent-400);
176
- backdrop-filter: blur(4px);
176
+ backdrop-filter: var(--tide-bg-blur);
177
177
  }
178
178
  @starting-style {
179
179
  .tide-modal[open] {
@@ -182,7 +182,7 @@
182
182
  }
183
183
  .tide-modal[open]::backdrop {
184
184
  background-color: transparent;
185
- backdrop-filter: blur(4px);
185
+ backdrop-filter: var(--tide-bg-blur);
186
186
  }
187
187
  }
188
188
  .tide-modal-body {
@@ -142,7 +142,7 @@
142
142
  CSS.SHADOW.BOTTOM,
143
143
  ]"
144
144
  ref="floating"
145
- :style="{ ...floatingStyles, maxWidth: `calc(100% - ${props.offset * 2}px)` }"
145
+ :style="{ ...floatingStyles }"
146
146
  v-show="isShowPopover"
147
147
  >
148
148
  <slot />
@@ -152,6 +152,9 @@
152
152
  </template>
153
153
 
154
154
  <style scoped>
155
+ .tide-popover {
156
+ max-width: 256px;
157
+ }
155
158
  .v-enter-from,
156
159
  .v-leave-to {
157
160
  opacity: 0;
@@ -0,0 +1,166 @@
1
+ <script lang="ts" setup>
2
+ import { onBeforeMount, onMounted, ref, watch } from 'vue';
3
+
4
+ import TideButtonIcon from '@/components/TideButtonIcon.vue';
5
+ import { ICON } from '@/types/Icon';
6
+ import { PRIORITY } from '@/types/Priority';
7
+ import { CSS } from '@/types/Styles';
8
+ import { TOP_LAYER_ID, initFauxTopLayer, setScrollLock } from '@/utilities/viewport';
9
+
10
+ import TideDivider from './TideDivider.vue';
11
+
12
+ import type { Ref } from 'vue';
13
+
14
+ type Props = {
15
+ isOpen: boolean;
16
+ isBackButton?: boolean;
17
+ };
18
+ const props = defineProps<Props>();
19
+
20
+ type Emits = {
21
+ (e: 'back'): void;
22
+ (e: 'close'): void;
23
+ };
24
+
25
+ const emit = defineEmits<Emits>();
26
+
27
+ const dialogElement: Ref<HTMLDialogElement | null> = ref(null);
28
+
29
+ const triggerNativeDialogOpen = () => {
30
+ dialogElement.value?.showModal();
31
+ };
32
+
33
+ const triggerNativeDialogClose = () => {
34
+ dialogElement.value?.close();
35
+ };
36
+
37
+ watch(
38
+ () => props.isOpen,
39
+ (newValue) => {
40
+ if (!dialogElement.value) return;
41
+ if (newValue) {
42
+ triggerNativeDialogOpen();
43
+ } else {
44
+ triggerNativeDialogClose();
45
+ }
46
+ setScrollLock(newValue);
47
+ }
48
+ );
49
+
50
+ onBeforeMount(() => {
51
+ initFauxTopLayer();
52
+ });
53
+
54
+ onMounted(() => {
55
+ if (props.isOpen) {
56
+ triggerNativeDialogOpen();
57
+ }
58
+ });
59
+ </script>
60
+
61
+ <template>
62
+ <Teleport :to="`#${TOP_LAYER_ID}`">
63
+ <dialog
64
+ :class="['tide-sheet', CSS.BG.INITIAL, CSS.HEIGHT.FULL, CSS.WIDTH.FULL, CSS.OVERFLOW.XY.HIDDEN]"
65
+ ref="dialogElement"
66
+ @click.self="emit('close')"
67
+ @close="emit('close')"
68
+ >
69
+ <div
70
+ :class="[
71
+ 'tide-sheet-body',
72
+ CSS.BG.SURFACE.DEFAULT,
73
+ CSS.DISPLAY.FLEX,
74
+ CSS.FLEX.DIRECTION.COLUMN,
75
+ CSS.HEIGHT.FULL,
76
+ CSS.OVERFLOW.XY.HIDDEN,
77
+ CSS.WIDTH.FULL,
78
+ ]"
79
+ >
80
+ <header :class="[CSS.DISPLAY.FLEX, CSS.PADDING.X.ONE, CSS.PADDING.TOP.ONE]">
81
+ <TideButtonIcon
82
+ :class="[CSS.FLEX.GROW.OFF, CSS.FLEX.SHRINK.OFF]"
83
+ :icon="ICON.CHEVRON_LEFT"
84
+ :priority="PRIORITY.QUATERNARY"
85
+ @click="emit('back')"
86
+ v-if="isBackButton"
87
+ />
88
+
89
+ <TideButtonIcon
90
+ :class="[CSS.FLEX.GROW.OFF, CSS.FLEX.SHRINK.OFF, CSS.MARGIN.LEFT.AUTO]"
91
+ :icon="ICON.CLOSE"
92
+ :priority="PRIORITY.QUATERNARY"
93
+ @click="triggerNativeDialogClose"
94
+ />
95
+ </header>
96
+
97
+ <TideDivider />
98
+
99
+ <div
100
+ :class="[
101
+ 'tide-sheet-content',
102
+ CSS.DISPLAY.GRID,
103
+ CSS.OVERFLOW.Y.AUTO,
104
+ CSS.OVERFLOW.X.HIDDEN,
105
+ CSS.WIDTH.FULL,
106
+ CSS.PADDING.BOTTOM.ONE,
107
+ ]"
108
+ >
109
+ <slot />
110
+ </div>
111
+ </div>
112
+ </dialog>
113
+ </Teleport>
114
+ </template>
115
+
116
+ <style scoped>
117
+ .tide-sheet {
118
+ --sheet-padding-x: var(--tide-spacing-1);
119
+ max-width: unset;
120
+ max-height: unset;
121
+ justify-items: right;
122
+ display: none;
123
+ transition: all var(--tide-animate) allow-discrete;
124
+ transform: translateX(100%);
125
+ }
126
+
127
+ .tide-sheet[open] {
128
+ display: grid;
129
+ transform: translateX(0%);
130
+ }
131
+
132
+ .tide-sheet::backdrop {
133
+ background-color: transparent;
134
+ transition: all var(--tide-animate) allow-discrete;
135
+ backdrop-filter: blur(0px);
136
+ }
137
+
138
+ .tide-sheet[open]::backdrop {
139
+ background-color: var(--tide-transparent-400);
140
+ backdrop-filter: var(--tide-bg-blur);
141
+ }
142
+
143
+ .tide-sheet-body {
144
+ max-width: min(calc(100vw - var(--tide-spacing-2)), 311px);
145
+ }
146
+
147
+ .tide-sheet-content {
148
+ grid-template-columns: var(--sheet-padding-x) 1fr var(--sheet-padding-x);
149
+ }
150
+
151
+ :where(.tide-sheet-content):deep(> :where(*)) {
152
+ grid-column: 2;
153
+ }
154
+
155
+ @starting-style {
156
+ .tide-sheet[open] {
157
+ display: grid;
158
+ transform: translateX(100%);
159
+ }
160
+
161
+ .tide-sheet[open]::backdrop {
162
+ background-color: transparent;
163
+ backdrop-filter: var(--tide-bg-blur);
164
+ }
165
+ }
166
+ </style>
@@ -1,5 +1,12 @@
1
+ import TideIcon from '@/components/TideIcon.vue';
1
2
  import { CSS } from '@/types/Styles';
2
- import { flatten, formatArgType, getConstantsByValues, prependNoneAsEmpty } from '@/utilities/storybook';
3
+ import {
4
+ disabledArgType,
5
+ flatten,
6
+ formatArgType,
7
+ getConstantsByValues,
8
+ prependNoneAsEmpty,
9
+ } from '@/utilities/storybook';
3
10
 
4
11
  import type { StoryContext } from '@storybook/vue3';
5
12
 
@@ -47,10 +54,11 @@ const parameters = {
47
54
  };
48
55
 
49
56
  const render = (args: any) => ({
57
+ components: { TideIcon },
50
58
  setup() {
51
59
  return formatArgs(args);
52
60
  },
53
- template: '<div class="tide-display-inline-block tide-padding-1" v-bind="args">Demo</div>',
61
+ template: `<div class="tide-display-inline-block tide-padding-1" v-bind="args">${args.default}</div>`,
54
62
  updated() {
55
63
  return formatArgs(args);
56
64
  },
@@ -76,6 +84,7 @@ export default {
76
84
  type: { summary: 'CSS.BORDER.COLOR' },
77
85
  },
78
86
  },
87
+ default: disabledArgType,
79
88
  fontColor: {
80
89
  ...formatArgType({ COLOR_FONT }),
81
90
  description: 'Applies a font color',
@@ -89,6 +98,7 @@ export default {
89
98
  args: {
90
99
  backgroundColor: COLOR_BACKGROUND.None,
91
100
  borderColor: COLOR_BORDER.None,
101
+ default: 'Demo',
92
102
  fontColor: COLOR_FONT.None,
93
103
  },
94
104
  parameters,
@@ -102,7 +112,6 @@ export const Default = {};
102
112
  export const SurfaceAccent = {
103
113
  args: {
104
114
  backgroundColor: COLOR_BACKGROUND['SURFACE.ACCENT'],
105
- fontColor: COLOR_FONT['SURFACE.DEFAULT'],
106
115
  },
107
116
  };
108
117
 
@@ -116,41 +125,180 @@ export const SurfaceBrand = {
116
125
  export const SurfaceGradient = {
117
126
  args: {
118
127
  backgroundColor: COLOR_BACKGROUND['SURFACE.GRADIENT'],
119
- fontColor: COLOR_FONT['SURFACE.DEFAULT'],
120
128
  },
121
129
  };
122
130
 
123
131
  export const SurfaceVariant = {
124
132
  args: {
125
133
  backgroundColor: COLOR_BACKGROUND['SURFACE.VARIANT'],
126
- fontColor: COLOR_FONT['SURFACE.DEFAULT'],
127
134
  },
128
135
  };
129
136
 
130
- export const GlobalSurfaceError = {
137
+ export const GlobalPrimaryBlue = {
138
+ args: {
139
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.PRIMARY.BLUE'],
140
+ default: `<TideIcon class="tide-font-on-surface-inverse" icon="ai-description" />`,
141
+ },
142
+ };
143
+
144
+ export const GlobalPrimaryGreen = {
145
+ args: {
146
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.PRIMARY.GREEN'],
147
+ default: `<TideIcon class="tide-font-on-surface-inverse" icon="ai-description" />`,
148
+ },
149
+ };
150
+
151
+ export const GlobalPrimaryLime = {
152
+ args: {
153
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.PRIMARY.LIME'],
154
+ default: `<TideIcon class="tide-font-on-surface-inverse" icon="ai-description" />`,
155
+ },
156
+ };
157
+
158
+ export const GlobalPrimaryOrange = {
159
+ args: {
160
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.PRIMARY.ORANGE'],
161
+ default: `<TideIcon class="tide-font-on-surface-inverse" icon="ai-description" />`,
162
+ },
163
+ };
164
+
165
+ export const GlobalPrimaryPurple = {
166
+ args: {
167
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.PRIMARY.PURPLE'],
168
+ default: `<TideIcon class="tide-font-on-surface-inverse" icon="ai-description" />`,
169
+ },
170
+ };
171
+
172
+ export const GlobalPrimaryRed = {
173
+ args: {
174
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.PRIMARY.RED'],
175
+ default: `<TideIcon class="tide-font-on-surface-inverse" icon="ai-description" />`,
176
+ },
177
+ };
178
+
179
+ export const GlobalPrimarySalmon = {
180
+ args: {
181
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.PRIMARY.SALMON'],
182
+ default: `<TideIcon class="tide-font-on-surface-inverse" icon="ai-description" />`,
183
+ },
184
+ };
185
+
186
+ export const GlobalPrimaryTeal = {
187
+ args: {
188
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.PRIMARY.TEAL'],
189
+ default: `<TideIcon class="tide-font-on-surface-inverse" icon="ai-description" />`,
190
+ },
191
+ };
192
+
193
+ export const GlobalPrimaryYellow = {
194
+ args: {
195
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.PRIMARY.YELLOW'],
196
+ default: `<TideIcon class="tide-font-on-surface-inverse" icon="ai-description" />`,
197
+ },
198
+ };
199
+
200
+ export const GlobalSurfaceBlue = {
201
+ args: {
202
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.SURFACE.BLUE'],
203
+ },
204
+ };
205
+
206
+ export const GlobalSurfaceGreen = {
207
+ args: {
208
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.SURFACE.GREEN'],
209
+ },
210
+ };
211
+
212
+ export const GlobalSurfaceLime = {
213
+ args: {
214
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.SURFACE.LIME'],
215
+ },
216
+ };
217
+
218
+ export const GlobalSurfaceOrange = {
219
+ args: {
220
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.SURFACE.ORANGE'],
221
+ },
222
+ };
223
+
224
+ export const GlobalSurfacePurple = {
225
+ args: {
226
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.SURFACE.PURPLE'],
227
+ },
228
+ };
229
+
230
+ export const GlobalSurfaceRed = {
231
+ args: {
232
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.SURFACE.RED'],
233
+ },
234
+ };
235
+
236
+ export const GlobalSurfaceSalmon = {
237
+ args: {
238
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.SURFACE.SALMON'],
239
+ },
240
+ };
241
+
242
+ export const GlobalSurfaceTeal = {
243
+ args: {
244
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.SURFACE.TEAL'],
245
+ },
246
+ };
247
+
248
+ export const GlobalSurfaceYellow = {
249
+ args: {
250
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.SURFACE.YELLOW'],
251
+ },
252
+ };
253
+
254
+ export const StatusPrimaryError = {
255
+ args: {
256
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.PRIMARY.ERROR'],
257
+ default: `<TideIcon class="tide-font-on-surface-inverse" icon="ai-description" />`,
258
+ },
259
+ };
260
+
261
+ export const StatusPrimaryInfo = {
262
+ args: {
263
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.PRIMARY.INFO'],
264
+ default: `<TideIcon class="tide-font-on-surface-inverse" icon="ai-description" />`,
265
+ },
266
+ };
267
+
268
+ export const StatusPrimarySuccess = {
269
+ args: {
270
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.PRIMARY.SUCCESS'],
271
+ default: `<TideIcon class="tide-font-on-surface-inverse" icon="ai-description" />`,
272
+ },
273
+ };
274
+
275
+ export const StatusPrimaryWarning = {
276
+ args: {
277
+ backgroundColor: COLOR_BACKGROUND['GLOBAL.PRIMARY.WARNING'],
278
+ default: `<TideIcon class="tide-font-on-surface-inverse" icon="ai-description" />`,
279
+ },
280
+ };
281
+
282
+ export const StatusSurfaceError = {
131
283
  args: {
132
284
  backgroundColor: COLOR_BACKGROUND['GLOBAL.SURFACE.ERROR'],
133
- fontColor: COLOR_FONT['SURFACE.DEFAULT'],
134
285
  },
135
286
  };
136
287
 
137
- export const GlobalSurfaceInfo = {
288
+ export const StatusSurfaceInfo = {
138
289
  args: {
139
290
  backgroundColor: COLOR_BACKGROUND['GLOBAL.SURFACE.INFO'],
140
- fontColor: COLOR_FONT['SURFACE.DEFAULT'],
141
291
  },
142
292
  };
143
293
 
144
- export const GlobalSurfaceSuccess = {
294
+ export const StatusSurfaceSuccess = {
145
295
  args: {
146
296
  backgroundColor: COLOR_BACKGROUND['GLOBAL.SURFACE.SUCCESS'],
147
- fontColor: COLOR_FONT['SURFACE.DEFAULT'],
148
297
  },
149
298
  };
150
299
 
151
- export const GlobalSurfaceWarning = {
300
+ export const StatusSurfaceWarning = {
152
301
  args: {
153
302
  backgroundColor: COLOR_BACKGROUND['GLOBAL.SURFACE.WARNING'],
154
- fontColor: COLOR_FONT['SURFACE.DEFAULT'],
155
303
  },
156
304
  };
@@ -1,9 +1,39 @@
1
1
  import TideBadge from '@/components/TideBadge.vue';
2
+ import { BADGE_COLOR as STANDARD_BADGE_COLOR } from '@/types/Badge';
2
3
  import * as STANDARD_ICON from '@/types/Icon';
3
- import { argTypeBooleanUnrequired, formatArgType, parameters, prependNoneAsUndefined } from '@/utilities/storybook';
4
+ import { argTypeBooleanUnrequired, formatArgType, prependNoneAsUndefined } from '@/utilities/storybook';
4
5
 
6
+ import type { StoryContext } from '@storybook/vue3';
7
+
8
+ const BADGE_COLOR = prependNoneAsUndefined(STANDARD_BADGE_COLOR);
5
9
  const ICON = prependNoneAsUndefined(STANDARD_ICON.ICON);
6
10
 
11
+ const formatSnippet = (code: string, context: StoryContext) => {
12
+ const { argTypes, args } = context;
13
+ const argsWithValues: string[] = [];
14
+
15
+ if (args.color !== undefined) argsWithValues.push(`:color="${args.color}"`);
16
+ if (args.iconLeading !== undefined) argsWithValues.push(`:icon-leading="${args.iconLeading}"`);
17
+ if (args.isFloating !== undefined && args.color === undefined)
18
+ argsWithValues.push(`:is-floating="${args.isFloating}"`);
19
+ if (args.label !== undefined) argsWithValues.push(`:label="${args.label}"`);
20
+
21
+ if (argTypes.iconLeading.type) argTypes.iconLeading.type.required = args.color !== undefined;
22
+ if (argTypes.isFloating.table) argTypes.isFloating.table.disable = args.color !== undefined;
23
+
24
+ return `<TideBadge ${argsWithValues.join(' ')} />`;
25
+ };
26
+
27
+ const parameters = {
28
+ docs: {
29
+ source: {
30
+ format: 'vue',
31
+ language: 'html',
32
+ transform: formatSnippet,
33
+ },
34
+ },
35
+ };
36
+
7
37
  const render = (args: any) => ({
8
38
  components: { TideBadge },
9
39
  setup: () => ({ args }),
@@ -12,24 +42,44 @@ const render = (args: any) => ({
12
42
 
13
43
  export default {
14
44
  argTypes: {
45
+ color: {
46
+ ...formatArgType({ BADGE_COLOR }),
47
+ description: 'Determines which color option to adopt (if any)',
48
+ table: {
49
+ category: 'Props',
50
+ defaultValue: { summary: 'None' },
51
+ },
52
+ },
15
53
  iconLeading: {
16
54
  ...formatArgType({ ICON }),
17
55
  description: 'Icon to left of label',
56
+ table: {
57
+ category: 'Props',
58
+ defaultValue: { summary: 'None' },
59
+ },
18
60
  },
19
61
  isFloating: {
20
62
  ...argTypeBooleanUnrequired,
21
63
  description: 'Determines whether to display the "Floating" variant styles',
64
+ table: {
65
+ category: 'Props',
66
+ defaultValue: { summary: 'None' },
67
+ },
22
68
  },
23
69
  label: {
24
70
  control: 'text',
25
71
  description: 'Badge text',
26
72
  table: {
73
+ category: 'Props',
27
74
  defaultValue: { summary: 'None' },
28
75
  type: { summary: 'string' },
29
76
  },
30
77
  },
31
78
  },
32
79
  args: {
80
+ color: BADGE_COLOR.None,
81
+ iconLeading: ICON.None,
82
+ isFloating: undefined,
33
83
  label: 'Demo',
34
84
  },
35
85
  component: TideBadge,