@sentropic/design-system-svelte 0.35.1 → 0.36.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/Calendar.svelte +28 -1
- package/dist/Calendar.svelte.d.ts +7 -0
- package/dist/Calendar.svelte.d.ts.map +1 -1
- package/dist/ContentSwitcher.svelte +6 -1
- package/dist/MenuPopover.svelte +101 -12
- package/dist/MenuPopover.svelte.d.ts.map +1 -1
- package/dist/RadioGroup.svelte +4 -1
- package/dist/TimeRangePicker.svelte +19 -1
- package/dist/TimeRangePicker.svelte.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/Calendar.svelte
CHANGED
|
@@ -27,6 +27,13 @@
|
|
|
27
27
|
locale?: string;
|
|
28
28
|
/** Mois affiché ("YYYY-MM"), contrôlable de l'extérieur. */
|
|
29
29
|
month?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Appelé avec le nouveau mois affiché ("YYYY-MM") quand il change par une
|
|
32
|
+
* navigation interne (boutons précédent/suivant, clavier qui franchit un
|
|
33
|
+
* mois, PageUp/PageDown). Jamais émis quand c'est le parent qui change la
|
|
34
|
+
* prop `month` (pas de boucle).
|
|
35
|
+
*/
|
|
36
|
+
onMonthChange?: (month: string) => void;
|
|
30
37
|
class?: string;
|
|
31
38
|
previousMonthLabel?: string;
|
|
32
39
|
nextMonthLabel?: string;
|
|
@@ -41,6 +48,7 @@
|
|
|
41
48
|
weekStartsOn = 1,
|
|
42
49
|
locale = "fr-FR",
|
|
43
50
|
month,
|
|
51
|
+
onMonthChange,
|
|
44
52
|
class: className,
|
|
45
53
|
previousMonthLabel,
|
|
46
54
|
nextMonthLabel,
|
|
@@ -204,6 +212,10 @@
|
|
|
204
212
|
return null;
|
|
205
213
|
}
|
|
206
214
|
|
|
215
|
+
function currentMonthId(): string {
|
|
216
|
+
return `${viewYear}-${String(viewMonth + 1).padStart(2, "0")}`;
|
|
217
|
+
}
|
|
218
|
+
|
|
207
219
|
function previousMonth() {
|
|
208
220
|
const targetMonth = viewMonth === 0 ? 11 : viewMonth - 1;
|
|
209
221
|
const targetYear = viewMonth === 0 ? viewYear - 1 : viewYear;
|
|
@@ -213,6 +225,7 @@
|
|
|
213
225
|
if (clamped) focusDate = clamped;
|
|
214
226
|
// Si clamped === null, le mois est entièrement hors-bornes : focusDate garde
|
|
215
227
|
// l'ancienne valeur — aucune cellule ne sera tabindex=0 car toutes sont disabled.
|
|
228
|
+
onMonthChange?.(currentMonthId());
|
|
216
229
|
}
|
|
217
230
|
|
|
218
231
|
function nextMonth() {
|
|
@@ -223,6 +236,7 @@
|
|
|
223
236
|
const clamped = clampToMonth(focusDate, targetYear, targetMonth);
|
|
224
237
|
if (clamped) focusDate = clamped;
|
|
225
238
|
// Si clamped === null, le mois est entièrement hors-bornes : idem.
|
|
239
|
+
onMonthChange?.(currentMonthId());
|
|
226
240
|
}
|
|
227
241
|
|
|
228
242
|
function pickDate(date: Date) {
|
|
@@ -322,6 +336,7 @@
|
|
|
322
336
|
if (next.getFullYear() !== viewYear || next.getMonth() !== viewMonth) {
|
|
323
337
|
viewYear = next.getFullYear();
|
|
324
338
|
viewMonth = next.getMonth();
|
|
339
|
+
onMonthChange?.(currentMonthId());
|
|
325
340
|
}
|
|
326
341
|
focusDate = startOfDay(next);
|
|
327
342
|
// Focus après rendu.
|
|
@@ -584,8 +599,20 @@
|
|
|
584
599
|
box-shadow: inset 0 0 0 1px var(--st-semantic-border-interactive);
|
|
585
600
|
}
|
|
586
601
|
|
|
602
|
+
/* Plage : teinte dérivée de la primaire (suit chaque thème), avec point
|
|
603
|
+
d'entrée de personnalisation. Le texte repasse en couleur primaire :
|
|
604
|
+
les jours hors-mois (.st-calendar__day--outside, texte atténué) resteraient
|
|
605
|
+
sinon sous 4.5:1 sur ce fond dans plusieurs thèmes. */
|
|
587
606
|
.st-calendar__day--inRange {
|
|
588
|
-
background: var(
|
|
607
|
+
background: var(
|
|
608
|
+
--st-component-calendar-rangeBackground,
|
|
609
|
+
color-mix(
|
|
610
|
+
in srgb,
|
|
611
|
+
var(--st-semantic-action-primary) 32%,
|
|
612
|
+
var(--st-component-popover-background, var(--st-semantic-surface-raised))
|
|
613
|
+
)
|
|
614
|
+
);
|
|
615
|
+
color: var(--st-component-popover-text, var(--st-semantic-text-primary));
|
|
589
616
|
}
|
|
590
617
|
|
|
591
618
|
.st-calendar__day--selected {
|
|
@@ -21,6 +21,13 @@ type CalendarProps = Omit<HTMLAttributes<HTMLDivElement>, "class" | "onchange">
|
|
|
21
21
|
locale?: string;
|
|
22
22
|
/** Mois affiché ("YYYY-MM"), contrôlable de l'extérieur. */
|
|
23
23
|
month?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Appelé avec le nouveau mois affiché ("YYYY-MM") quand il change par une
|
|
26
|
+
* navigation interne (boutons précédent/suivant, clavier qui franchit un
|
|
27
|
+
* mois, PageUp/PageDown). Jamais émis quand c'est le parent qui change la
|
|
28
|
+
* prop `month` (pas de boucle).
|
|
29
|
+
*/
|
|
30
|
+
onMonthChange?: (month: string) => void;
|
|
24
31
|
class?: string;
|
|
25
32
|
previousMonthLabel?: string;
|
|
26
33
|
nextMonthLabel?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Calendar.svelte.ts"],"names":[],"mappings":"AAGE;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;AAI7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,GAAG;IAChF,wEAAwE;IACxE,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,CAAC,KAA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AA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AA2aJ,QAAA,MAAM,QAAQ,mDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
|
|
@@ -114,9 +114,14 @@
|
|
|
114
114
|
outline-offset: 1px;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
/* Indicateur d'état non-chromatique : la pastille blanche sur piste claire
|
|
118
|
+
(~1.05:1) ne suffit pas (WCAG 1.4.11). L'anneau intérieur sur la bordure
|
|
119
|
+
interactive mesure >= 3:1 contre la piste sur tous les thèmes mesurés. */
|
|
117
120
|
.st-contentSwitcher__option--selected {
|
|
118
121
|
background: var(--st-semantic-surface-default);
|
|
119
|
-
box-shadow:
|
|
122
|
+
box-shadow:
|
|
123
|
+
inset 0 0 0 1px var(--st-semantic-border-interactive),
|
|
124
|
+
var(--st-shadow-subtle);
|
|
120
125
|
color: var(--st-semantic-text-primary);
|
|
121
126
|
}
|
|
122
127
|
|
package/dist/MenuPopover.svelte
CHANGED
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
let maxHeight = $state(0);
|
|
34
34
|
let alignmentRight = $state(false);
|
|
35
35
|
let alignmentCenter = $state(false);
|
|
36
|
+
// True once the requested vertical side no longer fits and the panel is
|
|
37
|
+
// shown on the opposite side (flip). The placement class follows so the
|
|
38
|
+
// existing translate transforms keep working.
|
|
39
|
+
let flipped = $state(false);
|
|
36
40
|
|
|
37
41
|
const GAP = 4;
|
|
38
42
|
// Marge anti-débordement entre le panneau et le bord du viewport.
|
|
@@ -41,8 +45,19 @@
|
|
|
41
45
|
// plutôt qu'un menu écrasé (cas rare d'un déclencheur collé au bord).
|
|
42
46
|
const MIN_HEIGHT = 160;
|
|
43
47
|
|
|
48
|
+
function effectivePlacement(): "bottom-start" | "bottom-end" | "top-start" | "top-end" {
|
|
49
|
+
if (!flipped) return placement;
|
|
50
|
+
if (placement === "bottom-start") return "top-start";
|
|
51
|
+
if (placement === "bottom-end") return "top-end";
|
|
52
|
+
if (placement === "top-start") return "bottom-start";
|
|
53
|
+
return "bottom-end";
|
|
54
|
+
}
|
|
55
|
+
|
|
44
56
|
function computePosition() {
|
|
45
57
|
if (!trigger) return;
|
|
58
|
+
// Viewport coordinates (getBoundingClientRect) with `position: fixed`:
|
|
59
|
+
// no scroll offsets — the old document coordinates were wrong inside any
|
|
60
|
+
// positioned ancestor and the panel was clipped by overflow containers.
|
|
46
61
|
const rect = trigger.getBoundingClientRect();
|
|
47
62
|
const verticalUp = placement === "top-start" || placement === "top-end";
|
|
48
63
|
const horizontalEnd = placement === "bottom-end" || placement === "top-end";
|
|
@@ -54,15 +69,26 @@
|
|
|
54
69
|
alignmentRight = resolvedAlign === "end";
|
|
55
70
|
alignmentCenter = resolvedAlign === "center";
|
|
56
71
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
const panelHeight = panel?.offsetHeight ?? 0;
|
|
73
|
+
const panelWidth = panel?.offsetWidth ?? 0;
|
|
74
|
+
const need = panelHeight > 0 ? panelHeight : MIN_HEIGHT;
|
|
75
|
+
const spaceBelow = window.innerHeight - rect.bottom - GAP;
|
|
76
|
+
const spaceAbove = rect.top - GAP;
|
|
77
|
+
|
|
78
|
+
// Flip when the requested side cannot fit the panel and the other side
|
|
79
|
+
// offers more room.
|
|
80
|
+
let showUp = verticalUp;
|
|
81
|
+
if (!verticalUp && spaceBelow < need && spaceAbove > spaceBelow) showUp = true;
|
|
82
|
+
else if (verticalUp && spaceAbove < need && spaceBelow > spaceAbove) showUp = false;
|
|
83
|
+
flipped = showUp !== verticalUp;
|
|
84
|
+
|
|
85
|
+
if (showUp) {
|
|
86
|
+
// The panel's bottom edge sits above the trigger (transform handles the
|
|
87
|
+
// flip); available space is what's ABOVE the trigger.
|
|
88
|
+
top = rect.top - GAP;
|
|
63
89
|
maxHeight = Math.max(rect.top - GAP - VIEWPORT_MARGIN, MIN_HEIGHT);
|
|
64
90
|
} else {
|
|
65
|
-
top = rect.bottom +
|
|
91
|
+
top = rect.bottom + GAP;
|
|
66
92
|
// Espace réellement disponible SOUS le déclencheur : c'est ce qui manquait —
|
|
67
93
|
// `max-height: 100vh` ignorait l'offset du panneau et débordait par le bas.
|
|
68
94
|
maxHeight = Math.max(
|
|
@@ -71,18 +97,71 @@
|
|
|
71
97
|
);
|
|
72
98
|
}
|
|
73
99
|
|
|
100
|
+
// Reclamp horizontally so the measured panel stays inside the viewport.
|
|
74
101
|
if (resolvedAlign === "end") {
|
|
75
|
-
left = rect.right
|
|
102
|
+
left = rect.right;
|
|
103
|
+
if (panelWidth > 0) left = Math.min(Math.max(left, panelWidth + VIEWPORT_MARGIN), window.innerWidth - VIEWPORT_MARGIN);
|
|
76
104
|
} else if (resolvedAlign === "center") {
|
|
77
|
-
left = rect.left +
|
|
105
|
+
left = rect.left + rect.width / 2;
|
|
106
|
+
if (panelWidth > 0) {
|
|
107
|
+
left = Math.min(
|
|
108
|
+
Math.max(left, panelWidth / 2 + VIEWPORT_MARGIN),
|
|
109
|
+
window.innerWidth - panelWidth / 2 - VIEWPORT_MARGIN
|
|
110
|
+
);
|
|
111
|
+
}
|
|
78
112
|
} else {
|
|
79
|
-
left = rect.left
|
|
113
|
+
left = rect.left;
|
|
114
|
+
if (panelWidth > 0) left = Math.min(Math.max(left, VIEWPORT_MARGIN), window.innerWidth - panelWidth - VIEWPORT_MARGIN);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// --- Top layer -----------------------------------------------------------
|
|
119
|
+
// The element stays in place in the DOM (no portal to <body>) so it keeps
|
|
120
|
+
// inheriting the theme's `--st-*` custom properties; the Popover API only
|
|
121
|
+
// lifts rendering into the top layer, above overflow clipping. Where the
|
|
122
|
+
// API is missing (jsdom), plain `position: fixed` still applies.
|
|
123
|
+
let popoverShown = false;
|
|
124
|
+
|
|
125
|
+
function showTopLayer() {
|
|
126
|
+
const el = panel as (HTMLDivElement & { showPopover?: () => void }) | undefined;
|
|
127
|
+
if (!el || popoverShown) return;
|
|
128
|
+
if (typeof el.showPopover !== "function") return;
|
|
129
|
+
// The attribute is set ONLY here (never statically in markup): environments
|
|
130
|
+
// without the API (jsdom) hide every [popover] element via the UA rule, so
|
|
131
|
+
// a static attribute would force display:none under test.
|
|
132
|
+
el.setAttribute("popover", "manual");
|
|
133
|
+
try {
|
|
134
|
+
el.showPopover();
|
|
135
|
+
popoverShown = true;
|
|
136
|
+
} catch {
|
|
137
|
+
el.removeAttribute("popover");
|
|
138
|
+
// Already open or not ready — fixed positioning still applies.
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function hideTopLayer() {
|
|
143
|
+
const el = panel as (HTMLDivElement & { hidePopover?: () => void }) | undefined;
|
|
144
|
+
popoverShown = false;
|
|
145
|
+
if (!el || typeof el.hidePopover !== "function") return;
|
|
146
|
+
try {
|
|
147
|
+
el.hidePopover();
|
|
148
|
+
} catch {
|
|
149
|
+
// Already hidden — nothing to do.
|
|
150
|
+
} finally {
|
|
151
|
+
el.removeAttribute("popover");
|
|
80
152
|
}
|
|
81
153
|
}
|
|
82
154
|
|
|
83
155
|
$effect(() => {
|
|
84
156
|
if (!open) return;
|
|
85
157
|
computePosition();
|
|
158
|
+
showTopLayer();
|
|
159
|
+
// Re-measure once the panel is laid out (size known for flip/clamp).
|
|
160
|
+
if (typeof requestAnimationFrame === "function") {
|
|
161
|
+
requestAnimationFrame(() => {
|
|
162
|
+
if (open) computePosition();
|
|
163
|
+
});
|
|
164
|
+
}
|
|
86
165
|
const onScroll = () => computePosition();
|
|
87
166
|
const onResize = () => computePosition();
|
|
88
167
|
window.addEventListener("scroll", onScroll, true);
|
|
@@ -90,6 +169,7 @@
|
|
|
90
169
|
return () => {
|
|
91
170
|
window.removeEventListener("scroll", onScroll, true);
|
|
92
171
|
window.removeEventListener("resize", onResize);
|
|
172
|
+
hideTopLayer();
|
|
93
173
|
};
|
|
94
174
|
});
|
|
95
175
|
|
|
@@ -121,7 +201,7 @@
|
|
|
121
201
|
const classes = () =>
|
|
122
202
|
[
|
|
123
203
|
"st-menuPopover",
|
|
124
|
-
`st-menuPopover--${
|
|
204
|
+
`st-menuPopover--${effectivePlacement()}`,
|
|
125
205
|
alignmentRight ? "st-menuPopover--alignEnd" : null,
|
|
126
206
|
alignmentCenter ? "st-menuPopover--alignCenter" : null,
|
|
127
207
|
className
|
|
@@ -133,6 +213,8 @@
|
|
|
133
213
|
<svelte:window onpointerdown={onWindowPointerDown} onkeydown={onWindowKeyDown} />
|
|
134
214
|
|
|
135
215
|
{#if open}
|
|
216
|
+
<!-- No static popover attribute: it is set imperatively by showTopLayer()
|
|
217
|
+
only where the Popover API exists (see above). -->
|
|
136
218
|
<div
|
|
137
219
|
{...rest}
|
|
138
220
|
bind:this={panel}
|
|
@@ -160,7 +242,14 @@
|
|
|
160
242
|
max-height: calc(100vh - 2rem);
|
|
161
243
|
overflow: auto;
|
|
162
244
|
padding: 0;
|
|
163
|
-
|
|
245
|
+
/* The Popover API UA sheet gives [popover] `inset: 0; margin: auto`: without
|
|
246
|
+
this reset the top-layer panel is re-centred between its top/left and the
|
|
247
|
+
viewport edges instead of sitting on the trigger. Inline top/left win. */
|
|
248
|
+
inset: auto;
|
|
249
|
+
margin: 0;
|
|
250
|
+
/* Viewport coordinates from getBoundingClientRect: fixed, never absolute
|
|
251
|
+
(absolute + document coords broke inside any positioned ancestor). */
|
|
252
|
+
position: fixed;
|
|
164
253
|
z-index: var(--st-component-popover-zIndex, 80);
|
|
165
254
|
}
|
|
166
255
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuPopover.svelte.d.ts","sourceRoot":"","sources":["../src/lib/MenuPopover.svelte.ts"],"names":[],"mappings":"AAGA,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,CAAC,GAAG;IACtE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,SAAS,CAAC;IACpE,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;
|
|
1
|
+
{"version":3,"file":"MenuPopover.svelte.d.ts","sourceRoot":"","sources":["../src/lib/MenuPopover.svelte.ts"],"names":[],"mappings":"AAGA,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,CAAC,GAAG;IACtE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,SAAS,CAAC;IACpE,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAuNJ,QAAA,MAAM,WAAW,0DAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
package/dist/RadioGroup.svelte
CHANGED
|
@@ -82,7 +82,10 @@
|
|
|
82
82
|
|
|
83
83
|
.st-radioGroup__legend {
|
|
84
84
|
color: var(--st-component-field-labelText, var(--st-semantic-text-primary));
|
|
85
|
-
|
|
85
|
+
/* Point d'entrée de personnalisation (même modèle que
|
|
86
|
+
--st-component-selection-choiceLabelFontSize) ; md = rendu actuel.
|
|
87
|
+
Pas de prop `size` : Checkbox/CheckboxGroup n'en ont aucune. */
|
|
88
|
+
font-size: var(--st-component-selection-legendFontSize, 0.9375rem);
|
|
86
89
|
font-weight: 650;
|
|
87
90
|
line-height: 1.3;
|
|
88
91
|
padding: 0;
|
|
@@ -196,6 +196,19 @@
|
|
|
196
196
|
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}`;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
// --- Couplage des deux mois (mode deux calendriers) -----------------------
|
|
200
|
+
// Invariant : droite > gauche, toujours. La comparaison lexicographique
|
|
201
|
+
// vaut l'ordre chronologique pour des "YYYY-MM" à mois rembourrés.
|
|
202
|
+
function onLeftMonthChange(next: string) {
|
|
203
|
+
leftMonth = next;
|
|
204
|
+
if (rightMonth <= next) rightMonth = monthOf(next, 1);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function onRightMonthChange(next: string) {
|
|
208
|
+
rightMonth = next;
|
|
209
|
+
if (leftMonth >= next) leftMonth = monthOf(next, -1);
|
|
210
|
+
}
|
|
211
|
+
|
|
199
212
|
let leftMonth = $state<string>("");
|
|
200
213
|
let rightMonth = $state<string>("");
|
|
201
214
|
|
|
@@ -214,7 +227,10 @@
|
|
|
214
227
|
toText: `${split.toDate} ${split.toTime}`
|
|
215
228
|
};
|
|
216
229
|
leftMonth = monthOf(split.fromDate, 0);
|
|
217
|
-
|
|
230
|
+
// Droite = mois de la fin quand il est après la gauche, sinon gauche + 1 :
|
|
231
|
+
// les deux bornes deviennent visibles dès l'ouverture.
|
|
232
|
+
const endMonth = monthOf(split.toDate, 0);
|
|
233
|
+
rightMonth = endMonth > leftMonth ? endMonth : monthOf(leftMonth, 1);
|
|
218
234
|
}
|
|
219
235
|
|
|
220
236
|
let previousFocus: HTMLElement | null = null;
|
|
@@ -454,6 +470,7 @@
|
|
|
454
470
|
range
|
|
455
471
|
value={calendarValue}
|
|
456
472
|
onChange={onCalendarChange}
|
|
473
|
+
onMonthChange={onLeftMonthChange}
|
|
457
474
|
min={calendarMinIso}
|
|
458
475
|
max={calendarMaxIso}
|
|
459
476
|
{locale}
|
|
@@ -464,6 +481,7 @@
|
|
|
464
481
|
range
|
|
465
482
|
value={calendarValue}
|
|
466
483
|
onChange={onCalendarChange}
|
|
484
|
+
onMonthChange={onRightMonthChange}
|
|
467
485
|
min={calendarMinIso}
|
|
468
486
|
max={calendarMaxIso}
|
|
469
487
|
{locale}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeRangePicker.svelte.d.ts","sourceRoot":"","sources":["../src/lib/TimeRangePicker.svelte.ts"],"names":[],"mappings":"AAOE,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,CAAC;AACpD,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AACF,MAAM,MAAM,eAAe,GACvB,MAAM,GACN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