@greypan/web-ui 8.0.0 → 9.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 +277 -146
- package/README.md +323 -191
- package/dist/assets/glass.js +1 -1
- package/dist/assets/glass.js.map +1 -1
- package/dist/assets/menu-portal.js +1 -1
- package/dist/assets/menu-portal.js.map +1 -1
- package/dist/assets/selection-control.js +1 -1
- package/dist/assets/selection-control.js.map +1 -1
- package/dist/assets/toast-containers.js +1 -1
- package/dist/assets/toast-containers.js.map +1 -1
- package/dist/components/autocomplete/index.d.ts +3 -2
- package/dist/components/autocomplete/index.js +46 -50
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/autocomplete/style.js +1 -1
- package/dist/components/autocomplete/style.js.map +1 -1
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/avatar/style.js +1 -1
- package/dist/components/avatar/style.js.map +1 -1
- package/dist/components/back-top/style.js +1 -1
- package/dist/components/back-top/style.js.map +1 -1
- package/dist/components/badge/style.js +1 -1
- package/dist/components/badge/style.js.map +1 -1
- package/dist/components/button/index.d.ts +368 -1
- package/dist/components/button/index.js +56 -36
- 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.js +0 -1
- package/dist/components/button-group/index.js.map +1 -1
- package/dist/components/button-group/style.js +1 -1
- package/dist/components/button-group/style.js.map +1 -1
- package/dist/components/checkbox/index.d.ts +3 -0
- package/dist/components/checkbox/index.js +35 -37
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox/style.js +1 -1
- package/dist/components/checkbox/style.js.map +1 -1
- package/dist/components/checkbox-group/index.js +8 -8
- package/dist/components/checkbox-group/style.js +1 -1
- package/dist/components/checkbox-group/style.js.map +1 -1
- package/dist/components/context-menu/index.d.ts +167 -3
- package/dist/components/context-menu/index.js +162 -91
- package/dist/components/context-menu/index.js.map +1 -1
- package/dist/components/context-menu/scrim.js +6 -0
- package/dist/components/context-menu/scrim.js.map +1 -0
- package/dist/components/context-menu/style.js +1 -1
- package/dist/components/context-menu/style.js.map +1 -1
- package/dist/components/dialog/index.d.ts +9 -0
- package/dist/components/dialog/index.js +61 -46
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/dialog/style.js +1 -1
- package/dist/components/dialog/style.js.map +1 -1
- package/dist/components/drawer/index.d.ts +45 -0
- package/dist/components/drawer/index.js +116 -52
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/drawer/style.js +1 -1
- package/dist/components/drawer/style.js.map +1 -1
- package/dist/components/dropdown/index.d.ts +12 -0
- package/dist/components/dropdown/index.js +13 -10
- package/dist/components/dropdown/index.js.map +1 -1
- package/dist/components/dropdown-divider/style.js +1 -1
- package/dist/components/dropdown-divider/style.js.map +1 -1
- package/dist/components/dropdown-header/style.js +1 -1
- package/dist/components/dropdown-header/style.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/editable-text/index.d.ts +41 -0
- package/dist/components/editable-text/index.js +55 -31
- package/dist/components/editable-text/index.js.map +1 -1
- package/dist/components/empty/index.d.ts +21 -4
- package/dist/components/empty/index.js +37 -32
- package/dist/components/empty/index.js.map +1 -1
- package/dist/components/empty/style.js +1 -1
- package/dist/components/empty/style.js.map +1 -1
- package/dist/components/icon/index.js +7 -7
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/image-preview/index.js +9 -2
- package/dist/components/image-preview/index.js.map +1 -1
- package/dist/components/image-preview/style.js +1 -1
- package/dist/components/image-preview/style.js.map +1 -1
- package/dist/components/index.js +23 -23
- package/dist/components/input/index.d.ts +7 -0
- package/dist/components/input/index.js +34 -29
- 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 +1 -0
- package/dist/components/input-number/index.js +28 -26
- 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 -3
- package/dist/components/layout/index.js +1 -1
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/style.js +1 -1
- package/dist/components/layout/style.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.map +1 -1
- package/dist/components/popover/style.js +1 -1
- package/dist/components/popover/style.js.map +1 -1
- package/dist/components/radio/index.d.ts +3 -0
- package/dist/components/radio/index.js +23 -19
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/radio/style.js +1 -1
- package/dist/components/radio/style.js.map +1 -1
- package/dist/components/radio-group/index.js +8 -8
- package/dist/components/radio-group/style.js +1 -1
- package/dist/components/radio-group/style.js.map +1 -1
- package/dist/components/segmented/index.d.ts +5 -0
- package/dist/components/segmented/index.js +49 -32
- package/dist/components/segmented/index.js.map +1 -1
- package/dist/components/segmented/style.js +1 -1
- package/dist/components/segmented/style.js.map +1 -1
- package/dist/components/segmented-trigger/style.js +1 -1
- package/dist/components/segmented-trigger/style.js.map +1 -1
- package/dist/components/select/index.js +0 -1
- 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/slider/index.js +9 -9
- package/dist/components/slider/style.js +1 -1
- package/dist/components/slider/style.js.map +1 -1
- package/dist/components/spinner/style.js +1 -1
- package/dist/components/spinner/style.js.map +1 -1
- package/dist/components/svg-draw-lines/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +1 -0
- package/dist/components/switch/index.js +26 -24
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/style.js +1 -1
- package/dist/components/switch/style.js.map +1 -1
- package/dist/components/textarea/index.d.ts +7 -1
- package/dist/components/textarea/index.js +45 -43
- 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 +9 -0
- package/dist/components/theme/index.js +128 -85
- package/dist/components/theme/index.js.map +1 -1
- package/dist/components/theme/style.js +1 -1
- package/dist/components/theme/style.js.map +1 -1
- package/dist/components/toast/style.js +1 -1
- package/dist/components/toast/style.js.map +1 -1
- package/dist/components/toast/toast.js +8 -8
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tooltip/style.js +1 -1
- package/dist/components/tooltip/style.js.map +1 -1
- package/dist/icons/generated/akar-icons-check.d.ts +6 -0
- package/dist/icons/generated/akar-icons-check.js +10 -0
- package/dist/icons/generated/akar-icons-check.js.map +1 -0
- package/dist/icons/generated/akar-icons-circle-check.d.ts +6 -0
- package/dist/icons/generated/akar-icons-circle-check.js +10 -0
- package/dist/icons/generated/akar-icons-circle-check.js.map +1 -0
- package/dist/icons/generated/bi-check-lg.d.ts +6 -0
- package/dist/icons/generated/bi-check-lg.js +10 -0
- package/dist/icons/generated/bi-check-lg.js.map +1 -0
- package/dist/icons/generated/bi-check.d.ts +6 -0
- package/dist/icons/generated/bi-check.js +10 -0
- package/dist/icons/generated/bi-check.js.map +1 -0
- package/dist/icons/generated/fluent-tag-search-24-regular.d.ts +6 -0
- package/dist/icons/generated/fluent-tag-search-24-regular.js +10 -0
- package/dist/icons/generated/fluent-tag-search-24-regular.js.map +1 -0
- package/dist/icons/generated/mdi-tag-search-outline.d.ts +6 -0
- package/dist/icons/generated/mdi-tag-search-outline.js +10 -0
- package/dist/icons/generated/mdi-tag-search-outline.js.map +1 -0
- package/dist/icons/index.d.ts +6 -0
- package/dist/icons/index.js +7 -1
- package/dist/shared/element-height/index.js +47 -0
- package/dist/shared/element-height/index.js.map +1 -0
- package/dist/shared/form-association/field-id.js +9 -0
- package/dist/shared/form-association/field-id.js.map +1 -0
- package/dist/shared/form-association/index.js +9 -1
- package/dist/shared/form-association/index.js.map +1 -1
- package/dist/shared/label-emptiness/index.js +45 -0
- package/dist/shared/label-emptiness/index.js.map +1 -0
- package/dist/shared/menu-portal/menu-portal.js +11 -11
- package/dist/shared/menu-portal/menu-portal.js.map +1 -1
- package/dist/shared/menu-portal/menu-tree.js +2 -2
- package/dist/shared/menu-portal/menu-tree.js.map +1 -1
- package/dist/shared/overlay/anchored-panel.js.map +1 -1
- package/dist/shared/overlay/native-dialog-presence.js +23 -11
- package/dist/shared/overlay/native-dialog-presence.js.map +1 -1
- package/dist/shared/overlay/nested-drawer-layers.js +30 -23
- package/dist/shared/overlay/nested-drawer-layers.js.map +1 -1
- package/dist/shared/scroll-lock/scroll-lock.js +3 -3
- package/dist/shared/scroll-lock/scroll-lock.js.map +1 -1
- package/dist/shared/theme/root-sync.js +24 -18
- package/dist/shared/theme/root-sync.js.map +1 -1
- package/package.json +8 -4
|
@@ -1,6 +1,370 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
declare const ALLOWED_TYPES: readonly ["button", "submit", "reset"];
|
|
3
|
-
|
|
3
|
+
declare const WebUiButton_base: {
|
|
4
|
+
new (...args: any[]): {
|
|
5
|
+
formResetCallback(): void;
|
|
6
|
+
formDisabledCallback(disabled: boolean): void;
|
|
7
|
+
formStateRestoreCallback(state: File | FormData | string | null): void;
|
|
8
|
+
accessKey: string;
|
|
9
|
+
readonly accessKeyLabel: string;
|
|
10
|
+
autocapitalize: string;
|
|
11
|
+
autocorrect: boolean;
|
|
12
|
+
dir: string;
|
|
13
|
+
draggable: boolean;
|
|
14
|
+
hidden: boolean | "until-found";
|
|
15
|
+
inert: boolean;
|
|
16
|
+
innerText: string;
|
|
17
|
+
lang: string;
|
|
18
|
+
readonly offsetHeight: number;
|
|
19
|
+
readonly offsetLeft: number;
|
|
20
|
+
readonly offsetParent: Element | null;
|
|
21
|
+
readonly offsetTop: number;
|
|
22
|
+
readonly offsetWidth: number;
|
|
23
|
+
outerText: string;
|
|
24
|
+
popover: string | null;
|
|
25
|
+
spellcheck: boolean;
|
|
26
|
+
title: string;
|
|
27
|
+
translate: boolean;
|
|
28
|
+
writingSuggestions: string;
|
|
29
|
+
attachInternals(): ElementInternals;
|
|
30
|
+
click(): void;
|
|
31
|
+
hidePopover(): void;
|
|
32
|
+
showPopover(options?: ShowPopoverOptions): void;
|
|
33
|
+
togglePopover(options?: TogglePopoverOptions | boolean): boolean;
|
|
34
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
35
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
36
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
37
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
38
|
+
readonly attributes: NamedNodeMap;
|
|
39
|
+
get classList(): DOMTokenList;
|
|
40
|
+
set classList(value: string);
|
|
41
|
+
className: string;
|
|
42
|
+
readonly clientHeight: number;
|
|
43
|
+
readonly clientLeft: number;
|
|
44
|
+
readonly clientTop: number;
|
|
45
|
+
readonly clientWidth: number;
|
|
46
|
+
readonly currentCSSZoom: number;
|
|
47
|
+
readonly customElementRegistry: CustomElementRegistry | null;
|
|
48
|
+
id: string;
|
|
49
|
+
innerHTML: string;
|
|
50
|
+
readonly localName: string;
|
|
51
|
+
readonly namespaceURI: string | null;
|
|
52
|
+
onfullscreenchange: ((this: Element, ev: Event) => any) | null;
|
|
53
|
+
onfullscreenerror: ((this: Element, ev: Event) => any) | null;
|
|
54
|
+
outerHTML: string;
|
|
55
|
+
readonly ownerDocument: Document;
|
|
56
|
+
get part(): DOMTokenList;
|
|
57
|
+
set part(value: string);
|
|
58
|
+
readonly prefix: string | null;
|
|
59
|
+
readonly scrollHeight: number;
|
|
60
|
+
scrollLeft: number;
|
|
61
|
+
scrollTop: number;
|
|
62
|
+
readonly scrollWidth: number;
|
|
63
|
+
readonly shadowRoot: ShadowRoot | null;
|
|
64
|
+
slot: string;
|
|
65
|
+
readonly tagName: string;
|
|
66
|
+
attachShadow(init: ShadowRootInit): ShadowRoot;
|
|
67
|
+
checkVisibility(options?: CheckVisibilityOptions): boolean;
|
|
68
|
+
closest<K extends keyof HTMLElementTagNameMap>(selector: K): HTMLElementTagNameMap[K] | null;
|
|
69
|
+
closest<K extends keyof SVGElementTagNameMap>(selector: K): SVGElementTagNameMap[K] | null;
|
|
70
|
+
closest<K extends keyof MathMLElementTagNameMap>(selector: K): MathMLElementTagNameMap[K] | null;
|
|
71
|
+
closest<E extends Element = Element>(selectors: string): E | null;
|
|
72
|
+
computedStyleMap(): StylePropertyMapReadOnly;
|
|
73
|
+
getAttribute(qualifiedName: string): string | null;
|
|
74
|
+
getAttributeNS(namespace: string | null, localName: string): string | null;
|
|
75
|
+
getAttributeNames(): string[];
|
|
76
|
+
getAttributeNode(qualifiedName: string): Attr | null;
|
|
77
|
+
getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
|
|
78
|
+
getBoundingClientRect(): DOMRect;
|
|
79
|
+
getClientRects(): DOMRectList;
|
|
80
|
+
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
|
|
81
|
+
getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
|
|
82
|
+
getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
|
|
83
|
+
getElementsByTagName<K extends keyof MathMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<MathMLElementTagNameMap[K]>;
|
|
84
|
+
getElementsByTagName<K extends keyof HTMLElementDeprecatedTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K]>;
|
|
85
|
+
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
|
|
86
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
|
|
87
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
|
|
88
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf<MathMLElement>;
|
|
89
|
+
getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;
|
|
90
|
+
getHTML(options?: GetHTMLOptions): string;
|
|
91
|
+
hasAttribute(qualifiedName: string): boolean;
|
|
92
|
+
hasAttributeNS(namespace: string | null, localName: string): boolean;
|
|
93
|
+
hasAttributes(): boolean;
|
|
94
|
+
hasPointerCapture(pointerId: number): boolean;
|
|
95
|
+
insertAdjacentElement(where: InsertPosition, element: Element): Element | null;
|
|
96
|
+
insertAdjacentHTML(position: InsertPosition, string: string): void;
|
|
97
|
+
insertAdjacentText(where: InsertPosition, data: string): void;
|
|
98
|
+
matches<K extends keyof HTMLElementTagNameMap>(selectors: K): this is HTMLElementTagNameMap[K];
|
|
99
|
+
matches<K extends keyof SVGElementTagNameMap>(selectors: K): this is SVGElementTagNameMap[K];
|
|
100
|
+
matches<K extends keyof MathMLElementTagNameMap>(selectors: K): this is MathMLElementTagNameMap[K];
|
|
101
|
+
matches(selectors: string): boolean;
|
|
102
|
+
releasePointerCapture(pointerId: number): void;
|
|
103
|
+
removeAttribute(qualifiedName: string): void;
|
|
104
|
+
removeAttributeNS(namespace: string | null, localName: string): void;
|
|
105
|
+
removeAttributeNode(attr: Attr): Attr;
|
|
106
|
+
requestFullscreen(options?: FullscreenOptions): Promise<void>;
|
|
107
|
+
requestPointerLock(options?: PointerLockOptions): Promise<void>;
|
|
108
|
+
scroll(options?: ScrollToOptions): void;
|
|
109
|
+
scroll(x: number, y: number): void;
|
|
110
|
+
scrollBy(options?: ScrollToOptions): void;
|
|
111
|
+
scrollBy(x: number, y: number): void;
|
|
112
|
+
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
|
|
113
|
+
scrollTo(options?: ScrollToOptions): void;
|
|
114
|
+
scrollTo(x: number, y: number): void;
|
|
115
|
+
setAttribute(qualifiedName: string, value: string): void;
|
|
116
|
+
setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
|
|
117
|
+
setAttributeNode(attr: Attr): Attr | null;
|
|
118
|
+
setAttributeNodeNS(attr: Attr): Attr | null;
|
|
119
|
+
setHTMLUnsafe(html: string): void;
|
|
120
|
+
setPointerCapture(pointerId: number): void;
|
|
121
|
+
toggleAttribute(qualifiedName: string, force?: boolean): boolean;
|
|
122
|
+
webkitMatchesSelector(selectors: string): boolean;
|
|
123
|
+
get textContent(): string;
|
|
124
|
+
set textContent(value: string | null);
|
|
125
|
+
readonly baseURI: string;
|
|
126
|
+
readonly childNodes: NodeListOf<ChildNode>;
|
|
127
|
+
readonly firstChild: ChildNode | null;
|
|
128
|
+
readonly isConnected: boolean;
|
|
129
|
+
readonly lastChild: ChildNode | null;
|
|
130
|
+
readonly nextSibling: ChildNode | null;
|
|
131
|
+
readonly nodeName: string;
|
|
132
|
+
readonly nodeType: number;
|
|
133
|
+
nodeValue: string | null;
|
|
134
|
+
readonly parentElement: HTMLElement | null;
|
|
135
|
+
readonly parentNode: ParentNode | null;
|
|
136
|
+
readonly previousSibling: ChildNode | null;
|
|
137
|
+
appendChild<T extends Node>(node: T): T;
|
|
138
|
+
cloneNode(subtree?: boolean): Node;
|
|
139
|
+
compareDocumentPosition(other: Node): number;
|
|
140
|
+
contains(other: Node | null): boolean;
|
|
141
|
+
getRootNode(options?: GetRootNodeOptions): Node;
|
|
142
|
+
hasChildNodes(): boolean;
|
|
143
|
+
insertBefore<T extends Node>(node: T, child: Node | null): T;
|
|
144
|
+
isDefaultNamespace(namespace: string | null): boolean;
|
|
145
|
+
isEqualNode(otherNode: Node | null): boolean;
|
|
146
|
+
isSameNode(otherNode: Node | null): boolean;
|
|
147
|
+
lookupNamespaceURI(prefix: string | null): string | null;
|
|
148
|
+
lookupPrefix(namespace: string | null): string | null;
|
|
149
|
+
normalize(): void;
|
|
150
|
+
removeChild<T extends Node>(child: T): T;
|
|
151
|
+
replaceChild<T extends Node>(node: Node, child: T): T;
|
|
152
|
+
readonly ELEMENT_NODE: 1;
|
|
153
|
+
readonly ATTRIBUTE_NODE: 2;
|
|
154
|
+
readonly TEXT_NODE: 3;
|
|
155
|
+
readonly CDATA_SECTION_NODE: 4;
|
|
156
|
+
readonly ENTITY_REFERENCE_NODE: 5;
|
|
157
|
+
readonly ENTITY_NODE: 6;
|
|
158
|
+
readonly PROCESSING_INSTRUCTION_NODE: 7;
|
|
159
|
+
readonly COMMENT_NODE: 8;
|
|
160
|
+
readonly DOCUMENT_NODE: 9;
|
|
161
|
+
readonly DOCUMENT_TYPE_NODE: 10;
|
|
162
|
+
readonly DOCUMENT_FRAGMENT_NODE: 11;
|
|
163
|
+
readonly NOTATION_NODE: 12;
|
|
164
|
+
readonly DOCUMENT_POSITION_DISCONNECTED: 1;
|
|
165
|
+
readonly DOCUMENT_POSITION_PRECEDING: 2;
|
|
166
|
+
readonly DOCUMENT_POSITION_FOLLOWING: 4;
|
|
167
|
+
readonly DOCUMENT_POSITION_CONTAINS: 8;
|
|
168
|
+
readonly DOCUMENT_POSITION_CONTAINED_BY: 16;
|
|
169
|
+
readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32;
|
|
170
|
+
dispatchEvent(event: Event): boolean;
|
|
171
|
+
ariaActiveDescendantElement: Element | null;
|
|
172
|
+
ariaAtomic: string | null;
|
|
173
|
+
ariaAutoComplete: string | null;
|
|
174
|
+
ariaBrailleLabel: string | null;
|
|
175
|
+
ariaBrailleRoleDescription: string | null;
|
|
176
|
+
ariaBusy: string | null;
|
|
177
|
+
ariaChecked: string | null;
|
|
178
|
+
ariaColCount: string | null;
|
|
179
|
+
ariaColIndex: string | null;
|
|
180
|
+
ariaColIndexText: string | null;
|
|
181
|
+
ariaColSpan: string | null;
|
|
182
|
+
ariaControlsElements: ReadonlyArray<Element> | null;
|
|
183
|
+
ariaCurrent: string | null;
|
|
184
|
+
ariaDescribedByElements: ReadonlyArray<Element> | null;
|
|
185
|
+
ariaDescription: string | null;
|
|
186
|
+
ariaDetailsElements: ReadonlyArray<Element> | null;
|
|
187
|
+
ariaDisabled: string | null;
|
|
188
|
+
ariaErrorMessageElements: ReadonlyArray<Element> | null;
|
|
189
|
+
ariaExpanded: string | null;
|
|
190
|
+
ariaFlowToElements: ReadonlyArray<Element> | null;
|
|
191
|
+
ariaHasPopup: string | null;
|
|
192
|
+
ariaHidden: string | null;
|
|
193
|
+
ariaInvalid: string | null;
|
|
194
|
+
ariaKeyShortcuts: string | null;
|
|
195
|
+
ariaLabel: string | null;
|
|
196
|
+
ariaLabelledByElements: ReadonlyArray<Element> | null;
|
|
197
|
+
ariaLevel: string | null;
|
|
198
|
+
ariaLive: string | null;
|
|
199
|
+
ariaModal: string | null;
|
|
200
|
+
ariaMultiLine: string | null;
|
|
201
|
+
ariaMultiSelectable: string | null;
|
|
202
|
+
ariaOrientation: string | null;
|
|
203
|
+
ariaOwnsElements: ReadonlyArray<Element> | null;
|
|
204
|
+
ariaPlaceholder: string | null;
|
|
205
|
+
ariaPosInSet: string | null;
|
|
206
|
+
ariaPressed: string | null;
|
|
207
|
+
ariaReadOnly: string | null;
|
|
208
|
+
ariaRelevant: string | null;
|
|
209
|
+
ariaRequired: string | null;
|
|
210
|
+
ariaRoleDescription: string | null;
|
|
211
|
+
ariaRowCount: string | null;
|
|
212
|
+
ariaRowIndex: string | null;
|
|
213
|
+
ariaRowIndexText: string | null;
|
|
214
|
+
ariaRowSpan: string | null;
|
|
215
|
+
ariaSelected: string | null;
|
|
216
|
+
ariaSetSize: string | null;
|
|
217
|
+
ariaSort: string | null;
|
|
218
|
+
ariaValueMax: string | null;
|
|
219
|
+
ariaValueMin: string | null;
|
|
220
|
+
ariaValueNow: string | null;
|
|
221
|
+
ariaValueText: string | null;
|
|
222
|
+
role: string | null;
|
|
223
|
+
animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation;
|
|
224
|
+
getAnimations(options?: GetAnimationsOptions): Animation[];
|
|
225
|
+
after(...nodes: (Node | string)[]): void;
|
|
226
|
+
before(...nodes: (Node | string)[]): void;
|
|
227
|
+
remove(): void;
|
|
228
|
+
replaceWith(...nodes: (Node | string)[]): void;
|
|
229
|
+
readonly nextElementSibling: Element | null;
|
|
230
|
+
readonly previousElementSibling: Element | null;
|
|
231
|
+
readonly childElementCount: number;
|
|
232
|
+
readonly children: HTMLCollection;
|
|
233
|
+
readonly firstElementChild: Element | null;
|
|
234
|
+
readonly lastElementChild: Element | null;
|
|
235
|
+
append(...nodes: (Node | string)[]): void;
|
|
236
|
+
moveBefore(node: Node, child: Node | null): void;
|
|
237
|
+
prepend(...nodes: (Node | string)[]): void;
|
|
238
|
+
querySelector<K extends keyof HTMLElementTagNameMap>(selectors: K): HTMLElementTagNameMap[K] | null;
|
|
239
|
+
querySelector<K extends keyof SVGElementTagNameMap>(selectors: K): SVGElementTagNameMap[K] | null;
|
|
240
|
+
querySelector<K extends keyof MathMLElementTagNameMap>(selectors: K): MathMLElementTagNameMap[K] | null;
|
|
241
|
+
querySelector<K extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K): HTMLElementDeprecatedTagNameMap[K] | null;
|
|
242
|
+
querySelector<E extends Element = Element>(selectors: string): E | null;
|
|
243
|
+
querySelectorAll<K extends keyof HTMLElementTagNameMap>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
|
|
244
|
+
querySelectorAll<K extends keyof SVGElementTagNameMap>(selectors: K): NodeListOf<SVGElementTagNameMap[K]>;
|
|
245
|
+
querySelectorAll<K extends keyof MathMLElementTagNameMap>(selectors: K): NodeListOf<MathMLElementTagNameMap[K]>;
|
|
246
|
+
querySelectorAll<K extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>;
|
|
247
|
+
querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
|
|
248
|
+
replaceChildren(...nodes: (Node | string)[]): void;
|
|
249
|
+
readonly assignedSlot: HTMLSlotElement | null;
|
|
250
|
+
readonly attributeStyleMap: StylePropertyMap;
|
|
251
|
+
get style(): CSSStyleDeclaration;
|
|
252
|
+
set style(cssText: string);
|
|
253
|
+
contentEditable: string;
|
|
254
|
+
enterKeyHint: string;
|
|
255
|
+
inputMode: string;
|
|
256
|
+
readonly isContentEditable: boolean;
|
|
257
|
+
onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
258
|
+
onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
259
|
+
onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
260
|
+
onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
261
|
+
onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
262
|
+
onauxclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
263
|
+
onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
|
|
264
|
+
onbeforematch: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
265
|
+
onbeforetoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null;
|
|
266
|
+
onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
267
|
+
oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
268
|
+
oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
269
|
+
oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
270
|
+
onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
271
|
+
onclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
272
|
+
onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
273
|
+
oncommand: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
274
|
+
oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
275
|
+
oncontextmenu: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
276
|
+
oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
277
|
+
oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
278
|
+
oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
279
|
+
oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
280
|
+
ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
281
|
+
ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
282
|
+
ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
283
|
+
ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
284
|
+
ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
285
|
+
ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
286
|
+
ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
287
|
+
ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
288
|
+
ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
289
|
+
onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
290
|
+
onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
291
|
+
onerror: OnErrorEventHandler;
|
|
292
|
+
onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
293
|
+
onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null;
|
|
294
|
+
ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
295
|
+
oninput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
|
|
296
|
+
oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
297
|
+
onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
298
|
+
onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
299
|
+
onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
300
|
+
onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
301
|
+
onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
302
|
+
onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
303
|
+
onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
304
|
+
onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
305
|
+
onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
306
|
+
onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
307
|
+
onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
308
|
+
onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
309
|
+
onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
310
|
+
onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
311
|
+
onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
312
|
+
onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
313
|
+
onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
314
|
+
onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
315
|
+
onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
316
|
+
onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
317
|
+
onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
318
|
+
onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
319
|
+
onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
320
|
+
onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
321
|
+
onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
322
|
+
onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
323
|
+
onpointerrawupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
324
|
+
onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
325
|
+
onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null;
|
|
326
|
+
onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
327
|
+
onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
328
|
+
onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
329
|
+
onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
330
|
+
onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
331
|
+
onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null;
|
|
332
|
+
onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
333
|
+
onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
334
|
+
onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
335
|
+
onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
336
|
+
onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
337
|
+
onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
338
|
+
onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
339
|
+
onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null;
|
|
340
|
+
onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
341
|
+
ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
342
|
+
ontoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null;
|
|
343
|
+
ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
344
|
+
ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
345
|
+
ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
346
|
+
ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
347
|
+
ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
348
|
+
ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
349
|
+
ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
350
|
+
ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
351
|
+
onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
352
|
+
onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
353
|
+
onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
354
|
+
onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
355
|
+
onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
356
|
+
onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
357
|
+
onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
|
|
358
|
+
autofocus: boolean;
|
|
359
|
+
readonly dataset: DOMStringMap;
|
|
360
|
+
nonce: string;
|
|
361
|
+
tabIndex: number;
|
|
362
|
+
blur(): void;
|
|
363
|
+
focus(options?: FocusOptions): void;
|
|
364
|
+
};
|
|
365
|
+
formAssociated: boolean;
|
|
366
|
+
} & typeof LitElement;
|
|
367
|
+
export declare class WebUiButton extends WebUiButton_base {
|
|
4
368
|
static styles: import('lit').CSSResult[];
|
|
5
369
|
get variant(): 'primary' | 'secondary' | 'ghost' | 'danger' | 'glass';
|
|
6
370
|
set variant(v: string);
|
|
@@ -16,6 +380,9 @@ export declare class WebUiButton extends LitElement {
|
|
|
16
380
|
ariaLabel: string | null;
|
|
17
381
|
private readonly _groupManagement;
|
|
18
382
|
private get _groupContext();
|
|
383
|
+
private readonly _formAssociation;
|
|
384
|
+
private readonly _formAssociationController;
|
|
385
|
+
private get _isDisabled();
|
|
19
386
|
private get _sizeStyle();
|
|
20
387
|
private handleClick;
|
|
21
388
|
render(): import('lit').TemplateResult<1>;
|
|
@@ -3,61 +3,81 @@ import "../icon/index.js";
|
|
|
3
3
|
import t from "../../assets/glass.js";
|
|
4
4
|
import n from "../../icons/generated/lucide-loader-circle.js";
|
|
5
5
|
import { installPointerFocusSuppression as r } from "../../shared/focus/pointer-focus.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
6
|
+
import { FormAssociated as i, FormAssociationController as a, defineFormAssociation as o } from "../../shared/form-association/index.js";
|
|
7
|
+
import { buttonGroupContextKey as s, defineGroupManaged as c } from "../../shared/group-management/index.js";
|
|
8
|
+
import { normalizeLiteral as l } from "../../shared/normalize/index.js";
|
|
9
|
+
import u from "./style.js";
|
|
10
|
+
import { LitElement as d, html as f, nothing as p, unsafeCSS as m } from "lit";
|
|
11
|
+
import { customElement as h, property as g } from "lit/decorators.js";
|
|
12
|
+
import { ifDefined as _ } from "lit/directives/if-defined.js";
|
|
13
|
+
import { classMap as v } from "lit/directives/class-map.js";
|
|
14
|
+
import { styleMap as y } from "lit/directives/style-map.js";
|
|
14
15
|
//#region src/components/button/index.ts
|
|
15
|
-
var
|
|
16
|
+
var b = [
|
|
16
17
|
"primary",
|
|
17
18
|
"secondary",
|
|
18
19
|
"ghost",
|
|
19
20
|
"danger",
|
|
20
21
|
"glass"
|
|
21
|
-
],
|
|
22
|
+
], x = [
|
|
22
23
|
"button",
|
|
23
24
|
"submit",
|
|
24
25
|
"reset"
|
|
25
26
|
];
|
|
26
27
|
r();
|
|
27
|
-
var
|
|
28
|
+
var S = class extends i(d) {
|
|
28
29
|
constructor(...e) {
|
|
29
|
-
super(...e), this._variant = "glass", this.disabled = !1, this.loading = !1, this.full = !1, this.icon = !1, this.size = "", this._type = "button", this.ariaLabel = null, this._groupManagement =
|
|
30
|
-
context:
|
|
30
|
+
super(...e), this._variant = "glass", this.disabled = !1, this.loading = !1, this.full = !1, this.icon = !1, this.size = "", this._type = "button", this.ariaLabel = null, this._groupManagement = c(this, {
|
|
31
|
+
context: s,
|
|
31
32
|
requestUpdate: () => this.requestUpdate(),
|
|
32
33
|
equals: (e, t) => e?.direction === t?.direction && e?.isLast === t?.isLast
|
|
33
|
-
}).make()
|
|
34
|
+
}).make(), this._formAssociation = o({
|
|
35
|
+
host: this,
|
|
36
|
+
getState: () => null,
|
|
37
|
+
setState: () => {},
|
|
38
|
+
getFormValue: () => null,
|
|
39
|
+
getFormState: () => null,
|
|
40
|
+
restoreState: () => {}
|
|
41
|
+
}).make(), this._formAssociationController = new a(this, this._formAssociation);
|
|
34
42
|
}
|
|
35
43
|
static {
|
|
36
|
-
this.styles = [
|
|
44
|
+
this.styles = [m(t), m(u)];
|
|
37
45
|
}
|
|
38
46
|
get variant() {
|
|
39
47
|
return this._variant;
|
|
40
48
|
}
|
|
41
49
|
set variant(e) {
|
|
42
50
|
let t = this._variant;
|
|
43
|
-
this._variant =
|
|
51
|
+
this._variant = l(e, b, "glass"), this.requestUpdate("variant", t);
|
|
44
52
|
}
|
|
45
53
|
get type() {
|
|
46
54
|
return this._type;
|
|
47
55
|
}
|
|
48
56
|
set type(e) {
|
|
49
57
|
let t = this._type;
|
|
50
|
-
this._type =
|
|
58
|
+
this._type = l(e, x, "button"), this.requestUpdate("type", t);
|
|
51
59
|
}
|
|
52
60
|
get _groupContext() {
|
|
53
61
|
return this._groupManagement.getContext();
|
|
54
62
|
}
|
|
63
|
+
get _isDisabled() {
|
|
64
|
+
return this.disabled || this.loading || this._formAssociation.isFormDisabled();
|
|
65
|
+
}
|
|
55
66
|
get _sizeStyle() {
|
|
56
67
|
let e = this._groupContext ? "30" : this.size;
|
|
57
68
|
return e ? { "--wui-control-size": `${e}px` } : {};
|
|
58
69
|
}
|
|
59
70
|
handleClick(e) {
|
|
60
|
-
(this.
|
|
71
|
+
if (this._isDisabled) {
|
|
72
|
+
e.preventDefault(), e.stopPropagation();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
let t = this.type;
|
|
76
|
+
t !== "button" && setTimeout(() => {
|
|
77
|
+
if (e.defaultPrevented) return;
|
|
78
|
+
let n = this._formAssociation.getInternals()?.form;
|
|
79
|
+
n && (t === "submit" ? n.requestSubmit() : n.reset());
|
|
80
|
+
});
|
|
61
81
|
}
|
|
62
82
|
render() {
|
|
63
83
|
let e = this._groupContext, t = {
|
|
@@ -67,53 +87,53 @@ var y = class extends c {
|
|
|
67
87
|
"group-divider": !0,
|
|
68
88
|
vertical: e?.direction === "vertical"
|
|
69
89
|
};
|
|
70
|
-
return
|
|
90
|
+
return f`
|
|
71
91
|
<button
|
|
72
92
|
type=${this.type}
|
|
73
|
-
aria-label=${
|
|
74
|
-
class=${
|
|
93
|
+
aria-label=${_(this.ariaLabel)}
|
|
94
|
+
class=${v(t)}
|
|
75
95
|
part="button"
|
|
76
|
-
style=${Object.keys(this._sizeStyle).length > 0 ?
|
|
77
|
-
?disabled=${this.
|
|
96
|
+
style=${Object.keys(this._sizeStyle).length > 0 ? y(this._sizeStyle) : p}
|
|
97
|
+
?disabled=${this._isDisabled}
|
|
78
98
|
@click=${this.handleClick}
|
|
79
99
|
>
|
|
80
|
-
${this.icon ? this.loading ?
|
|
81
|
-
${this.loading ?
|
|
100
|
+
${this.icon ? this.loading ? f`<web-ui-icon .icon=${n} spin></web-ui-icon>` : f`<slot></slot>` : f`
|
|
101
|
+
${this.loading ? f`<web-ui-icon .icon=${n} spin></web-ui-icon>` : ""}
|
|
82
102
|
<slot name="prefix"></slot>
|
|
83
103
|
<span class="label"><slot></slot></span>
|
|
84
104
|
<slot name="suffix"></slot>
|
|
85
105
|
`}
|
|
86
106
|
</button>
|
|
87
|
-
${e && !e.isLast ?
|
|
107
|
+
${e && !e.isLast ? f`<span class=${v(r)} aria-hidden="true"></span>` : ""}
|
|
88
108
|
`;
|
|
89
109
|
}
|
|
90
110
|
};
|
|
91
|
-
e([
|
|
111
|
+
e([g({
|
|
92
112
|
type: String,
|
|
93
113
|
reflect: !0
|
|
94
|
-
})],
|
|
114
|
+
})], S.prototype, "variant", null), e([g({
|
|
95
115
|
type: Boolean,
|
|
96
116
|
reflect: !0
|
|
97
|
-
})],
|
|
117
|
+
})], S.prototype, "disabled", void 0), e([g({
|
|
98
118
|
type: Boolean,
|
|
99
119
|
reflect: !0
|
|
100
|
-
})],
|
|
120
|
+
})], S.prototype, "loading", void 0), e([g({
|
|
101
121
|
type: Boolean,
|
|
102
122
|
reflect: !0
|
|
103
|
-
})],
|
|
123
|
+
})], S.prototype, "full", void 0), e([g({
|
|
104
124
|
type: Boolean,
|
|
105
125
|
reflect: !0
|
|
106
|
-
})],
|
|
126
|
+
})], S.prototype, "icon", void 0), e([g({
|
|
107
127
|
type: String,
|
|
108
128
|
reflect: !0
|
|
109
|
-
})],
|
|
129
|
+
})], S.prototype, "size", void 0), e([g({
|
|
110
130
|
type: String,
|
|
111
131
|
reflect: !0
|
|
112
|
-
})],
|
|
132
|
+
})], S.prototype, "type", null), e([g({
|
|
113
133
|
type: String,
|
|
114
134
|
attribute: "aria-label"
|
|
115
|
-
})],
|
|
135
|
+
})], S.prototype, "ariaLabel", void 0), S = e([h("web-ui-button")], S);
|
|
116
136
|
//#endregion
|
|
117
|
-
export {
|
|
137
|
+
export { S as WebUiButton };
|
|
118
138
|
|
|
119
139
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/button/index.ts"],"sourcesContent":["import { html, LitElement, nothing, unsafeCSS } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\nimport { styleMap } from 'lit/directives/style-map.js'\n\nimport '@/components/icon'\nimport glass from '@/assets/glass.css?inline'\nimport { lucideLoaderCircle } from '@/icons'\nimport { installPointerFocusSuppression } from '@/shared/focus/pointer-focus'\nimport { buttonGroupContextKey, defineGroupManaged, type ButtonGroupContext } from '@/shared/group-management'\nimport { normalizeLiteral } from '@/shared/normalize'\n\nimport style from './style.css?inline'\n\nconst ALLOWED_VARIANTS = ['primary', 'secondary', 'ghost', 'danger', 'glass'] as const\nconst ALLOWED_TYPES = ['button', 'submit', 'reset'] as const\n\ninstallPointerFocusSuppression()\n\n@customElement('web-ui-button')\nexport class WebUiButton extends LitElement {\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @property({ type: String, reflect: true })\n get variant(): 'primary' | 'secondary' | 'ghost' | 'danger' | 'glass' {\n return this._variant\n }\n set variant(v: string) {\n const old = this._variant\n this._variant = normalizeLiteral(v, ALLOWED_VARIANTS, 'glass')\n this.requestUpdate('variant', old)\n }\n private _variant: 'primary' | 'secondary' | 'ghost' | 'danger' | 'glass' = 'glass'\n\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) loading = false\n @property({ type: Boolean, reflect: true }) full = false\n @property({ type: Boolean, reflect: true }) icon = false\n @property({ type: String, reflect: true }) size = ''\n\n @property({ type: String, reflect: true })\n get type(): (typeof ALLOWED_TYPES)[number] {\n return this._type\n }\n set type(value: unknown) {\n const old = this._type\n this._type = normalizeLiteral(value, ALLOWED_TYPES, 'button')\n this.requestUpdate('type', old)\n }\n private _type: (typeof ALLOWED_TYPES)[number] = 'button'\n\n // Explicitly delegated accessible naming attributes.\n @property({ type: String, attribute: 'aria-label' }) override ariaLabel: string | null = null\n\n private readonly _groupManagement = defineGroupManaged<ButtonGroupContext>(this, {\n context: buttonGroupContextKey,\n requestUpdate: () => this.requestUpdate(),\n equals: (a, b) => a?.direction === b?.direction && a?.isLast === b?.isLast\n }).make()\n\n private get _groupContext(): ButtonGroupContext | undefined {\n return this._groupManagement.getContext()\n }\n\n private get _sizeStyle(): Record<string, string> {\n // size 仅控制按钮高度;icon 模式下 min-width 同步为相同值,天然保持正方形。\n const size = this._groupContext ? '30' : this.size\n return size ? { '--wui-control-size': `${size}px` } : {}\n }\n\n private handleClick(e: Event) {\n if (this.
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/button/index.ts"],"sourcesContent":["import { html, LitElement, nothing, unsafeCSS } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\nimport { styleMap } from 'lit/directives/style-map.js'\n\nimport '@/components/icon'\nimport glass from '@/assets/glass.css?inline'\nimport { lucideLoaderCircle } from '@/icons'\nimport { installPointerFocusSuppression } from '@/shared/focus/pointer-focus'\nimport { FormAssociated, defineFormAssociation, FormAssociationController } from '@/shared/form-association'\nimport { buttonGroupContextKey, defineGroupManaged, type ButtonGroupContext } from '@/shared/group-management'\nimport { normalizeLiteral } from '@/shared/normalize'\n\nimport style from './style.css?inline'\n\nconst ALLOWED_VARIANTS = ['primary', 'secondary', 'ghost', 'danger', 'glass'] as const\nconst ALLOWED_TYPES = ['button', 'submit', 'reset'] as const\n\ninstallPointerFocusSuppression()\n\n@customElement('web-ui-button')\nexport class WebUiButton extends FormAssociated(LitElement) {\n static override styles = [unsafeCSS(glass), unsafeCSS(style)]\n\n @property({ type: String, reflect: true })\n get variant(): 'primary' | 'secondary' | 'ghost' | 'danger' | 'glass' {\n return this._variant\n }\n set variant(v: string) {\n const old = this._variant\n this._variant = normalizeLiteral(v, ALLOWED_VARIANTS, 'glass')\n this.requestUpdate('variant', old)\n }\n private _variant: 'primary' | 'secondary' | 'ghost' | 'danger' | 'glass' = 'glass'\n\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) loading = false\n @property({ type: Boolean, reflect: true }) full = false\n @property({ type: Boolean, reflect: true }) icon = false\n @property({ type: String, reflect: true }) size = ''\n\n @property({ type: String, reflect: true })\n get type(): (typeof ALLOWED_TYPES)[number] {\n return this._type\n }\n set type(value: unknown) {\n const old = this._type\n this._type = normalizeLiteral(value, ALLOWED_TYPES, 'button')\n this.requestUpdate('type', old)\n }\n private _type: (typeof ALLOWED_TYPES)[number] = 'button'\n\n // Explicitly delegated accessible naming attributes.\n @property({ type: String, attribute: 'aria-label' }) override ariaLabel: string | null = null\n\n private readonly _groupManagement = defineGroupManaged<ButtonGroupContext>(this, {\n context: buttonGroupContextKey,\n requestUpdate: () => this.requestUpdate(),\n equals: (a, b) => a?.direction === b?.direction && a?.isLast === b?.isLast\n }).make()\n\n private get _groupContext(): ButtonGroupContext | undefined {\n return this._groupManagement.getContext()\n }\n\n /*\n * 按钮不贡献表单值,接 shared form-association 只为拿 ElementInternals 与原生禁用回调:\n * 禁用态由浏览器在宿主 disabled 反射时同步回报,自己镜像一份会漏掉更新时机。\n */\n private readonly _formAssociation = defineFormAssociation<null>({\n host: this,\n getState: () => null,\n setState: () => {},\n getFormValue: () => null,\n getFormState: () => null,\n restoreState: () => {}\n }).make()\n\n private readonly _formAssociationController = new FormAssociationController(this, this._formAssociation)\n\n private get _isDisabled(): boolean {\n return this.disabled || this.loading || this._formAssociation.isFormDisabled()\n }\n\n private get _sizeStyle(): Record<string, string> {\n // size 仅控制按钮高度;icon 模式下 min-width 同步为相同值,天然保持正方形。\n const size = this._groupContext ? '30' : this.size\n return size ? { '--wui-control-size': `${size}px` } : {}\n }\n\n private handleClick(e: Event) {\n if (this._isDisabled) {\n e.preventDefault()\n e.stopPropagation()\n return\n }\n\n const action = this.type\n if (action === 'button') return\n\n /*\n * Shadow 内按钮没有 form owner;等 composed click 的同步监听器全部完成后,\n * 再读取宿主的 live form owner 并转发,调用方仍可用 preventDefault 取消这次原生 activation。\n */\n setTimeout(() => {\n if (e.defaultPrevented) return\n const form = this._formAssociation.getInternals()?.form\n if (!form) return\n if (action === 'submit') form.requestSubmit()\n else form.reset()\n })\n }\n\n override render() {\n const groupContext = this._groupContext\n const btnClass = {\n 'wui-glass': this.variant === 'glass' && !groupContext,\n 'is-grouped': Boolean(groupContext)\n }\n const dividerClass = {\n 'group-divider': true,\n vertical: groupContext?.direction === 'vertical'\n }\n\n return html`\n <button\n type=${this.type}\n aria-label=${ifDefined(this.ariaLabel)}\n class=${classMap(btnClass)}\n part=\"button\"\n style=${Object.keys(this._sizeStyle).length > 0 ? styleMap(this._sizeStyle) : nothing}\n ?disabled=${this._isDisabled}\n @click=${this.handleClick}\n >\n ${\n this.icon\n ? // loading 优先于 icon 内容:icon 模式下只展示 spinner,不投影默认 slot,避免双图标叠加\n this.loading\n ? html`<web-ui-icon .icon=${lucideLoaderCircle} spin></web-ui-icon>`\n : html`<slot></slot>`\n : html`\n ${this.loading ? html`<web-ui-icon .icon=${lucideLoaderCircle} spin></web-ui-icon>` : ''}\n <slot name=\"prefix\"></slot>\n <span class=\"label\"><slot></slot></span>\n <slot name=\"suffix\"></slot>\n `\n }\n </button>\n ${\n groupContext && !groupContext.isLast\n ? html`<span class=${classMap(dividerClass)} aria-hidden=\"true\"></span>`\n : ''\n }\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-button': WebUiButton\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/components/button/style.css?inline
|
|
2
|
-
var e = "*,:before,:after{box-sizing:border-box}:host{justify-content:center;align-items:center;display:inline-flex;position:relative}:host([full]){width:100%;display:block}:host([disabled]){cursor:not-allowed}button{--wui-glass-corner-radius:calc(var(--wui-control-size,36px) / 2);cursor:default;-webkit-user-select:none;user-select:none;gap:var(--wui-button-gap,8px);box-sizing:border-box;width:var(--wui-button-width,max-content);min-width:var(--wui-control-size,36px);height:var(--wui-control-size,36px);padding:0 var(--wui-button-px,12px);border-radius:var(--wui-radius-control,calc(infinity * 1px));font:inherit;font-size:var(--wui-font-size,14px);color:var(--wui-button-color);white-space:nowrap;background-color:var(--wui-button-bg);border:none;justify-content:center;align-items:center;line-height:1;display:inline-flex;position:relative;overflow:clip}button:disabled{cursor:not-allowed;opacity:.4}button:focus-visible{outline:var(--wui-focus-ring-width,3px) solid var(--wui-color-focus-ring,#
|
|
2
|
+
var e = "*,:before,:after{box-sizing:border-box}:host{justify-content:center;align-items:center;display:inline-flex;position:relative}:host([full]){width:100%;display:block}:host([disabled]){cursor:not-allowed}button{--wui-glass-corner-radius:calc(var(--wui-control-size,36px) / 2);cursor:default;-webkit-user-select:none;user-select:none;gap:var(--wui-button-gap,var(--wui-space-2,8px));box-sizing:border-box;width:var(--wui-button-width,max-content);min-width:var(--wui-control-size,36px);height:var(--wui-control-size,36px);padding:0 var(--wui-button-px,var(--wui-space-3,12px));border-radius:var(--wui-radius-control,calc(infinity * 1px));font:inherit;font-size:var(--wui-font-size,14px);color:var(--wui-button-color);white-space:nowrap;background-color:var(--wui-button-bg);border:none;justify-content:center;align-items:center;line-height:1;display:inline-flex;position:relative;overflow:clip}button:disabled{cursor:not-allowed;opacity:.4}button:focus-visible{outline:var(--wui-focus-ring-width,3px) solid var(--wui-color-focus-ring,color-mix(in srgb, var(--wui-color-accent,#08f) 40%, transparent));outline-offset:2px}@media (hover:hover) and (pointer:fine){button:hover:not(:disabled){background-color:var(--wui-button-bg-hover)}}button:active:not(:disabled){background-color:var(--wui-button-bg-active)}:host([full]) button{width:100%;display:flex}:host([icon]) button{padding:0}:host([data-wui-pointer-focus]) button:focus-visible{outline-color:#0000}:host([variant=primary]){--wui-button-color:var(--wui-color-on-accent,#fff);--wui-button-bg:var(--wui-color-accent,#08f);--wui-button-bg-hover:color-mix(in srgb, var(--wui-button-bg,#08f) 88%, black);--wui-button-bg-active:color-mix(in srgb, var(--wui-button-bg,#08f) 76%, black)}:host([variant=secondary]){--wui-button-color:var(--wui-color-text,#1b1b1b);--wui-button-bg:var(--wui-color-surface-control,#dfdfdf);--wui-button-bg-hover:color-mix(in srgb, var(--wui-button-bg,#dfdfdf) 92%, black);--wui-button-bg-active:color-mix(in srgb, var(--wui-button-bg,#dfdfdf) 82%, black)}:host([variant=ghost]){--wui-button-color:var(--wui-color-text,#1b1b1b);--wui-button-bg:transparent;--wui-button-bg-hover:var(--wui-color-state-layer-hover,color-mix(in srgb, var(--wui-color-text,#1b1b1b) 6%, transparent));--wui-button-bg-active:var(--wui-color-state-layer-active,color-mix(in srgb, var(--wui-color-text,#1b1b1b) 15%, transparent))}:host([variant=danger]){--wui-button-color:var(--wui-color-danger,#dc2626);--wui-button-bg:color-mix(in srgb, var(--wui-color-danger,#dc2626) 18%, var(--wui-color-surface,#fff));--wui-button-bg-hover:color-mix(in srgb, var(--wui-color-danger,#dc2626) 26%, var(--wui-color-surface,#fff));--wui-button-bg-active:color-mix(in srgb, var(--wui-color-danger,#dc2626) 45%, var(--wui-color-surface,#fff))}:host([variant=glass]){--wui-button-color:var(--wui-color-text,#1b1b1b);--wui-button-bg:transparent;--wui-button-bg-hover:var(--wui-color-surface-glass-hover,color-mix(in srgb, var(--wui-color-text,#1b1b1b) 6%, var(--wui-color-surface-glass,#fafafa57)));--wui-button-bg-active:var(--wui-color-surface-glass-active,color-mix(in srgb, var(--wui-color-text,#1b1b1b) 15%, var(--wui-color-surface-glass,#fafafa57)))}button.is-grouped{--wui-button-bg:transparent;--wui-button-bg-hover:var(--wui-color-state-layer-hover,color-mix(in srgb, var(--wui-color-text,#1b1b1b) 6%, transparent));--wui-button-bg-active:var(--wui-color-state-layer-active,color-mix(in srgb, var(--wui-color-text,#1b1b1b) 15%, transparent))}.group-divider{z-index:1;width:1px;height:var(--wui-button-group-divider-length,20px);background-color:var(--wui-color-border,#0000001a);position:absolute;top:50%;right:-2px;transform:translateY(-50%)}.group-divider.vertical{width:var(--wui-button-group-divider-length,20px);height:1px;inset:auto auto -2px 50%;transform:translate(-50%)}";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { e as default };
|
|
5
5
|
|