@quartzds/core 1.0.0-beta.113 → 1.0.0-beta.115
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/CHANGELOG.md +50 -0
- package/components/index.d.ts +2 -2
- package/components/index.js +2 -2
- package/components/{p-CB1GgGmx.js → p--vOFwWP9.js} +4 -4
- package/components/{p-CB1GgGmx.js.map → p--vOFwWP9.js.map} +1 -1
- package/{dist/esm/helpers-CDZIefsI.js → components/p-Bs-thw7N.js} +24 -8
- package/components/{p-CzJQDr3N.js.map → p-Bs-thw7N.js.map} +1 -1
- package/components/{p-9fm05BrQ.js → p-D6kEwmWw.js} +16 -9
- package/components/p-D6kEwmWw.js.map +1 -0
- package/components/{p-jzP-octC.js → p-DG13nyez.js} +13 -13
- package/components/p-DG13nyez.js.map +1 -0
- package/components/{p-oYV2Vg_F.js → p-DHsQa63F.js} +6 -6
- package/components/{p-oYV2Vg_F.js.map → p-DHsQa63F.js.map} +1 -1
- package/components/{p-GGIVf4ry.js → p-DQ0iArwG.js} +12 -12
- package/components/p-DQ0iArwG.js.map +1 -0
- package/components/{p-Cin_uEzc.js → p-DRvYbv4e.js} +6 -6
- package/components/{p-Cin_uEzc.js.map → p-DRvYbv4e.js.map} +1 -1
- package/components/p-DabDNFFa.js +112 -0
- package/components/p-DabDNFFa.js.map +1 -0
- package/components/{p-CPvTGxdE.js → p-DeLdhUte.js} +9 -9
- package/components/p-DeLdhUte.js.map +1 -0
- package/components/{p-CK_Yxg3A.js → p-Df4zqimN.js} +11 -9
- package/components/p-Df4zqimN.js.map +1 -0
- package/components/{p-Dqnx5weA.js → p-Dmky30vp.js} +3 -3
- package/components/{p-Dqnx5weA.js.map → p-Dmky30vp.js.map} +1 -1
- package/components/{p-CSR3ZAEX.js → p-I5PkZmy8.js} +4 -4
- package/components/{p-CSR3ZAEX.js.map → p-I5PkZmy8.js.map} +1 -1
- package/components/qds-action-item.js +7 -7
- package/components/qds-action-item.js.map +1 -1
- package/components/{qds-nav-list-item.d.ts → qds-avatar-media.d.ts} +4 -4
- package/components/qds-avatar-media.js +14 -0
- package/components/qds-avatar-media.js.map +1 -0
- package/components/qds-breadcrumb-item.js +7 -7
- package/components/qds-breadcrumb-item.js.map +1 -1
- package/components/qds-button.js +1 -1
- package/components/qds-checkbox.js +1 -1
- package/components/qds-chip.js +11 -11
- package/components/qds-chip.js.map +1 -1
- package/components/qds-dialog.js +26 -7
- package/components/qds-dialog.js.map +1 -1
- package/components/qds-dropdown.js +1 -1
- package/components/qds-form-message.js +5 -5
- package/components/qds-form-message.js.map +1 -1
- package/components/qds-icon-button.js +10 -8
- package/components/qds-icon-button.js.map +1 -1
- package/components/qds-icon.js +1 -1
- package/components/qds-inline-link.js +43 -13
- package/components/qds-inline-link.js.map +1 -1
- package/components/qds-input.js +6 -6
- package/components/qds-label.js +1 -1
- package/components/qds-list-item.js +22 -16
- package/components/qds-list-item.js.map +1 -1
- package/components/qds-loader.js +3 -3
- package/components/qds-loader.js.map +1 -1
- package/components/qds-menu-item.js +9 -9
- package/components/qds-menu-item.js.map +1 -1
- package/components/qds-mini-button.js +1 -1
- package/components/qds-progress-bar.js +1 -1
- package/components/qds-radio.js +1 -1
- package/components/qds-select.js +5 -5
- package/components/qds-standalone-link.js +43 -13
- package/components/qds-standalone-link.js.map +1 -1
- package/components/qds-switch.js +5 -5
- package/components/qds-tab.js +11 -11
- package/components/qds-tab.js.map +1 -1
- package/components/qds-tabbar.js +8 -8
- package/components/qds-table-cell.js +2 -2
- package/components/qds-table-head-cell.js +2 -2
- package/components/qds-table-row.js +1 -1
- package/components/qds-table.js +1 -1
- package/components/qds-tag.js +1 -1
- package/components/qds-textarea.js +3 -3
- package/components/qds-title.js +1 -1
- package/components/qds-tooltip.js +1 -1
- package/dist/cjs/{helpers-D--0PcCT.js → helpers-BH_NFaV-.js} +24 -8
- package/dist/cjs/helpers-BH_NFaV-.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/{library-CF8K3bIq.js → library-C_NJJiFI.js} +15 -8
- package/dist/cjs/library-C_NJJiFI.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/qds-action-item.cjs.entry.js +5 -5
- package/dist/cjs/qds-action-item.entry.cjs.js.map +1 -1
- package/dist/cjs/qds-avatar-media.qds-checkbox.qds-radio.entry.cjs.js.map +1 -0
- package/dist/cjs/{qds-checkbox_2.cjs.entry.js → qds-avatar-media_3.cjs.entry.js} +79 -8
- package/dist/cjs/qds-breadcrumb-item.cjs.entry.js +5 -5
- package/dist/cjs/qds-breadcrumb-item.entry.cjs.js.map +1 -1
- package/dist/cjs/qds-button.cjs.entry.js +8 -8
- package/dist/cjs/qds-button.entry.cjs.js.map +1 -1
- package/dist/cjs/qds-chip.cjs.entry.js +8 -8
- package/dist/cjs/qds-chip.entry.cjs.js.map +1 -1
- package/dist/cjs/qds-dialog.cjs.entry.js +23 -4
- package/dist/cjs/qds-dialog.entry.cjs.js.map +1 -1
- package/dist/cjs/qds-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/qds-form-message.cjs.entry.js +4 -4
- package/dist/cjs/qds-form-message.entry.cjs.js.map +1 -1
- package/dist/cjs/qds-icon-button.cjs.entry.js +8 -6
- package/dist/cjs/qds-icon-button.entry.cjs.js.map +1 -1
- package/dist/cjs/qds-icon.cjs.entry.js +2 -2
- package/dist/cjs/qds-inline-link.cjs.entry.js +39 -8
- package/dist/cjs/qds-inline-link.entry.cjs.js.map +1 -1
- package/dist/cjs/qds-input.cjs.entry.js +4 -4
- package/dist/cjs/qds-label.cjs.entry.js +9 -9
- package/dist/cjs/qds-label.entry.cjs.js.map +1 -1
- package/dist/cjs/qds-list-item.cjs.entry.js +10 -10
- package/dist/cjs/qds-list-item.entry.cjs.js.map +1 -1
- package/dist/cjs/qds-loader.cjs.entry.js +2 -2
- package/dist/cjs/qds-loader.entry.cjs.js.map +1 -1
- package/dist/cjs/qds-menu-item.cjs.entry.js +6 -6
- package/dist/cjs/qds-menu-item.entry.cjs.js.map +1 -1
- package/dist/cjs/qds-mini-button.cjs.entry.js +1 -1
- package/dist/cjs/qds-progress-bar.cjs.entry.js +1 -1
- package/dist/cjs/qds-select.cjs.entry.js +4 -4
- package/dist/cjs/qds-standalone-link.cjs.entry.js +39 -8
- package/dist/cjs/qds-standalone-link.entry.cjs.js.map +1 -1
- package/dist/cjs/qds-switch.cjs.entry.js +4 -4
- package/dist/cjs/qds-tab.cjs.entry.js +7 -7
- package/dist/cjs/qds-tab.entry.cjs.js.map +1 -1
- package/dist/cjs/qds-tabbar.cjs.entry.js +5 -5
- package/dist/cjs/qds-table-cell.cjs.entry.js +2 -2
- package/dist/cjs/qds-table-head-cell.cjs.entry.js +2 -2
- package/dist/cjs/qds-table-row.cjs.entry.js +1 -1
- package/dist/cjs/qds-table.cjs.entry.js +1 -1
- package/dist/cjs/qds-tag_2.cjs.entry.js +6 -6
- package/dist/cjs/qds-textarea.cjs.entry.js +3 -3
- package/dist/cjs/qds-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/qds.cjs.js +1 -1
- package/dist/custom-elements.json +311 -367
- package/dist/docs.json +223 -331
- package/{components/p-CzJQDr3N.js → dist/esm/helpers-t9FQ7Vl_.js} +24 -8
- package/dist/esm/helpers-t9FQ7Vl_.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/{library-B2PJ_ZJB.js → library-C7n28y3j.js} +15 -8
- package/dist/esm/library-C7n28y3j.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/qds-action-item.entry.js +5 -5
- package/dist/esm/qds-action-item.entry.js.map +1 -1
- package/dist/esm/qds-avatar-media.qds-checkbox.qds-radio.entry.js.map +1 -0
- package/dist/esm/{qds-checkbox_2.entry.js → qds-avatar-media_3.entry.js} +79 -9
- package/dist/esm/qds-breadcrumb-item.entry.js +5 -5
- package/dist/esm/qds-breadcrumb-item.entry.js.map +1 -1
- package/dist/esm/qds-button.entry.js +8 -8
- package/dist/esm/qds-button.entry.js.map +1 -1
- package/dist/esm/qds-chip.entry.js +8 -8
- package/dist/esm/qds-chip.entry.js.map +1 -1
- package/dist/esm/qds-dialog.entry.js +23 -4
- package/dist/esm/qds-dialog.entry.js.map +1 -1
- package/dist/esm/qds-dropdown.entry.js +1 -1
- package/dist/esm/qds-form-message.entry.js +4 -4
- package/dist/esm/qds-form-message.entry.js.map +1 -1
- package/dist/esm/qds-icon-button.entry.js +8 -6
- package/dist/esm/qds-icon-button.entry.js.map +1 -1
- package/dist/esm/qds-icon.entry.js +2 -2
- package/dist/esm/qds-inline-link.entry.js +39 -8
- package/dist/esm/qds-inline-link.entry.js.map +1 -1
- package/dist/esm/qds-input.entry.js +4 -4
- package/dist/esm/qds-label.entry.js +9 -9
- package/dist/esm/qds-label.entry.js.map +1 -1
- package/dist/esm/qds-list-item.entry.js +10 -10
- package/dist/esm/qds-list-item.entry.js.map +1 -1
- package/dist/esm/qds-loader.entry.js +2 -2
- package/dist/esm/qds-loader.entry.js.map +1 -1
- package/dist/esm/qds-menu-item.entry.js +6 -6
- package/dist/esm/qds-menu-item.entry.js.map +1 -1
- package/dist/esm/qds-mini-button.entry.js +1 -1
- package/dist/esm/qds-progress-bar.entry.js +1 -1
- package/dist/esm/qds-select.entry.js +4 -4
- package/dist/esm/qds-standalone-link.entry.js +39 -8
- package/dist/esm/qds-standalone-link.entry.js.map +1 -1
- package/dist/esm/qds-switch.entry.js +4 -4
- package/dist/esm/qds-tab.entry.js +7 -7
- package/dist/esm/qds-tab.entry.js.map +1 -1
- package/dist/esm/qds-tabbar.entry.js +5 -5
- package/dist/esm/qds-table-cell.entry.js +2 -2
- package/dist/esm/qds-table-head-cell.entry.js +2 -2
- package/dist/esm/qds-table-row.entry.js +1 -1
- package/dist/esm/qds-table.entry.js +1 -1
- package/dist/esm/qds-tag_2.entry.js +6 -6
- package/dist/esm/qds-textarea.entry.js +3 -3
- package/dist/esm/qds-tooltip.entry.js +2 -2
- package/dist/esm/qds.js +1 -1
- package/dist/types/components/avatar-media/avatar-media.d.ts +39 -0
- package/dist/types/components/icon-button/icon-button.d.ts +1 -1
- package/dist/types/components/inline-link/inline-link.d.ts +1 -1
- package/dist/types/components/label/label.d.ts +1 -1
- package/dist/types/components/standalone-link/standalone-link.d.ts +1 -1
- package/dist/types/components.d.ts +94 -125
- package/dist/types/helpers.d.ts +3 -3
- package/dist/vscode.html-custom-data.json +29 -52
- package/hydrate/index.js +694 -632
- package/hydrate/index.mjs +694 -632
- package/package.json +1 -1
- package/components/p-9fm05BrQ.js.map +0 -1
- package/components/p-CK_Yxg3A.js.map +0 -1
- package/components/p-CPvTGxdE.js.map +0 -1
- package/components/p-GGIVf4ry.js.map +0 -1
- package/components/p-jzP-octC.js.map +0 -1
- package/components/qds-nav-list-item.js +0 -164
- package/components/qds-nav-list-item.js.map +0 -1
- package/dist/cjs/helpers-D--0PcCT.js.map +0 -1
- package/dist/cjs/library-CF8K3bIq.js.map +0 -1
- package/dist/cjs/qds-checkbox.qds-radio.entry.cjs.js.map +0 -1
- package/dist/cjs/qds-nav-list-item.cjs.entry.js +0 -120
- package/dist/cjs/qds-nav-list-item.entry.cjs.js.map +0 -1
- package/dist/esm/helpers-CDZIefsI.js.map +0 -1
- package/dist/esm/library-B2PJ_ZJB.js.map +0 -1
- package/dist/esm/qds-checkbox.qds-radio.entry.js.map +0 -1
- package/dist/esm/qds-nav-list-item.entry.js +0 -118
- package/dist/esm/qds-nav-list-item.entry.js.map +0 -1
- package/dist/types/components/nav-list-item/nav-list-item.d.ts +0 -67
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-Cin_uEzc.js","mappings":";;;;;;;;AAAA,MAAM,QAAQ,GAAG,02SAA02S;;ACA33S;AACA;AACA;;;;;;;;;MAyBa,KAAK,iBAAAA,kBAAA,CAAA,MAAA,KAAA,SAAAC,CAAA,CAAA;AALlB,IAAA,WAAA,CAAA,YAAA,EAAA;;;;;;;;AAME;;AAEG;AACqB,QAAA,IAAS,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CAAC,OAAO,EAAA,EAC/C,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAQ,CACJ,EACL,sBAAA,CAAA,IAAI,EAAW,gBAAA,EAAA,GAAA,EAAA,oBAAA,CAAA,IAAI,CAAG,CAAA,GAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAC,YAAY,EAAE,EAAA,IAAI,CAAC,MAAM,CAAK,EAC1D,sBAAA,CAAA,IAAI,EAAa,gBAAA,EAAA,GAAA,EAAA,sBAAA,CAAA,IAAI,CAAG,CAAA,GAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAC,cAAc,EAAE,EAAA,IAAI,CAAC,QAAQ,CAAK,EAChE,OAAO,KACN,CAAA,CAAA,UAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,aAAA,EACc,MAAM,EAClB,KAAK,EAAC,UAAU,EAChB,IAAI,EAAE,IAAI,CAAC,QAAQ,EACnB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,CAAA,CACH,CACM;;;;;;;;;;;;;;;IA5CX,OAAO,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,KAAK,EAAE;AAC5D,CAAC,EAAA,oBAAA,GAAA,SAAA,oBAAA,GAAA;IAGC,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE;AACxD,CAAC;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","HTMLElement"],"sources":["src/components/title/title.css?tag=qds-title&encapsulation=shadow","src/components/title/title.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2024 Schneider Electric\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\n@import url('../shared.css');\n\n:host {\n display: block;\n}\n\n.qds-titles {\n display: grid;\n grid-template-areas: 'title';\n\n &.qds-has-kicker {\n grid-template-areas:\n 'kicker'\n 'title';\n }\n\n &.qds-has-subtitle {\n grid-template-areas:\n 'title'\n 'subtitle';\n }\n\n &.qds-has-kicker.qds-has-subtitle {\n grid-template-areas:\n 'kicker'\n 'title'\n 'subtitle';\n }\n}\n\n.qds-has-icon {\n grid-template-columns: auto 1fr;\n grid-template-areas: 'icon title';\n\n &.qds-has-kicker {\n grid-template-areas:\n '. kicker'\n 'icon title';\n }\n\n &.qds-has-subtitle {\n grid-template-areas:\n 'icon title'\n '. subtitle';\n }\n\n &.qds-has-kicker.qds-has-subtitle {\n grid-template-areas:\n '. kicker'\n 'icon title'\n '. subtitle';\n }\n}\n\n.qds-titles,\n.qds-title {\n hyphens: inherit;\n}\n\n.qds-subtitle,\n.qds-kicker {\n hyphens: initial;\n}\n\n.qds-title,\n.qds-subtitle,\n.qds-kicker {\n margin-block: 0;\n}\n\n.qds-title {\n grid-area: title;\n color: var(--qds-theme-title);\n}\n\n.qds-subtitle {\n grid-area: subtitle;\n color: var(--qds-theme-subtitle);\n}\n\n.qds-kicker {\n grid-area: kicker;\n color: var(--qds-theme-kicker);\n}\n\n.qds-icon {\n grid-area: icon;\n align-content: center;\n color: var(--qds-theme-text-standard);\n}\n\n.qds-main {\n &.qds-section {\n &.qds-titles {\n gap: var(--qds-main-section-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-main-section-titles-gap)\n var(--qds-main-section-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-main-section-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-main-section-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-main-section-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-main-section-titles-icon-size);\n height: var(--qds-main-section-titles-icon-crop-height);\n }\n }\n\n &.qds-subsection {\n &.qds-titles {\n gap: var(--qds-main-subsection-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-main-subsection-titles-gap)\n var(--qds-main-subsection-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-main-subsection-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-main-subsection-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-main-subsection-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-main-subsection-titles-icon-size);\n height: var(--qds-main-subsection-titles-icon-crop-height);\n }\n }\n}\n\n.qds-panel {\n &.qds-root {\n &.qds-titles {\n gap: var(--qds-panel-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-panel-titles-gap) var(--qds-panel-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-panel-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-panel-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-panel-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-panel-titles-icon-size);\n height: var(--qds-panel-titles-icon-crop-height);\n }\n }\n\n &.qds-section {\n &.qds-titles {\n gap: var(--qds-panel-section-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-panel-section-titles-gap)\n var(--qds-panel-section-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-panel-section-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-panel-section-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-panel-section-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-panel-section-titles-icon-size);\n height: var(--qds-panel-section-titles-icon-crop-height);\n }\n }\n\n &.qds-subsection {\n &.qds-titles {\n gap: var(--qds-panel-subsection-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-panel-subsection-titles-gap)\n var(--qds-panel-subsection-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-panel-subsection-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-panel-subsection-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-panel-subsection-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-panel-subsection-titles-icon-size);\n height: var(--qds-panel-subsection-titles-icon-crop-height);\n }\n }\n}\n\n.qds-navigation {\n &.qds-section {\n &.qds-titles {\n gap: var(--qds-navigation-section-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-navigation-section-titles-gap)\n var(--qds-navigation-section-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-navigation-section-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-navigation-section-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-navigation-section-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-navigation-section-titles-icon-size);\n height: var(--qds-navigation-section-titles-icon-crop-height);\n }\n }\n\n &.qds-subsection {\n &.qds-titles {\n gap: var(--qds-navigation-subsection-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-navigation-subsection-titles-gap)\n var(--qds-navigation-subsection-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-navigation-subsection-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-navigation-subsection-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-navigation-subsection-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-navigation-subsection-titles-icon-size);\n height: var(--qds-navigation-subsection-titles-icon-crop-height);\n }\n }\n}\n\n.qds-popup {\n &.qds-root {\n &.qds-titles {\n gap: var(--qds-popup-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-popup-titles-gap) var(--qds-popup-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-popup-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-popup-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-popup-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-popup-titles-icon-size);\n height: var(--qds-popup-titles-icon-crop-height);\n }\n }\n\n &.qds-section {\n &.qds-titles {\n gap: var(--qds-popup-section-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-popup-section-titles-gap)\n var(--qds-popup-section-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-popup-section-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-popup-section-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-popup-section-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-popup-section-titles-icon-size);\n height: var(--qds-popup-section-titles-icon-crop-height);\n }\n }\n\n &.qds-subsection {\n &.qds-titles {\n gap: var(--qds-popup-subsection-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-popup-subsection-titles-gap)\n var(--qds-popup-subsection-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-popup-subsection-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-popup-subsection-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-popup-subsection-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-popup-subsection-titles-icon-size);\n height: var(--qds-popup-subsection-titles-icon-crop-height);\n }\n }\n}\n\n.qds-accessory {\n &.qds-root {\n &.qds-titles {\n gap: var(--qds-accessory-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-accessory-titles-gap) var(--qds-accessory-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-accessory-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-accessory-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-accessory-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-accessory-titles-icon-size);\n height: var(--qds-accessory-titles-icon-crop-height);\n }\n }\n\n &.qds-section {\n &.qds-titles {\n gap: var(--qds-accessory-section-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-accessory-section-titles-gap)\n var(--qds-accessory-section-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-accessory-section-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-accessory-section-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-accessory-section-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-accessory-section-titles-icon-size);\n height: var(--qds-accessory-section-titles-icon-crop-height);\n }\n }\n}\n\n[data-variant='web-main-section-promo'] {\n &:is(.qds-root, .qds-section, .qds-subsection) {\n &.qds-titles {\n gap: var(--qds-main-section-promo-titles-gap);\n margin: auto;\n }\n\n & .qds-title {\n font: var(--qds-main-section-promo-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-main-section-promo-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-main-section-promo-kicker);\n }\n\n &.qds-has-icon {\n gap: var(--qds-main-section-promo-titles-gap)\n var(--qds-main-section-promo-titles-icon-gap);\n }\n\n & .qds-icon {\n width: var(--qds-main-section-promo-titles-icon-size);\n height: var(--qds-main-section-promo-titles-icon-crop-height);\n }\n }\n}\n\n[data-alignment='start'] {\n text-align: start;\n}\n\n[data-alignment='center'] {\n text-align: center;\n}\n\n[data-alignment='end'] {\n text-align: end;\n}\n\n[data-variant='web-main-section-display'] {\n &:is(.qds-root, .qds-section, .qds-subsection) {\n &.qds-titles {\n gap: var(--qds-main-section-display-titles-gap);\n }\n\n & .qds-title {\n font: var(--qds-main-section-display-title);\n }\n }\n}\n\n[data-variant='web-main-subsection-card'] {\n &:is(.qds-root, .qds-section, .qds-subsection) {\n &.qds-titles {\n gap: var(--qds-main-subsection-card-titles-gap);\n }\n\n & .qds-title {\n font: var(--qds-main-subsection-card-standard-title);\n }\n }\n}\n\n[data-variant='web-main-section-hero'] {\n &:is(.qds-root, .qds-section, .qds-subsection) {\n &.qds-titles {\n gap: var(--qds-main-section-hero-titles-gap);\n }\n\n & .qds-title {\n font: var(--qds-main-section-hero-title);\n }\n }\n}\n","// SPDX-FileCopyrightText: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ComponentInterface } from '@stencil/core'\nimport { AttachInternals, Component, h, Prop } from '@stencil/core'\n\nexport type Layer = 'accessory' | 'main' | 'navigation' | 'panel' | 'popup'\nexport type Level = 'root' | 'section' | 'subsection'\nexport type Tag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\nexport type TitleVariant =\n | 'web-main-section-display'\n | 'web-main-section-hero'\n | 'web-main-section-promo'\n | 'web-main-subsection-card'\n\nexport type Alignment = 'center' | 'end' | 'start'\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 alignment of the title.\n */\n @Prop() public readonly alignment?: Alignment = 'start'\n\n /**\n * The name of the icon to render.\n *\n * Available names depend on the icon library being used.\n */\n @Prop() public readonly iconName?: string\n\n /**\n * The name of a registered icon library.\n */\n @Prop() 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 = 'main'\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 /**\n * The title's variant.\n */\n @Prop() public readonly variant?: TitleVariant\n\n @AttachInternals() private readonly internals!: ElementInternals\n\n get #hasSubtitle(): boolean {\n return this.subtitle !== undefined && this.subtitle !== ''\n }\n\n get #hasKicker(): boolean {\n return this.kicker !== undefined && this.kicker !== ''\n }\n\n public componentWillLoad(): void {\n this.internals.role = 'group'\n }\n\n public render() {\n const layer = `qds-${this.layer ?? 'main'}`\n const level = `qds-${this.level ?? 'section'}`\n const Tag = this.tag ?? 'h2'\n const hasIcon = this.iconName !== undefined && this.iconName !== ''\n\n return (\n <hgroup\n data-alignment={this.alignment ?? 'start'}\n data-variant={this.variant}\n class={{\n [layer]: true,\n [level]: true,\n 'qds-titles': true,\n 'qds-has-icon': hasIcon,\n 'qds-has-kicker': this.#hasKicker,\n 'qds-has-subtitle': this.#hasSubtitle,\n }}\n role=\"none\"\n >\n <Tag class=\"qds-title\" data-variant={this.variant}>\n <slot />\n </Tag>\n {this.#hasKicker && <p class=\"qds-kicker\">{this.kicker}</p>}\n {this.#hasSubtitle && <p class=\"qds-subtitle\">{this.subtitle}</p>}\n {hasIcon && (\n <qds-icon\n aria-hid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,KAAK,EAAE;AACxD,CAAC;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","HTMLElement"],"sources":["src/components/title/title.css?tag=qds-title&encapsulation=shadow","src/components/title/title.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2024 Schneider Electric\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\n@import url('../shared.css');\n\n:host {\n display: block;\n}\n\n.qds-titles {\n display: grid;\n grid-template-areas: 'title';\n\n &.qds-has-kicker {\n grid-template-areas:\n 'kicker'\n 'title';\n }\n\n &.qds-has-subtitle {\n grid-template-areas:\n 'title'\n 'subtitle';\n }\n\n &.qds-has-kicker.qds-has-subtitle {\n grid-template-areas:\n 'kicker'\n 'title'\n 'subtitle';\n }\n}\n\n.qds-has-icon {\n grid-template-columns: auto 1fr;\n grid-template-areas: 'icon title';\n\n &.qds-has-kicker {\n grid-template-areas:\n '. kicker'\n 'icon title';\n }\n\n &.qds-has-subtitle {\n grid-template-areas:\n 'icon title'\n '. subtitle';\n }\n\n &.qds-has-kicker.qds-has-subtitle {\n grid-template-areas:\n '. kicker'\n 'icon title'\n '. subtitle';\n }\n}\n\n.qds-titles,\n.qds-title {\n hyphens: inherit;\n}\n\n.qds-subtitle,\n.qds-kicker {\n hyphens: initial;\n}\n\n.qds-title,\n.qds-subtitle,\n.qds-kicker {\n margin-block: 0;\n}\n\n.qds-title {\n grid-area: title;\n color: var(--qds-theme-title);\n}\n\n.qds-subtitle {\n grid-area: subtitle;\n color: var(--qds-theme-subtitle);\n}\n\n.qds-kicker {\n grid-area: kicker;\n color: var(--qds-theme-kicker);\n}\n\n.qds-icon {\n grid-area: icon;\n align-content: center;\n color: var(--qds-theme-text-standard);\n}\n\n.qds-main {\n &.qds-section {\n &.qds-titles {\n gap: var(--qds-main-section-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-main-section-titles-gap)\n var(--qds-main-section-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-main-section-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-main-section-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-main-section-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-main-section-titles-icon-size);\n height: var(--qds-main-section-titles-icon-crop-height);\n }\n }\n\n &.qds-subsection {\n &.qds-titles {\n gap: var(--qds-main-subsection-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-main-subsection-titles-gap)\n var(--qds-main-subsection-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-main-subsection-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-main-subsection-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-main-subsection-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-main-subsection-titles-icon-size);\n height: var(--qds-main-subsection-titles-icon-crop-height);\n }\n }\n}\n\n.qds-panel {\n &.qds-root {\n &.qds-titles {\n gap: var(--qds-panel-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-panel-titles-gap) var(--qds-panel-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-panel-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-panel-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-panel-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-panel-titles-icon-size);\n height: var(--qds-panel-titles-icon-crop-height);\n }\n }\n\n &.qds-section {\n &.qds-titles {\n gap: var(--qds-panel-section-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-panel-section-titles-gap)\n var(--qds-panel-section-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-panel-section-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-panel-section-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-panel-section-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-panel-section-titles-icon-size);\n height: var(--qds-panel-section-titles-icon-crop-height);\n }\n }\n\n &.qds-subsection {\n &.qds-titles {\n gap: var(--qds-panel-subsection-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-panel-subsection-titles-gap)\n var(--qds-panel-subsection-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-panel-subsection-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-panel-subsection-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-panel-subsection-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-panel-subsection-titles-icon-size);\n height: var(--qds-panel-subsection-titles-icon-crop-height);\n }\n }\n}\n\n.qds-navigation {\n &.qds-section {\n &.qds-titles {\n gap: var(--qds-navigation-section-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-navigation-section-titles-gap)\n var(--qds-navigation-section-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-navigation-section-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-navigation-section-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-navigation-section-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-navigation-section-titles-icon-size);\n height: var(--qds-navigation-section-titles-icon-crop-height);\n }\n }\n\n &.qds-subsection {\n &.qds-titles {\n gap: var(--qds-navigation-subsection-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-navigation-subsection-titles-gap)\n var(--qds-navigation-subsection-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-navigation-subsection-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-navigation-subsection-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-navigation-subsection-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-navigation-subsection-titles-icon-size);\n height: var(--qds-navigation-subsection-titles-icon-crop-height);\n }\n }\n}\n\n.qds-popup {\n &.qds-root {\n &.qds-titles {\n gap: var(--qds-popup-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-popup-titles-gap) var(--qds-popup-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-popup-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-popup-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-popup-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-popup-titles-icon-size);\n height: var(--qds-popup-titles-icon-crop-height);\n }\n }\n\n &.qds-section {\n &.qds-titles {\n gap: var(--qds-popup-section-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-popup-section-titles-gap)\n var(--qds-popup-section-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-popup-section-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-popup-section-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-popup-section-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-popup-section-titles-icon-size);\n height: var(--qds-popup-section-titles-icon-crop-height);\n }\n }\n\n &.qds-subsection {\n &.qds-titles {\n gap: var(--qds-popup-subsection-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-popup-subsection-titles-gap)\n var(--qds-popup-subsection-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-popup-subsection-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-popup-subsection-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-popup-subsection-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-popup-subsection-titles-icon-size);\n height: var(--qds-popup-subsection-titles-icon-crop-height);\n }\n }\n}\n\n.qds-accessory {\n &.qds-root {\n &.qds-titles {\n gap: var(--qds-accessory-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-accessory-titles-gap) var(--qds-accessory-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-accessory-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-accessory-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-accessory-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-accessory-titles-icon-size);\n height: var(--qds-accessory-titles-icon-crop-height);\n }\n }\n\n &.qds-section {\n &.qds-titles {\n gap: var(--qds-accessory-section-titles-gap);\n }\n\n &.qds-has-icon {\n gap: var(--qds-accessory-section-titles-gap)\n var(--qds-accessory-section-titles-icon-gap);\n }\n\n & .qds-title {\n font: var(--qds-accessory-section-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-accessory-section-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-accessory-section-kicker);\n }\n\n & .qds-icon {\n width: var(--qds-accessory-section-titles-icon-size);\n height: var(--qds-accessory-section-titles-icon-crop-height);\n }\n }\n}\n\n[data-variant='web-main-section-promo'] {\n &:is(.qds-root, .qds-section, .qds-subsection) {\n &.qds-titles {\n gap: var(--qds-main-section-promo-titles-gap);\n margin: auto;\n }\n\n & .qds-title {\n font: var(--qds-main-section-promo-title);\n }\n\n & .qds-subtitle {\n font: var(--qds-main-section-promo-subtitle);\n }\n\n & .qds-kicker {\n font: var(--qds-main-section-promo-kicker);\n }\n\n &.qds-has-icon {\n gap: var(--qds-main-section-promo-titles-gap)\n var(--qds-main-section-promo-titles-icon-gap);\n }\n\n & .qds-icon {\n width: var(--qds-main-section-promo-titles-icon-size);\n height: var(--qds-main-section-promo-titles-icon-crop-height);\n }\n }\n}\n\n[data-alignment='start'] {\n text-align: start;\n}\n\n[data-alignment='center'] {\n text-align: center;\n}\n\n[data-alignment='end'] {\n text-align: end;\n}\n\n[data-variant='web-main-section-display'] {\n &:is(.qds-root, .qds-section, .qds-subsection) {\n &.qds-titles {\n gap: var(--qds-main-section-display-titles-gap);\n }\n\n & .qds-title {\n font: var(--qds-main-section-display-title);\n }\n }\n}\n\n[data-variant='web-main-subsection-card'] {\n &:is(.qds-root, .qds-section, .qds-subsection) {\n &.qds-titles {\n gap: var(--qds-main-subsection-card-titles-gap);\n }\n\n & .qds-title {\n font: var(--qds-main-subsection-card-standard-title);\n }\n }\n}\n\n[data-variant='web-main-section-hero'] {\n &:is(.qds-root, .qds-section, .qds-subsection) {\n &.qds-titles {\n gap: var(--qds-main-section-hero-titles-gap);\n }\n\n & .qds-title {\n font: var(--qds-main-section-hero-title);\n }\n }\n}\n","// SPDX-FileCopyrightText: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ComponentInterface } from '@stencil/core'\nimport { AttachInternals, Component, h, Prop } from '@stencil/core'\n\nexport type Layer = 'accessory' | 'main' | 'navigation' | 'panel' | 'popup'\nexport type Level = 'root' | 'section' | 'subsection'\nexport type Tag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\nexport type TitleVariant =\n | 'web-main-section-display'\n | 'web-main-section-hero'\n | 'web-main-section-promo'\n | 'web-main-subsection-card'\n\nexport type Alignment = 'center' | 'end' | 'start'\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 alignment of the title.\n */\n @Prop() public readonly alignment?: Alignment = 'start'\n\n /**\n * The name of the icon to render.\n *\n * Available names depend on the icon library being used.\n */\n @Prop() public readonly iconName?: string\n\n /**\n * The name of a registered icon library.\n */\n @Prop() 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 = 'main'\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 /**\n * The title's variant.\n */\n @Prop() public readonly variant?: TitleVariant\n\n @AttachInternals() private readonly internals!: ElementInternals\n\n get #hasSubtitle(): boolean {\n return this.subtitle !== undefined && this.subtitle !== ''\n }\n\n get #hasKicker(): boolean {\n return this.kicker !== undefined && this.kicker !== ''\n }\n\n public componentWillLoad(): void {\n this.internals.role = 'group'\n }\n\n public render() {\n const layer = `qds-${this.layer ?? 'main'}`\n const level = `qds-${this.level ?? 'section'}`\n const Tag = this.tag ?? 'h2'\n const hasIcon = this.iconName !== undefined && this.iconName !== ''\n\n return (\n <hgroup\n data-alignment={this.alignment ?? 'start'}\n data-variant={this.variant}\n class={{\n [layer]: true,\n [level]: true,\n 'qds-titles': true,\n 'qds-has-icon': hasIcon,\n 'qds-has-kicker': this.#hasKicker,\n 'qds-has-subtitle': this.#hasSubtitle,\n }}\n role=\"none\"\n >\n <Tag class=\"qds-title\" data-variant={this.variant}>\n <slot />\n </Tag>\n {this.#hasKicker && <p class=\"qds-kicker\">{this.kicker}</p>}\n {this.#hasSubtitle && <p class=\"qds-subtitle\">{this.subtitle}</p>}\n {hasIcon && (\n <qds-icon\n aria-hidden=\"true\"\n class=\"qds-icon\"\n name={this.iconName}\n library={this.iconLibrary}\n />\n )}\n </hgroup>\n )\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: © 2025 Schneider Electric
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { p as proxyCustomElement, H, c as createEvent, h } from './p-BEWDu8_P.js';
|
|
7
|
+
import { d as defineCustomElement$1 } from './p-D6kEwmWw.js';
|
|
8
|
+
|
|
9
|
+
const avatarMediaCss = ":host([hidden]){display:none!important}:host{display:block}.qds-container{align-items:center;align-self:stretch;background:var(--qds-theme-display-background);border:var(--qds-display-border-width) solid var(--qds-theme-display-background-contrast);border-radius:var(--qds-display-rounded-border-radius);display:flex;height:var(--qds-display-size);justify-content:center;width:var(--qds-display-size)}.qds-container .qds-picture{border-radius:inherit;flex-shrink:0;height:100%;object-fit:cover;width:100%}.qds-container .qds-icon,.qds-container .qds-text{color:var(--qds-theme-display-background-contrast)}.qds-container .qds-icon{flex-shrink:0;height:60%;width:60%}.qds-container .qds-text{font:var(--qds-display-standard);text-align:center}";
|
|
10
|
+
|
|
11
|
+
// SPDX-FileCopyrightText: © 2025 Schneider Electric
|
|
12
|
+
//
|
|
13
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
14
|
+
var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
15
|
+
if (kind === "a" && !f)
|
|
16
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
17
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
18
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
19
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
20
|
+
};
|
|
21
|
+
var _AvatarMedia_renderContent, _AvatarMedia_handleImageError;
|
|
22
|
+
const AvatarMedia = /*@__PURE__*/ proxyCustomElement(class AvatarMedia extends H {
|
|
23
|
+
constructor(registerHost) {
|
|
24
|
+
super();
|
|
25
|
+
if (registerHost !== false) {
|
|
26
|
+
this.__registerHost();
|
|
27
|
+
}
|
|
28
|
+
this.__attachShadow();
|
|
29
|
+
this.errorEmitter = createEvent(this, "qdsError", 6);
|
|
30
|
+
/**
|
|
31
|
+
* The alt text for the avatar-media's image.
|
|
32
|
+
* @webnative
|
|
33
|
+
*/
|
|
34
|
+
this.alt = '';
|
|
35
|
+
/**
|
|
36
|
+
* The avatar-media's icon library.
|
|
37
|
+
*/
|
|
38
|
+
this.iconLibrary = 'default';
|
|
39
|
+
this.hasImageError = false;
|
|
40
|
+
_AvatarMedia_renderContent.set(this, () => {
|
|
41
|
+
if (this.src !== undefined && this.src !== '' && !this.hasImageError) {
|
|
42
|
+
return (h("img", { class: "qds-picture", src: this.src, alt: this.alt, onError: __classPrivateFieldGet(this, _AvatarMedia_handleImageError, "f"), onLoad: () => {
|
|
43
|
+
this.hasImageError = false;
|
|
44
|
+
} }));
|
|
45
|
+
}
|
|
46
|
+
if (this.text !== undefined && this.text !== '') {
|
|
47
|
+
return h("span", { class: "qds-text" }, this.initials);
|
|
48
|
+
}
|
|
49
|
+
if (this.iconName !== undefined && this.iconName !== '') {
|
|
50
|
+
return (h("qds-icon", { class: "qds-icon", name: this.iconName, library: this.iconLibrary }));
|
|
51
|
+
}
|
|
52
|
+
return h("qds-icon", { class: "qds-icon", name: "user", library: "core" });
|
|
53
|
+
});
|
|
54
|
+
_AvatarMedia_handleImageError.set(this, () => {
|
|
55
|
+
this.hasImageError = true;
|
|
56
|
+
this.errorEmitter.emit();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
handleTextChange() {
|
|
60
|
+
if (this.text === undefined || this.text === '') {
|
|
61
|
+
this.initials = undefined;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const words = this.text.trim().split(' ');
|
|
65
|
+
const [first = '', second = ''] = words.filter(Boolean);
|
|
66
|
+
this.initials = (first.charAt(0) + (second.charAt(0) || '')).toLocaleUpperCase();
|
|
67
|
+
}
|
|
68
|
+
componentWillLoad() {
|
|
69
|
+
this.handleTextChange();
|
|
70
|
+
}
|
|
71
|
+
render() {
|
|
72
|
+
return h("div", { key: '3de037b482d057e4ae071e61bb72c60ee151f4e8', class: "qds-container" }, __classPrivateFieldGet(this, _AvatarMedia_renderContent, "f").call(this));
|
|
73
|
+
}
|
|
74
|
+
static get watchers() { return {
|
|
75
|
+
"text": ["handleTextChange"]
|
|
76
|
+
}; }
|
|
77
|
+
static get style() { return avatarMediaCss; }
|
|
78
|
+
}, [257, "qds-avatar-media", {
|
|
79
|
+
"src": [1],
|
|
80
|
+
"alt": [1],
|
|
81
|
+
"iconName": [1, "icon-name"],
|
|
82
|
+
"iconLibrary": [1, "icon-library"],
|
|
83
|
+
"text": [1],
|
|
84
|
+
"initials": [32],
|
|
85
|
+
"hasImageError": [32]
|
|
86
|
+
}, undefined, {
|
|
87
|
+
"text": ["handleTextChange"]
|
|
88
|
+
}]);
|
|
89
|
+
_AvatarMedia_renderContent = new WeakMap(), _AvatarMedia_handleImageError = new WeakMap();
|
|
90
|
+
function defineCustomElement() {
|
|
91
|
+
if (typeof customElements === "undefined") {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const components = ["qds-avatar-media", "qds-icon"];
|
|
95
|
+
components.forEach(tagName => { switch (tagName) {
|
|
96
|
+
case "qds-avatar-media":
|
|
97
|
+
if (!customElements.get(tagName)) {
|
|
98
|
+
customElements.define(tagName, AvatarMedia);
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
case "qds-icon":
|
|
102
|
+
if (!customElements.get(tagName)) {
|
|
103
|
+
defineCustomElement$1();
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
} });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export { AvatarMedia as A, defineCustomElement as d };
|
|
110
|
+
//# sourceMappingURL=p-DabDNFFa.js.map
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=p-DabDNFFa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-DabDNFFa.js","mappings":";;;;;;;;AAAA,MAAM,cAAc,GAAG,wuBAAwuB;;ACA/vB;AACA;AACA;;;;;;;;;MAaa,WAAW,iBAAAA,kBAAA,CAAA,MAAA,WAAA,SAAAC,CAAA,CAAA;AALxB,IAAA,WAAA,CAAA,YAAA,EAAA;;;;;;;AAYE;;;AAGG;AACqB,QAAA,IAAG,CAAA,GAAA,GAAW,EAAE;AAOxC;;AAEG;AACqB,QAAA,IAAW,CAAA,WAAA,GAAY,SAAS;AAevC,QAAA,IAAa,CAAA,aAAA,GAAG,KAAK;AAuB7B,QAAA,0BAAA,CAAA,GAAA,CAAA,IAAA,EAAiB,MAA8B;AACtD,YAAA,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;AACpE,gBAAA,QACE,CACE,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,aAAa,EACnB,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,OAAO,EAAE,sBAAA,CAAA,IAAI,EAAA,6BAAA,EAAA,GAAA,CAAkB,EAC/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ACd,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAC1C,iBAAiB,EAAE;;IAGhB,iBAAiB,GAAA;QACtB,IAAI,CAAC,gBAAgB,EAAE;;IAGlB,MAAM,GAAA;AACX,QAAA,OAAO,CAAK,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAC,eAAe,EAAE,EAAA,sBAAA,CAAA,IAAI,EAAA,0BAAA,EAAA,GAAA,CAAe,CAAnB,IAAA,CAAA,IAAI,CAAiB,CAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","HTMLElement"],"sources":["src/components/avatar-media/avatar-media.css?tag=qds-avatar-media&encapsulation=shadow","src/components/avatar-media/avatar-media.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2025 Schneider Electric\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\n@import url('../shared.css');\n\n:host {\n display: block;\n}\n\n.qds-container {\n display: flex;\n justify-content: center;\n align-self: stretch;\n border-radius: var(--qds-display-rounded-border-radius);\n border: var(--qds-display-border-width) solid\n var(--qds-theme-display-background-contrast);\n background: var(--qds-theme-display-background);\n width: var(--qds-display-size);\n height: var(--qds-display-size);\n align-items: center;\n\n .qds-picture {\n height: 100%;\n width: 100%;\n object-fit: cover;\n border-radius: inherit;\n flex-shrink: 0;\n }\n\n .qds-icon,\n .qds-text {\n color: var(--qds-theme-display-background-contrast);\n }\n\n .qds-icon {\n width: 60%;\n height: 60%;\n flex-shrink: 0;\n }\n\n .qds-text {\n text-align: center;\n font: var(--qds-display-standard);\n }\n}\n","// SPDX-FileCopyrightText: © 2025 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport { Component, Event, h, Prop, State, Watch } from '@stencil/core'\n\n/**\n * @experimental\n */\n@Component({\n tag: 'qds-avatar-media',\n shadow: true,\n styleUrl: 'avatar-media.css',\n})\nexport class AvatarMedia implements ComponentInterface {\n /**\n * The avatar-media's image source.\n * @webnative\n */\n @Prop() public readonly src?: string\n\n /**\n * The alt text for the avatar-media's image.\n * @webnative\n */\n @Prop() public readonly alt: string = ''\n\n /**\n * The avatar-media's icon name.\n */\n @Prop() public readonly iconName?: string\n\n /**\n * The avatar-media's icon library.\n */\n @Prop() public readonly iconLibrary?: string = 'default'\n\n /**\n * The avatar-media's text content.\n */\n @Prop() public readonly text?: string\n\n /**\n * Emitted when the avatar-media's image fails to load due to an error.\n */\n @Event({ eventName: 'qdsError', cancelable: false })\n private readonly errorEmitter!: EventEmitter<void>\n\n @State() private initials: string | undefined\n\n @State() private hasImageError = false\n\n @Watch('text')\n private handleTextChange(): void {\n if (this.text === undefined || this.text === '') {\n this.initials = undefined\n return\n }\n const words = this.text.trim().split(' ')\n const [first = '', second = ''] = words.filter(Boolean)\n this.initials = (\n first.charAt(0) + (second.charAt(0) || '')\n ).toLocaleUpperCase()\n }\n\n public componentWillLoad(): Promise<void> | void {\n this.handleTextChange()\n }\n\n public render() {\n return <div class=\"qds-container\">{this.#renderContent()}</div>\n }\n\n readonly #renderContent = (): HTMLElement | undefined => {\n if (this.src !== undefined && this.src !== '' && !this.hasImageError) {\n return (\n <img\n class=\"qds-picture\"\n src={this.src}\n alt={this.alt}\n onError={this.#handleImageError}\n onLoad={() => {\n this.hasImageError = false\n }}\n />\n )\n }\n if (this.text !== undefined && this.text !== '') {\n return <span class=\"qds-text\">{this.initials}</span>\n }\n if (this.iconName !== undefined && this.iconName !== '') {\n return (\n <qds-icon\n class=\"qds-icon\"\n name={this.iconName}\n library={this.iconLibrary}\n />\n )\n }\n\n return <qds-icon class=\"qds-icon\" name=\"user\" library=\"core\" />\n }\n\n readonly #handleImageError = (): void => {\n this.hasImageError = true\n this.errorEmitter.emit()\n }\n}\n"],"version":3}
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { p as proxyCustomElement, H, c as createEvent, h } from './p-BEWDu8_P.js';
|
|
7
|
-
import { p as pickFocusEventAttributes, b as inheritAriaAttributes } from './p-
|
|
7
|
+
import { p as pickFocusEventAttributes, b as inheritAriaAttributes } from './p-Bs-thw7N.js';
|
|
8
8
|
import { V as VALID_STATE, C as CUSTOM_ERROR_FLAGS, N as NO_ERROR_FLAGS } from './p-DQLjJn7-.js';
|
|
9
|
-
import { d as defineCustomElement$3 } from './p-
|
|
10
|
-
import { d as defineCustomElement$2 } from './p-
|
|
11
|
-
import { d as defineCustomElement$1 } from './p
|
|
9
|
+
import { d as defineCustomElement$3 } from './p-D6kEwmWw.js';
|
|
10
|
+
import { d as defineCustomElement$2 } from './p-DG13nyez.js';
|
|
11
|
+
import { d as defineCustomElement$1 } from './p--vOFwWP9.js';
|
|
12
12
|
|
|
13
|
-
const checkboxCss = ":host([hidden]){display:none!important}:host{display:inline-block;line-height:0}.qds-
|
|
13
|
+
const checkboxCss = ":host([hidden]){display:none!important}:host{display:inline-block;line-height:0}.qds-checkbox,.qds-icon{grid-area:a;place-self:center}.qds-icon{color:var(--qds-theme-signature-color-contrast);display:none;pointer-events:none}.qds-container{display:grid;grid-template-areas:\"a\"}.qds-label{align-items:center;background-color:var(--qds-theme-interactive-background-default);border-radius:var(--qds-control-border-radius);cursor:pointer;display:inline-flex;width:inherit}.qds-label:hover{background-color:var(--qds-theme-interactive-background-hover)}.qds-label:active{background-color:var(--qds-theme-interactive-background-pressed)}.qds-label:has(.qds-checkbox:focus-visible){outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width)}.qds-label-inner{flex:1 1 auto;min-width:0}.qds-checkbox{-webkit-appearance:none;appearance:none;background-color:var(--qds-theme-interactive-background-default);border:var(--qds-control-border-width) solid var(--qds-theme-control-border);cursor:pointer;margin:0;-webkit-print-color-adjust:exact;print-color-adjust:exact}.qds-checkbox:focus-visible{outline:none}.qds-checkbox:hover{background-color:var(--qds-theme-interactive-background-hover)}.qds-checkbox:active{background-color:var(--qds-theme-interactive-background-pressed)}.qds-checkbox:checked~.qds-checked,.qds-checkbox:indeterminate~.qds-indeterminate{display:block}.qds-checkbox:checked,.qds-checkbox:indeterminate{background-color:var(--qds-theme-control-background-contrast);border-color:#0000}[aria-disabled=true]{opacity:var(--qds-theme-disabled);pointer-events:none}.qds-checkbox[data-size=small]{border-radius:var(--qds-control-toggle-small-knob-border-radius);height:var(--qds-control-toggle-small-box-size);width:var(--qds-control-toggle-small-box-size)}.qds-icon[data-size=small]{font-size:var(--qds-control-small-icon-size)}.qds-label[data-size=small]{gap:var(--qds-control-small-gap-siblings-related);min-height:var(--qds-control-toggle-small-height);padding:var(--qds-control-no-inline-small-padding-vertical,4px) 0}.qds-inline[data-size=small]{min-height:var(--qds-control-small-height);padding:var(--qds-control-small-padding-auto-height) var(--qds-control-toggle-small-padding-horizontal,6px)}.qds-checkbox[data-size=standard]{border-radius:var(--qds-control-toggle-standard-knob-border-radius);height:var(--qds-control-toggle-standard-box-size);width:var(--qds-control-toggle-standard-box-size)}.qds-icon[data-size=standard]{font-size:var(--qds-control-standard-icon-size)}.qds-label[data-size=standard]{gap:var(--qds-control-standard-gap-siblings-related);min-height:var(--qds-control-toggle-standard-height);padding:var(--qds-control-no-inline-standard-padding-vertical,4px) 0}.qds-inline[data-size=standard]{min-height:var(--qds-control-standard-height);padding:var(--qds-control-standard-padding-auto-height) var(--qds-control-toggle-standard-padding-horizontal,6px)}.qds-checkbox[data-size=large]{border-radius:var(--qds-control-toggle-large-knob-border-radius);height:var(--qds-control-toggle-large-box-size);width:var(--qds-control-toggle-large-box-size)}.qds-icon[data-size=large]{font-size:var(--qds-control-large-icon-size)}.qds-label[data-size=large]{gap:var(--qds-control-large-gap-siblings-related);min-height:var(--qds-control-toggle-large-height);padding:var(--qds-control-no-inline-large-padding-vertical,4px) 0}.qds-inline[data-size=large]{min-height:var(--qds-control-large-height);padding:var(--qds-control-large-padding-auto-height) var(--qds-control-toggle-large-padding-horizontal,8px)}";
|
|
14
14
|
|
|
15
15
|
// SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
16
16
|
//
|
|
@@ -176,10 +176,10 @@ const Checkbox = /*@__PURE__*/ proxyCustomElement(class Checkbox extends H {
|
|
|
176
176
|
autoFocus: this.host.autofocus, checked: __classPrivateFieldGet(this, _Checkbox_instances, "a", _Checkbox_computedIndeterminate_get) ? false : this.checked, class: "qds-checkbox", "data-size": __classPrivateFieldGet(this, _Checkbox_instances, "a", _Checkbox_computedSize_get), disabled: __classPrivateFieldGet(this, _Checkbox_instances, "a", _Checkbox_computedDisabled_get), indeterminate: this.indeterminate, onBlur: __classPrivateFieldGet(this, _Checkbox_onBlur, "f"), onFocus: __classPrivateFieldGet(this, _Checkbox_onFocus, "f"), required: this.required, tabIndex: __classPrivateFieldGet(this, _Checkbox_instances, "a", _Checkbox_computedDisabled_get) ? undefined : this.tabIndex, type: "checkbox", "aria-label": this.checkboxOnly ? this.text : undefined, ...__classPrivateFieldGet(this, _Checkbox_inheritedAttributes, "f") }), h("qds-icon", { key: '7fd98e670537e117298a45d854b34fb9060a8850', "aria-hidden": "true", class: {
|
|
177
177
|
'qds-icon': true,
|
|
178
178
|
'qds-checked': true,
|
|
179
|
-
}, "data-size": __classPrivateFieldGet(this, _Checkbox_instances, "a", _Checkbox_computedSize_get), library: "core", name: "checked" }), h("
|
|
179
|
+
}, "data-size": __classPrivateFieldGet(this, _Checkbox_instances, "a", _Checkbox_computedSize_get), library: "core", name: "checked" }), h("qds-icon", { key: '7d5266124a946507ee7384a7086af51e6f5a1d66', "aria-hidden": "true", class: {
|
|
180
180
|
'qds-icon': true,
|
|
181
181
|
'qds-indeterminate': true,
|
|
182
|
-
}, "data-size": __classPrivateFieldGet(this, _Checkbox_instances, "a", _Checkbox_computedSize_get), library: "core", name: "indeterminate" })), __classPrivateFieldGet(this, _Checkbox_instances, "a", _Checkbox_hasText_get) && (h("qds-label", { key: '
|
|
182
|
+
}, "data-size": __classPrivateFieldGet(this, _Checkbox_instances, "a", _Checkbox_computedSize_get), library: "core", name: "indeterminate" })), __classPrivateFieldGet(this, _Checkbox_instances, "a", _Checkbox_hasText_get) && (h("qds-label", { key: '2abb3aa9fe38db5b754d65024d907fe7e6c05ed0', class: "qds-label-inner", required: this.required, size: this.size, text: this.text, tabindex: -1, tooltipTarget: this.host }))));
|
|
183
183
|
}
|
|
184
184
|
static get delegatesFocus() { return true; }
|
|
185
185
|
static get formAssociated() { return true; }
|
|
@@ -269,6 +269,6 @@ function defineCustomElement() {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
export { Checkbox as C, defineCustomElement as d };
|
|
272
|
-
//# sourceMappingURL=p-
|
|
272
|
+
//# sourceMappingURL=p-DeLdhUte.js.map
|
|
273
273
|
|
|
274
|
-
//# sourceMappingURL=p-
|
|
274
|
+
//# sourceMappingURL=p-DeLdhUte.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-DeLdhUte.js","mappings":";;;;;;;;;;;;AAAA,MAAM,WAAW,GAAG,m9GAAm9G;;ACAv+G;AACA;AACA;;;;;;;;;;;;;;;;;;MAmCa,QAAQ,iBAAAA,kBAAA,CAAA,MAAA,QAAA,SAAAC,CAAA,CAAA;AANrB,IAAA,WAAA,CAAA,YAAA,EAAA;;;;;;;;;;;AAOE;;;;;AAKG;AACqB,QAAA,IAAM,CAAA,MAAA,GAAY,KAAK;AAE/C;;AAEG;AACqB,QAAA,IAAI,CAAA,IAAA,GAAU,UAAU;AAyBhD;;;;;;;;;;;;;;;AAeG;;AAEqB,QAAA,IAAI,CAAA,IAAA,GAAsC,IAAI;AAgCtE;;;;;;AAMG;AAEa,QAAA,IAAiB,CAAA,iBAAA,GAA0C,EAAE;AAE7E;;;;;;;AAOG;AACqB,QAAA,IAAQ,CAAA,QAAA,GAAiC,WAAW;AAE5E;;;;AAIG;AACqB,QAAA,IA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A,0BAAA,GAAA;AAGC,IAAA,QAAQ,IAAI,CAAC,IAAI;AACf,QAAA,KAAK,UAAU;AACf,QAAA,KAAK,OAAO;QACZ,KAAK,OAAO,EAAE;YACZ,OAAO,IAAI,CAAC,IAAI;;QAElB,SAAS;AACP,YAAA,OAAO,UAAU;;;AAGvB,CAAC,EAAA,2BAAA,GAAA,SAAA,2BAAA,GAAA;;AAIC,IAAA,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;AAC1D,CAAC,EAAA,qBAAA,GAAA,SAAA,qBAAA,GAAA;AAGC,IAAA,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,EAAE,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,YAAY;AAC3E,CAAC,EAAA,sBAAA,GAAA,SAAA,sBAAA,CAiJa,CAAc,EAAE,GAAkB,EAAA;AAC9C,IAAA,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AAChE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","HTMLElement"],"sources":["src/components/checkbox/checkbox.css?tag=qds-checkbox&encapsulation=shadow","src/components/checkbox/checkbox.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2024 Schneider Electric\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n line-height: 0;\n}\n\n.qds-checkbox,\n.qds-icon {\n grid-area: checkbox;\n place-self: center;\n}\n\n.qds-icon {\n display: none;\n pointer-events: none;\n color: var(--qds-theme-signature-color-contrast);\n}\n\n.qds-container {\n display: grid;\n grid-template-areas: 'checkbox';\n}\n\n.qds-label {\n cursor: pointer;\n display: inline-flex;\n width: inherit;\n border-radius: var(--qds-control-border-radius);\n align-items: center;\n background-color: var(--qds-theme-interactive-background-default);\n\n &:hover {\n background-color: var(--qds-theme-interactive-background-hover);\n }\n\n &:active {\n background-color: var(--qds-theme-interactive-background-pressed);\n }\n\n &:has(.qds-checkbox:focus-visible) {\n outline: var(--qds-theme-focus-border) solid var(--qds-focus-border-width);\n }\n}\n\n.qds-label-inner {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.qds-checkbox {\n appearance: none;\n background-color: var(--qds-theme-interactive-background-default);\n border: var(--qds-control-border-width) solid var(--qds-theme-control-border);\n cursor: pointer;\n margin: 0;\n print-color-adjust: exact;\n\n &:focus-visible {\n outline: none;\n }\n\n &:hover {\n background-color: var(--qds-theme-interactive-background-hover);\n }\n\n &:active {\n background-color: var(--qds-theme-interactive-background-pressed);\n }\n\n &:checked ~ .qds-checked,\n &:indeterminate ~ .qds-indeterminate {\n display: block;\n }\n\n &:checked,\n &:indeterminate {\n background-color: var(--qds-theme-control-background-contrast);\n border-color: transparent;\n }\n}\n\n[aria-disabled='true'] {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\n}\n\n[data-size='small'] {\n &.qds-checkbox {\n width: var(--qds-control-toggle-small-box-size);\n height: var(--qds-control-toggle-small-box-size);\n border-radius: var(--qds-control-toggle-small-knob-border-radius);\n }\n\n &.qds-icon {\n font-size: var(--qds-control-small-icon-size);\n }\n\n &.qds-label {\n gap: var(--qds-control-small-gap-siblings-related);\n min-height: var(--qds-control-toggle-small-height);\n padding: var(--qds-control-no-inline-small-padding-vertical, 4px) 0;\n }\n\n &.qds-inline {\n min-height: var(--qds-control-small-height);\n padding: var(--qds-control-small-padding-auto-height)\n var(--qds-control-toggle-small-padding-horizontal, 6px);\n }\n}\n\n[data-size='standard'] {\n &.qds-checkbox {\n width: var(--qds-control-toggle-standard-box-size);\n height: var(--qds-control-toggle-standard-box-size);\n border-radius: var(--qds-control-toggle-standard-knob-border-radius);\n }\n\n &.qds-icon {\n font-size: var(--qds-control-standard-icon-size);\n }\n\n &.qds-label {\n gap: var(--qds-control-standard-gap-siblings-related);\n min-height: var(--qds-control-toggle-standard-height);\n padding: var(--qds-control-no-inline-standard-padding-vertical, 4px) 0;\n }\n\n &.qds-inline {\n min-height: var(--qds-control-standard-height);\n padding: var(--qds-control-standard-padding-auto-height)\n var(--qds-control-toggle-standard-padding-horizontal, 6px);\n }\n}\n\n[data-size='large'] {\n &.qds-checkbox {\n width: var(--qds-control-toggle-large-box-size);\n height: var(--qds-control-toggle-large-box-size);\n border-radius: var(--qds-control-toggle-large-knob-border-radius);\n }\n\n &.qds-icon {\n font-size: var(--qds-control-large-icon-size);\n }\n\n &.qds-label {\n gap: var(--qds-control-large-gap-siblings-related);\n min-height: var(--qds-control-toggle-large-height);\n padding: var(--qds-control-no-inline-large-padding-vertical, 4px) 0;\n }\n\n &.qds-inline {\n min-height: var(--qds-control-large-height);\n padding: var(--qds-control-large-padding-auto-height)\n var(--qds-control-toggle-large-padding-horizontal, 8px);\n }\n}\n","// SPDX-FileCopyrightText: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport {\n AttachInternals,\n Component,\n Element,\n Event,\n h,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core'\n\nimport type { Attributes, QdsFocusEventDetail } from '../../helpers'\nimport { inheritAriaAttributes, pickFocusEventAttributes } from '../../helpers'\nimport { CUSTOM_ERROR_FLAGS, NO_ERROR_FLAGS, VALID_STATE } from '../controls'\nimport type { Size } from '../shared'\n\nexport type CheckboxValue = number | string | null\n\n/**\n * `<qds-checkbox>` elements are rendered as boxes that are checked (ticked)\n * when activated, like you might see in an official government paper form. A\n * checkbox allows you to select single values for submission in a form (or not).\n *\n * @see https://quartz.se.com/build/components/checkbox\n */\n@Component({\n tag: 'qds-checkbox',\n formAssociated: true,\n shadow: { delegatesFocus: true },\n styleUrl: 'checkbox.css',\n})\nexport class Checkbox implements ComponentInterface {\n /**\n * Adds vertical margin to the checkbox for alignment.\n *\n * This is useful when creating inline layouts so that the first lines have\n * the correct vertical centering.\n */\n @Prop() public readonly inline: boolean = false\n\n /**\n * The checkbox's size.\n */\n @Prop() public readonly size?: Size = 'standard'\n\n /**\n * The checkbox's text.\n *\n * Its value will also be used as the `aria-label` value when the\n * `checkbox-only` attribute is specified.\n */\n @Prop() public readonly text!: string\n\n /**\n * Sets the checkbox's state.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public checked?: boolean\n\n /**\n * Prevents the checkbox from being interacted with: it cannot be pressed or\n * focused.\n *\n * @webnative\n */\n @Prop() public readonly disabled?: boolean\n\n /**\n * The [`<form>`][] element to associate the checkbox with (its form owner).\n *\n * The value of this attribute must be the id of a `<form>` in the same\n * document. If this attribute is not set, the `<qds-checkbox>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This attribute lets you associate `<qds-checkbox>` elements to `<form>`s\n * anywhere in the document, not just inside a `<form>`. It can also override\n * an ancestor `<form>` element.\n *\n * [`<form>`]: https://developer.mozilla.org/docs/Web/HTML/Element/form\n *\n * @readonly\n * @webnative\n */\n // eslint-disable-next-line unicorn/no-null\n @Prop() public readonly form: ElementInternals['form'] | string = null\n\n /**\n * Sets the checkbox to an indeterminate state. This is usually applied to\n * checkboxes that represent a \"select all/none\" behavior when associated\n * checkboxes have a mix of checked and unchecked states.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public indeterminate?: boolean\n\n /**\n * The name of the checkbox, which is submitted with the form data.\n *\n * @webnative\n */\n @Prop() public readonly name?: string\n\n /**\n * A value must be specified for the checkbox before the owning form can be\n * submitted.\n *\n * See\n * [Client-side validation](https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation)\n * and the\n * [HTML attribute: `required`](https://developer.mozilla.org/docs/Web/HTML/Attributes/required)\n * for more information.\n *\n * @webnative\n */\n @Prop() public readonly required?: boolean\n\n /**\n * The error message that would be shown to the user if the `<qds-checkbox>`\n * was to be checked for validity.\n *\n * @readonly\n * @webnative\n */\n @Prop()\n public readonly validationMessage: ElementInternals['validationMessage'] = ''\n\n /**\n * The [`ValidityState`][] object for this `<qds-checkbox>`.\n *\n * [`ValidityState`]: https://developer.mozilla.org/docs/Web/API/ValidityState\n *\n * @readonly\n * @webnative\n */\n @Prop() public readonly validity: ElementInternals['validity'] = VALID_STATE\n\n /**\n * The value of the checkbox, submitted as a name/value pair with form data.\n *\n * @webnative\n */\n @Prop() public readonly value?: CheckboxValue = 'on'\n\n /**\n * True if `<qds-checkbox>` will be validated when the form is submitted;\n * false otherwise.\n *\n * @readonly\n * @webnative\n */\n @Prop() public readonly willValidate: ElementInternals['willValidate'] = false\n\n /**\n * Whether or not the text is displayed.\n */\n @Prop() public readonly checkboxOnly: boolean = false\n\n @AttachInternals() private readonly internals!: ElementInternals\n\n /**\n * Emitted when the checkbox loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when a change to the checkbox's state is committed by the user.\n */\n @Event({ eventName: 'qdsChange', cancelable: false })\n private readonly changeEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the checkbox gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n @Element() private readonly host!: HTMLElement\n\n @State() private tabIndex?: number\n\n #inheritedAttributes: Attributes = {}\n\n get #computedChecked(): boolean {\n return this.checked ?? false\n }\n\n get #computedDisabled(): boolean {\n return (\n (this.host.matches(':disabled') || (this.disabled ?? false)) &&\n this.host.getAttribute('disabled') !== 'false'\n )\n }\n\n get #computedIndeterminate(): boolean {\n return this.indeterminate ?? false\n }\n\n get #computedSize(): Size {\n switch (this.size) {\n case 'standard':\n case 'small':\n case 'large': {\n return this.size\n }\n default: {\n return 'standard'\n }\n }\n }\n\n get #computedValue(): string | null {\n // eslint-disable-next-line unicorn/no-null\n return this.value == null ? null : this.value.toString()\n }\n\n get #hasText(): boolean {\n return (this.text !== '' || this.required === true) && !this.checkboxOnly\n }\n\n @Listen('click')\n protected onClick(event: MouseEvent): void {\n if (this.#computedDisabled) {\n event.stopImmediatePropagation()\n return\n }\n\n event.preventDefault()\n\n this.checked = this.#computedIndeterminate ? true : !this.#computedChecked\n this.changeEmitter.emit()\n this.indeterminate = false\n }\n\n @Watch('checked')\n protected checkedChanged(): void {\n this.internals.setFormValue(\n this.#computedChecked && !this.#computedDisabled\n ? this.#computedValue\n : // eslint-disable-next-line unicorn/no-null\n null,\n )\n }\n\n @Watch('disabled')\n protected disabledChanged(): void {\n if (this.#computedChecked && !this.#computedDisabled)\n this.internals.setFormValue(this.#computedValue)\n // eslint-disable-next-line unicorn/no-null\n else this.internals.setFormValue(null)\n }\n\n @Watch('tabindex')\n protected tabindexChanged(newValue: string): void {\n const parsedValue = Number.parseInt(newValue, 10)\n this.tabIndex =\n parsedValue === 0 || Number.isNaN(parsedValue) ? undefined : parsedValue\n }\n\n @Watch('value')\n protected valueChanged(): void {\n if (this.#computedChecked && !this.#computedDisabled)\n this.internals.setFormValue(this.#computedValue)\n }\n\n public componentWillLoad(): void {\n this.valueChanged()\n\n this.#defineGetter('form', () => this.internals.form)\n this.#defineGetter('willValidate', () => this.internals.willValidate)\n this.#defineGetter('validity', () => this.internals.validity)\n this.#defineGetter(\n 'validationMessage',\n () => this.internals.validationMessage,\n )\n\n this.#inheritedAttributes = inheritAriaAttributes(this.host)\n this.tabindexChanged(this.host.getAttribute('tabindex') ?? '0')\n }\n\n public render() {\n return (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label\n aria-disabled={this.#computedDisabled ? 'true' : undefined}\n class={{\n 'qds-inline': this.inline,\n 'qds-label': true,\n }}\n data-size={this.#computedSize}\n >\n <div class=\"qds-container\">\n <input\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.host.autofocus}\n checked={this.#computedIndeterminate ? false : this.checked}\n class=\"qds-checkbox\"\n data-size={this.#computedSize}\n disabled={this.#computedDisabled}\n indeterminate={this.indeterminate}\n onBlur={this.#onBlur}\n onFocus={this.#onFocus}\n required={this.required}\n tabIndex={this.#computedDisabled ? undefined : this.tabIndex}\n type=\"checkbox\"\n aria-label={this.checkboxOnly ? this.text : undefined}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.#inheritedAttributes}\n />\n <qds-icon\n aria-hidden=\"true\"\n class={{\n 'qds-icon': true,\n 'qds-checked': true,\n }}\n data-size={this.#computedSize}\n library=\"core\"\n name=\"checked\"\n />\n <qds-icon\n aria-hidden=\"true\"\n class={{\n 'qds-icon': true,\n 'qds-indeterminate': true,\n }}\n data-size={this.#computedSize}\n library=\"core\"\n name=\"indeterminate\"\n />\n </div>\n {this.#hasText && (\n <qds-label\n class=\"qds-label-inner\"\n required={this.required}\n size={this.size}\n text={this.text}\n tabindex={-1}\n tooltipTarget={this.host}\n />\n )}\n </label>\n )\n }\n\n public checkValidity: ElementInternals['checkValidity'] = () =>\n this.internals.checkValidity()\n\n public reportValidity: ElementInternals['reportValidity'] = () =>\n this.internals.reportValidity()\n\n public setCustomValidity: HTMLInputElement['setCustomValidity'] = (error) => {\n if (error) this.internals.setValidity(CUSTOM_ERROR_FLAGS, error, this.host)\n else this.internals.setValidity(NO_ERROR_FLAGS)\n }\n\n readonly #onBlur = (event: FocusEvent): void => {\n this.blurEmitter.emit(pickFocusEventAttributes(event))\n }\n\n readonly #onFocus = (event: FocusEvent): void => {\n this.focusEmitter.emit(pickFocusEventAttributes(event))\n }\n\n #defineGetter(p: PropertyKey, get: () => unknown): void {\n Object.defineProperty(this.host, p, { enumerable: true, get })\n }\n}\n"],"version":3}
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { p as proxyCustomElement, H, c as createEvent, h } from './p-BEWDu8_P.js';
|
|
7
|
-
import { p as pickFocusEventAttributes, i as invariant, b as inheritAriaAttributes } from './p-
|
|
8
|
-
import { d as defineCustomElement$3 } from './p-
|
|
9
|
-
import { d as defineCustomElement$2 } from './p-
|
|
10
|
-
import { d as defineCustomElement$1 } from './p
|
|
7
|
+
import { p as pickFocusEventAttributes, i as invariant, b as inheritAriaAttributes } from './p-Bs-thw7N.js';
|
|
8
|
+
import { d as defineCustomElement$3 } from './p-D6kEwmWw.js';
|
|
9
|
+
import { d as defineCustomElement$2 } from './p-DG13nyez.js';
|
|
10
|
+
import { d as defineCustomElement$1 } from './p--vOFwWP9.js';
|
|
11
11
|
|
|
12
|
-
const radioCss = "[hidden].sc-qds-radio-h{display:none!important}.sc-qds-radio-h{display:inline-block;line-height:0}.qds-
|
|
12
|
+
const radioCss = "[hidden].sc-qds-radio-h{display:none!important}.sc-qds-radio-h{display:inline-block;line-height:0}.qds-icon.sc-qds-radio,.qds-radio.sc-qds-radio{grid-area:h;place-self:center}.qds-icon.sc-qds-radio{display:none;pointer-events:none}.qds-container.sc-qds-radio{display:grid;grid-template-areas:\"h\"}.qds-label.sc-qds-radio{align-items:center;background-color:var(--qds-theme-interactive-background-default);border-radius:var(--qds-control-border-radius);cursor:pointer;display:inline-flex;width:inherit}.qds-label.sc-qds-radio:hover{background-color:var(--qds-theme-interactive-background-hover)}.qds-label.sc-qds-radio:active{background-color:var(--qds-theme-interactive-background-pressed)}.qds-label.sc-qds-radio:has(.qds-radio:focus-visible){outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width)}.qds-label-inner.sc-qds-radio{flex:1 1 auto;min-width:0}.qds-radio.sc-qds-radio{-webkit-appearance:none;appearance:none;background-color:var(--qds-theme-interactive-background-default);border:var(--qds-control-border-width) solid var(--qds-theme-control-border);border-radius:var(--qds-control-rounded-border-radius);cursor:pointer;margin:0;padding:var(--qds-control-toggle-padding);-webkit-print-color-adjust:exact;print-color-adjust:exact}.qds-radio.sc-qds-radio:focus-visible{outline:none}.qds-radio.sc-qds-radio:checked~.qds-icon.sc-qds-radio{color:var(--qds-theme-control-background-contrast);display:block}.qds-radio.sc-qds-radio:not(:checked):hover{background-color:var(--qds-theme-interactive-background-hover)}.qds-radio.sc-qds-radio:not(:checked):active{background-color:var(--qds-theme-interactive-background-pressed)}[aria-disabled=true].sc-qds-radio{opacity:var(--qds-theme-disabled);pointer-events:none}.qds-radio[data-size=small].sc-qds-radio{height:var(--qds-control-toggle-small-box-size);width:var(--qds-control-toggle-small-box-size)}.qds-icon[data-size=small].sc-qds-radio{font-size:var(--qds-control-small-icon-size)}.qds-label[data-size=small].sc-qds-radio{gap:var(--qds-control-small-gap-siblings-related);min-height:var(--qds-control-toggle-small-height);padding:var(--qds-control-no-inline-small-padding-vertical,4px) 0}.qds-inline[data-size=small].sc-qds-radio{min-height:var(--qds-control-small-height);padding:var(--qds-control-standard-padding-auto-height,6px) var(--control-toggle-standard-padding-horizontal,6px)}.qds-radio[data-size=standard].sc-qds-radio{height:var(--qds-control-toggle-standard-box-size);width:var(--qds-control-toggle-standard-box-size)}.qds-icon[data-size=standard].sc-qds-radio{height:var(--qds-control-standard-icon-size);width:var(--qds-control-standard-icon-size)}.qds-label[data-size=standard].sc-qds-radio{gap:var(--qds-control-standard-gap-siblings-related);min-height:var(--qds-control-toggle-standard-height);padding:var(--qds-control-no-inline-standard-padding-vertical,4px) 0}.qds-inline[data-size=standard].sc-qds-radio{min-height:var(--qds-control-standard-height);padding:var(--qds-control-standard-padding-auto-height,6px) var(--control-toggle-standard-padding-horizontal,6px)}.qds-radio[data-size=large].sc-qds-radio{height:var(--qds-control-toggle-large-box-size);width:var(--qds-control-toggle-large-box-size)}.qds-icon[data-size=large].sc-qds-radio{height:var(--qds-control-large-icon-size);width:var(--qds-control-large-icon-size)}.qds-label[data-size=large].sc-qds-radio{gap:var(--qds-control-large-gap-siblings-related);min-height:var(--qds-control-toggle-large-height);padding:var(--qds-control-no-inline-large-padding-vertical,4px) 0}.qds-inline[data-size=large].sc-qds-radio{min-height:var(--qds-control-large-height);padding:var(--qds-control-standard-padding-auto-height,6px) var(--control-toggle-standard-padding-horizontal,6px)}";
|
|
13
13
|
|
|
14
14
|
// SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
15
15
|
//
|
|
@@ -87,10 +87,12 @@ const Radio = /*@__PURE__*/ proxyCustomElement(class Radio extends H {
|
|
|
87
87
|
render() {
|
|
88
88
|
return (
|
|
89
89
|
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
90
|
-
h("label", { key: '
|
|
90
|
+
h("label", { key: '1b057e6d928560f9bddeab0100f9cbd588e11b12', "aria-disabled": __classPrivateFieldGet(this, _Radio_instances, "a", _Radio_computedDisabled_get) ? 'true' : undefined, class: {
|
|
91
91
|
'qds-inline': this.inline,
|
|
92
92
|
'qds-label': true,
|
|
93
|
-
}, "data-size": __classPrivateFieldGet(this, _Radio_instances, "a", _Radio_computedSize_get) }, h("div", { key: '
|
|
93
|
+
}, "data-size": __classPrivateFieldGet(this, _Radio_instances, "a", _Radio_computedSize_get) }, h("div", { key: '82e099d1f414596408691e137eb3925bedb844f7', class: "qds-container" }, h("input", { key: '45a4b0294693fb9f0546b01452e10df96f6aa6d4',
|
|
94
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
95
|
+
autoFocus: this.host.autofocus, checked: this.checked, class: "qds-radio", "data-size": __classPrivateFieldGet(this, _Radio_instances, "a", _Radio_computedSize_get), disabled: this.disabled, form: this.form, name: this.name, onBlur: __classPrivateFieldGet(this, _Radio_onBlur, "f"), onChange: __classPrivateFieldGet(this, _Radio_onChange, "f"), onFocus: __classPrivateFieldGet(this, _Radio_onFocus, "f"), ref: __classPrivateFieldGet(this, _Radio_ref, "f"), required: this.required, tabIndex: __classPrivateFieldGet(this, _Radio_instances, "a", _Radio_computedDisabled_get) ? undefined : this.tabIndex, type: "radio", value: this.value ?? undefined, ...__classPrivateFieldGet(this, _Radio_inheritedAttributes, "f") }), h("qds-icon", { key: 'f535f87c227e26fd8abbb258a6ef73f0e6835acf', "aria-hidden": "true", class: "qds-icon", "data-size": __classPrivateFieldGet(this, _Radio_instances, "a", _Radio_computedSize_get), library: "core", name: "checked-radio" })), __classPrivateFieldGet(this, _Radio_instances, "a", _Radio_hasText_get) && (h("qds-label", { key: '7ba957b356236d4066f454378b7cb8838f73aa63', class: "qds-label-inner", size: __classPrivateFieldGet(this, _Radio_instances, "a", _Radio_computedSize_get), text: this.text }))));
|
|
94
96
|
}
|
|
95
97
|
get host() { return this; }
|
|
96
98
|
static get watchers() { return {
|
|
@@ -157,6 +159,6 @@ function defineCustomElement() {
|
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
export { Radio as R, defineCustomElement as d };
|
|
160
|
-
//# sourceMappingURL=p-
|
|
162
|
+
//# sourceMappingURL=p-Df4zqimN.js.map
|
|
161
163
|
|
|
162
|
-
//# sourceMappingURL=p-
|
|
164
|
+
//# sourceMappingURL=p-Df4zqimN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-Df4zqimN.js","mappings":";;;;;;;;;;;AAAA,MAAM,QAAQ,GAAG,mpHAAmpH;;ACApqH;AACA;AACA;;;;;;;;;;;;;;;;;;MAsCa,KAAK,iBAAAA,kBAAA,CAAA,MAAA,KAAA,SAAAC,CAAA,CAAA;AALlB,IAAA,WAAA,CAAA,YAAA,EAAA;;;;;;;;;AAME;;;;;AAKG;AACqB,QAAA,IAAM,CAAA,MAAA,GAAY,KAAK;AAE/C;;AAEG;AACqB,QAAA,IAAI,CAAA,IAAA,GAAU,UAAU;AA0FhD,QAAA,0BAAA,CAAA,GAAA,CAAA,IAAA,EAAmC,EAAE,CAAA;QAErC,YAAyB,CAAA,GAAA,CAAA,IAAA,EAAA,MAAA,CAAA;QAkGhB,UAAO,CAAA,GAAA,CAAA,IAAA,EAAA,CAAC,KAAwB,KAAU;YACjD,sBAAA,CAAA,IAAI,EAAA,YAAA,EAAU,KAAK,EAAA,GAAA,CAAA;AACrB,SAAC,CAAA;QAEQ,aAAU,CAAA,GAAA,CAAA,IAAA,EAAA,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CAAC,KAAK,IAAI,SAAS,EAE1B,GAAA,sBAAA,CAAA,IAAI,EAAA,0BAAA,EAAA,GAAA,CAAqB,EAC7B,CAAA,EACF,CAAA,CAAA,UAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,aAAA,EACc,MAAM,EAClB,KAAK,EAAC,UAAU,EAAA,WAAA,EACL,uBAAA,IAAI,EAAA,gBAAA,EAAA,GAAA,EAAA,uBAAA,CAAc,EAC7B,OAAO,EAAC,MAAM,EACd,IAAI,EAAC,eAAe,GACpB,CACE,EACL,sBAAA,CAAA,IAAI,EAAS,gBAAA,EAAA,GAAA,EAAA,kBAAA,CAAA,KACZ,CAAA,CAAA,WAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACE,KAAK,EAAC,iBAAiB,EACvB,IAAI,EAAE,sBAAA,CAAA,IAAI,EAAc,gBAAA,EAAA,GAAA,EAAA,uBAAA,CAAA,EACxB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,CAAA,CACH,CACK;;;;;;;;;;;;;;;;;;;;;;AA3FV,IAAA,OAAO,IAAI,CAAC,QAAQ,IAAI,KAAK;AAC/B,CAAC,EAAA,uBAAA,GAAA,SAAA,uBAAA,GAAA;AAGC,IAAA,QAAQ,IAAI,CAAC,IAAI;AACf,QAAA,KAAK,UAAU;AACf,QAAA,KAAK,OAAO;QACZ,KAAK,OAAO,EAAE;YACZ,OAAO,IAAI,CAAC,IAAI;;QAElB,SAAS;AACP,YAAA,OAAO,UAAU;;;AAGvB,CAAC,EAAA,kBAAA,GAAA,SAAA,kBAAA,GAAA;IAGC,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE;AACpD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","HTMLElement"],"sources":["src/components/radio/radio.css?tag=qds-radio&encapsulation=scoped","src/components/radio/radio.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2024 Schneider Electric\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n line-height: 0;\n}\n\n.qds-radio,\n.qds-icon {\n grid-area: radio;\n place-self: center;\n}\n\n.qds-icon {\n display: none;\n pointer-events: none;\n}\n\n.qds-container {\n display: grid;\n grid-template-areas: 'radio';\n}\n\n.qds-label {\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n width: inherit;\n border-radius: var(--qds-control-border-radius);\n background-color: var(--qds-theme-interactive-background-default);\n\n &:hover {\n background-color: var(--qds-theme-interactive-background-hover);\n }\n\n &:active {\n background-color: var(--qds-theme-interactive-background-pressed);\n }\n\n &:has(.qds-radio:focus-visible) {\n outline: var(--qds-theme-focus-border) solid var(--qds-focus-border-width);\n }\n}\n\n.qds-label-inner {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.qds-radio {\n appearance: none;\n background-color: var(--qds-theme-interactive-background-default);\n border-radius: var(--qds-control-rounded-border-radius);\n border: var(--qds-control-border-width) solid var(--qds-theme-control-border);\n cursor: pointer;\n margin: 0;\n padding: var(--qds-control-toggle-padding);\n print-color-adjust: exact;\n\n &:focus-visible {\n outline: none;\n }\n\n &:checked {\n & ~ .qds-icon {\n display: block;\n color: var(--qds-theme-control-background-contrast);\n }\n }\n\n &:not(:checked):hover {\n background-color: var(--qds-theme-interactive-background-hover);\n }\n\n &:not(:checked):active {\n background-color: var(--qds-theme-interactive-background-pressed);\n }\n}\n\n[aria-disabled='true'] {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\n}\n\n[data-size='small'] {\n &.qds-radio {\n width: var(--qds-control-toggle-small-box-size);\n height: var(--qds-control-toggle-small-box-size);\n }\n\n &.qds-icon {\n font-size: var(--qds-control-small-icon-size);\n }\n\n &.qds-label {\n gap: var(--qds-control-small-gap-siblings-related);\n min-height: var(--qds-control-toggle-small-height);\n padding: var(--qds-control-no-inline-small-padding-vertical, 4px) 0;\n }\n\n &.qds-inline {\n min-height: var(--qds-control-small-height);\n padding: var(--qds-control-standard-padding-auto-height, 6px)\n var(--control-toggle-standard-padding-horizontal, 6px);\n }\n}\n\n[data-size='standard'] {\n &.qds-radio {\n width: var(--qds-control-toggle-standard-box-size);\n height: var(--qds-control-toggle-standard-box-size);\n }\n\n &.qds-icon {\n width: var(--qds-control-standard-icon-size);\n height: var(--qds-control-standard-icon-size);\n }\n\n &.qds-label {\n gap: var(--qds-control-standard-gap-siblings-related);\n min-height: var(--qds-control-toggle-standard-height);\n padding: var(--qds-control-no-inline-standard-padding-vertical, 4px) 0;\n }\n\n &.qds-inline {\n min-height: var(--qds-control-standard-height);\n padding: var(--qds-control-standard-padding-auto-height, 6px)\n var(--control-toggle-standard-padding-horizontal, 6px);\n }\n}\n\n[data-size='large'] {\n &.qds-radio {\n width: var(--qds-control-toggle-large-box-size);\n height: var(--qds-control-toggle-large-box-size);\n }\n\n &.qds-icon {\n width: var(--qds-control-large-icon-size);\n height: var(--qds-control-large-icon-size);\n }\n\n &.qds-label {\n gap: var(--qds-control-large-gap-siblings-related);\n min-height: var(--qds-control-toggle-large-height);\n padding: var(--qds-control-no-inline-large-padding-vertical, 4px) 0;\n }\n\n &.qds-inline {\n min-height: var(--qds-control-large-height);\n padding: var(--qds-control-standard-padding-auto-height, 6px)\n var(--control-toggle-standard-padding-horizontal, 6px);\n }\n}\n","// SPDX-FileCopyrightText: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport {\n Component,\n Element,\n Event,\n h,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core'\n\nimport type { Attributes, QdsFocusEventDetail } from '../../helpers'\nimport {\n inheritAriaAttributes,\n invariant,\n pickFocusEventAttributes,\n} from '../../helpers'\nimport type { Value } from '../controls'\nimport type { Size } from '../shared'\n\n/**\n * `<qds-radio>` elements are rendered as circles that are filled when\n * selected. They are generally used in **radio groups** — collections of radio\n * buttons describing a set of related options.\n *\n * Only one radio button in a given radio group can be selected at the same\n * time.\n *\n * @see https://quartz.se.com/build/components/radio\n */\n@Component({\n tag: 'qds-radio',\n scoped: true,\n styleUrl: 'radio.css',\n})\nexport class Radio implements ComponentInterface {\n /**\n * Adds vertical margin to the radio for alignment.\n *\n * This is useful when creating inline layouts so that the first lines have\n * the correct vertical centering.\n */\n @Prop() public readonly inline: boolean = false\n\n /**\n * The radio button's size.\n */\n @Prop() public readonly size?: Size = 'standard'\n\n /**\n * The radio button's text.\n */\n @Prop() public readonly text?: string\n\n /**\n * Sets the radio button's state.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public checked?: boolean\n\n /**\n * Prevents the radio button from being interacted with: it cannot be pressed\n * or focused.\n *\n * @webnative\n */\n @Prop() public readonly disabled?: boolean\n\n /**\n * The [`<form>`](https://developer.mozilla.org/docs/Web/HTML/Element/form)\n * element to associate the radio button with (its form owner).\n *\n * The value of this property must be the id of a `<form>` in the same\n * document. If this property is not set, the `<qds-radio>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This property lets you associate `<qds-radio>` elements to `<form>`s\n * anywhere in the document, not just inside a `<form>`. It can also override\n * an ancestor `<form>` element.\n *\n * @webnative\n */\n @Prop() public readonly form?: string\n\n /**\n * Specify the radio group this radio button belongs to.\n *\n * Once a radio group is established, selecting any radio button in that\n * group automatically deselects any currently-selected radio button in the\n * same group.\n *\n * @webnative\n */\n @Prop() public readonly name?: string\n\n /**\n * Specify the group the radio button belongs to as required.\n *\n * If any radio button in a same-named group of radio buttons has the\n * `required` attribute, a radio button in that group must be checked,\n * although it doesn't have to be the one with the attribute applied.\n *\n * @webnative\n */\n @Prop() public readonly required?: boolean\n\n /**\n * The value of the radio button, submitted as a name/value pair with form\n * data.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public value?: Value\n\n /**\n * Emitted when the radio button loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when the radio button is checked by the user.\n */\n @Event({ eventName: 'qdsChange', cancelable: false })\n private readonly changeEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the radio button gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n @Element() private readonly host!: HTMLElement\n\n @State() private tabIndex?: number\n\n #inheritedAttributes: Attributes = {}\n\n #input?: HTMLInputElement\n\n get #computedDisabled(): boolean {\n return this.disabled ?? false\n }\n\n get #computedSize(): Size {\n switch (this.size) {\n case 'standard':\n case 'small':\n case 'large': {\n return this.size\n }\n default: {\n return 'standard'\n }\n }\n }\n\n get #hasText(): boolean {\n return this.text !== undefined && this.text !== ''\n }\n\n @Listen('click')\n protected onClick(event: MouseEvent): void {\n if (this.#computedDisabled) {\n event.stopImmediatePropagation()\n return\n }\n\n invariant(this.#input)\n\n this.checked = this.#input.checked\n }\n\n @Watch('tabindex')\n protected tabindexChanged(newValue: string): void {\n const parsedValue = Number.parseInt(newValue, 10)\n this.tabIndex =\n parsedValue === 0 || Number.isNaN(parsedValue) ? undefined : parsedValue\n }\n\n public componentWillLoad(): void {\n this.#inheritedAttributes = inheritAriaAttributes(this.host)\n this.tabindexChanged(this.host.getAttribute('tabindex') ?? '0')\n }\n\n public render() {\n return (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label\n aria-disabled={this.#computedDisabled ? 'true' : undefined}\n class={{\n 'qds-inline': this.inline,\n 'qds-label': true,\n }}\n data-size={this.#computedSize}\n >\n <div class=\"qds-container\">\n <input\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.host.autofocus}\n checked={this.checked}\n class=\"qds-radio\"\n data-size={this.#computedSize}\n disabled={this.disabled}\n form={this.form}\n name={this.name}\n onBlur={this.#onBlur}\n onChange={this.#onChange}\n onFocus={this.#onFocus}\n ref={this.#ref}\n required={this.required}\n tabIndex={this.#computedDisabled ? undefined : this.tabIndex}\n type=\"radio\"\n value={this.value ?? undefined}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.#inheritedAttributes}\n />\n <qds-icon\n aria-hidden=\"true\"\n class=\"qds-icon\"\n data-size={this.#computedSize}\n library=\"core\"\n name=\"checked-radio\"\n />\n </div>\n {this.#hasText && (\n <qds-label\n class=\"qds-label-inner\"\n size={this.#computedSize}\n text={this.text}\n />\n )}\n </label>\n )\n }\n\n readonly #ref = (input?: HTMLInputElement): void => {\n this.#input = input\n }\n\n readonly #onBlur = (event: FocusEvent): void => {\n this.blurEmitter.emit(pickFocusEventAttributes(event))\n }\n\n readonly #onChange = (): void => {\n this.changeEmitter.emit()\n }\n\n readonly #onFocus = (event: FocusEvent): void => {\n this.focusEmitter.emit(pickFocusEventAttributes(event))\n }\n}\n"],"version":3}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { p as proxyCustomElement, H, c as createEvent, h, e as Host } from './p-BEWDu8_P.js';
|
|
7
7
|
import { o as offset, f as flip, s as shift, c as computePosition, a as autoUpdate, l as limitShift } from './p-MCOLEIOA.js';
|
|
8
|
-
import { V as VERTICAL_MOVE_KEYS, e as ignorePromise, f as propertyToPx, r as resolveTarget, g as roundByDPR } from './p-
|
|
8
|
+
import { V as VERTICAL_MOVE_KEYS, e as ignorePromise, f as propertyToPx, r as resolveTarget, g as roundByDPR } from './p-Bs-thw7N.js';
|
|
9
9
|
|
|
10
10
|
const dropdownCss = ":host([hidden]){display:none!important}:host{background:var(--qds-theme-popup-background);border:none;border-radius:var(--qds-popup-border-radius);box-shadow:var(--qds-popup-elevation);box-sizing:border-box;display:inline-block;inset-block-start:0;inset-inline-start:0;margin:0;overflow:initial;padding:0}";
|
|
11
11
|
|
|
@@ -421,6 +421,6 @@ function defineCustomElement() {
|
|
|
421
421
|
}
|
|
422
422
|
|
|
423
423
|
export { Dropdown as D, defineCustomElement as d };
|
|
424
|
-
//# sourceMappingURL=p-
|
|
424
|
+
//#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YAAE;QAChB,KAAK,MAAM,IAAI,IAAI,sBAAA,CAAA,IAAI,EAAO,eAAA,EAAA,GAAA,CAAA;AAAE,YAAA,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC;AACnE,QAAA,SAAS,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC;QACvC,SAAS,CAAC,KAAK,EAAE;AACnB,KAAC,CAAC;AACJ,CAAC,EAAA,oCAAA,GAAA,SAAA,oCAAA,GAAA;AAGC,IAAA,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC;AAE5C,IAAA,IAAI,EAAE,sBAAA,CAAA,IAAI,kCAAkB,YAAY,UAAU,CAAC,OAAO,CAAC;QAAE;IAE7D,sBAAA,CAAA,IAAI,EAAkB,0BAAA,EAAA,GAAA,CAAA,CAAC,mBAAmB,CACxC,UAAU,EACV,sBAAA,CAAA,IAAI,EAAiB,yBAAA,EAAA,GAAA,CAAA,CACtB;IACD,sBAAA,CAAA,IAAI,EAAkB,0BAAA,EAAA,GAAA,CAAA,CAAC,mBAAmB,CAAC,SAAS,EAAE,sBAAA,CAAA,IAAI,EAAgB,wBAAA,EAAA,GAAA,CAAA,CAAC;AAC3E,IAAA,sBAAA,CAAA,IAAI,EAAkB,0BAAA,EAAA,GAAA,CAAA,CAAC,eAAe,CAAC,eAAe,CAAC;AACvD,IAAA,sBAAA,CAAA,IAAI,EAAkB,0BAAA,EAAA,GAAA,CAAA,CAAC,eAAe,CAAC,eAAe,CAAC;AACzD,CAAC;;;;;;;;;;;;;;;;;","names":["HTMLElement","__stencil_proxyCustomElement"],"sources":["src/components/dropdown/dropdown.css?tag=qds-dropdown&encapsulation=shadow","src/components/dropdown/dropdown.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2024 Schneider Electric\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\n@import url('../shared.css');\n\n:host {\n background: var(--qds-theme-popup-background);\n border-radius: var(--qds-popup-border-radius);\n border: none;\n box-shadow: var(--qds-popup-elevation);\n box-sizing: border-box;\n display: inline-block;\n inset-inline-start: 0;\n margin: 0;\n overflow: initial;\n padding: 0;\n inset-block-start: 0;\n}\n","// SPDX-FileCopyrightText: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n AutoUpdateOptions,\n DetectOverflowOptions,\n FlipOptions,\n Middleware,\n Placement,\n ReferenceElement,\n ShiftOptions,\n Strategy,\n} from '@floating-ui/dom'\nimport {\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 AttachInternals,\n Component,\n Element,\n Event,\n h,\n Host,\n Listen,\n Method,\n Prop,\n Watch,\n} from '@stencil/core'\n\nimport type { OffsetOptions } from '../../helpers'\nimport {\n ignorePromise,\n propertyToPx,\n resolveTarget,\n roundByDPR,\n VERTICAL_MOVE_KEYS,\n} from '../../helpers'\n\nlet autoIncrementingId = 1\n\nconst isQdsButton = (\n element: globalThis.Element,\n): element is HTMLQdsButtonElement =>\n element.tagName.toLowerCase() === 'qds-button'\n\nconst ALLOWED_TAGS: ReadonlySet<string> = new Set([\n 'qds-action-item',\n 'qds-menu-item',\n])\n\nconst isEnabledItem = (element: unknown): element is HTMLElement =>\n element instanceof HTMLElement &&\n ALLOWED_TAGS.has(element.tagName.toLowerCase()) &&\n !element.hasAttribute('disabled') &&\n !element.inert\n\n/**\n * @slot Content to display in the dropdown.\n * @see https://quartz.se.com/build/components/dropdown\n */\n@Component({\n tag: 'qds-dropdown',\n shadow: { delegatesFocus: true },\n styleUrl: 'dropdown.css',\n})\nexport class Dropdown 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 dropdown from being shown by user interaction. The dropdown\n * can still be displayed by calling the `show()` method.\n */\n @Prop() public readonly disabled: boolean = 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 dropdown relative to the `target`.\n *\n * @see https://floating-ui.com/docs/tutorial#placements\n */\n @Prop() public readonly placement: Placement = 'bottom-start'\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 dropdown. The target specified\n * can be any of the following:\n *\n * - A CSS selector string\n * - A reference to an [`Element`][] or [Virtual Element][]\n * - A function returning a reference to an [`Element`][],\n * [Virtual Element][], or a CSS selector string\n *\n * [`Element`]: https://developer.mozilla.org/docs/Web/API/Element\n * [Virtual Element]: https://floating-ui.com/docs/virtual-elements\n */\n @Prop() public readonly target!:\n | ReferenceElement\n | string\n | (() => ReferenceElement | string)\n\n /**\n * By default, the dropdown is closed when an item is selected. This attribute will keep it open instead. Useful for\n * dropdowns that allow for multiple interactions.\n */\n @Prop() public readonly keepOpenOnSelect: boolean = false\n\n /**\n * Emitted when the user instructs the browser that they wish to dismiss the\n * current open dropdown by pressing the `Esc` key.\n *\n * When a dropdown is dismissed with the `Esc` key, both the `qdsCancel` and\n * `qdsClose` events are emitted.\n */\n @Event({ eventName: 'qdsCancel', bubbles: false })\n private readonly cancelEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the dropdown is closed.\n */\n @Event({ eventName: 'qdsClose', bubbles: false, cancelable: false })\n private readonly closeEmitter!: EventEmitter<void>\n\n @Element() private readonly host!: HTMLElement\n\n @AttachInternals() private readonly internals!: ElementInternals\n\n #cleanup?: () => void\n\n #Items: HTMLElement[] = []\n\n #gap = 0\n\n #middleware?: Middleware[]\n\n #referenceElement?: ReferenceElement\n\n #open = false\n\n /**\n * Whether the dropdown has been opened at least once.\n * This is used to determine whether the dropdown should update its position, gap\n * and middleware when it is opened.\n */\n #opened = false\n\n /**\n * Updates the gap between the dropdown and its target element.\n */\n @Method()\n public async updateGap(): Promise<void> {\n this.#gap = propertyToPx(this.host, '--qds-accessory-gap-floating') ?? 0\n\n await this.updateMiddleware()\n }\n\n /**\n * Shows the dropdown.\n */\n @Method()\n public async show(): Promise<void> {\n if (this.#open) return\n\n const reference = this.#referenceElement\n const { host } = this\n\n if (reference instanceof globalThis.Element) {\n reference.setAttribute('aria-expanded', 'true')\n reference.setAttribute('aria-controls', host.id)\n host.setAttribute('aria-labelledby', reference.id)\n if (!reference.hasAttribute('aria-haspopup'))\n reference.setAttribute('aria-haspopup', 'true')\n\n if (isQdsButton(reference) && reference.action === 'dropdown')\n reference.action = 'dropdown-close'\n }\n\n this.#open = true\n host.hidden = false\n host.showPopover()\n this.startAutoUpdate()\n\n if (!this.#opened) await this.updateGap()\n this.#opened = true\n }\n\n /**\n * Closes the dropdown.\n */\n @Method()\n public async close(): Promise<void> {\n if (!this.#open) return\n\n if (this.#referenceElement instanceof globalThis.Element) {\n this.#referenceElement.setAttribute('aria-expanded', 'false')\n this.#referenceElement.removeAttribute('aria-controls')\n\n if (\n isQdsButton(this.#referenceElement) &&\n this.#referenceElement.action === 'dropdown-close'\n )\n this.#referenceElement.action = 'dropdown'\n }\n\n this.#open = false\n this.host.hidden = true\n this.host.hidePopover()\n if (this.#cleanup) this.#cleanup()\n\n this.closeEmitter.emit()\n }\n\n @Listen('click', { target: 'document' })\n protected async handleMouseDown(event: MouseEvent): Promise<void> {\n if (!this.#open) return\n\n const composedPath = event.composedPath()\n const withinBounds =\n composedPath.includes(this.host) ||\n (this.#referenceElement instanceof globalThis.Element &&\n composedPath.includes(this.#referenceElement))\n if (!withinBounds) await this.close()\n }\n\n @Listen('click')\n protected async onItemClick(event: MouseEvent): Promise<void> {\n if (!this.keepOpenOnSelect && isEnabledItem(event.target)) {\n await this.close()\n }\n }\n\n @Watch('gap')\n protected async onGapChange(): Promise<void> {\n await this.updateMiddleware()\n }\n\n @Watch('target')\n protected async updateReferenceElement(): Promise<void> {\n this.#disconnectReferenceElement()\n\n this.#referenceElement = resolveTarget(this.target)\n\n if (!(this.#referenceElement instanceof globalThis.Element)) return\n\n this.#referenceElement.setAttribute('aria-expanded', 'false')\n this.#referenceElement.addEventListener(\n 'click',\n this.#boundOnReferenceClick,\n )\n this.#referenceElement.addEventListener('focusout', this.#boundOnFocusout)\n this.#referenceElement.addEventListener('keydown', this.#boundOnKeydown)\n\n if (this.host.role === 'menu') {\n this.#referenceElement.id ||= `qds-dropdown-trigger-${autoIncrementingId}`\n this.host.setAttribute('aria-labelledby', this.#referenceElement.id)\n }\n await this.updatePosition()\n }\n\n @Watch('flipOptions')\n @Watch('noFlip')\n @Watch('noShift')\n @Watch('offsetOptions')\n @Watch('shiftOptions')\n protected async updateMiddleware(): Promise<void> {\n this.#middleware = [\n offset({\n ...this.offsetOptions,\n mainAxis: this.#gap,\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 ].filter((middleware): middleware is Middleware => middleware !== false)\n await this.updatePosition()\n }\n\n @Watch('placement')\n @Watch('strategy')\n protected async updatePosition(): Promise<void> {\n if (!this.#referenceElement) return\n\n const { x, y, strategy } = await computePosition(\n this.#referenceElement,\n this.host,\n {\n middleware: this.#middleware,\n placement: this.placement,\n strategy: this.strategy,\n },\n )\n this.host.style.position = strategy\n this.host.style.transform = `translate(${roundByDPR(x)}px,${roundByDPR(y)}px)`\n }\n\n @Watch('autoUpdateOptions')\n protected startAutoUpdate(): void {\n if (!this.#referenceElement) return\n\n if (this.#cleanup) this.#cleanup()\n this.#cleanup = autoUpdate(\n this.#referenceElement,\n this.host,\n () => {\n ignorePromise(this.updatePosition())\n },\n this.autoUpdateOptions,\n )\n }\n\n public async componentWillLoad(): Promise<void> {\n this.host.hidden = true\n this.host.popover = 'manual'\n this.internals.role = 'menu'\n this.host.id ||= `qds-dropdown-${autoIncrementingId}`\n await this.updateReferenceElement()\n autoIncrementingId += 1\n await this.updateMiddleware()\n }\n\n public disconnectedCallback(): void {\n this.#disconnectReferenceElement()\n }\n\n public render() {\n return (\n <Host onKeyDown={this.#onKeydown} onFocusout={this.#onFocusout}>\n <slot onSlotchange={this.#onSlotchange} />\n </Host>\n )\n }\n\n readonly #onFocusout = async (event: Event): Promise<void> => {\n if (!(event instanceof FocusEvent)) return\n const { relatedTarget } = event\n\n if (\n relatedTarget instanceof globalThis.Element &&\n !this.host.contains(relatedTarget) &&\n this.#referenceElement !== relatedTarget\n )\n await this.close()\n }\n\n #focusOnTrigger(): void {\n if (\n this.#referenceElement instanceof globalThis.HTMLElement ||\n this.#referenceElement instanceof globalThis.SVGElement\n ) {\n this.#referenceElement.focus()\n }\n }\n\n readonly #onKeydown = async (event: Event): Promise<void> => {\n if (!(event instanceof KeyboardEvent)) return\n\n const { key, target } = event\n\n if (key === 'Enter' && !this.keepOpenOnSelect && isEnabledItem(target)) {\n await this.close()\n this.#focusOnTrigger()\n return\n }\n\n if (\n key === 'Escape' &&\n (target === this.#referenceElement ||\n (target instanceof globalThis.Element &&\n target.closest('qds-dropdown') === this.host))\n ) {\n const cancelEvent = this.cancelEmitter.emit()\n if (cancelEvent.defaultPrevented) return\n\n await this.close()\n this.#focusOnTrigger()\n\n return\n }\n\n if (\n target === this.#referenceElement &&\n (key === 'ArrowDown' || key === 'ArrowUp')\n ) {\n if (!this.#open) await this.show()\n this.#focusFirstItem()\n event.preventDefault()\n return\n }\n\n if (!VERTICAL_MOVE_KEYS.has(key)) return\n\n const Items = this.#Items.filter(\n (item: HTMLElement) =>\n isEnabledItem(item) && item.closest('qds-dropdown') === this.host,\n )\n\n if (Items.length === 0) return\n\n event.preventDefault()\n event.stopPropagation()\n\n const currentIndex = Items.findIndex(\n (item: HTMLElement) => item.getAttribute('tabindex') === '0',\n )\n\n let nextIndex = currentIndex\n\n switch (key) {\n case 'ArrowUp': {\n nextIndex = currentIndex > 0 ? currentIndex - 1 : Items.length - 1\n break\n }\n case 'ArrowDown': {\n nextIndex = currentIndex < Items.length - 1 ? currentIndex + 1 : 0\n break\n }\n case 'Home': {\n nextIndex = 0\n break\n }\n case 'End': {\n nextIndex = Items.length - 1\n break\n }\n default: {\n return\n }\n }\n const nextItem = Items[nextIndex]\n for (const [index, item] of Items.entries()) {\n ;(item as HTMLElement).setAttribute(\n 'tabindex',\n index === nextIndex ? '0' : '-1',\n )\n }\n\n nextItem.focus()\n event.preventDefault()\n }\n\n readonly #onReferenceClick = async (): Promise<void> => {\n if (this.disabled) return\n\n if (this.#open) {\n await this.close()\n return\n }\n\n await this.show()\n this.#focusFirstItem()\n }\n\n #focusFirstItem(): void {\n requestAnimationFrame(() => {\n const firstItem = this.#Items.find(\n (item) =>\n item instanceof HTMLElement &&\n isEnabledItem(item) &&\n item.closest('qds-dropdown') === this.host,\n )\n if (!firstItem) return\n for (const item of this.#Items) item.setAttribute('tabindex', '-1')\n firstItem.setAttribute('tabindex', '0')\n firstItem.focus()\n })\n }\n\n #disconnectReferenceElement(): void {\n this.host.removeAttribute('aria-labelledby')\n\n if (!(this.#referenceElement instanceof globalThis.Element)) return\n\n this.#referenceElement.removeEventListener(\n 'focusout',\n this.#boundOnFocusout,\n )\n this.#referenceElement.removeEventListener('keydown', this.#boundOnKeydown)\n this.#referenceElement.removeAttribute('aria-expanded')\n this.#referenceElement.removeAttribute('aria-controls')\n }\n\n readonly #boundOnFocusout = (event: Event): void => {\n ignorePromise(this.#onFocusout(event))\n }\n\n readonly #boundOnKeydown = (event: Event): void => {\n ignorePromise(this.#onKeydown(event))\n }\n\n readonly #boundOnReferenceClick = (): void => {\n ignorePromise(this.#onReferenceClick())\n }\n\n readonly #onSlotchange = (event: Event): void => {\n const slot = event.target as HTMLSlotElement\n const assignedElements = slot.assignedElements({ flatten: true })\n\n this.#Items = assignedElements.filter((element): element is HTMLElement =>\n isEnabledItem(element),\n )\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"p-Dmky30vp.js","mappings":";;;;;;;;;AAAA,MAAM,WAAW,GAAG,mTAAmT;;ACAvU;AACA;AACA;;;;;;;;;;;;;;;;;;AA2CA,IAAI,kBAAkB,GAAG,CAAC;AAE1B,MAAM,WAAW,GAAG,CAClB,OAA2B,KAE3B,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,YAAY;AAEhD,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC;IAChD,iBAAiB;IACjB,eAAe;AAChB,CAAA,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,OAAgB,KACrC,OAAO,YAAYA,CAAW;IAC9B,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;AAC/C,IAAA,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC;IACjC,CAAC,OAAO,CAAC,KA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EAAE,sBAAA,CAAA,IAAI,EAAgB,wBAAA,EAAA,GAAA,CAAA,CAAC;AAC3E,IAAA,sBAAA,CAAA,IAAI,EAAkB,0BAAA,EAAA,GAAA,CAAA,CAAC,eAAe,CAAC,eAAe,CAAC;AACvD,IAAA,sBAAA,CAAA,IAAI,EAAkB,0BAAA,EAAA,GAAA,CAAA,CAAC,eAAe,CAAC,eAAe,CAAC;AACzD,CAAC;;;;;;;;;;;;;;;;;","names":["HTMLElement","__stencil_proxyCustomElement"],"sources":["src/components/dropdown/dropdown.css?tag=qds-dropdown&encapsulation=shadow","src/components/dropdown/dropdown.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2024 Schneider Electric\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\n@import url('../shared.css');\n\n:host {\n background: var(--qds-theme-popup-background);\n border-radius: var(--qds-popup-border-radius);\n border: none;\n box-shadow: var(--qds-popup-elevation);\n box-sizing: border-box;\n display: inline-block;\n inset-inline-start: 0;\n margin: 0;\n overflow: initial;\n padding: 0;\n inset-block-start: 0;\n}\n","// SPDX-FileCopyrightText: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n AutoUpdateOptions,\n DetectOverflowOptions,\n FlipOptions,\n Middleware,\n Placement,\n ReferenceElement,\n ShiftOptions,\n Strategy,\n} from '@floating-ui/dom'\nimport {\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 AttachInternals,\n Component,\n Element,\n Event,\n h,\n Host,\n Listen,\n Method,\n Prop,\n Watch,\n} from '@stencil/core'\n\nimport type { OffsetOptions } from '../../helpers'\nimport {\n ignorePromise,\n propertyToPx,\n resolveTarget,\n roundByDPR,\n VERTICAL_MOVE_KEYS,\n} from '../../helpers'\n\nlet autoIncrementingId = 1\n\nconst isQdsButton = (\n element: globalThis.Element,\n): element is HTMLQdsButtonElement =>\n element.tagName.toLowerCase() === 'qds-button'\n\nconst ALLOWED_TAGS: ReadonlySet<string> = new Set([\n 'qds-action-item',\n 'qds-menu-item',\n])\n\nconst isEnabledItem = (element: unknown): element is HTMLElement =>\n element instanceof HTMLElement &&\n ALLOWED_TAGS.has(element.tagName.toLowerCase()) &&\n !element.hasAttribute('disabled') &&\n !element.inert\n\n/**\n * @slot Content to display in the dropdown.\n * @see https://quartz.se.com/build/components/dropdown\n */\n@Component({\n tag: 'qds-dropdown',\n shadow: { delegatesFocus: true },\n styleUrl: 'dropdown.css',\n})\nexport class Dropdown 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 dropdown from being shown by user interaction. The dropdown\n * can still be displayed by calling the `show()` method.\n */\n @Prop() public readonly disabled: boolean = 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 dropdown relative to the `target`.\n *\n * @see https://floating-ui.com/docs/tutorial#placements\n */\n @Prop() public readonly placement: Placement = 'bottom-start'\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 dropdown. The target specified\n * can be any of the following:\n *\n * - A CSS selector string\n * - A reference to an [`Element`][] or [Virtual Element][]\n * - A function returning a reference to an [`Element`][],\n * [Virtual Element][], or a CSS selector string\n *\n * [`Element`]: https://developer.mozilla.org/docs/Web/API/Element\n * [Virtual Element]: https://floating-ui.com/docs/virtual-elements\n */\n @Prop() public readonly target!:\n | ReferenceElement\n | string\n | (() => ReferenceElement | string)\n\n /**\n * By default, the dropdown is closed when an item is selected. This attribute will keep it open instead. Useful for\n * dropdowns that allow for multiple interactions.\n */\n @Prop() public readonly keepOpenOnSelect: boolean = false\n\n /**\n * Emitted when the user instructs the browser that they wish to dismiss the\n * current open dropdown by pressing the `Esc` key.\n *\n * When a dropdown is dismissed with the `Esc` key, both the `qdsCancel` and\n * `qdsClose` events are emitted.\n */\n @Event({ eventName: 'qdsCancel', bubbles: false })\n private readonly cancelEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the dropdown is closed.\n */\n @Event({ eventName: 'qdsClose', bubbles: false, cancelable: false })\n private readonly closeEmitter!: EventEmitter<void>\n\n @Element() private readonly host!: HTMLElement\n\n @AttachInternals() private readonly internals!: ElementInternals\n\n #cleanup?: () => void\n\n #Items: HTMLElement[] = []\n\n #gap = 0\n\n #middleware?: Middleware[]\n\n #referenceElement?: ReferenceElement\n\n #open = false\n\n /**\n * Whether the dropdown has been opened at least once.\n * This is used to determine whether the dropdown should update its position, gap\n * and middleware when it is opened.\n */\n #opened = false\n\n /**\n * Updates the gap between the dropdown and its target element.\n */\n @Method()\n public async updateGap(): Promise<void> {\n this.#gap = propertyToPx(this.host, '--qds-accessory-gap-floating') ?? 0\n\n await this.updateMiddleware()\n }\n\n /**\n * Shows the dropdown.\n */\n @Method()\n public async show(): Promise<void> {\n if (this.#open) return\n\n const reference = this.#referenceElement\n const { host } = this\n\n if (reference instanceof globalThis.Element) {\n reference.setAttribute('aria-expanded', 'true')\n reference.setAttribute('aria-controls', host.id)\n host.setAttribute('aria-labelledby', reference.id)\n if (!reference.hasAttribute('aria-haspopup'))\n reference.setAttribute('aria-haspopup', 'true')\n\n if (isQdsButton(reference) && reference.action === 'dropdown')\n reference.action = 'dropdown-close'\n }\n\n this.#open = true\n host.hidden = false\n host.showPopover()\n this.startAutoUpdate()\n\n if (!this.#opened) await this.updateGap()\n this.#opened = true\n }\n\n /**\n * Closes the dropdown.\n */\n @Method()\n public async close(): Promise<void> {\n if (!this.#open) return\n\n if (this.#referenceElement instanceof globalThis.Element) {\n this.#referenceElement.setAttribute('aria-expanded', 'false')\n this.#referenceElement.removeAttribute('aria-controls')\n\n if (\n isQdsButton(this.#referenceElement) &&\n this.#referenceElement.action === 'dropdown-close'\n )\n this.#referenceElement.action = 'dropdown'\n }\n\n this.#open = false\n this.host.hidden = true\n this.host.hidePopover()\n if (this.#cleanup) this.#cleanup()\n\n this.closeEmitter.emit()\n }\n\n @Listen('click', { target: 'document' })\n protected async handleMouseDown(event: MouseEvent): Promise<void> {\n if (!this.#open) return\n\n const composedPath = event.composedPath()\n const withinBounds =\n composedPath.includes(this.host) ||\n (this.#referenceElement instanceof globalThis.Element &&\n composedPath.includes(this.#referenceElement))\n if (!withinBounds) await this.close()\n }\n\n @Listen('click')\n protected async onItemClick(event: MouseEvent): Promise<void> {\n if (!this.keepOpenOnSelect && isEnabledItem(event.target)) {\n await this.close()\n }\n }\n\n @Watch('gap')\n protected async onGapChange(): Promise<void> {\n await this.updateMiddleware()\n }\n\n @Watch('target')\n protected async updateReferenceElement(): Promise<void> {\n this.#disconnectReferenceElement()\n\n this.#referenceElement = resolveTarget(this.target)\n\n if (!(this.#referenceElement instanceof globalThis.Element)) return\n\n this.#referenceElement.setAttribute('aria-expanded', 'false')\n this.#referenceElement.addEventListener(\n 'click',\n this.#boundOnReferenceClick,\n )\n this.#referenceElement.addEventListener('focusout', this.#boundOnFocusout)\n this.#referenceElement.addEventListener('keydown', this.#boundOnKeydown)\n\n if (this.host.role === 'menu') {\n this.#referenceElement.id ||= `qds-dropdown-trigger-${autoIncrementingId}`\n this.host.setAttribute('aria-labelledby', this.#referenceElement.id)\n }\n await this.updatePosition()\n }\n\n @Watch('flipOptions')\n @Watch('noFlip')\n @Watch('noShift')\n @Watch('offsetOptions')\n @Watch('shiftOptions')\n protected async updateMiddleware(): Promise<void> {\n this.#middleware = [\n offset({\n ...this.offsetOptions,\n mainAxis: this.#gap,\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 ].filter((middleware): middleware is Middleware => middleware !== false)\n await this.updatePosition()\n }\n\n @Watch('placement')\n @Watch('strategy')\n protected async updatePosition(): Promise<void> {\n if (!this.#referenceElement) return\n\n const { x, y, strategy } = await computePosition(\n this.#referenceElement,\n this.host,\n {\n middleware: this.#middleware,\n placement: this.placement,\n strategy: this.strategy,\n },\n )\n this.host.style.position = strategy\n this.host.style.transform = `translate(${roundByDPR(x)}px,${roundByDPR(y)}px)`\n }\n\n @Watch('autoUpdateOptions')\n protected startAutoUpdate(): void {\n if (!this.#referenceElement) return\n\n if (this.#cleanup) this.#cleanup()\n this.#cleanup = autoUpdate(\n this.#referenceElement,\n this.host,\n () => {\n ignorePromise(this.updatePosition())\n },\n this.autoUpdateOptions,\n )\n }\n\n public async componentWillLoad(): Promise<void> {\n this.host.hidden = true\n this.host.popover = 'manual'\n this.internals.role = 'menu'\n this.host.id ||= `qds-dropdown-${autoIncrementingId}`\n await this.updateReferenceElement()\n autoIncrementingId += 1\n await this.updateMiddleware()\n }\n\n public disconnectedCallback(): void {\n this.#disconnectReferenceElement()\n }\n\n public render() {\n return (\n <Host onKeyDown={this.#onKeydown} onFocusout={this.#onFocusout}>\n <slot onSlotchange={this.#onSlotchange} />\n </Host>\n )\n }\n\n readonly #onFocusout = async (event: Event): Promise<void> => {\n if (!(event instanceof FocusEvent)) return\n const { relatedTarget } = event\n\n if (\n relatedTarget instanceof globalThis.Element &&\n !this.host.contains(relatedTarget) &&\n this.#referenceElement !== relatedTarget\n )\n await this.close()\n }\n\n #focusOnTrigger(): void {\n if (\n this.#referenceElement instanceof globalThis.HTMLElement ||\n this.#referenceElement instanceof globalThis.SVGElement\n ) {\n this.#referenceElement.focus()\n }\n }\n\n readonly #onKeydown = async (event: Event): Promise<void> => {\n if (!(event instanceof KeyboardEvent)) return\n\n const { key, target } = event\n\n if (key === 'Enter' && !this.keepOpenOnSelect && isEnabledItem(target)) {\n await this.close()\n this.#focusOnTrigger()\n return\n }\n\n if (\n key === 'Escape' &&\n (target === this.#referenceElement ||\n (target instanceof globalThis.Element &&\n target.closest('qds-dropdown') === this.host))\n ) {\n const cancelEvent = this.cancelEmitter.emit()\n if (cancelEvent.defaultPrevented) return\n\n await this.close()\n this.#focusOnTrigger()\n\n return\n }\n\n if (\n target === this.#referenceElement &&\n (key === 'ArrowDown' || key === 'ArrowUp')\n ) {\n if (!this.#open) await this.show()\n this.#focusFirstItem()\n event.preventDefault()\n return\n }\n\n if (!VERTICAL_MOVE_KEYS.has(key)) return\n\n const Items = this.#Items.filter(\n (item: HTMLElement) =>\n isEnabledItem(item) && item.closest('qds-dropdown') === this.host,\n )\n\n if (Items.length === 0) return\n\n event.preventDefault()\n event.stopPropagation()\n\n const currentIndex = Items.findIndex(\n (item: HTMLElement) => item.getAttribute('tabindex') === '0',\n )\n\n let nextIndex = currentIndex\n\n switch (key) {\n case 'ArrowUp': {\n nextIndex = currentIndex > 0 ? currentIndex - 1 : Items.length - 1\n break\n }\n case 'ArrowDown': {\n nextIndex = currentIndex < Items.length - 1 ? currentIndex + 1 : 0\n break\n }\n case 'Home': {\n nextIndex = 0\n break\n }\n case 'End': {\n nextIndex = Items.length - 1\n break\n }\n default: {\n return\n }\n }\n const nextItem = Items[nextIndex]\n for (const [index, item] of Items.entries()) {\n ;(item as HTMLElement).setAttribute(\n 'tabindex',\n index === nextIndex ? '0' : '-1',\n )\n }\n\n nextItem.focus()\n event.preventDefault()\n }\n\n readonly #onReferenceClick = async (): Promise<void> => {\n if (this.disabled) return\n\n if (this.#open) {\n await this.close()\n return\n }\n\n await this.show()\n this.#focusFirstItem()\n }\n\n #focusFirstItem(): void {\n requestAnimationFrame(() => {\n const firstItem = this.#Items.find(\n (item) =>\n item instanceof HTMLElement &&\n isEnabledItem(item) &&\n item.closest('qds-dropdown') === this.host,\n )\n if (!firstItem) return\n for (const item of this.#Items) item.setAttribute('tabindex', '-1')\n firstItem.setAttribute('tabindex', '0')\n firstItem.focus()\n })\n }\n\n #disconnectReferenceElement(): void {\n this.host.removeAttribute('aria-labelledby')\n\n if (!(this.#referenceElement instanceof globalThis.Element)) return\n\n this.#referenceElement.removeEventListener(\n 'focusout',\n this.#boundOnFocusout,\n )\n this.#referenceElement.removeEventListener('keydown', this.#boundOnKeydown)\n this.#referenceElement.removeAttribute('aria-expanded')\n this.#referenceElement.removeAttribute('aria-controls')\n }\n\n readonly #boundOnFocusout = (event: Event): void => {\n ignorePromise(this.#onFocusout(event))\n }\n\n readonly #boundOnKeydown = (event: Event): void => {\n ignorePromise(this.#onKeydown(event))\n }\n\n readonly #boundOnReferenceClick = (): void => {\n ignorePromise(this.#onReferenceClick())\n }\n\n readonly #onSlotchange = (event: Event): void => {\n const slot = event.target as HTMLSlotElement\n const assignedElements = slot.assignedElements({ flatten: true })\n\n this.#Items = assignedElements.filter((element): element is HTMLElement =>\n isEnabledItem(element),\n )\n }\n}\n"],"version":3}
|