@sereno-ds/ui 0.25.3 → 0.25.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.
|
@@ -12,6 +12,14 @@ interface TimeSlot {
|
|
|
12
12
|
* popover to jump straight to a month or year. `year` / `month` set the *initial*
|
|
13
13
|
* view; the component then owns it. Pass `onMonthChange` to react to navigation
|
|
14
14
|
* (e.g. fetch the new month's availability).
|
|
15
|
+
*
|
|
16
|
+
* The day grid uses roving tabindex (SS-228) — only one cell is ever in the
|
|
17
|
+
* Tab order, so Tab enters/leaves it in one stop instead of one per day.
|
|
18
|
+
* Arrow keys move by day/week and cross month boundaries on overflow;
|
|
19
|
+
* Home/End move within the current week row; PageUp/PageDown step the
|
|
20
|
+
* month. An `unavailable` day stays focusable (`aria-disabled`, not the
|
|
21
|
+
* native `disabled` — a disabled button can't receive focus at all) so the
|
|
22
|
+
* cursor can still land on it, just not select it.
|
|
15
23
|
*/
|
|
16
24
|
interface DateTimePickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
17
25
|
/** Initial year. Defaults to the current year. */
|
|
@@ -37,6 +37,13 @@ function DateTimePicker({
|
|
|
37
37
|
const rootRef = React.useRef(null);
|
|
38
38
|
const titleRef = React.useRef(null);
|
|
39
39
|
const popRef = React.useRef(null);
|
|
40
|
+
const gridRef = React.useRef(null);
|
|
41
|
+
const [activeDay, setActiveDay] = React.useState(() => {
|
|
42
|
+
if (selectedDate) return selectedDate;
|
|
43
|
+
const todayIndex = now.getFullYear() * 12 + now.getMonth();
|
|
44
|
+
return todayIndex === initialIndex ? now.getDate() : 1;
|
|
45
|
+
});
|
|
46
|
+
const shouldFocusDayRef = React.useRef(false);
|
|
40
47
|
const onMonthChangeRef = React.useRef(onMonthChange);
|
|
41
48
|
React.useEffect(() => {
|
|
42
49
|
onMonthChangeRef.current = onMonthChange;
|
|
@@ -81,6 +88,61 @@ function DateTimePicker({
|
|
|
81
88
|
while (cells.length < 42) cells.push(null);
|
|
82
89
|
const cellH = renderDay ? 48 : 38;
|
|
83
90
|
const years = Array.from({ length: 12 }, (_, i) => yearBase + i);
|
|
91
|
+
const rovingDay = Math.min(Math.max(1, activeDay), total);
|
|
92
|
+
const onGridKeyDown = (e) => {
|
|
93
|
+
let delta = 0;
|
|
94
|
+
switch (e.key) {
|
|
95
|
+
case "ArrowRight":
|
|
96
|
+
delta = 1;
|
|
97
|
+
break;
|
|
98
|
+
case "ArrowLeft":
|
|
99
|
+
delta = -1;
|
|
100
|
+
break;
|
|
101
|
+
case "ArrowDown":
|
|
102
|
+
delta = 7;
|
|
103
|
+
break;
|
|
104
|
+
case "ArrowUp":
|
|
105
|
+
delta = -7;
|
|
106
|
+
break;
|
|
107
|
+
case "Home": {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
const row = Math.floor((first + rovingDay - 1) / 7);
|
|
110
|
+
shouldFocusDayRef.current = true;
|
|
111
|
+
setActiveDay(Math.max(1, row * 7 - first + 1));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
case "End": {
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
const row = Math.floor((first + rovingDay - 1) / 7);
|
|
117
|
+
shouldFocusDayRef.current = true;
|
|
118
|
+
setActiveDay(Math.min(total, row * 7 + 7 - first));
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
case "PageUp":
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
shouldFocusDayRef.current = true;
|
|
124
|
+
setViewIndex((i) => i - 1);
|
|
125
|
+
return;
|
|
126
|
+
case "PageDown":
|
|
127
|
+
e.preventDefault();
|
|
128
|
+
shouldFocusDayRef.current = true;
|
|
129
|
+
setViewIndex((i) => i + 1);
|
|
130
|
+
return;
|
|
131
|
+
default:
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
const next = new Date(viewYear, viewMonth, rovingDay + delta);
|
|
136
|
+
const nextViewIndex = next.getFullYear() * 12 + next.getMonth();
|
|
137
|
+
shouldFocusDayRef.current = true;
|
|
138
|
+
if (nextViewIndex !== viewIndex) setViewIndex(nextViewIndex);
|
|
139
|
+
setActiveDay(next.getDate());
|
|
140
|
+
};
|
|
141
|
+
React.useLayoutEffect(() => {
|
|
142
|
+
if (!shouldFocusDayRef.current) return;
|
|
143
|
+
shouldFocusDayRef.current = false;
|
|
144
|
+
gridRef.current?.querySelector(`[data-day="${rovingDay}"]`)?.focus();
|
|
145
|
+
}, [viewIndex, rovingDay]);
|
|
84
146
|
return /* @__PURE__ */ jsxs(
|
|
85
147
|
"div",
|
|
86
148
|
{
|
|
@@ -293,49 +355,67 @@ function DateTimePicker({
|
|
|
293
355
|
},
|
|
294
356
|
i
|
|
295
357
|
)) }),
|
|
296
|
-
/* @__PURE__ */ jsx(
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
"
|
|
303
|
-
{
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
358
|
+
/* @__PURE__ */ jsx(
|
|
359
|
+
"div",
|
|
360
|
+
{
|
|
361
|
+
ref: gridRef,
|
|
362
|
+
onKeyDown: onGridKeyDown,
|
|
363
|
+
className: "sereno-dtp-days",
|
|
364
|
+
style: sx({ display: "grid", gridTemplateColumns: "repeat(7,1fr)", gap: "var(--space-1)" }),
|
|
365
|
+
children: cells.map((d, i) => {
|
|
366
|
+
if (d === null) return /* @__PURE__ */ jsx("span", { "aria-hidden": true, style: { height: cellH } }, i);
|
|
367
|
+
const off = unavailable.includes(d);
|
|
368
|
+
const sel = selectedDate === d && viewIndex === selectionIndex;
|
|
369
|
+
const extra = renderDay?.(d);
|
|
370
|
+
return /* @__PURE__ */ jsxs(
|
|
371
|
+
"button",
|
|
372
|
+
{
|
|
373
|
+
type: "button",
|
|
374
|
+
"data-day": d,
|
|
375
|
+
"aria-disabled": off || void 0,
|
|
376
|
+
tabIndex: d === rovingDay ? 0 : -1,
|
|
377
|
+
"aria-pressed": sel,
|
|
378
|
+
onClick: () => {
|
|
379
|
+
if (off) return;
|
|
380
|
+
setSelectionIndex(viewIndex);
|
|
381
|
+
setActiveDay(d);
|
|
382
|
+
onSelectDate?.(d);
|
|
383
|
+
},
|
|
384
|
+
style: sx({
|
|
385
|
+
height: cellH,
|
|
386
|
+
display: "flex",
|
|
387
|
+
flexDirection: "column",
|
|
388
|
+
alignItems: "center",
|
|
389
|
+
justifyContent: "center",
|
|
390
|
+
gap: 1,
|
|
391
|
+
borderRadius: "var(--radius-sm)",
|
|
392
|
+
border: "none",
|
|
393
|
+
padding: 0,
|
|
394
|
+
cursor: off ? "not-allowed" : "pointer",
|
|
395
|
+
background: sel ? "var(--interactive-primary)" : "transparent",
|
|
396
|
+
color: sel ? "var(--interactive-primary-fg)" : off ? "var(--text-disabled)" : "var(--text-primary)",
|
|
397
|
+
fontFamily: "var(--font-body)",
|
|
398
|
+
fontSize: "var(--text-sm)",
|
|
399
|
+
fontWeight: sel ? "var(--weight-bold)" : "var(--weight-medium)",
|
|
400
|
+
textDecoration: off ? "line-through" : "none",
|
|
401
|
+
transition: "var(--transition-control)"
|
|
402
|
+
// Not inline outline:none — that would always beat the
|
|
403
|
+
// .sereno-dtp-days:focus-visible rule below no matter what
|
|
404
|
+
// it says (inline style always outranks a class selector).
|
|
405
|
+
// Suppressed as a class rule instead, same specificity as
|
|
406
|
+
// the :focus-visible override that re-enables it.
|
|
407
|
+
}),
|
|
408
|
+
children: [
|
|
409
|
+
/* @__PURE__ */ jsx("span", { children: d }),
|
|
410
|
+
renderDay ? /* @__PURE__ */ jsx("span", { style: sx({ display: "flex", minHeight: 12, lineHeight: 1 }), children: extra }) : null
|
|
411
|
+
]
|
|
412
|
+
},
|
|
413
|
+
i
|
|
414
|
+
);
|
|
415
|
+
})
|
|
416
|
+
},
|
|
417
|
+
viewIndex
|
|
418
|
+
),
|
|
339
419
|
times.length > 0 && /* @__PURE__ */ jsxs("div", { style: sx({ marginTop: "var(--space-4)", paddingTop: "var(--space-4)", borderTop: "var(--border-width-hairline) solid var(--border-subtle)" }), children: [
|
|
340
420
|
/* @__PURE__ */ jsx(
|
|
341
421
|
"div",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/forms/DateTimePicker.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronDown, ChevronLeft, ChevronRight } from 'lucide-react';\nimport { sx } from '../_internal/style';\nimport { IconButton } from '../core/IconButton';\n\nexport interface TimeSlot {\n value: string;\n disabled?: boolean;\n}\n\n/**\n * Month calendar plus available time slots — the heart of the public booking flow.\n * Day names and month names render in pt-BR.\n *\n * The header navigates: ‹ / › step the month, and the centred title opens a\n * popover to jump straight to a month or year. `year` / `month` set the *initial*\n * view; the component then owns it. Pass `onMonthChange` to react to navigation\n * (e.g. fetch the new month's availability).\n */\nexport interface DateTimePickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n /** Initial year. Defaults to the current year. */\n year?: number;\n /** Initial month, 0-indexed. Defaults to the current month. */\n month?: number;\n /** Selected day-of-month. The highlight only shows in the month it was picked\n * in — navigating away and back to a *different* month never re-highlights it. */\n selectedDate?: number;\n /** Slot labels (\"09:00\") or objects with `disabled`. */\n times?: (string | TimeSlot)[];\n selectedTime?: string;\n /** Day numbers with no availability — struck through and unclickable. */\n unavailable?: number[];\n onSelectDate?: (day: number) => void;\n onSelectTime?: (time: string) => void;\n /** Fires whenever the visible month changes (arrows or the month/year popover). */\n onMonthChange?: (year: number, month: number) => void;\n /**\n * Extra content under each day number — a count badge, a dot, etc. Return\n * `null` for days with nothing to show. When set, every cell grows to keep the\n * grid even. It's the caller's job to scope this (e.g. future days only).\n */\n renderDay?: (day: number) => React.ReactNode;\n timeLabel?: string;\n}\n\nconst DOW = ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'];\nconst MONTHS = ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'];\nconst MONTHS_SHORT = ['jan', 'fev', 'mar', 'abr', 'mai', 'jun', 'jul', 'ago', 'set', 'out', 'nov', 'dez'];\n\nfunction daysIn(y: number, m: number): number {\n return new Date(y, m + 1, 0).getDate();\n}\n\nexport function DateTimePicker({\n year,\n month,\n selectedDate,\n times = [],\n selectedTime,\n unavailable = [],\n onSelectDate,\n onSelectTime,\n onMonthChange,\n renderDay,\n timeLabel = 'Horários disponíveis',\n style,\n ...rest\n}: DateTimePickerProps) {\n const now = React.useMemo(() => new Date(), []);\n // One integer for the visible month — `year*12 + month`. Keeps ‹ / › arithmetic\n // (and rapid clicks) correct across year boundaries with no Date() juggling.\n // `year` / `month` are the *initial* view; the component owns it after mount\n // (re-mount with a `key` to force a different start).\n const initialIndex = (year ?? now.getFullYear()) * 12 + (month ?? now.getMonth());\n const [viewIndex, setViewIndex] = React.useState(initialIndex);\n const viewYear = Math.floor(viewIndex / 12);\n const viewMonth = viewIndex % 12;\n // `selectedDate` is only a day number, so remember which month that pick was\n // made in — the highlight shows only there, never on the same day of another\n // month you navigate to.\n const [selectionIndex, setSelectionIndex] = React.useState(initialIndex);\n const [open, setOpen] = React.useState(false);\n const [picker, setPicker] = React.useState<'month' | 'year'>('month');\n const [yearBase, setYearBase] = React.useState(() => (year ?? now.getFullYear()) - 5);\n\n const rootRef = React.useRef<HTMLDivElement>(null);\n const titleRef = React.useRef<HTMLButtonElement>(null);\n const popRef = React.useRef<HTMLDivElement>(null);\n\n // Notify on navigation — never on mount, always with the settled value.\n const onMonthChangeRef = React.useRef(onMonthChange);\n React.useEffect(() => {\n onMonthChangeRef.current = onMonthChange;\n });\n const didMount = React.useRef(false);\n React.useEffect(() => {\n if (!didMount.current) {\n didMount.current = true;\n return;\n }\n onMonthChangeRef.current?.(Math.floor(viewIndex / 12), viewIndex % 12);\n }, [viewIndex]);\n\n // close on outside pointer; move focus into the popover on open\n React.useEffect(() => {\n if (!open) return;\n const onDown = (e: PointerEvent) => {\n if (rootRef.current && !rootRef.current.contains(e.target as Node)) {\n setOpen(false);\n setPicker('month');\n }\n };\n document.addEventListener('pointerdown', onDown, true);\n const id = requestAnimationFrame(() => popRef.current?.focus());\n return () => {\n document.removeEventListener('pointerdown', onDown, true);\n cancelAnimationFrame(id);\n };\n }, [open]);\n\n const closePopover = React.useCallback(() => {\n setOpen(false);\n setPicker('month');\n titleRef.current?.focus();\n }, []);\n const toggleOpen = React.useCallback(() => {\n setOpen((v) => {\n if (v) setPicker('month');\n return !v;\n });\n }, []);\n\n const first = new Date(viewYear, viewMonth, 1).getDay();\n const total = daysIn(viewYear, viewMonth);\n // Always 6 rows (42 cells) so the calendar's height never shifts between\n // months — trailing blanks pad it out and carry the cell height too.\n const cells: (number | null)[] = [...Array(first).fill(null), ...Array.from({ length: total }, (_, i) => i + 1)];\n while (cells.length < 42) cells.push(null);\n const cellH = renderDay ? 48 : 38;\n const years = Array.from({ length: 12 }, (_, i) => yearBase + i);\n\n return (\n <div\n {...rest}\n ref={rootRef}\n style={sx({\n position: 'relative',\n background: 'var(--bg-surface)',\n border: 'var(--border-width-hairline) solid var(--border-default)',\n borderRadius: 'var(--radius-card)',\n padding: 'var(--space-4)',\n boxShadow: 'var(--shadow-sm)',\n ...style,\n })}\n >\n <div\n style={sx({\n position: 'relative',\n display: 'grid',\n gridTemplateColumns: 'auto 1fr auto',\n alignItems: 'center',\n gap: 'var(--space-1)',\n marginBottom: 'var(--space-3)',\n })}\n >\n <IconButton label=\"Mês anterior\" size=\"sm\" onClick={() => setViewIndex((i) => i - 1)}>\n <ChevronLeft size={18} strokeWidth={1.75} />\n </IconButton>\n\n <button\n ref={titleRef}\n type=\"button\"\n className=\"sereno-dtp-title\"\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n onClick={toggleOpen}\n style={sx({\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 4,\n margin: '0 auto',\n padding: '4px 8px',\n border: 'none',\n borderRadius: 'var(--radius-sm)',\n background: 'transparent',\n cursor: 'pointer',\n fontFamily: 'var(--font-display)',\n fontSize: 'var(--text-base)',\n fontWeight: 'var(--weight-bold)',\n color: 'var(--text-primary)',\n textTransform: 'capitalize',\n })}\n >\n {MONTHS[viewMonth]} {viewYear}\n <ChevronDown size={15} strokeWidth={2} style={{ opacity: 0.6 }} />\n </button>\n\n <IconButton label=\"Próximo mês\" size=\"sm\" onClick={() => setViewIndex((i) => i + 1)}>\n <ChevronRight size={18} strokeWidth={1.75} />\n </IconButton>\n\n {open && (\n <div\n ref={popRef}\n role=\"dialog\"\n aria-label=\"Escolher mês e ano\"\n tabIndex={-1}\n onKeyDown={(e) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n closePopover();\n }\n }}\n className=\"sereno-dtp-pop\"\n style={sx({\n position: 'absolute',\n top: 'calc(100% + 6px)',\n left: '50%',\n transform: 'translateX(-50%)',\n zIndex: 20,\n width: 248,\n maxWidth: 'calc(100vw - 24px)',\n background: 'var(--bg-surface)',\n border: 'var(--border-width-hairline) solid var(--border-default)',\n borderRadius: 'var(--radius-md)',\n boxShadow: 'var(--shadow-lg)',\n padding: 'var(--space-3)',\n outline: 'none',\n })}\n >\n <div\n style={sx({\n display: 'grid',\n gridTemplateColumns: 'auto 1fr auto',\n alignItems: 'center',\n marginBottom: 'var(--space-2)',\n })}\n >\n <IconButton\n label={picker === 'month' ? 'Ano anterior' : 'Anos anteriores'}\n size=\"sm\"\n onClick={() => (picker === 'month' ? setViewIndex((i) => i - 12) : setYearBase((b) => b - 12))}\n >\n <ChevronLeft size={18} strokeWidth={1.75} />\n </IconButton>\n\n {picker === 'month' ? (\n <button\n type=\"button\"\n className=\"sereno-dtp-title\"\n onClick={() => {\n setYearBase(viewYear - 5);\n setPicker('year');\n }}\n style={sx({\n margin: '0 auto',\n padding: '4px 8px',\n border: 'none',\n borderRadius: 'var(--radius-sm)',\n background: 'transparent',\n cursor: 'pointer',\n fontFamily: 'var(--font-display)',\n fontSize: 'var(--text-sm)',\n fontWeight: 'var(--weight-bold)',\n color: 'var(--text-primary)',\n })}\n >\n {viewYear}\n </button>\n ) : (\n <span\n style={sx({\n textAlign: 'center',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-sm)',\n fontWeight: 'var(--weight-semibold)',\n color: 'var(--text-secondary)',\n })}\n >\n {years[0]}–{years[11]}\n </span>\n )}\n\n <IconButton\n label={picker === 'month' ? 'Próximo ano' : 'Próximos anos'}\n size=\"sm\"\n onClick={() => (picker === 'month' ? setViewIndex((i) => i + 12) : setYearBase((b) => b + 12))}\n >\n <ChevronRight size={18} strokeWidth={1.75} />\n </IconButton>\n </div>\n\n <div className=\"sereno-dtp-grid\" style={sx({ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 'var(--space-1)' })}>\n {picker === 'month'\n ? MONTHS_SHORT.map((mo, i) => (\n <button\n key={mo}\n type=\"button\"\n data-current={i === viewMonth || undefined}\n aria-current={i === viewMonth ? 'true' : undefined}\n onClick={() => {\n setViewIndex(viewYear * 12 + i);\n closePopover();\n }}\n >\n {mo}\n </button>\n ))\n : years.map((y) => (\n <button\n key={y}\n type=\"button\"\n data-current={y === viewYear || undefined}\n aria-current={y === viewYear ? 'true' : undefined}\n onClick={() => {\n setViewIndex(y * 12 + viewMonth);\n setPicker('month');\n }}\n >\n {y}\n </button>\n ))}\n </div>\n </div>\n )}\n </div>\n\n <div style={sx({ display: 'grid', gridTemplateColumns: 'repeat(7,1fr)', gap: 'var(--space-1)', marginBottom: 'var(--space-1)' })}>\n {DOW.map((d, i) => (\n <span\n key={i}\n style={sx({\n textAlign: 'center',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-2xs)',\n fontWeight: 'var(--weight-semibold)',\n color: 'var(--text-muted)',\n letterSpacing: 'var(--tracking-caps)',\n })}\n >\n {d}\n </span>\n ))}\n </div>\n {/* keyed on the month so cells remount cleanly — no bg transition when a\n slot morphs from one day to another on navigation. */}\n <div key={viewIndex} style={sx({ display: 'grid', gridTemplateColumns: 'repeat(7,1fr)', gap: 'var(--space-1)' })}>\n {cells.map((d, i) => {\n // Blank cells still take the row height so the 6-row grid can't collapse.\n if (d === null) return <span key={i} aria-hidden style={{ height: cellH }} />;\n const off = unavailable.includes(d);\n const sel = selectedDate === d && viewIndex === selectionIndex;\n const extra = renderDay?.(d);\n return (\n <button\n key={i}\n type=\"button\"\n disabled={off}\n aria-pressed={sel}\n onClick={() => {\n setSelectionIndex(viewIndex);\n onSelectDate?.(d);\n }}\n style={sx({\n height: cellH,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 1,\n borderRadius: 'var(--radius-sm)',\n border: 'none',\n padding: 0,\n cursor: off ? 'not-allowed' : 'pointer',\n background: sel ? 'var(--interactive-primary)' : 'transparent',\n color: sel ? 'var(--interactive-primary-fg)' : off ? 'var(--text-disabled)' : 'var(--text-primary)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-sm)',\n fontWeight: sel ? 'var(--weight-bold)' : 'var(--weight-medium)',\n textDecoration: off ? 'line-through' : 'none',\n transition: 'var(--transition-control)',\n outline: 'none',\n })}\n >\n <span>{d}</span>\n {renderDay ? <span style={sx({ display: 'flex', minHeight: 12, lineHeight: 1 })}>{extra}</span> : null}\n </button>\n );\n })}\n </div>\n {times.length > 0 && (\n <div style={sx({ marginTop: 'var(--space-4)', paddingTop: 'var(--space-4)', borderTop: 'var(--border-width-hairline) solid var(--border-subtle)' })}>\n <div\n style={sx({\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-xs)',\n fontWeight: 'var(--weight-semibold)',\n color: 'var(--text-secondary)',\n letterSpacing: 'var(--tracking-caps)',\n textTransform: 'uppercase',\n marginBottom: 'var(--space-3)',\n })}\n >\n {timeLabel}\n </div>\n <div style={sx({ display: 'grid', gridTemplateColumns: 'repeat(auto-fill,minmax(76px,1fr))', gap: 'var(--space-2)' })}>\n {times.map((t) => {\n const val = typeof t === 'string' ? t : t.value;\n const dis = typeof t === 'object' && t.disabled;\n const sel = selectedTime === val;\n return (\n <button\n key={val}\n type=\"button\"\n disabled={dis}\n onClick={() => onSelectTime && onSelectTime(val)}\n style={sx({\n height: 'var(--control-height-md)',\n borderRadius: 'var(--radius-control)',\n cursor: dis ? 'not-allowed' : 'pointer',\n border: 'var(--border-width-hairline) solid ' + (sel ? 'transparent' : 'var(--border-default)'),\n background: sel ? 'var(--interactive-accent)' : dis ? 'var(--interactive-disabled-bg)' : 'var(--bg-surface)',\n color: sel ? 'var(--interactive-accent-fg)' : dis ? 'var(--interactive-disabled-fg)' : 'var(--text-primary)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-sm)',\n fontWeight: 'var(--weight-semibold)',\n transition: 'var(--transition-control)',\n outline: 'none',\n })}\n >\n {val}\n </button>\n );\n })}\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AAwKU,cAGF,YAHE;AAtKV,YAAY,WAAW;AACvB,SAAS,aAAa,aAAa,oBAAoB;AACvD,SAAS,UAAU;AACnB,SAAS,kBAAkB;AA0C3B,MAAM,MAAM,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,GAAG;AAC9C,MAAM,SAAS,CAAC,WAAW,aAAa,YAAS,SAAS,QAAQ,SAAS,SAAS,UAAU,YAAY,WAAW,YAAY,UAAU;AAC3I,MAAM,eAAe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AAA,gBAEC,MAAK;AAAA,gBACL,UAAU;AAAA,gBACV,SAAS,MAAM,gBAAgB,aAAa,GAAG;AAAA,gBAC/C,OAAO,GAAG;AAAA,kBACR,QAAQ;AAAA,kBACR,cAAc;AAAA,kBACd,QAAQ,MAAM,gBAAgB;AAAA,kBAC9B,QAAQ,yCAAyC,MAAM,gBAAgB;AAAA,kBACvE,YAAY,MAAM,8BAA8B,MAAM,mCAAmC;AAAA,kBACzF,OAAO,MAAM,iCAAiC,MAAM,mCAAmC;AAAA,kBACvF,YAAY;AAAA,kBACZ,UAAU;AAAA,kBACV,YAAY;AAAA,kBACZ,YAAY;AAAA,kBACZ,SAAS;AAAA,gBACX,CAAC;AAAA,gBAEA;AAAA;AAAA,cAlBI;AAAA,YAmBP;AAAA,UAEJ,CAAC,GACH;AAAA,WACF;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/forms/DateTimePicker.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronDown, ChevronLeft, ChevronRight } from 'lucide-react';\nimport { sx } from '../_internal/style';\nimport { IconButton } from '../core/IconButton';\n\nexport interface TimeSlot {\n value: string;\n disabled?: boolean;\n}\n\n/**\n * Month calendar plus available time slots — the heart of the public booking flow.\n * Day names and month names render in pt-BR.\n *\n * The header navigates: ‹ / › step the month, and the centred title opens a\n * popover to jump straight to a month or year. `year` / `month` set the *initial*\n * view; the component then owns it. Pass `onMonthChange` to react to navigation\n * (e.g. fetch the new month's availability).\n *\n * The day grid uses roving tabindex (SS-228) — only one cell is ever in the\n * Tab order, so Tab enters/leaves it in one stop instead of one per day.\n * Arrow keys move by day/week and cross month boundaries on overflow;\n * Home/End move within the current week row; PageUp/PageDown step the\n * month. An `unavailable` day stays focusable (`aria-disabled`, not the\n * native `disabled` — a disabled button can't receive focus at all) so the\n * cursor can still land on it, just not select it.\n */\nexport interface DateTimePickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n /** Initial year. Defaults to the current year. */\n year?: number;\n /** Initial month, 0-indexed. Defaults to the current month. */\n month?: number;\n /** Selected day-of-month. The highlight only shows in the month it was picked\n * in — navigating away and back to a *different* month never re-highlights it. */\n selectedDate?: number;\n /** Slot labels (\"09:00\") or objects with `disabled`. */\n times?: (string | TimeSlot)[];\n selectedTime?: string;\n /** Day numbers with no availability — struck through and unclickable. */\n unavailable?: number[];\n onSelectDate?: (day: number) => void;\n onSelectTime?: (time: string) => void;\n /** Fires whenever the visible month changes (arrows or the month/year popover). */\n onMonthChange?: (year: number, month: number) => void;\n /**\n * Extra content under each day number — a count badge, a dot, etc. Return\n * `null` for days with nothing to show. When set, every cell grows to keep the\n * grid even. It's the caller's job to scope this (e.g. future days only).\n */\n renderDay?: (day: number) => React.ReactNode;\n timeLabel?: string;\n}\n\nconst DOW = ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'];\nconst MONTHS = ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'];\nconst MONTHS_SHORT = ['jan', 'fev', 'mar', 'abr', 'mai', 'jun', 'jul', 'ago', 'set', 'out', 'nov', 'dez'];\n\nfunction daysIn(y: number, m: number): number {\n return new Date(y, m + 1, 0).getDate();\n}\n\nexport function DateTimePicker({\n year,\n month,\n selectedDate,\n times = [],\n selectedTime,\n unavailable = [],\n onSelectDate,\n onSelectTime,\n onMonthChange,\n renderDay,\n timeLabel = 'Horários disponíveis',\n style,\n ...rest\n}: DateTimePickerProps) {\n const now = React.useMemo(() => new Date(), []);\n // One integer for the visible month — `year*12 + month`. Keeps ‹ / › arithmetic\n // (and rapid clicks) correct across year boundaries with no Date() juggling.\n // `year` / `month` are the *initial* view; the component owns it after mount\n // (re-mount with a `key` to force a different start).\n const initialIndex = (year ?? now.getFullYear()) * 12 + (month ?? now.getMonth());\n const [viewIndex, setViewIndex] = React.useState(initialIndex);\n const viewYear = Math.floor(viewIndex / 12);\n const viewMonth = viewIndex % 12;\n // `selectedDate` is only a day number, so remember which month that pick was\n // made in — the highlight shows only there, never on the same day of another\n // month you navigate to.\n const [selectionIndex, setSelectionIndex] = React.useState(initialIndex);\n const [open, setOpen] = React.useState(false);\n const [picker, setPicker] = React.useState<'month' | 'year'>('month');\n const [yearBase, setYearBase] = React.useState(() => (year ?? now.getFullYear()) - 5);\n\n const rootRef = React.useRef<HTMLDivElement>(null);\n const titleRef = React.useRef<HTMLButtonElement>(null);\n const popRef = React.useRef<HTMLDivElement>(null);\n const gridRef = React.useRef<HTMLDivElement>(null);\n\n // Roving tabindex for the day grid: only one cell is ever in the Tab\n // order (below), so Tab enters/leaves the whole grid in one stop instead\n // of one per day. `activeDay` is the day-of-month that cell represents —\n // clamped to the visible month's length at render (below), since it\n // persists across a month change (‹ / › or an arrow-key crossing) where\n // the same day number may no longer exist (e.g. the 31st, into February).\n const [activeDay, setActiveDay] = React.useState(() => {\n if (selectedDate) return selectedDate;\n const todayIndex = now.getFullYear() * 12 + now.getMonth();\n return todayIndex === initialIndex ? now.getDate() : 1;\n });\n // Set right before a keyboard move changes activeDay/viewIndex; consumed\n // by the layout effect below to focus the new cell once it's in the DOM —\n // never on an unrelated render (a prop change, a re-render from the\n // parent) or the initial mount.\n const shouldFocusDayRef = React.useRef(false);\n\n // Notify on navigation — never on mount, always with the settled value.\n const onMonthChangeRef = React.useRef(onMonthChange);\n React.useEffect(() => {\n onMonthChangeRef.current = onMonthChange;\n });\n const didMount = React.useRef(false);\n React.useEffect(() => {\n if (!didMount.current) {\n didMount.current = true;\n return;\n }\n onMonthChangeRef.current?.(Math.floor(viewIndex / 12), viewIndex % 12);\n }, [viewIndex]);\n\n // close on outside pointer; move focus into the popover on open\n React.useEffect(() => {\n if (!open) return;\n const onDown = (e: PointerEvent) => {\n if (rootRef.current && !rootRef.current.contains(e.target as Node)) {\n setOpen(false);\n setPicker('month');\n }\n };\n document.addEventListener('pointerdown', onDown, true);\n const id = requestAnimationFrame(() => popRef.current?.focus());\n return () => {\n document.removeEventListener('pointerdown', onDown, true);\n cancelAnimationFrame(id);\n };\n }, [open]);\n\n const closePopover = React.useCallback(() => {\n setOpen(false);\n setPicker('month');\n titleRef.current?.focus();\n }, []);\n const toggleOpen = React.useCallback(() => {\n setOpen((v) => {\n if (v) setPicker('month');\n return !v;\n });\n }, []);\n\n const first = new Date(viewYear, viewMonth, 1).getDay();\n const total = daysIn(viewYear, viewMonth);\n // Always 6 rows (42 cells) so the calendar's height never shifts between\n // months — trailing blanks pad it out and carry the cell height too.\n const cells: (number | null)[] = [...Array(first).fill(null), ...Array.from({ length: total }, (_, i) => i + 1)];\n while (cells.length < 42) cells.push(null);\n const cellH = renderDay ? 48 : 38;\n const years = Array.from({ length: 12 }, (_, i) => yearBase + i);\n const rovingDay = Math.min(Math.max(1, activeDay), total);\n\n // Arrow keys move the roving cursor by real calendar days — crossing into\n // the adjacent month's grid when they overflow the visible one, rather\n // than stopping dead at the edge. Home/End stay within the current week\n // row; PageUp/PageDown step the month (reusing the same ‹ / › state\n // change, so onMonthChange fires identically either way).\n const onGridKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n let delta = 0;\n switch (e.key) {\n case 'ArrowRight':\n delta = 1;\n break;\n case 'ArrowLeft':\n delta = -1;\n break;\n case 'ArrowDown':\n delta = 7;\n break;\n case 'ArrowUp':\n delta = -7;\n break;\n case 'Home': {\n e.preventDefault();\n const row = Math.floor((first + rovingDay - 1) / 7);\n shouldFocusDayRef.current = true;\n setActiveDay(Math.max(1, row * 7 - first + 1));\n return;\n }\n case 'End': {\n e.preventDefault();\n const row = Math.floor((first + rovingDay - 1) / 7);\n shouldFocusDayRef.current = true;\n setActiveDay(Math.min(total, row * 7 + 7 - first));\n return;\n }\n case 'PageUp':\n e.preventDefault();\n shouldFocusDayRef.current = true;\n setViewIndex((i) => i - 1);\n return;\n case 'PageDown':\n e.preventDefault();\n shouldFocusDayRef.current = true;\n setViewIndex((i) => i + 1);\n return;\n default:\n return;\n }\n e.preventDefault();\n const next = new Date(viewYear, viewMonth, rovingDay + delta);\n const nextViewIndex = next.getFullYear() * 12 + next.getMonth();\n shouldFocusDayRef.current = true;\n if (nextViewIndex !== viewIndex) setViewIndex(nextViewIndex);\n setActiveDay(next.getDate());\n };\n\n // Runs after the grid above (keyed on viewIndex, so a month change remounts\n // it) has committed the DOM for the new activeDay/viewIndex — only then\n // does the target cell actually exist to focus.\n React.useLayoutEffect(() => {\n if (!shouldFocusDayRef.current) return;\n shouldFocusDayRef.current = false;\n gridRef.current?.querySelector<HTMLButtonElement>(`[data-day=\"${rovingDay}\"]`)?.focus();\n }, [viewIndex, rovingDay]);\n\n return (\n <div\n {...rest}\n ref={rootRef}\n style={sx({\n position: 'relative',\n background: 'var(--bg-surface)',\n border: 'var(--border-width-hairline) solid var(--border-default)',\n borderRadius: 'var(--radius-card)',\n padding: 'var(--space-4)',\n boxShadow: 'var(--shadow-sm)',\n ...style,\n })}\n >\n <div\n style={sx({\n position: 'relative',\n display: 'grid',\n gridTemplateColumns: 'auto 1fr auto',\n alignItems: 'center',\n gap: 'var(--space-1)',\n marginBottom: 'var(--space-3)',\n })}\n >\n <IconButton label=\"Mês anterior\" size=\"sm\" onClick={() => setViewIndex((i) => i - 1)}>\n <ChevronLeft size={18} strokeWidth={1.75} />\n </IconButton>\n\n <button\n ref={titleRef}\n type=\"button\"\n className=\"sereno-dtp-title\"\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n onClick={toggleOpen}\n style={sx({\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 4,\n margin: '0 auto',\n padding: '4px 8px',\n border: 'none',\n borderRadius: 'var(--radius-sm)',\n background: 'transparent',\n cursor: 'pointer',\n fontFamily: 'var(--font-display)',\n fontSize: 'var(--text-base)',\n fontWeight: 'var(--weight-bold)',\n color: 'var(--text-primary)',\n textTransform: 'capitalize',\n })}\n >\n {MONTHS[viewMonth]} {viewYear}\n <ChevronDown size={15} strokeWidth={2} style={{ opacity: 0.6 }} />\n </button>\n\n <IconButton label=\"Próximo mês\" size=\"sm\" onClick={() => setViewIndex((i) => i + 1)}>\n <ChevronRight size={18} strokeWidth={1.75} />\n </IconButton>\n\n {open && (\n <div\n ref={popRef}\n role=\"dialog\"\n aria-label=\"Escolher mês e ano\"\n tabIndex={-1}\n onKeyDown={(e) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n closePopover();\n }\n }}\n className=\"sereno-dtp-pop\"\n style={sx({\n position: 'absolute',\n top: 'calc(100% + 6px)',\n left: '50%',\n transform: 'translateX(-50%)',\n zIndex: 20,\n width: 248,\n maxWidth: 'calc(100vw - 24px)',\n background: 'var(--bg-surface)',\n border: 'var(--border-width-hairline) solid var(--border-default)',\n borderRadius: 'var(--radius-md)',\n boxShadow: 'var(--shadow-lg)',\n padding: 'var(--space-3)',\n outline: 'none',\n })}\n >\n <div\n style={sx({\n display: 'grid',\n gridTemplateColumns: 'auto 1fr auto',\n alignItems: 'center',\n marginBottom: 'var(--space-2)',\n })}\n >\n <IconButton\n label={picker === 'month' ? 'Ano anterior' : 'Anos anteriores'}\n size=\"sm\"\n onClick={() => (picker === 'month' ? setViewIndex((i) => i - 12) : setYearBase((b) => b - 12))}\n >\n <ChevronLeft size={18} strokeWidth={1.75} />\n </IconButton>\n\n {picker === 'month' ? (\n <button\n type=\"button\"\n className=\"sereno-dtp-title\"\n onClick={() => {\n setYearBase(viewYear - 5);\n setPicker('year');\n }}\n style={sx({\n margin: '0 auto',\n padding: '4px 8px',\n border: 'none',\n borderRadius: 'var(--radius-sm)',\n background: 'transparent',\n cursor: 'pointer',\n fontFamily: 'var(--font-display)',\n fontSize: 'var(--text-sm)',\n fontWeight: 'var(--weight-bold)',\n color: 'var(--text-primary)',\n })}\n >\n {viewYear}\n </button>\n ) : (\n <span\n style={sx({\n textAlign: 'center',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-sm)',\n fontWeight: 'var(--weight-semibold)',\n color: 'var(--text-secondary)',\n })}\n >\n {years[0]}–{years[11]}\n </span>\n )}\n\n <IconButton\n label={picker === 'month' ? 'Próximo ano' : 'Próximos anos'}\n size=\"sm\"\n onClick={() => (picker === 'month' ? setViewIndex((i) => i + 12) : setYearBase((b) => b + 12))}\n >\n <ChevronRight size={18} strokeWidth={1.75} />\n </IconButton>\n </div>\n\n <div className=\"sereno-dtp-grid\" style={sx({ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 'var(--space-1)' })}>\n {picker === 'month'\n ? MONTHS_SHORT.map((mo, i) => (\n <button\n key={mo}\n type=\"button\"\n data-current={i === viewMonth || undefined}\n aria-current={i === viewMonth ? 'true' : undefined}\n onClick={() => {\n setViewIndex(viewYear * 12 + i);\n closePopover();\n }}\n >\n {mo}\n </button>\n ))\n : years.map((y) => (\n <button\n key={y}\n type=\"button\"\n data-current={y === viewYear || undefined}\n aria-current={y === viewYear ? 'true' : undefined}\n onClick={() => {\n setViewIndex(y * 12 + viewMonth);\n setPicker('month');\n }}\n >\n {y}\n </button>\n ))}\n </div>\n </div>\n )}\n </div>\n\n <div style={sx({ display: 'grid', gridTemplateColumns: 'repeat(7,1fr)', gap: 'var(--space-1)', marginBottom: 'var(--space-1)' })}>\n {DOW.map((d, i) => (\n <span\n key={i}\n style={sx({\n textAlign: 'center',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-2xs)',\n fontWeight: 'var(--weight-semibold)',\n color: 'var(--text-muted)',\n letterSpacing: 'var(--tracking-caps)',\n })}\n >\n {d}\n </span>\n ))}\n </div>\n {/* keyed on the month so cells remount cleanly — no bg transition when a\n slot morphs from one day to another on navigation. */}\n <div\n key={viewIndex}\n ref={gridRef}\n onKeyDown={onGridKeyDown}\n className=\"sereno-dtp-days\"\n style={sx({ display: 'grid', gridTemplateColumns: 'repeat(7,1fr)', gap: 'var(--space-1)' })}\n >\n {cells.map((d, i) => {\n // Blank cells still take the row height so the 6-row grid can't collapse.\n if (d === null) return <span key={i} aria-hidden style={{ height: cellH }} />;\n const off = unavailable.includes(d);\n const sel = selectedDate === d && viewIndex === selectionIndex;\n const extra = renderDay?.(d);\n return (\n <button\n key={i}\n type=\"button\"\n data-day={d}\n // Not the native `disabled` — an unavailable day stays a real,\n // focusable stop on the roving cursor (aria-disabled only) so\n // arrow-key navigation can still land on it and the user can\n // tell it exists, matching the WAI-ARIA date-grid pattern. A\n // truly `disabled` button can't receive focus at all, which\n // would make the roving tabindex below silently break.\n aria-disabled={off || undefined}\n tabIndex={d === rovingDay ? 0 : -1}\n aria-pressed={sel}\n onClick={() => {\n if (off) return;\n setSelectionIndex(viewIndex);\n // Keep the roving cursor in sync with a mouse pick too — a\n // click already moves real DOM focus onto this button\n // natively, so without this the *next* arrow press would\n // jump from wherever the keyboard cursor was left instead\n // of from the day the user can see is focused/selected.\n setActiveDay(d);\n onSelectDate?.(d);\n }}\n style={sx({\n height: cellH,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 1,\n borderRadius: 'var(--radius-sm)',\n border: 'none',\n padding: 0,\n cursor: off ? 'not-allowed' : 'pointer',\n background: sel ? 'var(--interactive-primary)' : 'transparent',\n color: sel ? 'var(--interactive-primary-fg)' : off ? 'var(--text-disabled)' : 'var(--text-primary)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-sm)',\n fontWeight: sel ? 'var(--weight-bold)' : 'var(--weight-medium)',\n textDecoration: off ? 'line-through' : 'none',\n transition: 'var(--transition-control)',\n // Not inline outline:none — that would always beat the\n // .sereno-dtp-days:focus-visible rule below no matter what\n // it says (inline style always outranks a class selector).\n // Suppressed as a class rule instead, same specificity as\n // the :focus-visible override that re-enables it.\n })}\n >\n <span>{d}</span>\n {renderDay ? <span style={sx({ display: 'flex', minHeight: 12, lineHeight: 1 })}>{extra}</span> : null}\n </button>\n );\n })}\n </div>\n {times.length > 0 && (\n <div style={sx({ marginTop: 'var(--space-4)', paddingTop: 'var(--space-4)', borderTop: 'var(--border-width-hairline) solid var(--border-subtle)' })}>\n <div\n style={sx({\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-xs)',\n fontWeight: 'var(--weight-semibold)',\n color: 'var(--text-secondary)',\n letterSpacing: 'var(--tracking-caps)',\n textTransform: 'uppercase',\n marginBottom: 'var(--space-3)',\n })}\n >\n {timeLabel}\n </div>\n <div style={sx({ display: 'grid', gridTemplateColumns: 'repeat(auto-fill,minmax(76px,1fr))', gap: 'var(--space-2)' })}>\n {times.map((t) => {\n const val = typeof t === 'string' ? t : t.value;\n const dis = typeof t === 'object' && t.disabled;\n const sel = selectedTime === val;\n return (\n <button\n key={val}\n type=\"button\"\n disabled={dis}\n onClick={() => onSelectTime && onSelectTime(val)}\n style={sx({\n height: 'var(--control-height-md)',\n borderRadius: 'var(--radius-control)',\n cursor: dis ? 'not-allowed' : 'pointer',\n border: 'var(--border-width-hairline) solid ' + (sel ? 'transparent' : 'var(--border-default)'),\n background: sel ? 'var(--interactive-accent)' : dis ? 'var(--interactive-disabled-bg)' : 'var(--bg-surface)',\n color: sel ? 'var(--interactive-accent-fg)' : dis ? 'var(--interactive-disabled-fg)' : 'var(--text-primary)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-sm)',\n fontWeight: 'var(--weight-semibold)',\n transition: 'var(--transition-control)',\n outline: 'none',\n })}\n >\n {val}\n </button>\n );\n })}\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AAmQU,cAGF,YAHE;AAjQV,YAAY,WAAW;AACvB,SAAS,aAAa,aAAa,oBAAoB;AACvD,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAkD3B,MAAM,MAAM,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,GAAG;AAC9C,MAAM,SAAS,CAAC,WAAW,aAAa,YAAS,SAAS,QAAQ,SAAS,SAAS,UAAU,YAAY,WAAW,YAAY,UAAU;AAC3I,MAAM,eAAe,CAAC,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,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WAAW,0DAA0D,CAAC,GAChJ;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO,GAAG;AAAA,gBACR,YAAY;AAAA,gBACZ,UAAU;AAAA,gBACV,YAAY;AAAA,gBACZ,OAAO;AAAA,gBACP,eAAe;AAAA,gBACf,eAAe;AAAA,gBACf,cAAc;AAAA,cAChB,CAAC;AAAA,cAEA;AAAA;AAAA,UACH;AAAA,UACA,oBAAC,SAAI,OAAO,GAAG,EAAE,SAAS,QAAQ,qBAAqB,sCAAsC,KAAK,iBAAiB,CAAC,GACjH,gBAAM,IAAI,CAAC,MAAM;AAChB,kBAAM,MAAM,OAAO,MAAM,WAAW,IAAI,EAAE;AAC1C,kBAAM,MAAM,OAAO,MAAM,YAAY,EAAE;AACvC,kBAAM,MAAM,iBAAiB;AAC7B,mBACE;AAAA,cAAC;AAAA;AAAA,gBAEC,MAAK;AAAA,gBACL,UAAU;AAAA,gBACV,SAAS,MAAM,gBAAgB,aAAa,GAAG;AAAA,gBAC/C,OAAO,GAAG;AAAA,kBACR,QAAQ;AAAA,kBACR,cAAc;AAAA,kBACd,QAAQ,MAAM,gBAAgB;AAAA,kBAC9B,QAAQ,yCAAyC,MAAM,gBAAgB;AAAA,kBACvE,YAAY,MAAM,8BAA8B,MAAM,mCAAmC;AAAA,kBACzF,OAAO,MAAM,iCAAiC,MAAM,mCAAmC;AAAA,kBACvF,YAAY;AAAA,kBACZ,UAAU;AAAA,kBACV,YAAY;AAAA,kBACZ,YAAY;AAAA,kBACZ,SAAS;AAAA,gBACX,CAAC;AAAA,gBAEA;AAAA;AAAA,cAlBI;AAAA,YAmBP;AAAA,UAEJ,CAAC,GACH;AAAA,WACF;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
package/dist/forms/Radio.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ import * as React from 'react';
|
|
|
5
5
|
* Group by giving every option the same `name`. Visually matched to `Checkbox` — same 20px
|
|
6
6
|
* box, same hover and label/description rhythm — differing only in the pill radius and dot.
|
|
7
7
|
* Host must include the `.sereno-radio:checked` rule (see globals.css).
|
|
8
|
+
*
|
|
9
|
+
* Wrap every group in a `<fieldset>` / `<legend>` — `name` alone makes the browser treat
|
|
10
|
+
* the options as one native group (arrow keys move between them, only one can be checked),
|
|
11
|
+
* but without a `<legend>` a screen reader has no accessible name for what the choice is
|
|
12
|
+
* between, only "Online, radio button, 1 of 3" with no context.
|
|
8
13
|
*/
|
|
9
14
|
interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> {
|
|
10
15
|
label?: string;
|
package/dist/forms/Radio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/forms/Radio.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/**\n * Single-choice control for mutually exclusive options (payment method, appointment format).\n * Group by giving every option the same `name`. Visually matched to `Checkbox` — same 20px\n * box, same hover and label/description rhythm — differing only in the pill radius and dot.\n * Host must include the `.sereno-radio:checked` rule (see globals.css).\n */\nexport interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> {\n label?: string;\n /** Secondary line under the label. */\n description?: string;\n /** Circle size. `sm` (16px) for dense lists; `md` (20px) everywhere else. Matches `Checkbox`. */\n size?: 'sm' | 'md';\n}\n\nexport function Radio({ label, description, checked, defaultChecked, disabled, size = 'md', onChange, style, ...rest }: RadioProps) {\n const [hover, setHover] = React.useState(false);\n const box = size === 'sm' ? 16 : 20;\n return (\n <label\n onMouseEnter={() => setHover(true)}\n onMouseLeave={() => setHover(false)}\n style={sx({ display: 'flex', gap: 'var(--space-3)', alignItems: 'flex-start', cursor: disabled ? 'not-allowed' : 'pointer', opacity: disabled ? 0.6 : 1, ...style })}\n >\n <span style={sx({ position: 'relative', display: 'inline-flex', flex: '0 0 auto', marginTop: size === 'sm' ? 3 : 1 })}>\n <input\n type=\"radio\"\n checked={checked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n onChange={onChange}\n {...rest}\n data-size={size}\n className=\"sereno-radio\"\n style={sx({\n appearance: 'none',\n width: box,\n height: box,\n margin: 0,\n borderRadius: 'var(--radius-pill)',\n border: 'var(--border-width-emphasis) solid ' + (hover && !disabled ? 'var(--border-brand)' : 'var(--border-strong)'),\n backgroundColor: 'var(--bg-surface)',\n cursor: 'inherit',\n transition: 'var(--transition-control)',\n })}\n />\n </span>\n <span style={sx({ display: 'flex', flexDirection: 'column', gap: 2 })}>\n {label && <span style={sx({ fontFamily: 'var(--font-body)', fontSize: 'var(--text-base)', color: 'var(--text-primary)', lineHeight: 1.35 })}>{label}</span>}\n {description && (\n <span style={sx({ fontFamily: 'var(--font-body)', fontSize: 'var(--text-xs)', color: 'var(--text-muted)', lineHeight: 1.45 })}>{description}</span>\n )}\n </span>\n </label>\n );\n}"],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../../src/forms/Radio.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { sx } from '../_internal/style';\n\n/**\n * Single-choice control for mutually exclusive options (payment method, appointment format).\n * Group by giving every option the same `name`. Visually matched to `Checkbox` — same 20px\n * box, same hover and label/description rhythm — differing only in the pill radius and dot.\n * Host must include the `.sereno-radio:checked` rule (see globals.css).\n *\n * Wrap every group in a `<fieldset>` / `<legend>` — `name` alone makes the browser treat\n * the options as one native group (arrow keys move between them, only one can be checked),\n * but without a `<legend>` a screen reader has no accessible name for what the choice is\n * between, only \"Online, radio button, 1 of 3\" with no context.\n */\nexport interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> {\n label?: string;\n /** Secondary line under the label. */\n description?: string;\n /** Circle size. `sm` (16px) for dense lists; `md` (20px) everywhere else. Matches `Checkbox`. */\n size?: 'sm' | 'md';\n}\n\nexport function Radio({ label, description, checked, defaultChecked, disabled, size = 'md', onChange, style, ...rest }: RadioProps) {\n const [hover, setHover] = React.useState(false);\n const box = size === 'sm' ? 16 : 20;\n return (\n <label\n onMouseEnter={() => setHover(true)}\n onMouseLeave={() => setHover(false)}\n style={sx({ display: 'flex', gap: 'var(--space-3)', alignItems: 'flex-start', cursor: disabled ? 'not-allowed' : 'pointer', opacity: disabled ? 0.6 : 1, ...style })}\n >\n <span style={sx({ position: 'relative', display: 'inline-flex', flex: '0 0 auto', marginTop: size === 'sm' ? 3 : 1 })}>\n <input\n type=\"radio\"\n checked={checked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n onChange={onChange}\n {...rest}\n data-size={size}\n className=\"sereno-radio\"\n style={sx({\n appearance: 'none',\n width: box,\n height: box,\n margin: 0,\n borderRadius: 'var(--radius-pill)',\n border: 'var(--border-width-emphasis) solid ' + (hover && !disabled ? 'var(--border-brand)' : 'var(--border-strong)'),\n backgroundColor: 'var(--bg-surface)',\n cursor: 'inherit',\n transition: 'var(--transition-control)',\n })}\n />\n </span>\n <span style={sx({ display: 'flex', flexDirection: 'column', gap: 2 })}>\n {label && <span style={sx({ fontFamily: 'var(--font-body)', fontSize: 'var(--text-base)', color: 'var(--text-primary)', lineHeight: 1.35 })}>{label}</span>}\n {description && (\n <span style={sx({ fontFamily: 'var(--font-body)', fontSize: 'var(--text-xs)', color: 'var(--text-muted)', lineHeight: 1.45 })}>{description}</span>\n )}\n </span>\n </label>\n );\n}"],"mappings":";AAkCQ,cAsBF,YAtBE;AAhCR,YAAY,WAAW;AACvB,SAAS,UAAU;AAqBZ,SAAS,MAAM,EAAE,OAAO,aAAa,SAAS,gBAAgB,UAAU,OAAO,MAAM,UAAU,OAAO,GAAG,KAAK,GAAe;AAClI,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAS,KAAK;AAC9C,QAAM,MAAM,SAAS,OAAO,KAAK;AACjC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,cAAc,MAAM,SAAS,IAAI;AAAA,MACjC,cAAc,MAAM,SAAS,KAAK;AAAA,MAClC,OAAO,GAAG,EAAE,SAAS,QAAQ,KAAK,kBAAkB,YAAY,cAAc,QAAQ,WAAW,gBAAgB,WAAW,SAAS,WAAW,MAAM,GAAG,GAAG,MAAM,CAAC;AAAA,MAEnK;AAAA,4BAAC,UAAK,OAAO,GAAG,EAAE,UAAU,YAAY,SAAS,eAAe,MAAM,YAAY,WAAW,SAAS,OAAO,IAAI,EAAE,CAAC,GAClH;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACC,GAAG;AAAA,YACJ,aAAW;AAAA,YACX,WAAU;AAAA,YACV,OAAO,GAAG;AAAA,cACR,YAAY;AAAA,cACZ,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,QAAQ;AAAA,cACR,cAAc;AAAA,cACd,QAAQ,yCAAyC,SAAS,CAAC,WAAW,wBAAwB;AAAA,cAC9F,iBAAiB;AAAA,cACjB,QAAQ;AAAA,cACR,YAAY;AAAA,YACd,CAAC;AAAA;AAAA,QACH,GACF;AAAA,QACA,qBAAC,UAAK,OAAO,GAAG,EAAE,SAAS,QAAQ,eAAe,UAAU,KAAK,EAAE,CAAC,GACjE;AAAA,mBAAS,oBAAC,UAAK,OAAO,GAAG,EAAE,YAAY,oBAAoB,UAAU,oBAAoB,OAAO,uBAAuB,YAAY,KAAK,CAAC,GAAI,iBAAM;AAAA,UACnJ,eACC,oBAAC,UAAK,OAAO,GAAG,EAAE,YAAY,oBAAoB,UAAU,kBAAkB,OAAO,qBAAqB,YAAY,KAAK,CAAC,GAAI,uBAAY;AAAA,WAEhJ;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
package/dist/styles.css
CHANGED
|
@@ -250,6 +250,18 @@
|
|
|
250
250
|
}
|
|
251
251
|
.sereno-dtp-grid button:hover { background: var(--interactive-ghost-hover); }
|
|
252
252
|
.sereno-dtp-grid button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
|
|
253
|
+
/* The day grid's own focus ring (SS-228) — was missing entirely: the day
|
|
254
|
+
button used to set outline:none *inline*, which always wins over a class
|
|
255
|
+
selector regardless of :focus-visible, so the roving-tabindex cursor was
|
|
256
|
+
keyboard-functional but completely invisible. Suppressed here instead —
|
|
257
|
+
same specificity as the :focus-visible rule below, so source order
|
|
258
|
+
decides and the override actually takes. Separate from .sereno-dtp-grid
|
|
259
|
+
on purpose — that class is the month/year popover's mini-grid, whose
|
|
260
|
+
:hover / [data-current] rules don't belong on a day cell (it already has
|
|
261
|
+
its own selected/today styling driven from React state, not CSS
|
|
262
|
+
attribute selectors). */
|
|
263
|
+
.sereno-dtp-days button { outline: none; }
|
|
264
|
+
.sereno-dtp-days button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
|
|
253
265
|
.sereno-dtp-grid button[data-current] {
|
|
254
266
|
background: var(--interactive-primary);
|
|
255
267
|
color: var(--interactive-primary-fg);
|