@r2digisolutions/components 0.21.9 → 0.21.10

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.
@@ -26,6 +26,9 @@
26
26
  min?: number;
27
27
  max?: number;
28
28
  step?: number;
29
+ maxLength?: number;
30
+ /** Show `n/max` counter (defaults on when `maxLength` is set). */
31
+ showCount?: boolean;
29
32
  oninput?: (e: Event) => void;
30
33
  onchange?: (e: Event) => void;
31
34
  onfocus?: (e: FocusEvent) => void;
@@ -53,6 +56,8 @@
53
56
  min,
54
57
  max,
55
58
  step,
59
+ maxLength,
60
+ showCount = maxLength != null,
56
61
  size = 'md',
57
62
  leadIcon,
58
63
  trailIcon,
@@ -157,6 +162,7 @@
157
162
  {min}
158
163
  {max}
159
164
  {step}
165
+ maxlength={maxLength}
160
166
  {autocomplete}
161
167
  aria-describedby={helperText ? helperId : undefined}
162
168
  aria-invalid={status === 'error'}
@@ -184,6 +190,7 @@
184
190
  {min}
185
191
  {max}
186
192
  {step}
193
+ maxlength={maxLength}
187
194
  {autocomplete}
188
195
  bind:value
189
196
  aria-describedby={helperText ? helperId : undefined}
@@ -246,9 +253,25 @@
246
253
  {/if}
247
254
  </div>
248
255
 
