@cahyo-dimas/freeday 3.19.0 → 3.20.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/CHANGELOG.md +72 -0
- package/COMPONENTS.md +33 -4
- package/README.id.md +5 -5
- package/README.md +4 -4
- package/adapters/blazor/FdyDateRange.razor +42 -20
- package/adapters/blazor/FdyDateRange.razor.cs +62 -1
- package/adapters/core/date-range.d.ts +37 -0
- package/adapters/core/date-range.js +61 -0
- package/adapters/react/components/FdyDateRange.tsx +61 -5
- package/adapters/react/components/FdyDatepicker.tsx +93 -12
- package/adapters/react/index.d.ts +1 -1
- package/adapters/react/rangeField.ts +25 -0
- package/adapters/vue/components/FdyDateRange.vue +57 -7
- package/adapters/vue/components/FdyDatepicker.vue +92 -8
- package/adapters/vue/index.d.ts +1 -1
- package/adapters/vue/rangeField.ts +31 -0
- package/dist/freeday-datepicker.js +150 -7
- package/dist/freeday.bundle.css +15 -0
- package/dist/freeday.css +15 -0
- package/dist/freeday.js +150 -7
- package/docs/agent-onboarding.md +10 -9
- package/docs/getting-started.md +4 -4
- package/package.json +2 -2
- package/src/components/datepicker.css +15 -0
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
* <div data-fdy-datepicker data-role="to" data-placeholder="To"></div>
|
|
12
12
|
* </div>
|
|
13
13
|
* The range links the two: the end can never precede the start (out-of-range days disable).
|
|
14
|
+
* - Range in ONE field: <div data-fdy-daterange data-layout="single" data-value="2026-11-01/2026-11-30"
|
|
15
|
+
* data-label="Period"></div>
|
|
16
|
+
* One trigger, one calendar: the first day picked is the start, the second the end. The value is
|
|
17
|
+
* "start/end" (ISO 8601 interval) or "", and it changes only when the range is whole, announced
|
|
18
|
+
* by "fdy-daterange-settled" {from, to} on the root. Escape or a click outside drops half a range.
|
|
14
19
|
* - Month: <div data-fdy-datepicker data-mode="month" data-value="2026-10"></div>
|
|
15
20
|
* The calendar opens ON the month grid and stops there; the value is "YYYY-MM".
|
|
16
21
|
*
|
|
@@ -54,7 +59,14 @@
|
|
|
54
59
|
nextYears: 'Next years',
|
|
55
60
|
chooseMonth: '{label}, choose month',
|
|
56
61
|
chooseYear: '{label}, choose year',
|
|
57
|
-
backToMonths: '{start} to {end}, back to months'
|
|
62
|
+
backToMonths: '{start} to {end}, back to months',
|
|
63
|
+
/* The single-field range's own pair, for the same reason month mode has one: "Choose a date"
|
|
64
|
+
on a field that wants two of them tells the reader half the job. */
|
|
65
|
+
labelRange: 'Date range',
|
|
66
|
+
placeholderRange: 'Choose dates',
|
|
67
|
+
/* Appended to a day's accessible name, so an end of the range is not told by colour alone. */
|
|
68
|
+
rangeStart: 'range start',
|
|
69
|
+
rangeEnd: 'range end'
|
|
58
70
|
};
|
|
59
71
|
/* HTML lowercases attribute names, so a camelCase key like `prevMonth` can only ever be written
|
|
60
72
|
as `data-fdy-text-prevmonth`, while the kebab form anybody would reach for,
|
|
@@ -95,6 +107,16 @@
|
|
|
95
107
|
var d = new Date(Number(p[0]), Number(p[1]) - 1, p.length > 2 ? Number(p[2]) : 1);
|
|
96
108
|
return isNaN(d.getTime()) ? null : d;
|
|
97
109
|
}
|
|
110
|
+
/* "start/end", the ISO 8601 interval form, so a range is ONE `data-value` like every other kit
|
|
111
|
+
control and `freeday-form.js` can require it without knowing it is a range. Half an interval,
|
|
112
|
+
or an end before its start, reads as empty: the field never shows a range it would not commit. */
|
|
113
|
+
function parseInterval(s) {
|
|
114
|
+
var p = String(s || '').split('/');
|
|
115
|
+
var a = p.length === 2 ? parseISO(p[0]) : null;
|
|
116
|
+
var b = p.length === 2 ? parseISO(p[1]) : null;
|
|
117
|
+
if (!a || !b || b.getTime() < a.getTime()) return { start: null, end: null };
|
|
118
|
+
return { start: a, end: b };
|
|
119
|
+
}
|
|
98
120
|
function startOfDay(d) { return new Date(d.getFullYear(), d.getMonth(), d.getDate()); }
|
|
99
121
|
function sameDay(a, b) { return !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate(); }
|
|
100
122
|
function addDays(d, n) { var x = new Date(d); x.setDate(x.getDate() + n); return x; }
|
|
@@ -126,10 +148,26 @@
|
|
|
126
148
|
opens on it, Enter and a click commit from it, the day grid is never built, and the value is
|
|
127
149
|
"YYYY-MM". Anything else, including the attribute's absence, is the day picker unchanged. */
|
|
128
150
|
var monthOnly = wrap.getAttribute('data-mode') === 'month';
|
|
151
|
+
/* A `data-fdy-daterange` root reaches this function only for `data-layout="single"`: the range
|
|
152
|
+
in one field. It is the same calendar with a different answer, so it lives here rather than
|
|
153
|
+
in a second copy of everything below. `selected` holds the start and `selectedEnd` the end;
|
|
154
|
+
`anchor` is a start picked in this opening and not yet answered by an end, and `preview` the
|
|
155
|
+
day the pointer or the keyboard is on while it waits. */
|
|
156
|
+
var rangeMode = wrap.hasAttribute('data-fdy-daterange');
|
|
129
157
|
var parseVal = monthOnly ? parseISOMonth : parseISO;
|
|
130
|
-
var placeholder = wrap.getAttribute('data-placeholder') || textOf(wrap, monthOnly ? 'placeholderMonth' : 'placeholder');
|
|
131
|
-
var label = wrap.getAttribute('data-label') || textOf(wrap, monthOnly ? 'labelMonth' : 'label');
|
|
132
|
-
var
|
|
158
|
+
var placeholder = wrap.getAttribute('data-placeholder') || textOf(wrap, monthOnly ? 'placeholderMonth' : rangeMode ? 'placeholderRange' : 'placeholder');
|
|
159
|
+
var label = wrap.getAttribute('data-label') || (rangeMode && wrap.getAttribute('aria-label')) || textOf(wrap, monthOnly ? 'labelMonth' : rangeMode ? 'labelRange' : 'label');
|
|
160
|
+
var seed = rangeMode ? parseInterval(wrap.getAttribute('data-value')) : null;
|
|
161
|
+
var selected = rangeMode ? seed.start : parseVal(wrap.getAttribute('data-value'));
|
|
162
|
+
var selectedEnd = rangeMode ? seed.end : null;
|
|
163
|
+
var anchor = null, preview = null;
|
|
164
|
+
if (rangeMode) {
|
|
165
|
+
wrap.classList.add('fdy-datepicker--range');
|
|
166
|
+
/* The group role the split layout needs would wrap one button here; the trigger carries
|
|
167
|
+
the name instead. */
|
|
168
|
+
wrap.removeAttribute('role');
|
|
169
|
+
wrap.removeAttribute('aria-label');
|
|
170
|
+
}
|
|
133
171
|
var minDate = parseVal(wrap.getAttribute('data-min'));
|
|
134
172
|
var maxDate = parseVal(wrap.getAttribute('data-max'));
|
|
135
173
|
var rangeStart = null, rangeEnd = null; // for in-range shading
|
|
@@ -175,7 +213,22 @@
|
|
|
175
213
|
wrap.appendChild(trigger);
|
|
176
214
|
wrap.appendChild(panel);
|
|
177
215
|
|
|
216
|
+
function rangeValue() {
|
|
217
|
+
return selected && selectedEnd ? toISO(selected) + '/' + toISO(selectedEnd) : '';
|
|
218
|
+
}
|
|
219
|
+
|
|
178
220
|
function updateDisplay() {
|
|
221
|
+
if (rangeMode) {
|
|
222
|
+
wrap.setAttribute('data-value', rangeValue());
|
|
223
|
+
if (selected && selectedEnd) {
|
|
224
|
+
valueSpan.textContent = valueFmt.format(selected) + ' – ' + valueFmt.format(selectedEnd);
|
|
225
|
+
valueSpan.classList.remove('fdy-datepicker__value--placeholder');
|
|
226
|
+
} else {
|
|
227
|
+
valueSpan.textContent = placeholder;
|
|
228
|
+
valueSpan.classList.add('fdy-datepicker__value--placeholder');
|
|
229
|
+
}
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
179
232
|
/* Mirror the value onto the ROOT, which until now only seeded it. `freeday-select.js` has
|
|
180
233
|
always done this, so this makes the family agree rather than inventing a second idea, and
|
|
181
234
|
it is what lets `freeday-form.js` require a kit control without knowing which control it
|
|
@@ -284,7 +337,8 @@
|
|
|
284
337
|
btn.textContent = d.getDate();
|
|
285
338
|
if (d.getMonth() !== view.getMonth()) btn.classList.add('is-outside');
|
|
286
339
|
if (sameDay(d, today)) btn.classList.add('is-today');
|
|
287
|
-
if (
|
|
340
|
+
if (rangeMode) paintRange(btn, d);
|
|
341
|
+
else if (selected && sameDay(d, selected)) { btn.classList.add('is-selected'); btn.setAttribute('aria-selected', 'true'); }
|
|
288
342
|
if (rangeStart && rangeEnd) {
|
|
289
343
|
var t = startOfDay(d).getTime();
|
|
290
344
|
if (t > startOfDay(rangeStart).getTime() && t < startOfDay(rangeEnd).getTime()) btn.classList.add('in-range');
|
|
@@ -296,9 +350,84 @@
|
|
|
296
350
|
grid.appendChild(btn);
|
|
297
351
|
}
|
|
298
352
|
grid.addEventListener('keydown', onGridKey);
|
|
353
|
+
if (rangeMode) grid.addEventListener('mouseover', onRangeHover);
|
|
299
354
|
panel.appendChild(grid);
|
|
300
355
|
}
|
|
301
356
|
|
|
357
|
+
/* The two ends the grid shows. While a start waits for its end, the end is the day under the
|
|
358
|
+
pointer or the keyboard, and only when it does not precede the start: a day before it would
|
|
359
|
+
become the new start, so drawing a band backwards would promise something a click will not do. */
|
|
360
|
+
function shownEnds() {
|
|
361
|
+
if (anchor) {
|
|
362
|
+
var to = preview && startOfDay(preview).getTime() >= anchor.getTime() ? startOfDay(preview) : null;
|
|
363
|
+
return { from: anchor, to: to, pending: true };
|
|
364
|
+
}
|
|
365
|
+
return { from: selected, to: selectedEnd, pending: false };
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/* Every range state of one day cell, written in full each time, so the same function serves the
|
|
369
|
+
render and the cheaper repaint a hover asks for (rebuilding the grid under a moving pointer
|
|
370
|
+
would replace the element the pointer is on). The ends are rounded on their outer side only,
|
|
371
|
+
and a committed end is filled like a picked day. A previewed end is not filled: it is not an
|
|
372
|
+
answer yet. Each end also says so in its accessible name, so the range is not colour alone. */
|
|
373
|
+
function paintRange(btn, d) {
|
|
374
|
+
var ends = shownEnds();
|
|
375
|
+
var t = startOfDay(d).getTime();
|
|
376
|
+
var isFrom = !!ends.from && sameDay(d, ends.from);
|
|
377
|
+
var isTo = !!ends.to && sameDay(d, ends.to);
|
|
378
|
+
var span = !!ends.from && !!ends.to && !sameDay(ends.from, ends.to);
|
|
379
|
+
var filled = isFrom || (isTo && !ends.pending);
|
|
380
|
+
btn.classList.toggle('is-selected', filled);
|
|
381
|
+
if (filled) btn.setAttribute('aria-selected', 'true'); else btn.removeAttribute('aria-selected');
|
|
382
|
+
btn.classList.toggle('is-range-start', isFrom && span);
|
|
383
|
+
btn.classList.toggle('is-range-end', isTo && span);
|
|
384
|
+
btn.classList.toggle('in-range', span && ((t > ends.from.getTime() && t < ends.to.getTime()) || (isTo && ends.pending)));
|
|
385
|
+
var name = dayLabelFmt.format(d);
|
|
386
|
+
if (isFrom) name += ', ' + textOf(wrap, 'rangeStart');
|
|
387
|
+
else if (isTo && !ends.pending) name += ', ' + textOf(wrap, 'rangeEnd');
|
|
388
|
+
btn.setAttribute('aria-label', name);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function repaintRange() {
|
|
392
|
+
Array.prototype.forEach.call(panel.querySelectorAll('.fdy-cal__day'), function (btn) {
|
|
393
|
+
if (btn._date) paintRange(btn, btn._date);
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function onRangeHover(e) {
|
|
398
|
+
if (!anchor) return;
|
|
399
|
+
var cell = e.target && e.target.closest ? e.target.closest('.fdy-cal__day') : null;
|
|
400
|
+
if (!cell || !cell._date || cell.disabled) return;
|
|
401
|
+
if (preview && sameDay(preview, cell._date)) return;
|
|
402
|
+
preview = cell._date;
|
|
403
|
+
repaintRange();
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/* First pick: the start, and the panel stays open for the end. Second pick on or after it: the
|
|
407
|
+
range is whole, committed and announced, and the panel closes. A second pick BEFORE the start
|
|
408
|
+
becomes the new start instead of silently swapping the two, which would leave the reader
|
|
409
|
+
wondering which end they just moved. */
|
|
410
|
+
function pickRange(d) {
|
|
411
|
+
var day = startOfDay(d);
|
|
412
|
+
focusDate = day;
|
|
413
|
+
if (!anchor || day.getTime() < anchor.getTime()) {
|
|
414
|
+
anchor = day;
|
|
415
|
+
preview = day;
|
|
416
|
+
render();
|
|
417
|
+
focusFocusDate();
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
selected = anchor;
|
|
421
|
+
selectedEnd = day;
|
|
422
|
+
anchor = null;
|
|
423
|
+
preview = null;
|
|
424
|
+
updateDisplay();
|
|
425
|
+
wrap.dispatchEvent(new CustomEvent('fdy-daterange-settled', {
|
|
426
|
+
bubbles: true, detail: { from: toISO(selected), to: toISO(selectedEnd) }
|
|
427
|
+
}));
|
|
428
|
+
close(true);
|
|
429
|
+
}
|
|
430
|
+
|
|
302
431
|
function renderMonths() {
|
|
303
432
|
panel.innerHTML = '';
|
|
304
433
|
var year = view.getFullYear();
|
|
@@ -518,6 +647,9 @@
|
|
|
518
647
|
|
|
519
648
|
function moveFocus(next) {
|
|
520
649
|
focusDate = next;
|
|
650
|
+
/* The keyboard previews the band exactly as the pointer does, or a keyboard user would pick
|
|
651
|
+
the end without ever seeing the range they are about to commit. */
|
|
652
|
+
if (anchor) preview = startOfDay(next);
|
|
521
653
|
if (next.getMonth() !== view.getMonth() || next.getFullYear() !== view.getFullYear()) {
|
|
522
654
|
view = new Date(next.getFullYear(), next.getMonth(), 1);
|
|
523
655
|
}
|
|
@@ -546,6 +678,7 @@
|
|
|
546
678
|
|
|
547
679
|
function pick(d) {
|
|
548
680
|
if (isDisabled(d)) return;
|
|
681
|
+
if (rangeMode) { pickRange(d); return; }
|
|
549
682
|
selected = startOfDay(d);
|
|
550
683
|
focusDate = selected;
|
|
551
684
|
updateDisplay();
|
|
@@ -622,6 +755,10 @@
|
|
|
622
755
|
|
|
623
756
|
function close(returnFocus) {
|
|
624
757
|
if (panel.hidden) return;
|
|
758
|
+
/* Every way out that is not a second pick drops half a range: the value never held it, so
|
|
759
|
+
there is nothing to restore, only the start this opening was waiting on. */
|
|
760
|
+
anchor = null;
|
|
761
|
+
preview = null;
|
|
625
762
|
var p = popCtl(); if (p) p.hide(); else panel.hidden = true;
|
|
626
763
|
trigger.setAttribute('aria-expanded', 'false');
|
|
627
764
|
trigger.classList.remove('is-open');
|
|
@@ -643,8 +780,11 @@
|
|
|
643
780
|
var api = {
|
|
644
781
|
wrap: wrap,
|
|
645
782
|
setState: setState,
|
|
646
|
-
getValue: function () {
|
|
647
|
-
|
|
783
|
+
getValue: function () {
|
|
784
|
+
if (rangeMode) return rangeValue();
|
|
785
|
+
return selected ? (monthOnly ? toISOMonth(selected) : toISO(selected)) : '';
|
|
786
|
+
},
|
|
787
|
+
clear: function () { selected = null; selectedEnd = null; updateDisplay(); if (!panel.hidden) render(); },
|
|
648
788
|
setMin: function (iso) { minDate = parseVal(iso); if (!panel.hidden) render(); },
|
|
649
789
|
setMax: function (iso) { maxDate = parseVal(iso); if (!panel.hidden) render(); },
|
|
650
790
|
setRange: function (fromIso, toIso) {
|
|
@@ -661,6 +801,9 @@
|
|
|
661
801
|
if (root.dataset.fdyDrReady === '1') return;
|
|
662
802
|
if (root.closest('[data-fdy-ignore]')) return;
|
|
663
803
|
root.dataset.fdyDrReady = '1';
|
|
804
|
+
/* One field: the root IS the picker, and the range logic lives in initPicker beside the
|
|
805
|
+
calendar it draws on. The split layout below is unchanged. */
|
|
806
|
+
if (root.getAttribute('data-layout') === 'single') { initPicker(root); return; }
|
|
664
807
|
var fromEl = root.querySelector('[data-fdy-datepicker][data-role="from"]');
|
|
665
808
|
var toEl = root.querySelector('[data-fdy-datepicker][data-role="to"]');
|
|
666
809
|
if (!fromEl || !toEl) return;
|
package/dist/freeday.bundle.css
CHANGED
|
@@ -2461,6 +2461,21 @@ a { color: var(--color-primary-strong); }
|
|
|
2461
2461
|
.fdy-daterange .fdy-datepicker{flex:0 1 11rem;min-width:7rem;}
|
|
2462
2462
|
.fdy-daterange__sep{flex:none;color:var(--color-text-subtle);}
|
|
2463
2463
|
|
|
2464
|
+
/* Range in one field (`data-layout="single"` / `layout="single"`): one trigger holding both dates.
|
|
2465
|
+
Wider than a single picker's cap, which is sized for one date and would cut the second one off. */
|
|
2466
|
+
.fdy-datepicker--range{max-width:18rem;}
|
|
2467
|
+
/* The band. Day cells sit 2px apart, so a band painted on the cells alone is striped; each cell in it
|
|
2468
|
+
spreads 1px into the gap on both sides, which closes it. The ends are square on their inner side
|
|
2469
|
+
and keep their radius on the outer one, so the run reads as one bar from start to end. */
|
|
2470
|
+
.fdy-cal__day.in-range{box-shadow:-1px 0 0 var(--color-primary-soft),1px 0 0 var(--color-primary-soft);}
|
|
2471
|
+
.fdy-cal__day.in-range.is-today{box-shadow:inset 0 0 0 1.5px var(--color-border-strong),-1px 0 0 var(--color-primary-soft),1px 0 0 var(--color-primary-soft);}
|
|
2472
|
+
.fdy-cal__day.is-range-start{border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:1px 0 0 var(--color-primary-soft);}
|
|
2473
|
+
.fdy-cal__day.is-range-end{border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:-1px 0 0 var(--color-primary-soft);}
|
|
2474
|
+
.fdy-cal__day.is-range-end.in-range{border-top-right-radius:var(--radius-sm);border-bottom-right-radius:var(--radius-sm);}
|
|
2475
|
+
/* The band rules above weigh what the focus ring weighs and come later, so without this the day the
|
|
2476
|
+
keyboard is previewing from would be the one cell in the grid with no visible focus. */
|
|
2477
|
+
.fdy-cal__day.in-range:focus-visible,.fdy-cal__day.is-range-start:focus-visible,.fdy-cal__day.is-range-end:focus-visible{box-shadow:0 0 0 3px rgba(var(--color-primary-rgb),.26);}
|
|
2478
|
+
|
|
2464
2479
|
@media (prefers-reduced-motion:no-preference){.fdy-datepicker__panel:not([hidden]){animation:fdy-combo-in var(--dur-fast) var(--ease-standard);}}
|
|
2465
2480
|
|
|
2466
2481
|
/* Freeday. Datetime picker (composed: date picker + time picker → one value).
|
package/dist/freeday.css
CHANGED
|
@@ -1284,6 +1284,21 @@ a { color: var(--color-primary-strong); }
|
|
|
1284
1284
|
.fdy-daterange .fdy-datepicker{flex:0 1 11rem;min-width:7rem;}
|
|
1285
1285
|
.fdy-daterange__sep{flex:none;color:var(--color-text-subtle);}
|
|
1286
1286
|
|
|
1287
|
+
/* Range in one field (`data-layout="single"` / `layout="single"`): one trigger holding both dates.
|
|
1288
|
+
Wider than a single picker's cap, which is sized for one date and would cut the second one off. */
|
|
1289
|
+
.fdy-datepicker--range{max-width:18rem;}
|
|
1290
|
+
/* The band. Day cells sit 2px apart, so a band painted on the cells alone is striped; each cell in it
|
|
1291
|
+
spreads 1px into the gap on both sides, which closes it. The ends are square on their inner side
|
|
1292
|
+
and keep their radius on the outer one, so the run reads as one bar from start to end. */
|
|
1293
|
+
.fdy-cal__day.in-range{box-shadow:-1px 0 0 var(--color-primary-soft),1px 0 0 var(--color-primary-soft);}
|
|
1294
|
+
.fdy-cal__day.in-range.is-today{box-shadow:inset 0 0 0 1.5px var(--color-border-strong),-1px 0 0 var(--color-primary-soft),1px 0 0 var(--color-primary-soft);}
|
|
1295
|
+
.fdy-cal__day.is-range-start{border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:1px 0 0 var(--color-primary-soft);}
|
|
1296
|
+
.fdy-cal__day.is-range-end{border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:-1px 0 0 var(--color-primary-soft);}
|
|
1297
|
+
.fdy-cal__day.is-range-end.in-range{border-top-right-radius:var(--radius-sm);border-bottom-right-radius:var(--radius-sm);}
|
|
1298
|
+
/* The band rules above weigh what the focus ring weighs and come later, so without this the day the
|
|
1299
|
+
keyboard is previewing from would be the one cell in the grid with no visible focus. */
|
|
1300
|
+
.fdy-cal__day.in-range:focus-visible,.fdy-cal__day.is-range-start:focus-visible,.fdy-cal__day.is-range-end:focus-visible{box-shadow:0 0 0 3px rgba(var(--color-primary-rgb),.26);}
|
|
1301
|
+
|
|
1287
1302
|
@media (prefers-reduced-motion:no-preference){.fdy-datepicker__panel:not([hidden]){animation:fdy-combo-in var(--dur-fast) var(--ease-standard);}}
|
|
1288
1303
|
|
|
1289
1304
|
/* Freeday. Datetime picker (composed: date picker + time picker → one value).
|
package/dist/freeday.js
CHANGED
|
@@ -2170,6 +2170,11 @@
|
|
|
2170
2170
|
* <div data-fdy-datepicker data-role="to" data-placeholder="To"></div>
|
|
2171
2171
|
* </div>
|
|
2172
2172
|
* The range links the two: the end can never precede the start (out-of-range days disable).
|
|
2173
|
+
* - Range in ONE field: <div data-fdy-daterange data-layout="single" data-value="2026-11-01/2026-11-30"
|
|
2174
|
+
* data-label="Period"></div>
|
|
2175
|
+
* One trigger, one calendar: the first day picked is the start, the second the end. The value is
|
|
2176
|
+
* "start/end" (ISO 8601 interval) or "", and it changes only when the range is whole, announced
|
|
2177
|
+
* by "fdy-daterange-settled" {from, to} on the root. Escape or a click outside drops half a range.
|
|
2173
2178
|
* - Month: <div data-fdy-datepicker data-mode="month" data-value="2026-10"></div>
|
|
2174
2179
|
* The calendar opens ON the month grid and stops there; the value is "YYYY-MM".
|
|
2175
2180
|
*
|
|
@@ -2213,7 +2218,14 @@
|
|
|
2213
2218
|
nextYears: 'Next years',
|
|
2214
2219
|
chooseMonth: '{label}, choose month',
|
|
2215
2220
|
chooseYear: '{label}, choose year',
|
|
2216
|
-
backToMonths: '{start} to {end}, back to months'
|
|
2221
|
+
backToMonths: '{start} to {end}, back to months',
|
|
2222
|
+
/* The single-field range's own pair, for the same reason month mode has one: "Choose a date"
|
|
2223
|
+
on a field that wants two of them tells the reader half the job. */
|
|
2224
|
+
labelRange: 'Date range',
|
|
2225
|
+
placeholderRange: 'Choose dates',
|
|
2226
|
+
/* Appended to a day's accessible name, so an end of the range is not told by colour alone. */
|
|
2227
|
+
rangeStart: 'range start',
|
|
2228
|
+
rangeEnd: 'range end'
|
|
2217
2229
|
};
|
|
2218
2230
|
/* HTML lowercases attribute names, so a camelCase key like `prevMonth` can only ever be written
|
|
2219
2231
|
as `data-fdy-text-prevmonth`, while the kebab form anybody would reach for,
|
|
@@ -2254,6 +2266,16 @@
|
|
|
2254
2266
|
var d = new Date(Number(p[0]), Number(p[1]) - 1, p.length > 2 ? Number(p[2]) : 1);
|
|
2255
2267
|
return isNaN(d.getTime()) ? null : d;
|
|
2256
2268
|
}
|
|
2269
|
+
/* "start/end", the ISO 8601 interval form, so a range is ONE `data-value` like every other kit
|
|
2270
|
+
control and `freeday-form.js` can require it without knowing it is a range. Half an interval,
|
|
2271
|
+
or an end before its start, reads as empty: the field never shows a range it would not commit. */
|
|
2272
|
+
function parseInterval(s) {
|
|
2273
|
+
var p = String(s || '').split('/');
|
|
2274
|
+
var a = p.length === 2 ? parseISO(p[0]) : null;
|
|
2275
|
+
var b = p.length === 2 ? parseISO(p[1]) : null;
|
|
2276
|
+
if (!a || !b || b.getTime() < a.getTime()) return { start: null, end: null };
|
|
2277
|
+
return { start: a, end: b };
|
|
2278
|
+
}
|
|
2257
2279
|
function startOfDay(d) { return new Date(d.getFullYear(), d.getMonth(), d.getDate()); }
|
|
2258
2280
|
function sameDay(a, b) { return !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate(); }
|
|
2259
2281
|
function addDays(d, n) { var x = new Date(d); x.setDate(x.getDate() + n); return x; }
|
|
@@ -2285,10 +2307,26 @@
|
|
|
2285
2307
|
opens on it, Enter and a click commit from it, the day grid is never built, and the value is
|
|
2286
2308
|
"YYYY-MM". Anything else, including the attribute's absence, is the day picker unchanged. */
|
|
2287
2309
|
var monthOnly = wrap.getAttribute('data-mode') === 'month';
|
|
2310
|
+
/* A `data-fdy-daterange` root reaches this function only for `data-layout="single"`: the range
|
|
2311
|
+
in one field. It is the same calendar with a different answer, so it lives here rather than
|
|
2312
|
+
in a second copy of everything below. `selected` holds the start and `selectedEnd` the end;
|
|
2313
|
+
`anchor` is a start picked in this opening and not yet answered by an end, and `preview` the
|
|
2314
|
+
day the pointer or the keyboard is on while it waits. */
|
|
2315
|
+
var rangeMode = wrap.hasAttribute('data-fdy-daterange');
|
|
2288
2316
|
var parseVal = monthOnly ? parseISOMonth : parseISO;
|
|
2289
|
-
var placeholder = wrap.getAttribute('data-placeholder') || textOf(wrap, monthOnly ? 'placeholderMonth' : 'placeholder');
|
|
2290
|
-
var label = wrap.getAttribute('data-label') || textOf(wrap, monthOnly ? 'labelMonth' : 'label');
|
|
2291
|
-
var
|
|
2317
|
+
var placeholder = wrap.getAttribute('data-placeholder') || textOf(wrap, monthOnly ? 'placeholderMonth' : rangeMode ? 'placeholderRange' : 'placeholder');
|
|
2318
|
+
var label = wrap.getAttribute('data-label') || (rangeMode && wrap.getAttribute('aria-label')) || textOf(wrap, monthOnly ? 'labelMonth' : rangeMode ? 'labelRange' : 'label');
|
|
2319
|
+
var seed = rangeMode ? parseInterval(wrap.getAttribute('data-value')) : null;
|
|
2320
|
+
var selected = rangeMode ? seed.start : parseVal(wrap.getAttribute('data-value'));
|
|
2321
|
+
var selectedEnd = rangeMode ? seed.end : null;
|
|
2322
|
+
var anchor = null, preview = null;
|
|
2323
|
+
if (rangeMode) {
|
|
2324
|
+
wrap.classList.add('fdy-datepicker--range');
|
|
2325
|
+
/* The group role the split layout needs would wrap one button here; the trigger carries
|
|
2326
|
+
the name instead. */
|
|
2327
|
+
wrap.removeAttribute('role');
|
|
2328
|
+
wrap.removeAttribute('aria-label');
|
|
2329
|
+
}
|
|
2292
2330
|
var minDate = parseVal(wrap.getAttribute('data-min'));
|
|
2293
2331
|
var maxDate = parseVal(wrap.getAttribute('data-max'));
|
|
2294
2332
|
var rangeStart = null, rangeEnd = null; // for in-range shading
|
|
@@ -2334,7 +2372,22 @@
|
|
|
2334
2372
|
wrap.appendChild(trigger);
|
|
2335
2373
|
wrap.appendChild(panel);
|
|
2336
2374
|
|
|
2375
|
+
function rangeValue() {
|
|
2376
|
+
return selected && selectedEnd ? toISO(selected) + '/' + toISO(selectedEnd) : '';
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2337
2379
|
function updateDisplay() {
|
|
2380
|
+
if (rangeMode) {
|
|
2381
|
+
wrap.setAttribute('data-value', rangeValue());
|
|
2382
|
+
if (selected && selectedEnd) {
|
|
2383
|
+
valueSpan.textContent = valueFmt.format(selected) + ' – ' + valueFmt.format(selectedEnd);
|
|
2384
|
+
valueSpan.classList.remove('fdy-datepicker__value--placeholder');
|
|
2385
|
+
} else {
|
|
2386
|
+
valueSpan.textContent = placeholder;
|
|
2387
|
+
valueSpan.classList.add('fdy-datepicker__value--placeholder');
|
|
2388
|
+
}
|
|
2389
|
+
return;
|
|
2390
|
+
}
|
|
2338
2391
|
/* Mirror the value onto the ROOT, which until now only seeded it. `freeday-select.js` has
|
|
2339
2392
|
always done this, so this makes the family agree rather than inventing a second idea, and
|
|
2340
2393
|
it is what lets `freeday-form.js` require a kit control without knowing which control it
|
|
@@ -2443,7 +2496,8 @@
|
|
|
2443
2496
|
btn.textContent = d.getDate();
|
|
2444
2497
|
if (d.getMonth() !== view.getMonth()) btn.classList.add('is-outside');
|
|
2445
2498
|
if (sameDay(d, today)) btn.classList.add('is-today');
|
|
2446
|
-
if (
|
|
2499
|
+
if (rangeMode) paintRange(btn, d);
|
|
2500
|
+
else if (selected && sameDay(d, selected)) { btn.classList.add('is-selected'); btn.setAttribute('aria-selected', 'true'); }
|
|
2447
2501
|
if (rangeStart && rangeEnd) {
|
|
2448
2502
|
var t = startOfDay(d).getTime();
|
|
2449
2503
|
if (t > startOfDay(rangeStart).getTime() && t < startOfDay(rangeEnd).getTime()) btn.classList.add('in-range');
|
|
@@ -2455,9 +2509,84 @@
|
|
|
2455
2509
|
grid.appendChild(btn);
|
|
2456
2510
|
}
|
|
2457
2511
|
grid.addEventListener('keydown', onGridKey);
|
|
2512
|
+
if (rangeMode) grid.addEventListener('mouseover', onRangeHover);
|
|
2458
2513
|
panel.appendChild(grid);
|
|
2459
2514
|
}
|
|
2460
2515
|
|
|
2516
|
+
/* The two ends the grid shows. While a start waits for its end, the end is the day under the
|
|
2517
|
+
pointer or the keyboard, and only when it does not precede the start: a day before it would
|
|
2518
|
+
become the new start, so drawing a band backwards would promise something a click will not do. */
|
|
2519
|
+
function shownEnds() {
|
|
2520
|
+
if (anchor) {
|
|
2521
|
+
var to = preview && startOfDay(preview).getTime() >= anchor.getTime() ? startOfDay(preview) : null;
|
|
2522
|
+
return { from: anchor, to: to, pending: true };
|
|
2523
|
+
}
|
|
2524
|
+
return { from: selected, to: selectedEnd, pending: false };
|
|
2525
|
+
}
|
|
2526
|
+
|
|
2527
|
+
/* Every range state of one day cell, written in full each time, so the same function serves the
|
|
2528
|
+
render and the cheaper repaint a hover asks for (rebuilding the grid under a moving pointer
|
|
2529
|
+
would replace the element the pointer is on). The ends are rounded on their outer side only,
|
|
2530
|
+
and a committed end is filled like a picked day. A previewed end is not filled: it is not an
|
|
2531
|
+
answer yet. Each end also says so in its accessible name, so the range is not colour alone. */
|
|
2532
|
+
function paintRange(btn, d) {
|
|
2533
|
+
var ends = shownEnds();
|
|
2534
|
+
var t = startOfDay(d).getTime();
|
|
2535
|
+
var isFrom = !!ends.from && sameDay(d, ends.from);
|
|
2536
|
+
var isTo = !!ends.to && sameDay(d, ends.to);
|
|
2537
|
+
var span = !!ends.from && !!ends.to && !sameDay(ends.from, ends.to);
|
|
2538
|
+
var filled = isFrom || (isTo && !ends.pending);
|
|
2539
|
+
btn.classList.toggle('is-selected', filled);
|
|
2540
|
+
if (filled) btn.setAttribute('aria-selected', 'true'); else btn.removeAttribute('aria-selected');
|
|
2541
|
+
btn.classList.toggle('is-range-start', isFrom && span);
|
|
2542
|
+
btn.classList.toggle('is-range-end', isTo && span);
|
|
2543
|
+
btn.classList.toggle('in-range', span && ((t > ends.from.getTime() && t < ends.to.getTime()) || (isTo && ends.pending)));
|
|
2544
|
+
var name = dayLabelFmt.format(d);
|
|
2545
|
+
if (isFrom) name += ', ' + textOf(wrap, 'rangeStart');
|
|
2546
|
+
else if (isTo && !ends.pending) name += ', ' + textOf(wrap, 'rangeEnd');
|
|
2547
|
+
btn.setAttribute('aria-label', name);
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2550
|
+
function repaintRange() {
|
|
2551
|
+
Array.prototype.forEach.call(panel.querySelectorAll('.fdy-cal__day'), function (btn) {
|
|
2552
|
+
if (btn._date) paintRange(btn, btn._date);
|
|
2553
|
+
});
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
function onRangeHover(e) {
|
|
2557
|
+
if (!anchor) return;
|
|
2558
|
+
var cell = e.target && e.target.closest ? e.target.closest('.fdy-cal__day') : null;
|
|
2559
|
+
if (!cell || !cell._date || cell.disabled) return;
|
|
2560
|
+
if (preview && sameDay(preview, cell._date)) return;
|
|
2561
|
+
preview = cell._date;
|
|
2562
|
+
repaintRange();
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
/* First pick: the start, and the panel stays open for the end. Second pick on or after it: the
|
|
2566
|
+
range is whole, committed and announced, and the panel closes. A second pick BEFORE the start
|
|
2567
|
+
becomes the new start instead of silently swapping the two, which would leave the reader
|
|
2568
|
+
wondering which end they just moved. */
|
|
2569
|
+
function pickRange(d) {
|
|
2570
|
+
var day = startOfDay(d);
|
|
2571
|
+
focusDate = day;
|
|
2572
|
+
if (!anchor || day.getTime() < anchor.getTime()) {
|
|
2573
|
+
anchor = day;
|
|
2574
|
+
preview = day;
|
|
2575
|
+
render();
|
|
2576
|
+
focusFocusDate();
|
|
2577
|
+
return;
|
|
2578
|
+
}
|
|
2579
|
+
selected = anchor;
|
|
2580
|
+
selectedEnd = day;
|
|
2581
|
+
anchor = null;
|
|
2582
|
+
preview = null;
|
|
2583
|
+
updateDisplay();
|
|
2584
|
+
wrap.dispatchEvent(new CustomEvent('fdy-daterange-settled', {
|
|
2585
|
+
bubbles: true, detail: { from: toISO(selected), to: toISO(selectedEnd) }
|
|
2586
|
+
}));
|
|
2587
|
+
close(true);
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2461
2590
|
function renderMonths() {
|
|
2462
2591
|
panel.innerHTML = '';
|
|
2463
2592
|
var year = view.getFullYear();
|
|
@@ -2677,6 +2806,9 @@
|
|
|
2677
2806
|
|
|
2678
2807
|
function moveFocus(next) {
|
|
2679
2808
|
focusDate = next;
|
|
2809
|
+
/* The keyboard previews the band exactly as the pointer does, or a keyboard user would pick
|
|
2810
|
+
the end without ever seeing the range they are about to commit. */
|
|
2811
|
+
if (anchor) preview = startOfDay(next);
|
|
2680
2812
|
if (next.getMonth() !== view.getMonth() || next.getFullYear() !== view.getFullYear()) {
|
|
2681
2813
|
view = new Date(next.getFullYear(), next.getMonth(), 1);
|
|
2682
2814
|
}
|
|
@@ -2705,6 +2837,7 @@
|
|
|
2705
2837
|
|
|
2706
2838
|
function pick(d) {
|
|
2707
2839
|
if (isDisabled(d)) return;
|
|
2840
|
+
if (rangeMode) { pickRange(d); return; }
|
|
2708
2841
|
selected = startOfDay(d);
|
|
2709
2842
|
focusDate = selected;
|
|
2710
2843
|
updateDisplay();
|
|
@@ -2781,6 +2914,10 @@
|
|
|
2781
2914
|
|
|
2782
2915
|
function close(returnFocus) {
|
|
2783
2916
|
if (panel.hidden) return;
|
|
2917
|
+
/* Every way out that is not a second pick drops half a range: the value never held it, so
|
|
2918
|
+
there is nothing to restore, only the start this opening was waiting on. */
|
|
2919
|
+
anchor = null;
|
|
2920
|
+
preview = null;
|
|
2784
2921
|
var p = popCtl(); if (p) p.hide(); else panel.hidden = true;
|
|
2785
2922
|
trigger.setAttribute('aria-expanded', 'false');
|
|
2786
2923
|
trigger.classList.remove('is-open');
|
|
@@ -2802,8 +2939,11 @@
|
|
|
2802
2939
|
var api = {
|
|
2803
2940
|
wrap: wrap,
|
|
2804
2941
|
setState: setState,
|
|
2805
|
-
getValue: function () {
|
|
2806
|
-
|
|
2942
|
+
getValue: function () {
|
|
2943
|
+
if (rangeMode) return rangeValue();
|
|
2944
|
+
return selected ? (monthOnly ? toISOMonth(selected) : toISO(selected)) : '';
|
|
2945
|
+
},
|
|
2946
|
+
clear: function () { selected = null; selectedEnd = null; updateDisplay(); if (!panel.hidden) render(); },
|
|
2807
2947
|
setMin: function (iso) { minDate = parseVal(iso); if (!panel.hidden) render(); },
|
|
2808
2948
|
setMax: function (iso) { maxDate = parseVal(iso); if (!panel.hidden) render(); },
|
|
2809
2949
|
setRange: function (fromIso, toIso) {
|
|
@@ -2820,6 +2960,9 @@
|
|
|
2820
2960
|
if (root.dataset.fdyDrReady === '1') return;
|
|
2821
2961
|
if (root.closest('[data-fdy-ignore]')) return;
|
|
2822
2962
|
root.dataset.fdyDrReady = '1';
|
|
2963
|
+
/* One field: the root IS the picker, and the range logic lives in initPicker beside the
|
|
2964
|
+
calendar it draws on. The split layout below is unchanged. */
|
|
2965
|
+
if (root.getAttribute('data-layout') === 'single') { initPicker(root); return; }
|
|
2823
2966
|
var fromEl = root.querySelector('[data-fdy-datepicker][data-role="from"]');
|
|
2824
2967
|
var toEl = root.querySelector('[data-fdy-datepicker][data-role="to"]');
|
|
2825
2968
|
if (!fromEl || !toEl) return;
|
package/docs/agent-onboarding.md
CHANGED
|
@@ -20,34 +20,35 @@ the **root of the consuming project**:
|
|
|
20
20
|
|
|
21
21
|
All UI in this project is built from Freeday: a **token-driven CSS kit** (`fdy-*` classes on plain
|
|
22
22
|
markup) with **typed components for Vue, React and Blazor** layered on top. Most of the kit is
|
|
23
|
-
markup + classes;
|
|
23
|
+
markup + classes; the interactive components listed below also ship a typed wrapper, and in those three stacks
|
|
24
24
|
the wrapper is the correct way to use them.
|
|
25
25
|
|
|
26
26
|
**0. First decide which entry point this project uses. This is not an optimisation. Get it wrong
|
|
27
27
|
and the code looks correct and fails later.**
|
|
28
28
|
|
|
29
|
-
| This project's stack | Import the
|
|
29
|
+
| This project's stack | Import the typed wrappers from | Binding |
|
|
30
30
|
|---|---|---|
|
|
31
31
|
| Vue 3 | `@cahyo-dimas/freeday/vue` | `v-model` |
|
|
32
32
|
| React 18/19 | `@cahyo-dimas/freeday/react` | `value` + `onChange` |
|
|
33
33
|
| Blazor (net8.0) | `@using Freeday.Blazor` (RCL) | `@bind-Value` |
|
|
34
34
|
| Static HTML, Svelte, server-rendered templates… | no wrapper: raw markup + the enhancer script | `fdy-*` DOM events |
|
|
35
35
|
|
|
36
|
-
The
|
|
36
|
+
The typed wrappers: **FdyCombo · FdyDatepicker · FdyMonthpicker · FdyDateRange · FdyTimepicker ·
|
|
37
37
|
FdyAutocomplete · FdyCascade · FdyCfl · FdyChart · FdyTable · FdyModal · FdyDrawer · FdyAppShell**. In
|
|
38
|
-
Vue/React/Blazor, **never hand-write the raw markup + enhancer for these
|
|
38
|
+
Vue/React/Blazor, **never hand-write the raw markup + enhancer for any of these.** The raw path *appears* to work: the enhancer auto-initialises
|
|
39
39
|
once on `DOMContentLoaded` and the first render is correct. Then it fails quietly: DOM your framework
|
|
40
40
|
renders later is never hydrated, and the widget's state lives in the DOM instead of in your
|
|
41
41
|
framework's state.
|
|
42
42
|
|
|
43
43
|
Everything else is the same in every stack: plain `fdy-*` markup (button, card, badge, alert,
|
|
44
44
|
table markup, layout…). For the *other* interactive components (chips, stepper, input mask, file
|
|
45
|
-
upload, tree, tabs, menu, rating, slider, form validation, carousel,
|
|
45
|
+
upload, tree, tabs, menu, rating, slider, form validation, carousel, datetimepicker) there is no
|
|
46
46
|
wrapper, use the raw markup and hydrate it:
|
|
47
47
|
|
|
48
48
|
- **Vue / React:** `useFreeday(rootRef)` from the same import path, plus `import '@cahyo-dimas/freeday'`
|
|
49
|
-
once at app entry to register the enhancers. (The
|
|
50
|
-
are native Vue/React implementations of the same markup, not wrappers over the enhancer.
|
|
49
|
+
once at app entry to register the enhancers. (The typed wrappers do **not** need this: they
|
|
50
|
+
are native Vue/React implementations of the same markup, not wrappers over the enhancer. The one
|
|
51
|
+
exception is `FdyChart`, which paints through the enhancer and draws nothing without that import.)
|
|
51
52
|
- **Blazor:** `FreedayBlazor.initAll` interop. (Here the typed components *are* thin wrappers over
|
|
52
53
|
the enhancers, so the enhancer script is always required.)
|
|
53
54
|
|
|
@@ -76,7 +77,7 @@ wrapper, use the raw markup and hydrate it:
|
|
|
76
77
|
Icon-only buttons need `aria-label`. Status is never colour-only.
|
|
77
78
|
7. Interactive components need their enhancer script loaded (see the table in COMPONENTS.md); in an
|
|
78
79
|
SPA, re-hydrate dynamic DOM with `useFreeday` / `FreedayBlazor.initAll`. This applies to the
|
|
79
|
-
components **without** a typed wrapper. For the
|
|
80
|
+
components **without** a typed wrapper. For the ones listed in step 0, use the wrapper instead.
|
|
80
81
|
8. Freeday owns components + tokens, **not layout**. Grids/stacks/one-off gaps come from our own
|
|
81
82
|
layout layer. Build its theme on `var(--space-N)` so both systems stay in step.
|
|
82
83
|
9. The enhancers render their own English UI strings (pager, filter dialog, validation). Never
|
|
@@ -103,7 +104,7 @@ Blazor). Then verify the agent can actually read those files. An agent that can'
|
|
|
103
104
|
| `dist/freeday.media.css` | The breakpoints as `@custom-media` (`@cahyo-dimas/freeday/media`), so a responsive rule in your CSS states the kit's condition instead of a retyped literal. Needs PostCSS; carries no rules, and is **not** in the bundle. |
|
|
104
105
|
| `src/components/*.css` | The authoritative source for every class, when a doc is ambiguous. |
|
|
105
106
|
| `tokens/tokens.json` | Every token in W3C DTCG format, machine-readable. |
|
|
106
|
-
| `adapters/vue` · `adapters/react` · `adapters/blazor` | Typed wrappers
|
|
107
|
+
| `adapters/vue` · `adapters/react` · `adapters/blazor` | Typed wrappers: the same set in each, listed in step 0, plus `FdyTableFooter`, which is a part of `FdyTable`. |
|
|
107
108
|
|
|
108
109
|
The live docs (with an interactive playground) are at
|
|
109
110
|
<https://cahyo-dimas.github.io/freeday-ui-kit/>, and the repo (including three complete example
|
package/docs/getting-started.md
CHANGED
|
@@ -21,7 +21,7 @@ Freeday = **CSS** (semantic tokens + `fdy-*` classes) + **zero-dependency JS enh
|
|
|
21
21
|
the enhancer owns the widget's DOM. You **listen for `fdy-*` events** (all bubbling
|
|
22
22
|
`CustomEvent`s, data in `event.detail`) → store them in your framework state. Event/API contract
|
|
23
23
|
table: [`integrations.md` §Event & API contract](integrations.md).
|
|
24
|
-
**On Vue, React or Blazor this is not the path to take for
|
|
24
|
+
**On Vue, React or Blazor this is not the path to take for the components with a typed wrapper.** `FdyCombo`,
|
|
25
25
|
`FdyDatepicker`, `FdyMonthpicker`, `FdyDateRange`, `FdyTimepicker`, `FdyAutocomplete`, `FdyCascade`, `FdyCfl`,
|
|
26
26
|
`FdyChart`, `FdyTable`, `FdyModal`, `FdyDrawer`, `FdyAppShell` ship typed wrappers that own the state properly (Vue and
|
|
27
27
|
React re-implement the interaction natively; Blazor wraps the enhancer over interop). Use them;
|
|
@@ -198,7 +198,7 @@ live docs also have a copy button per component.
|
|
|
198
198
|
```bash
|
|
199
199
|
npm i @cahyo-dimas/freeday
|
|
200
200
|
```
|
|
201
|
-
Lands in `package.json` as `"@cahyo-dimas/freeday": "^3.
|
|
201
|
+
Lands in `package.json` as `"@cahyo-dimas/freeday": "^3.20.0"` (public npm package). `dist/` is
|
|
202
202
|
committed and published → no build step; `npm ci` runs without auth.
|
|
203
203
|
|
|
204
204
|
### 2. Import the CSS + enhancers **once** in your entry (`src/main.ts`)
|
|
@@ -317,7 +317,7 @@ dev; `useFreeday` is idempotent, so it's safe.
|
|
|
317
317
|
### 5. Alternative: typed controlled components
|
|
318
318
|
For fields you'd normally write as a native `<select>`/`<input type="date">`,
|
|
319
319
|
`@cahyo-dimas/freeday/react` also exports typed **controlled** components with plain `value`/`onChange`,
|
|
320
|
-
no manual event bubbling — the same
|
|
320
|
+
no manual event bubbling — the same set listed in §Core concepts #2, at parity with the Vue
|
|
321
321
|
`v-model` components above:
|
|
322
322
|
```tsx
|
|
323
323
|
import { FdyCombo } from '@cahyo-dimas/freeday/react';
|
|
@@ -452,7 +452,7 @@ kit's CSS/enhancers), then bind:
|
|
|
452
452
|
<FdyChart Type="donut" Values="_byCity" Labels="_cityLabels" AriaLabel="Revenue by city" />
|
|
453
453
|
<FdyDrawer @bind-Open="_drawerOpen" Title="Detail" Side="right">…</FdyDrawer>
|
|
454
454
|
```
|
|
455
|
-
|
|
455
|
+
The same components, at parity with the Vue/React adapters: **`FdyModal`** · **`FdyDrawer`** (`@bind-Open`,
|
|
456
456
|
`Title`, `Size`/`Side`, `Dismissible`) · **`FdyCombo<TValue>`** · **`FdyDatepicker`** ·
|
|
457
457
|
**`FdyMonthpicker`** (`@bind-Value` as `yyyy-MM`) · **`FdyTimepicker`** (`@bind-Value` as `HH:MM`) · **`FdyAutocomplete`** · **`FdyCascade`** · **`FdyDateRange`** (`@bind-From`/`@bind-To`) ·
|
|
458
458
|
**`FdyCfl<TRow>`** (async `LoadPage`) · **`FdyChart`** · **`FdyTable<TRow>`** (client sort/filter/page,
|