@mhmo91/schmancy 0.2.169 → 0.2.171
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/{dialog-service-wBbOEDry.js → dialog-service-BHRZUJ5M.js} +9 -9
- package/dist/dialog-service-BHRZUJ5M.js.map +1 -0
- package/dist/dialog-service-p9b29N9B.cjs +65 -0
- package/dist/dialog-service-p9b29N9B.cjs.map +1 -0
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +1 -1
- package/dist/{dropdown-content-seaVnlz3.cjs → dropdown-content--sqK901p.cjs} +4 -6
- package/dist/dropdown-content--sqK901p.cjs.map +1 -0
- package/dist/{dropdown-content-CA3A8GVG.js → dropdown-content-Ctq1JVzp.js} +5 -7
- package/dist/dropdown-content-Ctq1JVzp.js.map +1 -0
- package/dist/dropdown.cjs +1 -1
- package/dist/dropdown.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/{teleport.component-gowB4Yks.js → teleport.component-CinfAHv5.js} +3 -3
- package/dist/{teleport.component-gowB4Yks.js.map → teleport.component-CinfAHv5.js.map} +1 -1
- package/dist/{teleport.component-CHqb2Vou.cjs → teleport.component-DkrqLHFc.cjs} +2 -2
- package/dist/{teleport.component-CHqb2Vou.cjs.map → teleport.component-DkrqLHFc.cjs.map} +1 -1
- package/dist/teleport.js +1 -1
- package/package.json +1 -1
- package/dist/dialog-service-B55dEe3k.cjs +0 -66
- package/dist/dialog-service-B55dEe3k.cjs.map +0 -1
- package/dist/dialog-service-wBbOEDry.js.map +0 -1
- package/dist/dropdown-content-CA3A8GVG.js.map +0 -1
- package/dist/dropdown-content-seaVnlz3.cjs.map +0 -1
package/dist/badge.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-DkrqLHFc.cjs");Object.defineProperty(exports,"SchmancyBadgeV2",{enumerable:!0,get:()=>e.SchmancyBadgeV2});
|
|
2
2
|
//# sourceMappingURL=badge.cjs.map
|
package/dist/badge.js
CHANGED
package/dist/card.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require("./teleport.component-
|
|
1
|
+
"use strict";require("./teleport.component-DkrqLHFc.cjs");
|
|
2
2
|
//# sourceMappingURL=card.cjs.map
|
package/dist/card.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "./teleport.component-
|
|
1
|
+
import "./teleport.component-CinfAHv5.js";
|
|
2
2
|
//# sourceMappingURL=card.js.map
|
package/dist/content-drawer.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-DkrqLHFc.cjs");Object.defineProperty(exports,"SchmancyContentDrawer",{enumerable:!0,get:()=>e.SchmancyContentDrawer}),exports.SchmancyContentDrawerID=e.SchmancyContentDrawerID,Object.defineProperty(exports,"SchmancyContentDrawerMain",{enumerable:!0,get:()=>e.SchmancyContentDrawerMain}),exports.SchmancyContentDrawerMaxHeight=e.SchmancyContentDrawerMaxHeight,exports.SchmancyContentDrawerMinWidth=e.SchmancyContentDrawerMinWidth,Object.defineProperty(exports,"SchmancyContentDrawerSheet",{enumerable:!0,get:()=>e.SchmancyContentDrawerSheet}),exports.SchmancyContentDrawerSheetMode=e.SchmancyContentDrawerSheetMode,exports.SchmancyContentDrawerSheetState=e.SchmancyContentDrawerSheetState,exports.schmancyContentDrawer=e.schmancyContentDrawer;
|
|
2
2
|
//# sourceMappingURL=content-drawer.cjs.map
|
package/dist/content-drawer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as n, c as t, g as r, d as c, e as h, h as o, a as S, b as s, s as m } from "./teleport.component-
|
|
1
|
+
import { f as n, c as t, g as r, d as c, e as h, h as o, a as S, b as s, s as m } from "./teleport.component-CinfAHv5.js";
|
|
2
2
|
export {
|
|
3
3
|
n as SchmancyContentDrawer,
|
|
4
4
|
t as SchmancyContentDrawerID,
|
|
@@ -5,9 +5,10 @@ import { $ as u } from "./litElement.mixin-hg90OkNF.js";
|
|
|
5
5
|
import "./tailwind.mixin-PpOEXUY6.js";
|
|
6
6
|
import { css as g, html as h, render as f } from "lit";
|
|
7
7
|
import { property as d, customElement as v } from "lit/decorators.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import { when as x } from "lit/directives/when";
|
|
9
|
+
var w = Object.defineProperty, b = Object.getOwnPropertyDescriptor, l = (t, n, e, i) => {
|
|
10
|
+
for (var o, s = i > 1 ? void 0 : i ? b(n, e) : n, a = t.length - 1; a >= 0; a--) (o = t[a]) && (s = (i ? o(n, e, s) : o(s)) || s);
|
|
11
|
+
return i && s && w(n, e, s), s;
|
|
11
12
|
};
|
|
12
13
|
let r = class extends u(g`
|
|
13
14
|
:host {
|
|
@@ -101,8 +102,7 @@ let r = class extends u(g`
|
|
|
101
102
|
<div class="dialog" style=${y(t)} role="alertdialog" aria-modal="true">
|
|
102
103
|
<schmancy-surface rounded="all" elevation="3" type="containerHigh">
|
|
103
104
|
<schmancy-form @submit=${this.handleConfirm} class="p-4">
|
|
104
|
-
<schmancy-typography type="title" token="md" class="mb-2"> ${this.title} </schmancy-typography
|
|
105
|
-
|
|
105
|
+
${x(this.title, () => h` <schmancy-typography type="title" token="md" class="mb-2"> ${this.title} </schmancy-typography>`)}
|
|
106
106
|
${n ? h`<div class="mb-4"><slot name="content"></slot></div>` : h`<schmancy-typography type="body" class="mb-4"> ${this.message} </schmancy-typography>`}
|
|
107
107
|
|
|
108
108
|
<div class="flex justify-end gap-3">
|
|
@@ -168,7 +168,7 @@ const c = class c {
|
|
|
168
168
|
return this.confirm({ ...n, variant: "danger" });
|
|
169
169
|
}
|
|
170
170
|
component(n, e = { position: this.getCenteredPosition() }) {
|
|
171
|
-
return this.confirm({ ...e, content: n, message: void 0 });
|
|
171
|
+
return this.confirm({ ...e, content: n, title: void 0, message: void 0 });
|
|
172
172
|
}
|
|
173
173
|
getCenteredPosition() {
|
|
174
174
|
return { x: window.innerWidth / 2, y: window.innerHeight / 2 };
|
|
@@ -176,10 +176,10 @@ const c = class c {
|
|
|
176
176
|
};
|
|
177
177
|
c.DEFAULT_OPTIONS = { title: "Confirm Action", confirmText: "Confirm", cancelText: "Cancel", variant: "default", width: "360px" };
|
|
178
178
|
let m = c;
|
|
179
|
-
const
|
|
179
|
+
const L = { confirm: (t) => m.getInstance().confirm(t), ask: (t, n) => m.getInstance().ask(t, n), danger: (t) => m.getInstance().danger(t), component: (t, n) => m.getInstance().component(t, n) };
|
|
180
180
|
export {
|
|
181
|
-
|
|
181
|
+
L as $,
|
|
182
182
|
r as C,
|
|
183
183
|
m as D
|
|
184
184
|
};
|
|
185
|
-
//# sourceMappingURL=dialog-service-
|
|
185
|
+
//# sourceMappingURL=dialog-service-BHRZUJ5M.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-service-BHRZUJ5M.js","sources":["../src/dialog/dailog.ts","../src/dialog/dialog-service.ts"],"sourcesContent":["import { $LitElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { styleMap } from 'lit/directives/style-map.js'\nimport { when } from 'lit/directives/when'\n\n/**\n * A confirm dialog web component with custom content support\n *\n * @element confirm-dialog\n * @slot content - Optional slot for custom content\n */\n@customElement('confirm-dialog')\nexport class ConfirmDialog extends $LitElement(css`\n\t:host {\n\t\tposition: fixed;\n\t\tz-index: 10000;\n\t\tinset: 0;\n\t\tdisplay: none;\n\t\t--dialog-width: 360px;\n\t}\n\n\t:host([active]) {\n\t\tdisplay: block;\n\t}\n\n\t.overlay {\n\t\tposition: fixed;\n\t\tinset: 0;\n\t\tbackground: rgba(0, 0, 0, 0.4);\n\t\tanimation: fade-in 150ms ease;\n\t}\n\n\t.dialog {\n\t\tposition: absolute;\n\t\tmax-width: var(--dialog-width);\n\t\twidth: max-content;\n\t\tanimation: pop-in 150ms ease;\n\t}\n\n\t@keyframes pop-in {\n\t\tfrom {\n\t\t\topacity: 0;\n\t\t\ttransform: scale(0.9);\n\t\t}\n\t\tto {\n\t\t\topacity: 1;\n\t\t\ttransform: scale(1);\n\t\t}\n\t}\n\n\t@keyframes fade-in {\n\t\tfrom {\n\t\t\topacity: 0;\n\t\t}\n\t\tto {\n\t\t\topacity: 1;\n\t\t}\n\t}\n`) {\n\t/**\n\t * Dialog title\n\t */\n\t@property({ type: String })\n\ttitle = 'Confirm Action'\n\n\t/**\n\t * Dialog message\n\t */\n\t@property({ type: String })\n\tmessage = 'Are you sure you want to proceed?'\n\n\t/**\n\t * Text for confirm button\n\t */\n\t@property({ type: String, attribute: 'confirm-text' })\n\tconfirmText = 'Confirm'\n\n\t/**\n\t * Text for cancel button\n\t */\n\t@property({ type: String, attribute: 'cancel-text' })\n\tcancelText = 'Cancel'\n\n\t/**\n\t * Dialog variant (affects button colors)\n\t */\n\t@property({ type: String })\n\tvariant: 'default' | 'danger' = 'default'\n\n\t/**\n\t * Current position of the dialog\n\t */\n\tprivate position = { x: 0, y: 0 }\n\n\t/**\n\t * Current active promise resolver\n\t */\n\tprivate resolvePromise?: (value: boolean) => void\n\n\t/**\n\t * Simple API: Show the dialog at a specific position\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tasync show(positionOrEvent: { x: number; y: number } | MouseEvent | TouchEvent): Promise<boolean> {\n\t\t// Extract position from event or use direct coordinates\n\t\tlet x: number, y: number\n\n\t\tif ('clientX' in positionOrEvent) {\n\t\t\t// It's a mouse event\n\t\t\tx = positionOrEvent.clientX\n\t\t\ty = positionOrEvent.clientY\n\t\t} else if ('touches' in positionOrEvent && positionOrEvent.touches.length) {\n\t\t\t// It's a touch event\n\t\t\tx = positionOrEvent.touches[0].clientX\n\t\t\ty = positionOrEvent.touches[0].clientY\n\t\t} else {\n\t\t\t// It's a position object with x,y coordinates\n\t\t\tconst pos = positionOrEvent as { x: number; y: number }\n\t\t\tx = pos.x\n\t\t\ty = pos.y\n\t\t}\n\n\t\t// Set position and make dialog visible\n\t\tthis.position = this.calculatePosition(x, y)\n\t\tthis.setAttribute('active', '')\n\n\t\t// Return a promise that resolves when the user makes a choice\n\t\treturn new Promise<boolean>(resolve => {\n\t\t\tthis.resolvePromise = resolve\n\t\t})\n\t}\n\n\t/**\n\t * Simple API: Hide the dialog\n\t */\n\thide(confirmed = false) {\n\t\tthis.removeAttribute('active')\n\n\t\t// Resolve any pending promise\n\t\tif (this.resolvePromise) {\n\t\t\tthis.resolvePromise(confirmed)\n\t\t\tthis.resolvePromise = undefined\n\t\t}\n\t}\n\n\t/**\n\t * Calculate optimal position based on click coordinates\n\t */\n\tprivate calculatePosition(x: number, y: number) {\n\t\t// Default to click position\n\t\treturn { x, y }\n\t}\n\n\t/**\n\t * Handle lifecycle callback when dialog is first rendered\n\t */\n\tfirstUpdated() {\n\t\t// Optimize position after first render when we know the size\n\t\tsetTimeout(() => {\n\t\t\tconst dialog = this.shadowRoot?.querySelector('.dialog') as HTMLElement\n\t\t\tif (!dialog) return\n\n\t\t\t// Get dialog dimensions\n\t\t\tconst width = dialog.offsetWidth\n\t\t\tconst height = dialog.offsetHeight\n\n\t\t\t// Get viewport dimensions\n\t\t\tconst viewportWidth = window.innerWidth\n\t\t\tconst viewportHeight = window.innerHeight\n\n\t\t\t// Reposition if needed to keep dialog in viewport\n\t\t\tlet { x, y } = this.position\n\n\t\t\t// Make sure dialog stays within viewport horizontally\n\t\t\tif (x + width > viewportWidth - 16) {\n\t\t\t\tx = Math.max(16, viewportWidth - width - 16)\n\t\t\t}\n\n\t\t\t// Make sure dialog stays within viewport vertically\n\t\t\tif (y + height > viewportHeight - 16) {\n\t\t\t\t// Position above if space available, otherwise at top\n\t\t\t\tif (y > height + 32) {\n\t\t\t\t\ty = y - height - 16\n\t\t\t\t} else {\n\t\t\t\t\ty = 16\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Update dialog position\n\t\t\tdialog.style.left = `${x}px`\n\t\t\tdialog.style.top = `${y}px`\n\t\t}, 0)\n\t}\n\n\t/**\n\t * Handle confirm action\n\t */\n\tprivate handleConfirm() {\n\t\tthis.hide(true)\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('confirm', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\t/**\n\t * Handle cancel action\n\t */\n\tprivate handleCancel() {\n\t\tthis.hide(false)\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('cancel', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\trender() {\n\t\tconst dialogStyles = {\n\t\t\tleft: `${this.position.x}px`,\n\t\t\ttop: `${this.position.y}px`,\n\t\t}\n\n\t\tconst hasCustomContent = this.querySelectorAll('[slot=\"content\"]').length > 0\n\n\t\treturn html`\n\t\t\t<div class=\"overlay\" @click=${this.handleCancel}></div>\n\n\t\t\t<div class=\"dialog\" style=${styleMap(dialogStyles)} role=\"alertdialog\" aria-modal=\"true\">\n\t\t\t\t<schmancy-surface rounded=\"all\" elevation=\"3\" type=\"containerHigh\">\n\t\t\t\t\t<schmancy-form @submit=${this.handleConfirm} class=\"p-4\">\n\t\t\t\t\t\t${when(\n\t\t\t\t\t\t\tthis.title,\n\t\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\t\thtml` <schmancy-typography type=\"title\" token=\"md\" class=\"mb-2\"> ${this.title} </schmancy-typography>`,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t${hasCustomContent\n\t\t\t\t\t\t\t? html`<div class=\"mb-4\"><slot name=\"content\"></slot></div>`\n\t\t\t\t\t\t\t: html`<schmancy-typography type=\"body\" class=\"mb-4\"> ${this.message} </schmancy-typography>`}\n\n\t\t\t\t\t\t<div class=\"flex justify-end gap-3\">\n\t\t\t\t\t\t\t<schmancy-button variant=\"outlined\" @click=${this.handleCancel}> ${this.cancelText} </schmancy-button>\n\n\t\t\t\t\t\t\t<schmancy-button type=\"submit\" variant=\"filled\"> ${this.confirmText} </schmancy-button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</schmancy-form>\n\t\t\t\t</schmancy-surface>\n\t\t\t</div>\n\t\t`\n\t}\n\n\t/**\n\t * Static helper for even simpler API\n\t */\n\tstatic async confirm(options: {\n\t\ttitle?: string\n\t\tmessage?: string\n\t\tconfirmText?: string\n\t\tcancelText?: string\n\t\tvariant?: 'default' | 'danger'\n\t\tposition: { x: number; y: number } | MouseEvent | TouchEvent\n\t\twidth?: string\n\t}): Promise<boolean> {\n\t\t// Create dialog if it doesn't exist\n\t\tlet dialog = document.querySelector('confirm-dialog') as ConfirmDialog\n\n\t\tif (!dialog) {\n\t\t\tdialog = document.createElement('confirm-dialog') as ConfirmDialog\n\t\t\tdocument.body.appendChild(dialog)\n\t\t}\n\n\t\t// Set options\n\t\tif (options.title) dialog.title = options.title\n\t\tif (options.message) dialog.message = options.message\n\t\tif (options.confirmText) dialog.confirmText = options.confirmText\n\t\tif (options.cancelText) dialog.cancelText = options.cancelText\n\t\tif (options.variant) dialog.variant = options.variant\n\t\tif (options.width) dialog.style.setProperty('--dialog-width', options.width)\n\n\t\t// Show dialog and return promise\n\t\treturn dialog.show(options.position)\n\t}\n\n\t/**\n\t * Even simpler shorthand method - just pass the event and message\n\t */\n\tstatic async ask(event: MouseEvent | TouchEvent, message: string): Promise<boolean> {\n\t\treturn this.confirm({\n\t\t\tmessage,\n\t\t\tposition: event,\n\t\t})\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'confirm-dialog': ConfirmDialog\n\t}\n}\n","import { render, TemplateResult } from 'lit'\nimport { ConfirmDialog } from './dailog'\n\n/**\n * Dialog service options interface with component support\n */\nexport interface DialogOptions {\n\ttitle?: string\n\tmessage?: string\n\tconfirmText?: string\n\tcancelText?: string\n\tvariant?: 'default' | 'danger'\n\tposition: { x: number; y: number } | MouseEvent | TouchEvent\n\n\t// New options for component rendering\n\tcontent?: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult)\n\twidth?: string\n\tonConfirm?: () => void\n\tonCancel?: () => void\n}\n\n/**\n * Dialog service for centralized dialog management.\n * Provides a simple API for showing dialogs with optional custom components.\n */\nexport class DialogService {\n\tprivate static instance: DialogService\n\n\t// Default dialog options\n\tprivate static DEFAULT_OPTIONS: Partial<DialogOptions> = {\n\t\ttitle: 'Confirm Action',\n\t\tconfirmText: 'Confirm',\n\t\tcancelText: 'Cancel',\n\t\tvariant: 'default',\n\t\twidth: '360px',\n\t}\n\n\t// Private constructor for singleton pattern\n\tprivate constructor() {}\n\n\t/**\n\t * Get the singleton instance\n\t */\n\tpublic static getInstance(): DialogService {\n\t\tif (!DialogService.instance) {\n\t\t\tDialogService.instance = new DialogService()\n\t\t}\n\t\treturn DialogService.instance\n\t}\n\n\t/**\n\t * Show a confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tpublic confirm(options: DialogOptions): Promise<boolean> {\n\t\t// Apply default options\n\t\tconst completeOptions = {\n\t\t\t...DialogService.DEFAULT_OPTIONS,\n\t\t\t...options,\n\t\t}\n\n\t\t// If no position is provided, center the dialog\n\t\tif (!completeOptions.position) {\n\t\t\tcompleteOptions.position = this.getCenteredPosition()\n\t\t}\n\n\t\t// Create or find the dialog\n\t\tlet dialog = document.querySelector('confirm-dialog') as ConfirmDialog\n\t\tif (!dialog) {\n\t\t\tdialog = document.createElement('confirm-dialog') as ConfirmDialog\n\t\t\tdocument.body.appendChild(dialog)\n\t\t}\n\n\t\t// Set basic options\n\t\tif (completeOptions.title) dialog.title = completeOptions.title\n\t\tif (completeOptions.message) dialog.message = completeOptions.message\n\t\tif (completeOptions.confirmText) dialog.confirmText = completeOptions.confirmText\n\t\tif (completeOptions.cancelText) dialog.cancelText = completeOptions.cancelText\n\t\tif (completeOptions.variant) dialog.variant = completeOptions.variant\n\t\tif (completeOptions.width) dialog.style.setProperty('--dialog-width', completeOptions.width)\n\n\t\t// Handle custom content if provided\n\t\tif (completeOptions.content) {\n\t\t\tconst contentContainer = document.createElement('div')\n\t\t\tcontentContainer.slot = 'content'\n\n\t\t\tif (typeof completeOptions.content === 'function') {\n\t\t\t\tconst result = completeOptions.content()\n\t\t\t\tif (result instanceof HTMLElement) {\n\t\t\t\t\tcontentContainer.appendChild(result)\n\t\t\t\t} else {\n\t\t\t\t\trender(result, contentContainer)\n\t\t\t\t}\n\t\t\t} else if (completeOptions.content instanceof HTMLElement) {\n\t\t\t\tcontentContainer.appendChild(completeOptions.content)\n\t\t\t} else {\n\t\t\t\trender(completeOptions.content, contentContainer)\n\t\t\t}\n\n\t\t\tdialog.appendChild(contentContainer)\n\t\t}\n\n\t\t// Set up event listeners for optional callbacks\n\t\tif (completeOptions.onConfirm) {\n\t\t\tconst onConfirm = (_e: Event) => {\n\t\t\t\tcompleteOptions.onConfirm!()\n\t\t\t\tdialog.removeEventListener('confirm', onConfirm)\n\t\t\t}\n\t\t\tdialog.addEventListener('confirm', onConfirm)\n\t\t}\n\n\t\tif (completeOptions.onCancel) {\n\t\t\tconst onCancel = (_e: Event) => {\n\t\t\t\tcompleteOptions.onCancel!()\n\t\t\t\tdialog.removeEventListener('cancel', onCancel)\n\t\t\t}\n\t\t\tdialog.addEventListener('cancel', onCancel)\n\t\t}\n\n\t\t// Show dialog and return promise\n\t\treturn dialog.show(completeOptions.position).finally(() => {\n\t\t\t// Clean up the content when dialog closes\n\t\t\tif (completeOptions.content) {\n\t\t\t\tconst contentEl = dialog.querySelector('[slot=\"content\"]')\n\t\t\t\tif (contentEl) {\n\t\t\t\t\tdialog.removeChild(contentEl)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\t/**\n\t * Show a simple confirmation dialog with just a message\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tpublic ask(message: string, event?: MouseEvent | TouchEvent): Promise<boolean> {\n\t\treturn this.confirm({\n\t\t\tmessage,\n\t\t\tposition: event || this.getCenteredPosition(),\n\t\t})\n\t}\n\n\t/**\n\t * Show a danger confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tpublic danger(options: Omit<DialogOptions, 'variant'>): Promise<boolean> {\n\t\treturn this.confirm({\n\t\t\t...options,\n\t\t\tvariant: 'danger',\n\t\t})\n\t}\n\n\t/**\n\t * Show a dialog with custom component content\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tpublic component(\n\t\tcontent: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult),\n\t\toptions: Omit<DialogOptions, 'content' | 'message'> = { position: this.getCenteredPosition() },\n\t): Promise<boolean> {\n\t\treturn this.confirm({\n\t\t\t...options,\n\t\t\tcontent,\n\t\t\t// Clear message if content is provided\n\t\t\ttitle: undefined,\n\t\t\tmessage: undefined,\n\t\t})\n\t}\n\n\t/**\n\t * Get a centered position for the dialog\n\t */\n\tprivate getCenteredPosition(): { x: number; y: number } {\n\t\treturn {\n\t\t\tx: window.innerWidth / 2,\n\t\t\ty: window.innerHeight / 2,\n\t\t}\n\t}\n}\n\n/**\n * Global dialog utility - provides a quick way to show dialogs\n */\nexport const $dialog = {\n\t/**\n\t * Show a confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tconfirm: (options: DialogOptions): Promise<boolean> => {\n\t\treturn DialogService.getInstance().confirm(options)\n\t},\n\n\t/**\n\t * Show a simple confirmation dialog with just a message\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\task: (message: string, event?: MouseEvent | TouchEvent): Promise<boolean> => {\n\t\treturn DialogService.getInstance().ask(message, event)\n\t},\n\n\t/**\n\t * Show a danger confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tdanger: (options: Omit<DialogOptions, 'variant'>): Promise<boolean> => {\n\t\treturn DialogService.getInstance().danger(options)\n\t},\n\n\t/**\n\t * Show a dialog with custom component content\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tcomponent: (\n\t\tcontent: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult),\n\t\toptions?: Omit<DialogOptions, 'content' | 'message'>,\n\t): Promise<boolean> => {\n\t\treturn DialogService.getInstance().component(content, options)\n\t},\n}\n\nexport default DialogService\n"],"names":["ConfirmDialog","$LitElement","css","constructor","super","arguments","this","title","message","confirmText","cancelText","variant","position","x","y","positionOrEvent","clientX","clientY","touches","length","pos","calculatePosition","setAttribute","Promise","resolve","resolvePromise","confirmed","removeAttribute","setTimeout","dialog","shadowRoot","querySelector","width","offsetWidth","height","offsetHeight","viewportWidth","window","innerWidth","viewportHeight","innerHeight","Math","max","style","left","top","hide","dispatchEvent","CustomEvent","bubbles","composed","handleCancel","dialogStyles","hasCustomContent","querySelectorAll","html","styleMap","handleConfirm","when","options","document","createElement","body","appendChild","setProperty","show","event","confirm","__decorateClass","property","type","String","prototype","attribute","customElement","DialogService","instance","completeOptions","DEFAULT_OPTIONS","getCenteredPosition","content","contentContainer","slot","result","HTMLElement","render","onConfirm","_e","removeEventListener","addEventListener","onCancel","finally","contentEl","removeChild","_h","$dialog","getInstance","ask","danger","component"],"mappings":";;;;;;;;;;;;AAaa,IAAAA,IAAN,cAA4BC,EAAYC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAA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AA,EAMM;AACA,WAAA,EACNK,GAAGwB,OAAOC,aAAa,GACvBxB,GAAGuB,OAAOG,cAAc,EACzB;AAAA,EAAA;AAAA;AApJDlC,EAAewE,kBAA0C,EACxDvE,OAAO,kBACPE,aAAa,WACbC,YAAY,UACZC,SAAS,WACTqB,OAAO,QAAA;AATF,IAAM2C,IAANmB;AA+JA,MAAMC,IAAU,EAKtB5B,SAAUR,OACFgB,EAAcqB,YAAAA,EAAc7B,QAAQR,CAAAA,GAO5CsC,KAAK,CAACzF,GAAiB0D,MACfS,EAAcqB,YAAAA,EAAcC,IAAIzF,GAAS0D,CAAAA,GAOjDgC,QAASvC,OACDgB,EAAcqB,YAAAA,EAAcE,OAAOvC,CAO3CwC,GAAAA,WAAW,CACVnB,GACArB,MAEOgB,EAAcqB,cAAcG,UAAUnB,GAASrB;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";require("rxjs"),require("lit/directives/class-map.js");const p=require("lit/directives/style-map.js"),f=require("./litElement.mixin-DqMWf6Rp.cjs");require("./tailwind.mixin-C-SZB7Or.cjs");const a=require("lit"),m=require("lit/decorators.js"),y=require("lit/directives/when");var u=Object.defineProperty,g=Object.getOwnPropertyDescriptor,d=(e,i,t,n)=>{for(var o,s=n>1?void 0:n?g(i,t):i,r=e.length-1;r>=0;r--)(o=e[r])&&(s=(n?o(i,t,s):o(s))||s);return n&&s&&u(i,t,s),s};exports.ConfirmDialog=class extends f.$LitElement(a.css`
|
|
2
|
+
:host {
|
|
3
|
+
position: fixed;
|
|
4
|
+
z-index: 10000;
|
|
5
|
+
inset: 0;
|
|
6
|
+
display: none;
|
|
7
|
+
--dialog-width: 360px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:host([active]) {
|
|
11
|
+
display: block;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.overlay {
|
|
15
|
+
position: fixed;
|
|
16
|
+
inset: 0;
|
|
17
|
+
background: rgba(0, 0, 0, 0.4);
|
|
18
|
+
animation: fade-in 150ms ease;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.dialog {
|
|
22
|
+
position: absolute;
|
|
23
|
+
max-width: var(--dialog-width);
|
|
24
|
+
width: max-content;
|
|
25
|
+
animation: pop-in 150ms ease;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@keyframes pop-in {
|
|
29
|
+
from {
|
|
30
|
+
opacity: 0;
|
|
31
|
+
transform: scale(0.9);
|
|
32
|
+
}
|
|
33
|
+
to {
|
|
34
|
+
opacity: 1;
|
|
35
|
+
transform: scale(1);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@keyframes fade-in {
|
|
40
|
+
from {
|
|
41
|
+
opacity: 0;
|
|
42
|
+
}
|
|
43
|
+
to {
|
|
44
|
+
opacity: 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
`){constructor(){super(...arguments),this.title="Confirm Action",this.message="Are you sure you want to proceed?",this.confirmText="Confirm",this.cancelText="Cancel",this.variant="default",this.position={x:0,y:0}}async show(e){let i,t;if("clientX"in e)i=e.clientX,t=e.clientY;else if("touches"in e&&e.touches.length)i=e.touches[0].clientX,t=e.touches[0].clientY;else{const n=e;i=n.x,t=n.y}return this.position=this.calculatePosition(i,t),this.setAttribute("active",""),new Promise(n=>{this.resolvePromise=n})}hide(e=!1){this.removeAttribute("active"),this.resolvePromise&&(this.resolvePromise(e),this.resolvePromise=void 0)}calculatePosition(e,i){return{x:e,y:i}}firstUpdated(){setTimeout(()=>{var h;const e=(h=this.shadowRoot)==null?void 0:h.querySelector(".dialog");if(!e)return;const i=e.offsetWidth,t=e.offsetHeight,n=window.innerWidth,o=window.innerHeight;let{x:s,y:r}=this.position;s+i>n-16&&(s=Math.max(16,n-i-16)),r+t>o-16&&(r=r>t+32?r-t-16:16),e.style.left=`${s}px`,e.style.top=`${r}px`},0)}handleConfirm(){this.hide(!0),this.dispatchEvent(new CustomEvent("confirm",{bubbles:!0,composed:!0}))}handleCancel(){this.hide(!1),this.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}render(){const e={left:`${this.position.x}px`,top:`${this.position.y}px`},i=this.querySelectorAll('[slot="content"]').length>0;return a.html`
|
|
48
|
+
<div class="overlay" @click=${this.handleCancel}></div>
|
|
49
|
+
|
|
50
|
+
<div class="dialog" style=${p.styleMap(e)} role="alertdialog" aria-modal="true">
|
|
51
|
+
<schmancy-surface rounded="all" elevation="3" type="containerHigh">
|
|
52
|
+
<schmancy-form @submit=${this.handleConfirm} class="p-4">
|
|
53
|
+
${y.when(this.title,()=>a.html` <schmancy-typography type="title" token="md" class="mb-2"> ${this.title} </schmancy-typography>`)}
|
|
54
|
+
${i?a.html`<div class="mb-4"><slot name="content"></slot></div>`:a.html`<schmancy-typography type="body" class="mb-4"> ${this.message} </schmancy-typography>`}
|
|
55
|
+
|
|
56
|
+
<div class="flex justify-end gap-3">
|
|
57
|
+
<schmancy-button variant="outlined" @click=${this.handleCancel}> ${this.cancelText} </schmancy-button>
|
|
58
|
+
|
|
59
|
+
<schmancy-button type="submit" variant="filled"> ${this.confirmText} </schmancy-button>
|
|
60
|
+
</div>
|
|
61
|
+
</schmancy-form>
|
|
62
|
+
</schmancy-surface>
|
|
63
|
+
</div>
|
|
64
|
+
`}static async confirm(e){let i=document.querySelector("confirm-dialog");return i||(i=document.createElement("confirm-dialog"),document.body.appendChild(i)),e.title&&(i.title=e.title),e.message&&(i.message=e.message),e.confirmText&&(i.confirmText=e.confirmText),e.cancelText&&(i.cancelText=e.cancelText),e.variant&&(i.variant=e.variant),e.width&&i.style.setProperty("--dialog-width",e.width),i.show(e.position)}static async ask(e,i){return this.confirm({message:i,position:e})}},d([m.property({type:String})],exports.ConfirmDialog.prototype,"title",2),d([m.property({type:String})],exports.ConfirmDialog.prototype,"message",2),d([m.property({type:String,attribute:"confirm-text"})],exports.ConfirmDialog.prototype,"confirmText",2),d([m.property({type:String,attribute:"cancel-text"})],exports.ConfirmDialog.prototype,"cancelText",2),d([m.property({type:String})],exports.ConfirmDialog.prototype,"variant",2),exports.ConfirmDialog=d([m.customElement("confirm-dialog")],exports.ConfirmDialog);const c=class c{constructor(){}static getInstance(){return c.instance||(c.instance=new c),c.instance}confirm(i){const t={...c.DEFAULT_OPTIONS,...i};t.position||(t.position=this.getCenteredPosition());let n=document.querySelector("confirm-dialog");if(n||(n=document.createElement("confirm-dialog"),document.body.appendChild(n)),t.title&&(n.title=t.title),t.message&&(n.message=t.message),t.confirmText&&(n.confirmText=t.confirmText),t.cancelText&&(n.cancelText=t.cancelText),t.variant&&(n.variant=t.variant),t.width&&n.style.setProperty("--dialog-width",t.width),t.content){const o=document.createElement("div");if(o.slot="content",typeof t.content=="function"){const s=t.content();s instanceof HTMLElement?o.appendChild(s):a.render(s,o)}else t.content instanceof HTMLElement?o.appendChild(t.content):a.render(t.content,o);n.appendChild(o)}if(t.onConfirm){const o=s=>{t.onConfirm(),n.removeEventListener("confirm",o)};n.addEventListener("confirm",o)}if(t.onCancel){const o=s=>{t.onCancel(),n.removeEventListener("cancel",o)};n.addEventListener("cancel",o)}return n.show(t.position).finally(()=>{if(t.content){const o=n.querySelector('[slot="content"]');o&&n.removeChild(o)}})}ask(i,t){return this.confirm({message:i,position:t||this.getCenteredPosition()})}danger(i){return this.confirm({...i,variant:"danger"})}component(i,t={position:this.getCenteredPosition()}){return this.confirm({...t,content:i,title:void 0,message:void 0})}getCenteredPosition(){return{x:window.innerWidth/2,y:window.innerHeight/2}}};c.DEFAULT_OPTIONS={title:"Confirm Action",confirmText:"Confirm",cancelText:"Cancel",variant:"default",width:"360px"};let l=c;const v={confirm:e=>l.getInstance().confirm(e),ask:(e,i)=>l.getInstance().ask(e,i),danger:e=>l.getInstance().danger(e),component:(e,i)=>l.getInstance().component(e,i)};exports.$dialog=v,exports.DialogService=l;
|
|
65
|
+
//# sourceMappingURL=dialog-service-p9b29N9B.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-service-p9b29N9B.cjs","sources":["../src/dialog/dailog.ts","../src/dialog/dialog-service.ts"],"sourcesContent":["import { $LitElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { styleMap } from 'lit/directives/style-map.js'\nimport { when } from 'lit/directives/when'\n\n/**\n * A confirm dialog web component with custom content support\n *\n * @element confirm-dialog\n * @slot content - Optional slot for custom content\n */\n@customElement('confirm-dialog')\nexport class ConfirmDialog extends $LitElement(css`\n\t:host {\n\t\tposition: fixed;\n\t\tz-index: 10000;\n\t\tinset: 0;\n\t\tdisplay: none;\n\t\t--dialog-width: 360px;\n\t}\n\n\t:host([active]) {\n\t\tdisplay: block;\n\t}\n\n\t.overlay {\n\t\tposition: fixed;\n\t\tinset: 0;\n\t\tbackground: rgba(0, 0, 0, 0.4);\n\t\tanimation: fade-in 150ms ease;\n\t}\n\n\t.dialog {\n\t\tposition: absolute;\n\t\tmax-width: var(--dialog-width);\n\t\twidth: max-content;\n\t\tanimation: pop-in 150ms ease;\n\t}\n\n\t@keyframes pop-in {\n\t\tfrom {\n\t\t\topacity: 0;\n\t\t\ttransform: scale(0.9);\n\t\t}\n\t\tto {\n\t\t\topacity: 1;\n\t\t\ttransform: scale(1);\n\t\t}\n\t}\n\n\t@keyframes fade-in {\n\t\tfrom {\n\t\t\topacity: 0;\n\t\t}\n\t\tto {\n\t\t\topacity: 1;\n\t\t}\n\t}\n`) {\n\t/**\n\t * Dialog title\n\t */\n\t@property({ type: String })\n\ttitle = 'Confirm Action'\n\n\t/**\n\t * Dialog message\n\t */\n\t@property({ type: String })\n\tmessage = 'Are you sure you want to proceed?'\n\n\t/**\n\t * Text for confirm button\n\t */\n\t@property({ type: String, attribute: 'confirm-text' })\n\tconfirmText = 'Confirm'\n\n\t/**\n\t * Text for cancel button\n\t */\n\t@property({ type: String, attribute: 'cancel-text' })\n\tcancelText = 'Cancel'\n\n\t/**\n\t * Dialog variant (affects button colors)\n\t */\n\t@property({ type: String })\n\tvariant: 'default' | 'danger' = 'default'\n\n\t/**\n\t * Current position of the dialog\n\t */\n\tprivate position = { x: 0, y: 0 }\n\n\t/**\n\t * Current active promise resolver\n\t */\n\tprivate resolvePromise?: (value: boolean) => void\n\n\t/**\n\t * Simple API: Show the dialog at a specific position\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tasync show(positionOrEvent: { x: number; y: number } | MouseEvent | TouchEvent): Promise<boolean> {\n\t\t// Extract position from event or use direct coordinates\n\t\tlet x: number, y: number\n\n\t\tif ('clientX' in positionOrEvent) {\n\t\t\t// It's a mouse event\n\t\t\tx = positionOrEvent.clientX\n\t\t\ty = positionOrEvent.clientY\n\t\t} else if ('touches' in positionOrEvent && positionOrEvent.touches.length) {\n\t\t\t// It's a touch event\n\t\t\tx = positionOrEvent.touches[0].clientX\n\t\t\ty = positionOrEvent.touches[0].clientY\n\t\t} else {\n\t\t\t// It's a position object with x,y coordinates\n\t\t\tconst pos = positionOrEvent as { x: number; y: number }\n\t\t\tx = pos.x\n\t\t\ty = pos.y\n\t\t}\n\n\t\t// Set position and make dialog visible\n\t\tthis.position = this.calculatePosition(x, y)\n\t\tthis.setAttribute('active', '')\n\n\t\t// Return a promise that resolves when the user makes a choice\n\t\treturn new Promise<boolean>(resolve => {\n\t\t\tthis.resolvePromise = resolve\n\t\t})\n\t}\n\n\t/**\n\t * Simple API: Hide the dialog\n\t */\n\thide(confirmed = false) {\n\t\tthis.removeAttribute('active')\n\n\t\t// Resolve any pending promise\n\t\tif (this.resolvePromise) {\n\t\t\tthis.resolvePromise(confirmed)\n\t\t\tthis.resolvePromise = undefined\n\t\t}\n\t}\n\n\t/**\n\t * Calculate optimal position based on click coordinates\n\t */\n\tprivate calculatePosition(x: number, y: number) {\n\t\t// Default to click position\n\t\treturn { x, y }\n\t}\n\n\t/**\n\t * Handle lifecycle callback when dialog is first rendered\n\t */\n\tfirstUpdated() {\n\t\t// Optimize position after first render when we know the size\n\t\tsetTimeout(() => {\n\t\t\tconst dialog = this.shadowRoot?.querySelector('.dialog') as HTMLElement\n\t\t\tif (!dialog) return\n\n\t\t\t// Get dialog dimensions\n\t\t\tconst width = dialog.offsetWidth\n\t\t\tconst height = dialog.offsetHeight\n\n\t\t\t// Get viewport dimensions\n\t\t\tconst viewportWidth = window.innerWidth\n\t\t\tconst viewportHeight = window.innerHeight\n\n\t\t\t// Reposition if needed to keep dialog in viewport\n\t\t\tlet { x, y } = this.position\n\n\t\t\t// Make sure dialog stays within viewport horizontally\n\t\t\tif (x + width > viewportWidth - 16) {\n\t\t\t\tx = Math.max(16, viewportWidth - width - 16)\n\t\t\t}\n\n\t\t\t// Make sure dialog stays within viewport vertically\n\t\t\tif (y + height > viewportHeight - 16) {\n\t\t\t\t// Position above if space available, otherwise at top\n\t\t\t\tif (y > height + 32) {\n\t\t\t\t\ty = y - height - 16\n\t\t\t\t} else {\n\t\t\t\t\ty = 16\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Update dialog position\n\t\t\tdialog.style.left = `${x}px`\n\t\t\tdialog.style.top = `${y}px`\n\t\t}, 0)\n\t}\n\n\t/**\n\t * Handle confirm action\n\t */\n\tprivate handleConfirm() {\n\t\tthis.hide(true)\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('confirm', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\t/**\n\t * Handle cancel action\n\t */\n\tprivate handleCancel() {\n\t\tthis.hide(false)\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('cancel', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\trender() {\n\t\tconst dialogStyles = {\n\t\t\tleft: `${this.position.x}px`,\n\t\t\ttop: `${this.position.y}px`,\n\t\t}\n\n\t\tconst hasCustomContent = this.querySelectorAll('[slot=\"content\"]').length > 0\n\n\t\treturn html`\n\t\t\t<div class=\"overlay\" @click=${this.handleCancel}></div>\n\n\t\t\t<div class=\"dialog\" style=${styleMap(dialogStyles)} role=\"alertdialog\" aria-modal=\"true\">\n\t\t\t\t<schmancy-surface rounded=\"all\" elevation=\"3\" type=\"containerHigh\">\n\t\t\t\t\t<schmancy-form @submit=${this.handleConfirm} class=\"p-4\">\n\t\t\t\t\t\t${when(\n\t\t\t\t\t\t\tthis.title,\n\t\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\t\thtml` <schmancy-typography type=\"title\" token=\"md\" class=\"mb-2\"> ${this.title} </schmancy-typography>`,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t${hasCustomContent\n\t\t\t\t\t\t\t? html`<div class=\"mb-4\"><slot name=\"content\"></slot></div>`\n\t\t\t\t\t\t\t: html`<schmancy-typography type=\"body\" class=\"mb-4\"> ${this.message} </schmancy-typography>`}\n\n\t\t\t\t\t\t<div class=\"flex justify-end gap-3\">\n\t\t\t\t\t\t\t<schmancy-button variant=\"outlined\" @click=${this.handleCancel}> ${this.cancelText} </schmancy-button>\n\n\t\t\t\t\t\t\t<schmancy-button type=\"submit\" variant=\"filled\"> ${this.confirmText} </schmancy-button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</schmancy-form>\n\t\t\t\t</schmancy-surface>\n\t\t\t</div>\n\t\t`\n\t}\n\n\t/**\n\t * Static helper for even simpler API\n\t */\n\tstatic async confirm(options: {\n\t\ttitle?: string\n\t\tmessage?: string\n\t\tconfirmText?: string\n\t\tcancelText?: string\n\t\tvariant?: 'default' | 'danger'\n\t\tposition: { x: number; y: number } | MouseEvent | TouchEvent\n\t\twidth?: string\n\t}): Promise<boolean> {\n\t\t// Create dialog if it doesn't exist\n\t\tlet dialog = document.querySelector('confirm-dialog') as ConfirmDialog\n\n\t\tif (!dialog) {\n\t\t\tdialog = document.createElement('confirm-dialog') as ConfirmDialog\n\t\t\tdocument.body.appendChild(dialog)\n\t\t}\n\n\t\t// Set options\n\t\tif (options.title) dialog.title = options.title\n\t\tif (options.message) dialog.message = options.message\n\t\tif (options.confirmText) dialog.confirmText = options.confirmText\n\t\tif (options.cancelText) dialog.cancelText = options.cancelText\n\t\tif (options.variant) dialog.variant = options.variant\n\t\tif (options.width) dialog.style.setProperty('--dialog-width', options.width)\n\n\t\t// Show dialog and return promise\n\t\treturn dialog.show(options.position)\n\t}\n\n\t/**\n\t * Even simpler shorthand method - just pass the event and message\n\t */\n\tstatic async ask(event: MouseEvent | TouchEvent, message: string): Promise<boolean> {\n\t\treturn this.confirm({\n\t\t\tmessage,\n\t\t\tposition: event,\n\t\t})\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'confirm-dialog': ConfirmDialog\n\t}\n}\n","import { render, TemplateResult } from 'lit'\nimport { ConfirmDialog } from './dailog'\n\n/**\n * Dialog service options interface with component support\n */\nexport interface DialogOptions {\n\ttitle?: string\n\tmessage?: string\n\tconfirmText?: string\n\tcancelText?: string\n\tvariant?: 'default' | 'danger'\n\tposition: { x: number; y: number } | MouseEvent | TouchEvent\n\n\t// New options for component rendering\n\tcontent?: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult)\n\twidth?: string\n\tonConfirm?: () => void\n\tonCancel?: () => void\n}\n\n/**\n * Dialog service for centralized dialog management.\n * Provides a simple API for showing dialogs with optional custom components.\n */\nexport class DialogService {\n\tprivate static instance: DialogService\n\n\t// Default dialog options\n\tprivate static DEFAULT_OPTIONS: Partial<DialogOptions> = {\n\t\ttitle: 'Confirm Action',\n\t\tconfirmText: 'Confirm',\n\t\tcancelText: 'Cancel',\n\t\tvariant: 'default',\n\t\twidth: '360px',\n\t}\n\n\t// Private constructor for singleton pattern\n\tprivate constructor() {}\n\n\t/**\n\t * Get the singleton instance\n\t */\n\tpublic static getInstance(): DialogService {\n\t\tif (!DialogService.instance) {\n\t\t\tDialogService.instance = new DialogService()\n\t\t}\n\t\treturn DialogService.instance\n\t}\n\n\t/**\n\t * Show a confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tpublic confirm(options: DialogOptions): Promise<boolean> {\n\t\t// Apply default options\n\t\tconst completeOptions = {\n\t\t\t...DialogService.DEFAULT_OPTIONS,\n\t\t\t...options,\n\t\t}\n\n\t\t// If no position is provided, center the dialog\n\t\tif (!completeOptions.position) {\n\t\t\tcompleteOptions.position = this.getCenteredPosition()\n\t\t}\n\n\t\t// Create or find the dialog\n\t\tlet dialog = document.querySelector('confirm-dialog') as ConfirmDialog\n\t\tif (!dialog) {\n\t\t\tdialog = document.createElement('confirm-dialog') as ConfirmDialog\n\t\t\tdocument.body.appendChild(dialog)\n\t\t}\n\n\t\t// Set basic options\n\t\tif (completeOptions.title) dialog.title = completeOptions.title\n\t\tif (completeOptions.message) dialog.message = completeOptions.message\n\t\tif (completeOptions.confirmText) dialog.confirmText = completeOptions.confirmText\n\t\tif (completeOptions.cancelText) dialog.cancelText = completeOptions.cancelText\n\t\tif (completeOptions.variant) dialog.variant = completeOptions.variant\n\t\tif (completeOptions.width) dialog.style.setProperty('--dialog-width', completeOptions.width)\n\n\t\t// Handle custom content if provided\n\t\tif (completeOptions.content) {\n\t\t\tconst contentContainer = document.createElement('div')\n\t\t\tcontentContainer.slot = 'content'\n\n\t\t\tif (typeof completeOptions.content === 'function') {\n\t\t\t\tconst result = completeOptions.content()\n\t\t\t\tif (result instanceof HTMLElement) {\n\t\t\t\t\tcontentContainer.appendChild(result)\n\t\t\t\t} else {\n\t\t\t\t\trender(result, contentContainer)\n\t\t\t\t}\n\t\t\t} else if (completeOptions.content instanceof HTMLElement) {\n\t\t\t\tcontentContainer.appendChild(completeOptions.content)\n\t\t\t} else {\n\t\t\t\trender(completeOptions.content, contentContainer)\n\t\t\t}\n\n\t\t\tdialog.appendChild(contentContainer)\n\t\t}\n\n\t\t// Set up event listeners for optional callbacks\n\t\tif (completeOptions.onConfirm) {\n\t\t\tconst onConfirm = (_e: Event) => {\n\t\t\t\tcompleteOptions.onConfirm!()\n\t\t\t\tdialog.removeEventListener('confirm', onConfirm)\n\t\t\t}\n\t\t\tdialog.addEventListener('confirm', onConfirm)\n\t\t}\n\n\t\tif (completeOptions.onCancel) {\n\t\t\tconst onCancel = (_e: Event) => {\n\t\t\t\tcompleteOptions.onCancel!()\n\t\t\t\tdialog.removeEventListener('cancel', onCancel)\n\t\t\t}\n\t\t\tdialog.addEventListener('cancel', onCancel)\n\t\t}\n\n\t\t// Show dialog and return promise\n\t\treturn dialog.show(completeOptions.position).finally(() => {\n\t\t\t// Clean up the content when dialog closes\n\t\t\tif (completeOptions.content) {\n\t\t\t\tconst contentEl = dialog.querySelector('[slot=\"content\"]')\n\t\t\t\tif (contentEl) {\n\t\t\t\t\tdialog.removeChild(contentEl)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\t/**\n\t * Show a simple confirmation dialog with just a message\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tpublic ask(message: string, event?: MouseEvent | TouchEvent): Promise<boolean> {\n\t\treturn this.confirm({\n\t\t\tmessage,\n\t\t\tposition: event || this.getCenteredPosition(),\n\t\t})\n\t}\n\n\t/**\n\t * Show a danger confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tpublic danger(options: Omit<DialogOptions, 'variant'>): Promise<boolean> {\n\t\treturn this.confirm({\n\t\t\t...options,\n\t\t\tvariant: 'danger',\n\t\t})\n\t}\n\n\t/**\n\t * Show a dialog with custom component content\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tpublic component(\n\t\tcontent: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult),\n\t\toptions: Omit<DialogOptions, 'content' | 'message'> = { position: this.getCenteredPosition() },\n\t): Promise<boolean> {\n\t\treturn this.confirm({\n\t\t\t...options,\n\t\t\tcontent,\n\t\t\t// Clear message if content is provided\n\t\t\ttitle: undefined,\n\t\t\tmessage: undefined,\n\t\t})\n\t}\n\n\t/**\n\t * Get a centered position for the dialog\n\t */\n\tprivate getCenteredPosition(): { x: number; y: number } {\n\t\treturn {\n\t\t\tx: window.innerWidth / 2,\n\t\t\ty: window.innerHeight / 2,\n\t\t}\n\t}\n}\n\n/**\n * Global dialog utility - provides a quick way to show dialogs\n */\nexport const $dialog = {\n\t/**\n\t * Show a confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tconfirm: (options: DialogOptions): Promise<boolean> => {\n\t\treturn DialogService.getInstance().confirm(options)\n\t},\n\n\t/**\n\t * Show a simple confirmation dialog with just a message\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\task: (message: string, event?: MouseEvent | TouchEvent): Promise<boolean> => {\n\t\treturn DialogService.getInstance().ask(message, event)\n\t},\n\n\t/**\n\t * Show a danger confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tdanger: (options: Omit<DialogOptions, 'variant'>): Promise<boolean> => {\n\t\treturn DialogService.getInstance().danger(options)\n\t},\n\n\t/**\n\t * Show a dialog with custom component content\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tcomponent: (\n\t\tcontent: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult),\n\t\toptions?: Omit<DialogOptions, 'content' | 'message'>,\n\t): Promise<boolean> => {\n\t\treturn DialogService.getInstance().component(content, options)\n\t},\n}\n\nexport default DialogService\n"],"names":["ConfirmDialog","$LitElement","css","constructor","super","arguments","this","title","message","confirmText","cancelText","variant","position","x","y","show","positionOrEvent","clientX","clientY","touches","length","pos","calculatePosition","setAttribute","Promise","resolve","resolvePromise","confirmed","removeAttribute","firstUpdated","setTimeout","dialog","shadowRoot","querySelector","width","offsetWidth","height","offsetHeight","viewportWidth","window","innerWidth","viewportHeight","innerHeight","Math","max","style","left","top","handleConfirm","hide","dispatchEvent","CustomEvent","bubbles","composed","render","dialogStyles","hasCustomContent","querySelectorAll","html","handleCancel","styleMap","when","options","document","createElement","body","appendChild","setProperty","event","confirm","__decorateClass","property","type","String","prototype","attribute","customElement","DialogService","instance","completeOptions","DEFAULT_OPTIONS","getCenteredPosition","content","contentContainer","slot","result","HTMLElement","onConfirm","_e","removeEventListener","addEventListener","onCancel","finally","contentEl","removeChild","_r","$dialog","getInstance","ask","danger","component"],"mappings":"geAaaA,QAAAA,cAAN,cAA4BC,EAAAA,YAAYC,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,GAAxC,aAAAC,CAAAC,MAAAC,GAAAA,SAAAA,EAmDEC,KAAAC,MAAA,iBAMED,KAAAE,QAAA,oCAMIF,KAAAG,YAAA,UAMDH,KAAAI,WAAA,SAMmBJ,KAAAK,QAAA,UAKhCL,KAAQM,SAAW,CAAEC,EAAG,EAAGC,EAAG,CAAE,CAAA,CAWhC,MAAMC,KAAKC,GAEV,IAAIH,EAAWC,EAEf,GAAI,YAAaE,EAEhBH,EAAIG,EAAgBC,QACpBH,EAAIE,EAAgBE,gBACV,YAAaF,GAAmBA,EAAgBG,QAAQC,OAE9DP,EAAAG,EAAgBG,QAAQ,CAAGF,EAAAA,QAC3BH,EAAAE,EAAgBG,QAAQ,CAAA,EAAGD,YACzB,CAEN,MAAMG,EAAML,EACZH,EAAIQ,EAAIR,EACRC,EAAIO,EAAIP,CAAA,CAQF,OAJPR,KAAKM,SAAWN,KAAKgB,kBAAkBT,EAAGC,CACrCR,EAAAA,KAAAiB,aAAa,SAAU,EAGrB,EAAA,IAAIC,QAA4BC,GAAAA,CACtCnB,KAAKoB,eAAiBD,CAAA,CAAA,CACtB,CAMF,K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BP,EACHoB,QAAAA,EAEA3E,aACAC,QAAAA,MACA,CAAA,CAAA,CAMM,qBAAAyE,CACA,MAAA,CACNpE,EAAG0B,OAAOC,WAAa,EACvB1B,EAAGyB,OAAOG,YAAc,CAAA,CACzB,CAOK,EA3JNpC,EAAe0E,gBAA0C,CACxDzE,MAAO,iBACPE,YAAa,UACbC,WAAY,SACZC,QAAS,UACTuB,MAAO,OACR,EAVM,IAAM2C,EAANkB,EA+JA,MAAMC,EAAU,CAKtB3B,QAAUP,GACFe,EAAcoB,YAAc5B,EAAAA,QAAQP,CAO5CoC,EAAAA,IAAK,CAAC1F,EAAiB4D,IACfS,EAAcoB,YAAAA,EAAcC,IAAI1F,EAAS4D,GAOjD+B,OAASrC,GACDe,EAAcoB,YAAAA,EAAcE,OAAOrC,CAAAA,EAO3CsC,UAAW,CACVlB,EACApB,IAEOe,EAAcoB,YAAcG,EAAAA,UAAUlB,EAASpB,CAAAA,CAAAA"}
|
package/dist/dialog.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./dialog-service-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./dialog-service-p9b29N9B.cjs");exports.$dialog=e.$dialog,Object.defineProperty(exports,"ConfirmDialog",{enumerable:!0,get:()=>e.ConfirmDialog}),exports.DialogService=e.DialogService;
|
|
2
2
|
//# sourceMappingURL=dialog.cjs.map
|
package/dist/dialog.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";const l=require("@floating-ui/dom"),
|
|
1
|
+
"use strict";const l=require("@floating-ui/dom"),p=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const m=require("./litElement.mixin-DqMWf6Rp.cjs"),y=require("./tailwind.mixin-C-SZB7Or.cjs"),h=require("lit"),n=require("lit/decorators.js");var u=Object.defineProperty,g=Object.getOwnPropertyDescriptor,a=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?g(e,s):e,c=t.length-1;c>=0;c--)(i=t[c])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&u(e,s,o),o};exports.SchmancyDropdown=class extends m.$LitElement(h.css`
|
|
2
2
|
:host {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
position: relative;
|
|
5
5
|
}
|
|
6
|
-
`){constructor(){super(...arguments),this.open=!1,this.placement="bottom-start",this.distance=8,this.portal=null}connectedCallback(){super.connectedCallback(),this.setupPortal(),
|
|
6
|
+
`){constructor(){super(...arguments),this.open=!1,this.placement="bottom-start",this.distance=8,this.portal=null}connectedCallback(){super.connectedCallback(),this.setupPortal(),p.fromEvent(document,"click").pipe(p.filter(t=>this.open&&!this.isEventFromSelf(t)),p.takeUntil(this.disconnecting)).subscribe(()=>{this.open=!1}),p.fromEvent(document,"keydown").pipe(p.filter(t=>this.open&&t.key==="Escape"),p.takeUntil(this.disconnecting)).subscribe(()=>{this.open=!1})}setupPortal(){let t=document.getElementById("schmancy-portal-container");t||(t=document.createElement("div"),t.id="schmancy-portal-container",t.style.position="fixed",t.style.zIndex="10000",t.style.top="0",t.style.left="0",t.style.pointerEvents="none",document.body.appendChild(t));const e=document.createElement("div");e.className="schmancy-dropdown-portal",e.style.position="absolute",e.style.pointerEvents="auto",e.style.display="none",t.appendChild(e),this.portal=e}isEventFromSelf(t){return t.composedPath().some(e=>e===this)}disconnectedCallback(){var t;(t=this.cleanupPositioner)==null||t.call(this),this.portal&&(this.portal.remove(),this.portal=null),super.disconnectedCallback()}toggle(){this.open=!this.open}updated(t){var e;super.updated(t),t.has("open")&&(this.open?this.setupPositioner():((e=this.cleanupPositioner)==null||e.call(this),this.portal&&(this.portal.style.display="none",this.portal.innerHTML="")))}setupPositioner(){this.triggerContainer&&this.portal&&(this.portal.style.display="block",this.teleportContentToPortal(),this.cleanupPositioner=l.autoUpdate(this.triggerContainer,this.portal,()=>{l.computePosition(this.triggerContainer,this.portal,{placement:this.placement,middleware:[l.offset(this.distance),l.flip({fallbackPlacements:["top-start","bottom-start"]}),l.shift({padding:0})]}).then(({x:t,y:e})=>{Object.assign(this.portal.style,{left:`${t}px`,top:e-8+"px"})})}))}teleportContentToPortal(){this.portal&&(this.portal.innerHTML="",this.contentElements.forEach(t=>{var s;const e=t.cloneNode(!0);t.tagName.toLowerCase()==="schmancy-dropdown-content"&&e.addEventListener("slotchange",()=>{var i;const r=(i=e.shadowRoot)==null?void 0:i.querySelector('[part="content"]');r&&r.classList.add("schmancy-dropdown-content")}),(s=this.portal)==null||s.appendChild(e)}))}handleTriggerClick(t){t.stopPropagation(),this.toggle()}render(){return h.html`
|
|
7
7
|
<div class="trigger-container" @click=${this.handleTriggerClick}>
|
|
8
8
|
<slot name="trigger"></slot>
|
|
9
9
|
</div>
|
|
@@ -13,13 +13,12 @@
|
|
|
13
13
|
@slotchange=${()=>{this.open&&(this.teleportContentToPortal(),this.setupPositioner())}}
|
|
14
14
|
></slot>
|
|
15
15
|
</div>
|
|
16
|
-
`}},a([n.property({type:Boolean,reflect:!0})],exports.SchmancyDropdown.prototype,"open",2),a([n.property({type:String})],exports.SchmancyDropdown.prototype,"placement",2),a([n.property({type:Number})],exports.SchmancyDropdown.prototype,"distance",2),a([n.query(".trigger-container")],exports.SchmancyDropdown.prototype,"triggerContainer",2),a([n.query(".dropdown-content-container")],exports.SchmancyDropdown.prototype,"contentContainer",2),a([n.queryAssignedElements({flatten:!0})],exports.SchmancyDropdown.prototype,"contentElements",2),a([n.state()],exports.SchmancyDropdown.prototype,"portal",2),a([n.queryAssignedElements({slot:"trigger",flatten:!0})],exports.SchmancyDropdown.prototype,"triggerElements",2),exports.SchmancyDropdown=a([n.customElement("schmancy-dropdown")],exports.SchmancyDropdown);var w=Object.defineProperty,f=Object.getOwnPropertyDescriptor,d=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?f(e,s):e,
|
|
16
|
+
`}},a([n.property({type:Boolean,reflect:!0})],exports.SchmancyDropdown.prototype,"open",2),a([n.property({type:String})],exports.SchmancyDropdown.prototype,"placement",2),a([n.property({type:Number})],exports.SchmancyDropdown.prototype,"distance",2),a([n.query(".trigger-container")],exports.SchmancyDropdown.prototype,"triggerContainer",2),a([n.query(".dropdown-content-container")],exports.SchmancyDropdown.prototype,"contentContainer",2),a([n.queryAssignedElements({flatten:!0})],exports.SchmancyDropdown.prototype,"contentElements",2),a([n.state()],exports.SchmancyDropdown.prototype,"portal",2),a([n.queryAssignedElements({slot:"trigger",flatten:!0})],exports.SchmancyDropdown.prototype,"triggerElements",2),exports.SchmancyDropdown=a([n.customElement("schmancy-dropdown")],exports.SchmancyDropdown);var w=Object.defineProperty,f=Object.getOwnPropertyDescriptor,d=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?f(e,s):e,c=t.length-1;c>=0;c--)(i=t[c])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&w(e,s,o),o};exports.SchmancyDropdownContent=class extends y.TailwindElement(h.css`
|
|
17
17
|
:host {
|
|
18
18
|
display: block;
|
|
19
19
|
position: absolute;
|
|
20
20
|
z-index: 1000;
|
|
21
21
|
min-width: 10rem;
|
|
22
|
-
padding: 0.5rem 0;
|
|
23
22
|
margin: 0;
|
|
24
23
|
text-align: left;
|
|
25
24
|
list-style: none;
|
|
@@ -52,7 +51,6 @@
|
|
|
52
51
|
background-color: var(--schmancy-sys-color-surface-container);
|
|
53
52
|
border-radius: 0.375rem;
|
|
54
53
|
box-shadow: var(--schmancy-sys-elevation-3);
|
|
55
|
-
padding: 0.5rem 0;
|
|
56
54
|
will-change: transform;
|
|
57
55
|
transform-origin: top left;
|
|
58
56
|
animation: dropdownAnimation 0.1s ease-out forwards;
|
|
@@ -62,4 +60,4 @@
|
|
|
62
60
|
<slot></slot>
|
|
63
61
|
</div>
|
|
64
62
|
`}},d([n.property({type:String})],exports.SchmancyDropdownContent.prototype,"width",2),d([n.property({type:String})],exports.SchmancyDropdownContent.prototype,"maxHeight",2),d([n.property({type:Boolean})],exports.SchmancyDropdownContent.prototype,"shadow",2),d([n.property({type:String})],exports.SchmancyDropdownContent.prototype,"radius",2),exports.SchmancyDropdownContent=d([n.customElement("schmancy-dropdown-content")],exports.SchmancyDropdownContent);
|
|
65
|
-
//# sourceMappingURL=dropdown-content
|
|
63
|
+
//# sourceMappingURL=dropdown-content--sqK901p.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-content--sqK901p.cjs","sources":["../src/dropdown/dropdown-component.ts","../src/dropdown/dropdown-content.ts"],"sourcesContent":["import { autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom'\nimport { $LitElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property, query, queryAssignedElements, state } from 'lit/decorators.js'\nimport { filter, fromEvent, takeUntil } from 'rxjs'\n\n/**\n * A dropdown component that displays content when triggered.\n *\n * @element schmancy-dropdown\n * @slot trigger - The element that triggers the dropdown\n * @slot - Default slot for the dropdown content\n */\n@customElement('schmancy-dropdown')\nexport class SchmancyDropdown extends $LitElement(css`\n\t:host {\n\t\tdisplay: inline-block;\n\t\tposition: relative;\n\t}\n`) {\n\t/**\n\t * Whether the dropdown is currently open\n\t */\n\t@property({ type: Boolean, reflect: true })\n\topen = false\n\n\t/**\n\t * Placement of the dropdown relative to the trigger\n\t */\n\t@property({ type: String })\n\tplacement:\n\t\t| 'top'\n\t\t| 'top-start'\n\t\t| 'top-end'\n\t\t| 'right'\n\t\t| 'right-start'\n\t\t| 'right-end'\n\t\t| 'bottom'\n\t\t| 'bottom-start'\n\t\t| 'bottom-end'\n\t\t| 'left'\n\t\t| 'left-start'\n\t\t| 'left-end' = 'bottom-start'\n\n\t/**\n\t * Offset distance in pixels\n\t */\n\t@property({ type: Number })\n\tdistance = 8\n\n\t@query('.trigger-container') triggerContainer!: HTMLElement\n\t@query('.dropdown-content-container') contentContainer!: HTMLElement\n\t@queryAssignedElements({ flatten: true }) contentElements!: HTMLElement[]\n\t@state() private portal: HTMLElement | null = null\n\n\t@queryAssignedElements({ slot: 'trigger', flatten: true })\n\ttriggerElements!: Array<HTMLElement>\n\n\tprivate cleanupPositioner?: () => void\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\t// Create portal container for teleporting content to document body\n\t\tthis.setupPortal()\n\n\t\t// Listen for document clicks to close dropdown when clicking outside\n\t\tfromEvent<MouseEvent>(document, 'click')\n\t\t\t.pipe(\n\t\t\t\tfilter(event => this.open && !this.isEventFromSelf(event)),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe(() => {\n\t\t\t\tthis.open = false\n\t\t\t})\n\n\t\t// Listen for escape key to close dropdown\n\t\tfromEvent<KeyboardEvent>(document, 'keydown')\n\t\t\t.pipe(\n\t\t\t\tfilter(event => this.open && event.key === 'Escape'),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe(() => {\n\t\t\t\tthis.open = false\n\t\t\t})\n\t}\n\n\t/**\n\t * Set up the portal element for teleporting content\n\t */\n\tprivate setupPortal() {\n\t\t// Check if portal container exists\n\t\tlet portalContainer = document.getElementById('schmancy-portal-container')\n\n\t\t// Create portal container if it doesn't exist\n\t\tif (!portalContainer) {\n\t\t\tportalContainer = document.createElement('div')\n\t\t\tportalContainer.id = 'schmancy-portal-container'\n\t\t\tportalContainer.style.position = 'fixed'\n\t\t\tportalContainer.style.zIndex = '10000'\n\t\t\tportalContainer.style.top = '0'\n\t\t\tportalContainer.style.left = '0'\n\t\t\tportalContainer.style.pointerEvents = 'none'\n\t\t\tdocument.body.appendChild(portalContainer)\n\t\t}\n\n\t\t// Create portal for this specific dropdown\n\t\tconst portal = document.createElement('div')\n\t\tportal.className = 'schmancy-dropdown-portal'\n\t\tportal.style.position = 'absolute'\n\t\tportal.style.pointerEvents = 'auto'\n\t\tportal.style.display = 'none'\n\t\tportalContainer.appendChild(portal)\n\n\t\tthis.portal = portal\n\t}\n\n\t/**\n\t * Check if an event originated from within this component\n\t */\n\tprivate isEventFromSelf(event: Event): boolean {\n\t\treturn event.composedPath().some(el => el === this)\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.cleanupPositioner?.()\n\n\t\t// Remove portal when component is disconnected\n\t\tif (this.portal) {\n\t\t\tthis.portal.remove()\n\t\t\tthis.portal = null\n\t\t}\n\n\t\tsuper.disconnectedCallback()\n\t}\n\n\t/**\n\t * Toggle the dropdown open state\n\t */\n\ttoggle() {\n\t\tthis.open = !this.open\n\t}\n\n\tupdated(changedProps: Map<string, any>) {\n\t\tsuper.updated(changedProps)\n\n\t\tif (changedProps.has('open')) {\n\t\t\tif (this.open) {\n\t\t\t\tthis.setupPositioner()\n\t\t\t} else {\n\t\t\t\tthis.cleanupPositioner?.()\n\n\t\t\t\t// Hide portal when dropdown is closed\n\t\t\t\tif (this.portal) {\n\t\t\t\t\tthis.portal.style.display = 'none'\n\t\t\t\t\tthis.portal.innerHTML = ''\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Setup floating UI positioning with teleportation\n\t */\n\tprivate setupPositioner() {\n\t\tif (!this.triggerContainer || !this.portal) return\n\n\t\t// Show the portal\n\t\tthis.portal.style.display = 'block'\n\n\t\t// Move content to portal\n\t\tthis.teleportContentToPortal()\n\n\t\t// Setup positioning\n\t\tthis.cleanupPositioner = autoUpdate(this.triggerContainer, this.portal, () => {\n\t\t\tcomputePosition(this.triggerContainer, this.portal, {\n\t\t\t\tplacement: this.placement,\n\t\t\t\tmiddleware: [\n\t\t\t\t\toffset(this.distance),\n\t\t\t\t\tflip({\n\t\t\t\t\t\tfallbackPlacements: ['top-start', 'bottom-start'],\n\t\t\t\t\t}),\n\t\t\t\t\tshift({ padding: 0 }),\n\t\t\t\t],\n\t\t\t}).then(({ x, y }) => {\n\t\t\t\t// Update portal position\n\t\t\t\tObject.assign(this.portal.style, {\n\t\t\t\t\tleft: `${x}px`,\n\t\t\t\t\ttop: `${y - 8}px`,\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t}\n\n\t/**\n\t * Move slotted content to the portal\n\t */\n\tprivate teleportContentToPortal() {\n\t\tif (!this.portal) return\n\n\t\t// Clear existing content\n\t\tthis.portal.innerHTML = ''\n\n\t\t// Clone and move slotted content to portal\n\t\tthis.contentElements.forEach(element => {\n\t\t\t// Get computed styles to ensure portal content matches original styling\n\t\t\tconst clonedElement = element.cloneNode(true) as HTMLElement\n\n\t\t\t// Ensure dropdown-content elements maintain their styles when teleported\n\t\t\tif (element.tagName.toLowerCase() === 'schmancy-dropdown-content') {\n\t\t\t\tclonedElement.addEventListener('slotchange', () => {\n\t\t\t\t\t// Propagate any slot changes to class changes on children\n\t\t\t\t\tconst contentDiv = clonedElement.shadowRoot?.querySelector('[part=\"content\"]')\n\t\t\t\t\tif (contentDiv) {\n\t\t\t\t\t\tcontentDiv.classList.add('schmancy-dropdown-content')\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tthis.portal?.appendChild(clonedElement)\n\t\t})\n\t}\n\n\t/**\n\t * Handle trigger click to toggle dropdown\n\t */\n\tprivate handleTriggerClick(e: Event) {\n\t\te.stopPropagation()\n\t\tthis.toggle()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"trigger-container\" @click=${this.handleTriggerClick}>\n\t\t\t\t<slot name=\"trigger\"></slot>\n\t\t\t</div>\n\n\t\t\t<div class=\"dropdown-content-container\" ?hidden=${!this.open}>\n\t\t\t\t<slot\n\t\t\t\t\t@slotchange=${() => {\n\t\t\t\t\t\tif (this.open) {\n\t\t\t\t\t\t\tthis.teleportContentToPortal()\n\t\t\t\t\t\t\tthis.setupPositioner()\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t></slot>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-dropdown': SchmancyDropdown\n\t}\n}\n","import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\n/**\n * Content container for the schmancy-dropdown component.\n *\n * @element schmancy-dropdown-content\n * @slot - Default slot for dropdown content\n */\n@customElement('schmancy-dropdown-content')\nexport class SchmancyDropdownContent extends TailwindElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\tz-index: 1000;\n\t\tmin-width: 10rem;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\tlist-style: none;\n\t\tbackground-color: var(--schmancy-sys-color-surface-container);\n\t\tbackground-clip: padding-box;\n\t\tborder-radius: 0.375rem;\n\t\tbox-shadow: var(--schmancy-sys-elevation-3);\n\t\twill-change: transform;\n\t\ttransform-origin: top left;\n\t\tanimation: dropdownAnimation 0.1s ease-out forwards;\n\t}\n\n\t:host([hidden]) {\n\t\tdisplay: none;\n\t}\n\n\t@keyframes dropdownAnimation {\n\t\tfrom {\n\t\t\topacity: 0;\n\t\t\ttransform: scale(0.95);\n\t\t}\n\t\tto {\n\t\t\topacity: 1;\n\t\t\ttransform: scale(1);\n\t\t}\n\t}\n\n\t/* Apply styles to content both in the component and when teleported to the portal */\n\t.schmancy-dropdown-content {\n\t\tbackground-color: var(--schmancy-sys-color-surface-container);\n\t\tborder-radius: 0.375rem;\n\t\tbox-shadow: var(--schmancy-sys-elevation-3);\n\t\twill-change: transform;\n\t\ttransform-origin: top left;\n\t\tanimation: dropdownAnimation 0.1s ease-out forwards;\n\t}\n`) {\n\t/**\n\t * Width of the dropdown content\n\t */\n\t@property({ type: String })\n\twidth: string = 'auto'\n\n\t/**\n\t * Maximum height of the dropdown content\n\t */\n\t@property({ type: String })\n\tmaxHeight: string = '80vh'\n\n\t/**\n\t * Whether to render with a shadow\n\t */\n\t@property({ type: Boolean })\n\tshadow: boolean = true\n\n\t/**\n\t * Border radius style\n\t */\n\t@property({ type: String })\n\tradius: 'none' | 'sm' | 'md' | 'lg' | 'full' = 'md'\n\n\trender() {\n\t\tconst classes = {\n\t\t\t'schmancy-dropdown-content': true,\n\t\t\t'overflow-auto': true,\n\t\t\t'shadow-none': !this.shadow,\n\t\t\t'rounded-none': this.radius === 'none',\n\t\t\t'rounded-sm': this.radius === 'sm',\n\t\t\t'rounded-md': this.radius === 'md',\n\t\t\t'rounded-lg': this.radius === 'lg',\n\t\t\t'rounded-full': this.radius === 'full',\n\t\t}\n\n\t\tconst styles = {\n\t\t\twidth: this.width,\n\t\t\tmaxHeight: this.maxHeight,\n\t\t}\n\n\t\treturn html`\n\t\t\t<div class=${this.classMap(classes)} style=${this.styleMap(styles)} part=\"content\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-dropdown-content': SchmancyDropdownContent\n\t}\n}\n"],"names":["SchmancyDropdown","$LitElement","css","super","arguments","this","open","placement","distance","portal","connectedCallback","setupPortal","fromEvent","document","pipe","filter","isEventFromSelf","event","takeUntil","disconnecting","subscribe","key","portalContainer","getElementById","createElement","id","style","position","zIndex","top","left","pointerEvents","body","appendChild","className","display","composedPath","some","el","cleanupPositioner","remove","disconnectedCallback","changedProps","updated","has","setupPositioner","innerHTML","triggerContainer","teleportContentToPortal","autoUpdate","computePosition","middleware","offset","flip","fallbackPlacements","shift","padding","then","x","y","Object","assign","contentElements","forEach","element","clonedElement","cloneNode","tagName","toLowerCase","addEventListener","contentDiv","shadowRoot","querySelector","classList","add","e","stopPropagation","toggle","html","handleTriggerClick","__decorateClass","property","type","Boolean","reflect","prototype","String","Number","query","queryAssignedElements","flatten","state","slot","customElement","SchmancyDropdownContent","TailwindElement","constructor","width","maxHeight","shadow","radius","classes","styles","classMap","styleMap"],"mappings":"+dAcaA,QAAAA,iBAAN,cAA+BC,EAAAA,YAAYC,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,CAA3C,CAAA,CAAA,cAAAC,MAAAC,GAAAA,SAAAA,EAUCC,KAAAC,KAAAA,GAkBSD,KAAAE,UA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,OA1DNW,CAAAA,CAAAA,EAAAA,gCA2DZT,UAAA,SAAA,CAAA,EAMAL,EAAA,CADCC,WAAS,CAAEC,KAAMI,UAhENQ,gCAiEZT,UAAA,SAAA,CAjEYS,EAAAA,QAANA,wBAAAd,EAAA,CADNa,EAAAA,cAAc,2BAAA,CAAA,EACFC"}
|
|
@@ -84,17 +84,16 @@ let a = class extends E(f`
|
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
i([l({ type: Boolean, reflect: !0 })], a.prototype, "open", 2), i([l({ type: String })], a.prototype, "placement", 2), i([l({ type: Number })], a.prototype, "distance", 2), i([u(".trigger-container")], a.prototype, "triggerContainer", 2), i([u(".dropdown-content-container")], a.prototype, "contentContainer", 2), i([g({ flatten: !0 })], a.prototype, "contentElements", 2), i([T()], a.prototype, "portal", 2), i([g({ slot: "trigger", flatten: !0 })], a.prototype, "triggerElements", 2), a = i([b("schmancy-dropdown")], a);
|
|
87
|
-
var j = Object.defineProperty, H = Object.getOwnPropertyDescriptor,
|
|
87
|
+
var j = Object.defineProperty, H = Object.getOwnPropertyDescriptor, d = (t, e, s, n) => {
|
|
88
88
|
for (var r, o = n > 1 ? void 0 : n ? H(e, s) : e, p = t.length - 1; p >= 0; p--) (r = t[p]) && (o = (n ? r(e, s, o) : r(o)) || o);
|
|
89
89
|
return n && o && j(e, s, o), o;
|
|
90
90
|
};
|
|
91
|
-
let
|
|
91
|
+
let c = class extends S(f`
|
|
92
92
|
:host {
|
|
93
93
|
display: block;
|
|
94
94
|
position: absolute;
|
|
95
95
|
z-index: 1000;
|
|
96
96
|
min-width: 10rem;
|
|
97
|
-
padding: 0.5rem 0;
|
|
98
97
|
margin: 0;
|
|
99
98
|
text-align: left;
|
|
100
99
|
list-style: none;
|
|
@@ -127,7 +126,6 @@ let d = class extends S(f`
|
|
|
127
126
|
background-color: var(--schmancy-sys-color-surface-container);
|
|
128
127
|
border-radius: 0.375rem;
|
|
129
128
|
box-shadow: var(--schmancy-sys-elevation-3);
|
|
130
|
-
padding: 0.5rem 0;
|
|
131
129
|
will-change: transform;
|
|
132
130
|
transform-origin: top left;
|
|
133
131
|
animation: dropdownAnimation 0.1s ease-out forwards;
|
|
@@ -145,9 +143,9 @@ let d = class extends S(f`
|
|
|
145
143
|
`;
|
|
146
144
|
}
|
|
147
145
|
};
|
|
148
|
-
|
|
146
|
+
d([l({ type: String })], c.prototype, "width", 2), d([l({ type: String })], c.prototype, "maxHeight", 2), d([l({ type: Boolean })], c.prototype, "shadow", 2), d([l({ type: String })], c.prototype, "radius", 2), c = d([b("schmancy-dropdown-content")], c);
|
|
149
147
|
export {
|
|
150
148
|
a as S,
|
|
151
|
-
|
|
149
|
+
c as a
|
|
152
150
|
};
|
|
153
|
-
//# sourceMappingURL=dropdown-content-
|
|
151
|
+
//# sourceMappingURL=dropdown-content-Ctq1JVzp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-content-Ctq1JVzp.js","sources":["../src/dropdown/dropdown-component.ts","../src/dropdown/dropdown-content.ts"],"sourcesContent":["import { autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom'\nimport { $LitElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property, query, queryAssignedElements, state } from 'lit/decorators.js'\nimport { filter, fromEvent, takeUntil } from 'rxjs'\n\n/**\n * A dropdown component that displays content when triggered.\n *\n * @element schmancy-dropdown\n * @slot trigger - The element that triggers the dropdown\n * @slot - Default slot for the dropdown content\n */\n@customElement('schmancy-dropdown')\nexport class SchmancyDropdown extends $LitElement(css`\n\t:host {\n\t\tdisplay: inline-block;\n\t\tposition: relative;\n\t}\n`) {\n\t/**\n\t * Whether the dropdown is currently open\n\t */\n\t@property({ type: Boolean, reflect: true })\n\topen = false\n\n\t/**\n\t * Placement of the dropdown relative to the trigger\n\t */\n\t@property({ type: String })\n\tplacement:\n\t\t| 'top'\n\t\t| 'top-start'\n\t\t| 'top-end'\n\t\t| 'right'\n\t\t| 'right-start'\n\t\t| 'right-end'\n\t\t| 'bottom'\n\t\t| 'bottom-start'\n\t\t| 'bottom-end'\n\t\t| 'left'\n\t\t| 'left-start'\n\t\t| 'left-end' = 'bottom-start'\n\n\t/**\n\t * Offset distance in pixels\n\t */\n\t@property({ type: Number })\n\tdistance = 8\n\n\t@query('.trigger-container') triggerContainer!: HTMLElement\n\t@query('.dropdown-content-container') contentContainer!: HTMLElement\n\t@queryAssignedElements({ flatten: true }) contentElements!: HTMLElement[]\n\t@state() private portal: HTMLElement | null = null\n\n\t@queryAssignedElements({ slot: 'trigger', flatten: true })\n\ttriggerElements!: Array<HTMLElement>\n\n\tprivate cleanupPositioner?: () => void\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\t// Create portal container for teleporting content to document body\n\t\tthis.setupPortal()\n\n\t\t// Listen for document clicks to close dropdown when clicking outside\n\t\tfromEvent<MouseEvent>(document, 'click')\n\t\t\t.pipe(\n\t\t\t\tfilter(event => this.open && !this.isEventFromSelf(event)),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe(() => {\n\t\t\t\tthis.open = false\n\t\t\t})\n\n\t\t// Listen for escape key to close dropdown\n\t\tfromEvent<KeyboardEvent>(document, 'keydown')\n\t\t\t.pipe(\n\t\t\t\tfilter(event => this.open && event.key === 'Escape'),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe(() => {\n\t\t\t\tthis.open = false\n\t\t\t})\n\t}\n\n\t/**\n\t * Set up the portal element for teleporting content\n\t */\n\tprivate setupPortal() {\n\t\t// Check if portal container exists\n\t\tlet portalContainer = document.getElementById('schmancy-portal-container')\n\n\t\t// Create portal container if it doesn't exist\n\t\tif (!portalContainer) {\n\t\t\tportalContainer = document.createElement('div')\n\t\t\tportalContainer.id = 'schmancy-portal-container'\n\t\t\tportalContainer.style.position = 'fixed'\n\t\t\tportalContainer.style.zIndex = '10000'\n\t\t\tportalContainer.style.top = '0'\n\t\t\tportalContainer.style.left = '0'\n\t\t\tportalContainer.style.pointerEvents = 'none'\n\t\t\tdocument.body.appendChild(portalContainer)\n\t\t}\n\n\t\t// Create portal for this specific dropdown\n\t\tconst portal = document.createElement('div')\n\t\tportal.className = 'schmancy-dropdown-portal'\n\t\tportal.style.position = 'absolute'\n\t\tportal.style.pointerEvents = 'auto'\n\t\tportal.style.display = 'none'\n\t\tportalContainer.appendChild(portal)\n\n\t\tthis.portal = portal\n\t}\n\n\t/**\n\t * Check if an event originated from within this component\n\t */\n\tprivate isEventFromSelf(event: Event): boolean {\n\t\treturn event.composedPath().some(el => el === this)\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.cleanupPositioner?.()\n\n\t\t// Remove portal when component is disconnected\n\t\tif (this.portal) {\n\t\t\tthis.portal.remove()\n\t\t\tthis.portal = null\n\t\t}\n\n\t\tsuper.disconnectedCallback()\n\t}\n\n\t/**\n\t * Toggle the dropdown open state\n\t */\n\ttoggle() {\n\t\tthis.open = !this.open\n\t}\n\n\tupdated(changedProps: Map<string, any>) {\n\t\tsuper.updated(changedProps)\n\n\t\tif (changedProps.has('open')) {\n\t\t\tif (this.open) {\n\t\t\t\tthis.setupPositioner()\n\t\t\t} else {\n\t\t\t\tthis.cleanupPositioner?.()\n\n\t\t\t\t// Hide portal when dropdown is closed\n\t\t\t\tif (this.portal) {\n\t\t\t\t\tthis.portal.style.display = 'none'\n\t\t\t\t\tthis.portal.innerHTML = ''\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Setup floating UI positioning with teleportation\n\t */\n\tprivate setupPositioner() {\n\t\tif (!this.triggerContainer || !this.portal) return\n\n\t\t// Show the portal\n\t\tthis.portal.style.display = 'block'\n\n\t\t// Move content to portal\n\t\tthis.teleportContentToPortal()\n\n\t\t// Setup positioning\n\t\tthis.cleanupPositioner = autoUpdate(this.triggerContainer, this.portal, () => {\n\t\t\tcomputePosition(this.triggerContainer, this.portal, {\n\t\t\t\tplacement: this.placement,\n\t\t\t\tmiddleware: [\n\t\t\t\t\toffset(this.distance),\n\t\t\t\t\tflip({\n\t\t\t\t\t\tfallbackPlacements: ['top-start', 'bottom-start'],\n\t\t\t\t\t}),\n\t\t\t\t\tshift({ padding: 0 }),\n\t\t\t\t],\n\t\t\t}).then(({ x, y }) => {\n\t\t\t\t// Update portal position\n\t\t\t\tObject.assign(this.portal.style, {\n\t\t\t\t\tleft: `${x}px`,\n\t\t\t\t\ttop: `${y - 8}px`,\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t}\n\n\t/**\n\t * Move slotted content to the portal\n\t */\n\tprivate teleportContentToPortal() {\n\t\tif (!this.portal) return\n\n\t\t// Clear existing content\n\t\tthis.portal.innerHTML = ''\n\n\t\t// Clone and move slotted content to portal\n\t\tthis.contentElements.forEach(element => {\n\t\t\t// Get computed styles to ensure portal content matches original styling\n\t\t\tconst clonedElement = element.cloneNode(true) as HTMLElement\n\n\t\t\t// Ensure dropdown-content elements maintain their styles when teleported\n\t\t\tif (element.tagName.toLowerCase() === 'schmancy-dropdown-content') {\n\t\t\t\tclonedElement.addEventListener('slotchange', () => {\n\t\t\t\t\t// Propagate any slot changes to class changes on children\n\t\t\t\t\tconst contentDiv = clonedElement.shadowRoot?.querySelector('[part=\"content\"]')\n\t\t\t\t\tif (contentDiv) {\n\t\t\t\t\t\tcontentDiv.classList.add('schmancy-dropdown-content')\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tthis.portal?.appendChild(clonedElement)\n\t\t})\n\t}\n\n\t/**\n\t * Handle trigger click to toggle dropdown\n\t */\n\tprivate handleTriggerClick(e: Event) {\n\t\te.stopPropagation()\n\t\tthis.toggle()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"trigger-container\" @click=${this.handleTriggerClick}>\n\t\t\t\t<slot name=\"trigger\"></slot>\n\t\t\t</div>\n\n\t\t\t<div class=\"dropdown-content-container\" ?hidden=${!this.open}>\n\t\t\t\t<slot\n\t\t\t\t\t@slotchange=${() => {\n\t\t\t\t\t\tif (this.open) {\n\t\t\t\t\t\t\tthis.teleportContentToPortal()\n\t\t\t\t\t\t\tthis.setupPositioner()\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t></slot>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-dropdown': SchmancyDropdown\n\t}\n}\n","import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\n/**\n * Content container for the schmancy-dropdown component.\n *\n * @element schmancy-dropdown-content\n * @slot - Default slot for dropdown content\n */\n@customElement('schmancy-dropdown-content')\nexport class SchmancyDropdownContent extends TailwindElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\tz-index: 1000;\n\t\tmin-width: 10rem;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\tlist-style: none;\n\t\tbackground-color: var(--schmancy-sys-color-surface-container);\n\t\tbackground-clip: padding-box;\n\t\tborder-radius: 0.375rem;\n\t\tbox-shadow: var(--schmancy-sys-elevation-3);\n\t\twill-change: transform;\n\t\ttransform-origin: top left;\n\t\tanimation: dropdownAnimation 0.1s ease-out forwards;\n\t}\n\n\t:host([hidden]) {\n\t\tdisplay: none;\n\t}\n\n\t@keyframes dropdownAnimation {\n\t\tfrom {\n\t\t\topacity: 0;\n\t\t\ttransform: scale(0.95);\n\t\t}\n\t\tto {\n\t\t\topacity: 1;\n\t\t\ttransform: scale(1);\n\t\t}\n\t}\n\n\t/* Apply styles to content both in the component and when teleported to the portal */\n\t.schmancy-dropdown-content {\n\t\tbackground-color: var(--schmancy-sys-color-surface-container);\n\t\tborder-radius: 0.375rem;\n\t\tbox-shadow: var(--schmancy-sys-elevation-3);\n\t\twill-change: transform;\n\t\ttransform-origin: top left;\n\t\tanimation: dropdownAnimation 0.1s ease-out forwards;\n\t}\n`) {\n\t/**\n\t * Width of the dropdown content\n\t */\n\t@property({ type: String })\n\twidth: string = 'auto'\n\n\t/**\n\t * Maximum height of the dropdown content\n\t */\n\t@property({ type: String })\n\tmaxHeight: string = '80vh'\n\n\t/**\n\t * Whether to render with a shadow\n\t */\n\t@property({ type: Boolean })\n\tshadow: boolean = true\n\n\t/**\n\t * Border radius style\n\t */\n\t@property({ type: String })\n\tradius: 'none' | 'sm' | 'md' | 'lg' | 'full' = 'md'\n\n\trender() {\n\t\tconst classes = {\n\t\t\t'schmancy-dropdown-content': true,\n\t\t\t'overflow-auto': true,\n\t\t\t'shadow-none': !this.shadow,\n\t\t\t'rounded-none': this.radius === 'none',\n\t\t\t'rounded-sm': this.radius === 'sm',\n\t\t\t'rounded-md': this.radius === 'md',\n\t\t\t'rounded-lg': this.radius === 'lg',\n\t\t\t'rounded-full': this.radius === 'full',\n\t\t}\n\n\t\tconst styles = {\n\t\t\twidth: this.width,\n\t\t\tmaxHeight: this.maxHeight,\n\t\t}\n\n\t\treturn html`\n\t\t\t<div class=${this.classMap(classes)} style=${this.styleMap(styles)} part=\"content\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-dropdown-content': SchmancyDropdownContent\n\t}\n}\n"],"names":["SchmancyDropdown","$LitElement","css","super","arguments","this","open","placement","distance","portal","connectedCallback","setupPortal","fromEvent","document","pipe","filter","isEventFromSelf","event","takeUntil","disconnecting","subscribe","key","portalContainer","getElementById","createElement","id","style","position","zIndex","top","left","pointerEvents","body","appendChild","className","display","composedPath","some","el","cleanupPositioner","remove","disconnectedCallback","changedProps","updated","has","setupPositioner","innerHTML","triggerContainer","teleportContentToPortal","autoUpdate","computePosition","middleware","offset","flip","fallbackPlacements","shift","padding","then","x","y","Object","assign","contentElements","forEach","element","clonedElement","cloneNode","tagName","toLowerCase","addEventListener","contentDiv","shadowRoot","querySelector","classList","add","e","stopPropagation","toggle","render","html","handleTriggerClick","__decorateClass","property","type","Boolean","reflect","prototype","String","Number","query","queryAssignedElements","flatten","state","slot","customElement","SchmancyDropdownContent","TailwindElement","constructor","width","maxHeight","shadow","radius","classes","styles","classMap","styleMap"],"mappings":";;;;;;;;;;;;AAca,IAAAA,IAAN,cAA+BC,EAAYC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,CAA3C,EAAA;AAAA,EAAA,cAAAC;AAAAA,UAAAA,GAAAC,SAUCC,GAAAA,KAAAC,WAkBSD,KAAAE,YAAA,gBAMLF,KAAAG,WAAA,GAKFH,KAAQI,SAA6B;AAAA,EAAA;AAAA,EAO9C,oBACCN;AAAAA,UAAMO,qBAGNL,KAAKM,YAAAA,GAGiBC,EAAAC,UAAU,SAC9BC,KACAC,SAAgBV,KAAKC,SAASD,KAAKW,gBAAgBC,CACnDC,CAAAA,GAAAA,EAAUb,KAAKc,aAEfC,CAAAA,EAAAA,UAAU,MACVf;AAAAA,WAAKC,OAAO;AAAA,IAAA,CAIWM,GAAAA,EAAAC,UAAU,SACjCC,EAAAA,KACAC,EAAgBE,OAAAZ,KAAKC,QAAQW,EAAMI,QAAQ,QAARA,GACnCH,EAAUb,KAAKc,aAAAA,CAAAA,EAEfC,UAAU,MAAA;AACVf,WAAKC,OAAO;AAAA,IAAA,CACZ;AAAA,EAAA;AAAA,EAMK,cAEH;AAAA,QAAAgB,IAAkBT,SAASU,eAAe,2BAGzCD;AAAAA,UACcA,IAAAT,SAASW,cAAc,KACzCF,GAAAA,EAAgBG,KAAK,6BACrBH,EAAgBI,MAAMC,WAAW,SACjCL,EAAgBI,MAAME,SAAS,SAC/BN,EAAgBI,MAAMG,MAAM,KAC5BP,EAAgBI,MAAMI,OAAO,KAC7BR,EAAgBI,MAAMK,gBAAgB,QAC7BlB,SAAAmB,KAAKC,YAAYX,CAAAA;AAIrB,UAAAb,IAASI,SAASW,cAAc,KAAA;AACtCf,IAAAA,EAAOyB,YAAY,4BACnBzB,EAAOiB,MAAMC,WAAW,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9B,gBAAgBhG,KAAKgG,WAAW,OAG3BE,GAAAA,IAAS,EACdL,OAAO7F,KAAK6F,OACZC,WAAW9F,KAAK8F,UAGV;AAAA,WAAApB;AAAAA,gBACO1E,KAAKmG,SAASF,CAAkBjG,CAAAA,UAAAA,KAAKoG,SAASF,CAAAA,CAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAAO;AAtCpEtB;AAAAA,EAAA,CADCC,EAAS,EAAEC,MAAMI,OA9CNQ,CAAAA,CAAAA,GAAAA,EA+CZT,WAAA,SAAA,CAAA,GAMAL,EAAA,CADCC,EAAS,EAAEC,MAAMI,OAAAA,CAAAA,CAAAA,GApDNQ,EAqDZT,WAAA,aAAA,CAMAL,GAAAA,EAAA,CADCC,EAAS,EAAEC,MAAMC,QAAAA,CAAAA,CAAAA,GA1DNW,EA2DZT,WAAA,UAAA,IAMAL,EAAA,CADCC,EAAS,EAAEC,MAAMI,YAhENQ,EAiEZT,WAAA,UAAA,CAjEYS,GAAAA,IAANd,EAAA,CADNa,EAAc,2BACFC,CAAAA,GAAAA,CAAAA;"}
|
package/dist/dropdown.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./dropdown-content
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./dropdown-content--sqK901p.cjs");Object.defineProperty(exports,"SchmancyDropdown",{enumerable:!0,get:()=>e.SchmancyDropdown}),Object.defineProperty(exports,"SchmancyDropdownContent",{enumerable:!0,get:()=>e.SchmancyDropdownContent});
|
|
2
2
|
//# sourceMappingURL=dropdown.cjs.map
|
package/dist/dropdown.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./animated-text-DnpEmzG6.cjs");const c=require("./area.component-BScAAi9b.cjs");require("./autocomplete-BAblB5US.cjs");const r=require("./teleport.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./animated-text-DnpEmzG6.cjs");const c=require("./area.component-BScAAi9b.cjs");require("./autocomplete-BAblB5US.cjs");const r=require("./teleport.component-DkrqLHFc.cjs");require("./spinner-Cyoa6FUg.cjs");const h=require("./icon-button-BuQaHhHo.cjs"),f=require("./checkbox-j-8nzAvA.cjs");require("./chips-COn9_IpC.cjs");const C=require("./payment-card-form-CeW7v8C6.cjs"),O=require("./date-range-c5unYbcG.cjs"),u=require("./delay-dM9FOKCv.cjs"),S=require("./ripple-C2BHbhcS.cjs");require("./divider-B2lNC0Hi.cjs");const b=require("./timezone-B4sTteJT.cjs");require("./form-DBe9nCyD.cjs"),require("./icon-ClqiTwLk.cjs"),require("./input-BUwEVCui.cjs");const a=require("./flex-Bt5rjiJc.cjs"),y=require("./list-B2aWxkkk.cjs");require("./menu-CYU7-A6s.cjs");const n=require("./notification-service-Y81cuyI1.cjs");require("./option-Y52lFc0k.cjs");const D=require("./radio-group-DaIoovBv.cjs"),P=require("./rxjs-utils.cjs");require("rxjs"),require("./index-DyJ0oDpR.cjs");const j=require("./select-F73s56La.cjs"),o=require("./sheet-BMv294LB.cjs"),p=require("./slider-d4pNWdNo.cjs"),i=require("./schmancy-steps-container-CTGyq1in.cjs"),t=require("./context-object-CP7HbDFQ.cjs"),e=require("./selector-hook-wEJh3oTm.cjs"),d=require("./surface-BiwDfTwH.cjs"),g=require("./table-DY3znSpx.cjs");require("./tabs-group-CLoDXsPN.cjs"),require("./textarea-Dbn8e_6U.cjs");const m=require("./theme.component-BQhUaquX.cjs"),q=require("./theme.interface-Xg5Zi46a.cjs");require("./theme-button-D9peR8Hg.cjs");const w=require("./tooltip-CKmoUynJ.cjs"),T=require("./tree-Pa4t5MHy.cjs"),M=require("./types.cjs"),I=require("./typewriter-DXYFRAAl.cjs"),N=require("./typography-CF76Gm8m.cjs"),x=require("./intersection-CVvaDv96.cjs"),s=require("./dropdown-content--sqK901p.cjs"),l=require("./dialog-service-p9b29N9B.cjs");exports.FINDING_MORTIES=c.FINDING_MORTIES,exports.HERE_RICKY=c.HERE_RICKY,exports.HISTORY_STRATEGY=c.HISTORY_STRATEGY,Object.defineProperty(exports,"SchmancyArea",{enumerable:!0,get:()=>c.SchmancyArea}),exports.area=c.area,exports.routerHistory=c.routerHistory,exports.$drawer=r.$drawer,exports.HereMorty=r.HereMorty,Object.defineProperty(exports,"SchmancyBadgeV2",{enumerable:!0,get:()=>r.SchmancyBadgeV2}),Object.defineProperty(exports,"SchmancyContentDrawer",{enumerable:!0,get:()=>r.SchmancyContentDrawer}),exports.SchmancyContentDrawerID=r.SchmancyContentDrawerID,Object.defineProperty(exports,"SchmancyContentDrawerMain",{enumerable:!0,get:()=>r.SchmancyContentDrawerMain}),exports.SchmancyContentDrawerMaxHeight=r.SchmancyContentDrawerMaxHeight,exports.SchmancyContentDrawerMinWidth=r.SchmancyContentDrawerMinWidth,Object.defineProperty(exports,"SchmancyContentDrawerSheet",{enumerable:!0,get:()=>r.SchmancyContentDrawerSheet}),exports.SchmancyContentDrawerSheetMode=r.SchmancyContentDrawerSheetMode,exports.SchmancyContentDrawerSheetState=r.SchmancyContentDrawerSheetState,Object.defineProperty(exports,"SchmancyDrawerAppbar",{enumerable:!0,get:()=>r.SchmancyDrawerAppbar}),exports.SchmancyDrawerNavbarMode=r.SchmancyDrawerNavbarMode,exports.SchmancyDrawerNavbarState=r.SchmancyDrawerNavbarState,Object.defineProperty(exports,"SchmancyNavigationDrawer",{enumerable:!0,get:()=>r.SchmancyNavigationDrawer}),Object.defineProperty(exports,"SchmancyNavigationDrawerContent",{enumerable:!0,get:()=>r.SchmancyNavigationDrawerContent}),Object.defineProperty(exports,"SchmancyNavigationDrawerSidebar",{enumerable:!0,get:()=>r.SchmancyNavigationDrawerSidebar}),Object.defineProperty(exports,"SchmancyTeleportation",{enumerable:!0,get:()=>r.SchmancyTeleportation}),exports.WhereAreYouRicky=r.WhereAreYouRicky,exports.schmancyContentDrawer=r.schmancyContentDrawer,exports.schmancyNavDrawer=r.schmancyNavDrawer,exports.teleport=r.teleport,Object.defineProperty(exports,"SchmancyButton",{enumerable:!0,get:()=>h.SchmancyButton}),Object.defineProperty(exports,"SchmnacyIconButton",{enumerable:!0,get:()=>h.SchmnacyIconButton}),Object.defineProperty(exports,"SchmancyCheckbox",{enumerable:!0,get:()=>f.SchmancyCheckbox}),Object.defineProperty(exports,"SchmancyPaymentCardForm",{enumerable:!0,get:()=>C.SchmancyPaymentCardForm}),Object.defineProperty(exports,"SchmancyDateRange",{enumerable:!0,get:()=>O.SchmancyDateRange}),Object.defineProperty(exports,"SchmancyDelay",{enumerable:!0,get:()=>u.SchmancyDelay}),exports.delayContext=u.delayContext,exports.color=S.color,exports.fullHeight=S.fullHeight,exports.ripple=S.ripple,Object.defineProperty(exports,"SchmancyCountriesSelect",{enumerable:!0,get:()=>b.SchmancyCountriesSelect}),Object.defineProperty(exports,"SchmancyTimezonesSelect",{enumerable:!0,get:()=>b.SchmancyTimezonesSelect}),Object.defineProperty(exports,"SchmancyFlex",{enumerable:!0,get:()=>a.SchmancyFlex}),Object.defineProperty(exports,"SchmancyFlexV2",{enumerable:!0,get:()=>a.SchmancyFlexV2}),Object.defineProperty(exports,"SchmancyGrid",{enumerable:!0,get:()=>a.SchmancyGrid}),Object.defineProperty(exports,"SchmancyScroll",{enumerable:!0,get:()=>a.SchmancyScroll}),Object.defineProperty(exports,"List",{enumerable:!0,get:()=>y.List}),Object.defineProperty(exports,"SchmancyListItem",{enumerable:!0,get:()=>y.SchmancyListItem}),exports.SchmancyListTypeContext=y.SchmancyListTypeContext,exports.$notify=n.$notify,exports.NotificationAudioService=n.NotificationAudioService,Object.defineProperty(exports,"SchmancyNotification",{enumerable:!0,get:()=>n.SchmancyNotification}),Object.defineProperty(exports,"SchmancyNotificationContainer",{enumerable:!0,get:()=>n.SchmancyNotificationContainer}),Object.defineProperty(exports,"RadioGroup",{enumerable:!0,get:()=>D.RadioGroup}),exports.mutationObserver=P.mutationObserver,Object.defineProperty(exports,"SchmancySelect",{enumerable:!0,get:()=>j.SchmancySelect}),exports.SchmancySheetPosition=o.SchmancySheetPosition,exports.SheetHereMorty=o.SheetHereMorty,exports.SheetWhereAreYouRicky=o.SheetWhereAreYouRicky,exports.sheet=o.sheet,Object.defineProperty(exports,"SchmancySlide",{enumerable:!0,get:()=>p.SchmancySlide}),Object.defineProperty(exports,"SchmancySlider",{enumerable:!0,get:()=>p.SchmancySlider}),Object.defineProperty(exports,"SchmancyStep",{enumerable:!0,get:()=>i.SchmancyStep}),Object.defineProperty(exports,"SchmancyStepsContainer",{enumerable:!0,get:()=>i.SchmancyStepsContainer}),exports.StepsController=i.StepsController,exports.stepsContext=i.stepsContext,exports.BaseStore=t.BaseStore,exports.IndexedDBStorageManager=t.IndexedDBStorageManager,exports.LocalStorageManager=t.LocalStorageManager,exports.MemoryStorageManager=t.MemoryStorageManager,exports.SchmancyArrayStore=t.SchmancyArrayStore,exports.SchmancyStoreObject=t.SchmancyStoreObject,exports.SessionStorageManager=t.SessionStorageManager,exports.StoreError=t.StoreError,exports.createStorageManager=t.createStorageManager,exports.compareValues=e.compareValues,exports.createArrayContext=e.createArrayContext,exports.createCollectionSelector=e.createCollectionSelector,exports.createCompoundSelector=e.createCompoundSelector,exports.createContext=e.createContext,exports.createCountSelector=e.createCountSelector,exports.createEntriesSelector=e.createEntriesSelector,exports.createFilterSelector=e.createFilterSelector,exports.createFindSelector=e.createFindSelector,exports.createItemSelector=e.createItemSelector,exports.createItemsSelector=e.createItemsSelector,exports.createKeysSelector=e.createKeysSelector,exports.createMapSelector=e.createMapSelector,exports.createOptimizedSelector=e.createOptimizedSelector,exports.createSelector=e.createSelector,exports.createSortSelector=e.createSortSelector,exports.createTestArrayContext=e.createTestArrayContext,exports.filterArray=e.filterArray,exports.filterArrayItems=e.filterArrayItems,exports.filterMap=e.filterMap,exports.filterMapItems=e.filterMapItems,exports.getFieldValue=e.getFieldValue,exports.isArray=e.isArray,exports.isDate=e.isDate,exports.isIterable=e.isIterable,exports.isMap=e.isMap,exports.isNil=e.isNil,exports.isNumber=e.isNumber,exports.isPlainObject=e.isPlainObject,exports.isSet=e.isSet,exports.isString=e.isString,exports.select=e.select,exports.selectItem=e.selectItem,Object.defineProperty(exports,"SchmancySurface",{enumerable:!0,get:()=>d.SchmancySurface}),exports.SchmancySurfaceTypeContext=d.SchmancySurfaceTypeContext,Object.defineProperty(exports,"SchmancyDataTable",{enumerable:!0,get:()=>g.SchmancyDataTable}),Object.defineProperty(exports,"SchmancyTableRow",{enumerable:!0,get:()=>g.SchmancyTableRow}),Object.defineProperty(exports,"SchmancyThemeComponent",{enumerable:!0,get:()=>m.SchmancyThemeComponent}),exports.formateTheme=m.formateTheme,exports.tailwindStyles=m.tailwindStyles,exports.SchmancyTheme=q.SchmancyTheme,Object.defineProperty(exports,"SchmancyTooltip",{enumerable:!0,get:()=>w.SchmancyTooltip}),Object.defineProperty(exports,"SchmancyTree",{enumerable:!0,get:()=>T.SchmancyTree}),exports.SchmancyEvents=M.SchmancyEvents,Object.defineProperty(exports,"TypewriterElement",{enumerable:!0,get:()=>I.TypewriterElement}),Object.defineProperty(exports,"SchmancyTypography",{enumerable:!0,get:()=>N.SchmancyTypography}),exports.intersection$=x.intersection$,Object.defineProperty(exports,"SchmancyDropdown",{enumerable:!0,get:()=>s.SchmancyDropdown}),Object.defineProperty(exports,"SchmancyDropdownContent",{enumerable:!0,get:()=>s.SchmancyDropdownContent}),exports.$dialog=l.$dialog,Object.defineProperty(exports,"ConfirmDialog",{enumerable:!0,get:()=>l.ConfirmDialog}),exports.DialogService=l.DialogService;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./animated-text-CuzUjLrt.js";
|
|
2
2
|
import { F as C, H as D, b as d, S as g, a as w, r as b } from "./area.component-yPcYESCN.js";
|
|
3
3
|
import "./autocomplete-DzN6JlKD.js";
|
|
4
|
-
import { $ as T, H as u, S as I, f as N, c as A, g as v, d as R, e as E, h as F, a as H, b as B, j as $, l as L, m as O, n as k, k as G, o as Y, p as j, W as V, s as W, i as z, t as P } from "./teleport.component-
|
|
4
|
+
import { $ as T, H as u, S as I, f as N, c as A, g as v, d as R, e as E, h as F, a as H, b as B, j as $, l as L, m as O, n as k, k as G, o as Y, p as j, W as V, s as W, i as z, t as P } from "./teleport.component-CinfAHv5.js";
|
|
5
5
|
import "./spinner-DFyG-_vp.js";
|
|
6
6
|
import { S as K, a as q } from "./icon-button-D15DCKEh.js";
|
|
7
7
|
import { S as Q } from "./checkbox-CKwb-uFj.js";
|
|
@@ -43,8 +43,8 @@ import { SchmancyEvents as Ue } from "./types.js";
|
|
|
43
43
|
import { T as Ze } from "./typewriter-CEFN5I2Z.js";
|
|
44
44
|
import { S as er } from "./typography-DG3juvGV.js";
|
|
45
45
|
import { i as tr } from "./intersection-CJxzz8c-.js";
|
|
46
|
-
import { S as cr, a as sr } from "./dropdown-content-
|
|
47
|
-
import { $ as Sr, C as mr, D as ir } from "./dialog-service-
|
|
46
|
+
import { S as cr, a as sr } from "./dropdown-content-Ctq1JVzp.js";
|
|
47
|
+
import { $ as Sr, C as mr, D as ir } from "./dialog-service-BHRZUJ5M.js";
|
|
48
48
|
export {
|
|
49
49
|
Sr as $dialog,
|
|
50
50
|
T as $drawer,
|
package/dist/nav-drawer.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-DkrqLHFc.cjs");exports.$drawer=e.$drawer,Object.defineProperty(exports,"SchmancyDrawerAppbar",{enumerable:!0,get:()=>e.SchmancyDrawerAppbar}),exports.SchmancyDrawerNavbarMode=e.SchmancyDrawerNavbarMode,exports.SchmancyDrawerNavbarState=e.SchmancyDrawerNavbarState,Object.defineProperty(exports,"SchmancyNavigationDrawer",{enumerable:!0,get:()=>e.SchmancyNavigationDrawer}),Object.defineProperty(exports,"SchmancyNavigationDrawerContent",{enumerable:!0,get:()=>e.SchmancyNavigationDrawerContent}),Object.defineProperty(exports,"SchmancyNavigationDrawerSidebar",{enumerable:!0,get:()=>e.SchmancyNavigationDrawerSidebar}),exports.schmancyNavDrawer=e.schmancyNavDrawer;
|
|
2
2
|
//# sourceMappingURL=nav-drawer.cjs.map
|
package/dist/nav-drawer.js
CHANGED
package/dist/teleport.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-DkrqLHFc.cjs");exports.HereMorty=e.HereMorty,Object.defineProperty(exports,"SchmancyTeleportation",{enumerable:!0,get:()=>e.SchmancyTeleportation}),exports.WhereAreYouRicky=e.WhereAreYouRicky,exports.teleport=e.teleport;
|
|
2
2
|
//# sourceMappingURL=teleport.cjs.map
|