@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/collapse.js
CHANGED
|
@@ -34,11 +34,11 @@ export class HYCollapse 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; }
|
|
38
|
-
.collapse { overflow: hidden; border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-collapse-radius, 8px); background: var(--hy-surface-color, #111722); }
|
|
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
|
+
.collapse { overflow: hidden; border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-collapse-radius, var(--hy-radius-lg, 8px)); background: var(--hy-surface-color, #111722); }
|
|
39
39
|
.panel + .panel { border-top: 1px solid var(--hy-border-color, #3d4654); }
|
|
40
|
-
.header { display: flex; min-height: var(--hy-collapse-header-height, 44px); align-items: center; background: var(--hy-collapse-header-bg, color-mix(in srgb, var(--hy-surface-elevated-color, #171d27) 82%, transparent)); }
|
|
41
|
-
.trigger { display: flex; min-width: 0; min-height: inherit; flex: 1 1 auto; align-items: center; gap: 10px; padding:
|
|
40
|
+
.header { display: flex; min-height: var(--hy-collapse-header-height, var(--hy-control-height-lg, 44px)); align-items: center; background: var(--hy-collapse-header-bg, color-mix(in srgb, var(--hy-surface-elevated-color, #171d27) 82%, transparent)); }
|
|
41
|
+
.trigger { display: flex; min-width: 0; min-height: inherit; flex: 1 1 auto; align-items: center; gap: var(--hy-space-5, 10px); padding: calc(var(--hy-space-4, 8px) + 1px) var(--hy-space-7, 14px); border: 0; color: inherit; background: transparent; cursor: pointer; font: inherit; text-align: start; }
|
|
42
42
|
.trigger:hover:not(:disabled) { background: var(--hy-hover-bg-color, #273241); }
|
|
43
43
|
.trigger:focus-visible { position: relative; z-index: 1; outline: 2px solid var(--hy-focus-border-color, #79a8ff); outline-offset: -2px; }
|
|
44
44
|
.trigger:disabled { color: var(--hy-muted-color, #788697); cursor: not-allowed; }
|
|
@@ -46,9 +46,9 @@ export class HYCollapse extends HTMLElement {
|
|
|
46
46
|
.arrow::before { content: ''; width: 6px; height: 6px; border-block-start: 1.5px solid currentColor; border-inline-end: 1.5px solid currentColor; transform: rotate(45deg); }
|
|
47
47
|
.panel.expanded .arrow { transform: rotate(90deg); }
|
|
48
48
|
.title { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
49
|
-
.extra { flex: 0 0 auto; padding-inline: var(--hy-collapse-extra-gap, 10px) 14px; color: var(--hy-muted-color, #788697); font-size: 10px; }
|
|
49
|
+
.extra { flex: 0 0 auto; padding-inline: var(--hy-collapse-extra-gap, var(--hy-space-5, 10px)) var(--hy-space-7, 14px); color: var(--hy-muted-color, #788697); font-size: var(--hy-font-size-xs, 10px); }
|
|
50
50
|
.region[hidden] { display: none; }
|
|
51
|
-
.body { padding: var(--hy-collapse-content-padding, 16px); border-top: 1px solid var(--hy-border-color, #3d4654); color: var(--hy-secondary-text-color, #aebbd0); background: var(--hy-collapse-content-bg, transparent); }
|
|
51
|
+
.body { padding: var(--hy-collapse-content-padding, var(--hy-space-8, 16px)); border-top: 1px solid var(--hy-border-color, #3d4654); color: var(--hy-secondary-text-color, #aebbd0); background: var(--hy-collapse-content-bg, transparent); }
|
|
52
52
|
:host([icon-position="end"]) .arrow { order: 2; }
|
|
53
53
|
:host([bordered="false"]) .collapse { border: 0; border-radius: 0; }
|
|
54
54
|
:host([ghost]) .collapse { border: 0; background: transparent; }
|
package/dist/context-menu.js
CHANGED
|
@@ -19,7 +19,7 @@ export class HYContextMenu extends HTMLElement {
|
|
|
19
19
|
display: none;
|
|
20
20
|
min-width: 132px;
|
|
21
21
|
color: var(--hy-text-color, #d8e2f2);
|
|
22
|
-
font: 12px system-ui, sans-serif;
|
|
22
|
+
font: var(--hy-font-size-sm, 12px) var(--hy-font-family, system-ui, sans-serif);
|
|
23
23
|
}
|
|
24
24
|
:host([open]) {
|
|
25
25
|
display: block;
|
|
@@ -27,9 +27,9 @@ export class HYContextMenu extends HTMLElement {
|
|
|
27
27
|
.menu {
|
|
28
28
|
box-sizing: border-box;
|
|
29
29
|
min-width: 132px;
|
|
30
|
-
padding: 4px;
|
|
30
|
+
padding: var(--hy-space-2, 4px);
|
|
31
31
|
border: 1px solid var(--hy-border-color, #303746);
|
|
32
|
-
border-radius: 4px;
|
|
32
|
+
border-radius: var(--hy-radius-sm, 4px);
|
|
33
33
|
background: var(--hy-menu-bg-color, var(--hy-surface-elevated-color, #1b2230));
|
|
34
34
|
box-shadow: 0 10px 26px var(--hy-menu-shadow-color, rgba(0, 0, 0, 0.36));
|
|
35
35
|
}
|
package/dist/date-picker.js
CHANGED
|
@@ -43,38 +43,38 @@ export class HYDatePicker extends HTMLElement {
|
|
|
43
43
|
const root = this.attachShadow({ mode: 'open' });
|
|
44
44
|
const style = document.createElement('style');
|
|
45
45
|
style.textContent = `
|
|
46
|
-
:host { position: relative; display: inline-block; min-width: 180px; color: var(--hy-text-color, #eef3ff); font: 12px/1.4 system-ui, sans-serif; }
|
|
47
|
-
.control { display: grid; grid-template-columns: minmax(0, 1fr) auto; height: var(--hy-date-picker-height, 34px); box-sizing: border-box; border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-date-picker-radius, 6px); background: var(--hy-input-bg-color, #111722); }
|
|
46
|
+
:host { position: relative; display: inline-block; min-width: 180px; 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); }
|
|
47
|
+
.control { display: grid; grid-template-columns: minmax(0, 1fr) auto; height: var(--hy-date-picker-height, var(--hy-control-height-md, 34px)); box-sizing: border-box; border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-date-picker-radius, var(--hy-radius-md, 6px)); background: var(--hy-input-bg-color, #111722); }
|
|
48
48
|
:host(:not([disabled])) .control:hover { border-color: var(--hy-hover-border-color, #596779); }
|
|
49
49
|
: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, 0.22)); }
|
|
50
|
-
.trigger { display: flex; align-items: center; min-width: 0; gap: 8px; padding: 0 8px 0 10px; overflow: hidden; border: 0; color: inherit; background: transparent; cursor: pointer; font: inherit; text-align: left; }
|
|
50
|
+
.trigger { display: flex; align-items: center; min-width: 0; 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; }
|
|
51
51
|
.label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
52
52
|
.label.placeholder { color: var(--hy-muted-color, #788697); }
|
|
53
|
-
.arrow { flex: 0 0 auto; color: var(--hy-muted-color, #788697); font-size: 14px; }
|
|
54
|
-
.clear { width: 28px; padding: 0; border: 0; color: var(--hy-muted-color, #788697); background: transparent; cursor: pointer; font:
|
|
53
|
+
.arrow { flex: 0 0 auto; color: var(--hy-muted-color, #788697); font-size: var(--hy-font-size-md, 14px); }
|
|
54
|
+
.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); }
|
|
55
55
|
.clear:hover { color: var(--hy-text-color, #eef3ff); }
|
|
56
56
|
.clear[hidden] { display: none; }
|
|
57
57
|
.trigger:focus-visible, .clear:focus-visible { outline: none; }
|
|
58
58
|
:host([disabled]) { opacity: 0.52; }
|
|
59
59
|
:host([disabled]) .trigger, :host([disabled]) .clear { cursor: not-allowed; }
|
|
60
|
-
.panel { position: absolute; z-index: var(--hy-date-picker-z-index, 50); top: calc(100% + 6px); left: 0; width: var(--hy-date-picker-panel-width, 286px); box-sizing: border-box; padding: 10px; border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-date-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, 0.36)); }
|
|
60
|
+
.panel { position: absolute; z-index: var(--hy-date-picker-z-index, 50); top: calc(100% + 6px); left: 0; width: var(--hy-date-picker-panel-width, 286px); box-sizing: border-box; padding: var(--hy-space-5, 10px); border: 1px solid var(--hy-border-color, #3d4654); border-radius: var(--hy-date-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, 0.36)); }
|
|
61
61
|
.panel[hidden] { display: none; }
|
|
62
|
-
.calendar-header { display: grid; grid-template-columns: 30px 1fr 30px; align-items: center; margin-bottom:
|
|
63
|
-
.month-label { color: var(--hy-text-color, #eef3ff); font-weight:
|
|
64
|
-
.month-button, .footer button { height: 28px; border: 1px solid transparent; border-radius: 4px; color: var(--hy-secondary-text-color, #aebbd0); background: transparent; cursor: pointer; font: inherit; }
|
|
62
|
+
.calendar-header { display: grid; grid-template-columns: 30px 1fr 30px; align-items: center; margin-bottom: calc(var(--hy-space-3, 6px) + 1px); }
|
|
63
|
+
.month-label { color: var(--hy-text-color, #eef3ff); font-weight: calc(var(--hy-font-weight-semibold, 600) + 50); text-align: center; }
|
|
64
|
+
.month-button, .footer button { height: var(--hy-control-height-sm, 28px); border: 1px solid transparent; border-radius: var(--hy-radius-sm, 4px); color: var(--hy-secondary-text-color, #aebbd0); background: transparent; cursor: pointer; font: inherit; }
|
|
65
65
|
.month-button:hover:not(:disabled), .footer button:hover:not(:disabled) { color: var(--hy-accent-color, #79a8ff); background: var(--hy-hover-bg-color, #273241); }
|
|
66
66
|
.month-button:focus-visible, .footer button:focus-visible { outline: 2px solid var(--hy-focus-border-color, #79a8ff); outline-offset: 1px; }
|
|
67
67
|
.month-button:disabled, .footer button:disabled { cursor: not-allowed; opacity: 0.35; }
|
|
68
|
-
.weekdays, .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
|
|
69
|
-
.weekday { padding: 4px 0; color: var(--hy-muted-color, #788697); font-size: 10px; text-align: center; }
|
|
68
|
+
.weekdays, .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--hy-space-1, 2px); }
|
|
69
|
+
.weekday { padding: var(--hy-space-2, 4px) 0; color: var(--hy-muted-color, #788697); font-size: var(--hy-font-size-xs, 10px); text-align: center; }
|
|
70
70
|
.day { position: relative; width: 100%; aspect-ratio: 1; min-height: 31px; padding: 0; border: 1px solid transparent; border-radius: var(--hy-date-picker-day-radius, 50%); color: var(--hy-secondary-text-color, #aebbd0); background: transparent; cursor: pointer; font: inherit; }
|
|
71
71
|
.day:hover:not(:disabled), .day:focus-visible { outline: none; color: var(--hy-text-color, #eef3ff); border-color: var(--hy-hover-border-color, #596779); background: var(--hy-hover-bg-color, #273241); }
|
|
72
72
|
.day.outside { color: var(--hy-muted-color, #788697); opacity: 0.6; }
|
|
73
73
|
.day.today::after { position: absolute; right: 50%; bottom: 3px; width: 3px; height: 3px; border-radius: 50%; background: var(--hy-accent-color, #79a8ff); content: ''; transform: translateX(50%); }
|
|
74
74
|
.day[aria-selected="true"] { color: var(--hy-selected-text-color, #fff); border-color: var(--hy-selected-bg-color, #554cc6); background: var(--hy-selected-bg-color, #554cc6); }
|
|
75
75
|
.day:disabled { cursor: not-allowed; opacity: 0.24; }
|
|
76
|
-
.footer { display: flex; justify-content: flex-end; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--hy-border-color, #3d4654); }
|
|
77
|
-
.footer button { padding: 0
|
|
76
|
+
.footer { display: flex; justify-content: flex-end; margin-top: var(--hy-space-4, 8px); padding-top: var(--hy-space-4, 8px); border-top: 1px solid var(--hy-border-color, #3d4654); }
|
|
77
|
+
.footer button { padding: 0 calc(var(--hy-space-4, 8px) + 1px); color: var(--hy-accent-color, #79a8ff); }
|
|
78
78
|
`;
|
|
79
79
|
this._control.className = 'control';
|
|
80
80
|
this._control.part.add('control');
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type HYDescriptionsLayout = 'horizontal' | 'vertical';
|
|
2
|
+
export type HYDescriptionsSize = 'small' | 'default';
|
|
3
|
+
export interface HYDescriptionItem {
|
|
4
|
+
key?: string;
|
|
5
|
+
label: string;
|
|
6
|
+
value?: string | number | boolean | null;
|
|
7
|
+
span?: number | 'filled';
|
|
8
|
+
}
|
|
9
|
+
/** Semantic definition list with responsive columns, spans and rich value slots. */
|
|
10
|
+
export declare class HYDescriptions extends HTMLElement {
|
|
11
|
+
private readonly _header;
|
|
12
|
+
private readonly _heading;
|
|
13
|
+
private readonly _extra;
|
|
14
|
+
private readonly _list;
|
|
15
|
+
private readonly _rows;
|
|
16
|
+
private _items;
|
|
17
|
+
private _observer;
|
|
18
|
+
private _width;
|
|
19
|
+
static get observedAttributes(): string[];
|
|
20
|
+
constructor();
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
disconnectedCallback(): void;
|
|
23
|
+
attributeChangedCallback(name: string): void;
|
|
24
|
+
get items(): HYDescriptionItem[];
|
|
25
|
+
set items(value: readonly HYDescriptionItem[]);
|
|
26
|
+
get heading(): string;
|
|
27
|
+
set heading(value: string);
|
|
28
|
+
get column(): number;
|
|
29
|
+
set column(value: number);
|
|
30
|
+
get layout(): HYDescriptionsLayout;
|
|
31
|
+
set layout(value: HYDescriptionsLayout);
|
|
32
|
+
get bordered(): boolean;
|
|
33
|
+
set bordered(value: boolean);
|
|
34
|
+
get size(): HYDescriptionsSize;
|
|
35
|
+
set size(value: HYDescriptionsSize);
|
|
36
|
+
get responsive(): boolean;
|
|
37
|
+
set responsive(value: boolean);
|
|
38
|
+
get emptyText(): string;
|
|
39
|
+
set emptyText(value: string);
|
|
40
|
+
private _normalize;
|
|
41
|
+
private _layout;
|
|
42
|
+
private _render;
|
|
43
|
+
}
|
|
44
|
+
export declare function defineDescriptionsComponents(): void;
|
|
@@ -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
|
`;
|