aeico-components 0.1.4 → 0.1.6
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 +4 -4
- package/dist/chunks/alert.cjs.map +1 -1
- package/dist/chunks/alert.js +5 -5
- package/dist/chunks/alert.js.map +1 -1
- package/dist/chunks/badge.cjs +1 -1
- package/dist/chunks/badge.cjs.map +1 -1
- package/dist/chunks/badge.js +2 -2
- package/dist/chunks/badge.js.map +1 -1
- package/dist/chunks/breadcrumb-item.cjs +2 -2
- package/dist/chunks/breadcrumb-item.cjs.map +1 -1
- package/dist/chunks/breadcrumb-item.js +3 -3
- 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 +12 -15
- package/dist/chunks/button.cjs.map +1 -1
- package/dist/chunks/button.js +13 -16
- package/dist/chunks/button.js.map +1 -1
- package/dist/chunks/card.cjs +1 -1
- package/dist/chunks/card.cjs.map +1 -1
- package/dist/chunks/card.js +2 -2
- 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/copy-button.cjs +168 -0
- package/dist/chunks/copy-button.cjs.map +1 -0
- package/dist/chunks/copy-button.js +169 -0
- package/dist/chunks/copy-button.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 +1 -1
- package/dist/chunks/dialog.cjs.map +1 -1
- package/dist/chunks/dialog.js +2 -2
- package/dist/chunks/dialog.js.map +1 -1
- package/dist/chunks/divider.cjs +1 -1
- package/dist/chunks/divider.cjs.map +1 -1
- package/dist/chunks/divider.js +2 -2
- 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 +2 -2
- package/dist/chunks/dropdown-button.cjs.map +1 -1
- package/dist/chunks/dropdown-button.js +6 -6
- package/dist/chunks/dropdown-button.js.map +1 -1
- package/dist/chunks/icon.cjs +31 -1
- package/dist/chunks/icon.cjs.map +1 -1
- package/dist/chunks/icon.js +32 -2
- 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 -3
- package/dist/chunks/navbar.cjs.map +1 -1
- package/dist/chunks/navbar.js +3 -4
- package/dist/chunks/navbar.js.map +1 -1
- 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/slider.cjs +9 -46
- package/dist/chunks/slider.cjs.map +1 -1
- package/dist/chunks/slider.js +9 -46
- 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 +6 -7
- package/dist/chunks/tab-panel.cjs.map +1 -1
- package/dist/chunks/tab-panel.js +7 -8
- package/dist/chunks/tab-panel.js.map +1 -1
- package/dist/chunks/tag.cjs +1 -1
- package/dist/chunks/tag.cjs.map +1 -1
- package/dist/chunks/tag.js +2 -2
- 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 +293 -0
- package/dist/chunks/tooltip.cjs.map +1 -0
- package/dist/chunks/tooltip.js +294 -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 +2 -2
- package/dist/chunks/variables.js +2 -2
- 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/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 +186 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +201 -15
- 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/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 +1 -1
- package/dist/select.cjs.map +1 -1
- package/dist/select.js +2 -2
- 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 +57 -5
- package/dist/types/alert/alert.d.ts +1 -0
- package/dist/types/button/button.d.ts +2 -1
- package/dist/types/checkbox/checkbox.d.ts +5 -5
- 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 +1 -0
- 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/icon.d.ts +1 -0
- package/dist/types/icon/registry.d.ts +8 -0
- package/dist/types/index.d.ts +19 -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/progress-bar/defines.d.ts +1 -0
- package/dist/types/progress-bar/index.d.ts +3 -0
- package/dist/types/progress-bar/progress-bar.d.ts +37 -0
- package/dist/types/radio-group/radio-group.d.ts +1 -1
- package/dist/types/select/select.d.ts +3 -3
- 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 +13 -9
- 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 +6 -6
- package/src/aeico-field.ts +154 -15
- package/src/alert/alert.ts +3 -2
- package/src/button/button.ts +11 -13
- package/src/checkbox/checkbox.ts +21 -6
- package/src/copy-button/copy-button.ts +146 -0
- package/src/copy-button/defines.ts +5 -0
- package/src/copy-button/index.ts +3 -0
- package/src/detail/defines.ts +1 -0
- 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/icon.ts +1 -0
- package/src/icon/registry.ts +22 -0
- package/src/index.ts +32 -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/navbar/navbar.ts +1 -3
- 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/progress-bar/defines.ts +8 -0
- package/src/progress-bar/index.ts +3 -0
- package/src/progress-bar/progress-bar.ts +80 -0
- package/src/radio-group/radio-group.ts +12 -5
- package/src/select/select.ts +112 -71
- 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/components/action-button.css +37 -0
- package/src/styles/components/checkbox.css +4 -26
- package/src/styles/components/copy-button.css +119 -0
- package/src/styles/components/detail-group.css +10 -0
- package/src/styles/components/detail.css +10 -1
- package/src/styles/components/drawer.css +161 -0
- package/src/styles/components/field-label.css +120 -0
- package/src/styles/components/menu-item.css +168 -0
- package/src/styles/components/menu.css +17 -0
- package/src/styles/components/number-input.css +167 -0
- package/src/styles/components/pagination.css +205 -0
- package/src/styles/components/progress-bar.css +44 -0
- package/src/styles/components/radio-group.css +0 -23
- package/src/styles/components/select.css +12 -39
- package/src/styles/components/slider.css +0 -42
- package/src/styles/components/spinner.css +80 -0
- package/src/styles/components/switch.css +68 -19
- package/src/styles/components/tab-panel.css +1 -1
- package/src/styles/components/tabs.css +1 -0
- package/src/styles/components/text-input.css +7 -45
- package/src/styles/components/textarea.css +75 -0
- package/src/styles/components/tooltip.css +103 -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/switch/defines.ts +1 -0
- package/src/switch/switch.ts +65 -16
- package/src/tabs/tab.ts +1 -1
- package/src/tabs/tabs.ts +1 -2
- 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
package/src/detail/index.ts
CHANGED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { InferProps, Props } from 'aeico';
|
|
2
|
+
import styleVariables from '../styles/variables.css?inline';
|
|
3
|
+
import detailGroupStyle from '../styles/components/detail-group.css?inline';
|
|
4
|
+
import AeicoComponent from '../aeico-component';
|
|
5
|
+
import { html } from 'aeico';
|
|
6
|
+
import type Detail from '../detail/detail';
|
|
7
|
+
import type { DetailColor, DetailVariant } from '../detail/defines';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* DetailGroup component — wraps multiple `ae-detail` elements into an
|
|
11
|
+
* accordion-style group. By default only one item can be open at a time;
|
|
12
|
+
* set `multiple` to allow several items open simultaneously.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```html
|
|
16
|
+
* <ae-detail-group>
|
|
17
|
+
* <ae-detail summary="Section 1">Content 1</ae-detail>
|
|
18
|
+
* <ae-detail summary="Section 2">Content 2</ae-detail>
|
|
19
|
+
* <ae-detail summary="Section 3">Content 3</ae-detail>
|
|
20
|
+
* </ae-detail-group>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
class DetailGroup extends AeicoComponent {
|
|
24
|
+
static tagName = 'detail-group';
|
|
25
|
+
|
|
26
|
+
static props: Props = {
|
|
27
|
+
multiple: { type: Boolean },
|
|
28
|
+
variant: { type: String },
|
|
29
|
+
color: { type: String },
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
protected static styles = [styleVariables, detailGroupStyle];
|
|
33
|
+
|
|
34
|
+
declare multiple?: boolean;
|
|
35
|
+
declare variant?: DetailVariant;
|
|
36
|
+
declare color?: DetailColor;
|
|
37
|
+
|
|
38
|
+
private slotEl: HTMLSlotElement | null = null;
|
|
39
|
+
|
|
40
|
+
private readonly DETAIL_RADIUS = 6;
|
|
41
|
+
|
|
42
|
+
connectedCallback() {
|
|
43
|
+
super.connectedCallback();
|
|
44
|
+
this.listen('open', this._handleOpen);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private _getDetails(): Detail[] {
|
|
48
|
+
if (!this.slotEl) return [];
|
|
49
|
+
return (this.slotEl.assignedElements({ flatten: true }) as Detail[]).filter(
|
|
50
|
+
(el) => el.tagName.toLowerCase() === 'ae-detail',
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private _syncChildren(): void {
|
|
55
|
+
const details = this._getDetails();
|
|
56
|
+
const r = this.DETAIL_RADIUS;
|
|
57
|
+
|
|
58
|
+
details.forEach((detail, i) => {
|
|
59
|
+
const isFirst = i === 0;
|
|
60
|
+
const isLast = i === details.length - 1;
|
|
61
|
+
|
|
62
|
+
// Collapse borders between adjacent items
|
|
63
|
+
detail.style.marginTop = isFirst ? '' : '-1px';
|
|
64
|
+
|
|
65
|
+
// Adjust per-corner radius so only the outer edges of the group keep it
|
|
66
|
+
detail.style.setProperty('--detail-r-tl', isFirst ? `${r}px` : '0');
|
|
67
|
+
detail.style.setProperty('--detail-r-tr', isFirst ? `${r}px` : '0');
|
|
68
|
+
detail.style.setProperty('--detail-r-br', isLast ? `${r}px` : '0');
|
|
69
|
+
detail.style.setProperty('--detail-r-bl', isLast ? `${r}px` : '0');
|
|
70
|
+
|
|
71
|
+
// Propagate variant / color only when explicitly set on the group
|
|
72
|
+
if (this.variant !== undefined) detail.variant = this.variant;
|
|
73
|
+
if (this.color !== undefined) detail.color = this.color;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private _handleOpen = (event: Event): void => {
|
|
78
|
+
if (this.multiple) return;
|
|
79
|
+
const opened = event.target as Element;
|
|
80
|
+
this._getDetails().forEach((detail) => {
|
|
81
|
+
if (detail !== opened) detail.close();
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
protected render() {
|
|
86
|
+
return html(({ slot }) => {
|
|
87
|
+
this.slotEl = slot({
|
|
88
|
+
'@slotchange': () => this._syncChildren(),
|
|
89
|
+
});
|
|
90
|
+
this._syncChildren();
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
DetailGroup.register();
|
|
96
|
+
|
|
97
|
+
declare global {
|
|
98
|
+
interface HTMLElementTagNameMap {
|
|
99
|
+
'ae-detail-group': DetailGroup;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export default DetailGroup;
|
|
104
|
+
export type DetailGroupProps = InferProps<typeof DetailGroup>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type DrawerPlacement = 'left' | 'right' | 'top' | 'bottom';
|
|
@@ -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/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';
|
package/src/icon/registry.ts
CHANGED
|
@@ -2,7 +2,10 @@ 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') {
|
|
@@ -10,6 +13,25 @@ class IconRegistry {
|
|
|
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, { path: 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,7 +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';
|
|
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';
|
|
60
71
|
|
|
61
72
|
// Component types
|
|
62
73
|
export type { SelectProps, SelectOption, SelectOptions, SelectOptionValue } from './select';
|
|
@@ -71,15 +82,36 @@ export type {
|
|
|
71
82
|
export type { RadioProps } from './radio-group';
|
|
72
83
|
export type { SwitchProps } from './switch';
|
|
73
84
|
export type { TextInputProps } from './text-input';
|
|
85
|
+
export type { NumberInputProps } from './number-input';
|
|
86
|
+
export type { TextareaProps } from './textarea';
|
|
74
87
|
export type { ButtonProps, ButtonColor, ButtonSize, ButtonVariant } from './button';
|
|
75
88
|
export type { ButtonGroupProps } from './button-group';
|
|
89
|
+
export type { PaginationProps, PaginationSize } from './pagination';
|
|
76
90
|
export type { AlertProps, AlertColor, AlertSize, AlertVariant } from './alert';
|
|
77
91
|
export type { BadgeProps, BadgeColor, BadgeSize, BadgeVariant } from './badge';
|
|
78
92
|
export type { TagProps, TagColor, TagSize, TagVariant } from './tag';
|
|
79
93
|
export type { DialogProps } from './dialog';
|
|
94
|
+
export type { DrawerProps, DrawerPlacement } from './drawer';
|
|
80
95
|
export type { IconProps, IconSize, IconColor, IconDefinition, IconRegistryData } from './icon';
|
|
96
|
+
export type { ProgressBarProps, ProgressBarColor } from './progress-bar';
|
|
81
97
|
export type { IconButtonProps, IconButtonVariant, IconButtonSize } from './icon-button';
|
|
82
98
|
export type { DividerProps } from './divider';
|
|
83
99
|
export type { CardProps, CardVariant, CardColor } from './card';
|
|
84
100
|
export type { NavbarProps, NavbarColor, NavbarAppearance } from './navbar';
|
|
85
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';
|