@bethinkpl/design-system 31.0.3 → 33.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.
Files changed (52) hide show
  1. package/dist/design-system.css +1 -1
  2. package/dist/design-system.js +14394 -10556
  3. package/dist/design-system.js.map +1 -1
  4. package/dist/lib/js/components/Banner/Banner.vue.d.ts +53 -34
  5. package/dist/lib/js/components/Buttons/IconButton/IconButton.vue.d.ts +4 -0
  6. package/dist/lib/js/components/Cards/CardExpandable/CardExpandable.vue.d.ts +4 -0
  7. package/dist/lib/js/components/Chip/Chip.vue.d.ts +8 -0
  8. package/dist/lib/js/components/DatePickers/DateBox/DateBox.vue.d.ts +4 -0
  9. package/dist/lib/js/components/DatePickers/DatePicker/DatePicker.vue.d.ts +4 -0
  10. package/dist/lib/js/components/DatePickers/DateRangePicker/DateRangePicker.vue.d.ts +4 -0
  11. package/dist/lib/js/components/Drawer/DrawerHeader/DrawerHeader.vue.d.ts +16 -0
  12. package/dist/lib/js/components/Drawer/DrawerListItem/DrawerListItem.vue.d.ts +4 -0
  13. package/dist/lib/js/components/Drawer/DrawerSection/DrawerSection.vue.d.ts +24 -7
  14. package/dist/lib/js/components/Form/RadioButton/RadioButton.vue.d.ts +4 -0
  15. package/dist/lib/js/components/Headers/OverlayHeader/OverlayHeader.vue.d.ts +8 -0
  16. package/dist/lib/js/components/Headers/SectionHeader/SectionHeader.vue.d.ts +8 -0
  17. package/dist/lib/js/components/Icons/Icon/Icon.consts.d.ts +4 -0
  18. package/dist/lib/js/components/Menu/MenuItem/MenuItem.consts.d.ts +0 -4
  19. package/dist/lib/js/components/Menu/MenuItem/MenuItem.vue.d.ts +105 -49
  20. package/dist/lib/js/components/Modal/Modal.vue.d.ts +4 -0
  21. package/dist/lib/js/components/Modals/Modal/Modal.vue.d.ts +8 -0
  22. package/dist/lib/js/components/Modals/ModalDialog/ModalDialog.vue.d.ts +8 -0
  23. package/dist/lib/js/components/Pagination/Pagination.vue.d.ts +12 -0
  24. package/dist/lib/js/components/ProgressBar/ProgressBar.vue.d.ts +4 -0
  25. package/dist/lib/js/components/ProgressDonutChart/ProgressDonutChart.vue.d.ts +4 -0
  26. package/dist/lib/js/components/RichList/BasicRichListItem/BasicRichListItem.vue.d.ts +148 -262
  27. package/dist/lib/js/components/RichList/RichListItem/RichListItem.vue.d.ts +4 -0
  28. package/dist/lib/js/components/SelectList/SelectListItem/SelectListItem.vue.d.ts +4 -0
  29. package/dist/lib/js/components/SelectList/SelectListItemToggle/SelectListItemToggle.vue.d.ts +4 -0
  30. package/dist/lib/js/components/Statuses/AccessStatus/AccessStatus.vue.d.ts +4 -0
  31. package/dist/lib/js/components/Statuses/BlockadeStatus/BlockadeStatus.vue.d.ts +4 -0
  32. package/dist/lib/js/components/SurveyQuestions/SurveyQuestionOpenEnded/SurveyQuestionOpenEnded.vue.d.ts +12 -0
  33. package/dist/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue.d.ts +12 -0
  34. package/dist/lib/js/components/Switch/Switch.vue.d.ts +4 -0
  35. package/dist/lib/js/components/TextGroup/TextGroup.consts.d.ts +4 -3
  36. package/dist/lib/js/components/TextGroup/TextGroup.vue.d.ts +58 -302
  37. package/dist/lib/js/components/Tile/Tile.sb.shared.d.ts +7 -14
  38. package/dist/lib/js/components/Toggles/ToggleButton/ToggleButton.vue.d.ts +4 -0
  39. package/dist/lib/js/icons/fontawesome.d.ts +4 -0
  40. package/lib/js/components/Banner/Banner.vue +7 -36
  41. package/lib/js/components/Drawer/DrawerSection/DrawerSection.stories.ts +16 -7
  42. package/lib/js/components/Drawer/DrawerSection/DrawerSection.vue +15 -4
  43. package/lib/js/components/Menu/MenuItem/MenuItem.consts.ts +0 -9
  44. package/lib/js/components/Menu/MenuItem/MenuItem.spec.ts +83 -17
  45. package/lib/js/components/Menu/MenuItem/MenuItem.stories.ts +103 -27
  46. package/lib/js/components/Menu/MenuItem/MenuItem.vue +139 -57
  47. package/lib/js/components/TextGroup/TextGroup.consts.ts +5 -3
  48. package/lib/js/components/TextGroup/TextGroup.stories.ts +13 -6
  49. package/lib/js/components/TextGroup/TextGroup.vue +172 -105
  50. package/lib/js/icons/fontawesome.ts +8 -0
  51. package/lib/styles/mixins/_background-mask.scss +2 -2
  52. package/package.json +4 -1
