@exsto/ds 0.0.1-rc.8 → 0.0.1-rc.9

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 (37) hide show
  1. package/README.md +13 -0
  2. package/dist/chunks/date-range-picker-BvCOmQki.js +204 -0
  3. package/dist/chunks/date-range-picker-BvCOmQki.js.map +1 -0
  4. package/dist/chunks/input-9HRdsve1.js +169 -0
  5. package/dist/chunks/input-9HRdsve1.js.map +1 -0
  6. package/dist/chunks/{toggle-C2c5oDaE.js → toggle-B6VBlpwp.js} +4 -149
  7. package/dist/chunks/toggle-B6VBlpwp.js.map +1 -0
  8. package/dist/date-picker.js +331 -0
  9. package/dist/date-picker.js.map +1 -0
  10. package/dist/ds/src/date-picker.d.ts +9 -0
  11. package/dist/index.js +60 -188
  12. package/dist/index.js.map +1 -1
  13. package/dist/rich-text-editor.js +2 -1
  14. package/dist/rich-text-editor.js.map +1 -1
  15. package/dist/styles.css +125 -0
  16. package/dist/ui/src/components/edyn/animated-number/animated-number.d.ts +5 -5
  17. package/dist/ui/src/components/edyn/audio-player/audio-player.d.ts +3 -2
  18. package/dist/ui/src/components/edyn/date-picker/date-picker.d.ts +54 -0
  19. package/dist/ui/src/components/edyn/date-picker/date-text.d.ts +40 -0
  20. package/dist/ui/src/components/edyn/date-picker/date-text.test.d.ts +1 -0
  21. package/dist/ui/src/components/edyn/date-picker/index.d.ts +2 -0
  22. package/dist/ui/src/components/edyn/date-range-picker/date-range-picker.d.ts +5 -3
  23. package/dist/ui/src/components/edyn/initials-avatar/initials-avatar.d.ts +3 -2
  24. package/dist/ui/src/components/edyn/multi-select/multi-select.d.ts +12 -2
  25. package/dist/ui/src/components/edyn/progress-line/progress-line.d.ts +3 -3
  26. package/dist/ui/src/components/edyn/video-player/video-player.d.ts +2 -2
  27. package/dist/ui/src/components/forwarded-props.test.d.ts +8 -0
  28. package/dist/ui/src/components/ui/accordion/accordion.d.ts +9 -8
  29. package/dist/ui/src/components/ui/badge/badge.d.ts +1 -1
  30. package/dist/ui/src/components/ui/button/button.d.ts +1 -1
  31. package/dist/ui/src/components/ui/input-group/input-group.d.ts +1 -1
  32. package/dist/ui/src/components/ui/pagination/pagination.d.ts +3 -2
  33. package/dist/ui/src/components/ui/tabs/tabs.d.ts +9 -8
  34. package/dist/ui/src/lib/first-weekday.d.ts +6 -0
  35. package/dist/ui/src/lib/first-weekday.test.d.ts +1 -0
  36. package/package.json +5 -1
  37. package/dist/chunks/toggle-C2c5oDaE.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-picker.js","names":[],"sources":["../../ui/src/components/edyn/date-picker/date-text.ts","../../ui/src/components/edyn/date-picker/date-picker.tsx"],"sourcesContent":["/**\n * Reading and writing a calendar day as the text a person types.\n *\n * A day is the string `yyyy-mm-dd` everywhere here, never a Date: a Date is an instant, and the instant for \"5 March\" is a\n * different calendar day in another time zone (local midnight serialised as UTC lands on the 4th east of Greenwich). The\n * string is also what `<input type=\"date\">`, JSON and a .NET `DateOnly` use. Strings of that shape sort and compare as\n * days, so min, max and disabled days are compared as plain strings with no Date involved.\n */\n\nimport { dateToDay, dayToDate } from '@edyn/ui/components/edyn/date-range-picker';\n\nexport type TDatePart = 'day' | 'month' | 'year';\n\n/** Why a typed text is not a day the picker can use. */\nexport type TDateProblem = 'format' | 'notReal' | 'beforeMin' | 'afterMax' | 'unavailable';\n\nexport type TParsedDay = { kind: 'empty' } | { kind: 'day'; day: string } | { kind: 'problem'; problem: 'format' | 'notReal' };\n\nconst SHAPE = { day: '2-digit', month: '2-digit', year: 'numeric' } as const;\n\n/** The order a locale writes day, month and year in: en-GB is day, month, year; en-US month, day, year; sv year first. */\nexport const datePartsOf = (locale: string): TDatePart[] =>\n new Intl.DateTimeFormat(locale, SHAPE)\n .formatToParts(new Date(2000, 0, 2, 12))\n .flatMap((part) => (part.type === 'day' || part.type === 'month' || part.type === 'year' ? [part.type] : []));\n\n/** What to type, written the locale's way: `DD/MM/YYYY` for en-GB. */\nexport const datePatternOf = (locale: string): string =>\n new Intl.DateTimeFormat(locale, SHAPE)\n .formatToParts(new Date(2000, 0, 2, 12))\n .map((part) => {\n if (part.type === 'day') {\n return 'DD';\n }\n if (part.type === 'month') {\n return 'MM';\n }\n return part.type === 'year' ? 'YYYY' : part.value;\n })\n .join('')\n .trim();\n\n/** A day written the locale's way: `05/03/2026` for en-GB. */\nexport const formatDay = (day: string, locale: string): string => {\n const date = dayToDate(day);\n return date === undefined ? '' : new Intl.DateTimeFormat(locale, SHAPE).format(date);\n};\n\nconst isRealDay = (year: number, month: number, dayOfMonth: number): boolean => {\n if (year < 1000 || month < 1 || month > 12 || dayOfMonth < 1) {\n return false;\n }\n const date = new Date(year, month - 1, dayOfMonth, 12);\n return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === dayOfMonth;\n};\n\nconst toDay = (year: number, month: number, dayOfMonth: number): string => dateToDay(new Date(year, month - 1, dayOfMonth, 12)) ?? '';\n\n/**\n * Reads typed text as a day. The locale's order decides which number is the day; a first number of four digits is always\n * a year (so `2026-03-05` is read the same everywhere); the separator can be anything that is not a digit, and eight\n * digits with none (`05032026`) are split by the order. A year must have four digits: `5/3/26` is refused, not guessed.\n */\nexport const parseDateText = (text: string, locale: string): TParsedDay => {\n const trimmed = text.trim();\n if (trimmed === '') {\n return { kind: 'empty' };\n }\n if (!/^[\\d\\s./\\-,]+$/.test(trimmed)) {\n return { kind: 'problem', problem: 'format' };\n }\n const order = datePartsOf(locale);\n let numbers = trimmed.match(/\\d+/g) ?? [];\n let parts: readonly TDatePart[] = order;\n if (numbers.length === 1 && numbers[0]?.length === 8) {\n const digits = numbers[0];\n const yearFirst = order[0] === 'year';\n numbers = yearFirst ? [digits.slice(0, 4), digits.slice(4, 6), digits.slice(6)] : [digits.slice(0, 2), digits.slice(2, 4), digits.slice(4)];\n }\n if (numbers.length !== 3) {\n return { kind: 'problem', problem: 'format' };\n }\n if (numbers[0]?.length === 4) {\n parts = ['year', 'month', 'day'];\n }\n const read: Record<TDatePart, string> = { day: '', month: '', year: '' };\n parts.forEach((part, index) => {\n read[part] = numbers[index] ?? '';\n });\n if (read.year.length !== 4 || read.day.length > 2 || read.month.length > 2) {\n return { kind: 'problem', problem: 'format' };\n }\n const [year, month, dayOfMonth] = [Number(read.year), Number(read.month), Number(read.day)];\n return isRealDay(year, month, dayOfMonth) ? { kind: 'day', day: toDay(year, month, dayOfMonth) } : { kind: 'problem', problem: 'notReal' };\n};\n\nexport type TDisabledDays = readonly string[] | ((day: string) => boolean);\n\nexport interface IDayLimits {\n min?: string;\n max?: string;\n disabledDates?: TDisabledDays;\n}\n\n/** Whether a day is allowed, and if not, which limit it breaks. */\nexport const dayProblem = (day: string, { min, max, disabledDates }: IDayLimits): TDateProblem | undefined => {\n if (min !== undefined && day < min) {\n return 'beforeMin';\n }\n if (max !== undefined && day > max) {\n return 'afterMax';\n }\n const off = typeof disabledDates === 'function' ? disabledDates(day) : (disabledDates?.includes(day) ?? false);\n return off ? 'unavailable' : undefined;\n};\n","import { dateToDay, dayToDate } from '@edyn/ui/components/edyn/date-range-picker';\nimport { Button } from '@edyn/ui/components/ui/button';\nimport { Calendar } from '@edyn/ui/components/ui/calendar';\nimport { Input } from '@edyn/ui/components/ui/input';\nimport { Popover, PopoverContent, PopoverTrigger } from '@edyn/ui/components/ui/popover';\nimport { firstWeekdayOf } from '@edyn/ui/lib/first-weekday';\nimport { cn } from '@edyn/ui/lib/utils';\nimport { IconCalendar } from '@tabler/icons-react';\nimport { type ChangeEvent, type FocusEvent, type KeyboardEvent, useEffect, useId, useMemo, useRef, useState } from 'react';\nimport type { Locale } from 'react-day-picker';\nimport { datePatternOf, dayProblem, formatDay, parseDateText, type TDateProblem, type TDisabledDays } from './date-text';\n\n/** Every word the component prints, so a product can translate it. */\nexport interface IDatePickerLabels {\n /** The calendar button's accessible name. */\n choose: string;\n /** Said when the text is not a date; `pattern` is what to type, written the locale's way (`DD/MM/YYYY`). */\n format: (pattern: string) => string;\n notReal: string;\n /** `min` and `max` are written the locale's way. */\n beforeMin: (min: string) => string;\n afterMax: (max: string) => string;\n unavailable: string;\n}\n\nexport const DEFAULT_DATE_PICKER_LABELS: IDatePickerLabels = {\n choose: 'Choose date',\n format: (pattern) => `Enter a date as ${pattern}.`,\n notReal: 'That date does not exist.',\n beforeMin: (min) => `Choose ${min} or later.`,\n afterMax: (max) => `Choose ${max} or earlier.`,\n unavailable: 'That date is not available.',\n};\n\nexport interface IDatePickerProps {\n /** For a Label's htmlFor; inside a Field the Field's label is already wired. */\n id?: string;\n /**\n * The chosen day as `yyyy-mm-dd`, or `undefined` for none (an empty string counts as none, so a value kept for an\n * `<input type=\"date\">` drops in). A string and not a Date, on purpose: a Date is an instant, and the instant for\n * \"5 March\" is another calendar day in another time zone, so a Date serialised for an API drifts a day. The text is\n * what `<input type=\"date\">`, JSON and a .NET `DateOnly` use, and it compares as a day.\n */\n value: string | undefined;\n /** Called with a valid day, or with `undefined` when the field is emptied or its text is not a usable day. */\n onValueChange: (value: string | undefined) => void;\n /** The earliest and latest day that can be chosen, as `yyyy-mm-dd`, both included. */\n min?: string;\n max?: string;\n /** Days that cannot be chosen: a list of `yyyy-mm-dd`, or a function that says so for one (weekends, say). */\n disabledDates?: TDisabledDays;\n disabled?: boolean;\n /** How a day is written and in which order it is typed (BCP 47); en-GB reads 05/03/2026. */\n locale?: string;\n /** The calendar's own words (month and weekday names), as a date-fns locale; English by default. The first weekday follows `locale`. */\n calendarLocale?: Locale;\n /** What the empty field shows; the pattern for the locale (`DD/MM/YYYY`) by default. */\n placeholder?: string;\n /** An accessible name, when there is no visible label to point at. */\n 'aria-label'?: string;\n /** Marks the field invalid (the kit's destructive border), as a Field's invalid state does. */\n 'aria-invalid'?: boolean | 'true' | 'false';\n /** The id of the text that explains it. Added to what a Field names already, and to the picker's own error. */\n 'aria-describedby'?: string;\n labels?: Partial<IDatePickerLabels>;\n /** Layout only (a width); the look is the kit's. */\n className?: string;\n}\n\nconst problemText = (\n problem: TDateProblem,\n labels: IDatePickerLabels,\n locale: string,\n limits: { min?: string; max?: string },\n pattern: string,\n): string => {\n switch (problem) {\n case 'format':\n return labels.format(pattern);\n case 'notReal':\n return labels.notReal;\n case 'beforeMin':\n return labels.beforeMin(limits.min === undefined ? '' : formatDay(limits.min, locale));\n case 'afterMax':\n return labels.afterMax(limits.max === undefined ? '' : formatDay(limits.max, locale));\n default:\n return labels.unavailable;\n }\n};\n\n/**\n * One calendar day, typed or picked. The field takes the day in the locale's order (05/03/2026 in en-GB) and reads it\n * when it loses focus, saying inline what is wrong with it; the button, or Alt+ArrowDown in the field, opens a calendar.\n */\nexport const DatePicker = ({\n id,\n value,\n onValueChange,\n min,\n max,\n disabledDates,\n disabled = false,\n locale = 'en-GB',\n calendarLocale,\n placeholder,\n 'aria-label': ariaLabel,\n 'aria-invalid': ariaInvalid,\n 'aria-describedby': ariaDescribedBy,\n labels: labelOverrides,\n className,\n}: IDatePickerProps) => {\n const labels = useMemo(() => ({ ...DEFAULT_DATE_PICKER_LABELS, ...labelOverrides }), [labelOverrides]);\n const pattern = useMemo(() => datePatternOf(locale), [locale]);\n const current = value === '' ? undefined : value;\n const errorId = useId();\n const refField = useRef<HTMLDivElement | null>(null);\n const refInput = useRef<HTMLInputElement | null>(null);\n // The mouse is down inside the picker, so a blur of the field is a click on something in it, not a Tab.\n const refPointer = useRef(false);\n // The day the field last agreed on with the page, so a change from outside is told from our own report of it.\n const refKnown = useRef<string | undefined>(current);\n const [text, setText] = useState(current === undefined ? '' : formatDay(current, locale));\n const [problem, setProblem] = useState<TDateProblem | null>(null);\n const [open, setOpen] = useState(false);\n\n useEffect(() => {\n if (current !== refKnown.current) {\n refKnown.current = current;\n setText(current === undefined ? '' : formatDay(current, locale));\n setProblem(null);\n }\n }, [current, locale]);\n\n const report = (day: string | undefined) => {\n refKnown.current = day;\n onValueChange(day);\n };\n\n /** Reads the text: a day is reported and written back in full, anything else is said inline and reported as no day. */\n const commit = (typed: string) => {\n const parsed = parseDateText(typed, locale);\n if (parsed.kind === 'empty') {\n setProblem(null);\n if (current !== undefined) {\n report(undefined);\n }\n return;\n }\n const found = parsed.kind === 'problem' ? parsed.problem : dayProblem(parsed.day, { min, max, disabledDates });\n if (found !== undefined) {\n setProblem(found);\n if (current !== undefined) {\n report(undefined);\n }\n return;\n }\n if (parsed.kind === 'day') {\n setProblem(null);\n setText(formatDay(parsed.day, locale));\n if (parsed.day !== current) {\n report(parsed.day);\n }\n }\n };\n\n const pick = (date: Date | undefined) => {\n const day = dateToDay(date);\n if (day === undefined) {\n return;\n }\n setProblem(null);\n setText(formatDay(day, locale));\n if (day !== current) {\n report(day);\n }\n setOpen(false);\n };\n\n /**\n * Text is read as the person leaves the field. A day (or nothing) is taken at once; a message about text that is not a\n * day is shown too, unless they are only on the way to the calendar: a press of the mouse on the button, or focus\n * going into the calendar that Alt+ArrowDown opened, with the text half typed. Leaving the picker for anywhere else\n * reads whatever is typed.\n */\n const handleBlur = (event: FocusEvent<HTMLElement>) => {\n const next = event.relatedTarget as Element | null;\n const intoCalendar = next?.closest('[data-slot=\"popover-content\"]') != null;\n const intoButton = next?.closest('[data-slot=\"date-picker-trigger\"]') != null;\n const typed = refInput.current?.value ?? '';\n if (!(intoCalendar || intoButton || (next !== null && refField.current?.contains(next) === true))) {\n commit(typed);\n return;\n }\n if (event.target !== refInput.current) {\n return;\n }\n const onTheWay = intoCalendar || (intoButton && refPointer.current);\n const parsed = parseDateText(typed, locale);\n const usable = parsed.kind === 'empty' || (parsed.kind === 'day' && dayProblem(parsed.day, { min, max, disabledDates }) === undefined);\n if (usable || !onTheWay) {\n commit(typed);\n }\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'ArrowDown' && event.altKey && !disabled) {\n event.preventDefault();\n setOpen(true);\n return;\n }\n // The field has no key handler of Base UI's to close the calendar, so the key would reach the Sheet or Dialog around\n // it and close that too. While the calendar is open it is this field's key; when it is closed it is the page's.\n if (event.key === 'Escape' && open) {\n event.preventDefault();\n event.stopPropagation();\n setOpen(false);\n return;\n }\n if (event.key === 'Enter') {\n const parsed = parseDateText(event.currentTarget.value, locale);\n if (parsed.kind !== 'empty' && (parsed.kind === 'problem' || dayProblem(parsed.day, { min, max, disabledDates }) !== undefined)) {\n event.preventDefault();\n }\n commit(event.currentTarget.value);\n }\n };\n\n const selected = dayToDate(current);\n const limits = { min, max };\n const invalid = problem !== null || ariaInvalid === true || ariaInvalid === 'true';\n const describedBy = [ariaDescribedBy, problem === null ? undefined : errorId].filter(Boolean).join(' ') || undefined;\n const isOff = (date: Date): boolean => {\n const day = dateToDay(date);\n return day !== undefined && dayProblem(day, { min, max, disabledDates }) !== undefined;\n };\n const today = new Date();\n const start = dayToDate(min);\n const end = dayToDate(max);\n const month = selected ?? (start !== undefined && today < start ? start : end !== undefined && today > end ? end : today);\n\n return (\n <div data-slot=\"date-picker\" className={cn('flex flex-col gap-1.5', className)}>\n <div\n ref={refField}\n className=\"relative\"\n onPointerDownCapture={() => {\n refPointer.current = true;\n }}\n onPointerUpCapture={() => {\n refPointer.current = false;\n }}\n >\n <Input\n ref={refInput}\n id={id}\n type=\"text\"\n inputMode=\"numeric\"\n autoComplete=\"off\"\n data-slot=\"date-picker-input\"\n value={text}\n placeholder={placeholder ?? pattern}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-invalid={invalid ? true : undefined}\n aria-describedby={describedBy}\n className=\"pr-9\"\n onChange={(event: ChangeEvent<HTMLInputElement>) => {\n setText(event.target.value);\n setProblem(null);\n }}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n />\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n render={\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n data-slot=\"date-picker-trigger\"\n aria-label={labels.choose}\n disabled={disabled}\n className=\"absolute top-0.5 right-0.5\"\n onBlur={handleBlur}\n />\n }\n >\n <IconCalendar aria-hidden=\"true\" />\n </PopoverTrigger>\n <PopoverContent anchor={refField} align=\"start\" className=\"w-auto p-0\" finalFocus={refInput} onBlur={handleBlur}>\n <Calendar\n mode=\"single\"\n required\n autoFocus\n locale={calendarLocale}\n weekStartsOn={firstWeekdayOf(locale)}\n defaultMonth={month}\n startMonth={start}\n endMonth={end}\n selected={selected}\n disabled={isOff}\n onSelect={pick}\n />\n </PopoverContent>\n </Popover>\n </div>\n {problem !== null && (\n <p id={errorId} data-slot=\"date-picker-error\" role=\"alert\" className=\"text-sm text-destructive\">\n {problemText(problem, labels, locale, limits, pattern)}\n </p>\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAkBA,IAAM,QAAQ;CAAE,KAAK;CAAW,OAAO;CAAW,MAAM;AAAU;;AAGlE,IAAa,eAAe,WAC1B,IAAI,KAAK,eAAe,QAAQ,KAAK,CAAC,CACnC,cAAc,IAAI,KAAK,KAAM,GAAG,GAAG,EAAE,CAAC,CAAC,CACvC,SAAS,SAAU,KAAK,SAAS,SAAS,KAAK,SAAS,WAAW,KAAK,SAAS,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,CAAE;;AAGhH,IAAa,iBAAiB,WAC5B,IAAI,KAAK,eAAe,QAAQ,KAAK,CAAC,CACnC,cAAc,IAAI,KAAK,KAAM,GAAG,GAAG,EAAE,CAAC,CAAC,CACvC,KAAK,SAAS;CACb,IAAI,KAAK,SAAS,OAChB,OAAO;CAET,IAAI,KAAK,SAAS,SAChB,OAAO;CAET,OAAO,KAAK,SAAS,SAAS,SAAS,KAAK;AAC9C,CAAC,CAAC,CACD,KAAK,EAAE,CAAC,CACR,KAAK;;AAGV,IAAa,aAAa,KAAa,WAA2B;CAChE,MAAM,OAAO,UAAU,GAAG;CAC1B,OAAO,SAAS,KAAA,IAAY,KAAK,IAAI,KAAK,eAAe,QAAQ,KAAK,CAAC,CAAC,OAAO,IAAI;AACrF;AAEA,IAAM,aAAa,MAAc,OAAe,eAAgC;CAC9E,IAAI,OAAO,OAAQ,QAAQ,KAA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AAC,gBAAD;KACE,QACE,oBAAC,QAAD;MACE,SAAQ;MACR,MAAK;MACL,aAAU;MACV,cAAY,OAAO;MACT;MACV,WAAU;MACV,QAAQ;KACT,CAAA;KAGH,UAAA,oBAAC,cAAD,EAAc,eAAY,OAAQ,CAAA;IACpB,CAAA,GAChB,oBAAC,gBAAD;KAAgB,QAAQ;KAAU,OAAM;KAAQ,WAAU;KAAa,YAAY;KAAU,QAAQ;KACnG,UAAA,oBAAC,UAAD;MACE,MAAK;MACL,UAAA;MACA,WAAA;MACA,QAAQ;MACR,cAAc,eAAe,MAAM;MACnC,cAAc;MACd,YAAY;MACZ,UAAU;MACA;MACV,UAAU;MACV,UAAU;KACX,CAAA;IACa,CAAA,CACT;GACN,CAAA,CAAA;EACJ,CAAA,GAAA,YAAY,QACX,oBAAC,KAAD;GAAG,IAAI;GAAS,aAAU;GAAoB,MAAK;GAAQ,WAAU;GAClE,UAAA,YAAY,SAAS,QAAQ,QAAQ,QAAQ,OAAO;EACpD,CAAA,CAEF;;AAET"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * `@exsto/ds/date-picker` - the DatePicker, on its own entry on purpose.
3
+ *
4
+ * It is a field a person types a date into as well as picks one, with the parsing, the locale's order of day, month and
5
+ * year and the messages that come with that (about 13 KB unminified). Re-exported from `@exsto/ds` it would be one more
6
+ * thing in the entry every consumer loads and a bundler cannot always tell it unused. Here an app pays for it only on the
7
+ * pages that import this path.
8
+ */
9
+ export * from '../../ui/src/components/edyn/date-picker';
package/dist/index.js CHANGED
@@ -1,11 +1,12 @@
1
- import { A as ScrollBar, B as cn, C as RICH_TEXT_ATTRIBUTES, D as POPUP_ITEM_INDICATOR_CLASS, E as isAllowedRichTextHref, F as PopoverHeader, I as PopoverTitle, L as PopoverTrigger, M as Popover, N as PopoverContent, O as popupItemClass, P as PopoverDescription, R as Button, S as richTextToNodes, T as RICH_TEXT_LINK_PROTOCOLS, V as cssLength, _ as DropdownMenuTrigger, a as DropdownMenuContent, b as RICH_TEXT_MENTION_CLASS, c as DropdownMenuLabel, d as DropdownMenuRadioItem, f as DropdownMenuSeparator, g as DropdownMenuSubTrigger, h as DropdownMenuSubContent, i as DropdownMenuCheckboxItem, j as useMergedRefs, k as ScrollArea, l as DropdownMenuPortal, m as DropdownMenuSub, n as toggleVariants, o as DropdownMenuGroup, p as DropdownMenuShortcut, r as DropdownMenu, s as DropdownMenuItem, t as Toggle, u as DropdownMenuRadioGroup, v as Input, w as RICH_TEXT_ELEMENTS, x as RichTextContent, y as RICH_TEXT_BODY_CLASS, z as buttonVariants } from "./chunks/toggle-C2c5oDaE.js";
1
+ import { a as PopoverHeader, c as Button, d as cssLength, i as PopoverDescription, l as buttonVariants, n as Popover, o as PopoverTitle, r as PopoverContent, s as PopoverTrigger, t as Input, u as cn } from "./chunks/input-9HRdsve1.js";
2
+ import { a as useIsMobile, n as dateToDay, o as Calendar, r as dayToDate, s as CalendarDayButton, t as DateRangePicker } from "./chunks/date-range-picker-BvCOmQki.js";
3
+ import { A as useMergedRefs, C as RICH_TEXT_ELEMENTS, D as popupItemClass, E as POPUP_ITEM_INDICATOR_CLASS, O as ScrollArea, S as RICH_TEXT_ATTRIBUTES, T as isAllowedRichTextHref, _ as DropdownMenuTrigger, a as DropdownMenuContent, b as RichTextContent, c as DropdownMenuLabel, d as DropdownMenuRadioItem, f as DropdownMenuSeparator, g as DropdownMenuSubTrigger, h as DropdownMenuSubContent, i as DropdownMenuCheckboxItem, k as ScrollBar, l as DropdownMenuPortal, m as DropdownMenuSub, n as toggleVariants, o as DropdownMenuGroup, p as DropdownMenuShortcut, r as DropdownMenu, s as DropdownMenuItem, t as Toggle, u as DropdownMenuRadioGroup, v as RICH_TEXT_BODY_CLASS, w as RICH_TEXT_LINK_PROTOCOLS, x as richTextToNodes, y as RICH_TEXT_MENTION_CLASS } from "./chunks/toggle-B6VBlpwp.js";
2
4
  import * as React from "react";
3
5
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
4
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
7
  import { cva } from "class-variance-authority";
6
8
  import { Slider as Slider$1 } from "@base-ui/react/slider";
7
- import { IconAlertOctagon, IconAlertTriangle, IconArrowDown, IconCalendar, IconCheck, IconChevronDown, IconChevronLeft, IconChevronRight, IconCircleCheck, IconDots, IconInfoCircle, IconLayoutSidebar, IconLoader, IconMaximize, IconMinus, IconPlayerPauseFilled, IconPlayerPlayFilled, IconSearch, IconSelector, IconVolume, IconVolumeOff, IconX } from "@tabler/icons-react";
8
- import { DayPicker, getDefaultClassNames } from "react-day-picker";
9
+ import { IconAlertOctagon, IconAlertTriangle, IconArrowDown, IconCheck, IconChevronDown, IconChevronLeft, IconChevronRight, IconCircleCheck, IconDots, IconInfoCircle, IconLayoutSidebar, IconLoader, IconMaximize, IconMinus, IconPlayerPauseFilled, IconPlayerPlayFilled, IconSearch, IconSelector, IconVolume, IconVolumeOff, IconX } from "@tabler/icons-react";
9
10
  import { Avatar as Avatar$1 } from "@base-ui/react/avatar";
10
11
  import { Combobox as Combobox$1 } from "@base-ui/react/combobox";
11
12
  import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
@@ -104,7 +105,7 @@ var useAnimatedValues = (targets, element) => {
104
105
  * and where it lands, in tabular figures, so nothing beside it moves while the digits
105
106
  * change. Assistive technology reads only the final value.
106
107
  */
107
- var AnimatedNumber = ({ value, format = formatCount, className }) => {
108
+ var AnimatedNumber = ({ value, format = formatCount, className, ...props }) => {
108
109
  const refElement = useRef(null);
109
110
  const [shown = 0] = useAnimatedValues([value], refElement);
110
111
  return /* @__PURE__ */ jsx(NumberText, {
@@ -112,16 +113,18 @@ var AnimatedNumber = ({ value, format = formatCount, className }) => {
112
113
  shown,
113
114
  value,
114
115
  format,
115
- className
116
+ className,
117
+ ...props
116
118
  });
117
119
  };
118
120
  /** The text of a moving number: what it shows now, held at its widest, with the final value for assistive technology. */
119
- var NumberText = ({ element, shown, value, format = formatCount, className }) => {
121
+ var NumberText = ({ element, shown, value, format = formatCount, className, ...props }) => {
120
122
  const now = format(shown);
121
123
  const final = format(value);
122
124
  const widest = now.length > final.length ? now : final;
123
125
  return /* @__PURE__ */ jsxs("span", {
124
126
  "data-slot": "animated-number",
127
+ ...props,
125
128
  ref: element,
126
129
  className,
127
130
  children: [/* @__PURE__ */ jsxs("span", {
@@ -327,7 +330,7 @@ var useMediaPlayer = (options = {}) => {
327
330
  * time, a seekable timeline, and volume. Four elements in one rounded row, per
328
331
  * the design-system anatomy.
329
332
  */
330
- var AudioPlayer = ({ src, muted = false, loop = false, disabled = false, width, className, "aria-label": ariaLabel = "Audio player", onPlay, onPause, onEnded, onTimeUpdate }) => {
333
+ var AudioPlayer = ({ src, muted = false, loop = false, disabled = false, width, className, "aria-label": ariaLabel = "Audio player", style, onPlay, onPause, onEnded, onTimeUpdate, ...props }) => {
331
334
  const { refMedia, playing, currentTime, duration, muted: isMuted, toggle, seek, toggleMute } = useMediaPlayer({
332
335
  onPlay,
333
336
  onPause,
@@ -340,8 +343,12 @@ var AudioPlayer = ({ src, muted = false, loop = false, disabled = false, width,
340
343
  "data-slot": "audio-player",
341
344
  "data-playing": playing || void 0,
342
345
  role: "group",
346
+ ...props,
343
347
  "aria-label": ariaLabel,
344
- style: { width: cssLength(width) },
348
+ style: {
349
+ width: cssLength(width),
350
+ ...style
351
+ },
345
352
  className: cn("flex h-12 w-full items-center gap-2 rounded-lg bg-muted px-3 py-1.5", className),
346
353
  children: [
347
354
  /* @__PURE__ */ jsx(Button, {
@@ -394,169 +401,6 @@ var AudioPlayer = ({ src, muted = false, loop = false, disabled = false, width,
394
401
  });
395
402
  };
396
403
  //#endregion
397
- //#region ../ui/src/components/ui/calendar/calendar.tsx
398
- var Calendar = ({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", locale, formatters, components, ...props }) => {
399
- const defaultClassNames = getDefaultClassNames();
400
- return /* @__PURE__ */ jsx(DayPicker, {
401
- showOutsideDays,
402
- className: cn("group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent", String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className),
403
- captionLayout,
404
- locale,
405
- formatters: {
406
- formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
407
- ...formatters
408
- },
409
- classNames: {
410
- root: cn("w-fit", defaultClassNames.root),
411
- months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
412
- month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
413
- nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
414
- button_previous: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_previous),
415
- button_next: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_next),
416
- month_caption: cn("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)", defaultClassNames.month_caption),
417
- dropdowns: cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
418
- dropdown_root: cn("relative rounded-(--cell-radius)", defaultClassNames.dropdown_root),
419
- dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
420
- caption_label: cn("font-medium select-none", captionLayout === "label" ? "text-sm" : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground", defaultClassNames.caption_label),
421
- month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
422
- weekdays: cn("flex", defaultClassNames.weekdays),
423
- weekday: cn("flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none", defaultClassNames.weekday),
424
- week: cn("mt-2 flex w-full", defaultClassNames.week),
425
- week_number_header: cn("w-(--cell-size) select-none", defaultClassNames.week_number_header),
426
- week_number: cn("text-[0.8rem] text-muted-foreground select-none", defaultClassNames.week_number),
427
- day: cn("group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)", props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)", defaultClassNames.day),
428
- range_start: cn("relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted", defaultClassNames.range_start),
429
- range_middle: cn("rounded-none", defaultClassNames.range_middle),
430
- range_end: cn("relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted", defaultClassNames.range_end),
431
- today: cn("rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none", defaultClassNames.today),
432
- outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
433
- disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
434
- hidden: cn("invisible", defaultClassNames.hidden),
435
- ...classNames
436
- },
437
- components: {
438
- Root: ({ className, rootRef, ...props }) => {
439
- return /* @__PURE__ */ jsx("div", {
440
- "data-slot": "calendar",
441
- ref: rootRef,
442
- className: cn(className),
443
- ...props
444
- });
445
- },
446
- Chevron: ({ className, orientation, ...props }) => {
447
- if (orientation === "left") return /* @__PURE__ */ jsx(IconChevronLeft, {
448
- className: cn("size-4", className),
449
- ...props
450
- });
451
- if (orientation === "right") return /* @__PURE__ */ jsx(IconChevronRight, {
452
- className: cn("size-4", className),
453
- ...props
454
- });
455
- return /* @__PURE__ */ jsx(IconChevronDown, {
456
- className: cn("size-4", className),
457
- ...props
458
- });
459
- },
460
- DayButton: ({ ...props }) => /* @__PURE__ */ jsx(CalendarDayButton, {
461
- locale,
462
- ...props
463
- }),
464
- WeekNumber: ({ children, ...props }) => {
465
- return /* @__PURE__ */ jsx("td", {
466
- ...props,
467
- children: /* @__PURE__ */ jsx("div", {
468
- className: "flex size-(--cell-size) items-center justify-center text-center",
469
- children
470
- })
471
- });
472
- },
473
- ...components
474
- },
475
- ...props
476
- });
477
- };
478
- var CalendarDayButton = ({ className, day, modifiers, locale, ...props }) => {
479
- const defaultClassNames = getDefaultClassNames();
480
- const refButton = React.useRef(null);
481
- React.useEffect(() => {
482
- if (modifiers.focused) refButton.current?.focus();
483
- }, [modifiers.focused]);
484
- return /* @__PURE__ */ jsx(Button, {
485
- ref: refButton,
486
- variant: "ghost",
487
- size: "icon",
488
- "data-day": day.date.toLocaleDateString(locale?.code),
489
- "data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
490
- "data-range-start": modifiers.range_start,
491
- "data-range-end": modifiers.range_end,
492
- "data-range-middle": modifiers.range_middle,
493
- className: cn("relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className),
494
- ...props
495
- });
496
- };
497
- //#endregion
498
- //#region ../ui/src/hooks/use-mobile.ts
499
- var MOBILE_BREAKPOINT = 768;
500
- var useIsMobile = () => {
501
- const [isMobile, setIsMobile] = React.useState(void 0);
502
- React.useEffect(() => {
503
- const mql = window.matchMedia(`(max-width: 767px)`);
504
- const onChange = () => {
505
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
506
- };
507
- mql.addEventListener("change", onChange);
508
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
509
- return () => mql.removeEventListener("change", onChange);
510
- }, []);
511
- return !!isMobile;
512
- };
513
- //#endregion
514
- //#region ../ui/src/components/edyn/date-range-picker/date-range-picker.tsx
515
- var dayToDate = (value) => value === void 0 ? void 0 : /* @__PURE__ */ new Date(`${value}T12:00:00`);
516
- var dateToDay = (date) => date === void 0 ? void 0 : `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
517
- /** A range of calendar days, either end optional; two months side by side, one on a phone. */
518
- var DateRangePicker = ({ id, value, onValueChange, placeholder = "Select date range", locale = "en-GB", summary = "range", "aria-label": ariaLabel, className }) => {
519
- const isMobile = useIsMobile();
520
- const from = dayToDate(value.from);
521
- const to = dayToDate(value.to);
522
- const format = new Intl.DateTimeFormat(locale, {
523
- day: "2-digit",
524
- month: "short",
525
- year: "numeric"
526
- });
527
- const ends = [from, to].filter((date) => date !== void 0).map((date) => format.format(date));
528
- return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsxs(PopoverTrigger, {
529
- render: /* @__PURE__ */ jsx(Button, {
530
- id,
531
- "aria-label": ariaLabel,
532
- "data-slot": "date-range-picker-trigger",
533
- "data-set": ends.length > 0 ? "" : void 0,
534
- variant: "outline",
535
- className: cn("w-full min-w-0 justify-start font-normal", ends.length === 0 && "text-muted-foreground", className)
536
- }),
537
- children: [/* @__PURE__ */ jsx(IconCalendar, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", {
538
- className: "truncate",
539
- children: ends.length === 0 || summary === "label" ? placeholder : ends.join(" – ")
540
- })]
541
- }), /* @__PURE__ */ jsx(PopoverContent, {
542
- align: "start",
543
- className: "w-auto p-0",
544
- children: /* @__PURE__ */ jsx(Calendar, {
545
- mode: "range",
546
- defaultMonth: from,
547
- numberOfMonths: isMobile ? 1 : 2,
548
- selected: {
549
- from,
550
- to
551
- },
552
- onSelect: (range) => onValueChange({
553
- from: dateToDay(range?.from),
554
- to: dateToDay(range?.to)
555
- })
556
- })
557
- })] });
558
- };
559
- //#endregion
560
404
  //#region ../ui/src/components/ui/avatar/avatar.tsx
561
405
  var Avatar = ({ className, size = "default", ...props }) => {
562
406
  return /* @__PURE__ */ jsx(Avatar$1.Root, {
@@ -651,7 +495,7 @@ var SIZES = {
651
495
  }
652
496
  };
653
497
  /** A person's photo, or their initials on a circle in the palette colour they pick; both themes switch by themselves. */
654
- var InitialsAvatar = ({ name, photoUrl, size = "md", className, autoColor = true, label }) => {
498
+ var InitialsAvatar = ({ name, photoUrl, size = "md", className, autoColor = true, label, "aria-label": ariaLabel, ...props }) => {
655
499
  const initials = initialsOf(name);
656
500
  const tone = avatarTone(initials);
657
501
  const { box, fontSize } = SIZES[size];
@@ -660,12 +504,14 @@ var InitialsAvatar = ({ name, photoUrl, size = "md", className, autoColor = true
660
504
  backgroundColor: `var(--avatar-${tone}-bg)`,
661
505
  color: `var(--avatar-${tone}-fg)`
662
506
  } : { fontSize };
663
- const a11y = label === void 0 ? { "aria-hidden": true } : {
507
+ const accessibleName = label ?? ariaLabel;
508
+ const a11y = accessibleName === void 0 ? { "aria-hidden": true } : {
664
509
  role: "img",
665
- "aria-label": label
510
+ "aria-label": accessibleName
666
511
  };
667
512
  return /* @__PURE__ */ jsxs(Avatar, {
668
513
  "data-slot": "initials-avatar",
514
+ ...props,
669
515
  "data-tone": autoColor ? tone : void 0,
670
516
  className: cn(box, className),
671
517
  ...a11y,
@@ -886,6 +732,7 @@ var MultiSelect = ({ placeholder, searchPlaceholder, options, value, onValueChan
886
732
  const refScrollTo = useRef(() => void 0);
887
733
  const refTimer = useRef(void 0);
888
734
  const refTriggerText = useRef(null);
735
+ const refSearch = useRef(null);
889
736
  const [popupOpen, setPopupOpen] = useState(false);
890
737
  const [highlightedValue, setHighlightedValue] = useState(null);
891
738
  const refReported = useRef(void 0);
@@ -893,6 +740,16 @@ var MultiSelect = ({ placeholder, searchPlaceholder, options, value, onValueChan
893
740
  const errorMessage = typeof error === "string" ? error : labels.error;
894
741
  const failed = error !== false;
895
742
  useEffect(() => () => window.clearTimeout(refTimer.current), []);
743
+ const closeFromTrigger = (event) => {
744
+ if (event.key !== "Escape" || !popupOpen || refSearch.current === null) return;
745
+ event.stopPropagation();
746
+ event.preventDefault();
747
+ refSearch.current.dispatchEvent(new KeyboardEvent("keydown", {
748
+ key: "Escape",
749
+ bubbles: true,
750
+ cancelable: true
751
+ }));
752
+ };
896
753
  return /* @__PURE__ */ jsxs(Combobox$1.Root, {
897
754
  multiple: true,
898
755
  disabled,
@@ -933,9 +790,10 @@ var MultiSelect = ({ placeholder, searchPlaceholder, options, value, onValueChan
933
790
  children: [/* @__PURE__ */ jsxs(TooltipTrigger, {
934
791
  "data-slot": "multi-select-trigger",
935
792
  render: /* @__PURE__ */ jsx(Combobox$1.Trigger, {
793
+ ...rest,
936
794
  id,
937
- "aria-label": rest["aria-label"],
938
795
  "data-set": chosen.length > 0 ? "" : void 0,
796
+ onKeyDown: closeFromTrigger,
939
797
  className: cn(TRIGGER, className)
940
798
  }),
941
799
  children: [/* @__PURE__ */ jsx("span", {
@@ -961,6 +819,7 @@ var MultiSelect = ({ placeholder, searchPlaceholder, options, value, onValueChan
961
819
  "aria-hidden": "true",
962
820
  className: "size-4 shrink-0 text-muted-foreground"
963
821
  }), /* @__PURE__ */ jsx(Combobox$1.Input, {
822
+ ref: refSearch,
964
823
  placeholder: searchPlaceholder,
965
824
  "aria-label": searchPlaceholder.replace(/…$/, ""),
966
825
  className: "h-10 w-full min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
@@ -1049,7 +908,7 @@ var scaleOf = (line) => {
1049
908
  * before it has gone carries on from where it is. With reduced motion it is a
1050
909
  * full-width line that fades.
1051
910
  */
1052
- var ProgressLine = ({ active, label = "Loading", className, style }) => {
911
+ var ProgressLine = ({ active, label = "Loading", className, style, ...props }) => {
1053
912
  const [phase, setPhase] = useState("idle");
1054
913
  const [target, setTarget] = useState(RUN_TARGET);
1055
914
  const refPhase = useRef("idle");
@@ -1098,6 +957,7 @@ var ProgressLine = ({ active, label = "Loading", className, style }) => {
1098
957
  "data-slot": "progress-line",
1099
958
  role: "progressbar",
1100
959
  "aria-label": label,
960
+ ...props,
1101
961
  "aria-hidden": shown && phase !== "fading" ? void 0 : true,
1102
962
  "data-phase": phase,
1103
963
  className: cn("pointer-events-none h-0.5 overflow-hidden", className),
@@ -1125,7 +985,7 @@ var ProgressLine = ({ active, label = "Loading", className, style }) => {
1125
985
  * both themes. Video is dark, so the letterbox and controls must stay dark and
1126
986
  * light-on-dark; this re-scopes existing tokens rather than hardcoding a colour.
1127
987
  */
1128
- var VideoPlayer = ({ src, poster, title, description, muted = false, loop = false, disabled = false, width, height, ratio = "auto", className, "aria-label": ariaLabel = "Video player", onPlay, onPause, onEnded, onTimeUpdate }) => {
988
+ var VideoPlayer = ({ src, poster, title, description, muted = false, loop = false, disabled = false, width, height, ratio = "auto", className, "aria-label": ariaLabel = "Video player", style, onPlay, onPause, onEnded, onTimeUpdate, ...props }) => {
1129
989
  const { refMedia, playing, currentTime, duration, muted: isMuted, toggle, seek, toggleMute } = useMediaPlayer({
1130
990
  onPlay,
1131
991
  onPause,
@@ -1148,11 +1008,13 @@ var VideoPlayer = ({ src, poster, title, description, muted = false, loop = fals
1148
1008
  return /* @__PURE__ */ jsxs("div", {
1149
1009
  ref: refContainer,
1150
1010
  "data-slot": "video-player",
1011
+ ...props,
1151
1012
  "data-playing": playing || void 0,
1152
1013
  style: {
1153
1014
  width: cssLength(width),
1154
1015
  height: cssLength(height),
1155
- aspectRatio: height == null && ratio !== "auto" ? ratio : void 0
1016
+ aspectRatio: height == null && ratio !== "auto" ? ratio : void 0,
1017
+ ...style
1156
1018
  },
1157
1019
  className: cn("dark relative isolate w-full overflow-hidden rounded-lg bg-background", className),
1158
1020
  children: [/* @__PURE__ */ jsx("video", {
@@ -1237,8 +1099,9 @@ var VideoPlayer = ({ src, poster, title, description, muted = false, loop = fals
1237
1099
  };
1238
1100
  //#endregion
1239
1101
  //#region ../ui/src/components/ui/accordion/accordion.tsx
1240
- var Accordion = ({ value, defaultValue, onValueChange, multiple = false, className, children }) => /* @__PURE__ */ jsx(Accordion$1.Root, {
1102
+ var Accordion = ({ value, defaultValue, onValueChange, multiple = false, className, children, ...props }) => /* @__PURE__ */ jsx(Accordion$1.Root, {
1241
1103
  "data-slot": "accordion",
1104
+ ...props,
1242
1105
  value,
1243
1106
  defaultValue,
1244
1107
  onValueChange: (next) => {
@@ -1248,8 +1111,9 @@ var Accordion = ({ value, defaultValue, onValueChange, multiple = false, classNa
1248
1111
  className: cn("w-full", className),
1249
1112
  children
1250
1113
  });
1251
- var AccordionItem = ({ value, disabled, className, children }) => /* @__PURE__ */ jsx(Accordion$1.Item, {
1114
+ var AccordionItem = ({ value, disabled, className, children, ...props }) => /* @__PURE__ */ jsx(Accordion$1.Item, {
1252
1115
  "data-slot": "accordion-item",
1116
+ ...props,
1253
1117
  value,
1254
1118
  disabled,
1255
1119
  className: cn("border-b border-border", className),
@@ -1274,11 +1138,12 @@ var focusSiblingTrigger = (event) => {
1274
1138
  else if (event.key === "ArrowUp") nextIndex = (currentIndex - 1 + triggers.length) % triggers.length;
1275
1139
  triggers[nextIndex]?.focus();
1276
1140
  };
1277
- var AccordionTrigger = ({ className, children }) => /* @__PURE__ */ jsx(Accordion$1.Header, {
1141
+ var AccordionTrigger = ({ className, children, ...props }) => /* @__PURE__ */ jsx(Accordion$1.Header, {
1278
1142
  "data-slot": "accordion-header",
1279
1143
  className: "flex",
1280
1144
  children: /* @__PURE__ */ jsxs(Accordion$1.Trigger, {
1281
1145
  "data-slot": "accordion-trigger",
1146
+ ...props,
1282
1147
  onKeyDown: focusSiblingTrigger,
1283
1148
  className: cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline", className),
1284
1149
  children: [children, /* @__PURE__ */ jsx("svg", {
@@ -1298,9 +1163,10 @@ var AccordionTrigger = ({ className, children }) => /* @__PURE__ */ jsx(Accordio
1298
1163
  })]
1299
1164
  })
1300
1165
  });
1301
- var AccordionContent = ({ className, children }) => /* @__PURE__ */ jsx(Accordion$1.Panel, {
1166
+ var AccordionContent = ({ className, children, ...props }) => /* @__PURE__ */ jsx(Accordion$1.Panel, {
1302
1167
  keepMounted: true,
1303
1168
  "data-slot": "accordion-content",
1169
+ ...props,
1304
1170
  "data-focus": "inset",
1305
1171
  className: cn("text-sm", className),
1306
1172
  children: /* @__PURE__ */ jsx("div", {
@@ -1961,6 +1827,7 @@ var ChartContainer = ({ id, className, children, config, initialDimension = INIT
1961
1827
  children: /* @__PURE__ */ jsxs("div", {
1962
1828
  ref: refContainer,
1963
1829
  "data-slot": "chart",
1830
+ id,
1964
1831
  "data-chart": chartId,
1965
1832
  className: cn("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className),
1966
1833
  ...props,
@@ -2087,7 +1954,7 @@ var getPayloadConfigFromPayload = (config, payload, key) => {
2087
1954
  var Checkbox = ({ className, ...props }) => {
2088
1955
  return /* @__PURE__ */ jsx(Checkbox$1.Root, {
2089
1956
  "data-slot": "checkbox",
2090
- className: cn("peer relative flex size-4 shrink-0 items-center justify-center rounded-sm border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary", className),
1957
+ className: cn("peer relative flex size-4 shrink-0 items-center justify-center rounded-sm border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 data-disabled:cursor-not-allowed data-disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary", className),
2091
1958
  ...props,
2092
1959
  children: /* @__PURE__ */ jsxs(Checkbox$1.Indicator, {
2093
1960
  "data-slot": "checkbox-indicator",
@@ -3450,7 +3317,7 @@ var getPaginationRange = (page, count, siblingCount = 1) => {
3450
3317
  };
3451
3318
  /** Clamp a page number to the valid [1, count] range (count <= 0 yields 1). */
3452
3319
  var clampPage = (page, count) => Math.min(Math.max(page, 1), Math.max(count, 1));
3453
- var Pagination = ({ page, count, onPageChange, siblingCount = 1, className }) => {
3320
+ var Pagination = ({ page, count, onPageChange, siblingCount = 1, className, ...props }) => {
3454
3321
  const currentPage = clampPage(page, count);
3455
3322
  const range = getPaginationRange(currentPage, count, siblingCount);
3456
3323
  let ellipsisCount = 0;
@@ -3462,6 +3329,7 @@ var Pagination = ({ page, count, onPageChange, siblingCount = 1, className }) =>
3462
3329
  };
3463
3330
  return /* @__PURE__ */ jsx("nav", {
3464
3331
  "aria-label": "pagination",
3332
+ ...props,
3465
3333
  className: cn("mx-auto flex w-full justify-center", className),
3466
3334
  children: /* @__PURE__ */ jsxs("ul", {
3467
3335
  className: "flex flex-row items-center gap-1",
@@ -4435,8 +4303,9 @@ var TableCaption = ({ className, ...props }) => {
4435
4303
  };
4436
4304
  //#endregion
4437
4305
  //#region ../ui/src/components/ui/tabs/tabs.tsx
4438
- var Tabs = ({ value, defaultValue, onValueChange, className, orientation = "horizontal", children }) => /* @__PURE__ */ jsx(Tabs$1.Root, {
4306
+ var Tabs = ({ value, defaultValue, onValueChange, className, orientation = "horizontal", children, ...props }) => /* @__PURE__ */ jsx(Tabs$1.Root, {
4439
4307
  "data-slot": "tabs",
4308
+ ...props,
4440
4309
  "data-orientation": orientation,
4441
4310
  value,
4442
4311
  defaultValue,
@@ -4454,19 +4323,22 @@ var tabsListVariants = cva("group/tabs-list inline-flex w-fit items-center justi
4454
4323
  } },
4455
4324
  defaultVariants: { variant: "default" }
4456
4325
  });
4457
- var TabsList = ({ className, variant = "default", children }) => /* @__PURE__ */ jsx(Tabs$1.List, {
4326
+ var TabsList = ({ className, variant = "default", children, ...props }) => /* @__PURE__ */ jsx(Tabs$1.List, {
4458
4327
  "data-slot": "tabs-list",
4328
+ ...props,
4459
4329
  "data-variant": variant,
4460
4330
  className: cn(tabsListVariants({ variant }), className),
4461
4331
  children
4462
4332
  });
4463
- var TabsTrigger = ({ value, disabled, className, children }) => /* @__PURE__ */ jsx(Tabs$1.Tab, {
4333
+ var TabsTrigger = ({ value, disabled, className, children, ...props }) => /* @__PURE__ */ jsx(Tabs$1.Tab, {
4334
+ ...props,
4464
4335
  value,
4465
4336
  disabled,
4466
4337
  className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\"size-\"])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent", "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100", className),
4467
4338
  children
4468
4339
  });
4469
- var TabsContent = ({ value, keepMounted = false, className, children }) => /* @__PURE__ */ jsx(Tabs$1.Panel, {
4340
+ var TabsContent = ({ value, keepMounted = false, className, children, ...props }) => /* @__PURE__ */ jsx(Tabs$1.Panel, {
4341
+ ...props,
4470
4342
  value,
4471
4343
  keepMounted,
4472
4344
  className: cn("flex-1 text-sm outline-none", className),