@f-ewald/components 1.46.1 → 1.47.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.
Files changed (49) hide show
  1. package/README.md +1 -0
  2. package/custom-elements.json +4520 -2463
  3. package/dist/address-autocomplete.d.ts +9 -44
  4. package/dist/address-autocomplete.d.ts.map +1 -1
  5. package/dist/address-autocomplete.js +16 -597
  6. package/dist/address-autocomplete.js.map +1 -1
  7. package/dist/app-shell.d.ts.map +1 -1
  8. package/dist/app-shell.js +8 -5
  9. package/dist/app-shell.js.map +1 -1
  10. package/dist/autocomplete-base.d.ts +79 -0
  11. package/dist/autocomplete-base.d.ts.map +1 -0
  12. package/dist/autocomplete-base.js +679 -0
  13. package/dist/autocomplete-base.js.map +1 -0
  14. package/dist/autocomplete-input.d.ts +9 -44
  15. package/dist/autocomplete-input.d.ts.map +1 -1
  16. package/dist/autocomplete-input.js +18 -647
  17. package/dist/autocomplete-input.js.map +1 -1
  18. package/dist/calendar-month.d.ts +3 -2
  19. package/dist/calendar-month.d.ts.map +1 -1
  20. package/dist/calendar-month.js +5 -3
  21. package/dist/calendar-month.js.map +1 -1
  22. package/dist/calendar-timeline-base.d.ts +3 -2
  23. package/dist/calendar-timeline-base.d.ts.map +1 -1
  24. package/dist/calendar-timeline-base.js +5 -3
  25. package/dist/calendar-timeline-base.js.map +1 -1
  26. package/dist/drop-zone.d.ts +78 -0
  27. package/dist/drop-zone.d.ts.map +1 -0
  28. package/dist/drop-zone.js +479 -0
  29. package/dist/drop-zone.js.map +1 -0
  30. package/dist/icons.d.ts +2 -0
  31. package/dist/icons.d.ts.map +1 -1
  32. package/dist/icons.js +2 -0
  33. package/dist/icons.js.map +1 -1
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +1 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/mcp-server.js +13 -10
  39. package/dist/mcp-server.js.map +1 -1
  40. package/dist/utils/calendar.d.ts +5 -0
  41. package/dist/utils/calendar.d.ts.map +1 -1
  42. package/dist/utils/calendar.js +17 -0
  43. package/dist/utils/calendar.js.map +1 -1
  44. package/docs/address-autocomplete.md +7 -7
  45. package/docs/autocomplete-input.md +5 -5
  46. package/docs/drop-zone.md +87 -0
  47. package/docs/icons.md +1 -0
  48. package/llms.txt +42 -2
  49. package/package.json +1 -1
@@ -139,6 +139,23 @@ export function assignLanes(entries, { exclusiveEnd = false } = {}) {
139
139
  }
140
140
  return { entries: laned, laneCount: laneEnds.length };
141
141
  }
142
+ /**
143
+ * Calls `onMidnight` at every local midnight, so a "today" highlight moves
144
+ * while a page stays open. Returns a function that stops the timer.
145
+ */
146
+ export function onEachMidnight(onMidnight) {
147
+ let timer;
148
+ const schedule = () => {
149
+ const now = new Date();
150
+ const next = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);
151
+ timer = setTimeout(() => {
152
+ onMidnight();
153
+ schedule();
154
+ }, next.getTime() - now.getTime());
155
+ };
156
+ schedule();
157
+ return () => clearTimeout(timer);
158
+ }
142
159
  /** Adds `days` (negative to subtract) to `date`, returning a new local `Date`. */
