@reliability-design/web 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/rel-accordion/README.md +13 -13
- package/dist/components/rel-accordion/rel-accordion.ts +80 -45
- package/dist/components/rel-alert/README.md +15 -15
- package/dist/components/rel-alert/rel-alert.ts +161 -159
- package/dist/components/rel-avatar/README.md +15 -15
- package/dist/components/rel-avatar/rel-avatar.ts +42 -38
- package/dist/components/rel-badge/README.md +5 -5
- package/dist/components/rel-badge/rel-badge.ts +69 -17
- package/dist/components/rel-breadcrumb/README.md +7 -7
- package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +16 -13
- package/dist/components/rel-button/README.md +20 -20
- package/dist/components/rel-button/rel-button.ts +327 -105
- package/dist/components/rel-calendar/README.md +5 -5
- package/dist/components/rel-calendar/rel-calendar.ts +61 -45
- package/dist/components/rel-card/README.md +6 -6
- package/dist/components/rel-card/rel-card.ts +88 -35
- package/dist/components/rel-cardmedia/README.md +9 -9
- package/dist/components/rel-cardmedia/rel-cardmedia.ts +27 -20
- package/dist/components/rel-carousel/README.md +3 -3
- package/dist/components/rel-carousel/rel-carousel.ts +174 -90
- package/dist/components/rel-chart/README.md +8 -8
- package/dist/components/rel-chart/rel-chart.ts +59 -41
- package/dist/components/rel-checkbox/README.md +7 -7
- package/dist/components/rel-checkbox/rel-checkbox.ts +61 -61
- package/dist/components/rel-chip/README.md +16 -16
- package/dist/components/rel-chip/rel-chip.ts +143 -111
- package/dist/components/rel-container/README.md +11 -11
- package/dist/components/rel-container/rel-container.ts +35 -9
- package/dist/components/rel-date-picker/README.md +43 -7
- package/dist/components/rel-date-picker/date-format.test.ts +43 -0
- package/dist/components/rel-date-picker/date-format.ts +47 -0
- package/dist/components/rel-date-picker/rel-date-picker.ts +257 -83
- package/dist/components/rel-divider/README.md +9 -9
- package/dist/components/rel-divider/rel-divider.ts +10 -9
- package/dist/components/rel-drawer/README.md +1 -1
- package/dist/components/rel-drawer/rel-drawer-footer.ts +1 -1
- package/dist/components/rel-drawer/rel-drawer.ts +56 -28
- package/dist/components/rel-kbd/README.md +20 -20
- package/dist/components/rel-kbd/rel-kbd.ts +119 -25
- package/dist/components/rel-layout/README.md +1 -1
- package/dist/components/rel-layout/rel-layout.ts +2 -2
- package/dist/components/rel-menu/README.md +15 -15
- package/dist/components/rel-menu/rel-menu.ts +155 -88
- package/dist/components/rel-menubar/README.md +20 -20
- package/dist/components/rel-menubar/rel-menubar.ts +47 -31
- package/dist/components/rel-nav-menu/README.md +21 -21
- package/dist/components/rel-nav-menu/rel-nav-menu-item.ts +17 -14
- package/dist/components/rel-nav-menu/rel-nav-menu-panel.ts +33 -14
- package/dist/components/rel-nav-menu/rel-nav-menu.ts +14 -7
- package/dist/components/rel-navbar/README.md +7 -7
- package/dist/components/rel-navbar/rel-navbar.ts +12 -11
- package/dist/components/rel-otp/README.md +3 -3
- package/dist/components/rel-otp/rel-otp.ts +46 -30
- package/dist/components/rel-pagination/README.md +18 -18
- package/dist/components/rel-pagination/rel-pagination.ts +141 -90
- package/dist/components/rel-popover/README.md +13 -13
- package/dist/components/rel-popover/rel-popover-content.ts +39 -14
- package/dist/components/rel-popover/rel-popover.ts +18 -7
- package/dist/components/rel-progress/README.md +5 -5
- package/dist/components/rel-progress/rel-progress.ts +16 -12
- package/dist/components/rel-radio/README.md +9 -9
- package/dist/components/rel-radio/rel-radio.ts +64 -50
- package/dist/components/rel-range-picker/rel-range-picker.ts +120 -117
- package/dist/components/rel-resizable/README.md +4 -4
- package/dist/components/rel-resizable/rel-resizable-group.ts +15 -4
- package/dist/components/rel-resizable/rel-resizable-handle.ts +13 -9
- package/dist/components/rel-resizable/rel-resizable-panel.ts +11 -0
- package/dist/components/rel-segmented-button/README.md +10 -10
- package/dist/components/rel-segmented-button/rel-segmented-button.ts +39 -40
- package/dist/components/rel-select/README.md +14 -14
- package/dist/components/rel-select/rel-select.ts +120 -188
- package/dist/components/rel-sheet/README.md +10 -10
- package/dist/components/rel-sheet/rel-sheet.ts +82 -23
- package/dist/components/rel-sidebar/README.md +5 -5
- package/dist/components/rel-sidebar/rel-sidebar.ts +75 -60
- package/dist/components/rel-skeleton/rel-skeleton.ts +8 -13
- package/dist/components/rel-slider/README.md +10 -10
- package/dist/components/rel-slider/rel-slider.ts +230 -57
- package/dist/components/rel-snackbar/README.md +9 -9
- package/dist/components/rel-snackbar/rel-snackbar.ts +44 -32
- package/dist/components/rel-stepper/README.md +10 -10
- package/dist/components/rel-stepper/rel-stepper.ts +110 -46
- package/dist/components/rel-switch/README.md +5 -5
- package/dist/components/rel-switch/rel-switch.ts +23 -12
- package/dist/components/rel-tab/README.md +13 -13
- package/dist/components/rel-tab/rel-tab.ts +73 -23
- package/dist/components/rel-table/README.md +7 -7
- package/dist/components/rel-table/rel-table-body.ts +2 -1
- package/dist/components/rel-table/rel-table-caption.ts +10 -7
- package/dist/components/rel-table/rel-table-cell.ts +7 -6
- package/dist/components/rel-table/rel-table-footer.ts +4 -3
- package/dist/components/rel-table/rel-table-head.ts +11 -9
- package/dist/components/rel-table/rel-table-header.ts +2 -1
- package/dist/components/rel-table/rel-table-row.ts +5 -4
- package/dist/components/rel-table/rel-table.ts +16 -7
- package/dist/components/rel-textfield/README.md +11 -11
- package/dist/components/rel-textfield/rel-textfield.ts +718 -397
- package/dist/components/rel-toast/README.md +11 -11
- package/dist/components/rel-toast/rel-toast.ts +33 -30
- package/dist/components/rel-tooltip/README.md +7 -7
- package/dist/components/rel-tooltip/rel-tooltip.ts +160 -123
- package/dist/components/rel-topbar/rel-topbar-actions.ts +5 -2
- package/dist/components/rel-topbar/rel-topbar-brand.ts +12 -5
- package/dist/components/rel-topbar/rel-topbar-dropdown-item.ts +14 -8
- package/dist/components/rel-topbar/rel-topbar-dropdown.ts +8 -5
- package/dist/components/rel-topbar/rel-topbar-item.ts +27 -22
- package/dist/components/rel-topbar/rel-topbar-mobile-panel.ts +4 -1
- package/dist/components/rel-topbar/rel-topbar-profile.ts +71 -50
- package/dist/components/rel-topbar/rel-topbar-utilities.ts +5 -2
- package/dist/components/rel-topbar/rel-topbar.ts +37 -29
- package/dist/index.d.mts +227 -40
- package/dist/index.d.ts +227 -40
- package/dist/index.js +3930 -2247
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4311 -2629
- package/dist/index.mjs.map +1 -1
- package/dist/styles/vars.css +653 -346
- package/dist/vars-WY2XCF5G.css +653 -0
- package/package.json +3 -2
- package/dist/components/rel-range-picker/rel-range-picker.css +0 -349
- package/dist/styles/vars-v2.css +0 -525
- package/dist/vars-I2PC74XD.css +0 -346
- package/dist/vars-v2-VMGWTFJZ.css +0 -525
|
@@ -52,6 +52,7 @@ export class RelChip extends LitElement {
|
|
|
52
52
|
|
|
53
53
|
static styles = css`
|
|
54
54
|
:host {
|
|
55
|
+
color: var(--rel-text-default);
|
|
55
56
|
display: inline-flex;
|
|
56
57
|
width: auto;
|
|
57
58
|
flex: 0 0 auto;
|
|
@@ -65,10 +66,8 @@ export class RelChip extends LitElement {
|
|
|
65
66
|
display: inline-flex;
|
|
66
67
|
align-items: center;
|
|
67
68
|
box-sizing: border-box;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
letter-spacing: -0.6px;
|
|
71
|
-
gap: 8px;
|
|
69
|
+
border: 1px solid transparent;
|
|
70
|
+
gap: var(--rel-spacing-xs);
|
|
72
71
|
cursor: pointer;
|
|
73
72
|
user-select: none;
|
|
74
73
|
white-space: nowrap;
|
|
@@ -80,101 +79,176 @@ export class RelChip extends LitElement {
|
|
|
80
79
|
/* ── Size ── */
|
|
81
80
|
:host([size="lg"]) .chip {
|
|
82
81
|
height: 32px;
|
|
83
|
-
padding:
|
|
84
|
-
font-
|
|
85
|
-
|
|
82
|
+
padding: var(--rel-spacing-2xs) var(--rel-spacing-xs);
|
|
83
|
+
font-family: var(--rel-body-lg-regular-font-family);
|
|
84
|
+
font-weight: var(--rel-body-lg-medium-font-weight);
|
|
85
|
+
font-size: var(--rel-body-lg-regular-font-size);
|
|
86
|
+
line-height: var(--rel-body-lg-regular-line-height);
|
|
87
|
+
letter-spacing: var(--rel-body-lg-regular-letter-spacing);
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
:host([size="md"]) .chip {
|
|
89
91
|
height: 28px;
|
|
90
|
-
padding:
|
|
91
|
-
font-
|
|
92
|
-
|
|
92
|
+
padding: var(--rel-spacing-2xs) var(--rel-spacing-xs);
|
|
93
|
+
font-family: var(--rel-body-md-regular-font-family);
|
|
94
|
+
font-weight: var(--rel-body-md-medium-font-weight);
|
|
95
|
+
font-size: var(--rel-body-md-regular-font-size);
|
|
96
|
+
line-height: var(--rel-body-md-regular-line-height);
|
|
97
|
+
letter-spacing: var(--rel-body-md-regular-letter-spacing);
|
|
93
98
|
}
|
|
94
99
|
|
|
95
100
|
:host([size="sm"]) .chip {
|
|
96
101
|
height: 24px;
|
|
97
|
-
padding:
|
|
98
|
-
font-
|
|
99
|
-
|
|
102
|
+
padding: var(--rel-spacing-2xs) var(--rel-spacing-xs);
|
|
103
|
+
font-family: var(--rel-body-sm-regular-font-family);
|
|
104
|
+
font-weight: var(--rel-body-xs-medium-font-weight);
|
|
105
|
+
font-size: var(--rel-body-sm-medium-font-size);
|
|
106
|
+
line-height: var(--rel-body-sm-medium-line-height);
|
|
107
|
+
letter-spacing: var(--rel-body-sm-medium-letter-spacing);
|
|
100
108
|
}
|
|
101
109
|
|
|
102
110
|
/* ── Border / shape — "Rounded" also widens horizontal padding to 12px,
|
|
103
111
|
consistent across all three sizes per the Figma spec. ── */
|
|
104
112
|
:host([border="default"]) .chip {
|
|
105
|
-
border-radius:
|
|
113
|
+
border-radius: var(--rel-border-radius-xs);
|
|
106
114
|
}
|
|
107
115
|
|
|
108
116
|
:host([border="rounded"]) .chip {
|
|
109
|
-
border-radius:
|
|
110
|
-
padding-left:
|
|
111
|
-
padding-right:
|
|
117
|
+
border-radius: var(--rel-border-radius-full-rounded);
|
|
118
|
+
padding-left: var(--rel-spacing-sm);
|
|
119
|
+
padding-right: var(--rel-spacing-sm);
|
|
112
120
|
}
|
|
113
121
|
|
|
114
|
-
/* ── Tone x Variant —
|
|
122
|
+
/* ── Tone x Variant — V2 action tokens (auto light/dark) ── */
|
|
115
123
|
:host([tone="neutral"][variant="fill"]) .chip {
|
|
116
|
-
background:
|
|
117
|
-
color:
|
|
124
|
+
background: var(--rel-action-neutral-fill);
|
|
125
|
+
color: var(--rel-text-inverse);
|
|
118
126
|
}
|
|
119
127
|
:host([tone="neutral"][variant="subtle"]) .chip {
|
|
120
|
-
background:
|
|
121
|
-
color:
|
|
128
|
+
background: var(--rel-action-neutral-subtle);
|
|
129
|
+
color: var(--rel-action-neutral-label-icons-subtle);
|
|
122
130
|
}
|
|
123
131
|
:host([tone="danger"][variant="fill"]) .chip {
|
|
124
|
-
background:
|
|
125
|
-
color:
|
|
132
|
+
background: var(--rel-action-danger-fill);
|
|
133
|
+
color: var(--rel-text-static-light);
|
|
126
134
|
}
|
|
127
135
|
:host([tone="danger"][variant="subtle"]) .chip {
|
|
128
|
-
background:
|
|
129
|
-
color:
|
|
136
|
+
background: var(--rel-action-danger-subtle);
|
|
137
|
+
color: var(--rel-action-danger-label-icons-subtle);
|
|
130
138
|
}
|
|
131
139
|
:host([tone="warning"][variant="fill"]) .chip {
|
|
132
|
-
background:
|
|
133
|
-
color:
|
|
140
|
+
background: var(--rel-action-warning-fill);
|
|
141
|
+
color: var(--rel-action-warning-label-icons-fill);
|
|
134
142
|
}
|
|
135
143
|
:host([tone="warning"][variant="subtle"]) .chip {
|
|
136
|
-
background:
|
|
137
|
-
color:
|
|
144
|
+
background: var(--rel-action-warning-subtle);
|
|
145
|
+
color: var(--rel-action-warning-label-icons-subtle);
|
|
138
146
|
}
|
|
139
147
|
:host([tone="success"][variant="fill"]) .chip {
|
|
140
|
-
background:
|
|
141
|
-
color:
|
|
148
|
+
background: var(--rel-action-success-fill);
|
|
149
|
+
color: var(--rel-action-success-label-icons-fill);
|
|
142
150
|
}
|
|
143
151
|
:host([tone="success"][variant="subtle"]) .chip {
|
|
144
|
-
background:
|
|
145
|
-
color:
|
|
152
|
+
background: var(--rel-action-success-subtle);
|
|
153
|
+
color: var(--rel-action-success-label-icons-subtle);
|
|
146
154
|
}
|
|
147
155
|
:host([tone="info"][variant="fill"]) .chip {
|
|
148
|
-
background:
|
|
149
|
-
color:
|
|
156
|
+
background: var(--rel-action-info-fill);
|
|
157
|
+
color: var(--rel-action-info-label-icons-fill);
|
|
150
158
|
}
|
|
151
159
|
:host([tone="info"][variant="subtle"]) .chip {
|
|
152
|
-
background:
|
|
153
|
-
color:
|
|
160
|
+
background: var(--rel-action-info-subtle);
|
|
161
|
+
color: var(--rel-action-info-label-icons-subtle);
|
|
154
162
|
}
|
|
155
163
|
|
|
156
|
-
/* ── Hover / Dragged —
|
|
157
|
-
"neutral" tone; the other four tones have no hover/dragged sample to
|
|
158
|
-
match, so a generic brightness dim covers them instead of leaving
|
|
159
|
-
hover completely inert. Flagged in the handoff notes. ── */
|
|
164
|
+
/* ── Hover / Dragged — per-tone V2 action state tokens ── */
|
|
160
165
|
:host([tone="neutral"][variant="fill"]) .chip:hover {
|
|
161
|
-
background:
|
|
166
|
+
background: var(--rel-action-neutral-fill-hover);
|
|
162
167
|
}
|
|
163
168
|
:host([tone="neutral"][variant="fill"]) .chip:active,
|
|
164
169
|
:host([tone="neutral"][variant="fill"][dragging]) .chip {
|
|
165
|
-
background:
|
|
170
|
+
background: var(--rel-action-neutral-fill-dragged);
|
|
171
|
+
}
|
|
172
|
+
:host([tone="neutral"][variant="subtle"]) .chip:hover {
|
|
173
|
+
border-color: var(--rel-action-neutral-border-subtle-hover);
|
|
174
|
+
background: var(--rel-action-neutral-subtle-hover);
|
|
166
175
|
}
|
|
167
176
|
:host([tone="neutral"][variant="subtle"]) .chip:active,
|
|
168
177
|
:host([tone="neutral"][variant="subtle"][dragging]) .chip {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
:host(
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
:host(
|
|
176
|
-
:host(
|
|
177
|
-
|
|
178
|
+
border-color: var(--rel-action-neutral-border-subtle-dragged);
|
|
179
|
+
background: var(--rel-action-neutral-subtle-dragged);
|
|
180
|
+
}
|
|
181
|
+
:host([tone="danger"][variant="fill"]) .chip:hover {
|
|
182
|
+
background: var(--rel-action-danger-fill-hover);
|
|
183
|
+
}
|
|
184
|
+
:host([tone="danger"][variant="fill"]) .chip:active,
|
|
185
|
+
:host([tone="danger"][variant="fill"][dragging]) .chip {
|
|
186
|
+
background: var(--rel-action-danger-fill-dragged);
|
|
187
|
+
}
|
|
188
|
+
:host([tone="danger"][variant="subtle"]) .chip:hover {
|
|
189
|
+
border-color: var(--rel-action-danger-border-subtle-hover);
|
|
190
|
+
background: var(--rel-action-danger-subtle-hover);
|
|
191
|
+
color: var(--rel-action-danger-label-icons-subtle-hover);
|
|
192
|
+
}
|
|
193
|
+
:host([tone="danger"][variant="subtle"]) .chip:active,
|
|
194
|
+
:host([tone="danger"][variant="subtle"][dragging]) .chip {
|
|
195
|
+
border-color: var(--rel-action-danger-border-subtle-dragged);
|
|
196
|
+
background: var(--rel-action-danger-subtle-dragged);
|
|
197
|
+
color: var(--rel-action-danger-label-icons-subtle-dragged);
|
|
198
|
+
}
|
|
199
|
+
:host([tone="warning"][variant="fill"]) .chip:hover {
|
|
200
|
+
background: var(--rel-action-warning-fill-hover);
|
|
201
|
+
}
|
|
202
|
+
:host([tone="warning"][variant="fill"]) .chip:active,
|
|
203
|
+
:host([tone="warning"][variant="fill"][dragging]) .chip {
|
|
204
|
+
background: var(--rel-action-warning-fill-dragged);
|
|
205
|
+
}
|
|
206
|
+
:host([tone="warning"][variant="subtle"]) .chip:hover {
|
|
207
|
+
border-color: var(--rel-action-warning-border-subtle-hover);
|
|
208
|
+
background: var(--rel-action-warning-subtle-hover);
|
|
209
|
+
color: var(--rel-action-warning-label-icons-subtle-hover);
|
|
210
|
+
}
|
|
211
|
+
:host([tone="warning"][variant="subtle"]) .chip:active,
|
|
212
|
+
:host([tone="warning"][variant="subtle"][dragging]) .chip {
|
|
213
|
+
border-color: var(--rel-action-warning-border-subtle-dragged);
|
|
214
|
+
background: var(--rel-action-warning-subtle-dragged);
|
|
215
|
+
color: var(--rel-action-warning-label-icons-subtle-dragged);
|
|
216
|
+
}
|
|
217
|
+
:host([tone="success"][variant="fill"]) .chip:hover {
|
|
218
|
+
background: var(--rel-action-success-fill-hover);
|
|
219
|
+
}
|
|
220
|
+
:host([tone="success"][variant="fill"]) .chip:active,
|
|
221
|
+
:host([tone="success"][variant="fill"][dragging]) .chip {
|
|
222
|
+
background: var(--rel-action-success-fill-dragged);
|
|
223
|
+
}
|
|
224
|
+
:host([tone="success"][variant="subtle"]) .chip:hover {
|
|
225
|
+
border-color: var(--rel-action-success-border-subtle-hover);
|
|
226
|
+
background: var(--rel-action-success-subtle-hover);
|
|
227
|
+
color: var(--rel-action-success-label-icons-subtle-hover);
|
|
228
|
+
}
|
|
229
|
+
:host([tone="success"][variant="subtle"]) .chip:active,
|
|
230
|
+
:host([tone="success"][variant="subtle"][dragging]) .chip {
|
|
231
|
+
border-color: var(--rel-action-success-border-subtle-dragged);
|
|
232
|
+
background: var(--rel-action-success-subtle-dragged);
|
|
233
|
+
color: var(--rel-action-success-label-icons-subtle-dragged);
|
|
234
|
+
}
|
|
235
|
+
:host([tone="info"][variant="fill"]) .chip:hover {
|
|
236
|
+
background: var(--rel-action-info-fill-hover);
|
|
237
|
+
}
|
|
238
|
+
:host([tone="info"][variant="fill"]) .chip:active,
|
|
239
|
+
:host([tone="info"][variant="fill"][dragging]) .chip {
|
|
240
|
+
background: var(--rel-action-info-fill-dragged);
|
|
241
|
+
}
|
|
242
|
+
:host([tone="info"][variant="subtle"]) .chip:hover {
|
|
243
|
+
border-color: var(--rel-action-info-border-subtle-hover);
|
|
244
|
+
background: var(--rel-action-info-subtle-hover);
|
|
245
|
+
color: var(--rel-action-info-label-icons-subtle-hover);
|
|
246
|
+
}
|
|
247
|
+
:host([tone="info"][variant="subtle"]) .chip:active,
|
|
248
|
+
:host([tone="info"][variant="subtle"][dragging]) .chip {
|
|
249
|
+
border-color: var(--rel-action-info-border-subtle-dragged);
|
|
250
|
+
background: var(--rel-action-info-subtle-dragged);
|
|
251
|
+
color: var(--rel-action-info-label-icons-subtle-dragged);
|
|
178
252
|
}
|
|
179
253
|
|
|
180
254
|
:host([dragging]) .chip {
|
|
@@ -189,8 +263,9 @@ export class RelChip extends LitElement {
|
|
|
189
263
|
gap (a positive offset was the bug: it drew a visible gap that
|
|
190
264
|
doesn't exist in Figma). ── */
|
|
191
265
|
.chip:focus-visible {
|
|
192
|
-
outline: 1.5px solid var(--rel-chip-focus-ring,
|
|
193
|
-
outline-offset:
|
|
266
|
+
outline: 1.5px solid var(--rel-chip-focus-ring, var(--rel-border-focus));
|
|
267
|
+
outline-offset: 1.5px;
|
|
268
|
+
box-shadow: 0 0 0 1.5px var(--rel-border-focus-inner);
|
|
194
269
|
}
|
|
195
270
|
|
|
196
271
|
/* ── Icons ── */
|
|
@@ -203,15 +278,15 @@ export class RelChip extends LitElement {
|
|
|
203
278
|
}
|
|
204
279
|
|
|
205
280
|
:host([size="lg"]) .chip-icon {
|
|
206
|
-
--rel-icon-size:
|
|
281
|
+
--rel-icon-size: 20px;
|
|
207
282
|
}
|
|
208
283
|
|
|
209
284
|
:host([size="md"]) .chip-icon {
|
|
210
|
-
--rel-icon-size:
|
|
285
|
+
--rel-icon-size: 18px;
|
|
211
286
|
}
|
|
212
287
|
|
|
213
288
|
:host([size="sm"]) .chip-icon {
|
|
214
|
-
--rel-icon-size:
|
|
289
|
+
--rel-icon-size: 16px;
|
|
215
290
|
}
|
|
216
291
|
|
|
217
292
|
/* ── Avatar — not shown in the Figma sample. rel-avatar sizes its inner
|
|
@@ -227,12 +302,12 @@ export class RelChip extends LitElement {
|
|
|
227
302
|
}
|
|
228
303
|
|
|
229
304
|
:host([variant="fill"]) .chip rel-avatar {
|
|
230
|
-
--rel-avatar-bg-fill:
|
|
231
|
-
--rel-avatar-color-fill:
|
|
305
|
+
--rel-avatar-bg-fill: var(--rel-action-overlay-hover-inverse);
|
|
306
|
+
--rel-avatar-color-fill: var(--rel-action-neutral-label-icons-fill-inverse);
|
|
232
307
|
}
|
|
233
308
|
|
|
234
309
|
:host([variant="subtle"]) .chip rel-avatar {
|
|
235
|
-
--rel-avatar-bg-fill:
|
|
310
|
+
--rel-avatar-bg-fill: var(--rel-action-overlay-hover-strong);
|
|
236
311
|
--rel-avatar-color-fill: currentColor;
|
|
237
312
|
}
|
|
238
313
|
|
|
@@ -259,62 +334,19 @@ export class RelChip extends LitElement {
|
|
|
259
334
|
.chip-remove:focus-visible {
|
|
260
335
|
outline: 1.5px solid currentColor;
|
|
261
336
|
outline-offset: 1px;
|
|
262
|
-
border-radius:
|
|
337
|
+
border-radius: var(--rel-border-radius-xs);
|
|
263
338
|
}
|
|
264
339
|
|
|
265
340
|
:host([size="lg"]) .chip-remove {
|
|
266
|
-
--rel-icon-size:
|
|
341
|
+
--rel-icon-size: 20px;
|
|
267
342
|
}
|
|
268
343
|
:host([size="md"]) .chip-remove {
|
|
269
|
-
--rel-icon-size:
|
|
344
|
+
--rel-icon-size: 18px;
|
|
270
345
|
}
|
|
271
346
|
:host([size="sm"]) .chip-remove {
|
|
272
|
-
--rel-icon-size:
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/* ── Dark mode — Figma had no dark-mode sample for this new component
|
|
276
|
-
set. Fill stays unchanged (the saturated tones already read fine on
|
|
277
|
-
dark surfaces); Subtle gets a dark-tinted background, following the
|
|
278
|
-
same invert pattern used elsewhere in this design system. Flagged in
|
|
279
|
-
the handoff notes — adjust if exact values exist.
|
|
280
|
-
No [data-theme="dark"] :host(...) fallback here — :host() can never
|
|
281
|
-
be preceded by a combinator, so that form is invalid and silently
|
|
282
|
-
matches nothing (the exact bug hit and fixed multiple times in
|
|
283
|
-
rel-avatar/rel-select earlier this session). :host-context() alone
|
|
284
|
-
has universal modern browser support, so no fallback is needed. ── */
|
|
285
|
-
:host-context([data-theme="dark"])[tone="neutral"][variant="subtle"] .chip {
|
|
286
|
-
background: #333333;
|
|
287
|
-
color: #f5f5f5;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
:host-context([data-theme="dark"])[tone="danger"][variant="subtle"] .chip {
|
|
291
|
-
background: #3d1414;
|
|
292
|
-
color: #ff8080;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
:host-context([data-theme="dark"])[tone="warning"][variant="subtle"] .chip {
|
|
296
|
-
background: #3d2e0a;
|
|
297
|
-
color: #ffd980;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
:host-context([data-theme="dark"])[tone="success"][variant="subtle"] .chip {
|
|
301
|
-
background: #0d2e22;
|
|
302
|
-
color: #4ddba3;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
:host-context([data-theme="dark"])[tone="info"][variant="subtle"] .chip {
|
|
306
|
-
background: #0a2e45;
|
|
307
|
-
color: #66c2ff;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
:host-context([data-theme="dark"])[tone="neutral"][variant="fill"] .chip {
|
|
311
|
-
background: #f5f5f5;
|
|
312
|
-
color: #0b0b0b;
|
|
347
|
+
--rel-icon-size: 16px;
|
|
313
348
|
}
|
|
314
349
|
|
|
315
|
-
:host-context([data-theme="dark"]) .chip-remove:focus-visible {
|
|
316
|
-
outline-color: currentColor;
|
|
317
|
-
}
|
|
318
350
|
`;
|
|
319
351
|
|
|
320
352
|
private get classes() {
|
|
@@ -373,7 +405,7 @@ export class RelChip extends LitElement {
|
|
|
373
405
|
|
|
374
406
|
return html`
|
|
375
407
|
<span
|
|
376
|
-
class="${this.classes}"
|
|
408
|
+
part="base" class="${this.classes}"
|
|
377
409
|
role="button"
|
|
378
410
|
tabindex="0"
|
|
379
411
|
aria-label="${this.label}"
|
|
@@ -382,10 +414,10 @@ export class RelChip extends LitElement {
|
|
|
382
414
|
? html`<rel-avatar type="text" text=${this.avatar} size="xs"></rel-avatar>`
|
|
383
415
|
: null}
|
|
384
416
|
${showLeadingIcon
|
|
385
|
-
? html`<rel-icon class="chip-icon" name="${this.leadingIcon}"></rel-icon>`
|
|
417
|
+
? html`<rel-icon part="icon" class="chip-icon" name="${this.leadingIcon}"></rel-icon>`
|
|
386
418
|
: null}
|
|
387
419
|
|
|
388
|
-
<span class="chip-label">${this.label}</span>
|
|
420
|
+
<span part="label" class="chip-label">${this.label}</span>
|
|
389
421
|
|
|
390
422
|
${this.trailingIcon
|
|
391
423
|
? html`<rel-icon class="chip-icon" name="${this.trailingIcon}"></rel-icon>`
|
|
@@ -57,19 +57,19 @@ None exposed.
|
|
|
57
57
|
## Tokens / CSS Variables
|
|
58
58
|
|
|
59
59
|
### Color Tokens
|
|
60
|
-
- `--rel-
|
|
61
|
-
- `--rel-
|
|
60
|
+
- `--rel-bg-surface` - White background color
|
|
61
|
+
- `--rel-bg-surface-elevated` - Light background color
|
|
62
62
|
|
|
63
63
|
### Shadow Tokens
|
|
64
64
|
- `--rel-shadows-shadow-300` - Shadow when `shadow` is true
|
|
65
65
|
|
|
66
66
|
### Border Tokens
|
|
67
|
-
- `--rel-
|
|
67
|
+
- `--rel-border-radius-sm` - Container border radius
|
|
68
68
|
|
|
69
69
|
### Spacing Tokens
|
|
70
|
-
- `--rel-spacing-
|
|
71
|
-
- `--rel-spacing-
|
|
72
|
-
- `--rel-spacing-
|
|
70
|
+
- `--rel-spacing-xs` - Small padding
|
|
71
|
+
- `--rel-spacing-md` - Medium padding
|
|
72
|
+
- `--rel-spacing-2xl` - Large padding
|
|
73
73
|
|
|
74
74
|
## Accessibility
|
|
75
75
|
- Purely presentational container, no specific accessibility features
|
|
@@ -83,13 +83,13 @@ None exposed.
|
|
|
83
83
|
|
|
84
84
|
## Notes / Edge Cases
|
|
85
85
|
- **Padding variants**:
|
|
86
|
-
- **sm**: Uses `--rel-spacing-
|
|
87
|
-
- **md**: Uses `--rel-spacing-
|
|
88
|
-
- **lg**: Uses `--rel-spacing-
|
|
86
|
+
- **sm**: Uses `--rel-spacing-xs`
|
|
87
|
+
- **md**: Uses `--rel-spacing-md`
|
|
88
|
+
- **lg**: Uses `--rel-spacing-2xl`
|
|
89
89
|
|
|
90
90
|
- **Background variants**:
|
|
91
|
-
- **white**: White background (`--rel-
|
|
92
|
-
- **light**: Light gray background (`--rel-
|
|
91
|
+
- **white**: White background (`--rel-bg-surface`)
|
|
92
|
+
- **light**: Light gray background (`--rel-bg-surface-elevated`)
|
|
93
93
|
- **none**: Transparent background
|
|
94
94
|
|
|
95
95
|
- The component is `display: block` and `width: 100%` with `box-sizing: border-box`
|
|
@@ -3,46 +3,72 @@ import { customElement, property } from "lit/decorators.js";
|
|
|
3
3
|
|
|
4
4
|
@customElement("rel-container")
|
|
5
5
|
export class RelContainer extends LitElement {
|
|
6
|
-
@property({ type: String }) padding: "sm" | "md" | "lg" = "md";
|
|
6
|
+
@property({ type: String, reflect: true }) padding: "sm" | "md" | "lg" | "xl" = "md";
|
|
7
7
|
@property({ type: Boolean }) shadow = false;
|
|
8
|
-
@property({ type: String }) background: "light" | "white" | "none" = "white";
|
|
8
|
+
@property({ type: String, reflect: true }) background: "light" | "white" | "none" = "white";
|
|
9
9
|
|
|
10
10
|
static styles = css`
|
|
11
11
|
:host {
|
|
12
|
+
color: var(--rel-text-default);
|
|
12
13
|
display: block;
|
|
13
14
|
width: 100%;
|
|
14
15
|
box-sizing: border-box;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
.reliability-container {
|
|
18
|
-
border-radius: var(--rel-
|
|
19
|
+
border-radius: var(--rel-border-radius-sm);
|
|
19
20
|
display: block;
|
|
20
21
|
width: 100%;
|
|
21
22
|
box-sizing: border-box;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
.bg-white {
|
|
25
|
-
background-color: var(--rel-
|
|
26
|
+
background-color: var(--rel-bg-surface);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
.bg-light {
|
|
29
|
-
background-color: var(--rel-
|
|
30
|
+
background-color: var(--rel-bg-surface-elevated);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
.bg-none {
|
|
33
34
|
background: transparent;
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
/* Default typography for slotted container content (Figma roles) */
|
|
38
|
+
::slotted(h1), ::slotted(h2), ::slotted(h3), ::slotted(h4) {
|
|
39
|
+
font-family: var(--rel-headings-sm-font-family);
|
|
40
|
+
font-weight: var(--rel-headings-sm-font-weight);
|
|
41
|
+
font-size: var(--rel-headings-sm-font-size);
|
|
42
|
+
line-height: var(--rel-headings-sm-line-height);
|
|
43
|
+
letter-spacing: var(--rel-headings-sm-letter-spacing);
|
|
44
|
+
color: var(--rel-text-default);
|
|
45
|
+
margin: 0 0 var(--rel-spacing-lg) 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
::slotted(p) {
|
|
49
|
+
font-family: var(--rel-body-md-regular-font-family);
|
|
50
|
+
font-weight: var(--rel-body-md-regular-font-weight);
|
|
51
|
+
font-size: var(--rel-body-md-regular-font-size);
|
|
52
|
+
line-height: var(--rel-body-md-regular-line-height);
|
|
53
|
+
letter-spacing: var(--rel-body-md-regular-letter-spacing);
|
|
54
|
+
color: var(--rel-text-body);
|
|
55
|
+
margin: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
36
58
|
.padding-sm {
|
|
37
|
-
padding: var(--rel-spacing-
|
|
59
|
+
padding: var(--rel-spacing-xs);
|
|
38
60
|
}
|
|
39
61
|
|
|
40
62
|
.padding-md {
|
|
41
|
-
padding: var(--rel-spacing-
|
|
63
|
+
padding: var(--rel-spacing-md);
|
|
42
64
|
}
|
|
43
65
|
|
|
44
66
|
.padding-lg {
|
|
45
|
-
padding: var(--rel-spacing-
|
|
67
|
+
padding: var(--rel-spacing-xl);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.padding-xl {
|
|
71
|
+
padding: var(--rel-spacing-2xl);
|
|
46
72
|
}
|
|
47
73
|
|
|
48
74
|
.shadow {
|
|
@@ -61,7 +87,7 @@ export class RelContainer extends LitElement {
|
|
|
61
87
|
|
|
62
88
|
render() {
|
|
63
89
|
return html`
|
|
64
|
-
<div class="${this.classes}">
|
|
90
|
+
<div part="base container" class="${this.classes}">
|
|
65
91
|
<slot></slot>
|
|
66
92
|
</div>
|
|
67
93
|
`;
|
|
@@ -97,7 +97,8 @@ picker.addEventListener('rel-open-change', (e) => {
|
|
|
97
97
|
| `min` | `string \| null` | `null` | Minimum selectable date (ISO format) |
|
|
98
98
|
| `max` | `string \| null` | `null` | Maximum selectable date (ISO format) |
|
|
99
99
|
| `week-start` | `"sun" \| "mon"` | `"sun"` | First day of the week |
|
|
100
|
-
| `locale` | `string` | `"en-US"` | Locale for month
|
|
100
|
+
| `locale` | `string` | `"en-US"` | Locale for weekday labels and named-month display tokens (uses Intl.DateTimeFormat) |
|
|
101
|
+
| `display-format` | `string \| null` | `null` | Token pattern for the selected value (see [Display format](#display-format)). Unset → locale long date |
|
|
101
102
|
| `open` | `boolean` | `false` | Controls popover open state |
|
|
102
103
|
| `close-on-select` | `boolean` | `true` | Close popover after selecting a date |
|
|
103
104
|
| `clearable` | `boolean` | `false` | Show clear button when date is selected |
|
|
@@ -107,6 +108,41 @@ picker.addEventListener('rel-open-change', (e) => {
|
|
|
107
108
|
| Property | Type | Description |
|
|
108
109
|
|----------|------|-------------|
|
|
109
110
|
| `isDateDisabled` | `(date: Date) => boolean` | Custom function to disable specific dates |
|
|
111
|
+
| `formatDate` | `(date: Date) => string` | Full control of the selected-value display; takes precedence over `display-format`. Set via property (not an attribute) |
|
|
112
|
+
|
|
113
|
+
## Display format
|
|
114
|
+
|
|
115
|
+
By default the selected date is shown using the locale's long date (e.g. `July 21, 2026`). To render a fixed format instead, set `display-format` to a token pattern, or set the `formatDate` property to a callback for full control. Both affect **only the visible trigger text** — the underlying `value` stays ISO (`YYYY-MM-DD`), and parsing, the calendar, and accessibility are unchanged.
|
|
116
|
+
|
|
117
|
+
```html
|
|
118
|
+
<rel-date-picker value="2026-07-21" display-format="YYYY-MM-DD"></rel-date-picker> <!-- 2026-07-21 -->
|
|
119
|
+
<rel-date-picker value="2026-07-21" display-format="MM/DD/YYYY"></rel-date-picker> <!-- 07/21/2026 -->
|
|
120
|
+
<rel-date-picker value="2026-07-21" display-format="DD/MM/YYYY"></rel-date-picker> <!-- 21/07/2026 -->
|
|
121
|
+
<rel-date-picker value="2026-07-21" display-format="DD MMM YYYY"></rel-date-picker> <!-- 21 Jul 2026 -->
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```js
|
|
125
|
+
// Full control via callback (wins over display-format). Use it for logic a
|
|
126
|
+
// pattern can't express — e.g. relative labels or fiscal periods.
|
|
127
|
+
picker.formatDate = (date) => `Q${Math.floor(date.getMonth() / 3) + 1} ${date.getFullYear()}`;
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
> **Timezone note:** the `date` passed to `formatDate` is at **local midnight**. Read it with local getters (`getFullYear` / `getMonth` / `getDate`) — as the built-in tokens do. Avoid `toISOString()` / `getUTC*`, which shift the day by the local UTC offset (e.g. `2026-07-21` → `2026-07-20`). For a plain ISO string, prefer `display-format="YYYY-MM-DD"`.
|
|
131
|
+
|
|
132
|
+
**Tokens** (matched longest-first; other characters pass through; wrap literal text containing token letters in `[ ]`):
|
|
133
|
+
|
|
134
|
+
| Token | Meaning | Example (2026-07-21) |
|
|
135
|
+
|-------|---------|----------------------|
|
|
136
|
+
| `YYYY` | 4-digit year | `2026` |
|
|
137
|
+
| `YY` | 2-digit year | `26` |
|
|
138
|
+
| `MMMM` | Full month (locale) | `July` |
|
|
139
|
+
| `MMM` | Short month (locale) | `Jul` |
|
|
140
|
+
| `MM` | 2-digit month | `07` |
|
|
141
|
+
| `M` | Month number | `7` |
|
|
142
|
+
| `DD` | 2-digit day | `21` |
|
|
143
|
+
| `D` | Day number | `21` |
|
|
144
|
+
|
|
145
|
+
Named-month tokens (`MMMM`/`MMM`) respect `locale`; numeric formats are locale-independent. Existing consumers that set neither property are unaffected.
|
|
110
146
|
|
|
111
147
|
## Events
|
|
112
148
|
|
|
@@ -230,14 +266,14 @@ picker.isDateDisabled = (date) => {
|
|
|
230
266
|
The component uses design tokens from the Reliability Design System. All colors, spacing, and typography are inherited from CSS variables.
|
|
231
267
|
|
|
232
268
|
Key tokens used:
|
|
233
|
-
- `--rel-
|
|
269
|
+
- `--rel-bg-*` / `--rel-text-*` / `--rel-border-*` semantic colors
|
|
234
270
|
- `--rel-spacing-*` for spacing
|
|
235
|
-
- `--rel-
|
|
236
|
-
- `--rel-
|
|
271
|
+
- `--rel-body-*` composite typography roles
|
|
272
|
+
- `--rel-border-*` / `--rel-border-radius-*` tokens
|
|
237
273
|
- `--rel-shadows-*` for popover shadow
|
|
238
|
-
- Selected date: `--rel-
|
|
239
|
-
- Today indicator: `--rel-
|
|
240
|
-
- Focus rings: `--rel-
|
|
274
|
+
- Selected date: `--rel-bg-brand`
|
|
275
|
+
- Today indicator: `--rel-bg-info`
|
|
276
|
+
- Focus rings: `--rel-bg-info`
|
|
241
277
|
|
|
242
278
|
## Date Format
|
|
243
279
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { test } from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { formatDatePattern } from "./date-format";
|
|
4
|
+
|
|
5
|
+
// Local, DOM-free date (noon avoids any TZ edge on the calendar day).
|
|
6
|
+
const d = new Date(2026, 6, 21, 12, 0, 0); // 2026-07-21 (month is 0-based)
|
|
7
|
+
const single = new Date(2026, 2, 5, 12, 0, 0); // 2026-03-05 → single-digit M/D
|
|
8
|
+
|
|
9
|
+
test("YYYY-MM-DD (ISO, the primary ask)", () => {
|
|
10
|
+
assert.equal(formatDatePattern(d, "YYYY-MM-DD"), "2026-07-21");
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test("MM/DD/YYYY (US)", () => {
|
|
14
|
+
assert.equal(formatDatePattern(d, "MM/DD/YYYY"), "07/21/2026");
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test("DD/MM/YYYY (EU)", () => {
|
|
18
|
+
assert.equal(formatDatePattern(d, "DD/MM/YYYY"), "21/07/2026");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test("zero-padding vs single-digit tokens", () => {
|
|
22
|
+
assert.equal(formatDatePattern(single, "YYYY-MM-DD"), "2026-03-05");
|
|
23
|
+
assert.equal(formatDatePattern(single, "D/M/YYYY"), "5/3/2026");
|
|
24
|
+
assert.equal(formatDatePattern(single, "YY"), "26");
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test("named-month tokens are locale-aware", () => {
|
|
28
|
+
assert.equal(formatDatePattern(d, "MMMM D, YYYY", "en-US"), "July 21, 2026");
|
|
29
|
+
assert.equal(formatDatePattern(d, "MMM DD", "en-US"), "Jul 21");
|
|
30
|
+
// German locale month name
|
|
31
|
+
assert.equal(formatDatePattern(d, "MMMM", "de-DE"), "Juli");
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("bracketed literals pass through without token substitution", () => {
|
|
35
|
+
assert.equal(formatDatePattern(d, "[Week of] YYYY-MM-DD"), "Week of 2026-07-21");
|
|
36
|
+
// 'M' and 'D' inside a bracketed literal are NOT substituted
|
|
37
|
+
assert.equal(formatDatePattern(d, "[Manifest Due:] DD/MM"), "Manifest Due: 21/07");
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("arbitrary separators pass through", () => {
|
|
41
|
+
assert.equal(formatDatePattern(d, "YYYY.MM.DD"), "2026.07.21");
|
|
42
|
+
assert.equal(formatDatePattern(d, "DD MMM YYYY", "en-US"), "21 Jul 2026");
|
|
43
|
+
});
|