@bethinkpl/design-system 42.0.0 → 43.0.0
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.
- package/dist/design-system.css +1 -1
- package/dist/design-system.js +16798 -13006
- package/dist/design-system.js.map +1 -1
- package/dist/lib/js/components/Cards/Card/Card.consts.d.ts +14 -0
- package/dist/lib/js/components/Cards/Card/Card.vue.d.ts +10 -5
- package/dist/lib/js/components/Cards/CardExpandable/CardExpandable.vue.d.ts +33 -15
- package/dist/lib/js/components/Form/InputField/useInputFieldWithinForm.d.ts +1 -1
- package/dist/lib/js/components/Form/SelectField/SelectField.types.d.ts +26 -0
- package/dist/lib/js/components/Form/SelectField/SelectField.utils.d.ts +7 -0
- package/dist/lib/js/components/Form/SelectField/SelectField.vue.d.ts +107 -0
- package/dist/lib/js/components/Form/SelectField/SelectFieldOption.vue.d.ts +19 -0
- package/dist/lib/js/components/Form/SelectField/index.d.ts +4 -0
- package/dist/lib/js/components/Form/SelectField/useSelectFieldWithinForm.d.ts +8 -0
- package/dist/lib/js/components/Pagination/Pagination.vue.d.ts +2 -0
- package/dist/lib/js/components/SelectList/SelectListItem/SelectListItem.vue.d.ts +2 -0
- package/dist/lib/js/components/SelectList/SelectListItemToggle/SelectListItemToggle.vue.d.ts +2 -0
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionOpenEnded/SurveyQuestionOpenEnded.vue.d.ts +33 -15
- package/dist/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue.d.ts +33 -15
- package/dist/lib/js/components/Toast/Toast.vue.d.ts +33 -15
- package/dist/lib/js/composables/useFormFieldWithinForm.d.ts +3 -3
- package/dist/lib/js/index.d.ts +2 -0
- package/lib/js/components/Cards/Card/Card.consts.ts +18 -0
- package/lib/js/components/Cards/Card/Card.spec.ts +159 -33
- package/lib/js/components/Cards/Card/Card.stories.ts +21 -2
- package/lib/js/components/Cards/Card/Card.vue +90 -23
- package/lib/js/components/Dropdown/Dropdown.vue +6 -10
- package/lib/js/components/Form/Form.stories.ts +15 -1
- package/lib/js/components/Form/SelectField/SelectField.spec.ts +495 -0
- package/lib/js/components/Form/SelectField/SelectField.stories.ts +287 -0
- package/lib/js/components/Form/SelectField/SelectField.types.ts +65 -0
- package/lib/js/components/Form/SelectField/SelectField.utils.ts +83 -0
- package/lib/js/components/Form/SelectField/SelectField.vue +342 -0
- package/lib/js/components/Form/SelectField/SelectFieldOption.vue +51 -0
- package/lib/js/components/Form/SelectField/index.ts +5 -0
- package/lib/js/components/Form/SelectField/useSelectFieldWithinForm.ts +27 -0
- package/lib/js/components/SelectList/SelectListItem/SelectListItem.spec.ts +77 -0
- package/lib/js/components/SelectList/SelectListItem/SelectListItem.vue +4 -1
- package/lib/js/composables/useFormFieldWithinForm.ts +4 -4
- package/lib/js/index.ts +2 -0
- package/lib/js/styles/Shadows/Shadows.stories.scss +16 -0
- package/lib/js/styles/Shadows/Shadows.stories.ts +4 -0
- package/lib/styles/mixins/_dropdown-surface.scss +24 -0
- package/lib/styles/settings/_shadows.scss +18 -0
- package/package.json +1 -1
|
@@ -256,12 +256,18 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
256
256
|
hasRibbon: {
|
|
257
257
|
type: PropType<boolean>;
|
|
258
258
|
};
|
|
259
|
-
|
|
260
|
-
type: PropType<
|
|
259
|
+
elevation: {
|
|
260
|
+
type: PropType<import('../Cards/Card').CardElevation>;
|
|
261
|
+
};
|
|
262
|
+
radius: {
|
|
263
|
+
type: PropType<import('../Cards/Card').CardRadius>;
|
|
261
264
|
};
|
|
262
265
|
backgroundColor: {
|
|
263
266
|
type: PropType<import('../Cards/Card').CardBackgroundColor>;
|
|
264
267
|
};
|
|
268
|
+
isFlat: {
|
|
269
|
+
type: PropType<boolean>;
|
|
270
|
+
};
|
|
265
271
|
ribbonPosition: {
|
|
266
272
|
type: PropType<import('../Cards/Card').CardRibbonPositions>;
|
|
267
273
|
};
|
|
@@ -283,12 +289,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
283
289
|
loadingBarTime: {
|
|
284
290
|
type: PropType<string>;
|
|
285
291
|
};
|
|
286
|
-
isFlat: {
|
|
287
|
-
type: PropType<boolean>;
|
|
288
|
-
};
|
|
289
292
|
isContentScrollable: {
|
|
290
293
|
type: PropType<boolean>;
|
|
291
294
|
};
|
|
295
|
+
hasRadius: {
|
|
296
|
+
type: PropType<import('../../utils/type.utils').RemovedProp<"renamed to radius">>;
|
|
297
|
+
};
|
|
292
298
|
}>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
293
299
|
P: {};
|
|
294
300
|
B: {};
|
|
@@ -315,12 +321,18 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
315
321
|
hasRibbon: {
|
|
316
322
|
type: PropType<boolean>;
|
|
317
323
|
};
|
|
318
|
-
|
|
319
|
-
type: PropType<
|
|
324
|
+
elevation: {
|
|
325
|
+
type: PropType<import('../Cards/Card').CardElevation>;
|
|
326
|
+
};
|
|
327
|
+
radius: {
|
|
328
|
+
type: PropType<import('../Cards/Card').CardRadius>;
|
|
320
329
|
};
|
|
321
330
|
backgroundColor: {
|
|
322
331
|
type: PropType<import('../Cards/Card').CardBackgroundColor>;
|
|
323
332
|
};
|
|
333
|
+
isFlat: {
|
|
334
|
+
type: PropType<boolean>;
|
|
335
|
+
};
|
|
324
336
|
ribbonPosition: {
|
|
325
337
|
type: PropType<import('../Cards/Card').CardRibbonPositions>;
|
|
326
338
|
};
|
|
@@ -342,12 +354,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
342
354
|
loadingBarTime: {
|
|
343
355
|
type: PropType<string>;
|
|
344
356
|
};
|
|
345
|
-
isFlat: {
|
|
346
|
-
type: PropType<boolean>;
|
|
347
|
-
};
|
|
348
357
|
isContentScrollable: {
|
|
349
358
|
type: PropType<boolean>;
|
|
350
359
|
};
|
|
360
|
+
hasRadius: {
|
|
361
|
+
type: PropType<import('../../utils/type.utils').RemovedProp<"renamed to radius">>;
|
|
362
|
+
};
|
|
351
363
|
}>> & Readonly<{}>, {}, {}, {}, {}, {}>;
|
|
352
364
|
__isFragment?: never;
|
|
353
365
|
__isTeleport?: never;
|
|
@@ -371,12 +383,18 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
371
383
|
hasRibbon: {
|
|
372
384
|
type: PropType<boolean>;
|
|
373
385
|
};
|
|
374
|
-
|
|
375
|
-
type: PropType<
|
|
386
|
+
elevation: {
|
|
387
|
+
type: PropType<import('../Cards/Card').CardElevation>;
|
|
388
|
+
};
|
|
389
|
+
radius: {
|
|
390
|
+
type: PropType<import('../Cards/Card').CardRadius>;
|
|
376
391
|
};
|
|
377
392
|
backgroundColor: {
|
|
378
393
|
type: PropType<import('../Cards/Card').CardBackgroundColor>;
|
|
379
394
|
};
|
|
395
|
+
isFlat: {
|
|
396
|
+
type: PropType<boolean>;
|
|
397
|
+
};
|
|
380
398
|
ribbonPosition: {
|
|
381
399
|
type: PropType<import('../Cards/Card').CardRibbonPositions>;
|
|
382
400
|
};
|
|
@@ -398,12 +416,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
398
416
|
loadingBarTime: {
|
|
399
417
|
type: PropType<string>;
|
|
400
418
|
};
|
|
401
|
-
isFlat: {
|
|
402
|
-
type: PropType<boolean>;
|
|
403
|
-
};
|
|
404
419
|
isContentScrollable: {
|
|
405
420
|
type: PropType<boolean>;
|
|
406
421
|
};
|
|
422
|
+
hasRadius: {
|
|
423
|
+
type: PropType<import('../../utils/type.utils').RemovedProp<"renamed to radius">>;
|
|
424
|
+
};
|
|
407
425
|
}>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
408
426
|
$slots: Readonly<{
|
|
409
427
|
header?: () => any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeRefOrGetter, Ref } from 'vue';
|
|
2
2
|
|
|
3
|
-
export declare function useFormFieldWithinForm<T
|
|
4
|
-
field: import('vee-validate').FieldContext<
|
|
5
|
-
value: Ref<T
|
|
3
|
+
export declare function useFormFieldWithinForm<T>(name: MaybeRefOrGetter<string | undefined>, modelValue: Ref<T>): {
|
|
4
|
+
field: import('vee-validate').FieldContext<T> | null;
|
|
5
|
+
value: Ref<T, T>;
|
|
6
6
|
errors: Ref<string[], string[]>;
|
|
7
7
|
};
|
package/dist/lib/js/index.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ export { default as NumberInCircle } from './components/NumberInCircle';
|
|
|
53
53
|
export { default as DsNumberInCircle } from './components/NumberInCircle';
|
|
54
54
|
export * from './components/NumberInCircle/NumberInCircle.consts';
|
|
55
55
|
export { default as DsPasswordField } from './components/Form/PasswordField';
|
|
56
|
+
export { default as DsSelectField } from './components/Form/SelectField';
|
|
57
|
+
export * from './components/Form/SelectField';
|
|
56
58
|
export { default as TabItem } from './components/TabItem';
|
|
57
59
|
export { default as DsTabItem } from './components/TabItem';
|
|
58
60
|
export * from './components/TabItem/TabItem.consts';
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
|
|
8
8
|
export const CARD_PADDING_SIZES = {
|
|
9
9
|
SMALL: 'small',
|
|
10
|
+
MEDIUM: 'medium',
|
|
10
11
|
LARGE: 'large',
|
|
11
12
|
} as const;
|
|
12
13
|
|
|
@@ -15,10 +16,27 @@ export type CardPaddingSize = Value<typeof CARD_PADDING_SIZES>;
|
|
|
15
16
|
export const CARD_BACKGROUND_COLORS = {
|
|
16
17
|
DEFAULT: 'default',
|
|
17
18
|
NEUTRAL: 'neutral',
|
|
19
|
+
NONE: 'none',
|
|
18
20
|
} as const;
|
|
19
21
|
|
|
20
22
|
export type CardBackgroundColor = Value<typeof CARD_BACKGROUND_COLORS>;
|
|
21
23
|
|
|
24
|
+
export const CARD_ELEVATIONS = {
|
|
25
|
+
DEFAULT: 'default',
|
|
26
|
+
TOP: 'top',
|
|
27
|
+
NONE: 'none',
|
|
28
|
+
} as const;
|
|
29
|
+
|
|
30
|
+
export type CardElevation = Value<typeof CARD_ELEVATIONS>;
|
|
31
|
+
|
|
32
|
+
export const CARD_RADIUSES = {
|
|
33
|
+
ALL: 'all',
|
|
34
|
+
TOP: 'top',
|
|
35
|
+
NONE: 'none',
|
|
36
|
+
} as const;
|
|
37
|
+
|
|
38
|
+
export type CardRadius = Value<typeof CARD_RADIUSES>;
|
|
39
|
+
|
|
22
40
|
export const CARD_RIBBON_COLORS = CONTAINER_RIBBON_COLORS;
|
|
23
41
|
|
|
24
42
|
export type CardRibbonColors = Value<typeof CARD_RIBBON_COLORS>;
|
|
@@ -3,13 +3,37 @@ import { ComponentMountingOptions, mount } from '@vue/test-utils';
|
|
|
3
3
|
import { h } from 'vue';
|
|
4
4
|
|
|
5
5
|
import Card from './Card.vue';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
CARD_BACKGROUND_COLORS,
|
|
8
|
+
CARD_ELEVATIONS,
|
|
9
|
+
CARD_PADDING_SIZES,
|
|
10
|
+
CARD_RADIUSES,
|
|
11
|
+
CardBackgroundColor,
|
|
12
|
+
CardElevation,
|
|
13
|
+
CardPaddingSize,
|
|
14
|
+
CardRadius,
|
|
15
|
+
} from './Card.consts';
|
|
7
16
|
|
|
8
17
|
describe('Card', () => {
|
|
9
18
|
const createComponent = (options: ComponentMountingOptions<typeof Card> = {}) => {
|
|
10
19
|
return mount(Card, options);
|
|
11
20
|
};
|
|
12
21
|
|
|
22
|
+
// asserts that exactly one modifier out of a variant group is applied
|
|
23
|
+
const expectOnlyModifier = (
|
|
24
|
+
classes: Array<string>,
|
|
25
|
+
modifiers: Array<string>,
|
|
26
|
+
expectedModifier: string | null,
|
|
27
|
+
) => {
|
|
28
|
+
modifiers.forEach((modifier) => {
|
|
29
|
+
if (modifier === expectedModifier) {
|
|
30
|
+
expect(classes).toContain(modifier);
|
|
31
|
+
} else {
|
|
32
|
+
expect(classes).not.toContain(modifier);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
13
37
|
it('should create', () => {
|
|
14
38
|
const component = createComponent();
|
|
15
39
|
|
|
@@ -198,62 +222,143 @@ describe('Card', () => {
|
|
|
198
222
|
);
|
|
199
223
|
});
|
|
200
224
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
225
|
+
const PADDING_MODIFIERS = ['-ds-paddingMedium', '-ds-paddingLarge'];
|
|
226
|
+
|
|
227
|
+
it.each<[CardPaddingSize, string | null]>([
|
|
228
|
+
[CARD_PADDING_SIZES.SMALL, null],
|
|
229
|
+
[CARD_PADDING_SIZES.MEDIUM, '-ds-paddingMedium'],
|
|
230
|
+
[CARD_PADDING_SIZES.LARGE, '-ds-paddingLarge'],
|
|
231
|
+
])('should set the padding class for paddingSize %s', (paddingSize, expectedModifier) => {
|
|
232
|
+
const component = createComponent({ props: { paddingSize } });
|
|
205
233
|
|
|
206
|
-
|
|
234
|
+
expectOnlyModifier(
|
|
235
|
+
component.find('.ds-card').classes(),
|
|
236
|
+
PADDING_MODIFIERS,
|
|
237
|
+
expectedModifier,
|
|
238
|
+
);
|
|
207
239
|
});
|
|
208
240
|
|
|
209
|
-
it('should not set
|
|
210
|
-
const component = createComponent(
|
|
211
|
-
|
|
212
|
-
|
|
241
|
+
it('should not set any padding class by default', () => {
|
|
242
|
+
const component = createComponent();
|
|
243
|
+
|
|
244
|
+
expectOnlyModifier(component.find('.ds-card').classes(), PADDING_MODIFIERS, null);
|
|
245
|
+
});
|
|
213
246
|
|
|
214
|
-
|
|
247
|
+
const ELEVATION_MODIFIERS = ['-ds-elevationTop', '-ds-elevationNone'];
|
|
248
|
+
|
|
249
|
+
it.each<[CardElevation, string | null]>([
|
|
250
|
+
[CARD_ELEVATIONS.DEFAULT, null],
|
|
251
|
+
[CARD_ELEVATIONS.TOP, '-ds-elevationTop'],
|
|
252
|
+
[CARD_ELEVATIONS.NONE, '-ds-elevationNone'],
|
|
253
|
+
])('should set the elevation class for elevation %s', (elevation, expectedModifier) => {
|
|
254
|
+
const component = createComponent({ props: { elevation } });
|
|
255
|
+
|
|
256
|
+
expectOnlyModifier(
|
|
257
|
+
component.find('.ds-card').classes(),
|
|
258
|
+
ELEVATION_MODIFIERS,
|
|
259
|
+
expectedModifier,
|
|
260
|
+
);
|
|
215
261
|
});
|
|
216
262
|
|
|
217
|
-
it('should not set
|
|
263
|
+
it('should not set any elevation class by default', () => {
|
|
218
264
|
const component = createComponent();
|
|
219
265
|
|
|
220
|
-
|
|
266
|
+
expectOnlyModifier(component.find('.ds-card').classes(), ELEVATION_MODIFIERS, null);
|
|
221
267
|
});
|
|
222
268
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
269
|
+
const RADIUS_MODIFIERS = ['-ds-radiusTop', '-ds-radiusNone'];
|
|
270
|
+
|
|
271
|
+
it.each<[CardRadius, string | null]>([
|
|
272
|
+
[CARD_RADIUSES.ALL, null],
|
|
273
|
+
[CARD_RADIUSES.TOP, '-ds-radiusTop'],
|
|
274
|
+
[CARD_RADIUSES.NONE, '-ds-radiusNone'],
|
|
275
|
+
])('should set the radius class for radius %s', (radius, expectedModifier) => {
|
|
276
|
+
const component = createComponent({ props: { radius } });
|
|
227
277
|
|
|
228
|
-
|
|
278
|
+
expectOnlyModifier(
|
|
279
|
+
component.find('.ds-card').classes(),
|
|
280
|
+
RADIUS_MODIFIERS,
|
|
281
|
+
expectedModifier,
|
|
282
|
+
);
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
it('should not set any radius class by default', () => {
|
|
286
|
+
const component = createComponent();
|
|
287
|
+
|
|
288
|
+
expectOnlyModifier(component.find('.ds-card').classes(), RADIUS_MODIFIERS, null);
|
|
229
289
|
});
|
|
230
290
|
|
|
231
|
-
|
|
291
|
+
const BACKGROUND_MODIFIERS = ['-ds-backgroundNeutral', '-ds-backgroundNone'];
|
|
292
|
+
|
|
293
|
+
it.each<[CardBackgroundColor, string | null]>([
|
|
294
|
+
[CARD_BACKGROUND_COLORS.DEFAULT, null],
|
|
295
|
+
[CARD_BACKGROUND_COLORS.NEUTRAL, '-ds-backgroundNeutral'],
|
|
296
|
+
[CARD_BACKGROUND_COLORS.NONE, '-ds-backgroundNone'],
|
|
297
|
+
])(
|
|
298
|
+
'should set the background class for backgroundColor %s',
|
|
299
|
+
(backgroundColor, expectedModifier) => {
|
|
300
|
+
const component = createComponent({ props: { backgroundColor } });
|
|
301
|
+
|
|
302
|
+
expectOnlyModifier(
|
|
303
|
+
component.find('.ds-card').classes(),
|
|
304
|
+
BACKGROUND_MODIFIERS,
|
|
305
|
+
expectedModifier,
|
|
306
|
+
);
|
|
307
|
+
},
|
|
308
|
+
);
|
|
309
|
+
|
|
310
|
+
it('should not set any background class by default', () => {
|
|
232
311
|
const component = createComponent();
|
|
233
312
|
|
|
234
|
-
|
|
313
|
+
expectOnlyModifier(component.find('.ds-card').classes(), BACKGROUND_MODIFIERS, null);
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
it('should set the none modifiers of all three visual axes when isFlat is true', () => {
|
|
317
|
+
const classes = createComponent({ props: { isFlat: true } })
|
|
318
|
+
.find('.ds-card')
|
|
319
|
+
.classes();
|
|
320
|
+
|
|
321
|
+
expectOnlyModifier(classes, ELEVATION_MODIFIERS, '-ds-elevationNone');
|
|
322
|
+
expectOnlyModifier(classes, RADIUS_MODIFIERS, '-ds-radiusNone');
|
|
323
|
+
expectOnlyModifier(classes, BACKGROUND_MODIFIERS, '-ds-backgroundNone');
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
it('should not change the padding when isFlat is true', () => {
|
|
327
|
+
const component = createComponent({ props: { isFlat: true } });
|
|
328
|
+
|
|
329
|
+
expectOnlyModifier(component.find('.ds-card').classes(), PADDING_MODIFIERS, null);
|
|
235
330
|
});
|
|
236
331
|
|
|
237
|
-
it('should
|
|
332
|
+
it('should let an explicit elevation override isFlat', () => {
|
|
238
333
|
const component = createComponent({
|
|
239
|
-
props: {
|
|
334
|
+
props: { isFlat: true, elevation: CARD_ELEVATIONS.TOP },
|
|
240
335
|
});
|
|
241
336
|
|
|
242
|
-
|
|
337
|
+
expectOnlyModifier(
|
|
338
|
+
component.find('.ds-card').classes(),
|
|
339
|
+
ELEVATION_MODIFIERS,
|
|
340
|
+
'-ds-elevationTop',
|
|
341
|
+
);
|
|
243
342
|
});
|
|
244
343
|
|
|
245
|
-
it('should
|
|
246
|
-
const component = createComponent(
|
|
344
|
+
it('should let an explicit radius override isFlat', () => {
|
|
345
|
+
const component = createComponent({
|
|
346
|
+
props: { isFlat: true, radius: CARD_RADIUSES.TOP },
|
|
347
|
+
});
|
|
247
348
|
|
|
248
|
-
|
|
349
|
+
expectOnlyModifier(component.find('.ds-card').classes(), RADIUS_MODIFIERS, '-ds-radiusTop');
|
|
249
350
|
});
|
|
250
351
|
|
|
251
|
-
it('should
|
|
352
|
+
it('should let an explicit backgroundColor override isFlat', () => {
|
|
252
353
|
const component = createComponent({
|
|
253
|
-
props: { backgroundColor: CARD_BACKGROUND_COLORS.NEUTRAL },
|
|
354
|
+
props: { isFlat: true, backgroundColor: CARD_BACKGROUND_COLORS.NEUTRAL },
|
|
254
355
|
});
|
|
255
356
|
|
|
256
|
-
|
|
357
|
+
expectOnlyModifier(
|
|
358
|
+
component.find('.ds-card').classes(),
|
|
359
|
+
BACKGROUND_MODIFIERS,
|
|
360
|
+
'-ds-backgroundNeutral',
|
|
361
|
+
);
|
|
257
362
|
});
|
|
258
363
|
|
|
259
364
|
it('should not give the ribbon a radius when only hasRibbonRadius is set', () => {
|
|
@@ -266,25 +371,46 @@ describe('Card', () => {
|
|
|
266
371
|
|
|
267
372
|
it('should give the ribbon a radius when hasRibbonRadius and card has no radius', () => {
|
|
268
373
|
const component = createComponent({
|
|
269
|
-
props: { hasRibbon: true, hasRibbonRadius: true,
|
|
374
|
+
props: { hasRibbon: true, hasRibbonRadius: true, radius: CARD_RADIUSES.NONE },
|
|
270
375
|
});
|
|
271
376
|
|
|
272
377
|
expect(component.find('.-ds-radius-bottom').exists()).toBe(true);
|
|
273
378
|
});
|
|
274
379
|
|
|
275
|
-
it('should not give the ribbon a radius when
|
|
380
|
+
it('should not give the ribbon a radius when radius is none but hasRibbonRadius is false', () => {
|
|
381
|
+
const component = createComponent({
|
|
382
|
+
props: { hasRibbon: true, hasRibbonRadius: false, radius: CARD_RADIUSES.NONE },
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
expect(component.find('.-ds-radius-bottom').exists()).toBe(false);
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
it('should not give the ribbon a radius when the card is rounded at the top', () => {
|
|
276
389
|
const component = createComponent({
|
|
277
|
-
props: { hasRibbon: true, hasRibbonRadius:
|
|
390
|
+
props: { hasRibbon: true, hasRibbonRadius: true, radius: CARD_RADIUSES.TOP },
|
|
278
391
|
});
|
|
279
392
|
|
|
280
393
|
expect(component.find('.-ds-radius-bottom').exists()).toBe(false);
|
|
281
394
|
});
|
|
282
395
|
|
|
283
|
-
it('should give the ribbon a radius when hasRibbonRadius and card is flat', () => {
|
|
396
|
+
it('should give the ribbon a radius when hasRibbonRadius and the card is flat', () => {
|
|
284
397
|
const component = createComponent({
|
|
285
398
|
props: { hasRibbon: true, hasRibbonRadius: true, isFlat: true },
|
|
286
399
|
});
|
|
287
400
|
|
|
288
401
|
expect(component.find('.-ds-radius-bottom').exists()).toBe(true);
|
|
289
402
|
});
|
|
403
|
+
|
|
404
|
+
it('should not give the ribbon a radius when a flat card is overridden with radius top', () => {
|
|
405
|
+
const component = createComponent({
|
|
406
|
+
props: {
|
|
407
|
+
hasRibbon: true,
|
|
408
|
+
hasRibbonRadius: true,
|
|
409
|
+
isFlat: true,
|
|
410
|
+
radius: CARD_RADIUSES.TOP,
|
|
411
|
+
},
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
expect(component.find('.-ds-radius-bottom').exists()).toBe(false);
|
|
415
|
+
});
|
|
290
416
|
});
|
|
@@ -3,6 +3,8 @@ import Card from './Card.vue';
|
|
|
3
3
|
import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
|
|
4
4
|
import {
|
|
5
5
|
CARD_BACKGROUND_COLORS,
|
|
6
|
+
CARD_ELEVATIONS,
|
|
7
|
+
CARD_RADIUSES,
|
|
6
8
|
CARD_RIBBON_COLORS,
|
|
7
9
|
CARD_RIBBON_POSITIONS,
|
|
8
10
|
CARD_RIBBON_SIZES,
|
|
@@ -50,7 +52,9 @@ const args = {
|
|
|
50
52
|
paddingSize: CARD_PADDING_SIZES.SMALL,
|
|
51
53
|
dividerUnderHeader: false,
|
|
52
54
|
hasRibbon: false,
|
|
53
|
-
|
|
55
|
+
isFlat: false,
|
|
56
|
+
elevation: CARD_ELEVATIONS.DEFAULT,
|
|
57
|
+
radius: CARD_RADIUSES.ALL,
|
|
54
58
|
backgroundColor: CARD_BACKGROUND_COLORS.DEFAULT,
|
|
55
59
|
ribbonPosition: CARD_RIBBON_POSITIONS.TOP,
|
|
56
60
|
ribbonSize: CARD_RIBBON_SIZES.MEDIUM,
|
|
@@ -59,7 +63,6 @@ const args = {
|
|
|
59
63
|
hasLoadingBar: false,
|
|
60
64
|
loadingBarColor: LOADING_BAR_COLORS.NEUTRAL_HEAVY,
|
|
61
65
|
loadingBarTime: '0',
|
|
62
|
-
isFlat: false,
|
|
63
66
|
isContentScrollable: false,
|
|
64
67
|
} as Args;
|
|
65
68
|
|
|
@@ -70,6 +73,17 @@ const argTypes = {
|
|
|
70
73
|
},
|
|
71
74
|
footer: { control: 'text' },
|
|
72
75
|
experimentalContent: { control: 'text' },
|
|
76
|
+
isFlat: {
|
|
77
|
+
control: 'boolean',
|
|
78
|
+
},
|
|
79
|
+
elevation: {
|
|
80
|
+
control: 'select',
|
|
81
|
+
options: Object.values(CARD_ELEVATIONS),
|
|
82
|
+
},
|
|
83
|
+
radius: {
|
|
84
|
+
control: 'select',
|
|
85
|
+
options: Object.values(CARD_RADIUSES),
|
|
86
|
+
},
|
|
73
87
|
backgroundColor: {
|
|
74
88
|
control: 'select',
|
|
75
89
|
options: Object.values(CARD_BACKGROUND_COLORS),
|
|
@@ -108,3 +122,8 @@ Interactive.parameters = {
|
|
|
108
122
|
url: 'https://www.figma.com/file/izQdYyiBR1GQgFkaOIfIJI/LMS---DS---Components?node-id=1552%3A34959',
|
|
109
123
|
},
|
|
110
124
|
};
|
|
125
|
+
|
|
126
|
+
export const Flat = StoryTemplate.bind({});
|
|
127
|
+
|
|
128
|
+
Flat.argTypes = argTypes;
|
|
129
|
+
Flat.args = { ...args, isFlat: true };
|