143
160
  export function addDays(date, days) {
144
161
  const result = new Date(date);
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/utils/calendar.ts"],"names":[],"mappings":"AA0BA,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AACrD,MAAM,oBAAoB,GAAG,2CAA2C,CAAC;AAEzE,uEAAuE;AACvE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE5F,uEAAuE;AACvE,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,KAAa;IACrD,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;AAC5C,CAAC;AAED;;;;;;GAM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,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;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAyB,EAAE,UAAgB,EAAE,QAAc;IAC5F,IAAI,KAAK,CAAC,MAAM;QAAE,OAAO,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IACpE,OAAO,KAAK,CAAC,SAAS,IAAI,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,UAAU,IAAI,KAAK,CAAC,SAAS,IAAI,UAAU,CAAC,CAAC;AACtG,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 location?: 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 const location = slottedText(el, \"location\").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 location,\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 *\n * Pass `exclusiveEnd` for timed hour-grid entries, whose end is an instant\n * rather than an inclusive day: a 09:00–10:00 and a 10:00–11:00 entry then\n * share a lane.\n */\nexport function assignLanes(\n entries: ResolvedCalendarEntry[],\n { exclusiveEnd = false }: { exclusiveEnd?: boolean } = {},\n): {\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) => (exclusiveEnd ? end <= entry.startDate : 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\n/**\n * Whether an hour-grid entry intersects `[rangeStart, rangeEnd]`. All-day\n * entries use `overlapsRange`'s inclusive days; timed entries end\n * exclusively, so one ending at 00:00 does not reach into the next day. A\n * zero-length timed entry still counts where it starts.\n */\nexport function overlapsTimedRange(entry: ResolvedTimedEntry, rangeStart: Date, rangeEnd: Date): boolean {\n if (entry.allDay) return overlapsRange(entry, rangeStart, rangeEnd);\n return entry.startDate <= rangeEnd && (entry.endDate > rangeStart || entry.startDate >= rangeStart);\n}\n"]}
1
+ {"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/utils/calendar.ts"],"names":[],"mappings":"AA0BA,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AACrD,MAAM,oBAAoB,GAAG,2CAA2C,CAAC;AAEzE,uEAAuE;AACvE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE5F,uEAAuE;AACvE,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,KAAa;IACrD,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;AAC5C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAExB,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;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C,YAAY,IAAI,CAAC,UAAU,CAAC;IAE5C,IAAI,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,YAAY,CAAC,CAAC,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;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAyB,EAAE,UAAgB,EAAE,QAAc;IAC5F,IAAI,KAAK,CAAC,MAAM;QAAE,OAAO,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IACpE,OAAO,KAAK,CAAC,SAAS,IAAI,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,UAAU,IAAI,KAAK,CAAC,SAAS,IAAI,UAAU,CAAC,CAAC;AACtG,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 location?: 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 const location = slottedText(el, \"location\").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 location,\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 *\n * Pass `exclusiveEnd` for timed hour-grid entries, whose end is an instant\n * rather than an inclusive day: a 09:00–10:00 and a 10:00–11:00 entry then\n * share a lane.\n */\nexport function assignLanes(\n entries: ResolvedCalendarEntry[],\n { exclusiveEnd = false }: { exclusiveEnd?: boolean } = {},\n): {\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) => (exclusiveEnd ? end <= entry.startDate : 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/**\n * Calls `onMidnight` at every local midnight, so a \"today\" highlight moves\n * while a page stays open. Returns a function that stops the timer.\n */\nexport function onEachMidnight(onMidnight: () => void): () => void {\n let timer: ReturnType<typeof setTimeout>;\n const schedule = () => {\n const now = new Date();\n const next = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);\n timer = setTimeout(() => {\n onMidnight();\n schedule();\n }, next.getTime() - now.getTime());\n };\n schedule();\n return () => clearTimeout(timer);\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\n/**\n * Whether an hour-grid entry intersects `[rangeStart, rangeEnd]`. All-day\n * entries use `overlapsRange`'s inclusive days; timed entries end\n * exclusively, so one ending at 00:00 does not reach into the next day. A\n * zero-length timed entry still counts where it starts.\n */\nexport function overlapsTimedRange(entry: ResolvedTimedEntry, rangeStart: Date, rangeEnd: Date): boolean {\n if (entry.allDay) return overlapsRange(entry, rangeStart, rangeEnd);\n return entry.startDate <= rangeEnd && (entry.endDate > rangeStart || entry.startDate >= rangeStart);\n}\n"]}
@@ -36,20 +36,20 @@ import "@f-ewald/components/address-autocomplete.js";
36
36
 
