aeico-components 0.1.5 → 0.1.7
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/LICENSE +21 -0
- package/README.md +0 -0
- package/dist/chunks/action-button.cjs +296 -0
- package/dist/chunks/action-button.cjs.map +1 -0
- package/dist/chunks/action-button.js +297 -0
- package/dist/chunks/action-button.js.map +1 -0
- package/dist/chunks/alert.cjs +26 -32
- package/dist/chunks/alert.cjs.map +1 -1
- package/dist/chunks/alert.js +27 -33
- package/dist/chunks/alert.js.map +1 -1
- package/dist/chunks/badge.cjs +2 -2
- package/dist/chunks/badge.cjs.map +1 -1
- package/dist/chunks/badge.js +3 -3
- package/dist/chunks/badge.js.map +1 -1
- package/dist/chunks/breadcrumb-item.cjs +9 -9
- package/dist/chunks/breadcrumb-item.cjs.map +1 -1
- package/dist/chunks/breadcrumb-item.js +10 -10
- package/dist/chunks/breadcrumb-item.js.map +1 -1
- package/dist/chunks/button-group.cjs +1 -1
- package/dist/chunks/button-group.cjs.map +1 -1
- package/dist/chunks/button-group.js +2 -2
- package/dist/chunks/button-group.js.map +1 -1
- package/dist/chunks/button.cjs +40 -51
- package/dist/chunks/button.cjs.map +1 -1
- package/dist/chunks/button.js +41 -52
- package/dist/chunks/button.js.map +1 -1
- package/dist/chunks/card.cjs +2 -2
- package/dist/chunks/card.cjs.map +1 -1
- package/dist/chunks/card.js +3 -3
- package/dist/chunks/card.js.map +1 -1
- package/dist/chunks/checkbox.cjs +18 -5
- package/dist/chunks/checkbox.cjs.map +1 -1
- package/dist/chunks/checkbox.js +18 -5
- package/dist/chunks/checkbox.js.map +1 -1
- package/dist/chunks/color.cjs +1 -1
- package/dist/chunks/color.js +1 -1
- package/dist/chunks/copy-button.cjs +171 -0
- package/dist/chunks/copy-button.cjs.map +1 -0
- package/dist/chunks/copy-button.js +172 -0
- package/dist/chunks/copy-button.js.map +1 -0
- package/dist/chunks/detail-group.cjs +65 -0
- package/dist/chunks/detail-group.cjs.map +1 -0
- package/dist/chunks/detail-group.js +66 -0
- package/dist/chunks/detail-group.js.map +1 -0
- package/dist/chunks/detail.cjs +7 -4
- package/dist/chunks/detail.cjs.map +1 -1
- package/dist/chunks/detail.js +8 -5
- package/dist/chunks/detail.js.map +1 -1
- package/dist/chunks/dialog.cjs +2 -2
- package/dist/chunks/dialog.cjs.map +1 -1
- package/dist/chunks/dialog.js +3 -3
- package/dist/chunks/dialog.js.map +1 -1
- package/dist/chunks/divider.cjs +2 -2
- package/dist/chunks/divider.cjs.map +1 -1
- package/dist/chunks/divider.js +3 -3
- package/dist/chunks/divider.js.map +1 -1
- package/dist/chunks/drawer.cjs +180 -0
- package/dist/chunks/drawer.cjs.map +1 -0
- package/dist/chunks/drawer.js +181 -0
- package/dist/chunks/drawer.js.map +1 -0
- package/dist/chunks/dropdown-button.cjs +10 -11
- package/dist/chunks/dropdown-button.cjs.map +1 -1
- package/dist/chunks/dropdown-button.js +14 -15
- package/dist/chunks/dropdown-button.js.map +1 -1
- package/dist/chunks/icon.cjs +57 -11
- package/dist/chunks/icon.cjs.map +1 -1
- package/dist/chunks/icon.js +58 -12
- package/dist/chunks/icon.js.map +1 -1
- package/dist/chunks/menu.cjs +396 -0
- package/dist/chunks/menu.cjs.map +1 -0
- package/dist/chunks/menu.js +397 -0
- package/dist/chunks/menu.js.map +1 -0
- package/dist/chunks/navbar.cjs +2 -2
- package/dist/chunks/navbar.cjs.map +1 -1
- package/dist/chunks/navbar.js +3 -3
- package/dist/chunks/navbar.js.map +1 -1
- package/dist/chunks/number-input.cjs +110 -0
- package/dist/chunks/number-input.cjs.map +1 -0
- package/dist/chunks/number-input.js +111 -0
- package/dist/chunks/number-input.js.map +1 -0
- package/dist/chunks/pagination.cjs +475 -0
- package/dist/chunks/pagination.cjs.map +1 -0
- package/dist/chunks/pagination.js +476 -0
- package/dist/chunks/pagination.js.map +1 -0
- package/dist/chunks/progress-bar.cjs +101 -0
- package/dist/chunks/progress-bar.cjs.map +1 -0
- package/dist/chunks/progress-bar.js +102 -0
- package/dist/chunks/progress-bar.js.map +1 -0
- package/dist/chunks/radio.cjs +11 -7
- package/dist/chunks/radio.cjs.map +1 -1
- package/dist/chunks/radio.js +11 -7
- package/dist/chunks/radio.js.map +1 -1
- package/dist/chunks/select.cjs +97 -66
- package/dist/chunks/select.cjs.map +1 -1
- package/dist/chunks/select.js +97 -66
- package/dist/chunks/select.js.map +1 -1
- package/dist/chunks/size.cjs +1 -1
- package/dist/chunks/size.js +1 -1
- package/dist/chunks/slider.cjs +35 -75
- package/dist/chunks/slider.cjs.map +1 -1
- package/dist/chunks/slider.js +35 -75
- package/dist/chunks/slider.js.map +1 -1
- package/dist/chunks/spinner.cjs +102 -0
- package/dist/chunks/spinner.cjs.map +1 -0
- package/dist/chunks/spinner.js +103 -0
- package/dist/chunks/spinner.js.map +1 -0
- package/dist/chunks/switch.cjs +110 -16
- package/dist/chunks/switch.cjs.map +1 -1
- package/dist/chunks/switch.js +111 -17
- package/dist/chunks/switch.js.map +1 -1
- package/dist/chunks/tab-panel.cjs +14 -5
- package/dist/chunks/tab-panel.cjs.map +1 -1
- package/dist/chunks/tab-panel.js +15 -6
- package/dist/chunks/tab-panel.js.map +1 -1
- package/dist/chunks/tag.cjs +2 -2
- package/dist/chunks/tag.cjs.map +1 -1
- package/dist/chunks/tag.js +3 -3
- package/dist/chunks/tag.js.map +1 -1
- package/dist/chunks/text-input.cjs +11 -16
- package/dist/chunks/text-input.cjs.map +1 -1
- package/dist/chunks/text-input.js +11 -16
- package/dist/chunks/text-input.js.map +1 -1
- package/dist/chunks/textarea.cjs +137 -0
- package/dist/chunks/textarea.cjs.map +1 -0
- package/dist/chunks/textarea.js +138 -0
- package/dist/chunks/textarea.js.map +1 -0
- package/dist/chunks/tooltip.cjs +292 -0
- package/dist/chunks/tooltip.cjs.map +1 -0
- package/dist/chunks/tooltip.js +293 -0
- package/dist/chunks/tooltip.js.map +1 -0
- package/dist/chunks/tree.cjs +468 -0
- package/dist/chunks/tree.cjs.map +1 -0
- package/dist/chunks/tree.js +469 -0
- package/dist/chunks/tree.js.map +1 -0
- package/dist/chunks/variables.cjs +273 -249
- package/dist/chunks/variables.cjs.map +1 -1
- package/dist/chunks/variables.js +273 -249
- package/dist/chunks/variables.js.map +1 -1
- package/dist/copy-button.cjs +6 -0
- package/dist/copy-button.cjs.map +1 -0
- package/dist/copy-button.js +6 -0
- package/dist/copy-button.js.map +1 -0
- package/dist/detail-group.cjs +6 -0
- package/dist/detail-group.cjs.map +1 -0
- package/dist/detail-group.js +6 -0
- package/dist/detail-group.js.map +1 -0
- package/dist/drawer.cjs +6 -0
- package/dist/drawer.cjs.map +1 -0
- package/dist/drawer.js +6 -0
- package/dist/drawer.js.map +1 -0
- package/dist/dropdown.js +4 -4
- package/dist/index.cjs +24 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -116
- package/dist/index.js.map +1 -1
- package/dist/menu.cjs +6 -0
- package/dist/menu.cjs.map +1 -0
- package/dist/menu.js +6 -0
- package/dist/menu.js.map +1 -0
- package/dist/number-input.cjs +6 -0
- package/dist/number-input.cjs.map +1 -0
- package/dist/number-input.js +6 -0
- package/dist/number-input.js.map +1 -0
- package/dist/pagination.cjs +6 -0
- package/dist/pagination.cjs.map +1 -0
- package/dist/pagination.js +6 -0
- package/dist/pagination.js.map +1 -0
- package/dist/progress-bar.cjs +6 -0
- package/dist/progress-bar.cjs.map +1 -0
- package/dist/progress-bar.js +6 -0
- package/dist/progress-bar.js.map +1 -0
- package/dist/select.cjs +2 -2
- package/dist/select.cjs.map +1 -1
- package/dist/select.js +3 -3
- package/dist/select.js.map +1 -1
- package/dist/spinner.cjs +6 -0
- package/dist/spinner.cjs.map +1 -0
- package/dist/spinner.js +6 -0
- package/dist/spinner.js.map +1 -0
- package/dist/textarea.cjs +5 -0
- package/dist/textarea.cjs.map +1 -0
- package/dist/textarea.js +5 -0
- package/dist/textarea.js.map +1 -0
- package/dist/tooltip.cjs +6 -0
- package/dist/tooltip.cjs.map +1 -0
- package/dist/tooltip.js +6 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/tree.cjs +6 -0
- package/dist/tree.cjs.map +1 -0
- package/dist/tree.js +6 -0
- package/dist/tree.js.map +1 -0
- package/dist/types/aeico-field.d.ts +52 -0
- package/dist/types/alert/alert.d.ts +1 -0
- package/dist/types/card/defines.d.ts +1 -1
- package/dist/types/copy-button/copy-button.d.ts +32 -0
- package/dist/types/copy-button/defines.d.ts +1 -0
- package/dist/types/copy-button/index.d.ts +3 -0
- package/dist/types/detail/defines.d.ts +2 -1
- package/dist/types/detail/detail.d.ts +3 -1
- package/dist/types/detail/index.d.ts +1 -1
- package/dist/types/detail-group/detail-group.d.ts +39 -0
- package/dist/types/detail-group/index.d.ts +2 -0
- package/dist/types/drawer/defines.d.ts +1 -0
- package/dist/types/drawer/drawer.d.ts +31 -0
- package/dist/types/drawer/index.d.ts +3 -0
- package/dist/types/icon/built-in-icons.d.ts +1 -0
- package/dist/types/icon/defines.d.ts +5 -1
- package/dist/types/icon/icon.d.ts +1 -0
- package/dist/types/icon/index.d.ts +1 -1
- package/dist/types/icon/registry.d.ts +8 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/menu/defines.d.ts +15 -0
- package/dist/types/menu/index.d.ts +5 -0
- package/dist/types/menu/menu-item.d.ts +63 -0
- package/dist/types/menu/menu.d.ts +34 -0
- package/dist/types/number-input/index.d.ts +2 -0
- package/dist/types/number-input/number-input.d.ts +35 -0
- package/dist/types/pagination/defines.d.ts +2 -0
- package/dist/types/pagination/index.d.ts +3 -0
- package/dist/types/pagination/pagination.d.ts +77 -0
- package/dist/types/select/select.d.ts +2 -2
- package/dist/types/spinner/defines.d.ts +3 -0
- package/dist/types/spinner/index.d.ts +3 -0
- package/dist/types/spinner/spinner.d.ts +35 -0
- package/dist/types/switch/defines.d.ts +1 -0
- package/dist/types/switch/switch.d.ts +8 -4
- package/dist/types/tabs/defines.d.ts +1 -0
- package/dist/types/tabs/tabs.d.ts +3 -0
- package/dist/types/text-input/text-input.d.ts +0 -4
- package/dist/types/textarea/index.d.ts +1 -0
- package/dist/types/textarea/textarea.d.ts +26 -0
- package/dist/types/tooltip/defines.d.ts +2 -0
- package/dist/types/tooltip/index.d.ts +4 -0
- package/dist/types/tooltip/tooltip.d.ts +48 -0
- package/dist/types/tree/defines.d.ts +23 -0
- package/dist/types/tree/index.d.ts +5 -0
- package/dist/types/tree/tree-item.d.ts +54 -0
- package/dist/types/tree/tree.d.ts +64 -0
- package/package.json +5 -5
- package/src/aeico-field.ts +142 -7
- package/src/alert/alert.ts +3 -2
- package/src/card/defines.ts +1 -1
- package/src/checkbox/checkbox.ts +17 -2
- package/src/copy-button/copy-button.ts +150 -0
- package/src/copy-button/defines.ts +5 -0
- package/src/copy-button/index.ts +3 -0
- package/src/detail/defines.ts +2 -1
- package/src/detail/detail.ts +5 -1
- package/src/detail/index.ts +1 -1
- package/src/detail-group/detail-group.ts +104 -0
- package/src/detail-group/index.ts +2 -0
- package/src/drawer/defines.ts +1 -0
- package/src/drawer/drawer.ts +157 -0
- package/src/drawer/index.ts +3 -0
- package/src/icon/built-in-icons.ts +21 -0
- package/src/icon/defines.ts +6 -1
- package/src/icon/icon.ts +29 -10
- package/src/icon/index.ts +1 -1
- package/src/icon/registry.ts +23 -1
- package/src/index.ts +30 -0
- package/src/menu/defines.ts +17 -0
- package/src/menu/index.ts +5 -0
- package/src/menu/menu-item.ts +315 -0
- package/src/menu/menu.ts +81 -0
- package/src/number-input/index.ts +2 -0
- package/src/number-input/number-input.ts +137 -0
- package/src/pagination/defines.ts +2 -0
- package/src/pagination/index.ts +3 -0
- package/src/pagination/pagination.ts +310 -0
- package/src/radio-group/radio-group.ts +11 -4
- package/src/select/select.ts +111 -70
- package/src/slider/slider.ts +9 -2
- package/src/spinner/defines.ts +12 -0
- package/src/spinner/index.ts +3 -0
- package/src/spinner/spinner.ts +81 -0
- package/src/styles/color.css +91 -91
- package/src/styles/components/action-button.css +37 -0
- package/src/styles/components/alert.css +22 -28
- package/src/styles/components/badge.css +13 -20
- package/src/styles/components/breadcrumb-item.css +7 -7
- package/src/styles/components/button.css +39 -50
- package/src/styles/components/card.css +45 -30
- package/src/styles/components/checkbox.css +9 -36
- package/src/styles/components/copy-button.css +108 -0
- package/src/styles/components/detail-group.css +10 -0
- package/src/styles/components/detail.css +56 -35
- package/src/styles/components/dialog.css +11 -11
- package/src/styles/components/divider.css +3 -3
- package/src/styles/components/drawer.css +152 -0
- package/src/styles/components/dropdown-item.css +7 -8
- package/src/styles/components/dropdown.css +3 -4
- package/src/styles/components/field-label.css +120 -0
- package/src/styles/components/icon-button.css +25 -36
- package/src/styles/components/icon.css +1 -1
- package/src/styles/components/menu-item.css +167 -0
- package/src/styles/components/menu.css +17 -0
- package/src/styles/components/navbar.css +16 -16
- package/src/styles/components/number-input.css +158 -0
- package/src/styles/components/pagination.css +205 -0
- package/src/styles/components/progress-bar.css +2 -3
- package/src/styles/components/radio-group.css +69 -106
- package/src/styles/components/select-option.css +5 -5
- package/src/styles/components/select.css +30 -69
- package/src/styles/components/slider.css +26 -71
- package/src/styles/components/spinner.css +78 -0
- package/src/styles/components/switch.css +64 -27
- package/src/styles/components/tab-panel.css +1 -1
- package/src/styles/components/tab.css +4 -5
- package/src/styles/components/tabs.css +49 -1
- package/src/styles/components/tag.css +14 -21
- package/src/styles/components/text-input.css +17 -64
- package/src/styles/components/textarea.css +66 -0
- package/src/styles/components/tooltip.css +102 -0
- package/src/styles/components/tree-item.css +152 -0
- package/src/styles/components/tree.css +10 -0
- package/src/styles/layout.css +457 -25
- package/src/styles/radius.css +10 -0
- package/src/styles/size.css +7 -7
- package/src/styles/variables.css +271 -247
- package/src/switch/defines.ts +1 -0
- package/src/switch/switch.ts +61 -12
- package/src/tabs/defines.ts +1 -0
- package/src/tabs/tabs.ts +12 -0
- package/src/text-input/text-input.ts +10 -15
- package/src/textarea/index.ts +1 -0
- package/src/textarea/textarea.ts +107 -0
- package/src/tooltip/defines.ts +11 -0
- package/src/tooltip/index.ts +4 -0
- package/src/tooltip/tooltip.ts +183 -0
- package/src/tree/defines.ts +26 -0
- package/src/tree/index.ts +5 -0
- package/src/tree/tree-item.ts +258 -0
- package/src/tree/tree.ts +237 -0
- package/dist/chunks/aeico-field.cjs +0 -179
- package/dist/chunks/aeico-field.cjs.map +0 -1
- package/dist/chunks/aeico-field.js +0 -180
- package/dist/chunks/aeico-field.js.map +0 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { InferProps } from 'aeico';
|
|
2
|
+
import styleVariables from '../styles/variables.css?inline';
|
|
3
|
+
import style from '../styles/components/drawer.css?inline';
|
|
4
|
+
import AeicoComponent from '../aeico-component';
|
|
5
|
+
import { html, prop } from 'aeico';
|
|
6
|
+
import type { DrawerPlacement } from './defines';
|
|
7
|
+
|
|
8
|
+
class Drawer extends AeicoComponent {
|
|
9
|
+
protected static styles = [styleVariables, style];
|
|
10
|
+
|
|
11
|
+
@prop({ type: String })
|
|
12
|
+
accessor label: string | undefined;
|
|
13
|
+
|
|
14
|
+
@prop({ type: String })
|
|
15
|
+
accessor placement: DrawerPlacement | undefined;
|
|
16
|
+
|
|
17
|
+
@prop({ type: String })
|
|
18
|
+
accessor size: string | undefined;
|
|
19
|
+
|
|
20
|
+
@prop({ type: Boolean })
|
|
21
|
+
accessor modal: boolean = true;
|
|
22
|
+
|
|
23
|
+
@prop({ type: Boolean })
|
|
24
|
+
accessor closable: boolean = true;
|
|
25
|
+
|
|
26
|
+
@prop({ type: Boolean })
|
|
27
|
+
accessor header: boolean = true;
|
|
28
|
+
|
|
29
|
+
@prop({ type: Boolean })
|
|
30
|
+
accessor closeOnOverlayClick: boolean = true;
|
|
31
|
+
|
|
32
|
+
private _panelEl: HTMLDivElement | null = null;
|
|
33
|
+
private _hasFooter = false;
|
|
34
|
+
|
|
35
|
+
protected render() {
|
|
36
|
+
const placement = this.placement || 'right';
|
|
37
|
+
const isVertical = placement === 'top' || placement === 'bottom';
|
|
38
|
+
|
|
39
|
+
return html(({ div, header, footer, span, button, slot }) => {
|
|
40
|
+
// Backdrop (modal only)
|
|
41
|
+
if (this.modal) {
|
|
42
|
+
div({ className: 'backdrop', '@click': this._handleBackdropClick });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Panel
|
|
46
|
+
this._panelEl = div(
|
|
47
|
+
{
|
|
48
|
+
className: `panel placement-${placement}`,
|
|
49
|
+
role: 'dialog',
|
|
50
|
+
'aria-modal': this.modal ? 'true' : 'false',
|
|
51
|
+
'aria-label': this.label,
|
|
52
|
+
tabindex: '-1',
|
|
53
|
+
'@click': this._handlePanelClick,
|
|
54
|
+
style: {
|
|
55
|
+
[isVertical ? 'height' : 'width']: this.size || '',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
() => {
|
|
59
|
+
// Header
|
|
60
|
+
if (this.header) {
|
|
61
|
+
header({}, () => {
|
|
62
|
+
slot({ name: 'header' }, () => {
|
|
63
|
+
span({ className: 'label', textContent: this.label || '' });
|
|
64
|
+
});
|
|
65
|
+
if (this.closable) {
|
|
66
|
+
button({
|
|
67
|
+
className: 'close-btn',
|
|
68
|
+
textContent: '×',
|
|
69
|
+
'@click': () => this.close(),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Body
|
|
76
|
+
div({ className: 'body' }, () => {
|
|
77
|
+
slot();
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Footer — always rendered to capture slotchange, hidden when empty
|
|
81
|
+
footer({ style: { display: this._hasFooter ? '' : 'none' } }, () => {
|
|
82
|
+
slot({ name: 'footer', '@slotchange': this._handleFooterSlotChange });
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private _handleBackdropClick = () => {
|
|
90
|
+
if (this.closeOnOverlayClick) {
|
|
91
|
+
this.close();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
private _handlePanelClick = (e: Event) => {
|
|
96
|
+
const path = (e as MouseEvent).composedPath();
|
|
97
|
+
for (const el of path) {
|
|
98
|
+
if (el instanceof Element && el.hasAttribute('data-close')) {
|
|
99
|
+
this.close();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (el === this._panelEl) break;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
private _handleKeydown = (e: KeyboardEvent) => {
|
|
107
|
+
if (e.key === 'Escape') {
|
|
108
|
+
e.stopPropagation();
|
|
109
|
+
this.close();
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
private _handleFooterSlotChange = (e: Event) => {
|
|
114
|
+
const slotEl = e.target as HTMLSlotElement;
|
|
115
|
+
const hasContent = slotEl.assignedElements().length > 0;
|
|
116
|
+
if (hasContent !== this._hasFooter) {
|
|
117
|
+
this._hasFooter = hasContent;
|
|
118
|
+
this.update();
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
open() {
|
|
123
|
+
this.setAttribute('data-open', '');
|
|
124
|
+
document.addEventListener('keydown', this._handleKeydown);
|
|
125
|
+
requestAnimationFrame(() => {
|
|
126
|
+
const btn = this.shadowRoot?.querySelector<HTMLElement>('.close-btn');
|
|
127
|
+
(btn ?? this._panelEl)?.focus();
|
|
128
|
+
});
|
|
129
|
+
this.emit('open', { detail: { target: this } });
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
close() {
|
|
133
|
+
this.removeAttribute('data-open');
|
|
134
|
+
document.removeEventListener('keydown', this._handleKeydown);
|
|
135
|
+
this.emit('close', { detail: { target: this } });
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
isOpen(): boolean {
|
|
139
|
+
return this.hasAttribute('data-open');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
disconnectedCallback() {
|
|
143
|
+
super.disconnectedCallback();
|
|
144
|
+
document.removeEventListener('keydown', this._handleKeydown);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
Drawer.register();
|
|
149
|
+
|
|
150
|
+
declare global {
|
|
151
|
+
interface HTMLElementTagNameMap {
|
|
152
|
+
'ae-drawer': Drawer;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export default Drawer;
|
|
157
|
+
export type DrawerProps = InferProps<typeof Drawer>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in system icons used internally by aeico components.
|
|
3
|
+
* These are pre-registered so components work out of the box.
|
|
4
|
+
* Users can override any of them by calling IconRegistry.add({ 'name': '...' }).
|
|
5
|
+
*
|
|
6
|
+
* All paths use the Material Design 24×24 viewBox.
|
|
7
|
+
*/
|
|
8
|
+
import IconRegistry from './registry';
|
|
9
|
+
|
|
10
|
+
IconRegistry.addBuiltIn({
|
|
11
|
+
copy: 'M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z',
|
|
12
|
+
check: 'M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z',
|
|
13
|
+
'chevron-left': 'M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z',
|
|
14
|
+
'chevron-right': 'M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z',
|
|
15
|
+
'chevron-up': 'M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z',
|
|
16
|
+
'chevron-down': 'M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z',
|
|
17
|
+
'chevrons-left': 'M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z',
|
|
18
|
+
'chevrons-right': 'M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z',
|
|
19
|
+
close:
|
|
20
|
+
'M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z',
|
|
21
|
+
});
|
package/src/icon/defines.ts
CHANGED
|
@@ -9,8 +9,13 @@ export type IconColor =
|
|
|
9
9
|
| 'warning'
|
|
10
10
|
| 'info';
|
|
11
11
|
|
|
12
|
+
export interface IconPathDef {
|
|
13
|
+
d: string;
|
|
14
|
+
fill?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
export interface IconDefinition {
|
|
13
|
-
|
|
18
|
+
paths: string | IconPathDef[];
|
|
14
19
|
viewBox?: string;
|
|
15
20
|
stroke?: boolean;
|
|
16
21
|
strokeWidth?: number;
|
package/src/icon/icon.ts
CHANGED
|
@@ -9,6 +9,7 @@ import style from '../styles/components/icon.css?inline';
|
|
|
9
9
|
import type { IconSize, IconColor } from './defines';
|
|
10
10
|
import { defaultViewBox } from './defines';
|
|
11
11
|
import IconRegistry from './registry';
|
|
12
|
+
import './built-in-icons';
|
|
12
13
|
|
|
13
14
|
class Icon extends AeicoComponent {
|
|
14
15
|
static tagName = 'icon';
|
|
@@ -40,22 +41,32 @@ class Icon extends AeicoComponent {
|
|
|
40
41
|
this.style.removeProperty('font-size');
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
44
|
+
if (!def) return;
|
|
45
|
+
|
|
46
|
+
const { paths } = def;
|
|
47
|
+
const isMultiPath = Array.isArray(paths);
|
|
48
|
+
|
|
49
|
+
// Stroke CSS variables only apply in single-path mode (component props)
|
|
50
|
+
if (!isMultiPath) {
|
|
51
|
+
const useStroke =
|
|
52
|
+
this.stroke ?? (this.strokeWidth !== undefined ? true : (def.stroke ?? false));
|
|
53
|
+
const useStrokeWidth = this.strokeWidth ?? def.strokeWidth ?? 2;
|
|
46
54
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
if (useStroke) {
|
|
56
|
+
this.style.setProperty('--icon-fill', 'none');
|
|
57
|
+
this.style.setProperty('--icon-stroke', 'currentColor');
|
|
58
|
+
this.style.setProperty('--icon-stroke-width', String(useStrokeWidth));
|
|
59
|
+
} else {
|
|
60
|
+
this.style.removeProperty('--icon-fill');
|
|
61
|
+
this.style.removeProperty('--icon-stroke');
|
|
62
|
+
this.style.removeProperty('--icon-stroke-width');
|
|
63
|
+
}
|
|
51
64
|
} else {
|
|
52
65
|
this.style.removeProperty('--icon-fill');
|
|
53
66
|
this.style.removeProperty('--icon-stroke');
|
|
54
67
|
this.style.removeProperty('--icon-stroke-width');
|
|
55
68
|
}
|
|
56
69
|
|
|
57
|
-
if (!def) return;
|
|
58
|
-
|
|
59
70
|
return html(({ svg, path }) => {
|
|
60
71
|
svg(
|
|
61
72
|
{
|
|
@@ -65,7 +76,15 @@ class Icon extends AeicoComponent {
|
|
|
65
76
|
xmlns: SVG_NS,
|
|
66
77
|
},
|
|
67
78
|
() => {
|
|
68
|
-
|
|
79
|
+
if (typeof paths === 'string') {
|
|
80
|
+
path({ d: paths });
|
|
81
|
+
} else {
|
|
82
|
+
for (const p of paths) {
|
|
83
|
+
const attrs: Record<string, unknown> = { d: p.d };
|
|
84
|
+
if (p.fill) attrs.style = { fill: p.fill };
|
|
85
|
+
path(attrs);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
69
88
|
},
|
|
70
89
|
);
|
|
71
90
|
});
|
package/src/icon/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as Icon } from './icon';
|
|
2
2
|
export type { IconProps } from './icon';
|
|
3
3
|
export { default as IconRegistry } from './registry';
|
|
4
|
-
export type { IconSize, IconColor, IconDefinition, IconRegistryData } from './defines';
|
|
4
|
+
export type { IconSize, IconColor, IconDefinition, IconPathDef, IconRegistryData } from './defines';
|
package/src/icon/registry.ts
CHANGED
|
@@ -2,14 +2,36 @@ import { IconDefinition, IconRegistryData, defaultViewBox } from './defines';
|
|
|
2
2
|
|
|
3
3
|
class IconRegistry {
|
|
4
4
|
private static _icons: Map<string, IconDefinition> = new Map();
|
|
5
|
+
/** Names registered via addBuiltIn — can be overridden by user add() calls */
|
|
6
|
+
private static _builtInKeys: Set<string> = new Set();
|
|
5
7
|
|
|
8
|
+
/** Register user icons. Always takes priority over built-in icons. */
|
|
6
9
|
static add(icons: IconRegistryData) {
|
|
7
10
|
for (const [name, data] of Object.entries(icons)) {
|
|
8
11
|
if (typeof data === 'string') {
|
|
9
|
-
this._icons.set(name, {
|
|
12
|
+
this._icons.set(name, { paths: data, viewBox: defaultViewBox });
|
|
10
13
|
} else {
|
|
11
14
|
this._icons.set(name, data);
|
|
12
15
|
}
|
|
16
|
+
// Mark as user-defined (removes built-in status)
|
|
17
|
+
this._builtInKeys.delete(name);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Register built-in icons provided by the library.
|
|
23
|
+
* A built-in icon will NOT overwrite an icon already registered by the user.
|
|
24
|
+
*/
|
|
25
|
+
static addBuiltIn(icons: IconRegistryData) {
|
|
26
|
+
for (const [name, data] of Object.entries(icons)) {
|
|
27
|
+
// Skip if the user has already registered this icon
|
|
28
|
+
if (this._icons.has(name) && !this._builtInKeys.has(name)) continue;
|
|
29
|
+
if (typeof data === 'string') {
|
|
30
|
+
this._icons.set(name, { paths: data, viewBox: defaultViewBox });
|
|
31
|
+
} else {
|
|
32
|
+
this._icons.set(name, data);
|
|
33
|
+
}
|
|
34
|
+
this._builtInKeys.add(name);
|
|
13
35
|
}
|
|
14
36
|
}
|
|
15
37
|
|
package/src/index.ts
CHANGED
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
|
|
34
34
|
// Field components
|
|
35
35
|
export { default as TextInput } from './text-input';
|
|
36
|
+
export { default as NumberInput } from './number-input';
|
|
37
|
+
export { default as Textarea, type TextareaResize } from './textarea';
|
|
36
38
|
export { default as Select } from './select';
|
|
37
39
|
export { default as Slider } from './slider';
|
|
38
40
|
export { default as Checkbox } from './checkbox';
|
|
@@ -43,12 +45,14 @@ export { default as Switch } from './switch';
|
|
|
43
45
|
// UI components
|
|
44
46
|
export { default as Breadcrumb, BreadcrumbItem } from './breadcrumb';
|
|
45
47
|
export { default as Button } from './button';
|
|
48
|
+
export { default as CopyButton } from './copy-button';
|
|
46
49
|
export { default as Dropdown, DropdownItem, DropdownButton } from './dropdown';
|
|
47
50
|
export { default as ButtonGroup } from './button-group';
|
|
48
51
|
export { default as Badge } from './badge';
|
|
49
52
|
export { default as Tag } from './tag';
|
|
50
53
|
export { default as Alert } from './alert';
|
|
51
54
|
export { default as Dialog } from './dialog';
|
|
55
|
+
export { default as Drawer } from './drawer';
|
|
52
56
|
export { default as Icon } from './icon/icon';
|
|
53
57
|
export { default as IconRegistry } from './icon/registry';
|
|
54
58
|
export { default as IconButton } from './icon-button';
|
|
@@ -56,8 +60,14 @@ export { Tabs, Tab, TabPanel } from './tabs';
|
|
|
56
60
|
export { default as Divider } from './divider';
|
|
57
61
|
export { default as Card } from './card';
|
|
58
62
|
export { default as Navbar } from './navbar';
|
|
63
|
+
export { default as Spinner } from './spinner';
|
|
59
64
|
export { default as Detail } from './detail';
|
|
65
|
+
export { default as DetailGroup } from './detail-group';
|
|
60
66
|
export { default as ProgressBar } from './progress-bar';
|
|
67
|
+
export { Menu, MenuItem } from './menu';
|
|
68
|
+
export { default as Tooltip } from './tooltip';
|
|
69
|
+
export { default as Pagination } from './pagination';
|
|
70
|
+
export { Tree, TreeItem } from './tree';
|
|
61
71
|
|
|
62
72
|
// Component types
|
|
63
73
|
export type { SelectProps, SelectOption, SelectOptions, SelectOptionValue } from './select';
|
|
@@ -72,12 +82,16 @@ export type {
|
|
|
72
82
|
export type { RadioProps } from './radio-group';
|
|
73
83
|
export type { SwitchProps } from './switch';
|
|
74
84
|
export type { TextInputProps } from './text-input';
|
|
85
|
+
export type { NumberInputProps } from './number-input';
|
|
86
|
+
export type { TextareaProps } from './textarea';
|
|
75
87
|
export type { ButtonProps, ButtonColor, ButtonSize, ButtonVariant } from './button';
|
|
76
88
|
export type { ButtonGroupProps } from './button-group';
|
|
89
|
+
export type { PaginationProps, PaginationSize } from './pagination';
|
|
77
90
|
export type { AlertProps, AlertColor, AlertSize, AlertVariant } from './alert';
|
|
78
91
|
export type { BadgeProps, BadgeColor, BadgeSize, BadgeVariant } from './badge';
|
|
79
92
|
export type { TagProps, TagColor, TagSize, TagVariant } from './tag';
|
|
80
93
|
export type { DialogProps } from './dialog';
|
|
94
|
+
export type { DrawerProps, DrawerPlacement } from './drawer';
|
|
81
95
|
export type { IconProps, IconSize, IconColor, IconDefinition, IconRegistryData } from './icon';
|
|
82
96
|
export type { ProgressBarProps, ProgressBarColor } from './progress-bar';
|
|
83
97
|
export type { IconButtonProps, IconButtonVariant, IconButtonSize } from './icon-button';
|
|
@@ -85,3 +99,19 @@ export type { DividerProps } from './divider';
|
|
|
85
99
|
export type { CardProps, CardVariant, CardColor } from './card';
|
|
86
100
|
export type { NavbarProps, NavbarColor, NavbarAppearance } from './navbar';
|
|
87
101
|
export type { DetailProps, DetailVariant, DetailColor } from './detail';
|
|
102
|
+
export type {
|
|
103
|
+
MenuProps,
|
|
104
|
+
MenuItemProps,
|
|
105
|
+
MenuMode,
|
|
106
|
+
MenuOrientation,
|
|
107
|
+
MenuTrigger,
|
|
108
|
+
MenuSelectDetail,
|
|
109
|
+
} from './menu';
|
|
110
|
+
export type { TooltipProps, TooltipPlacement, TooltipTrigger } from './tooltip';
|
|
111
|
+
export type {
|
|
112
|
+
TreeProps,
|
|
113
|
+
TreeItemProps,
|
|
114
|
+
TreeSelectDetail,
|
|
115
|
+
TreeExpandDetail,
|
|
116
|
+
TreeCheckDetail,
|
|
117
|
+
} from './tree';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type MenuMode = 'flyout' | 'inline';
|
|
2
|
+
export type MenuOrientation = 'horizontal' | 'vertical';
|
|
3
|
+
export type MenuTrigger = 'click' | 'hover';
|
|
4
|
+
export type MenuIconPlacement = 'start' | 'end';
|
|
5
|
+
|
|
6
|
+
/** Minimal interface used by menu-item to read config from its parent ae-menu. */
|
|
7
|
+
export interface ParentMenuLike extends Element {
|
|
8
|
+
mode?: MenuMode;
|
|
9
|
+
orientation?: MenuOrientation;
|
|
10
|
+
trigger?: MenuTrigger;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface MenuSelectDetail {
|
|
14
|
+
key: string;
|
|
15
|
+
label: string;
|
|
16
|
+
keyPath: string[];
|
|
17
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Menu } from './menu';
|
|
2
|
+
export { default as MenuItem } from './menu-item';
|
|
3
|
+
export type { MenuProps } from './menu';
|
|
4
|
+
export type { MenuItemProps } from './menu-item';
|
|
5
|
+
export type { MenuMode, MenuOrientation, MenuTrigger, MenuSelectDetail } from './defines';
|