@greypan/web-ui 2.1.8 → 3.0.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.CN.md +44 -6
- package/README.md +46 -7
- package/dist/assets/menu-portal.js +1 -1
- package/dist/assets/menu-portal.js.map +1 -1
- package/dist/components/autocomplete/index.d.ts +121 -0
- package/dist/components/autocomplete/index.js +414 -0
- package/dist/components/autocomplete/index.js.map +1 -0
- package/dist/components/autocomplete/style.js +6 -0
- package/dist/components/autocomplete/style.js.map +1 -0
- package/dist/components/avatar/index.d.ts +0 -1
- package/dist/components/avatar/index.js +9 -9
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/back-top/index.d.ts +0 -1
- package/dist/components/back-top/index.js.map +1 -1
- package/dist/components/badge/index.d.ts +0 -1
- package/dist/components/badge/index.js +5 -5
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/button/index.d.ts +0 -1
- package/dist/components/button/index.js +8 -8
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button/style.js +1 -1
- package/dist/components/button/style.js.map +1 -1
- package/dist/components/button-group/index.d.ts +0 -1
- package/dist/components/button-group/index.js.map +1 -1
- package/dist/components/checkbox/index.js +7 -5
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox-group/index.js +2 -2
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/context-menu/index.js +25 -25
- package/dist/components/context-menu/index.js.map +1 -1
- package/dist/components/dialog/index.js +3 -3
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/drawer/index.js +7 -7
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/dropdown/index.js +31 -30
- package/dist/components/dropdown/index.js.map +1 -1
- package/dist/components/dropdown-divider/index.d.ts +0 -1
- package/dist/components/dropdown-divider/index.js.map +1 -1
- package/dist/components/dropdown-header/index.d.ts +0 -1
- package/dist/components/dropdown-header/index.js.map +1 -1
- package/dist/components/dropdown-item/index.d.ts +0 -1
- package/dist/components/dropdown-item/index.js.map +1 -1
- package/dist/components/dropdown-item/style.js +1 -1
- package/dist/components/dropdown-item/style.js.map +1 -1
- package/dist/components/empty/index.d.ts +0 -1
- package/dist/components/empty/index.js +6 -6
- package/dist/components/empty/index.js.map +1 -1
- package/dist/components/icon/index.d.ts +0 -1
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +36 -35
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +24 -13
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/input/style.js +1 -1
- package/dist/components/input/style.js.map +1 -1
- package/dist/components/input-number/index.d.ts +2 -0
- package/dist/components/input-number/index.js +25 -12
- package/dist/components/input-number/index.js.map +1 -1
- package/dist/components/input-number/style.js +1 -1
- package/dist/components/input-number/style.js.map +1 -1
- package/dist/components/layout/index.d.ts +0 -1
- package/dist/components/layout/index.js +4 -4
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/option/index.d.ts +0 -11
- package/dist/components/option/index.js.map +1 -1
- package/dist/components/option/style.js +1 -1
- package/dist/components/option/style.js.map +1 -1
- package/dist/components/popover/index.js +12 -12
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/radio/index.js +8 -5
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/radio-group/index.js +2 -2
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/segmented/index.js +2 -2
- package/dist/components/segmented/index.js.map +1 -1
- package/dist/components/segmented-trigger/index.d.ts +1 -0
- package/dist/components/segmented-trigger/index.js +11 -2
- package/dist/components/segmented-trigger/index.js.map +1 -1
- package/dist/components/select/index.d.ts +0 -1
- package/dist/components/select/index.js +19 -30
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/select/style.js +1 -1
- package/dist/components/select/style.js.map +1 -1
- package/dist/components/spinner/index.d.ts +0 -1
- package/dist/components/spinner/index.js.map +1 -1
- package/dist/components/svg-draw-lines/index.d.ts +0 -1
- package/dist/components/svg-draw-lines/index.js.map +1 -1
- package/dist/components/switch/index.js +6 -6
- package/dist/components/textarea/index.js +18 -15
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/textarea/style.js +1 -1
- package/dist/components/textarea/style.js.map +1 -1
- package/dist/components/theme/index.d.ts +0 -1
- package/dist/components/theme/index.js.map +1 -1
- package/dist/components/toast/toast.js +13 -13
- package/dist/components/tooltip/index.js +13 -13
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/shared/menu-portal/menu-portal.js +10 -11
- package/dist/shared/menu-portal/menu-portal.js.map +1 -1
- package/dist/shared/overlay/anchored-panel.js +12 -12
- package/dist/shared/overlay/overlay.js +55 -33
- package/dist/shared/overlay/overlay.js.map +1 -1
- package/dist/shared/overlay/portal.js +25 -13
- package/dist/shared/overlay/portal.js.map +1 -1
- package/dist/shared/scroll-lock/scroll-lock.js +13 -12
- package/dist/shared/scroll-lock/scroll-lock.js.map +1 -1
- package/dist/shared/theme/overlay-root.js +3 -3
- package/dist/types/react.d.ts +15 -41
- package/dist/types/utils.d.ts +33 -4
- package/dist/types/vue.d.ts +17 -49
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/dropdown-divider/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-dropdown-divider')\nexport class WebUiDropdownDivider extends LitElement {\n static override styles = unsafeCSS(style)\n\n override render() {\n return html`<div class=\"divider\" role=\"separator\"></div>`\n }\n
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/dropdown-divider/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-dropdown-divider')\nexport class WebUiDropdownDivider extends LitElement {\n static override styles = unsafeCSS(style)\n\n override render() {\n return html`<div class=\"divider\" role=\"separator\"></div>`\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-dropdown-divider': WebUiDropdownDivider\n }\n}\n"],"mappings":";;;;;AAMO,IAAM,IAAN,cAAmC,EAAW;;EAC1B,KAAA,SAAA,EAAU,CAAK;;CAExC,SAAkB;EAChB,OAAO,CAAI;CACb;AACF;AAPC,IAAA,EAAA,CAAA,EAAc,yBAAyB,CAAA,GAAA,CAAA"}
|
|
@@ -2,7 +2,6 @@ import { LitElement } from 'lit';
|
|
|
2
2
|
export declare class WebUiDropdownHeader extends LitElement {
|
|
3
3
|
static styles: import('lit').CSSResult;
|
|
4
4
|
render(): import('lit').TemplateResult<1>;
|
|
5
|
-
readonly $events: Record<string, never>;
|
|
6
5
|
}
|
|
7
6
|
declare global {
|
|
8
7
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/dropdown-header/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-dropdown-header')\nexport class WebUiDropdownHeader extends LitElement {\n static override styles = unsafeCSS(style)\n\n override render() {\n return html`<div class=\"header\"><slot></slot></div>`\n }\n
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/dropdown-header/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-dropdown-header')\nexport class WebUiDropdownHeader extends LitElement {\n static override styles = unsafeCSS(style)\n\n override render() {\n return html`<div class=\"header\"><slot></slot></div>`\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-dropdown-header': WebUiDropdownHeader\n }\n}\n"],"mappings":";;;;;AAMO,IAAM,IAAN,cAAkC,EAAW;;EACzB,KAAA,SAAA,EAAU,CAAK;;CAExC,SAAkB;EAChB,OAAO,CAAI;CACb;AACF;AAPC,IAAA,EAAA,CAAA,EAAc,wBAAwB,CAAA,GAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/dropdown-item/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport '@/components/icon'\nimport { lucideChevronRight } from '@/icons'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-dropdown-item')\nexport class WebUiDropdownItem extends LitElement {\n static override styles = unsafeCSS(style)\n\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: String, reflect: true }) pl = ''\n @property({ type: String, reflect: true }) value = ''\n @property({ type: Boolean, reflect: true }) submenu = false\n\n // 通过可见元素聚焦,避免 portal 菜单跨 Shadow DOM 时丢失焦点。\n focusItem() {\n this.shadowRoot?.querySelector<HTMLElement>('.item-inner')?.focus()\n }\n\n override render() {\n const plStyle = this.pl ? `padding-left: ${this.pl}` : ''\n return html`\n <div class=\"item-inner\" style=${plStyle} role=\"menuitem\" tabindex=${this.disabled ? '-1' : '0'}>\n <slot name=\"prefix\"></slot>\n <span class=\"item-label\"><slot></slot></span>\n ${this.submenu\n ? html`<web-ui-icon .icon=${lucideChevronRight}></web-ui-icon>`\n : html`<span class=\"item-suffix\"><slot name=\"suffix\"></slot></span>`}\n </div>\n `\n }\n
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/dropdown-item/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport '@/components/icon'\nimport { lucideChevronRight } from '@/icons'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-dropdown-item')\nexport class WebUiDropdownItem extends LitElement {\n static override styles = unsafeCSS(style)\n\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: String, reflect: true }) pl = ''\n @property({ type: String, reflect: true }) value = ''\n @property({ type: Boolean, reflect: true }) submenu = false\n\n // 通过可见元素聚焦,避免 portal 菜单跨 Shadow DOM 时丢失焦点。\n focusItem() {\n this.shadowRoot?.querySelector<HTMLElement>('.item-inner')?.focus()\n }\n\n override render() {\n const plStyle = this.pl ? `padding-left: ${this.pl}` : ''\n return html`\n <div class=\"item-inner\" style=${plStyle} role=\"menuitem\" tabindex=${this.disabled ? '-1' : '0'}>\n <slot name=\"prefix\"></slot>\n <span class=\"item-label\"><slot></slot></span>\n ${this.submenu\n ? html`<web-ui-icon .icon=${lucideChevronRight}></web-ui-icon>`\n : html`<span class=\"item-suffix\"><slot name=\"suffix\"></slot></span>`}\n </div>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-dropdown-item': WebUiDropdownItem\n }\n}\n"],"mappings":";;;;;;;AASO,IAAM,IAAN,cAAgC,EAAW;;EAMM,aAHC,KAAA,WAAA,IACP,KAAA,KAAA,IACG,KAAA,QAAA,IACG,KAAA,UAAA;;;EAL7B,KAAA,SAAA,EAAU,CAAK;;CAQxC,YAAY;EACV,KAAK,YAAY,cAA2B,aAAa,CAAC,EAAE,MAAM;CACpE;CAEA,SAAkB;EAEhB,OAAO,CAAI;sCADK,KAAK,KAAK,iBAAiB,KAAK,OAAO,GAEb,4BAA4B,KAAK,WAAW,OAAO,IAAI;;;UAG3F,KAAK,UACH,CAAI,sBAAsB,EAAmB,mBAC7C,CAAI,+DAA+D;;;CAG7E;AACF;AAtBG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,MAAA,KAAA,CAAA,GACxC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,KAAA,CAAA,GACxC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GAP3C,IAAA,EAAA,CAAA,EAAc,sBAAsB,CAAA,GAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/components/dropdown-item/style.css?inline
|
|
2
|
-
var e = "*,:before,:after{box-sizing:border-box}:host{display:block}:host([disabled]){cursor:not-allowed;opacity:.4}.item-inner{-webkit-user-select:none;user-select:none;height:32px;font-size:var(--wui-font-size,14px);color:inherit;white-space:nowrap;transition:color var(--wui-duration-feedback,.1s) var(--wui-ease-enter,cubic-bezier(.23, 1, .32, 1)), background-color var(--wui-duration-feedback,.1s) var(--wui-ease-enter,cubic-bezier(.23, 1, .32, 1));border-radius:2147483647px;outline:none;align-items:center;gap:8px;padding:0
|
|
2
|
+
var e = "*,:before,:after{box-sizing:border-box}:host{display:block}:host([disabled]){cursor:not-allowed;opacity:.4}.item-inner{-webkit-user-select:none;user-select:none;height:32px;font-size:var(--wui-font-size,14px);color:inherit;white-space:nowrap;transition:color var(--wui-duration-feedback,.1s) var(--wui-ease-enter,cubic-bezier(.23, 1, .32, 1)), background-color var(--wui-duration-feedback,.1s) var(--wui-ease-enter,cubic-bezier(.23, 1, .32, 1));border-radius:2147483647px;outline:none;align-items:center;gap:8px;padding:0 8px;display:flex}.item-inner:focus-visible{color:var(--wui-color-on-accent,#fff);background:var(--wui-color-accent,#08f)}:host([active]) .item-inner{color:inherit;background:var(--wui-color-border,#0000001a)}@media (hover:hover) and (pointer:fine){:host(:hover) .item-inner{color:var(--wui-color-on-accent,#fff);background:var(--wui-color-accent,#08f)}}.item-label{min-width:0;color:inherit;text-overflow:ellipsis;flex:1;overflow:hidden}.item-suffix{opacity:.4;flex:none}";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { e as default };
|
|
5
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","names":[],"sources":["../../../src/components/dropdown-item/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.item-inner {\n user-select: none;\n\n display: flex;\n gap: 8px;\n align-items: center;\n\n height: 32px;\n padding: 0
|
|
1
|
+
{"version":3,"file":"style.js","names":[],"sources":["../../../src/components/dropdown-item/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.item-inner {\n user-select: none;\n\n display: flex;\n gap: 8px;\n align-items: center;\n\n height: 32px;\n padding: 0 8px;\n border-radius: calc(infinity * 1px);\n\n font-size: var(--wui-font-size, 14px);\n color: inherit;\n white-space: nowrap;\n\n outline: none;\n\n transition:\n color var(--wui-duration-feedback, 100ms) var(--wui-ease-enter, cubic-bezier(0.23, 1, 0.32, 1)),\n background-color var(--wui-duration-feedback, 100ms) var(--wui-ease-enter, cubic-bezier(0.23, 1, 0.32, 1));\n}\n\n.item-inner:focus-visible {\n color: var(--wui-color-on-accent, #fff);\n background: var(--wui-color-accent, #08f);\n}\n\n:host([active]) .item-inner {\n color: inherit;\n background: var(--wui-color-border, rgb(0 0 0 / 0.1));\n}\n\n@media (hover: hover) and (pointer: fine) {\n :host(:hover) .item-inner {\n color: var(--wui-color-on-accent, #fff);\n background: var(--wui-color-accent, #08f);\n }\n}\n\n.item-label {\n overflow: hidden;\n flex: 1;\n\n min-width: 0;\n\n color: inherit;\n text-overflow: ellipsis;\n}\n\n.item-suffix {\n flex: none;\n opacity: 0.4;\n}\n"],"mappings":""}
|
|
@@ -14,7 +14,6 @@ export declare class WebUiEmpty extends LitElement {
|
|
|
14
14
|
private _syncSlotContent;
|
|
15
15
|
private _hasAssignedContent;
|
|
16
16
|
render(): import('lit').TemplateResult<1>;
|
|
17
|
-
readonly $events: Record<string, never>;
|
|
18
17
|
}
|
|
19
18
|
declare global {
|
|
20
19
|
interface HTMLElementTagNameMap {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "../../_virtual/_@oxc-project_runtime@0.140.0/helpers/esm/decorate.js";
|
|
2
2
|
import "../icon/index.js";
|
|
3
|
-
import t from "../../
|
|
4
|
-
import n from "../../
|
|
3
|
+
import t from "../../icons/generated/lucide-inbox.js";
|
|
4
|
+
import n from "../../assets/glass.js";
|
|
5
5
|
import { normalizeLiteral as r } from "../../shared/normalize/index.js";
|
|
6
6
|
import i from "./style.js";
|
|
7
7
|
import { LitElement as a, html as o, unsafeCSS as s } from "lit";
|
|
@@ -19,7 +19,7 @@ var f = [
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
static {
|
|
22
|
-
this.styles = [s(
|
|
22
|
+
this.styles = [s(n), s(i)];
|
|
23
23
|
}
|
|
24
24
|
set size(e) {
|
|
25
25
|
let t = r(e, f, "medium");
|
|
@@ -39,11 +39,11 @@ var f = [
|
|
|
39
39
|
return [...this.childNodes].some((t) => t instanceof HTMLElement && (t.getAttribute("slot") ?? "") === (e ?? "") || !e && t.nodeType === Node.TEXT_NODE && !!t.textContent?.trim());
|
|
40
40
|
}
|
|
41
41
|
render() {
|
|
42
|
-
let e = this._hasTitleSlot || !!this.title,
|
|
42
|
+
let e = this._hasTitleSlot || !!this.title, n = this._hasDescriptionSlot || !!this.description;
|
|
43
43
|
return o`
|
|
44
44
|
<section class="empty">
|
|
45
45
|
<div class="empty-icon wui-glass" aria-hidden="true">
|
|
46
|
-
<slot name="icon"><web-ui-icon .icon=${
|
|
46
|
+
<slot name="icon"><web-ui-icon .icon=${t}></web-ui-icon></slot>
|
|
47
47
|
</div>
|
|
48
48
|
<div class=${d({
|
|
49
49
|
"empty-title": !0,
|
|
@@ -53,7 +53,7 @@ var f = [
|
|
|
53
53
|
</div>
|
|
54
54
|
<div class=${d({
|
|
55
55
|
"empty-description": !0,
|
|
56
|
-
"is-hidden": !
|
|
56
|
+
"is-hidden": !n
|
|
57
57
|
})}>
|
|
58
58
|
<slot name="description" @slotchange=${this._syncSlotContent}>${this.description}</slot>
|
|
59
59
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/empty/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\n\nimport '@/components/icon'\nimport glass from '@/assets/glass.css?inline'\nimport { lucideInbox } from '@/icons'\nimport { normalizeLiteral } from '@/shared/normalize'\n\nimport style from './style.css?inline'\n\nexport type EmptySize = 'small' | 'medium' | 'large'\n\nconst ALLOWED_SIZES = ['small', 'medium', 'large'] as const\n\n@customElement('web-ui-empty')\nexport class WebUiEmpty extends LitElement {\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @property({ type: String, reflect: true }) override title = ''\n\n @property({ type: String, reflect: true }) description = ''\n\n @property({ type: String, reflect: true })\n set size(value: string) {\n const normalized = normalizeLiteral(value, ALLOWED_SIZES, 'medium')\n if (this._size !== normalized) {\n const old = this._size\n this._size = normalized\n this.requestUpdate('size', old)\n }\n if (this.getAttribute('size') !== normalized) {\n this.setAttribute('size', normalized)\n }\n }\n\n get size(): EmptySize {\n return this._size\n }\n\n private _size: EmptySize = 'medium'\n\n @state() private _hasTitleSlot = false\n @state() private _hasDescriptionSlot = false\n @state() private _hasActionSlot = false\n\n override connectedCallback() {\n super.connectedCallback()\n this._syncSlotContent()\n }\n\n private _syncSlotContent = () => {\n this._hasTitleSlot = this._hasAssignedContent()\n this._hasDescriptionSlot = this._hasAssignedContent('description')\n this._hasActionSlot = this._hasAssignedContent('action')\n }\n\n private _hasAssignedContent(slotName?: string): boolean {\n return [...this.childNodes].some(node => {\n if (node instanceof HTMLElement && (node.getAttribute('slot') ?? '') === (slotName ?? '')) return true\n return !slotName && node.nodeType === Node.TEXT_NODE && Boolean(node.textContent?.trim())\n })\n }\n\n override render() {\n const showTitle = this._hasTitleSlot || Boolean(this.title)\n const showDescription = this._hasDescriptionSlot || Boolean(this.description)\n\n return html`\n <section class=\"empty\">\n <div class=\"empty-icon wui-glass\" aria-hidden=\"true\">\n <slot name=\"icon\"><web-ui-icon .icon=${lucideInbox}></web-ui-icon></slot>\n </div>\n <div class=${classMap({ 'empty-title': true, 'is-hidden': !showTitle })}>\n <slot @slotchange=${this._syncSlotContent}>${this.title}</slot>\n </div>\n <div class=${classMap({ 'empty-description': true, 'is-hidden': !showDescription })}>\n <slot name=\"description\" @slotchange=${this._syncSlotContent}>${this.description}</slot>\n </div>\n <div class=${classMap({ 'empty-action': true, 'is-hidden': !this._hasActionSlot })}>\n <slot name=\"action\" @slotchange=${this._syncSlotContent}></slot>\n </div>\n </section>\n `\n }\n
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/empty/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\n\nimport '@/components/icon'\nimport glass from '@/assets/glass.css?inline'\nimport { lucideInbox } from '@/icons'\nimport { normalizeLiteral } from '@/shared/normalize'\n\nimport style from './style.css?inline'\n\nexport type EmptySize = 'small' | 'medium' | 'large'\n\nconst ALLOWED_SIZES = ['small', 'medium', 'large'] as const\n\n@customElement('web-ui-empty')\nexport class WebUiEmpty extends LitElement {\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @property({ type: String, reflect: true }) override title = ''\n\n @property({ type: String, reflect: true }) description = ''\n\n @property({ type: String, reflect: true })\n set size(value: string) {\n const normalized = normalizeLiteral(value, ALLOWED_SIZES, 'medium')\n if (this._size !== normalized) {\n const old = this._size\n this._size = normalized\n this.requestUpdate('size', old)\n }\n if (this.getAttribute('size') !== normalized) {\n this.setAttribute('size', normalized)\n }\n }\n\n get size(): EmptySize {\n return this._size\n }\n\n private _size: EmptySize = 'medium'\n\n @state() private _hasTitleSlot = false\n @state() private _hasDescriptionSlot = false\n @state() private _hasActionSlot = false\n\n override connectedCallback() {\n super.connectedCallback()\n this._syncSlotContent()\n }\n\n private _syncSlotContent = () => {\n this._hasTitleSlot = this._hasAssignedContent()\n this._hasDescriptionSlot = this._hasAssignedContent('description')\n this._hasActionSlot = this._hasAssignedContent('action')\n }\n\n private _hasAssignedContent(slotName?: string): boolean {\n return [...this.childNodes].some(node => {\n if (node instanceof HTMLElement && (node.getAttribute('slot') ?? '') === (slotName ?? '')) return true\n return !slotName && node.nodeType === Node.TEXT_NODE && Boolean(node.textContent?.trim())\n })\n }\n\n override render() {\n const showTitle = this._hasTitleSlot || Boolean(this.title)\n const showDescription = this._hasDescriptionSlot || Boolean(this.description)\n\n return html`\n <section class=\"empty\">\n <div class=\"empty-icon wui-glass\" aria-hidden=\"true\">\n <slot name=\"icon\"><web-ui-icon .icon=${lucideInbox}></web-ui-icon></slot>\n </div>\n <div class=${classMap({ 'empty-title': true, 'is-hidden': !showTitle })}>\n <slot @slotchange=${this._syncSlotContent}>${this.title}</slot>\n </div>\n <div class=${classMap({ 'empty-description': true, 'is-hidden': !showDescription })}>\n <slot name=\"description\" @slotchange=${this._syncSlotContent}>${this.description}</slot>\n </div>\n <div class=${classMap({ 'empty-action': true, 'is-hidden': !this._hasActionSlot })}>\n <slot name=\"action\" @slotchange=${this._syncSlotContent}></slot>\n </div>\n </section>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-empty': WebUiEmpty\n }\n}\n"],"mappings":";;;;;;;;;;AAaA,IAAM,IAAgB;CAAC;CAAS;CAAU;AAAO,GAGpC,IAAN,cAAyB,EAAW;;EAmCR,aAhC2B,KAAA,QAAA,IAEH,KAAA,cAAA,IAmB9B,KAAA,QAAA,UAEM,KAAA,gBAAA,IACM,KAAA,sBAAA,IACL,KAAA,iBAAA,IAOD,KAAA,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;CAIhE;AACF;AAlEG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,KAAA,CAAA,GAExC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,eAAA,KAAA,CAAA,GAExC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,IAAA,GAmBxC,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,iBAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,uBAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,kBAAA,KAAA,CAAA,GA7BR,IAAA,EAAA,CAAA,EAAc,cAAc,CAAA,GAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/icon/index.ts"],"sourcesContent":["import type { IconifyIcon } from '@iconify/types'\nimport { html, LitElement, nothing, unsafeCSS } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-icon')\nexport class WebUiIcon extends LitElement {\n static override styles = unsafeCSS(style)\n\n @property({ attribute: false }) icon?: IconifyIcon\n @property({ type: Boolean, reflect: true }) spin = false\n @property({ type: Number, reflect: true }) size: number = 18\n @property({ type: String, reflect: true }) color?: string\n\n override render() {\n if (!this.icon) return nothing\n\n const svgStyle = this.color ? `color: ${this.color}` : ''\n const viewBox = `${this.icon.left ?? 0} ${this.icon.top ?? 0} ${this.icon.width ?? 24} ${this.icon.height ?? 24}`\n\n return html`\n <svg\n class=${classMap({ spin: this.spin })}\n style=${svgStyle}\n viewBox=\"${viewBox}\"\n width=\"${this.size}\"\n height=\"${this.size}\"\n aria-hidden=\"true\"\n >\n ${unsafeSVG(this.icon.body)}\n </svg>\n `\n }\n
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/icon/index.ts"],"sourcesContent":["import type { IconifyIcon } from '@iconify/types'\nimport { html, LitElement, nothing, unsafeCSS } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-icon')\nexport class WebUiIcon extends LitElement {\n static override styles = unsafeCSS(style)\n\n @property({ attribute: false }) icon?: IconifyIcon\n @property({ type: Boolean, reflect: true }) spin = false\n @property({ type: Number, reflect: true }) size: number = 18\n @property({ type: String, reflect: true }) color?: string\n\n override render() {\n if (!this.icon) return nothing\n\n const svgStyle = this.color ? `color: ${this.color}` : ''\n const viewBox = `${this.icon.left ?? 0} ${this.icon.top ?? 0} ${this.icon.width ?? 24} ${this.icon.height ?? 24}`\n\n return html`\n <svg\n class=${classMap({ spin: this.spin })}\n style=${svgStyle}\n viewBox=\"${viewBox}\"\n width=\"${this.size}\"\n height=\"${this.size}\"\n aria-hidden=\"true\"\n >\n ${unsafeSVG(this.icon.body)}\n </svg>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-icon': WebUiIcon\n }\n}\n"],"mappings":";;;;;;;AASO,IAAM,IAAN,cAAwB,EAAW;;EAKkB,aADP,KAAA,OAAA,IACO,KAAA,OAAA;;;EAJjC,KAAA,SAAA,EAAU,CAAK;;CAOxC,SAAkB;EAChB,IAAI,CAAC,KAAK,MAAM,OAAO;EAEvB,IAAM,IAAW,KAAK,QAAQ,UAAU,KAAK,UAAU,IACjD,IAAU,GAAG,KAAK,KAAK,QAAQ,EAAE,GAAG,KAAK,KAAK,OAAO,EAAE,GAAG,KAAK,KAAK,SAAS,GAAG,GAAG,KAAK,KAAK,UAAU;EAE7G,OAAO,CAAI;;gBAEC,EAAS,EAAE,MAAM,KAAK,KAAK,CAAC,EAAE;gBAC9B,EAAS;mBACN,EAAQ;iBACV,KAAK,KAAK;kBACT,KAAK,KAAK;;;UAGlB,EAAU,KAAK,KAAK,IAAI,EAAE;;;CAGlC;AACF;AAxBG,EAAA,CAAA,EAAS,EAAE,WAAW,GAAM,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GAC7B,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GACxC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,KAAA,CAAA,GAP1C,IAAA,EAAA,CAAA,EAAc,aAAa,CAAA,GAAA,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './autocomplete';
|
|
1
2
|
export * from './avatar';
|
|
2
3
|
export * from './back-top';
|
|
3
4
|
export * from './badge';
|
|
@@ -32,3 +33,7 @@ export * from './toast';
|
|
|
32
33
|
export * from './svg-draw-lines';
|
|
33
34
|
export * from './switch';
|
|
34
35
|
export * from './tooltip';
|
|
36
|
+
export type { WebUiEvent } from '../types/utils';
|
|
37
|
+
export type WebUiElementMap = {
|
|
38
|
+
[K in keyof HTMLElementTagNameMap as K extends `web-ui-${string}` ? K : never]: HTMLElementTagNameMap[K];
|
|
39
|
+
};
|
package/dist/components/index.js
CHANGED
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
import { WebUiIcon as e } from "./icon/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
2
|
+
import { WebUiOption as t } from "./option/index.js";
|
|
3
|
+
import { WebUiAutocomplete as n } from "./autocomplete/index.js";
|
|
4
|
+
import { WebUiAvatar as r } from "./avatar/index.js";
|
|
5
|
+
import { WebUiButton as i } from "./button/index.js";
|
|
6
|
+
import { WebUiBackTop as a } from "./back-top/index.js";
|
|
7
|
+
import { WebUiBadge as o } from "./badge/index.js";
|
|
8
|
+
import { WebUiButtonGroup as s } from "./button-group/index.js";
|
|
9
|
+
import { WebUiCheckbox as c } from "./checkbox/index.js";
|
|
10
|
+
import { WebUiCheckboxGroup as l } from "./checkbox-group/index.js";
|
|
11
|
+
import { WebUiDropdownDivider as u } from "./dropdown-divider/index.js";
|
|
12
|
+
import { WebUiDropdownHeader as d } from "./dropdown-header/index.js";
|
|
13
|
+
import { WebUiDropdownItem as f } from "./dropdown-item/index.js";
|
|
14
|
+
import { WebUiContextMenu as p } from "./context-menu/index.js";
|
|
15
|
+
import { WebUiDialog as m } from "./dialog/index.js";
|
|
16
|
+
import { WebUiDrawer as h } from "./drawer/index.js";
|
|
17
|
+
import { WebUiDropdown as g } from "./dropdown/index.js";
|
|
18
|
+
import { WebUiEmpty as _ } from "./empty/index.js";
|
|
19
|
+
import { WebUiInput as v } from "./input/index.js";
|
|
20
|
+
import { WebUiInputNumber as y } from "./input-number/index.js";
|
|
21
|
+
import { WebUiLayout as b } from "./layout/index.js";
|
|
22
|
+
import { WebUiPopover as x } from "./popover/index.js";
|
|
23
|
+
import { WebUiRadio as S } from "./radio/index.js";
|
|
24
|
+
import { WebUiRadioGroup as C } from "./radio-group/index.js";
|
|
25
|
+
import { WebUiSegmented as w } from "./segmented/index.js";
|
|
26
|
+
import { WebUiSegmentedTrigger as T } from "./segmented-trigger/index.js";
|
|
27
|
+
import { WebUiSelect as E } from "./select/index.js";
|
|
28
|
+
import { WebUiSlider as D } from "./slider/index.js";
|
|
29
|
+
import { WebUiSpinner as O, WebUiSpinnerElement as k } from "./spinner/index.js";
|
|
30
|
+
import { WebUiTextarea as A } from "./textarea/index.js";
|
|
31
|
+
import { WebUiTheme as j } from "./theme/index.js";
|
|
32
|
+
import { toast as M } from "./toast/manager.js";
|
|
33
|
+
import { WebUiToast as N } from "./toast/toast.js";
|
|
33
34
|
import "./toast/index.js";
|
|
34
|
-
import { WebUiSvgDrawLines as
|
|
35
|
-
import { WebUiSwitch as
|
|
36
|
-
import { WebUiTooltip as
|
|
37
|
-
export {
|
|
35
|
+
import { WebUiSvgDrawLines as P } from "./svg-draw-lines/index.js";
|
|
36
|
+
import { WebUiSwitch as F } from "./switch/index.js";
|
|
37
|
+
import { WebUiTooltip as I } from "./tooltip/index.js";
|
|
38
|
+
export { n as WebUiAutocomplete, r as WebUiAvatar, a as WebUiBackTop, o as WebUiBadge, i as WebUiButton, s as WebUiButtonGroup, c as WebUiCheckbox, l as WebUiCheckboxGroup, p as WebUiContextMenu, m as WebUiDialog, h as WebUiDrawer, g as WebUiDropdown, u as WebUiDropdownDivider, d as WebUiDropdownHeader, f as WebUiDropdownItem, _ as WebUiEmpty, e as WebUiIcon, v as WebUiInput, y as WebUiInputNumber, b as WebUiLayout, t as WebUiOption, x as WebUiPopover, S as WebUiRadio, C as WebUiRadioGroup, w as WebUiSegmented, T as WebUiSegmentedTrigger, E as WebUiSelect, D as WebUiSlider, O as WebUiSpinner, k as WebUiSpinnerElement, P as WebUiSvgDrawLines, F as WebUiSwitch, A as WebUiTextarea, j as WebUiTheme, N as WebUiToast, I as WebUiTooltip, M as toast };
|
|
@@ -6,6 +6,7 @@ export declare class WebUiInput extends LitElement {
|
|
|
6
6
|
placeholder: string;
|
|
7
7
|
name: string;
|
|
8
8
|
disabled: boolean;
|
|
9
|
+
readonly: boolean;
|
|
9
10
|
required: boolean;
|
|
10
11
|
clearable: boolean;
|
|
11
12
|
full: boolean;
|
|
@@ -28,6 +29,7 @@ export declare class WebUiInput extends LitElement {
|
|
|
28
29
|
private _syncValidity;
|
|
29
30
|
private _onSlotChange;
|
|
30
31
|
private handleInput;
|
|
32
|
+
private handleNativeChange;
|
|
31
33
|
private handleFocus;
|
|
32
34
|
private handleBlur;
|
|
33
35
|
private handleClear;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import e from "../../_virtual/_@oxc-project_runtime@0.140.0/helpers/esm/decorate.js";
|
|
2
2
|
import "../icon/index.js";
|
|
3
|
-
import t from "../../
|
|
4
|
-
import n from "../../
|
|
3
|
+
import t from "../../icons/generated/jam-close-circle-f.js";
|
|
4
|
+
import n from "../../assets/glass.js";
|
|
5
5
|
import "../button/index.js";
|
|
6
6
|
import r from "./style.js";
|
|
7
7
|
import { LitElement as i, html as a, unsafeCSS as o } from "lit";
|
|
8
8
|
import { customElement as s, property as c, state as l } from "lit/decorators.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { ifDefined as u } from "lit/directives/if-defined.js";
|
|
10
|
+
import { classMap as d } from "lit/directives/class-map.js";
|
|
11
11
|
//#region src/components/input/index.ts
|
|
12
12
|
var f = class extends i {
|
|
13
13
|
constructor(...e) {
|
|
14
|
-
super(...e), this.type = "text", this.placeholder = "", this.name = "", this.disabled = !1, this.required = !1, this.clearable = !1, this.full = !1, this.borderless = !1, this.ariaLabel = null, this._value = "", this._focused = !1, this._formDisabled = !1, this._hasPrefix = !1, this._hasSuffix = !1;
|
|
14
|
+
super(...e), this.type = "text", this.placeholder = "", this.name = "", this.disabled = !1, this.readonly = !1, this.required = !1, this.clearable = !1, this.full = !1, this.borderless = !1, this.ariaLabel = null, this._value = "", this._focused = !1, this._formDisabled = !1, this._hasPrefix = !1, this._hasSuffix = !1;
|
|
15
15
|
}
|
|
16
16
|
static {
|
|
17
17
|
this.formAssociated = !0;
|
|
18
18
|
}
|
|
19
19
|
static {
|
|
20
|
-
this.styles = [o(
|
|
20
|
+
this.styles = [o(n), o(r)];
|
|
21
21
|
}
|
|
22
22
|
get value() {
|
|
23
23
|
return this._value;
|
|
@@ -64,7 +64,13 @@ var f = class extends i {
|
|
|
64
64
|
t.name === "prefix" && (this._hasPrefix = n), t.name === "suffix" && (this._hasSuffix = n);
|
|
65
65
|
}
|
|
66
66
|
handleInput(e) {
|
|
67
|
-
e.target instanceof HTMLInputElement && (this._value = e.target.value, this._internals?.setFormValue?.(this._value), this._syncValidity());
|
|
67
|
+
this._isDisabled || this.readonly || e.target instanceof HTMLInputElement && (this._value = e.target.value, this._internals?.setFormValue?.(this._value), this._syncValidity());
|
|
68
|
+
}
|
|
69
|
+
handleNativeChange(e) {
|
|
70
|
+
this.readonly || e.target instanceof HTMLInputElement && (this._value = e.target.value, this._internals?.setFormValue?.(this._value), this._syncValidity(), this.dispatchEvent(new Event("change", {
|
|
71
|
+
bubbles: !0,
|
|
72
|
+
composed: !0
|
|
73
|
+
})));
|
|
68
74
|
}
|
|
69
75
|
handleFocus() {
|
|
70
76
|
this._isDisabled || (this._focused = !0);
|
|
@@ -73,7 +79,7 @@ var f = class extends i {
|
|
|
73
79
|
this._focused = !1;
|
|
74
80
|
}
|
|
75
81
|
handleClear() {
|
|
76
|
-
this._isDisabled || (this._value = "", this._internals?.setFormValue?.(""), this._syncValidity(), this.dispatchEvent(new Event("input", {
|
|
82
|
+
this._isDisabled || this.readonly || (this._value = "", this._internals?.setFormValue?.(""), this._syncValidity(), this.dispatchEvent(new Event("input", {
|
|
77
83
|
bubbles: !0,
|
|
78
84
|
composed: !0
|
|
79
85
|
})));
|
|
@@ -85,19 +91,21 @@ var f = class extends i {
|
|
|
85
91
|
this._isDisabled || this.shadowRoot?.querySelector("input")?.focus();
|
|
86
92
|
}
|
|
87
93
|
render() {
|
|
88
|
-
let e = this.clearable && this._value;
|
|
94
|
+
let e = this.clearable && this._value && !this.readonly;
|
|
89
95
|
return a`
|
|
90
96
|
<div class="wui-glass wui-input-inner" @click=${this.focusInput}>
|
|
91
|
-
<slot name="prefix" class=${
|
|
97
|
+
<slot name="prefix" class=${d({ empty: !this._hasPrefix })} @slotchange=${this._onSlotChange}></slot>
|
|
92
98
|
<input
|
|
93
99
|
type=${this.type}
|
|
94
100
|
placeholder=${this.placeholder}
|
|
95
101
|
name=${this.name}
|
|
96
|
-
aria-label=${
|
|
102
|
+
aria-label=${u(this.ariaLabel)}
|
|
97
103
|
?disabled=${this._isDisabled}
|
|
104
|
+
?readonly=${this.readonly}
|
|
98
105
|
?required=${this.required}
|
|
99
106
|
.value=${this._value}
|
|
100
107
|
@input=${this.handleInput}
|
|
108
|
+
@change=${this.handleNativeChange}
|
|
101
109
|
@focus=${this.handleFocus}
|
|
102
110
|
@blur=${this.handleBlur}
|
|
103
111
|
/>
|
|
@@ -109,9 +117,9 @@ var f = class extends i {
|
|
|
109
117
|
@pointerdown=${this.preventMouseDownBlur}
|
|
110
118
|
@click=${this.handleClear}
|
|
111
119
|
>
|
|
112
|
-
<web-ui-icon .icon=${
|
|
120
|
+
<web-ui-icon .icon=${t}></web-ui-icon>
|
|
113
121
|
</web-ui-button>` : ""}
|
|
114
|
-
<slot name="suffix" class=${
|
|
122
|
+
<slot name="suffix" class=${d({ empty: !this._hasSuffix })} @slotchange=${this._onSlotChange}></slot>
|
|
115
123
|
</div>
|
|
116
124
|
`;
|
|
117
125
|
}
|
|
@@ -131,6 +139,9 @@ e([c({
|
|
|
131
139
|
})], f.prototype, "disabled", void 0), e([c({
|
|
132
140
|
type: Boolean,
|
|
133
141
|
reflect: !0
|
|
142
|
+
})], f.prototype, "readonly", void 0), e([c({
|
|
143
|
+
type: Boolean,
|
|
144
|
+
reflect: !0
|
|
134
145
|
})], f.prototype, "required", void 0), e([c({
|
|
135
146
|
type: Boolean,
|
|
136
147
|
reflect: !0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/input/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\nimport '@/components/icon'\nimport '@/components/button'\nimport glass from '@/assets/glass.css?inline'\nimport { jamCloseCircleF } from '@/icons'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-input')\nexport class WebUiInput extends LitElement {\n static formAssociated = true\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @property({ type: String, reflect: true }) type = 'text'\n @property({ type: String, reflect: true }) placeholder = ''\n @property({ type: String, reflect: true }) name = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) required = false\n @property({ type: Boolean, reflect: true }) clearable = false\n @property({ type: Boolean, reflect: true }) full = false\n @property({ type: Boolean, reflect: true }) borderless = false\n @property({ type: String, attribute: 'aria-label' }) override ariaLabel: string | null = null\n\n @state() private _value = ''\n @state() private _focused = false\n @state() private _formDisabled = false\n @state() private _hasPrefix = false\n @state() private _hasSuffix = false\n\n private _internals?: ElementInternals\n\n @property({ type: String, reflect: true })\n get value(): string {\n return this._value\n }\n\n set value(v: string) {\n const old = this._value\n this._value = v\n this._internals?.setFormValue?.(v)\n this.requestUpdate('value', old)\n }\n\n private get _isDisabled(): boolean {\n return this.disabled || this._formDisabled\n }\n\n override connectedCallback() {\n super.connectedCallback()\n if (!this._internals) {\n this._internals = this.attachInternals()\n }\n this._internals.setFormValue?.(this._value)\n }\n\n override updated(changed: Map<string, unknown>) {\n if (changed.has('_value')) {\n const input = this.shadowRoot?.querySelector('input')\n if (input && input.value !== this._value) {\n input.value = this._value\n }\n }\n this._syncValidity()\n this.toggleAttribute('focused', this._focused)\n }\n\n formResetCallback() {\n this.value = this.getAttribute('value') || ''\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n if (typeof state === 'string') this.value = state\n }\n\n private _syncValidity() {\n const input = this.shadowRoot?.querySelector('input')\n if (!this._internals || !input || typeof this._internals.setValidity !== 'function') return\n if (this._isDisabled || input.validity.valid) {\n this._internals.setValidity({})\n return\n }\n\n const flags: ValidityStateFlags = {}\n if (input.validity.valueMissing) flags.valueMissing = true\n if (input.validity.typeMismatch) flags.typeMismatch = true\n if (input.validity.patternMismatch) flags.patternMismatch = true\n if (input.validity.tooLong) flags.tooLong = true\n if (input.validity.tooShort) flags.tooShort = true\n this._internals.setValidity(flags, input.validationMessage, input)\n }\n\n private _onSlotChange(e: Event) {\n if (!(e.target instanceof HTMLSlotElement)) return\n const slot = e.target\n const hasContent = slot.assignedElements().length > 0\n if (slot.name === 'prefix') this._hasPrefix = hasContent\n if (slot.name === 'suffix') this._hasSuffix = hasContent\n }\n\n private handleInput(e: Event) {\n if (!(e.target instanceof HTMLInputElement)) return\n this._value = e.target.value\n this._internals?.setFormValue?.(this._value)\n this._syncValidity()\n }\n\n private handleFocus() {\n if (!this._isDisabled) this._focused = true\n }\n\n private handleBlur() {\n this._focused = false\n }\n\n private handleClear() {\n if (this._isDisabled) return\n this._value = ''\n this._internals?.setFormValue?.('')\n this._syncValidity()\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n }\n\n private preventMouseDownBlur(e: Event) {\n e.preventDefault()\n }\n\n private focusInput() {\n if (this._isDisabled) return\n this.shadowRoot?.querySelector('input')?.focus()\n }\n\n override render() {\n const showClear = this.clearable && this._value\n\n return html`\n <div class=\"wui-glass wui-input-inner\" @click=${this.focusInput}>\n <slot name=\"prefix\" class=${classMap({ empty: !this._hasPrefix })} @slotchange=${this._onSlotChange}></slot>\n <input\n type=${this.type}\n placeholder=${this.placeholder}\n name=${this.name}\n aria-label=${ifDefined(this.ariaLabel)}\n ?disabled=${this._isDisabled}\n ?required=${this.required}\n .value=${this._value}\n @input=${this.handleInput}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n />\n ${showClear\n ? html`<web-ui-button\n icon\n variant=\"ghost\"\n size=\"24\"\n aria-label=\"清除\"\n @pointerdown=${this.preventMouseDownBlur}\n @click=${this.handleClear}\n >\n <web-ui-icon .icon=${jamCloseCircleF}></web-ui-icon>\n </web-ui-button>`\n : ''}\n <slot name=\"suffix\" class=${classMap({ empty: !this._hasSuffix })} @slotchange=${this._onSlotChange}></slot>\n </div>\n `\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n focus: FocusEvent\n blur: FocusEvent\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-input': WebUiInput\n }\n}\n"],"mappings":";;;;;;;;;;;AAaO,IAAM,IAAN,cAAyB,EAAW;;EAkBX,aAdoB,KAAA,OAAA,QACO,KAAA,cAAA,IACP,KAAA,OAAA,IACK,KAAA,WAAA,IACA,KAAA,WAAA,IACC,KAAA,YAAA,IACL,KAAA,OAAA,IACM,KAAA,aAAA,IACgC,KAAA,YAAA,MAE/D,KAAA,SAAA,IACE,KAAA,WAAA,IACK,KAAA,gBAAA,IACH,KAAA,aAAA,IACA,KAAA,aAAA;;;EAjBN,KAAA,iBAAA;;;EACC,KAAA,SAAA,CAAC,EAAU,CAAK,GAAG,EAAU,CAAK,CAAC;;CAoB5D,IACI,QAAgB;EAClB,OAAO,KAAK;CACd;CAEA,IAAI,MAAM,GAAW;EACnB,IAAM,IAAM,KAAK;EAGjB,AAFA,KAAK,SAAS,GACd,KAAK,YAAY,eAAe,CAAC,GACjC,KAAK,cAAc,SAAS,CAAG;CACjC;CAEA,IAAY,cAAuB;EACjC,OAAO,KAAK,YAAY,KAAK;CAC/B;CAEA,oBAA6B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AAA,CAAA,EAAc,cAAc,CAAA,GAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/input/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\nimport '@/components/icon'\nimport '@/components/button'\nimport glass from '@/assets/glass.css?inline'\nimport { jamCloseCircleF } from '@/icons'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-input')\nexport class WebUiInput extends LitElement {\n static formAssociated = true\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @property({ type: String, reflect: true }) type = 'text'\n @property({ type: String, reflect: true }) placeholder = ''\n @property({ type: String, reflect: true }) name = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) readonly = false\n @property({ type: Boolean, reflect: true }) required = false\n @property({ type: Boolean, reflect: true }) clearable = false\n @property({ type: Boolean, reflect: true }) full = false\n @property({ type: Boolean, reflect: true }) borderless = false\n @property({ type: String, attribute: 'aria-label' }) override ariaLabel: string | null = null\n\n @state() private _value = ''\n @state() private _focused = false\n @state() private _formDisabled = false\n @state() private _hasPrefix = false\n @state() private _hasSuffix = false\n\n private _internals?: ElementInternals\n\n @property({ type: String, reflect: true })\n get value(): string {\n return this._value\n }\n\n set value(v: string) {\n const old = this._value\n this._value = v\n this._internals?.setFormValue?.(v)\n this.requestUpdate('value', old)\n }\n\n private get _isDisabled(): boolean {\n return this.disabled || this._formDisabled\n }\n\n override connectedCallback() {\n super.connectedCallback()\n if (!this._internals) {\n this._internals = this.attachInternals()\n }\n this._internals.setFormValue?.(this._value)\n }\n\n override updated(changed: Map<string, unknown>) {\n if (changed.has('_value')) {\n const input = this.shadowRoot?.querySelector('input')\n if (input && input.value !== this._value) {\n input.value = this._value\n }\n }\n this._syncValidity()\n this.toggleAttribute('focused', this._focused)\n }\n\n formResetCallback() {\n this.value = this.getAttribute('value') || ''\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formDisabled = disabled\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n if (typeof state === 'string') this.value = state\n }\n\n private _syncValidity() {\n const input = this.shadowRoot?.querySelector('input')\n if (!this._internals || !input || typeof this._internals.setValidity !== 'function') return\n if (this._isDisabled || input.validity.valid) {\n this._internals.setValidity({})\n return\n }\n\n const flags: ValidityStateFlags = {}\n if (input.validity.valueMissing) flags.valueMissing = true\n if (input.validity.typeMismatch) flags.typeMismatch = true\n if (input.validity.patternMismatch) flags.patternMismatch = true\n if (input.validity.tooLong) flags.tooLong = true\n if (input.validity.tooShort) flags.tooShort = true\n this._internals.setValidity(flags, input.validationMessage, input)\n }\n\n private _onSlotChange(e: Event) {\n if (!(e.target instanceof HTMLSlotElement)) return\n const slot = e.target\n const hasContent = slot.assignedElements().length > 0\n if (slot.name === 'prefix') this._hasPrefix = hasContent\n if (slot.name === 'suffix') this._hasSuffix = hasContent\n }\n\n private handleInput(e: Event) {\n if (this._isDisabled || this.readonly) return\n if (!(e.target instanceof HTMLInputElement)) return\n this._value = e.target.value\n this._internals?.setFormValue?.(this._value)\n this._syncValidity()\n }\n\n // 原生 change 不 composed,被 shadow root 挡住;这里补发 composed 事件,\n // 兑现 $events/README 声明的公共 change 契约。\n private handleNativeChange(e: Event) {\n if (this.readonly) return\n if (!(e.target instanceof HTMLInputElement)) return\n this._value = e.target.value\n this._internals?.setFormValue?.(this._value)\n this._syncValidity()\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n\n private handleFocus() {\n if (!this._isDisabled) this._focused = true\n }\n\n private handleBlur() {\n this._focused = false\n }\n\n private handleClear() {\n if (this._isDisabled || this.readonly) return\n this._value = ''\n this._internals?.setFormValue?.('')\n this._syncValidity()\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n }\n\n private preventMouseDownBlur(e: Event) {\n e.preventDefault()\n }\n\n private focusInput() {\n if (this._isDisabled) return\n this.shadowRoot?.querySelector('input')?.focus()\n }\n\n override render() {\n // readonly 下不可清除:清空按钮会修改值,与只读语义冲突\n const showClear = this.clearable && this._value && !this.readonly\n\n return html`\n <div class=\"wui-glass wui-input-inner\" @click=${this.focusInput}>\n <slot name=\"prefix\" class=${classMap({ empty: !this._hasPrefix })} @slotchange=${this._onSlotChange}></slot>\n <input\n type=${this.type}\n placeholder=${this.placeholder}\n name=${this.name}\n aria-label=${ifDefined(this.ariaLabel)}\n ?disabled=${this._isDisabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n .value=${this._value}\n @input=${this.handleInput}\n @change=${this.handleNativeChange}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n />\n ${showClear\n ? html`<web-ui-button\n icon\n variant=\"ghost\"\n size=\"24\"\n aria-label=\"清除\"\n @pointerdown=${this.preventMouseDownBlur}\n @click=${this.handleClear}\n >\n <web-ui-icon .icon=${jamCloseCircleF}></web-ui-icon>\n </web-ui-button>`\n : ''}\n <slot name=\"suffix\" class=${classMap({ empty: !this._hasSuffix })} @slotchange=${this._onSlotChange}></slot>\n </div>\n `\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n focus: FocusEvent\n blur: FocusEvent\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-input': WebUiInput\n }\n}\n"],"mappings":";;;;;;;;;;;AAaO,IAAM,IAAN,cAAyB,EAAW;;EAmBX,aAfoB,KAAA,OAAA,QACO,KAAA,cAAA,IACP,KAAA,OAAA,IACK,KAAA,WAAA,IACA,KAAA,WAAA,IACA,KAAA,WAAA,IACC,KAAA,YAAA,IACL,KAAA,OAAA,IACM,KAAA,aAAA,IACgC,KAAA,YAAA,MAE/D,KAAA,SAAA,IACE,KAAA,WAAA,IACK,KAAA,gBAAA,IACH,KAAA,aAAA,IACA,KAAA,aAAA;;;EAlBN,KAAA,iBAAA;;;EACC,KAAA,SAAA,CAAC,EAAU,CAAK,GAAG,EAAU,CA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AAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAa,CAAC,CAAA,GAAA,EAAA,WAAA,aAAA,KAAA,CAAA,GAElD,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,UAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,iBAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,GACN,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,cAAA,KAAA,CAAA,GAIN,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,SAAA,IAAA,GAxB1C,IAAA,EAAA,CAAA,EAAc,cAAc,CAAA,GAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/components/input/style.css?inline
|
|
2
|
-
var e = "*,:before,:after{box-sizing:border-box}:host{display:inline-block}:host([disabled]){cursor:not-allowed;opacity:.4}.wui-input-inner{box-sizing:border-box;width:var(--wui-input-width,200px);min-width:var(--wui-button-size,40px);height:var(--wui-button-size,40px);transition:border-color var(--wui-duration-focus,.2s), box-shadow var(--wui-duration-focus,.2s);border-radius:2147483647px;align-items:center;gap:8px;padding:0 12px;display:flex;position:relative}:host([full]){display:block}:host([full]) .wui-input-inner{width:100%}:host([borderless]) .wui-input-inner{-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:none;background:0 0;border:none;padding:0}:host([focused]) .wui-input-inner{--wui-glass-shadow:var(--wui-shadow-glass,0 2px 16px #0000000f), 0 0 0 3px var(--wui-focus-ring,#08f6);border-color:var(--wui-color-border-strong,#006ee680)}:host([borderless][focused]) .wui-input-inner{box-shadow:none;border-color:#0000}input{min-width:0;height:100%;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);background:0 0;border:none;outline:none;flex:1}input::placeholder{color:var(--wui-color-text-muted,#6a6a6a)}input:disabled{cursor:not-allowed;opacity:.4}slot{font-size:var(--wui-font-size,14px);color:var(--wui-color-text-muted,#6a6a6a);flex-shrink:0;align-items:center;display:flex}slot.empty{display:none}.wui-input-inner web-ui-button[variant=ghost]{--wui-button-color:var(--wui-color-text-muted,#6a6a6a);margin-left:-8px}";
|
|
2
|
+
var e = "*,:before,:after{box-sizing:border-box}:host{display:inline-block}:host([disabled]){cursor:not-allowed;opacity:.4}.wui-input-inner{box-sizing:border-box;width:var(--wui-input-width,200px);min-width:var(--wui-button-size,40px);height:var(--wui-button-size,40px);transition:border-color var(--wui-duration-focus,.2s), box-shadow var(--wui-duration-focus,.2s);border-radius:2147483647px;align-items:center;gap:8px;padding:0 12px;display:flex;position:relative}:host([full]){display:block}:host([full]) .wui-input-inner{width:100%}:host([borderless]) .wui-input-inner{-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:none;background:0 0;border:none;padding:0}:host([focused]) .wui-input-inner{--wui-glass-shadow:var(--wui-shadow-glass,0 2px 16px #0000000f), 0 0 0 3px var(--wui-focus-ring,#08f6);border-color:var(--wui-color-border-strong,#006ee680)}:host([borderless][focused]) .wui-input-inner{box-shadow:none;border-color:#0000}input{min-width:0;height:100%;font:inherit;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);background:0 0;border:none;outline:none;flex:1;margin:0;padding:0}input::placeholder{color:var(--wui-color-text-muted,#6a6a6a)}input:disabled{cursor:not-allowed;opacity:.4}slot{font-size:var(--wui-font-size,14px);color:var(--wui-color-text-muted,#6a6a6a);flex-shrink:0;align-items:center;display:flex}slot.empty{display:none}.wui-input-inner web-ui-button[variant=ghost]{--wui-button-color:var(--wui-color-text-muted,#6a6a6a);margin-left:-8px}";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { e as default };
|
|
5
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","names":[],"sources":["../../../src/components/input/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: inline-block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.wui-input-inner {\n position: relative;\n\n display: flex;\n gap: 8px;\n align-items: center;\n\n box-sizing: border-box;\n width: var(--wui-input-width, 200px);\n min-width: var(--wui-button-size, 40px);\n height: var(--wui-button-size, 40px);\n padding: 0 12px;\n border-radius: calc(infinity * 1px);\n\n transition:\n border-color var(--wui-duration-focus, 200ms),\n box-shadow var(--wui-duration-focus, 200ms);\n}\n\n:host([full]) {\n display: block;\n}\n\n:host([full]) .wui-input-inner {\n width: 100%;\n}\n\n/* ===== Borderless ===== */\n\n:host([borderless]) .wui-input-inner {\n padding: 0;\n border: none;\n\n background: transparent;\n backdrop-filter: none;\n box-shadow: none;\n}\n\n:host([focused]) .wui-input-inner {\n --wui-glass-shadow:\n var(--wui-shadow-glass, 0 2px 16px rgb(0 0 0 / 0.06)), 0 0 0 3px var(--wui-focus-ring, rgb(0 136 255 / 0.4));\n border-color: var(--wui-color-border-strong, rgb(0 110 230 / 0.5));\n}\n\n:host([borderless][focused]) .wui-input-inner {\n border-color: transparent;\n box-shadow: none;\n}\n\n/* ===== Input ===== */\n\ninput {\n flex: 1;\n\n min-width: 0;\n height: 100%;\n border: none;\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n\n background: transparent;\n outline: none;\n\n &::placeholder {\n color: var(--wui-color-text-muted, #6a6a6a);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\n}\n\n/* ===== Prefix / Suffix ===== */\n\nslot {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text-muted, #6a6a6a);\n}\n\n/* slot 无 slotted 内容时折叠 */\nslot.empty {\n display: none;\n}\n\n/* ===== Clear button ===== */\n\n/* 复用 web-ui-button icon ghost:仅覆盖颜色为 muted,保持原清除图标观感;\n 负 margin-left 抵消容器 8px flex gap,让清除按钮紧贴输入文本 */\n.wui-input-inner web-ui-button[variant='ghost'] {\n --wui-button-color: var(--wui-color-text-muted, #6a6a6a);\n margin-left: -8px;\n}\n\n/* ===== Disabled ===== */\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"style.js","names":[],"sources":["../../../src/components/input/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n display: inline-block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n opacity: 0.4;\n}\n\n.wui-input-inner {\n position: relative;\n\n display: flex;\n gap: 8px;\n align-items: center;\n\n box-sizing: border-box;\n width: var(--wui-input-width, 200px);\n min-width: var(--wui-button-size, 40px);\n height: var(--wui-button-size, 40px);\n padding: 0 12px;\n border-radius: calc(infinity * 1px);\n\n transition:\n border-color var(--wui-duration-focus, 200ms),\n box-shadow var(--wui-duration-focus, 200ms);\n}\n\n:host([full]) {\n display: block;\n}\n\n:host([full]) .wui-input-inner {\n width: 100%;\n}\n\n/* ===== Borderless ===== */\n\n:host([borderless]) .wui-input-inner {\n padding: 0;\n border: none;\n\n background: transparent;\n backdrop-filter: none;\n box-shadow: none;\n}\n\n:host([focused]) .wui-input-inner {\n --wui-glass-shadow:\n var(--wui-shadow-glass, 0 2px 16px rgb(0 0 0 / 0.06)), 0 0 0 3px var(--wui-focus-ring, rgb(0 136 255 / 0.4));\n border-color: var(--wui-color-border-strong, rgb(0 110 230 / 0.5));\n}\n\n:host([borderless][focused]) .wui-input-inner {\n border-color: transparent;\n box-shadow: none;\n}\n\n/* ===== Input ===== */\n\ninput {\n flex: 1;\n\n min-width: 0;\n height: 100%;\n margin: 0;\n padding: 0;\n border: none;\n\n /* 表单控件不继承字体;显式继承以对齐宿主排版,避免 UA 默认字体差异 */\n font: inherit;\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text, #1b1b1b);\n\n background: transparent;\n outline: none;\n\n &::placeholder {\n color: var(--wui-color-text-muted, #6a6a6a);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.4;\n }\n}\n\n/* ===== Prefix / Suffix ===== */\n\nslot {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n\n font-size: var(--wui-font-size, 14px);\n color: var(--wui-color-text-muted, #6a6a6a);\n}\n\n/* slot 无 slotted 内容时折叠 */\nslot.empty {\n display: none;\n}\n\n/* ===== Clear button ===== */\n\n/* 复用 web-ui-button icon ghost:仅覆盖颜色为 muted,保持原清除图标观感;\n 负 margin-left 抵消容器 8px flex gap,让清除按钮紧贴输入文本 */\n.wui-input-inner web-ui-button[variant='ghost'] {\n --wui-button-color: var(--wui-color-text-muted, #6a6a6a);\n margin-left: -8px;\n}\n\n/* ===== Disabled ===== */\n"],"mappings":""}
|
|
@@ -5,6 +5,7 @@ export declare class WebUiInputNumber extends LitElement {
|
|
|
5
5
|
placeholder: string;
|
|
6
6
|
name: string;
|
|
7
7
|
disabled: boolean;
|
|
8
|
+
readonly: boolean;
|
|
8
9
|
required: boolean;
|
|
9
10
|
get precision(): number;
|
|
10
11
|
set precision(v: number);
|
|
@@ -39,6 +40,7 @@ export declare class WebUiInputNumber extends LitElement {
|
|
|
39
40
|
private setValueAndNotify;
|
|
40
41
|
private handleStep;
|
|
41
42
|
private handleInput;
|
|
43
|
+
private handleNativeChange;
|
|
42
44
|
private handleKeydown;
|
|
43
45
|
private handleFocus;
|
|
44
46
|
private handleBlur;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import e from "../../_virtual/_@oxc-project_runtime@0.140.0/helpers/esm/decorate.js";
|
|
2
2
|
import "../icon/index.js";
|
|
3
|
-
import t from "../../
|
|
4
|
-
import n from "../../icons/generated/lucide-
|
|
5
|
-
import r from "../../
|
|
3
|
+
import t from "../../icons/generated/lucide-plus.js";
|
|
4
|
+
import n from "../../icons/generated/lucide-minus.js";
|
|
5
|
+
import r from "../../assets/glass.js";
|
|
6
6
|
import { normalizeNumber as i } from "../../shared/normalize/index.js";
|
|
7
7
|
import a from "./style.js";
|
|
8
8
|
import { LitElement as o, html as s, unsafeCSS as c } from "lit";
|
|
@@ -10,13 +10,13 @@ import { customElement as l, property as u, state as d } from "lit/decorators.js
|
|
|
10
10
|
//#region src/components/input-number/index.ts
|
|
11
11
|
var f = class extends o {
|
|
12
12
|
constructor(...e) {
|
|
13
|
-
super(...e), this.placeholder = "", this.name = "", this.disabled = !1, this.required = !1, this._value = 0, this._min = 0, this._max = Infinity, this._step = 1, this._focused = !1, this._formDisabled = !1, this._precision = 0;
|
|
13
|
+
super(...e), this.placeholder = "", this.name = "", this.disabled = !1, this.readonly = !1, this.required = !1, this._value = 0, this._min = 0, this._max = Infinity, this._step = 1, this._focused = !1, this._formDisabled = !1, this._precision = 0;
|
|
14
14
|
}
|
|
15
15
|
static {
|
|
16
16
|
this.formAssociated = !0;
|
|
17
17
|
}
|
|
18
18
|
static {
|
|
19
|
-
this.styles = [c(
|
|
19
|
+
this.styles = [c(r), c(a)];
|
|
20
20
|
}
|
|
21
21
|
get precision() {
|
|
22
22
|
return this._precision;
|
|
@@ -104,15 +104,23 @@ var f = class extends o {
|
|
|
104
104
|
}));
|
|
105
105
|
}
|
|
106
106
|
handleStep(e) {
|
|
107
|
-
this._isDisabled || this.setValueAndNotify(this._value + e * this._effectiveStep);
|
|
107
|
+
this._isDisabled || this.readonly || this.setValueAndNotify(this._value + e * this._effectiveStep);
|
|
108
108
|
}
|
|
109
109
|
handleInput(e) {
|
|
110
|
-
if (!(e.target instanceof HTMLInputElement)) return;
|
|
110
|
+
if (this.readonly || !(e.target instanceof HTMLInputElement)) return;
|
|
111
111
|
let t = e.target.value;
|
|
112
112
|
t !== "" && t !== "-" && (this._value = this.clamp(this.round(Number(t))), this._internals?.setFormValue?.(String(this._value)), this._syncValidity());
|
|
113
113
|
}
|
|
114
|
+
handleNativeChange(e) {
|
|
115
|
+
if (this.readonly || !(e.target instanceof HTMLInputElement)) return;
|
|
116
|
+
let t = e.target.value;
|
|
117
|
+
t !== "" && t !== "-" && (this._value = this.clamp(this.round(Number(t))), this._internals?.setFormValue?.(String(this._value)), this._syncValidity(), this.dispatchEvent(new Event("change", {
|
|
118
|
+
bubbles: !0,
|
|
119
|
+
composed: !0
|
|
120
|
+
})));
|
|
121
|
+
}
|
|
114
122
|
handleKeydown(e) {
|
|
115
|
-
this._isDisabled || (e.key === "ArrowUp" ? (e.preventDefault(), this.setValueAndNotify(this._value + this._effectiveStep), this.dispatchEvent(new Event("change", {
|
|
123
|
+
this._isDisabled || this.readonly || (e.key === "ArrowUp" ? (e.preventDefault(), this.setValueAndNotify(this._value + this._effectiveStep), this.dispatchEvent(new Event("change", {
|
|
116
124
|
bubbles: !0,
|
|
117
125
|
composed: !0
|
|
118
126
|
}))) : e.key === "ArrowDown" && (e.preventDefault(), this.setValueAndNotify(this._value - this._effectiveStep), this.dispatchEvent(new Event("change", {
|
|
@@ -132,10 +140,10 @@ var f = class extends o {
|
|
|
132
140
|
<button
|
|
133
141
|
class="num-btn"
|
|
134
142
|
aria-label="Decrease"
|
|
135
|
-
?disabled=${this._isDisabled || this.atMin}
|
|
143
|
+
?disabled=${this._isDisabled || this.readonly || this.atMin}
|
|
136
144
|
@click=${() => this.handleStep(-1)}
|
|
137
145
|
>
|
|
138
|
-
<web-ui-icon .icon=${
|
|
146
|
+
<web-ui-icon .icon=${n}></web-ui-icon>
|
|
139
147
|
</button>
|
|
140
148
|
<input
|
|
141
149
|
type="number"
|
|
@@ -143,8 +151,10 @@ var f = class extends o {
|
|
|
143
151
|
name=${this.name}
|
|
144
152
|
.value=${String(this._value)}
|
|
145
153
|
?disabled=${this._isDisabled}
|
|
154
|
+
?readonly=${this.readonly}
|
|
146
155
|
?required=${this.required}
|
|
147
156
|
@input=${this.handleInput}
|
|
157
|
+
@change=${this.handleNativeChange}
|
|
148
158
|
@keydown=${this.handleKeydown}
|
|
149
159
|
@focus=${this.handleFocus}
|
|
150
160
|
@blur=${this.handleBlur}
|
|
@@ -152,10 +162,10 @@ var f = class extends o {
|
|
|
152
162
|
<button
|
|
153
163
|
class="num-btn"
|
|
154
164
|
aria-label="Increase"
|
|
155
|
-
?disabled=${this._isDisabled || this.atMax}
|
|
165
|
+
?disabled=${this._isDisabled || this.readonly || this.atMax}
|
|
156
166
|
@click=${() => this.handleStep(1)}
|
|
157
167
|
>
|
|
158
|
-
<web-ui-icon .icon=${
|
|
168
|
+
<web-ui-icon .icon=${t}></web-ui-icon>
|
|
159
169
|
</button>
|
|
160
170
|
</div>
|
|
161
171
|
`;
|
|
@@ -173,6 +183,9 @@ e([u({
|
|
|
173
183
|
})], f.prototype, "disabled", void 0), e([u({
|
|
174
184
|
type: Boolean,
|
|
175
185
|
reflect: !0
|
|
186
|
+
})], f.prototype, "readonly", void 0), e([u({
|
|
187
|
+
type: Boolean,
|
|
188
|
+
reflect: !0
|
|
176
189
|
})], f.prototype, "required", void 0), e([u({
|
|
177
190
|
type: Number,
|
|
178
191
|
reflect: !0
|