@@ -22,6 +22,7 @@ export declare const data: () => {
22
22
  readonly FA_ARROW_DOWN_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
23
23
  readonly FA_ARROW_DOWN_TO_LINE: import('@fortawesome/fontawesome-common-types').IconDefinition;
24
24
  readonly FA_ARROW_LEFT_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
25
+ readonly FA_ARROW_LEFT_TO_DOTTED_LINE: import('@fortawesome/fontawesome-common-types').IconDefinition;
25
26
  readonly FA_ARROW_POINTER: import('@fortawesome/fontawesome-common-types').IconDefinition;
26
27
  readonly FA_ARROW_RIGHT_FROM_BRACKET: import('@fortawesome/fontawesome-common-types').IconDefinition;
27
28
  readonly FA_ARROW_RIGHT_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
@@ -32,8 +33,10 @@ export declare const data: () => {
32
33
  readonly FA_ARROW_UP_RIGHT_FROM_SQUARE: import('@fortawesome/fontawesome-common-types').IconDefinition;
33
34
  readonly FA_ARROW_UP_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
34
35
  readonly FA_ARROWS_LEFT_RIGHT_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
36
+ readonly FA_ARROWS_FROM_DOTTED_LINE: import('@fortawesome/fontawesome-common-types').IconDefinition;
35
37
  readonly FA_ARROWS_MAXIMIZE: import('@fortawesome/fontawesome-common-types').IconDefinition;
36
38
  readonly FA_ARROWS_ROTATE: import('@fortawesome/fontawesome-common-types').IconDefinition;
39
+ readonly FA_ARROWS_TO_DOTTED_LINE: import('@fortawesome/fontawesome-common-types').IconDefinition;
37
40
  readonly FA_ATOM_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
38
41
  readonly FA_BADGE_PERCENT: import('@fortawesome/fontawesome-common-types').IconDefinition;
39
42
  readonly FA_BAN: import('@fortawesome/fontawesome-common-types').IconDefinition;
@@ -173,6 +176,7 @@ export declare const data: () => {
173
176
  readonly FA_LIST: import('@fortawesome/fontawesome-common-types').IconDefinition;
174
177
  readonly FA_LOCATION_DOT: import('@fortawesome/fontawesome-common-types').IconDefinition;
175
178
  readonly FA_LOCK_KEYHOLE: import('@fortawesome/fontawesome-common-types').IconDefinition;
179
+ readonly FA_MAP: import('@fortawesome/fontawesome-common-types').IconDefinition;
176
180
  readonly FA_MAGNIFYING_GLASS: import('@fortawesome/fontawesome-common-types').IconDefinition;
177
181
  readonly FA_MEDAL: import('@fortawesome/fontawesome-common-types').IconDefinition;
178
182
  readonly FA_MEMO_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
@@ -278,6 +282,7 @@ export declare const data: () => {
278
282
  export declare const components: {
279
283
  DsBanner: {
280
284
  new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
285
+ isExpanded: import('vue').PropType<boolean>;
281
286
  icon: import('../Icons/Icon').IconItem | null;
282
287
  buttonText: {
283
288
  type: import('vue').PropType<string>;
@@ -292,9 +297,6 @@ export declare const components: {
292
297
  type: import('vue').PropType<string>;
293
298
  required: true;
294
299
  };
295
- isExpanded: {
296
- type: import('vue').PropType<boolean>;
297
- };
298
300
  isIconHiddenOnMobile: {
299
301
  type: import('vue').PropType<boolean>;
300
302
  };
@@ -307,11 +309,9 @@ export declare const components: {
307
309
  }>> & Readonly<{
308
310
  onClose?: (() => any) | undefined;
309
311
  "onButton-clicked"?: (() => any) | undefined;
310
- "onUpdate:isExpanded"?: ((isExpanded: boolean) => any) | undefined;
311
312
  }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
312
313
  close: () => void;
313
314
  "button-clicked": () => void;
314
- "update:isExpanded": (isExpanded: boolean) => void;
315
315
  }, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
316
316
  P: {};
317
317
  B: {};
@@ -320,6 +320,7 @@ export declare const components: {
320
320
  M: {};
321
321
  Defaults: {};
322
322
  }, Readonly<import('vue').ExtractPropTypes<{
323
+ isExpanded: import('vue').PropType<boolean>;
323
324
  icon: import('../Icons/Icon').IconItem | null;
324
325
  buttonText: {
325
326
  type: import('vue').PropType<string>;
@@ -334,9 +335,6 @@ export declare const components: {
334
335
  type: import('vue').PropType<string>;
335
336
  required: true;
336
337
  };
337
- isExpanded: {
338
- type: import('vue').PropType<boolean>;
339
- };
340
338
  isIconHiddenOnMobile: {
341
339
  type: import('vue').PropType<boolean>;
342
340
  };
@@ -349,12 +347,12 @@ export declare const components: {
349
347
  }>> & Readonly<{
350
348
  onClose?: (() => any) | undefined;
351
349
  "onButton-clicked"?: (() => any) | undefined;
352
- "onUpdate:isExpanded"?: ((isExpanded: boolean) => any) | undefined;
353
350
  }>, {}, {}, {}, {}, {}>;
354
351
  __isFragment?: never;
355
352
  __isTeleport?: never;
356
353
  __isSuspense?: never;
357
354
  } & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
355
+ isExpanded: import('vue').PropType<boolean>;
358
356
  icon: import('../Icons/Icon').IconItem | null;
359
357
  buttonText: {
360
358
  type: import('vue').PropType<string>;
@@ -369,9 +367,6 @@ export declare const components: {
369
367
  type: import('vue').PropType<string>;
370
368
  required: true;
371
369
  };
372
- isExpanded: {
373
- type: import('vue').PropType<boolean>;
374
- };
375
370
  isIconHiddenOnMobile: {
376
371
  type: import('vue').PropType<boolean>;
377
372
  };
@@ -384,11 +379,9 @@ export declare const components: {
384
379
  }>> & Readonly<{
385
380
  onClose?: (() => any) | undefined;
386
381
  "onButton-clicked"?: (() => any) | undefined;
387
- "onUpdate:isExpanded"?: ((isExpanded: boolean) => any) | undefined;
388
382
  }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
389
383
  close: () => void;
390
384
  "button-clicked": () => void;
391
- "update:isExpanded": (isExpanded: boolean) => void;
392
385
  }, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
393
386
  $slots: {
394
387
  defaultText?(_: {}): any;
@@ -78,6 +78,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
78
78
  readonly FA_ARROW_DOWN_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
79
79
  readonly FA_ARROW_DOWN_TO_LINE: import('@fortawesome/fontawesome-common-types').IconDefinition;
80
80
  readonly FA_ARROW_LEFT_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
81
+ readonly FA_ARROW_LEFT_TO_DOTTED_LINE: import('@fortawesome/fontawesome-common-types').IconDefinition;
81
82
  readonly FA_ARROW_POINTER: import('@fortawesome/fontawesome-common-types').IconDefinition;
82
83
  readonly FA_ARROW_RIGHT_FROM_BRACKET: import('@fortawesome/fontawesome-common-types').IconDefinition;
83
84
  readonly FA_ARROW_RIGHT_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
@@ -88,8 +89,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
88
89
  readonly FA_ARROW_UP_RIGHT_FROM_SQUARE: import('@fortawesome/fontawesome-common-types').IconDefinition;
89
90
  readonly FA_ARROW_UP_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
90
91
  readonly FA_ARROWS_LEFT_RIGHT_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
92
+ readonly FA_ARROWS_FROM_DOTTED_LINE: import('@fortawesome/fontawesome-common-types').IconDefinition;
91
93
  readonly FA_ARROWS_MAXIMIZE: import('@fortawesome/fontawesome-common-types').IconDefinition;
92
94
  readonly FA_ARROWS_ROTATE: import('@fortawesome/fontawesome-common-types').IconDefinition;
95
+ readonly FA_ARROWS_TO_DOTTED_LINE: import('@fortawesome/fontawesome-common-types').IconDefinition;
93
96
  readonly FA_ATOM_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
94
97
  readonly FA_BADGE_PERCENT: import('@fortawesome/fontawesome-common-types').IconDefinition;
95
98
  readonly FA_BAN: import('@fortawesome/fontawesome-common-types').IconDefinition;
@@ -229,6 +232,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
229
232
  readonly FA_LIST: import('@fortawesome/fontawesome-common-types').IconDefinition;
230
233
  readonly FA_LOCATION_DOT: import('@fortawesome/fontawesome-common-types').IconDefinition;
231
234
  readonly FA_LOCK_KEYHOLE: import('@fortawesome/fontawesome-common-types').IconDefinition;
235
+ readonly FA_MAP: import('@fortawesome/fontawesome-common-types').IconDefinition;
232
236
  readonly FA_MAGNIFYING_GLASS: import('@fortawesome/fontawesome-common-types').IconDefinition;
233
237
  readonly FA_MEDAL: import('@fortawesome/fontawesome-common-types').IconDefinition;
234
238
  readonly FA_MEMO_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
@@ -9,6 +9,7 @@ export declare const FONTAWESOME_ICONS: {
9
9
  readonly FA_ARROW_DOWN_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
10
10
  readonly FA_ARROW_DOWN_TO_LINE: import('@fortawesome/fontawesome-common-types').IconDefinition;
11
11
  readonly FA_ARROW_LEFT_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
12
+ readonly FA_ARROW_LEFT_TO_DOTTED_LINE: import('@fortawesome/fontawesome-common-types').IconDefinition;
12
13
  readonly FA_ARROW_POINTER: import('@fortawesome/fontawesome-common-types').IconDefinition;
13
14
  readonly FA_ARROW_RIGHT_FROM_BRACKET: import('@fortawesome/fontawesome-common-types').IconDefinition;
14
15
  readonly FA_ARROW_RIGHT_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
@@ -19,8 +20,10 @@ export declare const FONTAWESOME_ICONS: {
19
20
  readonly FA_ARROW_UP_RIGHT_FROM_SQUARE: import('@fortawesome/fontawesome-common-types').IconDefinition;
20
21
  readonly FA_ARROW_UP_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
21
22
  readonly FA_ARROWS_LEFT_RIGHT_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
23
+ readonly FA_ARROWS_FROM_DOTTED_LINE: import('@fortawesome/fontawesome-common-types').IconDefinition;
22
24
  readonly FA_ARROWS_MAXIMIZE: import('@fortawesome/fontawesome-common-types').IconDefinition;
23
25
  readonly FA_ARROWS_ROTATE: import('@fortawesome/fontawesome-common-types').IconDefinition;
26
+ readonly FA_ARROWS_TO_DOTTED_LINE: import('@fortawesome/fontawesome-common-types').IconDefinition;
24
27
  readonly FA_ATOM_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
25
28
  readonly FA_BADGE_PERCENT: import('@fortawesome/fontawesome-common-types').IconDefinition;
26
29
  readonly FA_BAN: import('@fortawesome/fontawesome-common-types').IconDefinition;
@@ -160,6 +163,7 @@ export declare const FONTAWESOME_ICONS: {
160
163
  readonly FA_LIST: import('@fortawesome/fontawesome-common-types').IconDefinition;
161
164
  readonly FA_LOCATION_DOT: import('@fortawesome/fontawesome-common-types').IconDefinition;
162
165
  readonly FA_LOCK_KEYHOLE: import('@fortawesome/fontawesome-common-types').IconDefinition;
166
+ readonly FA_MAP: import('@fortawesome/fontawesome-common-types').IconDefinition;
163
167
  readonly FA_MAGNIFYING_GLASS: import('@fortawesome/fontawesome-common-types').IconDefinition;
164
168
  readonly FA_MEDAL: import('@fortawesome/fontawesome-common-types').IconDefinition;
165
169
  readonly FA_MEMO_SOLID: import('@fortawesome/fontawesome-common-types').IconDefinition;
@@ -60,11 +60,11 @@
60
60
  <div v-if="$slots.expandedText" class="ds-banner__expander">
61
61
  <ds-icon-button
62
62
  :size="ICON_BUTTON_SIZES.SMALL"
63
- :icon="isExpandedInternal ? ICONS.FA_CHEVRON_UP : ICONS.FA_CHEVRON_DOWN"
63
+ :icon="isExpanded ? ICONS.FA_CHEVRON_UP : ICONS.FA_CHEVRON_DOWN"
64
64
  :color="ICON_BUTTON_COLORS.NEUTRAL"
65
65
  :radius="BUTTON_RADIUSES.CAPSULE"
66
66
  :touchable="false"
67
- @click="toggleExpandedText"
67
+ @click="isExpanded = !isExpanded"
68
68
  />
69
69
  </div>
70
70
  <div v-if="!$slots.expandedText && closable" class="ds-banner__close">
@@ -78,10 +78,7 @@
78
78
  />
79
79
  </div>
80
80
  </div>
81
- <div
82
- v-if="$slots.expandedText && isExpandedInternal"
83
- class="ds-banner__expandedContainer"
84
- >
81
+ <div v-if="$slots.expandedText && isExpanded" class="ds-banner__expandedContainer">
85
82
  <ds-divider :prominence="DIVIDER_PROMINENCES.STRONG" />
86
83
  <div class="ds-banner__expandedText">
87
84
  <slot name="expandedText" />
@@ -330,7 +327,7 @@ import DsDivider, { DIVIDER_PROMINENCES } from '../Divider';
330
327
  import { IconItem, ICONS } from '../Icons/Icon';
331
328
  import DsIconButton, { ICON_BUTTON_COLORS, ICON_BUTTON_SIZES } from '../Buttons/IconButton';
332
329
  import { BANNER_COLORS, BANNER_SIZES, BannerColor, BannerSize } from './Banner.consts';
333
- import { computed, ref, watch } from 'vue';
330
+ import { computed } from 'vue';
334
331
  import FeatureIcon, {
335
332
  FEATURE_ICON_COLOR,
336
333
  FEATURE_ICON_SIZES,
@@ -341,7 +338,6 @@ const {
341
338
  icon = null,
342
339
  closable = false,
343
340
  color = BANNER_COLORS.DEFAULT,
344
- isExpanded = false,
345
341
  isIconHiddenOnMobile = false,
346
342
  size = BANNER_SIZES.MEDIUM,
347
343
  titleInColor = false,
@@ -351,19 +347,18 @@ const {
351
347
  closable?: boolean;
352
348
  color?: BannerColor;
353
349
  title: string;
354
- isExpanded?: boolean;
355
350
  isIconHiddenOnMobile?: boolean;
356
351
  size?: BannerSize;
357
352
  titleInColor?: boolean;
358
353
  }>();
359
354
 
360
- const emit = defineEmits<{
355
+ defineEmits<{
361
356
  'button-clicked': [];
362
357
  close: [];
363
- 'update:isExpanded': [isExpanded: boolean];
364
358
  }>();
365
359
 
366
- const { toggleExpandedText, isExpandedInternal } = useExpanded();
360
+ const isExpanded = defineModel<boolean>('isExpanded', { default: false });
361
+
367
362
  const { sizeClass, colorClass } = useBannerClasses();
368
363
  const iconColor = computed(() => {
369
364
  const colorMap: Record<BannerColor, FeatureIconColor> = {
@@ -379,30 +374,6 @@ const iconColor = computed(() => {
379
374
  return colorMap[color];
380
375
  });
381
376
 
382
- function useExpanded() {
383
- const isExpandedInternal = ref(false);
384
-
385
- watch(
386
- () => isExpanded,
387
- (newValue) => {
388
- if (newValue !== isExpandedInternal.value) {
389
- isExpandedInternal.value = newValue;
390
- }
391
- },
392
- { immediate: true },
393
- );
394
-
395
- const toggleExpandedText = () => {
396
- isExpandedInternal.value = !isExpandedInternal.value;
397
- emit('update:isExpanded', isExpandedInternal.value);
398
- };
399
-
400
- return {
401
- isExpandedInternal,
402
- toggleExpandedText,
403
- };
404
- }
405
-
406
377
  function useBannerClasses() {
407
378
  const colorClass = computed(() => {
408
379
  const colorMap: Record<BannerColor, string> = {
@@ -4,6 +4,10 @@ import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
4
4
  import { SECTION_HEADER_ICON_COLORS, SECTION_HEADER_SIZES } from '../../Headers/SectionHeader';
5
5
  import { ICONS } from '../../Icons/Icon';
6
6
  import { useArgs } from '@storybook/preview-api';
7
+ import SlotPlaceholder, {
8
+ SLOT_PLACEHOLDER_SIZES,
9
+ } from '../../../../../.storybook/SlotPlaceholder/SlotPlaceholder.vue';
10
+ import { toRefs } from 'vue';
7
11
 
8
12
  export default {
9
13
  title: 'Components/Drawer/DrawerSection',
@@ -14,13 +18,14 @@ const StoryTemplate: StoryFn<typeof DrawerSection> = (args) => {
14
18
  const [_, updateArgs] = useArgs();
15
19
 
16
20
  return {
17
- components: { DrawerSection },
21
+ components: { DrawerSection, SlotPlaceholder },
18
22
  setup() {
19
- return args;
20
- },
21
- data() {
23
+ const reactiveArgs = toRefs(args);
24
+
22
25
  return {
23
- ICONS: Object.freeze(ICONS),
26
+ ...reactiveArgs,
27
+ ICONS,
28
+ SLOT_PLACEHOLDER_SIZES,
24
29
  };
25
30
  },
26
31
  methods: {
@@ -51,8 +56,12 @@ const StoryTemplate: StoryFn<typeof DrawerSection> = (args) => {
51
56
  @infoClick="infoClicked"
52
57
  @update:isExpanded="isExpandedUpdated"
53
58
  >
54
- Default slot
55
- <template #uncollapsible>Uncollapsible slot</template>
59
+ <slot-placeholder label="default slot" />
60
+ <template #uncollapsible>
61
+ <slot-placeholder label="uncollapsible slot" :size="SLOT_PLACEHOLDER_SIZES.MEDIUM" /></template>
62
+ <template #sectionHeaderDefault>
63
+ <slot-placeholder label="section header default slot" :size="SLOT_PLACEHOLDER_SIZES.SMALL" />
64
+ </template>
56
65
  </drawer-section>`,
57
66
  };
58
67
  };
@@ -15,9 +15,14 @@
15
15
  :eyebrow="eyebrow"
16
16
  :supporting-text="supportingText"
17
17
  :has-divider="hasDivider"
18
+ :mobile-layout="SECTION_HEADER_MOBILE_LAYOUTS.HORIZONTAL"
18
19
  @info-click="onInfoClick"
19
20
  @update:is-expanded="onExpandableHeaderClick"
20
- />
21
+ >
22
+ <template v-if="$slots.sectionHeaderDefault" #default>
23
+ <slot name="sectionHeaderDefault" />
24
+ </template>
25
+ </ds-section-header>
21
26
 
22
27
  <div v-if="isExpandedInternal || !isExpandable">
23
28
  <slot />
@@ -31,6 +36,7 @@ import { IconItem, ICONS } from '../../Icons/Icon';
31
36
  import { ICON_BUTTON_COLORS, ICON_BUTTON_SIZES } from '../../Buttons/IconButton';
32
37
  import SectionHeader, {
33
38
  SECTION_HEADER_ICON_COLORS,
39
+ SECTION_HEADER_MOBILE_LAYOUTS,
34
40
  SECTION_HEADER_SIZES,
35
41
  SectionHeaderIconColor,
36
42
  SectionHeaderSize,
@@ -114,11 +120,16 @@ export default defineComponent({
114
120
  // TODO fix me when touching this file
115
121
  // eslint-disable-next-line vue/require-emit-validator
116
122
  emits: ['info-click', 'update:isExpanded'],
123
+ setup() {
124
+ return {
125
+ ICON_BUTTON_COLORS,
126
+ ICON_BUTTON_SIZES,
127
+ ICONS,
128
+ SECTION_HEADER_MOBILE_LAYOUTS,
129
+ };
130
+ },
117
131
  data() {
118
132
  return {
119
- ICON_BUTTON_COLORS: Object.freeze(ICON_BUTTON_COLORS),
120
- ICON_BUTTON_SIZES: Object.freeze(ICON_BUTTON_SIZES),
121
- ICONS: Object.freeze(ICONS),
122
133
  isExpandedInternal: this.isExpanded,
123
134
  };
124
135
  },
@@ -22,13 +22,4 @@ export const MENU_ITEM_BACKGROUND_COLORS = {
22
22
 
23
23
  export type MenuItemBackgroundColor = Value<typeof MENU_ITEM_BACKGROUND_COLORS>;
24
24
 
25
- export const MENU_ITEM_ACCESSORY_STATES = {
26
- DOT: 'dot',
27
- // not implemented for now
28
- // EXPANDED: 'expanded',
29
- // COLLAPSED: 'collapsed',
30
- };
31
-
32
- export type MenuItemAccessoryState = Value<typeof MENU_ITEM_ACCESSORY_STATES>;
33
-
34
25
  export const MENU_ITEM_LEVEL_INJECTION_KEY: InjectionKey<number> = Symbol('menuItemLevel');
@@ -3,13 +3,13 @@ import { mount, shallowMount } from '@vue/test-utils';
3
3
  import { h } from 'vue';
4
4
  import MenuItem from './MenuItem.vue';
5
5
  import {
6
- MENU_ITEM_ACCESSORY_STATES,
7
6
  MENU_ITEM_BACKGROUND_COLORS,
8
7
  MENU_ITEM_LEVEL_INJECTION_KEY,
9
8
  MENU_ITEM_SIZES,
10
9
  MENU_ITEM_STATES,
11
10
  } from './MenuItem.consts';
12
11
  import { ICONS } from '../../Icons/Icon';
12
+ import { DsIconButton } from '../../../index';
13
13
 
14
14
  describe('MenuItem', () => {
15
15
  const createComponent = (props = {} as any, options = {}) => {
@@ -182,19 +182,93 @@ describe('MenuItem', () => {
182
182
  });
183
183
  });
184
184
 
185
- describe('Accessory state', () => {
186
- it('does not render accessory when accessoryState is null', () => {
187
- const wrapper = createComponent({ accessoryState: null });
185
+ describe('Expandable', () => {
186
+ it('does not render expandable icons when isExpandable is false', () => {
187
+ const wrapper = createComponent({ isExpandable: false });
188
188
 
189
- expect(wrapper.find('.ds-menuItem__accessory').exists()).toBe(false);
189
+ expect(wrapper.find('.ds-menuItem__expanderDotWrapper').exists()).toBe(false);
190
+ expect(wrapper.find('.ds-menuItem__expaneder').exists()).toBe(false);
190
191
  });
191
192
 
192
- it('renders dot accessory when accessoryState is dot', () => {
193
+ it('renders dot when isExpandable is true and no children slot set', () => {
193
194
  const wrapper = createComponent({
194
- accessoryState: MENU_ITEM_ACCESSORY_STATES.DOT,
195
+ isExpandable: true,
195
196
  });
196
197
 
197
- expect(wrapper.find('.ds-menuItem__accessory').exists()).toBe(true);
198
+ expect(wrapper.find('.ds-menuItem__expanderDotWrapper').exists()).toBe(true);
199
+ expect(wrapper.find('.ds-menuItem__expaneder').exists()).toBe(false);
200
+ });
201
+
202
+ it('renders chevron right icon button when isExpandable is true and children is set but not render children', () => {
203
+ const wrapper = createComponent(
204
+ {
205
+ isExpandable: true,
206
+ isExpanded: false,
207
+ },
208
+ {
209
+ slots: {
210
+ children: '<strong data-test-id="children-identifier">children</strong>',
211
+ },
212
+ },
213
+ );
214
+
215
+ expect(wrapper.find('.ds-menuItem__expanderDotWrapper').exists()).toBe(false);
216
+ const expanderIconButton =
217
+ wrapper.findComponent<typeof DsIconButton>('.ds-menuItem__expander');
218
+ expect(expanderIconButton.exists()).toBe(true);
219
+ expect(expanderIconButton.props().icon).toEqual(ICONS.FA_CHEVRON_RIGHT);
220
+ expect(wrapper.find('[data-test-id="children-identifier"]').exists()).toBe(false);
221
+ });
222
+
223
+ it('renders chevron down icon button when isExpandable is true and children is set and render it when is expanded', () => {
224
+ const wrapper = createComponent(
225
+ {
226
+ isExpandable: true,
227
+ isExpanded: true,
228
+ },
229
+ {
230
+ slots: {
231
+ children: '<strong data-test-id="children-identifier">children</strong>',
232
+ },
233
+ },
234
+ );
235
+
236
+ expect(wrapper.find('.ds-menuItem__expanderDotWrapper').exists()).toBe(false);
237
+ const expanderIconButton =
238
+ wrapper.findComponent<typeof DsIconButton>('.ds-menuItem__expander');
239
+ expect(expanderIconButton.exists()).toBe(true);
240
+ expect(expanderIconButton.props().icon).toEqual(ICONS.FA_CHEVRON_DOWN);
241
+ expect(wrapper.find('[data-test-id="children-identifier"]').exists()).toBe(true);
242
+ });
243
+
244
+ it('should change children and icon state when clicking on expander icon', async () => {
245
+ const wrapper = createComponent(
246
+ {
247
+ isExpandable: true,
248
+ isExpanded: false,
249
+ },
250
+ {
251
+ slots: {
252
+ children: '<strong data-test-id="children-identifier">children</strong>',
253
+ },
254
+ },
255
+ );
256
+
257
+ const expanderIconButton =
258
+ wrapper.findComponent<typeof DsIconButton>('.ds-menuItem__expander');
259
+ expect(expanderIconButton.exists()).toBe(true);
260
+ expect(expanderIconButton.props().icon).toEqual(ICONS.FA_CHEVRON_RIGHT);
261
+ expect(wrapper.find('[data-test-id="children-identifier"]').exists()).toBe(false);
262
+
263
+ await expanderIconButton.trigger('click');
264
+
265
+ expect(expanderIconButton.props().icon).toEqual(ICONS.FA_CHEVRON_DOWN);
266
+ expect(wrapper.find('[data-test-id="children-identifier"]').exists()).toBe(true);
267
+
268
+ await expanderIconButton.trigger('click');
269
+
270
+ expect(expanderIconButton.props().icon).toEqual(ICONS.FA_CHEVRON_RIGHT);
271
+ expect(wrapper.find('[data-test-id="children-identifier"]').exists()).toBe(false);
198
272
  });
199
273
  });
200
274
 
@@ -355,7 +429,7 @@ describe('MenuItem', () => {
355
429
  additionalText: '',
356
430
  index: null,
357
431
  iconLeft: null,
358
- accessoryState: null,
432
+ isExpandable: false,
359
433
  },
360
434
  });
361
435
 
@@ -392,14 +466,6 @@ describe('MenuItem', () => {
392
466
  expect(wrapper.find('.ds-menuItem').exists()).toBe(true);
393
467
  });
394
468
 
395
- it('renders when accessoryState is provided', () => {
396
- const wrapper = createComponent({
397
- label: '',
398
- accessoryState: MENU_ITEM_ACCESSORY_STATES.DOT,
399
- });
400
- expect(wrapper.find('.ds-menuItem').exists()).toBe(true);
401
- });
402
-
403
469
  it('renders right content section when needed', () => {
404
470
  // Should not render right content by default
405
471
  const wrapper1 = createComponent();