@quartzds/core 1.0.0-beta.8 → 1.0.0-beta.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/components/index.d.ts +50 -0
- package/components/index.js +49 -27
- package/components/index.js.map +1 -1
- package/components/p-028b9d2e.js +96 -0
- package/components/p-028b9d2e.js.map +1 -0
- package/components/p-355efdb1.js +83 -0
- package/components/p-355efdb1.js.map +1 -0
- package/components/p-4141d6ed.js +204 -0
- package/components/p-4141d6ed.js.map +1 -0
- package/components/p-698edde1.js +321 -0
- package/components/p-698edde1.js.map +1 -0
- package/components/p-7b04d43e.js +1556 -0
- package/components/p-7b04d43e.js.map +1 -0
- package/components/p-7f6e797a.js +108 -0
- package/components/p-7f6e797a.js.map +1 -0
- package/components/p-82461767.js +328 -0
- package/components/p-82461767.js.map +1 -0
- package/components/p-9df62f97.js +89 -0
- package/components/p-9df62f97.js.map +1 -0
- package/components/p-b82bac0a.js +121 -0
- package/components/p-b82bac0a.js.map +1 -0
- package/components/p-d107c90c.js +27 -0
- package/components/p-d107c90c.js.map +1 -0
- package/components/p-d279ae53.js +86 -0
- package/components/p-d279ae53.js.map +1 -0
- package/components/p-f5ba28ff.js +372 -0
- package/components/p-f5ba28ff.js.map +1 -0
- package/components/p-f85b490c.js +217 -0
- package/components/p-f85b490c.js.map +1 -0
- package/components/{floating-ui.dom.esm.js → p-fdd0abae.js} +468 -416
- package/components/p-fdd0abae.js.map +1 -0
- package/components/qds-badge-counter.d.ts +11 -0
- package/components/qds-badge-counter.js +13 -0
- package/components/qds-badge-counter.js.map +1 -0
- package/components/qds-badge-indicator.d.ts +11 -0
- package/components/qds-badge-indicator.js +13 -0
- package/components/qds-badge-indicator.js.map +1 -0
- package/components/qds-breadcrumb-item.d.ts +11 -0
- package/components/qds-breadcrumb-item.js +76 -0
- package/components/qds-breadcrumb-item.js.map +1 -0
- package/components/qds-button.d.ts +2 -2
- package/components/qds-button.js +3 -138
- package/components/qds-button.js.map +1 -1
- package/components/qds-checkbox.d.ts +2 -2
- package/components/qds-checkbox.js +3 -146
- package/components/qds-checkbox.js.map +1 -1
- package/components/qds-chip.d.ts +11 -0
- package/components/qds-chip.js +271 -0
- package/components/qds-chip.js.map +1 -0
- package/components/qds-dialog.d.ts +11 -0
- package/components/qds-dialog.js +121 -0
- package/components/qds-dialog.js.map +1 -0
- package/components/qds-divider.d.ts +11 -0
- package/components/qds-divider.js +13 -0
- package/components/qds-divider.js.map +1 -0
- package/components/qds-dropdown.d.ts +2 -2
- package/components/qds-dropdown.js +266 -239
- package/components/qds-dropdown.js.map +1 -1
- package/components/qds-form-message.d.ts +11 -0
- package/components/qds-form-message.js +102 -0
- package/components/qds-form-message.js.map +1 -0
- package/components/qds-icon.d.ts +2 -2
- package/components/qds-icon.js +3 -3
- package/components/qds-inline-link.d.ts +2 -2
- package/components/qds-inline-link.js +135 -73
- package/components/qds-inline-link.js.map +1 -1
- package/components/qds-input.d.ts +2 -2
- package/components/qds-input.js +426 -230
- package/components/qds-input.js.map +1 -1
- package/components/qds-label.d.ts +2 -2
- package/components/qds-label.js +3 -3
- package/components/qds-list-item.d.ts +11 -0
- package/components/qds-list-item.js +207 -0
- package/components/qds-list-item.js.map +1 -0
- package/components/qds-loader.d.ts +11 -0
- package/components/qds-loader.js +111 -0
- package/components/qds-loader.js.map +1 -0
- package/components/qds-nav-list-item.d.ts +11 -0
- package/components/qds-nav-list-item.js +146 -0
- package/components/qds-nav-list-item.js.map +1 -0
- package/components/qds-progress-bar.d.ts +11 -0
- package/components/qds-progress-bar.js +135 -0
- package/components/qds-progress-bar.js.map +1 -0
- package/components/qds-radio.d.ts +2 -2
- package/components/qds-radio.js +140 -93
- package/components/qds-radio.js.map +1 -1
- package/components/qds-select.d.ts +11 -0
- package/components/qds-select.js +273 -0
- package/components/qds-select.js.map +1 -0
- package/components/qds-standalone-link.d.ts +11 -0
- package/components/qds-standalone-link.js +167 -0
- package/components/qds-standalone-link.js.map +1 -0
- package/components/qds-switch.d.ts +2 -2
- package/components/qds-switch.js +172 -105
- package/components/qds-switch.js.map +1 -1
- package/components/qds-tab.d.ts +11 -0
- package/components/qds-tab.js +339 -0
- package/components/qds-tab.js.map +1 -0
- package/components/qds-tabbar.d.ts +11 -0
- package/components/qds-tabbar.js +384 -0
- package/components/qds-tabbar.js.map +1 -0
- package/components/qds-table-body.d.ts +11 -0
- package/components/qds-table-body.js +68 -0
- package/components/qds-table-body.js.map +1 -0
- package/components/qds-table-cell.d.ts +11 -0
- package/components/qds-table-cell.js +73 -0
- package/components/qds-table-cell.js.map +1 -0
- package/components/qds-table-head-cell.d.ts +11 -0
- package/components/qds-table-head-cell.js +77 -0
- package/components/qds-table-head-cell.js.map +1 -0
- package/components/qds-table-head.d.ts +11 -0
- package/components/qds-table-head.js +68 -0
- package/components/qds-table-head.js.map +1 -0
- package/components/qds-table-row.d.ts +11 -0
- package/components/qds-table-row.js +68 -0
- package/components/qds-table-row.js.map +1 -0
- package/components/qds-table.d.ts +11 -0
- package/components/qds-table.js +68 -0
- package/components/qds-table.js.map +1 -0
- package/components/qds-tag.d.ts +11 -0
- package/components/qds-tag.js +13 -0
- package/components/qds-tag.js.map +1 -0
- package/components/qds-textarea.d.ts +2 -2
- package/components/qds-textarea.js +276 -193
- package/components/qds-textarea.js.map +1 -1
- package/components/qds-title.d.ts +2 -2
- package/components/qds-title.js +3 -84
- package/components/qds-title.js.map +1 -1
- package/components/qds-tooltip.d.ts +2 -2
- package/components/qds-tooltip.js +3 -315
- package/components/qds-tooltip.js.map +1 -1
- package/dist/cjs/app-globals-c4cf08df.js +12 -0
- package/dist/cjs/app-globals-c4cf08df.js.map +1 -0
- package/dist/cjs/controls-ee3d2ec8.js +31 -0
- package/dist/cjs/controls-ee3d2ec8.js.map +1 -0
- package/dist/cjs/{floating-ui.dom.esm-71fa96af.js → floating-ui.dom.esm-19b2b933.js} +468 -416
- package/dist/cjs/floating-ui.dom.esm-19b2b933.js.map +1 -0
- package/dist/cjs/helpers-cdd65bd0.js +217 -0
- package/dist/cjs/helpers-cdd65bd0.js.map +1 -0
- package/dist/cjs/index-a9985af0.js +1699 -0
- package/dist/cjs/index-a9985af0.js.map +1 -0
- package/dist/cjs/index.cjs.js +27 -27
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/library-57845012.js +117 -0
- package/dist/cjs/library-57845012.js.map +1 -0
- package/dist/cjs/loader.cjs.js +8 -6
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/qds-badge-counter_3.cjs.entry.js +445 -0
- package/dist/cjs/qds-badge-counter_3.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-breadcrumb-item.cjs.entry.js +55 -0
- package/dist/cjs/qds-breadcrumb-item.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-button.cjs.entry.js +234 -87
- package/dist/cjs/qds-button.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-checkbox.cjs.entry.js +162 -99
- package/dist/cjs/qds-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-chip.cjs.entry.js +231 -0
- package/dist/cjs/qds-chip.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-dialog.cjs.entry.js +103 -0
- package/dist/cjs/qds-dialog.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-divider.cjs.entry.js +69 -0
- package/dist/cjs/qds-divider.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-dropdown.cjs.entry.js +225 -206
- package/dist/cjs/qds-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-form-message.cjs.entry.js +76 -0
- package/dist/cjs/qds-form-message.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-icon.cjs.entry.js +111 -90
- package/dist/cjs/qds-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-inline-link.cjs.entry.js +98 -46
- package/dist/cjs/qds-inline-link.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-input.cjs.entry.js +337 -185
- package/dist/cjs/qds-input.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-label.cjs.entry.js +58 -24
- package/dist/cjs/qds-label.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-list-item.cjs.entry.js +158 -0
- package/dist/cjs/qds-list-item.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-loader.cjs.entry.js +92 -0
- package/dist/cjs/qds-loader.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-nav-list-item.cjs.entry.js +108 -0
- package/dist/cjs/qds-nav-list-item.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-progress-bar.cjs.entry.js +117 -0
- package/dist/cjs/qds-progress-bar.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-radio.cjs.entry.js +101 -57
- package/dist/cjs/qds-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-select.cjs.entry.js +233 -0
- package/dist/cjs/qds-select.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-standalone-link.cjs.entry.js +127 -0
- package/dist/cjs/qds-standalone-link.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-switch.cjs.entry.js +143 -64
- package/dist/cjs/qds-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-tab.cjs.entry.js +260 -0
- package/dist/cjs/qds-tab.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-tabbar.cjs.entry.js +326 -0
- package/dist/cjs/qds-tabbar.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-table-body.cjs.entry.js +54 -0
- package/dist/cjs/qds-table-body.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-table-cell.cjs.entry.js +56 -0
- package/dist/cjs/qds-table-cell.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-table-head-cell.cjs.entry.js +58 -0
- package/dist/cjs/qds-table-head-cell.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-table-head.cjs.entry.js +54 -0
- package/dist/cjs/qds-table-head.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-table-row.cjs.entry.js +54 -0
- package/dist/cjs/qds-table-row.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-table.cjs.entry.js +54 -0
- package/dist/cjs/qds-table.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-tag_2.cjs.entry.js +163 -0
- package/dist/cjs/qds-tag_2.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-textarea.cjs.entry.js +229 -153
- package/dist/cjs/qds-textarea.cjs.entry.js.map +1 -1
- package/dist/cjs/qds.cjs.js +15 -13
- package/dist/cjs/qds.cjs.js.map +1 -1
- package/dist/custom-elements.json +8403 -1931
- package/dist/docs.d.ts +336 -240
- package/dist/docs.json +8819 -2762
- package/dist/esm/app-globals-8ced3a41.js +10 -0
- package/dist/esm/app-globals-8ced3a41.js.map +1 -0
- package/dist/esm/controls-a4768aaf.js +27 -0
- package/dist/esm/controls-a4768aaf.js.map +1 -0
- package/dist/esm/{floating-ui.dom.esm-f96ac766.js → floating-ui.dom.esm-61986f35.js} +468 -416
- package/dist/esm/floating-ui.dom.esm-61986f35.js.map +1 -0
- package/dist/esm/helpers-4eb4fa44.js +204 -0
- package/dist/esm/helpers-4eb4fa44.js.map +1 -0
- package/dist/esm/index-5291e8ff.js +1668 -0
- package/dist/esm/index-5291e8ff.js.map +1 -0
- package/dist/esm/index.js +27 -27
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/library-9edbe354.js +113 -0
- package/dist/esm/library-9edbe354.js.map +1 -0
- package/dist/esm/loader.js +9 -7
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/qds-badge-counter_3.entry.js +439 -0
- package/dist/esm/qds-badge-counter_3.entry.js.map +1 -0
- package/dist/esm/qds-breadcrumb-item.entry.js +51 -0
- package/dist/esm/qds-breadcrumb-item.entry.js.map +1 -0
- package/dist/esm/qds-button.entry.js +234 -87
- package/dist/esm/qds-button.entry.js.map +1 -1
- package/dist/esm/qds-checkbox.entry.js +162 -99
- package/dist/esm/qds-checkbox.entry.js.map +1 -1
- package/dist/esm/qds-chip.entry.js +227 -0
- package/dist/esm/qds-chip.entry.js.map +1 -0
- package/dist/esm/qds-dialog.entry.js +99 -0
- package/dist/esm/qds-dialog.entry.js.map +1 -0
- package/dist/esm/qds-divider.entry.js +65 -0
- package/dist/esm/qds-divider.entry.js.map +1 -0
- package/dist/esm/qds-dropdown.entry.js +225 -206
- package/dist/esm/qds-dropdown.entry.js.map +1 -1
- package/dist/esm/qds-form-message.entry.js +72 -0
- package/dist/esm/qds-form-message.entry.js.map +1 -0
- package/dist/esm/qds-icon.entry.js +111 -90
- package/dist/esm/qds-icon.entry.js.map +1 -1
- package/dist/esm/qds-inline-link.entry.js +98 -46
- package/dist/esm/qds-inline-link.entry.js.map +1 -1
- package/dist/esm/qds-input.entry.js +337 -185
- package/dist/esm/qds-input.entry.js.map +1 -1
- package/dist/esm/qds-label.entry.js +58 -24
- package/dist/esm/qds-label.entry.js.map +1 -1
- package/dist/esm/qds-list-item.entry.js +154 -0
- package/dist/esm/qds-list-item.entry.js.map +1 -0
- package/dist/esm/qds-loader.entry.js +88 -0
- package/dist/esm/qds-loader.entry.js.map +1 -0
- package/dist/esm/qds-nav-list-item.entry.js +104 -0
- package/dist/esm/qds-nav-list-item.entry.js.map +1 -0
- package/dist/esm/qds-progress-bar.entry.js +113 -0
- package/dist/esm/qds-progress-bar.entry.js.map +1 -0
- package/dist/esm/qds-radio.entry.js +101 -57
- package/dist/esm/qds-radio.entry.js.map +1 -1
- package/dist/esm/qds-select.entry.js +229 -0
- package/dist/esm/qds-select.entry.js.map +1 -0
- package/dist/esm/qds-standalone-link.entry.js +123 -0
- package/dist/esm/qds-standalone-link.entry.js.map +1 -0
- package/dist/esm/qds-switch.entry.js +143 -64
- package/dist/esm/qds-switch.entry.js.map +1 -1
- package/dist/esm/qds-tab.entry.js +256 -0
- package/dist/esm/qds-tab.entry.js.map +1 -0
- package/dist/esm/qds-tabbar.entry.js +322 -0
- package/dist/esm/qds-tabbar.entry.js.map +1 -0
- package/dist/esm/qds-table-body.entry.js +50 -0
- package/dist/esm/qds-table-body.entry.js.map +1 -0
- package/dist/esm/qds-table-cell.entry.js +52 -0
- package/dist/esm/qds-table-cell.entry.js.map +1 -0
- package/dist/esm/qds-table-head-cell.entry.js +54 -0
- package/dist/esm/qds-table-head-cell.entry.js.map +1 -0
- package/dist/esm/qds-table-head.entry.js +50 -0
- package/dist/esm/qds-table-head.entry.js.map +1 -0
- package/dist/esm/qds-table-row.entry.js +50 -0
- package/dist/esm/qds-table-row.entry.js.map +1 -0
- package/dist/esm/qds-table.entry.js +50 -0
- package/dist/esm/qds-table.entry.js.map +1 -0
- package/dist/esm/qds-tag_2.entry.js +158 -0
- package/dist/esm/qds-tag_2.entry.js.map +1 -0
- package/dist/esm/qds-textarea.entry.js +229 -153
- package/dist/esm/qds-textarea.entry.js.map +1 -1
- package/dist/esm/qds.js +16 -14
- package/dist/esm/qds.js.map +1 -1
- package/dist/types/components/badge-counter/badge-counter.d.ts +40 -0
- package/dist/types/components/badge-indicator/badge-indicator.d.ts +36 -0
- package/dist/types/components/breadcrumb-item/breadcrumb-item.d.ts +156 -0
- package/dist/types/components/button/button.d.ts +232 -194
- package/dist/types/components/checkbox/checkbox.d.ts +136 -124
- package/dist/types/components/chip/chip.d.ts +114 -0
- package/dist/types/components/controls.d.ts +4 -1
- package/dist/types/components/dialog/dialog.d.ts +35 -0
- package/dist/types/components/divider/divider.d.ts +26 -0
- package/dist/types/components/dropdown/dropdown.d.ts +107 -125
- package/dist/types/components/form-message/form-message.d.ts +42 -0
- package/dist/types/components/icon/icon.d.ts +24 -24
- package/dist/types/components/icon/library.d.ts +3 -3
- package/dist/types/components/icon/request.d.ts +5 -9
- package/dist/types/components/inline-link/inline-link.d.ts +208 -191
- package/dist/types/components/input/input.d.ts +444 -368
- package/dist/types/components/label/label.d.ts +24 -24
- package/dist/types/components/list-item/list-item.d.ts +100 -0
- package/dist/types/components/loader/loader.d.ts +27 -0
- package/dist/types/components/nav-list-item/nav-list-item.d.ts +67 -0
- package/dist/types/components/progress-bar/progress-bar.d.ts +60 -0
- package/dist/types/components/radio/radio.d.ts +90 -95
- package/dist/types/components/select/select.d.ts +210 -0
- package/dist/types/components/shared.d.ts +6 -0
- package/dist/types/components/standalone-link/standalone-link.d.ts +233 -0
- package/dist/types/components/switch/switch.d.ts +120 -107
- package/dist/types/components/tab/tab.d.ts +158 -0
- package/dist/types/components/tabbar/tabbar.d.ts +46 -0
- package/dist/types/components/table/table.d.ts +15 -0
- package/dist/types/components/table-body/table-body.d.ts +15 -0
- package/dist/types/components/table-cell/table-cell.d.ts +32 -0
- package/dist/types/components/table-head/table-head.d.ts +15 -0
- package/dist/types/components/table-head-cell/table-head-cell.d.ts +56 -0
- package/dist/types/components/table-row/table-row.d.ts +15 -0
- package/dist/types/components/tag/tag.d.ts +46 -0
- package/dist/types/components/textarea/textarea.d.ts +313 -300
- package/dist/types/components/title/title.d.ts +39 -32
- package/dist/types/components/tooltip/tooltip.d.ts +121 -137
- package/dist/types/components.d.ts +3320 -783
- package/dist/types/helpers.d.ts +15 -16
- package/dist/types/index.d.ts +1 -0
- package/dist/types/interface-overrides.d.ts +211 -0
- package/dist/types/qds-test.d.ts +22 -11
- package/dist/types/stencil-public-runtime.d.ts +49 -15
- package/dist/types/utils.d.ts +4 -4
- package/dist/vscode.html-custom-data.json +1580 -167
- package/hydrate/index.d.ts +36 -18
- package/hydrate/index.js +24050 -9160
- package/hydrate/index.mjs +24769 -0
- package/hydrate/package.json +7 -1
- package/loader/cdn.js +3 -4
- package/loader/index.cjs.js +3 -4
- package/loader/index.d.ts +4 -1
- package/loader/index.es2017.js +3 -4
- package/loader/index.js +3 -4
- package/package.json +53 -89
- package/styles/core.css +137 -14
- package/components/floating-ui.dom.esm.js.map +0 -1
- package/components/helpers.js +0 -175
- package/components/helpers.js.map +0 -1
- package/components/icon.js +0 -175
- package/components/icon.js.map +0 -1
- package/components/label.js +0 -55
- package/components/label.js.map +0 -1
- package/dist/cjs/floating-ui.dom.esm-71fa96af.js.map +0 -1
- package/dist/cjs/helpers-452256e8.js +0 -185
- package/dist/cjs/helpers-452256e8.js.map +0 -1
- package/dist/cjs/index-d181f952.js +0 -2039
- package/dist/cjs/index-d181f952.js.map +0 -1
- package/dist/cjs/library-0a619eeb.js +0 -62
- package/dist/cjs/library-0a619eeb.js.map +0 -1
- package/dist/cjs/qds-title.cjs.entry.js +0 -66
- package/dist/cjs/qds-title.cjs.entry.js.map +0 -1
- package/dist/cjs/qds-tooltip.cjs.entry.js +0 -284
- package/dist/cjs/qds-tooltip.cjs.entry.js.map +0 -1
- package/dist/esm/floating-ui.dom.esm-f96ac766.js.map +0 -1
- package/dist/esm/helpers-76b84f45.js +0 -175
- package/dist/esm/helpers-76b84f45.js.map +0 -1
- package/dist/esm/index-d7183092.js +0 -2009
- package/dist/esm/index-d7183092.js.map +0 -1
- package/dist/esm/library-021aca11.js +0 -58
- package/dist/esm/library-021aca11.js.map +0 -1
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/qds-title.entry.js +0 -62
- package/dist/esm/qds-title.entry.js.map +0 -1
- package/dist/esm/qds-tooltip.entry.js +0 -280
- package/dist/esm/qds-tooltip.entry.js.map +0 -1
- package/dist/types/components/create-story.d.ts +0 -5
|
@@ -1,74 +1,153 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* SPDX-FileCopyrightText: ©
|
|
2
|
+
* SPDX-FileCopyrightText: © 2025 Schneider Electric
|
|
3
3
|
*
|
|
4
|
-
* SPDX-License-Identifier:
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { r as registerInstance, c as createEvent, h, a as getElement } from './index-
|
|
7
|
-
import { p as pickFocusEventAttributes, i as inheritAriaAttributes
|
|
6
|
+
import { r as registerInstance, c as createEvent, h, a as getElement } from './index-5291e8ff.js';
|
|
7
|
+
import { p as pickFocusEventAttributes, i as inheritAriaAttributes } from './helpers-4eb4fa44.js';
|
|
8
|
+
import { C as CUSTOM_ERROR_FLAGS, N as NO_ERROR_FLAGS, V as VALID_STATE } from './controls-a4768aaf.js';
|
|
8
9
|
|
|
9
|
-
const switchCss = "
|
|
10
|
+
const switchCss = ":host([hidden]){display:none!important}:host{display:inline-block}.qds-knob,.qds-track{-webkit-print-color-adjust:exact;print-color-adjust:exact}.qds-track{align-items:center;background-color:var(--qds-theme-control-slider-track-default);border-radius:var(--qds-control-slider-track-border-radius);display:flex;flex-shrink:0}.qds-track:hover{background-color:var(--qds-theme-control-slider-track-hover)}.qds-track:active{background-color:var(--qds-theme-control-slider-track-pressed)}.qds-knob{background-color:var(--qds-theme-control-input-background);border:var(--qds-control-border-width) solid #0000;border-radius:var(--qds-control-slider-knob-border-radius);box-shadow:var(--qds-theme-accessory-elevation);box-sizing:border-box;margin-inline:var(--qds-control-border-width)}.qds-container{box-sizing:border-box;cursor:pointer;display:flex}.qds-switch{clip-path:inset(50%);height:1px;margin:0;position:absolute;white-space:nowrap;width:1px}.qds-switch:focus-visible~.qds-track{outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset)}.qds-switch:checked~.qds-track{background-color:var(--qds-theme-signature-color-default);justify-content:flex-end}.qds-switch:checked~.qds-track:hover{background-color:var(--qds-theme-signature-color-hover)}.qds-switch:checked~.qds-track:active{background-color:var(--qds-theme-signature-color-pressed)}.qds-disabled{opacity:var(--qds-theme-disabled);pointer-events:none}.qds-inline[data-size=small]{margin-block:var(--qds-control-small-padding-auto-height)}.qds-track[data-size=small]{height:var(--qds-control-toggle-box-small-size);width:calc(var(--qds-control-slider-knob-small-size)*2)}.qds-knob[data-size=small]{height:var(--qds-control-slider-knob-small-size);width:var(--qds-control-slider-knob-small-size)}.qds-inline[data-size=standard]{margin-block:var(--qds-control-standard-padding-auto-height)}.qds-track[data-size=standard]{height:var(--qds-control-toggle-box-standard-size);width:calc(var(--qds-control-slider-knob-standard-size)*2)}.qds-knob[data-size=standard]{height:var(--qds-control-slider-knob-standard-size);width:var(--qds-control-slider-knob-standard-size)}.qds-inline[data-size=large]{margin-block:var(--qds-control-large-padding-auto-height)}.qds-track[data-size=large]{height:var(--qds-control-toggle-box-large-size);width:calc(var(--qds-control-slider-knob-large-size)*2)}.qds-knob[data-size=large]{height:var(--qds-control-slider-knob-large-size);width:var(--qds-control-slider-knob-large-size)}";
|
|
11
|
+
const QdsSwitchStyle0 = switchCss;
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
// SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
16
|
+
var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
17
|
+
if (kind === "a" && !f)
|
|
18
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
19
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
20
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
21
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
22
|
+
};
|
|
23
|
+
var _Switch_instances, _Switch_computedChecked_get, _Switch_computedDisabled_get, _Switch_computedSize_get, _Switch_computedValue_get, _Switch_onBlur, _Switch_onFocus, _Switch_defineGetter, _Switch_updateFormValue;
|
|
12
24
|
const Switch = class {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
25
|
+
constructor(hostRef) {
|
|
26
|
+
registerInstance(this, hostRef);
|
|
27
|
+
this.blurEmitter = createEvent(this, "qdsBlur", 2);
|
|
28
|
+
this.changeEmitter = createEvent(this, "qdsChange", 6);
|
|
29
|
+
this.focusEmitter = createEvent(this, "qdsFocus", 2);
|
|
30
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
31
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
35
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
36
|
+
}
|
|
37
|
+
_Switch_instances.add(this);
|
|
38
|
+
this.checkValidity = () => this.internals.checkValidity();
|
|
39
|
+
this.reportValidity = () => this.internals.reportValidity();
|
|
40
|
+
this.setCustomValidity = (error) => {
|
|
41
|
+
if (error)
|
|
42
|
+
this.internals.setValidity(CUSTOM_ERROR_FLAGS, error, this.host);
|
|
43
|
+
else
|
|
44
|
+
this.internals.setValidity(NO_ERROR_FLAGS);
|
|
45
|
+
};
|
|
46
|
+
_Switch_onBlur.set(this, (event) => {
|
|
47
|
+
this.blurEmitter.emit(pickFocusEventAttributes(event));
|
|
48
|
+
});
|
|
49
|
+
_Switch_onFocus.set(this, (event) => {
|
|
50
|
+
this.focusEmitter.emit(pickFocusEventAttributes(event));
|
|
51
|
+
});
|
|
52
|
+
this.inline = false;
|
|
53
|
+
this.size = 'standard';
|
|
54
|
+
this.autoFocus = undefined;
|
|
55
|
+
this.checked = undefined;
|
|
56
|
+
this.disabled = undefined;
|
|
57
|
+
this.form = null;
|
|
58
|
+
this.labels = null;
|
|
59
|
+
this.name = undefined;
|
|
60
|
+
this.value = undefined;
|
|
61
|
+
this.validationMessage = '';
|
|
62
|
+
this.validity = VALID_STATE;
|
|
63
|
+
this.willValidate = false;
|
|
64
|
+
this.tabIndex = undefined;
|
|
65
|
+
this.inheritedAttributes = {};
|
|
66
|
+
}
|
|
67
|
+
onClick(event) {
|
|
68
|
+
if (__classPrivateFieldGet(this, _Switch_instances, "a", _Switch_computedDisabled_get)) {
|
|
69
|
+
event.stopImmediatePropagation();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
this.checked = !__classPrivateFieldGet(this, _Switch_instances, "a", _Switch_computedChecked_get);
|
|
74
|
+
this.changeEmitter.emit();
|
|
75
|
+
}
|
|
76
|
+
checkedChanged() {
|
|
77
|
+
__classPrivateFieldGet(this, _Switch_instances, "m", _Switch_updateFormValue).call(this);
|
|
78
|
+
this.internals.ariaChecked = __classPrivateFieldGet(this, _Switch_instances, "a", _Switch_computedChecked_get).toString();
|
|
79
|
+
}
|
|
80
|
+
disabledChanged() {
|
|
81
|
+
__classPrivateFieldGet(this, _Switch_instances, "m", _Switch_updateFormValue).call(this);
|
|
82
|
+
this.internals.ariaDisabled = __classPrivateFieldGet(this, _Switch_instances, "a", _Switch_computedDisabled_get).toString();
|
|
83
|
+
}
|
|
84
|
+
tabindexChanged(newValue) {
|
|
85
|
+
const parsedValue = Number.parseInt(newValue, 10);
|
|
86
|
+
this.tabIndex =
|
|
87
|
+
parsedValue === 0 || Number.isNaN(parsedValue) ? undefined : parsedValue;
|
|
88
|
+
}
|
|
89
|
+
valueChanged() {
|
|
90
|
+
__classPrivateFieldGet(this, _Switch_instances, "m", _Switch_updateFormValue).call(this);
|
|
91
|
+
}
|
|
92
|
+
componentWillLoad() {
|
|
93
|
+
this.internals.role = 'switch';
|
|
94
|
+
this.checkedChanged();
|
|
95
|
+
this.disabledChanged();
|
|
96
|
+
__classPrivateFieldGet(this, _Switch_instances, "m", _Switch_defineGetter).call(this, 'form', () => this.internals.form);
|
|
97
|
+
__classPrivateFieldGet(this, _Switch_instances, "m", _Switch_defineGetter).call(this, 'labels', () => this.internals.labels);
|
|
98
|
+
__classPrivateFieldGet(this, _Switch_instances, "m", _Switch_defineGetter).call(this, 'validationMessage', () => this.internals.validationMessage);
|
|
99
|
+
__classPrivateFieldGet(this, _Switch_instances, "m", _Switch_defineGetter).call(this, 'validity', () => this.internals.validity);
|
|
100
|
+
__classPrivateFieldGet(this, _Switch_instances, "m", _Switch_defineGetter).call(this, 'willValidate', () => this.internals.willValidate);
|
|
101
|
+
this.inheritedAttributes = inheritAriaAttributes(this.host);
|
|
102
|
+
this.tabindexChanged(this.host.getAttribute('tabindex') ?? '0');
|
|
103
|
+
}
|
|
104
|
+
render() {
|
|
105
|
+
return (h("div", { key: 'd2e5e0e1cee02851bcc4609815eda7f56eff1752', class: {
|
|
106
|
+
'qds-container': true,
|
|
107
|
+
'qds-disabled': __classPrivateFieldGet(this, _Switch_instances, "a", _Switch_computedDisabled_get),
|
|
108
|
+
'qds-inline': this.inline,
|
|
109
|
+
}, "data-size": __classPrivateFieldGet(this, _Switch_instances, "a", _Switch_computedSize_get) }, h("input", { key: '3f936c0009eae81618e96664a76cc1c1b8c9ba39', "aria-hidden": "true",
|
|
110
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
111
|
+
autoFocus: this.autoFocus, checked: this.checked, class: "qds-switch", disabled: this.disabled, onBlur: __classPrivateFieldGet(this, _Switch_onBlur, "f"), onFocus: __classPrivateFieldGet(this, _Switch_onFocus, "f"), tabIndex: __classPrivateFieldGet(this, _Switch_instances, "a", _Switch_computedDisabled_get) ? undefined : this.tabIndex, type: "checkbox", value: this.value ?? undefined, ...this.inheritedAttributes }), h("div", { key: '49b17576a18e1badc099b0a7e6081ddd4c5c2621', class: "qds-track", "data-size": __classPrivateFieldGet(this, _Switch_instances, "a", _Switch_computedSize_get) }, h("div", { key: 'c34784d30707e6cf206ab9121c91c192ad1a003b', class: "qds-knob", "data-size": __classPrivateFieldGet(this, _Switch_instances, "a", _Switch_computedSize_get) }))));
|
|
112
|
+
}
|
|
113
|
+
static get delegatesFocus() { return true; }
|
|
114
|
+
static get formAssociated() { return true; }
|
|
115
|
+
get host() { return getElement(this); }
|
|
116
|
+
static get watchers() { return {
|
|
117
|
+
"checked": ["checkedChanged"],
|
|
118
|
+
"disabled": ["disabledChanged"],
|
|
119
|
+
"tabindex": ["tabindexChanged"],
|
|
120
|
+
"value": ["valueChanged"]
|
|
121
|
+
}; }
|
|
122
|
+
};
|
|
123
|
+
_Switch_onBlur = new WeakMap(), _Switch_onFocus = new WeakMap(), _Switch_instances = new WeakSet(), _Switch_computedChecked_get = function _Switch_computedChecked_get() {
|
|
124
|
+
return this.checked ?? false;
|
|
125
|
+
}, _Switch_computedDisabled_get = function _Switch_computedDisabled_get() {
|
|
126
|
+
return ((this.host.matches(':disabled') || (this.disabled ?? false)) &&
|
|
127
|
+
this.host.getAttribute('disabled') !== 'false');
|
|
128
|
+
}, _Switch_computedSize_get = function _Switch_computedSize_get() {
|
|
129
|
+
switch (this.size) {
|
|
130
|
+
case 'standard':
|
|
131
|
+
case 'small':
|
|
132
|
+
case 'large': {
|
|
133
|
+
return this.size;
|
|
134
|
+
}
|
|
135
|
+
default: {
|
|
136
|
+
return 'standard';
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}, _Switch_computedValue_get = function _Switch_computedValue_get() {
|
|
140
|
+
// eslint-disable-next-line unicorn/no-null
|
|
141
|
+
return this.value == null ? null : this.value.toString();
|
|
142
|
+
}, _Switch_defineGetter = function _Switch_defineGetter(p, get) {
|
|
143
|
+
Object.defineProperty(this.host, p, { enumerable: true, get });
|
|
144
|
+
}, _Switch_updateFormValue = function _Switch_updateFormValue() {
|
|
145
|
+
this.internals.setFormValue(__classPrivateFieldGet(this, _Switch_instances, "a", _Switch_computedChecked_get) && !__classPrivateFieldGet(this, _Switch_instances, "a", _Switch_computedDisabled_get)
|
|
146
|
+
? __classPrivateFieldGet(this, _Switch_instances, "a", _Switch_computedValue_get)
|
|
147
|
+
: // eslint-disable-next-line unicorn/no-null
|
|
148
|
+
null);
|
|
70
149
|
};
|
|
71
|
-
Switch.style =
|
|
150
|
+
Switch.style = QdsSwitchStyle0;
|
|
72
151
|
|
|
73
152
|
export { Switch as qds_switch };
|
|
74
153
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"qds-switch.entry.js","mappings":"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","names":[],"sources":["src/components/switch/switch.css?tag=qds-switch&encapsulation=scoped","src/components/switch/switch.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n}\n\n.track,\n.knob {\n print-color-adjust: exact;\n}\n\n.unchecked-text {\n text-align: end;\n}\n\n.icon {\n color: var(--qds-theme-control-text-standard);\n flex-shrink: 0;\n}\n\n.track {\n align-items: center;\n border-radius: var(--qds-control-rounded-border-radius);\n display: flex;\n flex-shrink: 0;\n print-color-adjust: exact;\n background-color: var(--qds-theme-control-slider-track-inactive);\n}\n\n.knob {\n background-color: var(--qds-theme-accessory-background);\n border-radius: var(--qds-control-rounded-border-radius);\n border: var(--qds-control-border-width) solid var(--qds-theme-control-border);\n box-shadow: var(--qds-theme-accessory-elevation);\n box-sizing: content-box;\n}\n\n.label {\n cursor: pointer;\n display: flex;\n}\n\n.switch {\n clip-path: inset(50%);\n height: 1px;\n margin: 0;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n\n &:hover ~ .track > .knob {\n background-color: var(--qds-theme-interactive-background-hover);\n }\n\n &:active ~ .track > .knob {\n background-color: var(--qds-theme-interactive-background-pressed);\n }\n\n &:checked {\n & ~ .track {\n justify-content: flex-end;\n background-color: var(--qds-theme-signature-color-default);\n\n & > .knob {\n border-color: transparent;\n box-sizing: border-box;\n margin-inline-end: var(--qds-control-border-width);\n }\n }\n\n &:hover ~ .track > .knob {\n background-color: var(--qds-theme-interactive-background-hover);\n }\n\n &:active ~ .track > .knob {\n background-color: var(--qds-theme-interactive-background-pressed);\n }\n }\n\n &:focus-visible ~ .track {\n outline: var(--qds-theme-focus-border) solid var(--qds-focus-border-width);\n outline-offset: var(--qds-focus-border-offset);\n }\n}\n\n[aria-disabled='true'] {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\n}\n\n[data-size='small'] {\n &.icon {\n height: var(--qds-control-small-icon-size);\n width: var(--qds-control-small-icon-size);\n }\n\n &.inline {\n margin-block: var(--qds-control-small-padding-auto-height);\n }\n\n &.label {\n gap: var(--qds-control-small-gap-siblings-related);\n }\n\n &.track {\n width: calc(var(--qds-control-slider-knob-small-size) * 2);\n height: var(--qds-control-toggle-box-small-size);\n }\n\n &.knob {\n height: var(--qds-control-slider-knob-small-size);\n width: var(--qds-control-slider-knob-small-size);\n }\n}\n\n[data-size='standard'] {\n &.icon {\n height: var(--qds-control-standard-icon-size);\n width: var(--qds-control-standard-icon-size);\n }\n\n &.inline {\n margin-block: var(--qds-control-standard-padding-auto-height);\n }\n\n &.label {\n gap: var(--qds-control-standard-gap-siblings-related);\n }\n\n &.track {\n width: calc(var(--qds-control-slider-knob-standard-size) * 2);\n height: var(--qds-control-toggle-box-standard-size);\n }\n\n &.knob {\n height: var(--qds-control-slider-knob-standard-size);\n width: var(--qds-control-slider-knob-standard-size);\n }\n}\n\n[data-size='large'] {\n &.icon {\n height: var(--qds-control-large-icon-size);\n width: var(--qds-control-large-icon-size);\n }\n\n &.inline {\n margin-block: var(--qds-control-large-padding-auto-height);\n }\n\n &.label {\n gap: var(--qds-control-large-gap-siblings-related);\n }\n\n &.track {\n width: calc(var(--qds-control-slider-knob-large-size) * 2);\n height: var(--qds-control-toggle-box-large-size);\n }\n\n &.knob {\n height: var(--qds-control-slider-knob-large-size);\n width: var(--qds-control-slider-knob-large-size);\n }\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport { Component, Element, Event, h, Listen, Prop } from '@stencil/core'\n\nimport type { Attributes, QdsFocusEventDetail } from '../../helpers'\nimport {\n inheritAriaAttributes,\n inheritAttributes,\n pickFocusEventAttributes,\n} from '../../helpers'\nimport type { Value } from '../controls'\n\nexport type SwitchSize = 'large' | 'small' | 'standard'\n\nlet autoIncrementingId = 1\n\n/**\n * @see https://quartz.se.com/build/components/switch\n */\n@Component({\n tag: 'qds-switch',\n scoped: true,\n styleUrl: 'switch.css',\n})\nexport class Switch implements ComponentInterface {\n /**\n * Adds vertical margin to the switch 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 name of the checked icon to render.\n *\n * Available names depend on the icon library being used.\n */\n @Prop({ reflect: true }) public readonly iconCheckedName?: string\n\n /**\n * The name of a registered checked icon library.\n */\n @Prop({ reflect: true }) public readonly iconCheckedLibrary: string =\n 'default'\n\n /**\n * The name of the unchecked icon to render.\n *\n * Available names depend on the icon library being used.\n */\n @Prop({ reflect: true }) public readonly iconUncheckedName?: string\n\n /**\n * The name of a registered unchecked icon library.\n */\n @Prop({ reflect: true }) public readonly iconUncheckedLibrary: string =\n 'default'\n\n /**\n * The switches's size.\n */\n @Prop({ reflect: true }) public readonly size: SwitchSize = 'standard'\n\n /**\n * The switch's checked text.\n */\n @Prop({ mutable: true, reflect: true }) public readonly textChecked?: string\n\n /**\n * The switch's unchecked text.\n */\n @Prop({ mutable: true, reflect: true }) public readonly textUnchecked?: string\n\n /**\n * Specify whether the switch should have focus when the page loads.\n *\n * @webnative\n */\n @Prop({ attribute: 'autofocus' }) public readonly autoFocus?: boolean\n\n /**\n *Sets the switch's state.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public checked?: boolean\n\n /**\n * Prevents the switch from being interacted with: it cannot be pressed or\n *focused.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public disabled?: boolean\n\n /**\n * The [`<form>`](https://developer.mozilla.org/docs/Web/HTML/Element/form)\n * element to associate the switch 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-switch>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This property lets you associate `<qds-switch>` 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 * The name of the switch, which is submitted with the form data. An\n *incrementing ID is used by default.\n *\n * @webnative\n */\n @Prop() public readonly name = `qds-switch-${autoIncrementingId}`\n\n /**\n * The value of the switch, submitted as a name/value pair with form data.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public value?: Value\n\n /**\n * Emitted when the switch 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 switch'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 switch gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n @Element() private readonly element!: HTMLQdsSwitchElement\n\n private inheritedAttributes: Attributes = {}\n\n private get computedDisabled(): boolean {\n return this.disabled ?? false\n }\n\n @Listen('click')\n protected onClick(event: MouseEvent): void {\n if (this.computedDisabled) return\n\n event.preventDefault()\n\n this.checked = !(this.checked ?? false)\n this.changeEmitter.emit()\n }\n\n public componentWillLoad(): void {\n autoIncrementingId += 1\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.element),\n ...inheritAttributes(this.element, ['tabindex']),\n }\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' : 'false'}\n class={{\n inline: this.inline,\n label: true,\n }}\n data-size={this.size}\n >\n {this.textUnchecked !== undefined && this.textUnchecked !== '' && (\n <qds-label\n class=\"unchecked-text\"\n size={this.size}\n text={this.textUnchecked}\n />\n )}\n {this.iconUncheckedName !== undefined &&\n this.iconUncheckedName !== '' && (\n <qds-icon\n class=\"icon\"\n data-size={this.size}\n library={this.iconUncheckedLibrary}\n name={this.iconUncheckedName}\n />\n )}\n <input\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.autoFocus}\n checked={this.checked}\n class=\"switch\"\n disabled={this.disabled}\n form={this.form}\n name={this.name}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n type=\"checkbox\"\n value={this.value ?? undefined}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n />\n <div class=\"track\" data-size={this.size}>\n <div class=\"knob\" data-size={this.size} />\n </div>\n {this.iconCheckedName !== undefined && this.iconCheckedName !== '' && (\n <qds-icon\n class=\"icon\"\n data-size={this.size}\n library={this.iconCheckedLibrary}\n name={this.iconCheckedName}\n />\n )}\n {this.textChecked !== undefined && this.textChecked !== '' && (\n <qds-label size={this.size} text={this.textChecked} />\n )}\n </label>\n )\n }\n\n private readonly onBlur = (event: FocusEvent): void => {\n this.blurEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onFocus = (event: FocusEvent): void => {\n this.focusEmitter.emit(pickFocusEventAttributes(event))\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"qds-switch.entry.js","mappings":"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","names":[],"sources":["src/components/switch/switch.css?tag=qds-switch&encapsulation=shadow","src/components/switch/switch.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}\n\n.qds-track,\n.qds-knob {\n print-color-adjust: exact;\n}\n\n.qds-track {\n align-items: center;\n border-radius: var(--qds-control-slider-track-border-radius);\n display: flex;\n flex-shrink: 0;\n print-color-adjust: exact;\n background-color: var(--qds-theme-control-slider-track-default);\n\n &:hover {\n background-color: var(--qds-theme-control-slider-track-hover);\n }\n\n &:active {\n background-color: var(--qds-theme-control-slider-track-pressed);\n }\n}\n\n.qds-knob {\n background-color: var(--qds-theme-control-input-background);\n border-radius: var(--qds-control-slider-knob-border-radius);\n border: var(--qds-control-border-width) solid transparent;\n box-shadow: var(--qds-theme-accessory-elevation);\n box-sizing: border-box;\n margin-inline: var(--qds-control-border-width);\n}\n\n.qds-container {\n box-sizing: border-box;\n cursor: pointer;\n display: flex;\n}\n\n.qds-switch {\n clip-path: inset(50%);\n height: 1px;\n margin: 0;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n\n &:focus-visible ~ .qds-track {\n outline: var(--qds-theme-focus-border) solid var(--qds-focus-border-width);\n outline-offset: var(--qds-focus-border-offset);\n }\n\n &:checked ~ .qds-track {\n justify-content: flex-end;\n background-color: var(--qds-theme-signature-color-default);\n\n &:hover {\n background-color: var(--qds-theme-signature-color-hover);\n }\n\n &:active {\n background-color: var(--qds-theme-signature-color-pressed);\n }\n }\n}\n\n.qds-disabled {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\n}\n\n[data-size='small'] {\n &.qds-inline {\n margin-block: var(--qds-control-small-padding-auto-height);\n }\n\n &.qds-track {\n width: calc(var(--qds-control-slider-knob-small-size) * 2);\n height: var(--qds-control-toggle-box-small-size);\n }\n\n &.qds-knob {\n height: var(--qds-control-slider-knob-small-size);\n width: var(--qds-control-slider-knob-small-size);\n }\n}\n\n[data-size='standard'] {\n &.qds-inline {\n margin-block: var(--qds-control-standard-padding-auto-height);\n }\n\n &.qds-track {\n width: calc(var(--qds-control-slider-knob-standard-size) * 2);\n height: var(--qds-control-toggle-box-standard-size);\n }\n\n &.qds-knob {\n height: var(--qds-control-slider-knob-standard-size);\n width: var(--qds-control-slider-knob-standard-size);\n }\n}\n\n[data-size='large'] {\n &.qds-inline {\n margin-block: var(--qds-control-large-padding-auto-height);\n }\n\n &.qds-track {\n width: calc(var(--qds-control-slider-knob-large-size) * 2);\n height: var(--qds-control-toggle-box-large-size);\n }\n\n &.qds-knob {\n height: var(--qds-control-slider-knob-large-size);\n width: var(--qds-control-slider-knob-large-size);\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 type { Value } from '../controls'\nimport { CUSTOM_ERROR_FLAGS, NO_ERROR_FLAGS, VALID_STATE } from '../controls'\nimport type { Size } from '../shared'\n\n/**\n * @see https://quartz.se.com/build/components/switch\n */\n@Component({\n tag: 'qds-switch',\n formAssociated: true,\n shadow: { delegatesFocus: true },\n styleUrl: 'switch.css',\n})\nexport class Switch implements ComponentInterface {\n /**\n * Adds vertical margin to the switch 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 switches's size.\n */\n @Prop() public readonly size?: Size = 'standard'\n\n /**\n * Specify whether the switch should have focus when the page loads.\n *\n * @webnative\n */\n @Prop({ attribute: 'autofocus' }) public readonly autoFocus?: boolean\n\n /**\n *Sets the switch's state.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public checked?: boolean\n\n /**\n * Prevents the switch 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>`](https://developer.mozilla.org/docs/Web/HTML/Element/form)\n * element to associate the switch 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-switch>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This property lets you associate `<qds-switch>` 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 // eslint-disable-next-line unicorn/no-null\n @Prop() public readonly form: ElementInternals['form'] | string = null\n\n /**\n * Returns a list of the [`<label>`][] elements associated with the\n * `qds-switch` element.\n *\n * [`<label>`]: https://developer.mozilla.org/docs/Web/HTML/Element/label\n *\n * @readonly\n * @webnative\n */\n // eslint-disable-next-line unicorn/no-null\n @Prop() public readonly labels: HTMLInputElement['labels'] = null\n\n /**\n * The name of the switch, which is submitted with the form data.\n *\n * @webnative\n */\n @Prop() public readonly name?: string\n\n /**\n * The value of the switch, submitted as a name/value pair with form data.\n *\n * @webnative\n */\n @Prop() public readonly value?: Value\n\n /**\n * The error message that would be shown to the user if the `<qds-switch>`\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-switch>`.\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 * True if `<qds-switch>` 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 @AttachInternals() private readonly internals!: ElementInternals\n\n /**\n * Emitted when the switch 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 switch'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 switch gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n @Element() private readonly host!: HTMLQdsSwitchElement\n\n @State() private tabIndex?: number\n\n @State() private 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 #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 @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.#computedChecked\n this.changeEmitter.emit()\n }\n\n @Watch('checked')\n protected checkedChanged(): void {\n this.#updateFormValue()\n this.internals.ariaChecked = this.#computedChecked.toString()\n }\n\n @Watch('disabled')\n protected disabledChanged(): void {\n this.#updateFormValue()\n this.internals.ariaDisabled = this.#computedDisabled.toString()\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 this.#updateFormValue()\n }\n\n public componentWillLoad(): void {\n this.internals.role = 'switch'\n this.checkedChanged()\n this.disabledChanged()\n\n this.#defineGetter('form', () => this.internals.form)\n this.#defineGetter('labels', () => this.internals.labels)\n this.#defineGetter(\n 'validationMessage',\n () => this.internals.validationMessage,\n )\n this.#defineGetter('validity', () => this.internals.validity)\n this.#defineGetter('willValidate', () => this.internals.willValidate)\n\n this.inheritedAttributes = inheritAriaAttributes(this.host)\n this.tabindexChanged(this.host.getAttribute('tabindex') ?? '0')\n }\n\n public render() {\n return (\n <div\n class={{\n 'qds-container': true,\n 'qds-disabled': this.#computedDisabled,\n 'qds-inline': this.inline,\n }}\n data-size={this.#computedSize}\n >\n <input\n aria-hidden=\"true\"\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.autoFocus}\n checked={this.checked}\n class=\"qds-switch\"\n disabled={this.disabled}\n onBlur={this.#onBlur}\n onFocus={this.#onFocus}\n tabIndex={this.#computedDisabled ? undefined : this.tabIndex}\n type=\"checkbox\"\n value={this.value ?? undefined}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n />\n <div class=\"qds-track\" data-size={this.#computedSize}>\n <div class=\"qds-knob\" data-size={this.#computedSize} />\n </div>\n </div>\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 #updateFormValue(): 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"],"version":3}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: © 2025 Schneider Electric
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { r as registerInstance, c as createEvent, h, a as getElement } from './index-5291e8ff.js';
|
|
7
|
+
import { p as pickFocusEventAttributes, r as resolveTarget, i as inheritAriaAttributes } from './helpers-4eb4fa44.js';
|
|
8
|
+
|
|
9
|
+
const tabCss = ":host([hidden]){display:none!important}:host{display:inline-block;line-height:0}[aria-disabled=true]{opacity:var(--qds-theme-disabled);pointer-events:none}.qds-target{-webkit-appearance:none;appearance:none;background-color:initial;border:none;cursor:pointer;padding:0;pointer-events:auto}.qds-target:disabled{pointer-events:none}.qds-target:focus-visible{border-radius:var(--qds-focus-border-radius);outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset)}.qds-target-icon{color:var(--qds-theme-control-text-standard)}.qds-icon,.qds-target-icon{flex-shrink:0}.qds-chevron{transform:rotate(180deg)}.qds-closable-wrapper,.qds-tab{position:relative}.qds-closable-tab,.qds-closable-wrapper,.qds-tab,.qds-target,.qds-texts{display:flex}.qds-texts{flex:1 0;flex-direction:column}.qds-icon,.qds-text{color:var(--qds-theme-title)}.qds-subtitle{color:var(--qds-theme-subtitle);font:var(--qds-control-tab-standard-subtitle)}.qds-indicator{inset-block-start:0;inset-inline-end:0;position:absolute;transform:translate(50%,-50%)}.qds-closable-wrapper[data-size=small],.qds-tab[data-size=small]{gap:var(--qds-control-tab-small-gap-internal);min-height:var(--qds-control-tab-small-height);padding-inline:var(--qds-control-tab-small-padding-horizontal)}.qds-collapse[data-size=small]{min-width:var(--qds-control-tab-small-height)}.qds-closable-tab[data-size=small]{gap:var(--qds-control-tab-small-gap-internal)}[data-size=small]>.qds-icon{font-size:var(--qds-control-tab-small-icon-size)}[data-size=small]>.qds-texts{gap:var(--qds-control-tab-small-titles-gap)}[data-size=small] .qds-text{font:var(--qds-control-tab-small-title)}[data-size=small] .qds-subtitle{font:var(--qds-control-tab-small-subtitle)}.qds-target-icon[data-size=small]{--qds-experimental-icon-click-target-size:var(--qds-control-small-height);height:var(--qds-control-small-icon-size);width:var(--qds-control-small-icon-size)}.qds-closable-wrapper[data-size=standard],.qds-tab[data-size=standard]{gap:var(--qds-control-tab-standard-gap-internal);min-height:var(--qds-control-tab-standard-height);padding-inline:var(--qds-control-tab-standard-padding-horizontal)}.qds-collapse[data-size=standard]{min-width:var(--qds-control-tab-standard-height)}.qds-closable-tab[data-size=standard]{gap:var(--qds-control-tab-standard-gap-internal)}[data-size=standard]>.qds-icon{font-size:var(--qds-control-tab-standard-icon-size)}[data-size=standard]>.qds-texts{gap:var(--qds-control-tab-standard-titles-gap)}[data-size=standard] .qds-text{font:var(--qds-control-tab-standard-title)}[data-size=standard] .qds-subtitle{font:var(--qds-control-tab-standard-subtitle)}.qds-target-icon[data-size=standard]{--qds-experimental-icon-click-target-size:var(\n --qds-control-standard-height\n );height:var(--qds-control-standard-icon-size);width:var(--qds-control-standard-icon-size)}.qds-closable-wrapper[data-size=large],.qds-tab[data-size=large]{gap:var(--qds-control-tab-large-gap-internal);min-height:var(--qds-control-tab-large-height);padding-inline:var(--qds-control-tab-large-padding-horizontal)}.qds-collapse[data-size=large]{min-width:var(--qds-control-tab-large-height)}.qds-closable-tab[data-size=large]{gap:var(--qds-control-tab-large-gap-internal)}[data-size=large]>.qds-icon{font-size:var(--qds-control-tab-large-icon-size)}[data-size=large]>.qds-texts{gap:var(--qds-control-tab-large-titles-gap)}[data-size=large] .qds-text{font:var(--qds-control-tab-large-title)}[data-size=large] .qds-subtext{font:var(--qds-control-tab-large-subtitle)}.qds-target-icon[data-size=large]{--qds-experimental-icon-click-target-size:var(--qds-control-large-height);height:var(--qds-control-large-icon-size);width:var(--qds-control-large-icon-size)}.qds-selected.qds-closable-wrapper[data-importance=emphasized],.qds-selected.qds-tab[data-importance=emphasized]{background-color:var(--qds-theme-control-background)}[data-importance=emphasized][data-size=standard] .qds-text{font:var(--qds-control-tab-standard-title-emphasized)}[data-importance=emphasized][data-size=small] .qds-text{font:var(--qds-control-tab-small-title-emphasized)}[data-importance=emphasized][data-size=large] .qds-text{font:var(--qds-control-tab-large-title-emphasized)}[data-importance=emphasized] .qds-icon,[data-importance=standard] .qds-selected .qds-icon{color:var(--qds-theme-signature-color-default)}:is(.qds-selected[data-importance=subdued],.qds-selected[data-importance=standard],.qds-selected[data-importance=emphasized],.qds-closable-wrapper[data-importance=subdued],.qds-closable-wrapper[data-importance=standard],.qds-closable-wrapper[data-importance=emphasized],[data-importance=subdued] .qds-tab:hover,[data-importance=standard] .qds-tab:hover,[data-importance=emphasized] .qds-tab:hover):after{border-radius:var(--qds-signature-line-connection-cap-radius);content:\"\";display:block;position:absolute}.qds-indicator-inline-end:is(.qds-selected[data-importance=subdued],.qds-selected[data-importance=standard],.qds-selected[data-importance=emphasized],.qds-closable-wrapper[data-importance=subdued],.qds-closable-wrapper[data-importance=standard],.qds-closable-wrapper[data-importance=emphasized],[data-importance=subdued] .qds-tab:hover,[data-importance=standard] .qds-tab:hover,[data-importance=emphasized] .qds-tab:hover):after,.qds-indicator-inline-start:is(.qds-selected[data-importance=subdued],.qds-selected[data-importance=standard],.qds-selected[data-importance=emphasized],.qds-closable-wrapper[data-importance=subdued],.qds-closable-wrapper[data-importance=standard],.qds-closable-wrapper[data-importance=emphasized],[data-importance=subdued] .qds-tab:hover,[data-importance=standard] .qds-tab:hover,[data-importance=emphasized] .qds-tab:hover):after{height:100%;width:var(--qds-signature-line-connection-width)}.qds-indicator-inline-end:is(.qds-selected[data-importance=subdued],.qds-selected[data-importance=standard],.qds-selected[data-importance=emphasized],.qds-closable-wrapper[data-importance=subdued],.qds-closable-wrapper[data-importance=standard],.qds-closable-wrapper[data-importance=emphasized],[data-importance=subdued] .qds-tab:hover,[data-importance=standard] .qds-tab:hover,[data-importance=emphasized] .qds-tab:hover):after{inset-inline-end:0}.qds-indicator-inline-start:is(.qds-selected[data-importance=subdued],.qds-selected[data-importance=standard],.qds-selected[data-importance=emphasized],.qds-closable-wrapper[data-importance=subdued],.qds-closable-wrapper[data-importance=standard],.qds-closable-wrapper[data-importance=emphasized],[data-importance=subdued] .qds-tab:hover,[data-importance=standard] .qds-tab:hover,[data-importance=emphasized] .qds-tab:hover):after{inset-inline-start:0}.qds-indicator-block-end:is(.qds-selected[data-importance=subdued],.qds-selected[data-importance=standard],.qds-selected[data-importance=emphasized],.qds-closable-wrapper[data-importance=subdued],.qds-closable-wrapper[data-importance=standard],.qds-closable-wrapper[data-importance=emphasized],[data-importance=subdued] .qds-tab:hover,[data-importance=standard] .qds-tab:hover,[data-importance=emphasized] .qds-tab:hover):after,.qds-indicator-block-start:is(.qds-selected[data-importance=subdued],.qds-selected[data-importance=standard],.qds-selected[data-importance=emphasized],.qds-closable-wrapper[data-importance=subdued],.qds-closable-wrapper[data-importance=standard],.qds-closable-wrapper[data-importance=emphasized],[data-importance=subdued] .qds-tab:hover,[data-importance=standard] .qds-tab:hover,[data-importance=emphasized] .qds-tab:hover):after{height:var(--qds-signature-line-connection-width);width:100%}.qds-indicator-block-end:is(.qds-selected[data-importance=subdued],.qds-selected[data-importance=standard],.qds-selected[data-importance=emphasized],.qds-closable-wrapper[data-importance=subdued],.qds-closable-wrapper[data-importance=standard],.qds-closable-wrapper[data-importance=emphasized],[data-importance=subdued] .qds-tab:hover,[data-importance=standard] .qds-tab:hover,[data-importance=emphasized] .qds-tab:hover):after{bottom:0}.qds-indicator-block-start:is(.qds-selected[data-importance=subdued],.qds-selected[data-importance=standard],.qds-selected[data-importance=emphasized],.qds-closable-wrapper[data-importance=subdued],.qds-closable-wrapper[data-importance=standard],.qds-closable-wrapper[data-importance=emphasized],[data-importance=subdued] .qds-tab:hover,[data-importance=standard] .qds-tab:hover,[data-importance=emphasized] .qds-tab:hover):after{top:0}.qds-selected[data-importance=standard][data-size=standard] .qds-text,.qds-selected[data-importance=subdued][data-size=standard] .qds-text{font:var(--qds-control-tab-standard-title-emphasized)}.qds-selected[data-importance=standard][data-size=small] .qds-text,.qds-selected[data-importance=subdued][data-size=small] .qds-text{font:var(--qds-control-tab-small-title-emphasized)}.qds-selected[data-importance=standard][data-size=large] .qds-text,.qds-selected[data-importance=subdued][data-size=large] .qds-text{font:var(--qds-control-tab-large-title-emphasized)}[data-importance=emphasized]:hover:after,[data-importance=standard]:hover:after{background-color:var(--qds-theme-signature-color-hover)}[data-importance=emphasized]:active:after,[data-importance=standard]:active:after{background-color:var(--qds-theme-signature-color-pressed)}.qds-selected[data-importance=emphasized]:after,.qds-selected[data-importance=standard]:after{background-color:var(--qds-theme-signature-color-default)}.qds-selected[data-importance=subdued]:after,[data-importance=subdued] :active:after{background-color:var(--qds-theme-link-subdued-pressed)}[data-importance=subdued]:hover:after{background-color:var(--qds-theme-link-subdued-hover)}.qds-tab.qds-icon-only{padding-inline:0}.qds-tab:focus-visible{border-radius:var(--qds-focus-border-radius);outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:calc(var(--qds-focus-border-width)*-1 - var(--qds-focus-border-offset))}.qds-closable-tab{width:100%}.qds-closable-tab:focus-visible{border-radius:var(--qds-focus-border-radius);outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width)}.qds-closable-tab,.qds-closable-wrapper,.qds-tab{align-items:center;justify-content:center}.qds-closable-tab,.qds-tab{background-color:initial;border:none;cursor:pointer;text-align:initial}.qds-closable-tab:any-link,.qds-tab:any-link{-webkit-text-decoration:none;text-decoration:none}.qds-hidden{display:none}";
|
|
10
|
+
const QdsTabStyle0 = tabCss;
|
|
11
|
+
|
|
12
|
+
// SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
15
|
+
var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
16
|
+
if (kind === "m")
|
|
17
|
+
throw new TypeError("Private method is not writable");
|
|
18
|
+
if (kind === "a" && !f)
|
|
19
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
20
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
21
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
22
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
23
|
+
};
|
|
24
|
+
var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
25
|
+
if (kind === "a" && !f)
|
|
26
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
27
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
28
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
29
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
30
|
+
};
|
|
31
|
+
var _Tab_instances, _Tab_inheritedAttributes, _Tab_div, _Tab_panel, _Tab_collapsed_get, _Tab_computedAction_get, _Tab_computedSize_get, _Tab_computedImportance_get, _Tab_ariaLabel_get, _Tab_computedDisabled_get, _Tab_shouldCollapse_get, _Tab_placement_get, _Tab_renderText, _Tab_ref, _Tab_tooltipRef, _Tab_close, _Tab_onIconClick, _Tab_onIconKeyDown, _Tab_onBlur, _Tab_onFocus;
|
|
32
|
+
const isCounter = (value) => typeof value === 'string'
|
|
33
|
+
? !Number.isNaN(Number.parseFloat(value))
|
|
34
|
+
: typeof value === 'number';
|
|
35
|
+
const isIndicator = (value) => value === '' || value === true;
|
|
36
|
+
let autoIncrementingId = 1;
|
|
37
|
+
const Tab = class {
|
|
38
|
+
constructor(hostRef) {
|
|
39
|
+
registerInstance(this, hostRef);
|
|
40
|
+
this.closeEmitter = createEvent(this, "qdsClose", 6);
|
|
41
|
+
this.blurEmitter = createEvent(this, "qdsBlur", 2);
|
|
42
|
+
this.focusEmitter = createEvent(this, "qdsFocus", 2);
|
|
43
|
+
_Tab_instances.add(this);
|
|
44
|
+
_Tab_inheritedAttributes.set(this, {});
|
|
45
|
+
_Tab_div.set(this, void 0);
|
|
46
|
+
_Tab_panel.set(this, void 0);
|
|
47
|
+
_Tab_ref.set(this, (div) => {
|
|
48
|
+
__classPrivateFieldSet(this, _Tab_div, div, "f");
|
|
49
|
+
});
|
|
50
|
+
_Tab_tooltipRef.set(this, (tooltip) => {
|
|
51
|
+
if (tooltip)
|
|
52
|
+
// eslint-disable-next-line no-param-reassign
|
|
53
|
+
tooltip.target = __classPrivateFieldGet(this, _Tab_div, "f");
|
|
54
|
+
});
|
|
55
|
+
_Tab_close.set(this, () => {
|
|
56
|
+
this.closeEmitter.emit();
|
|
57
|
+
});
|
|
58
|
+
_Tab_onIconClick.set(this, (event) => {
|
|
59
|
+
event.stopPropagation();
|
|
60
|
+
const path = event.composedPath();
|
|
61
|
+
const closeIcon = path.find((element) => element instanceof HTMLElement &&
|
|
62
|
+
element.classList.contains('qds-target'));
|
|
63
|
+
if (closeIcon && !event.defaultPrevented)
|
|
64
|
+
__classPrivateFieldGet(this, _Tab_close, "f").call(this);
|
|
65
|
+
});
|
|
66
|
+
_Tab_onIconKeyDown.set(this, (event) => {
|
|
67
|
+
const path = event.composedPath();
|
|
68
|
+
const closeIcon = path.find((element) => element instanceof HTMLElement &&
|
|
69
|
+
element.classList.contains('qds-target'));
|
|
70
|
+
if (closeIcon && (event.key === 'Enter' || event.key === ' ')) {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
event.stopPropagation();
|
|
73
|
+
__classPrivateFieldGet(this, _Tab_close, "f").call(this);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
_Tab_onBlur.set(this, (event) => {
|
|
77
|
+
this.blurEmitter.emit(pickFocusEventAttributes(event));
|
|
78
|
+
});
|
|
79
|
+
_Tab_onFocus.set(this, (event) => {
|
|
80
|
+
this.focusEmitter.emit(pickFocusEventAttributes(event));
|
|
81
|
+
});
|
|
82
|
+
this.action = undefined;
|
|
83
|
+
this.badge = undefined;
|
|
84
|
+
this.badgeCounterImportance = 'standard';
|
|
85
|
+
this.badgeDescription = undefined;
|
|
86
|
+
this.badgeIndicatorStatus = 'neutral';
|
|
87
|
+
this.disabled = undefined;
|
|
88
|
+
this.iconLibrary = 'default';
|
|
89
|
+
this.iconName = undefined;
|
|
90
|
+
this.iconOnly = false;
|
|
91
|
+
this.importance = 'standard';
|
|
92
|
+
this.indicatorPosition = 'block-end';
|
|
93
|
+
this.panel = undefined;
|
|
94
|
+
this.tagIconDescription = undefined;
|
|
95
|
+
this.tagIconName = undefined;
|
|
96
|
+
this.tagIconLibrary = 'default';
|
|
97
|
+
this.tagImportance = 'emphasized';
|
|
98
|
+
this.tagSize = 'small';
|
|
99
|
+
this.tagStatus = 'info';
|
|
100
|
+
this.tagText = undefined;
|
|
101
|
+
this.selected = false;
|
|
102
|
+
this.size = 'standard';
|
|
103
|
+
this.subtitle = undefined;
|
|
104
|
+
this.text = undefined;
|
|
105
|
+
this.href = undefined;
|
|
106
|
+
this.tabIndex = undefined;
|
|
107
|
+
}
|
|
108
|
+
panelChanged() {
|
|
109
|
+
this.disconnectedCallback();
|
|
110
|
+
const panel = resolveTarget(this.panel);
|
|
111
|
+
if (!(panel instanceof globalThis.Element))
|
|
112
|
+
return;
|
|
113
|
+
__classPrivateFieldSet(this, _Tab_panel, panel, "f");
|
|
114
|
+
const tab = this.host.shadowRoot?.querySelector('[role="tab"]');
|
|
115
|
+
if (tab)
|
|
116
|
+
tab.setAttribute('aria-controls', __classPrivateFieldGet(this, _Tab_panel, "f").id);
|
|
117
|
+
if (__classPrivateFieldGet(this, _Tab_panel, "f").role === null)
|
|
118
|
+
__classPrivateFieldGet(this, _Tab_panel, "f").role = 'tabpanel';
|
|
119
|
+
if (__classPrivateFieldGet(this, _Tab_panel, "f").getAttribute('aria-labelledby') === null)
|
|
120
|
+
__classPrivateFieldGet(this, _Tab_panel, "f").setAttribute('aria-labelledby', this.host.id);
|
|
121
|
+
__classPrivateFieldGet(this, _Tab_panel, "f").setAttribute('tabindex', __classPrivateFieldGet(this, _Tab_panel, "f").getAttribute('tabindex') ?? '0');
|
|
122
|
+
}
|
|
123
|
+
onClick(event) {
|
|
124
|
+
if (__classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedDisabled_get))
|
|
125
|
+
event.stopImmediatePropagation();
|
|
126
|
+
}
|
|
127
|
+
tabindexChanged(newValue) {
|
|
128
|
+
const parsedValue = Number.parseInt(newValue, 10);
|
|
129
|
+
this.tabIndex =
|
|
130
|
+
parsedValue === 0 || Number.isNaN(parsedValue) ? undefined : parsedValue;
|
|
131
|
+
}
|
|
132
|
+
componentWillLoad() {
|
|
133
|
+
var _a;
|
|
134
|
+
__classPrivateFieldSet(this, _Tab_inheritedAttributes, inheritAriaAttributes(this.host), "f");
|
|
135
|
+
this.tabindexChanged(this.host.getAttribute('tabindex') ?? '0');
|
|
136
|
+
(_a = this.host).id || (_a.id = `qds-tab-${autoIncrementingId}`);
|
|
137
|
+
autoIncrementingId += 1;
|
|
138
|
+
}
|
|
139
|
+
componentDidLoad() {
|
|
140
|
+
this.panelChanged();
|
|
141
|
+
}
|
|
142
|
+
disconnectedCallback() {
|
|
143
|
+
if (!__classPrivateFieldGet(this, _Tab_panel, "f"))
|
|
144
|
+
return;
|
|
145
|
+
const tab = this.host.shadowRoot?.querySelector('[role="tab"]');
|
|
146
|
+
if (tab)
|
|
147
|
+
tab.removeAttribute('aria-controls');
|
|
148
|
+
if (__classPrivateFieldGet(this, _Tab_panel, "f").role === 'tabpanel')
|
|
149
|
+
// eslint-disable-next-line unicorn/no-null
|
|
150
|
+
__classPrivateFieldGet(this, _Tab_panel, "f").role = null;
|
|
151
|
+
if (__classPrivateFieldGet(this, _Tab_panel, "f").getAttribute('aria-labelledby') === this.host.id)
|
|
152
|
+
__classPrivateFieldGet(this, _Tab_panel, "f").removeAttribute('aria-labelledby');
|
|
153
|
+
__classPrivateFieldGet(this, _Tab_panel, "f").removeAttribute('tabindex');
|
|
154
|
+
}
|
|
155
|
+
render() {
|
|
156
|
+
const isLink = this.href !== undefined && __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedAction_get) === undefined;
|
|
157
|
+
const Tag = isLink
|
|
158
|
+
? 'a'
|
|
159
|
+
: __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedAction_get) === 'expandable'
|
|
160
|
+
? 'button'
|
|
161
|
+
: 'div';
|
|
162
|
+
return (h("div", { key: '87b74471679bdaaea47e101725d6f96ceb5e8d3f', "aria-disabled": __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedDisabled_get) ? 'true' : undefined, class: {
|
|
163
|
+
'qds-closable-wrapper': __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedAction_get) === 'closable',
|
|
164
|
+
'qds-selected': this.selected,
|
|
165
|
+
[`qds-indicator-${this.indicatorPosition}`]: __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedAction_get) === 'closable',
|
|
166
|
+
}, "data-size": __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedSize_get), "data-importance": __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedImportance_get), ref: __classPrivateFieldGet(this, _Tab_ref, "f") }, h(Tag, { key: '54a53d47260e0c89eea928c688aa7f81a1a64d6e', "aria-disabled": __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedDisabled_get) ? 'true' : undefined, disabled: isLink ? undefined : this.disabled, onBlur: __classPrivateFieldGet(this, _Tab_onBlur, "f"), onFocus: __classPrivateFieldGet(this, _Tab_onFocus, "f"), class: {
|
|
167
|
+
'qds-tab': __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedAction_get) !== 'closable',
|
|
168
|
+
'qds-icon-only': __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_collapsed_get),
|
|
169
|
+
'qds-collapse': __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_shouldCollapse_get) && __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedAction_get) !== 'closable',
|
|
170
|
+
'qds-closable-tab': __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedAction_get) === 'closable',
|
|
171
|
+
'qds-selected': this.selected,
|
|
172
|
+
[`qds-indicator-${this.indicatorPosition}`]: __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedAction_get) !== 'closable',
|
|
173
|
+
}, role: !isLink && __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedAction_get) !== 'expandable' ? 'tab' : undefined, "aria-current": isLink && this.selected ? 'true' : undefined, "aria-expanded": __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedAction_get) === 'expandable' && !isLink
|
|
174
|
+
? this.selected
|
|
175
|
+
? 'true'
|
|
176
|
+
: 'false'
|
|
177
|
+
: undefined, "data-importance": __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedImportance_get), "data-action": __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedAction_get), "data-size": __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedSize_get), href: isLink ? this.href : undefined, ...__classPrivateFieldGet(this, _Tab_inheritedAttributes, "f") }, ((this.tagText !== undefined && this.tagText !== '') ||
|
|
178
|
+
(this.tagIconName !== undefined && this.tagIconName !== '')) && (h("qds-tag", { key: '46bd543f6387afeff31f6e36393755ac7ea89ed2', text: this.tagText, status: this.tagStatus, size: __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedSize_get), importance: this.tagImportance, "icon-library": this.tagIconLibrary, "icon-name": this.tagIconName, "icon-description": this.tagIconDescription, class: { 'qds-hidden': __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_shouldCollapse_get) } })), this.iconName !== undefined && this.iconName !== '' && (h("qds-icon", { key: '464bf60019f9ad7f64056cb537d92bf9d375e57d', "aria-hidden": "true", class: "qds-icon", library: this.iconLibrary, name: this.iconName })), !__classPrivateFieldGet(this, _Tab_instances, "a", _Tab_shouldCollapse_get) && this.text && __classPrivateFieldGet(this, _Tab_instances, "m", _Tab_renderText).call(this), isIndicator(this.badge) && (h("qds-badge-indicator", { key: '4b5233a1d8cac76f3a4d882751c4c35e635ea22f', class: {
|
|
179
|
+
'qds-indicator': __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_shouldCollapse_get),
|
|
180
|
+
}, status: this.badgeIndicatorStatus, description: this.badgeDescription, size: __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedSize_get), strokeRing: true })), isCounter(this.badge) && (h("qds-badge-counter", { key: 'ef6f0c90068df3bebc9478ab2d25cf1c4b7b0749', class: {
|
|
181
|
+
'qds-indicator': __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_shouldCollapse_get),
|
|
182
|
+
}, description: this.badgeDescription, importance: this.badgeCounterImportance, size: __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedSize_get), strokeRing: true, value: this.badge })), __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedAction_get) === 'expandable' && (h("qds-icon", { key: '3ca3191ff895a20796e1c516e06ba59dd700f7a4', "aria-hidden": "true", class: { 'qds-target-icon': true, 'qds-chevron': this.selected }, "data-size": __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedSize_get), library: "core", name: "dropdown" }))), __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedAction_get) === 'closable' && (h("button", { key: 'aacf7c8428924c3f17b086ae85b99c4e09fa5fe8', "aria-label": __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_ariaLabel_get), class: "qds-target", tabIndex: __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedDisabled_get) ? undefined : this.tabIndex, disabled: this.disabled, onClick: __classPrivateFieldGet(this, _Tab_onIconClick, "f"), onKeyDown: __classPrivateFieldGet(this, _Tab_onIconKeyDown, "f"), type: "button", ...__classPrivateFieldGet(this, _Tab_inheritedAttributes, "f") }, h("qds-icon", { key: '76e3c63d3289855e0cfe7a174fa4881e72a4d687', "aria-hidden": "true", class: "qds-target-icon", "data-size": __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedSize_get), library: "core", name: "close" }))), __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_shouldCollapse_get) && this.text && (h("qds-tooltip", { key: '894ae79391f12e7d1838de0eb2f3bc91d6a71c11', placement: __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_placement_get), ref: __classPrivateFieldGet(this, _Tab_tooltipRef, "f") }, __classPrivateFieldGet(this, _Tab_instances, "m", _Tab_renderText).call(this)))));
|
|
183
|
+
}
|
|
184
|
+
get host() { return getElement(this); }
|
|
185
|
+
static get watchers() { return {
|
|
186
|
+
"panel": ["panelChanged"],
|
|
187
|
+
"tabindex": ["tabindexChanged"]
|
|
188
|
+
}; }
|
|
189
|
+
};
|
|
190
|
+
_Tab_inheritedAttributes = new WeakMap(), _Tab_div = new WeakMap(), _Tab_panel = new WeakMap(), _Tab_ref = new WeakMap(), _Tab_tooltipRef = new WeakMap(), _Tab_close = new WeakMap(), _Tab_onIconClick = new WeakMap(), _Tab_onIconKeyDown = new WeakMap(), _Tab_onBlur = new WeakMap(), _Tab_onFocus = new WeakMap(), _Tab_instances = new WeakSet(), _Tab_collapsed_get = function _Tab_collapsed_get() {
|
|
191
|
+
const hasNoTag = this.tagText === undefined || this.tagText === '';
|
|
192
|
+
const hasNoBadge = this.badge === undefined || this.badge === '';
|
|
193
|
+
return (__classPrivateFieldGet(this, _Tab_instances, "a", _Tab_shouldCollapse_get) &&
|
|
194
|
+
__classPrivateFieldGet(this, _Tab_instances, "a", _Tab_computedAction_get) === undefined &&
|
|
195
|
+
hasNoTag &&
|
|
196
|
+
hasNoBadge);
|
|
197
|
+
}, _Tab_computedAction_get = function _Tab_computedAction_get() {
|
|
198
|
+
switch (this.action) {
|
|
199
|
+
case 'closable':
|
|
200
|
+
case 'expandable': {
|
|
201
|
+
return this.action;
|
|
202
|
+
}
|
|
203
|
+
default: {
|
|
204
|
+
return undefined;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}, _Tab_computedSize_get = function _Tab_computedSize_get() {
|
|
208
|
+
switch (this.size) {
|
|
209
|
+
case 'standard':
|
|
210
|
+
case 'small':
|
|
211
|
+
case 'large': {
|
|
212
|
+
return this.size;
|
|
213
|
+
}
|
|
214
|
+
default: {
|
|
215
|
+
return 'standard';
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}, _Tab_computedImportance_get = function _Tab_computedImportance_get() {
|
|
219
|
+
switch (this.importance) {
|
|
220
|
+
case 'subdued':
|
|
221
|
+
case 'emphasized': {
|
|
222
|
+
return this.importance;
|
|
223
|
+
}
|
|
224
|
+
default: {
|
|
225
|
+
return 'standard';
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}, _Tab_ariaLabel_get = function _Tab_ariaLabel_get() {
|
|
229
|
+
return `Close ${this.text}`;
|
|
230
|
+
}, _Tab_computedDisabled_get = function _Tab_computedDisabled_get() {
|
|
231
|
+
return this.disabled ?? false;
|
|
232
|
+
}, _Tab_shouldCollapse_get = function _Tab_shouldCollapse_get() {
|
|
233
|
+
return this.iconOnly && this.iconName !== undefined && this.iconName !== '';
|
|
234
|
+
}, _Tab_placement_get = function _Tab_placement_get() {
|
|
235
|
+
switch (this.indicatorPosition) {
|
|
236
|
+
case 'inline-start': {
|
|
237
|
+
return 'left';
|
|
238
|
+
}
|
|
239
|
+
case 'inline-end': {
|
|
240
|
+
return 'right';
|
|
241
|
+
}
|
|
242
|
+
case 'block-start': {
|
|
243
|
+
return 'top';
|
|
244
|
+
}
|
|
245
|
+
default: {
|
|
246
|
+
return 'bottom';
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}, _Tab_renderText = function _Tab_renderText() {
|
|
250
|
+
return __classPrivateFieldGet(this, _Tab_instances, "a", _Tab_shouldCollapse_get) ? (h("qds-title", { subtitle: this.subtitle, layer: "accessory", level: "root" }, this.text)) : (h("div", { class: "qds-texts" }, h("div", { class: "qds-text" }, this.text), this.subtitle !== undefined && this.subtitle !== '' && (h("div", { class: "qds-subtitle" }, this.subtitle))));
|
|
251
|
+
};
|
|
252
|
+
Tab.style = QdsTabStyle0;
|
|
253
|
+
|
|
254
|
+
export { Tab as qds_tab };
|
|
255
|
+
|
|
256
|
+
//# sourceMappingURL=qds-tab.entry.js.map
|