37
37
  | Property | Attribute | Type | Default | Description |
38
38
  | --- | --- | --- | --- | --- |
39
- | `value` | `value` | `string` | `""` | Current input value; also the form-associated value submitted with the form. |
40
- | `placeholder` | `placeholder` | `string` | `""` | Placeholder text shown when the input is empty. |
41
- | `required` | `required` | `boolean` | `false` | Marks the input as required for native form validation. |
42
- | `disabled` | `disabled` | `boolean` | `false` | Disables the input and closes its suggestion popup. |
43
- | `clearable` | `clearable` | `boolean` | `false` | Shows an in-field clear action while the control has a value. |
44
39
  | `types` | `types` | `string` | `"address"` | Mapbox `types` param, e.g. "address" or "address,poi". |
45
40
  | `endpoint` | `endpoint` | `string` | `"https://api.mapbox.com/search/geocode/v6/forward"` | Geocoding endpoint URL. Defaults to the Mapbox Geocoding v6 forward URL. |
46
41
  | `accessToken` | `access-token` | `string` | `""` | Mapbox access token. Required for requests to succeed. |
47
42
  | `bbox` | `bbox` | `string` | `""` | Optional bounding box bias, comma-separated `west,south,east,north`. |
48
43
  | `proximity` | `proximity` | `string` | `""` | Optional proximity bias, comma-separated `lng,lat`. |
49
- | `debounce` | `debounce` | `number` | `300` | Debounce delay (ms) before firing a geocode request after typing. |
50
- | `minLength` | `min-length` | `number` | `3` | Minimum query length before suggestions are fetched. |
51
44
  | `suggestions` | _(JS property only)_ | `AddressSuggestion[] | null` | `null` | Fixed candidate list to filter locally instead of fetching from `endpoint`. When set (non-null), no network request is ever made — this takes priority over the API mode. |
52
45
  | `selectedSuggestion` | _(JS property only)_ | `AddressSuggestion | null` | `—` | Last-picked suggestion, or null once the input diverges from it. _(read-only)_ |
46
+ | `value` | `value` | `string` | `""` | Current input value; also the form-associated value submitted with the form. |
47
+ | `placeholder` | `placeholder` | `string` | `""` | Placeholder text shown when the input is empty. |
48
+ | `required` | `required` | `boolean` | `false` | Marks the input as required for native form validation. |
49
+ | `disabled` | `disabled` | `boolean` | `false` | Disables the input and closes its suggestion popup. |
50
+ | `clearable` | `clearable` | `boolean` | `false` | Shows an in-field clear action while the control has a value. |
51
+ | `debounce` | `debounce` | `number` | `300` | Debounce delay (ms) before firing a request/filter after typing. |
52
+ | `minLength` | `min-length` | `number` | `3` | Minimum query length before suggestions are shown. |
53
53
 
54
54
  ## Events
55
55
 
@@ -59,18 +59,18 @@ import "@f-ewald/components/autocomplete-input.js";
59
59
 
60
60
  | Property | Attribute | Type | Default | Description |
61
61
  | --- | --- | --- | --- | --- |
