@reliability-design/web 1.4.1 → 1.4.2
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/CHANGELOG.md +22 -22
- package/dist/components/rel-autocomplete/README.md +94 -0
- package/dist/components/rel-autocomplete/rel-autocomplete.ts +612 -0
- package/dist/components/rel-button/rel-button.ts +17 -3
- package/dist/components/rel-checkbox/README.md +1 -0
- package/dist/components/rel-checkbox/rel-checkbox.ts +34 -0
- package/dist/components/rel-drawer/rel-drawer.ts +9 -0
- package/dist/components/rel-popover/rel-popover.ts +56 -0
- package/dist/components/rel-radio/rel-radio.ts +12 -0
- package/dist/components/rel-select/README.md +4 -2
- package/dist/components/rel-select/rel-select.ts +180 -8
- package/dist/components/rel-sheet/rel-sheet.ts +20 -0
- package/dist/components/rel-textfield/rel-textfield.ts +5 -0
- package/dist/index.d.mts +204 -53
- package/dist/index.d.ts +204 -53
- package/dist/index.js +13266 -12395
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13205 -12335
- package/dist/index.mjs.map +1 -1
- package/dist/styles/vars.css +866 -866
- package/dist/{vars-BYCEEKWJ.css → vars-XNMTSRVN.css} +866 -866
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as lit_html from 'lit-html';
|
|
2
2
|
import * as lit from 'lit';
|
|
3
|
-
import { LitElement, PropertyValues } from 'lit';
|
|
3
|
+
import { LitElement, PropertyValues, TemplateResult } from 'lit';
|
|
4
4
|
export * from '@reliability-design/icons';
|
|
5
5
|
|
|
6
6
|
declare class RelAccordion extends LitElement {
|
|
@@ -31,6 +31,172 @@ declare class RelAlert extends LitElement {
|
|
|
31
31
|
render(): lit_html.TemplateResult<1>;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
type TextFieldState = "default" | "error" | "disabled";
|
|
35
|
+
type TextFieldSize = "small" | "medium" | "large";
|
|
36
|
+
type TextFieldVariant = "default" | "underline" | "legend";
|
|
37
|
+
declare class RelTextfield extends LitElement {
|
|
38
|
+
label?: string;
|
|
39
|
+
placeholder: string;
|
|
40
|
+
type: string;
|
|
41
|
+
value: string;
|
|
42
|
+
leftIcon?: string;
|
|
43
|
+
rightIcon?: string;
|
|
44
|
+
/** Makes the trailing icon interactive (pointer + focusable) and emits
|
|
45
|
+
* `rel-right-icon-click` — e.g. a password show/hide toggle or clear button. */
|
|
46
|
+
clickableRightIcon: boolean;
|
|
47
|
+
/** Accessible label for the trailing icon when it is clickable. */
|
|
48
|
+
rightIconAriaLabel?: string;
|
|
49
|
+
supportingText?: string;
|
|
50
|
+
state: TextFieldState;
|
|
51
|
+
size: TextFieldSize;
|
|
52
|
+
floatingLabel: boolean;
|
|
53
|
+
variant: TextFieldVariant;
|
|
54
|
+
disabled: boolean;
|
|
55
|
+
required: boolean;
|
|
56
|
+
multiline: boolean;
|
|
57
|
+
rows: number;
|
|
58
|
+
prefixIcon?: string;
|
|
59
|
+
prefixIconAriaLabel?: string;
|
|
60
|
+
error: boolean;
|
|
61
|
+
errorMessage?: string;
|
|
62
|
+
helperText?: string;
|
|
63
|
+
readonly: boolean;
|
|
64
|
+
maxLength?: number;
|
|
65
|
+
name?: string;
|
|
66
|
+
fullWidth: boolean;
|
|
67
|
+
private internalState;
|
|
68
|
+
private _wasError;
|
|
69
|
+
private uniqueId;
|
|
70
|
+
private get isDisabled();
|
|
71
|
+
private get isError();
|
|
72
|
+
private get leadingIcon();
|
|
73
|
+
private get helper();
|
|
74
|
+
static styles: lit.CSSResult;
|
|
75
|
+
connectedCallback(): void;
|
|
76
|
+
/** Focuses the inner input/textarea (the host itself is not focusable). */
|
|
77
|
+
focus(options?: FocusOptions): void;
|
|
78
|
+
private handleFocus;
|
|
79
|
+
private handleBlur;
|
|
80
|
+
private handleRightIconClick;
|
|
81
|
+
private handleRightIconKeydown;
|
|
82
|
+
private handleInput;
|
|
83
|
+
render(): lit_html.TemplateResult<1>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** An item is a plain string or any object read through displayField/valueField. */
|
|
87
|
+
type AutocompleteItem = string | Record<string, unknown>;
|
|
88
|
+
type AutocompleteFilter = "contains" | "starts-with" | "none";
|
|
89
|
+
type AutocompleteSearchFn = (query: string) => Promise<AutocompleteItem[]>;
|
|
90
|
+
/**
|
|
91
|
+
* `<rel-autocomplete>` — searchable single-select type-ahead field.
|
|
92
|
+
*
|
|
93
|
+
* Composes `<rel-textfield>` for all field chrome (label, sizes, variants,
|
|
94
|
+
* states, icons) and adds a suggestion panel on top. Two data modes:
|
|
95
|
+
* - local: set `items`; typing filters them (`filter` mode)
|
|
96
|
+
* - remote: set `searchFn`; input is debounced (`debounceMs`), queries are
|
|
97
|
+
* latest-wins (stale responses discarded), and `items` is ignored
|
|
98
|
+
*
|
|
99
|
+
* The committed `value` is always the selected item's value string (its
|
|
100
|
+
* `valueField`) — typing alone emits `rel-change` with the raw text but does
|
|
101
|
+
* not change `value` until an item is picked (or the text exactly matches an
|
|
102
|
+
* item's label/value on Enter/blur).
|
|
103
|
+
*/
|
|
104
|
+
declare class RelAutocomplete extends LitElement {
|
|
105
|
+
/** Local (or fallback initial) suggestion list. Ignored while searchFn drives results. */
|
|
106
|
+
items: AutocompleteItem[];
|
|
107
|
+
/** Committed value — the selected item's valueField string ("" = none). */
|
|
108
|
+
value: string;
|
|
109
|
+
/** Object key read for the row label when items are objects. */
|
|
110
|
+
displayField: string;
|
|
111
|
+
/** Object key read for the committed value when items are objects. */
|
|
112
|
+
valueField: string;
|
|
113
|
+
/** Local filtering mode. Ignored when searchFn is set (results arrive pre-filtered). */
|
|
114
|
+
filter: AutocompleteFilter;
|
|
115
|
+
/** Async data source. When set, local filtering is bypassed entirely. */
|
|
116
|
+
searchFn?: AutocompleteSearchFn;
|
|
117
|
+
/** Debounce for searchFn calls, in ms. */
|
|
118
|
+
debounceMs: number;
|
|
119
|
+
/** Minimum typed characters before the panel opens / searchFn fires. 0 = open on focus. */
|
|
120
|
+
minSearchLength: number;
|
|
121
|
+
/** Optional cap on rendered suggestions (panel scrolls regardless). */
|
|
122
|
+
maxSuggestions: number;
|
|
123
|
+
/** Shows a trailing ✕ that clears the text and the committed value. */
|
|
124
|
+
clearable: boolean;
|
|
125
|
+
/** Externally-controlled loading state (internal searchFn loading is automatic). */
|
|
126
|
+
loading: boolean;
|
|
127
|
+
/** Row shown when a query yields nothing. */
|
|
128
|
+
noResultsText: string;
|
|
129
|
+
loadingText: string;
|
|
130
|
+
label?: string;
|
|
131
|
+
placeholder: string;
|
|
132
|
+
size: TextFieldSize;
|
|
133
|
+
variant: TextFieldVariant;
|
|
134
|
+
floatingLabel: boolean;
|
|
135
|
+
prefixIcon?: string;
|
|
136
|
+
disabled: boolean;
|
|
137
|
+
readonly: boolean;
|
|
138
|
+
required: boolean;
|
|
139
|
+
error: boolean;
|
|
140
|
+
errorMessage?: string;
|
|
141
|
+
helperText?: string;
|
|
142
|
+
name?: string;
|
|
143
|
+
fullWidth: boolean;
|
|
144
|
+
private open;
|
|
145
|
+
private inputText;
|
|
146
|
+
private highlightedIndex;
|
|
147
|
+
private panelStyle;
|
|
148
|
+
private searching;
|
|
149
|
+
/** searchFn results; null = idle/local mode (use items). */
|
|
150
|
+
private remoteItems;
|
|
151
|
+
private fieldEl;
|
|
152
|
+
private panelEl;
|
|
153
|
+
private uniqueId;
|
|
154
|
+
private debounceTimer?;
|
|
155
|
+
private searchSeq;
|
|
156
|
+
/** Set while a selection/clear updates `value` internally, so willUpdate
|
|
157
|
+
* doesn't overwrite the input text the way it does for external writes. */
|
|
158
|
+
private internalValueWrite;
|
|
159
|
+
static styles: lit.CSSResult;
|
|
160
|
+
disconnectedCallback(): void;
|
|
161
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
162
|
+
/** Full normalized source list (remote results while searchFn drives, else items). */
|
|
163
|
+
private get allItems();
|
|
164
|
+
private normalizeItem;
|
|
165
|
+
/** Suggestions for the current query — local filter only applies without searchFn. */
|
|
166
|
+
private get filteredItems();
|
|
167
|
+
private get isLoading();
|
|
168
|
+
private get queryLongEnough();
|
|
169
|
+
private addGlobalListeners;
|
|
170
|
+
private removeGlobalListeners;
|
|
171
|
+
private onOutsidePointerDown;
|
|
172
|
+
private onPageScroll;
|
|
173
|
+
private openPanel;
|
|
174
|
+
private closePanel;
|
|
175
|
+
private updatePosition;
|
|
176
|
+
/** Re-evaluates whether the panel should be showing for the current state. */
|
|
177
|
+
private syncPanel;
|
|
178
|
+
private onFieldInput;
|
|
179
|
+
private runSearch;
|
|
180
|
+
private selectItem;
|
|
181
|
+
/** Silent commit when typed text exactly matches an item (label or value, case-insensitive). */
|
|
182
|
+
private commitExactMatch;
|
|
183
|
+
private emitChanged;
|
|
184
|
+
private clear;
|
|
185
|
+
private onKeyDown;
|
|
186
|
+
private onFocusIn;
|
|
187
|
+
private onFocusOut;
|
|
188
|
+
/** Delegates focus to the inner textfield. */
|
|
189
|
+
focus(): void;
|
|
190
|
+
/** Bolds the first occurrence of the query inside a suggestion label. */
|
|
191
|
+
private renderLabel;
|
|
192
|
+
render(): TemplateResult<1>;
|
|
193
|
+
}
|
|
194
|
+
declare global {
|
|
195
|
+
interface HTMLElementTagNameMap {
|
|
196
|
+
"rel-autocomplete": RelAutocomplete;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
34
200
|
declare class RelAvatar extends LitElement {
|
|
35
201
|
size: "lg" | "md" | "sm" | "xs";
|
|
36
202
|
type: "image" | "text" | "icon";
|
|
@@ -238,6 +404,8 @@ type CheckboxState = "default" | "error" | "disabled";
|
|
|
238
404
|
type CheckboxStatus = "unchecked" | "checked" | "indeterminate";
|
|
239
405
|
declare class RelCheckbox extends LitElement {
|
|
240
406
|
label: string;
|
|
407
|
+
/** rel-icon name rendered between the checkbox and the label (label prefix icon). */
|
|
408
|
+
icon: string;
|
|
241
409
|
supportingtext: string;
|
|
242
410
|
state: CheckboxState;
|
|
243
411
|
status: CheckboxStatus;
|
|
@@ -1001,6 +1169,8 @@ declare class RelPopover extends LitElement {
|
|
|
1001
1169
|
private onHostPointerDown;
|
|
1002
1170
|
private onOpen;
|
|
1003
1171
|
private onClose;
|
|
1172
|
+
private showNativePopover;
|
|
1173
|
+
private hideNativePopover;
|
|
1004
1174
|
private addGlobalListeners;
|
|
1005
1175
|
private removeGlobalListeners;
|
|
1006
1176
|
private onOutsidePointerDown;
|
|
@@ -1136,6 +1306,8 @@ interface SelectOptionObject {
|
|
|
1136
1306
|
value: string;
|
|
1137
1307
|
label?: string;
|
|
1138
1308
|
supportingText?: string;
|
|
1309
|
+
/** rel-icon name rendered as a prefix (leading icon) on the menu item. */
|
|
1310
|
+
icon?: string;
|
|
1139
1311
|
}
|
|
1140
1312
|
type SelectOption = string | SelectOptionObject;
|
|
1141
1313
|
declare class RelSelect extends LitElement {
|
|
@@ -1157,7 +1329,11 @@ declare class RelSelect extends LitElement {
|
|
|
1157
1329
|
placeholder: string;
|
|
1158
1330
|
searchPlaceholder: string;
|
|
1159
1331
|
selectAllLabel: string;
|
|
1160
|
-
/**
|
|
1332
|
+
/**
|
|
1333
|
+
* Optional hard cap on visible chips. By default (no cap) the visible
|
|
1334
|
+
* count adapts to the trigger's width: chips collapse into the "+N" badge
|
|
1335
|
+
* one by one instead of wrapping to a second line.
|
|
1336
|
+
*/
|
|
1161
1337
|
maxVisibleChips: number;
|
|
1162
1338
|
/** Hides the in-panel search field. Figma's "Single Option" dropdown has no search bar at all — use this for short, non-searchable lists. */
|
|
1163
1339
|
noSearch: boolean;
|
|
@@ -1166,13 +1342,30 @@ declare class RelSelect extends LitElement {
|
|
|
1166
1342
|
private panelStyle;
|
|
1167
1343
|
private searchValue;
|
|
1168
1344
|
private internalState;
|
|
1345
|
+
/** How many chips currently fit in the trigger width (width-adaptive). */
|
|
1346
|
+
private visibleChipCount;
|
|
1169
1347
|
private triggerEl;
|
|
1170
1348
|
private searchInputEl;
|
|
1171
1349
|
private listboxEl;
|
|
1350
|
+
private valueEl;
|
|
1351
|
+
private chipsMeasureEl;
|
|
1352
|
+
/** Must match the `gap` of .select-chips / .select-chips-measure. */
|
|
1353
|
+
private static readonly CHIP_GAP;
|
|
1354
|
+
private chipResizeObserver?;
|
|
1172
1355
|
private uniqueId;
|
|
1173
1356
|
static styles: lit.CSSResult;
|
|
1357
|
+
connectedCallback(): void;
|
|
1174
1358
|
disconnectedCallback(): void;
|
|
1359
|
+
protected firstUpdated(): void;
|
|
1175
1360
|
protected willUpdate(changed: PropertyValues<this>): void;
|
|
1361
|
+
protected updated(changed: PropertyValues<this>): void;
|
|
1362
|
+
/**
|
|
1363
|
+
* Width-adaptive chip collapsing: measures every selected chip in the
|
|
1364
|
+
* hidden .select-chips-measure row and works out how many fit in the value
|
|
1365
|
+
* area, always reserving room for the trailing "+N" chip when not all fit.
|
|
1366
|
+
* At least one chip stays visible no matter how narrow the field gets.
|
|
1367
|
+
*/
|
|
1368
|
+
private computeVisibleChips;
|
|
1176
1369
|
private get normalizedOptions();
|
|
1177
1370
|
/** Options matching the current search text (substring match, case-insensitive). */
|
|
1178
1371
|
private get filteredOptions();
|
|
@@ -1200,6 +1393,13 @@ declare class RelSelect extends LitElement {
|
|
|
1200
1393
|
private onSearchKeyDown;
|
|
1201
1394
|
private handleListNavigation;
|
|
1202
1395
|
private renderChips;
|
|
1396
|
+
/**
|
|
1397
|
+
* Hidden, unconstrained copy of every selected chip used purely for width
|
|
1398
|
+
* measurement (see computeVisibleChips). Chips mirror the visible ones'
|
|
1399
|
+
* width-affecting props (removable adds the ✕ icon). The trailing chip is
|
|
1400
|
+
* the widest "+N" badge that could ever be needed.
|
|
1401
|
+
*/
|
|
1402
|
+
private renderChipsMeasure;
|
|
1203
1403
|
render(): lit_html.TemplateResult<1>;
|
|
1204
1404
|
}
|
|
1205
1405
|
declare global {
|
|
@@ -1247,6 +1447,7 @@ declare class RelModal extends LitElement {
|
|
|
1247
1447
|
static styles: lit.CSSResult;
|
|
1248
1448
|
connectedCallback(): void;
|
|
1249
1449
|
disconnectedCallback(): void;
|
|
1450
|
+
protected willUpdate(): void;
|
|
1250
1451
|
updated(changed: Map<string, unknown>): void;
|
|
1251
1452
|
private handleOpen;
|
|
1252
1453
|
private handleClose;
|
|
@@ -1426,56 +1627,6 @@ declare class RelTab extends LitElement {
|
|
|
1426
1627
|
render(): lit_html.TemplateResult<1>;
|
|
1427
1628
|
}
|
|
1428
1629
|
|
|
1429
|
-
type TextFieldState = "default" | "error" | "disabled";
|
|
1430
|
-
type TextFieldSize = "small" | "medium" | "large";
|
|
1431
|
-
type TextFieldVariant = "default" | "underline" | "legend";
|
|
1432
|
-
declare class RelTextfield extends LitElement {
|
|
1433
|
-
label?: string;
|
|
1434
|
-
placeholder: string;
|
|
1435
|
-
type: string;
|
|
1436
|
-
value: string;
|
|
1437
|
-
leftIcon?: string;
|
|
1438
|
-
rightIcon?: string;
|
|
1439
|
-
/** Makes the trailing icon interactive (pointer + focusable) and emits
|
|
1440
|
-
* `rel-right-icon-click` — e.g. a password show/hide toggle or clear button. */
|
|
1441
|
-
clickableRightIcon: boolean;
|
|
1442
|
-
/** Accessible label for the trailing icon when it is clickable. */
|
|
1443
|
-
rightIconAriaLabel?: string;
|
|
1444
|
-
supportingText?: string;
|
|
1445
|
-
state: TextFieldState;
|
|
1446
|
-
size: TextFieldSize;
|
|
1447
|
-
floatingLabel: boolean;
|
|
1448
|
-
variant: TextFieldVariant;
|
|
1449
|
-
disabled: boolean;
|
|
1450
|
-
required: boolean;
|
|
1451
|
-
multiline: boolean;
|
|
1452
|
-
rows: number;
|
|
1453
|
-
prefixIcon?: string;
|
|
1454
|
-
prefixIconAriaLabel?: string;
|
|
1455
|
-
error: boolean;
|
|
1456
|
-
errorMessage?: string;
|
|
1457
|
-
helperText?: string;
|
|
1458
|
-
readonly: boolean;
|
|
1459
|
-
maxLength?: number;
|
|
1460
|
-
name?: string;
|
|
1461
|
-
fullWidth: boolean;
|
|
1462
|
-
private internalState;
|
|
1463
|
-
private _wasError;
|
|
1464
|
-
private uniqueId;
|
|
1465
|
-
private get isDisabled();
|
|
1466
|
-
private get isError();
|
|
1467
|
-
private get leadingIcon();
|
|
1468
|
-
private get helper();
|
|
1469
|
-
static styles: lit.CSSResult;
|
|
1470
|
-
connectedCallback(): void;
|
|
1471
|
-
private handleFocus;
|
|
1472
|
-
private handleBlur;
|
|
1473
|
-
private handleRightIconClick;
|
|
1474
|
-
private handleRightIconKeydown;
|
|
1475
|
-
private handleInput;
|
|
1476
|
-
render(): lit_html.TemplateResult<1>;
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
1630
|
type ToastType = "default" | "error";
|
|
1480
1631
|
declare class RelToast extends LitElement {
|
|
1481
1632
|
message: string;
|
|
@@ -1509,4 +1660,4 @@ declare class RelTooltip extends LitElement {
|
|
|
1509
1660
|
render(): lit_html.TemplateResult<1>;
|
|
1510
1661
|
}
|
|
1511
1662
|
|
|
1512
|
-
export { type BreadcrumbItem, type ButtonTone, type ButtonVariant, type ChipBorder, type ChipSize, type ChipTone, type ChipVariant, type DrawerCloseReason, type DrawerSide, type LabelPlacement, type MenuItem, type MenuType, type ModalSide, type Orientation, type OtpType, type ProgressMode, type RadioOption, RelAccordion, RelAlert, 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, 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 };
|
|
1663
|
+
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 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, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as lit_html from 'lit-html';
|
|
2
2
|
import * as lit from 'lit';
|
|
3
|
-
import { LitElement, PropertyValues } from 'lit';
|
|
3
|
+
import { LitElement, PropertyValues, TemplateResult } from 'lit';
|
|
4
4
|
export * from '@reliability-design/icons';
|
|
5
5
|
|
|
6
6
|
declare class RelAccordion extends LitElement {
|
|
@@ -31,6 +31,172 @@ declare class RelAlert extends LitElement {
|
|
|
31
31
|
render(): lit_html.TemplateResult<1>;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
type TextFieldState = "default" | "error" | "disabled";
|
|
35
|
+
type TextFieldSize = "small" | "medium" | "large";
|
|
36
|
+
type TextFieldVariant = "default" | "underline" | "legend";
|
|
37
|
+
declare class RelTextfield extends LitElement {
|
|
38
|
+
label?: string;
|
|
39
|
+
placeholder: string;
|
|
40
|
+
type: string;
|
|
41
|
+
value: string;
|
|
42
|
+
leftIcon?: string;
|
|
43
|
+
rightIcon?: string;
|
|
44
|
+
/** Makes the trailing icon interactive (pointer + focusable) and emits
|
|
45
|
+
* `rel-right-icon-click` — e.g. a password show/hide toggle or clear button. */
|
|
46
|
+
clickableRightIcon: boolean;
|
|
47
|
+
/** Accessible label for the trailing icon when it is clickable. */
|
|
48
|
+
rightIconAriaLabel?: string;
|
|
49
|
+
supportingText?: string;
|
|
50
|
+
state: TextFieldState;
|
|
51
|
+
size: TextFieldSize;
|
|
52
|
+
floatingLabel: boolean;
|
|
53
|
+
variant: TextFieldVariant;
|
|
54
|
+
disabled: boolean;
|
|
55
|
+
required: boolean;
|
|
56
|
+
multiline: boolean;
|
|
57
|
+
rows: number;
|
|
58
|
+
prefixIcon?: string;
|
|
59
|
+
prefixIconAriaLabel?: string;
|
|
60
|
+
error: boolean;
|
|
61
|
+
errorMessage?: string;
|
|
62
|
+
helperText?: string;
|
|
63
|
+
readonly: boolean;
|
|
64
|
+
maxLength?: number;
|
|
65
|
+
name?: string;
|
|
66
|
+
fullWidth: boolean;
|
|
67
|
+
private internalState;
|
|
68
|
+
private _wasError;
|
|
69
|
+
private uniqueId;
|
|
70
|
+
private get isDisabled();
|
|
71
|
+
private get isError();
|
|
72
|
+
private get leadingIcon();
|
|
73
|
+
private get helper();
|
|
74
|
+
static styles: lit.CSSResult;
|
|
75
|
+
connectedCallback(): void;
|
|
76
|
+
/** Focuses the inner input/textarea (the host itself is not focusable). */
|
|
77
|
+
focus(options?: FocusOptions): void;
|
|
78
|
+
private handleFocus;
|
|
79
|
+
private handleBlur;
|
|
80
|
+
private handleRightIconClick;
|
|
81
|
+
private handleRightIconKeydown;
|
|
82
|
+
private handleInput;
|
|
83
|
+
render(): lit_html.TemplateResult<1>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** An item is a plain string or any object read through displayField/valueField. */
|
|
87
|
+
type AutocompleteItem = string | Record<string, unknown>;
|
|
88
|
+
type AutocompleteFilter = "contains" | "starts-with" | "none";
|
|
89
|
+
type AutocompleteSearchFn = (query: string) => Promise<AutocompleteItem[]>;
|
|
90
|
+
/**
|
|
91
|
+
* `<rel-autocomplete>` — searchable single-select type-ahead field.
|
|
92
|
+
*
|
|
93
|
+
* Composes `<rel-textfield>` for all field chrome (label, sizes, variants,
|
|
94
|
+
* states, icons) and adds a suggestion panel on top. Two data modes:
|
|
95
|
+
* - local: set `items`; typing filters them (`filter` mode)
|
|
96
|
+
* - remote: set `searchFn`; input is debounced (`debounceMs`), queries are
|
|
97
|
+
* latest-wins (stale responses discarded), and `items` is ignored
|
|
98
|
+
*
|
|
99
|
+
* The committed `value` is always the selected item's value string (its
|
|
100
|
+
* `valueField`) — typing alone emits `rel-change` with the raw text but does
|
|
101
|
+
* not change `value` until an item is picked (or the text exactly matches an
|
|
102
|
+
* item's label/value on Enter/blur).
|
|
103
|
+
*/
|
|
104
|
+
declare class RelAutocomplete extends LitElement {
|
|
105
|
+
/** Local (or fallback initial) suggestion list. Ignored while searchFn drives results. */
|
|
106
|
+
items: AutocompleteItem[];
|
|
107
|
+
/** Committed value — the selected item's valueField string ("" = none). */
|
|
108
|
+
value: string;
|
|
109
|
+
/** Object key read for the row label when items are objects. */
|
|
110
|
+
displayField: string;
|
|
111
|
+
/** Object key read for the committed value when items are objects. */
|
|
112
|
+
valueField: string;
|
|
113
|
+
/** Local filtering mode. Ignored when searchFn is set (results arrive pre-filtered). */
|
|
114
|
+
filter: AutocompleteFilter;
|
|
115
|
+
/** Async data source. When set, local filtering is bypassed entirely. */
|
|
116
|
+
searchFn?: AutocompleteSearchFn;
|
|
117
|
+
/** Debounce for searchFn calls, in ms. */
|
|
118
|
+
debounceMs: number;
|
|
119
|
+
/** Minimum typed characters before the panel opens / searchFn fires. 0 = open on focus. */
|
|
120
|
+
minSearchLength: number;
|
|
121
|
+
/** Optional cap on rendered suggestions (panel scrolls regardless). */
|
|
122
|
+
maxSuggestions: number;
|
|
123
|
+
/** Shows a trailing ✕ that clears the text and the committed value. */
|
|
124
|
+
clearable: boolean;
|
|
125
|
+
/** Externally-controlled loading state (internal searchFn loading is automatic). */
|
|
126
|
+
loading: boolean;
|
|
127
|
+
/** Row shown when a query yields nothing. */
|
|
128
|
+
noResultsText: string;
|
|
129
|
+
loadingText: string;
|
|
130
|
+
label?: string;
|
|
131
|
+
placeholder: string;
|
|
132
|
+
size: TextFieldSize;
|
|
133
|
+
variant: TextFieldVariant;
|
|
134
|
+
floatingLabel: boolean;
|
|
135
|
+
prefixIcon?: string;
|
|
136
|
+
disabled: boolean;
|
|
137
|
+
readonly: boolean;
|
|
138
|
+
required: boolean;
|
|
139
|
+
error: boolean;
|
|
140
|
+
errorMessage?: string;
|
|
141
|
+
helperText?: string;
|
|
142
|
+
name?: string;
|
|
143
|
+
fullWidth: boolean;
|
|
144
|
+
private open;
|
|
145
|
+
private inputText;
|
|
146
|
+
private highlightedIndex;
|
|
147
|
+
private panelStyle;
|
|
148
|
+
private searching;
|
|
149
|
+
/** searchFn results; null = idle/local mode (use items). */
|
|
150
|
+
private remoteItems;
|
|
151
|
+
private fieldEl;
|
|
152
|
+
private panelEl;
|
|
153
|
+
private uniqueId;
|
|
154
|
+
private debounceTimer?;
|
|
155
|
+
private searchSeq;
|
|
156
|
+
/** Set while a selection/clear updates `value` internally, so willUpdate
|
|
157
|
+
* doesn't overwrite the input text the way it does for external writes. */
|
|
158
|
+
private internalValueWrite;
|
|
159
|
+
static styles: lit.CSSResult;
|
|
160
|
+
disconnectedCallback(): void;
|
|
161
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
162
|
+
/** Full normalized source list (remote results while searchFn drives, else items). */
|
|
163
|
+
private get allItems();
|
|
164
|
+
private normalizeItem;
|
|
165
|
+
/** Suggestions for the current query — local filter only applies without searchFn. */
|
|
166
|
+
private get filteredItems();
|
|
167
|
+
private get isLoading();
|
|
168
|
+
private get queryLongEnough();
|
|
169
|
+
private addGlobalListeners;
|
|
170
|
+
private removeGlobalListeners;
|
|
171
|
+
private onOutsidePointerDown;
|
|
172
|
+
private onPageScroll;
|
|
173
|
+
private openPanel;
|
|
174
|
+
private closePanel;
|
|
175
|
+
private updatePosition;
|
|
176
|
+
/** Re-evaluates whether the panel should be showing for the current state. */
|
|
177
|
+
private syncPanel;
|
|
178
|
+
private onFieldInput;
|
|
179
|
+
private runSearch;
|
|
180
|
+
private selectItem;
|
|
181
|
+
/** Silent commit when typed text exactly matches an item (label or value, case-insensitive). */
|
|
182
|
+
private commitExactMatch;
|
|
183
|
+
private emitChanged;
|
|
184
|
+
private clear;
|
|
185
|
+
private onKeyDown;
|
|
186
|
+
private onFocusIn;
|
|
187
|
+
private onFocusOut;
|
|
188
|
+
/** Delegates focus to the inner textfield. */
|
|
189
|
+
focus(): void;
|
|
190
|
+
/** Bolds the first occurrence of the query inside a suggestion label. */
|
|
191
|
+
private renderLabel;
|
|
192
|
+
render(): TemplateResult<1>;
|
|
193
|
+
}
|
|
194
|
+
declare global {
|
|
195
|
+
interface HTMLElementTagNameMap {
|
|
196
|
+
"rel-autocomplete": RelAutocomplete;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
34
200
|
declare class RelAvatar extends LitElement {
|
|
35
201
|
size: "lg" | "md" | "sm" | "xs";
|
|
36
202
|
type: "image" | "text" | "icon";
|
|
@@ -238,6 +404,8 @@ type CheckboxState = "default" | "error" | "disabled";
|
|
|
238
404
|
type CheckboxStatus = "unchecked" | "checked" | "indeterminate";
|
|
239
405
|
declare class RelCheckbox extends LitElement {
|
|
240
406
|
label: string;
|
|
407
|
+
/** rel-icon name rendered between the checkbox and the label (label prefix icon). */
|
|
408
|
+
icon: string;
|
|
241
409
|
supportingtext: string;
|
|
242
410
|
state: CheckboxState;
|
|
243
411
|
status: CheckboxStatus;
|
|
@@ -1001,6 +1169,8 @@ declare class RelPopover extends LitElement {
|
|
|
1001
1169
|
private onHostPointerDown;
|
|
1002
1170
|
private onOpen;
|
|
1003
1171
|
private onClose;
|
|
1172
|
+
private showNativePopover;
|
|
1173
|
+
private hideNativePopover;
|
|
1004
1174
|
private addGlobalListeners;
|
|
1005
1175
|
private removeGlobalListeners;
|
|
1006
1176
|
private onOutsidePointerDown;
|
|
@@ -1136,6 +1306,8 @@ interface SelectOptionObject {
|
|
|
1136
1306
|
value: string;
|
|
1137
1307
|
label?: string;
|
|
1138
1308
|
supportingText?: string;
|
|
1309
|
+
/** rel-icon name rendered as a prefix (leading icon) on the menu item. */
|
|
1310
|
+
icon?: string;
|
|
1139
1311
|
}
|
|
1140
1312
|
type SelectOption = string | SelectOptionObject;
|
|
1141
1313
|
declare class RelSelect extends LitElement {
|
|
@@ -1157,7 +1329,11 @@ declare class RelSelect extends LitElement {
|
|
|
1157
1329
|
placeholder: string;
|
|
1158
1330
|
searchPlaceholder: string;
|
|
1159
1331
|
selectAllLabel: string;
|
|
1160
|
-
/**
|
|
1332
|
+
/**
|
|
1333
|
+
* Optional hard cap on visible chips. By default (no cap) the visible
|
|
1334
|
+
* count adapts to the trigger's width: chips collapse into the "+N" badge
|
|
1335
|
+
* one by one instead of wrapping to a second line.
|
|
1336
|
+
*/
|
|
1161
1337
|
maxVisibleChips: number;
|
|
1162
1338
|
/** Hides the in-panel search field. Figma's "Single Option" dropdown has no search bar at all — use this for short, non-searchable lists. */
|
|
1163
1339
|
noSearch: boolean;
|
|
@@ -1166,13 +1342,30 @@ declare class RelSelect extends LitElement {
|
|
|
1166
1342
|
private panelStyle;
|
|
1167
1343
|
private searchValue;
|
|
1168
1344
|
private internalState;
|
|
1345
|
+
/** How many chips currently fit in the trigger width (width-adaptive). */
|
|
1346
|
+
private visibleChipCount;
|
|
1169
1347
|
private triggerEl;
|
|
1170
1348
|
private searchInputEl;
|
|
1171
1349
|
private listboxEl;
|
|
1350
|
+
private valueEl;
|
|
1351
|
+
private chipsMeasureEl;
|
|
1352
|
+
/** Must match the `gap` of .select-chips / .select-chips-measure. */
|
|
1353
|
+
private static readonly CHIP_GAP;
|
|
1354
|
+
private chipResizeObserver?;
|
|
1172
1355
|
private uniqueId;
|
|
1173
1356
|
static styles: lit.CSSResult;
|
|
1357
|
+
connectedCallback(): void;
|
|
1174
1358
|
disconnectedCallback(): void;
|
|
1359
|
+
protected firstUpdated(): void;
|
|
1175
1360
|
protected willUpdate(changed: PropertyValues<this>): void;
|
|
1361
|
+
protected updated(changed: PropertyValues<this>): void;
|
|
1362
|
+
/**
|
|
1363
|
+
* Width-adaptive chip collapsing: measures every selected chip in the
|
|
1364
|
+
* hidden .select-chips-measure row and works out how many fit in the value
|
|
1365
|
+
* area, always reserving room for the trailing "+N" chip when not all fit.
|
|
1366
|
+
* At least one chip stays visible no matter how narrow the field gets.
|
|
1367
|
+
*/
|
|
1368
|
+
private computeVisibleChips;
|
|
1176
1369
|
private get normalizedOptions();
|
|
1177
1370
|
/** Options matching the current search text (substring match, case-insensitive). */
|
|
1178
1371
|
private get filteredOptions();
|
|
@@ -1200,6 +1393,13 @@ declare class RelSelect extends LitElement {
|
|
|
1200
1393
|
private onSearchKeyDown;
|
|
1201
1394
|
private handleListNavigation;
|
|
1202
1395
|
private renderChips;
|
|
1396
|
+
/**
|
|
1397
|
+
* Hidden, unconstrained copy of every selected chip used purely for width
|
|
1398
|
+
* measurement (see computeVisibleChips). Chips mirror the visible ones'
|
|
1399
|
+
* width-affecting props (removable adds the ✕ icon). The trailing chip is
|
|
1400
|
+
* the widest "+N" badge that could ever be needed.
|
|
1401
|
+
*/
|
|
1402
|
+
private renderChipsMeasure;
|
|
1203
1403
|
render(): lit_html.TemplateResult<1>;
|
|
1204
1404
|
}
|
|
1205
1405
|
declare global {
|
|
@@ -1247,6 +1447,7 @@ declare class RelModal extends LitElement {
|
|
|
1247
1447
|
static styles: lit.CSSResult;
|
|
1248
1448
|
connectedCallback(): void;
|
|
1249
1449
|
disconnectedCallback(): void;
|
|
1450
|
+
protected willUpdate(): void;
|
|
1250
1451
|
updated(changed: Map<string, unknown>): void;
|
|
1251
1452
|
private handleOpen;
|
|
1252
1453
|
private handleClose;
|
|
@@ -1426,56 +1627,6 @@ declare class RelTab extends LitElement {
|
|
|
1426
1627
|
render(): lit_html.TemplateResult<1>;
|
|
1427
1628
|
}
|
|
1428
1629
|
|
|
1429
|
-
type TextFieldState = "default" | "error" | "disabled";
|
|
1430
|
-
type TextFieldSize = "small" | "medium" | "large";
|
|
1431
|
-
type TextFieldVariant = "default" | "underline" | "legend";
|
|
1432
|
-
declare class RelTextfield extends LitElement {
|
|
1433
|
-
label?: string;
|
|
1434
|
-
placeholder: string;
|
|
1435
|
-
type: string;
|
|
1436
|
-
value: string;
|
|
1437
|
-
leftIcon?: string;
|
|
1438
|
-
rightIcon?: string;
|
|
1439
|
-
/** Makes the trailing icon interactive (pointer + focusable) and emits
|
|
1440
|
-
* `rel-right-icon-click` — e.g. a password show/hide toggle or clear button. */
|
|
1441
|
-
clickableRightIcon: boolean;
|
|
1442
|
-
/** Accessible label for the trailing icon when it is clickable. */
|
|
1443
|
-
rightIconAriaLabel?: string;
|
|
1444
|
-
supportingText?: string;
|
|
1445
|
-
state: TextFieldState;
|
|
1446
|
-
size: TextFieldSize;
|
|
1447
|
-
floatingLabel: boolean;
|
|
1448
|
-
variant: TextFieldVariant;
|
|
1449
|
-
disabled: boolean;
|
|
1450
|
-
required: boolean;
|
|
1451
|
-
multiline: boolean;
|
|
1452
|
-
rows: number;
|
|
1453
|
-
prefixIcon?: string;
|
|
1454
|
-
prefixIconAriaLabel?: string;
|
|
1455
|
-
error: boolean;
|
|
1456
|
-
errorMessage?: string;
|
|
1457
|
-
helperText?: string;
|
|
1458
|
-
readonly: boolean;
|
|
1459
|
-
maxLength?: number;
|
|
1460
|
-
name?: string;
|
|
1461
|
-
fullWidth: boolean;
|
|
1462
|
-
private internalState;
|
|
1463
|
-
private _wasError;
|
|
1464
|
-
private uniqueId;
|
|
1465
|
-
private get isDisabled();
|
|
1466
|
-
private get isError();
|
|
1467
|
-
private get leadingIcon();
|
|
1468
|
-
private get helper();
|
|
1469
|
-
static styles: lit.CSSResult;
|
|
1470
|
-
connectedCallback(): void;
|
|
1471
|
-
private handleFocus;
|
|
1472
|
-
private handleBlur;
|
|
1473
|
-
private handleRightIconClick;
|
|
1474
|
-
private handleRightIconKeydown;
|
|
1475
|
-
private handleInput;
|
|
1476
|
-
render(): lit_html.TemplateResult<1>;
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
1630
|
type ToastType = "default" | "error";
|
|
1480
1631
|
declare class RelToast extends LitElement {
|
|
1481
1632
|
message: string;
|
|
@@ -1509,4 +1660,4 @@ declare class RelTooltip extends LitElement {
|
|
|
1509
1660
|
render(): lit_html.TemplateResult<1>;
|
|
1510
1661
|
}
|
|
1511
1662
|
|
|
1512
|
-
export { type BreadcrumbItem, type ButtonTone, type ButtonVariant, type ChipBorder, type ChipSize, type ChipTone, type ChipVariant, type DrawerCloseReason, type DrawerSide, type LabelPlacement, type MenuItem, type MenuType, type ModalSide, type Orientation, type OtpType, type ProgressMode, type RadioOption, RelAccordion, RelAlert, 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, 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 };
|
|
1663
|
+
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 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, 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 };
|