@reliability-design/web 1.2.0 → 1.3.1
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/components/rel-accordion/rel-accordion.ts +289 -135
- package/dist/components/rel-alert/rel-alert.ts +8 -1
- package/dist/components/rel-avatar/README.md +15 -4
- package/dist/components/rel-avatar/rel-avatar.ts +138 -96
- package/dist/components/rel-badge/README.md +7 -0
- package/dist/components/rel-badge/rel-badge.ts +61 -8
- package/dist/components/rel-button/rel-button.ts +64 -7
- package/dist/components/rel-chip/README.md +7 -0
- package/dist/components/rel-chip/rel-chip.ts +250 -130
- package/dist/components/rel-date-picker/rel-date-picker.ts +116 -14
- package/dist/components/rel-drawer/rel-drawer.ts +5 -2
- package/dist/components/rel-menubar/rel-menubar.ts +1 -0
- package/dist/components/rel-pagination/rel-pagination.ts +442 -425
- package/dist/components/rel-radio/rel-radio.ts +16 -16
- package/dist/components/rel-range-picker/rel-range-picker.css +349 -349
- package/dist/components/rel-range-picker/rel-range-picker.ts +1080 -1079
- package/dist/components/rel-select/README.md +34 -28
- package/dist/components/rel-select/rel-select.ts +1015 -346
- package/dist/components/rel-sheet/rel-sheet.ts +6 -3
- package/dist/components/rel-skeleton/rel-skeleton.ts +139 -0
- package/dist/components/rel-tab/rel-tab.ts +10 -4
- package/dist/components/rel-textfield/rel-textfield.ts +637 -349
- package/dist/components/rel-toast/rel-toast.ts +1 -6
- package/dist/components/rel-topbar/rel-topbar-actions.ts +4 -0
- package/dist/components/rel-topbar/rel-topbar-brand.ts +4 -0
- package/dist/components/rel-topbar/rel-topbar-dropdown-item.ts +4 -0
- package/dist/components/rel-topbar/rel-topbar-dropdown.ts +4 -0
- package/dist/components/rel-topbar/rel-topbar-item.ts +4 -0
- package/dist/components/rel-topbar/rel-topbar-mobile-panel.ts +4 -0
- package/dist/components/rel-topbar/rel-topbar-profile.ts +3 -0
- package/dist/components/rel-topbar/rel-topbar-utilities.ts +4 -0
- package/dist/components/rel-topbar/rel-topbar.ts +6 -0
- package/dist/index.d.mts +239 -22
- package/dist/index.d.ts +239 -22
- package/dist/index.js +2609 -981
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2621 -994
- package/dist/index.mjs.map +1 -1
- package/dist/styles/vars.css +17 -0
- package/dist/{vars-I2PC74XD.css → vars-F54UGCHM.css} +17 -0
- package/package.json +1 -1
|
@@ -17,17 +17,43 @@ export class RelDatePicker extends LitElement {
|
|
|
17
17
|
@property({ type: String }) label: string | null = null;
|
|
18
18
|
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
19
19
|
@property({ type: Boolean }) required = false;
|
|
20
|
+
@property({ type: Boolean, reflect: true }) readonly = false;
|
|
21
|
+
|
|
22
|
+
// Date bounds. minDate/maxDate are the standard names; min/max are kept as
|
|
23
|
+
// deprecated aliases (minDate/maxDate win when both are set).
|
|
24
|
+
@property({ type: String, attribute: "min-date" }) minDate: string | null = null;
|
|
25
|
+
@property({ type: String, attribute: "max-date" }) maxDate: string | null = null;
|
|
26
|
+
/** @deprecated use minDate */
|
|
20
27
|
@property({ type: String }) min: string | null = null;
|
|
28
|
+
/** @deprecated use maxDate */
|
|
21
29
|
@property({ type: String }) max: string | null = null;
|
|
30
|
+
|
|
22
31
|
@property({ type: String, attribute: "week-start" }) weekStart: "sun" | "mon" = "sun";
|
|
23
32
|
@property({ type: String }) locale = "en-US";
|
|
24
33
|
@property({ type: Boolean, reflect: true }) open = false;
|
|
25
34
|
@property({ type: Boolean, attribute: "close-on-select" }) closeOnSelect = true;
|
|
26
35
|
@property({ type: Boolean }) clearable = false;
|
|
27
36
|
|
|
37
|
+
// ── Standardized input API (mirrors rel-textfield) ──
|
|
38
|
+
@property({ type: Boolean }) error = false;
|
|
39
|
+
@property({ type: String, attribute: "error-message" }) errorMessage?: string;
|
|
40
|
+
@property({ type: String, attribute: "helper-text" }) helperText?: string;
|
|
41
|
+
@property({ type: String }) name?: string;
|
|
42
|
+
@property({ type: String }) size: "small" | "medium" | "large" = "medium";
|
|
43
|
+
@property({ type: String, reflect: true }) variant: "outlined" = "outlined";
|
|
44
|
+
@property({ type: Boolean, reflect: true }) fullWidth = false;
|
|
45
|
+
|
|
28
46
|
// Custom disabled predicate (not settable via attribute)
|
|
29
47
|
public isDateDisabled?: (date: Date) => boolean;
|
|
30
48
|
|
|
49
|
+
// minDate/maxDate supersede the deprecated min/max aliases
|
|
50
|
+
private get minBound(): string | null {
|
|
51
|
+
return this.minDate ?? this.min;
|
|
52
|
+
}
|
|
53
|
+
private get maxBound(): string | null {
|
|
54
|
+
return this.maxDate ?? this.max;
|
|
55
|
+
}
|
|
56
|
+
|
|
31
57
|
@state() private viewYear: number = new Date().getFullYear();
|
|
32
58
|
@state() private viewMonth: number = new Date().getMonth();
|
|
33
59
|
@state() private focusedDate: Date | null = null;
|
|
@@ -40,11 +66,17 @@ export class RelDatePicker extends LitElement {
|
|
|
40
66
|
|
|
41
67
|
static styles = css`
|
|
42
68
|
:host {
|
|
43
|
-
display:
|
|
69
|
+
display: block;
|
|
44
70
|
font-family: var(--rel-fontFamilies-primary);
|
|
45
71
|
position: relative;
|
|
46
72
|
}
|
|
47
73
|
|
|
74
|
+
/* Intrinsic width by default; set fullWidth to fill the parent. */
|
|
75
|
+
:host(:not([fullwidth])) {
|
|
76
|
+
display: inline-block;
|
|
77
|
+
width: auto;
|
|
78
|
+
}
|
|
79
|
+
|
|
48
80
|
:host([disabled]) {
|
|
49
81
|
opacity: 0.6;
|
|
50
82
|
cursor: not-allowed;
|
|
@@ -54,6 +86,10 @@ export class RelDatePicker extends LitElement {
|
|
|
54
86
|
pointer-events: none;
|
|
55
87
|
}
|
|
56
88
|
|
|
89
|
+
:host([readonly]) .trigger-button {
|
|
90
|
+
cursor: default;
|
|
91
|
+
}
|
|
92
|
+
|
|
57
93
|
.date-picker-wrapper {
|
|
58
94
|
display: flex;
|
|
59
95
|
flex-direction: column;
|
|
@@ -66,6 +102,21 @@ export class RelDatePicker extends LitElement {
|
|
|
66
102
|
color: var(--rel-text-heading);
|
|
67
103
|
}
|
|
68
104
|
|
|
105
|
+
.required-mark {
|
|
106
|
+
color: var(--rel-error-surface-default, #cc0000);
|
|
107
|
+
margin-left: 2px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Support text (helperText / errorMessage) */
|
|
111
|
+
.date-picker-support {
|
|
112
|
+
font-size: var(--rel-fontSizes-xs);
|
|
113
|
+
color: var(--rel-color-text-placeholder);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.date-picker-support.error {
|
|
117
|
+
color: var(--rel-error-surface-default, #cc0000);
|
|
118
|
+
}
|
|
119
|
+
|
|
69
120
|
.trigger-button {
|
|
70
121
|
width: 100%;
|
|
71
122
|
min-width: 200px;
|
|
@@ -100,6 +151,28 @@ export class RelDatePicker extends LitElement {
|
|
|
100
151
|
background: var(--rel-surface-secondary);
|
|
101
152
|
}
|
|
102
153
|
|
|
154
|
+
/* Error state */
|
|
155
|
+
.trigger-button.error,
|
|
156
|
+
.trigger-button.error:hover:not(:disabled) {
|
|
157
|
+
border-color: var(--rel-error-surface-default, #cc0000);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.trigger-button.error:focus-visible {
|
|
161
|
+
outline-color: var(--rel-error-surface-default, #cc0000);
|
|
162
|
+
border-color: var(--rel-error-surface-default, #cc0000);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* Size variants (medium is the base .trigger-button style) */
|
|
166
|
+
.date-picker-wrapper.small .trigger-button {
|
|
167
|
+
padding: var(--rel-spacing-space-xs) var(--rel-spacing-space-sm);
|
|
168
|
+
font-size: var(--rel-fontSizes-sm);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.date-picker-wrapper.large .trigger-button {
|
|
172
|
+
padding: var(--rel-spacing-space-md) var(--rel-spacing-space-md);
|
|
173
|
+
font-size: var(--rel-fontSizes-lg);
|
|
174
|
+
}
|
|
175
|
+
|
|
103
176
|
.trigger-content {
|
|
104
177
|
flex: 1;
|
|
105
178
|
color: var(--rel-text-primary);
|
|
@@ -428,13 +501,13 @@ export class RelDatePicker extends LitElement {
|
|
|
428
501
|
private isDateDisabledInternal(date: Date): boolean {
|
|
429
502
|
if (this.disabled) return true;
|
|
430
503
|
|
|
431
|
-
if (this.
|
|
432
|
-
const minDate = this.parseISODate(this.
|
|
504
|
+
if (this.minBound) {
|
|
505
|
+
const minDate = this.parseISODate(this.minBound);
|
|
433
506
|
if (minDate && date < minDate) return true;
|
|
434
507
|
}
|
|
435
508
|
|
|
436
|
-
if (this.
|
|
437
|
-
const maxDate = this.parseISODate(this.
|
|
509
|
+
if (this.maxBound) {
|
|
510
|
+
const maxDate = this.parseISODate(this.maxBound);
|
|
438
511
|
if (maxDate && date > maxDate) return true;
|
|
439
512
|
}
|
|
440
513
|
|
|
@@ -535,13 +608,13 @@ export class RelDatePicker extends LitElement {
|
|
|
535
608
|
let startYear = currentYear - 100;
|
|
536
609
|
let endYear = currentYear + 10;
|
|
537
610
|
|
|
538
|
-
if (this.
|
|
539
|
-
const minDate = this.parseISODate(this.
|
|
611
|
+
if (this.minBound) {
|
|
612
|
+
const minDate = this.parseISODate(this.minBound);
|
|
540
613
|
if (minDate) startYear = Math.max(startYear, minDate.getFullYear() - 5);
|
|
541
614
|
}
|
|
542
615
|
|
|
543
|
-
if (this.
|
|
544
|
-
const maxDate = this.parseISODate(this.
|
|
616
|
+
if (this.maxBound) {
|
|
617
|
+
const maxDate = this.parseISODate(this.maxBound);
|
|
545
618
|
if (maxDate) endYear = Math.min(endYear, maxDate.getFullYear() + 5);
|
|
546
619
|
}
|
|
547
620
|
|
|
@@ -553,7 +626,7 @@ export class RelDatePicker extends LitElement {
|
|
|
553
626
|
}
|
|
554
627
|
|
|
555
628
|
private toggleCalendarPopover() {
|
|
556
|
-
if (this.disabled) return;
|
|
629
|
+
if (this.disabled || this.readonly) return;
|
|
557
630
|
this.open = !this.open;
|
|
558
631
|
this.dispatchEvent(
|
|
559
632
|
new CustomEvent("rel-open-change", {
|
|
@@ -597,7 +670,7 @@ export class RelDatePicker extends LitElement {
|
|
|
597
670
|
}
|
|
598
671
|
|
|
599
672
|
private selectDay(day: CalendarDay) {
|
|
600
|
-
if (day.isDisabled || this.disabled) return;
|
|
673
|
+
if (day.isDisabled || this.disabled || this.readonly) return;
|
|
601
674
|
|
|
602
675
|
const newValue = this.formatISODate(day.date);
|
|
603
676
|
this.value = newValue;
|
|
@@ -746,14 +819,34 @@ export class RelDatePicker extends LitElement {
|
|
|
746
819
|
const months = this.getMonthsList();
|
|
747
820
|
const years = this.getYearsList();
|
|
748
821
|
|
|
822
|
+
const isError = this.error;
|
|
823
|
+
const belowText = isError && this.errorMessage ? this.errorMessage : this.helperText;
|
|
824
|
+
const describedById = belowText ? "date-picker-desc" : undefined;
|
|
825
|
+
const wrapperClasses = [
|
|
826
|
+
"date-picker-wrapper",
|
|
827
|
+
this.size,
|
|
828
|
+
isError ? "error" : "",
|
|
829
|
+
this.readonly ? "readonly" : "",
|
|
830
|
+
]
|
|
831
|
+
.filter(Boolean)
|
|
832
|
+
.join(" ");
|
|
833
|
+
|
|
749
834
|
return html`
|
|
750
|
-
<div class="
|
|
835
|
+
<div class="${wrapperClasses}">
|
|
751
836
|
${this.label
|
|
752
|
-
? html`<label class="label" id="date-picker-label"
|
|
837
|
+
? html`<label class="label" id="date-picker-label"
|
|
838
|
+
>${this.label}${this.required
|
|
839
|
+
? html`<span class="required-mark" aria-hidden="true">*</span>`
|
|
840
|
+
: nothing}</label
|
|
841
|
+
>`
|
|
842
|
+
: nothing}
|
|
843
|
+
|
|
844
|
+
${this.name
|
|
845
|
+
? html`<input type="hidden" name=${this.name} .value=${this.value ?? ""} />`
|
|
753
846
|
: nothing}
|
|
754
847
|
|
|
755
848
|
<button
|
|
756
|
-
class="trigger-button"
|
|
849
|
+
class="trigger-button ${isError ? "error" : ""}"
|
|
757
850
|
type="button"
|
|
758
851
|
?disabled=${this.disabled}
|
|
759
852
|
@click=${this.toggleCalendarPopover}
|
|
@@ -762,6 +855,9 @@ export class RelDatePicker extends LitElement {
|
|
|
762
855
|
aria-haspopup="dialog"
|
|
763
856
|
aria-expanded=${this.open}
|
|
764
857
|
aria-required=${this.required}
|
|
858
|
+
aria-invalid=${isError}
|
|
859
|
+
aria-readonly=${this.readonly}
|
|
860
|
+
aria-describedby=${describedById ?? nothing}
|
|
765
861
|
aria-labelledby=${this.label ? "date-picker-label" : nothing}
|
|
766
862
|
>
|
|
767
863
|
<span class="trigger-content ${this.value ? "" : "placeholder"}">
|
|
@@ -914,6 +1010,12 @@ export class RelDatePicker extends LitElement {
|
|
|
914
1010
|
)}
|
|
915
1011
|
</div>
|
|
916
1012
|
</div>
|
|
1013
|
+
|
|
1014
|
+
${belowText
|
|
1015
|
+
? html`<div class="date-picker-support ${isError ? "error" : ""}" id=${describedById}>
|
|
1016
|
+
${belowText}
|
|
1017
|
+
</div>`
|
|
1018
|
+
: nothing}
|
|
917
1019
|
</div>
|
|
918
1020
|
`;
|
|
919
1021
|
}
|
|
@@ -282,7 +282,10 @@ export class RelDrawer extends LitElement {
|
|
|
282
282
|
|
|
283
283
|
if (this.modal) {
|
|
284
284
|
this.updateComplete.then(() => {
|
|
285
|
-
const focusTarget =
|
|
285
|
+
const focusTarget =
|
|
286
|
+
this.querySelector<HTMLElement>("[autofocus]") ??
|
|
287
|
+
this.querySelector<HTMLElement>(".close-button") ??
|
|
288
|
+
this.querySelector<HTMLElement>(".panel");
|
|
286
289
|
focusTarget?.focus();
|
|
287
290
|
});
|
|
288
291
|
}
|
|
@@ -387,7 +390,7 @@ export class RelDrawer extends LitElement {
|
|
|
387
390
|
|
|
388
391
|
const firstFocusable = focusable[0];
|
|
389
392
|
const lastFocusable = focusable[focusable.length - 1];
|
|
390
|
-
const activeElement =
|
|
393
|
+
const activeElement = document.activeElement;
|
|
391
394
|
|
|
392
395
|
if (e.shiftKey) {
|
|
393
396
|
if (activeElement === firstFocusable) {
|