@r2digisolutions/components 0.22.1 → 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.
@@ -329,7 +329,7 @@
329
329
  ? 'w-full'
330
330
  : months === 2
331
331
  ? 'w-full max-w-xl'
332
- : 'w-full min-w-[18rem] max-w-[20rem]',
332
+ : 'w-full',
333
333
  className
334
334
  ]}
335
335
  >
@@ -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
- // Match the trigger: never narrower, never capped at an arbitrary px (was 320).
226
- const width = Math.min(Math.max(rect.width, 0), viewW - margin * 2);
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r2digisolutions/components",
3
- "version": "0.22.1",
3
+ "version": "0.22.2",
4
4
  "private": false,
5
5
  "description": "R2DigiSolutions Svelte 5 component library — Atomic Design, Tailwind 4, Light/Dark mode",
6
6
  "license": "MIT",