62
+ | `endpoint` | `endpoint` | `string` | `""` | API endpoint queried in API mode. Ignored when `options` is set. |
63
+ | `queryParam` | `query-param` | `string` | `"q"` | Query string parameter name the current input text is sent under. |
64
+ | `options` | _(JS property only)_ | `AutocompleteOption[] | null` | `null` | Fixed candidate list to filter locally instead of fetching from `endpoint`. When set (non-null), no network request is ever made — this takes priority over the API mode. |
65
+ | `selectedKey` | `selected-key` | `string | null` | `null` | Key of the selected option: set by picking one, or by the caller together with `value`. |
66
+ | `selectedOption` | _(JS property only)_ | `AutocompleteOption | null` | `—` | Selected option (picked, or matching `selectedKey`), or null once the input diverges from it. _(read-only)_ |
62
67
  | `value` | `value` | `string` | `""` | Current input value; also the form-associated value submitted with the form. |
63
68
  | `placeholder` | `placeholder` | `string` | `""` | Placeholder text shown when the input is empty. |
64
69
  | `required` | `required` | `boolean` | `false` | Marks the input as required for native form validation. |
65
70
  | `disabled` | `disabled` | `boolean` | `false` | Disables the input and closes its suggestion popup. |
66
71
  | `clearable` | `clearable` | `boolean` | `false` | Shows an in-field clear action while the control has a value. |
67
- | `endpoint` | `endpoint` | `string` | `""` | API endpoint queried in API mode. Ignored when `options` is set. |
68
- | `queryParam` | `query-param` | `string` | `"q"` | Query string parameter name the current input text is sent under. |
69
72
  | `debounce` | `debounce` | `number` | `300` | Debounce delay (ms) before firing a request/filter after typing. |
70
73
  | `minLength` | `min-length` | `number` | `3` | Minimum query length before suggestions are shown. |
71
- | `options` | _(JS property only)_ | `AutocompleteOption[] | null` | `null` | Fixed candidate list to filter locally instead of fetching from `endpoint`. When set (non-null), no network request is ever made — this takes priority over the API mode. |
72
- | `selectedKey` | `selected-key` | `string | null` | `null` | Key of the selected option: set by picking one, or by the caller together with `value`. |
73
- | `selectedOption` | _(JS property only)_ | `AutocompleteOption | null` | `—` | Selected option (picked, or matching `selectedKey`), or null once the input diverges from it. _(read-only)_ |
74
74
 
75
75
  ## Events
76
76
 
