aeico-components 0.1.4 → 0.1.5
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/dist/chunks/aeico-field.cjs.map +1 -1
- package/dist/chunks/aeico-field.js.map +1 -1
- package/dist/chunks/button.cjs +11 -14
- package/dist/chunks/button.cjs.map +1 -1
- package/dist/chunks/button.js +11 -14
- package/dist/chunks/button.js.map +1 -1
- package/dist/chunks/checkbox.cjs.map +1 -1
- package/dist/chunks/checkbox.js.map +1 -1
- package/dist/chunks/dropdown-button.js +3 -3
- package/dist/chunks/navbar.cjs +1 -2
- package/dist/chunks/navbar.cjs.map +1 -1
- package/dist/chunks/navbar.js +1 -2
- package/dist/chunks/navbar.js.map +1 -1
- package/dist/chunks/radio.cjs.map +1 -1
- package/dist/chunks/radio.js.map +1 -1
- package/dist/chunks/select.cjs.map +1 -1
- package/dist/chunks/select.js.map +1 -1
- package/dist/chunks/switch.cjs.map +1 -1
- package/dist/chunks/switch.js.map +1 -1
- package/dist/chunks/tab-panel.cjs +3 -4
- package/dist/chunks/tab-panel.cjs.map +1 -1
- package/dist/chunks/tab-panel.js +3 -4
- package/dist/chunks/tab-panel.js.map +1 -1
- package/dist/dropdown.js +4 -4
- package/dist/index.cjs +99 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +103 -4
- package/dist/index.js.map +1 -1
- package/dist/types/aeico-field.d.ts +5 -5
- package/dist/types/button/button.d.ts +2 -1
- package/dist/types/checkbox/checkbox.d.ts +5 -5
- package/dist/types/index.d.ts +2 -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 +1 -1
- package/dist/types/switch/switch.d.ts +5 -5
- package/package.json +3 -3
- package/src/aeico-field.ts +12 -8
- package/src/button/button.ts +11 -13
- package/src/checkbox/checkbox.ts +4 -4
- package/src/index.ts +2 -0
- package/src/navbar/navbar.ts +1 -3
- 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 +1 -1
- package/src/select/select.ts +1 -1
- package/src/styles/components/progress-bar.css +44 -0
- package/src/switch/switch.ts +4 -4
- package/src/tabs/tab.ts +1 -1
- package/src/tabs/tabs.ts +1 -2
package/src/checkbox/checkbox.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import AeicoField from '../aeico-field';
|
|
1
|
+
import AeicoField, { type FieldAction } from '../aeico-field';
|
|
2
2
|
import type { InferProps, Props } from 'aeico';
|
|
3
3
|
import { html } from 'aeico';
|
|
4
4
|
import styleVariables from '../styles/variables.css?inline';
|
|
@@ -7,7 +7,7 @@ import colorCSS from '../styles/color.css?inline';
|
|
|
7
7
|
import styles from '../styles/components/checkbox.css?inline';
|
|
8
8
|
import { CheckboxVariant } from './defines';
|
|
9
9
|
|
|
10
|
-
class Checkbox extends AeicoField {
|
|
10
|
+
class Checkbox extends AeicoField<boolean> {
|
|
11
11
|
protected fieldElement: HTMLInputElement | null = null;
|
|
12
12
|
|
|
13
13
|
static tagName = 'checkbox';
|
|
@@ -34,11 +34,11 @@ class Checkbox extends AeicoField {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
protected getEventPayload(checked: boolean, oldChecked: boolean, action:
|
|
37
|
+
protected getEventPayload(checked: boolean, oldChecked: boolean, action: FieldAction) {
|
|
38
38
|
return { checked, oldChecked, action };
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
protected setValue(checked: boolean, options?: { silent?: boolean; action?:
|
|
41
|
+
protected setValue(checked: boolean, options?: { silent?: boolean; action?: FieldAction }): void {
|
|
42
42
|
const oldChecked = this.getValue();
|
|
43
43
|
this.checked = checked;
|
|
44
44
|
this.writeValue(checked);
|
package/src/index.ts
CHANGED
|
@@ -57,6 +57,7 @@ export { default as Divider } from './divider';
|
|
|
57
57
|
export { default as Card } from './card';
|
|
58
58
|
export { default as Navbar } from './navbar';
|
|
59
59
|
export { default as Detail } from './detail';
|
|
60
|
+
export { default as ProgressBar } from './progress-bar';
|
|
60
61
|
|
|
61
62
|
// Component types
|
|
62
63
|
export type { SelectProps, SelectOption, SelectOptions, SelectOptionValue } from './select';
|
|
@@ -78,6 +79,7 @@ export type { BadgeProps, BadgeColor, BadgeSize, BadgeVariant } from './badge';
|
|
|
78
79
|
export type { TagProps, TagColor, TagSize, TagVariant } from './tag';
|
|
79
80
|
export type { DialogProps } from './dialog';
|
|
80
81
|
export type { IconProps, IconSize, IconColor, IconDefinition, IconRegistryData } from './icon';
|
|
82
|
+
export type { ProgressBarProps, ProgressBarColor } from './progress-bar';
|
|
81
83
|
export type { IconButtonProps, IconButtonVariant, IconButtonSize } from './icon-button';
|
|
82
84
|
export type { DividerProps } from './divider';
|
|
83
85
|
export type { CardProps, CardVariant, CardColor } from './card';
|
package/src/navbar/navbar.ts
CHANGED
|
@@ -74,8 +74,6 @@ class Navbar extends AeicoComponent {
|
|
|
74
74
|
|
|
75
75
|
connectedCallback() {
|
|
76
76
|
super.connectedCallback();
|
|
77
|
-
// Close menu when a nav link is clicked on mobile
|
|
78
|
-
this.listen('click', this._handleInnerClick);
|
|
79
77
|
// Close menu when clicking outside the navbar
|
|
80
78
|
this._outsideClickHandler = (e: MouseEvent) => {
|
|
81
79
|
// Event retargeting in shadow DOM means e.target is the host element
|
|
@@ -119,7 +117,7 @@ class Navbar extends AeicoComponent {
|
|
|
119
117
|
|
|
120
118
|
protected render() {
|
|
121
119
|
return html(({ div, nav, button, span, slot }) => {
|
|
122
|
-
div({ class: 'inner' }, () => {
|
|
120
|
+
div({ class: 'inner', '@click': this._handleInnerClick }, () => {
|
|
123
121
|
div({ part: 'brand' }, () => {
|
|
124
122
|
slot({ name: 'brand' });
|
|
125
123
|
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { InferProps } from 'aeico';
|
|
2
|
+
import { html, prop } from 'aeico';
|
|
3
|
+
import AeicoComponent from '../aeico-component';
|
|
4
|
+
import styleVariables from '../styles/variables.css?inline';
|
|
5
|
+
import colorCSS from '../styles/color.css?inline';
|
|
6
|
+
import style from '../styles/components/progress-bar.css?inline';
|
|
7
|
+
import type { ProgressBarColor } from './defines';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Progress bars show how far along an ongoing operation is as a horizontal fill.
|
|
11
|
+
* Use them for file uploads, multi-step flows, or any task with measurable progress.
|
|
12
|
+
*
|
|
13
|
+
* @prop {number} value - Completion percentage, automatically clamped to 0–100.
|
|
14
|
+
* @prop {string} label - Accessible label applied as `aria-label` on the track.
|
|
15
|
+
* @prop {'default'|'primary'|'secondary'|'success'|'danger'|'warning'|'info'} color
|
|
16
|
+
* - Preset color variant driven by the shared color system.
|
|
17
|
+
* @prop {boolean} animated - When set, overlays a shimmer sweep animation on the bar.
|
|
18
|
+
*
|
|
19
|
+
* @csspart base - The outermost wrapper `<div>`.
|
|
20
|
+
* @csspart track - The background track `<div>`.
|
|
21
|
+
* @csspart bar - The filled progress `<span>`.
|
|
22
|
+
*
|
|
23
|
+
* @cssproperty [--progress-height=8px] - Height of both the track and the bar.
|
|
24
|
+
* @cssproperty [--progress-bar-color=var(--color-solid)] - Fill color of the bar.
|
|
25
|
+
* When set, takes precedence over the `color` prop entirely.
|
|
26
|
+
*/
|
|
27
|
+
class ProgressBar extends AeicoComponent {
|
|
28
|
+
static tagName = 'progress-bar';
|
|
29
|
+
protected static styles = [styleVariables, colorCSS, style];
|
|
30
|
+
|
|
31
|
+
@prop({ type: Number })
|
|
32
|
+
accessor value: number = 0;
|
|
33
|
+
|
|
34
|
+
@prop({ type: String })
|
|
35
|
+
accessor label: string = '';
|
|
36
|
+
|
|
37
|
+
@prop({ type: String })
|
|
38
|
+
accessor color: ProgressBarColor = 'primary';
|
|
39
|
+
|
|
40
|
+
@prop({ type: Boolean })
|
|
41
|
+
accessor animated: boolean = false;
|
|
42
|
+
|
|
43
|
+
protected render() {
|
|
44
|
+
const clamped = Math.min(100, Math.max(0, this.value));
|
|
45
|
+
|
|
46
|
+
return html(({ div, span }) => {
|
|
47
|
+
div({ part: 'base' }, () => {
|
|
48
|
+
div(
|
|
49
|
+
{
|
|
50
|
+
part: 'track',
|
|
51
|
+
className: 'progress-track',
|
|
52
|
+
role: 'progressbar',
|
|
53
|
+
'aria-valuenow': String(clamped),
|
|
54
|
+
'aria-valuemin': '0',
|
|
55
|
+
'aria-valuemax': '100',
|
|
56
|
+
...(this.label ? { 'aria-label': this.label } : {}),
|
|
57
|
+
},
|
|
58
|
+
() => {
|
|
59
|
+
span({
|
|
60
|
+
part: 'bar',
|
|
61
|
+
className: 'progress-bar',
|
|
62
|
+
style: { width: `${clamped}%` },
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
ProgressBar.register();
|
|
72
|
+
|
|
73
|
+
declare global {
|
|
74
|
+
interface HTMLElementTagNameMap {
|
|
75
|
+
'ae-progress-bar': ProgressBar;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default ProgressBar;
|
|
80
|
+
export type ProgressBarProps = InferProps<typeof ProgressBar>;
|
|
@@ -117,7 +117,7 @@ class RadioGroup extends AeicoField {
|
|
|
117
117
|
return this.value ?? '';
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
protected writeValue(_value:
|
|
120
|
+
protected writeValue(_value: string): void {
|
|
121
121
|
// All visual state is driven by builder diff on next render;
|
|
122
122
|
// for native radio inputs we need to sync checked immediately.
|
|
123
123
|
// The render() reads this.value, so update handles the rest.
|
package/src/select/select.ts
CHANGED
|
@@ -107,7 +107,7 @@ class Select extends AeicoField<SelectOptionValue | SelectMultiValue> {
|
|
|
107
107
|
// Reactive re-render via this.value prop change handles the display update
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
protected getValue():
|
|
110
|
+
protected getValue(): SelectOptionValue | SelectMultiValue {
|
|
111
111
|
if (this.multiple) return this._getMultiValues();
|
|
112
112
|
|
|
113
113
|
return this.value || '';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
--progress-height: 8px;
|
|
4
|
+
--color-solid: var(--color-primary);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.progress-track {
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: var(--progress-height);
|
|
10
|
+
background: var(--border-subtle);
|
|
11
|
+
border-radius: calc(var(--progress-height) / 2);
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.progress-bar {
|
|
16
|
+
display: block;
|
|
17
|
+
height: 100%;
|
|
18
|
+
border-radius: inherit;
|
|
19
|
+
background: var(--progress-bar-color, var(--color-solid));
|
|
20
|
+
width: 0%;
|
|
21
|
+
transition: width 0.35s ease;
|
|
22
|
+
position: relative;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* animated: shimmer sweep on top of the solid fill */
|
|
26
|
+
:host([animated]) .progress-bar::after {
|
|
27
|
+
content: '';
|
|
28
|
+
position: absolute;
|
|
29
|
+
inset: 0;
|
|
30
|
+
border-radius: inherit;
|
|
31
|
+
background: linear-gradient(
|
|
32
|
+
90deg,
|
|
33
|
+
transparent 0%,
|
|
34
|
+
rgba(255, 255, 255, 0.35) 50%,
|
|
35
|
+
transparent 100%
|
|
36
|
+
);
|
|
37
|
+
background-size: 200% 100%;
|
|
38
|
+
animation: progress-shimmer 1.4s linear infinite;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@keyframes progress-shimmer {
|
|
42
|
+
0% { background-position: 200% 0; }
|
|
43
|
+
100% { background-position: -200% 0; }
|
|
44
|
+
}
|
package/src/switch/switch.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import AeicoField from '../aeico-field';
|
|
1
|
+
import AeicoField, { type FieldAction } from '../aeico-field';
|
|
2
2
|
import type { InferProps, Props } from 'aeico';
|
|
3
3
|
import { html } from 'aeico';
|
|
4
4
|
import styleVariables from '../styles/variables.css?inline';
|
|
@@ -6,7 +6,7 @@ import sizeCSS from '../styles/size.css?inline';
|
|
|
6
6
|
import colorCSS from '../styles/color.css?inline';
|
|
7
7
|
import styles from '../styles/components/switch.css?inline';
|
|
8
8
|
|
|
9
|
-
class Switch extends AeicoField {
|
|
9
|
+
class Switch extends AeicoField<boolean> {
|
|
10
10
|
protected fieldElement: HTMLInputElement | null = null;
|
|
11
11
|
|
|
12
12
|
static tagName = 'switch';
|
|
@@ -31,11 +31,11 @@ class Switch extends AeicoField {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
protected getEventPayload(checked: boolean, oldChecked: boolean, action:
|
|
34
|
+
protected getEventPayload(checked: boolean, oldChecked: boolean, action: FieldAction) {
|
|
35
35
|
return { checked, oldChecked, action };
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
protected setValue(checked: boolean, options?: { silent?: boolean; action?:
|
|
38
|
+
protected setValue(checked: boolean, options?: { silent?: boolean; action?: FieldAction }): void {
|
|
39
39
|
const oldChecked = this.getValue();
|
|
40
40
|
this.checked = checked;
|
|
41
41
|
this.writeValue(checked);
|
package/src/tabs/tab.ts
CHANGED
|
@@ -19,7 +19,6 @@ class Tab extends AeicoComponent {
|
|
|
19
19
|
connectedCallback() {
|
|
20
20
|
this.setAttribute('slot', 'tab');
|
|
21
21
|
super.connectedCallback();
|
|
22
|
-
this.listen('click', this._handleClick);
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
private _handleClick = () => {
|
|
@@ -42,6 +41,7 @@ class Tab extends AeicoComponent {
|
|
|
42
41
|
'aria-selected': this.active,
|
|
43
42
|
'aria-disabled': this.disabled,
|
|
44
43
|
disabled: this.disabled,
|
|
44
|
+
'@click': this._handleClick,
|
|
45
45
|
},
|
|
46
46
|
() => {
|
|
47
47
|
slot();
|
package/src/tabs/tabs.ts
CHANGED
|
@@ -66,7 +66,6 @@ class Tabs extends AeicoComponent {
|
|
|
66
66
|
|
|
67
67
|
connectedCallback() {
|
|
68
68
|
super.connectedCallback();
|
|
69
|
-
this.listen('_tab-click', this._handleTabClick);
|
|
70
69
|
this._observer = new MutationObserver(() => this.update());
|
|
71
70
|
this._observer.observe(this, { childList: true });
|
|
72
71
|
}
|
|
@@ -113,7 +112,7 @@ class Tabs extends AeicoComponent {
|
|
|
113
112
|
|
|
114
113
|
protected render() {
|
|
115
114
|
return html(({ nav, div, slot }) => {
|
|
116
|
-
nav({ part: 'tab-nav', role: 'tablist' }, () => {
|
|
115
|
+
nav({ part: 'tab-nav', role: 'tablist', '@_tab-click': this._handleTabClick }, () => {
|
|
117
116
|
slot({ name: 'tab' });
|
|
118
117
|
});
|
|
119
118
|
div({ part: 'panels' }, () => {
|