@sentropic/design-system-svelte 0.11.0 → 0.13.0
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/Avatar.svelte +161 -0
- package/dist/Avatar.svelte.d.ts +21 -0
- package/dist/Avatar.svelte.d.ts.map +1 -0
- package/dist/AvatarGroup.svelte +114 -0
- package/dist/AvatarGroup.svelte.d.ts +17 -0
- package/dist/AvatarGroup.svelte.d.ts.map +1 -0
- package/dist/ButtonGroup.svelte +130 -0
- package/dist/ButtonGroup.svelte.d.ts +21 -0
- package/dist/ButtonGroup.svelte.d.ts.map +1 -0
- package/dist/CheckboxGroup.svelte +116 -0
- package/dist/CheckboxGroup.svelte.d.ts +29 -0
- package/dist/CheckboxGroup.svelte.d.ts.map +1 -0
- package/dist/Collapsible.svelte +130 -0
- package/dist/Collapsible.svelte.d.ts +15 -0
- package/dist/Collapsible.svelte.d.ts.map +1 -0
- package/dist/ForceGraph.svelte +65 -14
- package/dist/ForceGraph.svelte.d.ts +12 -0
- package/dist/ForceGraph.svelte.d.ts.map +1 -1
- package/dist/RadioGroup.svelte +111 -0
- package/dist/RadioGroup.svelte.d.ts +26 -0
- package/dist/RadioGroup.svelte.d.ts.map +1 -0
- package/dist/Stepper.svelte +257 -0
- package/dist/Stepper.svelte.d.ts +22 -0
- package/dist/Stepper.svelte.d.ts.map +1 -0
- package/dist/Typography.svelte +219 -0
- package/dist/Typography.svelte.d.ts +22 -0
- package/dist/Typography.svelte.d.ts.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ChevronDown } from "@lucide/svelte";
|
|
3
|
+
import type { Snippet } from "svelte";
|
|
4
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
5
|
+
|
|
6
|
+
type CollapsibleProps = Omit<HTMLAttributes<HTMLDivElement>, "class" | "title"> & {
|
|
7
|
+
/** État ouvert (bindable). */
|
|
8
|
+
open?: boolean;
|
|
9
|
+
title: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
onToggle?: (open: boolean) => void;
|
|
12
|
+
class?: string;
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
open = $bindable(false),
|
|
18
|
+
title,
|
|
19
|
+
disabled = false,
|
|
20
|
+
onToggle,
|
|
21
|
+
class: className,
|
|
22
|
+
children,
|
|
23
|
+
...rest
|
|
24
|
+
}: CollapsibleProps = $props();
|
|
25
|
+
|
|
26
|
+
const uid = `st-collapsible-${Math.random().toString(36).slice(2, 9)}`;
|
|
27
|
+
|
|
28
|
+
const classes = $derived(
|
|
29
|
+
["st-collapsible", open ? "st-collapsible--open" : null, className].filter(Boolean).join(" ")
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
function toggle() {
|
|
33
|
+
if (disabled) return;
|
|
34
|
+
open = !open;
|
|
35
|
+
onToggle?.(open);
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<div {...rest} class={classes}>
|
|
40
|
+
<button
|
|
41
|
+
type="button"
|
|
42
|
+
class="st-collapsible__trigger"
|
|
43
|
+
aria-expanded={open ? "true" : "false"}
|
|
44
|
+
aria-controls={`${uid}-region`}
|
|
45
|
+
id={`${uid}-trigger`}
|
|
46
|
+
{disabled}
|
|
47
|
+
onclick={toggle}
|
|
48
|
+
>
|
|
49
|
+
<span class="st-collapsible__title">{title}</span>
|
|
50
|
+
<span class="st-collapsible__icon" aria-hidden="true">
|
|
51
|
+
<ChevronDown size={18} strokeWidth={2.25} />
|
|
52
|
+
</span>
|
|
53
|
+
</button>
|
|
54
|
+
{#if open}
|
|
55
|
+
<div
|
|
56
|
+
class="st-collapsible__region"
|
|
57
|
+
role="region"
|
|
58
|
+
id={`${uid}-region`}
|
|
59
|
+
aria-labelledby={`${uid}-trigger`}
|
|
60
|
+
>
|
|
61
|
+
{@render children?.()}
|
|
62
|
+
</div>
|
|
63
|
+
{/if}
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<style>
|
|
67
|
+
.st-collapsible {
|
|
68
|
+
color: var(--st-semantic-text-primary);
|
|
69
|
+
width: 100%;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.st-collapsible__trigger {
|
|
73
|
+
align-items: center;
|
|
74
|
+
background: transparent;
|
|
75
|
+
border: 0;
|
|
76
|
+
color: var(--st-component-accordion-text, inherit);
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
display: flex;
|
|
79
|
+
font: inherit;
|
|
80
|
+
font-size: var(--st-component-accordion-fontSize, 0.9375rem);
|
|
81
|
+
font-weight: var(--st-component-accordion-fontWeight, 650);
|
|
82
|
+
gap: 0.75rem;
|
|
83
|
+
justify-content: space-between;
|
|
84
|
+
line-height: var(--st-component-accordion-lineHeight, 1.3);
|
|
85
|
+
padding: var(--st-component-accordion-paddingBlock, 0.625rem)
|
|
86
|
+
var(--st-component-accordion-paddingInline, 0.25rem);
|
|
87
|
+
text-align: start;
|
|
88
|
+
transition: background-color var(--st-motion-fast, 120ms) var(--st-motion-easing, ease);
|
|
89
|
+
width: 100%;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.st-collapsible__trigger:hover:not(:disabled) {
|
|
93
|
+
background: var(--st-component-control-hoverBackground, var(--st-semantic-surface-subtle));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.st-collapsible__trigger:focus-visible {
|
|
97
|
+
outline: 2px solid var(--st-component-control-focusRing, var(--st-semantic-border-interactive));
|
|
98
|
+
outline-offset: -2px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.st-collapsible__trigger:disabled {
|
|
102
|
+
color: var(--st-semantic-text-muted);
|
|
103
|
+
cursor: not-allowed;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.st-collapsible__title {
|
|
107
|
+
flex: 1 1 auto;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.st-collapsible__icon {
|
|
111
|
+
align-items: center;
|
|
112
|
+
color: var(--st-semantic-text-secondary);
|
|
113
|
+
display: inline-flex;
|
|
114
|
+
flex: 0 0 auto;
|
|
115
|
+
height: 1.25rem;
|
|
116
|
+
justify-content: center;
|
|
117
|
+
transition: transform var(--st-motion-fast, 120ms) var(--st-motion-easing, ease);
|
|
118
|
+
width: 1.25rem;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.st-collapsible--open .st-collapsible__icon {
|
|
122
|
+
transform: rotate(180deg);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.st-collapsible__region {
|
|
126
|
+
color: var(--st-semantic-text-secondary);
|
|
127
|
+
line-height: 1.5;
|
|
128
|
+
padding: 0 0.25rem 0.625rem;
|
|
129
|
+
}
|
|
130
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
type CollapsibleProps = Omit<HTMLAttributes<HTMLDivElement>, "class" | "title"> & {
|
|
4
|
+
/** État ouvert (bindable). */
|
|
5
|
+
open?: boolean;
|
|
6
|
+
title: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
onToggle?: (open: boolean) => void;
|
|
9
|
+
class?: string;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
};
|
|
12
|
+
declare const Collapsible: import("svelte").Component<CollapsibleProps, {}, "open">;
|
|
13
|
+
type Collapsible = ReturnType<typeof Collapsible>;
|
|
14
|
+
export default Collapsible;
|
|
15
|
+
//# sourceMappingURL=Collapsible.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Collapsible.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Collapsible.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG;IAChF,8BAA8B;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAgDJ,QAAA,MAAM,WAAW,0DAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
package/dist/ForceGraph.svelte
CHANGED
|
@@ -237,6 +237,18 @@
|
|
|
237
237
|
* by `edgeCurve * dist * factor`. Defaults to a light 0.15.
|
|
238
238
|
*/
|
|
239
239
|
edgeCurve?: number;
|
|
240
|
+
/**
|
|
241
|
+
* Repulsion multiplier controlling how spread out the layout is.
|
|
242
|
+
* >1 = graphe plus aéré, <1 = plus compact ; multiplie la force de
|
|
243
|
+
* répulsion sans toucher au fit-to-content. Defaults to 1. Clamped to
|
|
244
|
+
* [0.1, 10] internally to avoid layout explosions/collapses.
|
|
245
|
+
*/
|
|
246
|
+
repulsion?: number;
|
|
247
|
+
/**
|
|
248
|
+
* Called when the user hovers (or keyboard-focuses) a node, and again with
|
|
249
|
+
* null when the hover/focus ends. Intended for syncing an external panel.
|
|
250
|
+
*/
|
|
251
|
+
onNodeHover?: (node: ForceGraphNode | null) => void;
|
|
240
252
|
class?: string;
|
|
241
253
|
};
|
|
242
254
|
|
|
@@ -256,6 +268,8 @@
|
|
|
256
268
|
onEdgeHover,
|
|
257
269
|
legend,
|
|
258
270
|
edgeCurve = 0.15,
|
|
271
|
+
repulsion = 1,
|
|
272
|
+
onNodeHover,
|
|
259
273
|
class: className
|
|
260
274
|
}: ForceGraphProps = $props();
|
|
261
275
|
|
|
@@ -311,7 +325,8 @@
|
|
|
311
325
|
es: ForceGraphEdge[],
|
|
312
326
|
w: number,
|
|
313
327
|
h: number,
|
|
314
|
-
ticks: number
|
|
328
|
+
ticks: number,
|
|
329
|
+
repulsionFactor: number
|
|
315
330
|
): Map<string, { x: number; y: number }> {
|
|
316
331
|
const cx = w / 2;
|
|
317
332
|
const cy = h / 2;
|
|
@@ -339,7 +354,11 @@
|
|
|
339
354
|
|
|
340
355
|
const area = w * h;
|
|
341
356
|
const k = Math.sqrt(area / Math.max(ns.length, 1)); // ideal node distance
|
|
342
|
-
|
|
357
|
+
// Clamp the caller-supplied factor so extreme values can't explode or
|
|
358
|
+
// collapse the layout. >1 spreads nodes out, <1 packs them tighter; the
|
|
359
|
+
// fit-to-content viewBox is recomputed afterwards so spacing just fills space.
|
|
360
|
+
const clampedRepulsion = Math.min(Math.max(repulsionFactor, 0.1), 10);
|
|
361
|
+
const repulsion = k * k * 0.9 * clampedRepulsion;
|
|
343
362
|
const restLength = k * 0.8;
|
|
344
363
|
const springK = 0.04;
|
|
345
364
|
const gravity = 0.012;
|
|
@@ -426,7 +445,7 @@
|
|
|
426
445
|
// honouring the motion preference (no rAF loop, no jitter).
|
|
427
446
|
const layout = $derived.by(() => {
|
|
428
447
|
const ticks = Math.max(1, Math.round(iterations));
|
|
429
|
-
return runSimulation(nodes, edges, width, height, ticks);
|
|
448
|
+
return runSimulation(nodes, edges, width, height, ticks, repulsion);
|
|
430
449
|
});
|
|
431
450
|
|
|
432
451
|
const positionedNodes = $derived.by(() =>
|
|
@@ -584,6 +603,38 @@
|
|
|
584
603
|
return !(srcActive || tgtActive);
|
|
585
604
|
}
|
|
586
605
|
|
|
606
|
+
// ---------------------------------------------------------------------------
|
|
607
|
+
// Hover-connexe (demand 7): hovering a node fades the rest of the graph the
|
|
608
|
+
// same way selection does — the hovered node and its direct neighbours stay
|
|
609
|
+
// full, every other node dims, and only edges incident to the hovered node
|
|
610
|
+
// keep their opacity. Composes with selection (predicates OR'd together).
|
|
611
|
+
// ---------------------------------------------------------------------------
|
|
612
|
+
const hoveredNodeId = $derived(
|
|
613
|
+
hoveredNodeIndex != null ? (positionedNodes[hoveredNodeIndex]?.node.id ?? null) : null
|
|
614
|
+
);
|
|
615
|
+
const hoverActiveSet = $derived.by(() => {
|
|
616
|
+
const set = new Set<string>();
|
|
617
|
+
if (hoveredNodeId == null) return set;
|
|
618
|
+
set.add(hoveredNodeId);
|
|
619
|
+
const nb = adjacency.get(hoveredNodeId);
|
|
620
|
+
if (nb) for (const n of nb) set.add(n);
|
|
621
|
+
return set;
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
// A node is dimmed by hover when a node is hovered and this one is neither
|
|
625
|
+
// the hovered node nor one of its direct neighbours.
|
|
626
|
+
function isHoverDimmedNode(id: string): boolean {
|
|
627
|
+
if (hoveredNodeId == null) return false;
|
|
628
|
+
return !hoverActiveSet.has(id);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
// An edge is dimmed by hover when a node is hovered and the edge is not
|
|
632
|
+
// incident to it (keep only the hovered node's own edges full).
|
|
633
|
+
function isHoverDimmedEdge(e: ForceGraphEdge): boolean {
|
|
634
|
+
if (hoveredNodeId == null) return false;
|
|
635
|
+
return e.source !== hoveredNodeId && e.target !== hoveredNodeId;
|
|
636
|
+
}
|
|
637
|
+
|
|
587
638
|
// Keyboard handler for a node circle: Space/Enter → onSelect, Enter → onOpenEntity.
|
|
588
639
|
function handleNodeKeydown(id: string, e: KeyboardEvent) {
|
|
589
640
|
if (e.key === "Enter" || e.key === " ") {
|
|
@@ -734,7 +785,7 @@
|
|
|
734
785
|
class:st-forceGraph__edge--weak={e.edge.weak}
|
|
735
786
|
class:st-forceGraph__edge--emphasis={e.edge.emphasis}
|
|
736
787
|
class:st-forceGraph__edge--hovered={hoveredEdgeIndex === e.i}
|
|
737
|
-
class:st-forceGraph__edge--dim={isEdgeSelectionDimmed(e.edge)}
|
|
788
|
+
class:st-forceGraph__edge--dim={isEdgeSelectionDimmed(e.edge) || isHoverDimmedEdge(e.edge)}
|
|
738
789
|
d={e.path}
|
|
739
790
|
fill="none"
|
|
740
791
|
stroke-dasharray={e.dashArray}
|
|
@@ -747,7 +798,7 @@
|
|
|
747
798
|
class:st-forceGraph__edge--weak={e.edge.weak}
|
|
748
799
|
class:st-forceGraph__edge--emphasis={e.edge.emphasis}
|
|
749
800
|
class:st-forceGraph__edge--hovered={hoveredEdgeIndex === e.i}
|
|
750
|
-
class:st-forceGraph__edge--dim={isEdgeSelectionDimmed(e.edge)}
|
|
801
|
+
class:st-forceGraph__edge--dim={isEdgeSelectionDimmed(e.edge) || isHoverDimmedEdge(e.edge)}
|
|
751
802
|
x1={e.x1}
|
|
752
803
|
y1={e.y1}
|
|
753
804
|
x2={e.x2}
|
|
@@ -764,7 +815,7 @@
|
|
|
764
815
|
{#each positionedNodes as p (p.node.id)}
|
|
765
816
|
<g
|
|
766
817
|
class="st-forceGraph__node st-forceGraph__node--{p.tone}"
|
|
767
|
-
class:st-forceGraph__node--dim={(
|
|
818
|
+
class:st-forceGraph__node--dim={isHoverDimmedNode(p.node.id) || isSelectionDimmed(p.node.id)}
|
|
768
819
|
class:st-forceGraph__node--selected={selectedSet.has(p.node.id)}
|
|
769
820
|
class:st-forceGraph__node--focus={focusId === p.node.id}
|
|
770
821
|
transform="translate({p.x} {p.y})"
|
|
@@ -777,10 +828,10 @@
|
|
|
777
828
|
role="button"
|
|
778
829
|
aria-label="{p.title}{p.node.group !== undefined ? `: ${p.node.group}` : ''}"
|
|
779
830
|
aria-pressed={selectedSet.has(p.node.id)}
|
|
780
|
-
onmouseenter={() =>
|
|
781
|
-
onmouseleave={() =>
|
|
782
|
-
onfocus={() =>
|
|
783
|
-
onblur={() =>
|
|
831
|
+
onmouseenter={() => { hoveredNodeIndex = p.i; onNodeHover?.(p.node); }}
|
|
832
|
+
onmouseleave={() => { hoveredNodeIndex = null; onNodeHover?.(null); }}
|
|
833
|
+
onfocus={() => { hoveredNodeIndex = p.i; onNodeHover?.(p.node); }}
|
|
834
|
+
onblur={() => { hoveredNodeIndex = null; onNodeHover?.(null); }}
|
|
784
835
|
onclick={() => onSelect?.(p.node.id)}
|
|
785
836
|
ondblclick={() => onOpenEntity?.(p.node.id)}
|
|
786
837
|
onkeydown={(e) => handleNodeKeydown(p.node.id, e)}
|
|
@@ -793,10 +844,10 @@
|
|
|
793
844
|
role="button"
|
|
794
845
|
aria-label="{p.title}{p.node.group !== undefined ? `: ${p.node.group}` : ''}"
|
|
795
846
|
aria-pressed={selectedSet.has(p.node.id)}
|
|
796
|
-
onmouseenter={() =>
|
|
797
|
-
onmouseleave={() =>
|
|
798
|
-
onfocus={() =>
|
|
799
|
-
onblur={() =>
|
|
847
|
+
onmouseenter={() => { hoveredNodeIndex = p.i; onNodeHover?.(p.node); }}
|
|
848
|
+
onmouseleave={() => { hoveredNodeIndex = null; onNodeHover?.(null); }}
|
|
849
|
+
onfocus={() => { hoveredNodeIndex = p.i; onNodeHover?.(p.node); }}
|
|
850
|
+
onblur={() => { hoveredNodeIndex = null; onNodeHover?.(null); }}
|
|
800
851
|
onclick={() => onSelect?.(p.node.id)}
|
|
801
852
|
ondblclick={() => onOpenEntity?.(p.node.id)}
|
|
802
853
|
onkeydown={(e) => handleNodeKeydown(p.node.id, e)}
|
|
@@ -126,6 +126,18 @@ type ForceGraphProps = {
|
|
|
126
126
|
* by `edgeCurve * dist * factor`. Defaults to a light 0.15.
|
|
127
127
|
*/
|
|
128
128
|
edgeCurve?: number;
|
|
129
|
+
/**
|
|
130
|
+
* Repulsion multiplier controlling how spread out the layout is.
|
|
131
|
+
* >1 = graphe plus aéré, <1 = plus compact ; multiplie la force de
|
|
132
|
+
* répulsion sans toucher au fit-to-content. Defaults to 1. Clamped to
|
|
133
|
+
* [0.1, 10] internally to avoid layout explosions/collapses.
|
|
134
|
+
*/
|
|
135
|
+
repulsion?: number;
|
|
136
|
+
/**
|
|
137
|
+
* Called when the user hovers (or keyboard-focuses) a node, and again with
|
|
138
|
+
* null when the hover/focus ends. Intended for syncing an external panel.
|
|
139
|
+
*/
|
|
140
|
+
onNodeHover?: (node: ForceGraphNode | null) => void;
|
|
129
141
|
class?: string;
|
|
130
142
|
};
|
|
131
143
|
declare const ForceGraph: import("svelte").Component<ForceGraphProps, {}, "">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForceGraph.svelte.d.ts","sourceRoot":"","sources":["../src/lib/ForceGraph.svelte.ts"],"names":[],"mappings":"AAGE,MAAM,MAAM,cAAc,GACtB,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,GACrD,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;AAE1D,MAAM,MAAM,mBAAmB,GAC3B,KAAK,GAAG,QAAQ,GAChB,SAAS,GACT,MAAM,GACN,SAAS,GACT,KAAK,GAAG,QAAQ,GAChB,YAAY,GACZ,UAAU,CAAC;AAEf,yCAAyC;AACzC,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE7E,MAAM,MAAM,cAAc,GAAG;IAC3B,8CAA8C;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,gEAAgE;IAChE,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAC;CAC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abled?: boolean;
|
|
6
|
+
helperText?: string;
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import type { Snippet } from "svelte";
|
|
12
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
13
|
+
import Radio from "./Radio.svelte";
|
|
14
|
+
|
|
15
|
+
type RadioGroupProps = Omit<HTMLAttributes<HTMLFieldSetElement>, "class" | "onchange"> & {
|
|
16
|
+
legend: string;
|
|
17
|
+
/** Valeur sélectionnée (contrôlée). */
|
|
18
|
+
value?: string;
|
|
19
|
+
onchange?: (value: string) => void;
|
|
20
|
+
orientation?: "vertical" | "horizontal";
|
|
21
|
+
/** Nom partagé garantissant l'exclusivité radio. Requis. */
|
|
22
|
+
name: string;
|
|
23
|
+
options?: RadioGroupOption[];
|
|
24
|
+
helperText?: string;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
class?: string;
|
|
27
|
+
children?: Snippet;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
let {
|
|
31
|
+
legend,
|
|
32
|
+
value,
|
|
33
|
+
onchange,
|
|
34
|
+
orientation = "vertical",
|
|
35
|
+
name,
|
|
36
|
+
options = [],
|
|
37
|
+
helperText,
|
|
38
|
+
disabled = false,
|
|
39
|
+
class: className,
|
|
40
|
+
children,
|
|
41
|
+
...rest
|
|
42
|
+
}: RadioGroupProps = $props();
|
|
43
|
+
|
|
44
|
+
const classes = $derived(
|
|
45
|
+
["st-radioGroup", `st-radioGroup--${orientation}`, className].filter(Boolean).join(" ")
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
function select(optionValue: string) {
|
|
49
|
+
if (optionValue === value) return;
|
|
50
|
+
onchange?.(optionValue);
|
|
51
|
+
}
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<fieldset {...rest} class={classes} {disabled}>
|
|
55
|
+
<legend class="st-radioGroup__legend">{legend}</legend>
|
|
56
|
+
{#if helperText}
|
|
57
|
+
<p class="st-radioGroup__help">{helperText}</p>
|
|
58
|
+
{/if}
|
|
59
|
+
<div class="st-radioGroup__options">
|
|
60
|
+
{#each options as option (option.value)}
|
|
61
|
+
<Radio
|
|
62
|
+
label={option.label}
|
|
63
|
+
helperText={option.helperText}
|
|
64
|
+
{name}
|
|
65
|
+
value={option.value}
|
|
66
|
+
checked={value === option.value}
|
|
67
|
+
disabled={option.disabled}
|
|
68
|
+
onchange={() => select(option.value)}
|
|
69
|
+
/>
|
|
70
|
+
{/each}
|
|
71
|
+
{@render children?.()}
|
|
72
|
+
</div>
|
|
73
|
+
</fieldset>
|
|
74
|
+
|
|
75
|
+
<style>
|
|
76
|
+
.st-radioGroup {
|
|
77
|
+
border: 0;
|
|
78
|
+
margin: 0;
|
|
79
|
+
min-width: 0;
|
|
80
|
+
padding: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.st-radioGroup__legend {
|
|
84
|
+
color: var(--st-component-field-labelText, var(--st-semantic-text-primary));
|
|
85
|
+
font-size: 0.9375rem;
|
|
86
|
+
font-weight: 650;
|
|
87
|
+
line-height: 1.3;
|
|
88
|
+
padding: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.st-radioGroup__help {
|
|
92
|
+
color: var(--st-component-field-helpText, var(--st-semantic-text-secondary));
|
|
93
|
+
font-size: 0.8125rem;
|
|
94
|
+
margin: 0.25rem 0 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.st-radioGroup__options {
|
|
98
|
+
display: flex;
|
|
99
|
+
gap: var(--st-spacing-3, 0.75rem);
|
|
100
|
+
margin-top: var(--st-spacing-2, 0.5rem);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.st-radioGroup--vertical .st-radioGroup__options {
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.st-radioGroup--horizontal .st-radioGroup__options {
|
|
108
|
+
flex-direction: row;
|
|
109
|
+
flex-wrap: wrap;
|
|
110
|
+
}
|
|
111
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface RadioGroupOption {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
helperText?: string;
|
|
6
|
+
}
|
|
7
|
+
import type { Snippet } from "svelte";
|
|
8
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
9
|
+
type RadioGroupProps = Omit<HTMLAttributes<HTMLFieldSetElement>, "class" | "onchange"> & {
|
|
10
|
+
legend: string;
|
|
11
|
+
/** Valeur sélectionnée (contrôlée). */
|
|
12
|
+
value?: string;
|
|
13
|
+
onchange?: (value: string) => void;
|
|
14
|
+
orientation?: "vertical" | "horizontal";
|
|
15
|
+
/** Nom partagé garantissant l'exclusivité radio. Requis. */
|
|
16
|
+
name: string;
|
|
17
|
+
options?: RadioGroupOption[];
|
|
18
|
+
helperText?: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
class?: string;
|
|
21
|
+
children?: Snippet;
|
|
22
|
+
};
|
|
23
|
+
declare const RadioGroup: import("svelte").Component<RadioGroupProps, {}, "">;
|
|
24
|
+
type RadioGroup = ReturnType<typeof RadioGroup>;
|
|
25
|
+
export default RadioGroup;
|
|
26
|
+
//# sourceMappingURL=RadioGroup.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioGroup.svelte.d.ts","sourceRoot":"","sources":["../src/lib/RadioGroup.svelte.ts"],"names":[],"mappings":"AAGE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIpD,KAAK,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,GAAG;IACvF,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACxC,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAkDJ,QAAA,MAAM,UAAU,qDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
|