athena-ui-js 2.0.1 → 2.1.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/README.md +21 -3
- package/docs/migration-2.0.md +1 -1
- package/docs/styling.md +3 -1
- package/package.json +1 -1
- package/src/athena-ui.js +1 -1
- package/src/libs/config/config.js +1 -1
- package/src/libs/core/popover.js +96 -0
- package/src/libs/hephaestus/componentGenerator/componentGenerator.js +26 -2
- package/src/libs/hephaestus/navigationGenerator/navigationGenerator.js +45 -9
- package/src/res/themes/default/style.css +32 -0
- package/types/libs/config/config.d.ts +3 -3
- package/types/libs/core/popover.d.ts +36 -0
- package/types/libs/hephaestus/chartGenerator/chartGenerator.d.ts +93 -93
- package/types/libs/hephaestus/componentGenerator/componentGenerator.d.ts +224 -222
- package/types/libs/hephaestus/navigationGenerator/navigationGenerator.d.ts +153 -150
|
@@ -1,150 +1,153 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates tabs. Arrow keys, Home and End move between the tabs.
|
|
3
|
-
*
|
|
4
|
-
* @param {object} options
|
|
5
|
-
* @param {string|Element} [options.parent]
|
|
6
|
-
* @param {string} [options.id]
|
|
7
|
-
* @param {{id: string, label: string, content: *, disabled?: boolean}[]} options.tabs content is text, a Node,
|
|
8
|
-
* an array, or a function called once when the tab is first shown (lazy content)
|
|
9
|
-
* @param {string} [options.active] id of the initially active tab (default: the first)
|
|
10
|
-
* @param {(id: string) => void} [options.onChange]
|
|
11
|
-
* @returns {{element: HTMLElement, select: (id: string) => void, getActive: () => string}}
|
|
12
|
-
*/
|
|
13
|
-
export function generateTabs(options?: {
|
|
14
|
-
parent?: string | Element;
|
|
15
|
-
id?: string;
|
|
16
|
-
tabs: {
|
|
17
|
-
id: string;
|
|
18
|
-
label: string;
|
|
19
|
-
content: any;
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
}[];
|
|
22
|
-
active?: string;
|
|
23
|
-
onChange?: (id: string) => void;
|
|
24
|
-
}): {
|
|
25
|
-
element: HTMLElement;
|
|
26
|
-
select: (id: string) => void;
|
|
27
|
-
getActive: () => string;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Generates breadcrumbs. The last item is the current page.
|
|
31
|
-
*
|
|
32
|
-
* @param {object} options
|
|
33
|
-
* @param {string|Element} [options.parent]
|
|
34
|
-
* @param {{label: string, href?: string, onclick?: Function}[]} options.items
|
|
35
|
-
*/
|
|
36
|
-
export function generateBreadcrumbs(options?: {
|
|
37
|
-
parent?: string | Element;
|
|
38
|
-
items: {
|
|
39
|
-
label: string;
|
|
40
|
-
href?: string;
|
|
41
|
-
onclick?: Function;
|
|
42
|
-
}[];
|
|
43
|
-
}): any;
|
|
44
|
-
/**
|
|
45
|
-
* Generates a page selector.
|
|
46
|
-
*
|
|
47
|
-
* @param {object} options
|
|
48
|
-
* @param {string|Element} [options.parent]
|
|
49
|
-
* @param {number} options.total number of items
|
|
50
|
-
* @param {number} [options.pageSize=10]
|
|
51
|
-
* @param {number} [options.page=1]
|
|
52
|
-
* @param {number} [options.siblings=1] page buttons shown next to the current page
|
|
53
|
-
* @param {(page: number) => void} [options.onChange]
|
|
54
|
-
* @returns {{element: HTMLElement, setPage: Function, setTotal: Function, getPage: Function}}
|
|
55
|
-
*/
|
|
56
|
-
export function generatePagination(options?: {
|
|
57
|
-
parent?: string | Element;
|
|
58
|
-
total: number;
|
|
59
|
-
pageSize?: number;
|
|
60
|
-
page?: number;
|
|
61
|
-
siblings?: number;
|
|
62
|
-
onChange?: (page: number) => void;
|
|
63
|
-
}): {
|
|
64
|
-
element: HTMLElement;
|
|
65
|
-
setPage: Function;
|
|
66
|
-
setTotal: Function;
|
|
67
|
-
getPage: Function;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Generates collapsible panels.
|
|
71
|
-
*
|
|
72
|
-
* @param {object} options
|
|
73
|
-
* @param {string|Element} [options.parent]
|
|
74
|
-
* @param {{id?: string, title: string, content: *, open?: boolean}[]} options.items
|
|
75
|
-
* @param {boolean} [options.multiple=false] allow several panels to be open at once
|
|
76
|
-
* @returns {{element: HTMLElement, toggle: (index: number, open?: boolean) => void}}
|
|
77
|
-
*/
|
|
78
|
-
export function generateAccordion(options?: {
|
|
79
|
-
parent?: string | Element;
|
|
80
|
-
items: {
|
|
81
|
-
id?: string;
|
|
82
|
-
title: string;
|
|
83
|
-
content: any;
|
|
84
|
-
open?: boolean;
|
|
85
|
-
}[];
|
|
86
|
-
multiple?: boolean;
|
|
87
|
-
}): {
|
|
88
|
-
element: HTMLElement;
|
|
89
|
-
toggle: (index: number, open?: boolean) => void;
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Generates a button that opens a menu. Arrow keys move through the items, Esc closes it.
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* @param {
|
|
98
|
-
* @param {string} [options.
|
|
99
|
-
* @param {
|
|
100
|
-
* @param {string} [options.
|
|
101
|
-
* @param {
|
|
102
|
-
* @param {
|
|
103
|
-
* @
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* @param {
|
|
132
|
-
* @param {string} [options.
|
|
133
|
-
* @
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Generates tabs. Arrow keys, Home and End move between the tabs.
|
|
3
|
+
*
|
|
4
|
+
* @param {object} options
|
|
5
|
+
* @param {string|Element} [options.parent]
|
|
6
|
+
* @param {string} [options.id]
|
|
7
|
+
* @param {{id: string, label: string, content: *, disabled?: boolean}[]} options.tabs content is text, a Node,
|
|
8
|
+
* an array, or a function called once when the tab is first shown (lazy content)
|
|
9
|
+
* @param {string} [options.active] id of the initially active tab (default: the first)
|
|
10
|
+
* @param {(id: string) => void} [options.onChange]
|
|
11
|
+
* @returns {{element: HTMLElement, select: (id: string) => void, getActive: () => string}}
|
|
12
|
+
*/
|
|
13
|
+
export function generateTabs(options?: {
|
|
14
|
+
parent?: string | Element;
|
|
15
|
+
id?: string;
|
|
16
|
+
tabs: {
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
content: any;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
}[];
|
|
22
|
+
active?: string;
|
|
23
|
+
onChange?: (id: string) => void;
|
|
24
|
+
}): {
|
|
25
|
+
element: HTMLElement;
|
|
26
|
+
select: (id: string) => void;
|
|
27
|
+
getActive: () => string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Generates breadcrumbs. The last item is the current page.
|
|
31
|
+
*
|
|
32
|
+
* @param {object} options
|
|
33
|
+
* @param {string|Element} [options.parent]
|
|
34
|
+
* @param {{label: string, href?: string, onclick?: Function}[]} options.items
|
|
35
|
+
*/
|
|
36
|
+
export function generateBreadcrumbs(options?: {
|
|
37
|
+
parent?: string | Element;
|
|
38
|
+
items: {
|
|
39
|
+
label: string;
|
|
40
|
+
href?: string;
|
|
41
|
+
onclick?: Function;
|
|
42
|
+
}[];
|
|
43
|
+
}): any;
|
|
44
|
+
/**
|
|
45
|
+
* Generates a page selector.
|
|
46
|
+
*
|
|
47
|
+
* @param {object} options
|
|
48
|
+
* @param {string|Element} [options.parent]
|
|
49
|
+
* @param {number} options.total number of items
|
|
50
|
+
* @param {number} [options.pageSize=10]
|
|
51
|
+
* @param {number} [options.page=1]
|
|
52
|
+
* @param {number} [options.siblings=1] page buttons shown next to the current page
|
|
53
|
+
* @param {(page: number) => void} [options.onChange]
|
|
54
|
+
* @returns {{element: HTMLElement, setPage: Function, setTotal: Function, getPage: Function}}
|
|
55
|
+
*/
|
|
56
|
+
export function generatePagination(options?: {
|
|
57
|
+
parent?: string | Element;
|
|
58
|
+
total: number;
|
|
59
|
+
pageSize?: number;
|
|
60
|
+
page?: number;
|
|
61
|
+
siblings?: number;
|
|
62
|
+
onChange?: (page: number) => void;
|
|
63
|
+
}): {
|
|
64
|
+
element: HTMLElement;
|
|
65
|
+
setPage: Function;
|
|
66
|
+
setTotal: Function;
|
|
67
|
+
getPage: Function;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Generates collapsible panels.
|
|
71
|
+
*
|
|
72
|
+
* @param {object} options
|
|
73
|
+
* @param {string|Element} [options.parent]
|
|
74
|
+
* @param {{id?: string, title: string, content: *, open?: boolean}[]} options.items
|
|
75
|
+
* @param {boolean} [options.multiple=false] allow several panels to be open at once
|
|
76
|
+
* @returns {{element: HTMLElement, toggle: (index: number, open?: boolean) => void}}
|
|
77
|
+
*/
|
|
78
|
+
export function generateAccordion(options?: {
|
|
79
|
+
parent?: string | Element;
|
|
80
|
+
items: {
|
|
81
|
+
id?: string;
|
|
82
|
+
title: string;
|
|
83
|
+
content: any;
|
|
84
|
+
open?: boolean;
|
|
85
|
+
}[];
|
|
86
|
+
multiple?: boolean;
|
|
87
|
+
}): {
|
|
88
|
+
element: HTMLElement;
|
|
89
|
+
toggle: (index: number, open?: boolean) => void;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Generates a button that opens a menu. Arrow keys move through the items, Esc closes it, and so does a click outside.
|
|
93
|
+
* The menu is a native popover (the `popover` attribute): it is drawn above everything, so no parent can cut it off, and the browser takes care of the
|
|
94
|
+
* light dismiss and of the focus. It is placed next to the button, below it, or above it when there is no room below. Browsers without the popover API
|
|
95
|
+
* get a plain menu that is shown and hidden with `hidden`.
|
|
96
|
+
*
|
|
97
|
+
* @param {object} options
|
|
98
|
+
* @param {string|Element} [options.parent]
|
|
99
|
+
* @param {string} [options.label] button text (leave it out for an icon-only button, and give `ariaLabel`)
|
|
100
|
+
* @param {string|Node} [options.icon] shown before the label, text or a Node (e.g. an SVG); hidden from screen readers
|
|
101
|
+
* @param {string} [options.ariaLabel] accessible name, needed when there is no label
|
|
102
|
+
* @param {boolean} [options.caret=false] show a small arrow after the label
|
|
103
|
+
* @param {string} [options.toggleClass] extra CSS class(es) of the toggle button
|
|
104
|
+
* @param {{label?: string, onclick?: Function, href?: string, disabled?: boolean, divider?: boolean}[]} options.items
|
|
105
|
+
* @param {"left"|"right"} [options.align="left"]
|
|
106
|
+
* @returns {{element: HTMLElement, open: Function, close: Function}}
|
|
107
|
+
*/
|
|
108
|
+
export function generateDropdown(options?: {
|
|
109
|
+
parent?: string | Element;
|
|
110
|
+
label?: string;
|
|
111
|
+
icon?: string | Node;
|
|
112
|
+
ariaLabel?: string;
|
|
113
|
+
caret?: boolean;
|
|
114
|
+
toggleClass?: string;
|
|
115
|
+
items: {
|
|
116
|
+
label?: string;
|
|
117
|
+
onclick?: Function;
|
|
118
|
+
href?: string;
|
|
119
|
+
disabled?: boolean;
|
|
120
|
+
divider?: boolean;
|
|
121
|
+
}[];
|
|
122
|
+
align?: "left" | "right";
|
|
123
|
+
}): {
|
|
124
|
+
element: HTMLElement;
|
|
125
|
+
open: Function;
|
|
126
|
+
close: Function;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Generates a vertical navigation with nested items. On small screens it collapses behind a toggle button.
|
|
130
|
+
*
|
|
131
|
+
* @param {object} options
|
|
132
|
+
* @param {string|Element} [options.parent]
|
|
133
|
+
* @param {{id: string, label: string, icon?: string, href?: string, children?: object[]}[]} options.items
|
|
134
|
+
* @param {(item: object) => void} [options.onSelect]
|
|
135
|
+
* @param {string} [options.active] id of the initially selected item
|
|
136
|
+
* @returns {{element: HTMLElement, select: (id: string) => void, toggle: Function}}
|
|
137
|
+
*/
|
|
138
|
+
export function generateSidebar(options?: {
|
|
139
|
+
parent?: string | Element;
|
|
140
|
+
items: {
|
|
141
|
+
id: string;
|
|
142
|
+
label: string;
|
|
143
|
+
icon?: string;
|
|
144
|
+
href?: string;
|
|
145
|
+
children?: object[];
|
|
146
|
+
}[];
|
|
147
|
+
onSelect?: (item: object) => void;
|
|
148
|
+
active?: string;
|
|
149
|
+
}): {
|
|
150
|
+
element: HTMLElement;
|
|
151
|
+
select: (id: string) => void;
|
|
152
|
+
toggle: Function;
|
|
153
|
+
};
|