@greypan/web-ui 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/README.CN.md +89 -26
  2. package/README.md +80 -30
  3. package/dist/assets/glass.js +1 -1
  4. package/dist/assets/glass.js.map +1 -1
  5. package/dist/assets/menu-portal.js +1 -1
  6. package/dist/assets/menu-portal.js.map +1 -1
  7. package/dist/components/autocomplete/index.d.ts +367 -4
  8. package/dist/components/autocomplete/index.js +83 -77
  9. package/dist/components/autocomplete/index.js.map +1 -1
  10. package/dist/components/autocomplete/style.js +1 -1
  11. package/dist/components/autocomplete/style.js.map +1 -1
  12. package/dist/components/avatar/style.js +1 -1
  13. package/dist/components/avatar/style.js.map +1 -1
  14. package/dist/components/back-top/style.js +1 -1
  15. package/dist/components/back-top/style.js.map +1 -1
  16. package/dist/components/badge/style.js +1 -1
  17. package/dist/components/badge/style.js.map +1 -1
  18. package/dist/components/button/style.js +1 -1
  19. package/dist/components/button/style.js.map +1 -1
  20. package/dist/components/button-group/style.js +1 -1
  21. package/dist/components/button-group/style.js.map +1 -1
  22. package/dist/components/checkbox/index.d.ts +366 -5
  23. package/dist/components/checkbox/index.js +19 -31
  24. package/dist/components/checkbox/index.js.map +1 -1
  25. package/dist/components/checkbox/style.js +1 -1
  26. package/dist/components/checkbox/style.js.map +1 -1
  27. package/dist/components/checkbox-group/index.d.ts +366 -4
  28. package/dist/components/checkbox-group/index.js +16 -25
  29. package/dist/components/checkbox-group/index.js.map +1 -1
  30. package/dist/components/collapse/index.js +24 -27
  31. package/dist/components/collapse/index.js.map +1 -1
  32. package/dist/components/context-menu/index.d.ts +6 -14
  33. package/dist/components/context-menu/index.js +88 -143
  34. package/dist/components/context-menu/index.js.map +1 -1
  35. package/dist/components/dialog/index.js +20 -23
  36. package/dist/components/dialog/index.js.map +1 -1
  37. package/dist/components/dialog/style.js +1 -1
  38. package/dist/components/dialog/style.js.map +1 -1
  39. package/dist/components/drawer/index.js +54 -57
  40. package/dist/components/drawer/index.js.map +1 -1
  41. package/dist/components/drawer/style.js +1 -1
  42. package/dist/components/drawer/style.js.map +1 -1
  43. package/dist/components/dropdown/index.d.ts +5 -14
  44. package/dist/components/dropdown/index.js +94 -155
  45. package/dist/components/dropdown/index.js.map +1 -1
  46. package/dist/components/dropdown-header/style.js +1 -1
  47. package/dist/components/dropdown-header/style.js.map +1 -1
  48. package/dist/components/dropdown-item/style.js +1 -1
  49. package/dist/components/dropdown-item/style.js.map +1 -1
  50. package/dist/components/empty/style.js +1 -1
  51. package/dist/components/empty/style.js.map +1 -1
  52. package/dist/components/input/index.d.ts +366 -5
  53. package/dist/components/input/index.js +35 -47
  54. package/dist/components/input/index.js.map +1 -1
  55. package/dist/components/input/style.js +1 -1
  56. package/dist/components/input/style.js.map +1 -1
  57. package/dist/components/input-number/index.d.ts +366 -5
  58. package/dist/components/input-number/index.js +31 -44
  59. package/dist/components/input-number/index.js.map +1 -1
  60. package/dist/components/input-number/style.js +1 -1
  61. package/dist/components/input-number/style.js.map +1 -1
  62. package/dist/components/layout/style.js +1 -1
  63. package/dist/components/layout/style.js.map +1 -1
  64. package/dist/components/option/style.js +1 -1
  65. package/dist/components/option/style.js.map +1 -1
  66. package/dist/components/popover/index.js +27 -46
  67. package/dist/components/popover/index.js.map +1 -1
  68. package/dist/components/popover/style.js +1 -1
  69. package/dist/components/popover/style.js.map +1 -1
  70. package/dist/components/radio/index.d.ts +366 -5
  71. package/dist/components/radio/index.js +19 -31
  72. package/dist/components/radio/index.js.map +1 -1
  73. package/dist/components/radio/style.js +1 -1
  74. package/dist/components/radio/style.js.map +1 -1
  75. package/dist/components/radio-group/index.d.ts +366 -4
  76. package/dist/components/radio-group/index.js +16 -25
  77. package/dist/components/radio-group/index.js.map +1 -1
  78. package/dist/components/segmented/index.d.ts +366 -4
  79. package/dist/components/segmented/index.js +26 -35
  80. package/dist/components/segmented/index.js.map +1 -1
  81. package/dist/components/segmented/style.js +1 -1
  82. package/dist/components/segmented/style.js.map +1 -1
  83. package/dist/components/segmented-trigger/style.js +1 -1
  84. package/dist/components/segmented-trigger/style.js.map +1 -1
  85. package/dist/components/select/index.d.ts +368 -5
  86. package/dist/components/select/index.js +64 -66
  87. package/dist/components/select/index.js.map +1 -1
  88. package/dist/components/select/style.js +1 -1
  89. package/dist/components/select/style.js.map +1 -1
  90. package/dist/components/slider/index.d.ts +366 -5
  91. package/dist/components/slider/index.js +38 -50
  92. package/dist/components/slider/index.js.map +1 -1
  93. package/dist/components/slider/style.js +1 -1
  94. package/dist/components/slider/style.js.map +1 -1
  95. package/dist/components/spinner/style.js +1 -1
  96. package/dist/components/spinner/style.js.map +1 -1
  97. package/dist/components/switch/index.d.ts +366 -5
  98. package/dist/components/switch/index.js +26 -38
  99. package/dist/components/switch/index.js.map +1 -1
  100. package/dist/components/switch/style.js +1 -1
  101. package/dist/components/switch/style.js.map +1 -1
  102. package/dist/components/textarea/index.d.ts +366 -5
  103. package/dist/components/textarea/index.js +43 -57
  104. package/dist/components/textarea/index.js.map +1 -1
  105. package/dist/components/textarea/style.js +1 -1
  106. package/dist/components/textarea/style.js.map +1 -1
  107. package/dist/components/theme/style.js +1 -1
  108. package/dist/components/theme/style.js.map +1 -1
  109. package/dist/components/toast/style.js +1 -1
  110. package/dist/components/toast/style.js.map +1 -1
  111. package/dist/components/tooltip/index.js +29 -48
  112. package/dist/components/tooltip/index.js.map +1 -1
  113. package/dist/components/tooltip/style.js +1 -1
  114. package/dist/components/tooltip/style.js.map +1 -1
  115. package/dist/shared/form-association/index.js +31 -4
  116. package/dist/shared/form-association/index.js.map +1 -1
  117. package/dist/shared/menu-behavior/index.js +112 -0
  118. package/dist/shared/menu-behavior/index.js.map +1 -0
  119. package/dist/shared/open-state/index.js +12 -0
  120. package/dist/shared/open-state/index.js.map +1 -0
  121. package/dist/shared/option-portal/combobox-shell.js +41 -0
  122. package/dist/shared/option-portal/combobox-shell.js.map +1 -0
  123. package/dist/shared/option-portal/index.js +22 -21
  124. package/dist/shared/option-portal/index.js.map +1 -1
  125. package/dist/shared/overlay/placement-props.js +19 -0
  126. package/dist/shared/overlay/placement-props.js.map +1 -0
  127. package/dist/shared/overlay/portal.js +4 -2
  128. package/dist/shared/overlay/portal.js.map +1 -1
  129. package/package.json +3 -7