@@ -0,0 +1,87 @@
1
+ # `<drop-zone>`
2
+
3
+ A form-associated area for choosing files by dragging them onto it or by
4
+ browsing. It only collects files — uploading them is up to the consumer.
5
+ Inside a native `<form>`, the chosen files are submitted under `name`,
6
+ just like `<input type="file">`, and `form.reset()` clears them.
7
+
8
+ Files are checked against `accept`, `max-size`, and `max-files` as they
9
+ arrive; files that don't fit are listed under the zone with the reason and
10
+ reported through `files-reject`. Without `multiple`, a new file replaces
11
+ the current one. Chosen files are listed with their size and a remove
12
+ button. The "Choose" button is the keyboard path; clicking anywhere on the
13
+ zone also opens the file picker.
14
+
15
+ ## Install
16
+
17
+ ```js
18
+ import "@f-ewald/components/drop-zone.js";
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```html
24
+ <form>
25
+ <drop-zone
26
+ name="attachments"
27
+ accept="image/*,.pdf"
28
+ multiple
29
+ max-size="5242880"
30
+ max-files="3"
31
+ hint="Images or PDF, up to 5 MB each"
32
+ ></drop-zone>
33
+ </form>
34
+ <script>
35
+ const zone = document.querySelector("drop-zone");
36
+ zone.addEventListener("change", (e) => console.log(e.detail.files));
37
+ zone.addEventListener("files-reject", (e) => console.log(e.detail.rejected));
38
+ </script>
39
+ ```
40
+
41
+ ## Attributes / properties
42
+
43
+ | Property | Attribute | Type | Default | Description |
44
+ | --- | --- | --- | --- | --- |
45
+ | `name` | `name` | `string` | `""` | Form field name the chosen files are submitted under. |
46
+ | `accept` | `accept` | `string` | `""` | Allowed files in native `accept` syntax, e.g. `"image/*,.pdf"`. Empty allows any file. |
47
+ | `multiple` | `multiple` | `boolean` | `false` | Allows choosing more than one file; otherwise a new file replaces the current one. |
48
+ | `maxSize` | `max-size` | `number` | `0` | Largest allowed file size in bytes; `0` means no limit. |
49
+ | `maxFiles` | `max-files` | `number` | `0` | Most files allowed with `multiple`; `0` means no limit. |
50
+ | `required` | `required` | `boolean` | `false` | Requires at least one file for native form validation. |
51
+ | `disabled` | `disabled` | `boolean` | `false` | Disables dropping, browsing, and removing. |
52
+ | `label` | `label` | `string` | `"Drag and drop files here"` | Main prompt text inside the zone. |
53
+ | `hint` | `hint` | `string` | `""` | Optional smaller line under the prompt, e.g. `"PNG or JPG, up to 5 MB"`. |
54
+ | `files` | _(JS property only)_ | `File[]` | `[]` | The chosen files. Setting it replaces the selection without firing `change`. |
55
+
56
+ ## Events
57
+
58
+ | Event | Description |
59
+ | --- | --- |
60
+ | `files-reject` | Some dropped or picked files were not added; detail: `{ rejected: DropZoneRejection[] }`. |
61
+ | `change` | The chosen files changed through a drop, the picker, or a remove button; detail: `{ files: File[] }`. Setting `files` does not fire it. |
62
+
63
+ ## Slots
64
+
65
+ _None._
66
+
67
+ ## CSS custom properties
68
+
69
+ | Custom property |
70
+ | --- |
71
+ | `--ui-border` |
72
+ | `--ui-border-width` |
73
+ | `--ui-danger` |
74
+ | `--ui-font` |
75
+ | `--ui-font-size` |
76
+ | `--ui-font-size-sm` |
77
+ | `--ui-font-size-xs` |
78
+ | `--ui-font-weight-medium` |
79
+ | `--ui-line-height-tight` |
80
+ | `--ui-numeric` |
81
+ | `--ui-primary` |
82
+ | `--ui-radius` |
83
+ | `--ui-radius-sm` |
84
+ | `--ui-surface` |
85
+ | `--ui-surface-muted` |
86
+ | `--ui-text` |
87
+ | `--ui-text-muted` |
package/docs/icons.md CHANGED
@@ -25,6 +25,7 @@ const icon = iconPencil(16); // 16px, defaults shown below if omitted
25
25
  | `iconArrowsPointingOut` | 16px | "Expand" or "view fullscreen" actions. |
26
26
  | `iconArrowsRightLeft` | 16px | Swap, exchange, or compare actions between two items. |
27
27
  | `iconArrowTopRightOnSquare` | 16px | Links that open in a new tab/window, or navigate to an external site. |
28
+ | `iconArrowUpTray` | 18px | Upload or import actions, e.g. drop-zone's file prompt. |
28
29
  | `iconBars3` | 18px | A hamburger menu toggle, e.g. collapsing or opening a sidebar/nav drawer. |
29
30
  | `iconBookOpen` | 20px | A library, documentation, or reading content, e.g. a library node in dag-graph. |
30
31
  | `iconCalendar` | 16px | Dates, due dates, or calendar-related metadata. |
package/llms.txt CHANGED
@@ -42,6 +42,7 @@ table to pick the icon matching a use case, for consistency across apps:
42
42
  | `iconArrowsPointingOut` | 16px | "Expand" or "view fullscreen" actions. |
43
43
  | `iconArrowsRightLeft` | 16px | Swap, exchange, or compare actions between two items. |
44
44
  | `iconArrowTopRightOnSquare` | 16px | Links that open in a new tab/window, or navigate to an external site. |
45
+ | `iconArrowUpTray` | 18px | Upload or import actions, e.g. drop-zone's file prompt. |
45
46
  | `iconBars3` | 18px | A hamburger menu toggle, e.g. collapsing or opening a sidebar/nav drawer. |
46
47
  | `iconBookOpen` | 20px | A library, documentation, or reading content, e.g. a library node in dag-graph. |
47
48
  | `iconCalendar` | 16px | Dates, due dates, or calendar-related metadata. |
@@ -151,7 +152,7 @@ present.
151
152
 
152
153
  Import: `import "@f-ewald/components/address-autocomplete.js";`
153
154
 
154
- Properties: `value` (attribute `value`) : string, default ""; `placeholder` (attribute `placeholder`) : string, default ""; `required` (attribute `required`) : boolean, default false; `disabled` (attribute `disabled`) : boolean, default false; `clearable` (attribute `clearable`) : boolean, default false; `types` (attribute `types`) : string, default "address"; `endpoint` (attribute `endpoint`) : string, default "https://api.mapbox.com/search/geocode/v6/forward"; `accessToken` (attribute `access-token`) : string, default ""; `bbox` (attribute `bbox`) : string, default ""; `proximity` (attribute `proximity`) : string, default ""; `debounce` (attribute `debounce`) : number, default 300; `minLength` (attribute `min-length`) : number, default 3; `suggestions` (JS property only) : AddressSuggestion[] | null, default null; `selectedSuggestion` (JS property only) : AddressSuggestion | null, default —
155
+ Properties: `types` (attribute `types`) : string, default "address"; `endpoint` (attribute `endpoint`) : string, default "https://api.mapbox.com/search/geocode/v6/forward"; `accessToken` (attribute `access-token`) : string, default ""; `bbox` (attribute `bbox`) : string, default ""; `proximity` (attribute `proximity`) : string, default ""; `suggestions` (JS property only) : AddressSuggestion[] | null, default null; `selectedSuggestion` (JS property only) : AddressSuggestion | null, default —; `value` (attribute `value`) : string, default ""; `placeholder` (attribute `placeholder`) : string, default ""; `required` (attribute `required`) : boolean, default false; `disabled` (attribute `disabled`) : boolean, default false; `clearable` (attribute `clearable`) : boolean, default false; `debounce` (attribute `debounce`) : number, default 300; `minLength` (attribute `min-length`) : number, default 3
155
156
  Events: `address-select`, `input`
156
157
  CSS custom properties: `--ui-border`, `--ui-border-width`, `--ui-danger`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size`, `--ui-font-size-sm`, `--ui-font-size-xs`, `--ui-font-weight-regular`, `--ui-line-height-tight`, `--ui-primary`, `--ui-radius-sm`, `--ui-shadow`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
