@quartzds/core 1.0.0-beta.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/README.md +136 -0
- package/components/floating-ui.dom.esm.js +1402 -0
- package/components/floating-ui.dom.esm.js.map +1 -0
- package/components/helpers.js +174 -0
- package/components/helpers.js.map +1 -0
- package/components/icon.js +175 -0
- package/components/icon.js.map +1 -0
- package/components/index.d.ts +52 -0
- package/components/index.js +117 -0
- package/components/index.js.map +1 -0
- package/components/label.js +55 -0
- package/components/label.js.map +1 -0
- package/components/qds-button.d.ts +11 -0
- package/components/qds-button.js +148 -0
- package/components/qds-button.js.map +1 -0
- package/components/qds-checkbox.d.ts +11 -0
- package/components/qds-checkbox.js +156 -0
- package/components/qds-checkbox.js.map +1 -0
- package/components/qds-dropdown.d.ts +11 -0
- package/components/qds-dropdown.js +259 -0
- package/components/qds-dropdown.js.map +1 -0
- package/components/qds-icon.d.ts +11 -0
- package/components/qds-icon.js +13 -0
- package/components/qds-icon.js.map +1 -0
- package/components/qds-inline-link.d.ts +11 -0
- package/components/qds-inline-link.js +89 -0
- package/components/qds-inline-link.js.map +1 -0
- package/components/qds-input.d.ts +11 -0
- package/components/qds-input.js +244 -0
- package/components/qds-input.js.map +1 -0
- package/components/qds-label.d.ts +11 -0
- package/components/qds-label.js +13 -0
- package/components/qds-label.js.map +1 -0
- package/components/qds-radio.d.ts +11 -0
- package/components/qds-radio.js +109 -0
- package/components/qds-radio.js.map +1 -0
- package/components/qds-switch.d.ts +11 -0
- package/components/qds-switch.js +119 -0
- package/components/qds-switch.js.map +1 -0
- package/components/qds-title.d.ts +11 -0
- package/components/qds-title.js +94 -0
- package/components/qds-title.js.map +1 -0
- package/components/qds-tooltip.d.ts +11 -0
- package/components/qds-tooltip.js +325 -0
- package/components/qds-tooltip.js.map +1 -0
- package/dist/cjs/floating-ui.dom.esm-71fa96af.js +1410 -0
- package/dist/cjs/floating-ui.dom.esm-71fa96af.js.map +1 -0
- package/dist/cjs/helpers-0b23af3f.js +184 -0
- package/dist/cjs/helpers-0b23af3f.js.map +1 -0
- package/dist/cjs/index-f19b2823.js +2030 -0
- package/dist/cjs/index-f19b2823.js.map +1 -0
- package/dist/cjs/index.cjs.js +115 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/library-4803c801.js +62 -0
- package/dist/cjs/library-4803c801.js.map +1 -0
- package/dist/cjs/loader.cjs.js +29 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/qds-button.cjs.entry.js +110 -0
- package/dist/cjs/qds-button.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-checkbox.cjs.entry.js +116 -0
- package/dist/cjs/qds-checkbox.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-dropdown.cjs.entry.js +227 -0
- package/dist/cjs/qds-dropdown.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-icon.cjs.entry.js +113 -0
- package/dist/cjs/qds-icon.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-inline-link.cjs.entry.js +61 -0
- package/dist/cjs/qds-inline-link.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-input.cjs.entry.js +200 -0
- package/dist/cjs/qds-input.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-label.cjs.entry.js +39 -0
- package/dist/cjs/qds-label.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-radio.cjs.entry.js +74 -0
- package/dist/cjs/qds-radio.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-switch.cjs.entry.js +79 -0
- package/dist/cjs/qds-switch.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-title.cjs.entry.js +66 -0
- package/dist/cjs/qds-title.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-tooltip.cjs.entry.js +284 -0
- package/dist/cjs/qds-tooltip.cjs.entry.js.map +1 -0
- package/dist/cjs/qds.cjs.js +33 -0
- package/dist/cjs/qds.cjs.js.map +1 -0
- package/dist/custom-elements.json +3976 -0
- package/dist/docs.d.ts +148 -0
- package/dist/docs.json +3918 -0
- package/dist/esm/floating-ui.dom.esm-f96ac766.js +1402 -0
- package/dist/esm/floating-ui.dom.esm-f96ac766.js.map +1 -0
- package/dist/esm/helpers-5c189a19.js +174 -0
- package/dist/esm/helpers-5c189a19.js.map +1 -0
- package/dist/esm/index-1bc8e218.js +2000 -0
- package/dist/esm/index-1bc8e218.js.map +1 -0
- package/dist/esm/index.js +106 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/library-aa6893c0.js +58 -0
- package/dist/esm/library-aa6893c0.js.map +1 -0
- package/dist/esm/loader.js +25 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/qds-button.entry.js +106 -0
- package/dist/esm/qds-button.entry.js.map +1 -0
- package/dist/esm/qds-checkbox.entry.js +112 -0
- package/dist/esm/qds-checkbox.entry.js.map +1 -0
- package/dist/esm/qds-dropdown.entry.js +223 -0
- package/dist/esm/qds-dropdown.entry.js.map +1 -0
- package/dist/esm/qds-icon.entry.js +109 -0
- package/dist/esm/qds-icon.entry.js.map +1 -0
- package/dist/esm/qds-inline-link.entry.js +57 -0
- package/dist/esm/qds-inline-link.entry.js.map +1 -0
- package/dist/esm/qds-input.entry.js +196 -0
- package/dist/esm/qds-input.entry.js.map +1 -0
- package/dist/esm/qds-label.entry.js +35 -0
- package/dist/esm/qds-label.entry.js.map +1 -0
- package/dist/esm/qds-radio.entry.js +70 -0
- package/dist/esm/qds-radio.entry.js.map +1 -0
- package/dist/esm/qds-switch.entry.js +75 -0
- package/dist/esm/qds-switch.entry.js.map +1 -0
- package/dist/esm/qds-title.entry.js +62 -0
- package/dist/esm/qds-title.entry.js.map +1 -0
- package/dist/esm/qds-tooltip.entry.js +280 -0
- package/dist/esm/qds-tooltip.entry.js.map +1 -0
- package/dist/esm/qds.js +28 -0
- package/dist/esm/qds.js.map +1 -0
- package/dist/types/components/button/button.d.ts +209 -0
- package/dist/types/components/checkbox/checkbox.d.ts +136 -0
- package/dist/types/components/create-story.d.ts +5 -0
- package/dist/types/components/dropdown/dropdown.d.ts +135 -0
- package/dist/types/components/icon/default-library.d.ts +4 -0
- package/dist/types/components/icon/icon.d.ts +31 -0
- package/dist/types/components/icon/library.d.ts +19 -0
- package/dist/types/components/icon/request.d.ts +12 -0
- package/dist/types/components/icon/system-library.d.ts +4 -0
- package/dist/types/components/inline-link/inline-link.d.ts +208 -0
- package/dist/types/components/input/input.d.ts +386 -0
- package/dist/types/components/label/label.d.ts +33 -0
- package/dist/types/components/radio/radio.d.ts +110 -0
- package/dist/types/components/switch/switch.d.ts +115 -0
- package/dist/types/components/title/title.d.ts +42 -0
- package/dist/types/components/tooltip/tooltip.d.ts +147 -0
- package/dist/types/components.d.ts +1692 -0
- package/dist/types/helpers.d.ts +49 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/qds-test.d.ts +18 -0
- package/dist/types/stencil-public-runtime.d.ts +1638 -0
- package/dist/types/utils.d.ts +65 -0
- package/dist/vscode.html-custom-data.json +947 -0
- package/hydrate/index.d.ts +218 -0
- package/hydrate/index.js +9690 -0
- package/hydrate/package.json +6 -0
- package/loader/cdn.js +7 -0
- package/loader/index.cjs.js +7 -0
- package/loader/index.d.ts +21 -0
- package/loader/index.es2017.js +7 -0
- package/loader/index.js +8 -0
- package/loader/package.json +11 -0
- package/package.json +231 -0
- package/styles/core.css +379 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"qds-title.entry.js","mappings":";;;;;;;;AAAA,MAAM,QAAQ,GAAG,qnXAAqnX;;MCuBznX,KAAK;;;IAkCR,wBAAmB,GAAe,EAAE,CAAA;;uBAvBmB,SAAS;;iBAOjC,OAAO;iBAEN,SAAS;;eA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A,IAAI,CAAC,QAAQ,CACZ,CACL,EACA,IAAI,CAAC,SAAS,KACb,SACE,KAAK,EAAE;QACL,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI;QAClB,CAAC,IAAI,CAAC,KAAK,IAAI,MAAM,GAAG,IAAI;QAC5B,MAAM,EAAE,IAAI;QACZ,UAAU,EAAE,IAAI,CAAC,OAAO;OACzB,IAEA,IAAI,CAAC,MAAM,CACV,CACL,CACM,EACV;GACF;;;;;;;","names":[],"sources":["./src/components/title/title.css?tag=qds-title&encapsulation=shadow","./src/components/title/title.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: block;\n}\n\n.titles,\n.title {\n display: flex;\n}\n\n.titles {\n flex-direction: column;\n}\n\n.title,\n.subtitle,\n.kicker {\n margin-block: 0;\n}\n\n.icon {\n flex-shrink: 0;\n}\n\n.title {\n font-weight: initial;\n font-size: initial;\n color: var(--qds-theme-title);\n}\n\n.subtitle {\n color: var(--qds-theme-subtitle);\n}\n\n.kicker {\n color: var(--qds-theme-kicker);\n order: -1;\n}\n\n.subtitle,\n.kicker {\n overflow-wrap: break-word;\n}\n\n.main {\n &.section {\n &.titles,\n &.title {\n gap: var(--qds-main-section-titles-gap);\n }\n\n &.title {\n font: var(--qds-main-section-title);\n\n & .icon {\n --qds-main-section-title-line-height: 2rem;\n\n width: var(--qds-main-section-titles-icon-size);\n height: var(--qds-main-section-title-line-height);\n }\n }\n\n &.subtitle {\n font: var(--qds-main-section-subtitle);\n }\n\n &.kicker {\n font: var(--qds-main-section-kicker);\n }\n\n &.has-icon {\n padding-inline-start: calc(\n var(--qds-main-section-titles-icon-size, 0px) +\n var(--qds-main-section-titles-gap, 0px)\n );\n }\n\n &.has-icon-end {\n padding-inline-end: calc(\n var(--qds-main-section-titles-icon-size, 0px) +\n var(--qds-main-section-titles-gap, 0px)\n );\n }\n }\n\n &.subsection {\n &.titles,\n &.title {\n gap: var(--qds-main-subsection-titles-gap);\n }\n\n &.title {\n font: var(--qds-main-subsection-title);\n\n & .icon {\n --qds-main-subsection-title-line-height: 1.5rem;\n\n width: var(--qds-main-subsection-titles-icon-size);\n height: var(--qds-main-subsection-title-line-height);\n }\n }\n\n &.subtitle {\n font: var(--qds-main-subsection-subtitle);\n }\n\n &.kicker {\n font: var(--qds-main-subsection-kicker);\n }\n\n &.has-icon {\n padding-inline-start: calc(\n var(--qds-main-subsection-titles-icon-size, 0px) +\n var(--qds-main-subsection-titles-gap, 0px)\n );\n }\n }\n}\n\n.panel {\n &.root {\n &.titles,\n &.title {\n gap: var(--qds-panel-titles-gap);\n }\n\n &.title {\n font: var(--qds-panel-title);\n\n & .icon {\n --qds-panel-title-line-height: 2rem;\n\n width: var(--qds-panel-titles-icon-size);\n height: var(--qds-panel-title-line-height);\n }\n }\n\n &.subtitle {\n font: var(--qds-panel-subtitle);\n }\n\n &.kicker {\n font: var(--qds-panel-kicker);\n }\n\n &.has-icon {\n padding-inline-start: calc(\n var(--qds-panel-titles-icon-size, 0px) +\n var(--qds-panel-titles-gap, 0px)\n );\n }\n }\n\n &.section {\n &.titles,\n &.title {\n gap: var(--qds-panel-section-titles-gap);\n }\n\n &.title {\n font: var(--qds-panel-section-title);\n\n & .icon {\n --qds-panel-section-title-line-height: 1.5rem;\n\n width: var(--qds-panel-section-titles-icon-size);\n height: var(--qds-panel-section-title-line-height);\n }\n }\n\n &.subtitle {\n font: var(--qds-panel-section-subtitle);\n }\n\n &.kicker {\n font: var(--qds-panel-section-kicker);\n }\n\n &.has-icon {\n padding-inline-start: calc(\n var(--qds-panel-section-titles-icon-size, 0px) +\n var(--qds-panel-section-titles-gap, 0px)\n );\n }\n }\n\n &.subsection {\n &.titles,\n &.title {\n gap: var(--qds-panel-subsection-titles-gap);\n }\n\n &.title {\n font: var(--qds-panel-subsection-title);\n\n & .icon {\n --qds-panel-subsection-title-line-height: 1.25rem;\n\n width: var(--qds-panel-subsection-titles-icon-size);\n height: var(--qds-panel-subsection-title-line-height);\n }\n }\n\n &.subtitle {\n font: var(--qds-panel-subsection-subtitle);\n }\n\n &.kicker {\n font: var(--qds-panel-subsection-kicker);\n }\n\n &.has-icon {\n padding-inline-start: calc(\n var(--qds-panel-subsection-titles-icon-size, 0px) +\n var(--qds-panel-subsection-titles-gap, 0px)\n );\n }\n }\n}\n\n.navigation {\n &.section {\n &.titles,\n &.title {\n gap: var(--qds-navigation-section-titles-gap);\n }\n\n &.title {\n font: var(--qds-navigation-section-title);\n\n & .icon {\n --qds-navigation-section-title-line-height: 1.5rem;\n\n width: var(--qds-navigation-section-titles-icon-size);\n height: var(--qds-navigation-section-title-line-height);\n }\n }\n\n &.subtitle {\n font: var(--qds-navigation-section-subtitle);\n }\n\n &.kicker {\n font: var(--qds-navigation-section-kicker);\n }\n\n &.has-icon {\n padding-inline-start: calc(\n var(--qds-navigation-section-titles-icon-size, 0px) +\n var(--qds-navigation-section-titles-gap, 0px)\n );\n }\n }\n\n &.subsection {\n &.titles,\n &.title {\n gap: var(--qds-navigation-subsection-titles-gap);\n }\n\n &.title {\n font: var(--qds-navigation-subsection-title);\n\n & .icon {\n --qds-navigation-subsection-title-line-height: 1.25rem;\n\n width: var(--qds-navigation-subsection-titles-icon-size);\n height: var(--qds-navigation-subsection-title-line-height);\n }\n }\n\n &.subtitle {\n font: var(--qds-navigation-subsection-subtitle);\n }\n\n &.kicker {\n font: var(--qds-navigation-subsection-kicker);\n }\n\n &.has-icon {\n padding-inline-start: calc(\n var(--qds-navigation-subsection-titles-icon-size, 0px) +\n var(--qds-navigation-subsection-titles-gap, 0px)\n );\n }\n }\n}\n\n.popup {\n &.root {\n &.titles,\n &.title {\n gap: var(--qds-popup-titles-gap);\n }\n\n &.title {\n font: var(--qds-popup-title);\n\n & .icon {\n --qds-popup-title-line-height: 1.75rem;\n\n width: var(--qds-popup-titles-icon-size);\n height: var(--qds-popup-title-line-height);\n }\n }\n\n &.subtitle {\n font: var(--qds-popup-subtitle);\n }\n\n &.kicker {\n font: var(--qds-popup-kicker);\n }\n\n &.has-icon {\n padding-inline-start: calc(\n var(--qds-popup-titles-icon-size, 0px) +\n var(--qds-popup-titles-gap, 0px)\n );\n }\n }\n\n &.section {\n &.titles,\n &.title {\n gap: var(--qds-popup-section-titles-gap);\n }\n\n &.title {\n font: var(--qds-popup-section-title);\n\n & .icon {\n --qds-popup-section-title-line-height: 1.5rem;\n\n width: var(--qds-popup-section-titles-icon-size);\n height: var(--qds-popup-section-title-line-height);\n }\n }\n\n &.subtitle {\n font: var(--qds-popup-section-subtitle);\n }\n\n &.kicker {\n font: var(--qds-popup-section-kicker);\n }\n\n &.has-icon {\n padding-inline-start: calc(\n var(--qds-popup-section-titles-icon-size, 0px) +\n var(--qds-popup-section-titles-gap, 0px)\n );\n }\n }\n\n &.subsection {\n &.titles,\n &.title {\n gap: var(--qds-popup-subsection-titles-gap);\n }\n\n &.title {\n font: var(--qds-popup-subsection-title);\n\n & .icon {\n --qds-popup-subsection-title-line-height: 1.25rem;\n\n width: var(--qds-popup-subsection-titles-icon-size);\n height: var(--qds-popup-subsection-title-line-height);\n }\n }\n\n &.subtitle {\n font: var(--qds-popup-subsection-subtitle);\n }\n\n &.kicker {\n font: var(--qds-popup-subsection-kicker);\n }\n\n &.has-icon {\n padding-inline-start: calc(\n var(--qds-popup-subsection-titles-icon-size, 0px) +\n var(--qds-popup-subsection-titles-gap, 0px)\n );\n }\n }\n}\n\n.accessory {\n &.root {\n &.titles,\n &.title {\n gap: var(--qds-accessory-titles-gap);\n }\n\n &.title {\n font: var(--qds-accessory-title);\n\n & .icon {\n --qds-accessory-title-line-height: 1.5rem;\n\n width: var(--qds-accessory-titles-icon-size);\n height: var(--qds-accessory-title-line-height);\n }\n }\n\n &.subtitle {\n font: var(--qds-accessory-subtitle);\n }\n\n &.kicker {\n font: var(--qds-accessory-kicker);\n }\n\n &.has-icon {\n padding-inline-start: calc(\n var(--qds-accessory-titles-icon-size, 0px) +\n var(--qds-accessory-titles-gap, 0px)\n );\n }\n }\n\n &.section {\n &.titles,\n &.title {\n gap: var(--qds-accessory-section-titles-gap);\n }\n\n &.title {\n font: var(--qds-accessory-section-title);\n\n & .icon {\n --qds-accessory-section-title-line-height: 1.25rem;\n\n width: var(--qds-accessory-section-titles-icon-size);\n height: var(--qds-accessory-section-title-line-height);\n }\n }\n\n &.subtitle {\n font: var(--qds-accessory-section-subtitle);\n }\n\n &.kicker {\n font: var(--qds-accessory-section-kicker);\n }\n\n &.has-icon {\n padding-inline-start: calc(\n var(--qds-accessory-section-titles-icon-size, 0px) +\n var(--qds-accessory-section-titles-gap, 0px)\n );\n }\n }\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface } from '@stencil/core'\nimport { Component, Element, h, Prop } from '@stencil/core'\n\nimport type { Attributes } from '../../helpers'\nimport { inheritAriaAttributes } from '../../helpers'\n\nexport type Layer = 'accessory' | 'main' | 'navigation' | 'panel' | 'popup'\nexport type Level = 'section' | 'subsection'\nexport type Tag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n\n/**\n * @slot Content to display for the title.\n * @see https://quartz.se.com/build/components/title\n */\n@Component({\n tag: 'qds-title',\n shadow: true,\n styleUrl: 'title.css',\n})\nexport class Title implements ComponentInterface {\n /**\n * The name of the icon to render.\n *\n * Available names depend on the icon library being used.\n */\n @Prop({ reflect: true }) public readonly iconName?: string\n\n /**\n * The name of a registered icon library.\n */\n @Prop({ reflect: true }) public readonly iconLibrary: string = 'default'\n\n /**\n * Text to display for the kicker.\n */\n @Prop() public readonly kicker?: string\n\n @Prop() public readonly layer: Layer = 'panel'\n\n @Prop() public readonly level?: Level = 'section'\n\n /**\n * Text to display for the subtitle.\n */\n @Prop() public readonly subtitle?: string\n\n /**\n * HTML tag to use to render the title.\n */\n @Prop() public readonly tag: Tag = 'h2'\n\n @Element() private readonly element!: HTMLQdsTitleElement\n\n private inheritedAttributes: Attributes = {}\n\n private get hasSubtitle(): boolean {\n return this.subtitle !== undefined && this.subtitle !== ''\n }\n\n private get hasKicker(): boolean {\n return this.kicker !== undefined && this.kicker !== ''\n }\n\n private get hasIcon(): boolean {\n return this.iconName !== undefined && this.iconName !== ''\n }\n\n public componentWillLoad(): void {\n this.inheritedAttributes = inheritAriaAttributes(this.element)\n }\n\n public render() {\n return (\n <hgroup\n class={{\n [this.layer]: true,\n [this.level ?? 'root']: true,\n titles: true,\n }}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n >\n <this.tag\n class={{\n [this.layer]: true,\n [this.level ?? 'root']: true,\n title: true,\n }}\n >\n {this.iconName !== undefined && this.iconName !== '' && (\n <qds-icon\n class=\"icon\"\n name={this.iconName}\n library={this.iconLibrary}\n />\n )}\n <div>\n <slot />\n </div>\n </this.tag>\n {this.hasSubtitle && (\n <p\n class={{\n [this.layer]: true,\n [this.level ?? 'root']: true,\n subtitle: true,\n 'has-icon': this.hasIcon,\n }}\n >\n {this.subtitle}\n </p>\n )}\n {this.hasKicker && (\n <p\n class={{\n [this.layer]: true,\n [this.level ?? 'root']: true,\n kicker: true,\n 'has-icon': this.hasIcon,\n }}\n >\n {this.kicker}\n </p>\n )}\n </hgroup>\n )\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: © 2023 Schneider Electric
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: LGPL-2.1-only
|
|
5
|
+
*/
|
|
6
|
+
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-1bc8e218.js';
|
|
7
|
+
import { o as offset, f as flip, s as shift, l as limitShift, b as arrow, c as computePosition, a as autoUpdate } from './floating-ui.dom.esm-f96ac766.js';
|
|
8
|
+
import { c as ignorePromise, d as propertyToPx, a as invariant, r as roundByDPR, f as isTouchDevice } from './helpers-5c189a19.js';
|
|
9
|
+
|
|
10
|
+
const tooltipCss = ":host{box-sizing:border-box}:host([hidden]){display:none !important}:host([hidden]){}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{align-items:flex-start;background-color:var(--qds-theme-accessory-background);border-radius:var(--qds-accessory-border-radius);box-shadow:var(--qds-theme-accessory-elevation);color:var(--qds-theme-text-standard);display:flex;flex-direction:column;gap:var(--qds-accessory-gap-children-unrelated);left:0;padding:var(--qds-accessory-padding);top:0}:host([aria-hidden='true']){display:none}:host::before{content:'';height:100%;left:0;position:absolute;top:0;width:100%}::slotted(blockquote),::slotted(button),::slotted(dd),::slotted(dl),::slotted(fieldset),::slotted(figure),::slotted(h1),::slotted(h2),::slotted(h3),::slotted(h4),::slotted(h5),::slotted(h6),::slotted(hr),::slotted(input),::slotted(menu),::slotted(ol),::slotted(p),::slotted(pre),::slotted(select),::slotted(textarea),::slotted(ul){margin:0}:host([data-side='top'])::before,:host([data-side='bottom'])::before{height:calc(\n 0px +\n 0px\n );height:calc(\n var(--qds-accessory-gap-floating, 0px) +\n var(--qds-signature-triangle-pointer-size-height, 0px)\n );top:100%}:host([data-side='bottom'])::before{top:calc(\n -1 * (0px +\n 0px)\n );top:calc(\n -1 * (var(--qds-accessory-gap-floating, 0px) +\n var(--qds-signature-triangle-pointer-size-height, 0px))\n )}:host([data-side='left'])::before,:host([data-side='right'])::before{width:calc(\n 0px +\n 0px\n );width:calc(\n var(--qds-accessory-gap-floating, 0px) +\n var(--qds-signature-triangle-pointer-size-height, 0px)\n );left:100%}:host([data-side='right'])::before{left:calc(\n -1 * (0px +\n 0px)\n );left:calc(\n -1 * (var(--qds-accessory-gap-floating, 0px) +\n var(--qds-signature-triangle-pointer-size-height, 0px))\n )}.arrow-container{height:var(--qds-signature-triangle-pointer-size-width);position:absolute;width:var(--qds-signature-triangle-pointer-size-width)}.arrow-container[data-side='bottom']{bottom:100%;transform:rotate(180deg)}.arrow-container[data-side='left']{left:100%;transform:rotate(-90deg)}.arrow-container[data-side='right']{right:100%;transform:rotate(90deg)}.arrow-container[data-side='top']{top:100%}.arrow{fill:var(--qds-theme-accessory-background)}";
|
|
11
|
+
|
|
12
|
+
let autoIncrementingId = 1;
|
|
13
|
+
const Tooltip = class {
|
|
14
|
+
constructor(hostRef) {
|
|
15
|
+
registerInstance(this, hostRef);
|
|
16
|
+
this.closeEmitter = createEvent(this, "qdsClose", 2);
|
|
17
|
+
this.clickedTooltip = false;
|
|
18
|
+
this.isTouchDevice = false;
|
|
19
|
+
this.arrowContainerRef = (svg) => {
|
|
20
|
+
this.arrowContainerElement = svg;
|
|
21
|
+
};
|
|
22
|
+
this.boundTooltipMouseDown = () => {
|
|
23
|
+
this.clickedTooltip = true;
|
|
24
|
+
};
|
|
25
|
+
this.boundFocus = () => {
|
|
26
|
+
ignorePromise(this.handleFocus());
|
|
27
|
+
};
|
|
28
|
+
this.boundMouseEnter = () => {
|
|
29
|
+
ignorePromise(this.handleMouseEnter());
|
|
30
|
+
};
|
|
31
|
+
this.boundMouseLeave = (event) => {
|
|
32
|
+
ignorePromise(this.handleMouseLeave(event));
|
|
33
|
+
};
|
|
34
|
+
this.boundFocusout = (event) => {
|
|
35
|
+
ignorePromise(this.handleFocusOut(event));
|
|
36
|
+
};
|
|
37
|
+
this.boundReferenceClick = () => {
|
|
38
|
+
ignorePromise(this.handleReferenceClick());
|
|
39
|
+
};
|
|
40
|
+
this.autoUpdateOptions = undefined;
|
|
41
|
+
this.disabled = false;
|
|
42
|
+
this.flipOptions = undefined;
|
|
43
|
+
this.noFlip = false;
|
|
44
|
+
this.noShift = false;
|
|
45
|
+
this.offsetOptions = undefined;
|
|
46
|
+
this.placement = 'top';
|
|
47
|
+
this.shiftOptions = undefined;
|
|
48
|
+
this.strategy = undefined;
|
|
49
|
+
this.target = undefined;
|
|
50
|
+
this.hostPosition = undefined;
|
|
51
|
+
this.hostTransform = undefined;
|
|
52
|
+
this.open = false;
|
|
53
|
+
this.middleware = undefined;
|
|
54
|
+
this.aDisplay = undefined;
|
|
55
|
+
this.side = 'top';
|
|
56
|
+
this.aShape = '';
|
|
57
|
+
this.aViewbox = '';
|
|
58
|
+
this.aHeight = 0;
|
|
59
|
+
this.aWidth = 0;
|
|
60
|
+
this.aGap = 0;
|
|
61
|
+
this.aX = '';
|
|
62
|
+
this.aY = '';
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Show the tooltip.
|
|
66
|
+
*/
|
|
67
|
+
async show() {
|
|
68
|
+
if (this.open)
|
|
69
|
+
return;
|
|
70
|
+
if (this.referenceElement instanceof globalThis.Element)
|
|
71
|
+
this.referenceElement.addEventListener('focusout', this.boundFocusout);
|
|
72
|
+
this.open = true;
|
|
73
|
+
this.element.setAttribute('aria-hidden', 'false');
|
|
74
|
+
this.startAutoUpdate();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Close the tooltip.
|
|
78
|
+
*/
|
|
79
|
+
async close() {
|
|
80
|
+
if (!this.open)
|
|
81
|
+
return;
|
|
82
|
+
this.closeEmitter.emit();
|
|
83
|
+
if (this.referenceElement instanceof globalThis.Element)
|
|
84
|
+
this.referenceElement.removeEventListener('focusout', this.boundFocusout);
|
|
85
|
+
this.open = false;
|
|
86
|
+
this.clickedTooltip = false;
|
|
87
|
+
this.element.setAttribute('aria-hidden', 'true');
|
|
88
|
+
if (this.cleanup)
|
|
89
|
+
this.cleanup();
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Update the tooltip's arrow.
|
|
93
|
+
*
|
|
94
|
+
* This method should typically be called when the Quartz platform was
|
|
95
|
+
* changed.
|
|
96
|
+
*/
|
|
97
|
+
async updateArrow() {
|
|
98
|
+
this.aGap = propertyToPx(this.element, '--qds-accessory-gap-floating') ?? 0;
|
|
99
|
+
this.aHeight =
|
|
100
|
+
propertyToPx(this.element, `--qds-signature-triangle-pointer-size-height`) ?? 0;
|
|
101
|
+
this.aWidth =
|
|
102
|
+
propertyToPx(this.element, `--qds-signature-triangle-pointer-size-width`) ?? 0;
|
|
103
|
+
this.aViewbox = `0 0 ${this.aWidth} ${Math.max(this.aHeight, this.aWidth)}`;
|
|
104
|
+
const aTipRadius = propertyToPx(this.element, `--qds-signature-triangle-pointer-tip-radius`) ?? 0;
|
|
105
|
+
const svgX = (this.aWidth / 2) * (aTipRadius / -8 + 1);
|
|
106
|
+
const svgY = ((this.aHeight / 2) * aTipRadius) / 4;
|
|
107
|
+
this.aShape =
|
|
108
|
+
'M0,0' +
|
|
109
|
+
` H${this.aWidth}` +
|
|
110
|
+
` L${this.aWidth - svgX},${this.aHeight - svgY}` +
|
|
111
|
+
` Q${this.aWidth / 2},${this.aHeight} ${svgX},${this.aHeight - svgY}` +
|
|
112
|
+
' Z';
|
|
113
|
+
}
|
|
114
|
+
async handleMouseDown(event) {
|
|
115
|
+
const composedPath = event.composedPath();
|
|
116
|
+
const withinBounds = composedPath.includes(this.element) ||
|
|
117
|
+
(this.referenceElement instanceof globalThis.Element &&
|
|
118
|
+
composedPath.includes(this.referenceElement));
|
|
119
|
+
if (!withinBounds)
|
|
120
|
+
await this.close();
|
|
121
|
+
}
|
|
122
|
+
async updateMiddleware() {
|
|
123
|
+
invariant(this.arrowContainerElement);
|
|
124
|
+
this.middleware = [
|
|
125
|
+
offset({
|
|
126
|
+
...this.offsetOptions,
|
|
127
|
+
mainAxis: this.aGap + this.aHeight,
|
|
128
|
+
}),
|
|
129
|
+
!this.noFlip &&
|
|
130
|
+
flip({
|
|
131
|
+
crossAxis: this.noShift,
|
|
132
|
+
...this.flipOptions,
|
|
133
|
+
}),
|
|
134
|
+
!this.noShift &&
|
|
135
|
+
shift({
|
|
136
|
+
limiter: limitShift(),
|
|
137
|
+
...this.shiftOptions,
|
|
138
|
+
}),
|
|
139
|
+
arrow({
|
|
140
|
+
element: this.arrowContainerElement,
|
|
141
|
+
}),
|
|
142
|
+
].filter((middleware) => middleware !== false);
|
|
143
|
+
}
|
|
144
|
+
async updateReferenceElement() {
|
|
145
|
+
var _a;
|
|
146
|
+
this.disconnectReferenceElement();
|
|
147
|
+
const resolvedTarget = typeof this.target === 'function' ? this.target() : this.target;
|
|
148
|
+
if (typeof resolvedTarget === 'string') {
|
|
149
|
+
const element = document.querySelector(resolvedTarget);
|
|
150
|
+
if (element === null)
|
|
151
|
+
throw new Error('String `target` must resolve to an Element.');
|
|
152
|
+
this.referenceElement = element;
|
|
153
|
+
}
|
|
154
|
+
else
|
|
155
|
+
this.referenceElement = resolvedTarget;
|
|
156
|
+
if (!(this.referenceElement instanceof globalThis.Element))
|
|
157
|
+
return;
|
|
158
|
+
if (this.isTouchDevice)
|
|
159
|
+
this.referenceElement.addEventListener('click', this.boundReferenceClick);
|
|
160
|
+
this.referenceElement.addEventListener('focus', this.boundFocus);
|
|
161
|
+
this.referenceElement.addEventListener('mouseenter', this.boundMouseEnter);
|
|
162
|
+
this.referenceElement.addEventListener('mouseleave', this.boundMouseLeave);
|
|
163
|
+
(_a = this.element).id || (_a.id = `qds-tooltip-${autoIncrementingId}`);
|
|
164
|
+
this.referenceElement.setAttribute('aria-describedby', this.element.id);
|
|
165
|
+
}
|
|
166
|
+
async updatePosition() {
|
|
167
|
+
invariant(this.referenceElement);
|
|
168
|
+
const { x, y, middlewareData, placement, strategy } = await computePosition(this.referenceElement, this.element, {
|
|
169
|
+
middleware: this.middleware,
|
|
170
|
+
placement: this.placement,
|
|
171
|
+
strategy: this.strategy,
|
|
172
|
+
});
|
|
173
|
+
this.hostPosition = strategy;
|
|
174
|
+
this.hostTransform = `translate(${roundByDPR(x)}px,${roundByDPR(y)}px)`;
|
|
175
|
+
if (!middlewareData.arrow)
|
|
176
|
+
return;
|
|
177
|
+
invariant(this.arrowContainerElement);
|
|
178
|
+
if (middlewareData.arrow.centerOffset !== 0) {
|
|
179
|
+
this.aDisplay = 'none';
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
this.aDisplay = undefined;
|
|
183
|
+
const [side] = placement.split('-');
|
|
184
|
+
this.side = side;
|
|
185
|
+
const { x: aX, y: aY } = middlewareData.arrow;
|
|
186
|
+
this.aX = aX === undefined ? '' : `${aX}px`;
|
|
187
|
+
this.aY = aY === undefined ? '' : `${aY}px`;
|
|
188
|
+
}
|
|
189
|
+
startAutoUpdate() {
|
|
190
|
+
invariant(this.referenceElement);
|
|
191
|
+
if (this.cleanup)
|
|
192
|
+
this.cleanup();
|
|
193
|
+
this.cleanup = autoUpdate(this.referenceElement, this.element, () => {
|
|
194
|
+
ignorePromise(this.updatePosition());
|
|
195
|
+
}, this.autoUpdateOptions);
|
|
196
|
+
}
|
|
197
|
+
async componentWillLoad() {
|
|
198
|
+
this.isTouchDevice = isTouchDevice();
|
|
199
|
+
this.element.setAttribute('aria-hidden', 'true');
|
|
200
|
+
await this.updateReferenceElement();
|
|
201
|
+
autoIncrementingId += 1;
|
|
202
|
+
}
|
|
203
|
+
async componentDidLoad() {
|
|
204
|
+
await this.updateArrow();
|
|
205
|
+
}
|
|
206
|
+
disconnectedCallback() {
|
|
207
|
+
this.disconnectReferenceElement();
|
|
208
|
+
}
|
|
209
|
+
render() {
|
|
210
|
+
return (h(Host, { "data-side": this.side, onFocusout: this.boundFocusout, onMouseDown: this.boundTooltipMouseDown, onMouseLeave: this.boundMouseLeave, role: this.element.role ?? 'tooltip', style: {
|
|
211
|
+
position: this.hostPosition,
|
|
212
|
+
transform: this.hostTransform,
|
|
213
|
+
} }, h("slot", null), h("svg", { "aria-hidden": true, "data-side": this.side, class: "arrow-container", ref: this.arrowContainerRef, viewBox: this.aViewbox, style: {
|
|
214
|
+
left: this.aX,
|
|
215
|
+
top: this.aY,
|
|
216
|
+
display: this.aDisplay,
|
|
217
|
+
} }, h("path", { class: "arrow", d: this.aShape }))));
|
|
218
|
+
}
|
|
219
|
+
async handleFocus() {
|
|
220
|
+
if (!this.disabled)
|
|
221
|
+
await this.show();
|
|
222
|
+
}
|
|
223
|
+
async handleMouseEnter() {
|
|
224
|
+
if (!this.disabled)
|
|
225
|
+
await this.show();
|
|
226
|
+
}
|
|
227
|
+
async handleMouseLeave(event) {
|
|
228
|
+
if (!this.clickedTooltip &&
|
|
229
|
+
document.activeElement !== this.referenceElement &&
|
|
230
|
+
document.activeElement?.closest('qds-tooltip') !== this.element &&
|
|
231
|
+
event instanceof MouseEvent &&
|
|
232
|
+
event.relatedTarget !== this.referenceElement &&
|
|
233
|
+
event.relatedTarget !== this.element)
|
|
234
|
+
await this.close();
|
|
235
|
+
}
|
|
236
|
+
async handleFocusOut(event) {
|
|
237
|
+
if (!(event instanceof FocusEvent))
|
|
238
|
+
return;
|
|
239
|
+
const { relatedTarget } = event;
|
|
240
|
+
if (relatedTarget instanceof globalThis.Element &&
|
|
241
|
+
!this.element.contains(relatedTarget) &&
|
|
242
|
+
this.referenceElement !== relatedTarget)
|
|
243
|
+
await this.close();
|
|
244
|
+
}
|
|
245
|
+
async handleReferenceClick() {
|
|
246
|
+
if (!this.disabled)
|
|
247
|
+
await (this.open ? this.close() : this.show());
|
|
248
|
+
}
|
|
249
|
+
disconnectReferenceElement() {
|
|
250
|
+
if (!(this.referenceElement instanceof globalThis.Element))
|
|
251
|
+
return;
|
|
252
|
+
if (this.isTouchDevice)
|
|
253
|
+
this.referenceElement.removeEventListener('click', this.boundReferenceClick);
|
|
254
|
+
this.referenceElement.removeEventListener('focus', this.boundFocus);
|
|
255
|
+
this.referenceElement.removeEventListener('focusout', this.boundFocusout);
|
|
256
|
+
this.referenceElement.removeEventListener('mouseenter', this.boundMouseEnter);
|
|
257
|
+
this.referenceElement.removeEventListener('mouseleave', this.boundMouseLeave);
|
|
258
|
+
this.referenceElement.removeAttribute('aria-describedby');
|
|
259
|
+
}
|
|
260
|
+
get element() { return getElement(this); }
|
|
261
|
+
static get watchers() { return {
|
|
262
|
+
"aGap": ["updateMiddleware"],
|
|
263
|
+
"aHeight": ["updateMiddleware"],
|
|
264
|
+
"flipOptions": ["updateMiddleware"],
|
|
265
|
+
"noFlip": ["updateMiddleware"],
|
|
266
|
+
"noShift": ["updateMiddleware"],
|
|
267
|
+
"offsetOptions": ["updateMiddleware"],
|
|
268
|
+
"shiftOptions": ["updateMiddleware"],
|
|
269
|
+
"target": ["updateReferenceElement"],
|
|
270
|
+
"middleware": ["updatePosition"],
|
|
271
|
+
"placement": ["updatePosition"],
|
|
272
|
+
"strategy": ["updatePosition"],
|
|
273
|
+
"autoUpdateOptions": ["startAutoUpdate"]
|
|
274
|
+
}; }
|
|
275
|
+
};
|
|
276
|
+
Tooltip.style = tooltipCss;
|
|
277
|
+
|
|
278
|
+
export { Tooltip as qds_tooltip };
|
|
279
|
+
|
|
280
|
+
//# sourceMappingURL=qds-tooltip.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"qds-tooltip.entry.js","mappings":";;;;;;;;;AAAA,MAAM,UAAU,GAAG,8xEAA8xE;;AC+CjzE,IAAI,kBAAkB,GAAG,CAAC,CAAA;MAYb,OAAO;;;;IAoIV,mBAAc,GAAG,KAAK,CAAA;IAEtB,kBAAa,GAAG,KAAK,CAAA;IAiPZ,sBAAiB,GAAG,CAAC,GAAgB;MACpD,IAAI,CAAC,qBAAqB,GAAG,GAAG,CAAA;KACjC,CAAA;IAEgB,0BAAqB,GAAG;MACvC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;KAC3B,CAAA;IAMgB,eAAU,GAAG;MAC5B,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;KAClC,CAAA;IAMgB,oBAAe,GAAG;MACjC,aAAa,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAA;KACvC,CAAA;IAcgB,oBAAe,GAAG,CAAC,KAAY;MAC9C,aAAa,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAA;KAC5C,CAAA;IAcgB,kBAAa,GAAG,CAAC,KAAY;MAC5C,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAA;KAC1C,CAAA;IAMgB,wBA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ooltip&encapsulation=shadow","./src/components/tooltip/tooltip.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n align-items: flex-start;\n background-color: var(--qds-theme-accessory-background);\n border-radius: var(--qds-accessory-border-radius);\n box-shadow: var(--qds-theme-accessory-elevation);\n color: var(--qds-theme-text-standard);\n display: flex;\n flex-direction: column;\n gap: var(--qds-accessory-gap-children-unrelated);\n left: 0;\n padding: var(--qds-accessory-padding);\n top: 0;\n}\n\n:host([aria-hidden='true']) {\n display: none;\n}\n\n:host::before {\n content: '';\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n::slotted(blockquote),\n::slotted(button),\n::slotted(dd),\n::slotted(dl),\n::slotted(fieldset),\n::slotted(figure),\n::slotted(h1),\n::slotted(h2),\n::slotted(h3),\n::slotted(h4),\n::slotted(h5),\n::slotted(h6),\n::slotted(hr),\n::slotted(input),\n::slotted(menu),\n::slotted(ol),\n::slotted(p),\n::slotted(pre),\n::slotted(select),\n::slotted(textarea),\n::slotted(ul) {\n margin: 0;\n}\n\n:host([data-side='top'])::before,\n:host([data-side='bottom'])::before {\n height: calc(\n var(--qds-accessory-gap-floating, 0px) +\n var(--qds-signature-triangle-pointer-size-height, 0px)\n );\n top: 100%;\n}\n\n:host([data-side='bottom'])::before {\n top: calc(\n -1 * (var(--qds-accessory-gap-floating, 0px) +\n var(--qds-signature-triangle-pointer-size-height, 0px))\n );\n}\n\n:host([data-side='left'])::before,\n:host([data-side='right'])::before {\n width: calc(\n var(--qds-accessory-gap-floating, 0px) +\n var(--qds-signature-triangle-pointer-size-height, 0px)\n );\n left: 100%;\n}\n\n:host([data-side='right'])::before {\n left: calc(\n -1 * (var(--qds-accessory-gap-floating, 0px) +\n var(--qds-signature-triangle-pointer-size-height, 0px))\n );\n}\n\n.arrow-container {\n height: var(--qds-signature-triangle-pointer-size-width);\n position: absolute;\n width: var(--qds-signature-triangle-pointer-size-width);\n\n &[data-side='bottom'] {\n bottom: 100%;\n transform: rotate(180deg);\n }\n\n &[data-side='left'] {\n left: 100%;\n transform: rotate(-90deg);\n }\n\n &[data-side='right'] {\n right: 100%;\n transform: rotate(90deg);\n }\n\n &[data-side='top'] {\n top: 100%;\n }\n}\n\n.arrow {\n fill: var(--qds-theme-accessory-background);\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type {\n AutoUpdateOptions,\n DetectOverflowOptions,\n FlipOptions,\n Middleware,\n Placement,\n ReferenceElement,\n ShiftOptions,\n Side,\n Strategy,\n} from '@floating-ui/dom'\nimport {\n arrow,\n autoUpdate,\n computePosition,\n flip,\n limitShift,\n offset,\n shift,\n} from '@floating-ui/dom'\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport {\n Component,\n Element,\n Event,\n h,\n Host,\n Listen,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core'\n\nimport type { OffsetOptions } from '../../helpers'\nimport {\n ignorePromise,\n invariant,\n isTouchDevice,\n propertyToPx,\n roundByDPR,\n} from '../../helpers'\n\nlet autoIncrementingId = 1\n\n/**\n * @experimental\n * @slot Content to display in the dropdown.\n * @see https://quartz.se.com/build/components/tooltip\n */\n@Component({\n tag: 'qds-tooltip',\n shadow: true,\n styleUrl: 'tooltip.css',\n})\nexport class Tooltip implements ComponentInterface {\n /**\n * Options to pass to Floating UI's\n * [`autoUpdate()` function](https://floating-ui.com/docs/autoUpdate).\n *\n * @see https://floating-ui.com/docs/autoupdate#options\n */\n @Prop() public readonly autoUpdateOptions?: AutoUpdateOptions\n\n /**\n * Prevents the tooltip from being shown by user interaction. The tooltip can\n * still be displayed by calling the `show()` method.\n */\n @Prop({ mutable: true }) public disabled = false\n\n /**\n * Options to pass to Floating UI's\n * [`flip` middleware](https://floating-ui.com/docs/flip).\n *\n * The [`crossAxis` option](https://floating-ui.com/docs/flip#crossaxis) is\n * set to the value of the `noShift` property by default for interoperability\n * with the [`shift` middleware](https://floating-ui.com/docs/shift).\n *\n * @see https://floating-ui.com/docs/flip#options\n */\n @Prop() public readonly flipOptions?: Partial<\n DetectOverflowOptions & FlipOptions\n >\n\n /**\n * Disable Floating UI's\n * [`flip` middleware](https://floating-ui.com/docs/flip).\n */\n @Prop() public readonly noFlip: boolean = false\n\n /**\n * Disable Floating UI's\n * [`shift` middleware](https://floating-ui.com/docs/shift).\n */\n @Prop() public readonly noShift: boolean = false\n\n /**\n * Options to pass to Floating UI's\n * [`offset` middleware](https://floating-ui.com/docs/offset).\n *\n * The [`mainAxis` option](https://floating-ui.com/docs/offset#mainaxis) is\n * not supported.\n *\n * @see https://floating-ui.com/docs/offset#options\n */\n @Prop() public readonly offsetOptions?: OffsetOptions\n\n /**\n * Where to place the tooltip relative to the `target`.\n *\n * @see https://floating-ui.com/docs/tutorial#placements\n */\n @Prop() public readonly placement: Placement = 'top'\n\n /**\n * Options to pass to Floating UI's\n * [`shift` middleware](https://floating-ui.com/docs/shift).\n *\n * @see https://floating-ui.com/docs/shift#options\n */\n @Prop() public readonly shiftOptions?: Partial<\n DetectOverflowOptions & ShiftOptions\n >\n\n /**\n * The CSS position strategy to use.\n *\n * @see https://floating-ui.com/docs/computeposition#strategy\n */\n @Prop() public readonly strategy?: Strategy\n\n /**\n * The trigger element that will trigger the tooltip. The target specified\n * can be any of the follow:\n *\n * - A CSS selector string\n * - A reference to an\n * [`Element`](https://developer.mozilla.org/docs/Web/API/Element) or\n * [Virtual Element](https://floating-ui.com/docs/virtual-elements)\n * - A function returning a reference to an\n * [`Element`](https://developer.mozilla.org/docs/Web/API/Element),\n * [Virtual Element](https://floating-ui.com/docs/virtual-elements),\n * or a CSS selector string\n */\n @Prop() public readonly target!:\n | ReferenceElement\n | string\n | (() => ReferenceElement | string)\n\n /**\n * Emitted when the tooltip is closed.\n */\n @Event({ eventName: 'qdsClose', bubbles: false, cancelable: false })\n private readonly closeEmitter!: EventEmitter<void>\n\n @Element() private readonly element!: HTMLQdsTooltipElement\n\n @State() private hostPosition?: string\n\n @State() private hostTransform?: string\n\n @State() private open = false\n\n @State() private middleware?: Middleware[]\n\n @State() private aDisplay?: string\n\n @State() private side: Side = 'top'\n\n @State() private aShape = ''\n\n @State() private aViewbox = ''\n\n @State() private aHeight = 0\n\n @State() private aWidth = 0\n\n @State() private aGap = 0\n\n @State() private aX = ''\n\n @State() private aY = ''\n\n private arrowContainerElement?: SVGElement\n\n private cleanup?: () => void\n\n private clickedTooltip = false\n\n private isTouchDevice = false\n\n private referenceElement?: ReferenceElement\n\n /**\n * Show the tooltip.\n */\n @Method()\n public async show(): Promise<void> {\n if (this.open) return\n\n if (this.referenceElement instanceof globalThis.Element)\n this.referenceElement.addEventListener('focusout', this.boundFocusout)\n\n this.open = true\n this.element.setAttribute('aria-hidden', 'false')\n this.startAutoUpdate()\n }\n\n /**\n * Close the tooltip.\n */\n @Method()\n public async close(): Promise<void> {\n if (!this.open) return\n\n this.closeEmitter.emit()\n if (this.referenceElement instanceof globalThis.Element)\n this.referenceElement.removeEventListener('focusout', this.boundFocusout)\n\n this.open = false\n this.clickedTooltip = false\n this.element.setAttribute('aria-hidden', 'true')\n if (this.cleanup) this.cleanup()\n }\n\n /**\n * Update the tooltip's arrow.\n *\n * This method should typically be called when the Quartz platform was\n * changed.\n */\n @Method()\n public async updateArrow(): Promise<void> {\n this.aGap = propertyToPx(this.element, '--qds-accessory-gap-floating') ?? 0\n\n this.aHeight =\n propertyToPx(\n this.element,\n `--qds-signature-triangle-pointer-size-height`,\n ) ?? 0\n\n this.aWidth =\n propertyToPx(\n this.element,\n `--qds-signature-triangle-pointer-size-width`,\n ) ?? 0\n\n this.aViewbox = `0 0 ${this.aWidth} ${Math.max(this.aHeight, this.aWidth)}`\n\n const aTipRadius =\n propertyToPx(\n this.element,\n `--qds-signature-triangle-pointer-tip-radius`,\n ) ?? 0\n\n const svgX = (this.aWidth / 2) * (aTipRadius / -8 + 1)\n const svgY = ((this.aHeight / 2) * aTipRadius) / 4\n\n this.aShape =\n 'M0,0' +\n ` H${this.aWidth}` +\n ` L${this.aWidth - svgX},${this.aHeight - svgY}` +\n ` Q${this.aWidth / 2},${this.aHeight} ${svgX},${this.aHeight - svgY}` +\n ' Z'\n }\n\n @Listen('mousedown', { target: 'document' })\n protected async handleMouseDown(event: MouseEvent): Promise<void> {\n const composedPath = event.composedPath()\n const withinBounds =\n composedPath.includes(this.element) ||\n (this.referenceElement instanceof globalThis.Element &&\n composedPath.includes(this.referenceElement))\n if (!withinBounds) await this.close()\n }\n\n @Watch('aGap')\n @Watch('aHeight')\n @Watch('flipOptions')\n @Watch('noFlip')\n @Watch('noShift')\n @Watch('offsetOptions')\n @Watch('shiftOptions')\n protected async updateMiddleware(): Promise<void> {\n invariant(this.arrowContainerElement)\n\n this.middleware = [\n offset({\n ...this.offsetOptions,\n mainAxis: this.aGap + this.aHeight,\n }),\n !this.noFlip &&\n flip({\n crossAxis: this.noShift,\n ...this.flipOptions,\n }),\n !this.noShift &&\n shift({\n limiter: limitShift(),\n ...this.shiftOptions,\n }),\n arrow({\n element: this.arrowContainerElement,\n }),\n ].filter((middleware): middleware is Middleware => middleware !== false)\n }\n\n @Watch('target')\n private async updateReferenceElement(): Promise<void> {\n this.disconnectReferenceElement()\n\n const resolvedTarget =\n typeof this.target === 'function' ? this.target() : this.target\n if (typeof resolvedTarget === 'string') {\n const element = document.querySelector(resolvedTarget)\n if (element === null)\n throw new Error('String `target` must resolve to an Element.')\n this.referenceElement = element\n } else this.referenceElement = resolvedTarget\n\n if (!(this.referenceElement instanceof globalThis.Element)) return\n\n if (this.isTouchDevice)\n this.referenceElement.addEventListener('click', this.boundReferenceClick)\n this.referenceElement.addEventListener('focus', this.boundFocus)\n this.referenceElement.addEventListener('mouseenter', this.boundMouseEnter)\n this.referenceElement.addEventListener('mouseleave', this.boundMouseLeave)\n this.element.id ||= `qds-tooltip-${autoIncrementingId}`\n this.referenceElement.setAttribute('aria-describedby', this.element.id)\n }\n\n @Watch('middleware')\n @Watch('placement')\n @Watch('strategy')\n private async updatePosition(): Promise<void> {\n invariant(this.referenceElement)\n\n const { x, y, middlewareData, placement, strategy } = await computePosition(\n this.referenceElement,\n this.element,\n {\n middleware: this.middleware,\n placement: this.placement,\n strategy: this.strategy,\n },\n )\n this.hostPosition = strategy\n this.hostTransform = `translate(${roundByDPR(x)}px,${roundByDPR(y)}px)`\n\n if (!middlewareData.arrow) return\n\n invariant(this.arrowContainerElement)\n\n if (middlewareData.arrow.centerOffset !== 0) {\n this.aDisplay = 'none'\n return\n }\n this.aDisplay = undefined\n\n const [side] = placement.split('-') as [Side]\n this.side = side\n\n const { x: aX, y: aY } = middlewareData.arrow\n\n this.aX = aX === undefined ? '' : `${aX}px`\n this.aY = aY === undefined ? '' : `${aY}px`\n }\n\n @Watch('autoUpdateOptions')\n private startAutoUpdate(): void {\n invariant(this.referenceElement)\n\n if (this.cleanup) this.cleanup()\n this.cleanup = autoUpdate(\n this.referenceElement,\n this.element,\n () => {\n ignorePromise(this.updatePosition())\n },\n this.autoUpdateOptions,\n )\n }\n\n public async componentWillLoad(): Promise<void> {\n this.isTouchDevice = isTouchDevice()\n this.element.setAttribute('aria-hidden', 'true')\n await this.updateReferenceElement()\n autoIncrementingId += 1\n }\n\n public async componentDidLoad(): Promise<void> {\n await this.updateArrow()\n }\n\n public disconnectedCallback(): void {\n this.disconnectReferenceElement()\n }\n\n public render() {\n return (\n <Host\n data-side={this.side}\n onFocusout={this.boundFocusout}\n onMouseDown={this.boundTooltipMouseDown}\n onMouseLeave={this.boundMouseLeave}\n role={this.element.role ?? 'tooltip'}\n style={{\n position: this.hostPosition,\n transform: this.hostTransform,\n }}\n >\n <slot />\n <svg\n aria-hidden\n data-side={this.side}\n class=\"arrow-container\"\n ref={this.arrowContainerRef}\n viewBox={this.aViewbox}\n style={{\n left: this.aX,\n top: this.aY,\n display: this.aDisplay,\n }}\n >\n <path class=\"arrow\" d={this.aShape} />\n </svg>\n </Host>\n )\n }\n\n private readonly arrowContainerRef = (svg?: SVGElement): void => {\n this.arrowContainerElement = svg\n }\n\n private readonly boundTooltipMouseDown = (): void => {\n this.clickedTooltip = true\n }\n\n private async handleFocus(): Promise<void> {\n if (!this.disabled) await this.show()\n }\n\n private readonly boundFocus = (): void => {\n ignorePromise(this.handleFocus())\n }\n\n private async handleMouseEnter(): Promise<void> {\n if (!this.disabled) await this.show()\n }\n\n private readonly boundMouseEnter = (): void => {\n ignorePromise(this.handleMouseEnter())\n }\n\n private async handleMouseLeave(event: Event): Promise<void> {\n if (\n !this.clickedTooltip &&\n document.activeElement !== this.referenceElement &&\n document.activeElement?.closest('qds-tooltip') !== this.element &&\n event instanceof MouseEvent &&\n event.relatedTarget !== this.referenceElement &&\n event.relatedTarget !== this.element\n )\n await this.close()\n }\n\n private readonly boundMouseLeave = (event: Event): void => {\n ignorePromise(this.handleMouseLeave(event))\n }\n\n private async handleFocusOut(event: Event): Promise<void> {\n if (!(event instanceof FocusEvent)) return\n const { relatedTarget } = event\n\n if (\n relatedTarget instanceof globalThis.Element &&\n !this.element.contains(relatedTarget) &&\n this.referenceElement !== relatedTarget\n )\n await this.close()\n }\n\n private readonly boundFocusout = (event: Event): void => {\n ignorePromise(this.handleFocusOut(event))\n }\n\n private async handleReferenceClick(): Promise<void> {\n if (!this.disabled) await (this.open ? this.close() : this.show())\n }\n\n private readonly boundReferenceClick = (): void => {\n ignorePromise(this.handleReferenceClick())\n }\n\n private disconnectReferenceElement(): void {\n if (!(this.referenceElement instanceof globalThis.Element)) return\n\n if (this.isTouchDevice)\n this.referenceElement.removeEventListener(\n 'click',\n this.boundReferenceClick,\n )\n this.referenceElement.removeEventListener('focus', this.boundFocus)\n this.referenceElement.removeEventListener('focusout', this.boundFocusout)\n this.referenceElement.removeEventListener(\n 'mouseenter',\n this.boundMouseEnter,\n )\n this.referenceElement.removeEventListener(\n 'mouseleave',\n this.boundMouseLeave,\n )\n this.referenceElement.removeAttribute('aria-describedby')\n }\n}\n"],"version":3}
|
package/dist/esm/qds.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: © 2023 Schneider Electric
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: LGPL-2.1-only
|
|
5
|
+
*/
|
|
6
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-1bc8e218.js';
|
|
7
|
+
export { s as setNonce } from './index-1bc8e218.js';
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
Stencil Client Patch Browser v3.2.2 | MIT Licensed | https://stenciljs.com
|
|
11
|
+
*/
|
|
12
|
+
const patchBrowser = () => {
|
|
13
|
+
const importMeta = import.meta.url;
|
|
14
|
+
const opts = {};
|
|
15
|
+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
|
|
16
|
+
if (importMeta !== '') {
|
|
17
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
18
|
+
// TODO(STENCIL-661): Remove code related to the dynamic import shim
|
|
19
|
+
// TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
|
|
20
|
+
}
|
|
21
|
+
return promiseResolve(opts);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
patchBrowser().then(options => {
|
|
25
|
+
return bootstrapLazy([["qds-icon",[[1,"qds-icon",{"name":[513],"library":[513],"svg":[32]}]]],["qds-checkbox",[[2,"qds-checkbox",{"inline":[4],"size":[513],"text":[1537],"autoFocus":[4,"autofocus"],"checked":[1540],"disabled":[1540],"form":[1],"indeterminate":[1540],"name":[1],"required":[4],"value":[1032],"checkValidity":[64],"reportValidity":[64],"setCustomValidity":[64]},[[0,"click","onClick"]]]]],["qds-radio",[[2,"qds-radio",{"inline":[4],"size":[513],"text":[1537],"checked":[1540],"disabled":[1540],"form":[1],"name":[1],"required":[4],"value":[1032]},[[0,"click","onClick"]]]]],["qds-switch",[[2,"qds-switch",{"inline":[4],"iconCheckedName":[513,"icon-checked-name"],"iconCheckedLibrary":[513,"icon-checked-library"],"iconUncheckedName":[513,"icon-unchecked-name"],"iconUncheckedLibrary":[513,"icon-unchecked-library"],"size":[513],"textChecked":[1537,"text-checked"],"textUnchecked":[1537,"text-unchecked"],"autoFocus":[4,"autofocus"],"checked":[1540],"disabled":[1540],"form":[1],"name":[1],"value":[1032]},[[0,"click","onClick"]]]]],["qds-button",[[17,"qds-button",{"iconName":[513,"icon-name"],"iconLibrary":[513,"icon-library"],"importance":[513],"size":[513],"text":[1537],"disabled":[1540],"download":[1],"form":[1],"formAction":[1,"formaction"],"formMethod":[1,"formmethod"],"formNoValidate":[4,"formnovalidate"],"formTarget":[1,"formtarget"],"href":[1],"name":[1],"target":[1],"type":[1],"value":[1]}]]],["qds-inline-link",[[17,"qds-inline-link",{"disabled":[1540],"download":[8],"href":[1],"hreflang":[1],"referrerPolicy":[1,"referrerpolicy"],"rel":[1],"target":[1]},[[0,"click","onClick"]]]]],["qds-title",[[1,"qds-title",{"iconName":[513,"icon-name"],"iconLibrary":[513,"icon-library"],"kicker":[1],"layer":[1],"level":[1],"subtitle":[1],"tag":[1]}]]],["qds-dropdown",[[1,"qds-dropdown",{"autoUpdateOptions":[16],"disabled":[1028],"flipOptions":[16],"noFlip":[4,"no-flip"],"noShift":[4,"no-shift"],"offsetOptions":[16],"placement":[1],"shiftOptions":[16],"strategy":[1],"target":[1],"hostAriaLabelledBy":[32],"hostDisplay":[32],"hostPosition":[32],"hostTransform":[32],"show":[64],"close":[64],"update":[64]},[[4,"click","handleMouseDown"]]]]],["qds-input",[[2,"qds-input",{"invalid":[1540],"size":[513],"autoCapitalize":[1,"autocapitalize"],"autoComplete":[1,"autocomplete"],"autoFocus":[4,"autofocus"],"disabled":[1540],"enterkeyhint":[1],"form":[1],"inputmode":[1],"max":[8],"maxLength":[2,"maxlength"],"min":[8],"minLength":[2,"minlength"],"multiple":[4],"name":[1],"pattern":[1],"placeholder":[1],"readOnly":[4,"readonly"],"required":[4],"spellCheck":[4,"spellcheck"],"step":[8],"type":[1],"value":[1032],"reportValidity":[64],"select":[64],"setCustomValidity":[64],"setRangeText":[64],"setSelectionRange":[64],"stepDown":[64],"stepUp":[64]}]]],["qds-tooltip",[[1,"qds-tooltip",{"autoUpdateOptions":[16],"disabled":[1028],"flipOptions":[16],"noFlip":[4,"no-flip"],"noShift":[4,"no-shift"],"offsetOptions":[16],"placement":[1],"shiftOptions":[16],"strategy":[1],"target":[1],"hostPosition":[32],"hostTransform":[32],"open":[32],"middleware":[32],"aDisplay":[32],"side":[32],"aShape":[32],"aViewbox":[32],"aHeight":[32],"aWidth":[32],"aGap":[32],"aX":[32],"aY":[32],"show":[64],"close":[64],"updateArrow":[64]},[[5,"mousedown","handleMouseDown"]]]]],["qds-label",[[1,"qds-label",{"inline":[4],"required":[4],"size":[513],"text":[513]}]]]], options);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=qds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"qds.js","mappings":";;;;;;;;AAAA;AACA;AACA;AAiBA,MAAM,YAAY,GAAG,MAAM;AAkC3B,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AACvC,IAAI,MAAM,IAAI,GAAiE,EAAE,CAAC;AAgBlF;AACA,IAAI,IAAuB,UAAU,KAAK,EAAE,EAAE;AAC9C,QAAQ,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC;AAC1D;AACA;AACA,KAaK;AACL,IAAI,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;;ACtFD,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,IAAI;AAE/B,EAAE,OAAO,aAAa,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC,CAAC","names":[],"sources":["../../node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v3.2.2 | MIT Licensed | https://stenciljs.com\n */\nimport { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';\nimport { consoleDevInfo, plt, win, doc, promiseResolve, H } from '@stencil/core';\n/**\n * Helper method for querying a `meta` tag that contains a nonce value\n * out of a DOM's head.\n *\n * @param doc The DOM containing the `head` to query against\n * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag\n * exists or the tag has no content.\n */\nfunction queryNonceMetaTagContent(doc) {\n var _a, _b, _c;\n return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name=\"csp-nonce\"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;\n}\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\\s|-/g, '_')}`;\nconst patchBrowser = () => {\n // NOTE!! This fn cannot use async/await!\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo('Running in development mode.');\n }\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n if (BUILD.cssVarShim) {\n // shim css vars\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n plt.$cssShim$ = win.__cssshim;\n }\n if (BUILD.cloneNodeFix) {\n // opted-in to polyfill cloneNode() for slot polyfilled components\n patchCloneNodeFix(H.prototype);\n }\n if (BUILD.profile && !performance.mark) {\n // not all browsers support performance.mark/measure (Safari 10)\n // because the mark/measure APIs are designed to write entries to a buffer in the browser that does not exist,\n // simply stub the implementations out.\n // TODO(STENCIL-323): Remove this patch when support for older browsers is removed (breaking)\n // @ts-ignore\n performance.mark = performance.measure = () => {\n /*noop*/\n };\n performance.getEntriesByName = () => [];\n }\n // @ts-ignore\n const scriptElm = \n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim\n ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\\/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) ||\n s.getAttribute('data-stencil-namespace') === NAMESPACE)\n : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {\n // Safari < v11 support: This IF is true if it's Safari below v11.\n // This fn cannot use async/await since Safari didn't support it until v11,\n // however, Safari 10 did support modules. Safari 10 also didn't support \"nomodule\",\n // so both the ESM file and nomodule file would get downloaded. Only Safari\n // has 'onbeforeload' in the script, and \"history.scrollRestoration\" was added\n // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.\n // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.\n return {\n then() {\n /* promise noop */\n },\n };\n }\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (!BUILD.safari10 && importMeta !== '') {\n opts.resourcesUrl = new URL('.', importMeta).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n }\n else if (BUILD.dynamicImportShim || BUILD.safari10) {\n opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim) {\n patchDynamicImport(opts.resourcesUrl, scriptElm);\n }\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim && !win.customElements) {\n // module support, but no custom elements support (Old Edge)\n // @ts-ignore\n return import(/* webpackChunkName: \"polyfills-dom\" */ './dom.js').then(() => opts);\n }\n }\n return promiseResolve(opts);\n};\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst patchDynamicImport = (base, orgScriptElm) => {\n const importFunctionName = getDynamicImportFunction(NAMESPACE);\n try {\n // test if this browser supports dynamic imports\n // There is a caching issue in V8, that breaks using import() in Function\n // By generating a random string, we can workaround it\n // Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info\n win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);\n }\n catch (e) {\n // this shim is specifically for browsers that do support \"esm\" imports\n // however, they do NOT support \"dynamic\" imports\n // basically this code is for old Edge, v18 and below\n const moduleMap = new Map();\n win[importFunctionName] = (src) => {\n var _a;\n const url = new URL(src, base).href;\n let mod = moduleMap.get(url);\n if (!mod) {\n const script = doc.createElement('script');\n script.type = 'module';\n script.crossOrigin = orgScriptElm.crossOrigin;\n script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {\n type: 'application/javascript',\n }));\n // Apply CSP nonce to the script tag if it exists\n const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);\n if (nonce != null) {\n script.setAttribute('nonce', nonce);\n }\n mod = new Promise((resolve) => {\n script.onload = () => {\n resolve(win[importFunctionName].m);\n script.remove();\n };\n });\n moduleMap.set(url, mod);\n doc.head.appendChild(script);\n }\n return mod;\n };\n }\n};\nconst patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function (deep) {\n if (this.nodeName === 'TEMPLATE') {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n // Node.ATTRIBUTE_NODE === 2, and checking because IE11\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport { patchBrowser };\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(options => {\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"version":3}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import type { ComponentInterface } from '../../stencil-public-runtime';
|
|
2
|
+
import type { LiteralUnion } from 'type-fest';
|
|
3
|
+
export type ButtonType = 'button' | 'reset' | 'submit';
|
|
4
|
+
export type Importance = 'destructive' | 'emphasized' | 'standard' | 'subdued';
|
|
5
|
+
export type ButtonSize = 'large' | 'small' | 'standard';
|
|
6
|
+
export type FormMethod = 'get' | 'post';
|
|
7
|
+
export type ButtonTarget = '_blank' | '_parent' | '_self' | '_top';
|
|
8
|
+
/**
|
|
9
|
+
* The `<qds-button>` element is an interactive element activated by a user
|
|
10
|
+
* with a mouse, keyboard, finger, voice command, or other assistive technology.
|
|
11
|
+
* Once activated, it then performs a programmable action, such as submitting a
|
|
12
|
+
* [form](https://developer.mozilla.org/docs/Learn/Forms)
|
|
13
|
+
* or opening a dialog.
|
|
14
|
+
*
|
|
15
|
+
* @see https://quartz.se.com/build/components/button
|
|
16
|
+
*/
|
|
17
|
+
export declare class Button implements ComponentInterface {
|
|
18
|
+
/**
|
|
19
|
+
* The name of the icon to render.
|
|
20
|
+
*
|
|
21
|
+
* Available names depend on the icon library being used.
|
|
22
|
+
*/
|
|
23
|
+
readonly iconName?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The name of a registered icon library.
|
|
26
|
+
*/
|
|
27
|
+
readonly iconLibrary: string;
|
|
28
|
+
/**
|
|
29
|
+
* The button's importance.
|
|
30
|
+
*/
|
|
31
|
+
readonly importance: Importance;
|
|
32
|
+
/**
|
|
33
|
+
* The button's size.
|
|
34
|
+
*/
|
|
35
|
+
readonly size: ButtonSize;
|
|
36
|
+
/**
|
|
37
|
+
* The button's text.
|
|
38
|
+
*/
|
|
39
|
+
readonly text?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Prevents the button from being interacted with: it cannot be pressed or
|
|
42
|
+
* focused.
|
|
43
|
+
*
|
|
44
|
+
* @webnative
|
|
45
|
+
*/
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Tells the browser to download the linked file as this filename. Only used
|
|
49
|
+
* when `href` is set.
|
|
50
|
+
*
|
|
51
|
+
* @webnative
|
|
52
|
+
*/
|
|
53
|
+
readonly download?: string;
|
|
54
|
+
/**
|
|
55
|
+
* The [`<form>`](https://developer.mozilla.org/docs/Web/HTML/Element/form)
|
|
56
|
+
* element to associate the button with (its form owner).
|
|
57
|
+
*
|
|
58
|
+
* The value of this attribute must be the id of a `<form>` in the same
|
|
59
|
+
* document. If this attribute is not set, the `<button>` is associated with
|
|
60
|
+
* its ancestor `<form>` element, if any.
|
|
61
|
+
*
|
|
62
|
+
* This attribute lets you associate `<button>` elements to `<form>`s
|
|
63
|
+
* anywhere in the document, not just inside a `<form>`. It can also override
|
|
64
|
+
* an ancestor `<form>` element.
|
|
65
|
+
*
|
|
66
|
+
* @webnative
|
|
67
|
+
*/
|
|
68
|
+
readonly form?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The URL that processes the information submitted by the button. Overrides
|
|
71
|
+
* the [`action`](https://developer.mozilla.org/docs/Web/HTML/Element/button#attr-formaction)
|
|
72
|
+
* attribute of the button's form owner. Does nothing if there is no form owner.
|
|
73
|
+
*
|
|
74
|
+
* @webnative
|
|
75
|
+
*/
|
|
76
|
+
readonly formAction?: string;
|
|
77
|
+
/**
|
|
78
|
+
* If the button is a submit button (it's inside/associated with a `<form>`
|
|
79
|
+
* and doesn't have `type="button"`), this attribute specifies the
|
|
80
|
+
* [HTTP method](https://developer.mozilla.org/docs/Web/HTTP/Methods) used to
|
|
81
|
+
* submit the form. Possible values:
|
|
82
|
+
*
|
|
83
|
+
* - `get`: The form data are appended to the form's action URL, with a ? as
|
|
84
|
+
* a separator, and the resulting URL is sent to the server. Use this method
|
|
85
|
+
* when the form has no side effects, like search forms.
|
|
86
|
+
* - `post`: The data from the form are included in the body of the HTTP
|
|
87
|
+
* request when sent to the server. Use when the form contains information
|
|
88
|
+
* that shouldn't be public, like login credentials.
|
|
89
|
+
*
|
|
90
|
+
* If specified, this attribute overrides the method attribute of the button's form owner.
|
|
91
|
+
*
|
|
92
|
+
* @webnative
|
|
93
|
+
*/
|
|
94
|
+
readonly formMethod?: FormMethod;
|
|
95
|
+
/**
|
|
96
|
+
* If the button is a submit button, this attribute specifies that the form
|
|
97
|
+
* is not to be
|
|
98
|
+
* [validated](https://developer.mozilla.org/docs/Learn/Forms/Form_validation)
|
|
99
|
+
* when it is submitted. If this attribute is specified, it overrides the
|
|
100
|
+
* [`novalidate`](https://developer.mozilla.org/docs/Web/HTML/Element/form#attr-novalidate)
|
|
101
|
+
* attribute of the button's form owner.
|
|
102
|
+
*
|
|
103
|
+
* @webnative
|
|
104
|
+
*/
|
|
105
|
+
readonly formNoValidate: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* If the button is a submit button, this attribute is an author-defined name
|
|
108
|
+
* or standardized, underscore-prefixed keyword indicating where to display
|
|
109
|
+
* the response from submitting the form. This is the `name` of, or keyword
|
|
110
|
+
* for, a browsing context (a tab, window, or
|
|
111
|
+
* [`<iframe>`](https://developer.mozilla.org/docs/Web/HTML/Element/iframe)).
|
|
112
|
+
* If this attribute is specified, it overrides the
|
|
113
|
+
* [`target`](https://developer.mozilla.org/docs/Web/HTML/Element/form#attr-target)
|
|
114
|
+
* attribute of the button's form owner. The following keywords have special
|
|
115
|
+
* meanings:
|
|
116
|
+
*
|
|
117
|
+
* - `_blank`: Load the response into a new unnamed browsing context — usually
|
|
118
|
+
* a new tab or window, depending on the user's browser settings.
|
|
119
|
+
* - `_parent`: Load the response into the parent browsing context of the
|
|
120
|
+
* current one. If there is no parent, this option behaves the same way as
|
|
121
|
+
* `_self`.
|
|
122
|
+
* - `_self`: Load the response into the same browsing context as the current
|
|
123
|
+
* one.
|
|
124
|
+
* - `_top`: Load the response into the top-level browsing context (that is,
|
|
125
|
+
* the browsing context that is an ancestor of the current one, and has no
|
|
126
|
+
* parent). If there is no parent, this option behaves the same way as
|
|
127
|
+
* `_self`.
|
|
128
|
+
*
|
|
129
|
+
* @webnative
|
|
130
|
+
*/
|
|
131
|
+
readonly formTarget: LiteralUnion<ButtonTarget, string>;
|
|
132
|
+
/**
|
|
133
|
+
* When set, the underlying button will be rendered as an `<a>` with this
|
|
134
|
+
* `href` instead of a `<button>`.
|
|
135
|
+
*
|
|
136
|
+
* @webnative
|
|
137
|
+
*/
|
|
138
|
+
readonly href?: string;
|
|
139
|
+
/**
|
|
140
|
+
* The name of the button, submitted as a pair with the button's `value` as
|
|
141
|
+
* part of the form data, when that button is used to submit the form.
|
|
142
|
+
* Ignored when `href` is set.
|
|
143
|
+
*
|
|
144
|
+
* @webnative
|
|
145
|
+
*/
|
|
146
|
+
readonly name?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Where to display the linked URL, as the name for a browsing context (a
|
|
149
|
+
* tab, window, or
|
|
150
|
+
* [`<iframe>`](https://developer.mozilla.org/docs/Web/HTML/Element/iframe).
|
|
151
|
+
* The following keywords have special meanings for where to load the URL:
|
|
152
|
+
*
|
|
153
|
+
* - `_blank`: usually a new tab, but users can configure browsers to open a new
|
|
154
|
+
* window instead.
|
|
155
|
+
* - `_parent`: the parent browsing context of the current one. If no parent,
|
|
156
|
+
* behaves as `_self`.
|
|
157
|
+
* - `_self`: the current browsing context.
|
|
158
|
+
* - `_top`: the topmost browsing context (the "highest" context that's an
|
|
159
|
+
* ancestor of the current one). If no ancestors, behaves as `_self`.
|
|
160
|
+
*
|
|
161
|
+
* @webnative
|
|
162
|
+
*/
|
|
163
|
+
readonly target: LiteralUnion<ButtonTarget, string>;
|
|
164
|
+
/**
|
|
165
|
+
* The type of button.
|
|
166
|
+
*
|
|
167
|
+
* `button`: The button has no default behavior, and does nothing when
|
|
168
|
+
* pressed by default. It can have client-side scripts listen to the
|
|
169
|
+
* element's events, which are triggered when the events occur.
|
|
170
|
+
*
|
|
171
|
+
* `submit`: The button submits the form data to the server. This is the
|
|
172
|
+
* default if the attribute is not specified for buttons associated with a
|
|
173
|
+
* `<form>`, or if the attribute is an empty or invalid value.
|
|
174
|
+
*
|
|
175
|
+
* `reset`: The button resets all the controls to their initial values.
|
|
176
|
+
*
|
|
177
|
+
* @webnative
|
|
178
|
+
*/
|
|
179
|
+
readonly type?: ButtonType;
|
|
180
|
+
/**
|
|
181
|
+
* Defines the value associated with the button's `name` when it's submitted
|
|
182
|
+
* with the form data. This value is passed to the server in params when the
|
|
183
|
+
* form is submitted using this button. Ignored when `href` is set.
|
|
184
|
+
*
|
|
185
|
+
* @webnative
|
|
186
|
+
*/
|
|
187
|
+
readonly value?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Emitted when the button loses focus.
|
|
190
|
+
*/
|
|
191
|
+
private readonly blurEmitter;
|
|
192
|
+
/**
|
|
193
|
+
* Emitted when the button gains focus.
|
|
194
|
+
*/
|
|
195
|
+
private readonly focusEmitter;
|
|
196
|
+
private readonly element;
|
|
197
|
+
private inheritedAttributes;
|
|
198
|
+
private get formElement();
|
|
199
|
+
private get buttonType();
|
|
200
|
+
private get iconOnly();
|
|
201
|
+
private get computedDisabled();
|
|
202
|
+
private get computedTabIndex();
|
|
203
|
+
componentWillLoad(): void;
|
|
204
|
+
render(): any;
|
|
205
|
+
private readonly onClick;
|
|
206
|
+
private readonly onBlur;
|
|
207
|
+
private readonly onFocus;
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=button.d.ts.map
|