@reliability-design/web 1.4.3 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -213,6 +213,8 @@ declare class RelAutocomplete extends LitElement {
213
213
  private onPageScroll;
214
214
  private openPanel;
215
215
  private closePanel;
216
+ private showNativePopover;
217
+ private hideNativePopover;
216
218
  private updatePosition;
217
219
  /** Re-evaluates whether the panel should be showing for the current state. */
218
220
  private syncPanel;
@@ -443,6 +445,9 @@ declare class RelCardMedia extends LitElement {
443
445
 
444
446
  type CheckboxState = "default" | "error" | "disabled";
445
447
  type CheckboxStatus = "unchecked" | "checked" | "indeterminate";
448
+ type CheckboxSize = "small" | "medium";
449
+ type CheckboxDensity = "compact" | "comfortable";
450
+ type CheckboxAlignment = "leading" | "trailing";
446
451
  declare class RelCheckbox extends LitElement {
447
452
  label: string;
448
453
  /** rel-icon name rendered between the checkbox and the label (label prefix icon). */
@@ -451,11 +456,26 @@ declare class RelCheckbox extends LitElement {
451
456
  state: CheckboxState;
452
457
  status: CheckboxStatus;
453
458
  value: string;
459
+ /** Control scale (Figma Size). `"medium"` (default) = 18px box with body-lg
460
+ * label; `"small"` = 14px box with body-md label. */
461
+ size: CheckboxSize;
462
+ /** Supporting-text layout (Figma Density). `"compact"` (default) puts the
463
+ * supporting text on its own line under the row, indented past the box;
464
+ * `"comfortable"` stacks label + supporting text beside the box. */
465
+ density: CheckboxDensity;
466
+ /** Box position (Figma Alignment). `"leading"` (default) renders the box
467
+ * before the label; `"trailing"` pushes it to the far edge of the row.
468
+ * Trailing has no compact layout in the spec, so it always renders with
469
+ * comfortable density. */
470
+ alignment: CheckboxAlignment;
454
471
  get checked(): boolean;
455
472
  set checked(val: boolean);
456
473
  private _onChange;
457
474
  private _onTouched;
458
475
  static styles: lit.CSSResult;
476
+ protected willUpdate(changed: PropertyValues<this>): void;
477
+ /** Trailing has no compact layout in the spec — trailing wins. */
478
+ private get effectiveDensity();
459
479
  private toggle;
460
480
  registerOnChange(fn: (value: boolean) => void): void;
461
481
  registerOnTouched(fn: () => void): void;
@@ -563,10 +583,16 @@ declare class RelRangePicker extends LitElement {
563
583
  private isSelectingRange;
564
584
  private hoverDate;
565
585
  private triggerButton?;
586
+ private popoverEl?;
587
+ private backdropEl?;
566
588
  static styles: lit.CSSResult;
567
589
  connectedCallback(): void;
568
590
  disconnectedCallback(): void;
569
- updated(): void;
591
+ updated(changed: Map<string, unknown>): void;
592
+ private showTopLayer;
593
+ private hideTopLayer;
594
+ private onReposition;
595
+ private updatePopoverPosition;
570
596
  private handleClickOutside;
571
597
  private handleGlobalKeydown;
572
598
  private toggleOpen;
@@ -1212,6 +1238,9 @@ declare class RelPagination extends LitElement {
1212
1238
  private get activePage();
1213
1239
  private get computedTotalPages();
1214
1240
  private generatePageNumbers;
1241
+ /** Abbreviate large page numbers (368178 → "368k") so buttons stay compact.
1242
+ Exact below 10,000; floored to k up to 1M; then M with one decimal. */
1243
+ private formatPageLabel;
1215
1244
  private handlePageChange;
1216
1245
  private renderChevronLeft;
1217
1246
  private renderChevronRight;
@@ -1474,6 +1503,8 @@ declare class RelSelect extends LitElement {
1474
1503
  private emitChange;
1475
1504
  private openListbox;
1476
1505
  private closeListbox;
1506
+ private showNativePopover;
1507
+ private hideNativePopover;
1477
1508
  private updatePosition;
1478
1509
  private selectSingleOption;
1479
1510
  private toggleMultiOption;
@@ -1809,4 +1840,238 @@ declare class RelTooltip extends LitElement {
1809
1840
  render(): lit_html.TemplateResult<1>;
1810
1841
  }
1811
1842
 
1812
- export { type AutocompleteFilter, type AutocompleteItem, type AutocompleteSearchFn, type BreadcrumbItem, type ButtonTone, type ButtonVariant, type ChipBorder, type ChipSize, type ChipTone, type ChipVariant, type DrawerCloseReason, type DrawerSide, type FieldLabelStyle, type LabelPlacement, type MenuItem, type MenuType, type ModalSide, type Orientation, type OtpType, type ProgressMode, type RadioOption, RelAccordion, RelAlert, RelAutocomplete, RelAvatar, RelBadge, RelBreadcrumbs, RelButton, RelCalendar, RelCard, RelCardMedia, RelCarousel, RelCheckbox, RelChip, RelContainer, RelDatePicker, RelDivider, RelDrawer, RelDrawerFooter, RelKbd, RelKbdGroup, RelLayout, RelMenu, RelMenuItem, RelMenubar, RelMenubarMenu, RelModal, RelNavbar, RelOtp, RelPagination, RelPopover, RelPopoverContent, RelProgress, RelRadio, RelRangePicker, RelResizableGroup, RelResizableHandle, RelResizablePanel, RelSegmentedButton, RelSelect, RelSkeleton, RelSlider, RelSnackbar, RelStepper, RelSwitch, RelTab, RelTabItem, RelTextfield, RelTimePicker, RelToast, RelTooltip, RelTopbar, RelTopbarActions, RelTopbarBrand, RelTopbarDropdown, RelTopbarDropdownItem, RelTopbarItem, RelTopbarMobilePanel, RelTopbarProfile, RelTopbarUtilities, type SegmentAlign, type SegmentOption, type SegmentSize, type SelectBorder, type SelectLabelStyle, type SelectOption, type SelectOptionObject, type SelectSize, type SelectState, type SkeletonAnimation, type SkeletonShape, type SliderType, type SnackbarLines, type SnackbarType, type Step, type StepStatus, type StepperSize, type StepperType, type TabItem, type TextAlign, type TextFieldSize, type TextFieldState, type TextFieldVariant, type ToastType, type TooltipPosition, type TooltipType, type TopbarForceLayout, type TopbarProfileType, type TopbarRewardTier, type TopbarVariant, type TrackStyle };
1843
+ /** Per-file lifecycle state. Mirrors the Figma "Upload File Row" variants 1:1. */
1844
+ type UploadStatus = "ready" | "uploading" | "success" | "error";
1845
+ /**
1846
+ * Aggregate state, derived from `files` — never set directly. Drives the list
1847
+ * heading, the alert, and the footer button in `<rel-upload-actions>`, and
1848
+ * corresponds to the Figma "Upload Modal" variants.
1849
+ */
1850
+ type UploadPhase = "empty" | "selected" | "uploading" | "delayed" | "failed";
1851
+ interface UploadFile {
1852
+ /** Stable identity for keyed rendering and remove/retry targeting. */
1853
+ id: string;
1854
+ name: string;
1855
+ /** Size in bytes. */
1856
+ size: number;
1857
+ status: UploadStatus;
1858
+ /** 0–100, present while uploading and after success. */
1859
+ progress?: number;
1860
+ /** Bytes transferred so far. */
1861
+ loaded?: number;
1862
+ /** Human-readable failure reason, e.g. "file exceeds the 10 MB limit". */
1863
+ error?: string;
1864
+ /** The underlying File. Absent when the app supplies `files` itself. */
1865
+ file?: File;
1866
+ }
1867
+ interface UploadRejection {
1868
+ name: string;
1869
+ reason: "format" | "size";
1870
+ message: string;
1871
+ }
1872
+ interface UploaderContext {
1873
+ /** The entry being uploaded. */
1874
+ file: UploadFile;
1875
+ /** Aborted when `cancel()` is called. */
1876
+ signal: AbortSignal;
1877
+ /** Report bytes transferred. `total` defaults to the file size. */
1878
+ onProgress: (loaded: number, total?: number) => void;
1879
+ }
1880
+ /** Supply this to let `<rel-upload>` drive the whole lifecycle itself. */
1881
+ type Uploader = (file: File, ctx: UploaderContext) => Promise<void>;
1882
+ /** Snapshot handed to `<rel-upload-actions>` on every `rel-state` event. */
1883
+ interface UploadState {
1884
+ phase: UploadPhase;
1885
+ total: number;
1886
+ failed: number;
1887
+ canUpload: boolean;
1888
+ primaryLabel: string;
1889
+ }
1890
+ /**
1891
+ * `<rel-upload>` — dropzone plus per-file upload list.
1892
+ *
1893
+ * Two modes, chosen by whether `uploader` is set:
1894
+ *
1895
+ * - **Controlled** (default): the component picks and validates files, then
1896
+ * emits intents (`rel-upload`, `rel-retry`, `rel-cancel`, `rel-remove`). The
1897
+ * app performs the transfer and writes progress back onto `files`.
1898
+ * - **Self-driving**: with an `uploader` function the component runs the whole
1899
+ * batch itself — concurrency, progress, the delay warning, abort and retry.
1900
+ *
1901
+ * The Cancel / Upload buttons are NOT rendered here. They live in
1902
+ * `<rel-upload-actions>` so they can sit in `<rel-modal>`'s footer slot and
1903
+ * stay pinned while this body scrolls.
1904
+ *
1905
+ * Emits (bubbling + composed):
1906
+ * - `rel-files-added` — `{ added: UploadFile[], rejected: UploadRejection[] }`
1907
+ * - `rel-invalid` — `{ rejected: UploadRejection[] }`
1908
+ * - `rel-change` — selection changed; `{ files: UploadFile[] }`
1909
+ * - `rel-remove` — row removed; `{ id, file }`
1910
+ * - `rel-upload` — Upload pressed; `{ files: UploadFile[] }`
1911
+ * - `rel-retry` — Retry pressed; `{ files: UploadFile[] }`
1912
+ * - `rel-cancel` — Cancel pressed
1913
+ * - `rel-progress` — `{ id, progress, loaded, total }`
1914
+ * - `rel-file-complete`— `{ id, file }`
1915
+ * - `rel-file-error` — `{ id, file, error }`
1916
+ * - `rel-complete` — batch settled; `{ succeeded, failed }`
1917
+ * - `rel-state` — derived snapshot changed; `detail: UploadState`
1918
+ *
1919
+ * @element rel-upload
1920
+ */
1921
+ declare class RelUpload extends LitElement {
1922
+ /** Comma-separated accept list, e.g. ".pdf,.png,.jpg" or "image/*". */
1923
+ accept: string;
1924
+ /** Max size per file as a human string ("10MB", "500kb"). Empty → no limit. */
1925
+ maxSize: string;
1926
+ /** Allow more than one file. */
1927
+ multiple: boolean;
1928
+ /** Disables the whole control. */
1929
+ disabled: boolean;
1930
+ /** Overrides the derived "PDF, PNG or JPG - up to 10 MB per file" hint. */
1931
+ hint: string;
1932
+ /** Dropzone headline. */
1933
+ dropzoneTitle: string;
1934
+ /** Browse button label. */
1935
+ browseLabel: string;
1936
+ /**
1937
+ * The file list. Set it to drive the component in controlled mode; the
1938
+ * component also maintains it itself as files are added and removed.
1939
+ */
1940
+ files: UploadFile[];
1941
+ /** Supply to run uploads internally. See {@link Uploader}. */
1942
+ uploader?: Uploader;
1943
+ /** Max files transferred at once in self-driving mode. */
1944
+ concurrency: number;
1945
+ /** ms of continuous uploading before the "taking longer than usual" alert. */
1946
+ delayThreshold: number;
1947
+ private dragOver;
1948
+ private delayed;
1949
+ private inputEl;
1950
+ private aborter?;
1951
+ private delayTimer?;
1952
+ private lastSignature;
1953
+ static styles: lit.CSSResult;
1954
+ /**
1955
+ * Aggregate state. Read-only; corresponds to the Figma modal variants.
1956
+ *
1957
+ * `failed` means there is nothing left to send AND something errored — while
1958
+ * any row is still `ready` the primary action is Upload, not Retry.
1959
+ */
1960
+ get phase(): UploadPhase;
1961
+ /** Files still eligible to be sent. */
1962
+ private get pending();
1963
+ private get failedFiles();
1964
+ /**
1965
+ * Failed rows worth sending again. A file rejected by `accept`/`max-size`
1966
+ * will fail validation every time, so retrying it is pointless — re-check
1967
+ * rather than re-queueing it blindly.
1968
+ */
1969
+ private get retryable();
1970
+ get canUpload(): boolean;
1971
+ /** Footer button label — "Upload", "Upload 3 files" or "Retry upload". */
1972
+ get primaryLabel(): string;
1973
+ /** The snapshot `<rel-upload-actions>` renders from. */
1974
+ get state(): UploadState;
1975
+ private get listHeading();
1976
+ private get hintText();
1977
+ private get acceptDisplay();
1978
+ private get alertContent();
1979
+ private parseMaxBytes;
1980
+ private matchesAccept;
1981
+ static fmtSize(bytes: number): string;
1982
+ private static ext;
1983
+ /**
1984
+ * Validate and append. Invalid files are kept as `error` rows rather than
1985
+ * dropped — that is how the Figma Failure state surfaces them.
1986
+ */
1987
+ private ingest;
1988
+ private patch;
1989
+ private startDelayTimer;
1990
+ private stopDelayTimer;
1991
+ private runBatch;
1992
+ /** Start (or resume) the batch. Emits `rel-upload`; runs it when `uploader` is set. */
1993
+ upload(): void;
1994
+ /** Re-queue every retryable failed row and send again. */
1995
+ retry(): void;
1996
+ /** Abort anything in flight and emit `rel-cancel`. Does not clear the list. */
1997
+ cancel(): void;
1998
+ /** Remove one row by id. */
1999
+ removeFile(id: string): void;
2000
+ /** Clear everything and abort in-flight transfers. */
2001
+ reset(): void;
2002
+ private emit;
2003
+ /**
2004
+ * Emit `rel-state` only when the derived snapshot actually changes, so
2005
+ * progress ticks don't spam `<rel-upload-actions>`.
2006
+ */
2007
+ private notify;
2008
+ private openPicker;
2009
+ private onInputChange;
2010
+ private onDragOver;
2011
+ private onDragLeave;
2012
+ private onDrop;
2013
+ connectedCallback(): void;
2014
+ disconnectedCallback(): void;
2015
+ updated(): void;
2016
+ private rowMeta;
2017
+ private renderRow;
2018
+ render(): lit_html.TemplateResult<1>;
2019
+ }
2020
+ declare global {
2021
+ interface HTMLElementTagNameMap {
2022
+ "rel-upload": RelUpload;
2023
+ }
2024
+ }
2025
+
2026
+ /**
2027
+ * `<rel-upload-actions>` — the Cancel / Upload footer for `<rel-upload>`.
2028
+ *
2029
+ * Lives outside `<rel-upload>` so it can sit in `<rel-modal>`'s footer slot and
2030
+ * stay pinned while the upload body scrolls. It mirrors the sibling
2031
+ * `<rel-upload>`'s derived state, so the button label follows the design:
2032
+ * "Upload" → "Upload 3 files" → spinner → "Retry upload".
2033
+ *
2034
+ * ```html
2035
+ * <rel-modal open side="center" title="Upload documents">
2036
+ * <rel-upload multiple .uploader=${fn}></rel-upload>
2037
+ * <rel-upload-actions slot="footer"></rel-upload-actions>
2038
+ * </rel-modal>
2039
+ * ```
2040
+ *
2041
+ * The target is found automatically among its siblings. Use `for` to point at a
2042
+ * specific `<rel-upload>` by id when a container holds more than one.
2043
+ *
2044
+ * @element rel-upload-actions
2045
+ */
2046
+ declare class RelUploadActions extends LitElement {
2047
+ /** Id of the `<rel-upload>` to control. Omit to auto-discover a sibling. */
2048
+ for: string;
2049
+ /** Cancel button label. */
2050
+ cancelLabel: string;
2051
+ /** Hides Cancel for flows that only ever move forward. */
2052
+ noCancel: boolean;
2053
+ private snapshot;
2054
+ private target;
2055
+ static styles: lit.CSSResult;
2056
+ connectedCallback(): void;
2057
+ disconnectedCallback(): void;
2058
+ updated(changed: Map<string, unknown>): void;
2059
+ /**
2060
+ * Listen on our own root rather than `document`: a shared root means no
2061
+ * shadow boundary sits between us and the sibling `<rel-upload>`, so
2062
+ * `event.target` is never retargeted away from it.
2063
+ */
2064
+ private get root();
2065
+ private resolveTarget;
2066
+ private onState;
2067
+ private onCancel;
2068
+ private onPrimary;
2069
+ render(): lit_html.TemplateResult<1>;
2070
+ }
2071
+ declare global {
2072
+ interface HTMLElementTagNameMap {
2073
+ "rel-upload-actions": RelUploadActions;
2074
+ }
2075
+ }
2076
+
2077
+ export { type AutocompleteFilter, type AutocompleteItem, type AutocompleteSearchFn, type BreadcrumbItem, type ButtonTone, type ButtonVariant, type ChipBorder, type ChipSize, type ChipTone, type ChipVariant, type DrawerCloseReason, type DrawerSide, type FieldLabelStyle, type LabelPlacement, type MenuItem, type MenuType, type ModalSide, type Orientation, type OtpType, type ProgressMode, type RadioOption, RelAccordion, RelAlert, RelAutocomplete, RelAvatar, RelBadge, RelBreadcrumbs, RelButton, RelCalendar, RelCard, RelCardMedia, RelCarousel, RelCheckbox, RelChip, RelContainer, RelDatePicker, RelDivider, RelDrawer, RelDrawerFooter, RelKbd, RelKbdGroup, RelLayout, RelMenu, RelMenuItem, RelMenubar, RelMenubarMenu, RelModal, RelNavbar, RelOtp, RelPagination, RelPopover, RelPopoverContent, RelProgress, RelRadio, RelRangePicker, RelResizableGroup, RelResizableHandle, RelResizablePanel, RelSegmentedButton, RelSelect, RelSkeleton, RelSlider, RelSnackbar, RelStepper, RelSwitch, RelTab, RelTabItem, RelTextfield, RelTimePicker, RelToast, RelTooltip, RelTopbar, RelTopbarActions, RelTopbarBrand, RelTopbarDropdown, RelTopbarDropdownItem, RelTopbarItem, RelTopbarMobilePanel, RelTopbarProfile, RelTopbarUtilities, RelUpload, RelUploadActions, type SegmentAlign, type SegmentOption, type SegmentSize, type SelectBorder, type SelectLabelStyle, type SelectOption, type SelectOptionObject, type SelectSize, type SelectState, type SkeletonAnimation, type SkeletonShape, type SliderType, type SnackbarLines, type SnackbarType, type Step, type StepStatus, type StepperSize, type StepperType, type TabItem, type TextAlign, type TextFieldSize, type TextFieldState, type TextFieldVariant, type ToastType, type TooltipPosition, type TooltipType, type TopbarForceLayout, type TopbarProfileType, type TopbarRewardTier, type TopbarVariant, type TrackStyle, type UploadFile, type UploadPhase, type UploadRejection, type UploadState, type UploadStatus, type Uploader, type UploaderContext };
package/dist/index.d.ts CHANGED
@@ -213,6 +213,8 @@ declare class RelAutocomplete extends LitElement {
213
213
  private onPageScroll;
214
214
  private openPanel;
215
215
  private closePanel;
216
+ private showNativePopover;
217
+ private hideNativePopover;
216
218
  private updatePosition;
217
219
  /** Re-evaluates whether the panel should be showing for the current state. */
218
220
  private syncPanel;
@@ -443,6 +445,9 @@ declare class RelCardMedia extends LitElement {
443
445
 
444
446
  type CheckboxState = "default" | "error" | "disabled";
445
447
  type CheckboxStatus = "unchecked" | "checked" | "indeterminate";
448
+ type CheckboxSize = "small" | "medium";
449
+ type CheckboxDensity = "compact" | "comfortable";
450
+ type CheckboxAlignment = "leading" | "trailing";
446
451
  declare class RelCheckbox extends LitElement {
447
452
  label: string;
448
453
  /** rel-icon name rendered between the checkbox and the label (label prefix icon). */
@@ -451,11 +456,26 @@ declare class RelCheckbox extends LitElement {
451
456
  state: CheckboxState;
452
457
  status: CheckboxStatus;
453
458
  value: string;
459
+ /** Control scale (Figma Size). `"medium"` (default) = 18px box with body-lg
460
+ * label; `"small"` = 14px box with body-md label. */
461
+ size: CheckboxSize;
462
+ /** Supporting-text layout (Figma Density). `"compact"` (default) puts the
463
+ * supporting text on its own line under the row, indented past the box;
464
+ * `"comfortable"` stacks label + supporting text beside the box. */
465
+ density: CheckboxDensity;
466
+ /** Box position (Figma Alignment). `"leading"` (default) renders the box
467
+ * before the label; `"trailing"` pushes it to the far edge of the row.
468
+ * Trailing has no compact layout in the spec, so it always renders with
469
+ * comfortable density. */
470
+ alignment: CheckboxAlignment;
454
471
  get checked(): boolean;
455
472
  set checked(val: boolean);
456
473
  private _onChange;
457
474
  private _onTouched;
458
475
  static styles: lit.CSSResult;
476
+ protected willUpdate(changed: PropertyValues<this>): void;
477
+ /** Trailing has no compact layout in the spec — trailing wins. */
478
+ private get effectiveDensity();
459
479
  private toggle;
460
480
  registerOnChange(fn: (value: boolean) => void): void;
461
481
  registerOnTouched(fn: () => void): void;
@@ -563,10 +583,16 @@ declare class RelRangePicker extends LitElement {
563
583
  private isSelectingRange;
564
584
  private hoverDate;
565
585
  private triggerButton?;
586
+ private popoverEl?;
587
+ private backdropEl?;
566
588
  static styles: lit.CSSResult;
567
589
  connectedCallback(): void;
568
590
  disconnectedCallback(): void;
569
- updated(): void;
591
+ updated(changed: Map<string, unknown>): void;
592
+ private showTopLayer;
593
+ private hideTopLayer;
594
+ private onReposition;
595
+ private updatePopoverPosition;
570
596
  private handleClickOutside;
571
597
  private handleGlobalKeydown;
572
598
  private toggleOpen;
@@ -1212,6 +1238,9 @@ declare class RelPagination extends LitElement {
1212
1238
  private get activePage();
1213
1239
  private get computedTotalPages();
1214
1240
  private generatePageNumbers;
1241
+ /** Abbreviate large page numbers (368178 → "368k") so buttons stay compact.
1242
+ Exact below 10,000; floored to k up to 1M; then M with one decimal. */
1243
+ private formatPageLabel;
1215
1244
  private handlePageChange;
1216
1245
  private renderChevronLeft;
1217
1246
  private renderChevronRight;
@@ -1474,6 +1503,8 @@ declare class RelSelect extends LitElement {
1474
1503
  private emitChange;
1475
1504
  private openListbox;
1476
1505
  private closeListbox;
1506
+ private showNativePopover;
1507
+ private hideNativePopover;
1477
1508
  private updatePosition;
1478
1509
  private selectSingleOption;
1479
1510
  private toggleMultiOption;
@@ -1809,4 +1840,238 @@ declare class RelTooltip extends LitElement {
1809
1840
  render(): lit_html.TemplateResult<1>;
1810
1841
  }
1811
1842
 
1812
- export { type AutocompleteFilter, type AutocompleteItem, type AutocompleteSearchFn, type BreadcrumbItem, type ButtonTone, type ButtonVariant, type ChipBorder, type ChipSize, type ChipTone, type ChipVariant, type DrawerCloseReason, type DrawerSide, type FieldLabelStyle, type LabelPlacement, type MenuItem, type MenuType, type ModalSide, type Orientation, type OtpType, type ProgressMode, type RadioOption, RelAccordion, RelAlert, RelAutocomplete, RelAvatar, RelBadge, RelBreadcrumbs, RelButton, RelCalendar, RelCard, RelCardMedia, RelCarousel, RelCheckbox, RelChip, RelContainer, RelDatePicker, RelDivider, RelDrawer, RelDrawerFooter, RelKbd, RelKbdGroup, RelLayout, RelMenu, RelMenuItem, RelMenubar, RelMenubarMenu, RelModal, RelNavbar, RelOtp, RelPagination, RelPopover, RelPopoverContent, RelProgress, RelRadio, RelRangePicker, RelResizableGroup, RelResizableHandle, RelResizablePanel, RelSegmentedButton, RelSelect, RelSkeleton, RelSlider, RelSnackbar, RelStepper, RelSwitch, RelTab, RelTabItem, RelTextfield, RelTimePicker, RelToast, RelTooltip, RelTopbar, RelTopbarActions, RelTopbarBrand, RelTopbarDropdown, RelTopbarDropdownItem, RelTopbarItem, RelTopbarMobilePanel, RelTopbarProfile, RelTopbarUtilities, type SegmentAlign, type SegmentOption, type SegmentSize, type SelectBorder, type SelectLabelStyle, type SelectOption, type SelectOptionObject, type SelectSize, type SelectState, type SkeletonAnimation, type SkeletonShape, type SliderType, type SnackbarLines, type SnackbarType, type Step, type StepStatus, type StepperSize, type StepperType, type TabItem, type TextAlign, type TextFieldSize, type TextFieldState, type TextFieldVariant, type ToastType, type TooltipPosition, type TooltipType, type TopbarForceLayout, type TopbarProfileType, type TopbarRewardTier, type TopbarVariant, type TrackStyle };
1843
+ /** Per-file lifecycle state. Mirrors the Figma "Upload File Row" variants 1:1. */
1844
+ type UploadStatus = "ready" | "uploading" | "success" | "error";
1845
+ /**
1846
+ * Aggregate state, derived from `files` — never set directly. Drives the list
1847
+ * heading, the alert, and the footer button in `<rel-upload-actions>`, and
1848
+ * corresponds to the Figma "Upload Modal" variants.
1849
+ */
1850
+ type UploadPhase = "empty" | "selected" | "uploading" | "delayed" | "failed";
1851
+ interface UploadFile {
1852
+ /** Stable identity for keyed rendering and remove/retry targeting. */
1853
+ id: string;
1854
+ name: string;
1855
+ /** Size in bytes. */
1856
+ size: number;
1857
+ status: UploadStatus;
1858
+ /** 0–100, present while uploading and after success. */
1859
+ progress?: number;
1860
+ /** Bytes transferred so far. */
1861
+ loaded?: number;
1862
+ /** Human-readable failure reason, e.g. "file exceeds the 10 MB limit". */
1863
+ error?: string;
1864
+ /** The underlying File. Absent when the app supplies `files` itself. */
1865
+ file?: File;
1866
+ }
1867
+ interface UploadRejection {
1868
+ name: string;
1869
+ reason: "format" | "size";
1870
+ message: string;
1871
+ }
1872
+ interface UploaderContext {
1873
+ /** The entry being uploaded. */
1874
+ file: UploadFile;
1875
+ /** Aborted when `cancel()` is called. */
1876
+ signal: AbortSignal;
1877
+ /** Report bytes transferred. `total` defaults to the file size. */
1878
+ onProgress: (loaded: number, total?: number) => void;
1879
+ }
1880
+ /** Supply this to let `<rel-upload>` drive the whole lifecycle itself. */
1881
+ type Uploader = (file: File, ctx: UploaderContext) => Promise<void>;
1882
+ /** Snapshot handed to `<rel-upload-actions>` on every `rel-state` event. */
1883
+ interface UploadState {
1884
+ phase: UploadPhase;
1885
+ total: number;
1886
+ failed: number;
1887
+ canUpload: boolean;
1888
+ primaryLabel: string;
1889
+ }
1890
+ /**
1891
+ * `<rel-upload>` — dropzone plus per-file upload list.
1892
+ *
1893
+ * Two modes, chosen by whether `uploader` is set:
1894
+ *
1895
+ * - **Controlled** (default): the component picks and validates files, then
1896
+ * emits intents (`rel-upload`, `rel-retry`, `rel-cancel`, `rel-remove`). The
1897
+ * app performs the transfer and writes progress back onto `files`.
1898
+ * - **Self-driving**: with an `uploader` function the component runs the whole
1899
+ * batch itself — concurrency, progress, the delay warning, abort and retry.
1900
+ *
1901
+ * The Cancel / Upload buttons are NOT rendered here. They live in
1902
+ * `<rel-upload-actions>` so they can sit in `<rel-modal>`'s footer slot and
1903
+ * stay pinned while this body scrolls.
1904
+ *
1905
+ * Emits (bubbling + composed):
1906
+ * - `rel-files-added` — `{ added: UploadFile[], rejected: UploadRejection[] }`
1907
+ * - `rel-invalid` — `{ rejected: UploadRejection[] }`
1908
+ * - `rel-change` — selection changed; `{ files: UploadFile[] }`
1909
+ * - `rel-remove` — row removed; `{ id, file }`
1910
+ * - `rel-upload` — Upload pressed; `{ files: UploadFile[] }`
1911
+ * - `rel-retry` — Retry pressed; `{ files: UploadFile[] }`
1912
+ * - `rel-cancel` — Cancel pressed
1913
+ * - `rel-progress` — `{ id, progress, loaded, total }`
1914
+ * - `rel-file-complete`— `{ id, file }`
1915
+ * - `rel-file-error` — `{ id, file, error }`
1916
+ * - `rel-complete` — batch settled; `{ succeeded, failed }`
1917
+ * - `rel-state` — derived snapshot changed; `detail: UploadState`
1918
+ *
1919
+ * @element rel-upload
1920
+ */
1921
+ declare class RelUpload extends LitElement {
1922
+ /** Comma-separated accept list, e.g. ".pdf,.png,.jpg" or "image/*". */
1923
+ accept: string;
1924
+ /** Max size per file as a human string ("10MB", "500kb"). Empty → no limit. */
1925
+ maxSize: string;
1926
+ /** Allow more than one file. */
1927
+ multiple: boolean;
1928
+ /** Disables the whole control. */
1929
+ disabled: boolean;
1930
+ /** Overrides the derived "PDF, PNG or JPG - up to 10 MB per file" hint. */
1931
+ hint: string;
1932
+ /** Dropzone headline. */
1933
+ dropzoneTitle: string;
1934
+ /** Browse button label. */
1935
+ browseLabel: string;
1936
+ /**
1937
+ * The file list. Set it to drive the component in controlled mode; the
1938
+ * component also maintains it itself as files are added and removed.
1939
+ */
1940
+ files: UploadFile[];
1941
+ /** Supply to run uploads internally. See {@link Uploader}. */
1942
+ uploader?: Uploader;
1943
+ /** Max files transferred at once in self-driving mode. */
1944
+ concurrency: number;
1945
+ /** ms of continuous uploading before the "taking longer than usual" alert. */
1946
+ delayThreshold: number;
1947
+ private dragOver;
1948
+ private delayed;
1949
+ private inputEl;
1950
+ private aborter?;
1951
+ private delayTimer?;
1952
+ private lastSignature;
1953
+ static styles: lit.CSSResult;
1954
+ /**
1955
+ * Aggregate state. Read-only; corresponds to the Figma modal variants.
1956
+ *
1957
+ * `failed` means there is nothing left to send AND something errored — while
1958
+ * any row is still `ready` the primary action is Upload, not Retry.
1959
+ */
1960
+ get phase(): UploadPhase;
1961
+ /** Files still eligible to be sent. */
1962
+ private get pending();
1963
+ private get failedFiles();
1964
+ /**
1965
+ * Failed rows worth sending again. A file rejected by `accept`/`max-size`
1966
+ * will fail validation every time, so retrying it is pointless — re-check
1967
+ * rather than re-queueing it blindly.
1968
+ */
1969
+ private get retryable();
1970
+ get canUpload(): boolean;
1971
+ /** Footer button label — "Upload", "Upload 3 files" or "Retry upload". */
1972
+ get primaryLabel(): string;
1973
+ /** The snapshot `<rel-upload-actions>` renders from. */
1974
+ get state(): UploadState;
1975
+ private get listHeading();
1976
+ private get hintText();
1977
+ private get acceptDisplay();
1978
+ private get alertContent();
1979
+ private parseMaxBytes;
1980
+ private matchesAccept;
1981
+ static fmtSize(bytes: number): string;
1982
+ private static ext;
1983
+ /**
1984
+ * Validate and append. Invalid files are kept as `error` rows rather than
1985
+ * dropped — that is how the Figma Failure state surfaces them.
1986
+ */
1987
+ private ingest;
1988
+ private patch;
1989
+ private startDelayTimer;
1990
+ private stopDelayTimer;
1991
+ private runBatch;
1992
+ /** Start (or resume) the batch. Emits `rel-upload`; runs it when `uploader` is set. */
1993
+ upload(): void;
1994
+ /** Re-queue every retryable failed row and send again. */
1995
+ retry(): void;
1996
+ /** Abort anything in flight and emit `rel-cancel`. Does not clear the list. */
1997
+ cancel(): void;
1998
+ /** Remove one row by id. */
1999
+ removeFile(id: string): void;
2000
+ /** Clear everything and abort in-flight transfers. */
2001
+ reset(): void;
2002
+ private emit;
2003
+ /**
2004
+ * Emit `rel-state` only when the derived snapshot actually changes, so
2005
+ * progress ticks don't spam `<rel-upload-actions>`.
2006
+ */
2007
+ private notify;
2008
+ private openPicker;
2009
+ private onInputChange;
2010
+ private onDragOver;
2011
+ private onDragLeave;
2012
+ private onDrop;
2013
+ connectedCallback(): void;
2014
+ disconnectedCallback(): void;
2015
+ updated(): void;
2016
+ private rowMeta;
2017
+ private renderRow;
2018
+ render(): lit_html.TemplateResult<1>;
2019
+ }
2020
+ declare global {
2021
+ interface HTMLElementTagNameMap {
2022
+ "rel-upload": RelUpload;
2023
+ }
2024
+ }
2025
+
2026
+ /**
2027
+ * `<rel-upload-actions>` — the Cancel / Upload footer for `<rel-upload>`.
2028
+ *
2029
+ * Lives outside `<rel-upload>` so it can sit in `<rel-modal>`'s footer slot and
2030
+ * stay pinned while the upload body scrolls. It mirrors the sibling
2031
+ * `<rel-upload>`'s derived state, so the button label follows the design:
2032
+ * "Upload" → "Upload 3 files" → spinner → "Retry upload".
2033
+ *
2034
+ * ```html
2035
+ * <rel-modal open side="center" title="Upload documents">
2036
+ * <rel-upload multiple .uploader=${fn}></rel-upload>
2037
+ * <rel-upload-actions slot="footer"></rel-upload-actions>
2038
+ * </rel-modal>
2039
+ * ```
2040
+ *
2041
+ * The target is found automatically among its siblings. Use `for` to point at a
2042
+ * specific `<rel-upload>` by id when a container holds more than one.
2043
+ *
2044
+ * @element rel-upload-actions
2045
+ */
2046
+ declare class RelUploadActions extends LitElement {
2047
+ /** Id of the `<rel-upload>` to control. Omit to auto-discover a sibling. */
2048
+ for: string;
2049
+ /** Cancel button label. */
2050
+ cancelLabel: string;
2051
+ /** Hides Cancel for flows that only ever move forward. */
2052
+ noCancel: boolean;
2053
+ private snapshot;
2054
+ private target;
2055
+ static styles: lit.CSSResult;
2056
+ connectedCallback(): void;
2057
+ disconnectedCallback(): void;
2058
+ updated(changed: Map<string, unknown>): void;
2059
+ /**
2060
+ * Listen on our own root rather than `document`: a shared root means no
2061
+ * shadow boundary sits between us and the sibling `<rel-upload>`, so
2062
+ * `event.target` is never retargeted away from it.
2063
+ */
2064
+ private get root();
2065
+ private resolveTarget;
2066
+ private onState;
2067
+ private onCancel;
2068
+ private onPrimary;
2069
+ render(): lit_html.TemplateResult<1>;
2070
+ }
2071
+ declare global {
2072
+ interface HTMLElementTagNameMap {
2073
+ "rel-upload-actions": RelUploadActions;
2074
+ }
2075
+ }
2076
+
2077
+ export { type AutocompleteFilter, type AutocompleteItem, type AutocompleteSearchFn, type BreadcrumbItem, type ButtonTone, type ButtonVariant, type ChipBorder, type ChipSize, type ChipTone, type ChipVariant, type DrawerCloseReason, type DrawerSide, type FieldLabelStyle, type LabelPlacement, type MenuItem, type MenuType, type ModalSide, type Orientation, type OtpType, type ProgressMode, type RadioOption, RelAccordion, RelAlert, RelAutocomplete, RelAvatar, RelBadge, RelBreadcrumbs, RelButton, RelCalendar, RelCard, RelCardMedia, RelCarousel, RelCheckbox, RelChip, RelContainer, RelDatePicker, RelDivider, RelDrawer, RelDrawerFooter, RelKbd, RelKbdGroup, RelLayout, RelMenu, RelMenuItem, RelMenubar, RelMenubarMenu, RelModal, RelNavbar, RelOtp, RelPagination, RelPopover, RelPopoverContent, RelProgress, RelRadio, RelRangePicker, RelResizableGroup, RelResizableHandle, RelResizablePanel, RelSegmentedButton, RelSelect, RelSkeleton, RelSlider, RelSnackbar, RelStepper, RelSwitch, RelTab, RelTabItem, RelTextfield, RelTimePicker, RelToast, RelTooltip, RelTopbar, RelTopbarActions, RelTopbarBrand, RelTopbarDropdown, RelTopbarDropdownItem, RelTopbarItem, RelTopbarMobilePanel, RelTopbarProfile, RelTopbarUtilities, RelUpload, RelUploadActions, type SegmentAlign, type SegmentOption, type SegmentSize, type SelectBorder, type SelectLabelStyle, type SelectOption, type SelectOptionObject, type SelectSize, type SelectState, type SkeletonAnimation, type SkeletonShape, type SliderType, type SnackbarLines, type SnackbarType, type Step, type StepStatus, type StepperSize, type StepperType, type TabItem, type TextAlign, type TextFieldSize, type TextFieldState, type TextFieldVariant, type ToastType, type TooltipPosition, type TooltipType, type TopbarForceLayout, type TopbarProfileType, type TopbarRewardTier, type TopbarVariant, type TrackStyle, type UploadFile, type UploadPhase, type UploadRejection, type UploadState, type UploadStatus, type Uploader, type UploaderContext };