@samuel-charpentier/sform 0.0.3 → 0.0.4
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { CheckboxGroupInputProps, SelectOption } from '../types.js';
|
|
3
|
+
import Fieldset from '../utils/Fieldset.svelte';
|
|
3
4
|
|
|
4
5
|
let {
|
|
5
6
|
field,
|
|
@@ -29,10 +30,7 @@
|
|
|
29
30
|
}
|
|
30
31
|
</script>
|
|
31
32
|
|
|
32
|
-
<
|
|
33
|
-
{#if label}
|
|
34
|
-
<legend class={labelClass}>{label}</legend>
|
|
35
|
-
{/if}
|
|
33
|
+
<Fieldset {label} {labelClass} {className} {disabled}>
|
|
36
34
|
{#each normalizedOptions as option}
|
|
37
35
|
{@const fieldAttrs = getFieldAttrs(option.value)}
|
|
38
36
|
{@const uniqueId = `${name}-${option.value}`}
|
|
@@ -48,20 +46,9 @@
|
|
|
48
46
|
<span class="sform-checkbox-label">{option.label}</span>
|
|
49
47
|
</label>
|
|
50
48
|
{/each}
|
|
51
|
-
</
|
|
49
|
+
</Fieldset>
|
|
52
50
|
|
|
53
51
|
<style>
|
|
54
|
-
.sform-checkbox-group {
|
|
55
|
-
border: none;
|
|
56
|
-
padding: 0;
|
|
57
|
-
margin: 0;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.sform-checkbox-group legend {
|
|
61
|
-
padding: 0;
|
|
62
|
-
margin-bottom: 0.5rem;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
52
|
.sform-checkbox-option {
|
|
66
53
|
display: flex;
|
|
67
54
|
align-items: center;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { RadioInputProps, SelectOption } from '../types.js';
|
|
3
|
+
import Fieldset from '../utils/Fieldset.svelte';
|
|
3
4
|
|
|
4
5
|
let {
|
|
5
6
|
field,
|
|
@@ -29,10 +30,7 @@
|
|
|
29
30
|
}
|
|
30
31
|
</script>
|
|
31
32
|
|
|
32
|
-
<
|
|
33
|
-
{#if label}
|
|
34
|
-
<legend class={labelClass}>{label}</legend>
|
|
35
|
-
{/if}
|
|
33
|
+
<Fieldset {label} {labelClass} {className} {disabled}>
|
|
36
34
|
{#each normalizedOptions as option}
|
|
37
35
|
{@const fieldAttrs = getFieldAttrs(option.value)}
|
|
38
36
|
{@const uniqueId = `${name}-${option.value}`}
|
|
@@ -48,7 +46,7 @@
|
|
|
48
46
|
<span class="sform-radio-label">{option.label}</span>
|
|
49
47
|
</label>
|
|
50
48
|
{/each}
|
|
51
|
-
</
|
|
49
|
+
</Fieldset>
|
|
52
50
|
|
|
53
51
|
<style>
|
|
54
52
|
.sform-radio-group {
|
package/dist/Sform/types.d.ts
CHANGED
|
@@ -682,3 +682,13 @@ export interface MaskedInputProps extends BaseInputComponentProps, InputAffixPro
|
|
|
682
682
|
/** Whether to store the unmasked (raw) value. If true, stores '1234567890'. If false, stores '(123) 456-7890'. Default: true */
|
|
683
683
|
unmaskValue?: boolean;
|
|
684
684
|
}
|
|
685
|
+
/**
|
|
686
|
+
* Props for Fieldset utils component
|
|
687
|
+
*/
|
|
688
|
+
export type FieldsetProps = {
|
|
689
|
+
label?: string;
|
|
690
|
+
labelClass?: string;
|
|
691
|
+
className?: string;
|
|
692
|
+
disabled?: boolean;
|
|
693
|
+
children: Snippet;
|
|
694
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { FieldsetProps } from '../types';
|
|
4
|
+
|
|
5
|
+
let { label, labelClass, className, disabled, children }: FieldsetProps = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<fieldset class="sform-checkbox-group {className ?? ''}" {disabled}>
|
|
9
|
+
{#if label}
|
|
10
|
+
<legend class={labelClass}>{label}</legend>
|
|
11
|
+
{/if}
|
|
12
|
+
{@render children()}
|
|
13
|
+
</fieldset>
|
|
14
|
+
|
|
15
|
+
<style>
|
|
16
|
+
.sform-checkbox-group legend {
|
|
17
|
+
padding: 0.25rem 0.5rem;
|
|
18
|
+
margin: 0;
|
|
19
|
+
border: var(--sform-border-width) solid var(--sform-border);
|
|
20
|
+
background: var(--sform-bg);
|
|
21
|
+
border-radius: 0.25rem;
|
|
22
|
+
line-height: 1;
|
|
23
|
+
}
|
|
24
|
+
</style>
|