@haiyue/ui 0.2.1 → 0.3.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/CHANGELOG.md +46 -0
- package/LICENSE +27 -0
- package/README.md +707 -5
- package/dist/adapters/web/controls.js +28 -5
- package/dist/adapters/web/renderer.js +11 -10
- package/dist/adapters/web/styles.d.ts +2 -3
- package/dist/adapters/web/styles.js +42 -18
- package/dist/alert.d.ts +39 -0
- package/dist/alert.js +144 -0
- package/dist/anchor.d.ts +60 -0
- package/dist/anchor.js +274 -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 +1 -1
- 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.d.ts +92 -0
- package/dist/carousel.js +509 -0
- package/dist/cascader.js +12 -12
- package/dist/checkbox.d.ts +12 -0
- package/dist/checkbox.js +22 -6
- package/dist/collapse.d.ts +13 -0
- package/dist/collapse.js +100 -13
- package/dist/context-menu.js +3 -3
- package/dist/core/types.d.ts +22 -3
- package/dist/core/validation.js +9 -4
- package/dist/date-picker.js +13 -13
- package/dist/descriptions.d.ts +44 -0
- package/dist/descriptions.js +169 -0
- package/dist/dialog.js +11 -11
- package/dist/divider.js +2 -2
- package/dist/draggable.js +1 -1
- package/dist/drawer.js +12 -12
- package/dist/dropdown.js +3 -3
- 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 +56 -0
- package/dist/index.js +84 -0
- package/dist/input.d.ts +11 -0
- package/dist/input.js +29 -15
- package/dist/internal/anchored-popup.d.ts +19 -0
- package/dist/internal/anchored-popup.js +89 -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/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/internal/qrcodegen.d.ts +94 -0
- package/dist/internal/qrcodegen.js +856 -0
- package/dist/masonry.d.ts +36 -0
- package/dist/masonry.js +171 -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.d.ts +73 -0
- package/dist/modal.js +361 -0
- package/dist/notification.js +9 -9
- 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/icons.d.ts +5 -0
- package/dist/portable/icons.js +24 -0
- package/dist/portable/index.d.ts +3 -0
- package/dist/portable/index.js +2 -0
- package/dist/portable/responsive.d.ts +20 -0
- package/dist/portable/responsive.js +15 -0
- package/dist/portable/theme.d.ts +6 -1
- package/dist/portable/theme.js +23 -3
- package/dist/progress.d.ts +30 -0
- package/dist/progress.js +102 -0
- package/dist/qr-code.d.ts +62 -0
- package/dist/qr-code.js +224 -0
- 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 +4 -4
- 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 +0 -2
- package/dist/table.js +46 -87
- package/dist/tabs.js +7 -7
- package/dist/tag.js +8 -8
- package/dist/time-picker.js +10 -10
- package/dist/timeline.js +12 -12
- package/dist/toast.js +9 -9
- package/dist/tooltip.js +4 -4
- package/dist/tour.js +11 -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.js +6 -5
- package/dist/upload.d.ts +107 -0
- package/dist/upload.js +353 -0
- package/dist/virtual-keyboard.js +5 -5
- package/dist/virtual-list.js +4 -4
- package/dist/virtual-mouse.js +5 -5
- package/package.json +99 -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.js
CHANGED
|
@@ -15,7 +15,7 @@ export class HYDialog extends HTMLElement {
|
|
|
15
15
|
style.textContent = `
|
|
16
16
|
:host {
|
|
17
17
|
color: var(--hy-text-color, #e6edf7);
|
|
18
|
-
font:
|
|
18
|
+
font: calc(var(--hy-font-size-sm, 12px) + 1px) var(--hy-font-family, system-ui, sans-serif);
|
|
19
19
|
}
|
|
20
20
|
dialog {
|
|
21
21
|
width: min(var(--hy-dialog-width, 460px), calc(100vw - 32px));
|
|
@@ -24,7 +24,7 @@ export class HYDialog extends HTMLElement {
|
|
|
24
24
|
padding: 0;
|
|
25
25
|
overflow: hidden;
|
|
26
26
|
border: 1px solid var(--hy-border-color, #303746);
|
|
27
|
-
border-radius: var(--hy-dialog-radius, 8px);
|
|
27
|
+
border-radius: var(--hy-dialog-radius, var(--hy-radius-lg, 8px));
|
|
28
28
|
color: inherit;
|
|
29
29
|
background: var(--hy-dialog-bg-color, var(--hy-surface-elevated-color, #171e2a));
|
|
30
30
|
box-shadow: 0 22px 70px var(--hy-dialog-shadow-color, rgba(0, 0, 0, 0.52));
|
|
@@ -37,7 +37,7 @@ export class HYDialog extends HTMLElement {
|
|
|
37
37
|
display: flex;
|
|
38
38
|
align-items: center;
|
|
39
39
|
min-height: 49px;
|
|
40
|
-
padding: 0 12px 0 16px;
|
|
40
|
+
padding: 0 var(--hy-space-6, 12px) 0 var(--hy-space-8, 16px);
|
|
41
41
|
border-bottom: 1px solid var(--hy-border-color, #303746);
|
|
42
42
|
}
|
|
43
43
|
h2 {
|
|
@@ -45,8 +45,8 @@ export class HYDialog extends HTMLElement {
|
|
|
45
45
|
min-width: 0;
|
|
46
46
|
margin: 0;
|
|
47
47
|
overflow: hidden;
|
|
48
|
-
font-size: 14px;
|
|
49
|
-
font-weight:
|
|
48
|
+
font-size: var(--hy-font-size-md, 14px);
|
|
49
|
+
font-weight: calc(var(--hy-font-weight-semibold, 600) + 50);
|
|
50
50
|
text-overflow: ellipsis;
|
|
51
51
|
white-space: nowrap;
|
|
52
52
|
}
|
|
@@ -55,27 +55,27 @@ export class HYDialog extends HTMLElement {
|
|
|
55
55
|
width: 28px;
|
|
56
56
|
height: 28px;
|
|
57
57
|
border: 0;
|
|
58
|
-
border-radius:
|
|
58
|
+
border-radius: calc(var(--hy-radius-sm, 4px) + 1px);
|
|
59
59
|
color: var(--hy-secondary-text-color, #8b99ad);
|
|
60
60
|
background: transparent;
|
|
61
61
|
cursor: pointer;
|
|
62
|
-
font: 20px/1 system-ui, sans-serif;
|
|
62
|
+
font: var(--hy-font-size-xl, 20px)/var(--hy-line-height-tight, 1) var(--hy-font-family, system-ui, sans-serif);
|
|
63
63
|
}
|
|
64
64
|
:host([dismissible]) .close { display: grid; place-items: center; }
|
|
65
65
|
.close:hover { color: inherit; background: var(--hy-hover-bg-color, #242d3b); }
|
|
66
66
|
.body {
|
|
67
67
|
max-height: calc(100vh - 160px);
|
|
68
68
|
overflow: auto;
|
|
69
|
-
padding: var(--hy-dialog-body-padding, 16px);
|
|
69
|
+
padding: var(--hy-dialog-body-padding, var(--hy-space-8, 16px));
|
|
70
70
|
color: var(--hy-dialog-body-color, var(--hy-secondary-text-color, #a8b4c5));
|
|
71
|
-
line-height: 1.
|
|
71
|
+
line-height: calc(var(--hy-line-height-relaxed, 1.5) + 0.05);
|
|
72
72
|
}
|
|
73
73
|
.footer {
|
|
74
74
|
display: flex;
|
|
75
75
|
justify-content: flex-end;
|
|
76
|
-
gap: 8px;
|
|
76
|
+
gap: var(--hy-space-4, 8px);
|
|
77
77
|
min-height: 54px;
|
|
78
|
-
padding: 10px 14px;
|
|
78
|
+
padding: var(--hy-space-5, 10px) var(--hy-space-7, 14px);
|
|
79
79
|
border-top: 1px solid var(--hy-border-color, #303746);
|
|
80
80
|
background: var(--hy-dialog-footer-bg-color, rgba(9, 13, 19, 0.22));
|
|
81
81
|
}
|
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
|
@@ -38,7 +38,7 @@ export class HYDraggable extends HTMLElement {
|
|
|
38
38
|
:host([dragging]) { z-index: var(--hy-draggable-active-z-index, 10); }
|
|
39
39
|
:host([dragging]) .surface { cursor: var(--hy-draggable-active-cursor, grabbing); }
|
|
40
40
|
: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); }
|
|
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, var(--hy-radius-md, 6px)); }
|
|
42
42
|
::slotted([data-drag-handle]) { cursor: var(--hy-draggable-cursor, grab); }
|
|
43
43
|
@media (prefers-reduced-motion: reduce) { :host { scroll-behavior: auto; } }
|
|
44
44
|
`;
|
package/dist/drawer.js
CHANGED
|
@@ -15,7 +15,7 @@ const DRAWER_STYLES = `
|
|
|
15
15
|
display: block;
|
|
16
16
|
pointer-events: none;
|
|
17
17
|
color: var(--hy-text-color, #e6edf7);
|
|
18
|
-
font:
|
|
18
|
+
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
19
|
--_duration: var(--hy-drawer-duration, 200ms);
|
|
20
20
|
}
|
|
21
21
|
.root {
|
|
@@ -33,7 +33,7 @@ const DRAWER_STYLES = `
|
|
|
33
33
|
inset: 0;
|
|
34
34
|
opacity: 0;
|
|
35
35
|
pointer-events: none;
|
|
36
|
-
background: var(--hy-drawer-mask-color, rgba(3, 7, 18, 0.58));
|
|
36
|
+
background: var(--hy-drawer-mask-color, var(--hy-dialog-backdrop-color, rgba(3, 7, 18, 0.58)));
|
|
37
37
|
backdrop-filter: blur(var(--hy-drawer-mask-blur, 1px));
|
|
38
38
|
transition: opacity var(--_duration) ease;
|
|
39
39
|
}
|
|
@@ -52,7 +52,7 @@ const DRAWER_STYLES = `
|
|
|
52
52
|
outline: none;
|
|
53
53
|
color: inherit;
|
|
54
54
|
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));
|
|
55
|
+
box-shadow: 0 0 54px var(--hy-drawer-shadow-color, var(--hy-dialog-shadow-color, rgba(0, 0, 0, 0.42)));
|
|
56
56
|
transition: transform var(--_duration) cubic-bezier(0.22, 1, 0.36, 1);
|
|
57
57
|
box-sizing: border-box;
|
|
58
58
|
}
|
|
@@ -87,7 +87,7 @@ const DRAWER_STYLES = `
|
|
|
87
87
|
flex: 0 0 auto;
|
|
88
88
|
align-items: center;
|
|
89
89
|
min-height: 52px;
|
|
90
|
-
padding: 0 12px 0
|
|
90
|
+
padding: 0 var(--hy-space-6, 12px) 0 calc(var(--hy-space-8, 16px) + 2px);
|
|
91
91
|
border-bottom: 1px solid var(--hy-border-color, #303746);
|
|
92
92
|
}
|
|
93
93
|
h2 {
|
|
@@ -95,8 +95,8 @@ const DRAWER_STYLES = `
|
|
|
95
95
|
min-width: 0;
|
|
96
96
|
margin: 0;
|
|
97
97
|
overflow: hidden;
|
|
98
|
-
font-size: 14px;
|
|
99
|
-
font-weight:
|
|
98
|
+
font-size: var(--hy-font-size-md, 14px);
|
|
99
|
+
font-weight: calc(var(--hy-font-weight-semibold, 600) + 50);
|
|
100
100
|
text-overflow: ellipsis;
|
|
101
101
|
white-space: nowrap;
|
|
102
102
|
}
|
|
@@ -106,12 +106,12 @@ const DRAWER_STYLES = `
|
|
|
106
106
|
height: 30px;
|
|
107
107
|
padding: 0;
|
|
108
108
|
border: 0;
|
|
109
|
-
border-radius:
|
|
109
|
+
border-radius: calc(var(--hy-radius-sm, 4px) + 1px);
|
|
110
110
|
place-items: center;
|
|
111
111
|
color: var(--hy-secondary-text-color, #8b99ad);
|
|
112
112
|
background: transparent;
|
|
113
113
|
cursor: pointer;
|
|
114
|
-
font: 20px/1 system-ui, sans-serif;
|
|
114
|
+
font: var(--hy-font-size-xl, 20px)/var(--hy-line-height-tight, 1) var(--hy-font-family, system-ui, sans-serif);
|
|
115
115
|
}
|
|
116
116
|
.close:hover { color: inherit; background: var(--hy-hover-bg-color, #242d3b); }
|
|
117
117
|
.close:focus-visible, .panel:focus-visible {
|
|
@@ -122,18 +122,18 @@ const DRAWER_STYLES = `
|
|
|
122
122
|
flex: 1 1 auto;
|
|
123
123
|
min-height: 0;
|
|
124
124
|
overflow: auto;
|
|
125
|
-
padding: var(--hy-drawer-body-padding,
|
|
125
|
+
padding: var(--hy-drawer-body-padding, calc(var(--hy-space-8, 16px) + 2px));
|
|
126
126
|
color: var(--hy-secondary-text-color, #a8b4c5);
|
|
127
127
|
}
|
|
128
128
|
.footer {
|
|
129
129
|
display: flex;
|
|
130
130
|
flex: 0 0 auto;
|
|
131
131
|
justify-content: flex-end;
|
|
132
|
-
gap: 8px;
|
|
132
|
+
gap: var(--hy-space-4, 8px);
|
|
133
133
|
min-height: 56px;
|
|
134
|
-
padding: 10px 16px;
|
|
134
|
+
padding: var(--hy-space-5, 10px) var(--hy-space-8, 16px);
|
|
135
135
|
border-top: 1px solid var(--hy-border-color, #303746);
|
|
136
|
-
background: var(--hy-drawer-footer-bg-color, rgba(9, 13, 19, 0.22));
|
|
136
|
+
background: var(--hy-drawer-footer-bg-color, var(--hy-dialog-footer-bg-color, rgba(9, 13, 19, 0.22)));
|
|
137
137
|
box-sizing: border-box;
|
|
138
138
|
}
|
|
139
139
|
.footer[hidden] { display: none; }
|
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));
|
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
|
`;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type HYFormItemStatus = '' | 'validating' | 'success' | 'error';
|
|
2
|
+
export interface HYFormRule {
|
|
3
|
+
required?: boolean;
|
|
4
|
+
min?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
pattern?: RegExp;
|
|
7
|
+
message?: string;
|
|
8
|
+
validator?: (value: unknown, signal: AbortSignal) => void | string | Promise<void | string>;
|
|
9
|
+
}
|
|
10
|
+
export interface HYFormItemValidateDetail {
|
|
11
|
+
name: string;
|
|
12
|
+
valid: boolean;
|
|
13
|
+
error: string;
|
|
14
|
+
}
|
|
15
|
+
export declare class HYFormItem extends HTMLElement {
|
|
16
|
+
private readonly _label;
|
|
17
|
+
private readonly _slot;
|
|
18
|
+
private readonly _help;
|
|
19
|
+
private readonly _error;
|
|
20
|
+
private readonly _pending;
|
|
21
|
+
private _rules;
|
|
22
|
+
private _status;
|
|
23
|
+
private _validation;
|
|
24
|
+
private _listeners;
|
|
25
|
+
private _observer;
|
|
26
|
+
private _managed;
|
|
27
|
+
static get observedAttributes(): string[];
|
|
28
|
+
constructor();
|
|
29
|
+
connectedCallback(): void;
|
|
30
|
+
disconnectedCallback(): void;
|
|
31
|
+
attributeChangedCallback(): void;
|
|
32
|
+
get label(): string;
|
|
33
|
+
set label(value: string);
|
|
34
|
+
get name(): string;
|
|
35
|
+
set name(value: string);
|
|
36
|
+
get required(): boolean;
|
|
37
|
+
set required(value: boolean);
|
|
38
|
+
get help(): string;
|
|
39
|
+
set help(value: string);
|
|
40
|
+
get error(): string;
|
|
41
|
+
set error(value: string);
|
|
42
|
+
get status(): HYFormItemStatus;
|
|
43
|
+
get rules(): HYFormRule[];
|
|
44
|
+
set rules(value: HYFormRule[]);
|
|
45
|
+
get validateTrigger(): 'blur' | 'change' | 'submit';
|
|
46
|
+
set validateTrigger(value: 'blur' | 'change' | 'submit');
|
|
47
|
+
get value(): unknown;
|
|
48
|
+
focus(options?: FocusOptions): void;
|
|
49
|
+
clearValidation(): void;
|
|
50
|
+
validate(): Promise<boolean>;
|
|
51
|
+
private _field;
|
|
52
|
+
private _manage;
|
|
53
|
+
private _restoreManaged;
|
|
54
|
+
private _sync;
|
|
55
|
+
private _isOwnEvent;
|
|
56
|
+
private _onInput;
|
|
57
|
+
private _onChange;
|
|
58
|
+
private _onBlur;
|
|
59
|
+
}
|
|
60
|
+
export declare function defineFormItemComponents(): void;
|