@threadlabs/looma 0.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.
- package/LICENSE +21 -0
- package/README.md +21 -0
- package/dist/chunk-G53JEAQK.js +94 -0
- package/dist/chunk-OF57X5AR.js +10 -0
- package/dist/chunk-UL7UIUJZ.js +20 -0
- package/dist/chunk-YK4MTZGJ.js +1580 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/events-TcQIzpNv.js +19 -0
- package/dist/cjs/id-CYbKpaYr.js +9 -0
- package/dist/cjs/index-D07f6BOw.js +1569 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/looma.cjs.js +25 -0
- package/dist/cjs/manager-BOpVXb92.js +93 -0
- package/dist/cjs/ui-avatar-group.cjs.entry.js +51 -0
- package/dist/cjs/ui-avatar.cjs.entry.js +50 -0
- package/dist/cjs/ui-badge.cjs.entry.js +19 -0
- package/dist/cjs/ui-button.cjs.entry.js +62 -0
- package/dist/cjs/ui-checkbox.cjs.entry.js +91 -0
- package/dist/cjs/ui-context-menu.cjs.entry.js +201 -0
- package/dist/cjs/ui-dialog.cjs.entry.js +93 -0
- package/dist/cjs/ui-disclosure.cjs.entry.js +109 -0
- package/dist/cjs/ui-floating-action-button.cjs.entry.js +20 -0
- package/dist/cjs/ui-form-field.cjs.entry.js +59 -0
- package/dist/cjs/ui-icon-button.cjs.entry.js +21 -0
- package/dist/cjs/ui-input.cjs.entry.js +101 -0
- package/dist/cjs/ui-menu-item.cjs.entry.js +19 -0
- package/dist/cjs/ui-menu.cjs.entry.js +96 -0
- package/dist/cjs/ui-popover.cjs.entry.js +92 -0
- package/dist/cjs/ui-radio-group.cjs.entry.js +134 -0
- package/dist/cjs/ui-radio.cjs.entry.js +85 -0
- package/dist/cjs/ui-search-result-row.cjs.entry.js +47 -0
- package/dist/cjs/ui-search-shell.cjs.entry.js +39 -0
- package/dist/cjs/ui-select.cjs.entry.js +100 -0
- package/dist/cjs/ui-switch.cjs.entry.js +65 -0
- package/dist/cjs/ui-tabs.cjs.entry.js +117 -0
- package/dist/cjs/ui-textarea.cjs.entry.js +106 -0
- package/dist/cjs/ui-toast-region.cjs.entry.js +67 -0
- package/dist/cjs/ui-tooltip.cjs.entry.js +133 -0
- package/dist/cjs/ui-top-bar.cjs.entry.js +43 -0
- package/dist/collection/collection-manifest.json +38 -0
- package/dist/collection/components/ui-avatar/ui-avatar.css +35 -0
- package/dist/collection/components/ui-avatar/ui-avatar.js +130 -0
- package/dist/collection/components/ui-avatar-group/ui-avatar-group.css +32 -0
- package/dist/collection/components/ui-avatar-group/ui-avatar-group.js +103 -0
- package/dist/collection/components/ui-badge/ui-badge.css +74 -0
- package/dist/collection/components/ui-badge/ui-badge.js +62 -0
- package/dist/collection/components/ui-button/ui-button.css +101 -0
- package/dist/collection/components/ui-button/ui-button.js +127 -0
- package/dist/collection/components/ui-checkbox/ui-checkbox.css +24 -0
- package/dist/collection/components/ui-checkbox/ui-checkbox.js +223 -0
- package/dist/collection/components/ui-context-menu/ui-context-menu.css +17 -0
- package/dist/collection/components/ui-context-menu/ui-context-menu.js +272 -0
- package/dist/collection/components/ui-dialog/ui-dialog.css +65 -0
- package/dist/collection/components/ui-dialog/ui-dialog.js +185 -0
- package/dist/collection/components/ui-disclosure/ui-disclosure.css +7 -0
- package/dist/collection/components/ui-disclosure/ui-disclosure.js +182 -0
- package/dist/collection/components/ui-floating-action-button/ui-floating-action-button.css +70 -0
- package/dist/collection/components/ui-floating-action-button/ui-floating-action-button.js +85 -0
- package/dist/collection/components/ui-form-field/ui-form-field.css +21 -0
- package/dist/collection/components/ui-form-field/ui-form-field.js +125 -0
- package/dist/collection/components/ui-icon-button/ui-icon-button.css +92 -0
- package/dist/collection/components/ui-icon-button/ui-icon-button.js +106 -0
- package/dist/collection/components/ui-input/ui-input.css +46 -0
- package/dist/collection/components/ui-input/ui-input.js +213 -0
- package/dist/collection/components/ui-menu/ui-menu.css +37 -0
- package/dist/collection/components/ui-menu/ui-menu.js +149 -0
- package/dist/collection/components/ui-menu-item/ui-menu-item.css +26 -0
- package/dist/collection/components/ui-menu-item/ui-menu-item.js +64 -0
- package/dist/collection/components/ui-popover/ui-popover.css +8 -0
- package/dist/collection/components/ui-popover/ui-popover.js +144 -0
- package/dist/collection/components/ui-radio/ui-radio.css +22 -0
- package/dist/collection/components/ui-radio/ui-radio.js +213 -0
- package/dist/collection/components/ui-radio-group/ui-radio-group.css +10 -0
- package/dist/collection/components/ui-radio-group/ui-radio-group.js +247 -0
- package/dist/collection/components/ui-search-result-row/ui-search-result-row.css +80 -0
- package/dist/collection/components/ui-search-result-row/ui-search-result-row.js +100 -0
- package/dist/collection/components/ui-search-shell/ui-search-shell.css +61 -0
- package/dist/collection/components/ui-search-shell/ui-search-shell.js +46 -0
- package/dist/collection/components/ui-select/ui-select.css +62 -0
- package/dist/collection/components/ui-select/ui-select.js +212 -0
- package/dist/collection/components/ui-switch/ui-switch.css +63 -0
- package/dist/collection/components/ui-switch/ui-switch.js +177 -0
- package/dist/collection/components/ui-tabs/ui-tabs.css +65 -0
- package/dist/collection/components/ui-tabs/ui-tabs.js +190 -0
- package/dist/collection/components/ui-textarea/ui-textarea.css +48 -0
- package/dist/collection/components/ui-textarea/ui-textarea.js +238 -0
- package/dist/collection/components/ui-toast-region/ui-toast-region.css +52 -0
- package/dist/collection/components/ui-toast-region/ui-toast-region.js +100 -0
- package/dist/collection/components/ui-tooltip/ui-tooltip.css +14 -0
- package/dist/collection/components/ui-tooltip/ui-tooltip.js +205 -0
- package/dist/collection/components/ui-top-bar/ui-top-bar.css +43 -0
- package/dist/collection/components/ui-top-bar/ui-top-bar.js +52 -0
- package/dist/collection/overlay/manager.js +90 -0
- package/dist/collection/utils/events.js +13 -0
- package/dist/collection/utils/id.js +5 -0
- package/dist/collection/utils/initials.js +11 -0
- package/dist/components/index.d.ts +88 -0
- package/dist/components/index.js +1 -0
- package/dist/components/p-CIA4RyEp.js +1 -0
- package/dist/components/p-CR7f2MQC.js +1 -0
- package/dist/components/p-JwSoedEO.js +1 -0
- package/dist/components/p-WvL4iAhX.js +1 -0
- package/dist/components/p-hgBUJRDa.js +1 -0
- package/dist/components/ui-avatar-group.d.ts +11 -0
- package/dist/components/ui-avatar-group.js +1 -0
- package/dist/components/ui-avatar.d.ts +11 -0
- package/dist/components/ui-avatar.js +1 -0
- package/dist/components/ui-badge.d.ts +11 -0
- package/dist/components/ui-badge.js +1 -0
- package/dist/components/ui-button.d.ts +11 -0
- package/dist/components/ui-button.js +1 -0
- package/dist/components/ui-checkbox.d.ts +11 -0
- package/dist/components/ui-checkbox.js +1 -0
- package/dist/components/ui-context-menu.d.ts +11 -0
- package/dist/components/ui-context-menu.js +1 -0
- package/dist/components/ui-dialog.d.ts +11 -0
- package/dist/components/ui-dialog.js +1 -0
- package/dist/components/ui-disclosure.d.ts +11 -0
- package/dist/components/ui-disclosure.js +1 -0
- package/dist/components/ui-floating-action-button.d.ts +11 -0
- package/dist/components/ui-floating-action-button.js +1 -0
- package/dist/components/ui-form-field.d.ts +11 -0
- package/dist/components/ui-form-field.js +1 -0
- package/dist/components/ui-icon-button.d.ts +11 -0
- package/dist/components/ui-icon-button.js +1 -0
- package/dist/components/ui-input.d.ts +11 -0
- package/dist/components/ui-input.js +1 -0
- package/dist/components/ui-menu-item.d.ts +11 -0
- package/dist/components/ui-menu-item.js +1 -0
- package/dist/components/ui-menu.d.ts +11 -0
- package/dist/components/ui-menu.js +1 -0
- package/dist/components/ui-popover.d.ts +11 -0
- package/dist/components/ui-popover.js +1 -0
- package/dist/components/ui-radio-group.d.ts +11 -0
- package/dist/components/ui-radio-group.js +1 -0
- package/dist/components/ui-radio.d.ts +11 -0
- package/dist/components/ui-radio.js +1 -0
- package/dist/components/ui-search-result-row.d.ts +11 -0
- package/dist/components/ui-search-result-row.js +1 -0
- package/dist/components/ui-search-shell.d.ts +11 -0
- package/dist/components/ui-search-shell.js +1 -0
- package/dist/components/ui-select.d.ts +11 -0
- package/dist/components/ui-select.js +1 -0
- package/dist/components/ui-switch.d.ts +11 -0
- package/dist/components/ui-switch.js +1 -0
- package/dist/components/ui-tabs.d.ts +11 -0
- package/dist/components/ui-tabs.js +1 -0
- package/dist/components/ui-textarea.d.ts +11 -0
- package/dist/components/ui-textarea.js +1 -0
- package/dist/components/ui-toast-region.d.ts +11 -0
- package/dist/components/ui-toast-region.js +1 -0
- package/dist/components/ui-tooltip.d.ts +11 -0
- package/dist/components/ui-tooltip.js +1 -0
- package/dist/components/ui-top-bar.d.ts +11 -0
- package/dist/components/ui-top-bar.js +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/events-JwSoedEO.js +15 -0
- package/dist/esm/id-hgBUJRDa.js +7 -0
- package/dist/esm/index-CEeiinfk.js +1561 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/looma.js +21 -0
- package/dist/esm/manager-CR7f2MQC.js +89 -0
- package/dist/esm/ui-avatar-group.entry.js +49 -0
- package/dist/esm/ui-avatar.entry.js +48 -0
- package/dist/esm/ui-badge.entry.js +17 -0
- package/dist/esm/ui-button.entry.js +60 -0
- package/dist/esm/ui-checkbox.entry.js +89 -0
- package/dist/esm/ui-context-menu.entry.js +199 -0
- package/dist/esm/ui-dialog.entry.js +91 -0
- package/dist/esm/ui-disclosure.entry.js +107 -0
- package/dist/esm/ui-floating-action-button.entry.js +18 -0
- package/dist/esm/ui-form-field.entry.js +57 -0
- package/dist/esm/ui-icon-button.entry.js +19 -0
- package/dist/esm/ui-input.entry.js +99 -0
- package/dist/esm/ui-menu-item.entry.js +17 -0
- package/dist/esm/ui-menu.entry.js +94 -0
- package/dist/esm/ui-popover.entry.js +90 -0
- package/dist/esm/ui-radio-group.entry.js +132 -0
- package/dist/esm/ui-radio.entry.js +83 -0
- package/dist/esm/ui-search-result-row.entry.js +45 -0
- package/dist/esm/ui-search-shell.entry.js +37 -0
- package/dist/esm/ui-select.entry.js +98 -0
- package/dist/esm/ui-switch.entry.js +63 -0
- package/dist/esm/ui-tabs.entry.js +115 -0
- package/dist/esm/ui-textarea.entry.js +104 -0
- package/dist/esm/ui-toast-region.entry.js +65 -0
- package/dist/esm/ui-tooltip.entry.js +131 -0
- package/dist/esm/ui-top-bar.entry.js +41 -0
- package/dist/index.cjs +4062 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +129 -0
- package/dist/looma/index.esm.js +0 -0
- package/dist/looma/looma.esm.js +1 -0
- package/dist/looma/p-03f0594b.entry.js +1 -0
- package/dist/looma/p-15e619fd.entry.js +1 -0
- package/dist/looma/p-201243dc.entry.js +1 -0
- package/dist/looma/p-24d7aa5b.entry.js +1 -0
- package/dist/looma/p-341ba64a.entry.js +1 -0
- package/dist/looma/p-41d62a83.entry.js +1 -0
- package/dist/looma/p-4742e6b4.entry.js +1 -0
- package/dist/looma/p-4c54d489.entry.js +1 -0
- package/dist/looma/p-52c537fa.entry.js +1 -0
- package/dist/looma/p-5a645647.entry.js +1 -0
- package/dist/looma/p-610b2eca.entry.js +1 -0
- package/dist/looma/p-649dad92.entry.js +1 -0
- package/dist/looma/p-66a203a1.entry.js +1 -0
- package/dist/looma/p-754cfff3.entry.js +1 -0
- package/dist/looma/p-93ce1c62.entry.js +1 -0
- package/dist/looma/p-955fb814.entry.js +1 -0
- package/dist/looma/p-96de71ad.entry.js +1 -0
- package/dist/looma/p-CEeiinfk.js +2 -0
- package/dist/looma/p-CR7f2MQC.js +1 -0
- package/dist/looma/p-DQuL1Twl.js +1 -0
- package/dist/looma/p-JwSoedEO.js +1 -0
- package/dist/looma/p-ab4151d5.entry.js +1 -0
- package/dist/looma/p-c14233bc.entry.js +1 -0
- package/dist/looma/p-dc857ed4.entry.js +1 -0
- package/dist/looma/p-dfcb2cca.entry.js +1 -0
- package/dist/looma/p-dff144bd.entry.js +1 -0
- package/dist/looma/p-ebb74106.entry.js +1 -0
- package/dist/looma/p-ecb5739b.entry.js +1 -0
- package/dist/looma/p-ee31c7b4.entry.js +1 -0
- package/dist/looma/p-fa4659c4.entry.js +1 -0
- package/dist/looma/p-hgBUJRDa.js +1 -0
- package/dist/types/components/ui-avatar/ui-avatar.d.ts +11 -0
- package/dist/types/components/ui-avatar-group/ui-avatar-group.d.ts +12 -0
- package/dist/types/components/ui-badge/ui-badge.d.ts +5 -0
- package/dist/types/components/ui-button/ui-button.d.ts +13 -0
- package/dist/types/components/ui-checkbox/ui-checkbox.d.ts +19 -0
- package/dist/types/components/ui-context-menu/ui-context-menu.d.ts +37 -0
- package/dist/types/components/ui-dialog/ui-dialog.d.ts +19 -0
- package/dist/types/components/ui-disclosure/ui-disclosure.d.ts +20 -0
- package/dist/types/components/ui-floating-action-button/ui-floating-action-button.d.ts +6 -0
- package/dist/types/components/ui-form-field/ui-form-field.d.ts +10 -0
- package/dist/types/components/ui-icon-button/ui-icon-button.d.ts +7 -0
- package/dist/types/components/ui-input/ui-input.d.ts +19 -0
- package/dist/types/components/ui-menu/ui-menu.d.ts +14 -0
- package/dist/types/components/ui-menu-item/ui-menu-item.d.ts +5 -0
- package/dist/types/components/ui-popover/ui-popover.d.ts +16 -0
- package/dist/types/components/ui-radio/ui-radio.d.ts +17 -0
- package/dist/types/components/ui-radio-group/ui-radio-group.d.ts +21 -0
- package/dist/types/components/ui-search-result-row/ui-search-result-row.d.ts +15 -0
- package/dist/types/components/ui-search-shell/ui-search-shell.d.ts +9 -0
- package/dist/types/components/ui-select/ui-select.d.ts +19 -0
- package/dist/types/components/ui-switch/ui-switch.d.ts +15 -0
- package/dist/types/components/ui-tabs/ui-tabs.d.ts +17 -0
- package/dist/types/components/ui-textarea/ui-textarea.d.ts +20 -0
- package/dist/types/components/ui-toast-region/ui-toast-region.d.ts +12 -0
- package/dist/types/components/ui-tooltip/ui-tooltip.d.ts +24 -0
- package/dist/types/components/ui-top-bar/ui-top-bar.d.ts +12 -0
- package/dist/types/components.d.ts +1148 -0
- package/dist/types/overlay/manager.d.ts +14 -0
- package/dist/types/stencil-public-runtime.d.ts +1860 -0
- package/dist/types/utils/events.d.ts +4 -0
- package/dist/types/utils/id.d.ts +1 -0
- package/dist/types/utils/initials.d.ts +1 -0
- package/dist/ui-avatar-group.entry-BZGXBOSE.js +59 -0
- package/dist/ui-avatar.entry-S2O2W5SA.js +51 -0
- package/dist/ui-badge.entry-CVJDISCR.js +22 -0
- package/dist/ui-button.entry-LNJBEJFE.js +72 -0
- package/dist/ui-checkbox.entry-5RA2CB43.js +102 -0
- package/dist/ui-context-menu.entry-UUOCT75F.js +211 -0
- package/dist/ui-dialog.entry-OEPJTEES.js +106 -0
- package/dist/ui-disclosure.entry-LRRISGUD.js +120 -0
- package/dist/ui-floating-action-button.entry-7TSAZRXP.js +23 -0
- package/dist/ui-form-field.entry-73YOVICF.js +67 -0
- package/dist/ui-icon-button.entry-MNXGPG36.js +24 -0
- package/dist/ui-input.entry-UWRVAOSW.js +112 -0
- package/dist/ui-menu-item.entry-5AOJO5MP.js +22 -0
- package/dist/ui-menu.entry-YDS6UMB5.js +98 -0
- package/dist/ui-popover.entry-PGWDCQIX.js +104 -0
- package/dist/ui-radio-group.entry-RHP5GNWU.js +142 -0
- package/dist/ui-radio.entry-5WRWPSTK.js +96 -0
- package/dist/ui-search-result-row.entry-IKJB2SJJ.js +50 -0
- package/dist/ui-search-shell.entry-ZIWF4ZHH.js +41 -0
- package/dist/ui-select.entry-N5TIKHR7.js +111 -0
- package/dist/ui-switch.entry-WUSZTXIR.js +75 -0
- package/dist/ui-tabs.entry-UFAVAQIF.js +124 -0
- package/dist/ui-textarea.entry-BYT47RAQ.js +117 -0
- package/dist/ui-toast-region.entry-6UYR3ZU2.js +78 -0
- package/dist/ui-tooltip.entry-YS7UX4FS.js +145 -0
- package/dist/ui-top-bar.entry-V27H6NFO.js +49 -0
- package/editor/chunk-JKRA4D4W.js +435 -0
- package/editor/chunk-NOOV344H.js +783 -0
- package/editor/extensions/index.d.ts +78 -0
- package/editor/extensions/index.js +28 -0
- package/editor/index.d.ts +7 -0
- package/editor/index.js +29 -0
- package/editor/table-overlay-DTr3KC9e.d.ts +12 -0
- package/editor/ui.d.ts +48 -0
- package/editor/ui.js +1 -0
- package/editor.css +662 -0
- package/layout/index.cjs +207 -0
- package/layout/index.css +166 -0
- package/layout/index.d.cts +3 -0
- package/layout/index.d.ts +3 -0
- package/layout/index.js +182 -0
- package/layout.css +124 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +244 -0
- package/styles.css +899 -0
- package/theme-dark.css +59 -0
- package/theme-high-contrast.css +21 -0
- package/theme-light.css +30 -0
- package/tokens.css +148 -0
- package/vue/chunk-J4UBEIIL.js +83 -0
- package/vue/editor/index.d.ts +89 -0
- package/vue/editor/index.js +125 -0
- package/vue/index.d.ts +167 -0
- package/vue/index.js +113 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type OverlayTrigger = 'keyboard' | 'pointer' | 'programmatic';
|
|
2
|
+
export declare function eventToTrigger(event: Event): OverlayTrigger;
|
|
3
|
+
export declare function isActivationKey(event: KeyboardEvent): boolean;
|
|
4
|
+
export declare function dispatchDetail<T>(el: HTMLElement, name: string, detail: T): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createId(prefix: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function toInitials(value: string): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Host,
|
|
3
|
+
getElement,
|
|
4
|
+
h,
|
|
5
|
+
registerInstance
|
|
6
|
+
} from "./chunk-YK4MTZGJ.js";
|
|
7
|
+
|
|
8
|
+
// dist/esm/ui-avatar-group.entry.js
|
|
9
|
+
var uiAvatarGroupCss = () => `:host{display:flex;align-items:center;flex-direction:row-reverse;gap:0}::slotted(*:not([data-ui-avatar-group-overflow])){margin-inline-end:-0.5rem;flex-shrink:0}::slotted(*:last-of-type:not([data-ui-avatar-group-overflow])){margin-inline-end:0}.overflow{margin-inline-end:-0.5rem;display:inline-flex;align-items:center;justify-content:center;inline-size:2.5rem;block-size:2.5rem;border-radius:999px;border:1px solid var(--ui-border-default);background:var(--ui-surface-muted);color:var(--ui-text-secondary);font:inherit;font-size:0.75rem;font-weight:600;flex-shrink:0}`;
|
|
10
|
+
var OVERFLOW_ATTR = "data-ui-avatar-group-overflow";
|
|
11
|
+
var UIAvatarGroup = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
registerInstance(this, hostRef);
|
|
14
|
+
}
|
|
15
|
+
get host() {
|
|
16
|
+
return getElement(this);
|
|
17
|
+
}
|
|
18
|
+
max = 5;
|
|
19
|
+
label = "People";
|
|
20
|
+
overflowCount = 0;
|
|
21
|
+
slotRef;
|
|
22
|
+
syncOverflow() {
|
|
23
|
+
this.updateOverflow();
|
|
24
|
+
}
|
|
25
|
+
componentDidLoad() {
|
|
26
|
+
this.slotRef?.addEventListener("slotchange", () => this.updateOverflow());
|
|
27
|
+
this.updateOverflow();
|
|
28
|
+
}
|
|
29
|
+
componentDidUpdate() {
|
|
30
|
+
this.updateOverflow();
|
|
31
|
+
}
|
|
32
|
+
updateOverflow() {
|
|
33
|
+
const slot = this.host.shadowRoot?.querySelector("slot");
|
|
34
|
+
const nodes = slot?.assignedElements() ?? Array.from(this.host.children);
|
|
35
|
+
const children = nodes.filter((el) => !el.hasAttribute(OVERFLOW_ATTR));
|
|
36
|
+
const total = children.length;
|
|
37
|
+
const visibleCount = Math.min(this.max, total);
|
|
38
|
+
const overflowCount = total > this.max ? total - this.max : 0;
|
|
39
|
+
children.forEach((el, i) => {
|
|
40
|
+
el.hidden = i >= visibleCount;
|
|
41
|
+
el.setAttribute("aria-hidden", String(i >= visibleCount));
|
|
42
|
+
});
|
|
43
|
+
this.overflowCount = overflowCount;
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
return h(Host, { key: "9c8fbeb6e8c87ef4d86778a70a52f48b62717728", role: "list", "aria-label": this.label || void 0 }, h("slot", { key: "432877b335f2a75f6b17a14b4be768c68ba04bfa" }), this.overflowCount > 0 && h("span", { key: "ccf8007947e5d97edcdf42b7f4740db33560956b", class: "overflow", role: "listitem", "aria-label": `${this.overflowCount} more`, "data-ui-avatar-group-overflow": true }, "+", this.overflowCount));
|
|
47
|
+
}
|
|
48
|
+
static get watchers() {
|
|
49
|
+
return {
|
|
50
|
+
"max": [{
|
|
51
|
+
"syncOverflow": 0
|
|
52
|
+
}]
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
UIAvatarGroup.style = uiAvatarGroupCss();
|
|
57
|
+
export {
|
|
58
|
+
UIAvatarGroup as ui_avatar_group
|
|
59
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Host,
|
|
3
|
+
h,
|
|
4
|
+
registerInstance
|
|
5
|
+
} from "./chunk-YK4MTZGJ.js";
|
|
6
|
+
|
|
7
|
+
// dist/esm/ui-avatar.entry.js
|
|
8
|
+
function toInitials(value) {
|
|
9
|
+
const tokens = value.trim().split(/\s+/).filter((token) => token.length > 0);
|
|
10
|
+
if (tokens.length === 0)
|
|
11
|
+
return "?";
|
|
12
|
+
if (tokens.length === 1)
|
|
13
|
+
return tokens[0].slice(0, 2).toUpperCase();
|
|
14
|
+
return `${tokens[0][0] ?? ""}${tokens[1][0] ?? ""}`.toUpperCase();
|
|
15
|
+
}
|
|
16
|
+
var uiAvatarCss = () => `:host{display:inline-grid;place-items:center;overflow:hidden;inline-size:2.5rem;block-size:2.5rem;border-radius:999px;border:1px solid var(--ui-border-default);background:var(--ui-surface-muted);color:var(--ui-text-secondary);font:inherit;font-size:0.875rem;font-weight:600;text-transform:uppercase}.avatar{display:contents}.avatar img{grid-area:1 / 1;inline-size:100%;block-size:100%;object-fit:cover}.avatar .fallback{grid-area:1 / 1;display:inline-flex;align-items:center;justify-content:center;inline-size:100%;block-size:100%}`;
|
|
17
|
+
var UIAvatar = class {
|
|
18
|
+
constructor(hostRef) {
|
|
19
|
+
registerInstance(this, hostRef);
|
|
20
|
+
}
|
|
21
|
+
src = "";
|
|
22
|
+
alt = "";
|
|
23
|
+
name = "";
|
|
24
|
+
fallback = "";
|
|
25
|
+
hasImage = false;
|
|
26
|
+
watchSrc() {
|
|
27
|
+
this.hasImage = false;
|
|
28
|
+
}
|
|
29
|
+
onImageLoad = () => {
|
|
30
|
+
this.hasImage = true;
|
|
31
|
+
};
|
|
32
|
+
onImageError = () => {
|
|
33
|
+
this.hasImage = false;
|
|
34
|
+
};
|
|
35
|
+
render() {
|
|
36
|
+
const fallbackText = this.fallback || toInitials(this.name || this.alt);
|
|
37
|
+
const label = this.alt || this.name || "Avatar";
|
|
38
|
+
return h(Host, { key: "f61c3a4e5556be947b9f573591d4db0687fd01fd", role: "img", "aria-label": label, "data-has-image": this.hasImage ? "" : void 0 }, h("div", { key: "03d4a3d1c86bb1d1779ad007ba12407230478dac", class: "avatar" }, h("img", { key: "512015d68f9118bf8b8181b5b5118c133e783baf", src: this.src, alt: label, onLoad: this.onImageLoad, onError: this.onImageError, hidden: !this.hasImage, "aria-hidden": this.hasImage ? "false" : "true" }), h("span", { key: "48b0f1f81a6465c6021d4c867af67a559b9b8a67", class: "fallback", hidden: this.hasImage, "aria-hidden": this.hasImage ? "true" : "false" }, fallbackText)));
|
|
39
|
+
}
|
|
40
|
+
static get watchers() {
|
|
41
|
+
return {
|
|
42
|
+
"src": [{
|
|
43
|
+
"watchSrc": 0
|
|
44
|
+
}]
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
UIAvatar.style = uiAvatarCss();
|
|
49
|
+
export {
|
|
50
|
+
UIAvatar as ui_avatar
|
|
51
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Host,
|
|
3
|
+
h,
|
|
4
|
+
registerInstance
|
|
5
|
+
} from "./chunk-YK4MTZGJ.js";
|
|
6
|
+
|
|
7
|
+
// dist/esm/ui-badge.entry.js
|
|
8
|
+
var uiBadgeCss = () => `:host{display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--ui-border-default);border-radius:999px;background:var(--ui-surface-muted);color:var(--ui-text-secondary);font:inherit;font-size:0.75rem;line-height:1;padding:0.25em 0.6em;white-space:nowrap}:host([data-tone='accent']){background:var(--ui-accent-solid);border-color:var(--ui-accent-solid);color:var(--ui-text-on-accent)}:host([data-tone='danger']){background:var(--ui-danger-solid);border-color:var(--ui-danger-solid);color:var(--ui-text-on-accent)}:host([data-tone='success']){background:var(--ui-success-solid);border-color:var(--ui-success-solid);color:var(--ui-text-on-accent)}:host([data-tone='warning']){background:var(--ui-warning-solid);border-color:var(--ui-warning-solid);color:var(--ui-text-primary)}:host([data-tone='info']){background:var(--ui-info-solid);border-color:var(--ui-info-solid);color:var(--ui-text-on-accent)}:host([data-variant='subtle'][data-tone='accent']){background:var(--ui-accent-soft);border-color:var(--ui-accent-soft);color:var(--ui-accent-solid)}:host([data-variant='subtle'][data-tone='danger']){background:var(--ui-danger-soft);border-color:var(--ui-danger-soft);color:var(--ui-danger-solid)}:host([data-variant='subtle'][data-tone='success']){background:var(--ui-success-soft);border-color:var(--ui-success-soft);color:var(--ui-success-solid)}:host([data-variant='subtle'][data-tone='warning']){background:var(--ui-warning-soft);border-color:var(--ui-warning-soft);color:var(--ui-warning-solid)}:host([data-variant='subtle'][data-tone='info']){background:var(--ui-info-soft);border-color:var(--ui-info-soft);color:var(--ui-info-solid)}`;
|
|
9
|
+
var UIBadge = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
registerInstance(this, hostRef);
|
|
12
|
+
}
|
|
13
|
+
variant;
|
|
14
|
+
tone;
|
|
15
|
+
render() {
|
|
16
|
+
return h(Host, { key: "53eba0640816bc09ae198de29f9a1ac97c1d5f1d", "data-variant": this.variant || void 0, "data-tone": this.tone || void 0 }, h("slot", { key: "abc8a9e09c2001f222f9aa8f164da76ff8343e01" }));
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
UIBadge.style = uiBadgeCss();
|
|
20
|
+
export {
|
|
21
|
+
UIBadge as ui_badge
|
|
22
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isActivationKey
|
|
3
|
+
} from "./chunk-UL7UIUJZ.js";
|
|
4
|
+
import {
|
|
5
|
+
Host,
|
|
6
|
+
getElement,
|
|
7
|
+
h,
|
|
8
|
+
registerInstance
|
|
9
|
+
} from "./chunk-YK4MTZGJ.js";
|
|
10
|
+
|
|
11
|
+
// dist/esm/ui-button.entry.js
|
|
12
|
+
var uiButtonCss = () => `:host{display:inline-flex;vertical-align:middle;color:var(--ui-text-primary)}::slotted(button){appearance:none;border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-2);background:var(--ui-surface-default);color:inherit;font:inherit;font-weight:var(--ui-font-medium, 500);line-height:var(--ui-line-height-tight);padding:var(--ui-space-2) var(--ui-space-3);cursor:pointer;transition:background-color var(--ui-motion-fast) var(--ui-motion-ease), border-color var(--ui-motion-fast) var(--ui-motion-ease), color var(--ui-motion-fast) var(--ui-motion-ease), box-shadow var(--ui-motion-fast) var(--ui-motion-ease);margin:0}:host([data-size='sm'])::slotted(button){padding:var(--ui-space-1) var(--ui-space-2);font-size:0.875rem}:host([data-size='lg'])::slotted(button){padding:var(--ui-space-3) var(--ui-space-4);font-size:1rem}::slotted(button:hover:enabled){background:var(--ui-surface-muted);border-color:var(--ui-border-strong)}::slotted(button:active:enabled){background:var(--ui-surface-subtle)}:host([data-variant='solid'])::slotted(button){border-color:var(--ui-accent-solid);background:var(--ui-accent-solid);color:var(--ui-text-on-accent);box-shadow:var(--ui-shadow-xs)}:host([data-variant='solid'])::slotted(button:hover:enabled){background:var(--ui-accent-hover);border-color:var(--ui-accent-hover);box-shadow:var(--ui-shadow-sm)}:host([data-variant='solid'])::slotted(button:active:enabled){background:var(--ui-accent-active);border-color:var(--ui-accent-active);box-shadow:none}:host([data-variant='destructive'])::slotted(button){border-color:var(--ui-danger-solid);background:var(--ui-danger-solid);color:var(--ui-text-on-accent);box-shadow:var(--ui-shadow-xs)}:host([data-variant='destructive'])::slotted(button:hover:enabled){background:var(--ui-danger-hover);border-color:var(--ui-danger-hover);box-shadow:var(--ui-shadow-sm)}:host([data-variant='ghost'])::slotted(button){border-color:transparent;background:transparent}:host([data-variant='ghost'])::slotted(button:hover:enabled){background:var(--ui-surface-muted);border-color:transparent}:host([data-variant='ghost'])::slotted(button:active:enabled){background:var(--ui-surface-subtle);border-color:transparent}::slotted(button:focus-visible){outline:2px solid var(--ui-focus-ring);outline-offset:2px}::slotted(button:disabled),:host([data-disabled]){opacity:0.6;cursor:not-allowed}`;
|
|
13
|
+
var UIButton = class {
|
|
14
|
+
constructor(hostRef) {
|
|
15
|
+
registerInstance(this, hostRef);
|
|
16
|
+
}
|
|
17
|
+
get host() {
|
|
18
|
+
return getElement(this);
|
|
19
|
+
}
|
|
20
|
+
variant;
|
|
21
|
+
size;
|
|
22
|
+
disabled = false;
|
|
23
|
+
slotRef;
|
|
24
|
+
syncToButton() {
|
|
25
|
+
const btn = this.getButton();
|
|
26
|
+
if (!btn)
|
|
27
|
+
return;
|
|
28
|
+
this.host.dataset.variant = this.variant || "";
|
|
29
|
+
this.host.dataset.size = this.size || "";
|
|
30
|
+
this.host.dataset.disabled = this.disabled ? "true" : "";
|
|
31
|
+
btn.disabled = this.disabled;
|
|
32
|
+
}
|
|
33
|
+
componentDidLoad() {
|
|
34
|
+
this.slotRef?.addEventListener("slotchange", () => this.syncToButton());
|
|
35
|
+
this.syncToButton();
|
|
36
|
+
}
|
|
37
|
+
componentDidUpdate() {
|
|
38
|
+
this.syncToButton();
|
|
39
|
+
}
|
|
40
|
+
getButton() {
|
|
41
|
+
const slot = this.host.shadowRoot?.querySelector("slot");
|
|
42
|
+
const nodes = slot?.assignedElements() ?? Array.from(this.host.children);
|
|
43
|
+
return nodes.find((el) => el.tagName === "BUTTON") ?? null;
|
|
44
|
+
}
|
|
45
|
+
onKeydown = (e) => {
|
|
46
|
+
const btn = this.getButton();
|
|
47
|
+
if (btn || this.disabled || !isActivationKey(e))
|
|
48
|
+
return;
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
this.host.click();
|
|
51
|
+
};
|
|
52
|
+
render() {
|
|
53
|
+
return h(Host, { key: "01011aa13228b9e8d10ed11b99c95ef1df91326d", "data-variant": this.variant || void 0, "data-size": this.size || void 0, "data-disabled": this.disabled ? "" : void 0, onKeyDown: this.onKeydown }, h("slot", { key: "2bf0274d2732ea46fdf016a46d85bbe6e0d96bba", ref: (el) => this.slotRef = el }));
|
|
54
|
+
}
|
|
55
|
+
static get watchers() {
|
|
56
|
+
return {
|
|
57
|
+
"variant": [{
|
|
58
|
+
"syncToButton": 0
|
|
59
|
+
}],
|
|
60
|
+
"size": [{
|
|
61
|
+
"syncToButton": 0
|
|
62
|
+
}],
|
|
63
|
+
"disabled": [{
|
|
64
|
+
"syncToButton": 0
|
|
65
|
+
}]
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
UIButton.style = uiButtonCss();
|
|
70
|
+
export {
|
|
71
|
+
UIButton as ui_button
|
|
72
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dispatchDetail,
|
|
3
|
+
eventToTrigger
|
|
4
|
+
} from "./chunk-UL7UIUJZ.js";
|
|
5
|
+
import {
|
|
6
|
+
Host,
|
|
7
|
+
getElement,
|
|
8
|
+
h,
|
|
9
|
+
registerInstance
|
|
10
|
+
} from "./chunk-YK4MTZGJ.js";
|
|
11
|
+
|
|
12
|
+
// dist/esm/ui-checkbox.entry.js
|
|
13
|
+
var uiCheckboxCss = () => `:host{display:inline-flex;align-items:center;gap:var(--ui-space-2);color:var(--ui-text-primary)}:host([aria-disabled='true']),:host([data-disabled='true']){opacity:0.6;cursor:not-allowed}::slotted(input[type='checkbox']){accent-color:var(--ui-accent-solid);width:1.125em;height:1.125em;cursor:pointer}::slotted(input[type='checkbox']:focus-visible){outline:2px solid var(--ui-accent-solid);outline-offset:2px}`;
|
|
14
|
+
var UICheckbox = class {
|
|
15
|
+
constructor(hostRef) {
|
|
16
|
+
registerInstance(this, hostRef);
|
|
17
|
+
}
|
|
18
|
+
get host() {
|
|
19
|
+
return getElement(this);
|
|
20
|
+
}
|
|
21
|
+
checked = false;
|
|
22
|
+
defaultChecked = false;
|
|
23
|
+
disabled = false;
|
|
24
|
+
indeterminate = false;
|
|
25
|
+
required = false;
|
|
26
|
+
value = "on";
|
|
27
|
+
internalChecked = false;
|
|
28
|
+
slotRef;
|
|
29
|
+
syncFromProp() {
|
|
30
|
+
this.internalChecked = this.checked;
|
|
31
|
+
}
|
|
32
|
+
syncToInput() {
|
|
33
|
+
const input = this.getInput();
|
|
34
|
+
if (!input)
|
|
35
|
+
return;
|
|
36
|
+
this.host.dataset.disabled = this.disabled ? "true" : "";
|
|
37
|
+
this.host.setAttribute("aria-disabled", String(this.disabled));
|
|
38
|
+
input.checked = this.internalChecked;
|
|
39
|
+
input.indeterminate = this.indeterminate;
|
|
40
|
+
input.disabled = this.disabled;
|
|
41
|
+
input.required = this.required;
|
|
42
|
+
input.value = this.value;
|
|
43
|
+
}
|
|
44
|
+
componentDidLoad() {
|
|
45
|
+
this.syncFromProp();
|
|
46
|
+
this.internalChecked = this.internalChecked || this.defaultChecked;
|
|
47
|
+
this.slotRef?.addEventListener("slotchange", () => this.syncToInput());
|
|
48
|
+
this.syncToInput();
|
|
49
|
+
const input = this.getInput();
|
|
50
|
+
input?.addEventListener("change", this.onInputChange);
|
|
51
|
+
}
|
|
52
|
+
disconnectedCallback() {
|
|
53
|
+
const input = this.getInput();
|
|
54
|
+
input?.removeEventListener("change", this.onInputChange);
|
|
55
|
+
}
|
|
56
|
+
componentDidUpdate() {
|
|
57
|
+
this.syncToInput();
|
|
58
|
+
}
|
|
59
|
+
getInput() {
|
|
60
|
+
const slot = this.host.shadowRoot?.querySelector("slot");
|
|
61
|
+
const nodes = slot?.assignedElements() ?? Array.from(this.host.children);
|
|
62
|
+
return nodes.find((el) => el instanceof HTMLInputElement && el.type === "checkbox") ?? null;
|
|
63
|
+
}
|
|
64
|
+
onInputChange = (e) => {
|
|
65
|
+
const input = e.target;
|
|
66
|
+
if (!input)
|
|
67
|
+
return;
|
|
68
|
+
this.internalChecked = input.checked;
|
|
69
|
+
this.indeterminate = input.indeterminate;
|
|
70
|
+
dispatchDetail(this.host, "change", {
|
|
71
|
+
checked: this.internalChecked,
|
|
72
|
+
value: this.value,
|
|
73
|
+
trigger: eventToTrigger(e)
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
render() {
|
|
77
|
+
return h(Host, { key: "c125eb000960f63f48ae8a96e8f001c843f8baa7", role: "checkbox", "aria-checked": this.indeterminate ? "mixed" : String(this.internalChecked), "aria-disabled": String(this.disabled), "data-disabled": this.disabled ? "" : void 0 }, h("slot", { key: "8eade76069c56e00d160488c5d91dae7b46ccc99", ref: (el) => this.slotRef = el }));
|
|
78
|
+
}
|
|
79
|
+
static get watchers() {
|
|
80
|
+
return {
|
|
81
|
+
"checked": [{
|
|
82
|
+
"syncFromProp": 0
|
|
83
|
+
}],
|
|
84
|
+
"internalChecked": [{
|
|
85
|
+
"syncToInput": 0
|
|
86
|
+
}],
|
|
87
|
+
"indeterminate": [{
|
|
88
|
+
"syncToInput": 0
|
|
89
|
+
}],
|
|
90
|
+
"disabled": [{
|
|
91
|
+
"syncToInput": 0
|
|
92
|
+
}],
|
|
93
|
+
"required": [{
|
|
94
|
+
"syncToInput": 0
|
|
95
|
+
}]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
UICheckbox.style = uiCheckboxCss();
|
|
100
|
+
export {
|
|
101
|
+
UICheckbox as ui_checkbox
|
|
102
|
+
};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import {
|
|
2
|
+
closeOverlay,
|
|
3
|
+
openOverlay,
|
|
4
|
+
requestTopOverlayClose
|
|
5
|
+
} from "./chunk-G53JEAQK.js";
|
|
6
|
+
import {
|
|
7
|
+
dispatchDetail
|
|
8
|
+
} from "./chunk-UL7UIUJZ.js";
|
|
9
|
+
import {
|
|
10
|
+
Host,
|
|
11
|
+
getElement,
|
|
12
|
+
h,
|
|
13
|
+
registerInstance
|
|
14
|
+
} from "./chunk-YK4MTZGJ.js";
|
|
15
|
+
|
|
16
|
+
// dist/esm/ui-context-menu.entry.js
|
|
17
|
+
var uiContextMenuCss = () => `:host{display:contents}.menu{position:fixed;z-index:var(--ui-z-overlay, 1000);min-width:12rem}.menu[data-open]{display:block}.menu:not([data-open]){display:none !important}`;
|
|
18
|
+
var UIContextMenu = class {
|
|
19
|
+
constructor(hostRef) {
|
|
20
|
+
registerInstance(this, hostRef);
|
|
21
|
+
}
|
|
22
|
+
get host() {
|
|
23
|
+
return getElement(this);
|
|
24
|
+
}
|
|
25
|
+
/** Controls the menu when the consumer owns open state. */
|
|
26
|
+
open = false;
|
|
27
|
+
/** Opens the menu on first client render. */
|
|
28
|
+
defaultOpen = false;
|
|
29
|
+
/** Optional id of the region that should also respond to a context-menu gesture. */
|
|
30
|
+
for;
|
|
31
|
+
internalOpen = false;
|
|
32
|
+
overlayId = `ui-context-menu-${Math.random().toString(36).slice(2, 11)}`;
|
|
33
|
+
trigger = null;
|
|
34
|
+
contextTarget = null;
|
|
35
|
+
pointerX = 0;
|
|
36
|
+
pointerY = 0;
|
|
37
|
+
syncFromProp() {
|
|
38
|
+
this.internalOpen = this.open;
|
|
39
|
+
}
|
|
40
|
+
syncTarget() {
|
|
41
|
+
this.resolveTargets();
|
|
42
|
+
this.attachTargetListeners();
|
|
43
|
+
}
|
|
44
|
+
syncOverlay() {
|
|
45
|
+
this.syncTriggerState();
|
|
46
|
+
if (this.internalOpen) {
|
|
47
|
+
openOverlay({
|
|
48
|
+
id: this.overlayId,
|
|
49
|
+
modal: false,
|
|
50
|
+
element: this.host,
|
|
51
|
+
dismissible: true,
|
|
52
|
+
requestClose: (reason, trigger) => this.closeMenu(reason, trigger)
|
|
53
|
+
});
|
|
54
|
+
} else {
|
|
55
|
+
closeOverlay(this.overlayId);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
componentDidLoad() {
|
|
59
|
+
this.syncFromProp();
|
|
60
|
+
this.internalOpen = this.internalOpen || this.defaultOpen;
|
|
61
|
+
this.resolveTargets();
|
|
62
|
+
this.attachTargetListeners();
|
|
63
|
+
this.syncTriggerState();
|
|
64
|
+
this.syncOverlay();
|
|
65
|
+
}
|
|
66
|
+
componentDidUpdate() {
|
|
67
|
+
this.resolveTargets();
|
|
68
|
+
this.attachTargetListeners();
|
|
69
|
+
this.syncTriggerState();
|
|
70
|
+
}
|
|
71
|
+
disconnectedCallback() {
|
|
72
|
+
this.detachTargetListeners();
|
|
73
|
+
closeOverlay(this.overlayId);
|
|
74
|
+
}
|
|
75
|
+
resolveTargets() {
|
|
76
|
+
const previousTrigger = this.trigger;
|
|
77
|
+
const previousContextTarget = this.contextTarget;
|
|
78
|
+
const explicitTrigger = this.host.querySelector('[slot="trigger"]');
|
|
79
|
+
const referencedTarget = this.for ? document.getElementById(this.for) : null;
|
|
80
|
+
this.trigger = explicitTrigger;
|
|
81
|
+
this.contextTarget = referencedTarget ?? explicitTrigger ?? this.host.parentElement;
|
|
82
|
+
if (previousTrigger !== this.trigger || previousContextTarget !== this.contextTarget) {
|
|
83
|
+
previousTrigger?.removeEventListener("click", this.onTriggerClick);
|
|
84
|
+
previousTrigger?.removeEventListener("keydown", this.onTriggerKeydown);
|
|
85
|
+
previousContextTarget?.removeEventListener("contextmenu", this.onContextMenu);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
attachTargetListeners() {
|
|
89
|
+
this.detachTargetListeners();
|
|
90
|
+
this.trigger?.addEventListener("click", this.onTriggerClick);
|
|
91
|
+
this.trigger?.addEventListener("keydown", this.onTriggerKeydown);
|
|
92
|
+
this.contextTarget?.addEventListener("contextmenu", this.onContextMenu);
|
|
93
|
+
}
|
|
94
|
+
detachTargetListeners() {
|
|
95
|
+
this.trigger?.removeEventListener("click", this.onTriggerClick);
|
|
96
|
+
this.trigger?.removeEventListener("keydown", this.onTriggerKeydown);
|
|
97
|
+
this.contextTarget?.removeEventListener("contextmenu", this.onContextMenu);
|
|
98
|
+
}
|
|
99
|
+
syncTriggerState() {
|
|
100
|
+
if (!this.trigger)
|
|
101
|
+
return;
|
|
102
|
+
this.trigger.setAttribute("aria-haspopup", "menu");
|
|
103
|
+
this.trigger.setAttribute("aria-expanded", this.internalOpen ? "true" : "false");
|
|
104
|
+
}
|
|
105
|
+
getItems() {
|
|
106
|
+
return Array.from(this.host.querySelectorAll("ui-menu-item")).filter((item) => !this.isItemDisabled(item));
|
|
107
|
+
}
|
|
108
|
+
focusFirstItem() {
|
|
109
|
+
requestAnimationFrame(() => this.getItems()[0]?.focus());
|
|
110
|
+
}
|
|
111
|
+
openMenu(x, y, trigger) {
|
|
112
|
+
this.pointerX = x;
|
|
113
|
+
this.pointerY = y;
|
|
114
|
+
this.internalOpen = true;
|
|
115
|
+
dispatchDetail(this.host, "open", {
|
|
116
|
+
open: true,
|
|
117
|
+
reason: "action",
|
|
118
|
+
trigger
|
|
119
|
+
});
|
|
120
|
+
this.focusFirstItem();
|
|
121
|
+
}
|
|
122
|
+
openFromTrigger(trigger) {
|
|
123
|
+
if (!this.trigger)
|
|
124
|
+
return;
|
|
125
|
+
const rect = this.trigger.getBoundingClientRect();
|
|
126
|
+
this.openMenu(rect.left, rect.bottom, trigger);
|
|
127
|
+
}
|
|
128
|
+
closeMenu(reason, trigger, returnFocus = true) {
|
|
129
|
+
if (!this.internalOpen)
|
|
130
|
+
return;
|
|
131
|
+
this.internalOpen = false;
|
|
132
|
+
dispatchDetail(this.host, "close", {
|
|
133
|
+
open: false,
|
|
134
|
+
reason,
|
|
135
|
+
trigger
|
|
136
|
+
});
|
|
137
|
+
if (returnFocus) {
|
|
138
|
+
this.trigger?.focus();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
onTriggerClick = (event) => {
|
|
142
|
+
if (this.internalOpen) {
|
|
143
|
+
this.closeMenu("action", event.detail === 0 ? "keyboard" : "pointer");
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
this.openFromTrigger(event.detail === 0 ? "keyboard" : "pointer");
|
|
147
|
+
};
|
|
148
|
+
onTriggerKeydown = (event) => {
|
|
149
|
+
if (event.key !== "Enter" && event.key !== " " && event.key !== "ArrowDown")
|
|
150
|
+
return;
|
|
151
|
+
event.preventDefault();
|
|
152
|
+
if (!this.internalOpen) {
|
|
153
|
+
this.openFromTrigger("keyboard");
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.focusFirstItem();
|
|
157
|
+
};
|
|
158
|
+
onContextMenu = (event) => {
|
|
159
|
+
event.preventDefault();
|
|
160
|
+
this.openMenu(event.clientX, event.clientY, "pointer");
|
|
161
|
+
};
|
|
162
|
+
isItemDisabled(item) {
|
|
163
|
+
return item.getAttribute("aria-disabled") === "true" || item.hasAttribute("disabled") || item.getAttribute("disabled") === "true" || item.disabled === true;
|
|
164
|
+
}
|
|
165
|
+
onKeydown = (event) => {
|
|
166
|
+
if (!this.internalOpen)
|
|
167
|
+
return;
|
|
168
|
+
if (event.key === "Escape") {
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
requestTopOverlayClose("escape", "keyboard");
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
174
|
+
const target = event.target.closest?.("ui-menu-item");
|
|
175
|
+
if (!target || this.isItemDisabled(target))
|
|
176
|
+
return;
|
|
177
|
+
event.preventDefault();
|
|
178
|
+
const value = target.getAttribute("value") ?? target.getAttribute("data-value") ?? "";
|
|
179
|
+
dispatchDetail(this.host, "select", { value, trigger: "keyboard" });
|
|
180
|
+
this.closeMenu("action", "keyboard");
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
onItemClick = (event) => {
|
|
184
|
+
const item = event.target.closest?.("ui-menu-item");
|
|
185
|
+
if (!item || this.isItemDisabled(item))
|
|
186
|
+
return;
|
|
187
|
+
const value = item.getAttribute("value") ?? item.getAttribute("data-value") ?? "";
|
|
188
|
+
dispatchDetail(this.host, "select", { value, trigger: "pointer" });
|
|
189
|
+
this.closeMenu("action", "pointer");
|
|
190
|
+
};
|
|
191
|
+
render() {
|
|
192
|
+
return h(Host, { key: "c57c08724714d1de8c22a4a1e86e3a790f45fa20", "data-open": this.internalOpen ? "" : void 0, onKeyDown: this.onKeydown, onClick: this.onItemClick }, h("slot", { key: "4048abb040de1125b8eb02358480914c97ea6b06", name: "trigger" }), h("div", { key: "6ce80f67142319260093903d289456070d49bfcc", class: "menu", "data-open": this.internalOpen ? "" : void 0, style: { left: `${this.pointerX}px`, top: `${this.pointerY}px` } }, h("ui-menu", { key: "2a2c22f0a797ca3a70a1399de41de2b18257abf8", open: this.internalOpen }, h("slot", { key: "252cc6e973704cd561301b5bf96f98481c6c74ff" }))));
|
|
193
|
+
}
|
|
194
|
+
static get watchers() {
|
|
195
|
+
return {
|
|
196
|
+
"open": [{
|
|
197
|
+
"syncFromProp": 0
|
|
198
|
+
}],
|
|
199
|
+
"for": [{
|
|
200
|
+
"syncTarget": 0
|
|
201
|
+
}],
|
|
202
|
+
"internalOpen": [{
|
|
203
|
+
"syncOverlay": 0
|
|
204
|
+
}]
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
UIContextMenu.style = uiContextMenuCss();
|
|
209
|
+
export {
|
|
210
|
+
UIContextMenu as ui_context_menu
|
|
211
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import {
|
|
2
|
+
closeOverlay,
|
|
3
|
+
openOverlay,
|
|
4
|
+
requestTopOverlayClose
|
|
5
|
+
} from "./chunk-G53JEAQK.js";
|
|
6
|
+
import {
|
|
7
|
+
dispatchDetail
|
|
8
|
+
} from "./chunk-UL7UIUJZ.js";
|
|
9
|
+
import {
|
|
10
|
+
Host,
|
|
11
|
+
getElement,
|
|
12
|
+
h,
|
|
13
|
+
registerInstance
|
|
14
|
+
} from "./chunk-YK4MTZGJ.js";
|
|
15
|
+
|
|
16
|
+
// dist/esm/ui-dialog.entry.js
|
|
17
|
+
var uiDialogCss = () => `:host{display:block}:host:not([open]){display:none}:host dialog{--ui-dialog-duration:var(--ui-motion-base);position:fixed;inset:var(--ui-space-4);width:min(100%, 440px);max-width:min(100%, 440px);margin:auto;padding:var(--ui-space-4);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-dialog);box-shadow:var(--ui-shadow-dialog);visibility:hidden;pointer-events:none;opacity:0;transform:scale(0.96);transition:opacity var(--ui-dialog-duration) var(--ui-motion-ease), transform var(--ui-dialog-duration) var(--ui-motion-ease), visibility var(--ui-dialog-duration), display var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete, overlay var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete}:host dialog[open]{visibility:visible;pointer-events:auto;opacity:1;transform:scale(1);animation:ui-dialog-enter var(--ui-dialog-duration) var(--ui-motion-ease)}@keyframes ui-dialog-enter{from{opacity:0;transform:scale(0.96)}}:host dialog::backdrop{background-color:transparent;transition:background-color var(--ui-dialog-duration) var(--ui-motion-ease), display var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete, overlay var(--ui-dialog-duration) var(--ui-motion-ease) allow-discrete}:host dialog[open]::backdrop{background-color:var(--ui-overlay-backdrop);animation:ui-dialog-backdrop-enter var(--ui-dialog-duration) var(--ui-motion-ease)}@keyframes ui-dialog-backdrop-enter{from{background-color:transparent}}`;
|
|
18
|
+
var UIDialog = class {
|
|
19
|
+
constructor(hostRef) {
|
|
20
|
+
registerInstance(this, hostRef);
|
|
21
|
+
}
|
|
22
|
+
get host() {
|
|
23
|
+
return getElement(this);
|
|
24
|
+
}
|
|
25
|
+
open = false;
|
|
26
|
+
defaultOpen = false;
|
|
27
|
+
modal = true;
|
|
28
|
+
dismissible = true;
|
|
29
|
+
internalOpen = false;
|
|
30
|
+
overlayId = `ui-dialog-${Math.random().toString(36).slice(2, 11)}`;
|
|
31
|
+
dialogRef;
|
|
32
|
+
syncFromProp() {
|
|
33
|
+
this.internalOpen = this.open;
|
|
34
|
+
}
|
|
35
|
+
syncOpen() {
|
|
36
|
+
if (this.dialogRef) {
|
|
37
|
+
if (this.internalOpen) {
|
|
38
|
+
this.dialogRef.showModal();
|
|
39
|
+
openOverlay({
|
|
40
|
+
id: this.overlayId,
|
|
41
|
+
modal: this.modal,
|
|
42
|
+
element: this.host,
|
|
43
|
+
dismissible: this.dismissible,
|
|
44
|
+
requestClose: (reason, trigger) => this.handleRequestClose(reason, trigger)
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
this.dialogRef.close();
|
|
48
|
+
closeOverlay(this.overlayId);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
componentDidLoad() {
|
|
53
|
+
this.syncFromProp();
|
|
54
|
+
this.internalOpen = this.internalOpen || this.defaultOpen;
|
|
55
|
+
this.dialogRef?.addEventListener("close", this.onDialogClose);
|
|
56
|
+
this.syncOpen();
|
|
57
|
+
}
|
|
58
|
+
disconnectedCallback() {
|
|
59
|
+
this.dialogRef?.removeEventListener("close", this.onDialogClose);
|
|
60
|
+
closeOverlay(this.overlayId);
|
|
61
|
+
}
|
|
62
|
+
componentDidUpdate() {
|
|
63
|
+
this.syncOpen();
|
|
64
|
+
}
|
|
65
|
+
handleRequestClose(reason, trigger) {
|
|
66
|
+
this.internalOpen = false;
|
|
67
|
+
dispatchDetail(this.host, "close", {
|
|
68
|
+
open: false,
|
|
69
|
+
reason,
|
|
70
|
+
trigger
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
onDialogClose = () => {
|
|
74
|
+
if (this.internalOpen) {
|
|
75
|
+
this.internalOpen = false;
|
|
76
|
+
closeOverlay(this.overlayId);
|
|
77
|
+
dispatchDetail(this.host, "close", {
|
|
78
|
+
open: false,
|
|
79
|
+
reason: "programmatic",
|
|
80
|
+
trigger: "programmatic"
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
onKeydown = (e) => {
|
|
85
|
+
if (e.key === "Escape") {
|
|
86
|
+
requestTopOverlayClose("escape", "keyboard");
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
render() {
|
|
90
|
+
return h(Host, { key: "2a2fcdfa1e3fac5eb3c0e3d6748cebdf388c216d", "data-open": this.internalOpen ? "" : void 0, onKeyDown: this.onKeydown }, h("dialog", { key: "c3eef2bb3bec77fa518269fce38c19c2ededda49", ref: (el) => this.dialogRef = el, open: this.internalOpen }, h("slot", { key: "9ae5c30d57096184ec287fd9dd134ff566b9fd39" })));
|
|
91
|
+
}
|
|
92
|
+
static get watchers() {
|
|
93
|
+
return {
|
|
94
|
+
"open": [{
|
|
95
|
+
"syncFromProp": 0
|
|
96
|
+
}],
|
|
97
|
+
"internalOpen": [{
|
|
98
|
+
"syncOpen": 0
|
|
99
|
+
}]
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
UIDialog.style = uiDialogCss();
|
|
104
|
+
export {
|
|
105
|
+
UIDialog as ui_dialog
|
|
106
|
+
};
|