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/dist/index.cjs
CHANGED
|
@@ -21,6 +21,104 @@ const divider = require("./chunks/divider.cjs");
|
|
|
21
21
|
const card = require("./chunks/card.cjs");
|
|
22
22
|
const navbar = require("./chunks/navbar.cjs");
|
|
23
23
|
const detail = require("./chunks/detail.cjs");
|
|
24
|
+
const aeico = require("aeico");
|
|
25
|
+
const aeicoComponent = require("./chunks/aeico-component.cjs");
|
|
26
|
+
const variables = require("./chunks/variables.cjs");
|
|
27
|
+
const color = require("./chunks/color.cjs");
|
|
28
|
+
const style = ":host {\n display: block;\n --progress-height: 8px;\n --color-solid: var(--color-primary);\n}\n\n.progress-track {\n width: 100%;\n height: var(--progress-height);\n background: var(--border-subtle);\n border-radius: calc(var(--progress-height) / 2);\n overflow: hidden;\n}\n\n.progress-bar {\n display: block;\n height: 100%;\n border-radius: inherit;\n background: var(--progress-bar-color, var(--color-solid));\n width: 0%;\n transition: width 0.35s ease;\n position: relative;\n}\n\n/* animated: shimmer sweep on top of the solid fill */\n:host([animated]) .progress-bar::after {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: inherit;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.35) 50%,\n transparent 100%\n );\n background-size: 200% 100%;\n animation: progress-shimmer 1.4s linear infinite;\n}\n\n@keyframes progress-shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}\n";
|
|
29
|
+
var __create = Object.create;
|
|
30
|
+
var __defProp = Object.defineProperty;
|
|
31
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
32
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
33
|
+
var __typeError = (msg) => {
|
|
34
|
+
throw TypeError(msg);
|
|
35
|
+
};
|
|
36
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
37
|
+
var __decoratorStart = (base) => [, , , __create((base == null ? void 0 : base[__knownSymbol("metadata")]) ?? null)];
|
|
38
|
+
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
39
|
+
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
|
40
|
+
var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
|
|
41
|
+
var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
|
|
42
|
+
var __runInitializers = (array, flags, self, value) => {
|
|
43
|
+
for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
|
|
44
|
+
return value;
|
|
45
|
+
};
|
|
46
|
+
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
47
|
+
var fn, it, done, ctx, access, k = flags & 7, s = false, p = false;
|
|
48
|
+
var j = array.length + 1, key = __decoratorStrings[k + 5];
|
|
49
|
+
var initializers = array[j - 1] = [], extraInitializers = array[j] || (array[j] = []);
|
|
50
|
+
var desc = (target = target.prototype, __getOwnPropDesc({ get [name]() {
|
|
51
|
+
return __privateGet(this, extra);
|
|
52
|
+
}, set [name](x) {
|
|
53
|
+
return __privateSet(this, extra, x);
|
|
54
|
+
} }, name));
|
|
55
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
56
|
+
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
|
57
|
+
{
|
|
58
|
+
ctx.static = s, ctx.private = p, access = ctx.access = { has: (x) => name in x };
|
|
59
|
+
access.get = (x) => x[name];
|
|
60
|
+
access.set = (x, y) => x[name] = y;
|
|
61
|
+
}
|
|
62
|
+
it = (0, decorators[i])({ get: desc.get, set: desc.set }, ctx), done._ = 1;
|
|
63
|
+
if (it === void 0) __expectFn(it) && (desc[key] = it);
|
|
64
|
+
else if (typeof it !== "object" || it === null) __typeError("Object expected");
|
|
65
|
+
else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
|
|
66
|
+
}
|
|
67
|
+
return desc && __defProp(target, name, desc), target;
|
|
68
|
+
};
|
|
69
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
70
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
71
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), member.get(obj));
|
|
72
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
73
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
74
|
+
var _animated_dec, _color_dec, _label_dec, _value_dec, _a, _init, _value, _label, _color, _animated;
|
|
75
|
+
class ProgressBar extends (_a = aeicoComponent.AeicoComponent, _value_dec = [aeico.prop({ type: Number })], _label_dec = [aeico.prop({ type: String })], _color_dec = [aeico.prop({ type: String })], _animated_dec = [aeico.prop({ type: Boolean })], _a) {
|
|
76
|
+
constructor() {
|
|
77
|
+
super(...arguments);
|
|
78
|
+
__privateAdd(this, _value, __runInitializers(_init, 8, this, 0)), __runInitializers(_init, 11, this);
|
|
79
|
+
__privateAdd(this, _label, __runInitializers(_init, 12, this, "")), __runInitializers(_init, 15, this);
|
|
80
|
+
__privateAdd(this, _color, __runInitializers(_init, 16, this, "primary")), __runInitializers(_init, 19, this);
|
|
81
|
+
__privateAdd(this, _animated, __runInitializers(_init, 20, this, false)), __runInitializers(_init, 23, this);
|
|
82
|
+
}
|
|
83
|
+
render() {
|
|
84
|
+
const clamped = Math.min(100, Math.max(0, this.value));
|
|
85
|
+
return aeico.html(({ div, span }) => {
|
|
86
|
+
div({ part: "base" }, () => {
|
|
87
|
+
div(
|
|
88
|
+
{
|
|
89
|
+
part: "track",
|
|
90
|
+
className: "progress-track",
|
|
91
|
+
role: "progressbar",
|
|
92
|
+
"aria-valuenow": String(clamped),
|
|
93
|
+
"aria-valuemin": "0",
|
|
94
|
+
"aria-valuemax": "100",
|
|
95
|
+
...this.label ? { "aria-label": this.label } : {}
|
|
96
|
+
},
|
|
97
|
+
() => {
|
|
98
|
+
span({
|
|
99
|
+
part: "bar",
|
|
100
|
+
className: "progress-bar",
|
|
101
|
+
style: { width: `${clamped}%` }
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
_init = __decoratorStart(_a);
|
|
110
|
+
_value = /* @__PURE__ */ new WeakMap();
|
|
111
|
+
_label = /* @__PURE__ */ new WeakMap();
|
|
112
|
+
_color = /* @__PURE__ */ new WeakMap();
|
|
113
|
+
_animated = /* @__PURE__ */ new WeakMap();
|
|
114
|
+
__decorateElement(_init, 4, "value", _value_dec, ProgressBar, _value);
|
|
115
|
+
__decorateElement(_init, 4, "label", _label_dec, ProgressBar, _label);
|
|
116
|
+
__decorateElement(_init, 4, "color", _color_dec, ProgressBar, _color);
|
|
117
|
+
__decorateElement(_init, 4, "animated", _animated_dec, ProgressBar, _animated);
|
|
118
|
+
__decoratorMetadata(_init, ProgressBar);
|
|
119
|
+
__publicField(ProgressBar, "tagName", "progress-bar");
|
|
120
|
+
__publicField(ProgressBar, "styles", [variables.styleVariables, color.colorCSS, style]);
|
|
121
|
+
ProgressBar.register();
|
|
24
122
|
exports.TextInput = textInput.TextInput;
|
|
25
123
|
exports.Select = select.Select;
|
|
26
124
|
exports.Slider = slider.Slider;
|
|
@@ -49,4 +147,5 @@ exports.Divider = divider.Divider;
|
|
|
49
147
|
exports.Card = card.Card;
|
|
50
148
|
exports.Navbar = navbar.Navbar;
|
|
51
149
|
exports.Detail = detail.Detail;
|
|
150
|
+
exports.ProgressBar = ProgressBar;
|
|
52
151
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/progress-bar/progress-bar.ts"],"sourcesContent":["import type { InferProps } from 'aeico';\nimport { html, prop } from 'aeico';\nimport AeicoComponent from '../aeico-component';\nimport styleVariables from '../styles/variables.css?inline';\nimport colorCSS from '../styles/color.css?inline';\nimport style from '../styles/components/progress-bar.css?inline';\nimport type { ProgressBarColor } from './defines';\n\n/**\n * Progress bars show how far along an ongoing operation is as a horizontal fill.\n * Use them for file uploads, multi-step flows, or any task with measurable progress.\n *\n * @prop {number} value - Completion percentage, automatically clamped to 0–100.\n * @prop {string} label - Accessible label applied as `aria-label` on the track.\n * @prop {'default'|'primary'|'secondary'|'success'|'danger'|'warning'|'info'} color\n * - Preset color variant driven by the shared color system.\n * @prop {boolean} animated - When set, overlays a shimmer sweep animation on the bar.\n *\n * @csspart base - The outermost wrapper `<div>`.\n * @csspart track - The background track `<div>`.\n * @csspart bar - The filled progress `<span>`.\n *\n * @cssproperty [--progress-height=8px] - Height of both the track and the bar.\n * @cssproperty [--progress-bar-color=var(--color-solid)] - Fill color of the bar.\n * When set, takes precedence over the `color` prop entirely.\n */\nclass ProgressBar extends AeicoComponent {\n static tagName = 'progress-bar';\n protected static styles = [styleVariables, colorCSS, style];\n\n @prop({ type: Number })\n accessor value: number = 0;\n\n @prop({ type: String })\n accessor label: string = '';\n\n @prop({ type: String })\n accessor color: ProgressBarColor = 'primary';\n\n @prop({ type: Boolean })\n accessor animated: boolean = false;\n\n protected render() {\n const clamped = Math.min(100, Math.max(0, this.value));\n\n return html(({ div, span }) => {\n div({ part: 'base' }, () => {\n div(\n {\n part: 'track',\n className: 'progress-track',\n role: 'progressbar',\n 'aria-valuenow': String(clamped),\n 'aria-valuemin': '0',\n 'aria-valuemax': '100',\n ...(this.label ? { 'aria-label': this.label } : {}),\n },\n () => {\n span({\n part: 'bar',\n className: 'progress-bar',\n style: { width: `${clamped}%` },\n });\n },\n );\n });\n });\n }\n}\n\nProgressBar.register();\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ae-progress-bar': ProgressBar;\n }\n}\n\nexport default ProgressBar;\nexport type ProgressBarProps = InferProps<typeof ProgressBar>;\n"],"names":["AeicoComponent","prop","html","styleVariables","colorCSS"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,eAAA,YAAA,YAAA,YAAA,IAAA,OAAA,QAAA,QAAA,QAAA;AA0BA,MAAM,qBAAoB,KAAAA,eAAAA,gBAIxB,aAAA,CAACC,MAAAA,KAAK,EAAE,MAAM,OAAA,CAAQ,CAAA,GAGtB,aAAA,CAACA,MAAAA,KAAK,EAAE,MAAM,OAAA,CAAQ,CAAA,GAGtB,aAAA,CAACA,MAAAA,KAAK,EAAE,MAAM,OAAA,CAAQ,CAAA,GAGtB,gBAAA,CAACA,MAAAA,KAAK,EAAE,MAAM,QAAA,CAAS,IAbC,IAAe;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA;AAKE,iBAAA,MAAS,QAAgB,kBAAzB,OAAA,GAAA,MAAyB,CAAA,CAAA,GAAzB,kBAAA,OAAA,IAAA,IAAA;AAGA,iBAAA,MAAS,QAAgB,kBAAzB,OAAA,IAAA,MAAyB,EAAA,CAAA,GAAzB,kBAAA,OAAA,IAAA,IAAA;AAGA,iBAAA,MAAS,QAA0B,kBAAnC,OAAA,IAAA,MAAmC,SAAA,CAAA,GAAnC,kBAAA,OAAA,IAAA,IAAA;AAGA,iBAAA,MAAS,WAAoB,kBAA7B,OAAA,IAAA,MAA6B,KAAA,CAAA,GAA7B,kBAAA,OAAA,IAAA,IAAA;AAAA,EAAA;AAAA,EAEU,SAAS;AACjB,UAAM,UAAU,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,KAAK,KAAK,CAAC;AAErD,WAAOC,WAAK,CAAC,EAAE,KAAK,WAAW;AAC7B,UAAI,EAAE,MAAM,OAAA,GAAU,MAAM;AAC1B;AAAA,UACE;AAAA,YACE,MAAM;AAAA,YACN,WAAW;AAAA,YACX,MAAM;AAAA,YACN,iBAAiB,OAAO,OAAO;AAAA,YAC/B,iBAAiB;AAAA,YACjB,iBAAiB;AAAA,YACjB,GAAI,KAAK,QAAQ,EAAE,cAAc,KAAK,MAAA,IAAU,CAAA;AAAA,UAAC;AAAA,UAEnD,MAAM;AACJ,iBAAK;AAAA,cACH,MAAM;AAAA,cACN,WAAW;AAAA,cACX,OAAO,EAAE,OAAO,GAAG,OAAO,IAAA;AAAA,YAAI,CAC/B;AAAA,UACH;AAAA,QAAA;AAAA,MAEJ,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;AA1CA,QAAA,iBAAA,EAAA;AAKW,SAAA,oBAAA,QAAA;AAGA,SAAA,oBAAA,QAAA;AAGA,SAAA,oBAAA,QAAA;AAGA,YAAA,oBAAA,QAAA;AATT,kBAAA,OAAA,GAAS,SADT,YAJI,aAKK,MAAA;AAGT,kBAAA,OAAA,GAAS,SADT,YAPI,aAQK,MAAA;AAGT,kBAAA,OAAA,GAAS,SADT,YAVI,aAWK,MAAA;AAGT,kBAAA,OAAA,GAAS,YADT,eAbI,aAcK,SAAA;AAdX,oBAAA,OAAM,WAAA;AACJ,cADI,aACG,WAAU,cAAA;AACjB,cAFI,aAEa,UAAS,CAACC,UAAAA,gBAAgBC,MAAAA,UAAU,KAAK,CAAA;AA0C5D,YAAY,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { R, a } from "./chunks/radio.js";
|
|
|
6
6
|
import { S as S3 } from "./chunks/switch.js";
|
|
7
7
|
import { B, a as a2 } from "./chunks/breadcrumb-item.js";
|
|
8
8
|
import { B as B2 } from "./chunks/button.js";
|
|
9
|
-
import { D, a as a3
|
|
9
|
+
import { b, D, a as a3 } from "./chunks/dropdown-button.js";
|
|
10
10
|
import { B as B3 } from "./chunks/button-group.js";
|
|
11
11
|
import { B as B4 } from "./chunks/badge.js";
|
|
12
12
|
import { T as T2 } from "./chunks/tag.js";
|
|
@@ -19,6 +19,104 @@ import { D as D3 } from "./chunks/divider.js";
|
|
|
19
19
|
import { C as C2 } from "./chunks/card.js";
|
|
20
20
|
import { N } from "./chunks/navbar.js";
|
|
21
21
|
import { D as D4 } from "./chunks/detail.js";
|
|
22
|
+
import { prop, html } from "aeico";
|
|
23
|
+
import { A as AeicoComponent } from "./chunks/aeico-component.js";
|
|
24
|
+
import { s as styleVariables } from "./chunks/variables.js";
|
|
25
|
+
import { c as colorCSS } from "./chunks/color.js";
|
|
26
|
+
const style = ":host {\n display: block;\n --progress-height: 8px;\n --color-solid: var(--color-primary);\n}\n\n.progress-track {\n width: 100%;\n height: var(--progress-height);\n background: var(--border-subtle);\n border-radius: calc(var(--progress-height) / 2);\n overflow: hidden;\n}\n\n.progress-bar {\n display: block;\n height: 100%;\n border-radius: inherit;\n background: var(--progress-bar-color, var(--color-solid));\n width: 0%;\n transition: width 0.35s ease;\n position: relative;\n}\n\n/* animated: shimmer sweep on top of the solid fill */\n:host([animated]) .progress-bar::after {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: inherit;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.35) 50%,\n transparent 100%\n );\n background-size: 200% 100%;\n animation: progress-shimmer 1.4s linear infinite;\n}\n\n@keyframes progress-shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}\n";
|
|
27
|
+
var __create = Object.create;
|
|
28
|
+
var __defProp = Object.defineProperty;
|
|
29
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
30
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
31
|
+
var __typeError = (msg) => {
|
|
32
|
+
throw TypeError(msg);
|
|
33
|
+
};
|
|
34
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
35
|
+
var __decoratorStart = (base) => [, , , __create((base == null ? void 0 : base[__knownSymbol("metadata")]) ?? null)];
|
|
36
|
+
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
37
|
+
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
|
38
|
+
var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
|
|
39
|
+
var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
|
|
40
|
+
var __runInitializers = (array, flags, self, value) => {
|
|
41
|
+
for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
|
|
42
|
+
return value;
|
|
43
|
+
};
|
|
44
|
+
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
45
|
+
var fn, it, done, ctx, access, k = flags & 7, s = false, p = false;
|
|
46
|
+
var j = array.length + 1, key = __decoratorStrings[k + 5];
|
|
47
|
+
var initializers = array[j - 1] = [], extraInitializers = array[j] || (array[j] = []);
|
|
48
|
+
var desc = (target = target.prototype, __getOwnPropDesc({ get [name]() {
|
|
49
|
+
return __privateGet(this, extra);
|
|
50
|
+
}, set [name](x) {
|
|
51
|
+
return __privateSet(this, extra, x);
|
|
52
|
+
} }, name));
|
|
53
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
54
|
+
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
|
55
|
+
{
|
|
56
|
+
ctx.static = s, ctx.private = p, access = ctx.access = { has: (x) => name in x };
|
|
57
|
+
access.get = (x) => x[name];
|
|
58
|
+
access.set = (x, y) => x[name] = y;
|
|
59
|
+
}
|
|
60
|
+
it = (0, decorators[i])({ get: desc.get, set: desc.set }, ctx), done._ = 1;
|
|
61
|
+
if (it === void 0) __expectFn(it) && (desc[key] = it);
|
|
62
|
+
else if (typeof it !== "object" || it === null) __typeError("Object expected");
|
|
63
|
+
else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
|
|
64
|
+
}
|
|
65
|
+
return desc && __defProp(target, name, desc), target;
|
|
66
|
+
};
|
|
67
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
68
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
69
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), member.get(obj));
|
|
70
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
71
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
72
|
+
var _animated_dec, _color_dec, _label_dec, _value_dec, _a, _init, _value, _label, _color, _animated;
|
|
73
|
+
class ProgressBar extends (_a = AeicoComponent, _value_dec = [prop({ type: Number })], _label_dec = [prop({ type: String })], _color_dec = [prop({ type: String })], _animated_dec = [prop({ type: Boolean })], _a) {
|
|
74
|
+
constructor() {
|
|
75
|
+
super(...arguments);
|
|
76
|
+
__privateAdd(this, _value, __runInitializers(_init, 8, this, 0)), __runInitializers(_init, 11, this);
|
|
77
|
+
__privateAdd(this, _label, __runInitializers(_init, 12, this, "")), __runInitializers(_init, 15, this);
|
|
78
|
+
__privateAdd(this, _color, __runInitializers(_init, 16, this, "primary")), __runInitializers(_init, 19, this);
|
|
79
|
+
__privateAdd(this, _animated, __runInitializers(_init, 20, this, false)), __runInitializers(_init, 23, this);
|
|
80
|
+
}
|
|
81
|
+
render() {
|
|
82
|
+
const clamped = Math.min(100, Math.max(0, this.value));
|
|
83
|
+
return html(({ div, span }) => {
|
|
84
|
+
div({ part: "base" }, () => {
|
|
85
|
+
div(
|
|
86
|
+
{
|
|
87
|
+
part: "track",
|
|
88
|
+
className: "progress-track",
|
|
89
|
+
role: "progressbar",
|
|
90
|
+
"aria-valuenow": String(clamped),
|
|
91
|
+
"aria-valuemin": "0",
|
|
92
|
+
"aria-valuemax": "100",
|
|
93
|
+
...this.label ? { "aria-label": this.label } : {}
|
|
94
|
+
},
|
|
95
|
+
() => {
|
|
96
|
+
span({
|
|
97
|
+
part: "bar",
|
|
98
|
+
className: "progress-bar",
|
|
99
|
+
style: { width: `${clamped}%` }
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
_init = __decoratorStart(_a);
|
|
108
|
+
_value = /* @__PURE__ */ new WeakMap();
|
|
109
|
+
_label = /* @__PURE__ */ new WeakMap();
|
|
110
|
+
_color = /* @__PURE__ */ new WeakMap();
|
|
111
|
+
_animated = /* @__PURE__ */ new WeakMap();
|
|
112
|
+
__decorateElement(_init, 4, "value", _value_dec, ProgressBar, _value);
|
|
113
|
+
__decorateElement(_init, 4, "label", _label_dec, ProgressBar, _label);
|
|
114
|
+
__decorateElement(_init, 4, "color", _color_dec, ProgressBar, _color);
|
|
115
|
+
__decorateElement(_init, 4, "animated", _animated_dec, ProgressBar, _animated);
|
|
116
|
+
__decoratorMetadata(_init, ProgressBar);
|
|
117
|
+
__publicField(ProgressBar, "tagName", "progress-bar");
|
|
118
|
+
__publicField(ProgressBar, "styles", [styleVariables, colorCSS, style]);
|
|
119
|
+
ProgressBar.register();
|
|
22
120
|
export {
|
|
23
121
|
A as Alert,
|
|
24
122
|
B4 as Badge,
|
|
@@ -31,13 +129,14 @@ export {
|
|
|
31
129
|
D4 as Detail,
|
|
32
130
|
D2 as Dialog,
|
|
33
131
|
D3 as Divider,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
132
|
+
b as Dropdown,
|
|
133
|
+
D as DropdownButton,
|
|
134
|
+
a3 as DropdownItem,
|
|
37
135
|
I as Icon,
|
|
38
136
|
I2 as IconButton,
|
|
39
137
|
a4 as IconRegistry,
|
|
40
138
|
N as Navbar,
|
|
139
|
+
ProgressBar,
|
|
41
140
|
R as Radio,
|
|
42
141
|
a as RadioGroup,
|
|
43
142
|
S as Select,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/progress-bar/progress-bar.ts"],"sourcesContent":["import type { InferProps } from 'aeico';\nimport { html, prop } from 'aeico';\nimport AeicoComponent from '../aeico-component';\nimport styleVariables from '../styles/variables.css?inline';\nimport colorCSS from '../styles/color.css?inline';\nimport style from '../styles/components/progress-bar.css?inline';\nimport type { ProgressBarColor } from './defines';\n\n/**\n * Progress bars show how far along an ongoing operation is as a horizontal fill.\n * Use them for file uploads, multi-step flows, or any task with measurable progress.\n *\n * @prop {number} value - Completion percentage, automatically clamped to 0–100.\n * @prop {string} label - Accessible label applied as `aria-label` on the track.\n * @prop {'default'|'primary'|'secondary'|'success'|'danger'|'warning'|'info'} color\n * - Preset color variant driven by the shared color system.\n * @prop {boolean} animated - When set, overlays a shimmer sweep animation on the bar.\n *\n * @csspart base - The outermost wrapper `<div>`.\n * @csspart track - The background track `<div>`.\n * @csspart bar - The filled progress `<span>`.\n *\n * @cssproperty [--progress-height=8px] - Height of both the track and the bar.\n * @cssproperty [--progress-bar-color=var(--color-solid)] - Fill color of the bar.\n * When set, takes precedence over the `color` prop entirely.\n */\nclass ProgressBar extends AeicoComponent {\n static tagName = 'progress-bar';\n protected static styles = [styleVariables, colorCSS, style];\n\n @prop({ type: Number })\n accessor value: number = 0;\n\n @prop({ type: String })\n accessor label: string = '';\n\n @prop({ type: String })\n accessor color: ProgressBarColor = 'primary';\n\n @prop({ type: Boolean })\n accessor animated: boolean = false;\n\n protected render() {\n const clamped = Math.min(100, Math.max(0, this.value));\n\n return html(({ div, span }) => {\n div({ part: 'base' }, () => {\n div(\n {\n part: 'track',\n className: 'progress-track',\n role: 'progressbar',\n 'aria-valuenow': String(clamped),\n 'aria-valuemin': '0',\n 'aria-valuemax': '100',\n ...(this.label ? { 'aria-label': this.label } : {}),\n },\n () => {\n span({\n part: 'bar',\n className: 'progress-bar',\n style: { width: `${clamped}%` },\n });\n },\n );\n });\n });\n }\n}\n\nProgressBar.register();\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ae-progress-bar': ProgressBar;\n }\n}\n\nexport default ProgressBar;\nexport type ProgressBarProps = InferProps<typeof ProgressBar>;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,eAAA,YAAA,YAAA,YAAA,IAAA,OAAA,QAAA,QAAA,QAAA;AA0BA,MAAM,qBAAoB,KAAA,gBAIxB,aAAA,CAAC,KAAK,EAAE,MAAM,OAAA,CAAQ,CAAA,GAGtB,aAAA,CAAC,KAAK,EAAE,MAAM,OAAA,CAAQ,CAAA,GAGtB,aAAA,CAAC,KAAK,EAAE,MAAM,OAAA,CAAQ,CAAA,GAGtB,gBAAA,CAAC,KAAK,EAAE,MAAM,QAAA,CAAS,IAbC,IAAe;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA;AAKE,iBAAA,MAAS,QAAgB,kBAAzB,OAAA,GAAA,MAAyB,CAAA,CAAA,GAAzB,kBAAA,OAAA,IAAA,IAAA;AAGA,iBAAA,MAAS,QAAgB,kBAAzB,OAAA,IAAA,MAAyB,EAAA,CAAA,GAAzB,kBAAA,OAAA,IAAA,IAAA;AAGA,iBAAA,MAAS,QAA0B,kBAAnC,OAAA,IAAA,MAAmC,SAAA,CAAA,GAAnC,kBAAA,OAAA,IAAA,IAAA;AAGA,iBAAA,MAAS,WAAoB,kBAA7B,OAAA,IAAA,MAA6B,KAAA,CAAA,GAA7B,kBAAA,OAAA,IAAA,IAAA;AAAA,EAAA;AAAA,EAEU,SAAS;AACjB,UAAM,UAAU,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,KAAK,KAAK,CAAC;AAErD,WAAO,KAAK,CAAC,EAAE,KAAK,WAAW;AAC7B,UAAI,EAAE,MAAM,OAAA,GAAU,MAAM;AAC1B;AAAA,UACE;AAAA,YACE,MAAM;AAAA,YACN,WAAW;AAAA,YACX,MAAM;AAAA,YACN,iBAAiB,OAAO,OAAO;AAAA,YAC/B,iBAAiB;AAAA,YACjB,iBAAiB;AAAA,YACjB,GAAI,KAAK,QAAQ,EAAE,cAAc,KAAK,MAAA,IAAU,CAAA;AAAA,UAAC;AAAA,UAEnD,MAAM;AACJ,iBAAK;AAAA,cACH,MAAM;AAAA,cACN,WAAW;AAAA,cACX,OAAO,EAAE,OAAO,GAAG,OAAO,IAAA;AAAA,YAAI,CAC/B;AAAA,UACH;AAAA,QAAA;AAAA,MAEJ,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;AA1CA,QAAA,iBAAA,EAAA;AAKW,SAAA,oBAAA,QAAA;AAGA,SAAA,oBAAA,QAAA;AAGA,SAAA,oBAAA,QAAA;AAGA,YAAA,oBAAA,QAAA;AATT,kBAAA,OAAA,GAAS,SADT,YAJI,aAKK,MAAA;AAGT,kBAAA,OAAA,GAAS,SADT,YAPI,aAQK,MAAA;AAGT,kBAAA,OAAA,GAAS,SADT,YAVI,aAWK,MAAA;AAGT,kBAAA,OAAA,GAAS,YADT,eAbI,aAcK,SAAA;AAdX,oBAAA,OAAM,WAAA;AACJ,cADI,aACG,WAAU,cAAA;AACjB,cAFI,aAEa,UAAS,CAAC,gBAAgB,UAAU,KAAK,CAAA;AA0C5D,YAAY,SAAA;"}
|
|
@@ -70,14 +70,14 @@ declare class AeicoField<TValue = string> extends AeicoComponent {
|
|
|
70
70
|
*
|
|
71
71
|
* @returns Current field value
|
|
72
72
|
*/
|
|
73
|
-
protected getValue():
|
|
73
|
+
protected getValue(): TValue;
|
|
74
74
|
/**
|
|
75
75
|
* Write value to the underlying UI element and sync props
|
|
76
76
|
* Subclasses must override this to update their specific UI element
|
|
77
77
|
*
|
|
78
78
|
* @param _value New value to write to the element
|
|
79
79
|
*/
|
|
80
|
-
protected writeValue(_value:
|
|
80
|
+
protected writeValue(_value: TValue): void;
|
|
81
81
|
/**
|
|
82
82
|
* Get event payload for change events
|
|
83
83
|
* Override in subclasses to customize event data (e.g., { checked, oldChecked } for checkbox)
|
|
@@ -87,7 +87,7 @@ declare class AeicoField<TValue = string> extends AeicoComponent {
|
|
|
87
87
|
* @param action Action type
|
|
88
88
|
* @returns Event payload object
|
|
89
89
|
*/
|
|
90
|
-
protected getEventPayload(value:
|
|
90
|
+
protected getEventPayload(value: TValue, oldValue: TValue, action: FieldAction): Record<string, unknown>;
|
|
91
91
|
/**
|
|
92
92
|
* Update field value programmatically (internal method)
|
|
93
93
|
* Subclasses should provide type-safe public wrappers (e.g., change() method)
|
|
@@ -96,7 +96,7 @@ declare class AeicoField<TValue = string> extends AeicoComponent {
|
|
|
96
96
|
* @param options.silent If true, won't emit change event (default: true)
|
|
97
97
|
* @param options.action Action type for the event (default: 'change')
|
|
98
98
|
*/
|
|
99
|
-
protected setValue(value:
|
|
99
|
+
protected setValue(value: TValue, options?: {
|
|
100
100
|
silent?: boolean;
|
|
101
101
|
action?: FieldAction;
|
|
102
102
|
}): void;
|
|
@@ -106,7 +106,7 @@ declare class AeicoField<TValue = string> extends AeicoComponent {
|
|
|
106
106
|
* @param value Value to reset to, defaults to defaultValue prop
|
|
107
107
|
* @param options.silent If false, will emit reset event (default: true)
|
|
108
108
|
*/
|
|
109
|
-
reset(value?:
|
|
109
|
+
reset(value?: TValue, options?: {
|
|
110
110
|
silent?: boolean;
|
|
111
111
|
}): void;
|
|
112
112
|
/**
|
|
@@ -33,7 +33,8 @@ declare class Button extends AeicoComponent {
|
|
|
33
33
|
type?: 'button' | 'submit' | 'reset';
|
|
34
34
|
active?: boolean;
|
|
35
35
|
block?: boolean;
|
|
36
|
-
private
|
|
36
|
+
private _buttonElement;
|
|
37
|
+
private _slotElement;
|
|
37
38
|
private _autoAriaLabel;
|
|
38
39
|
protected onMounted(): void;
|
|
39
40
|
private _handleSlotChange;
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { CheckboxVariant } from './defines';
|
|
4
|
-
declare class Checkbox extends AeicoField {
|
|
4
|
+
declare class Checkbox extends AeicoField<boolean> {
|
|
5
5
|
protected fieldElement: HTMLInputElement | null;
|
|
6
6
|
static tagName: string;
|
|
7
7
|
static props: Props;
|
|
@@ -11,14 +11,14 @@ declare class Checkbox extends AeicoField {
|
|
|
11
11
|
protected static styles: string[];
|
|
12
12
|
protected getValue(): boolean;
|
|
13
13
|
protected writeValue(checked: boolean): void;
|
|
14
|
-
protected getEventPayload(checked: boolean, oldChecked: boolean, action:
|
|
14
|
+
protected getEventPayload(checked: boolean, oldChecked: boolean, action: FieldAction): {
|
|
15
15
|
checked: boolean;
|
|
16
16
|
oldChecked: boolean;
|
|
17
|
-
action:
|
|
17
|
+
action: FieldAction;
|
|
18
18
|
};
|
|
19
19
|
protected setValue(checked: boolean, options?: {
|
|
20
20
|
silent?: boolean;
|
|
21
|
-
action?:
|
|
21
|
+
action?: FieldAction;
|
|
22
22
|
}): void;
|
|
23
23
|
reset(checked?: boolean, options?: {
|
|
24
24
|
silent?: boolean;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export { default as Divider } from './divider';
|
|
|
53
53
|
export { default as Card } from './card';
|
|
54
54
|
export { default as Navbar } from './navbar';
|
|
55
55
|
export { default as Detail } from './detail';
|
|
56
|
+
export { default as ProgressBar } from './progress-bar';
|
|
56
57
|
export type { SelectProps, SelectOption, SelectOptions, SelectOptionValue } from './select';
|
|
57
58
|
export type { SliderProps, SliderOption, SliderOptions, SliderOptionValue } from './slider';
|
|
58
59
|
export type { CheckboxProps, CheckboxVariant } from './checkbox';
|
|
@@ -67,6 +68,7 @@ export type { BadgeProps, BadgeColor, BadgeSize, BadgeVariant } from './badge';
|
|
|
67
68
|
export type { TagProps, TagColor, TagSize, TagVariant } from './tag';
|
|
68
69
|
export type { DialogProps } from './dialog';
|
|
69
70
|
export type { IconProps, IconSize, IconColor, IconDefinition, IconRegistryData } from './icon';
|
|
71
|
+
export type { ProgressBarProps, ProgressBarColor } from './progress-bar';
|
|
70
72
|
export type { IconButtonProps, IconButtonVariant, IconButtonSize } from './icon-button';
|
|
71
73
|
export type { DividerProps } from './divider';
|
|
72
74
|
export type { CardProps, CardVariant, CardColor } from './card';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ProgressBarColor = 'default' | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { InferProps } from 'aeico';
|
|
2
|
+
import AeicoComponent from '../aeico-component';
|
|
3
|
+
import type { ProgressBarColor } from './defines';
|
|
4
|
+
/**
|
|
5
|
+
* Progress bars show how far along an ongoing operation is as a horizontal fill.
|
|
6
|
+
* Use them for file uploads, multi-step flows, or any task with measurable progress.
|
|
7
|
+
*
|
|
8
|
+
* @prop {number} value - Completion percentage, automatically clamped to 0–100.
|
|
9
|
+
* @prop {string} label - Accessible label applied as `aria-label` on the track.
|
|
10
|
+
* @prop {'default'|'primary'|'secondary'|'success'|'danger'|'warning'|'info'} color
|
|
11
|
+
* - Preset color variant driven by the shared color system.
|
|
12
|
+
* @prop {boolean} animated - When set, overlays a shimmer sweep animation on the bar.
|
|
13
|
+
*
|
|
14
|
+
* @csspart base - The outermost wrapper `<div>`.
|
|
15
|
+
* @csspart track - The background track `<div>`.
|
|
16
|
+
* @csspart bar - The filled progress `<span>`.
|
|
17
|
+
*
|
|
18
|
+
* @cssproperty [--progress-height=8px] - Height of both the track and the bar.
|
|
19
|
+
* @cssproperty [--progress-bar-color=var(--color-solid)] - Fill color of the bar.
|
|
20
|
+
* When set, takes precedence over the `color` prop entirely.
|
|
21
|
+
*/
|
|
22
|
+
declare class ProgressBar extends AeicoComponent {
|
|
23
|
+
static tagName: string;
|
|
24
|
+
protected static styles: string[];
|
|
25
|
+
accessor value: number;
|
|
26
|
+
accessor label: string;
|
|
27
|
+
accessor color: ProgressBarColor;
|
|
28
|
+
accessor animated: boolean;
|
|
29
|
+
protected render(): import("aeico-view").RenderResult;
|
|
30
|
+
}
|
|
31
|
+
declare global {
|
|
32
|
+
interface HTMLElementTagNameMap {
|
|
33
|
+
'ae-progress-bar': ProgressBar;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export default ProgressBar;
|
|
37
|
+
export type ProgressBarProps = InferProps<typeof ProgressBar>;
|
|
@@ -25,7 +25,7 @@ declare class RadioGroup extends AeicoField {
|
|
|
25
25
|
private _boundOnRadioClick;
|
|
26
26
|
private _boundOnButtonClick;
|
|
27
27
|
protected getValue(): string;
|
|
28
|
-
protected writeValue(_value:
|
|
28
|
+
protected writeValue(_value: string): void;
|
|
29
29
|
protected onReset(): void;
|
|
30
30
|
protected onClear(): void;
|
|
31
31
|
render(): import("aeico-view").RenderResult;
|
|
@@ -32,7 +32,7 @@ declare class Select extends AeicoField<SelectOptionValue | SelectMultiValue> {
|
|
|
32
32
|
defaultValue: SelectOptionValue | SelectMultiValue | undefined;
|
|
33
33
|
protected static styles: string[];
|
|
34
34
|
protected writeValue(_value: SelectOptionValue | SelectMultiValue): void;
|
|
35
|
-
protected getValue():
|
|
35
|
+
protected getValue(): SelectOptionValue | SelectMultiValue;
|
|
36
36
|
private _getMultiValues;
|
|
37
37
|
protected onDisabledChanged(_newValue: boolean): void;
|
|
38
38
|
protected onUpdated(_changedProps: Map<string, unknown>): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import AeicoField from '../aeico-field';
|
|
1
|
+
import AeicoField, { type FieldAction } from '../aeico-field';
|
|
2
2
|
import type { InferProps, Props } from 'aeico';
|
|
3
|
-
declare class Switch extends AeicoField {
|
|
3
|
+
declare class Switch extends AeicoField<boolean> {
|
|
4
4
|
protected fieldElement: HTMLInputElement | null;
|
|
5
5
|
static tagName: string;
|
|
6
6
|
static props: Props;
|
|
@@ -9,14 +9,14 @@ declare class Switch extends AeicoField {
|
|
|
9
9
|
protected static styles: string[];
|
|
10
10
|
protected getValue(): boolean;
|
|
11
11
|
protected writeValue(checked: boolean): void;
|
|
12
|
-
protected getEventPayload(checked: boolean, oldChecked: boolean, action:
|
|
12
|
+
protected getEventPayload(checked: boolean, oldChecked: boolean, action: FieldAction): {
|
|
13
13
|
checked: boolean;
|
|
14
14
|
oldChecked: boolean;
|
|
15
|
-
action:
|
|
15
|
+
action: FieldAction;
|
|
16
16
|
};
|
|
17
17
|
protected setValue(checked: boolean, options?: {
|
|
18
18
|
silent?: boolean;
|
|
19
|
-
action?:
|
|
19
|
+
action?: FieldAction;
|
|
20
20
|
}): void;
|
|
21
21
|
reset(checked?: boolean, options?: {
|
|
22
22
|
silent?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aeico-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Built-in UI components for the Aeico Web Components framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"author": "",
|
|
53
53
|
"license": "ISC",
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"aeico": "^0.1.
|
|
55
|
+
"aeico": "^0.1.5",
|
|
56
56
|
"aeico-localize": "^0.1.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"aeico": "^0.1.
|
|
59
|
+
"aeico": "^0.1.5",
|
|
60
60
|
"aeico-localize": "^0.1.1",
|
|
61
61
|
"@eslint/js": "^10.0.1",
|
|
62
62
|
"@esm-bundle/chai": "^4.3.4-fix.0",
|
package/src/aeico-field.ts
CHANGED
|
@@ -136,8 +136,8 @@ class AeicoField<TValue = string> extends AeicoComponent {
|
|
|
136
136
|
*
|
|
137
137
|
* @returns Current field value
|
|
138
138
|
*/
|
|
139
|
-
protected getValue():
|
|
140
|
-
return this.fieldElement?.value || '';
|
|
139
|
+
protected getValue(): TValue {
|
|
140
|
+
return (this.fieldElement?.value || '') as TValue;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
/**
|
|
@@ -146,7 +146,7 @@ class AeicoField<TValue = string> extends AeicoComponent {
|
|
|
146
146
|
*
|
|
147
147
|
* @param _value New value to write to the element
|
|
148
148
|
*/
|
|
149
|
-
protected writeValue(_value:
|
|
149
|
+
protected writeValue(_value: TValue): void {
|
|
150
150
|
// Base implementation - subclasses override
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -159,7 +159,11 @@ class AeicoField<TValue = string> extends AeicoComponent {
|
|
|
159
159
|
* @param action Action type
|
|
160
160
|
* @returns Event payload object
|
|
161
161
|
*/
|
|
162
|
-
protected getEventPayload(
|
|
162
|
+
protected getEventPayload(
|
|
163
|
+
value: TValue,
|
|
164
|
+
oldValue: TValue,
|
|
165
|
+
action: FieldAction,
|
|
166
|
+
): Record<string, unknown> {
|
|
163
167
|
return { value, oldValue, action };
|
|
164
168
|
}
|
|
165
169
|
|
|
@@ -171,7 +175,7 @@ class AeicoField<TValue = string> extends AeicoComponent {
|
|
|
171
175
|
* @param options.silent If true, won't emit change event (default: true)
|
|
172
176
|
* @param options.action Action type for the event (default: 'change')
|
|
173
177
|
*/
|
|
174
|
-
protected setValue(value:
|
|
178
|
+
protected setValue(value: TValue, options?: { silent?: boolean; action?: FieldAction }): void {
|
|
175
179
|
const oldValue = this.getValue();
|
|
176
180
|
|
|
177
181
|
// Update property value
|
|
@@ -193,9 +197,9 @@ class AeicoField<TValue = string> extends AeicoComponent {
|
|
|
193
197
|
* @param value Value to reset to, defaults to defaultValue prop
|
|
194
198
|
* @param options.silent If false, will emit reset event (default: true)
|
|
195
199
|
*/
|
|
196
|
-
public reset(value?:
|
|
200
|
+
public reset(value?: TValue, options?: { silent?: boolean }): void {
|
|
197
201
|
const resetValue = value !== undefined ? value : this.defaultValue;
|
|
198
|
-
this.setValue(resetValue, { ...options, action: 'reset' });
|
|
202
|
+
this.setValue(resetValue as TValue, { ...options, action: 'reset' });
|
|
199
203
|
}
|
|
200
204
|
|
|
201
205
|
/**
|
|
@@ -204,7 +208,7 @@ class AeicoField<TValue = string> extends AeicoComponent {
|
|
|
204
208
|
* @param options.silent If false, will emit clear event (default: true)
|
|
205
209
|
*/
|
|
206
210
|
public clear(options?: { silent?: boolean }): void {
|
|
207
|
-
this.setValue('', { ...options, action: 'clear' });
|
|
211
|
+
this.setValue('' as TValue, { ...options, action: 'clear' });
|
|
208
212
|
}
|
|
209
213
|
|
|
210
214
|
/**
|
package/src/button/button.ts
CHANGED
|
@@ -55,18 +55,16 @@ class Button extends AeicoComponent {
|
|
|
55
55
|
@prop({ type: Boolean })
|
|
56
56
|
block?: boolean;
|
|
57
57
|
|
|
58
|
-
private
|
|
58
|
+
private _buttonElement: HTMLButtonElement | null = null;
|
|
59
|
+
private _slotElement: HTMLSlotElement | null = null;
|
|
59
60
|
private _autoAriaLabel = false;
|
|
60
61
|
|
|
61
62
|
protected onMounted() {
|
|
62
|
-
const slot = this.shadowRoot?.querySelector('slot:not([name])');
|
|
63
|
-
if (slot) this.listen(slot, 'slotchange', this._handleSlotChange);
|
|
64
63
|
this._handleSlotChange();
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
private _handleSlotChange = () => {
|
|
68
|
-
const
|
|
69
|
-
const nodes = slot?.assignedNodes() ?? [];
|
|
67
|
+
const nodes = this._slotElement?.assignedNodes() ?? [];
|
|
70
68
|
// Icon-only: exactly one element (ae-icon) and no meaningful text nodes
|
|
71
69
|
const elements = nodes.filter((n): n is Element => n.nodeType === Node.ELEMENT_NODE);
|
|
72
70
|
const hasText = nodes.some(
|
|
@@ -92,7 +90,7 @@ class Button extends AeicoComponent {
|
|
|
92
90
|
|
|
93
91
|
protected render() {
|
|
94
92
|
return html(({ button, slot }) => {
|
|
95
|
-
this.
|
|
93
|
+
this._buttonElement = button(
|
|
96
94
|
{
|
|
97
95
|
type: this.type || 'button',
|
|
98
96
|
disabled: this.disabled,
|
|
@@ -101,7 +99,7 @@ class Button extends AeicoComponent {
|
|
|
101
99
|
'aria-disabled': this.disabled,
|
|
102
100
|
},
|
|
103
101
|
() => {
|
|
104
|
-
slot();
|
|
102
|
+
this._slotElement = slot({ '@slotchange': this._handleSlotChange });
|
|
105
103
|
},
|
|
106
104
|
);
|
|
107
105
|
});
|
|
@@ -111,8 +109,8 @@ class Button extends AeicoComponent {
|
|
|
111
109
|
* Programmatically click the button
|
|
112
110
|
*/
|
|
113
111
|
click() {
|
|
114
|
-
if (!this.disabled && this.
|
|
115
|
-
this.
|
|
112
|
+
if (!this.disabled && this._buttonElement) {
|
|
113
|
+
this._buttonElement.click();
|
|
116
114
|
}
|
|
117
115
|
}
|
|
118
116
|
|
|
@@ -120,8 +118,8 @@ class Button extends AeicoComponent {
|
|
|
120
118
|
* Focus the button
|
|
121
119
|
*/
|
|
122
120
|
focus() {
|
|
123
|
-
if (this.
|
|
124
|
-
this.
|
|
121
|
+
if (this._buttonElement) {
|
|
122
|
+
this._buttonElement.focus();
|
|
125
123
|
}
|
|
126
124
|
}
|
|
127
125
|
|
|
@@ -129,8 +127,8 @@ class Button extends AeicoComponent {
|
|
|
129
127
|
* Blur the button
|
|
130
128
|
*/
|
|
131
129
|
blur() {
|
|
132
|
-
if (this.
|
|
133
|
-
this.
|
|
130
|
+
if (this._buttonElement) {
|
|
131
|
+
this._buttonElement.blur();
|
|
134
132
|
}
|
|
135
133
|
}
|
|
136
134
|
}
|