@meistrari/tela-build 1.50.4 → 1.51.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.
|
@@ -5,7 +5,7 @@ import * as MultipleSelectStories from './multiple-select.stories.ts';
|
|
|
5
5
|
|
|
6
6
|
# TelaMultipleSelect
|
|
7
7
|
|
|
8
|
-
A multiple select component that allows users to select multiple options from a dropdown list. Supports search functionality, grouping, icons, custom styling, and
|
|
8
|
+
A multiple select component that allows users to select multiple options from a dropdown list. Supports search functionality, grouping, icons, custom styling, and three display variants (list, preview, and compact). Perfect for selecting multiple items with rich option data.
|
|
9
9
|
|
|
10
10
|
## Examples
|
|
11
11
|
|
|
@@ -132,6 +132,19 @@ Shows selected items inline with a compact display:
|
|
|
132
132
|
/>
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
+
### Compact Variant
|
|
136
|
+
|
|
137
|
+
Renders only the trigger — no selected-items block above it. Use for toolbar filters, usually with a custom `#trigger` slot showing a selection count:
|
|
138
|
+
|
|
139
|
+
```vue
|
|
140
|
+
<TelaMultipleSelect
|
|
141
|
+
v-model="selected"
|
|
142
|
+
:options="options"
|
|
143
|
+
variant="compact"
|
|
144
|
+
allow-search
|
|
145
|
+
/>
|
|
146
|
+
```
|
|
147
|
+
|
|
135
148
|
### With Description
|
|
136
149
|
|
|
137
150
|
```vue
|
|
@@ -206,7 +219,7 @@ type MultipleSelectProps = {
|
|
|
206
219
|
closeButtonLabel?: string
|
|
207
220
|
closeOnSelect?: boolean
|
|
208
221
|
buttonIcon?: string
|
|
209
|
-
variant?: 'list' | 'preview'
|
|
222
|
+
variant?: 'list' | 'preview' | 'compact'
|
|
210
223
|
previewMaxItems?: number
|
|
211
224
|
description?: string
|
|
212
225
|
}
|
|
@@ -29,9 +29,10 @@ const props = withDefaults(defineProps<{
|
|
|
29
29
|
closeButtonLabel?: string
|
|
30
30
|
closeOnSelect?: boolean
|
|
31
31
|
buttonIcon?: string
|
|
32
|
-
variant?: 'list' | 'preview'
|
|
32
|
+
variant?: 'list' | 'preview' | 'compact'
|
|
33
33
|
previewMaxItems?: number
|
|
34
34
|
description?: string
|
|
35
|
+
avatarOptions?: boolean
|
|
35
36
|
}>(), {
|
|
36
37
|
maxSelectedDisplay: 10,
|
|
37
38
|
searchPlaceholder: 'Search options...',
|
|
@@ -375,7 +376,10 @@ function selectAll() {
|
|
|
375
376
|
<Component :is="option.icon" v-else class="!w-12px !h-12px" />
|
|
376
377
|
</div>
|
|
377
378
|
<div v-if="!option.icon && option.externalIconSrc" w-16px h-16px flex items-center justify-center flex-shrink-0>
|
|
378
|
-
<img :src="option.externalIconSrc" alt="" w-16px h-16px>
|
|
379
|
+
<img :src="option.externalIconSrc" alt="" w-16px h-16px :class="avatarOptions ? 'rounded-full object-cover' : ''">
|
|
380
|
+
</div>
|
|
381
|
+
<div v-else-if="!option.icon && avatarOptions" w-16px h-16px flex items-center justify-center flex-shrink-0>
|
|
382
|
+
<div w-14px h-14px rounded-full bg-gray-200 />
|
|
379
383
|
</div>
|
|
380
384
|
<div flex-1 flex items-center justify-start w-full overflow-hidden>
|
|
381
385
|
<span :title="option.label" truncate>{{ option.label }}</span>
|
|
@@ -626,7 +630,10 @@ function selectAll() {
|
|
|
626
630
|
<Component :is="option.icon" v-else class="!w-24px !h-24px" />
|
|
627
631
|
</div>
|
|
628
632
|
<div v-if="!option.icon && option.externalIconSrc" mr-12px rounded-4px w-16px h-36px flex items-center justify-center>
|
|
629
|
-
<img :src="option.externalIconSrc" alt="" min-w-18px h-18px>
|
|
633
|
+
<img :src="option.externalIconSrc" alt="" min-w-18px h-18px :class="avatarOptions ? 'rounded-full object-cover' : ''">
|
|
634
|
+
</div>
|
|
635
|
+
<div v-else-if="!option.icon && avatarOptions" mr-12px w-16px h-36px flex items-center justify-center>
|
|
636
|
+
<div min-w-18px h-18px rounded-full bg-gray-200 />
|
|
630
637
|
</div>
|
|
631
638
|
<div flex="~ col" overflow-hidden>
|
|
632
639
|
<p text="gray-900" body-14-medium text-start truncate :title="option.label">
|
|
@@ -655,7 +662,7 @@ function selectAll() {
|
|
|
655
662
|
<SelectScrollDownButton class="flex items-center justify-center h-25px bg-white text-dark cursor-default">
|
|
656
663
|
<TelaIcon name="i-ph-caret-down" text="16px" />
|
|
657
664
|
</SelectScrollDownButton>
|
|
658
|
-
<div class="p-8px border-t border-gray-300">
|
|
665
|
+
<div class="p-8px" :class="variant === 'compact' ? '' : 'border-t border-gray-300'">
|
|
659
666
|
<TelaButton variant="secondary" w-full @click="isOpen = false">
|
|
660
667
|
{{ closeButtonLabel }}
|
|
661
668
|
</TelaButton>
|
|
@@ -7,6 +7,7 @@ const props = defineProps<{
|
|
|
7
7
|
modelValue: boolean
|
|
8
8
|
size?: 'xs' | 'sm' | 'md'
|
|
9
9
|
class?: HTMLAttributes['class']
|
|
10
|
+
inactiveIconClass?: string
|
|
10
11
|
}>()
|
|
11
12
|
|
|
12
13
|
const emit = defineEmits<{
|
|
@@ -33,7 +34,7 @@ watch(() => props.modelValue, (newValue, oldValue) => {
|
|
|
33
34
|
color="secondary"
|
|
34
35
|
:size="size"
|
|
35
36
|
:class="cn(modelValue && 'hover:bg-amber-100!', props.class)"
|
|
36
|
-
:icon-class="cn('relative z-1', modelValue ? 'text-amber-400!' : 'text-neutral-400!')"
|
|
37
|
+
:icon-class="cn('relative z-1', modelValue ? 'text-amber-400!' : (props.inactiveIconClass ?? 'text-neutral-400!'))"
|
|
37
38
|
@click.stop.prevent="emit('update:modelValue', !modelValue)"
|
|
38
39
|
/>
|
|
39
40
|
<div v-if="shouldExplode" absolute pointer-events-none z-0 class="top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2">
|