design-system-next 2.17.6 → 2.17.7

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.
@@ -1,6 +1,6 @@
1
- import { computed, type Ref } from "vue";
2
- import type { BannerPropTypes } from "./banner";
3
- import classNames from "classnames";
1
+ import { computed, type Ref } from 'vue';
2
+ import type { BannerPropTypes } from './banner';
3
+ import classNames from 'classnames';
4
4
 
5
5
  interface BannerClasses {
6
6
  base: string;
@@ -11,7 +11,7 @@ interface BannerClasses {
11
11
  }
12
12
 
13
13
  export const useBanner = (props: BannerPropTypes, showModel: Ref<boolean>) => {
14
- const closeBanner = () => showModel.value = false;
14
+ const closeBanner = () => (showModel.value = false);
15
15
 
16
16
  const bannerClasses = computed<BannerClasses>(() => {
17
17
  const base = classNames(
@@ -22,45 +22,34 @@ export const useBanner = (props: BannerPropTypes, showModel: Ref<boolean>) => {
22
22
  'spr-background-color-information-weak': props.type === 'info',
23
23
  'spr-background-color-pending-weak': props.type === 'pending',
24
24
  'spr-background-color-caution-weak': props.type === 'caution',
25
- }
25
+ },
26
26
  );
27
27
 
28
- const content = classNames(
29
- 'spr-flex-auto'
30
- );
28
+ const content = classNames('spr-flex-auto');
31
29
 
32
- const icon = classNames(
33
- 'spr-mt-[2px]',
34
- {
35
- 'spr-text-color-brand-base': props.type === 'success',
36
- 'spr-text-color-danger-base': props.type === 'error',
37
- 'spr-text-color-information-base': props.type === 'info',
38
- 'spr-text-color-pending-base': props.type === 'pending',
39
- 'spr-text-color-caution-base': props.type === 'caution',
40
- }
41
- );
30
+ const icon = classNames({
31
+ 'spr-text-color-brand-base': props.type === 'success',
32
+ 'spr-text-color-danger-base': props.type === 'error',
33
+ 'spr-text-color-information-base': props.type === 'info',
34
+ 'spr-text-color-pending-base': props.type === 'pending',
35
+ 'spr-text-color-caution-base': props.type === 'caution',
36
+ });
42
37
 
43
- const message = classNames(
44
- 'spr-body-sm-regular',
45
- {
46
- 'spr-text-color-brand-base': props.type === 'success',
47
- 'spr-text-color-danger-pressed': props.type === 'error',
48
- 'spr-text-color-information-pressed': props.type === 'info',
49
- 'spr-text-color-pending-pressed': props.type === 'pending',
50
- 'spr-text-color-caution-pressed': props.type === 'caution',
51
- }
52
- );
38
+ const message = classNames('spr-block spr-m-0 spr-body-sm-regular', {
39
+ 'spr-text-color-brand-base': props.type === 'success',
40
+ 'spr-text-color-danger-pressed': props.type === 'error',
41
+ 'spr-text-color-information-pressed': props.type === 'info',
42
+ 'spr-text-color-pending-pressed': props.type === 'pending',
43
+ 'spr-text-color-caution-pressed': props.type === 'caution',
44
+ });
53
45
 
54
- const close = classNames(
55
- 'spr-flex-none spr-cursor-pointer spr-mt-[2px]',
56
- {
57
- 'spr-text-color-brand-base': props.type === 'success',
58
- 'spr-text-color-danger-base': props.type === 'error',
59
- 'spr-text-color-information-base': props.type === 'info',
60
- 'spr-text-color-pending-base': props.type === 'pending',
61
- 'spr-text-color-caution-base': props.type === 'caution',
62
- }
63
- );
46
+ const close = classNames('spr-flex-none spr-cursor-pointer spr-mt-[2px]', {
47
+ 'spr-text-color-brand-base': props.type === 'success',
48
+ 'spr-text-color-danger-base': props.type === 'error',
49
+ 'spr-text-color-information-base': props.type === 'info',
50
+ 'spr-text-color-pending-base': props.type === 'pending',
51
+ 'spr-text-color-caution-base': props.type === 'caution',
52
+ });
64
53
 
65
54
  return {
66
55
  base,
@@ -68,7 +57,7 @@ export const useBanner = (props: BannerPropTypes, showModel: Ref<boolean>) => {
68
57
  icon,
69
58
  message,
70
59
  close,
71
- }
60
+ };
72
61
  });
73
62
 
74
63
  const bannerIcon = computed(() => {
@@ -123,6 +123,10 @@ export const multiSelectPropTypes = {
123
123
  type: String,
124
124
  default: '',
125
125
  },
126
+ displaySelectedCountOnly: {
127
+ type: Boolean,
128
+ default: false,
129
+ },
126
130
  displayHelper: {
127
131
  type: Boolean,
128
132
  default: false,
@@ -33,14 +33,27 @@
33
33
  <div ref="chippedInputTextRef" :class="multiSelectClasses.chippedInputTextClasses">
34
34
  <div class="spr-h-auto spr-w-full">
35
35
  <template v-if="multiSelectedListItems.length > 0">
36
- <template v-for="item in multiSelectedListItems" :key="item.value">
37
- <spr-chips
38
- class="spr-m-1 spr-inline-block"
39
- :label="String(item.text)"
40
- closable
41
- visible
42
- @close="handleChippedRemoveItem(String(item.value))"
43
- />
36
+ <template v-if="!props.displaySelectedCountOnly">
37
+ <template v-for="item in multiSelectedListItems" :key="item.value">
38
+ <spr-chips
39
+ class="spr-m-1 spr-inline-block"
40
+ :label="String(item.text)"
41
+ closable
42
+ visible
43
+ @close="handleChippedRemoveItem(String(item.value))"
44
+ />
45
+ </template>
46
+ </template>
47
+ <template v-else>
48
+ <span
49
+ class="spr-text-color-supporting spr-px-3"
50
+ :aria-label="`${multiSelectedListItems.length} selected options`"
51
+ >
52
+ {{ multiSelectedListItems.length }} item{{
53
+ multiSelectedListItems.length === 1 ? '' : 's'
54
+ }}
55
+ selected
56
+ </span>
44
57
  </template>
45
58
  </template>
46
59
  <template v-else>
@@ -297,7 +297,12 @@ export const useMultiSelect = (props: MultiSelectPropTypes, emit: SetupContext<M
297
297
  });
298
298
  }
299
299
 
300
- if (multiSelectedListItems.value.length > 3) {
300
+ // Determine input text based on whether count-only mode is enabled
301
+ if (props.displaySelectedCountOnly && multiSelectedListItems.value.length) {
302
+ inputText.value = `${multiSelectedListItems.value.length} item${
303
+ multiSelectedListItems.value.length === 1 ? '' : 's'
304
+ } selected`;
305
+ } else if (multiSelectedListItems.value.length > 3) {
301
306
  inputText.value = `${multiSelectedListItems.value.length} items selected`;
302
307
  } else {
303
308
  inputText.value = multiSelectedListItems.value.map((item) => item.text).join(', ');
@@ -408,5 +413,6 @@ export const useMultiSelect = (props: MultiSelectPropTypes, emit: SetupContext<M
408
413
  handleMultiSelectedItem,
409
414
  handleChippedRemoveItem,
410
415
  handleClear,
416
+ normalizedValue,
411
417
  };
412
418
  };