@@ -1,5 +1,5 @@
1
1
  //#region src/components/checkbox/style.css?inline
2
- var e = "*,:before,:after{box-sizing:border-box}:host{cursor:default;display:inline-block}:host([disabled]){cursor:not-allowed}.wui-checkbox{cursor:default;-webkit-user-select:none;user-select:none;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);align-items:center;gap:10px;line-height:1;display:inline-flex}.wui-checkbox:focus-visible{outline:var(--wui-focus-ring-width,3px) solid var(--wui-color-focus-ring,#08f6);outline-offset:2px;border-radius:2147483647px}.wui-checkbox.is-disabled{cursor:not-allowed;color:var(--wui-color-text-secondary,#6a6a6a);opacity:.4}.wui-checkbox-box{background-color:var(--wui-color-surface-raised,#f2f2f7);border-radius:6px;flex-shrink:0;justify-content:center;align-items:center;width:18px;height:18px;transition:background-color .2s,border-color .2s;display:flex}.is-checked .wui-checkbox-box{border-color:var(--wui-color-accent,#08f);background-color:var(--wui-color-accent,#08f)}.wui-checkbox-icon{opacity:0;transition:opacity var(--wui-duration-trigger,.16s) ease, transform var(--wui-duration-trigger,.16s) var(--wui-ease-enter,cubic-bezier(.23, 1, .32, 1));font-size:0;line-height:0;display:block;overflow:hidden;transform:scale(.85)}.is-checked .wui-checkbox-icon{opacity:1;transform:scale(1)}.wui-checkbox-label{pointer-events:none}@media (prefers-reduced-motion:reduce){.wui-checkbox-icon,.is-checked .wui-checkbox-icon{transform:none}}";
2
+ var e = "*,:before,:after{box-sizing:border-box}:host{cursor:default;display:inline-block}:host([disabled]){cursor:not-allowed}.wui-checkbox{cursor:default;-webkit-user-select:none;user-select:none;font-size:var(--wui-font-size,14px);color:var(--wui-color-text,#1b1b1b);align-items:center;gap:10px;line-height:1;display:inline-flex}.wui-checkbox:focus-visible{border-radius:var(--wui-radius-control,calc(infinity * 1px));outline:var(--wui-focus-ring-width,3px) solid var(--wui-color-focus-ring,#08f6);outline-offset:2px}.wui-checkbox.is-disabled{cursor:not-allowed;color:var(--wui-color-text-secondary,#6a6a6a);opacity:.4}.wui-checkbox-box{border-radius:var(--wui-internal-checkbox-radius,6px);background-color:var(--wui-color-surface-raised,#f2f2f7);flex-shrink:0;justify-content:center;align-items:center;width:18px;height:18px;transition:background-color .2s,border-color .2s;display:flex}.is-checked .wui-checkbox-box{border-color:var(--wui-color-accent,#08f);background-color:var(--wui-color-accent,#08f)}.wui-checkbox-icon{opacity:0;transition:opacity var(--wui-duration-trigger,.16s) ease, transform var(--wui-duration-trigger,.16s) var(--wui-ease-enter,cubic-bezier(.23, 1, .32, 1));font-size:0;line-height:0;display:block;overflow:hidden;transform:scale(.85)}.is-checked .wui-checkbox-icon{opacity:1;transform:scale(1)}.wui-checkbox-label{pointer-events:none}@media (prefers-reduced-motion:reduce){.wui-checkbox-icon,.is-checked .wui-checkbox-icon{transform:none}}";
3
3
  //#endregion
