@f-ewald/components 1.26.0 → 1.27.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/README.md +3 -0
- package/custom-elements.json +1285 -95
- package/dist/calendar-day.d.ts +33 -0
- package/dist/calendar-day.d.ts.map +1 -0
- package/dist/calendar-day.js +280 -0
- package/dist/calendar-day.js.map +1 -0
- package/dist/calendar-timeline-base.d.ts +43 -0
- package/dist/calendar-timeline-base.d.ts.map +1 -0
- package/dist/calendar-timeline-base.js +113 -0
- package/dist/calendar-timeline-base.js.map +1 -0
- package/dist/calendar-week.d.ts +37 -0
- package/dist/calendar-week.d.ts.map +1 -0
- package/dist/calendar-week.js +315 -0
- package/dist/calendar-week.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/modal-dialog.d.ts +49 -0
- package/dist/modal-dialog.d.ts.map +1 -0
- package/dist/modal-dialog.js +287 -0
- package/dist/modal-dialog.js.map +1 -0
- package/dist/ui-button.d.ts +2 -0
- package/dist/ui-button.d.ts.map +1 -1
- package/dist/ui-button.js +9 -1
- package/dist/ui-button.js.map +1 -1
- package/dist/utils/calendar.d.ts +41 -0
- package/dist/utils/calendar.d.ts.map +1 -1
- package/dist/utils/calendar.js +74 -0
- package/dist/utils/calendar.js.map +1 -1
- package/docs/calendar-day.md +70 -0
- package/docs/calendar-week.md +69 -0
- package/docs/modal-dialog.md +66 -0
- package/docs/ui-button.md +1 -0
- package/llms.txt +88 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/utils/calendar.ts"],"names":[],"mappings":"AAyBA,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AAErD,uEAAuE;AACvE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,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IAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;AACxD,CAAC","sourcesContent":["import type { StatusPillColor } from \"../status-pill.js\";\nimport type { CalendarEntry } from \"../calendar-entry.js\";\n\n/** Plain data extracted from a `calendar-entry` element's properties. */\nexport interface CalendarEntryData {\n start: string;\n end: string;\n label: string;\n details?: string[];\n footer?: string;\n color: StatusPillColor;\n href?: string;\n}\n\n/** A `CalendarEntryData` with its date strings resolved to local `Date`s. */\nexport interface ResolvedCalendarEntry extends CalendarEntryData {\n startDate: Date;\n endDate: Date;\n}\n\n/** A `ResolvedCalendarEntry` assigned a stacking column by `assignLanes`. */\nexport interface LanedEntry extends ResolvedCalendarEntry {\n lane: number;\n}\n\nconst ISO_DATE_PATTERN = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\n/** Attributes whose mutations can change a rendered calendar entry. */\nexport const CALENDAR_ENTRY_ATTRIBUTES = [\"start\", \"end\", \"label\", \"color\", \"href\", \"slot\"];\n\n/** Number of days in `month` (1-12) of `year`, leap years included. */\nexport function daysInMonth(year: number, month: number): number {\n return new Date(year, month, 0).getDate();\n}\n\n/**\n * Parses `\"YYYY-MM-DD\"` as a local-midnight `Date`. Returns `null` for\n * anything that doesn't match or doesn't round-trip (e.g. \"2026-02-30\") —\n * deliberately never uses `new Date(iso)`/`.toISOString()`, both of which\n * are UTC-based and would silently shift the date in negative-UTC-offset\n * timezones.\n */\nexport function parseIsoDate(iso: string): Date | null {\n const match = ISO_DATE_PATTERN.exec(iso);\n if (!match) return null;\n\n const year = Number(match[1]);\n const month = Number(match[2]);\n const day = Number(match[3]);\n const date = new Date(year, month - 1, day);\n if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) {\n return null;\n }\n return date;\n}\n\n/** Formats a `Date`'s local year/month/day as `\"YYYY-MM-DD\"`. */\nexport function toIsoDate(date: Date): string {\n const year = String(date.getFullYear()).padStart(4, \"0\");\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n return `${year}-${month}-${day}`;\n}\n\nconst monthNameFormatter = new Intl.DateTimeFormat(undefined, { month: \"long\" });\n\n/** Locale-aware full month name for `month` (1-12). */\nexport function monthName(month: number): string {\n return monthNameFormatter.format(new Date(2000, month - 1, 1));\n}\n\n/** Sunday-first weekday abbreviations, indexed by `Date.getDay()` (0 = Sunday). */\nexport const WEEKDAY_ABBR: readonly string[] = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\n\n/**\n * Whether `date` falls on a Saturday or Sunday, per JS's `Date.getDay()`\n * convention (Sunday = 0 .. Saturday = 6) — note this differs from Python's\n * `calendar` module (Monday = 0), which the original reference\n * implementation this component's layout is based on used.\n */\nexport function isWeekend(date: Date): boolean {\n const day = date.getDay();\n return day === 0 || day === 6;\n}\n\n/** Reads normalized plain-text content from direct children assigned to a named slot. */\nfunction slottedText(el: CalendarEntry, slotName: string): string[] {\n return Array.from(el.querySelectorAll<HTMLElement>(`:scope > [slot=\"${slotName}\"]`))\n .map((node) => (node.textContent ?? \"\").replace(/\\s+/g, \" \").trim());\n}\n\n/** Reads a `calendar-entry` element's properties and named text slots into plain data. */\nexport function readCalendarEntryElement(el: CalendarEntry): CalendarEntryData {\n const title = slottedText(el, \"title\").find((line) => line.length > 0);\n const footer = slottedText(el, \"footer\").find((line) => line.length > 0);\n return {\n start: el.start,\n end: el.end,\n label: title ?? el.label,\n details: slottedText(el, \"detail\"),\n footer,\n color: el.color,\n href: el.href,\n };\n}\n\n/**\n * Resolves a `CalendarEntryData`'s date strings to `Date`s. Returns `null`\n * when `start` is missing or unparseable — such entries are dropped\n * silently rather than thrown, since this reads declarative markup a\n * consumer authored, not validated user input. A blank `end` defaults to\n * `start` (single-day entry); an `end` before `start` is clamped up to\n * `start` rather than treated as an error.\n */\nexport function resolveEntry(data: CalendarEntryData): ResolvedCalendarEntry | null {\n const startDate = parseIsoDate(data.start);\n if (!startDate) return null;\n\n const endDate = parseIsoDate(data.end) ?? startDate;\n return {\n ...data,\n details: data.details ?? [],\n startDate,\n endDate: endDate < startDate ? startDate : endDate,\n };\n}\n\n/** Whether `entry`'s inclusive date range intersects the inclusive `[rangeStart, rangeEnd]` range. */\nexport function overlapsRange(entry: ResolvedCalendarEntry, rangeStart: Date, rangeEnd: Date): boolean {\n return entry.startDate <= rangeEnd && entry.endDate >= rangeStart;\n}\n\n/**\n * Assigns each entry a 0-based stacking lane via greedy interval\n * partitioning (\"meeting rooms II\"): entries are sorted by start date, then\n * each is placed in the lowest-numbered lane whose current occupant ends\n * strictly before the entry starts. Because entry ranges are\n * inclusive-inclusive, an entry ending on day X and one starting on day X\n * both occupy day X and must not share a lane — hence the strict `<`.\n *\n * Lane assignment is meant to be computed independently per `calendar-month`\n * (from only the entries overlapping that month); an entry spanning a month\n * boundary may therefore land in a different lane in adjacent months. This\n * is an accepted v1 limitation, not a bug.\n */\nexport function assignLanes(entries: ResolvedCalendarEntry[]): {\n entries: LanedEntry[];\n laneCount: number;\n} {\n const sorted = entries\n .map((entry, index) => ({ entry, index }))\n .sort((a, b) => {\n const startDiff = a.entry.startDate.getTime() - b.entry.startDate.getTime();\n if (startDiff !== 0) return startDiff;\n const endDiff = a.entry.endDate.getTime() - b.entry.endDate.getTime();\n if (endDiff !== 0) return endDiff;\n return a.index - b.index;\n });\n\n const laneEnds: Date[] = [];\n const laned: LanedEntry[] = [];\n for (const { entry } of sorted) {\n let lane = laneEnds.findIndex((end) => end < entry.startDate);\n if (lane === -1) {\n lane = laneEnds.length;\n laneEnds.push(entry.endDate);\n } else {\n laneEnds[lane] = entry.endDate;\n }\n laned.push({ ...entry, lane });\n }\n\n return { entries: laned, laneCount: laneEnds.length };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/utils/calendar.ts"],"names":[],"mappings":"AAyBA,MAAM,gBAAgB,GAAG,2BAA2B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CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACtF,CAAC;IAED,OAAO;QACL,GAAG,IAAI;QACP,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE;QAC3B,SAAS;QACT,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO;QAClD,MAAM;KACP,CAAC;AACJ,CAAC","sourcesContent":["import type { StatusPillColor } from \"../status-pill.js\";\nimport type { CalendarEntry } from \"../calendar-entry.js\";\n\n/** Plain data extracted from a `calendar-entry` element's properties. */\nexport interface CalendarEntryData {\n start: string;\n end: string;\n label: string;\n details?: string[];\n footer?: string;\n color: StatusPillColor;\n href?: string;\n}\n\n/** A `CalendarEntryData` with its date strings resolved to local `Date`s. */\nexport interface ResolvedCalendarEntry extends CalendarEntryData {\n startDate: Date;\n endDate: Date;\n}\n\n/** A `ResolvedCalendarEntry` assigned a stacking column by `assignLanes`. */\nexport interface LanedEntry extends ResolvedCalendarEntry {\n lane: number;\n}\n\nconst ISO_DATE_PATTERN = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst ISO_DATETIME_PATTERN = /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2})$/;\n\n/** Attributes whose mutations can change a rendered calendar entry. */\nexport const CALENDAR_ENTRY_ATTRIBUTES = [\"start\", \"end\", \"label\", \"color\", \"href\", \"slot\"];\n\n/** Number of days in `month` (1-12) of `year`, leap years included. */\nexport function daysInMonth(year: number, month: number): number {\n return new Date(year, month, 0).getDate();\n}\n\n/**\n * Parses `\"YYYY-MM-DD\"` as a local-midnight `Date`. Returns `null` for\n * anything that doesn't match or doesn't round-trip (e.g. \"2026-02-30\") —\n * deliberately never uses `new Date(iso)`/`.toISOString()`, both of which\n * are UTC-based and would silently shift the date in negative-UTC-offset\n * timezones.\n */\nexport function parseIsoDate(iso: string): Date | null {\n const match = ISO_DATE_PATTERN.exec(iso);\n if (!match) return null;\n\n const year = Number(match[1]);\n const month = Number(match[2]);\n const day = Number(match[3]);\n const date = new Date(year, month - 1, day);\n if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) {\n return null;\n }\n return date;\n}\n\n/** Formats a `Date`'s local year/month/day as `\"YYYY-MM-DD\"`. */\nexport function toIsoDate(date: Date): string {\n const year = String(date.getFullYear()).padStart(4, \"0\");\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n return `${year}-${month}-${day}`;\n}\n\nconst monthNameFormatter = new Intl.DateTimeFormat(undefined, { month: \"long\" });\n\n/** Locale-aware full month name for `month` (1-12). */\nexport function monthName(month: number): string {\n return monthNameFormatter.format(new Date(2000, month - 1, 1));\n}\n\n/** Sunday-first weekday abbreviations, indexed by `Date.getDay()` (0 = Sunday). */\nexport const WEEKDAY_ABBR: readonly string[] = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\n\n/**\n * Whether `date` falls on a Saturday or Sunday, per JS's `Date.getDay()`\n * convention (Sunday = 0 .. Saturday = 6) — note this differs from Python's\n * `calendar` module (Monday = 0), which the original reference\n * implementation this component's layout is based on used.\n */\nexport function isWeekend(date: Date): boolean {\n const day = date.getDay();\n return day === 0 || day === 6;\n}\n\n/** Reads normalized plain-text content from direct children assigned to a named slot. */\nfunction slottedText(el: CalendarEntry, slotName: string): string[] {\n return Array.from(el.querySelectorAll<HTMLElement>(`:scope > [slot=\"${slotName}\"]`))\n .map((node) => (node.textContent ?? \"\").replace(/\\s+/g, \" \").trim());\n}\n\n/** Reads a `calendar-entry` element's properties and named text slots into plain data. */\nexport function readCalendarEntryElement(el: CalendarEntry): CalendarEntryData {\n const title = slottedText(el, \"title\").find((line) => line.length > 0);\n const footer = slottedText(el, \"footer\").find((line) => line.length > 0);\n return {\n start: el.start,\n end: el.end,\n label: title ?? el.label,\n details: slottedText(el, \"detail\"),\n footer,\n color: el.color,\n href: el.href,\n };\n}\n\n/**\n * Resolves a `CalendarEntryData`'s date strings to `Date`s. Returns `null`\n * when `start` is missing or unparseable — such entries are dropped\n * silently rather than thrown, since this reads declarative markup a\n * consumer authored, not validated user input. A blank `end` defaults to\n * `start` (single-day entry); an `end` before `start` is clamped up to\n * `start` rather than treated as an error.\n */\nexport function resolveEntry(data: CalendarEntryData): ResolvedCalendarEntry | null {\n const startDate = parseIsoDate(data.start);\n if (!startDate) return null;\n\n const endDate = parseIsoDate(data.end) ?? startDate;\n return {\n ...data,\n details: data.details ?? [],\n startDate,\n endDate: endDate < startDate ? startDate : endDate,\n };\n}\n\n/** Whether `entry`'s inclusive date range intersects the inclusive `[rangeStart, rangeEnd]` range. */\nexport function overlapsRange(entry: ResolvedCalendarEntry, rangeStart: Date, rangeEnd: Date): boolean {\n return entry.startDate <= rangeEnd && entry.endDate >= rangeStart;\n}\n\n/**\n * Assigns each entry a 0-based stacking lane via greedy interval\n * partitioning (\"meeting rooms II\"): entries are sorted by start date, then\n * each is placed in the lowest-numbered lane whose current occupant ends\n * strictly before the entry starts. Because entry ranges are\n * inclusive-inclusive, an entry ending on day X and one starting on day X\n * both occupy day X and must not share a lane — hence the strict `<`.\n *\n * Lane assignment is meant to be computed independently per `calendar-month`\n * (from only the entries overlapping that month); an entry spanning a month\n * boundary may therefore land in a different lane in adjacent months. This\n * is an accepted v1 limitation, not a bug.\n */\nexport function assignLanes(entries: ResolvedCalendarEntry[]): {\n entries: LanedEntry[];\n laneCount: number;\n} {\n const sorted = entries\n .map((entry, index) => ({ entry, index }))\n .sort((a, b) => {\n const startDiff = a.entry.startDate.getTime() - b.entry.startDate.getTime();\n if (startDiff !== 0) return startDiff;\n const endDiff = a.entry.endDate.getTime() - b.entry.endDate.getTime();\n if (endDiff !== 0) return endDiff;\n return a.index - b.index;\n });\n\n const laneEnds: Date[] = [];\n const laned: LanedEntry[] = [];\n for (const { entry } of sorted) {\n let lane = laneEnds.findIndex((end) => end < entry.startDate);\n if (lane === -1) {\n lane = laneEnds.length;\n laneEnds.push(entry.endDate);\n } else {\n laneEnds[lane] = entry.endDate;\n }\n laned.push({ ...entry, lane });\n }\n\n return { entries: laned, laneCount: laneEnds.length };\n}\n\n/** Adds `days` (negative to subtract) to `date`, returning a new local `Date`. */\nexport function addDays(date: Date, days: number): Date {\n const result = new Date(date);\n result.setDate(result.getDate() + days);\n return result;\n}\n\n/** The Sunday (local midnight) of the week containing `date`, per `WEEKDAY_ABBR`'s Sunday-first convention. */\nexport function startOfWeek(date: Date): Date {\n return addDays(date, -date.getDay());\n}\n\n/** Minutes elapsed since local midnight on `date`'s day, for hour-grid vertical positioning. */\nexport function minutesSinceMidnight(date: Date): number {\n return date.getHours() * 60 + date.getMinutes();\n}\n\n/** Whether `iso` carries a time-of-day component (`\"YYYY-MM-DDTHH:MM\"`) rather than being date-only. */\nexport function hasTimeComponent(iso: string): boolean {\n return ISO_DATETIME_PATTERN.test(iso);\n}\n\n/**\n * Parses `\"YYYY-MM-DDTHH:MM\"` as a local `Date`, falling back to\n * `parseIsoDate` (local midnight) for a plain `\"YYYY-MM-DD\"` string. Returns\n * `null` for anything else, including a datetime whose components don't\n * round-trip (e.g. an invalid hour).\n */\nexport function parseIsoDateTime(iso: string): Date | null {\n const match = ISO_DATETIME_PATTERN.exec(iso);\n if (!match) return parseIsoDate(iso);\n\n const year = Number(match[1]);\n const month = Number(match[2]);\n const day = Number(match[3]);\n const hours = Number(match[4]);\n const minutes = Number(match[5]);\n const date = new Date(year, month - 1, day, hours, minutes);\n if (\n date.getFullYear() !== year ||\n date.getMonth() !== month - 1 ||\n date.getDate() !== day ||\n date.getHours() !== hours ||\n date.getMinutes() !== minutes\n ) {\n return null;\n }\n return date;\n}\n\n/**\n * A `CalendarEntryData` resolved for hour-grid (`calendar-day`/`calendar-week`)\n * rendering. Reuses the `startDate`/`endDate` field names from\n * `ResolvedCalendarEntry` so it stays structurally compatible with\n * `assignLanes`/`overlapsRange` — both operate purely on those two `Date`\n * fields via `.getTime()`, which already generalizes correctly to sub-day\n * time granularity and multi-day ranges with no changes needed.\n */\nexport interface ResolvedTimedEntry extends CalendarEntryData {\n startDate: Date;\n endDate: Date;\n /** True when neither `start` nor `end` carries a time-of-day component. */\n allDay: boolean;\n}\n\n/**\n * Resolves a `CalendarEntryData`'s date/datetime strings for hour-grid\n * rendering. Returns `null` when `start` is missing or unparseable. A blank\n * `end` defaults to `start`; when `start` has a time but `end` doesn't (or is\n * blank), `end` defaults to one hour after `start` rather than clamping to\n * `start`'s instant, so a timed entry with no explicit end still renders as\n * a visible block. `allDay` is true only when neither endpoint carries a\n * time-of-day component — this is a separate, additive resolution path from\n * `resolveEntry`/`ResolvedCalendarEntry`, which stay date-only and are used\n * unchanged by `calendar-month`/`calendar-year`.\n */\nexport function resolveTimedEntry(data: CalendarEntryData): ResolvedTimedEntry | null {\n const startDate = parseIsoDateTime(data.start);\n if (!startDate) return null;\n\n const startHasTime = hasTimeComponent(data.start);\n const endHasTime = hasTimeComponent(data.end);\n const allDay = !startHasTime && !endHasTime;\n\n let endDate = data.end ? parseIsoDateTime(data.end) : null;\n if (!endDate) {\n endDate = startHasTime ? new Date(startDate.getTime() + 60 * 60 * 1000) : startDate;\n }\n\n return {\n ...data,\n details: data.details ?? [],\n startDate,\n endDate: endDate < startDate ? startDate : endDate,\n allDay,\n };\n}\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# `<calendar-day>`
|
|
2
|
+
|
|
3
|
+
A single day rendered as an hourly time grid — a Google-Calendar-style
|
|
4
|
+
view distinct from `calendar-month`'s whole-day table. Declarative
|
|
5
|
+
`calendar-entry` children with a time-of-day in `start`/`end` (e.g.
|
|
6
|
+
`start="2026-03-05T09:00"`) render as positioned/sized blocks; entries
|
|
7
|
+
with only a date (no time) render in an all-day band above the grid.
|
|
8
|
+
Overlapping timed entries stack into side-by-side columns; overlapping
|
|
9
|
+
all-day/multi-day entries stack into lanes, same as `calendar-month`.
|
|
10
|
+
Read-only.
|
|
11
|
+
|
|
12
|
+
Shares its slotted-entry observation, resolution, and hover/focus
|
|
13
|
+
interaction sync with `calendar-week` via `CalendarTimelineBase`.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import "@f-ewald/components/calendar-day.js";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<calendar-day date="2026-07-15">
|
|
25
|
+
<calendar-entry start="2026-07-15" end="2026-07-15" label="Company holiday" color="neutral"></calendar-entry>
|
|
26
|
+
<calendar-entry start="2026-07-15T09:00" end="2026-07-15T09:30" label="Standup" color="info"></calendar-entry>
|
|
27
|
+
<calendar-entry start="2026-07-15T09:15" end="2026-07-15T10:00" label="Design review" color="primary" href="#review">
|
|
28
|
+
<span slot="detail">Walk through the new onboarding flow</span>
|
|
29
|
+
</calendar-entry>
|
|
30
|
+
</calendar-day>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Attributes / properties
|
|
34
|
+
|
|
35
|
+
| Property | Attribute | Type | Default | Description |
|
|
36
|
+
| --- | --- | --- | --- | --- |
|
|
37
|
+
| `date` | `date` | `string` | `—` | The day shown, `"YYYY-MM-DD"`. |
|
|
38
|
+
|
|
39
|
+
## Events
|
|
40
|
+
|
|
41
|
+
_None._
|
|
42
|
+
|
|
43
|
+
## Slots
|
|
44
|
+
|
|
45
|
+
| Slot | Description |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `(default)` | Declarative `calendar-entry` elements to render for this day. |
|
|
48
|
+
|
|
49
|
+
## CSS custom properties
|
|
50
|
+
|
|
51
|
+
| Custom property |
|
|
52
|
+
| --- |
|
|
53
|
+
| `--ui-border` |
|
|
54
|
+
| `--ui-danger` |
|
|
55
|
+
| `--ui-focus-ring` |
|
|
56
|
+
| `--ui-font` |
|
|
57
|
+
| `--ui-font-size-lg` |
|
|
58
|
+
| `--ui-font-size-sm` |
|
|
59
|
+
| `--ui-font-weight-medium` |
|
|
60
|
+
| `--ui-font-weight-semibold` |
|
|
61
|
+
| `--ui-hover-overlay` |
|
|
62
|
+
| `--ui-info` |
|
|
63
|
+
| `--ui-line-height-tight` |
|
|
64
|
+
| `--ui-primary` |
|
|
65
|
+
| `--ui-radius-sm` |
|
|
66
|
+
| `--ui-success` |
|
|
67
|
+
| `--ui-surface` |
|
|
68
|
+
| `--ui-text` |
|
|
69
|
+
| `--ui-text-muted` |
|
|
70
|
+
| `--ui-warning` |
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# `<calendar-week>`
|
|
2
|
+
|
|
3
|
+
Sunday-through-Saturday week rendered as one shared hourly time grid — the
|
|
4
|
+
seven-day sibling of `calendar-day`. Unlike `calendar-year` composing 12
|
|
5
|
+
`calendar-month` children, this is its own independent 7-column layout
|
|
6
|
+
(not 7 nested `<calendar-day>` elements): a single hour gutter is drawn
|
|
7
|
+
once, and multi-day/all-day entries span the days they cover as one
|
|
8
|
+
continuous bar in a shared all-day band, since lanes for that band are
|
|
9
|
+
assigned once across the whole visible week (unlike `calendar-month`'s
|
|
10
|
+
documented per-instance lane limitation). Timed entries stack into
|
|
11
|
+
side-by-side columns independently per day, same as `calendar-day`.
|
|
12
|
+
Read-only.
|
|
13
|
+
|
|
14
|
+
Shares its slotted-entry observation, resolution, and hover/focus
|
|
15
|
+
interaction sync with `calendar-day` via `CalendarTimelineBase`.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import "@f-ewald/components/calendar-week.js";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<calendar-week date="2026-07-15">
|
|
27
|
+
<calendar-entry start="2026-07-13" end="2026-07-15" label="Offsite" color="primary" href="#offsite"></calendar-entry>
|
|
28
|
+
<calendar-entry start="2026-07-14T09:00" end="2026-07-14T09:30" label="Standup" color="info"></calendar-entry>
|
|
29
|
+
<calendar-entry start="2026-07-16T14:00" end="2026-07-16T15:00" label="Customer demo" color="success"></calendar-entry>
|
|
30
|
+
</calendar-week>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Attributes / properties
|
|
34
|
+
|
|
35
|
+
| Property | Attribute | Type | Default | Description |
|
|
36
|
+
| --- | --- | --- | --- | --- |
|
|
37
|
+
| `date` | `date` | `string` | `—` | Any date within the displayed week (`"YYYY-MM-DD"`) — the week runs Sunday through Saturday. |
|
|
38
|
+
|
|
39
|
+
## Events
|
|
40
|
+
|
|
41
|
+
_None._
|
|
42
|
+
|
|
43
|
+
## Slots
|
|
44
|
+
|
|
45
|
+
| Slot | Description |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `(default)` | Declarative `calendar-entry` elements to render for this week. |
|
|
48
|
+
|
|
49
|
+
## CSS custom properties
|
|
50
|
+
|
|
51
|
+
| Custom property |
|
|
52
|
+
| --- |
|
|
53
|
+
| `--ui-border` |
|
|
54
|
+
| `--ui-danger` |
|
|
55
|
+
| `--ui-focus-ring` |
|
|
56
|
+
| `--ui-font` |
|
|
57
|
+
| `--ui-font-size-lg` |
|
|
58
|
+
| `--ui-font-size-sm` |
|
|
59
|
+
| `--ui-font-weight-medium` |
|
|
60
|
+
| `--ui-font-weight-semibold` |
|
|
61
|
+
| `--ui-hover-overlay` |
|
|
62
|
+
| `--ui-info` |
|
|
63
|
+
| `--ui-primary` |
|
|
64
|
+
| `--ui-radius-sm` |
|
|
65
|
+
| `--ui-success` |
|
|
66
|
+
| `--ui-surface` |
|
|
67
|
+
| `--ui-text` |
|
|
68
|
+
| `--ui-text-muted` |
|
|
69
|
+
| `--ui-warning` |
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# `<modal-dialog>`
|
|
2
|
+
|
|
3
|
+
Generic centered modal-dialog shell: overlay + card with header chrome, a
|
|
4
|
+
close button, and an arbitrary slotted body — the modal sibling to
|
|
5
|
+
`slide-panel` (fixed-edge) and `popover-panel` (anchored). Unlike
|
|
6
|
+
`confirm-dialog`, it has no baked-in actions; the consumer supplies the
|
|
7
|
+
body content (a form, a read-only viewer, a table) and any footer buttons
|
|
8
|
+
itself. Instant `display:none` → `display:flex` toggle, no transition.
|
|
9
|
+
Traps focus, closes on Escape, and restores focus to the trigger on
|
|
10
|
+
close, stacking correctly against other open `confirm-dialog`/
|
|
11
|
+
`slide-panel`/`popover-panel`/`modal-dialog` layers.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import "@f-ewald/components/modal-dialog.js";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<modal-dialog open heading="Changelog" dismissible>
|
|
23
|
+
Dialog body content goes here.
|
|
24
|
+
</modal-dialog>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Attributes / properties
|
|
28
|
+
|
|
29
|
+
| Property | Attribute | Type | Default | Description |
|
|
30
|
+
| --- | --- | --- | --- | --- |
|
|
31
|
+
| `open` | `open` | `boolean` | `false` | Whether the dialog is visible. |
|
|
32
|
+
| `heading` | `heading` | `string` | `""` | Title text shown in the dialog header (overridable via slot="title"). |
|
|
33
|
+
| `size` | `size` | `ModalDialogSize` | `"default"` | `"lg"` widens the dialog to 60rem for content like tables; `"default"` is 25rem; `"fullscreen"` covers the entire viewport edge-to-edge with no border-radius or overlay padding. |
|
|
34
|
+
| `dismissible` | `dismissible` | `boolean` | `false` | When true, clicking the backdrop also closes the dialog (off by default — safe for forms with unsaved input). |
|
|
35
|
+
|
|
36
|
+
## Events
|
|
37
|
+
|
|
38
|
+
| Event | Description |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| `panel-close` | User clicked the close (✕) button, pressed Escape, or (when `dismissible`) clicked the backdrop. |
|
|
41
|
+
|
|
42
|
+
## Slots
|
|
43
|
+
|
|
44
|
+
| Slot | Description |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| `(default)` | Dialog body content. |
|
|
47
|
+
| `title` | Overrides the header title text (falls back to the `heading` property). |
|
|
48
|
+
|
|
49
|
+
## CSS custom properties
|
|
50
|
+
|
|
51
|
+
| Custom property |
|
|
52
|
+
| --- |
|
|
53
|
+
| `--ui-border` |
|
|
54
|
+
| `--ui-focus-ring` |
|
|
55
|
+
| `--ui-font` |
|
|
56
|
+
| `--ui-font-size-lg` |
|
|
57
|
+
| `--ui-font-weight-semibold` |
|
|
58
|
+
| `--ui-line-height-tight` |
|
|
59
|
+
| `--ui-overlay` |
|
|
60
|
+
| `--ui-radius` |
|
|
61
|
+
| `--ui-radius-sm` |
|
|
62
|
+
| `--ui-shadow-lg` |
|
|
63
|
+
| `--ui-surface` |
|
|
64
|
+
| `--ui-surface-muted` |
|
|
65
|
+
| `--ui-text` |
|
|
66
|
+
| `--ui-text-muted` |
|
package/docs/ui-button.md
CHANGED
|
@@ -54,6 +54,7 @@ import "@f-ewald/components/ui-button.js";
|
|
|
54
54
|
| --- | --- | --- | --- | --- |
|
|
55
55
|
| `variant` | `variant` | `ButtonVariant` | `"primary"` | Visual weight. |
|
|
56
56
|
| `size` | `size` | `"sm" | "md"` | `"md"` | Size — `sm` reduces height/padding/font-size one step below the default. |
|
|
57
|
+
| `pill` | `pill` | `boolean` | `false` | Renders fully rounded (pill-shaped) corners instead of the default `--ui-radius-sm`. |
|
|
57
58
|
| `href` | `href` | `string | null` | `null` | Renders an `<a href="...">` instead of a `<button>` when set. |
|
|
58
59
|
| `type` | `type` | `"button" | "submit" | "reset"` | `"button"` | Native button `type`. Ignored when `href` is set. |
|
|
59
60
|
| `disabled` | `disabled` | `boolean` | `false` | Disables the control and dims it. |
|
package/llms.txt
CHANGED
|
@@ -384,6 +384,37 @@ Example:
|
|
|
384
384
|
</script>
|
|
385
385
|
```
|
|
386
386
|
|
|
387
|
+
## <calendar-day>
|
|
388
|
+
|
|
389
|
+
A single day rendered as an hourly time grid — a Google-Calendar-style
|
|
390
|
+
view distinct from `calendar-month`'s whole-day table. Declarative
|
|
391
|
+
`calendar-entry` children with a time-of-day in `start`/`end` (e.g.
|
|
392
|
+
`start="2026-03-05T09:00"`) render as positioned/sized blocks; entries
|
|
393
|
+
with only a date (no time) render in an all-day band above the grid.
|
|
394
|
+
Overlapping timed entries stack into side-by-side columns; overlapping
|
|
395
|
+
all-day/multi-day entries stack into lanes, same as `calendar-month`.
|
|
396
|
+
Read-only.
|
|
397
|
+
|
|
398
|
+
Shares its slotted-entry observation, resolution, and hover/focus
|
|
399
|
+
interaction sync with `calendar-week` via `CalendarTimelineBase`.
|
|
400
|
+
|
|
401
|
+
Import: `import "@f-ewald/components/calendar-day.js";`
|
|
402
|
+
|
|
403
|
+
Properties: `date` (attribute `date`) : string, default —
|
|
404
|
+
Events: none
|
|
405
|
+
CSS custom properties: `--ui-border`, `--ui-danger`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-lg`, `--ui-font-size-sm`, `--ui-font-weight-medium`, `--ui-font-weight-semibold`, `--ui-hover-overlay`, `--ui-info`, `--ui-line-height-tight`, `--ui-primary`, `--ui-radius-sm`, `--ui-success`, `--ui-surface`, `--ui-text`, `--ui-text-muted`, `--ui-warning`
|
|
406
|
+
|
|
407
|
+
Example:
|
|
408
|
+
```html
|
|
409
|
+
<calendar-day date="2026-07-15">
|
|
410
|
+
<calendar-entry start="2026-07-15" end="2026-07-15" label="Company holiday" color="neutral"></calendar-entry>
|
|
411
|
+
<calendar-entry start="2026-07-15T09:00" end="2026-07-15T09:30" label="Standup" color="info"></calendar-entry>
|
|
412
|
+
<calendar-entry start="2026-07-15T09:15" end="2026-07-15T10:00" label="Design review" color="primary" href="#review">
|
|
413
|
+
<span slot="detail">Walk through the new onboarding flow</span>
|
|
414
|
+
</calendar-entry>
|
|
415
|
+
</calendar-day>
|
|
416
|
+
```
|
|
417
|
+
|
|
387
418
|
## <calendar-entry>
|
|
388
419
|
|
|
389
420
|
Declarative metadata for one calendar event, consumed by a parent
|
|
@@ -451,6 +482,37 @@ Example:
|
|
|
451
482
|
</calendar-month>
|
|
452
483
|
```
|
|
453
484
|
|
|
485
|
+
## <calendar-week>
|
|
486
|
+
|
|
487
|
+
Sunday-through-Saturday week rendered as one shared hourly time grid — the
|
|
488
|
+
seven-day sibling of `calendar-day`. Unlike `calendar-year` composing 12
|
|
489
|
+
`calendar-month` children, this is its own independent 7-column layout
|
|
490
|
+
(not 7 nested `<calendar-day>` elements): a single hour gutter is drawn
|
|
491
|
+
once, and multi-day/all-day entries span the days they cover as one
|
|
492
|
+
continuous bar in a shared all-day band, since lanes for that band are
|
|
493
|
+
assigned once across the whole visible week (unlike `calendar-month`'s
|
|
494
|
+
documented per-instance lane limitation). Timed entries stack into
|
|
495
|
+
side-by-side columns independently per day, same as `calendar-day`.
|
|
496
|
+
Read-only.
|
|
497
|
+
|
|
498
|
+
Shares its slotted-entry observation, resolution, and hover/focus
|
|
499
|
+
interaction sync with `calendar-day` via `CalendarTimelineBase`.
|
|
500
|
+
|
|
501
|
+
Import: `import "@f-ewald/components/calendar-week.js";`
|
|
502
|
+
|
|
503
|
+
Properties: `date` (attribute `date`) : string, default —
|
|
504
|
+
Events: none
|
|
505
|
+
CSS custom properties: `--ui-border`, `--ui-danger`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-lg`, `--ui-font-size-sm`, `--ui-font-weight-medium`, `--ui-font-weight-semibold`, `--ui-hover-overlay`, `--ui-info`, `--ui-primary`, `--ui-radius-sm`, `--ui-success`, `--ui-surface`, `--ui-text`, `--ui-text-muted`, `--ui-warning`
|
|
506
|
+
|
|
507
|
+
Example:
|
|
508
|
+
```html
|
|
509
|
+
<calendar-week date="2026-07-15">
|
|
510
|
+
<calendar-entry start="2026-07-13" end="2026-07-15" label="Offsite" color="primary" href="#offsite"></calendar-entry>
|
|
511
|
+
<calendar-entry start="2026-07-14T09:00" end="2026-07-14T09:30" label="Standup" color="info"></calendar-entry>
|
|
512
|
+
<calendar-entry start="2026-07-16T14:00" end="2026-07-16T15:00" label="Customer demo" color="success"></calendar-entry>
|
|
513
|
+
</calendar-week>
|
|
514
|
+
```
|
|
515
|
+
|
|
454
516
|
## <calendar-year>
|
|
455
517
|
|
|
456
518
|
A full year of `calendar-month` blocks, generated from declarative
|
|
@@ -1364,6 +1426,31 @@ See the [changelog](#markdown-view) for details.`;
|
|
|
1364
1426
|
</script>
|
|
1365
1427
|
```
|
|
1366
1428
|
|
|
1429
|
+
## <modal-dialog>
|
|
1430
|
+
|
|
1431
|
+
Generic centered modal-dialog shell: overlay + card with header chrome, a
|
|
1432
|
+
close button, and an arbitrary slotted body — the modal sibling to
|
|
1433
|
+
`slide-panel` (fixed-edge) and `popover-panel` (anchored). Unlike
|
|
1434
|
+
`confirm-dialog`, it has no baked-in actions; the consumer supplies the
|
|
1435
|
+
body content (a form, a read-only viewer, a table) and any footer buttons
|
|
1436
|
+
itself. Instant `display:none` → `display:flex` toggle, no transition.
|
|
1437
|
+
Traps focus, closes on Escape, and restores focus to the trigger on
|
|
1438
|
+
close, stacking correctly against other open `confirm-dialog`/
|
|
1439
|
+
`slide-panel`/`popover-panel`/`modal-dialog` layers.
|
|
1440
|
+
|
|
1441
|
+
Import: `import "@f-ewald/components/modal-dialog.js";`
|
|
1442
|
+
|
|
1443
|
+
Properties: `open` (attribute `open`) : boolean, default false; `heading` (attribute `heading`) : string, default ""; `size` (attribute `size`) : ModalDialogSize, default "default"; `dismissible` (attribute `dismissible`) : boolean, default false
|
|
1444
|
+
Events: `panel-close`
|
|
1445
|
+
CSS custom properties: `--ui-border`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-lg`, `--ui-font-weight-semibold`, `--ui-line-height-tight`, `--ui-overlay`, `--ui-radius`, `--ui-radius-sm`, `--ui-shadow-lg`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
|
|
1446
|
+
|
|
1447
|
+
Example:
|
|
1448
|
+
```html
|
|
1449
|
+
<modal-dialog open heading="Changelog" dismissible>
|
|
1450
|
+
Dialog body content goes here.
|
|
1451
|
+
</modal-dialog>
|
|
1452
|
+
```
|
|
1453
|
+
|
|
1367
1454
|
## <multi-select>
|
|
1368
1455
|
|
|
1369
1456
|
A form-associated multi-select: a trigger showing a compact summary of the
|
|
@@ -2238,7 +2325,7 @@ white-to-gray) gradient too.
|
|
|
2238
2325
|
|
|
2239
2326
|
Import: `import "@f-ewald/components/ui-button.js";`
|
|
2240
2327
|
|
|
2241
|
-
Properties: `variant` (attribute `variant`) : ButtonVariant, default "primary"; `size` (attribute `size`) : "sm" | "md", default "md"; `href` (attribute `href`) : string | null, default null; `type` (attribute `type`) : "button" | "submit" | "reset", default "button"; `disabled` (attribute `disabled`) : boolean, default false; `busy` (attribute `busy`) : boolean, default false
|
|
2328
|
+
Properties: `variant` (attribute `variant`) : ButtonVariant, default "primary"; `size` (attribute `size`) : "sm" | "md", default "md"; `pill` (attribute `pill`) : boolean, default false; `href` (attribute `href`) : string | null, default null; `type` (attribute `type`) : "button" | "submit" | "reset", default "button"; `disabled` (attribute `disabled`) : boolean, default false; `busy` (attribute `busy`) : boolean, default false
|
|
2242
2329
|
Events: none
|
|
2243
2330
|
CSS custom properties: `--ui-border`, `--ui-button-background`, `--ui-button-background-active`, `--ui-button-background-hover`, `--ui-button-border`, `--ui-button-danger-background`, `--ui-button-danger-background-active`, `--ui-button-danger-background-hover`, `--ui-button-danger-border`, `--ui-button-highlight`, `--ui-button-secondary-`, `--ui-button-secondary-background`, `--ui-button-secondary-background-active`, `--ui-button-secondary-background-hover`, `--ui-button-secondary-border`, `--ui-button-secondary-border-hover`, `--ui-button-text-shadow`, `--ui-danger`, `--ui-danger-hover`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-size-xs`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-on-accent`, `--ui-primary`, `--ui-primary-hover`, `--ui-radius-sm`, `--ui-text`, `--ui-text-muted`
|
|
2244
2331
|
|