@r2digisolutions/components 0.22.0 → 0.22.2
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/components/molecules/DatePicker/DatePicker.svelte +1 -1
- package/dist/components/molecules/DropdownMenu/DropdownMenu.svelte +9 -5
- package/dist/components/molecules/FormSelect/FormSelect.svelte +4 -0
- package/dist/components/molecules/FormSelect/FormSelect.svelte.d.ts +2 -0
- package/dist/components/molecules/Select/Select.svelte +9 -2
- package/dist/components/molecules/Select/Select.svelte.d.ts +5 -0
- package/package.json +1 -1
|
@@ -419,11 +419,15 @@
|
|
|
419
419
|
{disabled}
|
|
420
420
|
onkeydown={onTriggerKeydown}
|
|
421
421
|
class={[
|
|
422
|
-
'
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
422
|
+
'inline-flex items-center font-medium transition-colors focus-visible:ring-brand-500/30 focus-visible:ring-2 focus-visible:outline-none',
|
|
423
|
+
trigger
|
|
424
|
+
? 'gap-0 rounded-lg border-0 bg-transparent p-0 text-inherit hover:bg-transparent'
|
|
425
|
+
: [
|
|
426
|
+
'gap-2 rounded-lg border border-border bg-surface-elevated text-primary',
|
|
427
|
+
'hover:bg-surface-overlay',
|
|
428
|
+
size === 'sm' ? 'min-h-8 px-2.5 text-xs' : 'min-h-9 px-3 text-sm'
|
|
429
|
+
],
|
|
430
|
+
disabled && 'cursor-not-allowed opacity-50'
|
|
427
431
|
]}
|
|
428
432
|
aria-label={trigger ? label : undefined}
|
|
429
433
|
aria-haspopup="menu"
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
required?: boolean;
|
|
25
25
|
searchable?: boolean;
|
|
26
26
|
size?: 'sm' | 'md' | 'lg';
|
|
27
|
+
/** Min width (px) of the open listbox — see Select `listboxMinWidth`. */
|
|
28
|
+
listboxMinWidth?: number;
|
|
27
29
|
/** Sync with `form.data[name]` when inside `<Form>`. */
|
|
28
30
|
bindData?: boolean;
|
|
29
31
|
class?: string;
|
|
@@ -44,6 +46,7 @@
|
|
|
44
46
|
required = false,
|
|
45
47
|
searchable = false,
|
|
46
48
|
size = 'md',
|
|
49
|
+
listboxMinWidth,
|
|
47
50
|
bindData = false,
|
|
48
51
|
class: className = '',
|
|
49
52
|
onchange
|
|
@@ -100,6 +103,7 @@
|
|
|
100
103
|
{required}
|
|
101
104
|
{searchable}
|
|
102
105
|
{size}
|
|
106
|
+
{listboxMinWidth}
|
|
103
107
|
status={resolved.status}
|
|
104
108
|
helperText={resolved.helperText}
|
|
105
109
|
bind:value
|
|
@@ -13,6 +13,8 @@ interface FormSelectProps {
|
|
|
13
13
|
required?: boolean;
|
|
14
14
|
searchable?: boolean;
|
|
15
15
|
size?: 'sm' | 'md' | 'lg';
|
|
16
|
+
/** Min width (px) of the open listbox — see Select `listboxMinWidth`. */
|
|
17
|
+
listboxMinWidth?: number;
|
|
16
18
|
/** Sync with `form.data[name]` when inside `<Form>`. */
|
|
17
19
|
bindData?: boolean;
|
|
18
20
|
class?: string;
|
|
@@ -30,6 +30,11 @@
|
|
|
30
30
|
*/
|
|
31
31
|
flyToSelected?: boolean;
|
|
32
32
|
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
33
|
+
/**
|
|
34
|
+
* Minimum width (px) for the open listbox. Defaults to the trigger width.
|
|
35
|
+
* Useful when option labels are longer than the field (e.g. contribution groups).
|
|
36
|
+
*/
|
|
37
|
+
listboxMinWidth?: number;
|
|
33
38
|
class?: string;
|
|
34
39
|
onchange?: (value: string) => void;
|
|
35
40
|
}
|
|
@@ -48,6 +53,7 @@
|
|
|
48
53
|
searchable = false,
|
|
49
54
|
flyToSelected = true,
|
|
50
55
|
size = 'md',
|
|
56
|
+
listboxMinWidth,
|
|
51
57
|
class: className = '',
|
|
52
58
|
onchange
|
|
53
59
|
}: SelectProps = $props();
|
|
@@ -222,8 +228,9 @@
|
|
|
222
228
|
const ceiling = Math.min(maxHeight, available);
|
|
223
229
|
listHeightCeiling = ceiling;
|
|
224
230
|
|
|
225
|
-
//
|
|
226
|
-
const
|
|
231
|
+
// Prefer trigger width; optionally grow for long labels (never past viewport).
|
|
232
|
+
const minW = Math.max(rect.width, listboxMinWidth ?? 0);
|
|
233
|
+
const width = Math.min(minW, viewW - margin * 2);
|
|
227
234
|
|
|
228
235
|
let left = rect.left;
|
|
229
236
|
if (left + width > viewLeft + viewW - margin) {
|
|
@@ -24,6 +24,11 @@ interface SelectProps {
|
|
|
24
24
|
*/
|
|
25
25
|
flyToSelected?: boolean;
|
|
26
26
|
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
27
|
+
/**
|
|
28
|
+
* Minimum width (px) for the open listbox. Defaults to the trigger width.
|
|
29
|
+
* Useful when option labels are longer than the field (e.g. contribution groups).
|
|
30
|
+
*/
|
|
31
|
+
listboxMinWidth?: number;
|
|
27
32
|
class?: string;
|
|
28
33
|
onchange?: (value: string) => void;
|
|
29
34
|
}
|