@reliability-design/web 1.0.3 → 1.1.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/README.md +132 -0
- package/dist/components/rel-accordion/rel-accordion.ts +47 -16
- package/dist/components/rel-alert/README.md +141 -0
- package/dist/components/rel-alert/rel-alert.ts +101 -20
- package/dist/components/rel-avatar/README.md +119 -0
- package/dist/components/rel-avatar/rel-avatar.ts +3 -2
- package/dist/components/rel-badge/README.md +86 -0
- package/dist/components/rel-badge/rel-badge.ts +11 -7
- package/dist/components/rel-breadcrumb/README.md +102 -0
- package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +12 -6
- package/dist/components/rel-button/README.md +130 -0
- package/dist/components/rel-button/rel-button.ts +64 -8
- package/dist/components/rel-calendar/README.md +109 -0
- package/dist/components/rel-calendar/index.ts +1 -0
- package/dist/components/rel-calendar/rel-calendar.ts +467 -0
- package/dist/components/rel-card/README.md +94 -0
- package/dist/components/rel-card/rel-card.ts +12 -3
- package/dist/components/rel-cardmedia/README.md +127 -0
- package/dist/components/rel-cardmedia/rel-cardmedia.ts +14 -4
- package/dist/components/rel-carousel/README.md +166 -0
- package/dist/components/rel-carousel/index.ts +1 -0
- package/dist/components/rel-carousel/rel-carousel.ts +468 -0
- package/dist/components/rel-chart/README.md +286 -0
- package/dist/components/rel-chart/index.ts +1 -0
- package/dist/components/rel-chart/rel-chart.ts +736 -0
- package/dist/components/rel-checkbox/README.md +77 -0
- package/dist/components/rel-checkbox/rel-checkbox.ts +51 -12
- package/dist/components/rel-chip/README.md +114 -0
- package/dist/components/rel-chip/rel-chip.ts +83 -9
- package/dist/components/rel-container/README.md +99 -0
- package/dist/components/rel-date-picker/README.md +253 -0
- package/dist/components/rel-date-picker/index.ts +1 -0
- package/dist/components/rel-date-picker/rel-date-picker.ts +916 -0
- package/dist/components/rel-divider/README.md +100 -0
- package/dist/components/rel-divider/rel-divider.ts +9 -0
- package/dist/components/rel-drawer/README.md +200 -0
- package/dist/components/rel-drawer/index.ts +1 -0
- package/dist/components/rel-drawer/rel-drawer-footer.ts +29 -0
- package/dist/components/rel-drawer/rel-drawer.ts +612 -0
- package/dist/components/rel-kbd/README.md +151 -0
- package/dist/components/rel-kbd/rel-kbd.ts +118 -0
- package/dist/components/rel-layout/README.md +88 -0
- package/dist/components/rel-menu/README.md +151 -0
- package/dist/components/rel-menu/rel-menu.ts +64 -24
- package/dist/components/rel-menubar/README.md +329 -0
- package/dist/components/rel-menubar/index.ts +2 -0
- package/dist/components/rel-menubar/rel-menubar-menu.ts +16 -0
- package/dist/components/rel-menubar/rel-menubar.ts +605 -0
- package/dist/components/rel-nav-menu/README.md +289 -0
- package/dist/components/rel-nav-menu/index.ts +3 -0
- package/dist/components/rel-nav-menu/rel-nav-menu-item.ts +240 -0
- package/dist/components/rel-nav-menu/rel-nav-menu-panel.ts +53 -0
- package/dist/components/rel-nav-menu/rel-nav-menu.ts +227 -0
- package/dist/components/rel-navbar/README.md +126 -0
- package/dist/components/rel-navbar/rel-navbar.ts +104 -0
- package/dist/components/rel-otp/README.md +440 -0
- package/dist/components/rel-otp/index.ts +1 -0
- package/dist/components/rel-otp/rel-otp.ts +504 -0
- package/dist/components/rel-pagination/README.md +410 -0
- package/dist/components/rel-pagination/index.ts +1 -0
- package/dist/components/rel-pagination/rel-pagination.ts +381 -0
- package/dist/components/rel-popover/README.md +568 -0
- package/dist/components/rel-popover/index.ts +2 -0
- package/dist/components/rel-popover/rel-popover-content.ts +55 -0
- package/dist/components/rel-popover/rel-popover.ts +330 -0
- package/dist/components/rel-progress/README.md +110 -0
- package/dist/components/rel-progress/rel-progress.ts +32 -5
- package/dist/components/rel-radio/README.md +120 -0
- package/dist/components/rel-radio/rel-radio.ts +31 -6
- package/dist/components/rel-resizable/README.md +140 -0
- package/dist/components/rel-resizable/index.ts +3 -0
- package/dist/components/rel-resizable/rel-resizable-group.ts +374 -0
- package/dist/components/rel-resizable/rel-resizable-handle.ts +145 -0
- package/dist/components/rel-resizable/rel-resizable-panel.ts +47 -0
- package/dist/components/rel-segmented-button/README.md +141 -0
- package/dist/components/rel-segmented-button/rel-segmented-button.ts +18 -13
- package/dist/components/rel-select/README.md +107 -0
- package/dist/components/rel-select/rel-select.ts +28 -14
- package/dist/components/rel-sheet/README.md +224 -0
- package/dist/components/rel-sheet/rel-sheet.ts +684 -0
- package/dist/components/rel-sidebar/README.md +209 -0
- package/dist/components/rel-sidebar/rel-sidebar.ts +1166 -0
- package/dist/components/rel-slider/README.md +135 -0
- package/dist/components/rel-slider/rel-slider.ts +44 -9
- package/dist/components/rel-snackbar/README.md +134 -0
- package/dist/components/rel-snackbar/rel-snackbar.ts +109 -14
- package/dist/components/rel-stepper/README.md +160 -0
- package/dist/components/rel-stepper/rel-stepper.ts +38 -27
- package/dist/components/rel-switch/README.md +102 -0
- package/dist/components/rel-switch/rel-switch.ts +34 -12
- package/dist/components/rel-tab/README.md +163 -0
- package/dist/components/rel-tab/rel-tab.ts +79 -23
- package/dist/components/rel-table/README.md +178 -0
- package/dist/components/rel-table/rel-table-body.ts +21 -0
- package/dist/components/rel-table/rel-table-caption.ts +27 -0
- package/dist/components/rel-table/rel-table-cell.ts +42 -0
- package/dist/components/rel-table/rel-table-footer.ts +23 -0
- package/dist/components/rel-table/rel-table-head.ts +45 -0
- package/dist/components/rel-table/rel-table-header.ts +21 -0
- package/dist/components/rel-table/rel-table-row.ts +36 -0
- package/dist/components/rel-table/rel-table.ts +53 -0
- package/dist/components/rel-textfield/README.md +90 -0
- package/dist/components/rel-textfield/rel-textfield.ts +55 -39
- package/dist/components/rel-toast/README.md +148 -0
- package/dist/components/rel-toast/rel-toast.ts +63 -24
- package/dist/components/rel-tooltip/README.md +103 -0
- package/dist/components/rel-tooltip/rel-tooltip.ts +123 -80
- package/dist/components/rel-topbar/rel-topbar-actions.ts +23 -0
- package/dist/components/rel-topbar/rel-topbar-brand.ts +46 -0
- package/dist/components/rel-topbar/rel-topbar-dropdown-item.ts +33 -0
- package/dist/components/rel-topbar/rel-topbar-dropdown.ts +28 -0
- package/dist/components/rel-topbar/rel-topbar-item.ts +315 -0
- package/dist/components/rel-topbar/rel-topbar-mobile-panel.ts +23 -0
- package/dist/components/rel-topbar/rel-topbar-profile.ts +248 -0
- package/dist/components/rel-topbar/rel-topbar-utilities.ts +23 -0
- package/dist/components/rel-topbar/rel-topbar.ts +329 -0
- package/dist/index.d.mts +831 -7
- package/dist/index.d.ts +831 -7
- package/dist/index.js +9500 -1564
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9240 -1344
- package/dist/index.mjs.map +1 -1
- package/dist/styles/vars.css +187 -25
- package/dist/vars-TBB4BMSD.css +346 -0
- package/package.json +2 -1
- package/dist/vars-6ZIUPIU4.css +0 -184
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# rel-checkbox
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
A tri-state checkbox component supporting checked, unchecked, and indeterminate states. Includes label and supporting text with built-in error and disabled states for form validation scenarios.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
```html
|
|
8
|
+
<!-- Basic example -->
|
|
9
|
+
<rel-checkbox label="Accept terms"></rel-checkbox>
|
|
10
|
+
|
|
11
|
+
<!-- Example with common options -->
|
|
12
|
+
<rel-checkbox
|
|
13
|
+
label="Subscribe to newsletter"
|
|
14
|
+
supportingtext="We'll send you weekly updates"
|
|
15
|
+
status="unchecked"
|
|
16
|
+
state="default">
|
|
17
|
+
</rel-checkbox>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## API
|
|
21
|
+
|
|
22
|
+
### Attributes/Properties
|
|
23
|
+
| Name | Type | Default | Description |
|
|
24
|
+
|------|------|---------|-------------|
|
|
25
|
+
| `label` | `string` | `"Label"` | Label text displayed next to the checkbox |
|
|
26
|
+
| `supportingtext` | `string` | `""` | Helper text displayed below the checkbox and label |
|
|
27
|
+
| `state` | `"default" \| "error" \| "disabled"` | `"default"` | Visual and interaction state of the checkbox |
|
|
28
|
+
| `status` | `"unchecked" \| "checked" \| "indeterminate"` | `"unchecked"` | Current checked state of the checkbox |
|
|
29
|
+
|
|
30
|
+
## Events
|
|
31
|
+
| Event | Detail | Description |
|
|
32
|
+
|-------|--------|-------------|
|
|
33
|
+
| `change` | `{ checked: boolean, indeterminate: boolean }` | Fired when checkbox state changes through user interaction |
|
|
34
|
+
|
|
35
|
+
## Slots
|
|
36
|
+
Default slot not used.
|
|
37
|
+
|
|
38
|
+
## CSS Parts
|
|
39
|
+
None exposed.
|
|
40
|
+
|
|
41
|
+
## Tokens / CSS Variables
|
|
42
|
+
|
|
43
|
+
### Semantic Tokens
|
|
44
|
+
- `--rel-fontFamilies-primary` - Font family
|
|
45
|
+
- `--rel-fontSizes-md`, `--rel-fontSizes-sm` - Font sizes for label and supporting text
|
|
46
|
+
- `--rel-fontWeights-medium` - Font weight for label
|
|
47
|
+
|
|
48
|
+
### Color Tokens
|
|
49
|
+
- `--rel-text-heading` - Checkbox border and checked background color
|
|
50
|
+
- `--rel-colors-white` - Checkbox background and checkmark color
|
|
51
|
+
- `--rel-text-primary` - Label text color
|
|
52
|
+
- `--rel-text-placeholder` - Supporting text color
|
|
53
|
+
- `--rel-colors-red-primary` - Error state border and background color
|
|
54
|
+
- `--rel-border-info` - Focus outline color
|
|
55
|
+
|
|
56
|
+
## Accessibility
|
|
57
|
+
- Uses visually hidden native checkbox input for screen reader support
|
|
58
|
+
- Custom visual checkbox with proper focus indicators
|
|
59
|
+
- Focus visible state with outline offset for keyboard users
|
|
60
|
+
- Label click targets the checkbox for larger interaction area
|
|
61
|
+
- Disabled state communicated through opacity reduction and cursor change
|
|
62
|
+
|
|
63
|
+
### Keyboard Interactions
|
|
64
|
+
- `Space` - Toggle checkbox state
|
|
65
|
+
- `Tab` - Move focus to/from checkbox
|
|
66
|
+
|
|
67
|
+
### Focus Behavior
|
|
68
|
+
- Focus outline appears with offset around the custom checkbox box
|
|
69
|
+
- Uses info border color for high contrast
|
|
70
|
+
|
|
71
|
+
## Notes / Edge Cases
|
|
72
|
+
- Clicking cycles through three states in order: unchecked → checked → indeterminate → unchecked (repeating)
|
|
73
|
+
- When `state="disabled"`, click events are blocked and opacity is reduced to 0.55
|
|
74
|
+
- The indeterminate state displays a horizontal line instead of a checkmark
|
|
75
|
+
- In error state, the checkbox border and checked background use error color
|
|
76
|
+
- Supporting text is positioned below with left padding to align with checkbox content
|
|
77
|
+
- Native checkbox input is visually hidden but maintains accessibility features
|
|
@@ -10,6 +10,17 @@ export class RelCheckbox extends LitElement {
|
|
|
10
10
|
@property({ type: String }) supportingtext = "";
|
|
11
11
|
@property({ type: String }) state: CheckboxState = "default";
|
|
12
12
|
@property({ type: String }) status: CheckboxStatus = "unchecked";
|
|
13
|
+
@property({ type: String }) value = "";
|
|
14
|
+
|
|
15
|
+
get checked(): boolean {
|
|
16
|
+
return this.status === "checked";
|
|
17
|
+
}
|
|
18
|
+
set checked(val: boolean) {
|
|
19
|
+
this.status = val ? "checked" : "unchecked";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
private _onChange: (value: boolean) => void = () => {};
|
|
23
|
+
private _onTouched: () => void = () => {};
|
|
13
24
|
|
|
14
25
|
static styles = css`
|
|
15
26
|
:host {
|
|
@@ -40,12 +51,18 @@ export class RelCheckbox extends LitElement {
|
|
|
40
51
|
width: 18px;
|
|
41
52
|
height: 18px;
|
|
42
53
|
border-radius: 4px;
|
|
43
|
-
border: 2px solid var(--rel-
|
|
44
|
-
background: var(--rel-colors-white);
|
|
54
|
+
border: 2px solid var(--rel-text-heading, #2b2b2b);
|
|
55
|
+
background: var(--rel-colors-white, #fff);
|
|
45
56
|
display: flex;
|
|
46
57
|
align-items: center;
|
|
47
58
|
justify-content: center;
|
|
48
59
|
transition: all 0.2s;
|
|
60
|
+
flex-shrink: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
input:focus-visible + .box {
|
|
64
|
+
outline: 2px solid var(--rel-border-info, #0091ea);
|
|
65
|
+
outline-offset: 2px;
|
|
49
66
|
}
|
|
50
67
|
|
|
51
68
|
svg {
|
|
@@ -56,8 +73,8 @@ export class RelCheckbox extends LitElement {
|
|
|
56
73
|
|
|
57
74
|
.checked .box,
|
|
58
75
|
.indeterminate .box {
|
|
59
|
-
background: var(--rel-
|
|
60
|
-
border-color: var(--rel-
|
|
76
|
+
background: var(--rel-text-heading, #2b2b2b);
|
|
77
|
+
border-color: var(--rel-text-heading, #2b2b2b);
|
|
61
78
|
}
|
|
62
79
|
|
|
63
80
|
.checked .check-icon {
|
|
@@ -78,19 +95,35 @@ export class RelCheckbox extends LitElement {
|
|
|
78
95
|
border-color: var(--rel-colors-red-primary);
|
|
79
96
|
}
|
|
80
97
|
|
|
98
|
+
/* Pin checkmark/dash to white on red background — correct in both themes */
|
|
99
|
+
.error.checked svg,
|
|
100
|
+
.error.indeterminate svg {
|
|
101
|
+
fill: #ffffff;
|
|
102
|
+
}
|
|
103
|
+
|
|
81
104
|
.disabled {
|
|
82
105
|
opacity: 0.55;
|
|
83
106
|
cursor: not-allowed;
|
|
84
107
|
}
|
|
85
108
|
|
|
109
|
+
:host([state="disabled"]) {
|
|
110
|
+
cursor: not-allowed;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
:host([state="disabled"]) * {
|
|
114
|
+
pointer-events: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
86
117
|
.label {
|
|
87
|
-
font-size: var(--rel-fontSizes-md);
|
|
88
|
-
font-weight: var(--rel-fontWeights-medium);
|
|
118
|
+
font-size: var(--rel-fontSizes-md, 14px);
|
|
119
|
+
font-weight: var(--rel-fontWeights-medium, 500);
|
|
120
|
+
color: var(--rel-text-primary, #333);
|
|
89
121
|
}
|
|
90
122
|
|
|
91
123
|
.text {
|
|
92
|
-
font-size: var(--rel-fontSizes-sm);
|
|
93
|
-
color: var(--rel-
|
|
124
|
+
font-size: var(--rel-fontSizes-sm, 12px);
|
|
125
|
+
color: var(--rel-text-placeholder, #a9a9a9);
|
|
126
|
+
padding-left: 28px;
|
|
94
127
|
}
|
|
95
128
|
`;
|
|
96
129
|
|
|
@@ -102,17 +135,22 @@ export class RelCheckbox extends LitElement {
|
|
|
102
135
|
else this.status = "unchecked";
|
|
103
136
|
|
|
104
137
|
this.dispatchEvent(
|
|
105
|
-
new CustomEvent("change", {
|
|
138
|
+
new CustomEvent("rel-change", {
|
|
106
139
|
detail: {
|
|
107
140
|
checked: this.status === "checked",
|
|
108
|
-
|
|
141
|
+
value: this.value,
|
|
109
142
|
},
|
|
110
143
|
bubbles: true,
|
|
111
144
|
composed: true,
|
|
112
145
|
})
|
|
113
146
|
);
|
|
147
|
+
this._onChange(this.checked);
|
|
114
148
|
}
|
|
115
149
|
|
|
150
|
+
registerOnChange(fn: (value: boolean) => void): void { this._onChange = fn; }
|
|
151
|
+
registerOnTouched(fn: () => void): void { this._onTouched = fn; }
|
|
152
|
+
writeValue(checked: boolean): void { this.checked = checked; }
|
|
153
|
+
|
|
116
154
|
render() {
|
|
117
155
|
return html`
|
|
118
156
|
<div class="wrapper ${this.state} ${this.status}">
|
|
@@ -120,17 +158,18 @@ export class RelCheckbox extends LitElement {
|
|
|
120
158
|
<input
|
|
121
159
|
type="checkbox"
|
|
122
160
|
@click=${this.toggle}
|
|
161
|
+
@blur=${() => this._onTouched()}
|
|
123
162
|
?disabled=${this.state === "disabled"}
|
|
124
163
|
/>
|
|
125
164
|
|
|
126
165
|
<span class="box">
|
|
127
|
-
<svg class="check-icon" viewBox="0 0 18 14" fill="white">
|
|
166
|
+
<svg class="check-icon" viewBox="0 0 18 14" fill="var(--rel-colors-white, #fff)">
|
|
128
167
|
<path
|
|
129
168
|
d="M6.44 14L0.5 7.36l1.49-1.66L6.44 10.68 16.01 0 17.5 1.66z"
|
|
130
169
|
/>
|
|
131
170
|
</svg>
|
|
132
171
|
|
|
133
|
-
<svg class="indeterminate-icon" viewBox="0 0 16 2" fill="white">
|
|
172
|
+
<svg class="indeterminate-icon" viewBox="0 0 16 2" fill="var(--rel-colors-white, #fff)">
|
|
134
173
|
<rect width="16" height="2" />
|
|
135
174
|
</svg>
|
|
136
175
|
</span>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# rel-chip
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
A compact chip component for displaying tags, labels, or selected options. Supports multiple color tones, avatar/icon decorations, outline variants, and removable functionality. Automatically hides when removed via the `removed` reflected attribute.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
```html
|
|
8
|
+
<!-- Basic chip -->
|
|
9
|
+
<rel-chip label="Active"></rel-chip>
|
|
10
|
+
|
|
11
|
+
<!-- Colored tones -->
|
|
12
|
+
<rel-chip label="Info" tone="blue"></rel-chip>
|
|
13
|
+
<rel-chip label="Warning" tone="yellow"></rel-chip>
|
|
14
|
+
<rel-chip label="Error" tone="red"></rel-chip>
|
|
15
|
+
<rel-chip label="Success" tone="green"></rel-chip>
|
|
16
|
+
|
|
17
|
+
<!-- Outline variant -->
|
|
18
|
+
<rel-chip label="Outline Style" tone="blue" outline></rel-chip>
|
|
19
|
+
|
|
20
|
+
<!-- With avatar -->
|
|
21
|
+
<rel-chip id="avatarChip" label="John Doe" avatar="./user.jpg"></rel-chip>
|
|
22
|
+
|
|
23
|
+
<!-- With leading icon (SVG string via JS) -->
|
|
24
|
+
<rel-chip id="iconChip" label="Tagged"></rel-chip>
|
|
25
|
+
<script>
|
|
26
|
+
const chip = document.getElementById('iconChip');
|
|
27
|
+
chip.leadingIcon = '<svg viewBox="0 0 16 16"><path d="M8 0l2 6h6l-5 4 2 6-5-4-5 4 2-6-5-4h6z"/></svg>';
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<!-- Removable chip -->
|
|
31
|
+
<rel-chip id="removableChip" label="Removable" removable></rel-chip>
|
|
32
|
+
<script>
|
|
33
|
+
const removableChip = document.getElementById('removableChip');
|
|
34
|
+
removableChip.addEventListener('removed', () => {
|
|
35
|
+
console.log('Chip was removed');
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## API
|
|
41
|
+
|
|
42
|
+
### Attributes/Properties
|
|
43
|
+
| Name | Type | Default | Description |
|
|
44
|
+
|------|------|---------|-------------|
|
|
45
|
+
| `label` | `string` | `"Label"` | Text displayed on the chip |
|
|
46
|
+
| `tone` | `"default" \| "blue" \| "yellow" \| "red" \| "green"` | `"default"` | Color tone variant |
|
|
47
|
+
| `leadingIcon` | `string` | - | SVG or HTML string for leading icon |
|
|
48
|
+
| `trailingIcon` | `string` | - | SVG or HTML string for trailing icon |
|
|
49
|
+
| `avatar` | `string` | - | Image URL for avatar (circular image before label) |
|
|
50
|
+
| `removable` | `boolean` | `false` | Shows a remove button (✕) |
|
|
51
|
+
| `outline` | `boolean` | `false` | Applies outline styling (transparent background) |
|
|
52
|
+
| `removed` | `boolean` (reflected) | `false` | When true, component hides via `:host([removed])` |
|
|
53
|
+
|
|
54
|
+
## Events
|
|
55
|
+
| Event | Detail | Description |
|
|
56
|
+
|-------|--------|-------------|
|
|
57
|
+
| `removed` | None | Fired when the remove button is clicked (sets `removed` to true) |
|
|
58
|
+
|
|
59
|
+
## Slots
|
|
60
|
+
Default slot not used.
|
|
61
|
+
|
|
62
|
+
## CSS Parts
|
|
63
|
+
None exposed.
|
|
64
|
+
|
|
65
|
+
## Tokens / CSS Variables
|
|
66
|
+
|
|
67
|
+
### Semantic Tokens
|
|
68
|
+
- `--rel-fontFamilies-primary` - Font family
|
|
69
|
+
- `--rel-fontSizes-md` - Font size
|
|
70
|
+
- `--rel-fontWeights-medium` - Font weight
|
|
71
|
+
|
|
72
|
+
### Spacing Tokens
|
|
73
|
+
- `--rel-spacing-space-2xs` - Padding and internal gaps
|
|
74
|
+
- `--rel-spacing-space-sm` - Horizontal padding
|
|
75
|
+
- `--rel-spacing-space-3xs` - Remove button margin
|
|
76
|
+
|
|
77
|
+
### Color Tokens (by tone)
|
|
78
|
+
- **default**: `--rel-colors-gray-border` (background), `--rel-colors-black` (text)
|
|
79
|
+
- **blue**: `--rel-colors-blue-tertiary` (background), `--rel-colors-white` (text)
|
|
80
|
+
- **yellow**: `--rel-colors-yellow-pending` (background), `--rel-colors-black` (text)
|
|
81
|
+
- **red**: `--rel-colors-red-secondary` (background), `--rel-colors-white` (text)
|
|
82
|
+
- **green**: `--rel-colors-green-success` (background), `--rel-colors-white` (text)
|
|
83
|
+
|
|
84
|
+
### Border & Shadow Tokens
|
|
85
|
+
- `--rel-borders-radius-border-radius-500` - Border radius (pill shape)
|
|
86
|
+
- `--rel-borders-width-stroke-100` - Border width (used in outline mode)
|
|
87
|
+
- `--rel-shadows-shadow-100` - Hover shadow
|
|
88
|
+
- `--rel-colors-blue-primary` - Focus outline color
|
|
89
|
+
|
|
90
|
+
## Accessibility
|
|
91
|
+
- Uses `role="button"` and `tabindex="0"` on the main chip element
|
|
92
|
+
- `aria-label` set to the chip's label
|
|
93
|
+
- Remove button has proper `aria-label="Remove {label}"`
|
|
94
|
+
- Focus visible states on chip and remove button with distinct outlines
|
|
95
|
+
- Remove button focus uses white outline for contrast against colored backgrounds
|
|
96
|
+
|
|
97
|
+
### Keyboard Interactions
|
|
98
|
+
- `Tab` - Focus the chip (or remove button if present)
|
|
99
|
+
- No built-in activation behavior on Enter/Space (purely informational/decorative)
|
|
100
|
+
|
|
101
|
+
### Focus Behavior
|
|
102
|
+
- Chip focus: 2px blue outline with 2px offset
|
|
103
|
+
- Remove button focus: 2px white outline with 1px offset
|
|
104
|
+
|
|
105
|
+
## Notes / Edge Cases
|
|
106
|
+
- Icons (`leadingIcon`, `trailingIcon`) must be passed as raw HTML/SVG strings via JavaScript (see examples)
|
|
107
|
+
- Icons are injected using `renderIcon()` which creates a template element and clones the content
|
|
108
|
+
- Avatar images are 20px × 20px circular (`border-radius: 50%`, `object-fit: cover`)
|
|
109
|
+
- When `removed` is set to `true`, the component applies `display: none` via `:host([removed])`
|
|
110
|
+
- `removed` is a reflected attribute, meaning it appears in the HTML when true
|
|
111
|
+
- Clicking the remove button stops propagation to prevent triggering chip-level click handlers
|
|
112
|
+
- **Outline mode** removes the background color but keeps the same text color
|
|
113
|
+
- Hover effect applies `filter: brightness(0.92)` and box-shadow
|
|
114
|
+
- The component is `display: inline-block`, so chips flow inline by default
|
|
@@ -48,35 +48,65 @@ export class RelChip extends LitElement {
|
|
|
48
48
|
box-shadow: var(--rel-shadows-shadow-100);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
.chip:focus-visible {
|
|
52
|
+
outline: 2px solid var(--rel-colors-blue-primary, #0091ea);
|
|
53
|
+
outline-offset: 2px;
|
|
54
|
+
}
|
|
55
|
+
|
|
51
56
|
/* TONES */
|
|
52
57
|
.chip-default {
|
|
53
58
|
background: var(--rel-colors-gray-border);
|
|
54
|
-
color:
|
|
59
|
+
color: #000000;
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
.chip-blue {
|
|
58
63
|
background: var(--rel-colors-blue-tertiary);
|
|
59
|
-
color:
|
|
64
|
+
color: #ffffff;
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
.chip-yellow {
|
|
63
68
|
background: var(--rel-colors-yellow-pending);
|
|
64
|
-
color:
|
|
69
|
+
color: #000000;
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
.chip-red {
|
|
68
73
|
background: var(--rel-colors-red-secondary);
|
|
69
|
-
color:
|
|
74
|
+
color: #ffffff;
|
|
70
75
|
}
|
|
71
76
|
|
|
72
77
|
.chip-green {
|
|
73
78
|
background: var(--rel-colors-green-success);
|
|
74
|
-
color:
|
|
79
|
+
color: #ffffff;
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
/* OUTLINE */
|
|
78
83
|
.chip-outline {
|
|
79
84
|
background: transparent;
|
|
85
|
+
border-color: var(--rel-color-border-default);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.chip-blue.chip-outline {
|
|
89
|
+
color: #000000;
|
|
90
|
+
background: transparent;
|
|
91
|
+
border-color: #0059F4;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.chip-red.chip-outline {
|
|
95
|
+
color: #9C1E33;
|
|
96
|
+
background: transparent;
|
|
97
|
+
border-color: #9C1E33;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.chip-green.chip-outline {
|
|
101
|
+
color: #00A86B;
|
|
102
|
+
background: transparent;
|
|
103
|
+
border-color: #00A86B;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.chip-yellow.chip-outline {
|
|
107
|
+
color: #92400E;
|
|
108
|
+
background: transparent;
|
|
109
|
+
border-color: #F2915C;
|
|
80
110
|
}
|
|
81
111
|
|
|
82
112
|
.chip-avatar {
|
|
@@ -86,6 +116,20 @@ export class RelChip extends LitElement {
|
|
|
86
116
|
object-fit: cover;
|
|
87
117
|
}
|
|
88
118
|
|
|
119
|
+
.chip-icon {
|
|
120
|
+
display: inline-flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
width: 14px;
|
|
124
|
+
height: 14px;
|
|
125
|
+
flex-shrink: 0;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.chip-icon * {
|
|
129
|
+
width: 100%;
|
|
130
|
+
height: 100%;
|
|
131
|
+
}
|
|
132
|
+
|
|
89
133
|
.chip-icon ::slotted(svg),
|
|
90
134
|
.chip-icon svg {
|
|
91
135
|
width: 16px;
|
|
@@ -97,11 +141,42 @@ export class RelChip extends LitElement {
|
|
|
97
141
|
margin-left: var(--rel-spacing-space-3xs);
|
|
98
142
|
cursor: pointer;
|
|
99
143
|
opacity: 0.7;
|
|
144
|
+
background: none;
|
|
145
|
+
border: none;
|
|
146
|
+
color: inherit;
|
|
147
|
+
font: inherit;
|
|
148
|
+
padding: 0;
|
|
149
|
+
line-height: 1;
|
|
100
150
|
}
|
|
101
151
|
|
|
102
152
|
.chip-remove:hover {
|
|
103
153
|
opacity: 1;
|
|
104
154
|
}
|
|
155
|
+
|
|
156
|
+
.chip-remove:focus-visible {
|
|
157
|
+
outline: 2px solid var(--rel-colors-white, #fff);
|
|
158
|
+
outline-offset: 1px;
|
|
159
|
+
border-radius: 2px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* Dark mode overrides */
|
|
163
|
+
:host-context([data-theme="dark"]) .chip-default,
|
|
164
|
+
:host-context(.dark) .chip-default {
|
|
165
|
+
color: #ffffff;
|
|
166
|
+
background: var(--rel-color-bg-secondary);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
:host-context([data-theme="dark"]) .chip-default.chip-outline,
|
|
170
|
+
:host-context(.dark) .chip-default.chip-outline {
|
|
171
|
+
color: #ffffff;
|
|
172
|
+
border-color: #ffffff;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
:host-context([data-theme="dark"]) .chip-outline,
|
|
176
|
+
:host-context(.dark) .chip-outline {
|
|
177
|
+
color: #ffffff;
|
|
178
|
+
border-color: currentColor;
|
|
179
|
+
}
|
|
105
180
|
`;
|
|
106
181
|
|
|
107
182
|
private get classes() {
|
|
@@ -149,14 +224,13 @@ export class RelChip extends LitElement {
|
|
|
149
224
|
</span>`
|
|
150
225
|
: null}
|
|
151
226
|
${this.removable
|
|
152
|
-
? html`<
|
|
227
|
+
? html`<button
|
|
153
228
|
class="chip-remove"
|
|
154
|
-
|
|
155
|
-
aria-label="Remove chip"
|
|
229
|
+
aria-label="Remove ${this.label}"
|
|
156
230
|
@click=${this.handleRemove}
|
|
157
231
|
>
|
|
158
232
|
✕
|
|
159
|
-
</
|
|
233
|
+
</button>`
|
|
160
234
|
: null}
|
|
161
235
|
</span>
|
|
162
236
|
`;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# rel-container
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
A versatile container component providing configurable padding, background colors, and optional shadow. Ideal for wrapping content sections with consistent spacing and theming.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
```html
|
|
8
|
+
<!-- Default container (white background, medium padding) -->
|
|
9
|
+
<rel-container>
|
|
10
|
+
<h2>Section Title</h2>
|
|
11
|
+
<p>Content goes here</p>
|
|
12
|
+
</rel-container>
|
|
13
|
+
|
|
14
|
+
<!-- Light background with small padding -->
|
|
15
|
+
<rel-container background="light" padding="sm">
|
|
16
|
+
<p>Compact section with light background</p>
|
|
17
|
+
</rel-container>
|
|
18
|
+
|
|
19
|
+
<!-- Large padding with shadow -->
|
|
20
|
+
<rel-container padding="lg" shadow>
|
|
21
|
+
<h1>Hero Section</h1>
|
|
22
|
+
<p>With shadow elevation</p>
|
|
23
|
+
</rel-container>
|
|
24
|
+
|
|
25
|
+
<!-- Transparent background -->
|
|
26
|
+
<rel-container background="none">
|
|
27
|
+
<div>Content with transparent background</div>
|
|
28
|
+
</rel-container>
|
|
29
|
+
|
|
30
|
+
<!-- All options combined -->
|
|
31
|
+
<rel-container background="white" padding="md" shadow>
|
|
32
|
+
<h3>Card-like Container</h3>
|
|
33
|
+
<p>White background, medium padding, with shadow</p>
|
|
34
|
+
</rel-container>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## API
|
|
38
|
+
|
|
39
|
+
### Attributes/Properties
|
|
40
|
+
| Name | Type | Default | Description |
|
|
41
|
+
|------|------|---------|-------------|
|
|
42
|
+
| `padding` | `"sm" \| "md" \| "lg"` | `"md"` | Padding size variant |
|
|
43
|
+
| `shadow` | `boolean` | `false` | Enable box shadow |
|
|
44
|
+
| `background` | `"light" \| "white" \| "none"` | `"white"` | Background color variant |
|
|
45
|
+
|
|
46
|
+
## Events
|
|
47
|
+
None.
|
|
48
|
+
|
|
49
|
+
## Slots
|
|
50
|
+
| Slot | Description |
|
|
51
|
+
|------|-------------|
|
|
52
|
+
| (default) | Container content (any HTML elements) |
|
|
53
|
+
|
|
54
|
+
## CSS Parts
|
|
55
|
+
None exposed.
|
|
56
|
+
|
|
57
|
+
## Tokens / CSS Variables
|
|
58
|
+
|
|
59
|
+
### Color Tokens
|
|
60
|
+
- `--rel-colors-white` - White background color
|
|
61
|
+
- `--rel-colors-gray-light` - Light background color
|
|
62
|
+
|
|
63
|
+
### Shadow Tokens
|
|
64
|
+
- `--rel-shadows-shadow-300` - Shadow when `shadow` is true
|
|
65
|
+
|
|
66
|
+
### Border Tokens
|
|
67
|
+
- `--rel-borders-radius-border-radius-200` - Container border radius
|
|
68
|
+
|
|
69
|
+
### Spacing Tokens
|
|
70
|
+
- `--rel-spacing-space-xs` - Small padding
|
|
71
|
+
- `--rel-spacing-space-md` - Medium padding
|
|
72
|
+
- `--rel-spacing-space-2xl` - Large padding
|
|
73
|
+
|
|
74
|
+
## Accessibility
|
|
75
|
+
- Purely presentational container, no specific accessibility features
|
|
76
|
+
- Ensure slotted content includes proper semantic HTML
|
|
77
|
+
|
|
78
|
+
### Keyboard Interactions
|
|
79
|
+
- None (purely presentational container)
|
|
80
|
+
|
|
81
|
+
### Focus Behavior
|
|
82
|
+
- No specific focus handling
|
|
83
|
+
|
|
84
|
+
## Notes / Edge Cases
|
|
85
|
+
- **Padding variants**:
|
|
86
|
+
- **sm**: Uses `--rel-spacing-space-xs`
|
|
87
|
+
- **md**: Uses `--rel-spacing-space-md`
|
|
88
|
+
- **lg**: Uses `--rel-spacing-space-2xl`
|
|
89
|
+
|
|
90
|
+
- **Background variants**:
|
|
91
|
+
- **white**: White background (`--rel-colors-white`)
|
|
92
|
+
- **light**: Light gray background (`--rel-colors-gray-light`)
|
|
93
|
+
- **none**: Transparent background
|
|
94
|
+
|
|
95
|
+
- The component is `display: block` and `width: 100%` with `box-sizing: border-box`
|
|
96
|
+
- All styles are applied to an internal `.reliability-container` div
|
|
97
|
+
- The border-radius is always applied regardless of background variant
|
|
98
|
+
- The shadow is applied via the `--rel-shadows-shadow-300` token when `shadow` is true
|
|
99
|
+
- Slotted content inherits the padding and background from the container
|