simplesvelte 2.4.8 → 2.4.9

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/Input.svelte CHANGED
@@ -23,6 +23,7 @@
23
23
  | 'file'
24
24
  | 'checkbox'
25
25
  error?: string
26
+ hideOptional?: boolean
26
27
  zodErrors?: {
27
28
  expected: string
28
29
  code: string
@@ -41,6 +42,7 @@
41
42
  disabled,
42
43
  class: myClass,
43
44
  error,
45
+ hideOptional,
44
46
  zodErrors,
45
47
  ...rest
46
48
  }: Props = $props()
@@ -101,6 +103,7 @@
101
103
  })
102
104
 
103
105
  let showOptional = $derived.by(() => {
106
+ if (hideOptional) return false
104
107
  return !required && !disabled && type != 'checkbox'
105
108
  })
106
109
 
@@ -8,6 +8,7 @@ type Props = {
8
8
  element?: HTMLElement;
9
9
  type?: 'text' | 'number' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'date' | 'datetime-local' | 'color' | 'file' | 'checkbox';
10
10
  error?: string;
11
+ hideOptional?: boolean;
11
12
  zodErrors?: {
12
13
  expected: string;
13
14
  code: string;
@@ -26,6 +26,7 @@
26
26
  disabled?: boolean
27
27
  multiple?: boolean
28
28
  error?: string
29
+ hideOptional?: boolean
29
30
  zodErrors?: {
30
31
  expected: string
31
32
  code: string
@@ -48,6 +49,7 @@
48
49
  multiple = false,
49
50
  placeholder = 'Select an item...',
50
51
  error,
52
+ hideOptional,
51
53
  zodErrors,
52
54
  onchange,
53
55
  }: Props = $props()
@@ -468,7 +470,7 @@
468
470
  }
469
471
  </script>
470
472
 
471
- <Label {label} {name} optional={!required} class={className} error={errorText}>
473
+ <Label {label} {name} optional={!required && !hideOptional} class={className} error={errorText}>
472
474
  {#if !disabled}
473
475
  <!-- Trigger button with popover target and anchor positioning -->
474
476
  <button
@@ -20,6 +20,7 @@ type Props = {
20
20
  disabled?: boolean;
21
21
  multiple?: boolean;
22
22
  error?: string;
23
+ hideOptional?: boolean;
23
24
  zodErrors?: {
24
25
  expected: string;
25
26
  code: string;
@@ -10,6 +10,7 @@
10
10
  disabled?: boolean
11
11
  element?: HTMLElement
12
12
  error?: string
13
+ hideOptional?: boolean
13
14
  zodErrors?: {
14
15
  expected: string
15
16
  code: string
@@ -27,6 +28,7 @@
27
28
  disabled,
28
29
  class: myClass,
29
30
  error,
31
+ hideOptional,
30
32
  zodErrors,
31
33
  ...rest
32
34
  }: Props = $props()
@@ -38,6 +40,6 @@
38
40
  })
39
41
  </script>
40
42
 
41
- <Label class={myClass} {label} {name} optional={!required} {disabled} error={errorText}>
43
+ <Label class={myClass} {label} {name} optional={!required && !hideOptional} {disabled} error={errorText}>
42
44
  <textarea bind:this={element} {disabled} {name} {required} class="textarea w-full" {...rest} bind:value></textarea>
43
45
  </Label>
@@ -7,6 +7,7 @@ type Props = {
7
7
  disabled?: boolean;
8
8
  element?: HTMLElement;
9
9
  error?: string;
10
+ hideOptional?: boolean;
10
11
  zodErrors?: {
11
12
  expected: string;
12
13
  code: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simplesvelte",
3
- "version": "2.4.8",
3
+ "version": "2.4.9",
4
4
  "scripts": {
5
5
  "dev": "bun vite dev",
6
6
  "build": "bun vite build && bun run prepack",