@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 +1 @@
|
|
|
1
|
-
{"file":"qds-button.js","mappings":";;;;;;;;;AAAA,MAAM,SAAS,GAAG,qjHAAqjH;;MC+B1jH,MAAM;;;;;;;IA4MT,wBAAmB,GAAe,EAAE,CAAA;IA0E3B,YAAO,GAAG,CAAC,KAAiB;MAC3C,IAAI,IAAI,CAAC,gBAAgB,EAAE;QACzB,KAAK,CAAC,cAAc,EAAE,CAAA;QACtB,KAAK,CAAC,eAAe,EAAE,CAAA;QACvB,OAAM;OACP;MAED,IAAI,IAAI,CAAC,UAAU,KAAK,QAAQ,IAAI,CAA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EACP;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/button/button.css?tag=qds-button&encapsulation=shadow","src/components/button/button.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.button {\n appearance: none;\n background-color: initial;\n border: none;\n padding-block: 0;\n align-items: center;\n border-radius: var(--qds-control-border-radius);\n cursor: pointer;\n display: inline-flex;\n gap: var(--qds-control-button-gap-internal);\n justify-content: center;\n padding-inline: var(--qds-control-button-padding-horizontal);\n print-color-adjust: exact;\n user-select: none;\n white-space: nowrap;\n width: 100%;\n\n &.icon-only {\n padding-inline: 0;\n }\n\n &:any-link {\n text-decoration: none;\n }\n\n &:focus-visible {\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 font: var(--qds-control-small-text);\n height: var(--qds-control-small-height);\n\n &.icon-only {\n width: var(--qds-control-small-height);\n }\n\n &.icon {\n font-size: var(--qds-control-small-icon-size);\n }\n}\n\n[data-size='standard'] {\n font: var(--qds-control-standard-text);\n height: var(--qds-control-standard-height);\n\n &.icon-only {\n width: var(--qds-control-standard-height);\n }\n\n &.icon {\n font-size: var(--qds-control-standard-icon-size);\n }\n}\n\n[data-size='large'] {\n font: var(--qds-control-large-text);\n height: var(--qds-control-large-height);\n\n &.icon-only {\n width: var(--qds-control-large-height);\n }\n\n &.icon {\n font-size: var(--qds-control-large-icon-size);\n }\n}\n\n[data-importance='subdued'] {\n border: var(--qds-control-border-width) solid transparent;\n color: var(--qds-theme-link-default);\n\n &.icon-only {\n color: var(--qds-theme-control-text-standard);\n }\n\n &:hover {\n border: var(--qds-control-border-width) solid var(--qds-theme-link-default);\n\n &.icon-only {\n background-color: var(--qds-theme-interactive-background-hover);\n border: none;\n color: var(--qds-theme-control-text-standard);\n }\n }\n\n &:active {\n border: var(--qds-control-border-width) solid var(--qds-theme-link-pressed);\n color: var(--qds-theme-link-pressed);\n\n &.icon-only {\n background-color: var(--qds-theme-interactive-background-pressed);\n border: none;\n color: var(--qds-theme-control-text-standard);\n }\n }\n}\n\n[data-importance='standard'] {\n border: var(--qds-control-border-width) solid var(--qds-theme-control-border);\n color: var(--qds-theme-control-text-standard);\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\n[data-importance='emphasized'] {\n background-color: var(--qds-theme-signature-color-default);\n color: var(--qds-theme-signature-color-contrast);\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[data-importance='destructive'] {\n background-color: var(--qds-theme-feedback-action-destructive-default);\n color: var(--qds-theme-feedback-action-destructive-contrast);\n\n &:hover {\n background-color: var(--qds-theme-feedback-action-destructive-hover);\n }\n\n &:active {\n background-color: var(--qds-theme-feedback-action-destructive-pressed);\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, Prop } from '@stencil/core'\nimport type { LiteralUnion } from 'type-fest'\n\nimport type { Attributes, QdsFocusEventDetail } from '../../helpers'\nimport { inheritAriaAttributes, pickFocusEventAttributes } from '../../helpers'\n\nexport type ButtonType = 'button' | 'reset' | 'submit'\nexport type Importance = 'destructive' | 'emphasized' | 'standard' | 'subdued'\nexport type ButtonSize = 'large' | 'small' | 'standard'\nexport type FormMethod = 'get' | 'post'\nexport type ButtonTarget = '_blank' | '_parent' | '_self' | '_top'\n\n/**\n * The `<qds-button>` element is an interactive element activated by a user\n * with a mouse, keyboard, finger, voice command, or other assistive technology.\n * Once activated, it then performs a programmable action, such as submitting a\n * [form](https://developer.mozilla.org/docs/Learn/Forms)\n * or opening a dialog.\n *\n * @see https://quartz.se.com/build/components/button\n */\n@Component({\n tag: 'qds-button',\n shadow: { delegatesFocus: true },\n styleUrl: 'button.css',\n})\nexport class Button implements ComponentInterface {\n /**\n * The name of the icon to render.\n *\n * Available names depend on the icon library being used.\n */\n @Prop({ reflect: true }) public readonly iconName?: string\n\n /**\n * The name of a registered icon library.\n */\n @Prop({ reflect: true }) public readonly iconLibrary: string = 'default'\n\n /**\n * The button's importance.\n */\n @Prop({ reflect: true }) public readonly importance: Importance = 'standard'\n\n /**\n * The button's size.\n */\n @Prop({ reflect: true }) public readonly size: ButtonSize = 'standard'\n\n /**\n * The button's text.\n */\n @Prop({ mutable: true, reflect: true }) public readonly text?: string\n\n /**\n * Prevents the button 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 * Tells the browser to download the linked file as this filename. Only used\n * when `href` is set.\n *\n * @webnative\n */\n @Prop() public readonly download?: string\n\n /**\n * The [`<form>`](https://developer.mozilla.org/docs/Web/HTML/Element/form)\n * element to associate the button 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 `<button>` is associated with\n * its ancestor `<form>` element, if any.\n *\n * This attribute lets you associate `<button>` 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 URL that processes the information submitted by the button. Overrides\n * the [`action`](https://developer.mozilla.org/docs/Web/HTML/Element/button#attr-formaction)\n * attribute of the button's form owner. Does nothing if there is no form owner.\n *\n * @webnative\n */\n @Prop({ attribute: 'formaction' }) public readonly formAction?: string\n\n /**\n * If the button is a submit button (it's inside/associated with a `<form>`\n * and doesn't have `type=\"button\"`), this attribute specifies the\n * [HTTP method](https://developer.mozilla.org/docs/Web/HTTP/Methods) used to\n * submit the form. Possible values:\n *\n * - `get`: The form data are appended to the form's action URL, with a ? as\n * a separator, and the resulting URL is sent to the server. Use this method\n * when the form has no side effects, like search forms.\n * - `post`: The data from the form are included in the body of the HTTP\n * request when sent to the server. Use when the form contains information\n * that shouldn't be public, like login credentials.\n *\n * If specified, this attribute overrides the method attribute of the button's form owner.\n *\n * @webnative\n */\n @Prop({ attribute: 'formmethod' }) public readonly formMethod?: FormMethod\n\n /**\n * If the button is a submit button, this attribute specifies that the form\n * is not to be\n * [validated](https://developer.mozilla.org/docs/Learn/Forms/Form_validation)\n * when it is submitted. If this attribute is specified, it overrides the\n * [`novalidate`](https://developer.mozilla.org/docs/Web/HTML/Element/form#attr-novalidate)\n * attribute of the button's form owner.\n *\n * @webnative\n */\n @Prop({ attribute: 'formnovalidate' })\n public readonly formNoValidate: boolean = false\n\n /**\n * If the button is a submit button, this attribute is an author-defined name\n * or standardized, underscore-prefixed keyword indicating where to display\n * the response from submitting the form. This is the `name` of, or keyword\n * for, a browsing context (a tab, window, or\n * [`<iframe>`](https://developer.mozilla.org/docs/Web/HTML/Element/iframe)).\n * If this attribute is specified, it overrides the\n * [`target`](https://developer.mozilla.org/docs/Web/HTML/Element/form#attr-target)\n * attribute of the button's form owner. The following keywords have special\n * meanings:\n *\n * - `_blank`: Load the response into a new unnamed browsing context — usually\n * a new tab or window, depending on the user's browser settings.\n * - `_parent`: Load the response into the parent browsing context of the\n * current one. If there is no parent, this option behaves the same way as\n * `_self`.\n * - `_self`: Load the response into the same browsing context as the current\n * one.\n * - `_top`: Load the response into the top-level browsing context (that is,\n * the browsing context that is an ancestor of the current one, and has no\n * parent). If there is no parent, this option behaves the same way as\n * `_self`.\n *\n * @webnative\n */\n @Prop({ attribute: 'formtarget' })\n public readonly formTarget: LiteralUnion<ButtonTarget, string> = '_self'\n\n /**\n * When set, the underlying button will be rendered as an `<a>` with this\n * `href` instead of a `<button>`.\n *\n * @webnative\n */\n @Prop() public readonly href?: string\n\n /**\n * The name of the button, submitted as a pair with the button's `value` as\n * part of the form data, when that button is used to submit the form.\n * Ignored when `href` is set.\n *\n * @webnative\n */\n @Prop() public readonly name?: string\n\n /**\n * Where to display the linked URL, as the name for a browsing context (a\n * tab, window, or\n * [`<iframe>`](https://developer.mozilla.org/docs/Web/HTML/Element/iframe).\n * The following keywords have special meanings for where to load the URL:\n *\n * - `_blank`: usually a new tab, but users can configure browsers to open a new\n * window instead.\n * - `_parent`: the parent browsing context of the current one. If no parent,\n * behaves as `_self`.\n * - `_self`: the current browsing context.\n * - `_top`: the topmost browsing context (the \"highest\" context that's an\n * ancestor of the current one). If no ancestors, behaves as `_self`.\n *\n * @webnative\n */\n @Prop() public readonly target: LiteralUnion<ButtonTarget, string> = '_self'\n\n /**\n * The type of button.\n *\n * `button`: The button has no default behavior, and does nothing when\n * pressed by default. It can have client-side scripts listen to the\n * element's events, which are triggered when the events occur.\n *\n * `submit`: The button submits the form data to the server. This is the\n * default if the attribute is not specified for buttons associated with a\n * `<form>`, or if the attribute is an empty or invalid value.\n *\n * `reset`: The button resets all the controls to their initial values.\n *\n * @webnative\n */\n @Prop() public readonly type?: ButtonType\n\n /**\n * Defines the value associated with the button's `name` when it's submitted\n * with the form data. This value is passed to the server in params when the\n * form is submitted using this button. Ignored when `href` is set.\n *\n * @webnative\n */\n @Prop() public readonly value?: string\n\n /**\n * Emitted when the button loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when the button gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n @Element() private readonly element!: HTMLQdsButtonElement\n\n private inheritedAttributes: Attributes = {}\n\n private get formElement(): HTMLElement | null {\n return this.form !== undefined && this.form !== ''\n ? document.querySelector(`#${this.form}`)\n : this.element.closest('form')\n }\n\n private get buttonType(): ButtonType {\n if (this.type === undefined) return this.formElement ? 'submit' : 'button'\n return this.type\n }\n\n private get iconOnly(): boolean {\n const hasIcon = this.iconName !== undefined && this.iconName !== ''\n const hasNoLabel = this.text === undefined || this.text === ''\n\n return hasIcon && hasNoLabel\n }\n\n private get computedDisabled(): boolean {\n return this.disabled ?? false\n }\n\n private get computedTabIndex(): number {\n const parsedValue = Number.parseInt(this.inheritedAttributes.tabindex, 10)\n return Number.isNaN(parsedValue) ? 0 : parsedValue\n }\n\n public componentWillLoad(): void {\n this.inheritedAttributes = inheritAriaAttributes(this.element)\n }\n\n public render() {\n const Tag = this.href === undefined ? 'button' : 'a'\n\n return (\n <Tag\n aria-disabled={this.computedDisabled ? 'true' : 'false'}\n class={{\n button: true,\n 'icon-only': this.iconOnly,\n }}\n data-importance={this.importance}\n data-size={this.size}\n disabled={Tag === 'a' ? undefined : this.disabled}\n download={Tag === 'a' ? this.download : undefined}\n href={Tag === 'a' ? this.href : undefined}\n name={Tag === 'a' ? undefined : this.name}\n onBlur={this.onBlur}\n onClick={this.onClick}\n onFocus={this.onFocus}\n rel={Tag === 'a' ? 'noreferrer noopener' : undefined}\n role={Tag === 'a' ? 'button' : undefined}\n tabIndex={this.computedDisabled ? -1 : this.computedTabIndex}\n target={Tag === 'a' ? this.target : undefined}\n type={Tag === 'a' ? undefined : this.buttonType}\n value={Tag === 'a' ? undefined : this.value}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n >\n {this.iconName !== undefined && this.iconName !== '' && (\n <qds-icon\n class=\"icon\"\n data-size={this.size}\n library={this.iconLibrary}\n name={this.iconName}\n />\n )}\n {this.text}\n </Tag>\n )\n }\n\n private readonly onClick = (event: MouseEvent): void => {\n if (this.computedDisabled) {\n event.preventDefault()\n event.stopPropagation()\n return\n }\n\n if (this.buttonType === 'button' || !this.formElement) return\n event.preventDefault()\n\n const fakeButton = document.createElement('button')\n fakeButton.type = this.buttonType\n if (this.name !== undefined) fakeButton.name = this.name\n if (this.value !== undefined) fakeButton.value = this.value\n if (this.formAction !== undefined) fakeButton.formAction = this.formAction\n if (this.formMethod !== undefined) fakeButton.formMethod = this.formMethod\n fakeButton.formNoValidate = this.formNoValidate\n fakeButton.formTarget = this.formTarget\n fakeButton.style.display = 'none'\n\n this.formElement.append(fakeButton)\n fakeButton.click()\n fakeButton.remove()\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-button.js","mappings":";;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
|
@@ -2,8 +2,8 @@ import type { Components, JSX } from "../dist/types/components";
|
|
|
2
2
|
|
|
3
3
|
interface QdsCheckbox extends Components.QdsCheckbox, HTMLElement {}
|
|
4
4
|
export const QdsCheckbox: {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
prototype: QdsCheckbox;
|
|
6
|
+
new (): QdsCheckbox;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Used to define this component and all nested components recursively.
|
|
@@ -1,152 +1,9 @@
|
|
|
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 {
|
|
7
|
-
import { p as pickFocusEventAttributes, a as invariant, i as inheritAriaAttributes, b as inheritAttributes } from './helpers.js';
|
|
8
|
-
import { d as defineCustomElement$3 } from './icon.js';
|
|
9
|
-
import { d as defineCustomElement$2 } from './label.js';
|
|
10
|
-
|
|
11
|
-
const checkboxCss = ".sc-qds-checkbox-h{box-sizing:border-box}[hidden].sc-qds-checkbox-h{display:none !important}.sc-qds-checkbox-h *.sc-qds-checkbox,.sc-qds-checkbox-h *.sc-qds-checkbox::before,.sc-qds-checkbox-h *.sc-qds-checkbox::after{box-sizing:inherit}.sc-qds-checkbox-h{display:inline-block;line-height:0}.icon.sc-qds-checkbox{display:none;color:var(--qds-theme-signature-color-contrast);inset-inline-start:0;pointer-events:none;position:absolute}.label.sc-qds-checkbox{cursor:pointer;display:inline-flex;position:relative}.checkbox.sc-qds-checkbox{align-items:center;-webkit-appearance:none;appearance:none;background-color:var(--qds-theme-control-input-background);border-radius:var(--qds-control-border-radius);border:var(--qds-control-border-width) solid var(--qds-theme-control-border);cursor:pointer;display:flex;flex-shrink:0;justify-content:center;margin:0;-webkit-print-color-adjust:exact;print-color-adjust:exact}.checkbox.sc-qds-checkbox:focus-visible{outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset)}.checkbox.sc-qds-checkbox::before{content:'';height:10px;position:absolute;width:10px}.checkbox.sc-qds-checkbox:hover::before{box-shadow:inset 1em 1em var(--qds-theme-signature-color-hover)}.checkbox.sc-qds-checkbox:active::before{box-shadow:inset 1em 1em var(--qds-theme-signature-color-pressed)}.checkbox.sc-qds-checkbox:checked~.checked.sc-qds-checkbox,.checkbox.sc-qds-checkbox:indeterminate~.indeterminate.sc-qds-checkbox{display:inline-block}.checkbox.sc-qds-checkbox:checked,.checkbox.sc-qds-checkbox:indeterminate{background-color:var(--qds-theme-signature-color-default);border-color:transparent}.checkbox.sc-qds-checkbox:checked:hover,.checkbox.sc-qds-checkbox:indeterminate:hover{background-color:var(--qds-theme-signature-color-hover)}.checkbox.sc-qds-checkbox:checked:active,.checkbox.sc-qds-checkbox:indeterminate:active{background-color:var(--qds-theme-signature-color-pressed)}[aria-disabled='true'].sc-qds-checkbox{opacity:var(--qds-theme-disabled);pointer-events:none}.icon[data-size='small'].sc-qds-checkbox,.checkbox[data-size='small'].sc-qds-checkbox{width:var(--qds-control-small-icon-size);height:var(--qds-control-small-icon-size)}.inline[data-size='small'].sc-qds-checkbox{margin-block:var(--qds-control-small-padding-auto-height)}.label[data-size='small'].sc-qds-checkbox{gap:var(--qds-control-small-gap-siblings-related)}.icon[data-size='standard'].sc-qds-checkbox,.checkbox[data-size='standard'].sc-qds-checkbox{width:var(--qds-control-standard-icon-size);height:var(--qds-control-standard-icon-size)}.inline[data-size='standard'].sc-qds-checkbox{margin-block:var(--qds-control-standard-padding-auto-height)}.label[data-size='standard'].sc-qds-checkbox{gap:var(--qds-control-standard-gap-siblings-related)}.icon[data-size='large'].sc-qds-checkbox,.checkbox[data-size='large'].sc-qds-checkbox{width:var(--qds-control-large-icon-size);height:var(--qds-control-large-icon-size)}.inline[data-size='large'].sc-qds-checkbox{margin-block:var(--qds-control-large-padding-auto-height)}.label[data-size='large'].sc-qds-checkbox{gap:var(--qds-control-large-gap-siblings-related)}";
|
|
12
|
-
|
|
13
|
-
let autoIncrementingId = 1;
|
|
14
|
-
const Checkbox = /*@__PURE__*/ proxyCustomElement(class Checkbox extends HTMLElement {
|
|
15
|
-
constructor() {
|
|
16
|
-
super();
|
|
17
|
-
this.__registerHost();
|
|
18
|
-
this.blurEmitter = createEvent(this, "qdsBlur", 2);
|
|
19
|
-
this.changeEmitter = createEvent(this, "qdsChange", 6);
|
|
20
|
-
this.focusEmitter = createEvent(this, "qdsFocus", 2);
|
|
21
|
-
this.inheritedAttributes = {};
|
|
22
|
-
this.ref = (checkbox) => {
|
|
23
|
-
this.input = checkbox;
|
|
24
|
-
};
|
|
25
|
-
this.onBlur = (event) => {
|
|
26
|
-
this.blurEmitter.emit(pickFocusEventAttributes(event));
|
|
27
|
-
};
|
|
28
|
-
this.onFocus = (event) => {
|
|
29
|
-
this.focusEmitter.emit(pickFocusEventAttributes(event));
|
|
30
|
-
};
|
|
31
|
-
this.inline = false;
|
|
32
|
-
this.size = 'standard';
|
|
33
|
-
this.text = undefined;
|
|
34
|
-
this.autoFocus = undefined;
|
|
35
|
-
this.checked = undefined;
|
|
36
|
-
this.disabled = undefined;
|
|
37
|
-
this.form = undefined;
|
|
38
|
-
this.indeterminate = undefined;
|
|
39
|
-
this.name = `qds-checkbox-${autoIncrementingId}`;
|
|
40
|
-
this.required = undefined;
|
|
41
|
-
this.value = undefined;
|
|
42
|
-
}
|
|
43
|
-
get computedDisabled() {
|
|
44
|
-
return this.disabled ?? false;
|
|
45
|
-
}
|
|
46
|
-
get computedIndeterminate() {
|
|
47
|
-
return this.indeterminate ?? false;
|
|
48
|
-
}
|
|
49
|
-
get hasText() {
|
|
50
|
-
return ((this.text !== undefined && this.text !== '') || this.required === true);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Returns whether a form will validate this checkbox when it is submitted
|
|
54
|
-
* without having to submit it.
|
|
55
|
-
*/
|
|
56
|
-
async checkValidity() {
|
|
57
|
-
invariant(this.input);
|
|
58
|
-
return this.input.checkValidity();
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Returns true if the checkbox's value passes validity checks; otherwise,
|
|
62
|
-
* returns false, and (if the event isn't canceled) reports the problem to
|
|
63
|
-
* the user.
|
|
64
|
-
*/
|
|
65
|
-
async reportValidity() {
|
|
66
|
-
invariant(this.input);
|
|
67
|
-
return this.input.reportValidity();
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Sets a custom validity message for the checkbox. If this message is not the
|
|
71
|
-
* empty string, then the checkbox is considered invalid.
|
|
72
|
-
*/
|
|
73
|
-
async setCustomValidity(message) {
|
|
74
|
-
invariant(this.input);
|
|
75
|
-
this.input.setCustomValidity(message);
|
|
76
|
-
}
|
|
77
|
-
onClick(event) {
|
|
78
|
-
if (this.computedDisabled)
|
|
79
|
-
return;
|
|
80
|
-
event.preventDefault();
|
|
81
|
-
this.checked = this.computedIndeterminate ? true : !(this.checked ?? false);
|
|
82
|
-
this.changeEmitter.emit();
|
|
83
|
-
this.indeterminate = false;
|
|
84
|
-
}
|
|
85
|
-
componentWillLoad() {
|
|
86
|
-
autoIncrementingId += 1;
|
|
87
|
-
this.inheritedAttributes = {
|
|
88
|
-
...inheritAriaAttributes(this.element),
|
|
89
|
-
...inheritAttributes(this.element, ['tabindex']),
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
render() {
|
|
93
|
-
return (
|
|
94
|
-
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
95
|
-
h("label", { "aria-disabled": this.computedDisabled ? 'true' : 'false', class: {
|
|
96
|
-
inline: this.inline,
|
|
97
|
-
label: true,
|
|
98
|
-
}, "data-size": this.size }, h("input", {
|
|
99
|
-
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
100
|
-
autoFocus: this.autoFocus, checked: this.computedIndeterminate ? false : this.checked, class: "checkbox", "data-size": this.size, disabled: this.disabled, form: this.form, indeterminate: this.indeterminate, name: this.name, onBlur: this.onBlur, onFocus: this.onFocus, ref: this.ref, required: this.required, type: "checkbox", value: this.value ?? undefined, ...this.inheritedAttributes
|
|
101
|
-
}), h("qds-icon", { "aria-hidden": "true", class: {
|
|
102
|
-
icon: true,
|
|
103
|
-
checked: true,
|
|
104
|
-
}, "data-size": this.size, library: "core", name: "checked" }), h("qds-icon", { "aria-hidden": "true", class: {
|
|
105
|
-
icon: true,
|
|
106
|
-
indeterminate: true,
|
|
107
|
-
}, "data-size": this.size, library: "core", name: "indeterminate" }), this.hasText && (h("qds-label", { required: this.required, size: this.size, text: this.text }))));
|
|
108
|
-
}
|
|
109
|
-
get element() { return this; }
|
|
110
|
-
static get style() { return checkboxCss; }
|
|
111
|
-
}, [2, "qds-checkbox", {
|
|
112
|
-
"inline": [4],
|
|
113
|
-
"size": [513],
|
|
114
|
-
"text": [1537],
|
|
115
|
-
"autoFocus": [4, "autofocus"],
|
|
116
|
-
"checked": [1540],
|
|
117
|
-
"disabled": [1540],
|
|
118
|
-
"form": [1],
|
|
119
|
-
"indeterminate": [1540],
|
|
120
|
-
"name": [1],
|
|
121
|
-
"required": [4],
|
|
122
|
-
"value": [1032],
|
|
123
|
-
"checkValidity": [64],
|
|
124
|
-
"reportValidity": [64],
|
|
125
|
-
"setCustomValidity": [64]
|
|
126
|
-
}, [[0, "click", "onClick"]]]);
|
|
127
|
-
function defineCustomElement$1() {
|
|
128
|
-
if (typeof customElements === "undefined") {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
const components = ["qds-checkbox", "qds-icon", "qds-label"];
|
|
132
|
-
components.forEach(tagName => { switch (tagName) {
|
|
133
|
-
case "qds-checkbox":
|
|
134
|
-
if (!customElements.get(tagName)) {
|
|
135
|
-
customElements.define(tagName, Checkbox);
|
|
136
|
-
}
|
|
137
|
-
break;
|
|
138
|
-
case "qds-icon":
|
|
139
|
-
if (!customElements.get(tagName)) {
|
|
140
|
-
defineCustomElement$3();
|
|
141
|
-
}
|
|
142
|
-
break;
|
|
143
|
-
case "qds-label":
|
|
144
|
-
if (!customElements.get(tagName)) {
|
|
145
|
-
defineCustomElement$2();
|
|
146
|
-
}
|
|
147
|
-
break;
|
|
148
|
-
} });
|
|
149
|
-
}
|
|
6
|
+
import { C as Checkbox, d as defineCustomElement$1 } from './p-f85b490c.js';
|
|
150
7
|
|
|
151
8
|
const QdsCheckbox = Checkbox;
|
|
152
9
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"qds-checkbox.js","mappings":";;;;;;;;;;AAAA,MAAM,WAAW,GAAG,+lGAA+lG;;AC0BnnG,IAAI,kBAAkB,GAAG,CAAC,CAAA;MAcb,QAAQ;;;;;;;IAmHX,wBAAmB,GAAe,EAAE,CAAA;IAoI3B,QAAG,GAAG,CAAC,QAA2B;MACjD,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAA;KACtB,CAAA;IAEgB,WAAM,GAAG,CAAC,KAAiB;MAC1C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;KACvD,CAAA;IAEgB,YAAO,GAAG,CA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OAAO,EAAC,MAAM,EACd,IAAI,EAAC,eAAe,GACpB,EACD,IAAI,CAAC,OAAO,KACX,iBACE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,GACf,CACH,CACK,EACT;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/checkbox/checkbox.css?tag=qds-checkbox&encapsulation=scoped","src/components/checkbox/checkbox.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 line-height: 0;\n}\n\n.icon {\n display: none;\n color: var(--qds-theme-signature-color-contrast);\n inset-inline-start: 0;\n pointer-events: none;\n position: absolute;\n}\n\n.label {\n cursor: pointer;\n display: inline-flex;\n position: relative;\n}\n\n.checkbox {\n align-items: center;\n appearance: none;\n background-color: var(--qds-theme-control-input-background);\n border-radius: var(--qds-control-border-radius);\n border: var(--qds-control-border-width) solid var(--qds-theme-control-border);\n cursor: pointer;\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n margin: 0;\n print-color-adjust: exact;\n\n &:focus-visible {\n outline: var(--qds-theme-focus-border) solid var(--qds-focus-border-width);\n outline-offset: var(--qds-focus-border-offset);\n }\n\n &::before {\n content: '';\n height: 10px;\n position: absolute;\n width: 10px;\n }\n\n &:hover::before {\n box-shadow: inset 1em 1em var(--qds-theme-signature-color-hover);\n }\n\n &:active::before {\n box-shadow: inset 1em 1em var(--qds-theme-signature-color-pressed);\n }\n\n &:checked ~ .checked,\n &:indeterminate ~ .indeterminate {\n display: inline-block;\n }\n\n &:checked,\n &:indeterminate {\n background-color: var(--qds-theme-signature-color-default);\n border-color: transparent;\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[aria-disabled='true'] {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\n}\n\n[data-size='small'] {\n &:is(.icon, .checkbox) {\n width: var(--qds-control-small-icon-size);\n height: 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\n[data-size='standard'] {\n &:is(.icon, .checkbox) {\n width: var(--qds-control-standard-icon-size);\n height: 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\n[data-size='large'] {\n &:is(.icon, .checkbox) {\n width: var(--qds-control-large-icon-size);\n height: 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","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport {\n Component,\n Element,\n Event,\n h,\n Listen,\n Method,\n Prop,\n} from '@stencil/core'\n\nimport type { Attributes, QdsFocusEventDetail } from '../../helpers'\nimport {\n inheritAriaAttributes,\n inheritAttributes,\n invariant,\n pickFocusEventAttributes,\n} from '../../helpers'\n\nexport type CheckboxValue = number | string | null\nexport type CheckboxSize = 'large' | 'small' | 'standard'\n\nlet autoIncrementingId = 1\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 scoped: 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({ reflect: true }) public readonly size: CheckboxSize = 'standard'\n\n /**\n * The checkbox's text.\n */\n @Prop({ mutable: true, reflect: true }) public readonly text?: string\n\n /**\n * Specify whether the checkbox should have focus when the page loads.\n *\n * @webnative\n */\n @Prop({ attribute: 'autofocus' }) public readonly autoFocus?: boolean\n\n /**\n * Sets the checkbox's state.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: 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({ 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 checkbox 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-checkbox>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This property 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 * @webnative\n */\n @Prop() public readonly form?: string\n\n /**\n * Sets the checkbox to an indeterminate state. This is usually applied to\n * checkboxes that represents 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, reflect: true }) public indeterminate?: boolean\n\n /**\n * The name of the checkbox, 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-checkbox-${autoIncrementingId}`\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 value of the checkbox, submitted as a name/value pair with form data.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public value?: CheckboxValue\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 element!: HTMLQdsCheckboxElement\n\n private inheritedAttributes: Attributes = {}\n\n private input?: HTMLInputElement\n\n private get computedDisabled(): boolean {\n return this.disabled ?? false\n }\n\n private get computedIndeterminate(): boolean {\n return this.indeterminate ?? false\n }\n\n private get hasText(): boolean {\n return (\n (this.text !== undefined && this.text !== '') || this.required === true\n )\n }\n\n /**\n * Returns whether a form will validate this checkbox when it is submitted\n * without having to submit it.\n */\n @Method()\n public async checkValidity(): Promise<boolean> {\n invariant(this.input)\n\n return this.input.checkValidity()\n }\n\n /**\n * Returns true if the checkbox's value passes validity checks; otherwise,\n * returns false, and (if the event isn't canceled) reports the problem to\n * the user.\n */\n @Method()\n public async reportValidity(): Promise<boolean> {\n invariant(this.input)\n\n return this.input.reportValidity()\n }\n\n /**\n * Sets a custom validity message for the checkbox. If this message is not the\n * empty string, then the checkbox is considered invalid.\n */\n @Method()\n public async setCustomValidity(message: string): Promise<void> {\n invariant(this.input)\n\n this.input.setCustomValidity(message)\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.computedIndeterminate ? true : !(this.checked ?? false)\n this.changeEmitter.emit()\n this.indeterminate = false\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 <input\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.autoFocus}\n checked={this.computedIndeterminate ? false : this.checked}\n class=\"checkbox\"\n data-size={this.size}\n disabled={this.disabled}\n form={this.form}\n indeterminate={this.indeterminate}\n name={this.name}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n ref={this.ref}\n required={this.required}\n type=\"checkbox\"\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={{\n icon: true,\n checked: true,\n }}\n data-size={this.size}\n library=\"core\"\n name=\"checked\"\n />\n <qds-icon\n aria-hidden=\"true\"\n class={{\n icon: true,\n indeterminate: true,\n }}\n data-size={this.size}\n library=\"core\"\n name=\"indeterminate\"\n />\n {this.hasText && (\n <qds-label\n required={this.required}\n size={this.size}\n text={this.text}\n />\n )}\n </label>\n )\n }\n\n private readonly ref = (checkbox?: HTMLInputElement): void => {\n this.input = checkbox\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-checkbox.js","mappings":";;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../dist/types/components";
|
|
2
|
+
|
|
3
|
+
interface QdsChip extends Components.QdsChip, HTMLElement {}
|
|
4
|
+
export const QdsChip: {
|
|
5
|
+
prototype: QdsChip;
|
|
6
|
+
new (): QdsChip;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,271 @@
|
|
|
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-7b04d43e.js';
|
|
7
|
+
import { p as pickFocusEventAttributes, i as inheritAriaAttributes, b as invariant, c as isOverflowing } from './p-4141d6ed.js';
|
|
8
|
+
import { d as defineCustomElement$3 } from './p-82461767.js';
|
|
9
|
+
import { d as defineCustomElement$2 } from './p-f5ba28ff.js';
|
|
10
|
+
|
|
11
|
+
const chipCss = ":host([hidden]){display:none!important}:host{display:inline-block;line-height:0}[aria-disabled=true]{opacity:var(--qds-theme-disabled);pointer-events:none}.qds-text{line-height:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.qds-chip,.qds-container,.qds-label{width:inherit}.qds-target{-webkit-appearance:none;appearance:none;background-color:initial;border:none;color:inherit;cursor:pointer;display:flex;outline:none;padding:0;pointer-events:auto}.qds-target:disabled{pointer-events:none}.qds-alignment{align-items:center;display:flex}.qds-cursor{cursor:pointer}.qds-icon{flex-shrink:0}.qds-closable-chip,.qds-container{align-items:center;-webkit-appearance:none;appearance:none;background-color:initial;border:var(--qds-control-border-width) solid var(--qds-theme-control-border);border-radius:var(--qds-control-rounded-border-radius);box-sizing:border-box;color:var(--qds-theme-control-text-standard);display:inline-flex;justify-content:center;padding-block:0;-webkit-user-select:none;user-select:none}.qds-closable-chip{pointer-events:none}.qds-closable-chip:focus-within{outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset)}.qds-container:hover{background-color:var(--qds-theme-interactive-background-hover)}.qds-checkbox:active~.qds-container,.qds-closable-chip:has(.qds-target:active),.qds-container.qds-pressed-state{background-color:var(--qds-theme-interactive-background-pressed)}.qds-checkbox{clip-path:inset(50%);margin:0;position:absolute}.qds-checkbox:focus-visible~.qds-container{outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset)}.qds-closable-chip[data-size=small],.qds-container[data-size=small]{gap:var(--qds-control-small-gap-internal);height:var(--qds-control-small-height);padding-inline:var(--qds-control-chip-small-padding-horizontal)}.qds-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-text[data-size=small]{font:var(--qds-control-small-text)}.qds-closable-chip[data-size=standard],.qds-container[data-size=standard]{gap:var(--qds-control-standard-gap-internal);height:var(--qds-control-standard-height);padding-inline:var(--qds-control-chip-standard-padding-horizontal)}.qds-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-text[data-size=standard]{font:var(--qds-control-standard-text)}.qds-closable-chip[data-size=large],.qds-container[data-size=large]{gap:var(--qds-control-large-gap-internal);height:var(--qds-control-large-height);padding-inline:var(--qds-control-chip-large-padding-horizontal)}.qds-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-text[data-size=large]{font:var(--qds-control-large-text)}";
|
|
12
|
+
const QdsChipStyle0 = chipCss;
|
|
13
|
+
|
|
14
|
+
// SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
15
|
+
//
|
|
16
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
17
|
+
var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
18
|
+
if (kind === "a" && !f)
|
|
19
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
20
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
21
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
22
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
23
|
+
};
|
|
24
|
+
var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
25
|
+
if (kind === "m")
|
|
26
|
+
throw new TypeError("Private method is not writable");
|
|
27
|
+
if (kind === "a" && !f)
|
|
28
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
29
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
30
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
31
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
32
|
+
};
|
|
33
|
+
var _Chip_instances, _Chip_chip, _Chip_span, _Chip_ro, _Chip_inheritedAttributes, _Chip_ariaLabel_get, _Chip_computedDisabled_get, _Chip_computedSize_get, _Chip_computedType_get, _Chip_computedChecked_get, _Chip_computedValue_get, _Chip_onIconClick, _Chip_onFocus, _Chip_onBlur, _Chip_chipRef, _Chip_spanRef, _Chip_tooltipRef;
|
|
34
|
+
const Chip = /*@__PURE__*/ proxyCustomElement(class Chip extends H {
|
|
35
|
+
constructor() {
|
|
36
|
+
super();
|
|
37
|
+
this.__registerHost();
|
|
38
|
+
this.__attachShadow();
|
|
39
|
+
this.blurEmitter = createEvent(this, "qdsBlur", 2);
|
|
40
|
+
this.focusEmitter = createEvent(this, "qdsFocus", 2);
|
|
41
|
+
this.closeEmitter = createEvent(this, "qdsClose", 6);
|
|
42
|
+
this.changeEmitter = createEvent(this, "qdsChange", 6);
|
|
43
|
+
this.internals = this.attachInternals();
|
|
44
|
+
_Chip_instances.add(this);
|
|
45
|
+
_Chip_chip.set(this, void 0);
|
|
46
|
+
_Chip_span.set(this, void 0);
|
|
47
|
+
_Chip_ro.set(this, void 0);
|
|
48
|
+
_Chip_inheritedAttributes.set(this, {});
|
|
49
|
+
_Chip_onIconClick.set(this, (event) => {
|
|
50
|
+
if (!event.defaultPrevented && __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedType_get) === 'closable')
|
|
51
|
+
this.closeEmitter.emit();
|
|
52
|
+
});
|
|
53
|
+
_Chip_onFocus.set(this, (event) => {
|
|
54
|
+
this.focusEmitter.emit(pickFocusEventAttributes(event));
|
|
55
|
+
});
|
|
56
|
+
_Chip_onBlur.set(this, (event) => {
|
|
57
|
+
this.blurEmitter.emit(pickFocusEventAttributes(event));
|
|
58
|
+
});
|
|
59
|
+
_Chip_chipRef.set(this, (chip) => {
|
|
60
|
+
__classPrivateFieldSet(this, _Chip_chip, chip, "f");
|
|
61
|
+
});
|
|
62
|
+
_Chip_spanRef.set(this, (span) => {
|
|
63
|
+
__classPrivateFieldSet(this, _Chip_span, span, "f");
|
|
64
|
+
});
|
|
65
|
+
_Chip_tooltipRef.set(this, (tooltip) => {
|
|
66
|
+
if (tooltip)
|
|
67
|
+
// eslint-disable-next-line no-param-reassign
|
|
68
|
+
tooltip.target = __classPrivateFieldGet(this, _Chip_chip, "f");
|
|
69
|
+
});
|
|
70
|
+
this.iconName = undefined;
|
|
71
|
+
this.iconLibrary = 'default';
|
|
72
|
+
this.size = 'standard';
|
|
73
|
+
this.type = 'selectable';
|
|
74
|
+
this.text = undefined;
|
|
75
|
+
this.checked = undefined;
|
|
76
|
+
this.form = null;
|
|
77
|
+
this.disabled = undefined;
|
|
78
|
+
this.name = undefined;
|
|
79
|
+
this.autoFocus = undefined;
|
|
80
|
+
this.value = 'on';
|
|
81
|
+
this.isPressed = false;
|
|
82
|
+
this.tabIndex = undefined;
|
|
83
|
+
this.tooltip = false;
|
|
84
|
+
}
|
|
85
|
+
onClick(event) {
|
|
86
|
+
if (__classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedDisabled_get)) {
|
|
87
|
+
event.stopImmediatePropagation();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
if (__classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedType_get) === 'selectable') {
|
|
92
|
+
this.checked = !__classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedChecked_get);
|
|
93
|
+
this.changeEmitter.emit();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
handleKeyDown(event) {
|
|
97
|
+
if (__classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedDisabled_get)) {
|
|
98
|
+
event.stopImmediatePropagation();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (event.key === ' ') {
|
|
102
|
+
this.isPressed = true;
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
}
|
|
105
|
+
else if (event.key === 'Enter' && this.internals.form) {
|
|
106
|
+
this.internals.form.requestSubmit();
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
handleKeyUp(event) {
|
|
111
|
+
if (event.key !== ' ')
|
|
112
|
+
return;
|
|
113
|
+
this.isPressed = false;
|
|
114
|
+
if (__classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedType_get) === 'closable')
|
|
115
|
+
this.closeEmitter.emit();
|
|
116
|
+
else {
|
|
117
|
+
this.checked = !__classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedChecked_get);
|
|
118
|
+
this.changeEmitter.emit();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
checkedChanged() {
|
|
122
|
+
this.internals.setFormValue(__classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedChecked_get) && !__classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedDisabled_get)
|
|
123
|
+
? __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedValue_get)
|
|
124
|
+
: // eslint-disable-next-line unicorn/no-null
|
|
125
|
+
null);
|
|
126
|
+
}
|
|
127
|
+
disabledChanged() {
|
|
128
|
+
if (__classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedChecked_get) && !__classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedDisabled_get))
|
|
129
|
+
this.internals.setFormValue(__classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedValue_get));
|
|
130
|
+
// eslint-disable-next-line unicorn/no-null
|
|
131
|
+
else
|
|
132
|
+
this.internals.setFormValue(null);
|
|
133
|
+
}
|
|
134
|
+
tabindexChanged(newValue) {
|
|
135
|
+
const parsedValue = Number.parseInt(newValue, 10);
|
|
136
|
+
this.tabIndex =
|
|
137
|
+
parsedValue === 0 || Number.isNaN(parsedValue) ? undefined : parsedValue;
|
|
138
|
+
}
|
|
139
|
+
valueChanged() {
|
|
140
|
+
if (__classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedChecked_get) && !__classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedDisabled_get))
|
|
141
|
+
this.internals.setFormValue(__classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedValue_get));
|
|
142
|
+
}
|
|
143
|
+
componentWillLoad() {
|
|
144
|
+
this.valueChanged();
|
|
145
|
+
Object.defineProperty(this.host, 'form', {
|
|
146
|
+
enumerable: true,
|
|
147
|
+
get: () => this.internals.form,
|
|
148
|
+
});
|
|
149
|
+
__classPrivateFieldSet(this, _Chip_inheritedAttributes, inheritAriaAttributes(this.host), "f");
|
|
150
|
+
this.tabindexChanged(this.host.getAttribute('tabindex') ?? '0');
|
|
151
|
+
}
|
|
152
|
+
componentDidLoad() {
|
|
153
|
+
invariant(__classPrivateFieldGet(this, _Chip_span, "f"));
|
|
154
|
+
this.tooltip = isOverflowing(__classPrivateFieldGet(this, _Chip_span, "f"));
|
|
155
|
+
__classPrivateFieldSet(this, _Chip_ro, new ResizeObserver(([spanEntry]) => {
|
|
156
|
+
this.tooltip = isOverflowing(spanEntry.target);
|
|
157
|
+
}), "f");
|
|
158
|
+
__classPrivateFieldGet(this, _Chip_ro, "f").observe(__classPrivateFieldGet(this, _Chip_span, "f"));
|
|
159
|
+
}
|
|
160
|
+
disconnectedCallback() {
|
|
161
|
+
if (__classPrivateFieldGet(this, _Chip_ro, "f"))
|
|
162
|
+
__classPrivateFieldGet(this, _Chip_ro, "f").disconnect();
|
|
163
|
+
}
|
|
164
|
+
render() {
|
|
165
|
+
return (h("div", { key: '36bff2d84c6aeb06723dc30e1a73a076a52977fc', class: "qds-chip", ref: __classPrivateFieldGet(this, _Chip_chipRef, "f") }, __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedType_get) === 'closable' && (h("div", { key: 'de70281e480160344cbdbf68ed160bbd48f96c72', "aria-disabled": __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedDisabled_get) ? 'true' : undefined, class: {
|
|
166
|
+
'qds-container': true,
|
|
167
|
+
'qds-closable-chip': true,
|
|
168
|
+
'qds-pressed-state': this.isPressed,
|
|
169
|
+
}, "data-size": __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedSize_get) }, this.iconName !== undefined && this.iconName !== '' && (h("qds-icon", { key: 'fe5034ee25491fbc2c4559ee30b99c28892752cb', "aria-hidden": "true", class: "qds-icon", "data-size": __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedSize_get), library: this.iconLibrary, name: this.iconName })), h("span", { key: '52817dbe0485d35bbc1deac180ad7838ab6b96a9', class: "qds-text", "data-size": __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedSize_get), ref: __classPrivateFieldGet(this, _Chip_spanRef, "f") }, this.text), h("button", { key: '4b98b907e796a956f376de928525a5ecfe4b81a6', "aria-label": __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_ariaLabel_get), class: "qds-target", "data-size": __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedSize_get), disabled: __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedDisabled_get), onClick: __classPrivateFieldGet(this, _Chip_onIconClick, "f"), tabIndex: __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedDisabled_get) ? undefined : this.tabIndex, type: "button", ...__classPrivateFieldGet(this, _Chip_inheritedAttributes, "f") }, h("qds-icon", { key: '7278efa67ca1e5a4986ab35502607bd39007bc34', "aria-hidden": "true", class: "qds-icon", "data-size": __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedSize_get), library: "core", name: "close" })))), __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedType_get) === 'selectable' && (
|
|
170
|
+
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
171
|
+
h("label", { key: 'e4caf1fc6a0cc37e608872d97b79362d9f768e39', "aria-disabled": __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedDisabled_get) ? 'true' : undefined, class: "qds-label" }, h("input", { key: 'a831e5c0925a926a2328b896db2c8d64b79c6def',
|
|
172
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
173
|
+
autoFocus: this.autoFocus, checked: this.checked, class: "qds-checkbox", "data-size": __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedSize_get), disabled: __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedDisabled_get), name: this.name, onBlur: __classPrivateFieldGet(this, _Chip_onBlur, "f"), onFocus: __classPrivateFieldGet(this, _Chip_onFocus, "f"), tabIndex: __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedDisabled_get) ? undefined : this.tabIndex, type: "checkbox", value: this.value ?? undefined, ...__classPrivateFieldGet(this, _Chip_inheritedAttributes, "f") }), h("div", { key: '5bdda2f36b950df4a641e04027f9abd494697fbc', class: {
|
|
174
|
+
'qds-container': true,
|
|
175
|
+
'qds-pressed-state': this.isPressed,
|
|
176
|
+
'qds-padding-end': true,
|
|
177
|
+
'qds-cursor': true,
|
|
178
|
+
}, "data-size": __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedSize_get) }, this.iconName !== undefined && this.iconName !== '' && (h("qds-icon", { key: 'ecfcfdf0f0f14c54bed742bf661c96e42e68921d', "aria-hidden": "true", class: "qds-icon", "data-size": __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedSize_get), library: this.iconLibrary, name: this.iconName })), h("span", { key: '28ec8f7e9b576cd095794a8d9e9d59bc20cab5a3', class: "qds-text", "data-size": __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedSize_get), ref: __classPrivateFieldGet(this, _Chip_spanRef, "f") }, this.text), (this.checked ?? false) && (h("qds-icon", { key: '6c201c01a488eb74ed3ed208f158f9c3901e0c55', "aria-hidden": "true", class: "qds-icon", "data-size": __classPrivateFieldGet(this, _Chip_instances, "a", _Chip_computedSize_get), library: "core", name: "checked" }))))), this.tooltip && (h("qds-tooltip", { key: '9bac5d85e452cfade627116476f3713239741fd2', ref: __classPrivateFieldGet(this, _Chip_tooltipRef, "f"), trigger: "pointerenter focusin" }, this.text))));
|
|
179
|
+
}
|
|
180
|
+
static get delegatesFocus() { return true; }
|
|
181
|
+
static get formAssociated() { return true; }
|
|
182
|
+
get host() { return this; }
|
|
183
|
+
static get watchers() { return {
|
|
184
|
+
"checked": ["checkedChanged"],
|
|
185
|
+
"disabled": ["disabledChanged"],
|
|
186
|
+
"tabindex": ["tabindexChanged"],
|
|
187
|
+
"value": ["valueChanged"]
|
|
188
|
+
}; }
|
|
189
|
+
static get style() { return QdsChipStyle0; }
|
|
190
|
+
}, [81, "qds-chip", {
|
|
191
|
+
"iconName": [1, "icon-name"],
|
|
192
|
+
"iconLibrary": [1, "icon-library"],
|
|
193
|
+
"size": [1],
|
|
194
|
+
"type": [1],
|
|
195
|
+
"text": [1],
|
|
196
|
+
"checked": [1028],
|
|
197
|
+
"form": [1],
|
|
198
|
+
"disabled": [4],
|
|
199
|
+
"name": [1],
|
|
200
|
+
"autoFocus": [4, "autofocus"],
|
|
201
|
+
"value": [8],
|
|
202
|
+
"isPressed": [32],
|
|
203
|
+
"tabIndex": [32],
|
|
204
|
+
"tooltip": [32]
|
|
205
|
+
}, [[0, "click", "onClick"], [0, "keydown", "handleKeyDown"], [0, "keyup", "handleKeyUp"]], {
|
|
206
|
+
"checked": ["checkedChanged"],
|
|
207
|
+
"disabled": ["disabledChanged"],
|
|
208
|
+
"tabindex": ["tabindexChanged"],
|
|
209
|
+
"value": ["valueChanged"]
|
|
210
|
+
}]);
|
|
211
|
+
_Chip_chip = new WeakMap(), _Chip_span = new WeakMap(), _Chip_ro = new WeakMap(), _Chip_inheritedAttributes = new WeakMap(), _Chip_onIconClick = new WeakMap(), _Chip_onFocus = new WeakMap(), _Chip_onBlur = new WeakMap(), _Chip_chipRef = new WeakMap(), _Chip_spanRef = new WeakMap(), _Chip_tooltipRef = new WeakMap(), _Chip_instances = new WeakSet(), _Chip_ariaLabel_get = function _Chip_ariaLabel_get() {
|
|
212
|
+
return `Delete ${this.text} selection`;
|
|
213
|
+
}, _Chip_computedDisabled_get = function _Chip_computedDisabled_get() {
|
|
214
|
+
return this.disabled ?? false;
|
|
215
|
+
}, _Chip_computedSize_get = function _Chip_computedSize_get() {
|
|
216
|
+
switch (this.size) {
|
|
217
|
+
case 'standard':
|
|
218
|
+
case 'small':
|
|
219
|
+
case 'large': {
|
|
220
|
+
return this.size;
|
|
221
|
+
}
|
|
222
|
+
default: {
|
|
223
|
+
return 'standard';
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}, _Chip_computedType_get = function _Chip_computedType_get() {
|
|
227
|
+
switch (this.type) {
|
|
228
|
+
case 'selectable':
|
|
229
|
+
case 'closable': {
|
|
230
|
+
return this.type;
|
|
231
|
+
}
|
|
232
|
+
default: {
|
|
233
|
+
return 'selectable';
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}, _Chip_computedChecked_get = function _Chip_computedChecked_get() {
|
|
237
|
+
return this.checked ?? false;
|
|
238
|
+
}, _Chip_computedValue_get = function _Chip_computedValue_get() {
|
|
239
|
+
// eslint-disable-next-line unicorn/no-null
|
|
240
|
+
return this.value == null ? null : this.value.toString();
|
|
241
|
+
};
|
|
242
|
+
function defineCustomElement$1() {
|
|
243
|
+
if (typeof customElements === "undefined") {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const components = ["qds-chip", "qds-icon", "qds-tooltip"];
|
|
247
|
+
components.forEach(tagName => { switch (tagName) {
|
|
248
|
+
case "qds-chip":
|
|
249
|
+
if (!customElements.get(tagName)) {
|
|
250
|
+
customElements.define(tagName, Chip);
|
|
251
|
+
}
|
|
252
|
+
break;
|
|
253
|
+
case "qds-icon":
|
|
254
|
+
if (!customElements.get(tagName)) {
|
|
255
|
+
defineCustomElement$3();
|
|
256
|
+
}
|
|
257
|
+
break;
|
|
258
|
+
case "qds-tooltip":
|
|
259
|
+
if (!customElements.get(tagName)) {
|
|
260
|
+
defineCustomElement$2();
|
|
261
|
+
}
|
|
262
|
+
break;
|
|
263
|
+
} });
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const QdsChip = Chip;
|
|
267
|
+
const defineCustomElement = defineCustomElement$1;
|
|
268
|
+
|
|
269
|
+
export { QdsChip, defineCustomElement };
|
|
270
|
+
|
|
271
|
+
//# sourceMappingURL=qds-chip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"qds-chip.js","mappings":";;;;;;;;;;AAAA,MAAM,OAAO,GAAG,sjGAAsjG,CAAC;AACvkG,sBAAe,OAAO;;ACDtB;AACA;AACA;;;;;;;;;;;;;;;;;;MAwCa,IAAI;;;;;;;;;;;QAkHf,6BAAsB;QAEtB,6BAAuB;QAEvB,2BAAoB;QAEpB,oCAAmC,EAAE,EAAA;QAsQ5B,4BAAe,CAAC,KAAiB;YACxC,IAAI,CAAC,KAAK,CAAC,gBAAgB,IAAI,uBAAA,IAAI,+CAAc,KAAK,UAAU;gBAC9D,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;SAC3B,EAAA;QAEQ,wBAAW,CAAC,KAAiB;YACpC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;SACxD,EAAA;QAEQ,uBAAU,CAAC,KAAiB;YACnC,IAAI,CAAC,WAAW,CAAC,IA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;AACH,CAAC;IAGC,QAAQ,IAAI,CAAC,IAAI;QACf,KAAK,YAAY,CAAC;QAClB,KAAK,UAAU,EAAE;YACf,OAAO,IAAI,CAAC,IAAI,CAAA;SACjB;QACD,SAAS;YACP,OAAO,YAAY,CAAA;SACpB;KACF;AACH,CAAC;IAGC,OAAO,IAAI,CAAC,OAAO,IAAI,KAAK,CAAA;AAC9B,CAAC;;IAIC,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAA;AAC1D,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/chip/chip.css?tag=qds-chip&encapsulation=shadow","src/components/chip/chip.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[aria-disabled='true'] {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\n}\n\n.qds-text {\n line-height: normal;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.qds-chip,\n.qds-container,\n.qds-label {\n width: inherit;\n}\n\n.qds-target {\n appearance: none;\n display: flex;\n border: none;\n padding: 0;\n background-color: transparent;\n color: inherit;\n cursor: pointer;\n pointer-events: auto;\n outline: none;\n\n &:disabled {\n pointer-events: none;\n }\n}\n\n.qds-alignment {\n display: flex;\n align-items: center;\n}\n\n.qds-cursor {\n cursor: pointer;\n}\n\n.qds-icon {\n flex-shrink: 0;\n}\n\n.qds-closable-chip,\n.qds-container {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding-block: 0;\n user-select: none;\n border: var(--qds-control-border-width) solid var(--qds-theme-control-border);\n border-radius: var(--qds-control-rounded-border-radius);\n color: var(--qds-theme-control-text-standard);\n background-color: initial;\n appearance: none;\n box-sizing: border-box;\n}\n\n.qds-closable-chip {\n pointer-events: none;\n\n &:focus-within {\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.qds-container:hover {\n background-color: var(--qds-theme-interactive-background-hover);\n}\n\n.qds-checkbox:active ~ .qds-container,\n.qds-closable-chip:has(.qds-target:active),\n.qds-container.qds-pressed-state {\n background-color: var(--qds-theme-interactive-background-pressed);\n}\n\n.qds-checkbox {\n clip-path: inset(50%);\n margin: 0;\n position: absolute;\n\n &:focus-visible ~ .qds-container {\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[data-size='small'] {\n &.qds-closable-chip,\n &.qds-container {\n height: var(--qds-control-small-height);\n padding-inline: var(--qds-control-chip-small-padding-horizontal);\n gap: var(--qds-control-small-gap-internal);\n }\n\n &.qds-icon {\n --qds-experimental-icon-click-target-size: var(--qds-control-small-height);\n\n height: var(--qds-control-small-icon-size);\n width: var(--qds-control-small-icon-size);\n }\n\n &.qds-text {\n font: var(--qds-control-small-text);\n }\n}\n\n[data-size='standard'] {\n &.qds-closable-chip,\n &.qds-container {\n height: var(--qds-control-standard-height);\n padding-inline: var(--qds-control-chip-standard-padding-horizontal);\n gap: var(--qds-control-standard-gap-internal);\n }\n\n &.qds-icon {\n --qds-experimental-icon-click-target-size: var(\n --qds-control-standard-height\n );\n\n height: var(--qds-control-standard-icon-size);\n width: var(--qds-control-standard-icon-size);\n }\n\n &.qds-text {\n font: var(--qds-control-standard-text);\n }\n}\n\n[data-size='large'] {\n &.qds-closable-chip,\n &.qds-container {\n height: var(--qds-control-large-height);\n padding-inline: var(--qds-control-chip-large-padding-horizontal);\n gap: var(--qds-control-large-gap-internal);\n }\n\n &.qds-icon {\n --qds-experimental-icon-click-target-size: var(--qds-control-large-height);\n\n height: var(--qds-control-large-icon-size);\n width: var(--qds-control-large-icon-size);\n }\n\n &.qds-text {\n font: var(--qds-control-large-text);\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 {\n inheritAriaAttributes,\n invariant,\n isOverflowing,\n pickFocusEventAttributes,\n} from '../../helpers'\nimport type { Value } from '../controls'\nimport type { Size } from '../shared'\n\nexport type ChipType = 'closable' | 'selectable'\n\n/**\n * `<qds-chip>` elements are interactive elements that represent selections.\n * Chips allow users to make a selection from a list of options or display\n * items like filters or tags.\n *\n * @see https://quartz.se.com/build/components/chip\n */\n@Component({\n tag: 'qds-chip',\n formAssociated: true,\n shadow: { delegatesFocus: true },\n styleUrl: 'chip.css',\n})\nexport class Chip implements ComponentInterface {\n /**\n * The name of the icon to render.\n *\n * Available names depend on the icon library being used.\n */\n @Prop() 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 * The chip's size.\n */\n @Prop() public readonly size?: Size = 'standard'\n\n /**\n * The chip's type.\n */\n @Prop() public readonly type?: ChipType = 'selectable'\n\n /**\n * The chip's text.\n */\n @Prop() public readonly text?: string\n\n /**\n * Sets the selectable chip's state.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public checked?: boolean\n\n /**\n * The [`<form>`](https://developer.mozilla.org/docs/Web/HTML/Element/form)\n * element to associate the chip 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-chip>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This property lets you associate `<qds-chip>` 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 * Prevents the chip from being interacted with: it cannot be pressed or\n * focused.\n *\n */\n @Prop() public readonly disabled?: boolean\n\n /**\n * The name of the chip, which is submitted with the form data.\n *\n * @webnative\n */\n @Prop() public readonly name?: string\n\n /**\n * Specify whether the chip should have focus when the page loads.\n *\n * @webnative\n */\n @Prop({ attribute: 'autofocus' }) public readonly autoFocus?: boolean\n\n /**\n * The value of the chip, submitted as a name/value pair with form data.\n *\n * @webnative\n */\n @Prop() public readonly value?: Value = 'on'\n\n /**\n * Emitted when the chip loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when the chip gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when the chip is closed.\n */\n @Event({ eventName: 'qdsClose', cancelable: false })\n private readonly closeEmitter!: EventEmitter<void>\n\n /**\n * Emitted when a change to the selectable chip's state is committed by the user.\n */\n @Event({ eventName: 'qdsChange', cancelable: false })\n private readonly changeEmitter!: EventEmitter<void>\n\n @Element() private readonly host!: HTMLQdsChipElement\n\n @AttachInternals() private readonly internals!: ElementInternals\n\n @State() private isPressed = false\n\n @State() private tabIndex?: number\n\n @State() private tooltip = false\n\n #chip?: HTMLDivElement\n\n #span?: HTMLSpanElement\n\n #ro?: ResizeObserver\n\n #inheritedAttributes: Attributes = {}\n\n get #ariaLabel(): string {\n return `Delete ${this.text} selection`\n }\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 #computedType(): ChipType {\n switch (this.type) {\n case 'selectable':\n case 'closable': {\n return this.type\n }\n default: {\n return 'selectable'\n }\n }\n }\n\n get #computedChecked(): boolean {\n return this.checked ?? false\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 if (this.#computedType === 'selectable') {\n this.checked = !this.#computedChecked\n this.changeEmitter.emit()\n }\n }\n\n @Listen('keydown')\n protected handleKeyDown(event: KeyboardEvent): void {\n if (this.#computedDisabled) {\n event.stopImmediatePropagation()\n return\n }\n\n if (event.key === ' ') {\n this.isPressed = true\n event.preventDefault()\n } else if (event.key === 'Enter' && this.internals.form) {\n this.internals.form.requestSubmit()\n event.preventDefault()\n }\n }\n\n @Listen('keyup')\n protected handleKeyUp(event: KeyboardEvent): void {\n if (event.key !== ' ') return\n\n this.isPressed = false\n if (this.#computedType === 'closable') this.closeEmitter.emit()\n else {\n this.checked = !this.#computedChecked\n this.changeEmitter.emit()\n }\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 Object.defineProperty(this.host, 'form', {\n enumerable: true,\n get: () => this.internals.form,\n })\n\n this.#inheritedAttributes = inheritAriaAttributes(this.host)\n this.tabindexChanged(this.host.getAttribute('tabindex') ?? '0')\n }\n\n public componentDidLoad(): void {\n invariant(this.#span)\n\n this.tooltip = isOverflowing(this.#span)\n this.#ro = new ResizeObserver(([spanEntry]) => {\n this.tooltip = isOverflowing(spanEntry.target)\n })\n this.#ro.observe(this.#span)\n }\n\n public disconnectedCallback(): void {\n if (this.#ro) this.#ro.disconnect()\n }\n\n public render() {\n return (\n <div class=\"qds-chip\" ref={this.#chipRef}>\n {this.#computedType === 'closable' && (\n <div\n aria-disabled={this.#computedDisabled ? 'true' : undefined}\n class={{\n 'qds-container': true,\n 'qds-closable-chip': true,\n 'qds-pressed-state': this.isPressed,\n }}\n data-size={this.#computedSize}\n >\n {this.iconName !== undefined && this.iconName !== '' && (\n <qds-icon\n aria-hidden=\"true\"\n class=\"qds-icon\"\n data-size={this.#computedSize}\n library={this.iconLibrary}\n name={this.iconName}\n />\n )}\n <span\n class=\"qds-text\"\n data-size={this.#computedSize}\n ref={this.#spanRef}\n >\n {this.text}\n </span>\n <button\n aria-label={this.#ariaLabel}\n class=\"qds-target\"\n data-size={this.#computedSize}\n disabled={this.#computedDisabled}\n onClick={this.#onIconClick}\n tabIndex={this.#computedDisabled ? undefined : this.tabIndex}\n type=\"button\"\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=\"close\"\n />\n </button>\n </div>\n )}\n {this.#computedType === 'selectable' && (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label\n aria-disabled={this.#computedDisabled ? 'true' : undefined}\n class=\"qds-label\"\n >\n <input\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.autoFocus}\n checked={this.checked}\n class=\"qds-checkbox\"\n data-size={this.#computedSize}\n disabled={this.#computedDisabled}\n name={this.name}\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\n class={{\n 'qds-container': true,\n 'qds-pressed-state': this.isPressed,\n 'qds-padding-end': true,\n 'qds-cursor': true,\n }}\n data-size={this.#computedSize}\n >\n {this.iconName !== undefined && this.iconName !== '' && (\n <qds-icon\n aria-hidden=\"true\"\n class=\"qds-icon\"\n data-size={this.#computedSize}\n library={this.iconLibrary}\n name={this.iconName}\n />\n )}\n <span\n class=\"qds-text\"\n data-size={this.#computedSize}\n ref={this.#spanRef}\n >\n {this.text}\n </span>\n {(this.checked ?? false) && (\n <qds-icon\n aria-hidden=\"true\"\n class=\"qds-icon\"\n data-size={this.#computedSize}\n library=\"core\"\n name=\"checked\"\n />\n )}\n </div>\n </label>\n )}\n {this.tooltip && (\n <qds-tooltip ref={this.#tooltipRef} trigger=\"pointerenter focusin\">\n {this.text}\n </qds-tooltip>\n )}\n </div>\n )\n }\n\n readonly #onIconClick = (event: MouseEvent): void => {\n if (!event.defaultPrevented && this.#computedType === 'closable')\n this.closeEmitter.emit()\n }\n\n readonly #onFocus = (event: FocusEvent): void => {\n this.focusEmitter.emit(pickFocusEventAttributes(event))\n }\n\n readonly #onBlur = (event: FocusEvent): void => {\n this.blurEmitter.emit(pickFocusEventAttributes(event))\n }\n\n readonly #chipRef = (chip?: HTMLDivElement): void => {\n this.#chip = chip\n }\n\n readonly #spanRef = (span?: HTMLSpanElement): void => {\n this.#span = span\n }\n\n readonly #tooltipRef = (tooltip?: HTMLQdsTooltipElement): void => {\n if (tooltip)\n // eslint-disable-next-line no-param-reassign\n tooltip.target = this.#chip\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../dist/types/components";
|
|
2
|
+
|
|
3
|
+
interface QdsDialog extends Components.QdsDialog, HTMLElement {}
|
|
4
|
+
export const QdsDialog: {
|
|
5
|
+
prototype: QdsDialog;
|
|
6
|
+
new (): QdsDialog;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|