@reliability-design/web 1.4.6 → 1.4.7
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 +211 -49
- package/dist/components/rel-accordion/README.md +132 -132
- package/dist/components/rel-alert/README.md +145 -141
- package/dist/components/rel-autocomplete/README.md +156 -61
- package/dist/components/rel-avatar/README.md +116 -130
- package/dist/components/rel-badge/README.md +98 -93
- package/dist/components/rel-breadcrumb/README.md +96 -102
- package/dist/components/rel-button/README.md +160 -130
- package/dist/components/rel-calendar/README.md +109 -109
- package/dist/components/rel-card/README.md +75 -94
- package/dist/components/rel-cardmedia/README.md +100 -127
- package/dist/components/rel-carousel/README.md +184 -166
- package/dist/components/rel-checkbox/README.md +93 -75
- package/dist/components/rel-chip/README.md +132 -121
- package/dist/components/rel-container/README.md +107 -99
- package/dist/components/rel-date-picker/README.md +200 -289
- package/dist/components/rel-divider/README.md +78 -100
- package/dist/components/rel-drawer/README.md +187 -200
- package/dist/components/rel-kbd/README.md +141 -151
- package/dist/components/rel-menu/README.md +178 -151
- package/dist/components/rel-menubar/README.md +218 -329
- package/dist/components/rel-otp/README.md +170 -440
- package/dist/components/rel-pagination/README.md +100 -424
- package/dist/components/rel-popover/README.md +203 -568
- package/dist/components/rel-progress/README.md +88 -110
- package/dist/components/rel-radio/README.md +131 -138
- package/dist/components/rel-range-picker/README.md +162 -0
- package/dist/components/rel-resizable/README.md +199 -140
- package/dist/components/rel-segmented-button/README.md +155 -141
- package/dist/components/rel-select/README.md +154 -93
- package/dist/components/rel-sheet/README.md +168 -224
- package/dist/components/rel-skeleton/README.md +103 -0
- package/dist/components/rel-slider/README.md +130 -135
- package/dist/components/rel-snackbar/README.md +162 -134
- package/dist/components/rel-stepper/README.md +158 -160
- package/dist/components/rel-switch/README.md +108 -102
- package/dist/components/rel-tab/README.md +171 -163
- package/dist/components/rel-textfield/README.md +159 -69
- package/dist/components/rel-time-picker/README.md +122 -157
- package/dist/components/rel-toast/README.md +157 -148
- package/dist/components/rel-tooltip/README.md +108 -111
- package/dist/components/rel-upload/README.md +220 -0
- package/dist/index.d.mts +1147 -340
- package/dist/index.d.ts +1147 -340
- package/dist/index.js +3451 -3163
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3416 -3118
- package/dist/index.mjs.map +1 -1
- package/dist/styles/vars.css +877 -866
- package/dist/{vars-XNMTSRVN.css → vars-JHTUGNRG.css} +877 -866
- package/package.json +3 -2
- package/dist/components/rel-accordion/rel-accordion.ts +0 -336
- package/dist/components/rel-alert/rel-alert.ts +0 -305
- package/dist/components/rel-autocomplete/rel-autocomplete.ts +0 -720
- package/dist/components/rel-avatar/rel-avatar.ts +0 -142
- package/dist/components/rel-badge/rel-badge.ts +0 -175
- package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +0 -106
- package/dist/components/rel-button/rel-button.ts +0 -560
- package/dist/components/rel-calendar/index.ts +0 -1
- package/dist/components/rel-calendar/rel-calendar.ts +0 -565
- package/dist/components/rel-card/rel-card.ts +0 -88
- package/dist/components/rel-cardmedia/rel-cardmedia.ts +0 -88
- package/dist/components/rel-carousel/index.ts +0 -1
- package/dist/components/rel-carousel/rel-carousel.ts +0 -723
- package/dist/components/rel-chart/README.md +0 -286
- package/dist/components/rel-chart/index.ts +0 -1
- package/dist/components/rel-chart/rel-chart.ts +0 -754
- package/dist/components/rel-checkbox/rel-checkbox.ts +0 -382
- package/dist/components/rel-chip/rel-chip.ts +0 -483
- package/dist/components/rel-container/rel-container.ts +0 -95
- package/dist/components/rel-date-picker/date-format.test.ts +0 -43
- package/dist/components/rel-date-picker/date-format.ts +0 -47
- package/dist/components/rel-date-picker/date-parse.test.ts +0 -116
- package/dist/components/rel-date-picker/date-parse.ts +0 -178
- package/dist/components/rel-date-picker/index.ts +0 -1
- package/dist/components/rel-date-picker/rel-date-picker.ts +0 -1676
- package/dist/components/rel-divider/rel-divider.ts +0 -54
- package/dist/components/rel-drawer/index.ts +0 -1
- package/dist/components/rel-drawer/rel-drawer-footer.ts +0 -27
- package/dist/components/rel-drawer/rel-drawer.ts +0 -607
- package/dist/components/rel-kbd/rel-kbd.ts +0 -188
- package/dist/components/rel-layout/rel-layout.ts +0 -49
- package/dist/components/rel-menu/rel-menu.ts +0 -541
- package/dist/components/rel-menubar/index.ts +0 -2
- package/dist/components/rel-menubar/rel-menubar-menu.css +0 -3
- package/dist/components/rel-menubar/rel-menubar-menu.ts +0 -17
- package/dist/components/rel-menubar/rel-menubar.ts +0 -777
- package/dist/components/rel-nav-menu/README.md +0 -289
- package/dist/components/rel-nav-menu/index.ts +0 -3
- package/dist/components/rel-nav-menu/rel-nav-menu-item.ts +0 -243
- package/dist/components/rel-nav-menu/rel-nav-menu-panel.ts +0 -72
- package/dist/components/rel-nav-menu/rel-nav-menu.ts +0 -270
- package/dist/components/rel-navbar/README.md +0 -126
- package/dist/components/rel-navbar/rel-navbar.ts +0 -105
- package/dist/components/rel-otp/index.ts +0 -1
- package/dist/components/rel-otp/rel-otp.ts +0 -527
- package/dist/components/rel-pagination/index.ts +0 -1
- package/dist/components/rel-pagination/rel-pagination.ts +0 -522
- package/dist/components/rel-popover/index.ts +0 -2
- package/dist/components/rel-popover/rel-popover-content.ts +0 -81
- package/dist/components/rel-popover/rel-popover.ts +0 -475
- package/dist/components/rel-progress/rel-progress.ts +0 -234
- package/dist/components/rel-radio/rel-radio.ts +0 -481
- package/dist/components/rel-range-picker/rel-range-picker.ts +0 -1688
- package/dist/components/rel-resizable/index.ts +0 -3
- package/dist/components/rel-resizable/rel-resizable-group.ts +0 -405
- package/dist/components/rel-resizable/rel-resizable-handle.ts +0 -150
- package/dist/components/rel-resizable/rel-resizable-panel.ts +0 -58
- package/dist/components/rel-segmented-button/rel-segmented-button.ts +0 -217
- package/dist/components/rel-select/rel-select.ts +0 -1416
- package/dist/components/rel-sheet/rel-sheet.ts +0 -610
- package/dist/components/rel-sidebar/README.md +0 -209
- package/dist/components/rel-sidebar/rel-sidebar.ts +0 -1191
- package/dist/components/rel-skeleton/rel-skeleton.ts +0 -143
- package/dist/components/rel-slider/rel-slider.ts +0 -673
- package/dist/components/rel-snackbar/rel-snackbar.ts +0 -329
- package/dist/components/rel-stepper/rel-stepper.ts +0 -567
- package/dist/components/rel-switch/rel-switch.ts +0 -199
- package/dist/components/rel-tab/rel-tab.ts +0 -264
- package/dist/components/rel-table/README.md +0 -178
- package/dist/components/rel-table/rel-table-body.ts +0 -22
- package/dist/components/rel-table/rel-table-caption.ts +0 -30
- package/dist/components/rel-table/rel-table-cell.ts +0 -43
- package/dist/components/rel-table/rel-table-footer.ts +0 -24
- package/dist/components/rel-table/rel-table-head.ts +0 -47
- package/dist/components/rel-table/rel-table-header.ts +0 -22
- package/dist/components/rel-table/rel-table-row.ts +0 -37
- package/dist/components/rel-table/rel-table.ts +0 -62
- package/dist/components/rel-textfield/rel-textfield.ts +0 -1054
- package/dist/components/rel-time-picker/rel-time-picker.ts +0 -1482
- package/dist/components/rel-time-picker/time-parse.test.ts +0 -67
- package/dist/components/rel-time-picker/time-parse.ts +0 -85
- package/dist/components/rel-toast/rel-toast.ts +0 -206
- package/dist/components/rel-tooltip/rel-tooltip.ts +0 -193
- package/dist/components/rel-topbar/rel-topbar-actions.ts +0 -27
- package/dist/components/rel-topbar/rel-topbar-brand.ts +0 -54
- package/dist/components/rel-topbar/rel-topbar-dropdown-item.ts +0 -69
- package/dist/components/rel-topbar/rel-topbar-dropdown.ts +0 -31
- package/dist/components/rel-topbar/rel-topbar-item.ts +0 -324
- package/dist/components/rel-topbar/rel-topbar-mobile-panel.ts +0 -27
- package/dist/components/rel-topbar/rel-topbar-profile.ts +0 -243
- package/dist/components/rel-topbar/rel-topbar-utilities.ts +0 -27
- package/dist/components/rel-topbar/rel-topbar.ts +0 -446
- package/dist/components/rel-upload/UPLOAD-DESIGN-CHANGES.md +0 -134
- package/dist/components/rel-upload/rel-upload-actions.ts +0 -163
- package/dist/components/rel-upload/rel-upload.ts +0 -968
|
@@ -1,483 +0,0 @@
|
|
|
1
|
-
import { LitElement, html, css } from "lit";
|
|
2
|
-
import { customElement, property, state } from "lit/decorators.js";
|
|
3
|
-
import "../rel-avatar/rel-avatar.js";
|
|
4
|
-
import "@reliability-design/icons/rel-icon";
|
|
5
|
-
import { announce } from "../../utils/announce";
|
|
6
|
-
|
|
7
|
-
export type ChipTone = "neutral" | "danger" | "warning" | "success" | "info";
|
|
8
|
-
export type ChipVariant = "fill" | "subtle";
|
|
9
|
-
export type ChipSize = "sm" | "md" | "lg";
|
|
10
|
-
export type ChipBorder = "default" | "rounded";
|
|
11
|
-
|
|
12
|
-
@customElement("rel-chip")
|
|
13
|
-
export class RelChip extends LitElement {
|
|
14
|
-
// The actually-focusable element is the inner <span tabindex="0">, not the
|
|
15
|
-
// host. Without delegatesFocus, calling host.focus() (e.g. from a parent
|
|
16
|
-
// component, or a "focus this" demo button) is a no-op since the host
|
|
17
|
-
// itself carries no tabindex — only real Tab-key traversal would still
|
|
18
|
-
// reach the inner span, because that walks the flattened DOM regardless.
|
|
19
|
-
static override shadowRootOptions: ShadowRootInit = {
|
|
20
|
-
...LitElement.shadowRootOptions,
|
|
21
|
-
delegatesFocus: true,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
@property({ type: String }) label = "Label";
|
|
25
|
-
|
|
26
|
-
@property({ type: String, reflect: true }) tone: ChipTone = "neutral";
|
|
27
|
-
|
|
28
|
-
@property({ type: String, reflect: true }) variant: ChipVariant = "fill";
|
|
29
|
-
|
|
30
|
-
@property({ type: String, reflect: true }) size: ChipSize = "md";
|
|
31
|
-
|
|
32
|
-
@property({ type: String, reflect: true }) border: ChipBorder = "default";
|
|
33
|
-
|
|
34
|
-
/** Icon name from the generated icon dictionary (e.g. "settings") — rendered via <rel-icon>. */
|
|
35
|
-
@property({ type: String, attribute: "leading-icon" }) leadingIcon?: string;
|
|
36
|
-
@property({ type: String, attribute: "trailing-icon" }) trailingIcon?: string;
|
|
37
|
-
/** Initials text for the avatar (e.g. "JD"). Mutually exclusive with leadingIcon. */
|
|
38
|
-
@property({ type: String }) avatar?: string;
|
|
39
|
-
|
|
40
|
-
@property({ type: Boolean }) removable = false;
|
|
41
|
-
|
|
42
|
-
/** IMPORTANT: reflected so CSS + Angular can see it */
|
|
43
|
-
@property({ type: Boolean, reflect: true }) removed = false;
|
|
44
|
-
|
|
45
|
-
/** Opt-in native drag-and-drop — reflects the Figma "Dragged" state automatically during a real drag gesture. */
|
|
46
|
-
// Explicit attribute mapping — Lit's default attribute name for a camelCase
|
|
47
|
-
// property is the name fully lowercased (no hyphens), so without this it'd
|
|
48
|
-
// only respond to draggablechip="", not draggable-chip.
|
|
49
|
-
@property({ type: Boolean, attribute: "draggable-chip" }) draggableChip = false;
|
|
50
|
-
|
|
51
|
-
/** Reflected so CSS can target the Figma "Dragged" visual state. Driven automatically by dragstart/dragend when draggableChip is set. */
|
|
52
|
-
@state() private dragging = false;
|
|
53
|
-
|
|
54
|
-
static styles = css`
|
|
55
|
-
:host {
|
|
56
|
-
color: var(--rel-text-default);
|
|
57
|
-
display: inline-flex;
|
|
58
|
-
width: auto;
|
|
59
|
-
flex: 0 0 auto;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
:host([removed]) {
|
|
63
|
-
display: none;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.chip {
|
|
67
|
-
display: inline-flex;
|
|
68
|
-
align-items: center;
|
|
69
|
-
box-sizing: border-box;
|
|
70
|
-
border: 1px solid transparent;
|
|
71
|
-
gap: var(--rel-spacing-xs);
|
|
72
|
-
cursor: pointer;
|
|
73
|
-
user-select: none;
|
|
74
|
-
white-space: nowrap;
|
|
75
|
-
outline: none;
|
|
76
|
-
background: transparent;
|
|
77
|
-
transition: background-color 0.15s ease;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.chip-action {
|
|
81
|
-
display: inline-flex;
|
|
82
|
-
align-items: center;
|
|
83
|
-
gap: var(--rel-spacing-xs);
|
|
84
|
-
outline: none;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/* ── Size ── */
|
|
88
|
-
:host([size="lg"]) .chip {
|
|
89
|
-
height: 32px;
|
|
90
|
-
padding: var(--rel-spacing-2xs) var(--rel-spacing-xs);
|
|
91
|
-
font-family: var(--rel-body-lg-regular-font-family);
|
|
92
|
-
font-weight: var(--rel-body-lg-medium-font-weight);
|
|
93
|
-
font-size: var(--rel-body-lg-regular-font-size);
|
|
94
|
-
line-height: var(--rel-body-lg-regular-line-height);
|
|
95
|
-
letter-spacing: var(--rel-body-lg-regular-letter-spacing);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
:host([size="md"]) .chip {
|
|
99
|
-
height: 28px;
|
|
100
|
-
padding: var(--rel-spacing-2xs) var(--rel-spacing-xs);
|
|
101
|
-
font-family: var(--rel-body-md-regular-font-family);
|
|
102
|
-
font-weight: var(--rel-body-md-medium-font-weight);
|
|
103
|
-
font-size: var(--rel-body-md-regular-font-size);
|
|
104
|
-
line-height: var(--rel-body-md-regular-line-height);
|
|
105
|
-
letter-spacing: var(--rel-body-md-regular-letter-spacing);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
:host([size="sm"]) .chip {
|
|
109
|
-
height: 24px;
|
|
110
|
-
padding: var(--rel-spacing-2xs) var(--rel-spacing-xs);
|
|
111
|
-
font-family: var(--rel-body-sm-regular-font-family);
|
|
112
|
-
font-weight: var(--rel-body-xs-medium-font-weight);
|
|
113
|
-
font-size: var(--rel-body-sm-medium-font-size);
|
|
114
|
-
line-height: var(--rel-body-sm-medium-line-height);
|
|
115
|
-
letter-spacing: var(--rel-body-sm-medium-letter-spacing);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/* ── Border / shape — "Rounded" also widens horizontal padding to 12px,
|
|
119
|
-
consistent across all three sizes per the Figma spec. ── */
|
|
120
|
-
:host([border="default"]) .chip {
|
|
121
|
-
border-radius: var(--rel-border-radius-xs);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
:host([border="rounded"]) .chip {
|
|
125
|
-
border-radius: var(--rel-border-radius-full-rounded);
|
|
126
|
-
padding-left: var(--rel-spacing-sm);
|
|
127
|
-
padding-right: var(--rel-spacing-sm);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/* ── Tone x Variant — V2 action tokens (auto light/dark) ── */
|
|
131
|
-
:host([tone="neutral"][variant="fill"]) .chip {
|
|
132
|
-
background: var(--rel-action-neutral-fill);
|
|
133
|
-
color: var(--rel-text-inverse);
|
|
134
|
-
}
|
|
135
|
-
:host([tone="neutral"][variant="subtle"]) .chip {
|
|
136
|
-
background: var(--rel-action-neutral-subtle);
|
|
137
|
-
color: var(--rel-action-neutral-label-icons-subtle);
|
|
138
|
-
}
|
|
139
|
-
:host([tone="danger"][variant="fill"]) .chip {
|
|
140
|
-
background: var(--rel-action-danger-fill);
|
|
141
|
-
color: var(--rel-text-static-light);
|
|
142
|
-
}
|
|
143
|
-
:host([tone="danger"][variant="subtle"]) .chip {
|
|
144
|
-
background: var(--rel-action-danger-subtle);
|
|
145
|
-
color: var(--rel-action-danger-label-icons-subtle);
|
|
146
|
-
}
|
|
147
|
-
:host([tone="warning"][variant="fill"]) .chip {
|
|
148
|
-
background: var(--rel-action-warning-fill);
|
|
149
|
-
color: var(--rel-action-warning-label-icons-fill);
|
|
150
|
-
}
|
|
151
|
-
:host([tone="warning"][variant="subtle"]) .chip {
|
|
152
|
-
background: var(--rel-action-warning-subtle);
|
|
153
|
-
color: var(--rel-action-warning-label-icons-subtle);
|
|
154
|
-
}
|
|
155
|
-
:host([tone="success"][variant="fill"]) .chip {
|
|
156
|
-
background: var(--rel-action-success-fill);
|
|
157
|
-
color: var(--rel-action-success-label-icons-fill);
|
|
158
|
-
}
|
|
159
|
-
:host([tone="success"][variant="subtle"]) .chip {
|
|
160
|
-
background: var(--rel-action-success-subtle);
|
|
161
|
-
color: var(--rel-action-success-label-icons-subtle);
|
|
162
|
-
}
|
|
163
|
-
:host([tone="info"][variant="fill"]) .chip {
|
|
164
|
-
background: var(--rel-action-info-fill);
|
|
165
|
-
color: var(--rel-action-info-label-icons-fill);
|
|
166
|
-
}
|
|
167
|
-
:host([tone="info"][variant="subtle"]) .chip {
|
|
168
|
-
background: var(--rel-action-info-subtle);
|
|
169
|
-
color: var(--rel-action-info-label-icons-subtle);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/* ── Hover / Dragged — per-tone V2 action state tokens ── */
|
|
173
|
-
:host([tone="neutral"][variant="fill"]) .chip:hover {
|
|
174
|
-
background: var(--rel-action-neutral-fill-hover);
|
|
175
|
-
}
|
|
176
|
-
:host([tone="neutral"][variant="fill"]) .chip:active,
|
|
177
|
-
:host([tone="neutral"][variant="fill"][dragging]) .chip {
|
|
178
|
-
background: var(--rel-action-neutral-fill-dragged);
|
|
179
|
-
}
|
|
180
|
-
:host([tone="neutral"][variant="subtle"]) .chip:hover {
|
|
181
|
-
border-color: var(--rel-action-neutral-border-subtle-hover);
|
|
182
|
-
background: var(--rel-action-neutral-subtle-hover);
|
|
183
|
-
}
|
|
184
|
-
:host([tone="neutral"][variant="subtle"]) .chip:active,
|
|
185
|
-
:host([tone="neutral"][variant="subtle"][dragging]) .chip {
|
|
186
|
-
border-color: var(--rel-action-neutral-border-subtle-dragged);
|
|
187
|
-
background: var(--rel-action-neutral-subtle-dragged);
|
|
188
|
-
}
|
|
189
|
-
:host([tone="danger"][variant="fill"]) .chip:hover {
|
|
190
|
-
background: var(--rel-action-danger-fill-hover);
|
|
191
|
-
}
|
|
192
|
-
:host([tone="danger"][variant="fill"]) .chip:active,
|
|
193
|
-
:host([tone="danger"][variant="fill"][dragging]) .chip {
|
|
194
|
-
background: var(--rel-action-danger-fill-dragged);
|
|
195
|
-
}
|
|
196
|
-
:host([tone="danger"][variant="subtle"]) .chip:hover {
|
|
197
|
-
border-color: var(--rel-action-danger-border-subtle-hover);
|
|
198
|
-
background: var(--rel-action-danger-subtle-hover);
|
|
199
|
-
color: var(--rel-action-danger-label-icons-subtle-hover);
|
|
200
|
-
}
|
|
201
|
-
:host([tone="danger"][variant="subtle"]) .chip:active,
|
|
202
|
-
:host([tone="danger"][variant="subtle"][dragging]) .chip {
|
|
203
|
-
border-color: var(--rel-action-danger-border-subtle-dragged);
|
|
204
|
-
background: var(--rel-action-danger-subtle-dragged);
|
|
205
|
-
color: var(--rel-action-danger-label-icons-subtle-dragged);
|
|
206
|
-
}
|
|
207
|
-
:host([tone="warning"][variant="fill"]) .chip:hover {
|
|
208
|
-
background: var(--rel-action-warning-fill-hover);
|
|
209
|
-
}
|
|
210
|
-
:host([tone="warning"][variant="fill"]) .chip:active,
|
|
211
|
-
:host([tone="warning"][variant="fill"][dragging]) .chip {
|
|
212
|
-
background: var(--rel-action-warning-fill-dragged);
|
|
213
|
-
}
|
|
214
|
-
:host([tone="warning"][variant="subtle"]) .chip:hover {
|
|
215
|
-
border-color: var(--rel-action-warning-border-subtle-hover);
|
|
216
|
-
background: var(--rel-action-warning-subtle-hover);
|
|
217
|
-
color: var(--rel-action-warning-label-icons-subtle-hover);
|
|
218
|
-
}
|
|
219
|
-
:host([tone="warning"][variant="subtle"]) .chip:active,
|
|
220
|
-
:host([tone="warning"][variant="subtle"][dragging]) .chip {
|
|
221
|
-
border-color: var(--rel-action-warning-border-subtle-dragged);
|
|
222
|
-
background: var(--rel-action-warning-subtle-dragged);
|
|
223
|
-
color: var(--rel-action-warning-label-icons-subtle-dragged);
|
|
224
|
-
}
|
|
225
|
-
:host([tone="success"][variant="fill"]) .chip:hover {
|
|
226
|
-
background: var(--rel-action-success-fill-hover);
|
|
227
|
-
}
|
|
228
|
-
:host([tone="success"][variant="fill"]) .chip:active,
|
|
229
|
-
:host([tone="success"][variant="fill"][dragging]) .chip {
|
|
230
|
-
background: var(--rel-action-success-fill-dragged);
|
|
231
|
-
}
|
|
232
|
-
:host([tone="success"][variant="subtle"]) .chip:hover {
|
|
233
|
-
border-color: var(--rel-action-success-border-subtle-hover);
|
|
234
|
-
background: var(--rel-action-success-subtle-hover);
|
|
235
|
-
color: var(--rel-action-success-label-icons-subtle-hover);
|
|
236
|
-
}
|
|
237
|
-
:host([tone="success"][variant="subtle"]) .chip:active,
|
|
238
|
-
:host([tone="success"][variant="subtle"][dragging]) .chip {
|
|
239
|
-
border-color: var(--rel-action-success-border-subtle-dragged);
|
|
240
|
-
background: var(--rel-action-success-subtle-dragged);
|
|
241
|
-
color: var(--rel-action-success-label-icons-subtle-dragged);
|
|
242
|
-
}
|
|
243
|
-
:host([tone="info"][variant="fill"]) .chip:hover {
|
|
244
|
-
background: var(--rel-action-info-fill-hover);
|
|
245
|
-
}
|
|
246
|
-
:host([tone="info"][variant="fill"]) .chip:active,
|
|
247
|
-
:host([tone="info"][variant="fill"][dragging]) .chip {
|
|
248
|
-
background: var(--rel-action-info-fill-dragged);
|
|
249
|
-
}
|
|
250
|
-
:host([tone="info"][variant="subtle"]) .chip:hover {
|
|
251
|
-
border-color: var(--rel-action-info-border-subtle-hover);
|
|
252
|
-
background: var(--rel-action-info-subtle-hover);
|
|
253
|
-
color: var(--rel-action-info-label-icons-subtle-hover);
|
|
254
|
-
}
|
|
255
|
-
:host([tone="info"][variant="subtle"]) .chip:active,
|
|
256
|
-
:host([tone="info"][variant="subtle"][dragging]) .chip {
|
|
257
|
-
border-color: var(--rel-action-info-border-subtle-dragged);
|
|
258
|
-
background: var(--rel-action-info-subtle-dragged);
|
|
259
|
-
color: var(--rel-action-info-label-icons-subtle-dragged);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
:host([dragging]) .chip {
|
|
263
|
-
cursor: grabbing;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/* ── Focused — 1.5px outline, drawn outside (matches Figma's
|
|
267
|
-
strokeAlign:OUTSIDE) so it never affects layout. Same color
|
|
268
|
-
regardless of tone, per spec. OUTSIDE alignment means the stroke
|
|
269
|
-
sits flush against the shape's edge with zero gap, extending
|
|
270
|
-
outward by strokeWeight — outline-offset must be 0, not a positive
|
|
271
|
-
gap (a positive offset was the bug: it drew a visible gap that
|
|
272
|
-
doesn't exist in Figma). ── */
|
|
273
|
-
.chip:has(.chip-action:focus-visible) {
|
|
274
|
-
outline: 1.5px solid var(--rel-chip-focus-ring, var(--rel-border-focus));
|
|
275
|
-
outline-offset: 1.5px;
|
|
276
|
-
box-shadow: 0 0 0 1.5px var(--rel-border-focus-inner);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/* ── Icons ── */
|
|
280
|
-
/* rel-icon renders its SVG inside its own shadow root, so sizing has to
|
|
281
|
-
go through --rel-icon-size (a custom property — pierces shadow
|
|
282
|
-
boundaries) rather than a ".chip-icon svg" selector, which can never
|
|
283
|
-
reach across shadow DOM. */
|
|
284
|
-
.chip-icon {
|
|
285
|
-
flex-shrink: 0;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
:host([size="lg"]) .chip-icon {
|
|
289
|
-
--rel-icon-size: 20px;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
:host([size="md"]) .chip-icon {
|
|
293
|
-
--rel-icon-size: 18px;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
:host([size="sm"]) .chip-icon {
|
|
297
|
-
--rel-icon-size: 16px;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/* ── Avatar — not shown in the Figma sample. rel-avatar sizes its inner
|
|
301
|
-
.avatar div directly from its own "size" prop (fixed presets only —
|
|
302
|
-
no --rel-avatar-size custom property escape hatch like rel-icon has),
|
|
303
|
-
so a host-level width/height override here would only resize the
|
|
304
|
-
empty outer wrapper, not the actual painted circle. "xs" (20px) is
|
|
305
|
-
rel-avatar's smallest preset; used uniformly across all three chip
|
|
306
|
-
sizes since there's nothing smaller to ask for. ── */
|
|
307
|
-
.chip rel-avatar {
|
|
308
|
-
display: inline-flex;
|
|
309
|
-
flex-shrink: 0;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
:host([variant="fill"]) .chip rel-avatar {
|
|
313
|
-
--rel-avatar-bg-fill: var(--rel-action-overlay-hover-inverse);
|
|
314
|
-
--rel-avatar-color-fill: var(--rel-action-neutral-label-icons-fill-inverse);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
:host([variant="subtle"]) .chip rel-avatar {
|
|
318
|
-
--rel-avatar-bg-fill: var(--rel-action-overlay-hover-strong);
|
|
319
|
-
--rel-avatar-color-fill: currentColor;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/* ── Remove (close) button ── */
|
|
323
|
-
.chip-remove {
|
|
324
|
-
display: inline-flex;
|
|
325
|
-
align-items: center;
|
|
326
|
-
justify-content: center;
|
|
327
|
-
flex-shrink: 0;
|
|
328
|
-
cursor: pointer;
|
|
329
|
-
opacity: 0.7;
|
|
330
|
-
background: none;
|
|
331
|
-
border: none;
|
|
332
|
-
color: inherit;
|
|
333
|
-
font: inherit;
|
|
334
|
-
padding: 0;
|
|
335
|
-
line-height: 1;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
.chip-remove:hover {
|
|
339
|
-
opacity: 1;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
.chip-remove:focus-visible {
|
|
343
|
-
outline: 1.5px solid currentColor;
|
|
344
|
-
outline-offset: 1px;
|
|
345
|
-
border-radius: var(--rel-border-radius-xs);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
:host([size="lg"]) .chip-remove {
|
|
349
|
-
--rel-icon-size: 20px;
|
|
350
|
-
}
|
|
351
|
-
:host([size="md"]) .chip-remove {
|
|
352
|
-
--rel-icon-size: 18px;
|
|
353
|
-
}
|
|
354
|
-
:host([size="sm"]) .chip-remove {
|
|
355
|
-
--rel-icon-size: 16px;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
`;
|
|
359
|
-
|
|
360
|
-
private get classes() {
|
|
361
|
-
return "chip";
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
private handleRemove(event: Event) {
|
|
365
|
-
event.stopPropagation();
|
|
366
|
-
this.removed = true;
|
|
367
|
-
|
|
368
|
-
this.dispatchEvent(
|
|
369
|
-
new CustomEvent("removed", {
|
|
370
|
-
bubbles: true,
|
|
371
|
-
composed: true,
|
|
372
|
-
})
|
|
373
|
-
);
|
|
374
|
-
announce(`${this.label} removed`);
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
/** The chip body is announced as a button, so it must also act on keys:
|
|
378
|
-
* Enter/Space re-dispatch as a host click (consumers' @click handlers
|
|
379
|
-
* fire), Delete/Backspace remove when removable, and arrow keys ask the
|
|
380
|
-
* container to reorder a draggable chip (`chip-move`) — the keyboard
|
|
381
|
-
* alternative to pointer drag-and-drop. */
|
|
382
|
-
private handleKeydown = (e: KeyboardEvent) => {
|
|
383
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
384
|
-
e.preventDefault();
|
|
385
|
-
this.click();
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
if ((e.key === "Delete" || e.key === "Backspace") && this.removable) {
|
|
389
|
-
e.preventDefault();
|
|
390
|
-
this.handleRemove(e);
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
if (this.draggableChip && (e.key === "ArrowLeft" || e.key === "ArrowRight")) {
|
|
394
|
-
e.preventDefault();
|
|
395
|
-
this.dispatchEvent(
|
|
396
|
-
new CustomEvent("chip-move", {
|
|
397
|
-
detail: { direction: e.key === "ArrowLeft" ? -1 : 1 },
|
|
398
|
-
bubbles: true,
|
|
399
|
-
composed: true,
|
|
400
|
-
})
|
|
401
|
-
);
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
private onDragStart = (e: DragEvent) => {
|
|
406
|
-
if (!this.draggableChip) return;
|
|
407
|
-
this.dragging = true;
|
|
408
|
-
e.dataTransfer?.setData("text/plain", this.label);
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
private onDragEnd = () => {
|
|
412
|
-
this.dragging = false;
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
protected updated(changed: Map<string, unknown>) {
|
|
416
|
-
if (changed.has("draggableChip")) {
|
|
417
|
-
if (this.draggableChip) {
|
|
418
|
-
this.setAttribute("draggable", "true");
|
|
419
|
-
this.addEventListener("dragstart", this.onDragStart);
|
|
420
|
-
this.addEventListener("dragend", this.onDragEnd);
|
|
421
|
-
} else {
|
|
422
|
-
this.removeAttribute("draggable");
|
|
423
|
-
this.removeEventListener("dragstart", this.onDragStart);
|
|
424
|
-
this.removeEventListener("dragend", this.onDragEnd);
|
|
425
|
-
this.dragging = false;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
if (changed.has("dragging")) {
|
|
429
|
-
this.toggleAttribute("dragging", this.dragging);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
render() {
|
|
434
|
-
const showAvatar = !!this.avatar;
|
|
435
|
-
const showLeadingIcon = !showAvatar && !!this.leadingIcon;
|
|
436
|
-
|
|
437
|
-
if (this.avatar && this.leadingIcon) {
|
|
438
|
-
console.warn(
|
|
439
|
-
"[rel-chip] leadingIcon and avatar are mutually exclusive. avatar takes precedence."
|
|
440
|
-
);
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
return html`
|
|
444
|
-
<span part="base" class="${this.classes}">
|
|
445
|
-
<span
|
|
446
|
-
class="chip-action"
|
|
447
|
-
role="button"
|
|
448
|
-
tabindex="0"
|
|
449
|
-
aria-label="${this.label}"
|
|
450
|
-
@keydown=${this.handleKeydown}
|
|
451
|
-
>
|
|
452
|
-
${showAvatar
|
|
453
|
-
? html`<rel-avatar type="text" text=${this.avatar} size="xs"></rel-avatar>`
|
|
454
|
-
: null}
|
|
455
|
-
${showLeadingIcon
|
|
456
|
-
? html`<rel-icon part="icon" class="chip-icon" name="${this.leadingIcon}"></rel-icon>`
|
|
457
|
-
: null}
|
|
458
|
-
|
|
459
|
-
<span part="label" class="chip-label">${this.label}</span>
|
|
460
|
-
|
|
461
|
-
${this.trailingIcon
|
|
462
|
-
? html`<rel-icon class="chip-icon" name="${this.trailingIcon}"></rel-icon>`
|
|
463
|
-
: null}
|
|
464
|
-
</span>
|
|
465
|
-
${this.removable
|
|
466
|
-
? html`<button
|
|
467
|
-
class="chip-remove"
|
|
468
|
-
aria-label="Remove ${this.label}"
|
|
469
|
-
@click=${this.handleRemove}
|
|
470
|
-
>
|
|
471
|
-
<rel-icon name="close"></rel-icon>
|
|
472
|
-
</button>`
|
|
473
|
-
: null}
|
|
474
|
-
</span>
|
|
475
|
-
`;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
declare global {
|
|
480
|
-
interface HTMLElementTagNameMap {
|
|
481
|
-
"rel-chip": RelChip;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { LitElement, html, css } from "lit";
|
|
2
|
-
import { customElement, property } from "lit/decorators.js";
|
|
3
|
-
|
|
4
|
-
@customElement("rel-container")
|
|
5
|
-
export class RelContainer extends LitElement {
|
|
6
|
-
@property({ type: String, reflect: true }) padding: "sm" | "md" | "lg" | "xl" = "md";
|
|
7
|
-
@property({ type: Boolean }) shadow = false;
|
|
8
|
-
@property({ type: String, reflect: true }) background: "light" | "white" | "none" = "white";
|
|
9
|
-
|
|
10
|
-
static styles = css`
|
|
11
|
-
:host {
|
|
12
|
-
color: var(--rel-text-default);
|
|
13
|
-
display: block;
|
|
14
|
-
width: 100%;
|
|
15
|
-
box-sizing: border-box;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.reliability-container {
|
|
19
|
-
border-radius: var(--rel-border-radius-sm);
|
|
20
|
-
display: block;
|
|
21
|
-
width: 100%;
|
|
22
|
-
box-sizing: border-box;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.bg-white {
|
|
26
|
-
background-color: var(--rel-bg-surface);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.bg-light {
|
|
30
|
-
background-color: var(--rel-bg-surface-elevated);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.bg-none {
|
|
34
|
-
background: transparent;
|
|
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
|
-
|
|
58
|
-
.padding-sm {
|
|
59
|
-
padding: var(--rel-spacing-xs);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.padding-md {
|
|
63
|
-
padding: var(--rel-spacing-md);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.padding-lg {
|
|
67
|
-
padding: var(--rel-spacing-xl);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.padding-xl {
|
|
71
|
-
padding: var(--rel-spacing-2xl);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.shadow {
|
|
75
|
-
box-shadow: var(--rel-shadows-shadow-300);
|
|
76
|
-
}
|
|
77
|
-
`;
|
|
78
|
-
|
|
79
|
-
private get classes() {
|
|
80
|
-
return [
|
|
81
|
-
"reliability-container",
|
|
82
|
-
`bg-${this.background}`,
|
|
83
|
-
`padding-${this.padding}`,
|
|
84
|
-
this.shadow ? "shadow" : "",
|
|
85
|
-
].join(" ");
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
render() {
|
|
89
|
-
return html`
|
|
90
|
-
<div part="base container" class="${this.classes}">
|
|
91
|
-
<slot></slot>
|
|
92
|
-
</div>
|
|
93
|
-
`;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Token-based date formatting for rel-date-picker's selected-value display.
|
|
3
|
-
*
|
|
4
|
-
* Pure (Date + Intl only, no DOM) so it is unit-testable in Node. Tokens are
|
|
5
|
-
* matched longest-first; anything else (separators like `-` `/` `.` and spaces)
|
|
6
|
-
* passes through literally. Wrap literal text that contains token letters in
|
|
7
|
-
* square brackets, e.g. `[Week of] YYYY-MM-DD`.
|
|
8
|
-
*
|
|
9
|
-
* | Token | Meaning | Example (2026-07-21) |
|
|
10
|
-
* |-------|------------------------|----------------------|
|
|
11
|
-
* | YYYY | 4-digit year | 2026 |
|
|
12
|
-
* | YY | 2-digit year | 26 |
|
|
13
|
-
* | MMMM | full month (locale) | July |
|
|
14
|
-
* | MMM | short month (locale) | Jul |
|
|
15
|
-
* | MM | 2-digit month | 07 |
|
|
16
|
-
* | M | month number | 7 |
|
|
17
|
-
* | DD | 2-digit day | 21 |
|
|
18
|
-
* | D | day number | 21 |
|
|
19
|
-
*/
|
|
20
|
-
export function formatDatePattern(
|
|
21
|
-
date: Date,
|
|
22
|
-
pattern: string,
|
|
23
|
-
locale = "en-US"
|
|
24
|
-
): string {
|
|
25
|
-
const pad = (n: number) => String(n).padStart(2, "0");
|
|
26
|
-
const year = date.getFullYear();
|
|
27
|
-
const month = date.getMonth() + 1;
|
|
28
|
-
const day = date.getDate();
|
|
29
|
-
|
|
30
|
-
const tokens: Record<string, string> = {
|
|
31
|
-
YYYY: String(year),
|
|
32
|
-
YY: String(year).slice(-2),
|
|
33
|
-
MMMM: new Intl.DateTimeFormat(locale, { month: "long" }).format(date),
|
|
34
|
-
MMM: new Intl.DateTimeFormat(locale, { month: "short" }).format(date),
|
|
35
|
-
MM: pad(month),
|
|
36
|
-
M: String(month),
|
|
37
|
-
DD: pad(day),
|
|
38
|
-
D: String(day),
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// `\[([^\]]*)\]` captures a bracketed literal (emitted without the brackets);
|
|
42
|
-
// otherwise the matched token is substituted from the map.
|
|
43
|
-
return pattern.replace(
|
|
44
|
-
/\[([^\]]*)\]|YYYY|YY|MMMM|MMM|MM|M|DD|D/g,
|
|
45
|
-
(match, literal) => (literal !== undefined ? literal : tokens[match])
|
|
46
|
-
);
|
|
47
|
-
}
|