@haiyue/ui 0.2.2 → 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 +30 -0
- package/README.md +506 -2
- package/dist/adapters/web/renderer.js +1 -8
- 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 +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.js +6 -6
- package/dist/cascader.js +12 -12
- 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 -3
- 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 +48 -0
- package/dist/index.js +72 -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/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 +10 -10
- 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/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 +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 +82 -1
- package/themes/haiyue-dark.css +51 -0
- package/themes/haiyue-light.css +51 -0
package/dist/switch.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { HYFormControl } from './internal/form-control.js';
|
|
2
|
+
export class HYSwitch extends HTMLElement {
|
|
3
|
+
static formAssociated = true;
|
|
4
|
+
_input = document.createElement('input');
|
|
5
|
+
_text = document.createElement('span');
|
|
6
|
+
_labelSlot = document.createElement('slot');
|
|
7
|
+
_formControl = new HYFormControl(this, this._input);
|
|
8
|
+
static get observedAttributes() { return ['checked', 'disabled', 'loading', 'required', 'name', 'value', 'label', 'aria-label', 'checked-text', 'unchecked-text', 'size']; }
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
12
|
+
const style = document.createElement('style');
|
|
13
|
+
style.textContent = `
|
|
14
|
+
:host { display: inline-block; color: var(--hy-text-color, #d8e2f2); font: var(--hy-font-size-sm, 12px)/1.5 var(--hy-font-family, system-ui, sans-serif); }
|
|
15
|
+
label { display: inline-flex; align-items: center; gap: var(--hy-space-4, 8px); cursor: pointer; }
|
|
16
|
+
input { position: absolute; width: 1px; height: 1px; opacity: 0; clip-path: inset(50%); }
|
|
17
|
+
.track { position: relative; display: inline-flex; align-items: center; box-sizing: border-box; min-width: 38px; height: 22px; padding: 0 7px 0 24px; border-radius: 999px; background: var(--hy-switch-off-bg, var(--hy-disabled-text-color, #65738a)); color: var(--hy-selected-text-color, #fff); transition: background 120ms; }
|
|
18
|
+
.thumb { position: absolute; inset-inline-start: 3px; top: 3px; width: 16px; height: 16px; box-sizing: border-box; border-radius: 50%; background: var(--hy-switch-thumb-color, var(--hy-selected-text-color, #fff)); transition: inset-inline-start 120ms; }
|
|
19
|
+
.state { font-size: 11px; white-space: nowrap; }
|
|
20
|
+
input:checked + .track { padding-inline: 7px 24px; background: var(--hy-switch-on-bg, var(--hy-accent-strong-color, #554cc6)); }
|
|
21
|
+
input:checked + .track .thumb { inset-inline-start: calc(100% - 19px); }
|
|
22
|
+
input:focus-visible + .track { outline: 2px solid var(--hy-focus-border-color, #79a8ff); outline-offset: 2px; }
|
|
23
|
+
input:disabled ~ * { opacity: .55; cursor: not-allowed; }
|
|
24
|
+
:host([size="small"]) .track { min-width: 30px; height: 18px; padding-inline: 20px 5px; }
|
|
25
|
+
:host([size="small"]) .thumb { width: 12px; height: 12px; }
|
|
26
|
+
:host([size="small"]) input:checked + .track { padding-inline: 5px 20px; }
|
|
27
|
+
:host([size="small"]) input:checked + .track .thumb { inset-inline-start: calc(100% - 15px); }
|
|
28
|
+
:host([loading]) .thumb::after { content: ''; position: absolute; inset: 3px; border: 2px solid var(--hy-border-color, #65738a); border-top-color: transparent; border-radius: 50%; animation: hy-switch-spin .8s linear infinite; }
|
|
29
|
+
@keyframes hy-switch-spin { to { transform: rotate(360deg); } }
|
|
30
|
+
@media (prefers-reduced-motion: reduce) { .track, .thumb { transition: none; } :host([loading]) .thumb::after { animation: none; } }
|
|
31
|
+
`;
|
|
32
|
+
const label = document.createElement('label');
|
|
33
|
+
label.part.add('label');
|
|
34
|
+
const track = document.createElement('span');
|
|
35
|
+
track.className = 'track';
|
|
36
|
+
track.part.add('track');
|
|
37
|
+
track.setAttribute('aria-hidden', 'true');
|
|
38
|
+
const thumb = document.createElement('span');
|
|
39
|
+
thumb.className = 'thumb';
|
|
40
|
+
thumb.part.add('thumb');
|
|
41
|
+
this._text.className = 'state';
|
|
42
|
+
this._text.part.add('state');
|
|
43
|
+
this._input.type = 'checkbox';
|
|
44
|
+
this._input.setAttribute('role', 'switch');
|
|
45
|
+
this._input.part.add('input');
|
|
46
|
+
track.append(thumb, this._text);
|
|
47
|
+
label.append(this._input, track, this._labelSlot);
|
|
48
|
+
root.append(style, label);
|
|
49
|
+
}
|
|
50
|
+
connectedCallback() { this._input.addEventListener('change', this._onChange); this._input.addEventListener('keydown', this._onKeydown); this._sync(); this._formControl.connect(); }
|
|
51
|
+
disconnectedCallback() { this._input.removeEventListener('change', this._onChange); this._input.removeEventListener('keydown', this._onKeydown); }
|
|
52
|
+
attributeChangedCallback() { this._sync(); }
|
|
53
|
+
get checked() { return this.hasAttribute('checked'); }
|
|
54
|
+
set checked(value) { this.toggleAttribute('checked', Boolean(value)); }
|
|
55
|
+
get disabled() { return this.hasAttribute('disabled'); }
|
|
56
|
+
set disabled(value) { this.toggleAttribute('disabled', Boolean(value)); }
|
|
57
|
+
get loading() { return this.hasAttribute('loading'); }
|
|
58
|
+
set loading(value) { this.toggleAttribute('loading', Boolean(value)); }
|
|
59
|
+
get value() { return this.getAttribute('value') ?? 'on'; }
|
|
60
|
+
set value(value) { this.setAttribute('value', String(value)); }
|
|
61
|
+
get name() { return this.getAttribute('name') ?? ''; }
|
|
62
|
+
set name(value) { this.setAttribute('name', value); }
|
|
63
|
+
get label() { return this.getAttribute('label') ?? ''; }
|
|
64
|
+
set label(value) { this.setAttribute('label', value); }
|
|
65
|
+
get size() { return this.getAttribute('size') === 'small' ? 'small' : 'default'; }
|
|
66
|
+
set size(value) { this.setAttribute('size', value); }
|
|
67
|
+
get form() { return this._formControl.internals.form; }
|
|
68
|
+
checkValidity() { return this._formControl.internals.checkValidity(); }
|
|
69
|
+
reportValidity() { return this._formControl.internals.reportValidity(); }
|
|
70
|
+
setCustomValidity(message) { this._formControl.setCustomValidity(message); }
|
|
71
|
+
formDisabledCallback(disabled) { this._formControl.disabled = disabled; this._sync(); }
|
|
72
|
+
formResetCallback() { this._formControl.reset(); }
|
|
73
|
+
formStateRestoreCallback(state) { this._formControl.restore(state); }
|
|
74
|
+
focus(options) { this._input.focus(options); }
|
|
75
|
+
click() { this._input.click(); }
|
|
76
|
+
_sync() {
|
|
77
|
+
this._input.checked = this.checked;
|
|
78
|
+
this._input.disabled = this.disabled || this.loading || this._formControl.disabled;
|
|
79
|
+
this._input.required = this.hasAttribute('required');
|
|
80
|
+
this._input.value = this.value;
|
|
81
|
+
this._input.setAttribute('aria-checked', String(this.checked));
|
|
82
|
+
this._input.setAttribute('aria-busy', String(this.loading));
|
|
83
|
+
const name = this.getAttribute('aria-label') ?? this.label;
|
|
84
|
+
if (name)
|
|
85
|
+
this._input.setAttribute('aria-label', name);
|
|
86
|
+
else
|
|
87
|
+
this._input.removeAttribute('aria-label');
|
|
88
|
+
this._labelSlot.textContent = this.label;
|
|
89
|
+
this._text.textContent = this.getAttribute(this.checked ? 'checked-text' : 'unchecked-text') ?? '';
|
|
90
|
+
this._formControl.sync();
|
|
91
|
+
}
|
|
92
|
+
_onChange = () => {
|
|
93
|
+
this.checked = this._input.checked;
|
|
94
|
+
this.dispatchEvent(new CustomEvent('checked-change', { detail: { checked: this.checked, value: this.value }, bubbles: true, composed: true }));
|
|
95
|
+
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
|
96
|
+
};
|
|
97
|
+
_onKeydown = (event) => { if (event.key === 'Enter' && !event.isComposing) {
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
this._input.click();
|
|
100
|
+
} };
|
|
101
|
+
}
|
|
102
|
+
export function defineSwitchComponents() { if (!customElements.get('hy-switch'))
|
|
103
|
+
customElements.define('hy-switch', HYSwitch); }
|
|
104
|
+
//# sourceMappingURL=switch.js.map
|
package/dist/table.d.ts
CHANGED
|
@@ -94,8 +94,6 @@ export declare class HYTable<T extends object = Record<string, unknown>> extends
|
|
|
94
94
|
private _renderBodyAndPagination;
|
|
95
95
|
private _createRow;
|
|
96
96
|
private _renderPagination;
|
|
97
|
-
private _pageButton;
|
|
98
|
-
private _pageNumbers;
|
|
99
97
|
private _processedRecords;
|
|
100
98
|
private _visibleRecords;
|
|
101
99
|
private _clampPage;
|
package/dist/table.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HYPaginationControls, HY_PAGINATION_STYLES } from './internal/pagination.js';
|
|
1
2
|
const DEFAULT_PAGE_SIZE = 10;
|
|
2
3
|
const DEFAULT_PAGE_SIZE_OPTIONS = [5, 10, 20, 50];
|
|
3
4
|
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' });
|
|
@@ -47,7 +48,12 @@ export class HYTable extends HTMLElement {
|
|
|
47
48
|
_table = document.createElement('table');
|
|
48
49
|
_head = document.createElement('thead');
|
|
49
50
|
_body = document.createElement('tbody');
|
|
50
|
-
_pagination =
|
|
51
|
+
_pagination = new HYPaginationControls((page, pageSize, source) => {
|
|
52
|
+
if (source === 'size')
|
|
53
|
+
this.pageSize = pageSize;
|
|
54
|
+
else
|
|
55
|
+
this.goToPage(page);
|
|
56
|
+
}, 'table');
|
|
51
57
|
_columns = [];
|
|
52
58
|
_dataSource = [];
|
|
53
59
|
_filters = {};
|
|
@@ -68,12 +74,12 @@ export class HYTable extends HTMLElement {
|
|
|
68
74
|
display: block;
|
|
69
75
|
min-width: 0;
|
|
70
76
|
color: var(--hy-text-color, #eef3ff);
|
|
71
|
-
font:
|
|
77
|
+
font: calc(var(--hy-font-size-sm, 12px) + 1px)/var(--hy-line-height-snug, 1.4) var(--hy-font-family, system-ui, sans-serif);
|
|
72
78
|
}
|
|
73
79
|
.scroller {
|
|
74
80
|
overflow: auto;
|
|
75
81
|
border: 1px solid var(--hy-border-color, #3d4654);
|
|
76
|
-
border-radius: var(--hy-table-radius,
|
|
82
|
+
border-radius: var(--hy-table-radius, calc(var(--hy-radius-md, 6px) + 1px));
|
|
77
83
|
background: var(--hy-surface-color, #171d27);
|
|
78
84
|
scrollbar-color: var(--hy-border-strong-color, #596779) var(--hy-input-bg-color, #111722);
|
|
79
85
|
scrollbar-width: thin;
|
|
@@ -82,7 +88,7 @@ export class HYTable extends HTMLElement {
|
|
|
82
88
|
th, td {
|
|
83
89
|
box-sizing: border-box;
|
|
84
90
|
min-width: 0;
|
|
85
|
-
padding: var(--hy-table-cell-padding,
|
|
91
|
+
padding: var(--hy-table-cell-padding, calc(var(--hy-space-5, 10px) + 1px) calc(var(--hy-space-6, 12px) + 1px));
|
|
86
92
|
border-bottom: 1px solid var(--hy-border-subtle-color, var(--hy-border-color, #3d4654));
|
|
87
93
|
overflow-wrap: anywhere;
|
|
88
94
|
}
|
|
@@ -90,8 +96,8 @@ export class HYTable extends HTMLElement {
|
|
|
90
96
|
position: relative;
|
|
91
97
|
color: var(--hy-secondary-text-color, #aebbd0);
|
|
92
98
|
background: var(--hy-table-header-background, var(--hy-input-bg-color, #111722));
|
|
93
|
-
font-size:
|
|
94
|
-
font-weight:
|
|
99
|
+
font-size: calc(var(--hy-font-size-xs, 10px) + 1px);
|
|
100
|
+
font-weight: calc(var(--hy-font-weight-semibold, 600) + 50);
|
|
95
101
|
text-align: left;
|
|
96
102
|
}
|
|
97
103
|
tbody tr { background: var(--hy-table-row-background, var(--hy-surface-color, #171d27)); }
|
|
@@ -99,12 +105,12 @@ export class HYTable extends HTMLElement {
|
|
|
99
105
|
tbody tr:last-child td { border-bottom: 0; }
|
|
100
106
|
thead { position: relative; z-index: 2; }
|
|
101
107
|
tbody { position: relative; z-index: 1; }
|
|
102
|
-
.header-content { display: flex; align-items: center; gap:
|
|
108
|
+
.header-content { display: flex; align-items: center; gap: calc(var(--hy-space-3, 6px) + 1px); min-width: 0; }
|
|
103
109
|
.header-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
104
110
|
.sort-button {
|
|
105
111
|
display: inline-flex;
|
|
106
112
|
align-items: center;
|
|
107
|
-
gap:
|
|
113
|
+
gap: calc(var(--hy-space-3, 6px) + 1px);
|
|
108
114
|
max-width: 100%;
|
|
109
115
|
padding: 0;
|
|
110
116
|
border: 0;
|
|
@@ -115,7 +121,7 @@ export class HYTable extends HTMLElement {
|
|
|
115
121
|
text-align: inherit;
|
|
116
122
|
}
|
|
117
123
|
.sort-button:hover, .sort-button:focus-visible { color: var(--hy-accent-color, #79a8ff); }
|
|
118
|
-
.sort-indicator { color: var(--hy-muted-text-color, #667587); font-size:
|
|
124
|
+
.sort-indicator { color: var(--hy-muted-text-color, var(--hy-muted-color, #667587)); font-size: calc(var(--hy-font-size-xs, 10px) - 1px); }
|
|
119
125
|
th[aria-sort="ascending"] .sort-indicator,
|
|
120
126
|
th[aria-sort="descending"] .sort-indicator { color: var(--hy-accent-color, #79a8ff); }
|
|
121
127
|
.filter-menu { position: relative; flex: 0 0 auto; }
|
|
@@ -127,8 +133,8 @@ export class HYTable extends HTMLElement {
|
|
|
127
133
|
place-items: center;
|
|
128
134
|
padding: 0;
|
|
129
135
|
border: 1px solid transparent;
|
|
130
|
-
border-radius: var(--hy-table-filter-radius,
|
|
131
|
-
color: var(--hy-muted-text-color, #667587);
|
|
136
|
+
border-radius: var(--hy-table-filter-radius, calc(var(--hy-radius-sm, 4px) + 1px));
|
|
137
|
+
color: var(--hy-muted-text-color, var(--hy-muted-color, #667587));
|
|
132
138
|
background: transparent;
|
|
133
139
|
cursor: pointer;
|
|
134
140
|
list-style: none;
|
|
@@ -151,11 +157,11 @@ export class HYTable extends HTMLElement {
|
|
|
151
157
|
width: max-content;
|
|
152
158
|
min-width: 184px;
|
|
153
159
|
max-width: min(280px, 70vw);
|
|
154
|
-
gap:
|
|
160
|
+
gap: calc(var(--hy-space-3, 6px) + 1px);
|
|
155
161
|
box-sizing: border-box;
|
|
156
|
-
padding:
|
|
162
|
+
padding: calc(var(--hy-space-4, 8px) + 1px);
|
|
157
163
|
border: 1px solid var(--hy-border-color, #3d4654);
|
|
158
|
-
border-radius: var(--hy-table-filter-panel-radius,
|
|
164
|
+
border-radius: var(--hy-table-filter-panel-radius, calc(var(--hy-radius-md, 6px) + 1px));
|
|
159
165
|
background: var(--hy-surface-elevated-color, var(--hy-surface-color, #171d27));
|
|
160
166
|
box-shadow: 0 10px 28px var(--hy-menu-shadow-color, rgba(0, 0, 0, 0.28));
|
|
161
167
|
}
|
|
@@ -167,63 +173,60 @@ export class HYTable extends HTMLElement {
|
|
|
167
173
|
min-width: 74px;
|
|
168
174
|
height: 30px;
|
|
169
175
|
box-sizing: border-box;
|
|
170
|
-
padding: 0
|
|
176
|
+
padding: 0 calc(var(--hy-space-4, 8px) + 1px);
|
|
171
177
|
border: 1px solid var(--hy-border-color, #3d4654);
|
|
172
|
-
border-radius: var(--hy-table-filter-radius,
|
|
178
|
+
border-radius: var(--hy-table-filter-radius, calc(var(--hy-radius-sm, 4px) + 1px));
|
|
173
179
|
outline: none;
|
|
174
180
|
color: var(--hy-text-color, #eef3ff);
|
|
175
181
|
background: var(--hy-input-bg-color, #111722);
|
|
176
|
-
font:
|
|
182
|
+
font: calc(var(--hy-font-size-xs, 10px) + 1px) var(--hy-font-family, system-ui, sans-serif);
|
|
177
183
|
}
|
|
178
184
|
.filter:focus { border-color: var(--hy-focus-border-color, #79a8ff); box-shadow: 0 0 0 2px var(--hy-focus-ring-color, rgba(121, 168, 255, 0.22)); }
|
|
179
185
|
.filter-clear {
|
|
180
186
|
flex: 0 0 auto;
|
|
181
187
|
height: 30px;
|
|
182
|
-
padding: 0
|
|
188
|
+
padding: 0 calc(var(--hy-space-4, 8px) + 1px);
|
|
183
189
|
border: 1px solid var(--hy-border-color, #3d4654);
|
|
184
|
-
border-radius: var(--hy-table-filter-radius,
|
|
190
|
+
border-radius: var(--hy-table-filter-radius, calc(var(--hy-radius-sm, 4px) + 1px));
|
|
185
191
|
color: var(--hy-secondary-text-color, #aebbd0);
|
|
186
192
|
background: var(--hy-surface-color, #171d27);
|
|
187
193
|
cursor: pointer;
|
|
188
|
-
font:
|
|
194
|
+
font: calc(var(--hy-font-size-xs, 10px) + 1px) var(--hy-font-family, system-ui, sans-serif);
|
|
189
195
|
}
|
|
190
196
|
.filter-clear:hover:not(:disabled) { border-color: var(--hy-accent-color, #79a8ff); color: var(--hy-accent-color, #79a8ff); }
|
|
191
197
|
.filter-clear:disabled { cursor: default; opacity: 0.45; }
|
|
192
|
-
.empty { height: 112px; color: var(--hy-muted-text-color, #788697); text-align: center; }
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
align-items: center;
|
|
198
|
+
.empty { height: 112px; color: var(--hy-muted-text-color, var(--hy-muted-color, #788697)); text-align: center; }
|
|
199
|
+
${HY_PAGINATION_STYLES}
|
|
200
|
+
.pagination-controls.pagination {
|
|
196
201
|
justify-content: flex-end;
|
|
197
|
-
gap: 6px;
|
|
198
|
-
padding:
|
|
202
|
+
gap: var(--hy-space-3, 6px);
|
|
203
|
+
padding: calc(var(--hy-space-5, 10px) + 1px) 0 0;
|
|
204
|
+
font: calc(var(--hy-font-size-xs, 10px) + 1px) var(--hy-font-family, system-ui, sans-serif);
|
|
199
205
|
}
|
|
200
|
-
.pagination
|
|
206
|
+
.pagination .pages { display: contents; }
|
|
201
207
|
.pagination button, .pagination select {
|
|
202
208
|
height: 30px;
|
|
203
|
-
|
|
204
|
-
border:
|
|
205
|
-
border-radius:
|
|
209
|
+
min-height: 0;
|
|
210
|
+
border-color: var(--hy-border-color, #3d4654);
|
|
211
|
+
border-radius: calc(var(--hy-radius-sm, 4px) + 1px);
|
|
206
212
|
color: var(--hy-secondary-text-color, #aebbd0);
|
|
207
213
|
background: var(--hy-surface-color, #171d27);
|
|
208
|
-
font: 11px system-ui, sans-serif;
|
|
209
214
|
}
|
|
210
|
-
.pagination button { min-width: 30px; padding: 0 8px;
|
|
215
|
+
.pagination button { min-width: 30px; padding: 0 var(--hy-space-4, 8px); }
|
|
211
216
|
.pagination button:hover:not(:disabled), .pagination button[aria-current="page"] { border-color: var(--hy-accent-color, #79a8ff); color: var(--hy-accent-color, #79a8ff); }
|
|
212
217
|
.pagination button:disabled { cursor: not-allowed; opacity: 0.45; }
|
|
213
|
-
.pagination select { margin-left: 6px; padding: 0
|
|
214
|
-
.summary { margin-
|
|
218
|
+
.pagination select { margin-left: var(--hy-space-3, 6px); padding: 0 calc(var(--hy-space-3, 6px) + 1px); }
|
|
219
|
+
.pagination .summary { margin-inline-end: auto; color: var(--hy-muted-text-color, var(--hy-muted-color, #788697)); font-size: var(--hy-font-size-xs, 10px); }
|
|
215
220
|
`;
|
|
216
221
|
this._scroller.className = 'scroller';
|
|
217
222
|
this._scroller.part.add('scroller');
|
|
218
223
|
this._table.part.add('table');
|
|
219
224
|
this._head.part.add('header');
|
|
220
225
|
this._body.part.add('body');
|
|
221
|
-
this._pagination.
|
|
222
|
-
this._pagination.part.add('pagination');
|
|
223
|
-
this._pagination.setAttribute('aria-label', 'Table pagination');
|
|
226
|
+
this._pagination.element.classList.add('pagination');
|
|
224
227
|
this._table.append(this._head, this._body);
|
|
225
228
|
this._scroller.append(this._table);
|
|
226
|
-
root.append(style, this._scroller, this._pagination);
|
|
229
|
+
root.append(style, this._scroller, this._pagination.element);
|
|
227
230
|
}
|
|
228
231
|
connectedCallback() {
|
|
229
232
|
this._syncAttributes();
|
|
@@ -553,55 +556,11 @@ export class HYTable extends HTMLElement {
|
|
|
553
556
|
return row;
|
|
554
557
|
}
|
|
555
558
|
_renderPagination() {
|
|
556
|
-
|
|
557
|
-
this.
|
|
558
|
-
this.
|
|
559
|
-
|
|
560
|
-
}
|
|
561
|
-
this._pagination.hidden = false;
|
|
562
|
-
const processed = this._processedRecords();
|
|
563
|
-
const pageCount = Math.max(1, Math.ceil(processed.length / this._pageSize));
|
|
564
|
-
const summary = document.createElement('span');
|
|
565
|
-
summary.className = 'summary';
|
|
566
|
-
summary.part.add('summary');
|
|
567
|
-
const start = processed.length ? (this._page - 1) * this._pageSize + 1 : 0;
|
|
568
|
-
const end = Math.min(processed.length, this._page * this._pageSize);
|
|
569
|
-
summary.textContent = `${start}–${end} of ${processed.length}`;
|
|
570
|
-
const previous = this._pageButton('‹', 'Previous page', this._page - 1, this._page <= 1);
|
|
571
|
-
const pages = this._pageNumbers(pageCount).map(page => this._pageButton(String(page), `Page ${page}`, page, false, page === this._page));
|
|
572
|
-
const next = this._pageButton('›', 'Next page', this._page + 1, this._page >= pageCount);
|
|
573
|
-
const pageSize = document.createElement('select');
|
|
574
|
-
pageSize.part.add('page-size');
|
|
575
|
-
pageSize.setAttribute('aria-label', 'Rows per page');
|
|
576
|
-
const options = this._pageSizeOptions.includes(this._pageSize)
|
|
577
|
-
? this._pageSizeOptions
|
|
578
|
-
: [...this._pageSizeOptions, this._pageSize].sort((a, b) => a - b);
|
|
579
|
-
pageSize.append(...options.map(value => {
|
|
580
|
-
const option = document.createElement('option');
|
|
581
|
-
option.value = String(value);
|
|
582
|
-
option.textContent = `${value} / page`;
|
|
583
|
-
option.selected = value === this._pageSize;
|
|
584
|
-
return option;
|
|
585
|
-
}));
|
|
586
|
-
pageSize.addEventListener('change', () => { this.pageSize = Number(pageSize.value); });
|
|
587
|
-
this._pagination.replaceChildren(summary, previous, ...pages, next, pageSize);
|
|
588
|
-
}
|
|
589
|
-
_pageButton(text, label, page, disabled, current = false) {
|
|
590
|
-
const button = document.createElement('button');
|
|
591
|
-
button.type = 'button';
|
|
592
|
-
button.textContent = text;
|
|
593
|
-
button.disabled = disabled;
|
|
594
|
-
button.setAttribute('aria-label', label);
|
|
595
|
-
if (current)
|
|
596
|
-
button.setAttribute('aria-current', 'page');
|
|
597
|
-
button.addEventListener('click', () => this.goToPage(page));
|
|
598
|
-
return button;
|
|
599
|
-
}
|
|
600
|
-
_pageNumbers(pageCount) {
|
|
601
|
-
if (pageCount <= 7)
|
|
602
|
-
return Array.from({ length: pageCount }, (_, index) => index + 1);
|
|
603
|
-
const start = Math.max(1, Math.min(pageCount - 4, this._page - 2));
|
|
604
|
-
return Array.from({ length: 5 }, (_, index) => start + index);
|
|
559
|
+
this._pagination.update({
|
|
560
|
+
page: this._page, pageSize: this._pageSize, total: this._processedRecords().length,
|
|
561
|
+
pageSizeOptions: this._pageSizeOptions, label: 'Table pagination',
|
|
562
|
+
hidden: !this.pagination, showSizeChanger: true,
|
|
563
|
+
});
|
|
605
564
|
}
|
|
606
565
|
_processedRecords() {
|
|
607
566
|
let records = this._dataSource.map((record, index) => ({ record, index }));
|
package/dist/tabs.js
CHANGED
|
@@ -15,36 +15,36 @@ export class HYTabs extends HTMLElement {
|
|
|
15
15
|
:host {
|
|
16
16
|
box-sizing: border-box;
|
|
17
17
|
display: grid;
|
|
18
|
-
grid-template-rows:
|
|
18
|
+
grid-template-rows: calc(var(--hy-control-height-sm, 28px) + var(--hy-space-2, 4px)) minmax(0, 1fr);
|
|
19
19
|
width: 100%;
|
|
20
20
|
height: 100%;
|
|
21
21
|
min-width: 0;
|
|
22
22
|
min-height: 0;
|
|
23
23
|
color: var(--hy-text-color, #d8e2f2);
|
|
24
24
|
background: var(--hy-panel-bg-color, #171d28);
|
|
25
|
-
font: 12px system-ui, sans-serif;
|
|
25
|
+
font: var(--hy-font-size-sm, 12px) var(--hy-font-family, system-ui, sans-serif);
|
|
26
26
|
}
|
|
27
27
|
.tabs {
|
|
28
28
|
display: flex;
|
|
29
29
|
align-items: end;
|
|
30
|
-
gap: 2px;
|
|
30
|
+
gap: var(--hy-space-1, 2px);
|
|
31
31
|
min-width: 0;
|
|
32
32
|
overflow-x: auto;
|
|
33
33
|
overflow-y: hidden;
|
|
34
34
|
scrollbar-width: none;
|
|
35
|
-
padding: 4px 6px 0;
|
|
35
|
+
padding: var(--hy-space-2, 4px) var(--hy-space-3, 6px) 0;
|
|
36
36
|
border-bottom: 1px solid var(--hy-border-color, #303746);
|
|
37
37
|
background: var(--hy-tabs-bar-bg-color, var(--hy-menu-bg-color, var(--hy-surface-elevated-color, #1b2230)));
|
|
38
38
|
}
|
|
39
39
|
button {
|
|
40
|
-
height: 28px;
|
|
40
|
+
height: var(--hy-control-height-sm, 28px);
|
|
41
41
|
min-width: 0;
|
|
42
42
|
flex-shrink: 0;
|
|
43
43
|
white-space: nowrap;
|
|
44
|
-
padding: 0 10px;
|
|
44
|
+
padding: 0 var(--hy-space-5, 10px);
|
|
45
45
|
border: 1px solid transparent;
|
|
46
46
|
border-bottom: 0;
|
|
47
|
-
border-radius: 4px 4px 0 0;
|
|
47
|
+
border-radius: var(--hy-radius-sm, 4px) var(--hy-radius-sm, 4px) 0 0;
|
|
48
48
|
color: var(--hy-secondary-text-color, #8fa7c8);
|
|
49
49
|
background: transparent;
|
|
50
50
|
font: inherit;
|
package/dist/tag.js
CHANGED
|
@@ -34,13 +34,13 @@ export class HYTag extends HTMLElement {
|
|
|
34
34
|
min-height: var(--hy-tag-height, 24px);
|
|
35
35
|
box-sizing: border-box;
|
|
36
36
|
align-items: center;
|
|
37
|
-
gap: var(--hy-tag-gap,
|
|
38
|
-
padding: 2px var(--hy-tag-padding-inline, 8px);
|
|
37
|
+
gap: var(--hy-tag-gap, calc(var(--hy-space-2, 4px) + 1px));
|
|
38
|
+
padding: var(--hy-space-1, 2px) var(--hy-tag-padding-inline, var(--hy-space-4, 8px));
|
|
39
39
|
border: 1px solid color-mix(in srgb, var(--_tone) 42%, var(--hy-border-color, #303746));
|
|
40
|
-
border-radius: var(--hy-tag-radius,
|
|
40
|
+
border-radius: var(--hy-tag-radius, calc(var(--hy-radius-sm, 4px) + 1px));
|
|
41
41
|
color: var(--_tone);
|
|
42
42
|
background: var(--_surface);
|
|
43
|
-
font: 600 var(--hy-tag-font-size,
|
|
43
|
+
font: var(--hy-font-weight-semibold, 600) var(--hy-tag-font-size, calc(var(--hy-font-size-xs, 10px) + 1px))/calc(var(--hy-line-height-snug, 1.4) - 0.05) var(--hy-font-family, system-ui, sans-serif);
|
|
44
44
|
transition: border-color 120ms ease, box-shadow 120ms ease, color 120ms ease, background 120ms ease;
|
|
45
45
|
}
|
|
46
46
|
.tag[data-variant="primary"] { --_tone: var(--hy-accent-color, #79a8ff); }
|
|
@@ -56,8 +56,8 @@ export class HYTag extends HTMLElement {
|
|
|
56
56
|
:host(:focus-visible) { outline: none; }
|
|
57
57
|
:host(:focus-visible) .tag { box-shadow: 0 0 0 2px var(--hy-focus-ring-color, rgba(61, 111, 168, .24)); }
|
|
58
58
|
:host([disabled]) { pointer-events: none; opacity: .5; }
|
|
59
|
-
:host([size="small"]) .tag { --hy-tag-height: 20px; --hy-tag-padding-inline: 6px; --hy-tag-font-size: 10px; }
|
|
60
|
-
:host([size="large"]) .tag { --hy-tag-height: 30px; --hy-tag-padding-inline:
|
|
59
|
+
:host([size="small"]) .tag { --hy-tag-height: 20px; --hy-tag-padding-inline: var(--hy-space-3, 6px); --hy-tag-font-size: var(--hy-font-size-xs, 10px); }
|
|
60
|
+
:host([size="large"]) .tag { --hy-tag-height: 30px; --hy-tag-padding-inline: calc(var(--hy-space-5, 10px) + 1px); --hy-tag-font-size: var(--hy-font-size-sm, 12px); }
|
|
61
61
|
.icon { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; }
|
|
62
62
|
.icon[hidden] { display: none; }
|
|
63
63
|
.label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
@@ -65,7 +65,7 @@ export class HYTag extends HTMLElement {
|
|
|
65
65
|
display: none;
|
|
66
66
|
width: 16px;
|
|
67
67
|
height: 16px;
|
|
68
|
-
margin-inline-end: -
|
|
68
|
+
margin-inline-end: calc(-1 * calc(var(--hy-space-1, 2px) + 1px));
|
|
69
69
|
padding: 0;
|
|
70
70
|
border: 0;
|
|
71
71
|
border-radius: 50%;
|
|
@@ -73,7 +73,7 @@ export class HYTag extends HTMLElement {
|
|
|
73
73
|
color: currentColor;
|
|
74
74
|
background: transparent;
|
|
75
75
|
cursor: pointer;
|
|
76
|
-
font:
|
|
76
|
+
font: calc(var(--hy-font-size-md, 14px) + 1px)/var(--hy-line-height-tight, 1) var(--hy-font-family, system-ui, sans-serif);
|
|
77
77
|
}
|
|
78
78
|
:host([closable]) .close { display: grid; }
|
|
79
79
|
.close:hover { background: color-mix(in srgb, currentColor 16%, transparent); }
|
package/dist/time-picker.js
CHANGED
|
@@ -37,27 +37,27 @@ export class HYTimePicker extends HTMLElement {
|
|
|
37
37
|
const root = this.attachShadow({ mode: 'open' });
|
|
38
38
|
const style = document.createElement('style');
|
|
39
39
|
style.textContent = `
|
|
40
|
-
:host { position: relative; display: inline-block; min-width: 150px; color: var(--hy-text-color, #eef3ff); font: 12px/1.4 system-ui, sans-serif; }
|
|
41
|
-
.control { display: grid; grid-template-columns: minmax(0, 1fr) auto; height: var(--hy-time-picker-height, 34px); box-sizing: border-box; border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-time-picker-radius, 6px); background: var(--hy-input-bg-color, #111722); }
|
|
40
|
+
:host { position: relative; display: inline-block; min-width: 150px; color: var(--hy-text-color, #eef3ff); font: var(--hy-font-size-sm, 12px)/var(--hy-line-height-snug, 1.4) var(--hy-font-family, system-ui, sans-serif); }
|
|
41
|
+
.control { display: grid; grid-template-columns: minmax(0, 1fr) auto; height: var(--hy-time-picker-height, var(--hy-control-height-md, 34px)); box-sizing: border-box; border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-time-picker-radius, var(--hy-radius-md, 6px)); background: var(--hy-input-bg-color, #111722); }
|
|
42
42
|
:host(:not([disabled])) .control:hover { border-color: var(--hy-hover-border-color, #596779); }
|
|
43
43
|
:host(:focus-within) .control, :host([open]) .control { border-color: var(--hy-focus-border-color, #79a8ff); box-shadow: 0 0 0 2px var(--hy-focus-ring-color, rgba(121, 168, 255, .22)); }
|
|
44
|
-
.trigger { display: flex; min-width: 0; align-items: center; gap: 8px; padding: 0 8px 0 10px; overflow: hidden; border: 0; color: inherit; background: transparent; cursor: pointer; font: inherit; text-align: left; }
|
|
44
|
+
.trigger { display: flex; min-width: 0; align-items: center; gap: var(--hy-space-4, 8px); padding: 0 var(--hy-space-4, 8px) 0 var(--hy-space-5, 10px); overflow: hidden; border: 0; color: inherit; background: transparent; cursor: pointer; font: inherit; text-align: left; }
|
|
45
45
|
.label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
46
46
|
.label.placeholder { color: var(--hy-muted-color, #788697); }
|
|
47
|
-
.arrow { color: var(--hy-muted-color, #788697); font-size: 14px; }
|
|
48
|
-
.clear { width: 28px; padding: 0; border: 0; color: var(--hy-muted-color, #788697); background: transparent; cursor: pointer; font:
|
|
47
|
+
.arrow { color: var(--hy-muted-color, #788697); font-size: var(--hy-font-size-md, 14px); }
|
|
48
|
+
.clear { width: 28px; padding: 0; border: 0; color: var(--hy-muted-color, #788697); background: transparent; cursor: pointer; font: calc(var(--hy-font-size-md, 14px) + 1px)/var(--hy-line-height-tight, 1) var(--hy-font-family, system-ui, sans-serif); }
|
|
49
49
|
.clear:hover { color: var(--hy-text-color, #eef3ff); } .clear[hidden], .panel[hidden] { display: none; }
|
|
50
50
|
.trigger:focus-visible, .clear:focus-visible { outline: none; }
|
|
51
51
|
:host([disabled]) { opacity: .52; } :host([disabled]) .trigger, :host([disabled]) .clear { cursor: not-allowed; }
|
|
52
|
-
.panel { position: absolute; z-index: var(--hy-time-picker-z-index, 50); top: calc(100% + 6px); left: 0; width: max-content; min-width: 100%; box-sizing: border-box; border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-time-picker-panel-radius, 8px); background: var(--hy-menu-bg-color, var(--hy-surface-elevated-color, #171d27)); box-shadow: 0 12px 32px var(--hy-menu-shadow-color, rgba(0, 0, 0, .36)); }
|
|
52
|
+
.panel { position: absolute; z-index: var(--hy-time-picker-z-index, 50); top: calc(100% + 6px); left: 0; width: max-content; min-width: 100%; box-sizing: border-box; border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-time-picker-panel-radius, var(--hy-radius-lg, 8px)); background: var(--hy-menu-bg-color, var(--hy-surface-elevated-color, #171d27)); box-shadow: 0 12px 32px var(--hy-menu-shadow-color, rgba(0, 0, 0, .36)); }
|
|
53
53
|
.columns { display: flex; height: var(--hy-time-picker-panel-height, 196px); overflow: hidden; }
|
|
54
|
-
.column { width: var(--hy-time-picker-column-width, 58px); margin: 0; padding: 4px; overflow-y: auto; list-style: none; scrollbar-color: var(--hy-border-strong-color, #596779) transparent; scrollbar-width: thin; }
|
|
54
|
+
.column { width: var(--hy-time-picker-column-width, 58px); margin: 0; padding: var(--hy-space-2, 4px); overflow-y: auto; list-style: none; scrollbar-color: var(--hy-border-strong-color, #596779) transparent; scrollbar-width: thin; }
|
|
55
55
|
.column + .column { border-left: 1px solid var(--hy-border-color, #3d4654); }
|
|
56
|
-
.option { width: 100%; height: 30px; padding: 0; border: 0; border-radius: 4px; color: var(--hy-secondary-text-color, #aebbd0); background: transparent; cursor: pointer; font: inherit; }
|
|
56
|
+
.option { width: 100%; height: 30px; padding: 0; border: 0; border-radius: var(--hy-radius-sm, 4px); color: var(--hy-secondary-text-color, #aebbd0); background: transparent; cursor: pointer; font: inherit; }
|
|
57
57
|
.option:hover, .option:focus-visible { outline: none; color: var(--hy-text-color, #eef3ff); background: var(--hy-hover-bg-color, #273241); }
|
|
58
58
|
.option[aria-selected="true"] { color: var(--hy-selected-text-color, #fff); background: var(--hy-selected-bg-color, #554cc6); }
|
|
59
|
-
.footer { display: flex; justify-content: space-between; gap: 8px; padding:
|
|
60
|
-
.footer button { min-width: 42px; height: 27px; padding: 0 8px; border: 1px solid transparent; border-radius: 4px; color: var(--hy-accent-color, #79a8ff); background: transparent; cursor: pointer; font: inherit; }
|
|
59
|
+
.footer { display: flex; justify-content: space-between; gap: var(--hy-space-4, 8px); padding: calc(var(--hy-space-3, 6px) + 1px) var(--hy-space-4, 8px); border-top: 1px solid var(--hy-border-color, #3d4654); }
|
|
60
|
+
.footer button { min-width: 42px; height: 27px; padding: 0 var(--hy-space-4, 8px); border: 1px solid transparent; border-radius: var(--hy-radius-sm, 4px); color: var(--hy-accent-color, #79a8ff); background: transparent; cursor: pointer; font: inherit; }
|
|
61
61
|
.footer button:hover:not(:disabled) { background: var(--hy-hover-bg-color, #273241); }
|
|
62
62
|
.footer .confirm { color: var(--hy-selected-text-color, #fff); background: var(--hy-selected-bg-color, #554cc6); }
|
|
63
63
|
.footer button:focus-visible { outline: 2px solid var(--hy-focus-border-color, #79a8ff); outline-offset: 1px; }
|
package/dist/timeline.js
CHANGED
|
@@ -34,24 +34,24 @@ export class HYTimeline extends HTMLElement {
|
|
|
34
34
|
const root = this.attachShadow({ mode: 'open' });
|
|
35
35
|
const style = document.createElement('style');
|
|
36
36
|
style.textContent = `
|
|
37
|
-
:host { display: block; min-width: 0; color: var(--hy-text-color, #eef3ff); font: 12px/1.5 system-ui, sans-serif; }
|
|
37
|
+
:host { display: block; min-width: 0; color: var(--hy-text-color, #eef3ff); font: var(--hy-font-size-sm, 12px)/var(--hy-line-height-relaxed, 1.5) var(--hy-font-family, system-ui, sans-serif); }
|
|
38
38
|
.timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
|
|
39
39
|
.item { display: grid; grid-template-columns: minmax(0, 1fr) var(--hy-timeline-axis-width, 30px) minmax(0, 1fr); min-height: var(--hy-timeline-item-min-height, 72px); margin: 0; padding: 0; }
|
|
40
|
-
.label { grid-column: 1; padding: 1px 14px
|
|
40
|
+
.label { grid-column: 1; padding: 1px var(--hy-space-7, 14px) calc(var(--hy-space-10, 20px) + 2px) 0; color: var(--hy-muted-color, #788697); text-align: right; }
|
|
41
41
|
.axis { position: relative; grid-column: 2; grid-row: 1; display: flex; justify-content: center; }
|
|
42
42
|
.axis::after { position: absolute; top: 16px; bottom: 0; width: var(--hy-timeline-line-width, 1px); background: var(--hy-timeline-line-color, var(--hy-border-color, #3d4654)); content: ''; }
|
|
43
43
|
.item:last-child .axis::after { display: none; }
|
|
44
|
-
.dot { position: relative; z-index: 1; display: grid; width: var(--hy-timeline-dot-size, 10px); height: var(--hy-timeline-dot-size, 10px); box-sizing: border-box; place-items: center; margin-top: 4px; border: 2px solid var(--_dot-color, var(--hy-muted-color, #788697)); border-radius: 50%; color: var(--_dot-color, var(--hy-muted-color, #788697)); background: var(--hy-surface-color, #111722); font-size:
|
|
45
|
-
.dot.custom { width: var(--hy-timeline-custom-dot-size, 22px); height: var(--hy-timeline-custom-dot-size, 22px); margin-top: -2px; border-width: 1px; background: var(--hy-surface-elevated-color, #171d27); }
|
|
44
|
+
.dot { position: relative; z-index: 1; display: grid; width: var(--hy-timeline-dot-size, 10px); height: var(--hy-timeline-dot-size, 10px); box-sizing: border-box; place-items: center; margin-top: var(--hy-space-2, 4px); border: 2px solid var(--_dot-color, var(--hy-muted-color, #788697)); border-radius: 50%; color: var(--_dot-color, var(--hy-muted-color, #788697)); background: var(--hy-surface-color, #111722); font-size: calc(var(--hy-font-size-xs, 10px) - 1px); line-height: var(--hy-line-height-tight, 1); }
|
|
45
|
+
.dot.custom { width: var(--hy-timeline-custom-dot-size, 22px); height: var(--hy-timeline-custom-dot-size, 22px); margin-top: calc(-1 * var(--hy-space-1, 2px)); border-width: 1px; background: var(--hy-surface-elevated-color, #171d27); }
|
|
46
46
|
.status-success { --_dot-color: var(--hy-success-color, #4ade80); }
|
|
47
47
|
.status-info { --_dot-color: var(--hy-info-color, var(--hy-accent-color, #79a8ff)); }
|
|
48
48
|
.status-warning { --_dot-color: var(--hy-warning-color, #fbbf24); }
|
|
49
49
|
.status-error { --_dot-color: var(--hy-error-color, #fb7185); }
|
|
50
|
-
.card { grid-column: 3; min-width: 0; padding: 0 0
|
|
51
|
-
.title { color: var(--hy-text-color, #eef3ff); font-weight:
|
|
52
|
-
.description { margin-top: 4px; color: var(--hy-secondary-text-color, #aebbd0); }
|
|
53
|
-
.content-left .card { grid-column: 1; padding: 0 14px
|
|
54
|
-
.content-left .label { grid-column: 3; padding: 1px 0
|
|
50
|
+
.card { grid-column: 3; min-width: 0; padding: 0 0 calc(var(--hy-space-10, 20px) + 2px) var(--hy-space-7, 14px); }
|
|
51
|
+
.title { color: var(--hy-text-color, #eef3ff); font-weight: calc(var(--hy-font-weight-semibold, 600) + 50); }
|
|
52
|
+
.description { margin-top: var(--hy-space-2, 4px); color: var(--hy-secondary-text-color, #aebbd0); }
|
|
53
|
+
.content-left .card { grid-column: 1; padding: 0 var(--hy-space-7, 14px) calc(var(--hy-space-10, 20px) + 2px) 0; text-align: right; }
|
|
54
|
+
.content-left .label { grid-column: 3; padding: 1px 0 calc(var(--hy-space-10, 20px) + 2px) var(--hy-space-7, 14px); text-align: left; }
|
|
55
55
|
.pending .dot { border-style: dashed; animation: hy-timeline-spin 1.2s linear infinite; }
|
|
56
56
|
.pending .dot.custom { animation: none; }
|
|
57
57
|
@keyframes hy-timeline-spin { to { transform: rotate(360deg); } }
|
|
@@ -59,9 +59,9 @@ export class HYTimeline extends HTMLElement {
|
|
|
59
59
|
@media (max-width: 560px) {
|
|
60
60
|
.item, .item.content-left { grid-template-columns: var(--hy-timeline-axis-width, 30px) minmax(0, 1fr); }
|
|
61
61
|
.axis, .item.content-left .axis { grid-column: 1; }
|
|
62
|
-
.card, .item.content-left .card { grid-column: 2; padding: 0 0
|
|
63
|
-
.label, .item.content-left .label { grid-column: 2; grid-row: 1; justify-self: end; padding: 1px 0 0 12px; text-align: right; }
|
|
64
|
-
.label + .axis + .card { padding-top:
|
|
62
|
+
.card, .item.content-left .card { grid-column: 2; padding: 0 0 calc(var(--hy-space-10, 20px) + 2px) var(--hy-space-6, 12px); text-align: left; }
|
|
63
|
+
.label, .item.content-left .label { grid-column: 2; grid-row: 1; justify-self: end; padding: 1px 0 0 var(--hy-space-6, 12px); text-align: right; }
|
|
64
|
+
.label + .axis + .card { padding-top: calc(var(--hy-space-10, 20px) + 2px); }
|
|
65
65
|
}
|
|
66
66
|
`;
|
|
67
67
|
this._list.className = 'timeline';
|
package/dist/toast.js
CHANGED
|
@@ -24,7 +24,7 @@ export class HYToast extends HTMLElement {
|
|
|
24
24
|
const style = document.createElement('style');
|
|
25
25
|
style.textContent = `
|
|
26
26
|
:host { position: fixed; z-index: var(--hy-toast-z-index, 1200); inset: 0; display: block; pointer-events: none; }
|
|
27
|
-
.container { position: fixed; left: 50%; display: flex; width: min(var(--hy-toast-width, 420px), calc(100vw - 32px)); flex-direction: column; align-items: center; gap: var(--hy-toast-gap,
|
|
27
|
+
.container { position: fixed; left: 50%; display: flex; width: min(var(--hy-toast-width, 420px), calc(100vw - 32px)); flex-direction: column; align-items: center; gap: var(--hy-toast-gap, calc(var(--hy-space-4, 8px) + 1px)); pointer-events: none; transform: translateX(-50%); }
|
|
28
28
|
.container[data-placement="top"] { top: var(--hy-toast-offset, 24px); }
|
|
29
29
|
.container[data-placement="center"] { top: 50%; transform: translate(-50%, -50%); }
|
|
30
30
|
.container[data-placement="bottom"] { bottom: var(--hy-toast-offset, 24px); flex-direction: column-reverse; }
|
|
@@ -32,19 +32,19 @@ export class HYToast extends HTMLElement {
|
|
|
32
32
|
--_tone: var(--hy-info-color, var(--hy-accent-color, #79a8ff));
|
|
33
33
|
display: grid;
|
|
34
34
|
grid-template-columns: 20px minmax(0, 1fr) auto;
|
|
35
|
-
gap:
|
|
35
|
+
gap: calc(var(--hy-space-4, 8px) + 1px);
|
|
36
36
|
min-width: min(240px, calc(100vw - 32px));
|
|
37
37
|
max-width: 100%;
|
|
38
38
|
box-sizing: border-box;
|
|
39
39
|
align-items: center;
|
|
40
|
-
padding: 10px 12px;
|
|
40
|
+
padding: var(--hy-space-5, 10px) var(--hy-space-6, 12px);
|
|
41
41
|
border: 1px solid color-mix(in srgb, var(--_tone) 28%, var(--hy-border-color, #303746));
|
|
42
|
-
border-radius: var(--hy-toast-radius, 8px);
|
|
42
|
+
border-radius: var(--hy-toast-radius, var(--hy-radius-lg, 8px));
|
|
43
43
|
color: var(--hy-text-color, #e8effa);
|
|
44
44
|
background: var(--hy-toast-bg-color, var(--hy-surface-elevated-color, #171e2a));
|
|
45
|
-
box-shadow: 0 10px 30px var(--hy-toast-shadow-color, rgba(0, 0, 0, .3));
|
|
45
|
+
box-shadow: 0 10px 30px var(--hy-toast-shadow-color, var(--hy-shadow-color, rgba(0, 0, 0, .3)));
|
|
46
46
|
pointer-events: auto;
|
|
47
|
-
font: 12px/1.
|
|
47
|
+
font: var(--hy-font-size-sm, 12px)/calc(var(--hy-line-height-snug, 1.4) + 0.05) var(--hy-font-family, system-ui, sans-serif);
|
|
48
48
|
animation: hy-toast-enter 160ms cubic-bezier(.22, 1, .36, 1);
|
|
49
49
|
transition: opacity 140ms ease, transform 140ms ease;
|
|
50
50
|
}
|
|
@@ -54,10 +54,10 @@ export class HYToast extends HTMLElement {
|
|
|
54
54
|
.toast[data-type="loading"] { --_tone: var(--hy-accent-color, #79a8ff); }
|
|
55
55
|
.toast.closing { opacity: 0; transform: translateY(-6px) scale(.97); }
|
|
56
56
|
.container[data-placement="bottom"] .toast.closing { transform: translateY(6px) scale(.97); }
|
|
57
|
-
.icon { display: grid; width: 20px; height: 20px; place-items: center; color: var(--_tone); font-weight: 800; }
|
|
58
|
-
.toast[data-type="loading"] .icon { width: 15px; height: 15px; margin: 2px; border: 2px solid color-mix(in srgb, var(--_tone) 25%, transparent); border-top-color: var(--_tone); border-radius: 50%; animation: hy-toast-spin .75s linear infinite; font-size: 0; }
|
|
57
|
+
.icon { display: grid; width: 20px; height: 20px; place-items: center; color: var(--_tone); font-weight: var(--hy-font-weight-heavy, 800); }
|
|
58
|
+
.toast[data-type="loading"] .icon { width: 15px; height: 15px; margin: var(--hy-space-1, 2px); border: 2px solid color-mix(in srgb, var(--_tone) 25%, transparent); border-top-color: var(--_tone); border-radius: 50%; animation: hy-toast-spin .75s linear infinite; font-size: 0; }
|
|
59
59
|
.message { min-width: 0; overflow-wrap: anywhere; }
|
|
60
|
-
.close { display: grid; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px; place-items: center; color: var(--hy-secondary-text-color, #9aa8ba); background: transparent; cursor: pointer; font: 16px/1 system-ui, sans-serif; }
|
|
60
|
+
.close { display: grid; width: 20px; height: 20px; padding: 0; border: 0; border-radius: var(--hy-radius-sm, 4px); place-items: center; color: var(--hy-secondary-text-color, #9aa8ba); background: transparent; cursor: pointer; font: var(--hy-font-size-lg, 16px)/var(--hy-line-height-tight, 1) var(--hy-font-family, system-ui, sans-serif); }
|
|
61
61
|
.close:hover { color: inherit; background: var(--hy-hover-bg-color, #242d3b); }
|
|
62
62
|
.close:focus-visible { outline: 2px solid var(--hy-focus-border-color, #79a8ff); outline-offset: 1px; }
|
|
63
63
|
@keyframes hy-toast-enter { from { opacity: 0; transform: translateY(-7px) scale(.97); } }
|
package/dist/tooltip.js
CHANGED
|
@@ -43,14 +43,14 @@ export class HYTooltip extends HTMLElement {
|
|
|
43
43
|
z-index: 10001;
|
|
44
44
|
box-sizing: border-box;
|
|
45
45
|
max-width: min(280px, calc(100vw - 16px));
|
|
46
|
-
padding:
|
|
47
|
-
border-radius: 4px;
|
|
46
|
+
padding: calc(var(--hy-space-2, 4px) + 1px) var(--hy-space-4, 8px);
|
|
47
|
+
border-radius: var(--hy-radius-sm, 4px);
|
|
48
48
|
color: var(--hy-tooltip-text-color, #f4f7fb);
|
|
49
49
|
background: var(--hy-tooltip-bg-color, #0f141c);
|
|
50
50
|
border: 1px solid var(--hy-tooltip-border-color, rgba(255, 255, 255, 0.08));
|
|
51
51
|
box-shadow: 0 8px 24px var(--hy-tooltip-shadow-color, rgba(0, 0, 0, 0.35));
|
|
52
|
-
font: 12px system-ui, sans-serif;
|
|
53
|
-
line-height: 1.
|
|
52
|
+
font: var(--hy-font-size-sm, 12px) var(--hy-font-family, system-ui, sans-serif);
|
|
53
|
+
line-height: calc(var(--hy-line-height-snug, 1.4) - 0.05);
|
|
54
54
|
width: max-content;
|
|
55
55
|
white-space: normal;
|
|
56
56
|
overflow-wrap: anywhere;
|