@webquark/core 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/cjs/dom-CTqgGpWA.js +238 -0
- package/dist/cjs/index-CLlvFbDw.js +1774 -0
- package/dist/cjs/index-DGQOjEwT.js +33 -0
- package/dist/cjs/index.cjs.js +7 -0
- package/dist/cjs/loader.cjs.js +12 -0
- package/dist/cjs/q-button_3.cjs.entry.js +603 -0
- package/dist/cjs/q-card.cjs.entry.js +55 -0
- package/dist/cjs/q-carousel.cjs.entry.js +288 -0
- package/dist/cjs/q-circular-progress_2.cjs.entry.js +255 -0
- package/dist/cjs/q-data-table.cjs.entry.js +197 -0
- package/dist/cjs/q-dialog.cjs.entry.js +143 -0
- package/dist/cjs/q-dropdown.cjs.entry.js +348 -0
- package/dist/cjs/q-icon.cjs.entry.js +184 -0
- package/dist/cjs/q-quantity-selector.cjs.entry.js +178 -0
- package/dist/cjs/q-reel.cjs.entry.js +117 -0
- package/dist/cjs/q-sidepanel.cjs.entry.js +215 -0
- package/dist/cjs/q-step-diagram-item.cjs.entry.js +48 -0
- package/dist/cjs/q-step-diagram.cjs.entry.js +47 -0
- package/dist/cjs/q-syntax-box.cjs.entry.js +457 -0
- package/dist/cjs/q-textarea.cjs.entry.js +136 -0
- package/dist/cjs/q-thumbnail.cjs.entry.js +44 -0
- package/dist/cjs/q-toggle.cjs.entry.js +148 -0
- package/dist/cjs/webquark.cjs.js +24 -0
- package/dist/collection/assets/icons/braces.svg +14 -0
- package/dist/collection/assets/icons/check.svg +1 -0
- package/dist/collection/assets/icons/chevron-down.svg +1 -0
- package/dist/collection/assets/icons/chevron-left.svg +1 -0
- package/dist/collection/assets/icons/chevron-right.svg +1 -0
- package/dist/collection/assets/icons/chevron-up.svg +1 -0
- package/dist/collection/assets/icons/copy.svg +4 -0
- package/dist/collection/assets/icons/eye-off.svg +1 -0
- package/dist/collection/assets/icons/eye.svg +1 -0
- package/dist/collection/assets/icons/minus.svg +1 -0
- package/dist/collection/assets/icons/play.svg +1 -0
- package/dist/collection/assets/icons/plus.svg +1 -0
- package/dist/collection/assets/icons/search.svg +1 -0
- package/dist/collection/assets/icons/spinner.svg +1 -0
- package/dist/collection/assets/icons/trash-2.svg +1 -0
- package/dist/collection/assets/icons/x.svg +1 -0
- package/dist/collection/collection-manifest.json +32 -0
- package/dist/collection/components/button/button.css +174 -0
- package/dist/collection/components/button/button.js +358 -0
- package/dist/collection/components/card/card.css +96 -0
- package/dist/collection/components/card/card.js +147 -0
- package/dist/collection/components/carousel/carousel.css +177 -0
- package/dist/collection/components/carousel/carousel.js +467 -0
- package/dist/collection/components/circular-progress/circular-progress.css +85 -0
- package/dist/collection/components/circular-progress/circular-progress.js +122 -0
- package/dist/collection/components/data-table/data-table.css +219 -0
- package/dist/collection/components/data-table/data-table.js +481 -0
- package/dist/collection/components/dialog/dialog.css +240 -0
- package/dist/collection/components/dialog/dialog.js +481 -0
- package/dist/collection/components/dropdown/dropdown.css +292 -0
- package/dist/collection/components/dropdown/dropdown.js +606 -0
- package/dist/collection/components/icon/icon.css +39 -0
- package/dist/collection/components/icon/icon.js +297 -0
- package/dist/collection/components/input/input.css +276 -0
- package/dist/collection/components/input/input.js +609 -0
- package/dist/collection/components/quantity-selector/quantity-selector.css +131 -0
- package/dist/collection/components/quantity-selector/quantity-selector.js +361 -0
- package/dist/collection/components/reel/reel.css +185 -0
- package/dist/collection/components/reel/reel.js +214 -0
- package/dist/collection/components/scrollable/scrollable.css +122 -0
- package/dist/collection/components/scrollable/scrollable.js +536 -0
- package/dist/collection/components/sidepanel/sidepanel.css +371 -0
- package/dist/collection/components/sidepanel/sidepanel.js +460 -0
- package/dist/collection/components/step-diagram/step-diagram.css +21 -0
- package/dist/collection/components/step-diagram/step-diagram.js +74 -0
- package/dist/collection/components/step-diagram-item/step-diagram-item.css +253 -0
- package/dist/collection/components/step-diagram-item/step-diagram-item.js +131 -0
- package/dist/collection/components/syntax-box/syntax-box.css +206 -0
- package/dist/collection/components/syntax-box/syntax-box.js +534 -0
- package/dist/collection/components/textarea/textarea.css +83 -0
- package/dist/collection/components/textarea/textarea.js +461 -0
- package/dist/collection/components/thumbnail/thumbnail.css +109 -0
- package/dist/collection/components/thumbnail/thumbnail.js +171 -0
- package/dist/collection/components/toggle/toggle.css +212 -0
- package/dist/collection/components/toggle/toggle.js +390 -0
- package/dist/collection/components/tooltip/tooltip.css +65 -0
- package/dist/collection/components/tooltip/tooltip.js +249 -0
- package/dist/collection/index.js +10 -0
- package/dist/collection/playground/components/playground-code-preview/playground-code-preview.js +48 -0
- package/dist/collection/playground/components/playground-event-log/playground-event-log.js +63 -0
- package/dist/collection/playground/components/playground-header/playground-header.js +65 -0
- package/dist/collection/playground/components/playground-sidebar/playground-sidebar.js +74 -0
- package/dist/collection/playground/components/properties-panel/properties-panel.js +146 -0
- package/dist/collection/playground/components/properties-panel/property-row.js +31 -0
- package/dist/collection/playground/components/properties-panel/slot-row.js +27 -0
- package/dist/collection/playground/components/sandbox-viewport/sandbox-panel.js +334 -0
- package/dist/collection/playground/components/sandbox-viewport/sandbox-viewport.js +155 -0
- package/dist/collection/playground/components/sandbox-viewport/variant-card.js +86 -0
- package/dist/collection/playground/components/sandbox-viewport/viewport-tabs.js +39 -0
- package/dist/collection/playground/components/theme-designer/theme-designer.js +89 -0
- package/dist/collection/playground/components/theme-designer/token-row.js +70 -0
- package/dist/collection/playground/components/theme-designer/token-section.js +19 -0
- package/dist/collection/playground/dom-factory.js +76 -0
- package/dist/collection/playground/events.js +37 -0
- package/dist/collection/playground/logo.svg +8 -0
- package/dist/collection/playground/playground.bundled.js +2831 -0
- package/dist/collection/playground/playground.js +10 -0
- package/dist/collection/playground/state.js +158 -0
- package/dist/collection/playground/utils/color.js +26 -0
- package/dist/collection/playground/utils/dom.js +38 -0
- package/dist/collection/playground/utils/index.js +2 -0
- package/dist/collection/playground/views/q-button-view/q-button-view.js +6 -0
- package/dist/collection/playground/views/q-input-view/q-input-view.js +6 -0
- package/dist/collection/utils/dom.js +228 -0
- package/dist/collection/utils/formatter.js +177 -0
- package/dist/collection/utils/formatter.unit.test.js +53 -0
- package/dist/collection/utils/math.js +19 -0
- package/dist/collection/utils/syntax.js +110 -0
- package/dist/collection/utils/utils.js +28 -0
- package/dist/collection/utils/utils.unit.test.js +16 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/p-91lJS0-v.js +1 -0
- package/dist/components/p-B7e76DLW.js +1 -0
- package/dist/components/p-BCSpNDGG.js +1 -0
- package/dist/components/p-BRNv11Jn.js +1 -0
- package/dist/components/p-CYfD9z8O.js +1 -0
- package/dist/components/p-DfTW9B7V.js +1 -0
- package/dist/components/p-DgaKWrjd.js +1 -0
- package/dist/components/p-DoQvrOHk.js +1 -0
- package/dist/components/q-button.d.ts +11 -0
- package/dist/components/q-button.js +1 -0
- package/dist/components/q-card.d.ts +11 -0
- package/dist/components/q-card.js +1 -0
- package/dist/components/q-carousel.d.ts +11 -0
- package/dist/components/q-carousel.js +1 -0
- package/dist/components/q-circular-progress.d.ts +11 -0
- package/dist/components/q-circular-progress.js +1 -0
- package/dist/components/q-data-table.d.ts +11 -0
- package/dist/components/q-data-table.js +1 -0
- package/dist/components/q-dialog.d.ts +11 -0
- package/dist/components/q-dialog.js +1 -0
- package/dist/components/q-dropdown.d.ts +11 -0
- package/dist/components/q-dropdown.js +1 -0
- package/dist/components/q-icon.d.ts +11 -0
- package/dist/components/q-icon.js +1 -0
- package/dist/components/q-input.d.ts +11 -0
- package/dist/components/q-input.js +1 -0
- package/dist/components/q-quantity-selector.d.ts +11 -0
- package/dist/components/q-quantity-selector.js +1 -0
- package/dist/components/q-reel.d.ts +11 -0
- package/dist/components/q-reel.js +1 -0
- package/dist/components/q-scrollable.d.ts +11 -0
- package/dist/components/q-scrollable.js +1 -0
- package/dist/components/q-sidepanel.d.ts +11 -0
- package/dist/components/q-sidepanel.js +1 -0
- package/dist/components/q-step-diagram-item.d.ts +11 -0
- package/dist/components/q-step-diagram-item.js +1 -0
- package/dist/components/q-step-diagram.d.ts +11 -0
- package/dist/components/q-step-diagram.js +1 -0
- package/dist/components/q-syntax-box.d.ts +11 -0
- package/dist/components/q-syntax-box.js +1 -0
- package/dist/components/q-textarea.d.ts +11 -0
- package/dist/components/q-textarea.js +1 -0
- package/dist/components/q-thumbnail.d.ts +11 -0
- package/dist/components/q-thumbnail.js +1 -0
- package/dist/components/q-toggle.d.ts +11 -0
- package/dist/components/q-toggle.js +1 -0
- package/dist/components/q-tooltip.d.ts +11 -0
- package/dist/components/q-tooltip.js +1 -0
- package/dist/esm/dom-DoQvrOHk.js +230 -0
- package/dist/esm/index-BJiYCN3i.js +30 -0
- package/dist/esm/index-CYoQ4Zv3.js +1764 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +10 -0
- package/dist/esm/q-button_3.entry.js +599 -0
- package/dist/esm/q-card.entry.js +53 -0
- package/dist/esm/q-carousel.entry.js +286 -0
- package/dist/esm/q-circular-progress_2.entry.js +252 -0
- package/dist/esm/q-data-table.entry.js +195 -0
- package/dist/esm/q-dialog.entry.js +141 -0
- package/dist/esm/q-dropdown.entry.js +346 -0
- package/dist/esm/q-icon.entry.js +182 -0
- package/dist/esm/q-quantity-selector.entry.js +176 -0
- package/dist/esm/q-reel.entry.js +115 -0
- package/dist/esm/q-sidepanel.entry.js +213 -0
- package/dist/esm/q-step-diagram-item.entry.js +46 -0
- package/dist/esm/q-step-diagram.entry.js +45 -0
- package/dist/esm/q-syntax-box.entry.js +455 -0
- package/dist/esm/q-textarea.entry.js +134 -0
- package/dist/esm/q-thumbnail.entry.js +42 -0
- package/dist/esm/q-toggle.entry.js +146 -0
- package/dist/esm/webquark.js +20 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/loader/cdn.js +1 -0
- package/dist/loader/index.cjs.js +1 -0
- package/dist/loader/index.d.ts +24 -0
- package/dist/loader/index.es2017.js +1 -0
- package/dist/loader/index.js +2 -0
- package/dist/playground/assets/icons/braces.svg +14 -0
- package/dist/playground/assets/icons/check.svg +1 -0
- package/dist/playground/assets/icons/chevron-down.svg +1 -0
- package/dist/playground/assets/icons/chevron-left.svg +1 -0
- package/dist/playground/assets/icons/chevron-right.svg +1 -0
- package/dist/playground/assets/icons/chevron-up.svg +1 -0
- package/dist/playground/assets/icons/copy.svg +4 -0
- package/dist/playground/assets/icons/eye-off.svg +1 -0
- package/dist/playground/assets/icons/eye.svg +1 -0
- package/dist/playground/assets/icons/minus.svg +1 -0
- package/dist/playground/assets/icons/play.svg +1 -0
- package/dist/playground/assets/icons/plus.svg +1 -0
- package/dist/playground/assets/icons/search.svg +1 -0
- package/dist/playground/assets/icons/spinner.svg +1 -0
- package/dist/playground/assets/icons/trash-2.svg +1 -0
- package/dist/playground/assets/icons/x.svg +1 -0
- package/dist/playground/build/index.esm.js +1 -0
- package/dist/playground/build/p-095635d3.entry.js +1 -0
- package/dist/playground/build/p-1238a2cc.entry.js +1 -0
- package/dist/playground/build/p-389e2cd3.entry.js +1 -0
- package/dist/playground/build/p-4f133a25.entry.js +1 -0
- package/dist/playground/build/p-5c67a28e.entry.js +1 -0
- package/dist/playground/build/p-679fa494.entry.js +1 -0
- package/dist/playground/build/p-6dc7b987.entry.js +1 -0
- package/dist/playground/build/p-7083c5ff.entry.js +1 -0
- package/dist/playground/build/p-7f47861b.entry.js +1 -0
- package/dist/playground/build/p-8a94a0a2.entry.js +1 -0
- package/dist/playground/build/p-9afa3fe8.entry.js +1 -0
- package/dist/playground/build/p-9bb8ed97.entry.js +1 -0
- package/dist/playground/build/p-BJiYCN3i.js +1 -0
- package/dist/playground/build/p-CYoQ4Zv3.js +2 -0
- package/dist/playground/build/p-DoQvrOHk.js +1 -0
- package/dist/playground/build/p-aa9be919.entry.js +1 -0
- package/dist/playground/build/p-b1e68119.entry.js +1 -0
- package/dist/playground/build/p-c8d6af8e.entry.js +1 -0
- package/dist/playground/build/p-f48dd3dd.entry.js +1 -0
- package/dist/playground/build/p-f7b5b155.entry.js +1 -0
- package/dist/playground/build/webquark.css +1 -0
- package/dist/playground/build/webquark.esm.js +1 -0
- package/dist/playground/build/webquark.js +33 -0
- package/dist/playground/css/base.css +145 -0
- package/dist/playground/host.config.json +15 -0
- package/dist/playground/index.html +29 -0
- package/dist/playground/logo.svg +8 -0
- package/dist/playground/playground/components.manifest.json +20 -0
- package/dist/playground/playground/specs/q-button.sandbox.json +198 -0
- package/dist/playground/playground/specs/q-card.sandbox.json +144 -0
- package/dist/playground/playground/specs/q-carousel.sandbox.json +120 -0
- package/dist/playground/playground/specs/q-circular-progress.sandbox.json +91 -0
- package/dist/playground/playground/specs/q-data-table.sandbox.json +108 -0
- package/dist/playground/playground/specs/q-dialog.sandbox.json +108 -0
- package/dist/playground/playground/specs/q-dropdown.sandbox.json +116 -0
- package/dist/playground/playground/specs/q-icon.sandbox.json +138 -0
- package/dist/playground/playground/specs/q-input.sandbox.json +192 -0
- package/dist/playground/playground/specs/q-quantity-selector.sandbox.json +99 -0
- package/dist/playground/playground/specs/q-reel.sandbox.json +70 -0
- package/dist/playground/playground/specs/q-scrollable.sandbox.json +102 -0
- package/dist/playground/playground/specs/q-sidepanel.sandbox.json +147 -0
- package/dist/playground/playground/specs/q-step-diagram.sandbox.json +56 -0
- package/dist/playground/playground/specs/q-syntax-box.sandbox.json +160 -0
- package/dist/playground/playground/specs/q-textarea.sandbox.json +133 -0
- package/dist/playground/playground/specs/q-toggle.sandbox.json +196 -0
- package/dist/playground/playground/specs/q-tooltip.sandbox.json +65 -0
- package/dist/playground/playground.css +1 -0
- package/dist/playground/playground.js +2831 -0
- package/dist/playground/views/q-button-view/q-button-view.css +1 -0
- package/dist/playground/views/q-button-view/q-button-view.html +1 -0
- package/dist/playground/views/q-button-view/q-button-view.js +6 -0
- package/dist/playground/views/q-input-view/q-input-view.css +1 -0
- package/dist/playground/views/q-input-view/q-input-view.html +1 -0
- package/dist/playground/views/q-input-view/q-input-view.js +6 -0
- package/dist/types/components/button/button.d.ts +26 -0
- package/dist/types/components/card/card.d.ts +12 -0
- package/dist/types/components/carousel/carousel.d.ts +44 -0
- package/dist/types/components/circular-progress/circular-progress.d.ts +7 -0
- package/dist/types/components/data-table/data-table.d.ts +45 -0
- package/dist/types/components/dialog/dialog.d.ts +35 -0
- package/dist/types/components/dropdown/dropdown.d.ts +49 -0
- package/dist/types/components/icon/icon.d.ts +33 -0
- package/dist/types/components/input/input.d.ts +43 -0
- package/dist/types/components/quantity-selector/quantity-selector.d.ts +31 -0
- package/dist/types/components/reel/reel.d.ts +23 -0
- package/dist/types/components/scrollable/scrollable.d.ts +47 -0
- package/dist/types/components/sidepanel/sidepanel.d.ts +58 -0
- package/dist/types/components/step-diagram/step-diagram.d.ts +10 -0
- package/dist/types/components/step-diagram-item/step-diagram-item.d.ts +12 -0
- package/dist/types/components/syntax-box/syntax-box.d.ts +37 -0
- package/dist/types/components/textarea/textarea.d.ts +36 -0
- package/dist/types/components/thumbnail/thumbnail.d.ts +18 -0
- package/dist/types/components/toggle/toggle.d.ts +36 -0
- package/dist/types/components/tooltip/tooltip.d.ts +29 -0
- package/dist/types/components.d.ts +1752 -0
- package/dist/types/declarations.d.ts +9 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/playground/components/playground-code-preview/playground-code-preview.d.ts +9 -0
- package/dist/types/playground/components/playground-event-log/playground-event-log.d.ts +11 -0
- package/dist/types/playground/components/playground-header/playground-header.d.ts +10 -0
- package/dist/types/playground/components/playground-sidebar/playground-sidebar.d.ts +11 -0
- package/dist/types/playground/components/properties-panel/properties-panel.d.ts +15 -0
- package/dist/types/playground/components/properties-panel/property-row.d.ts +6 -0
- package/dist/types/playground/components/properties-panel/slot-row.d.ts +7 -0
- package/dist/types/playground/components/sandbox-viewport/sandbox-panel.d.ts +15 -0
- package/dist/types/playground/components/sandbox-viewport/sandbox-viewport.d.ts +14 -0
- package/dist/types/playground/components/sandbox-viewport/variant-card.d.ts +7 -0
- package/dist/types/playground/components/sandbox-viewport/viewport-tabs.d.ts +5 -0
- package/dist/types/playground/components/theme-designer/theme-designer.d.ts +15 -0
- package/dist/types/playground/components/theme-designer/token-row.d.ts +13 -0
- package/dist/types/playground/components/theme-designer/token-section.d.ts +7 -0
- package/dist/types/playground/dom-factory.d.ts +12 -0
- package/dist/types/playground/events.d.ts +24 -0
- package/dist/types/playground/playground.d.ts +7 -0
- package/dist/types/playground/state.d.ts +44 -0
- package/dist/types/playground/utils/color.d.ts +8 -0
- package/dist/types/playground/utils/dom.d.ts +15 -0
- package/dist/types/playground/utils/index.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +1861 -0
- package/dist/types/utils/dom.d.ts +68 -0
- package/dist/types/utils/formatter.d.ts +24 -0
- package/dist/types/utils/formatter.unit.test.d.ts +1 -0
- package/dist/types/utils/math.d.ts +10 -0
- package/dist/types/utils/syntax.d.ts +9 -0
- package/dist/types/utils/utils.d.ts +11 -0
- package/dist/types/utils/utils.unit.test.d.ts +1 -0
- package/dist/webquark/index.esm.js +1 -0
- package/dist/webquark/p-095635d3.entry.js +1 -0
- package/dist/webquark/p-1238a2cc.entry.js +1 -0
- package/dist/webquark/p-389e2cd3.entry.js +1 -0
- package/dist/webquark/p-4f133a25.entry.js +1 -0
- package/dist/webquark/p-5c67a28e.entry.js +1 -0
- package/dist/webquark/p-679fa494.entry.js +1 -0
- package/dist/webquark/p-6dc7b987.entry.js +1 -0
- package/dist/webquark/p-7083c5ff.entry.js +1 -0
- package/dist/webquark/p-7f47861b.entry.js +1 -0
- package/dist/webquark/p-8a94a0a2.entry.js +1 -0
- package/dist/webquark/p-9afa3fe8.entry.js +1 -0
- package/dist/webquark/p-9bb8ed97.entry.js +1 -0
- package/dist/webquark/p-BJiYCN3i.js +1 -0
- package/dist/webquark/p-CYoQ4Zv3.js +2 -0
- package/dist/webquark/p-DoQvrOHk.js +1 -0
- package/dist/webquark/p-aa9be919.entry.js +1 -0
- package/dist/webquark/p-b1e68119.entry.js +1 -0
- package/dist/webquark/p-c8d6af8e.entry.js +1 -0
- package/dist/webquark/p-f48dd3dd.entry.js +1 -0
- package/dist/webquark/p-f7b5b155.entry.js +1 -0
- package/dist/webquark/webquark.css +1 -0
- package/dist/webquark/webquark.esm.js +1 -0
- package/package.json +84 -0
- package/readme.md +79 -0
- package/scripts/webquark-serve.js +79 -0
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { handleTabTrap, waitForTransitionEnd, focusFirstElement, safeFocus } from "../../utils/dom";
|
|
3
|
+
export class QDialog {
|
|
4
|
+
// ======== [1] STENCIL API (Props, Events, AttachInternals, Elements) =========
|
|
5
|
+
el;
|
|
6
|
+
open = false;
|
|
7
|
+
dialogTitle;
|
|
8
|
+
message;
|
|
9
|
+
closeOnEsc = true;
|
|
10
|
+
closeOnOverlayClick = true;
|
|
11
|
+
loading = false;
|
|
12
|
+
confirmLabel = 'Confirm';
|
|
13
|
+
cancelLabel = 'Cancel';
|
|
14
|
+
showCancel = true;
|
|
15
|
+
showConfirm = true;
|
|
16
|
+
qConfirm;
|
|
17
|
+
qCancel;
|
|
18
|
+
qClose;
|
|
19
|
+
isVisible = false;
|
|
20
|
+
isAnimatedOpen = false;
|
|
21
|
+
dialogEl;
|
|
22
|
+
// ========================= [2] INTERNAL STATE & REFS =========================
|
|
23
|
+
previousActiveElement = null;
|
|
24
|
+
// ========================= [3] LIFECYCLE & WATCHERS ==========================
|
|
25
|
+
componentWillLoad() {
|
|
26
|
+
this.isVisible = this.open;
|
|
27
|
+
this.isAnimatedOpen = this.open;
|
|
28
|
+
}
|
|
29
|
+
componentDidLoad() {
|
|
30
|
+
if (this.open) {
|
|
31
|
+
focusFirstElement(this.dialogEl);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
handleOpenChange(isOpen) {
|
|
35
|
+
if (isOpen) {
|
|
36
|
+
this.previousActiveElement = document.activeElement;
|
|
37
|
+
this.isVisible = true;
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
this.isAnimatedOpen = true;
|
|
40
|
+
if (this.dialogEl) {
|
|
41
|
+
waitForTransitionEnd(this.dialogEl, () => {
|
|
42
|
+
focusFirstElement(this.dialogEl);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}, 50);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.isAnimatedOpen = false;
|
|
49
|
+
if (this.dialogEl) {
|
|
50
|
+
waitForTransitionEnd(this.dialogEl, () => {
|
|
51
|
+
this.isVisible = false;
|
|
52
|
+
safeFocus(this.previousActiveElement);
|
|
53
|
+
this.previousActiveElement = null;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.isVisible = false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// ============================ [4] EXPOSED METHODS ============================
|
|
62
|
+
async show() {
|
|
63
|
+
this.open = true;
|
|
64
|
+
}
|
|
65
|
+
async close() {
|
|
66
|
+
this.open = false;
|
|
67
|
+
this.qClose.emit();
|
|
68
|
+
}
|
|
69
|
+
async confirm() {
|
|
70
|
+
if (this.loading)
|
|
71
|
+
return;
|
|
72
|
+
this.handleConfirm();
|
|
73
|
+
}
|
|
74
|
+
async cancel() {
|
|
75
|
+
if (this.loading)
|
|
76
|
+
return;
|
|
77
|
+
this.handleCancel();
|
|
78
|
+
}
|
|
79
|
+
// =================== [5] EVENT HANDLERS & INTERNAL METHODS ===================
|
|
80
|
+
handleGlobalKeyDown(event) {
|
|
81
|
+
if (this.open && event.key === 'Escape' && this.closeOnEsc) {
|
|
82
|
+
this.handleCancel();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
handleKeyDown = (e) => {
|
|
86
|
+
if (e.key === 'Tab' && this.open && this.dialogEl) {
|
|
87
|
+
handleTabTrap(e, this.dialogEl);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
handleBackdropClick = () => {
|
|
91
|
+
if (this.closeOnOverlayClick && !this.loading) {
|
|
92
|
+
this.handleCancel();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
handleConfirm = () => {
|
|
96
|
+
if (this.loading)
|
|
97
|
+
return;
|
|
98
|
+
this.qConfirm.emit();
|
|
99
|
+
this.open = false;
|
|
100
|
+
this.qClose.emit();
|
|
101
|
+
};
|
|
102
|
+
handleCancel = () => {
|
|
103
|
+
if (this.loading)
|
|
104
|
+
return;
|
|
105
|
+
this.qCancel.emit();
|
|
106
|
+
this.open = false;
|
|
107
|
+
this.qClose.emit();
|
|
108
|
+
};
|
|
109
|
+
handleCloseButton = () => {
|
|
110
|
+
if (this.loading)
|
|
111
|
+
return;
|
|
112
|
+
this.open = false;
|
|
113
|
+
this.qClose.emit();
|
|
114
|
+
};
|
|
115
|
+
// ===================== [6] RENDER (Visual Template Only) =====================
|
|
116
|
+
render() {
|
|
117
|
+
const titleText = this.dialogTitle;
|
|
118
|
+
const classes = {
|
|
119
|
+
'dialog-wrapper': true,
|
|
120
|
+
'is-open': this.isAnimatedOpen,
|
|
121
|
+
'is-visible': this.isVisible,
|
|
122
|
+
};
|
|
123
|
+
return (h("div", { key: 'faa25638a0e67ce8e6db3e4cdd771848f1d6c065', class: classes, onKeyDown: this.handleKeyDown, inert: !this.open ? true : undefined }, h("div", { key: 'cd966a6287e76c7d73e6617c6bb23713a8e096ad', class: "dialog-backdrop", onClick: this.handleBackdropClick, part: "backdrop" }), h("div", { key: 'db9f6bb765dadedf5d68b8263b900c5769915157', ref: el => (this.dialogEl = el), class: "dialog-modal", part: "modal", role: "dialog", "aria-modal": "true", "aria-hidden": this.open ? 'false' : 'true', tabindex: "-1" }, h("header", { key: '3defaf7f32bc95870a50c1022cbf7d3c82cd708a', class: "dialog-header", part: "header" }, h("slot", { key: '54ca55624115965f3d4a14e5966aec40d0aeba4c', name: "header" }, titleText && h("h2", { key: 'e0ab2a95da072d382a0240e7822dffd1c3646063', class: "dialog-title" }, titleText)), h("button", { key: '2ccdc25e9e63ee86921702bea740525dce6df4b7', class: "dialog-close-btn", onClick: this.handleCloseButton, "aria-label": "Close dialog", disabled: this.loading, part: "close-btn" }, h("svg", { key: '47ecbba13fbafb95a631387c97ec2b06c14dccf1', class: "close-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("line", { key: '1aa7172f6ee838d7fe7914cd1d6ab6f24f6f862b', x1: "18", y1: "6", x2: "6", y2: "18" }), h("line", { key: 'b3e5e4f527b12e0e0c8ba9f5ea7a9dc0a925769d', x1: "6", y1: "6", x2: "18", y2: "18" })))), h("div", { key: '58f5e99edc8e9903bb5afc537fb908e73fd02443', class: "dialog-body", part: "body" }, h("slot", { key: '30cf8d109e64291fe417781a6f3f001df2f7cb13' }, this.message && h("p", { key: '71a75cfe855bf4ccb29a898870a532a871fe2560', class: "dialog-message" }, this.message))), h("footer", { key: 'f9030a7fb3ca7760aa86d06dbf60e3d16c336a55', class: "dialog-footer", part: "footer" }, h("slot", { key: 'a2a48f6d0841b64cf6c950fcec1a23ad6eefcb5d', name: "footer" }, h("div", { key: '36e81f9c64c2883e2d78c69fd323c3ed83b6d183', class: "dialog-actions" }, this.showCancel && (h("button", { key: '891fedffa200be88e0c42a5f6e8ae7373ed58f55', class: "btn-cancel", onClick: this.handleCancel, disabled: this.loading, part: "cancel-btn" }, this.cancelLabel)), this.showConfirm && (h("button", { key: 'f5006f97cac3539e464e3aefa04c5698f99da023', class: "btn-confirm", onClick: this.handleConfirm, disabled: this.loading, "aria-busy": this.loading ? 'true' : 'false', part: "confirm-btn" }, this.loading && h("span", { key: 'f6633f17fc56cd2d64cf2b936a63293de0b0d18f', class: "spinner-el" }), h("span", { key: '2f91a411decc749c55d360cdb0e1e833b61cdb89', class: "btn-label" }, this.confirmLabel)))))))));
|
|
124
|
+
}
|
|
125
|
+
static get is() { return "q-dialog"; }
|
|
126
|
+
static get encapsulation() { return "shadow"; }
|
|
127
|
+
static get originalStyleUrls() {
|
|
128
|
+
return {
|
|
129
|
+
"$": ["dialog.css"]
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
static get styleUrls() {
|
|
133
|
+
return {
|
|
134
|
+
"$": ["dialog.css"]
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
static get properties() {
|
|
138
|
+
return {
|
|
139
|
+
"open": {
|
|
140
|
+
"type": "boolean",
|
|
141
|
+
"mutable": true,
|
|
142
|
+
"complexType": {
|
|
143
|
+
"original": "boolean",
|
|
144
|
+
"resolved": "boolean",
|
|
145
|
+
"references": {}
|
|
146
|
+
},
|
|
147
|
+
"required": false,
|
|
148
|
+
"optional": false,
|
|
149
|
+
"docs": {
|
|
150
|
+
"tags": [],
|
|
151
|
+
"text": ""
|
|
152
|
+
},
|
|
153
|
+
"getter": false,
|
|
154
|
+
"setter": false,
|
|
155
|
+
"reflect": true,
|
|
156
|
+
"attribute": "open",
|
|
157
|
+
"defaultValue": "false"
|
|
158
|
+
},
|
|
159
|
+
"dialogTitle": {
|
|
160
|
+
"type": "string",
|
|
161
|
+
"mutable": false,
|
|
162
|
+
"complexType": {
|
|
163
|
+
"original": "string",
|
|
164
|
+
"resolved": "string",
|
|
165
|
+
"references": {}
|
|
166
|
+
},
|
|
167
|
+
"required": false,
|
|
168
|
+
"optional": true,
|
|
169
|
+
"docs": {
|
|
170
|
+
"tags": [],
|
|
171
|
+
"text": ""
|
|
172
|
+
},
|
|
173
|
+
"getter": false,
|
|
174
|
+
"setter": false,
|
|
175
|
+
"reflect": false,
|
|
176
|
+
"attribute": "dialog-title"
|
|
177
|
+
},
|
|
178
|
+
"message": {
|
|
179
|
+
"type": "string",
|
|
180
|
+
"mutable": false,
|
|
181
|
+
"complexType": {
|
|
182
|
+
"original": "string",
|
|
183
|
+
"resolved": "string",
|
|
184
|
+
"references": {}
|
|
185
|
+
},
|
|
186
|
+
"required": false,
|
|
187
|
+
"optional": true,
|
|
188
|
+
"docs": {
|
|
189
|
+
"tags": [],
|
|
190
|
+
"text": ""
|
|
191
|
+
},
|
|
192
|
+
"getter": false,
|
|
193
|
+
"setter": false,
|
|
194
|
+
"reflect": false,
|
|
195
|
+
"attribute": "message"
|
|
196
|
+
},
|
|
197
|
+
"closeOnEsc": {
|
|
198
|
+
"type": "boolean",
|
|
199
|
+
"mutable": false,
|
|
200
|
+
"complexType": {
|
|
201
|
+
"original": "boolean",
|
|
202
|
+
"resolved": "boolean",
|
|
203
|
+
"references": {}
|
|
204
|
+
},
|
|
205
|
+
"required": false,
|
|
206
|
+
"optional": false,
|
|
207
|
+
"docs": {
|
|
208
|
+
"tags": [],
|
|
209
|
+
"text": ""
|
|
210
|
+
},
|
|
211
|
+
"getter": false,
|
|
212
|
+
"setter": false,
|
|
213
|
+
"reflect": false,
|
|
214
|
+
"attribute": "close-on-esc",
|
|
215
|
+
"defaultValue": "true"
|
|
216
|
+
},
|
|
217
|
+
"closeOnOverlayClick": {
|
|
218
|
+
"type": "boolean",
|
|
219
|
+
"mutable": false,
|
|
220
|
+
"complexType": {
|
|
221
|
+
"original": "boolean",
|
|
222
|
+
"resolved": "boolean",
|
|
223
|
+
"references": {}
|
|
224
|
+
},
|
|
225
|
+
"required": false,
|
|
226
|
+
"optional": false,
|
|
227
|
+
"docs": {
|
|
228
|
+
"tags": [],
|
|
229
|
+
"text": ""
|
|
230
|
+
},
|
|
231
|
+
"getter": false,
|
|
232
|
+
"setter": false,
|
|
233
|
+
"reflect": false,
|
|
234
|
+
"attribute": "close-on-overlay-click",
|
|
235
|
+
"defaultValue": "true"
|
|
236
|
+
},
|
|
237
|
+
"loading": {
|
|
238
|
+
"type": "boolean",
|
|
239
|
+
"mutable": false,
|
|
240
|
+
"complexType": {
|
|
241
|
+
"original": "boolean",
|
|
242
|
+
"resolved": "boolean",
|
|
243
|
+
"references": {}
|
|
244
|
+
},
|
|
245
|
+
"required": false,
|
|
246
|
+
"optional": false,
|
|
247
|
+
"docs": {
|
|
248
|
+
"tags": [],
|
|
249
|
+
"text": ""
|
|
250
|
+
},
|
|
251
|
+
"getter": false,
|
|
252
|
+
"setter": false,
|
|
253
|
+
"reflect": false,
|
|
254
|
+
"attribute": "loading",
|
|
255
|
+
"defaultValue": "false"
|
|
256
|
+
},
|
|
257
|
+
"confirmLabel": {
|
|
258
|
+
"type": "string",
|
|
259
|
+
"mutable": false,
|
|
260
|
+
"complexType": {
|
|
261
|
+
"original": "string",
|
|
262
|
+
"resolved": "string",
|
|
263
|
+
"references": {}
|
|
264
|
+
},
|
|
265
|
+
"required": false,
|
|
266
|
+
"optional": false,
|
|
267
|
+
"docs": {
|
|
268
|
+
"tags": [],
|
|
269
|
+
"text": ""
|
|
270
|
+
},
|
|
271
|
+
"getter": false,
|
|
272
|
+
"setter": false,
|
|
273
|
+
"reflect": false,
|
|
274
|
+
"attribute": "confirm-label",
|
|
275
|
+
"defaultValue": "'Confirm'"
|
|
276
|
+
},
|
|
277
|
+
"cancelLabel": {
|
|
278
|
+
"type": "string",
|
|
279
|
+
"mutable": false,
|
|
280
|
+
"complexType": {
|
|
281
|
+
"original": "string",
|
|
282
|
+
"resolved": "string",
|
|
283
|
+
"references": {}
|
|
284
|
+
},
|
|
285
|
+
"required": false,
|
|
286
|
+
"optional": false,
|
|
287
|
+
"docs": {
|
|
288
|
+
"tags": [],
|
|
289
|
+
"text": ""
|
|
290
|
+
},
|
|
291
|
+
"getter": false,
|
|
292
|
+
"setter": false,
|
|
293
|
+
"reflect": false,
|
|
294
|
+
"attribute": "cancel-label",
|
|
295
|
+
"defaultValue": "'Cancel'"
|
|
296
|
+
},
|
|
297
|
+
"showCancel": {
|
|
298
|
+
"type": "boolean",
|
|
299
|
+
"mutable": false,
|
|
300
|
+
"complexType": {
|
|
301
|
+
"original": "boolean",
|
|
302
|
+
"resolved": "boolean",
|
|
303
|
+
"references": {}
|
|
304
|
+
},
|
|
305
|
+
"required": false,
|
|
306
|
+
"optional": false,
|
|
307
|
+
"docs": {
|
|
308
|
+
"tags": [],
|
|
309
|
+
"text": ""
|
|
310
|
+
},
|
|
311
|
+
"getter": false,
|
|
312
|
+
"setter": false,
|
|
313
|
+
"reflect": false,
|
|
314
|
+
"attribute": "show-cancel",
|
|
315
|
+
"defaultValue": "true"
|
|
316
|
+
},
|
|
317
|
+
"showConfirm": {
|
|
318
|
+
"type": "boolean",
|
|
319
|
+
"mutable": false,
|
|
320
|
+
"complexType": {
|
|
321
|
+
"original": "boolean",
|
|
322
|
+
"resolved": "boolean",
|
|
323
|
+
"references": {}
|
|
324
|
+
},
|
|
325
|
+
"required": false,
|
|
326
|
+
"optional": false,
|
|
327
|
+
"docs": {
|
|
328
|
+
"tags": [],
|
|
329
|
+
"text": ""
|
|
330
|
+
},
|
|
331
|
+
"getter": false,
|
|
332
|
+
"setter": false,
|
|
333
|
+
"reflect": false,
|
|
334
|
+
"attribute": "show-confirm",
|
|
335
|
+
"defaultValue": "true"
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
static get states() {
|
|
340
|
+
return {
|
|
341
|
+
"isVisible": {},
|
|
342
|
+
"isAnimatedOpen": {}
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
static get events() {
|
|
346
|
+
return [{
|
|
347
|
+
"method": "qConfirm",
|
|
348
|
+
"name": "qConfirm",
|
|
349
|
+
"bubbles": true,
|
|
350
|
+
"cancelable": true,
|
|
351
|
+
"composed": true,
|
|
352
|
+
"docs": {
|
|
353
|
+
"tags": [],
|
|
354
|
+
"text": ""
|
|
355
|
+
},
|
|
356
|
+
"complexType": {
|
|
357
|
+
"original": "void",
|
|
358
|
+
"resolved": "void",
|
|
359
|
+
"references": {}
|
|
360
|
+
}
|
|
361
|
+
}, {
|
|
362
|
+
"method": "qCancel",
|
|
363
|
+
"name": "qCancel",
|
|
364
|
+
"bubbles": true,
|
|
365
|
+
"cancelable": true,
|
|
366
|
+
"composed": true,
|
|
367
|
+
"docs": {
|
|
368
|
+
"tags": [],
|
|
369
|
+
"text": ""
|
|
370
|
+
},
|
|
371
|
+
"complexType": {
|
|
372
|
+
"original": "void",
|
|
373
|
+
"resolved": "void",
|
|
374
|
+
"references": {}
|
|
375
|
+
}
|
|
376
|
+
}, {
|
|
377
|
+
"method": "qClose",
|
|
378
|
+
"name": "qClose",
|
|
379
|
+
"bubbles": true,
|
|
380
|
+
"cancelable": true,
|
|
381
|
+
"composed": true,
|
|
382
|
+
"docs": {
|
|
383
|
+
"tags": [],
|
|
384
|
+
"text": ""
|
|
385
|
+
},
|
|
386
|
+
"complexType": {
|
|
387
|
+
"original": "void",
|
|
388
|
+
"resolved": "void",
|
|
389
|
+
"references": {}
|
|
390
|
+
}
|
|
391
|
+
}];
|
|
392
|
+
}
|
|
393
|
+
static get methods() {
|
|
394
|
+
return {
|
|
395
|
+
"show": {
|
|
396
|
+
"complexType": {
|
|
397
|
+
"signature": "() => Promise<void>",
|
|
398
|
+
"parameters": [],
|
|
399
|
+
"references": {
|
|
400
|
+
"Promise": {
|
|
401
|
+
"location": "global",
|
|
402
|
+
"id": "global::Promise"
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
"return": "Promise<void>"
|
|
406
|
+
},
|
|
407
|
+
"docs": {
|
|
408
|
+
"text": "",
|
|
409
|
+
"tags": []
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
"close": {
|
|
413
|
+
"complexType": {
|
|
414
|
+
"signature": "() => Promise<void>",
|
|
415
|
+
"parameters": [],
|
|
416
|
+
"references": {
|
|
417
|
+
"Promise": {
|
|
418
|
+
"location": "global",
|
|
419
|
+
"id": "global::Promise"
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
"return": "Promise<void>"
|
|
423
|
+
},
|
|
424
|
+
"docs": {
|
|
425
|
+
"text": "",
|
|
426
|
+
"tags": []
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
"confirm": {
|
|
430
|
+
"complexType": {
|
|
431
|
+
"signature": "() => Promise<void>",
|
|
432
|
+
"parameters": [],
|
|
433
|
+
"references": {
|
|
434
|
+
"Promise": {
|
|
435
|
+
"location": "global",
|
|
436
|
+
"id": "global::Promise"
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
"return": "Promise<void>"
|
|
440
|
+
},
|
|
441
|
+
"docs": {
|
|
442
|
+
"text": "",
|
|
443
|
+
"tags": []
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
"cancel": {
|
|
447
|
+
"complexType": {
|
|
448
|
+
"signature": "() => Promise<void>",
|
|
449
|
+
"parameters": [],
|
|
450
|
+
"references": {
|
|
451
|
+
"Promise": {
|
|
452
|
+
"location": "global",
|
|
453
|
+
"id": "global::Promise"
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
"return": "Promise<void>"
|
|
457
|
+
},
|
|
458
|
+
"docs": {
|
|
459
|
+
"text": "",
|
|
460
|
+
"tags": []
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
static get elementRef() { return "el"; }
|
|
466
|
+
static get watchers() {
|
|
467
|
+
return [{
|
|
468
|
+
"propName": "open",
|
|
469
|
+
"methodName": "handleOpenChange"
|
|
470
|
+
}];
|
|
471
|
+
}
|
|
472
|
+
static get listeners() {
|
|
473
|
+
return [{
|
|
474
|
+
"name": "keydown",
|
|
475
|
+
"method": "handleGlobalKeyDown",
|
|
476
|
+
"target": "window",
|
|
477
|
+
"capture": false,
|
|
478
|
+
"passive": false
|
|
479
|
+
}];
|
|
480
|
+
}
|
|
481
|
+
}
|