157
158
 
@@ -381,7 +382,7 @@ present.
381
382
 
382
383
  Import: `import "@f-ewald/components/autocomplete-input.js";`
383
384
 
384
- Properties: `value` (attribute `value`) : string, default ""; `placeholder` (attribute `placeholder`) : string, default ""; `required` (attribute `required`) : boolean, default false; `disabled` (attribute `disabled`) : boolean, default false; `clearable` (attribute `clearable`) : boolean, default false; `endpoint` (attribute `endpoint`) : string, default ""; `queryParam` (attribute `query-param`) : string, default "q"; `debounce` (attribute `debounce`) : number, default 300; `minLength` (attribute `min-length`) : number, default 3; `options` (JS property only) : AutocompleteOption[] | null, default null; `selectedKey` (attribute `selected-key`) : string | null, default null; `selectedOption` (JS property only) : AutocompleteOption | null, default —
385
+ Properties: `endpoint` (attribute `endpoint`) : string, default ""; `queryParam` (attribute `query-param`) : string, default "q"; `options` (JS property only) : AutocompleteOption[] | null, default null; `selectedKey` (attribute `selected-key`) : string | null, default null; `selectedOption` (JS property only) : AutocompleteOption | null, default —; `value` (attribute `value`) : string, default ""; `placeholder` (attribute `placeholder`) : string, default ""; `required` (attribute `required`) : boolean, default false; `disabled` (attribute `disabled`) : boolean, default false; `clearable` (attribute `clearable`) : boolean, default false; `debounce` (attribute `debounce`) : number, default 300; `minLength` (attribute `min-length`) : number, default 3
385
386
  Events: `option-select`, `input`
