@haiyue/ui 0.2.2 → 0.3.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/CHANGELOG.md +42 -0
- package/README.md +523 -4
- package/dist/adapters/web/controls.js +48 -8
- package/dist/adapters/web/renderer.js +9 -11
- package/dist/adapters/web/styles.d.ts +2 -3
- package/dist/adapters/web/styles.js +26 -23
- package/dist/alert.d.ts +39 -0
- package/dist/alert.js +144 -0
- package/dist/anchor.d.ts +62 -0
- package/dist/anchor.js +293 -0
- package/dist/auto-complete.d.ts +83 -0
- package/dist/auto-complete.js +267 -0
- package/dist/avatar.d.ts +45 -0
- package/dist/avatar.js +135 -0
- package/dist/badge.js +5 -5
- package/dist/border-beam.js +3 -2
- package/dist/breadcrumb.js +5 -5
- package/dist/button-group.js +8 -8
- package/dist/button.js +10 -10
- package/dist/card.d.ts +29 -0
- package/dist/card.js +101 -0
- package/dist/carousel.js +6 -6
- package/dist/cascader.js +19 -13
- package/dist/checkbox.d.ts +12 -0
- package/dist/checkbox.js +22 -6
- package/dist/collapse.js +6 -6
- package/dist/context-menu.js +3 -4
- package/dist/core/actions.js +7 -8
- package/dist/core/data.d.ts +1 -1
- package/dist/core/data.js +44 -10
- package/dist/core/platform-view.js +8 -2
- package/dist/core/selection.js +4 -4
- package/dist/core/semantics.d.ts +26 -0
- package/dist/core/semantics.js +8 -0
- package/dist/core/text.js +3 -3
- package/dist/core/validation.d.ts +3 -1
- package/dist/core/validation.js +23 -5
- package/dist/date-picker.js +19 -13
- package/dist/descriptions.d.ts +44 -0
- package/dist/descriptions.js +169 -0
- package/dist/dialog.d.ts +4 -0
- package/dist/dialog.js +48 -27
- package/dist/divider.js +2 -2
- package/dist/draggable.js +5 -3
- package/dist/drawer.js +16 -24
- package/dist/dropdown.js +3 -4
- package/dist/empty.d.ts +20 -0
- package/dist/empty.js +58 -0
- package/dist/expandable.js +4 -4
- package/dist/form-item.d.ts +60 -0
- package/dist/form-item.js +212 -0
- package/dist/form.d.ts +41 -0
- package/dist/form.js +154 -0
- package/dist/history-controls.js +5 -5
- package/dist/image-preview.d.ts +22 -0
- package/dist/image-preview.js +38 -0
- package/dist/image.d.ts +52 -0
- package/dist/image.js +152 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +72 -0
- package/dist/input.d.ts +11 -0
- package/dist/input.js +32 -18
- package/dist/internal/anchored-popup.d.ts +19 -0
- package/dist/internal/anchored-popup.js +89 -0
- package/dist/internal/focus.d.ts +2 -0
- package/dist/internal/focus.js +31 -0
- package/dist/internal/form-control.d.ts +22 -0
- package/dist/internal/form-control.js +52 -0
- package/dist/internal/image-viewer.d.ts +51 -0
- package/dist/internal/image-viewer.js +210 -0
- package/dist/internal/keyboard.d.ts +2 -0
- package/dist/internal/keyboard.js +12 -0
- package/dist/internal/numbers.d.ts +2 -0
- package/dist/internal/numbers.js +8 -0
- package/dist/internal/pagination.d.ts +35 -0
- package/dist/internal/pagination.js +169 -0
- package/dist/internal/popover-base.d.ts +87 -0
- package/dist/internal/popover-base.js +365 -0
- package/dist/internal/presentation.d.ts +2 -0
- package/dist/internal/presentation.js +28 -0
- package/dist/mentions.d.ts +115 -0
- package/dist/mentions.js +485 -0
- package/dist/menu-shared.d.ts +1 -1
- package/dist/menu-shared.js +3 -3
- package/dist/menu.d.ts +63 -0
- package/dist/menu.js +339 -0
- package/dist/modal.js +11 -40
- package/dist/notification.js +11 -10
- package/dist/pagination.d.ts +34 -0
- package/dist/pagination.js +73 -0
- package/dist/popconfirm.d.ts +6 -0
- package/dist/popconfirm.js +7 -0
- package/dist/popover.d.ts +6 -0
- package/dist/popover.js +7 -0
- package/dist/portable/page.js +25 -14
- package/dist/progress.d.ts +30 -0
- package/dist/progress.js +102 -0
- package/dist/qr-code.js +3 -3
- package/dist/radio.d.ts +10 -0
- package/dist/radio.js +18 -5
- package/dist/range.js +7 -7
- package/dist/rate.js +3 -3
- package/dist/resizable.js +8 -5
- package/dist/result.d.ts +22 -0
- package/dist/result.js +88 -0
- package/dist/ribbon.d.ts +19 -0
- package/dist/ribbon.js +106 -0
- package/dist/segmented.d.ts +39 -0
- package/dist/segmented.js +192 -0
- package/dist/select.d.ts +12 -0
- package/dist/select.js +31 -13
- package/dist/skeleton.js +10 -10
- package/dist/spin.d.ts +26 -0
- package/dist/spin.js +80 -0
- package/dist/steps.js +13 -13
- package/dist/switch.d.ts +44 -0
- package/dist/switch.js +104 -0
- package/dist/table.d.ts +3 -3
- package/dist/table.js +110 -128
- package/dist/tabs.js +7 -7
- package/dist/tag.js +8 -8
- package/dist/time-picker.js +16 -10
- package/dist/timeline.js +12 -12
- package/dist/toast.js +12 -11
- package/dist/tooltip.d.ts +6 -0
- package/dist/tooltip.js +107 -6
- package/dist/tour.js +26 -17
- package/dist/tree-model.d.ts +2 -0
- package/dist/tree-model.js +32 -11
- package/dist/tree-node.js +2 -2
- package/dist/tree-select.d.ts +94 -0
- package/dist/tree-select.js +398 -0
- package/dist/tree.d.ts +0 -2
- package/dist/tree.js +14 -29
- package/dist/upload.d.ts +108 -0
- package/dist/upload.js +358 -0
- package/dist/virtual-keyboard.d.ts +1 -0
- package/dist/virtual-keyboard.js +72 -41
- package/dist/virtual-list.d.ts +1 -0
- package/dist/virtual-list.js +25 -8
- package/dist/virtual-mouse.js +7 -6
- package/dist/watermark.js +2 -1
- package/package.json +82 -1
- package/themes/haiyue-dark.css +51 -0
- package/themes/haiyue-light.css +51 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { hasSlotContent } from './internal/presentation.js';
|
|
2
|
+
/** Semantic definition list with responsive columns, spans and rich value slots. */
|
|
3
|
+
export class HYDescriptions extends HTMLElement {
|
|
4
|
+
_header = document.createElement('header');
|
|
5
|
+
_heading = document.createElement('slot');
|
|
6
|
+
_extra = document.createElement('slot');
|
|
7
|
+
_list = document.createElement('dl');
|
|
8
|
+
_rows = new Map();
|
|
9
|
+
_items = [];
|
|
10
|
+
_observer = null;
|
|
11
|
+
_width = 0;
|
|
12
|
+
static get observedAttributes() { return ['heading', 'items', 'column', 'layout', 'bordered', 'size', 'responsive', 'empty-text', 'aria-label']; }
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
16
|
+
const style = document.createElement('style');
|
|
17
|
+
style.textContent = `
|
|
18
|
+
:host { display: block; min-width: 0; color: var(--hy-text-color, #eef0ff); font: var(--hy-font-size-sm, 12px)/var(--hy-line-height-relaxed, 1.5) var(--hy-font-family, system-ui, sans-serif); }
|
|
19
|
+
header { display: flex; align-items: center; justify-content: space-between; gap: var(--hy-space-6, 12px); margin-bottom: var(--hy-space-8, 16px); }
|
|
20
|
+
h3 { flex: 1; min-width: 0; margin: 0; font-size: var(--hy-font-size-md, 14px); font-weight: var(--hy-font-weight-semibold, 600); overflow-wrap: anywhere; }
|
|
21
|
+
dl { display: grid; grid-template-columns: repeat(var(--_columns, 3), minmax(0, 1fr)); gap: var(--hy-descriptions-row-gap, var(--hy-space-6, 12px)) var(--hy-descriptions-column-gap, var(--hy-space-10, 20px)); margin: 0; min-width: 0; }
|
|
22
|
+
.item { display: grid; grid-template-columns: var(--hy-descriptions-label-width, minmax(0, 1fr)) minmax(0, 2fr); min-width: 0; gap: var(--hy-space-4, 8px); }
|
|
23
|
+
dt, dd { min-width: 0; margin: 0; overflow-wrap: anywhere; } dt { color: var(--hy-secondary-text-color, #a9add4); }
|
|
24
|
+
:host([layout="vertical"]) .item { grid-template-columns: minmax(0, 1fr); }
|
|
25
|
+
:host([bordered]) dl { gap: 1px; overflow: hidden; border: 1px solid var(--hy-border-color, #343765); border-radius: var(--hy-descriptions-radius, var(--hy-radius-md, 6px)); background: var(--hy-border-color, #343765); }
|
|
26
|
+
:host([bordered]) .item { gap: 0; background: var(--hy-surface-elevated-color, #181a40); }
|
|
27
|
+
:host([bordered]) dt, :host([bordered]) dd { padding: var(--hy-descriptions-cell-padding, var(--hy-space-6, 12px) var(--hy-space-8, 16px)); }
|
|
28
|
+
:host([bordered]) dt { background: var(--hy-surface-color, #10132f); }
|
|
29
|
+
:host([bordered]:not([layout="vertical"])) dd { border-inline-start: 1px solid var(--hy-border-color, #343765); }
|
|
30
|
+
:host([size="small"][bordered]) dt, :host([size="small"][bordered]) dd { padding: var(--hy-space-3, 6px) var(--hy-space-6, 12px); }
|
|
31
|
+
[hidden] { display: none !important; }
|
|
32
|
+
`;
|
|
33
|
+
this._header.part.add('header');
|
|
34
|
+
const heading = document.createElement('h3');
|
|
35
|
+
heading.id = 'descriptions-heading';
|
|
36
|
+
heading.part.add('heading');
|
|
37
|
+
this._heading.name = 'heading';
|
|
38
|
+
heading.append(this._heading);
|
|
39
|
+
this._extra.name = 'extra';
|
|
40
|
+
this._extra.part.add('extra');
|
|
41
|
+
this._header.append(heading, this._extra);
|
|
42
|
+
this._list.part.add('list');
|
|
43
|
+
root.append(style, this._header, this._list);
|
|
44
|
+
for (const slot of [this._heading, this._extra])
|
|
45
|
+
slot.addEventListener('slotchange', this._render);
|
|
46
|
+
}
|
|
47
|
+
connectedCallback() {
|
|
48
|
+
this._observer?.disconnect();
|
|
49
|
+
this._width = this.getBoundingClientRect().width;
|
|
50
|
+
this._observer = new ResizeObserver(entries => { this._width = entries[0]?.contentRect.width ?? 0; this._layout(); });
|
|
51
|
+
this._observer.observe(this);
|
|
52
|
+
this._render();
|
|
53
|
+
}
|
|
54
|
+
disconnectedCallback() { this._observer?.disconnect(); this._observer = null; }
|
|
55
|
+
attributeChangedCallback(name) {
|
|
56
|
+
if (name === 'items') {
|
|
57
|
+
try {
|
|
58
|
+
this._items = this._normalize(JSON.parse(this.getAttribute('items') ?? '[]'));
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
this._items = [];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
this._render();
|
|
65
|
+
}
|
|
66
|
+
get items() { return this._items.map(item => ({ ...item })); }
|
|
67
|
+
set items(value) { this._items = this._normalize(value); this._render(); }
|
|
68
|
+
get heading() { return this.getAttribute('heading') ?? ''; }
|
|
69
|
+
set heading(value) { this.setAttribute('heading', value); }
|
|
70
|
+
get column() {
|
|
71
|
+
const value = Number(this.getAttribute('column') ?? 3);
|
|
72
|
+
return Number.isFinite(value) ? Math.max(1, Math.min(6, Math.floor(value))) : 3;
|
|
73
|
+
}
|
|
74
|
+
set column(value) { this.setAttribute('column', String(value)); }
|
|
75
|
+
get layout() { return this.getAttribute('layout') === 'vertical' ? 'vertical' : 'horizontal'; }
|
|
76
|
+
set layout(value) { this.setAttribute('layout', value); }
|
|
77
|
+
get bordered() { return this.hasAttribute('bordered'); }
|
|
78
|
+
set bordered(value) { this.toggleAttribute('bordered', Boolean(value)); }
|
|
79
|
+
get size() { return this.getAttribute('size') === 'small' ? 'small' : 'default'; }
|
|
80
|
+
set size(value) { this.setAttribute('size', value); }
|
|
81
|
+
get responsive() { return this.getAttribute('responsive') !== 'false'; }
|
|
82
|
+
set responsive(value) { this.setAttribute('responsive', String(value)); }
|
|
83
|
+
get emptyText() { return this.getAttribute('empty-text') ?? '—'; }
|
|
84
|
+
set emptyText(value) { this.setAttribute('empty-text', value); }
|
|
85
|
+
_normalize(value) {
|
|
86
|
+
if (!Array.isArray(value))
|
|
87
|
+
return [];
|
|
88
|
+
const keys = new Set();
|
|
89
|
+
return value.map((raw, index) => {
|
|
90
|
+
const key = String(raw?.key ?? index);
|
|
91
|
+
if (keys.has(key))
|
|
92
|
+
throw new TypeError(`Duplicate description key: ${key}`);
|
|
93
|
+
keys.add(key);
|
|
94
|
+
const itemValue = raw?.value;
|
|
95
|
+
return { key, label: String(raw?.label ?? ''), value: typeof itemValue === 'string' || typeof itemValue === 'number' || typeof itemValue === 'boolean' ? itemValue : null,
|
|
96
|
+
span: raw?.span === 'filled' ? 'filled' : Math.max(1, Math.min(6, Math.floor(Number(raw?.span)) || 1)) };
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
_layout() {
|
|
100
|
+
const columns = this.responsive && this._width < 480 ? 1 : this.responsive && this._width < 720 ? Math.min(2, this.column) : this.column;
|
|
101
|
+
this._list.style.setProperty('--_columns', String(columns));
|
|
102
|
+
let occupied = 0;
|
|
103
|
+
for (const item of this._items) {
|
|
104
|
+
let span = item.span === 'filled' ? columns - occupied : Math.min(columns, Number(item.span) || 1);
|
|
105
|
+
if (occupied + span > columns)
|
|
106
|
+
occupied = 0;
|
|
107
|
+
span = Math.max(1, span);
|
|
108
|
+
this._rows.get(item.key)?.element.style.setProperty('grid-column', `${occupied + 1} / span ${span}`);
|
|
109
|
+
occupied = (occupied + span) % columns;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
_render = () => {
|
|
113
|
+
if (this._heading.textContent !== this.heading)
|
|
114
|
+
this._heading.textContent = this.heading;
|
|
115
|
+
const heading = Boolean(this.heading) || hasSlotContent(this._heading);
|
|
116
|
+
this._header.firstElementChild.toggleAttribute('hidden', !heading);
|
|
117
|
+
this._extra.hidden = !hasSlotContent(this._extra);
|
|
118
|
+
this._header.hidden = !heading && this._extra.hidden;
|
|
119
|
+
const label = this.getAttribute('aria-label');
|
|
120
|
+
if (label || !heading) {
|
|
121
|
+
this._list.setAttribute('aria-label', label || 'Details');
|
|
122
|
+
this._list.removeAttribute('aria-labelledby');
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
this._list.removeAttribute('aria-label');
|
|
126
|
+
this._list.setAttribute('aria-labelledby', 'descriptions-heading');
|
|
127
|
+
}
|
|
128
|
+
const keys = new Set(this._items.map(item => item.key));
|
|
129
|
+
for (const [key, row] of this._rows)
|
|
130
|
+
if (!keys.has(key)) {
|
|
131
|
+
row.element.remove();
|
|
132
|
+
this._rows.delete(key);
|
|
133
|
+
}
|
|
134
|
+
this._items.forEach((item, index) => {
|
|
135
|
+
const key = item.key;
|
|
136
|
+
let row = this._rows.get(key);
|
|
137
|
+
if (!row) {
|
|
138
|
+
const element = document.createElement('div');
|
|
139
|
+
element.className = 'item';
|
|
140
|
+
element.part.add('item');
|
|
141
|
+
element.dataset.key = key;
|
|
142
|
+
const term = document.createElement('dt');
|
|
143
|
+
term.part.add('label');
|
|
144
|
+
const label = document.createElement('slot');
|
|
145
|
+
label.name = `label-${key}`;
|
|
146
|
+
term.append(label);
|
|
147
|
+
const definition = document.createElement('dd');
|
|
148
|
+
definition.part.add('value');
|
|
149
|
+
const value = document.createElement('slot');
|
|
150
|
+
value.name = `value-${key}`;
|
|
151
|
+
definition.append(value);
|
|
152
|
+
element.append(term, definition);
|
|
153
|
+
row = { element, label, value };
|
|
154
|
+
this._rows.set(key, row);
|
|
155
|
+
}
|
|
156
|
+
if (row.label.textContent !== item.label)
|
|
157
|
+
row.label.textContent = item.label;
|
|
158
|
+
const value = item.value == null || item.value === '' ? this.emptyText : String(item.value);
|
|
159
|
+
if (row.value.textContent !== value)
|
|
160
|
+
row.value.textContent = value;
|
|
161
|
+
if (this._list.children[index] !== row.element)
|
|
162
|
+
this._list.insertBefore(row.element, this._list.children[index] ?? null);
|
|
163
|
+
});
|
|
164
|
+
this._layout();
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
export function defineDescriptionsComponents() { if (!customElements.get('hy-descriptions'))
|
|
168
|
+
customElements.define('hy-descriptions', HYDescriptions); }
|
|
169
|
+
//# sourceMappingURL=descriptions.js.map
|
package/dist/dialog.d.ts
CHANGED
|
@@ -9,9 +9,12 @@ export declare class HYDialog extends HTMLElement {
|
|
|
9
9
|
private readonly _closeButton;
|
|
10
10
|
private _returnFocus;
|
|
11
11
|
private _closeReason;
|
|
12
|
+
private _shown;
|
|
13
|
+
private _session;
|
|
12
14
|
static get observedAttributes(): string[];
|
|
13
15
|
constructor();
|
|
14
16
|
connectedCallback(): void;
|
|
17
|
+
disconnectedCallback(): void;
|
|
15
18
|
attributeChangedCallback(name: string): void;
|
|
16
19
|
get open(): boolean;
|
|
17
20
|
set open(value: boolean);
|
|
@@ -26,6 +29,7 @@ export declare class HYDialog extends HTMLElement {
|
|
|
26
29
|
close(reason?: HYDialogCloseDetail['reason']): void;
|
|
27
30
|
private _syncHeading;
|
|
28
31
|
private _syncOpen;
|
|
32
|
+
private _finishClose;
|
|
29
33
|
private _onCancel;
|
|
30
34
|
private _onDialogClick;
|
|
31
35
|
private _requestClose;
|
package/dist/dialog.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { focusedElement } from './internal/focus.js';
|
|
1
2
|
/** Accessible modal surface with slotted body/footer content and reflected open state. */
|
|
2
3
|
export class HYDialog extends HTMLElement {
|
|
3
4
|
_dialog = document.createElement('dialog');
|
|
@@ -5,6 +6,8 @@ export class HYDialog extends HTMLElement {
|
|
|
5
6
|
_closeButton = document.createElement('button');
|
|
6
7
|
_returnFocus = null;
|
|
7
8
|
_closeReason = 'programmatic';
|
|
9
|
+
_shown = false;
|
|
10
|
+
_session = 0;
|
|
8
11
|
static get observedAttributes() {
|
|
9
12
|
return ['open', 'heading', 'dismissible', 'controlled'];
|
|
10
13
|
}
|
|
@@ -15,7 +18,7 @@ export class HYDialog extends HTMLElement {
|
|
|
15
18
|
style.textContent = `
|
|
16
19
|
:host {
|
|
17
20
|
color: var(--hy-text-color, #e6edf7);
|
|
18
|
-
font:
|
|
21
|
+
font: calc(var(--hy-font-size-sm, 12px) + 1px) var(--hy-font-family, system-ui, sans-serif);
|
|
19
22
|
}
|
|
20
23
|
dialog {
|
|
21
24
|
width: min(var(--hy-dialog-width, 460px), calc(100vw - 32px));
|
|
@@ -24,7 +27,7 @@ export class HYDialog extends HTMLElement {
|
|
|
24
27
|
padding: 0;
|
|
25
28
|
overflow: hidden;
|
|
26
29
|
border: 1px solid var(--hy-border-color, #303746);
|
|
27
|
-
border-radius: var(--hy-dialog-radius, 8px);
|
|
30
|
+
border-radius: var(--hy-dialog-radius, var(--hy-radius-lg, 8px));
|
|
28
31
|
color: inherit;
|
|
29
32
|
background: var(--hy-dialog-bg-color, var(--hy-surface-elevated-color, #171e2a));
|
|
30
33
|
box-shadow: 0 22px 70px var(--hy-dialog-shadow-color, rgba(0, 0, 0, 0.52));
|
|
@@ -37,7 +40,7 @@ export class HYDialog extends HTMLElement {
|
|
|
37
40
|
display: flex;
|
|
38
41
|
align-items: center;
|
|
39
42
|
min-height: 49px;
|
|
40
|
-
padding: 0 12px 0 16px;
|
|
43
|
+
padding: 0 var(--hy-space-6, 12px) 0 var(--hy-space-8, 16px);
|
|
41
44
|
border-bottom: 1px solid var(--hy-border-color, #303746);
|
|
42
45
|
}
|
|
43
46
|
h2 {
|
|
@@ -45,8 +48,8 @@ export class HYDialog extends HTMLElement {
|
|
|
45
48
|
min-width: 0;
|
|
46
49
|
margin: 0;
|
|
47
50
|
overflow: hidden;
|
|
48
|
-
font-size: 14px;
|
|
49
|
-
font-weight:
|
|
51
|
+
font-size: var(--hy-font-size-md, 14px);
|
|
52
|
+
font-weight: calc(var(--hy-font-weight-semibold, 600) + 50);
|
|
50
53
|
text-overflow: ellipsis;
|
|
51
54
|
white-space: nowrap;
|
|
52
55
|
}
|
|
@@ -55,27 +58,27 @@ export class HYDialog extends HTMLElement {
|
|
|
55
58
|
width: 28px;
|
|
56
59
|
height: 28px;
|
|
57
60
|
border: 0;
|
|
58
|
-
border-radius:
|
|
61
|
+
border-radius: calc(var(--hy-radius-sm, 4px) + 1px);
|
|
59
62
|
color: var(--hy-secondary-text-color, #8b99ad);
|
|
60
63
|
background: transparent;
|
|
61
64
|
cursor: pointer;
|
|
62
|
-
font: 20px/1 system-ui, sans-serif;
|
|
65
|
+
font: var(--hy-font-size-xl, 20px)/var(--hy-line-height-tight, 1) var(--hy-font-family, system-ui, sans-serif);
|
|
63
66
|
}
|
|
64
67
|
:host([dismissible]) .close { display: grid; place-items: center; }
|
|
65
68
|
.close:hover { color: inherit; background: var(--hy-hover-bg-color, #242d3b); }
|
|
66
69
|
.body {
|
|
67
70
|
max-height: calc(100vh - 160px);
|
|
68
71
|
overflow: auto;
|
|
69
|
-
padding: var(--hy-dialog-body-padding, 16px);
|
|
72
|
+
padding: var(--hy-dialog-body-padding, var(--hy-space-8, 16px));
|
|
70
73
|
color: var(--hy-dialog-body-color, var(--hy-secondary-text-color, #a8b4c5));
|
|
71
|
-
line-height: 1.
|
|
74
|
+
line-height: calc(var(--hy-line-height-relaxed, 1.5) + 0.05);
|
|
72
75
|
}
|
|
73
76
|
.footer {
|
|
74
77
|
display: flex;
|
|
75
78
|
justify-content: flex-end;
|
|
76
|
-
gap: 8px;
|
|
79
|
+
gap: var(--hy-space-4, 8px);
|
|
77
80
|
min-height: 54px;
|
|
78
|
-
padding: 10px 14px;
|
|
81
|
+
padding: var(--hy-space-5, 10px) var(--hy-space-7, 14px);
|
|
79
82
|
border-top: 1px solid var(--hy-border-color, #303746);
|
|
80
83
|
background: var(--hy-dialog-footer-bg-color, rgba(9, 13, 19, 0.22));
|
|
81
84
|
}
|
|
@@ -109,6 +112,14 @@ export class HYDialog extends HTMLElement {
|
|
|
109
112
|
this._syncHeading();
|
|
110
113
|
this._syncOpen();
|
|
111
114
|
}
|
|
115
|
+
disconnectedCallback() {
|
|
116
|
+
this._shown = false;
|
|
117
|
+
this._session++;
|
|
118
|
+
this._returnFocus = null;
|
|
119
|
+
this._closeReason = 'programmatic';
|
|
120
|
+
if (this._dialog.open)
|
|
121
|
+
this._dialog.close();
|
|
122
|
+
}
|
|
112
123
|
attributeChangedCallback(name) {
|
|
113
124
|
if (name === 'heading')
|
|
114
125
|
this._syncHeading();
|
|
@@ -127,7 +138,7 @@ export class HYDialog extends HTMLElement {
|
|
|
127
138
|
showModal() {
|
|
128
139
|
if (this.open && this._dialog.open)
|
|
129
140
|
return;
|
|
130
|
-
this._returnFocus =
|
|
141
|
+
this._returnFocus = focusedElement(this.ownerDocument);
|
|
131
142
|
this._closeReason = 'programmatic';
|
|
132
143
|
this.open = true;
|
|
133
144
|
}
|
|
@@ -142,12 +153,32 @@ export class HYDialog extends HTMLElement {
|
|
|
142
153
|
}
|
|
143
154
|
_syncOpen() {
|
|
144
155
|
if (this.open && !this._dialog.open) {
|
|
145
|
-
this._returnFocus ??=
|
|
146
|
-
this.
|
|
156
|
+
this._returnFocus ??= focusedElement(this.ownerDocument);
|
|
157
|
+
this._shown = true;
|
|
158
|
+
this._session++;
|
|
159
|
+
try {
|
|
160
|
+
this._dialog.showModal();
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
this._shown = false;
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
147
166
|
return;
|
|
148
167
|
}
|
|
149
|
-
if (!this.open && this.
|
|
168
|
+
if (!this.open && this._shown)
|
|
169
|
+
this._finishClose();
|
|
170
|
+
}
|
|
171
|
+
_finishClose() {
|
|
172
|
+
const session = this._session, reason = this._closeReason, returnFocus = this._returnFocus, controlled = this.controlled;
|
|
173
|
+
this._shown = false;
|
|
174
|
+
this._returnFocus = null;
|
|
175
|
+
this._closeReason = 'programmatic';
|
|
176
|
+
this.removeAttribute('open');
|
|
177
|
+
if (this._dialog.open)
|
|
150
178
|
this._dialog.close();
|
|
179
|
+
this.dispatchEvent(new CustomEvent('dialog-close', { detail: { reason }, bubbles: true, composed: true }));
|
|
180
|
+
if (session === this._session && !this.open && this.isConnected && !controlled && returnFocus?.isConnected)
|
|
181
|
+
returnFocus.focus();
|
|
151
182
|
}
|
|
152
183
|
_onCancel = (event) => {
|
|
153
184
|
event.preventDefault();
|
|
@@ -179,19 +210,9 @@ export class HYDialog extends HTMLElement {
|
|
|
179
210
|
}
|
|
180
211
|
_onNativeClose = () => {
|
|
181
212
|
// Native close is queued. A subsequent showModal must not be undone by that old event.
|
|
182
|
-
if (this._dialog.open)
|
|
213
|
+
if (!this.isConnected || this._dialog.open || !this._shown)
|
|
183
214
|
return;
|
|
184
|
-
this.
|
|
185
|
-
const reason = this._closeReason;
|
|
186
|
-
this._closeReason = 'programmatic';
|
|
187
|
-
this.dispatchEvent(new CustomEvent('dialog-close', {
|
|
188
|
-
detail: { reason },
|
|
189
|
-
bubbles: true,
|
|
190
|
-
composed: true,
|
|
191
|
-
}));
|
|
192
|
-
if (!this.controlled)
|
|
193
|
-
this._returnFocus?.focus();
|
|
194
|
-
this._returnFocus = null;
|
|
215
|
+
this._finishClose();
|
|
195
216
|
};
|
|
196
217
|
}
|
|
197
218
|
export function defineDialogComponents() {
|
package/dist/divider.js
CHANGED
|
@@ -20,8 +20,8 @@ export class HYDivider extends HTMLElement {
|
|
|
20
20
|
const root = this.attachShadow({ mode: 'open' });
|
|
21
21
|
const style = document.createElement('style');
|
|
22
22
|
style.textContent = `
|
|
23
|
-
:host { display: block; min-width: 0; color: var(--hy-secondary-text-color, #aebbd0); font: 12px/1.4 system-ui, sans-serif; }
|
|
24
|
-
.divider { display: flex; width: 100%; align-items: center; gap: var(--_spacing, var(--hy-divider-text-gap, 12px)); box-sizing: border-box; }
|
|
23
|
+
:host { display: block; min-width: 0; color: var(--hy-secondary-text-color, #aebbd0); font: var(--hy-font-size-sm, 12px)/var(--hy-line-height-snug, 1.4) var(--hy-font-family, system-ui, sans-serif); }
|
|
24
|
+
.divider { display: flex; width: 100%; align-items: center; gap: var(--_spacing, var(--hy-divider-text-gap, var(--hy-space-6, 12px))); box-sizing: border-box; }
|
|
25
25
|
.line { flex: 1 1 auto; min-width: 0; height: 0; border-top: var(--_thickness, 1px) var(--_line-style, solid) var(--_color, var(--hy-divider-color, var(--hy-border-color, #3d4654))); }
|
|
26
26
|
.label { flex: 0 0 auto; max-width: min(70%, 64ch); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
27
27
|
.label[hidden] { display: none; }
|
package/dist/draggable.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { finiteNumber as readFiniteNumber } from './internal/numbers.js';
|
|
2
|
+
import { isKeyboardControlEvent } from './internal/keyboard.js';
|
|
1
3
|
const DEFAULT_CANCEL = 'input, textarea, select, button, a, [contenteditable="true"], [data-no-drag]';
|
|
2
4
|
function finiteNumber(value, fallback = 0) {
|
|
3
|
-
const number =
|
|
5
|
+
const number = readFiniteNumber(value, fallback);
|
|
4
6
|
return Number.isFinite(number) ? number : fallback;
|
|
5
7
|
}
|
|
6
8
|
function safeMatches(element, selector) {
|
|
@@ -38,7 +40,7 @@ export class HYDraggable extends HTMLElement {
|
|
|
38
40
|
:host([dragging]) { z-index: var(--hy-draggable-active-z-index, 10); }
|
|
39
41
|
:host([dragging]) .surface { cursor: var(--hy-draggable-active-cursor, grabbing); }
|
|
40
42
|
:host([disabled]) .surface { cursor: default; }
|
|
41
|
-
.surface:focus-visible { outline: 2px solid var(--hy-focus-border-color, #79a8ff); outline-offset: var(--hy-draggable-focus-offset, 2px); border-radius: var(--hy-draggable-focus-radius, 6px); }
|
|
43
|
+
.surface:focus-visible { outline: 2px solid var(--hy-focus-border-color, #79a8ff); outline-offset: var(--hy-draggable-focus-offset, 2px); border-radius: var(--hy-draggable-focus-radius, var(--hy-radius-md, 6px)); }
|
|
42
44
|
::slotted([data-drag-handle]) { cursor: var(--hy-draggable-cursor, grab); }
|
|
43
45
|
@media (prefers-reduced-motion: reduce) { :host { scroll-behavior: auto; } }
|
|
44
46
|
`;
|
|
@@ -164,7 +166,7 @@ export class HYDraggable extends HTMLElement {
|
|
|
164
166
|
this._completePointerDrag(this._pointerId, cancelled);
|
|
165
167
|
}
|
|
166
168
|
_handleKeydown(event) {
|
|
167
|
-
if (this.disabled || !this.keyboard)
|
|
169
|
+
if (this.disabled || !this.keyboard || event.defaultPrevented || isKeyboardControlEvent(event, this._surface))
|
|
168
170
|
return;
|
|
169
171
|
const multiplier = event.shiftKey ? 10 : 1;
|
|
170
172
|
const step = this.grid * multiplier;
|
package/dist/drawer.js
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
+
import { focusedElement, focusableElements } from './internal/focus.js';
|
|
1
2
|
const CONTENT_DESTROY_DELAY = 220;
|
|
2
|
-
const FOCUSABLE_SELECTOR = [
|
|
3
|
-
'a[href]',
|
|
4
|
-
'button:not([disabled])',
|
|
5
|
-
'input:not([disabled])',
|
|
6
|
-
'select:not([disabled])',
|
|
7
|
-
'textarea:not([disabled])',
|
|
8
|
-
'[tabindex]:not([tabindex="-1"])',
|
|
9
|
-
].join(',');
|
|
10
3
|
const DRAWER_STYLES = `
|
|
11
4
|
:host {
|
|
12
5
|
position: fixed;
|
|
@@ -15,7 +8,7 @@ const DRAWER_STYLES = `
|
|
|
15
8
|
display: block;
|
|
16
9
|
pointer-events: none;
|
|
17
10
|
color: var(--hy-text-color, #e6edf7);
|
|
18
|
-
font:
|
|
11
|
+
font: calc(var(--hy-font-size-sm, 12px) + 1px)/var(--hy-line-height-relaxed, 1.5) var(--hy-font-family, system-ui, sans-serif);
|
|
19
12
|
--_duration: var(--hy-drawer-duration, 200ms);
|
|
20
13
|
}
|
|
21
14
|
.root {
|
|
@@ -33,7 +26,7 @@ const DRAWER_STYLES = `
|
|
|
33
26
|
inset: 0;
|
|
34
27
|
opacity: 0;
|
|
35
28
|
pointer-events: none;
|
|
36
|
-
background: var(--hy-drawer-mask-color, rgba(3, 7, 18, 0.58));
|
|
29
|
+
background: var(--hy-drawer-mask-color, var(--hy-dialog-backdrop-color, rgba(3, 7, 18, 0.58)));
|
|
37
30
|
backdrop-filter: blur(var(--hy-drawer-mask-blur, 1px));
|
|
38
31
|
transition: opacity var(--_duration) ease;
|
|
39
32
|
}
|
|
@@ -52,7 +45,7 @@ const DRAWER_STYLES = `
|
|
|
52
45
|
outline: none;
|
|
53
46
|
color: inherit;
|
|
54
47
|
background: var(--hy-drawer-bg-color, var(--hy-surface-elevated-color, #171e2a));
|
|
55
|
-
box-shadow: 0 0 54px var(--hy-drawer-shadow-color, rgba(0, 0, 0, 0.42));
|
|
48
|
+
box-shadow: 0 0 54px var(--hy-drawer-shadow-color, var(--hy-dialog-shadow-color, rgba(0, 0, 0, 0.42)));
|
|
56
49
|
transition: transform var(--_duration) cubic-bezier(0.22, 1, 0.36, 1);
|
|
57
50
|
box-sizing: border-box;
|
|
58
51
|
}
|
|
@@ -87,7 +80,7 @@ const DRAWER_STYLES = `
|
|
|
87
80
|
flex: 0 0 auto;
|
|
88
81
|
align-items: center;
|
|
89
82
|
min-height: 52px;
|
|
90
|
-
padding: 0 12px 0
|
|
83
|
+
padding: 0 var(--hy-space-6, 12px) 0 calc(var(--hy-space-8, 16px) + 2px);
|
|
91
84
|
border-bottom: 1px solid var(--hy-border-color, #303746);
|
|
92
85
|
}
|
|
93
86
|
h2 {
|
|
@@ -95,8 +88,8 @@ const DRAWER_STYLES = `
|
|
|
95
88
|
min-width: 0;
|
|
96
89
|
margin: 0;
|
|
97
90
|
overflow: hidden;
|
|
98
|
-
font-size: 14px;
|
|
99
|
-
font-weight:
|
|
91
|
+
font-size: var(--hy-font-size-md, 14px);
|
|
92
|
+
font-weight: calc(var(--hy-font-weight-semibold, 600) + 50);
|
|
100
93
|
text-overflow: ellipsis;
|
|
101
94
|
white-space: nowrap;
|
|
102
95
|
}
|
|
@@ -106,12 +99,12 @@ const DRAWER_STYLES = `
|
|
|
106
99
|
height: 30px;
|
|
107
100
|
padding: 0;
|
|
108
101
|
border: 0;
|
|
109
|
-
border-radius:
|
|
102
|
+
border-radius: calc(var(--hy-radius-sm, 4px) + 1px);
|
|
110
103
|
place-items: center;
|
|
111
104
|
color: var(--hy-secondary-text-color, #8b99ad);
|
|
112
105
|
background: transparent;
|
|
113
106
|
cursor: pointer;
|
|
114
|
-
font: 20px/1 system-ui, sans-serif;
|
|
107
|
+
font: var(--hy-font-size-xl, 20px)/var(--hy-line-height-tight, 1) var(--hy-font-family, system-ui, sans-serif);
|
|
115
108
|
}
|
|
116
109
|
.close:hover { color: inherit; background: var(--hy-hover-bg-color, #242d3b); }
|
|
117
110
|
.close:focus-visible, .panel:focus-visible {
|
|
@@ -122,18 +115,18 @@ const DRAWER_STYLES = `
|
|
|
122
115
|
flex: 1 1 auto;
|
|
123
116
|
min-height: 0;
|
|
124
117
|
overflow: auto;
|
|
125
|
-
padding: var(--hy-drawer-body-padding,
|
|
118
|
+
padding: var(--hy-drawer-body-padding, calc(var(--hy-space-8, 16px) + 2px));
|
|
126
119
|
color: var(--hy-secondary-text-color, #a8b4c5);
|
|
127
120
|
}
|
|
128
121
|
.footer {
|
|
129
122
|
display: flex;
|
|
130
123
|
flex: 0 0 auto;
|
|
131
124
|
justify-content: flex-end;
|
|
132
|
-
gap: 8px;
|
|
125
|
+
gap: var(--hy-space-4, 8px);
|
|
133
126
|
min-height: 56px;
|
|
134
|
-
padding: 10px 16px;
|
|
127
|
+
padding: var(--hy-space-5, 10px) var(--hy-space-8, 16px);
|
|
135
128
|
border-top: 1px solid var(--hy-border-color, #303746);
|
|
136
|
-
background: var(--hy-drawer-footer-bg-color, rgba(9, 13, 19, 0.22));
|
|
129
|
+
background: var(--hy-drawer-footer-bg-color, var(--hy-dialog-footer-bg-color, rgba(9, 13, 19, 0.22)));
|
|
137
130
|
box-sizing: border-box;
|
|
138
131
|
}
|
|
139
132
|
.footer[hidden] { display: none; }
|
|
@@ -278,7 +271,7 @@ export class HYDrawer extends HTMLElement {
|
|
|
278
271
|
if (this.open) {
|
|
279
272
|
this._cancelContentDestroy();
|
|
280
273
|
this._restoreContent();
|
|
281
|
-
this._returnFocus ??=
|
|
274
|
+
this._returnFocus ??= focusedElement(this.ownerDocument);
|
|
282
275
|
this._panel.setAttribute('aria-hidden', 'false');
|
|
283
276
|
this._syncPanelSemantics();
|
|
284
277
|
this._attachDocumentListener();
|
|
@@ -329,14 +322,13 @@ export class HYDrawer extends HTMLElement {
|
|
|
329
322
|
}
|
|
330
323
|
if (event.key !== 'Tab' || !this.mask)
|
|
331
324
|
return;
|
|
332
|
-
const focusable =
|
|
333
|
-
.filter(element => !element.hidden && element.getAttribute('aria-hidden') !== 'true');
|
|
325
|
+
const focusable = focusableElements(this._panel);
|
|
334
326
|
if (focusable.length === 0) {
|
|
335
327
|
event.preventDefault();
|
|
336
328
|
this._panel.focus();
|
|
337
329
|
return;
|
|
338
330
|
}
|
|
339
|
-
const active = this.
|
|
331
|
+
const active = focusedElement(this.ownerDocument);
|
|
340
332
|
const index = focusable.indexOf(active);
|
|
341
333
|
if (event.shiftKey && index <= 0) {
|
|
342
334
|
event.preventDefault();
|
package/dist/dropdown.js
CHANGED
|
@@ -18,7 +18,7 @@ export class HYDropdown extends HTMLElement {
|
|
|
18
18
|
width: max-content;
|
|
19
19
|
min-width: 0;
|
|
20
20
|
color: var(--hy-text-color, #d8e2f2);
|
|
21
|
-
font: 12px system-ui, sans-serif;
|
|
21
|
+
font: var(--hy-font-size-sm, 12px) var(--hy-font-family, system-ui, sans-serif);
|
|
22
22
|
}
|
|
23
23
|
:host([disabled]) {
|
|
24
24
|
pointer-events: none;
|
|
@@ -32,9 +32,9 @@ export class HYDropdown extends HTMLElement {
|
|
|
32
32
|
max-height: min(320px, calc(100vh - 12px));
|
|
33
33
|
overflow: auto;
|
|
34
34
|
display: none;
|
|
35
|
-
padding: 4px;
|
|
35
|
+
padding: var(--hy-space-2, 4px);
|
|
36
36
|
border: 1px solid var(--hy-border-color, #303746);
|
|
37
|
-
border-radius: 4px;
|
|
37
|
+
border-radius: var(--hy-radius-sm, 4px);
|
|
38
38
|
color: var(--hy-text-color, #d8e2f2);
|
|
39
39
|
background: var(--hy-menu-bg-color, var(--hy-surface-elevated-color, #1b2230));
|
|
40
40
|
box-shadow: 0 10px 26px var(--hy-menu-shadow-color, rgba(0, 0, 0, 0.36));
|
|
@@ -49,7 +49,6 @@ ${GE_MENU_ITEM_STYLES}
|
|
|
49
49
|
this._root.append(this._style, this._triggerSlot, this._menu);
|
|
50
50
|
}
|
|
51
51
|
connectedCallback() {
|
|
52
|
-
this._readItemsAttribute();
|
|
53
52
|
this._render();
|
|
54
53
|
this.addEventListener('click', this._onHostClick);
|
|
55
54
|
this._syncDocumentListeners();
|
package/dist/empty.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type HYEmptyImage = 'default' | 'simple' | 'none';
|
|
2
|
+
export type HYEmptySize = 'small' | 'default';
|
|
3
|
+
/** Empty-state illustration, description and slotted actions. */
|
|
4
|
+
export declare class HYEmpty extends HTMLElement {
|
|
5
|
+
private readonly _image;
|
|
6
|
+
private readonly _description;
|
|
7
|
+
private readonly _actions;
|
|
8
|
+
static get observedAttributes(): string[];
|
|
9
|
+
constructor();
|
|
10
|
+
connectedCallback(): void;
|
|
11
|
+
attributeChangedCallback(): void;
|
|
12
|
+
get description(): string;
|
|
13
|
+
set description(value: string);
|
|
14
|
+
get image(): HYEmptyImage;
|
|
15
|
+
set image(value: HYEmptyImage);
|
|
16
|
+
get size(): HYEmptySize;
|
|
17
|
+
set size(value: HYEmptySize);
|
|
18
|
+
private _render;
|
|
19
|
+
}
|
|
20
|
+
export declare function defineEmptyComponents(): void;
|
package/dist/empty.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { hasSlotContent, presentationIcon } from './internal/presentation.js';
|
|
2
|
+
/** Empty-state illustration, description and slotted actions. */
|
|
3
|
+
export class HYEmpty extends HTMLElement {
|
|
4
|
+
_image = document.createElement('slot');
|
|
5
|
+
_description = document.createElement('slot');
|
|
6
|
+
_actions = document.createElement('slot');
|
|
7
|
+
static get observedAttributes() { return ['description', 'image', 'size']; }
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
11
|
+
const style = document.createElement('style');
|
|
12
|
+
style.textContent = `
|
|
13
|
+
:host { display: block; min-width: 0; color: var(--hy-secondary-text-color, #a9add4); font: var(--hy-font-size-sm, 12px)/var(--hy-line-height-relaxed, 1.5) var(--hy-font-family, system-ui, sans-serif); }
|
|
14
|
+
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--hy-space-6, 12px); padding: var(--hy-empty-padding, var(--hy-space-12, 24px)); text-align: center; overflow-wrap: anywhere; }
|
|
15
|
+
.image { display: flex; justify-content: center; width: var(--hy-empty-image-size, 80px); max-width: 100%; color: var(--hy-empty-image-color, var(--hy-muted-color, #777baf)); }
|
|
16
|
+
.image svg { width: 100%; height: auto; } .image::slotted(*) { max-width: 100%; max-height: var(--hy-empty-image-size, 80px); object-fit: contain; }
|
|
17
|
+
:host([image="simple"]) .image { width: 48px; opacity: .65; }
|
|
18
|
+
:host([size="small"]) .empty { gap: var(--hy-space-3, 6px); padding: var(--hy-space-6, 12px); }
|
|
19
|
+
:host([size="small"]) .image { width: 40px; }
|
|
20
|
+
.description { display: block; max-width: 100%; } .actions { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--hy-space-4, 8px); }
|
|
21
|
+
[hidden] { display: none !important; }
|
|
22
|
+
`;
|
|
23
|
+
const surface = document.createElement('div');
|
|
24
|
+
surface.className = 'empty';
|
|
25
|
+
surface.part.add('empty');
|
|
26
|
+
this._image.name = 'image';
|
|
27
|
+
this._image.className = 'image';
|
|
28
|
+
this._image.part.add('image');
|
|
29
|
+
this._image.append(presentationIcon('empty'));
|
|
30
|
+
this._description.name = 'description';
|
|
31
|
+
this._description.className = 'description';
|
|
32
|
+
this._description.part.add('description');
|
|
33
|
+
this._actions.className = 'actions';
|
|
34
|
+
this._actions.part.add('actions');
|
|
35
|
+
surface.append(this._image, this._description, this._actions);
|
|
36
|
+
root.append(style, surface);
|
|
37
|
+
for (const slot of [this._image, this._description, this._actions])
|
|
38
|
+
slot.addEventListener('slotchange', this._render);
|
|
39
|
+
}
|
|
40
|
+
connectedCallback() { this._render(); }
|
|
41
|
+
attributeChangedCallback() { this._render(); }
|
|
42
|
+
get description() { return this.getAttribute('description') ?? 'No data'; }
|
|
43
|
+
set description(value) { this.setAttribute('description', value); }
|
|
44
|
+
get image() { const value = this.getAttribute('image'); return value === 'simple' || value === 'none' ? value : 'default'; }
|
|
45
|
+
set image(value) { this.setAttribute('image', value); }
|
|
46
|
+
get size() { return this.getAttribute('size') === 'small' ? 'small' : 'default'; }
|
|
47
|
+
set size(value) { this.setAttribute('size', value); }
|
|
48
|
+
_render = () => {
|
|
49
|
+
this._image.hidden = this.image === 'none';
|
|
50
|
+
if (this._description.textContent !== this.description)
|
|
51
|
+
this._description.textContent = this.description;
|
|
52
|
+
this._description.hidden = !this.description && !hasSlotContent(this._description);
|
|
53
|
+
this._actions.hidden = !hasSlotContent(this._actions);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export function defineEmptyComponents() { if (!customElements.get('hy-empty'))
|
|
57
|
+
customElements.define('hy-empty', HYEmpty); }
|
|
58
|
+
//# sourceMappingURL=empty.js.map
|
package/dist/expandable.js
CHANGED
|
@@ -16,13 +16,13 @@ export class HYExpandable extends HTMLElement {
|
|
|
16
16
|
:host { display:block; position:relative; min-width:0; min-height:0; }
|
|
17
17
|
.placeholder { display:none; pointer-events:none; }
|
|
18
18
|
.panel { position:relative; display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr); width:100%; height:100%; min-width:0; min-height:0; box-sizing:border-box; color:inherit; font:inherit; }
|
|
19
|
-
.panel:popover-open { position:fixed; inset:0; margin:auto; width:var(--_width,90vw); height:var(--_height,90dvh); max-width:calc(100vw - 2 * var(--hy-expandable-margin,16px)); max-height:calc(100dvh - 2 * var(--hy-expandable-margin,16px)); padding:var(--hy-expandable-padding,16px); border:1px solid var(--hy-border-color,#536074); border-radius:var(--hy-expandable-radius,
|
|
19
|
+
.panel:popover-open { position:fixed; inset:0; margin:auto; width:var(--_width,90vw); height:var(--_height,90dvh); max-width:calc(100vw - 2 * var(--hy-expandable-margin,var(--hy-space-8, 16px))); max-height:calc(100dvh - 2 * var(--hy-expandable-margin,var(--hy-space-8, 16px))); padding:var(--hy-expandable-padding,var(--hy-space-8, 16px)); border:1px solid var(--hy-border-color,#536074); border-radius:var(--hy-expandable-radius,calc(var(--hy-radius-lg, 8px) + 2px)); background:var(--hy-surface-color,#18202e); box-shadow:var(--hy-expandable-shadow,0 16px 64px var(--hy-shadow-color, #0006)); }
|
|
20
20
|
.panel::backdrop { background:transparent; pointer-events:none; }
|
|
21
|
-
button { position:absolute; z-index:2; top:var(--hy-expandable-button-offset,8px); right:var(--hy-expandable-button-offset,8px); display:grid; place-items:center; width:var(--hy-expandable-button-size,32px); height:var(--hy-expandable-button-size,32px); padding:6px; border:1px solid var(--hy-border-color,#536074); border-radius:6px; color:var(--hy-text-color,inherit); background:var(--hy-surface-color,#18202e); cursor:pointer; }
|
|
21
|
+
button { position:absolute; z-index:2; top:var(--hy-expandable-button-offset,var(--hy-space-4, 8px)); right:var(--hy-expandable-button-offset,var(--hy-space-4, 8px)); display:grid; place-items:center; width:var(--hy-expandable-button-size,32px); height:var(--hy-expandable-button-size,32px); padding:var(--hy-space-3, 6px); border:1px solid var(--hy-border-color,#536074); border-radius:var(--hy-radius-md, 6px); color:var(--hy-text-color,inherit); background:var(--hy-surface-color,#18202e); cursor:pointer; }
|
|
22
22
|
button:hover { color:var(--hy-accent-color,#7dd3fc); }
|
|
23
23
|
button:focus-visible { outline:2px solid var(--hy-accent-color,#7dd3fc); outline-offset:2px; }
|
|
24
|
-
button[data-position$="left"] { left:var(--hy-expandable-button-offset,8px); right:auto; }
|
|
25
|
-
button[data-position^="bottom"] { bottom:var(--hy-expandable-button-offset,8px); top:auto; }
|
|
24
|
+
button[data-position$="left"] { left:var(--hy-expandable-button-offset,var(--hy-space-4, 8px)); right:auto; }
|
|
25
|
+
button[data-position^="bottom"] { bottom:var(--hy-expandable-button-offset,var(--hy-space-4, 8px)); top:auto; }
|
|
26
26
|
svg, ::slotted([slot="expand-icon"]), ::slotted([slot="restore-icon"]) { width:100%; height:100%; pointer-events:none; }
|
|
27
27
|
slot[hidden] { display:none; }
|
|
28
28
|
`;
|