@ds-gn/ui 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/custom-elements.json +5527 -2136
- package/dist/common/controllers/OverlayDismissController.d.ts +52 -0
- package/dist/common/controllers/OverlayPositionController.d.ts +168 -0
- package/dist/common/controllers/RovingFocusController.d.ts +99 -0
- package/dist/common/controllers/SectionEntranceController.d.ts +37 -0
- package/dist/common/helpers/field-control.d.ts +35 -0
- package/dist/common/helpers/listbox-navigation.d.ts +50 -0
- package/dist/common/props/size/size.props.d.ts +11 -0
- package/dist/common/styles/overlay-panel.styles.d.ts +55 -0
- package/dist/components/Button/src/Button.d.ts +20 -0
- package/dist/components/Button/src/Button.js +28 -0
- package/dist/components/Container/src/Container.d.ts +10 -0
- package/dist/components/Container/src/Container.js +148 -23
- package/dist/components/DropdownMenu/src/DropdownMenu.d.ts +150 -0
- package/dist/components/DropdownMenu/src/DropdownMenu.js +1550 -0
- package/dist/components/DropdownMenu/src/DropdownMenu.playground.d.ts +2 -0
- package/dist/components/DropdownMenu/src/DropdownMenu.props.d.ts +47 -0
- package/dist/components/DropdownMenu/src/DropdownMenu.props.js +54 -0
- package/dist/components/DropdownMenu/src/DropdownMenu.styles.d.ts +20 -0
- package/dist/components/Field/src/Field.d.ts +39 -0
- package/dist/components/Field/src/Field.js +203 -0
- package/dist/components/Field/src/Field.playground.d.ts +2 -0
- package/dist/components/Field/src/Field.styles.d.ts +6 -0
- package/dist/components/Icon/src/Icon.d.ts +5 -0
- package/dist/components/Icon/src/Icon.js +3 -0
- package/dist/components/Icon/src/icons/arrow-down.d.ts +1 -0
- package/dist/components/Icon/src/icons/arrow-down.js +6 -0
- package/dist/components/Icon/src/icons/arrow-up.d.ts +1 -0
- package/dist/components/Icon/src/icons/arrow-up.js +6 -0
- package/dist/components/Icon/src/icons/chevrons-up-down.d.ts +1 -0
- package/dist/components/Icon/src/icons/chevrons-up-down.js +6 -0
- package/dist/components/Icon/src/icons/cookie.d.ts +1 -0
- package/dist/components/Icon/src/icons/cookie.js +6 -0
- package/dist/components/Icon/src/icons/icon-names.d.ts +1 -1
- package/dist/components/Icon/src/icons/icon-names.js +4 -0
- package/dist/components/Icon/src/icons/index.d.ts +4 -0
- package/dist/components/Icon/src/icons/index.js +4 -0
- package/dist/components/Input/src/Input.d.ts +37 -0
- package/dist/components/Input/src/Input.js +300 -143
- package/dist/components/Input/src/Input.props.d.ts +2 -1
- package/dist/components/Input/src/Input.props.js +12 -6
- package/dist/components/Input/src/Input.styles.d.ts +12 -4
- package/dist/components/Modal/src/Modal.d.ts +1 -0
- package/dist/components/Modal/src/Modal.js +1 -0
- package/dist/components/Nav/src/Nav.js +2 -1
- package/dist/components/NavLink/src/NavLink.d.ts +14 -30
- package/dist/components/NavLink/src/NavLink.js +201 -65
- package/dist/components/Select/src/Select.d.ts +157 -0
- package/dist/components/Select/src/Select.js +1766 -0
- package/dist/components/Select/src/Select.playground.d.ts +2 -0
- package/dist/components/Select/src/Select.props.d.ts +19 -0
- package/dist/components/Select/src/Select.props.js +40 -0
- package/dist/components/Select/src/Select.styles.d.ts +30 -0
- package/dist/components/Table/src/Table.d.ts +93 -0
- package/dist/components/Table/src/Table.js +1105 -0
- package/dist/components/Table/src/Table.playground.d.ts +2 -0
- package/dist/components/Table/src/Table.props.d.ts +53 -0
- package/dist/components/Table/src/Table.props.js +18 -0
- package/dist/components/Table/src/Table.styles.d.ts +33 -0
- package/dist/components/Toaster/src/Toaster.d.ts +174 -0
- package/dist/components/Toaster/src/Toaster.js +1489 -0
- package/dist/components/Toaster/src/Toaster.playground.d.ts +2 -0
- package/dist/components/Toaster/src/Toaster.props.d.ts +14 -0
- package/dist/components/Toaster/src/Toaster.props.js +81 -0
- package/dist/components/Toaster/src/Toaster.styles.d.ts +52 -0
- package/dist/components/Toaster/src/toast.d.ts +115 -0
- package/dist/components/Toaster/src/toast.js +74 -0
- package/dist/playground/types.d.ts +27 -0
- package/dist/playground-manifest.d.ts +3 -2
- package/dist/playground-manifest.js +507 -7
- package/dist/react/DropdownMenu.d.ts +8 -0
- package/dist/react/DropdownMenu.js +13 -0
- package/dist/react/Field.d.ts +6 -0
- package/dist/react/Field.js +13 -0
- package/dist/react/Select.d.ts +8 -0
- package/dist/react/Select.js +13 -0
- package/dist/react/Table.d.ts +8 -0
- package/dist/react/Table.js +13 -0
- package/dist/react/Toaster.d.ts +8 -0
- package/dist/react/Toaster.js +13 -0
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.js +6 -0
- package/package.json +52 -2
|
@@ -0,0 +1,1105 @@
|
|
|
1
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else
|
|
6
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
7
|
+
if (d = decorators[i])
|
|
8
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// components/Table/src/Table.ts
|
|
13
|
+
import { html as html2, nothing, svg as svg4 } from "lit";
|
|
14
|
+
import { property, query, state } from "lit/decorators.js";
|
|
15
|
+
import { repeat } from "lit/directives/repeat.js";
|
|
16
|
+
|
|
17
|
+
// common/Base/Base.ts
|
|
18
|
+
import { html, LitElement } from "lit";
|
|
19
|
+
|
|
20
|
+
// common/helpers/define-element.ts
|
|
21
|
+
var defineElement = (tag, ctor) => {
|
|
22
|
+
if (typeof customElements === "undefined")
|
|
23
|
+
return;
|
|
24
|
+
if (!customElements.get(tag))
|
|
25
|
+
customElements.define(tag, ctor);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// common/Base/Base.css
|
|
29
|
+
import { css } from "lit";
|
|
30
|
+
var styles = css`/* Base reset in @layer base ensures it comes before utilities in Tailwind v4 cascade
|
|
31
|
+
This prevents the reset from overriding component utility classes */
|
|
32
|
+
@layer base {
|
|
33
|
+
:host {
|
|
34
|
+
display: block;
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
line-height: 1.5;
|
|
37
|
+
-webkit-text-size-adjust: 100%;
|
|
38
|
+
tab-size: 4;
|
|
39
|
+
font-family: var(
|
|
40
|
+
--default-font-family,
|
|
41
|
+
var(--font-sans, ui-sans-serif, system-ui, sans-serif)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
*,
|
|
46
|
+
*::before,
|
|
47
|
+
*::after {
|
|
48
|
+
box-sizing: inherit;
|
|
49
|
+
margin: 0;
|
|
50
|
+
padding: 0;
|
|
51
|
+
border: 0 solid;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:host h1,
|
|
55
|
+
:host h2,
|
|
56
|
+
:host h3,
|
|
57
|
+
:host h4,
|
|
58
|
+
:host h5,
|
|
59
|
+
:host h6 {
|
|
60
|
+
font-size: inherit;
|
|
61
|
+
font-weight: inherit;
|
|
62
|
+
margin: 0;
|
|
63
|
+
padding: 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
var Base_default = styles;
|
|
68
|
+
|
|
69
|
+
// common/Base/Base.ts
|
|
70
|
+
class Base extends LitElement {
|
|
71
|
+
static styles = Base_default;
|
|
72
|
+
updateTheme(changedProperties, surface) {
|
|
73
|
+
if (changedProperties.has("surface")) {
|
|
74
|
+
if (surface) {
|
|
75
|
+
this.setAttribute("data-theme", surface);
|
|
76
|
+
} else {
|
|
77
|
+
this.removeAttribute("data-theme");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
emit(name, detail, options = {}) {
|
|
82
|
+
return this.dispatchEvent(new CustomEvent(name, {
|
|
83
|
+
detail,
|
|
84
|
+
bubbles: true,
|
|
85
|
+
composed: true,
|
|
86
|
+
cancelable: options.cancelable ?? false
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
render() {
|
|
90
|
+
return html`<slot></slot>`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
defineElement("dsgn-base", Base);
|
|
94
|
+
|
|
95
|
+
// common/helpers/enum-validator.ts
|
|
96
|
+
var enumValidator = (propName, enumSet, candidateValue) => {
|
|
97
|
+
if (!enumSet.has(candidateValue)) {
|
|
98
|
+
throw new Error(`Invalid prop ${propName} of value ${candidateValue}. Expected one of: ${Array.from(enumSet).join(", ")}`);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// common/helpers/enum-creator.ts
|
|
103
|
+
var enumCreator = (acceptableValues, propName, type, other = {}) => {
|
|
104
|
+
const acceptableValuesSet = new Set(acceptableValues);
|
|
105
|
+
return {
|
|
106
|
+
type,
|
|
107
|
+
hasChanged(newValue, oldValue) {
|
|
108
|
+
if (newValue !== oldValue) {
|
|
109
|
+
enumValidator(propName, acceptableValuesSet, newValue);
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
},
|
|
114
|
+
...other
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// common/props/size/size.props.ts
|
|
119
|
+
var sizeValues = {
|
|
120
|
+
SM: "sm",
|
|
121
|
+
MD: "md",
|
|
122
|
+
LG: "lg"
|
|
123
|
+
};
|
|
124
|
+
var sizeProps = enumCreator(Object.values(sizeValues), "size", String, {
|
|
125
|
+
reflect: true
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// common/props/surface/surface.props.ts
|
|
129
|
+
var surfaceValues = {
|
|
130
|
+
LIGHT: "light",
|
|
131
|
+
DARK: "dark"
|
|
132
|
+
};
|
|
133
|
+
var surfaceProps = enumCreator(Object.values(surfaceValues), "surface", String, { reflect: true });
|
|
134
|
+
|
|
135
|
+
// components/Icon/src/icons/arrow-down.ts
|
|
136
|
+
import { svg } from "lit";
|
|
137
|
+
var arrowDown = svg`<path d="M12 5v14" /><path d="m19 12-7 7-7-7" />`;
|
|
138
|
+
// components/Icon/src/icons/arrow-up.ts
|
|
139
|
+
import { svg as svg2 } from "lit";
|
|
140
|
+
var arrowUp = svg2`<path d="m5 12 7-7 7 7" /><path d="M12 19V5" />`;
|
|
141
|
+
// components/Icon/src/icons/chevrons-up-down.ts
|
|
142
|
+
import { svg as svg3 } from "lit";
|
|
143
|
+
var chevronsUpDown = svg3`<path d="m7 15 5 5 5-5" /><path d="m7 9 5-5 5 5" />`;
|
|
144
|
+
// components/Table/src/Table.css
|
|
145
|
+
import { css as css2 } from "lit";
|
|
146
|
+
var styles2 = css2`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
147
|
+
@layer properties;
|
|
148
|
+
@layer theme {
|
|
149
|
+
:root, :host {
|
|
150
|
+
--font-sans: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
151
|
+
'Noto Color Emoji';
|
|
152
|
+
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
|
|
153
|
+
monospace;
|
|
154
|
+
--spacing: 0.25rem;
|
|
155
|
+
--text-xs: 0.75rem;
|
|
156
|
+
--text-xs--line-height: calc(1 / 0.75);
|
|
157
|
+
--text-sm: 0.875rem;
|
|
158
|
+
--text-sm--line-height: calc(1.25 / 0.875);
|
|
159
|
+
--font-weight-normal: 400;
|
|
160
|
+
--font-weight-medium: 500;
|
|
161
|
+
--font-weight-semibold: 600;
|
|
162
|
+
--radius-md: 0.375rem;
|
|
163
|
+
--radius-xl: 0.75rem;
|
|
164
|
+
--default-transition-duration: 150ms;
|
|
165
|
+
--default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
166
|
+
--font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
|
|
167
|
+
--color-focus: inherit;
|
|
168
|
+
--color-surface-default: inherit;
|
|
169
|
+
--color-table-border: inherit;
|
|
170
|
+
--color-table-divider: inherit;
|
|
171
|
+
--color-table-header-bg: inherit;
|
|
172
|
+
--color-table-pin-shadow: inherit;
|
|
173
|
+
--color-table-row-hover: inherit;
|
|
174
|
+
--color-table-sort-hover: inherit;
|
|
175
|
+
--color-text-primary: inherit;
|
|
176
|
+
--color-text-secondary: inherit;
|
|
177
|
+
--color-text-tertiary: inherit;
|
|
178
|
+
--shadow-table: inherit;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
@layer utilities {
|
|
182
|
+
.pointer-events-none {
|
|
183
|
+
pointer-events: none;
|
|
184
|
+
}
|
|
185
|
+
.visible {
|
|
186
|
+
visibility: visible;
|
|
187
|
+
}
|
|
188
|
+
.sr-only {
|
|
189
|
+
position: absolute;
|
|
190
|
+
width: 1px;
|
|
191
|
+
height: 1px;
|
|
192
|
+
padding: 0;
|
|
193
|
+
margin: -1px;
|
|
194
|
+
overflow: hidden;
|
|
195
|
+
clip-path: inset(50%);
|
|
196
|
+
white-space: nowrap;
|
|
197
|
+
border-width: 0;
|
|
198
|
+
}
|
|
199
|
+
.absolute {
|
|
200
|
+
position: absolute;
|
|
201
|
+
}
|
|
202
|
+
.fixed {
|
|
203
|
+
position: fixed;
|
|
204
|
+
}
|
|
205
|
+
.relative {
|
|
206
|
+
position: relative;
|
|
207
|
+
}
|
|
208
|
+
.static {
|
|
209
|
+
position: static;
|
|
210
|
+
}
|
|
211
|
+
.sticky {
|
|
212
|
+
position: sticky;
|
|
213
|
+
}
|
|
214
|
+
.inset-y-0 {
|
|
215
|
+
inset-block: calc(var(--spacing) * 0);
|
|
216
|
+
}
|
|
217
|
+
.start-0 {
|
|
218
|
+
inset-inline-start: calc(var(--spacing) * 0);
|
|
219
|
+
}
|
|
220
|
+
.end-0 {
|
|
221
|
+
inset-inline-end: calc(var(--spacing) * 0);
|
|
222
|
+
}
|
|
223
|
+
.container {
|
|
224
|
+
width: 100%;
|
|
225
|
+
@media (width >= 40rem) {
|
|
226
|
+
max-width: 40rem;
|
|
227
|
+
}
|
|
228
|
+
@media (width >= 48rem) {
|
|
229
|
+
max-width: 48rem;
|
|
230
|
+
}
|
|
231
|
+
@media (width >= 64rem) {
|
|
232
|
+
max-width: 64rem;
|
|
233
|
+
}
|
|
234
|
+
@media (width >= 80rem) {
|
|
235
|
+
max-width: 80rem;
|
|
236
|
+
}
|
|
237
|
+
@media (width >= 96rem) {
|
|
238
|
+
max-width: 96rem;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
.block {
|
|
242
|
+
display: block;
|
|
243
|
+
}
|
|
244
|
+
.flex {
|
|
245
|
+
display: flex;
|
|
246
|
+
}
|
|
247
|
+
.hidden {
|
|
248
|
+
display: none;
|
|
249
|
+
}
|
|
250
|
+
.inline {
|
|
251
|
+
display: inline;
|
|
252
|
+
}
|
|
253
|
+
.inline-flex {
|
|
254
|
+
display: inline-flex;
|
|
255
|
+
}
|
|
256
|
+
.table {
|
|
257
|
+
display: table;
|
|
258
|
+
}
|
|
259
|
+
.size-3\\.5 {
|
|
260
|
+
width: calc(var(--spacing) * 3.5);
|
|
261
|
+
height: calc(var(--spacing) * 3.5);
|
|
262
|
+
}
|
|
263
|
+
.h-7 {
|
|
264
|
+
height: calc(var(--spacing) * 7);
|
|
265
|
+
}
|
|
266
|
+
.h-8 {
|
|
267
|
+
height: calc(var(--spacing) * 8);
|
|
268
|
+
}
|
|
269
|
+
.h-11 {
|
|
270
|
+
height: calc(var(--spacing) * 11);
|
|
271
|
+
}
|
|
272
|
+
.h-12 {
|
|
273
|
+
height: calc(var(--spacing) * 12);
|
|
274
|
+
}
|
|
275
|
+
.w-7 {
|
|
276
|
+
width: calc(var(--spacing) * 7);
|
|
277
|
+
}
|
|
278
|
+
.w-full {
|
|
279
|
+
width: 100%;
|
|
280
|
+
}
|
|
281
|
+
.flex-none {
|
|
282
|
+
flex: none;
|
|
283
|
+
}
|
|
284
|
+
.border-separate {
|
|
285
|
+
border-collapse: separate;
|
|
286
|
+
}
|
|
287
|
+
.border-spacing-0 {
|
|
288
|
+
--tw-border-spacing-x: calc(var(--spacing) * 0);
|
|
289
|
+
--tw-border-spacing-y: calc(var(--spacing) * 0);
|
|
290
|
+
border-spacing: var(--tw-border-spacing-x) var(--tw-border-spacing-y);
|
|
291
|
+
}
|
|
292
|
+
.cursor-pointer {
|
|
293
|
+
cursor: pointer;
|
|
294
|
+
}
|
|
295
|
+
.flex-wrap {
|
|
296
|
+
flex-wrap: wrap;
|
|
297
|
+
}
|
|
298
|
+
.items-baseline {
|
|
299
|
+
align-items: baseline;
|
|
300
|
+
}
|
|
301
|
+
.items-center {
|
|
302
|
+
align-items: center;
|
|
303
|
+
}
|
|
304
|
+
.gap-1\\.5 {
|
|
305
|
+
gap: calc(var(--spacing) * 1.5);
|
|
306
|
+
}
|
|
307
|
+
.gap-x-2\\.5 {
|
|
308
|
+
column-gap: calc(var(--spacing) * 2.5);
|
|
309
|
+
}
|
|
310
|
+
.gap-y-1 {
|
|
311
|
+
row-gap: calc(var(--spacing) * 1);
|
|
312
|
+
}
|
|
313
|
+
.overflow-hidden {
|
|
314
|
+
overflow: hidden;
|
|
315
|
+
}
|
|
316
|
+
.overflow-x-auto {
|
|
317
|
+
overflow-x: auto;
|
|
318
|
+
}
|
|
319
|
+
.rounded-md {
|
|
320
|
+
border-radius: var(--radius-md);
|
|
321
|
+
}
|
|
322
|
+
.rounded-xl {
|
|
323
|
+
border-radius: var(--radius-xl);
|
|
324
|
+
}
|
|
325
|
+
.border {
|
|
326
|
+
border-style: var(--tw-border-style);
|
|
327
|
+
border-width: 1px;
|
|
328
|
+
}
|
|
329
|
+
.border-b {
|
|
330
|
+
border-bottom-style: var(--tw-border-style);
|
|
331
|
+
border-bottom-width: 1px;
|
|
332
|
+
}
|
|
333
|
+
.border-table-border {
|
|
334
|
+
border-color: var(--color-table-border);
|
|
335
|
+
}
|
|
336
|
+
.border-table-divider {
|
|
337
|
+
border-color: var(--color-table-divider);
|
|
338
|
+
}
|
|
339
|
+
.bg-surface-default {
|
|
340
|
+
background-color: var(--color-surface-default);
|
|
341
|
+
}
|
|
342
|
+
.bg-table-header-bg {
|
|
343
|
+
background-color: var(--color-table-header-bg);
|
|
344
|
+
}
|
|
345
|
+
.bg-transparent {
|
|
346
|
+
background-color: transparent;
|
|
347
|
+
}
|
|
348
|
+
.bg-linear-to-l {
|
|
349
|
+
--tw-gradient-position: to left;
|
|
350
|
+
@supports (background-image: linear-gradient(in lab, red, red)) {
|
|
351
|
+
--tw-gradient-position: to left in oklab;
|
|
352
|
+
}
|
|
353
|
+
background-image: linear-gradient(var(--tw-gradient-stops));
|
|
354
|
+
}
|
|
355
|
+
.bg-linear-to-r {
|
|
356
|
+
--tw-gradient-position: to right;
|
|
357
|
+
@supports (background-image: linear-gradient(in lab, red, red)) {
|
|
358
|
+
--tw-gradient-position: to right in oklab;
|
|
359
|
+
}
|
|
360
|
+
background-image: linear-gradient(var(--tw-gradient-stops));
|
|
361
|
+
}
|
|
362
|
+
.from-transparent {
|
|
363
|
+
--tw-gradient-from: transparent;
|
|
364
|
+
--tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
|
|
365
|
+
}
|
|
366
|
+
.to-surface-default {
|
|
367
|
+
--tw-gradient-to: var(--color-surface-default);
|
|
368
|
+
--tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
|
|
369
|
+
}
|
|
370
|
+
.px-1 {
|
|
371
|
+
padding-inline: calc(var(--spacing) * 1);
|
|
372
|
+
}
|
|
373
|
+
.px-2 {
|
|
374
|
+
padding-inline: calc(var(--spacing) * 2);
|
|
375
|
+
}
|
|
376
|
+
.px-3 {
|
|
377
|
+
padding-inline: calc(var(--spacing) * 3);
|
|
378
|
+
}
|
|
379
|
+
.px-4 {
|
|
380
|
+
padding-inline: calc(var(--spacing) * 4);
|
|
381
|
+
}
|
|
382
|
+
.px-5 {
|
|
383
|
+
padding-inline: calc(var(--spacing) * 5);
|
|
384
|
+
}
|
|
385
|
+
.px-6 {
|
|
386
|
+
padding-inline: calc(var(--spacing) * 6);
|
|
387
|
+
}
|
|
388
|
+
.py-3\\.5 {
|
|
389
|
+
padding-block: calc(var(--spacing) * 3.5);
|
|
390
|
+
}
|
|
391
|
+
.py-14 {
|
|
392
|
+
padding-block: calc(var(--spacing) * 14);
|
|
393
|
+
}
|
|
394
|
+
.py-\\[9px\\] {
|
|
395
|
+
padding-block: 9px;
|
|
396
|
+
}
|
|
397
|
+
.py-\\[18px\\] {
|
|
398
|
+
padding-block: 18px;
|
|
399
|
+
}
|
|
400
|
+
.text-center {
|
|
401
|
+
text-align: center;
|
|
402
|
+
}
|
|
403
|
+
.text-end {
|
|
404
|
+
text-align: end;
|
|
405
|
+
}
|
|
406
|
+
.text-start {
|
|
407
|
+
text-align: start;
|
|
408
|
+
}
|
|
409
|
+
.align-middle {
|
|
410
|
+
vertical-align: middle;
|
|
411
|
+
}
|
|
412
|
+
.font-\\[inherit\\] {
|
|
413
|
+
font-family: inherit;
|
|
414
|
+
}
|
|
415
|
+
.font-display {
|
|
416
|
+
font-family: var(--font-display);
|
|
417
|
+
}
|
|
418
|
+
.font-mono {
|
|
419
|
+
font-family: var(--font-mono);
|
|
420
|
+
}
|
|
421
|
+
.font-sans {
|
|
422
|
+
font-family: var(--font-sans);
|
|
423
|
+
}
|
|
424
|
+
.text-sm {
|
|
425
|
+
font-size: var(--text-sm);
|
|
426
|
+
line-height: var(--tw-leading, var(--text-sm--line-height));
|
|
427
|
+
}
|
|
428
|
+
.text-xs {
|
|
429
|
+
font-size: var(--text-xs);
|
|
430
|
+
line-height: var(--tw-leading, var(--text-xs--line-height));
|
|
431
|
+
}
|
|
432
|
+
.text-\\[13px\\] {
|
|
433
|
+
font-size: 13px;
|
|
434
|
+
}
|
|
435
|
+
.text-\\[18px\\] {
|
|
436
|
+
font-size: 18px;
|
|
437
|
+
}
|
|
438
|
+
.leading-5 {
|
|
439
|
+
--tw-leading: calc(var(--spacing) * 5);
|
|
440
|
+
line-height: calc(var(--spacing) * 5);
|
|
441
|
+
}
|
|
442
|
+
.leading-6 {
|
|
443
|
+
--tw-leading: calc(var(--spacing) * 6);
|
|
444
|
+
line-height: calc(var(--spacing) * 6);
|
|
445
|
+
}
|
|
446
|
+
.leading-\\[18px\\] {
|
|
447
|
+
--tw-leading: 18px;
|
|
448
|
+
line-height: 18px;
|
|
449
|
+
}
|
|
450
|
+
.font-medium {
|
|
451
|
+
--tw-font-weight: var(--font-weight-medium);
|
|
452
|
+
font-weight: var(--font-weight-medium);
|
|
453
|
+
}
|
|
454
|
+
.font-normal {
|
|
455
|
+
--tw-font-weight: var(--font-weight-normal);
|
|
456
|
+
font-weight: var(--font-weight-normal);
|
|
457
|
+
}
|
|
458
|
+
.font-semibold {
|
|
459
|
+
--tw-font-weight: var(--font-weight-semibold);
|
|
460
|
+
font-weight: var(--font-weight-semibold);
|
|
461
|
+
}
|
|
462
|
+
.tracking-\\[-0\\.01em\\] {
|
|
463
|
+
--tw-tracking: -0.01em;
|
|
464
|
+
letter-spacing: -0.01em;
|
|
465
|
+
}
|
|
466
|
+
.whitespace-normal {
|
|
467
|
+
white-space: normal;
|
|
468
|
+
}
|
|
469
|
+
.whitespace-nowrap {
|
|
470
|
+
white-space: nowrap;
|
|
471
|
+
}
|
|
472
|
+
.text-text-primary {
|
|
473
|
+
color: var(--color-text-primary);
|
|
474
|
+
}
|
|
475
|
+
.text-text-secondary {
|
|
476
|
+
color: var(--color-text-secondary);
|
|
477
|
+
}
|
|
478
|
+
.text-text-tertiary {
|
|
479
|
+
color: var(--color-text-tertiary);
|
|
480
|
+
}
|
|
481
|
+
.tabular-nums {
|
|
482
|
+
--tw-numeric-spacing: tabular-nums;
|
|
483
|
+
font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
|
|
484
|
+
}
|
|
485
|
+
.opacity-0 {
|
|
486
|
+
opacity: 0%;
|
|
487
|
+
}
|
|
488
|
+
.opacity-70 {
|
|
489
|
+
opacity: 70%;
|
|
490
|
+
}
|
|
491
|
+
.\\[box-shadow\\:var\\(--shadow-table\\)\\] {
|
|
492
|
+
box-shadow: var(--shadow-table);
|
|
493
|
+
}
|
|
494
|
+
.transition {
|
|
495
|
+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, content-visibility, overlay, pointer-events;
|
|
496
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
497
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
498
|
+
}
|
|
499
|
+
.transition-colors {
|
|
500
|
+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
|
|
501
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
502
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
503
|
+
}
|
|
504
|
+
.transition-opacity {
|
|
505
|
+
transition-property: opacity;
|
|
506
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
507
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
508
|
+
}
|
|
509
|
+
.duration-\\[120ms\\] {
|
|
510
|
+
--tw-duration: 120ms;
|
|
511
|
+
transition-duration: 120ms;
|
|
512
|
+
}
|
|
513
|
+
.group-hover\\:bg-table-row-hover {
|
|
514
|
+
&:is(:where(.group):hover *) {
|
|
515
|
+
@media (hover: hover) {
|
|
516
|
+
background-color: var(--color-table-row-hover);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
.hover\\:bg-table-sort-hover {
|
|
521
|
+
&:hover {
|
|
522
|
+
@media (hover: hover) {
|
|
523
|
+
background-color: var(--color-table-sort-hover);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
.hover\\:text-text-primary {
|
|
528
|
+
&:hover {
|
|
529
|
+
@media (hover: hover) {
|
|
530
|
+
color: var(--color-text-primary);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
.focus-visible\\:\\[box-shadow\\:0_0_0_3px_color-mix\\(in_oklab\\,var\\(--color-focus\\)_45\\%\\,transparent\\)\\] {
|
|
535
|
+
&:focus-visible {
|
|
536
|
+
box-shadow: 0 0 0 3px color-mix(in srgb,inherit 45%,transparent);
|
|
537
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
538
|
+
box-shadow: 0 0 0 3px color-mix(in oklab,var(--color-focus) 45%,transparent);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
.focus-visible\\:\\[box-shadow\\:inset_0_0_0_2px_var\\(--color-focus\\)\\] {
|
|
543
|
+
&:focus-visible {
|
|
544
|
+
box-shadow: inset 0 0 0 2px var(--color-focus);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
.focus-visible\\:outline-none {
|
|
548
|
+
&:focus-visible {
|
|
549
|
+
--tw-outline-style: none;
|
|
550
|
+
outline-style: none;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
@property --dsgn-border-sweep-angle {
|
|
555
|
+
syntax: '<angle>';
|
|
556
|
+
inherits: false;
|
|
557
|
+
initial-value: 0deg;
|
|
558
|
+
}
|
|
559
|
+
@property --tw-border-spacing-x {
|
|
560
|
+
syntax: "<length>";
|
|
561
|
+
inherits: false;
|
|
562
|
+
initial-value: 0;
|
|
563
|
+
}
|
|
564
|
+
@property --tw-border-spacing-y {
|
|
565
|
+
syntax: "<length>";
|
|
566
|
+
inherits: false;
|
|
567
|
+
initial-value: 0;
|
|
568
|
+
}
|
|
569
|
+
@property --tw-border-style {
|
|
570
|
+
syntax: "*";
|
|
571
|
+
inherits: false;
|
|
572
|
+
initial-value: solid;
|
|
573
|
+
}
|
|
574
|
+
@property --tw-gradient-position {
|
|
575
|
+
syntax: "*";
|
|
576
|
+
inherits: false;
|
|
577
|
+
}
|
|
578
|
+
@property --tw-gradient-from {
|
|
579
|
+
syntax: "<color>";
|
|
580
|
+
inherits: false;
|
|
581
|
+
initial-value: #0000;
|
|
582
|
+
}
|
|
583
|
+
@property --tw-gradient-via {
|
|
584
|
+
syntax: "<color>";
|
|
585
|
+
inherits: false;
|
|
586
|
+
initial-value: #0000;
|
|
587
|
+
}
|
|
588
|
+
@property --tw-gradient-to {
|
|
589
|
+
syntax: "<color>";
|
|
590
|
+
inherits: false;
|
|
591
|
+
initial-value: #0000;
|
|
592
|
+
}
|
|
593
|
+
@property --tw-gradient-stops {
|
|
594
|
+
syntax: "*";
|
|
595
|
+
inherits: false;
|
|
596
|
+
}
|
|
597
|
+
@property --tw-gradient-via-stops {
|
|
598
|
+
syntax: "*";
|
|
599
|
+
inherits: false;
|
|
600
|
+
}
|
|
601
|
+
@property --tw-gradient-from-position {
|
|
602
|
+
syntax: "<length-percentage>";
|
|
603
|
+
inherits: false;
|
|
604
|
+
initial-value: 0%;
|
|
605
|
+
}
|
|
606
|
+
@property --tw-gradient-via-position {
|
|
607
|
+
syntax: "<length-percentage>";
|
|
608
|
+
inherits: false;
|
|
609
|
+
initial-value: 50%;
|
|
610
|
+
}
|
|
611
|
+
@property --tw-gradient-to-position {
|
|
612
|
+
syntax: "<length-percentage>";
|
|
613
|
+
inherits: false;
|
|
614
|
+
initial-value: 100%;
|
|
615
|
+
}
|
|
616
|
+
@property --tw-leading {
|
|
617
|
+
syntax: "*";
|
|
618
|
+
inherits: false;
|
|
619
|
+
}
|
|
620
|
+
@property --tw-font-weight {
|
|
621
|
+
syntax: "*";
|
|
622
|
+
inherits: false;
|
|
623
|
+
}
|
|
624
|
+
@property --tw-tracking {
|
|
625
|
+
syntax: "*";
|
|
626
|
+
inherits: false;
|
|
627
|
+
}
|
|
628
|
+
@property --tw-ordinal {
|
|
629
|
+
syntax: "*";
|
|
630
|
+
inherits: false;
|
|
631
|
+
}
|
|
632
|
+
@property --tw-slashed-zero {
|
|
633
|
+
syntax: "*";
|
|
634
|
+
inherits: false;
|
|
635
|
+
}
|
|
636
|
+
@property --tw-numeric-figure {
|
|
637
|
+
syntax: "*";
|
|
638
|
+
inherits: false;
|
|
639
|
+
}
|
|
640
|
+
@property --tw-numeric-spacing {
|
|
641
|
+
syntax: "*";
|
|
642
|
+
inherits: false;
|
|
643
|
+
}
|
|
644
|
+
@property --tw-numeric-fraction {
|
|
645
|
+
syntax: "*";
|
|
646
|
+
inherits: false;
|
|
647
|
+
}
|
|
648
|
+
@property --tw-duration {
|
|
649
|
+
syntax: "*";
|
|
650
|
+
inherits: false;
|
|
651
|
+
}
|
|
652
|
+
@layer properties {
|
|
653
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
654
|
+
*, ::before, ::after, ::backdrop {
|
|
655
|
+
--tw-border-spacing-x: 0;
|
|
656
|
+
--tw-border-spacing-y: 0;
|
|
657
|
+
--tw-border-style: solid;
|
|
658
|
+
--tw-gradient-position: initial;
|
|
659
|
+
--tw-gradient-from: #0000;
|
|
660
|
+
--tw-gradient-via: #0000;
|
|
661
|
+
--tw-gradient-to: #0000;
|
|
662
|
+
--tw-gradient-stops: initial;
|
|
663
|
+
--tw-gradient-via-stops: initial;
|
|
664
|
+
--tw-gradient-from-position: 0%;
|
|
665
|
+
--tw-gradient-via-position: 50%;
|
|
666
|
+
--tw-gradient-to-position: 100%;
|
|
667
|
+
--tw-leading: initial;
|
|
668
|
+
--tw-font-weight: initial;
|
|
669
|
+
--tw-tracking: initial;
|
|
670
|
+
--tw-ordinal: initial;
|
|
671
|
+
--tw-slashed-zero: initial;
|
|
672
|
+
--tw-numeric-figure: initial;
|
|
673
|
+
--tw-numeric-spacing: initial;
|
|
674
|
+
--tw-numeric-fraction: initial;
|
|
675
|
+
--tw-duration: initial;
|
|
676
|
+
--dsgn-border-sweep-angle: 0deg;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
`;
|
|
681
|
+
var Table_default = styles2;
|
|
682
|
+
|
|
683
|
+
// components/Table/src/Table.props.ts
|
|
684
|
+
var tableAlignValues = {
|
|
685
|
+
START: "start",
|
|
686
|
+
END: "end"
|
|
687
|
+
};
|
|
688
|
+
var tablePinValues = {
|
|
689
|
+
START: "start",
|
|
690
|
+
NONE: "none"
|
|
691
|
+
};
|
|
692
|
+
var tableSortDirectionValues = {
|
|
693
|
+
ASCENDING: "ascending",
|
|
694
|
+
DESCENDING: "descending"
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
// ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
698
|
+
function r(e) {
|
|
699
|
+
var t, f, n = "";
|
|
700
|
+
if (typeof e == "string" || typeof e == "number")
|
|
701
|
+
n += e;
|
|
702
|
+
else if (typeof e == "object")
|
|
703
|
+
if (Array.isArray(e)) {
|
|
704
|
+
var o = e.length;
|
|
705
|
+
for (t = 0;t < o; t++)
|
|
706
|
+
e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
707
|
+
} else
|
|
708
|
+
for (f in e)
|
|
709
|
+
e[f] && (n && (n += " "), n += f);
|
|
710
|
+
return n;
|
|
711
|
+
}
|
|
712
|
+
function clsx() {
|
|
713
|
+
for (var e, t, f = 0, n = "", o = arguments.length;f < o; f++)
|
|
714
|
+
(e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
715
|
+
return n;
|
|
716
|
+
}
|
|
717
|
+
var clsx_default = clsx;
|
|
718
|
+
|
|
719
|
+
// components/Table/src/Table.styles.ts
|
|
720
|
+
import { css as css3 } from "lit";
|
|
721
|
+
var bodySizeClasses = {
|
|
722
|
+
[sizeValues.SM]: ["text-[13px]", "leading-[18px]"],
|
|
723
|
+
[sizeValues.MD]: ["text-sm", "leading-5"],
|
|
724
|
+
[sizeValues.LG]: ["text-sm", "leading-5"]
|
|
725
|
+
};
|
|
726
|
+
var cellPaddingClasses = {
|
|
727
|
+
[sizeValues.SM]: ["px-3", "py-[9px]"],
|
|
728
|
+
[sizeValues.MD]: ["px-4", "py-3.5"],
|
|
729
|
+
[sizeValues.LG]: ["px-5", "py-[18px]"]
|
|
730
|
+
};
|
|
731
|
+
var headerSizeClasses = {
|
|
732
|
+
[sizeValues.SM]: ["h-8", "text-xs"],
|
|
733
|
+
[sizeValues.MD]: ["h-11", "text-[13px]"],
|
|
734
|
+
[sizeValues.LG]: ["h-12", "text-[13px]"]
|
|
735
|
+
};
|
|
736
|
+
var headerPaddingClasses = {
|
|
737
|
+
[sizeValues.SM]: ["px-3"],
|
|
738
|
+
[sizeValues.MD]: ["px-4"],
|
|
739
|
+
[sizeValues.LG]: ["px-5"]
|
|
740
|
+
};
|
|
741
|
+
var sortableHeaderPaddingClasses = {
|
|
742
|
+
[sizeValues.SM]: ["px-1"],
|
|
743
|
+
[sizeValues.MD]: ["px-2"],
|
|
744
|
+
[sizeValues.LG]: ["px-3"]
|
|
745
|
+
};
|
|
746
|
+
var sortButtonSizeClasses = {
|
|
747
|
+
[sizeValues.SM]: ["h-7"],
|
|
748
|
+
[sizeValues.MD]: ["h-8"],
|
|
749
|
+
[sizeValues.LG]: ["h-8"]
|
|
750
|
+
};
|
|
751
|
+
var alignClasses = {
|
|
752
|
+
[tableAlignValues.START]: "text-start",
|
|
753
|
+
[tableAlignValues.END]: "text-end"
|
|
754
|
+
};
|
|
755
|
+
var focusRingClasses = [
|
|
756
|
+
"focus-visible:outline-none",
|
|
757
|
+
"focus-visible:[box-shadow:0_0_0_3px_color-mix(in_oklab,var(--color-focus)_45%,transparent)]"
|
|
758
|
+
];
|
|
759
|
+
var containerClasses = () => clsx_default("block", "overflow-hidden", "rounded-xl", "border", "border-table-border", "bg-surface-default", "text-text-primary", "font-sans", "[box-shadow:var(--shadow-table)]");
|
|
760
|
+
var captionClasses = () => clsx_default("flex", "flex-wrap", "items-baseline", "gap-x-2.5", "gap-y-1", "px-5", "py-[18px]", "border-b", "border-table-border");
|
|
761
|
+
var captionTitleClasses = () => clsx_default("font-display", "text-[18px]", "leading-6", "font-semibold", "tracking-[-0.01em]", "text-text-primary");
|
|
762
|
+
var captionMetaClasses = () => clsx_default("font-mono", "text-xs", "text-text-secondary");
|
|
763
|
+
var frameClasses = () => clsx_default("relative");
|
|
764
|
+
var scrollerClasses = () => clsx_default("overflow-x-auto", "focus-visible:outline-none", "focus-visible:[box-shadow:inset_0_0_0_2px_var(--color-focus)]");
|
|
765
|
+
var tableClasses = (size) => clsx_default("w-full", "border-separate", "border-spacing-0", "text-start", bodySizeClasses[size]);
|
|
766
|
+
var headerCellClasses = ({
|
|
767
|
+
size,
|
|
768
|
+
align,
|
|
769
|
+
sortable
|
|
770
|
+
}) => clsx_default("bg-table-header-bg", "border-b", "border-table-border", "font-medium", "text-text-secondary", "whitespace-nowrap", "align-middle", alignClasses[align], headerSizeClasses[size], sortable ? sortableHeaderPaddingClasses[size] : headerPaddingClasses[size]);
|
|
771
|
+
var sortButtonClasses = (size, active) => clsx_default("inline-flex", "items-center", "gap-1.5", "px-2", "rounded-md", "bg-transparent", "font-[inherit]", "font-medium", "cursor-pointer", "transition-colors", "duration-[120ms]", "hover:bg-table-sort-hover", "hover:text-text-primary", active ? "text-text-primary" : "text-text-secondary", sortButtonSizeClasses[size], focusRingClasses);
|
|
772
|
+
var sortIconClasses = (active) => clsx_default("size-3.5", "flex-none", !active && ["text-text-tertiary", "opacity-70"]);
|
|
773
|
+
var rowClasses = () => clsx_default("group", "transition-colors", "duration-[120ms]");
|
|
774
|
+
var cellClasses = ({
|
|
775
|
+
size,
|
|
776
|
+
align,
|
|
777
|
+
numeric,
|
|
778
|
+
rowHeader,
|
|
779
|
+
wrap
|
|
780
|
+
}) => clsx_default("align-middle", "border-b", "border-table-divider", "group-hover:bg-table-row-hover", "transition-colors", "duration-[120ms]", alignClasses[align], cellPaddingClasses[size], wrap ? "whitespace-normal" : "whitespace-nowrap", rowHeader ? "font-medium" : "font-normal", numeric && ["font-mono", "text-[13px]", "tabular-nums"]);
|
|
781
|
+
var emptyCellClasses = () => clsx_default("px-6", "py-14", "text-center", "text-text-secondary");
|
|
782
|
+
var fadeClasses = (edge) => clsx_default("pointer-events-none", "absolute", "inset-y-0", "w-7", "opacity-0", "transition-opacity", "duration-[120ms]", edge === "start" ? ["start-0", "bg-linear-to-l"] : ["end-0", "bg-linear-to-r"], "from-transparent", "to-surface-default");
|
|
783
|
+
var srOnlyClasses = () => clsx_default("sr-only");
|
|
784
|
+
var structuralStyles = css3`
|
|
785
|
+
tbody tr:last-child > * {
|
|
786
|
+
border-bottom-width: 0;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
.pinned {
|
|
790
|
+
position: sticky;
|
|
791
|
+
inset-inline-start: 0;
|
|
792
|
+
z-index: 1;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
thead .pinned {
|
|
796
|
+
z-index: 2;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
tbody .pinned {
|
|
800
|
+
background-color: var(--color-surface-default);
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
tbody tr:hover .pinned {
|
|
804
|
+
background-color: var(--color-table-row-hover);
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
[data-overflow] .pinned {
|
|
808
|
+
box-shadow: 1px 0 0 var(--color-table-border);
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
[data-more-start] .pinned {
|
|
812
|
+
box-shadow:
|
|
813
|
+
1px 0 0 var(--color-table-border),
|
|
814
|
+
8px 0 12px -8px var(--color-table-pin-shadow);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
[data-more-start] .fade-start,
|
|
818
|
+
[data-more-end] .fade-end {
|
|
819
|
+
opacity: 1;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
@media (prefers-reduced-motion: reduce) {
|
|
823
|
+
* {
|
|
824
|
+
transition: none !important;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
`;
|
|
828
|
+
|
|
829
|
+
// components/Table/src/Table.ts
|
|
830
|
+
var CAPTION_ID = "caption";
|
|
831
|
+
|
|
832
|
+
class Table extends Base {
|
|
833
|
+
constructor() {
|
|
834
|
+
super(...arguments);
|
|
835
|
+
this.surface = surfaceValues.DARK;
|
|
836
|
+
this.size = sizeValues.MD;
|
|
837
|
+
this.columns = [];
|
|
838
|
+
this.rows = [];
|
|
839
|
+
this.rowKey = "id";
|
|
840
|
+
this.sort = null;
|
|
841
|
+
this.caption = "";
|
|
842
|
+
this.captionMeta = "";
|
|
843
|
+
this.label = "";
|
|
844
|
+
this._overflow = false;
|
|
845
|
+
this._moreStart = false;
|
|
846
|
+
this._moreEnd = false;
|
|
847
|
+
this._resizeObserver = null;
|
|
848
|
+
}
|
|
849
|
+
static styles = [Base.styles, Table_default, structuralStyles];
|
|
850
|
+
connectedCallback() {
|
|
851
|
+
super.connectedCallback();
|
|
852
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
853
|
+
this._resizeObserver = new ResizeObserver(() => this._updateEdges());
|
|
854
|
+
}
|
|
855
|
+
if (this.hasUpdated) {
|
|
856
|
+
this._observeSize();
|
|
857
|
+
this._updateEdges();
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
disconnectedCallback() {
|
|
861
|
+
super.disconnectedCallback();
|
|
862
|
+
this._resizeObserver?.disconnect();
|
|
863
|
+
this._resizeObserver = null;
|
|
864
|
+
}
|
|
865
|
+
firstUpdated() {
|
|
866
|
+
this._observeSize();
|
|
867
|
+
}
|
|
868
|
+
_observeSize() {
|
|
869
|
+
const scroller = this._scroller;
|
|
870
|
+
if (!scroller || !this._resizeObserver)
|
|
871
|
+
return;
|
|
872
|
+
this._resizeObserver.observe(scroller);
|
|
873
|
+
const table = scroller.querySelector("table");
|
|
874
|
+
if (table)
|
|
875
|
+
this._resizeObserver.observe(table);
|
|
876
|
+
}
|
|
877
|
+
updated(changedProperties) {
|
|
878
|
+
super.updated(changedProperties);
|
|
879
|
+
this.updateTheme(changedProperties, this.surface);
|
|
880
|
+
if (changedProperties.has("columns") || changedProperties.has("rows")) {
|
|
881
|
+
this._updateEdges();
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
_updateEdges() {
|
|
885
|
+
const scroller = this._scroller;
|
|
886
|
+
if (!scroller)
|
|
887
|
+
return;
|
|
888
|
+
const { scrollWidth, clientWidth } = scroller;
|
|
889
|
+
const offset = Math.abs(scroller.scrollLeft);
|
|
890
|
+
this._overflow = scrollWidth > clientWidth + 1;
|
|
891
|
+
this._moreStart = this._overflow && offset > 1;
|
|
892
|
+
this._moreEnd = this._overflow && offset + clientWidth < scrollWidth - 1;
|
|
893
|
+
}
|
|
894
|
+
_handleSort(column) {
|
|
895
|
+
const isCurrentAscending = this.sort?.column === column.key && this.sort.direction === tableSortDirectionValues.ASCENDING;
|
|
896
|
+
const direction = isCurrentAscending ? tableSortDirectionValues.DESCENDING : tableSortDirectionValues.ASCENDING;
|
|
897
|
+
this.emit("dsgn-sort", { column: column.key, direction });
|
|
898
|
+
}
|
|
899
|
+
get _rowHeaderKey() {
|
|
900
|
+
return (this.columns.find((column) => column.rowHeader) ?? this.columns[0])?.key;
|
|
901
|
+
}
|
|
902
|
+
_isPinned(column, index) {
|
|
903
|
+
if (index !== 0)
|
|
904
|
+
return false;
|
|
905
|
+
if (column.pin)
|
|
906
|
+
return column.pin === tablePinValues.START;
|
|
907
|
+
return column.key === this._rowHeaderKey;
|
|
908
|
+
}
|
|
909
|
+
_alignOf(column) {
|
|
910
|
+
if (column.align)
|
|
911
|
+
return column.align;
|
|
912
|
+
return column.numeric ? tableAlignValues.END : tableAlignValues.START;
|
|
913
|
+
}
|
|
914
|
+
_ariaSort(column) {
|
|
915
|
+
if (!column.sortable)
|
|
916
|
+
return nothing;
|
|
917
|
+
return this.sort?.column === column.key ? this.sort.direction : "none";
|
|
918
|
+
}
|
|
919
|
+
_keyOf(row, index) {
|
|
920
|
+
const key = row[this.rowKey];
|
|
921
|
+
return key === undefined || key === null ? String(index) : String(key);
|
|
922
|
+
}
|
|
923
|
+
_renderSortIcon(direction) {
|
|
924
|
+
let icon = chevronsUpDown;
|
|
925
|
+
if (direction === tableSortDirectionValues.ASCENDING)
|
|
926
|
+
icon = arrowUp;
|
|
927
|
+
if (direction === tableSortDirectionValues.DESCENDING)
|
|
928
|
+
icon = arrowDown;
|
|
929
|
+
return svg4`<svg
|
|
930
|
+
class=${sortIconClasses(direction !== "none")}
|
|
931
|
+
viewBox="0 0 24 24"
|
|
932
|
+
fill="none"
|
|
933
|
+
stroke="currentColor"
|
|
934
|
+
stroke-width="1.75"
|
|
935
|
+
stroke-linecap="round"
|
|
936
|
+
stroke-linejoin="round"
|
|
937
|
+
aria-hidden="true"
|
|
938
|
+
>${icon}</svg>`;
|
|
939
|
+
}
|
|
940
|
+
_renderHeaderContent(column) {
|
|
941
|
+
const label = column.hideLabel ? html2`<span class=${srOnlyClasses()}>${column.label}</span>` : column.label;
|
|
942
|
+
if (!column.sortable)
|
|
943
|
+
return label;
|
|
944
|
+
const direction = this.sort?.column === column.key ? this.sort.direction : "none";
|
|
945
|
+
return html2`<button
|
|
946
|
+
type="button"
|
|
947
|
+
part="sort-button"
|
|
948
|
+
class=${sortButtonClasses(this.size, direction !== "none")}
|
|
949
|
+
@click=${() => this._handleSort(column)}
|
|
950
|
+
>
|
|
951
|
+
${label}${this._renderSortIcon(direction)}
|
|
952
|
+
</button>`;
|
|
953
|
+
}
|
|
954
|
+
_renderHeaderCell(column, index) {
|
|
955
|
+
const sortable = !!column.sortable;
|
|
956
|
+
const pinned = this._isPinned(column, index);
|
|
957
|
+
return html2`<th
|
|
958
|
+
scope="col"
|
|
959
|
+
part="header-cell"
|
|
960
|
+
aria-sort=${sortable ? this._ariaSort(column) : nothing}
|
|
961
|
+
class="${pinned ? "pinned " : ""}${headerCellClasses({
|
|
962
|
+
size: this.size,
|
|
963
|
+
align: this._alignOf(column),
|
|
964
|
+
sortable
|
|
965
|
+
})}"
|
|
966
|
+
style=${column.width ? `width: ${column.width}` : nothing}
|
|
967
|
+
>
|
|
968
|
+
${this._renderHeaderContent(column)}
|
|
969
|
+
</th>`;
|
|
970
|
+
}
|
|
971
|
+
_renderCell(row, rowKey, column, index) {
|
|
972
|
+
const rowHeader = column.key === this._rowHeaderKey;
|
|
973
|
+
const value = row[column.key];
|
|
974
|
+
const classes = `${this._isPinned(column, index) ? "pinned " : ""}${cellClasses({
|
|
975
|
+
size: this.size,
|
|
976
|
+
align: this._alignOf(column),
|
|
977
|
+
numeric: !!column.numeric,
|
|
978
|
+
rowHeader,
|
|
979
|
+
wrap: !!column.wrap
|
|
980
|
+
})}`;
|
|
981
|
+
const content = html2`<slot name="cell:${rowKey}:${column.key}"
|
|
982
|
+
>${value === undefined || value === null ? "" : String(value)}</slot
|
|
983
|
+
>`;
|
|
984
|
+
return rowHeader ? html2`<th scope="row" part="cell row-header" class=${classes}>
|
|
985
|
+
${content}
|
|
986
|
+
</th>` : html2`<td part="cell" class=${classes}>${content}</td>`;
|
|
987
|
+
}
|
|
988
|
+
_renderBody() {
|
|
989
|
+
if (this.rows.length === 0) {
|
|
990
|
+
return html2`<tr>
|
|
991
|
+
<td
|
|
992
|
+
part="empty"
|
|
993
|
+
colspan=${Math.max(this.columns.length, 1)}
|
|
994
|
+
class=${emptyCellClasses()}
|
|
995
|
+
>
|
|
996
|
+
<slot name="empty"></slot>
|
|
997
|
+
</td>
|
|
998
|
+
</tr>`;
|
|
999
|
+
}
|
|
1000
|
+
return repeat(this.rows, (row, index) => this._keyOf(row, index), (row, index) => {
|
|
1001
|
+
const rowKey = this._keyOf(row, index);
|
|
1002
|
+
return html2`<tr part="row" class=${rowClasses()}>
|
|
1003
|
+
${this.columns.map((column, columnIndex) => this._renderCell(row, rowKey, column, columnIndex))}
|
|
1004
|
+
</tr>`;
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
_renderCaption() {
|
|
1008
|
+
if (!this.caption)
|
|
1009
|
+
return nothing;
|
|
1010
|
+
return html2`<div part="caption" class=${captionClasses()}>
|
|
1011
|
+
<span id=${CAPTION_ID} class=${captionTitleClasses()}
|
|
1012
|
+
>${this.caption}</span
|
|
1013
|
+
>
|
|
1014
|
+
${this.captionMeta ? html2`<span class=${captionMetaClasses()}>${this.captionMeta}</span>` : nothing}
|
|
1015
|
+
</div>`;
|
|
1016
|
+
}
|
|
1017
|
+
render() {
|
|
1018
|
+
const labelledBy = this.caption ? CAPTION_ID : nothing;
|
|
1019
|
+
const label = !this.caption && this.label ? this.label : nothing;
|
|
1020
|
+
const hasPinned = this.columns.some((column, index) => this._isPinned(column, index));
|
|
1021
|
+
return html2`<div part="container" class=${containerClasses()}>
|
|
1022
|
+
${this._renderCaption()}
|
|
1023
|
+
<div
|
|
1024
|
+
class=${frameClasses()}
|
|
1025
|
+
?data-overflow=${this._overflow}
|
|
1026
|
+
?data-more-start=${this._moreStart}
|
|
1027
|
+
?data-more-end=${this._moreEnd}
|
|
1028
|
+
>
|
|
1029
|
+
<div
|
|
1030
|
+
part="scroller"
|
|
1031
|
+
class=${scrollerClasses()}
|
|
1032
|
+
role="region"
|
|
1033
|
+
aria-labelledby=${labelledBy}
|
|
1034
|
+
aria-label=${label}
|
|
1035
|
+
tabindex="0"
|
|
1036
|
+
@scroll=${this._updateEdges}
|
|
1037
|
+
>
|
|
1038
|
+
<table
|
|
1039
|
+
part="table"
|
|
1040
|
+
class=${tableClasses(this.size)}
|
|
1041
|
+
aria-labelledby=${labelledBy}
|
|
1042
|
+
aria-label=${label}
|
|
1043
|
+
>
|
|
1044
|
+
<thead>
|
|
1045
|
+
<tr>
|
|
1046
|
+
${this.columns.map((column, index) => this._renderHeaderCell(column, index))}
|
|
1047
|
+
</tr>
|
|
1048
|
+
</thead>
|
|
1049
|
+
<tbody>
|
|
1050
|
+
${this._renderBody()}
|
|
1051
|
+
</tbody>
|
|
1052
|
+
</table>
|
|
1053
|
+
</div>
|
|
1054
|
+
${hasPinned ? nothing : html2`<div
|
|
1055
|
+
class="fade-start ${fadeClasses("start")}"
|
|
1056
|
+
aria-hidden="true"
|
|
1057
|
+
></div>`}
|
|
1058
|
+
<div class="fade-end ${fadeClasses("end")}" aria-hidden="true"></div>
|
|
1059
|
+
</div>
|
|
1060
|
+
</div>`;
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
__legacyDecorateClassTS([
|
|
1064
|
+
property({ ...surfaceProps })
|
|
1065
|
+
], Table.prototype, "surface", undefined);
|
|
1066
|
+
__legacyDecorateClassTS([
|
|
1067
|
+
property({ ...sizeProps })
|
|
1068
|
+
], Table.prototype, "size", undefined);
|
|
1069
|
+
__legacyDecorateClassTS([
|
|
1070
|
+
property({ type: Array })
|
|
1071
|
+
], Table.prototype, "columns", undefined);
|
|
1072
|
+
__legacyDecorateClassTS([
|
|
1073
|
+
property({ type: Array })
|
|
1074
|
+
], Table.prototype, "rows", undefined);
|
|
1075
|
+
__legacyDecorateClassTS([
|
|
1076
|
+
property({ type: String, attribute: "row-key" })
|
|
1077
|
+
], Table.prototype, "rowKey", undefined);
|
|
1078
|
+
__legacyDecorateClassTS([
|
|
1079
|
+
property({ type: Object })
|
|
1080
|
+
], Table.prototype, "sort", undefined);
|
|
1081
|
+
__legacyDecorateClassTS([
|
|
1082
|
+
property({ type: String })
|
|
1083
|
+
], Table.prototype, "caption", undefined);
|
|
1084
|
+
__legacyDecorateClassTS([
|
|
1085
|
+
property({ type: String, attribute: "caption-meta" })
|
|
1086
|
+
], Table.prototype, "captionMeta", undefined);
|
|
1087
|
+
__legacyDecorateClassTS([
|
|
1088
|
+
property({ type: String })
|
|
1089
|
+
], Table.prototype, "label", undefined);
|
|
1090
|
+
__legacyDecorateClassTS([
|
|
1091
|
+
state()
|
|
1092
|
+
], Table.prototype, "_overflow", undefined);
|
|
1093
|
+
__legacyDecorateClassTS([
|
|
1094
|
+
state()
|
|
1095
|
+
], Table.prototype, "_moreStart", undefined);
|
|
1096
|
+
__legacyDecorateClassTS([
|
|
1097
|
+
state()
|
|
1098
|
+
], Table.prototype, "_moreEnd", undefined);
|
|
1099
|
+
__legacyDecorateClassTS([
|
|
1100
|
+
query('[part="scroller"]')
|
|
1101
|
+
], Table.prototype, "_scroller", undefined);
|
|
1102
|
+
defineElement("dsgn-table", Table);
|
|
1103
|
+
export {
|
|
1104
|
+
Table
|
|
1105
|
+
};
|