@stainless-api/ui-primitives 0.1.0-beta.21 → 0.1.0-beta.23
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/{Accordion-DLQE3Td6.js → Accordion-CL3Oarbz.js} +3 -3
- package/dist/{Accordion-CJL9SWwS.d.ts → Accordion-Cj5GURin.d.ts} +4 -4
- package/dist/{Button-DwndlytB.d.ts → Button-CxQtPObH.d.ts} +4 -4
- package/dist/{Button-DBhd6kU7.js → Button-DFAg4M-E.js} +3 -3
- package/dist/{Callout-UZQRuCQ5.js → Callout-BGkXD7D2.js} +1 -1
- package/dist/{Callout-CMz3Yl_5.d.ts → Callout-DlwbfFHm.d.ts} +2 -2
- package/dist/components/Accordion.d.ts +1 -1
- package/dist/components/Accordion.js +1 -1
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Button.js +1 -1
- package/dist/components/Callout.d.ts +1 -1
- package/dist/components/Callout.js +1 -1
- package/dist/index.d.ts +170 -5
- package/dist/index.js +175 -5
- package/dist/scripts/index.d.ts +12 -1
- package/dist/scripts/index.js +150 -22
- package/dist/styles.css +210 -96
- package/dist/styles.js +0 -1
- package/package.json +21 -12
- package/.turbo/turbo-build.log +0 -35
- package/CHANGELOG.md +0 -133
- package/dist/DropdownButton-DoYDi8tB.js +0 -82
- package/dist/DropdownButton-zcvep_xH.d.ts +0 -50
- package/dist/components/DropdownButton.d.ts +0 -2
- package/dist/components/DropdownButton.js +0 -3
- package/eslint.config.js +0 -2
- package/src/components/Accordion.tsx +0 -41
- package/src/components/Button.tsx +0 -95
- package/src/components/Callout.tsx +0 -31
- package/src/components/accordion.css +0 -145
- package/src/components/button.css +0 -187
- package/src/components/callout.css +0 -93
- package/src/components/dropdown/Dropdown.tsx +0 -51
- package/src/components/dropdown/DropdownButton.tsx +0 -54
- package/src/components/dropdown/DropdownMenu.tsx +0 -113
- package/src/components/dropdown/dropdown.css +0 -232
- package/src/index.ts +0 -5
- package/src/scripts/dropdown-button.ts +0 -39
- package/src/scripts/dropdown.ts +0 -193
- package/src/scripts/index.ts +0 -2
- package/src/styles/layout.css +0 -13
- package/src/styles/scales.css +0 -129
- package/src/styles/starlight-compat.css +0 -156
- package/src/styles/swatches.css +0 -87
- package/src/styles/theme.css +0 -49
- package/src/styles/typography.css +0 -169
- package/src/styles.css +0 -11
- package/tsconfig.json +0 -11
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
.stl-ui-dropdown {
|
|
2
|
-
--stl-ui-dropdown-button-color: var(--stl-ui-foreground);
|
|
3
|
-
--stl-ui-dropdown-button-background-color: var(--stl-ui-card-background);
|
|
4
|
-
--stl-ui-dropdown-button-border-color: var(--stl-ui-border);
|
|
5
|
-
--stl-ui-dropdown-button-border-radius: var(--stl-ui-layout-border-radius-sml);
|
|
6
|
-
--stl-ui-dropdown-button-font-size: var(--stl-ui-type-scale-text-sm);
|
|
7
|
-
|
|
8
|
-
--stl-ui-dropdown-button-height: 32px;
|
|
9
|
-
--stl-ui-dropdown-button-padding: 0 10px;
|
|
10
|
-
--stl-ui-dropdown-button-line-height: 100%;
|
|
11
|
-
--stl-ui-dropdown-button-font-weight: 500;
|
|
12
|
-
|
|
13
|
-
position: relative;
|
|
14
|
-
display: inline-flex;
|
|
15
|
-
align-items: center;
|
|
16
|
-
|
|
17
|
-
color: var(--stl-ui-dropdown-button-color);
|
|
18
|
-
gap: 0;
|
|
19
|
-
font-size: var(--stl-ui-dropdown-button-font-size);
|
|
20
|
-
|
|
21
|
-
hr {
|
|
22
|
-
--stl-ui-dropdown-button__divider-height: 1px;
|
|
23
|
-
--stl-ui-dropdown-button__divider-color: var(--stl-ui-border);
|
|
24
|
-
|
|
25
|
-
height: var(--stl-ui-dropdown-button__divider-height);
|
|
26
|
-
background-color: var(--stl-ui-dropdown-button__divider-color);
|
|
27
|
-
border: none;
|
|
28
|
-
|
|
29
|
-
margin: 4px 0;
|
|
30
|
-
width: calc(100% + 8px);
|
|
31
|
-
transform: translateX(-4px);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.stl-ui-dropdown__button {
|
|
35
|
-
background-color: var(--stl-ui-dropdown-button-background-color);
|
|
36
|
-
|
|
37
|
-
border: 1px solid var(--stl-ui-dropdown-button-border-color);
|
|
38
|
-
border-radius: var(--stl-ui-dropdown-button-border-radius);
|
|
39
|
-
height: var(--stl-ui-dropdown-button-height);
|
|
40
|
-
padding: var(--stl-ui-dropdown-button-padding);
|
|
41
|
-
line-height: var(--stl-ui-dropdown-button-line-height);
|
|
42
|
-
font-weight: var(--stl-ui-dropdown-button-font-weight);
|
|
43
|
-
cursor: pointer;
|
|
44
|
-
display: flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
justify-content: center;
|
|
47
|
-
color: inherit;
|
|
48
|
-
|
|
49
|
-
&:focus {
|
|
50
|
-
outline: 1px auto Highlight;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
&:hover {
|
|
54
|
-
background-color: oklch(from var(--stl-ui-foreground) l c h / 0.05);
|
|
55
|
-
border-color: var(--stl-ui-border-emphasis);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.stl-ui-dropdown__trigger-icon {
|
|
59
|
-
margin-right: -4px;
|
|
60
|
-
margin-left: 4px;
|
|
61
|
-
display: flex;
|
|
62
|
-
align-items: center;
|
|
63
|
-
justify-content: center;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.stl-ui-dropdown__icon {
|
|
68
|
-
display: flex;
|
|
69
|
-
align-items: center;
|
|
70
|
-
justify-content: center;
|
|
71
|
-
|
|
72
|
-
svg {
|
|
73
|
-
width: 16px;
|
|
74
|
-
height: 16px;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Dropdown Button
|
|
80
|
-
*/
|
|
81
|
-
.stl-ui-dropdown-button--action {
|
|
82
|
-
display: flex;
|
|
83
|
-
align-items: center;
|
|
84
|
-
gap: 8px;
|
|
85
|
-
border-top-right-radius: 0;
|
|
86
|
-
border-bottom-right-radius: 0;
|
|
87
|
-
margin-right: -1px;
|
|
88
|
-
|
|
89
|
-
&:hover {
|
|
90
|
-
background-color: oklch(from var(--stl-ui-foreground) l c h / 0.05);
|
|
91
|
-
border-color: var(--stl-ui-border-emphasis);
|
|
92
|
-
z-index: 1;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
&.disabled {
|
|
96
|
-
cursor: not-allowed;
|
|
97
|
-
background-color: oklch(from var(--stl-ui-foreground) l c h / 0.05);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.stl-ui-dropdown-button__trigger {
|
|
102
|
-
border-left: 1px solid var(--stl-ui-border);
|
|
103
|
-
border-radius: 0;
|
|
104
|
-
border-top-right-radius: var(--stl-ui-dropdown-button-border-radius);
|
|
105
|
-
border-bottom-right-radius: var(--stl-ui-dropdown-button-border-radius);
|
|
106
|
-
|
|
107
|
-
&:hover {
|
|
108
|
-
background-color: oklch(from var(--stl-ui-foreground) l c h / 0.05);
|
|
109
|
-
border-color: var(--stl-ui-border-emphasis);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.stl-ui-dropdown__trigger-selected {
|
|
114
|
-
display: flex;
|
|
115
|
-
align-items: center;
|
|
116
|
-
gap: 8px;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Dropdown Menu
|
|
121
|
-
*/
|
|
122
|
-
.stl-ui-dropdown-menu {
|
|
123
|
-
--stl-ui-dropdown-menu-background-color: var(--stl-ui-card-background);
|
|
124
|
-
--stl-ui-dropdown-menu-border-color: var(--stl-ui-border);
|
|
125
|
-
--stl-ui-dropdown-menu-box-shadow: var(--stl-ui-shadow-md);
|
|
126
|
-
--stl-ui-dropdown-menu-border-radius: var(--stl-ui-layout-border-radius-sml);
|
|
127
|
-
|
|
128
|
-
background-color: var(--stl-ui-dropdown-menu-background-color);
|
|
129
|
-
border: 1px solid var(--stl-ui-dropdown-menu-border-color);
|
|
130
|
-
box-shadow: var(--stl-ui-dropdown-menu-box-shadow);
|
|
131
|
-
border-radius: var(--stl-ui-dropdown-menu-border-radius);
|
|
132
|
-
|
|
133
|
-
position: absolute;
|
|
134
|
-
right: 0;
|
|
135
|
-
z-index: 1000;
|
|
136
|
-
min-width: 100%;
|
|
137
|
-
padding: 4px;
|
|
138
|
-
display: none;
|
|
139
|
-
|
|
140
|
-
&.stl-ui-dropdown-menu--above {
|
|
141
|
-
top: auto;
|
|
142
|
-
bottom: 100%;
|
|
143
|
-
margin-bottom: 4px;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
&.stl-ui-dropdown-menu--below {
|
|
147
|
-
top: 100%;
|
|
148
|
-
bottom: auto;
|
|
149
|
-
margin-top: 4px;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
&[data-state='open'] {
|
|
153
|
-
display: block;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.stl-ui-dropdown-menu__item {
|
|
157
|
-
--stl-ui-dropdown-menu__item-border-radius: var(--stl-ui-dropdown-button-border-radius);
|
|
158
|
-
--stl-ui-dropdown-menu__item-height: var(--stl-ui-dropdown-button-height);
|
|
159
|
-
--stl-ui-dropdown-menu__item-line-height: var(--stl-ui-dropdown-button-line-height);
|
|
160
|
-
--stl-ui-dropdown-menu__item-hover-background-color: oklch(from var(--stl-ui-foreground) l c h / 0.05);
|
|
161
|
-
|
|
162
|
-
border-radius: var(--stl-ui-dropdown-menu__item-border-radius);
|
|
163
|
-
height: var(--stl-ui-dropdown-menu__item-height);
|
|
164
|
-
line-height: var(--stl-ui-dropdown-menu__item-line-height);
|
|
165
|
-
|
|
166
|
-
background: transparent;
|
|
167
|
-
border: none;
|
|
168
|
-
|
|
169
|
-
padding: 8px;
|
|
170
|
-
cursor: pointer;
|
|
171
|
-
display: flex;
|
|
172
|
-
align-items: center;
|
|
173
|
-
justify-content: space-between;
|
|
174
|
-
gap: 16px;
|
|
175
|
-
width: 100%;
|
|
176
|
-
|
|
177
|
-
&:hover,
|
|
178
|
-
&:focus-visible {
|
|
179
|
-
background-color: var(--stl-ui-dropdown-menu__item-hover-background-color);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
&:hover,
|
|
183
|
-
&:focus-visible,
|
|
184
|
-
&:focus {
|
|
185
|
-
color: var(--stl-ui-foreground);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
&.stl-ui-dropdown-menu__item-link {
|
|
189
|
-
display: flex;
|
|
190
|
-
align-items: center;
|
|
191
|
-
justify-content: space-between;
|
|
192
|
-
gap: 16px;
|
|
193
|
-
width: 100%;
|
|
194
|
-
|
|
195
|
-
&:hover {
|
|
196
|
-
color: var(--stl-ui-foreground);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.stl-ui-dropdown-menu__item-icon {
|
|
201
|
-
display: flex;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.stl-ui-dropdown-menu__item-content {
|
|
205
|
-
display: flex;
|
|
206
|
-
align-items: center;
|
|
207
|
-
gap: 8px;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.stl-ui-dropdown-menu__item-text {
|
|
211
|
-
white-space: nowrap;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.stl-ui-dropdown-menu__item-text--subtle {
|
|
215
|
-
color: var(--stl-ui-foreground-muted);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
strong {
|
|
219
|
-
color: var(--stl-ui-foreground);
|
|
220
|
-
font-weight: 500;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
.stl-ui-dropdown-menu__item-subtle-icon {
|
|
224
|
-
--stl-ui-dropdown-menu__item-subtle-icon-color: oklch(from var(--stl-ui-foreground) l c h / 0.25);
|
|
225
|
-
|
|
226
|
-
svg {
|
|
227
|
-
color: var(--stl-ui-dropdown-menu__item-subtle-icon-color);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { initDropdown } from './dropdown';
|
|
2
|
-
|
|
3
|
-
export function initDropdownButton({
|
|
4
|
-
dropdown,
|
|
5
|
-
onSelect,
|
|
6
|
-
onPrimaryAction,
|
|
7
|
-
}: {
|
|
8
|
-
dropdown: Element;
|
|
9
|
-
onSelect: (value: string) => void;
|
|
10
|
-
onPrimaryAction: (primaryActionElement: Element) => void;
|
|
11
|
-
}) {
|
|
12
|
-
const trigger = dropdown.querySelector('[data-part="trigger"]') as HTMLButtonElement | null;
|
|
13
|
-
const menu = dropdown.querySelector('[data-part="menu"]') as HTMLElement | null;
|
|
14
|
-
const primaryAction = dropdown.querySelector('[data-part="primary-action"]');
|
|
15
|
-
|
|
16
|
-
if (!trigger) {
|
|
17
|
-
console.error('Dropdown trigger not found');
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (!menu) {
|
|
22
|
-
console.error('Dropdown menu not found');
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (!primaryAction) {
|
|
27
|
-
console.error('Dropdown primary action not found');
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
primaryAction.addEventListener('click', () => {
|
|
32
|
-
onPrimaryAction(primaryAction);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
initDropdown({
|
|
36
|
-
root: dropdown,
|
|
37
|
-
onSelect,
|
|
38
|
-
});
|
|
39
|
-
}
|
package/src/scripts/dropdown.ts
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
export function initDropdown({
|
|
2
|
-
root,
|
|
3
|
-
onSelect,
|
|
4
|
-
initialValue,
|
|
5
|
-
}: {
|
|
6
|
-
root?: Element | null;
|
|
7
|
-
onSelect?: (value: string) => void;
|
|
8
|
-
initialValue?: string;
|
|
9
|
-
}) {
|
|
10
|
-
if (!root) {
|
|
11
|
-
console.error('Dropdown root element not found');
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const trigger = root.querySelector<HTMLElement>('[data-part="trigger"]');
|
|
15
|
-
const menu = root.querySelector<HTMLElement>('[data-part="menu"]');
|
|
16
|
-
|
|
17
|
-
if (!trigger) {
|
|
18
|
-
console.error('Dropdown trigger not found');
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (!menu) {
|
|
23
|
-
console.error('Dropdown menu not found');
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const selectedSlot = trigger.querySelector('[data-part="trigger-selected"]');
|
|
28
|
-
|
|
29
|
-
const items = Array.from(menu.querySelectorAll<HTMLElement>('[data-part="item"]'));
|
|
30
|
-
|
|
31
|
-
function open() {
|
|
32
|
-
if (!trigger || !menu || !root) return;
|
|
33
|
-
root.setAttribute('aria-expanded', 'true');
|
|
34
|
-
menu.dataset.state = 'open';
|
|
35
|
-
menu.removeAttribute('aria-hidden');
|
|
36
|
-
|
|
37
|
-
// Determine if menu should open above or below
|
|
38
|
-
const triggerRect = trigger.getBoundingClientRect();
|
|
39
|
-
const menuHeight = menu.offsetHeight;
|
|
40
|
-
const viewportHeight = window.innerHeight;
|
|
41
|
-
const spaceBelow = viewportHeight - triggerRect.bottom;
|
|
42
|
-
const spaceAbove = triggerRect.top;
|
|
43
|
-
menu.classList.remove('stl-ui-dropdown-menu--above', 'stl-ui-dropdown-menu--below');
|
|
44
|
-
|
|
45
|
-
if (spaceBelow < menuHeight && spaceAbove > spaceBelow) {
|
|
46
|
-
menu.classList.add('stl-ui-dropdown-menu--above');
|
|
47
|
-
} else {
|
|
48
|
-
menu.classList.add('stl-ui-dropdown-menu--below');
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function close() {
|
|
53
|
-
if (!trigger || !menu || !root) return;
|
|
54
|
-
root.setAttribute('aria-expanded', 'false');
|
|
55
|
-
menu.dataset.state = 'closed';
|
|
56
|
-
menu.setAttribute('aria-hidden', 'true');
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function renderSelectedFromItem(item: Element) {
|
|
60
|
-
// If there is no selected slot, do nothing. This allows for dropdowns without a selected display.
|
|
61
|
-
if (!selectedSlot) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const tmpl = item.querySelector<HTMLTemplateElement>('template[data-part="selected-template"]');
|
|
65
|
-
|
|
66
|
-
if (!tmpl) {
|
|
67
|
-
console.error('Dropdown item template not found');
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
selectedSlot.innerHTML = '';
|
|
72
|
-
selectedSlot.appendChild(tmpl.content.cloneNode(true));
|
|
73
|
-
selectedSlot.removeAttribute('data-placeholder');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function selectItem(item: Element) {
|
|
77
|
-
if (!trigger) {
|
|
78
|
-
console.error('Dropdown trigger not found');
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
items.forEach((i) => i.setAttribute('aria-selected', String(i === item)));
|
|
82
|
-
trigger.dataset.value = item.getAttribute('data-value') || '';
|
|
83
|
-
renderSelectedFromItem(item);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function handleItemSelection(e: MouseEvent | KeyboardEvent) {
|
|
87
|
-
const item = (e.target as Element).closest('[data-part="item"]');
|
|
88
|
-
if (!item) {
|
|
89
|
-
console.error('Dropdown item not found');
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
if (!trigger) {
|
|
93
|
-
console.error('Dropdown trigger not found');
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
selectItem(item);
|
|
98
|
-
onSelect?.(item.getAttribute('data-value') || '');
|
|
99
|
-
close();
|
|
100
|
-
trigger.focus();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function handleTriggerClick() {
|
|
104
|
-
if (!root) return false;
|
|
105
|
-
const isOpen = root.getAttribute('aria-expanded') === 'true';
|
|
106
|
-
if (isOpen) {
|
|
107
|
-
close();
|
|
108
|
-
return false;
|
|
109
|
-
} else {
|
|
110
|
-
open();
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Initialize selected item
|
|
116
|
-
const initial =
|
|
117
|
-
(initialValue
|
|
118
|
-
? items.find((i) => i.getAttribute('data-value') === initialValue)
|
|
119
|
-
: items.find((i) => i.getAttribute('aria-selected') === 'true')) ?? items[0];
|
|
120
|
-
|
|
121
|
-
if (initial) selectItem(initial);
|
|
122
|
-
|
|
123
|
-
// add event listeners
|
|
124
|
-
trigger.addEventListener('click', () => {
|
|
125
|
-
handleTriggerClick();
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
// When using the keyboard to open the dropdown, we focus the first item
|
|
129
|
-
trigger.addEventListener('keydown', (e) => {
|
|
130
|
-
if (e.key !== 'Enter' && e.key !== ' ') return;
|
|
131
|
-
e.preventDefault();
|
|
132
|
-
const didOpen = handleTriggerClick();
|
|
133
|
-
if (didOpen) {
|
|
134
|
-
items[0]?.focus();
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
menu.addEventListener('click', (e) => {
|
|
139
|
-
handleItemSelection(e);
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
document.addEventListener('keydown', (e) => {
|
|
143
|
-
const isOpen = root.getAttribute('aria-expanded') === 'true';
|
|
144
|
-
if (!isOpen) return;
|
|
145
|
-
|
|
146
|
-
if (e.key === 'Escape') {
|
|
147
|
-
close();
|
|
148
|
-
trigger.focus();
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (e.key === 'ArrowDown') {
|
|
153
|
-
e.preventDefault();
|
|
154
|
-
const activeElement = document.activeElement;
|
|
155
|
-
|
|
156
|
-
// if the active item is the button itself, focus the first item
|
|
157
|
-
if (activeElement === trigger) {
|
|
158
|
-
items[0]?.focus();
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
let nextSibling = activeElement?.nextElementSibling;
|
|
162
|
-
while (nextSibling && nextSibling.tagName.toLowerCase() === 'hr') {
|
|
163
|
-
nextSibling = nextSibling.nextElementSibling;
|
|
164
|
-
}
|
|
165
|
-
if (nextSibling instanceof HTMLElement && items.includes(nextSibling)) {
|
|
166
|
-
nextSibling.focus();
|
|
167
|
-
}
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (e.key === 'ArrowUp') {
|
|
172
|
-
e.preventDefault();
|
|
173
|
-
const activeElement = document.activeElement;
|
|
174
|
-
// if the active item is the button itself, focus the last item
|
|
175
|
-
if (activeElement === trigger) {
|
|
176
|
-
items[items.length - 1]?.focus();
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
let prevSibling = activeElement?.previousElementSibling;
|
|
180
|
-
while (prevSibling && prevSibling.tagName.toLowerCase() === 'hr') {
|
|
181
|
-
prevSibling = prevSibling.previousElementSibling;
|
|
182
|
-
}
|
|
183
|
-
if (prevSibling instanceof HTMLElement && items.includes(prevSibling)) {
|
|
184
|
-
prevSibling.focus();
|
|
185
|
-
}
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
document.addEventListener('click', (e) => {
|
|
191
|
-
if (!root.contains(e.target as Element)) close();
|
|
192
|
-
});
|
|
193
|
-
}
|
package/src/scripts/index.ts
DELETED
package/src/styles/layout.css
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
@layer stl-ui.tokens {
|
|
2
|
-
/* Layout - Stainless */
|
|
3
|
-
:root {
|
|
4
|
-
--stl-ui-layout-border-radius-xs: 4px;
|
|
5
|
-
--stl-ui-layout-border-radius-sml: 8px;
|
|
6
|
-
--stl-ui-layout-border-radius: 12px;
|
|
7
|
-
--stl-ui-layout-border-radius-med: 16px;
|
|
8
|
-
--stl-ui-layout-border-radius-max: 9999px;
|
|
9
|
-
--stl-ui-left-content-indent: 24px;
|
|
10
|
-
|
|
11
|
-
--stl-ui-page-padding-inline: 20px;
|
|
12
|
-
}
|
|
13
|
-
}
|
package/src/styles/scales.css
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
@layer stl-ui.tokens {
|
|
2
|
-
/* Scales - Default */
|
|
3
|
-
:root {
|
|
4
|
-
--stl-ui-gray-50: rgba(250, 250, 250, 1);
|
|
5
|
-
--stl-ui-gray-100: rgba(245, 245, 245, 1);
|
|
6
|
-
--stl-ui-gray-200: rgba(229, 229, 229, 1);
|
|
7
|
-
--stl-ui-gray-300: rgba(212, 212, 212, 1);
|
|
8
|
-
--stl-ui-gray-400: rgba(163, 163, 163, 1);
|
|
9
|
-
--stl-ui-gray-500: rgba(115, 115, 115, 1);
|
|
10
|
-
--stl-ui-gray-600: rgba(82, 82, 82, 1);
|
|
11
|
-
--stl-ui-gray-700: rgba(64, 64, 64, 1);
|
|
12
|
-
--stl-ui-gray-800: rgba(38, 38, 38, 1);
|
|
13
|
-
--stl-ui-gray-900: rgba(23, 23, 23, 1);
|
|
14
|
-
--stl-ui-gray-950: rgba(10, 10, 10, 1);
|
|
15
|
-
--stl-ui-accent-50: #eff6ffff;
|
|
16
|
-
--stl-ui-accent-100: #dbeafeff;
|
|
17
|
-
--stl-ui-accent-200: #bedbffff;
|
|
18
|
-
--stl-ui-accent-300: #8ec5ffff;
|
|
19
|
-
--stl-ui-accent-400: #51a2ffff;
|
|
20
|
-
--stl-ui-accent-500: #2b7fffff;
|
|
21
|
-
--stl-ui-accent-600: #155dfcff;
|
|
22
|
-
--stl-ui-accent-700: #1447e6ff;
|
|
23
|
-
--stl-ui-accent-800: #193cb8ff;
|
|
24
|
-
--stl-ui-accent-900: #132762ff;
|
|
25
|
-
--stl-ui-accent-950: #0b1128ff;
|
|
26
|
-
--stl-ui-red-50: rgba(252, 243, 243, 1);
|
|
27
|
-
--stl-ui-red-100: rgba(249, 227, 227, 1);
|
|
28
|
-
--stl-ui-red-200: rgba(246, 203, 203, 1);
|
|
29
|
-
--stl-ui-red-300: rgba(242, 166, 165, 1);
|
|
30
|
-
--stl-ui-red-400: rgba(235, 109, 108, 1);
|
|
31
|
-
--stl-ui-red-500: rgba(227, 64, 65, 1);
|
|
32
|
-
--stl-ui-red-600: rgba(208, 30, 34, 1);
|
|
33
|
-
--stl-ui-red-700: rgba(174, 25, 26, 1);
|
|
34
|
-
--stl-ui-red-800: rgba(143, 28, 27, 1);
|
|
35
|
-
--stl-ui-red-900: rgba(85, 24, 22, 1);
|
|
36
|
-
--stl-ui-red-950: rgba(43, 9, 8, 1);
|
|
37
|
-
--stl-ui-blue-50: rgba(239, 246, 255, 1);
|
|
38
|
-
--stl-ui-blue-100: rgba(219, 234, 254, 1);
|
|
39
|
-
--stl-ui-blue-200: rgba(190, 219, 255, 1);
|
|
40
|
-
--stl-ui-blue-300: rgba(142, 197, 255, 1);
|
|
41
|
-
--stl-ui-blue-400: rgba(81, 162, 255, 1);
|
|
42
|
-
--stl-ui-blue-500: rgba(43, 127, 255, 1);
|
|
43
|
-
--stl-ui-blue-600: rgba(21, 93, 252, 1);
|
|
44
|
-
--stl-ui-blue-700: rgba(20, 71, 230, 1);
|
|
45
|
-
--stl-ui-blue-800: rgba(25, 60, 184, 1);
|
|
46
|
-
--stl-ui-blue-900: rgba(19, 39, 98, 1);
|
|
47
|
-
--stl-ui-blue-950: rgba(11, 17, 40, 1);
|
|
48
|
-
--stl-ui-green-50: rgba(240, 253, 244, 1);
|
|
49
|
-
--stl-ui-green-100: rgba(220, 252, 231, 1);
|
|
50
|
-
--stl-ui-green-200: rgba(187, 247, 208, 1);
|
|
51
|
-
--stl-ui-green-300: rgba(134, 239, 172, 1);
|
|
52
|
-
--stl-ui-green-400: rgba(74, 222, 128, 1);
|
|
53
|
-
--stl-ui-green-500: rgba(34, 197, 94, 1);
|
|
54
|
-
--stl-ui-green-600: rgba(22, 163, 74, 1);
|
|
55
|
-
--stl-ui-green-700: rgba(21, 128, 61, 1);
|
|
56
|
-
--stl-ui-green-800: rgba(22, 101, 52, 1);
|
|
57
|
-
--stl-ui-green-900: rgba(15, 62, 33, 1);
|
|
58
|
-
--stl-ui-green-950: rgba(4, 32, 15, 1);
|
|
59
|
-
--stl-ui-orange-50: rgba(255, 247, 237, 1);
|
|
60
|
-
--stl-ui-orange-100: rgba(255, 237, 213, 1);
|
|
61
|
-
--stl-ui-orange-200: rgba(254, 215, 170, 1);
|
|
62
|
-
--stl-ui-orange-300: rgba(253, 186, 116, 1);
|
|
63
|
-
--stl-ui-orange-400: rgba(251, 146, 60, 1);
|
|
64
|
-
--stl-ui-orange-500: rgba(249, 115, 22, 1);
|
|
65
|
-
--stl-ui-orange-600: rgba(234, 88, 12, 1);
|
|
66
|
-
--stl-ui-orange-700: rgba(194, 65, 12, 1);
|
|
67
|
-
--stl-ui-orange-800: rgba(154, 52, 18, 1);
|
|
68
|
-
--stl-ui-orange-900: rgba(89, 32, 13, 1);
|
|
69
|
-
--stl-ui-orange-950: rgba(46, 14, 5, 1);
|
|
70
|
-
--stl-ui-purple-50: rgba(250, 245, 255, 1);
|
|
71
|
-
--stl-ui-purple-100: rgba(243, 232, 255, 1);
|
|
72
|
-
--stl-ui-purple-200: rgba(233, 213, 255, 1);
|
|
73
|
-
--stl-ui-purple-300: rgba(216, 180, 254, 1);
|
|
74
|
-
--stl-ui-purple-400: rgba(192, 132, 252, 1);
|
|
75
|
-
--stl-ui-purple-500: rgba(168, 85, 247, 1);
|
|
76
|
-
--stl-ui-purple-600: rgba(147, 51, 234, 1);
|
|
77
|
-
--stl-ui-purple-700: rgba(126, 34, 206, 1);
|
|
78
|
-
--stl-ui-purple-800: rgba(107, 33, 168, 1);
|
|
79
|
-
--stl-ui-purple-900: rgba(72, 23, 110, 1);
|
|
80
|
-
--stl-ui-purple-950: rgba(39, 5, 67, 1);
|
|
81
|
-
--stl-ui-cyan-50: rgba(236, 254, 255, 1);
|
|
82
|
-
--stl-ui-cyan-100: rgba(207, 250, 254, 1);
|
|
83
|
-
--stl-ui-cyan-200: rgba(165, 243, 252, 1);
|
|
84
|
-
--stl-ui-cyan-300: rgba(103, 232, 249, 1);
|
|
85
|
-
--stl-ui-cyan-400: rgba(34, 211, 238, 1);
|
|
86
|
-
--stl-ui-cyan-500: rgba(6, 182, 212, 1);
|
|
87
|
-
--stl-ui-cyan-600: rgba(8, 145, 178, 1);
|
|
88
|
-
--stl-ui-cyan-700: rgba(14, 116, 144, 1);
|
|
89
|
-
--stl-ui-cyan-800: rgba(21, 94, 117, 1);
|
|
90
|
-
--stl-ui-cyan-900: rgba(18, 62, 79, 1);
|
|
91
|
-
--stl-ui-cyan-950: rgba(5, 34, 46, 1);
|
|
92
|
-
--stl-ui-pink-50: rgba(253, 242, 248, 1);
|
|
93
|
-
--stl-ui-pink-100: rgba(252, 231, 243, 1);
|
|
94
|
-
--stl-ui-pink-200: rgba(251, 207, 232, 1);
|
|
95
|
-
--stl-ui-pink-300: rgba(249, 168, 212, 1);
|
|
96
|
-
--stl-ui-pink-400: rgba(244, 114, 182, 1);
|
|
97
|
-
--stl-ui-pink-500: rgba(236, 72, 153, 1);
|
|
98
|
-
--stl-ui-pink-600: rgba(219, 39, 119, 1);
|
|
99
|
-
--stl-ui-pink-700: rgba(190, 24, 93, 1);
|
|
100
|
-
--stl-ui-pink-800: rgba(157, 23, 77, 1);
|
|
101
|
-
--stl-ui-pink-900: rgba(103, 19, 53, 1);
|
|
102
|
-
--stl-ui-pink-950: rgba(56, 5, 25, 1);
|
|
103
|
-
--stl-ui-yellow-50: rgba(254, 252, 232, 1);
|
|
104
|
-
--stl-ui-yellow-100: rgba(254, 249, 195, 1);
|
|
105
|
-
--stl-ui-yellow-200: rgba(254, 240, 138, 1);
|
|
106
|
-
--stl-ui-yellow-300: rgba(253, 224, 71, 1);
|
|
107
|
-
--stl-ui-yellow-400: rgba(250, 204, 21, 1);
|
|
108
|
-
--stl-ui-yellow-500: rgba(234, 179, 8, 1);
|
|
109
|
-
--stl-ui-yellow-600: rgba(202, 138, 4, 1);
|
|
110
|
-
--stl-ui-yellow-700: rgba(161, 98, 7, 1);
|
|
111
|
-
--stl-ui-yellow-800: rgba(133, 77, 14, 1);
|
|
112
|
-
--stl-ui-yellow-900: rgba(88, 49, 14, 1);
|
|
113
|
-
--stl-ui-yellow-950: rgba(47, 23, 4, 1);
|
|
114
|
-
|
|
115
|
-
/* TODO support accent generation */
|
|
116
|
-
/* --stl-ui-accent-base: rgb(21, 93, 252);
|
|
117
|
-
--stl-ui-accent-50: color-mix(in oklch, white 95%, var(--stl-ui-accent-base));
|
|
118
|
-
--stl-ui-accent-100: color-mix(in oklch, white 85%, var(--stl-ui-accent-base));
|
|
119
|
-
--stl-ui-accent-200: color-mix(in oklch, white 70%, var(--stl-ui-accent-base));
|
|
120
|
-
--stl-ui-accent-300: color-mix(in oklch, white 55%, var(--stl-ui-accent-base));
|
|
121
|
-
--stl-ui-accent-400: color-mix(in oklch, white 40%, var(--stl-ui-accent-base));
|
|
122
|
-
--stl-ui-accent-500: color-mix(in oklch, white 25%, var(--stl-ui-accent-base));
|
|
123
|
-
--stl-ui-accent-600: var(--stl-ui-accent-base);
|
|
124
|
-
--stl-ui-accent-700: color-mix(in oklch, black 15%, var(--stl-ui-accent-base));
|
|
125
|
-
--stl-ui-accent-800: color-mix(in oklch, black 30%, var(--stl-ui-accent-base));
|
|
126
|
-
--stl-ui-accent-900: color-mix(in oklch, black 45%, var(--stl-ui-accent-base));
|
|
127
|
-
--stl-ui-accent-950: color-mix(in oklch, black 60%, var(--stl-ui-accent-base)); */
|
|
128
|
-
}
|
|
129
|
-
}
|