4
4
  export { e as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/checkbox/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n cursor: default;\n display: inline-block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n}\n\n.wui-checkbox {\n cursor: default;\n user-select: none;\n\n display: inline-flex;\n gap: 10px;\n align-items: center;\n\n font-size: var(--wui-font-size, 14px);\n line-height: 1;\n color: var(--wui-color-text, #1b1b1b);\n\n &:focus-visible {\n border-radius: calc(infinity * 1px);\n outline: var(--wui-focus-ring-width, 3px) solid var(--wui-color-focus-ring, rgb(0 136 255 / 0.4));\n outline-offset: 2px;\n }\n}\n\n.wui-checkbox.is-disabled {\n cursor: not-allowed;\n color: var(--wui-color-text-secondary, #6a6a6a);\n opacity: 0.4;\n}\n\n.wui-checkbox-box {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 18px;\n height: 18px;\n border-radius: 6px;\n\n background-color: var(--wui-color-surface-raised, #f2f2f7);\n\n transition:\n background-color 0.2s ease,\n border-color 0.2s ease;\n}\n\n.is-checked .wui-checkbox-box {\n border-color: var(--wui-color-accent, #08f);\n background-color: var(--wui-color-accent, #08f);\n}\n\n.wui-checkbox-icon {\n transform: scale(0.85);\n\n overflow: hidden;\n display: block;\n\n font-size: 0;\n line-height: 0;\n\n opacity: 0;\n\n transition:\n opacity var(--wui-duration-trigger, 160ms) ease,\n transform var(--wui-duration-trigger, 160ms) var(--wui-ease-enter, cubic-bezier(0.23, 1, 0.32, 1));\n}\n\n.is-checked .wui-checkbox-icon {\n transform: scale(1);\n opacity: 1;\n}\n\n.wui-checkbox-label {\n pointer-events: none;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .wui-checkbox-icon,\n .is-checked .wui-checkbox-icon {\n transform: none;\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/checkbox/style.css?inline"],"sourcesContent":["*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n:host {\n cursor: default;\n display: inline-block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n}\n\n.wui-checkbox {\n cursor: default;\n user-select: none;\n\n display: inline-flex;\n gap: 10px;\n align-items: center;\n\n font-size: var(--wui-font-size, 14px);\n line-height: 1;\n color: var(--wui-color-text, #1b1b1b);\n\n &:focus-visible {\n border-radius: var(--wui-radius-control, calc(infinity * 1px));\n outline: var(--wui-focus-ring-width, 3px) solid var(--wui-color-focus-ring, rgb(0 136 255 / 0.4));\n outline-offset: 2px;\n }\n}\n\n.wui-checkbox.is-disabled {\n cursor: not-allowed;\n color: var(--wui-color-text-secondary, #6a6a6a);\n opacity: 0.4;\n}\n\n.wui-checkbox-box {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n\n width: 18px;\n height: 18px;\n border-radius: var(--wui-internal-checkbox-radius, 6px);\n\n background-color: var(--wui-color-surface-raised, #f2f2f7);\n\n transition:\n background-color 0.2s ease,\n border-color 0.2s ease;\n}\n\n.is-checked .wui-checkbox-box {\n border-color: var(--wui-color-accent, #08f);\n background-color: var(--wui-color-accent, #08f);\n}\n\n.wui-checkbox-icon {\n transform: scale(0.85);\n\n overflow: hidden;\n display: block;\n\n font-size: 0;\n line-height: 0;\n\n opacity: 0;\n\n transition:\n opacity var(--wui-duration-trigger, 160ms) ease,\n transform var(--wui-duration-trigger, 160ms) var(--wui-ease-enter, cubic-bezier(0.23, 1, 0.32, 1));\n}\n\n.is-checked .wui-checkbox-icon {\n transform: scale(1);\n opacity: 1;\n}\n\n.wui-checkbox-label {\n pointer-events: none;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .wui-checkbox-icon,\n .is-checked .wui-checkbox-icon {\n transform: none;\n }\n}\n"],"mappings":""}
@@ -1,7 +1,370 @@
1
1
  import { LitElement } from 'lit';
2
- export declare class WebUiCheckboxGroup extends LitElement {
2
+ declare const WebUiCheckboxGroup_base: {
3
+ new (...args: any[]): {
4
+ formResetCallback(): void;
5
+ formDisabledCallback(disabled: boolean): void;
6
+ formStateRestoreCallback(state: File | FormData | string | null): void;
7
+ accessKey: string;
8
+ readonly accessKeyLabel: string;
9
+ autocapitalize: string;
10
+ autocorrect: boolean;
11
+ dir: string;
12
+ draggable: boolean;
13
+ hidden: boolean | "until-found";
14
+ inert: boolean;
15
+ innerText: string;
16
+ lang: string;
17
+ readonly offsetHeight: number;
18
+ readonly offsetLeft: number;
19
+ readonly offsetParent: Element | null;
20
+ readonly offsetTop: number;
21
+ readonly offsetWidth: number;
22
+ outerText: string;
23
+ popover: string | null;
24
+ spellcheck: boolean;
25
+ title: string;
26
+ translate: boolean;
27
+ writingSuggestions: string;
28
+ attachInternals(): ElementInternals;
29
+ click(): void;
30
+ hidePopover(): void;
31
+ showPopover(options?: ShowPopoverOptions): void;
32
+ togglePopover(options?: TogglePopoverOptions | boolean): boolean;
33
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
34
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
35
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
36
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
37
+ readonly attributes: NamedNodeMap;
38
+ get classList(): DOMTokenList;
39
+ set classList(value: string);
40
+ className: string;
41
+ readonly clientHeight: number;
42
+ readonly clientLeft: number;
43
+ readonly clientTop: number;
44
+ readonly clientWidth: number;
45
+ readonly currentCSSZoom: number;
46
+ readonly customElementRegistry: CustomElementRegistry | null;
47
+ id: string;
48
+ innerHTML: string;
49
+ readonly localName: string;
50
+ readonly namespaceURI: string | null;
51
+ onfullscreenchange: ((this: Element, ev: Event) => any) | null;
52
+ onfullscreenerror: ((this: Element, ev: Event) => any) | null;
53
+ outerHTML: string;
54
+ readonly ownerDocument: Document;
55
+ get part(): DOMTokenList;
56
+ set part(value: string);
57
+ readonly prefix: string | null;
58
+ readonly scrollHeight: number;
59
+ scrollLeft: number;
60
+ scrollTop: number;
61
+ readonly scrollWidth: number;
62
+ readonly shadowRoot: ShadowRoot | null;
63
+ slot: string;
64
+ readonly tagName: string;
65
+ attachShadow(init: ShadowRootInit): ShadowRoot;
66
+ checkVisibility(options?: CheckVisibilityOptions): boolean;
67
+ closest<K extends keyof HTMLElementTagNameMap>(selector: K): HTMLElementTagNameMap[K] | null;
68
+ closest<K extends keyof SVGElementTagNameMap>(selector: K): SVGElementTagNameMap[K] | null;
69
+ closest<K extends keyof MathMLElementTagNameMap>(selector: K): MathMLElementTagNameMap[K] | null;
70
+ closest<E extends Element = Element>(selectors: string): E | null;
71
+ computedStyleMap(): StylePropertyMapReadOnly;
72
+ getAttribute(qualifiedName: string): string | null;
73
+ getAttributeNS(namespace: string | null, localName: string): string | null;
74
+ getAttributeNames(): string[];
75
+ getAttributeNode(qualifiedName: string): Attr | null;
76
+ getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
77
+ getBoundingClientRect(): DOMRect;
78
+ getClientRects(): DOMRectList;
79
+ getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
80
+ getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
81
+ getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
82
+ getElementsByTagName<K extends keyof MathMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<MathMLElementTagNameMap[K]>;
83
+ getElementsByTagName<K extends keyof HTMLElementDeprecatedTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K]>;
84
+ getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
85
+ getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
86
+ getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
87
+ getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf<MathMLElement>;
88
+ getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;
89
+ getHTML(options?: GetHTMLOptions): string;
90
+ hasAttribute(qualifiedName: string): boolean;
91
+ hasAttributeNS(namespace: string | null, localName: string): boolean;
92
+ hasAttributes(): boolean;
93
+ hasPointerCapture(pointerId: number): boolean;
94
+ insertAdjacentElement(where: InsertPosition, element: Element): Element | null;
95
+ insertAdjacentHTML(position: InsertPosition, string: string): void;
96
+ insertAdjacentText(where: InsertPosition, data: string): void;
97
+ matches<K extends keyof HTMLElementTagNameMap>(selectors: K): this is HTMLElementTagNameMap[K];
98
+ matches<K extends keyof SVGElementTagNameMap>(selectors: K): this is SVGElementTagNameMap[K];
99
+ matches<K extends keyof MathMLElementTagNameMap>(selectors: K): this is MathMLElementTagNameMap[K];
100
+ matches(selectors: string): boolean;
101
+ releasePointerCapture(pointerId: number): void;
102
+ removeAttribute(qualifiedName: string): void;
103
+ removeAttributeNS(namespace: string | null, localName: string): void;
104
+ removeAttributeNode(attr: Attr): Attr;
105
+ requestFullscreen(options?: FullscreenOptions): Promise<void>;
106
+ requestPointerLock(options?: PointerLockOptions): Promise<void>;
107
+ scroll(options?: ScrollToOptions): void;
108
+ scroll(x: number, y: number): void;
109
+ scrollBy(options?: ScrollToOptions): void;
110
+ scrollBy(x: number, y: number): void;
111
+ scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
112
+ scrollTo(options?: ScrollToOptions): void;
113
+ scrollTo(x: number, y: number): void;
114
+ setAttribute(qualifiedName: string, value: string): void;
115
+ setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
116
+ setAttributeNode(attr: Attr): Attr | null;
117
+ setAttributeNodeNS(attr: Attr): Attr | null;
118
+ setHTMLUnsafe(html: string): void;
119
+ setPointerCapture(pointerId: number): void;
120
+ toggleAttribute(qualifiedName: string, force?: boolean): boolean;
121
+ webkitMatchesSelector(selectors: string): boolean;
122
+ get textContent(): string;
123
+ set textContent(value: string | null);
124
+ readonly baseURI: string;
125
+ readonly childNodes: NodeListOf<ChildNode>;
126
+ readonly firstChild: ChildNode | null;
127
+ readonly isConnected: boolean;
128
+ readonly lastChild: ChildNode | null;
129
+ readonly nextSibling: ChildNode | null;
130
+ readonly nodeName: string;
131
+ readonly nodeType: number;
132
+ nodeValue: string | null;
133
+ readonly parentElement: HTMLElement | null;
134
+ readonly parentNode: ParentNode | null;
135
+ readonly previousSibling: ChildNode | null;
136
+ appendChild<T extends Node>(node: T): T;
137
+ cloneNode(subtree?: boolean): Node;
138
+ compareDocumentPosition(other: Node): number;
139
+ contains(other: Node | null): boolean;
140
+ getRootNode(options?: GetRootNodeOptions): Node;
141
+ hasChildNodes(): boolean;
142
+ insertBefore<T extends Node>(node: T, child: Node | null): T;
143
+ isDefaultNamespace(namespace: string | null): boolean;
144
+ isEqualNode(otherNode: Node | null): boolean;
145
+ isSameNode(otherNode: Node | null): boolean;
146
+ lookupNamespaceURI(prefix: string | null): string | null;
147
+ lookupPrefix(namespace: string | null): string | null;
148
+ normalize(): void;
149
+ removeChild<T extends Node>(child: T): T;
150
+ replaceChild<T extends Node>(node: Node, child: T): T;
151
+ readonly ELEMENT_NODE: 1;
152
+ readonly ATTRIBUTE_NODE: 2;
153
+ readonly TEXT_NODE: 3;
154
+ readonly CDATA_SECTION_NODE: 4;
155
+ readonly ENTITY_REFERENCE_NODE: 5;
156
+ readonly ENTITY_NODE: 6;
157
+ readonly PROCESSING_INSTRUCTION_NODE: 7;
158
+ readonly COMMENT_NODE: 8;
159
+ readonly DOCUMENT_NODE: 9;
160
+ readonly DOCUMENT_TYPE_NODE: 10;
161
+ readonly DOCUMENT_FRAGMENT_NODE: 11;
162
+ readonly NOTATION_NODE: 12;
163
+ readonly DOCUMENT_POSITION_DISCONNECTED: 1;
164
+ readonly DOCUMENT_POSITION_PRECEDING: 2;
165
+ readonly DOCUMENT_POSITION_FOLLOWING: 4;
166
+ readonly DOCUMENT_POSITION_CONTAINS: 8;
167
+ readonly DOCUMENT_POSITION_CONTAINED_BY: 16;
168
+ readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32;
169
+ dispatchEvent(event: Event): boolean;
170
+ ariaActiveDescendantElement: Element | null;
171
+ ariaAtomic: string | null;
172
+ ariaAutoComplete: string | null;
173
+ ariaBrailleLabel: string | null;
174
+ ariaBrailleRoleDescription: string | null;
175
+ ariaBusy: string | null;
176
+ ariaChecked: string | null;
177
+ ariaColCount: string | null;
178
+ ariaColIndex: string | null;
179
+ ariaColIndexText: string | null;
180
+ ariaColSpan: string | null;
181
+ ariaControlsElements: ReadonlyArray<Element> | null;
182
+ ariaCurrent: string | null;
183
+ ariaDescribedByElements: ReadonlyArray<Element> | null;
184
+ ariaDescription: string | null;
185
+ ariaDetailsElements: ReadonlyArray<Element> | null;
186
+ ariaDisabled: string | null;
187
+ ariaErrorMessageElements: ReadonlyArray<Element> | null;
188
+ ariaExpanded: string | null;
189
+ ariaFlowToElements: ReadonlyArray<Element> | null;
190
+ ariaHasPopup: string | null;
191
+ ariaHidden: string | null;
192
+ ariaInvalid: string | null;
193
+ ariaKeyShortcuts: string | null;
194
+ ariaLabel: string | null;
195
+ ariaLabelledByElements: ReadonlyArray<Element> | null;
196
+ ariaLevel: string | null;
197
+ ariaLive: string | null;
198
+ ariaModal: string | null;
199
+ ariaMultiLine: string | null;
200
+ ariaMultiSelectable: string | null;
201
+ ariaOrientation: string | null;
202
+ ariaOwnsElements: ReadonlyArray<Element> | null;
203
+ ariaPlaceholder: string | null;
204
+ ariaPosInSet: string | null;
205
+ ariaPressed: string | null;
206
+ ariaReadOnly: string | null;
207
+ ariaRelevant: string | null;
208
+ ariaRequired: string | null;
209
+ ariaRoleDescription: string | null;
210
+ ariaRowCount: string | null;
211
+ ariaRowIndex: string | null;
212
+ ariaRowIndexText: string | null;
213
+ ariaRowSpan: string | null;
214
+ ariaSelected: string | null;
215
+ ariaSetSize: string | null;
216
+ ariaSort: string | null;
217
+ ariaValueMax: string | null;
218
+ ariaValueMin: string | null;
219
+ ariaValueNow: string | null;
220
+ ariaValueText: string | null;
221
+ role: string | null;
222
+ animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation;
223
+ getAnimations(options?: GetAnimationsOptions): Animation[];
224
+ after(...nodes: (Node | string)[]): void;
225
+ before(...nodes: (Node | string)[]): void;
226
+ remove(): void;
227
+ replaceWith(...nodes: (Node | string)[]): void;
228
+ readonly nextElementSibling: Element | null;
229
+ readonly previousElementSibling: Element | null;
230
+ readonly childElementCount: number;
231
+ readonly children: HTMLCollection;
232
+ readonly firstElementChild: Element | null;
233
+ readonly lastElementChild: Element | null;
234
+ append(...nodes: (Node | string)[]): void;
235
+ moveBefore(node: Node, child: Node | null): void;
236
+ prepend(...nodes: (Node | string)[]): void;
237
+ querySelector<K extends keyof HTMLElementTagNameMap>(selectors: K): HTMLElementTagNameMap[K] | null;
238
+ querySelector<K extends keyof SVGElementTagNameMap>(selectors: K): SVGElementTagNameMap[K] | null;
239
+ querySelector<K extends keyof MathMLElementTagNameMap>(selectors: K): MathMLElementTagNameMap[K] | null;
240
+ querySelector<K extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K): HTMLElementDeprecatedTagNameMap[K] | null;
241
+ querySelector<E extends Element = Element>(selectors: string): E | null;
242
+ querySelectorAll<K extends keyof HTMLElementTagNameMap>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
243
+ querySelectorAll<K extends keyof SVGElementTagNameMap>(selectors: K): NodeListOf<SVGElementTagNameMap[K]>;
244
+ querySelectorAll<K extends keyof MathMLElementTagNameMap>(selectors: K): NodeListOf<MathMLElementTagNameMap[K]>;
245
+ querySelectorAll<K extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>;
246
+ querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
247
+ replaceChildren(...nodes: (Node | string)[]): void;
248
+ readonly assignedSlot: HTMLSlotElement | null;
249
+ readonly attributeStyleMap: StylePropertyMap;
250
+ get style(): CSSStyleDeclaration;
251
+ set style(cssText: string);
252
+ contentEditable: string;
253
+ enterKeyHint: string;
254
+ inputMode: string;
255
+ readonly isContentEditable: boolean;
256
+ onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
257
+ onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
258
+ onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
259
+ onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
260
+ onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
261
+ onauxclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
262
+ onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
263
+ onbeforematch: ((this: GlobalEventHandlers, ev: Event) => any) | null;
264
+ onbeforetoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null;
265
+ onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
266
+ oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null;
267
+ oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
268
+ oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
269
+ onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
270
+ onclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
271
+ onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
272
+ oncommand: ((this: GlobalEventHandlers, ev: Event) => any) | null;
273
+ oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null;
274
+ oncontextmenu: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
275
+ oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null;
276
+ oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
277
+ oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
278
+ oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
279
+ ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
280
+ ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
281
+ ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
282
+ ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
283
+ ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
284
+ ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
285
+ ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
286
+ ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
287
+ ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
288
+ onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
289
+ onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
290
+ onerror: OnErrorEventHandler;
291
+ onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
292
+ onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null;
293
+ ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
294
+ oninput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
295
+ oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
296
+ onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
297
+ onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
298
+ onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
299
+ onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
300
+ onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
301
+ onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
302
+ onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
303
+ onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
304
+ onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
305
+ onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
306
+ onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
307
+ onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
308
+ onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
309
+ onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
310
+ onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
311
+ onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
312
+ onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
313
+ onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
314
+ onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
315
+ onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
316
+ onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
317
+ onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
318
+ onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
319
+ onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
320
+ onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
321
+ onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
322
+ onpointerrawupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
323
+ onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
324
+ onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null;
325
+ onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
326
+ onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
327
+ onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
328
+ onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
329
+ onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
330
+ onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null;
331
+ onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
332
+ onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
333
+ onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
334
+ onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
335
+ onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
336
+ onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
337
+ onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
338
+ onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null;
339
+ onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
340
+ ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
341
+ ontoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null;
342
+ ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
343
+ ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
344
+ ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
345
+ ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
346
+ ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
347
+ ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
348
+ ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
349
+ ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
350
+ onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
351
+ onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
352
+ onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
353
+ onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null;
354
+ onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
355
+ onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
356
+ onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
357
+ autofocus: boolean;
358
+ readonly dataset: DOMStringMap;
359
+ nonce: string;
360
+ tabIndex: number;
361
+ blur(): void;
362
+ focus(options?: FocusOptions): void;
363
+ };
364
+ formAssociated: boolean;
365
+ } & typeof LitElement;
366
+ export declare class WebUiCheckboxGroup extends WebUiCheckboxGroup_base {
3
367
  static styles: import('lit').CSSResult;
4
- static formAssociated: boolean;
5
368
  name: string;
6
369
  disabled: boolean;
7
370
  required: boolean;
@@ -12,9 +375,7 @@ export declare class WebUiCheckboxGroup extends LitElement {
12
375
  private get _isDisabled();
13
376
  private readonly _formAssociation;
14
377
  private readonly _formAssociationController;
15
- formResetCallback(): void;
16
378
  formDisabledCallback(disabled: boolean): void;
17
- formStateRestoreCallback(state: string | File | FormData | null): void;
18
379
  private _syncValidity;
19
380
  render(): import('lit').TemplateResult<1>;
20
381
  readonly $events: {
@@ -27,3 +388,4 @@ declare global {
27
388
  'web-ui-checkbox-group': WebUiCheckboxGroup;
28
389
  }
29
390
  }
391
+ export {};
@@ -1,13 +1,13 @@
1
1
  import e from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
2
- import { FormAssociationController as t, defineFormAssociation as n } from "../../shared/form-association/index.js";
3
- import { GroupController as r, defineGroupCoordinator as i } from "../../shared/group-management/index.js";
4
- import a from "./style.js";
5
- import { LitElement as o, html as s, unsafeCSS as c } from "lit";
6
- import { customElement as l, property as u, state as d } from "lit/decorators.js";
2
+ import { FormAssociated as t, FormAssociationController as n, defineFormAssociation as r } from "../../shared/form-association/index.js";
3
+ import { GroupController as i, defineGroupCoordinator as a } from "../../shared/group-management/index.js";
4
+ import o from "./style.js";
5
+ import { LitElement as s, html as c, unsafeCSS as l } from "lit";
6
+ import { customElement as u, property as d, state as f } from "lit/decorators.js";
7
7
  //#region src/components/checkbox-group/index.ts
8
- var f = class extends o {
8
+ var p = class extends t(s) {
9
9
  constructor(...e) {
10
- super(...e), this.name = "", this.disabled = !1, this.required = !1, this._value = [], this._groupController = new r(this, i({
10
+ super(...e), this.name = "", this.disabled = !1, this.required = !1, this._value = [], this._groupController = new i(this, a({
11
11
  host: this,
12
12
  getItems: () => [...this.querySelectorAll("web-ui-checkbox")],
13
13
  getValue: () => this._value,
@@ -32,7 +32,7 @@ var f = class extends o {
32
32
  composed: !0
33
33
  }));
34
34
  }
35
- }).make()), this._formAssociation = n({
35
+ }).make()), this._formAssociation = r({
36
36
  host: this,
37
37
  initialize: () => {
38
38
  let e = this.getAttribute("value");
@@ -56,13 +56,10 @@ var f = class extends o {
56
56
  } catch {}
57
57
  },
58
58
  syncValidity: () => this._syncValidity()
59
- }).make(), this._formAssociationController = new t(this, this._formAssociation);
59
+ }).make(), this._formAssociationController = new n(this, this._formAssociation);
60
60
  }
61
61
  static {
62
- this.styles = c(a);
63
- }
64
- static {
65
- this.formAssociated = !0;
62
+ this.styles = l(o);
66
63
  }
67
64
  get value() {
68
65
  return this._value;
@@ -74,15 +71,9 @@ var f = class extends o {
74
71
  get _isDisabled() {
75
72
  return this.disabled || this._formAssociation.isFormDisabled();
76
73
  }
77
- formResetCallback() {
78
- this._formAssociation.reset();
79
- }
80
74
  formDisabledCallback(e) {
81
75
  this._formAssociation.setDisabled(e), this._groupController.sync();
82
76
  }
83
- formStateRestoreCallback(e) {
84
- this._formAssociation.restore(e);
85
- }
86
77
  _syncValidity() {
87
78
  let e = this._formAssociation.getInternals();
88
79
  if (!(!e || typeof e.setValidity != "function")) {
@@ -94,20 +85,20 @@ var f = class extends o {
94
85
  }
95
86
  }
96
87
  render() {
97
- return s`<div class="wui-checkbox-group"><slot></slot></div>`;
88
+ return c`<div class="wui-checkbox-group"><slot></slot></div>`;
98
89
  }
99
90
  };
100
- e([u({
91
+ e([d({
101
92
  type: String,
102
93
  reflect: !0
103
- })], f.prototype, "name", void 0), e([u({
94
+ })], p.prototype, "name", void 0), e([d({
104
95
  type: Boolean,
105
96
  reflect: !0
106
- })], f.prototype, "disabled", void 0), e([u({
97
+ })], p.prototype, "disabled", void 0), e([d({
107
98
  type: Boolean,
108
99
  reflect: !0
109
- })], f.prototype, "required", void 0), e([d()], f.prototype, "_value", void 0), f = e([l("web-ui-checkbox-group")], f);
100
+ })], p.prototype, "required", void 0), e([f()], p.prototype, "_value", void 0), p = e([u("web-ui-checkbox-group")], p);
110
101
  //#endregion
111
- export { f as WebUiCheckboxGroup };
102
+ export { p as WebUiCheckboxGroup };
112
103
 
113
104
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/checkbox-group/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { defineFormAssociation, FormAssociationController } from '@/shared/form-association'\nimport { defineGroupCoordinator, GroupController } from '@/shared/group-management'\n\nimport type { WebUiCheckbox } from '../checkbox'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-checkbox-group')\nexport class WebUiCheckboxGroup extends LitElement {\n static override styles = unsafeCSS(style)\n static formAssociated = true\n\n @property({ type: String, reflect: true }) name = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) required = false\n\n @state() private _value: string[] = []\n\n private readonly _groupController = new GroupController(\n this,\n defineGroupCoordinator<WebUiCheckbox, string[]>({\n host: this,\n getItems: () => [...this.querySelectorAll<WebUiCheckbox>('web-ui-checkbox')],\n getValue: () => this._value,\n setValue: value => {\n this.value = value\n },\n getDisabled: () => this._isDisabled,\n isItem: (target): target is WebUiCheckbox => target instanceof HTMLElement && target.matches('web-ui-checkbox'),\n isItemSelected: (checkbox, value) => value.includes(checkbox.value),\n getNextValue: (checkbox, value) =>\n checkbox.checked ? [...new Set([...value, checkbox.value])] : value.filter(item => item !== checkbox.value),\n valuesEqual: (a, b) => a.length === b.length && a.every((value, index) => value === b[index]),\n copyValue: value => [...value],\n setItemSelected: (checkbox, selected) => {\n checkbox.checked = selected\n },\n dispatchValueChange: () => {\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n }).make()\n )\n\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._formAssociation.sync()\n this.requestUpdate('value', old)\n }\n\n private get _isDisabled(): boolean {\n return this.disabled || this._formAssociation.isFormDisabled()\n }\n\n private readonly _formAssociation = defineFormAssociation<string[]>({\n host: this,\n initialize: () => {\n const attributeValue = this.getAttribute('value')\n if (attributeValue !== null) this.value = attributeValue.split(',').filter(Boolean)\n },\n getState: () => this._value,\n setState: value => {\n this.value = value\n },\n copyState: value => [...value],\n getFormValue: () => {\n if (!this.name || this._value.length === 0) return null\n const formData = new FormData()\n this._value.forEach(value => formData.append(this.name, value))\n return formData\n },\n getFormState: () => JSON.stringify(this._value),\n restoreState: state => {\n if (typeof state !== 'string') return\n try {\n const value = JSON.parse(state)\n if (Array.isArray(value) && value.every(item => typeof item === 'string')) this.value = value\n } catch {\n // 忽略无法解析的历史表单状态。\n }\n },\n syncValidity: () => this._syncValidity()\n }).make()\n\n private readonly _formAssociationController = new FormAssociationController(this, this._formAssociation)\n\n formResetCallback() {\n this._formAssociation.reset()\n }\n\n formDisabledCallback(disabled: boolean) {\n this._formAssociation.setDisabled(disabled)\n this._groupController.sync()\n }\n\n formStateRestoreCallback(state: string | File | FormData | null) {\n this._formAssociation.restore(state)\n }\n\n private _syncValidity() {\n const internals = this._formAssociation.getInternals()\n if (!internals || typeof internals.setValidity !== 'function') return\n if (this._isDisabled || !this.required || this._value.length > 0) {\n internals.setValidity({})\n return\n }\n internals.setValidity({ valueMissing: true }, '请至少选择一项')\n }\n\n override render() {\n return html`<div class=\"wui-checkbox-group\"><slot></slot></div>`\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'web-ui-checkbox-group': WebUiCheckboxGroup\n }\n}\n"],"mappings":";;;;;;;AAWO,IAAM,IAAN,cAAiC,EAAW;;EAiFH,aA7EI,KAAA,OAAA,IACK,KAAA,WAAA,IACA,KAAA,WAAA,IAEnB,KAAA,SAAA,CAAC,GAED,K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B,OAAO,CAAI;CACb;AAMF;AA9GG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GACxC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GAEzC,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,UAAA,KAAA,CAAA,GATR,IAAA,EAAA,CAAA,EAAc,uBAAuB,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/checkbox-group/index.ts"],"sourcesContent":["import { html, LitElement, unsafeCSS } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { FormAssociated, defineFormAssociation, FormAssociationController } from '@/shared/form-association'\nimport { defineGroupCoordinator, GroupController } from '@/shared/group-management'\n\nimport type { WebUiCheckbox } from '../checkbox'\n\nimport style from './style.css?inline'\n\n@customElement('web-ui-checkbox-group')\nexport class WebUiCheckboxGroup extends FormAssociated(LitElement) {\n static override styles = unsafeCSS(style)\n @property({ type: String, reflect: true }) name = ''\n @property({ type: Boolean, reflect: true }) disabled = false\n @property({ type: Boolean, reflect: true }) required = false\n\n @state() private _value: string[] = []\n\n private readonly _groupController = new GroupController(\n this,\n defineGroupCoordinator<WebUiCheckbox, string[]>({\n host: this,\n getItems: () => [...this.querySelectorAll<WebUiCheckbox>('web-ui-checkbox')],\n getValue: () => this._value,\n setValue: value => {\n this.value = value\n },\n getDisabled: () => this._isDisabled,\n isItem: (target): target is WebUiCheckbox => target instanceof HTMLElement && target.matches('web-ui-checkbox'),\n isItemSelected: (checkbox, value) => value.includes(checkbox.value),\n getNextValue: (checkbox, value) =>\n checkbox.checked ? [...new Set([...value, checkbox.value])] : value.filter(item => item !== checkbox.value),\n valuesEqual: (a, b) => a.length === b.length && a.every((value, index) => value === b[index]),\n copyValue: value => [...value],\n setItemSelected: (checkbox, selected) => {\n checkbox.checked = selected\n },\n dispatchValueChange: () => {\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n }\n }).make()\n )\n\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._formAssociation.sync()\n this.requestUpdate('value', old)\n }\n\n private get _isDisabled(): boolean {\n return this.disabled || this._formAssociation.isFormDisabled()\n }\n\n private readonly _formAssociation = defineFormAssociation<string[]>({\n host: this,\n initialize: () => {\n const attributeValue = this.getAttribute('value')\n if (attributeValue !== null) this.value = attributeValue.split(',').filter(Boolean)\n },\n getState: () => this._value,\n setState: value => {\n this.value = value\n },\n copyState: value => [...value],\n getFormValue: () => {\n if (!this.name || this._value.length === 0) return null\n const formData = new FormData()\n this._value.forEach(value => formData.append(this.name, value))\n return formData\n },\n getFormState: () => JSON.stringify(this._value),\n restoreState: state => {\n if (typeof state !== 'string') return\n try {\n const value = JSON.parse(state)\n if (Array.isArray(value) && value.every(item => typeof item === 'string')) this.value = value\n } catch {\n // 忽略无法解析的历史表单状态。\n }\n },\n syncValidity: () => this._syncValidity()\n }).make()\n\n private readonly _formAssociationController = new FormAssociationController(this, this._formAssociation)\n\n override formDisabledCallback(disabled: boolean) {\n this._formAssociation.setDisabled(disabled)\n this._groupController.sync()\n }\n\n private _syncValidity() {\n const internals = this._formAssociation.getInternals()\n if (!internals || typeof internals.setValidity !== 'function') return\n if (this._isDisabled || !this.required || this._value.length > 0) {\n internals.setValidity({})\n return\n }\n internals.setValidity({ valueMissing: true }, '请至少选择一项')\n }\n\n override render() {\n return html`<div class=\"wui-checkbox-group\"><slot></slot></div>`\n }\n\n declare readonly $events: {\n input: Event\n change: Event\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameM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A,EAAU,YAAY,EAAE,cAAc,GAAK,GAAG,SAAS;EADvD;CAEF;CAEA,SAAkB;EAChB,OAAO,CAAI;CACb;AAMF;AAtGG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GACxC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GACzC,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GAEzC,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,UAAA,KAAA,CAAA,GAPR,IAAA,EAAA,CAAA,EAAc,uBAAuB,CAAA,GAAA,CAAA"}
@@ -1,21 +1,22 @@
1
1
  import e from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
2
- import { getTransitionDuration as t } from "../../shared/overlay/presence.js";
3
- import { UserChangeController as n } from "../../shared/events/user-change.js";
4
- import r from "./style.js";
5
- import { LitElement as i, html as a, unsafeCSS as o } from "lit";
6
- import { customElement as s, property as c, query as l } from "lit/decorators.js";
7
- import { classMap as u } from "lit/directives/class-map.js";
2
+ import { dispatchOpenChangeEvent as t } from "../../shared/open-state/index.js";
3
+ import { getTransitionDuration as n } from "../../shared/overlay/presence.js";
4
+ import { UserChangeController as r } from "../../shared/events/user-change.js";
5
+ import i from "./style.js";
6
+ import { LitElement as a, html as o, unsafeCSS as s } from "lit";
7
+ import { customElement as c, property as l, query as u } from "lit/decorators.js";
8
+ import { classMap as d } from "lit/directives/class-map.js";
8
9
  //#region src/components/collapse/index.ts
9
- var d = 80, f = 0, p = class extends i {
10
+ var f = 80, p = 0, m = class extends a {
10
11
  constructor(...e) {
11
- super(...e), this.open = !1, this.disabled = !1, this.horizontal = !1, this.keepMounted = !1, this._contentId = `wui-collapse-content-${++f}`, this._userOpenChange = new n(), this._generation = 0, this._onTriggerClick = (e) => {
12
+ super(...e), this.open = !1, this.disabled = !1, this.horizontal = !1, this.keepMounted = !1, this._contentId = `wui-collapse-content-${++p}`, this._userOpenChange = new r(), this._generation = 0, this._onTriggerClick = (e) => {
12
13
  this.disabled || e.composedPath().includes(this._triggerWrapper) && (this._userOpenChange.mark(), this.toggle());
13
14
  }, this._onTriggerSlotChange = () => {
14
15
  this.requestUpdate();
15
16
  };
16
17
  }
17
18
  static {
18
- this.styles = o(r);
19
+ this.styles = s(i);
19
20
  }
20
21
  connectedCallback() {
21
22
  super.connectedCallback(), this.addEventListener("click", this._onTriggerClick), this.hasUpdated && (this._generation++, this._clearExitTimer(), this._lastOpen = void 0, this.requestUpdate());
@@ -40,11 +41,7 @@ var d = 80, f = 0, p = class extends i {
40
41
  this.open ? this.close() : this.show();
41
42
  }
42
43
  _dispatchChange(e) {
43
- this.dispatchEvent(new CustomEvent("open-change", {
44
- detail: { open: e },
45
- bubbles: !0,
46
- composed: !0
47
- }));
44
+ t(this, e);
48
45
  }
49
46
  _queryTrigger() {
50
47
  let e = (this.shadowRoot?.querySelector(".wui-collapse-trigger-wrapper slot"))?.assignedElements()[0];
@@ -95,15 +92,15 @@ var d = 80, f = 0, p = class extends i {
95
92
  let n = this._contentContainer();
96
93
  this._setInnerInert(!1), n && (n.hidden = !0);
97
94
  }
98
- _awaitTransition(e, n, r) {
99
- let i = t(e, 0);
95
+ _awaitTransition(e, t, r) {
96
+ let i = n(e, 0);
100
97
  if (i === 0) {
101
- n === this._generation && r();
98
+ t === this._generation && r();
102
99
  return;
103
100
  }
104
101
  let a = !1, o = () => {
105
- e.removeEventListener("transitionend", c), this._exitTimer === s && (this._exitTimer = void 0), clearTimeout(s), !(a || n !== this._generation) && (a = !0, r());
106
- }, s = setTimeout(o, i + d);
102
+ e.removeEventListener("transitionend", c), this._exitTimer === s && (this._exitTimer = void 0), clearTimeout(s), !(a || t !== this._generation) && (a = !0, r());
103
+ }, s = setTimeout(o, i + f);
107
104
  this._exitTimer = s;
108
105
  let c = (t) => {
109
106
  t.target === e && (t.propertyName === "grid-template-rows" || t.propertyName === "grid-template-columns") && o();
@@ -127,10 +124,10 @@ var d = 80, f = 0, p = class extends i {
127
124
  "wui-collapse-track": !0,
128
125
  "is-horizontal": this.horizontal
129
126
  };
130
- return a`
127
+ return o`
131
128
  <div class="wui-collapse-trigger-wrapper" @slotchange=${this._onTriggerSlotChange}><slot></slot></div>
132
129
  <div class="wui-collapse-content">
133
- <div class=${u(e)} id=${this._contentId}>
130
+ <div class=${d(e)} id=${this._contentId}>
134
131
  <div class="wui-collapse-inner">
135
132
  <slot name="content"></slot>
136
133
  </div>
@@ -139,21 +136,21 @@ var d = 80, f = 0, p = class extends i {
139
136
  `;
140
137
  }
141
138
  };
142
- e([c({
139
+ e([l({
143
140
  type: Boolean,
144
141
  reflect: !0
145
- })], p.prototype, "open", void 0), e([c({
142
+ })], m.prototype, "open", void 0), e([l({
146
143
  type: Boolean,
147
144
  reflect: !0
148
- })], p.prototype, "disabled", void 0), e([c({
145
+ })], m.prototype, "disabled", void 0), e([l({
149
146
  type: Boolean,
150
147
  reflect: !0
151
- })], p.prototype, "horizontal", void 0), e([c({
148
+ })], m.prototype, "horizontal", void 0), e([l({
152
149
  type: Boolean,
153
150
  reflect: !0,
154
151
  attribute: "keep-mounted"
155
- })], p.prototype, "keepMounted", void 0), e([l(".wui-collapse-trigger-wrapper")], p.prototype, "_triggerWrapper", void 0), p = e([s("web-ui-collapse")], p);
152
+ })], m.prototype, "keepMounted", void 0), e([u(".wui-collapse-trigger-wrapper")], m.prototype, "_triggerWrapper", void 0), m = e([c("web-ui-collapse")], m);
156
153
  //#endregion
157
- export { p as WebUiCollapse };
154
+ export { m as WebUiCollapse };
158
155
 
159
156
  //# sourceMappingURL=index.js.map