386
387
  CSS custom properties: `--ui-border`, `--ui-border-width`, `--ui-danger`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size`, `--ui-font-size-sm`, `--ui-font-size-xs`, `--ui-font-weight-regular`, `--ui-line-height-tight`, `--ui-primary`, `--ui-radius-sm`, `--ui-shadow`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
387
388
 
@@ -1112,6 +1113,45 @@ Example:
1112
1113
  </script>
1113
1114
  ```
1114
1115
 
1116
+ ## <drop-zone>
1117
+
1118
+ A form-associated area for choosing files by dragging them onto it or by
1119
+ browsing. It only collects files — uploading them is up to the consumer.
1120
+ Inside a native `<form>`, the chosen files are submitted under `name`,
1121
+ just like `<input type="file">`, and `form.reset()` clears them.
1122
+
1123
+ Files are checked against `accept`, `max-size`, and `max-files` as they
1124
+ arrive; files that don't fit are listed under the zone with the reason and
1125
+ reported through `files-reject`. Without `multiple`, a new file replaces
1126
+ the current one. Chosen files are listed with their size and a remove
1127
+ button. The "Choose" button is the keyboard path; clicking anywhere on the
1128
+ zone also opens the file picker.
1129
+
1130
+ Import: `import "@f-ewald/components/drop-zone.js";`
1131
+
1132
+ Properties: `name` (attribute `name`) : string, default ""; `accept` (attribute `accept`) : string, default ""; `multiple` (attribute `multiple`) : boolean, default false; `maxSize` (attribute `max-size`) : number, default 0; `maxFiles` (attribute `max-files`) : number, default 0; `required` (attribute `required`) : boolean, default false; `disabled` (attribute `disabled`) : boolean, default false; `label` (attribute `label`) : string, default "Drag and drop files here"; `hint` (attribute `hint`) : string, default ""; `files` (JS property only) : File[], default []
1133
+ Events: `files-reject`, `change`
1134
+ CSS custom properties: `--ui-border`, `--ui-border-width`, `--ui-danger`, `--ui-font`, `--ui-font-size`, `--ui-font-size-sm`, `--ui-font-size-xs`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-numeric`, `--ui-primary`, `--ui-radius`, `--ui-radius-sm`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
1135
+
1136
+ Example:
1137
+ ```html
1138
+ <form>
1139
+ <drop-zone
1140
+ name="attachments"
1141
+ accept="image/*,.pdf"
1142
+ multiple
1143
+ max-size="5242880"
1144
+ max-files="3"
1145
+ hint="Images or PDF, up to 5 MB each"
1146
+ ></drop-zone>
1147
+ </form>
1148
+ <script>
1149
+ const zone = document.querySelector("drop-zone");
1150
+ zone.addEventListener("change", (e) => console.log(e.detail.files));
1151
+ zone.addEventListener("files-reject", (e) => console.log(e.detail.rejected));
1152
+ </script>
1153
+ ```
1154
+
1115
1155
  ## <dropdown-button>
1116
1156
 
1117
1157
  A button that opens an anchored menu of actions — essentially `form-select`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@f-ewald/components",
3
3
  "private": false,
4
- "version": "1.46.1",
4
+ "version": "1.47.0",
5
5
  "description": "A collection of universally usable web components for various tasks.",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",