design-system-next 2.26.2 → 2.26.6

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.
@@ -8,6 +8,7 @@ import type { RadioPropTypes, RadioEmitTypes } from './radio';
8
8
 
9
9
  interface RadioClasses {
10
10
  baseClasses: string;
11
+ baseInputClasses: string;
11
12
  baseIndicatorClasses: string;
12
13
  labelClasses: string;
13
14
  borderedClasses: string;
@@ -18,13 +19,24 @@ export const useRadioButton = (
18
19
  emit: SetupContext<RadioEmitTypes>['emit'],
19
20
  slots: Record<string, unknown>,
20
21
  ) => {
21
- const { modelValue, disabled, description, bordered, fullWidth } = toRefs(props);
22
+ const { modelValue, disabled, description, bordered, fullWidth, choiceBox } = toRefs(props);
22
23
 
23
24
  const radioRef = ref<HTMLInputElement | null>(null);
24
25
  const isHovered = useElementHover(radioRef);
25
26
 
26
27
  const radioClasses: ComputedRef<RadioClasses> = computed(() => {
27
- const baseClasses = classNames('spr-sr-only spr-peer spr-inline-block', {
28
+ const baseClasses = classNames('spr-relative spr-m-0', {
29
+ 'spr-inline-block': !choiceBox.value,
30
+ 'spr-block': choiceBox.value,
31
+ 'spr-w-full': fullWidth.value || choiceBox.value,
32
+ 'spr-align-middle': !choiceBox.value,
33
+ 'spr-border-color spr-border-color-weak spr-border spr-border-solid spr-p-2 spr-rounded-lg spr-transition spr-ease-in-out spr-duration-150 active:spr-scale-[0.98]':
34
+ choiceBox.value,
35
+ 'spr-cursor-pointer': choiceBox.value && !disabled.value,
36
+ 'spr-cursor-not-allowed': disabled.value && choiceBox.value,
37
+ });
38
+
39
+ const baseInputClasses = classNames('spr-sr-only spr-peer spr-inline-block', {
28
40
  'spr-cursor-not-allowed': disabled.value,
29
41
  });
30
42
 
@@ -121,6 +133,7 @@ export const useRadioButton = (
121
133
 
122
134
  return {
123
135
  baseClasses,
136
+ baseInputClasses,
124
137
  baseIndicatorClasses,
125
138
  labelClasses,
126
139
  borderedClasses,
@@ -132,6 +145,7 @@ export const useRadioButton = (
132
145
  return {
133
146
  radioRef,
134
147
  radioClasses,
148
+ isHovered,
135
149
  proxyValue,
136
150
  description,
137
151
  bordered,
@@ -209,6 +209,10 @@ export const multiSelectPropTypes = {
209
209
  type: Boolean,
210
210
  default: false,
211
211
  },
212
+ allowSelectAll: {
213
+ type: Boolean,
214
+ default: false,
215
+ },
212
216
  };
213
217
 
214
218
  export const multiSelectEmitTypes = {
@@ -165,6 +165,7 @@
165
165
  :display-list-item-selected="props.displayListItemSelected"
166
166
  :disabled-local-search="props.disabledLocalSearch"
167
167
  :disabled-unselected-items="props.disabledUnselectedItems"
168
+ :allow-select-all="props.allowSelectAll"
168
169
  multi-select
169
170
  @update:model-value="handleMultiSelectedItem"
170
171
  @get-single-selected-item="emit('get-single-selected-item', $event)"
@@ -268,8 +268,9 @@ export const useMultiSelect = (props: MultiSelectPropTypes, emit: SetupContext<M
268
268
  }
269
269
 
270
270
  // Always keep multiSelectedListItems in sync with selected values
271
+ const seenValues = new Set<string>();
271
272
  multiSelectedListItems.value = multiSelectOptions.value.filter((item) => {
272
- return values.some((val) => {
273
+ const isMatch = values.some((val) => {
273
274
  let itemVal = item.value;
274
275
  let valToCompare = val;
275
276
 
@@ -292,6 +293,16 @@ export const useMultiSelect = (props: MultiSelectPropTypes, emit: SetupContext<M
292
293
  }
293
294
  return itemVal == valToCompare;
294
295
  });
296
+
297
+ if (isMatch) {
298
+ const itemKey = typeof item.value === 'object' ? JSON.stringify(item.value) : String(item.value);
299
+ if (seenValues.has(itemKey)) {
300
+ return false; // Skip duplicates
301
+ }
302
+ seenValues.add(itemKey);
303
+ }
304
+
305
+ return isMatch;
295
306
  });
296
307
 
297
308
  // Determine input text based on whether count-only mode is enabled