tide-design-system 2.2.6 → 2.2.8

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.
@@ -2,7 +2,7 @@ import { action } from '@storybook/addon-actions';
2
2
 
3
3
  import TideCard from '@/components/TideCard.vue';
4
4
  import TideCarousel from '@/components/TideCarousel.vue';
5
- import { argTypeBooleanUnrequired, change, disabledArgType, doSomething, lineBreak, tab } from '@/utilities/storybook';
5
+ import { argTypeBooleanUnrequired, disabledArgType, doSomething, lineBreak, tab } from '@/utilities/storybook';
6
6
 
7
7
  import type { StoryContext } from '@storybook/vue3';
8
8
 
@@ -17,7 +17,8 @@ const formatSnippet = (code: string, context: StoryContext) => {
17
17
  if (args.isTouchscreen !== undefined) argsWithValues.push(`:is-touchscreen="${args.isTouchscreen}"`);
18
18
  if (args.subtitle !== '') argsWithValues.push(`subtitle="${args.subtitle}"`);
19
19
  if (args.title !== '') argsWithValues.push(`title="${args.title}"`);
20
- if (args.handleChange) argsWithValues.push(`@change="${args.handleChange}"`);
20
+ if (args.handleSlideChange) argsWithValues.push(`@slide-change="${args.handleSlideChange}"`);
21
+ if (args.handleSlidesAddedToView) argsWithValues.push(`@slides-added-to-view="${args.handleSlidesAddedToView}"`);
21
22
 
22
23
  const slotContentMisc = args.misc === '' ? '' : `${tab}<template #misc>${args.misc}</template>${lineBreak}`;
23
24
 
@@ -46,17 +47,30 @@ const render = (args: any) => ({
46
47
  components: { TideCard, TideCarousel },
47
48
  methods: {
48
49
  doSomething,
49
- handleChange: (index: number) => {
50
- action(`Current slide ${index}`)(index);
50
+ handleSlideChange: (index: number) => {
51
+ action(`Current slide`)(index);
51
52
 
52
53
  try {
53
- const callback = eval(args.handleChange);
54
+ const callback = eval(args.handleSlideChange);
54
55
 
55
56
  if (callback) {
56
57
  callback();
57
58
  }
58
59
  } catch {
59
- alert('Please specify a valid handler in the "change" control.');
60
+ alert('Please specify a valid handler in the "slideChange" control.');
61
+ }
62
+ },
63
+ handleSlidesAddedToView: (slides: number[]) => {
64
+ action(`Slides added to view`)(slides);
65
+
66
+ try {
67
+ const callback = eval(args.handleSlidesAddedToView);
68
+
69
+ if (callback) {
70
+ callback();
71
+ }
72
+ } catch {
73
+ alert('Please specify a valid handler in the "slidesAddedToView" control.');
60
74
  }
61
75
  },
62
76
  },
@@ -64,7 +78,8 @@ const render = (args: any) => ({
64
78
  // prettier-ignore
65
79
  template:
66
80
  `<TideCarousel
67
- @change="handleChange"
81
+ @slide-change="handleSlideChange"
82
+ @slides-added-to-view="handleSlidesAddedToView"
68
83
  class="tide-margin-x-1"
69
84
  v-bind="args"
70
85
  >
@@ -74,7 +89,7 @@ const render = (args: any) => ({
74
89
  class="tide-shrink-none tide-border-1 tide-border tide-padding-1"
75
90
  v-for="(_child, index) in new Array(12)"
76
91
  >
77
- {{ args.default }}
92
+ {{ args.default.replace('#', index) }}
78
93
  </li>
79
94
  </TideCarousel>`,
80
95
  updated() {
@@ -96,7 +111,6 @@ export default {
96
111
  type: { summary: 'number' },
97
112
  },
98
113
  },
99
- change: disabledArgType,
100
114
  default: {
101
115
  control: 'text',
102
116
  description: 'Dynamic card content',
@@ -105,14 +119,28 @@ export default {
105
119
  type: { summary: 'HTML' },
106
120
  },
107
121
  },
108
- handleChange: {
109
- ...change,
122
+ handleSlideChange: {
123
+ control: 'text',
124
+ description: 'JS code or function to execute on slideChange event',
125
+ isEmit: true,
126
+ name: 'slideChange',
110
127
  table: {
111
128
  category: 'Events',
112
129
  defaultValue: { summary: 'None' },
113
130
  type: { summary: '(currentSlide: number) => void' },
114
131
  },
115
132
  },
133
+ handleSlidesAddedToView: {
134
+ control: 'text',
135
+ description: 'JS code or function to execute on slidesAddedToView event',
136
+ isEmit: true,
137
+ name: 'slidesAddedToView',
138
+ table: {
139
+ category: 'Events',
140
+ defaultValue: { summary: 'None' },
141
+ type: { summary: '(slides: number[]) => void' },
142
+ },
143
+ },
116
144
  isFloating: {
117
145
  ...argTypeBooleanUnrequired,
118
146
  description: 'Determines whether to display on-page or floating carousel',
@@ -150,6 +178,8 @@ export default {
150
178
  type: { summary: 'HTML' },
151
179
  },
152
180
  },
181
+ slideChange: disabledArgType,
182
+ slidesAddedToView: disabledArgType,
153
183
  subtitle: {
154
184
  control: 'text',
155
185
  description: 'Determines the text displayed to the right of the title',
@@ -169,8 +199,9 @@ export default {
169
199
  },
170
200
  args: {
171
201
  bleed: '',
172
- default: 'Card',
173
- handleChange: 'doSomething',
202
+ default: 'Card #',
203
+ handleSlideChange: 'doSomething',
204
+ handleSlidesAddedToView: 'doSomething',
174
205
  isFloating: undefined,
175
206
  isHideawayButtons: undefined,
176
207
  isTouchscreen: undefined,
@@ -29,6 +29,7 @@ export const CSS = {
29
29
  CENTER: 'tide-axis2-center',
30
30
  END: 'tide-axis2-end',
31
31
  START: 'tide-axis2-start',
32
+ STRETCH: 'tide-axis2-stretch',
32
33
  },
33
34
  BG: {
34
35
  GLOBAL: {
@@ -240,6 +241,7 @@ export const CSS = {
240
241
  ZERO: 'tide-height-0',
241
242
  FULL: 'tide-height-full',
242
243
  MAX_FULL: 'tide-max-height-full',
244
+ MIN_ZERO: 'tide-min-height-0',
243
245
  },
244
246
  ISOLATION: {
245
247
  ISOLATE: 'tide-isolate',
@@ -457,6 +459,7 @@ export const CSS = {
457
459
  ZERO: 'tide-width-0',
458
460
  FULL: 'tide-width-full',
459
461
  MAX_FULL: 'tide-max-width-full',
462
+ MIN_ZERO: 'tide-min-width-0',
460
463
  },
461
464
  Z_INDEX: {
462
465
  INITIAL: 'tide-z-index-initial',