249
- {#if helperText}
250
- <p id={helperId} class={['text-xs leading-relaxed', statusTextClasses[status]]}>
251
- {helperText}
252
- </p>
256
+ {#if helperText || (showCount && maxLength != null)}
257
+ <div class="flex items-center justify-between gap-2 text-xs">
258
+ {#if helperText}
259
+ <p id={helperId} class={['leading-relaxed', statusTextClasses[status]]}>
260
+ {helperText}
261
+ </p>
262
+ {:else}
263
+ <span></span>
264
+ {/if}
265
+ {#if showCount && maxLength != null}
266
+ <span
267
+ class={[
268
+ 'font-mono shrink-0 ml-auto tabular-nums',
269
+ value.length >= maxLength ? 'font-semibold text-amber-600 dark:text-amber-400' : 'text-muted'
270
+ ]}
271
+ >
272
+ {value.length}/{maxLength}
273
+ </span>
274
+ {/if}
275
+ </div>
253
276
  {/if}
254
277
  </div>
@@ -22,6 +22,9 @@ interface InputProps {
22
22
  min?: number;
23
23
  max?: number;
24
24
  step?: number;
25
+ maxLength?: number;
26
+ /** Show `n/max` counter (defaults on when `maxLength` is set). */
27
+ showCount?: boolean;
25
28
  oninput?: (e: Event) => void;
26
29
  onchange?: (e: Event) => void;
27
30
  onfocus?: (e: FocusEvent) => void;
@@ -52,6 +52,8 @@
52
52
  required?: boolean;
53
53
  clearable?: boolean;
54
54
  size?: 'sm' | 'md' | 'lg';
55
+ maxLength?: number;
56
+ showCount?: boolean;
55
57
  /**
56
58
  * When true and inside `<Form>`, keep `value` in sync with `form.data[name]`.
57
59
  * Uses the logical field name (strips Kit `/formId` when present).
@@ -90,6 +92,8 @@
90
92
  required = false,
91
93
  clearable = false,
92
94
  size = 'md',
95
+ maxLength,
96
+ showCount = maxLength != null,
93
97
  bindData = false,
94
98
  inputName,
95
99
  leadIcon,
@@ -184,6 +188,8 @@
184
188
  {required}
185
189
  {clearable}
186
190
  {size}
191
+ {maxLength}
192
+ {showCount}
187
193
  {leadIcon}
188
194
  {trailIcon}
189
195
  oninput={handleInput}
@@ -41,6 +41,8 @@ interface FormFieldProps {
41
41
  required?: boolean;
42
42
  clearable?: boolean;
43
43
  size?: 'sm' | 'md' | 'lg';
44
+ maxLength?: number;
45
+ showCount?: boolean;
44
46
  /**
45
47
  * When true and inside `<Form>`, keep `value` in sync with `form.data[name]`.
46
48
  * Uses the logical field name (strips Kit `/formId` when present).
@@ -45,7 +45,7 @@
45
45
  required = false,
46
46
  rows = 3,
47
47
  maxLength,
48
- showCount = false,
48
+ showCount = maxLength != null,
49
49
  autoResize = false,
50
50
  bindData = false,
51
51
  class: className = '',
@@ -63,7 +63,7 @@
63
63
  </script>
64
64
 
65
65
  <div
66
- class={['w-full', className]}
66
+ class={[fullWidth || variant === 'underline' ? 'w-full' : 'w-auto', className]}
67
67
  role="tablist"
68
68
  aria-orientation="horizontal"
69
69
  >
@@ -6,7 +6,7 @@ const meta = {
6
6
  argTypes: {
7
7
  title: { control: 'text' },
8
8
  description: { control: 'text' },
9
- size: { control: 'select', options: ['xs', 'sm', 'md', 'lg', 'xl', 'full'] },
9
+ size: { control: 'select', options: ['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', 'full'] },
10
10
  tone: { control: 'select', options: ['default', 'info', 'success', 'warning', 'danger'] },
11
11
  position: { control: 'select', options: ['center', 'top'] },
12
12
  closeOnBackdrop: { control: 'boolean' },
@@ -6,7 +6,7 @@
6
6
  import type { Snippet } from 'svelte';
7
7
  import Button from '../../atoms/Button/Button.svelte';
8
8
 
9
- type DialogSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
9
+ type DialogSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full';
10
10
  type DialogTone = 'default' | 'info' | 'success' | 'warning' | 'danger';
11
11
  type FooterAlign = 'start' | 'center' | 'end' | 'between';
12
12
  type DialogPosition = 'center' | 'top';
@@ -87,6 +87,8 @@
87
87
  md: 'max-w-md',
88
88
  lg: 'max-w-lg',
89
89
  xl: 'max-w-2xl',
90
+ '2xl': 'max-w-4xl',
91
+ '3xl': 'max-w-5xl',
90
92
  full: ''
91
93
  };
92
94
 
@@ -284,9 +286,11 @@
284
286
  scrollable &&
285
287
  (size === 'full'
286
288
  ? 'overflow-auto'
287
- : size === 'xl'
288
- ? 'max-h-[min(70vh,36rem)] overflow-y-auto'
289
- : 'max-h-[min(60vh,28rem)] overflow-y-auto')
289
+ : size === '3xl' || size === '2xl'
290
+ ? 'max-h-[min(75vh,40rem)] overflow-y-auto'
291
+ : size === 'xl'
292
+ ? 'max-h-[min(70vh,36rem)] overflow-y-auto'
293
+ : 'max-h-[min(60vh,28rem)] overflow-y-auto')
290
294
  ]}
291
295
  >
292
296
  {@render children()}
@@ -1,5 +1,5 @@
1
1
  import type { Snippet } from 'svelte';
2
- type DialogSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
2
+ type DialogSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full';
3
3
  type DialogTone = 'default' | 'info' | 'success' | 'warning' | 'danger';
4
4
  type FooterAlign = 'start' | 'center' | 'end' | 'between';
5
5
  type DialogPosition = 'center' | 'top';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r2digisolutions/components",
3
- "version": "0.21.9",
3
+ "version": "0.21.10",
4
4
  "private": false,
5
5
  "description": "R2DigiSolutions Svelte 5 component library — Atomic Design, Tailwind 4, Light/Dark mode",
6
6
  "license": "MIT",