@quartzds/core 1.0.0-beta.9 → 1.0.0-beta.90
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 +48 -0
- package/components/index.js +60 -28
- package/components/index.js.map +1 -1
- package/components/p-2806fee1.js +1887 -0
- package/components/p-2806fee1.js.map +1 -0
- package/components/p-3c48ff53.js +103 -0
- package/components/p-3c48ff53.js.map +1 -0
- package/components/p-688c90f6.js +267 -0
- package/components/p-688c90f6.js.map +1 -0
- package/components/p-8abba29b.js +204 -0
- package/components/p-8abba29b.js.map +1 -0
- package/components/p-a020ece3.js +142 -0
- package/components/p-a020ece3.js.map +1 -0
- package/components/p-a6310886.js +144 -0
- package/components/p-a6310886.js.map +1 -0
- package/components/p-adefd438.js +404 -0
- package/components/p-adefd438.js.map +1 -0
- package/components/p-b4c302d4.js +91 -0
- package/components/p-b4c302d4.js.map +1 -0
- package/components/p-ba880369.js +256 -0
- package/components/p-ba880369.js.map +1 -0
- package/components/p-c80f112a.js +408 -0
- package/components/p-c80f112a.js.map +1 -0
- package/components/p-d107c90c.js +27 -0
- package/components/p-d107c90c.js.map +1 -0
- package/components/p-fac26e20.js +111 -0
- package/components/p-fac26e20.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/p-fed0d11f.js +94 -0
- package/components/p-fed0d11f.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 +126 -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 +296 -0
- package/components/qds-chip.js.map +1 -0
- package/components/qds-dialog.d.ts +11 -0
- package/components/qds-dialog.js +126 -0
- package/components/qds-dialog.js.map +1 -0
- package/components/qds-divider.d.ts +2 -2
- package/components/qds-divider.js +3 -39
- package/components/qds-divider.js.map +1 -1
- package/components/qds-dropdown.d.ts +2 -2
- package/components/qds-dropdown.js +273 -239
- package/components/qds-dropdown.js.map +1 -1
- package/components/qds-form-message.d.ts +11 -0
- package/components/qds-form-message.js +112 -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 +136 -73
- package/components/qds-inline-link.js.map +1 -1
- package/components/qds-input.d.ts +2 -2
- package/components/qds-input.js +489 -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 +212 -0
- package/components/qds-list-item.js.map +1 -0
- package/components/qds-loader.d.ts +11 -0
- package/components/qds-loader.js +113 -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 +162 -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 +153 -0
- package/components/qds-progress-bar.js.map +1 -0
- package/components/qds-radio.d.ts +2 -2
- package/components/qds-radio.js +147 -93
- package/components/qds-radio.js.map +1 -1
- package/components/qds-select.d.ts +11 -0
- package/components/qds-select.js +361 -0
- package/components/qds-select.js.map +1 -0
- package/components/qds-standalone-link.d.ts +11 -0
- package/components/qds-standalone-link.js +174 -0
- package/components/qds-standalone-link.js.map +1 -0
- package/components/qds-switch.d.ts +2 -2
- package/components/qds-switch.js +221 -105
- package/components/qds-switch.js.map +1 -1
- package/components/qds-tab.d.ts +11 -0
- package/components/qds-tab.js +379 -0
- package/components/qds-tab.js.map +1 -0
- package/components/qds-tabbar.d.ts +11 -0
- package/components/qds-tabbar.js +407 -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 +71 -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 +73 -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 +331 -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-10154521.js +217 -0
- package/dist/cjs/helpers-10154521.js.map +1 -0
- package/dist/cjs/index-523dd2e0.js +2149 -0
- package/dist/cjs/index-523dd2e0.js.map +1 -0
- package/dist/cjs/index.cjs.js +39 -27
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/library-41b19b9e.js +117 -0
- package/dist/cjs/library-41b19b9e.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_2.cjs.entry.js +151 -0
- package/dist/cjs/qds-badge-counter_2.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-breadcrumb-item.cjs.entry.js +96 -0
- package/dist/cjs/qds-breadcrumb-item.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-button.cjs.entry.js +321 -90
- package/dist/cjs/qds-button.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-checkbox.cjs.entry.js +207 -99
- package/dist/cjs/qds-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-chip.cjs.entry.js +256 -0
- package/dist/cjs/qds-chip.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-dialog.cjs.entry.js +108 -0
- package/dist/cjs/qds-dialog.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-divider.cjs.entry.js +60 -18
- package/dist/cjs/qds-divider.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-dropdown.cjs.entry.js +232 -206
- package/dist/cjs/qds-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-form-message.cjs.entry.js +86 -0
- package/dist/cjs/qds-form-message.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-icon.cjs.entry.js +113 -90
- package/dist/cjs/qds-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-inline-link.cjs.entry.js +99 -46
- package/dist/cjs/qds-inline-link.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-input.cjs.entry.js +404 -185
- package/dist/cjs/qds-input.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-label.cjs.entry.js +102 -24
- package/dist/cjs/qds-label.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-list-item.cjs.entry.js +157 -0
- package/dist/cjs/qds-list-item.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-loader.cjs.entry.js +94 -0
- package/dist/cjs/qds-loader.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-nav-list-item.cjs.entry.js +124 -0
- package/dist/cjs/qds-nav-list-item.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-progress-bar.cjs.entry.js +135 -0
- package/dist/cjs/qds-progress-bar.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-radio.cjs.entry.js +102 -57
- package/dist/cjs/qds-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-select.cjs.entry.js +323 -0
- package/dist/cjs/qds-select.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-standalone-link.cjs.entry.js +134 -0
- package/dist/cjs/qds-standalone-link.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-switch.cjs.entry.js +193 -64
- package/dist/cjs/qds-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-tab.cjs.entry.js +299 -0
- package/dist/cjs/qds-tab.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-tabbar.cjs.entry.js +349 -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 +54 -0
- package/dist/cjs/qds-table-cell.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-table-head-cell.cjs.entry.js +54 -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 +181 -0
- package/dist/cjs/qds-tag_2.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-textarea.cjs.entry.js +288 -153
- package/dist/cjs/qds-textarea.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-tooltip.cjs.entry.js +332 -260
- package/dist/cjs/qds-tooltip.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 +8707 -2149
- package/dist/docs.d.ts +344 -240
- package/dist/docs.json +9494 -3054
- 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-2e4ca34d.js +204 -0
- package/dist/esm/helpers-2e4ca34d.js.map +1 -0
- package/dist/esm/index-b1d6acd2.js +2118 -0
- package/dist/esm/index-b1d6acd2.js.map +1 -0
- package/dist/esm/index.js +39 -28
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/library-2e5458af.js +113 -0
- package/dist/esm/library-2e5458af.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_2.entry.js +146 -0
- package/dist/esm/qds-badge-counter_2.entry.js.map +1 -0
- package/dist/esm/qds-breadcrumb-item.entry.js +92 -0
- package/dist/esm/qds-breadcrumb-item.entry.js.map +1 -0
- package/dist/esm/qds-button.entry.js +321 -90
- package/dist/esm/qds-button.entry.js.map +1 -1
- package/dist/esm/qds-checkbox.entry.js +207 -99
- package/dist/esm/qds-checkbox.entry.js.map +1 -1
- package/dist/esm/qds-chip.entry.js +252 -0
- package/dist/esm/qds-chip.entry.js.map +1 -0
- package/dist/esm/qds-dialog.entry.js +104 -0
- package/dist/esm/qds-dialog.entry.js.map +1 -0
- package/dist/esm/qds-divider.entry.js +60 -18
- package/dist/esm/qds-divider.entry.js.map +1 -1
- package/dist/esm/qds-dropdown.entry.js +232 -206
- package/dist/esm/qds-dropdown.entry.js.map +1 -1
- package/dist/esm/qds-form-message.entry.js +82 -0
- package/dist/esm/qds-form-message.entry.js.map +1 -0
- package/dist/esm/qds-icon.entry.js +113 -90
- package/dist/esm/qds-icon.entry.js.map +1 -1
- package/dist/esm/qds-inline-link.entry.js +99 -46
- package/dist/esm/qds-inline-link.entry.js.map +1 -1
- package/dist/esm/qds-input.entry.js +404 -185
- package/dist/esm/qds-input.entry.js.map +1 -1
- package/dist/esm/qds-label.entry.js +102 -24
- package/dist/esm/qds-label.entry.js.map +1 -1
- package/dist/esm/qds-list-item.entry.js +153 -0
- package/dist/esm/qds-list-item.entry.js.map +1 -0
- package/dist/esm/qds-loader.entry.js +90 -0
- package/dist/esm/qds-loader.entry.js.map +1 -0
- package/dist/esm/qds-nav-list-item.entry.js +120 -0
- package/dist/esm/qds-nav-list-item.entry.js.map +1 -0
- package/dist/esm/qds-progress-bar.entry.js +131 -0
- package/dist/esm/qds-progress-bar.entry.js.map +1 -0
- package/dist/esm/qds-radio.entry.js +102 -57
- package/dist/esm/qds-radio.entry.js.map +1 -1
- package/dist/esm/qds-select.entry.js +319 -0
- package/dist/esm/qds-select.entry.js.map +1 -0
- package/dist/esm/qds-standalone-link.entry.js +130 -0
- package/dist/esm/qds-standalone-link.entry.js.map +1 -0
- package/dist/esm/qds-switch.entry.js +193 -64
- package/dist/esm/qds-switch.entry.js.map +1 -1
- package/dist/esm/qds-tab.entry.js +295 -0
- package/dist/esm/qds-tab.entry.js.map +1 -0
- package/dist/esm/qds-tabbar.entry.js +345 -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 +50 -0
- package/dist/esm/qds-table-cell.entry.js.map +1 -0
- package/dist/esm/qds-table-head-cell.entry.js +50 -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 +176 -0
- package/dist/esm/qds-tag_2.entry.js.map +1 -0
- package/dist/esm/qds-textarea.entry.js +288 -153
- package/dist/esm/qds-textarea.entry.js.map +1 -1
- package/dist/esm/qds-tooltip.entry.js +332 -260
- package/dist/esm/qds-tooltip.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 +160 -0
- package/dist/types/components/button/button.d.ts +272 -194
- package/dist/types/components/checkbox/checkbox.d.ts +130 -124
- package/dist/types/components/chip/chip.d.ts +109 -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 +13 -9
- 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 +415 -368
- package/dist/types/components/label/label.d.ts +26 -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 +203 -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 +114 -107
- package/dist/types/components/tab/tab.d.ts +160 -0
- package/dist/types/components/tabbar/tabbar.d.ts +47 -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 +55 -0
- package/dist/types/components/textarea/textarea.d.ts +285 -300
- package/dist/types/components/title/title.d.ts +39 -32
- package/dist/types/components/tooltip/tooltip.d.ts +123 -137
- package/dist/types/components.d.ts +3928 -820
- package/dist/types/helpers.d.ts +15 -16
- package/dist/types/index.d.ts +2 -1
- 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 +55 -15
- package/dist/types/utils.d.ts +11 -4
- package/dist/vscode.html-custom-data.json +1523 -209
- package/hydrate/index.d.ts +59 -18
- package/hydrate/index.js +25682 -8977
- package/hydrate/index.mjs +26622 -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/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/types/components/create-story.d.ts +0 -5
|
@@ -1,168 +1,303 @@
|
|
|
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
6
|
'use strict';
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
|
-
const index = require('./index-
|
|
11
|
-
const helpers = require('./helpers-
|
|
10
|
+
const index = require('./index-523dd2e0.js');
|
|
11
|
+
const helpers = require('./helpers-10154521.js');
|
|
12
|
+
const controls = require('./controls-ee3d2ec8.js');
|
|
12
13
|
|
|
13
|
-
const textareaCss = "
|
|
14
|
+
const textareaCss = ":host([hidden]){display:none!important}:host{display:inline-block;resize:both}slot{display:none}.qds-textarea{background-color:var(--qds-theme-control-input-background);border:var(--qds-control-border-width) solid var(--qds-theme-control-border);border-radius:var(--qds-control-border-radius);box-sizing:border-box;color:var(--qds-theme-control-text-standard);height:100%;padding-inline:var(--qds-control-input-padding-horizontal);resize:inherit;width:100%}.qds-textarea:disabled{opacity:var(--qds-theme-disabled);pointer-events:none}.qds-textarea:focus-visible{outline:var(--qds-control-input-focus-border-width) solid var(--qds-theme-control-input-focus-border)}.qds-textarea:placeholder-shown{color:var(--qds-theme-control-text-placeholder)}.qds-textarea:not(:focus):user-invalid{border-color:var(--qds-theme-feedback-result-failure)}[data-size=small]{font:var(--qds-control-small-text);padding-block:var(--qds-control-small-padding-auto-height)}[data-size=standard]{font:var(--qds-control-standard-text);padding-block:var(--qds-control-standard-padding-auto-height)}[data-size=large]{font:var(--qds-control-large-text);padding-block:var(--qds-control-large-padding-auto-height)}";
|
|
15
|
+
const QdsTextareaStyle0 = textareaCss;
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
// SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
18
|
+
//
|
|
19
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
20
|
+
var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
21
|
+
if (kind === "a" && !f)
|
|
22
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
23
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
24
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
25
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
26
|
+
};
|
|
27
|
+
var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
28
|
+
if (kind === "m")
|
|
29
|
+
throw new TypeError("Private method is not writable");
|
|
30
|
+
if (kind === "a" && !f)
|
|
31
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
32
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
33
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
34
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
35
|
+
};
|
|
36
|
+
var _TextArea_instances, _TextArea_inheritedAttributes, _TextArea_textarea, _TextArea_computedDisabled_get, _TextArea_computedValue_get, _TextArea_getSelectionDirection, _TextArea_getSelectionStart, _TextArea_getSelectionEnd, _TextArea_ref, _TextArea_onBlur, _TextArea_onChange, _TextArea_onFocus, _TextArea_onInput, _TextArea_onSlotchange, _TextArea_defineGetter;
|
|
16
37
|
const TextArea = class {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
38
|
+
constructor(hostRef) {
|
|
39
|
+
index.registerInstance(this, hostRef);
|
|
40
|
+
this.blurEmitter = index.createEvent(this, "qdsBlur", 2);
|
|
41
|
+
this.changeEmitter = index.createEvent(this, "qdsChange", 6);
|
|
42
|
+
this.focusEmitter = index.createEvent(this, "qdsFocus", 2);
|
|
43
|
+
this.inputEmitter = index.createEvent(this, "qdsInput", 6);
|
|
44
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
45
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
49
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
50
|
+
}
|
|
51
|
+
_TextArea_instances.add(this);
|
|
52
|
+
/**
|
|
53
|
+
* The textarea's size.
|
|
54
|
+
*
|
|
55
|
+
* > **_NOTE:_** The native [`size` HTML attribute][] is not supported. CSS
|
|
56
|
+
* `width` should be used instead if this functionality is needed.
|
|
57
|
+
*
|
|
58
|
+
* [`size` HTML attribute]: https://developer.mozilla.org/docs/Web/HTML/Attributes/size
|
|
59
|
+
*/
|
|
60
|
+
this.size = 'standard';
|
|
61
|
+
/**
|
|
62
|
+
* The [`<form>`][] element to associate the input with (its form owner).
|
|
63
|
+
*
|
|
64
|
+
* The value of this attribute must be the id of a `<form>` in the same
|
|
65
|
+
* document. If this attribute is not set, the `<qds-textarea>` is associated
|
|
66
|
+
* with its ancestor `<form>` element, if any.
|
|
67
|
+
*
|
|
68
|
+
* This attribute lets you associate `<qds-textarea>` elements to `<form>`s
|
|
69
|
+
* anywhere in the document, not just inside a `<form>`. It can also override
|
|
70
|
+
* an ancestor `<form>` element.
|
|
71
|
+
*
|
|
72
|
+
* [`<form>`]: https://developer.mozilla.org/docs/Web/HTML/Element/form
|
|
73
|
+
*
|
|
74
|
+
* @readonly
|
|
75
|
+
* @webnative
|
|
76
|
+
*/
|
|
77
|
+
// eslint-disable-next-line unicorn/no-null
|
|
78
|
+
this.form = null;
|
|
79
|
+
/**
|
|
80
|
+
* Returns a list of the [`<label>`][] elements associated with the
|
|
81
|
+
* `qds-textarea` element.
|
|
82
|
+
*
|
|
83
|
+
* [`<label>`]: https://developer.mozilla.org/docs/Web/HTML/Element/label
|
|
84
|
+
*
|
|
85
|
+
* @readonly
|
|
86
|
+
* @webnative
|
|
87
|
+
*/
|
|
88
|
+
this.labels = {};
|
|
89
|
+
/**
|
|
90
|
+
* Get or set the selection direction of a text selection.
|
|
91
|
+
*
|
|
92
|
+
* > **_NOTE:_** This property has no effect when used as an attribute.
|
|
93
|
+
*
|
|
94
|
+
* @webnative
|
|
95
|
+
*/
|
|
96
|
+
this.selectionDirection = null;
|
|
97
|
+
/**
|
|
98
|
+
* Get or set the ending position or offset of a text selection.
|
|
99
|
+
*
|
|
100
|
+
* > **_NOTE:_** This property has no effect when used as an attribute.
|
|
101
|
+
*
|
|
102
|
+
* @webnative
|
|
103
|
+
*/
|
|
104
|
+
this.selectionEnd = null;
|
|
105
|
+
/**
|
|
106
|
+
* Get or set the starting position or offset of a text selection.
|
|
107
|
+
*
|
|
108
|
+
* > **_NOTE:_** This property has no effect when used as an attribute.
|
|
109
|
+
*
|
|
110
|
+
* @webnative
|
|
111
|
+
*/
|
|
112
|
+
this.selectionStart = null;
|
|
113
|
+
/**
|
|
114
|
+
* The error message that would be shown to the user if the `<qds-select>`
|
|
115
|
+
* was to be checked for validity.
|
|
116
|
+
*
|
|
117
|
+
* @readonly
|
|
118
|
+
* @webnative
|
|
119
|
+
*/
|
|
120
|
+
this.validationMessage = '';
|
|
121
|
+
/**
|
|
122
|
+
* The [`ValidityState`][] object for this `<qds-select>`.
|
|
123
|
+
*
|
|
124
|
+
* [`ValidityState`]: https://developer.mozilla.org/docs/Web/API/ValidityState
|
|
125
|
+
*
|
|
126
|
+
* @readonly
|
|
127
|
+
* @webnative
|
|
128
|
+
*/
|
|
129
|
+
this.validity = controls.VALID_STATE;
|
|
130
|
+
/**
|
|
131
|
+
* True if `<qds-textarea>` will be validated when the form is submitted;
|
|
132
|
+
* false otherwise.
|
|
133
|
+
*
|
|
134
|
+
* @readonly
|
|
135
|
+
* @webnative
|
|
136
|
+
*/
|
|
137
|
+
this.willValidate = false;
|
|
138
|
+
_TextArea_inheritedAttributes.set(this, {});
|
|
139
|
+
_TextArea_textarea.set(this, void 0);
|
|
140
|
+
this.checkValidity = () => this.internals.checkValidity();
|
|
141
|
+
this.reportValidity = () => this.internals.reportValidity();
|
|
142
|
+
this.setCustomValidity = (error) => {
|
|
143
|
+
helpers.invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
144
|
+
__classPrivateFieldGet(this, _TextArea_textarea, "f").setCustomValidity(error);
|
|
145
|
+
if (error)
|
|
146
|
+
this.internals.setValidity(controls.CUSTOM_ERROR_FLAGS, error, __classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
147
|
+
else
|
|
148
|
+
this.internals.setValidity(controls.NO_ERROR_FLAGS);
|
|
149
|
+
};
|
|
150
|
+
this.select = () => {
|
|
151
|
+
helpers.invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
152
|
+
__classPrivateFieldGet(this, _TextArea_textarea, "f").select();
|
|
153
|
+
};
|
|
154
|
+
this.setRangeText = (replacement, start, end, selectionMode) => {
|
|
155
|
+
helpers.invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
156
|
+
__classPrivateFieldGet(this, _TextArea_textarea, "f").setRangeText(replacement, start, end, selectionMode);
|
|
157
|
+
if (this.value !== __classPrivateFieldGet(this, _TextArea_textarea, "f").value) {
|
|
158
|
+
this.value = __classPrivateFieldGet(this, _TextArea_textarea, "f").value;
|
|
159
|
+
this.inputEmitter.emit();
|
|
160
|
+
this.changeEmitter.emit();
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
this.setSelectionRange = (start, end, direction) => {
|
|
164
|
+
helpers.invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
165
|
+
__classPrivateFieldGet(this, _TextArea_textarea, "f").setSelectionRange(start, end, direction);
|
|
166
|
+
};
|
|
167
|
+
_TextArea_getSelectionDirection.set(this, () => {
|
|
168
|
+
helpers.invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
169
|
+
return __classPrivateFieldGet(this, _TextArea_textarea, "f").selectionDirection;
|
|
170
|
+
});
|
|
171
|
+
_TextArea_getSelectionStart.set(this, () => {
|
|
172
|
+
helpers.invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
173
|
+
return __classPrivateFieldGet(this, _TextArea_textarea, "f").selectionStart;
|
|
174
|
+
});
|
|
175
|
+
_TextArea_getSelectionEnd.set(this, () => {
|
|
176
|
+
helpers.invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
177
|
+
return __classPrivateFieldGet(this, _TextArea_textarea, "f").selectionEnd;
|
|
178
|
+
});
|
|
179
|
+
_TextArea_ref.set(this, (textarea) => {
|
|
180
|
+
__classPrivateFieldSet(this, _TextArea_textarea, textarea, "f");
|
|
181
|
+
});
|
|
182
|
+
_TextArea_onBlur.set(this, (event) => {
|
|
183
|
+
this.blurEmitter.emit(helpers.pickFocusEventAttributes(event));
|
|
184
|
+
});
|
|
185
|
+
_TextArea_onChange.set(this, () => {
|
|
186
|
+
this.changeEmitter.emit();
|
|
187
|
+
});
|
|
188
|
+
_TextArea_onFocus.set(this, (event) => {
|
|
189
|
+
this.focusEmitter.emit(helpers.pickFocusEventAttributes(event));
|
|
190
|
+
});
|
|
191
|
+
_TextArea_onInput.set(this, (event) => {
|
|
192
|
+
helpers.invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
193
|
+
this.value = __classPrivateFieldGet(this, _TextArea_textarea, "f").value;
|
|
194
|
+
this.inputEmitter.emit(helpers.pickInputEventAttributes(event));
|
|
195
|
+
});
|
|
196
|
+
_TextArea_onSlotchange.set(this, () => {
|
|
197
|
+
helpers.invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
198
|
+
__classPrivateFieldGet(this, _TextArea_textarea, "f").innerHTML = this.host.innerHTML;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
onClick(event) {
|
|
202
|
+
if (__classPrivateFieldGet(this, _TextArea_instances, "a", _TextArea_computedDisabled_get))
|
|
203
|
+
event.stopImmediatePropagation();
|
|
204
|
+
}
|
|
205
|
+
disabledChanged() {
|
|
206
|
+
if (__classPrivateFieldGet(this, _TextArea_instances, "a", _TextArea_computedDisabled_get))
|
|
207
|
+
// eslint-disable-next-line unicorn/no-null
|
|
208
|
+
this.internals.setFormValue(null);
|
|
209
|
+
else
|
|
210
|
+
this.internals.setFormValue(__classPrivateFieldGet(this, _TextArea_instances, "a", _TextArea_computedValue_get));
|
|
211
|
+
}
|
|
212
|
+
selectionDirectionChanged() {
|
|
213
|
+
helpers.invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
214
|
+
// @ts-expect-error: `null` is a valid value according to the HTML spec.
|
|
215
|
+
__classPrivateFieldGet(this, _TextArea_textarea, "f").selectionDirection = this.selectionDirection;
|
|
216
|
+
}
|
|
217
|
+
selectionEndChanged() {
|
|
218
|
+
helpers.invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
219
|
+
// @ts-expect-error: `null` is a valid value according to the HTML spec.
|
|
220
|
+
__classPrivateFieldGet(this, _TextArea_textarea, "f").selectionEnd = this.selectionEnd;
|
|
221
|
+
}
|
|
222
|
+
selectionStartChanged() {
|
|
223
|
+
helpers.invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
224
|
+
// @ts-expect-error: `null` is a valid value according to the HTML spec.
|
|
225
|
+
__classPrivateFieldGet(this, _TextArea_textarea, "f").selectionStart = this.selectionStart;
|
|
123
226
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
227
|
+
tabindexChanged(newValue) {
|
|
228
|
+
const parsedValue = Number.parseInt(newValue, 10);
|
|
229
|
+
this.tabIndex =
|
|
230
|
+
parsedValue === 0 || Number.isNaN(parsedValue) ? undefined : parsedValue;
|
|
231
|
+
}
|
|
232
|
+
validationChanged() {
|
|
233
|
+
helpers.invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
234
|
+
if (this.maxLength !== undefined)
|
|
235
|
+
__classPrivateFieldGet(this, _TextArea_textarea, "f").maxLength = this.maxLength;
|
|
236
|
+
if (this.minLength !== undefined)
|
|
237
|
+
__classPrivateFieldGet(this, _TextArea_textarea, "f").minLength = this.minLength;
|
|
238
|
+
__classPrivateFieldGet(this, _TextArea_textarea, "f").required = this.required ?? false;
|
|
239
|
+
// eslint-disable-next-line unicorn/no-null
|
|
240
|
+
if (this.value != null)
|
|
241
|
+
__classPrivateFieldGet(this, _TextArea_textarea, "f").value = this.value.toString();
|
|
242
|
+
const { valid } = __classPrivateFieldGet(this, _TextArea_textarea, "f").validity;
|
|
243
|
+
if (valid)
|
|
244
|
+
this.internals.setValidity(controls.NO_ERROR_FLAGS, undefined, __classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
245
|
+
else
|
|
246
|
+
this.internals.setValidity(__classPrivateFieldGet(this, _TextArea_textarea, "f").validity, __classPrivateFieldGet(this, _TextArea_textarea, "f").validationMessage, __classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
247
|
+
}
|
|
248
|
+
valueChanged() {
|
|
249
|
+
if (!__classPrivateFieldGet(this, _TextArea_instances, "a", _TextArea_computedDisabled_get))
|
|
250
|
+
this.internals.setFormValue(__classPrivateFieldGet(this, _TextArea_instances, "a", _TextArea_computedValue_get));
|
|
251
|
+
}
|
|
252
|
+
componentWillLoad() {
|
|
253
|
+
__classPrivateFieldGet(this, _TextArea_instances, "m", _TextArea_defineGetter).call(this, 'form', () => this.internals.form);
|
|
254
|
+
__classPrivateFieldGet(this, _TextArea_instances, "m", _TextArea_defineGetter).call(this, 'willValidate', () => this.internals.willValidate);
|
|
255
|
+
__classPrivateFieldGet(this, _TextArea_instances, "m", _TextArea_defineGetter).call(this, 'validity', () => this.internals.validity);
|
|
256
|
+
__classPrivateFieldGet(this, _TextArea_instances, "m", _TextArea_defineGetter).call(this, 'validationMessage', () => this.internals.validationMessage);
|
|
257
|
+
__classPrivateFieldGet(this, _TextArea_instances, "m", _TextArea_defineGetter).call(this, 'labels', () => this.internals.labels);
|
|
258
|
+
__classPrivateFieldGet(this, _TextArea_instances, "m", _TextArea_defineGetter).call(this, 'selectionDirection', __classPrivateFieldGet(this, _TextArea_getSelectionDirection, "f"));
|
|
259
|
+
__classPrivateFieldGet(this, _TextArea_instances, "m", _TextArea_defineGetter).call(this, 'selectionStart', __classPrivateFieldGet(this, _TextArea_getSelectionStart, "f"));
|
|
260
|
+
__classPrivateFieldGet(this, _TextArea_instances, "m", _TextArea_defineGetter).call(this, 'selectionEnd', __classPrivateFieldGet(this, _TextArea_getSelectionEnd, "f"));
|
|
261
|
+
__classPrivateFieldSet(this, _TextArea_inheritedAttributes, helpers.inheritAriaAttributes(this.host), "f");
|
|
262
|
+
this.tabindexChanged(this.host.getAttribute('tabindex') ?? '0');
|
|
263
|
+
}
|
|
264
|
+
componentDidLoad() {
|
|
265
|
+
helpers.invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
|
|
266
|
+
this.validationChanged();
|
|
267
|
+
this.valueChanged();
|
|
268
|
+
}
|
|
269
|
+
render() {
|
|
270
|
+
return (index.h(index.Host, { key: '3d90ed4fa28f54ac3676c2da3b7c78875322bf60' }, index.h("textarea", { key: '6636101c90c14b78e81f7121c2a1a948cebcaefa', autoCapitalize: this.host.autocapitalize, autoComplete: this.autoComplete,
|
|
271
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
272
|
+
autoFocus: this.host.autofocus, class: "qds-textarea", cols: this.cols, "data-size": this.size ?? 'standard', disabled: this.disabled, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, maxLength: this.maxLength, minLength: this.minLength, onBlur: __classPrivateFieldGet(this, _TextArea_onBlur, "f"), onChange: __classPrivateFieldGet(this, _TextArea_onChange, "f"), onFocus: __classPrivateFieldGet(this, _TextArea_onFocus, "f"), onInput: __classPrivateFieldGet(this, _TextArea_onInput, "f"), placeholder: this.placeholder, ref: __classPrivateFieldGet(this, _TextArea_ref, "f"), rows: this.rows, spellcheck: this.host.spellcheck, tabIndex: __classPrivateFieldGet(this, _TextArea_instances, "a", _TextArea_computedDisabled_get) ? undefined : this.tabIndex, wrap: this.wrap, ...__classPrivateFieldGet(this, _TextArea_inheritedAttributes, "f") }), index.h("slot", { key: '7f654f572a7ba49acb68addb731b811ba76c71f5', onSlotchange: __classPrivateFieldGet(this, _TextArea_onSlotchange, "f") })));
|
|
273
|
+
}
|
|
274
|
+
static get delegatesFocus() { return true; }
|
|
275
|
+
static get formAssociated() { return true; }
|
|
276
|
+
get host() { return index.getElement(this); }
|
|
277
|
+
static get watchers() { return {
|
|
278
|
+
"disabled": ["disabledChanged"],
|
|
279
|
+
"selectionDirection": ["selectionDirectionChanged"],
|
|
280
|
+
"selectionEnd": ["selectionEndChanged"],
|
|
281
|
+
"selectionStart": ["selectionStartChanged"],
|
|
282
|
+
"tabindex": ["tabindexChanged"],
|
|
283
|
+
"maxLength": ["validationChanged"],
|
|
284
|
+
"minLength": ["validationChanged"],
|
|
285
|
+
"required": ["validationChanged"],
|
|
286
|
+
"value": ["validationChanged", "valueChanged"]
|
|
287
|
+
}; }
|
|
288
|
+
};
|
|
289
|
+
_TextArea_inheritedAttributes = new WeakMap(), _TextArea_textarea = new WeakMap(), _TextArea_getSelectionDirection = new WeakMap(), _TextArea_getSelectionStart = new WeakMap(), _TextArea_getSelectionEnd = new WeakMap(), _TextArea_ref = new WeakMap(), _TextArea_onBlur = new WeakMap(), _TextArea_onChange = new WeakMap(), _TextArea_onFocus = new WeakMap(), _TextArea_onInput = new WeakMap(), _TextArea_onSlotchange = new WeakMap(), _TextArea_instances = new WeakSet(), _TextArea_computedDisabled_get = function _TextArea_computedDisabled_get() {
|
|
290
|
+
return ((this.host.matches(':disabled') || (this.disabled ?? false)) &&
|
|
291
|
+
this.host.getAttribute('disabled') !== 'false');
|
|
292
|
+
}, _TextArea_computedValue_get = function _TextArea_computedValue_get() {
|
|
293
|
+
if (typeof this.value === 'number')
|
|
294
|
+
return this.value.toString();
|
|
295
|
+
// eslint-disable-next-line unicorn/no-null
|
|
296
|
+
return this.value === undefined ? null : this.value;
|
|
297
|
+
}, _TextArea_defineGetter = function _TextArea_defineGetter(p, get) {
|
|
298
|
+
Object.defineProperty(this.host, p, { enumerable: true, get });
|
|
164
299
|
};
|
|
165
|
-
TextArea.style =
|
|
300
|
+
TextArea.style = QdsTextareaStyle0;
|
|
166
301
|
|
|
167
302
|
exports.qds_textarea = TextArea;
|
|
168
303
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"qds-textarea.entry.cjs.js","mappings":";;;;;;;;;;;;AAAA,MAAM,WAAW,GAAG,u9CAAu9C;;ACuC3+C,IAAI,kBAAkB,GAAG,CAAC,CAAA;MAcb,QAAQ;;;;;;;IAsRX,wBAAmB,GAAe,EAAE,CAAA;IA4J3B,QAAG,GAAG,CAAC,QAA8B;MACpD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;KACzB,CAAA;IAEgB,WAAM,GAAG,CAAC,KAAiB;MAC1C,IAAI,CAAC,WAAW,CAAC,IAAI,CAACA,gCAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;KACvD,CAAA;IAEgB,aAAQ,GAAG;MAC1BC,iBAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;MAExB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAA;MAChC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAA;KAC1B,CAAA;IAEgB,YAAO,GAAG,CAAC,KAAiB;MAC3C,IAAI,IAAI,CAAC,gBAAgB,EAAE;QACzB,KAAK,CAAC,cAAc,EAAE,CAAA;QACtB,KAAK,CAAC,eAAe,EAAE,CAAA;OACxB;KACF,CAAA;IAEgB,YAAO,GAAG,CAAC,KAAiB;MAC3C,IAAI,CAAC,YAAY,CAAC,IAAI,CAACD,gCAAwB,CAAC,K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I,CAAC,YAAY;;MAE/B,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,KAAK,EAAC,UAAU,EAChB,IAAI,EAAE,IAAI,CAAC,IAAI,eACJ,IAAI,CAAC,IAAI,EACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS,EAC9B,IAAI,EAAE,IAAI,CAAC,IAAI,KAEX,IAAI,CAAC,mBAAmB,GAC5B,EACH;GACF;;;;;;;;;;;","names":["pickFocusEventAttributes","invariant","pickInputEventAttributes","inheritAriaAttributes","inheritAttributes","h"],"sources":["src/components/textarea/textarea.css?tag=qds-textarea&encapsulation=scoped","src/components/textarea/textarea.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 resize: both;\n}\n\n.textarea {\n background-color: var(--qds-theme-control-input-background);\n border: var(--qds-control-border-width) solid var(--qds-theme-control-border);\n border-radius: var(--qds-control-border-radius);\n color: var(--qds-theme-control-text-standard);\n padding-inline: var(--qds-control-input-padding-horizontal);\n resize: inherit;\n width: 100%;\n height: 100%;\n\n &:not(:focus)[aria-invalid='true'] {\n border-color: var(--qds-theme-feedback-result-failure);\n }\n\n &:disabled {\n opacity: var(--qds-theme-disabled);\n pointer-events: 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 &:placeholder-shown {\n color: var(--qds-theme-control-text-placeholder);\n }\n}\n\n[data-size='small'] {\n font: var(--qds-control-small-text);\n padding-block: var(--qds-control-small-padding-auto-height);\n}\n\n[data-size='standard'] {\n font: var(--qds-control-standard-text);\n padding-block: var(--qds-control-standard-padding-auto-height);\n}\n\n[data-size='large'] {\n font: var(--qds-control-large-text);\n padding-block: var(--qds-control-large-padding-auto-height);\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 Method,\n Prop,\n Watch,\n} from '@stencil/core'\n\nimport type {\n Attributes,\n QdsFocusEventDetail,\n QdsInputEventDetail,\n} from '../../helpers'\nimport {\n inheritAriaAttributes,\n inheritAttributes,\n invariant,\n pickFocusEventAttributes,\n pickInputEventAttributes,\n} from '../../helpers'\nimport type {\n AutoCapitalize,\n EnterKeyHint,\n InputMode,\n SelectDirection,\n Value,\n} from '../controls'\n\nexport type TextAreaAutoComplete = 'off' | 'on'\nexport type TextAreaSize = 'large' | 'small' | 'standard'\nexport type Wrap = 'hard' | 'off' | 'soft'\n\nlet autoIncrementingId = 1\n\n/**\n * The `<qds-textarea>` element represents a multi-line plain-text editing\n * control, useful when you want to allow users to enter a sizeable amount of\n * free-form text, for example a comment on a review or feedback form.\n *\n * @see https://quartz.se.com/build/components/textarea\n */\n@Component({\n tag: 'qds-textarea',\n scoped: true,\n styleUrl: 'textarea.css',\n})\nexport class TextArea implements ComponentInterface {\n /**\n * Defines if the textarea is in an invalid state. Validity is determined by\n * attributes such as `required`, `minlength`, and `maxlength` using\n * [constraint validation][].\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n */\n @Prop({ mutable: true, reflect: true }) public invalid?: boolean\n\n /**\n * The textarea's size.\n *\n * > **_NOTE:_** The native [`size` HTML attribute][] is not supported. CSS\n * `width` should be used instead if this functionality is needed.\n *\n * [`size` HTML attribute]: https://developer.mozilla.org/docs/Web/HTML/Attributes/size\n */\n @Prop({ reflect: true }) public readonly size: TextAreaSize = 'standard'\n\n /**\n * Controls whether and how input is automatically capitalized as it is\n * entered/edited by the user. Possible values:\n *\n * - `\"off\"` or `\"none\"`: No auto-capitalization is applied (all letters\n * default to lowercase).\n * - `\"on\"` or `\"sentences\"`: The first letter of each sentence defaults to a\n * capital letter; all other letters default to lowercase.\n * - `\"words\"`: The first letter of each word defaults to a capital letter;\n * all other letters default to lowercase.\n * - `\"characters\"`: All letters default to uppercase.\n *\n * @webnative\n */\n @Prop({ attribute: 'autocapitalize' })\n public readonly autoCapitalize?: AutoCapitalize\n\n /**\n * Indicates whether the value of the textarea can be automatically completed\n * by the browser. Possible values:\n *\n * `off`: The user must explicitly enter a value into this field for every\n * use, or the document provides its own auto-completion method; the browser\n * does not automatically complete the entry.\n * `on`: The browser can automatically complete the value based on values\n * that the user has entered during previous uses.\n *\n * If the `autocomplete` attribute is not specified on a `<qds-textarea>`\n * element, then the browser uses the `autocomplete` attribute value of the\n * `<qds-textarea>` element's form owner. The form owner is either the\n * [`<form>`][] element that this `<qds-textarea>` element is a descendant of\n * or the form element whose `id` is specified by the `form` attribute of the\n * `qds-textarea` element. For more information, see the [`autocomplete`]\n * attribute in [`<form>`][].\n *\n * [`<form>`]: https://developer.mozilla.org/docs/Web/HTML/Element/form\n * [`autocomplete`]: https://developer.mozilla.org/docs/Web/HTML/Element/form#autocomplete\n *\n * @webnative\n */\n @Prop({ attribute: 'autocomplete' })\n public readonly autoComplete?: TextAreaAutoComplete\n\n /**\n * Specify whether the input should have focus when the page loads.\n *\n * @webnative\n */\n @Prop({ attribute: 'autofocus' }) public readonly autoFocus?: boolean\n\n /**\n * The visible width of the text control, in average character widths. If it\n * is specified, it must be a positive integer. If it is not specified, the\n * default value is `20`.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public readonly cols?: number\n\n /**\n * Prevents the input 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 * What action label (or icon) to present for the enter key on virtual\n * keyboards. Possible values:\n *\n * - `\"done\"`: Typically meaning there is nothing more to input and the input\n * method editor (IME) will be closed.\n * - `\"enter\"`:\tTypically inserting a new line.\n * - `\"go\"`: \tTypically meaning to take the user to the target of the text\n * they typed.\n * - `\"next\"`: \tTypically taking the user to the next field that will accept\n * text.\n * - `\"previous\"`: Typically taking the user to the previous field that will\n * accept text.\n * - `\"search\"`: Typically taking the user to the results of searching for\n * the text they have typed.\n * - `\"send\"`: Typically delivering the text to its target.\n *\n * @webnative\n */\n // FIXME: Can't use `attribute` option here to name this `enterKeyHint` instead.\n @Prop() public readonly enterkeyhint?: EnterKeyHint\n\n /**\n * The [`<form>`][] element to associate the input with (its form owner).\n *\n * The value of this attribute must be the id of a `<form>` in the same\n * document. If this attribute is not set, the `<qds-textarea>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This attribute lets you associate `<qds-textarea>` elements to `<form>`s\n * anywhere in the document, not just inside a `<form>`. It can also override\n * an ancestor `<form>` element.\n *\n * [`<form>`]: https://developer.mozilla.org/docs/Web/HTML/Element/form\n *\n * @webnative\n */\n @Prop() public readonly form?: string\n\n /**\n * Provide a hint to browsers as to the type of virtual keyboard\n * configuration to use when editing this element or its contents.\n *\n * @webnative\n */\n // FIXME: Can't use `attribute` option here to name this `inputMode` instead.\n @Prop() public readonly inputmode?: InputMode\n\n /**\n * The maximum number of characters (as UTF-16 code units) the user can enter\n * into the textarea. This must be an non-negative integer value. If no\n * `maxlength` is specified, or an invalid value is specified, the textarea\n * has no maximum length.\n *\n * The textarea will fail [constraint validation][] if the length of the text\n * entered into the field is greater than `maxlength` UTF-16 code units long.\n * By default, browsers prevent users from entering more characters than\n * allowed by the `maxlength` attribute. See [Client-side validation][] for\n * more information.\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n * [Client-side validation]: https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation\n *\n * @webnative\n */\n @Prop({ attribute: 'maxlength' }) public readonly maxLength?: number\n\n /**\n * The minimum number of characters (as UTF-16 code units) the user can enter\n * into the textarea. This must be an non-negative integer value smaller than\n * or equal to the value specified by `maxlength`. If no `minlength` is\n * specified, or an invalid value is specified, the textarea has no minimum\n * length.\n *\n * The textarea will fail [constraint validation][] if the length of the text\n * entered into the field is fewer than `minlength` UTF-16 code units long,\n * preventing form submission. See [Client-side validation][] for more\n * information.\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n * [Client-side validation]: https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation\n *\n * @webnative\n */\n @Prop({ attribute: 'minlength' }) public readonly minLength?: number\n\n /**\n * The name of the control, which is submitted with the form data. An\n * incrementing textarea ID is used by default.\n *\n * @webnative\n */\n @Prop() public readonly name = `qds-textarea-${autoIncrementingId}`\n\n /**\n * Text that appears in the textarea when it has no value set.\n *\n * @webnative\n */\n @Prop() public readonly placeholder?: string\n\n /**\n * The value of the textarea cannot be edited.\n *\n * @webnative\n */\n @Prop({ attribute: 'readonly' }) public readonly readOnly?: boolean\n\n /**\n * A value must be specified for the textarea before the owning form can be\n * submitted.\n *\n * See [Client-side validation][] and the [HTML attribute: `required`][] for\n * more information.\n *\n * [Client-side validation]: https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation\n * [HTML attribute: `required`]: https://developer.mozilla.org/docs/Web/HTML/Attributes/required\n *\n * @webnative\n */\n @Prop() public readonly required?: boolean\n\n /**\n * The number of visible text lines for the control. If it is specified, it\n * must be a positive integer. If it is not specified, the default value is\n * `2`.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public readonly rows?: number\n\n /**\n * Defines whether the textarea may be checked for spelling errors.\n *\n * @webnative\n */\n @Prop({ attribute: 'spellcheck' }) public readonly spellCheck?: boolean\n\n /**\n * The value of the textarea.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public value?: Value\n\n /**\n * Indicates how the control should wrap the value for form submission.\n * Possible values are:\n *\n * - `hard`: The browser automatically inserts line breaks (`CR+LF`) so that\n * each line is no longer than the width of the control; the `cols` attribute\n * must be specified for this to take effect\n * - `soft`: The browser ensures that all line breaks in the entered value\n * are a `CR+LF` pair, but no additional line breaks are added to the value.\n * - `off`: Like `soft` but changes appearance to `white-space: pre` so line\n * segments exceeding `cols` are not wrapped and the `<qds-textarea>` becomes\n * horizontally scrollable.\n *\n * If this attribute is not specified, `soft` is its default value.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public wrap?: Wrap\n\n /**\n * Emitted when the textarea loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when an alteration to the textarea's value is committed by the\n * user.\n */\n @Event({ eventName: 'qdsChange', cancelable: false })\n private readonly changeEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the textarea gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when the textarea's value changes.\n */\n @Event({ eventName: 'qdsInput', cancelable: false })\n private readonly inputEmitter!: EventEmitter<QdsInputEventDetail>\n\n @Element() private readonly element!: HTMLQdsTextareaElement\n\n private inheritedAttributes: Attributes = {}\n\n private textarea?: HTMLTextAreaElement\n\n private get computedDisabled(): boolean {\n return this.disabled ?? false\n }\n\n /**\n * Returns true if the element's value passes validity checks; otherwise,\n * returns false, fires an invalid event at the element, and (if the event\n * isn't canceled) reports the problem to the user.\n */\n @Method()\n public async reportValidity(): Promise<boolean> {\n invariant(this.textarea)\n\n return this.textarea.reportValidity()\n }\n\n /**\n * Selects the entire content of the `<qds-textarea>` element if the\n * element's content is selectable.\n */\n @Method()\n public async select(): Promise<void> {\n invariant(this.textarea)\n\n this.textarea.select()\n }\n\n /**\n * Sets a custom validity message for the textarea. If this message is not\n * the empty string, then the element is considered invalid.\n */\n @Method()\n public async setCustomValidity(message: string): Promise<void> {\n invariant(this.textarea)\n\n this.textarea.setCustomValidity(message)\n this.invalid = !this.textarea.checkValidity()\n }\n\n /**\n * Sets the contents of the specified range of characters in the textarea\n * element to a given string.\n *\n * @param replacement The string to insert.\n * @param start The 0-based index of the first character to replace. Defaults to the current selectionStart value (the start of the user's current selection).\n * @param end The 0-based index of the character _after_ the last character to replace. Defaults to the current selectionEnd value (the end of the user's current selection).\n * @param selectionMode A string defining how the selection should be set after the text has been replaced. Possible values:\n *\n * - `\"select\"` selects the newly inserted text.\n * - `\"start\"` moves the selection to just before the inserted text.\n * - `\"end\"` moves the selection to just after the inserted text.\n * - `\"preserve\"` attempts to preserve the selection.\n */\n @Method()\n public async setRangeText(\n replacement: string,\n start: number,\n end: number,\n selectionMode: SelectionMode = 'preserve',\n ): Promise<void> {\n invariant(this.textarea)\n\n this.textarea.setRangeText(replacement, start, end, selectionMode)\n\n if (this.value !== this.textarea.value) {\n this.value = this.textarea.value\n this.inputEmitter.emit()\n this.changeEmitter.emit()\n }\n }\n\n /**\n * Selects the specified range of characters within the textarea.\n *\n * @param start The offset into the input for the start of the selection.\n * @param end The offset into the input for the end of the selection.\n * @param direction The direction in which the selection is performed.\n */\n @Method()\n public async setSelectionRange(\n start: number | null,\n end: number | null,\n direction?: SelectDirection,\n ): Promise<void> {\n invariant(this.textarea)\n\n this.textarea.setSelectionRange(start, end, direction)\n }\n\n @Watch('disabled')\n protected disabledChanged(): void {\n invariant(this.textarea)\n\n // Disabled inputs are always valid, so we need to recheck validity when\n // the state changes.\n this.textarea.disabled = this.computedDisabled\n this.invalid = !this.textarea.checkValidity()\n }\n\n @Watch('value')\n protected valueChanged(): void {\n invariant(this.textarea)\n\n this.invalid = !this.textarea.checkValidity()\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 <textarea\n aria-invalid={this.invalid ?? false ? 'true' : 'false'}\n autoCapitalize={this.autoCapitalize}\n autoComplete={this.autoComplete}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.autoFocus}\n class=\"textarea\"\n cols={this.cols}\n data-size={this.size}\n disabled={this.disabled}\n enterKeyHint={this.enterkeyhint}\n form={this.form}\n inputMode={this.inputmode}\n maxLength={this.maxLength}\n minLength={this.minLength}\n name={this.name}\n onBlur={this.onBlur}\n onChange={this.onChange}\n onClick={this.onClick}\n onFocus={this.onFocus}\n onInput={this.onInput}\n onInvalid={this.onInvalid}\n placeholder={this.placeholder}\n readOnly={this.readOnly}\n ref={this.ref}\n required={this.required}\n rows={this.rows}\n spellcheck={this.spellCheck}\n value={this.value ?? undefined}\n wrap={this.wrap}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n />\n )\n }\n\n private readonly ref = (textarea?: HTMLTextAreaElement): void => {\n this.textarea = textarea\n }\n\n private readonly onBlur = (event: FocusEvent): void => {\n this.blurEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onChange = (): void => {\n invariant(this.textarea)\n\n this.value = this.textarea.value\n this.changeEmitter.emit()\n }\n\n private readonly onClick = (event: MouseEvent): void => {\n if (this.computedDisabled) {\n event.preventDefault()\n event.stopPropagation()\n }\n }\n\n private readonly onFocus = (event: FocusEvent): void => {\n this.focusEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onInput = (event: InputEvent): void => {\n invariant(this.textarea)\n\n this.value = this.textarea.value\n this.inputEmitter.emit(pickInputEventAttributes(event))\n }\n\n private readonly onInvalid = (): void => {\n this.invalid = true\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"qds-textarea.entry.cjs.js","mappings":";;;;;;;;;;;;;AAAA,MAAM,WAAW,GAAG,gqCAAgqC,CAAC;AACrrC,0BAAe,WAAW;;ACD1B;AACA;AACA;;;;;;;;;;;;;;;;;;MAgDa,QAAQ;IANrB;;;;;;;;;;;;;;;;;;;;;;QAe0B,SAAI,GAAU,UAAU,CAAA;;;;;;;;;;;;;;;;;;QAoFxB,SAAI,GAAsC,IAAI,CAAA;;;;;;;;;;QAoB9C,WAAM,GAC5B,EAAgC,CAAA;;;;;;;;QAuF3B,uBAAkB,GAA2C,IAAI,CAAA;;;;;;;;QAYjE,iBAAY,GAAqC,IAAI,CAAA;;;;;;;;QAYrD,mBAAc,GAAuC,IAAI,CAAA;;;;;;;;QAUhD,sBAAiB,GAA0C,EAAE,CAAA;;;;;;;;;QAUrD,aAAQ,GAAiCA,oBAAW,CAAA;;;;;;;;QAgBpD,iBAAY,GAAqC,KAAK,CAAA;QAoD9E,wCAAmC,EAAE,EAAA;QAErC,qCAA+B;QAoJxB,kBAAa,GAAsC,MACxD,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAA;QAEzB,mBAAc,GAAuC,MAC1D,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,CAAA;QAE1B,sBAAiB,GAA6C,CACnE,KAAK;YAELC,iBAAS,CAAC,uBAAA,IAAI,0BAAU,CAAC,CAAA;YAEzB,uBAAA,IAAI,0BAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;YACvC,IAAI,KAAK;gBACP,IAAI,CAAC,SAAS,CA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,CAAC,QAAQ,EAC5D,IAAI,EAAE,IAAI,CAAC,IAAI,KAEX,uBAAA,IAAI,qCAAqB,GAC7B,EACFA,mEAAM,YAAY,EAAE,uBAAA,IAAI,8BAAc,GAAI,CACrC,EACR;KACF;;;;;;;;;;;;;;;;;IA/IC,QACE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;QAC3D,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,OAAO,EAC/C;AACH,CAAC;IAGC,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAA;;IAEhE,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAA;AACrD,CAAC,2DAyOa,CAAc,EAAE,GAAkB;IAC9C,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAA;AAChE,CAAC;;;;;","names":["VALID_STATE","invariant","CUSTOM_ERROR_FLAGS","NO_ERROR_FLAGS","pickFocusEventAttributes","pickInputEventAttributes","inheritAriaAttributes","h","Host"],"sources":["src/components/textarea/textarea.css?tag=qds-textarea&encapsulation=shadow","src/components/textarea/textarea.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 resize: both;\n}\n\nslot {\n display: none;\n}\n\n.qds-textarea {\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 box-sizing: border-box;\n color: var(--qds-theme-control-text-standard);\n height: 100%;\n padding-inline: var(--qds-control-input-padding-horizontal);\n resize: inherit;\n width: 100%;\n\n &:disabled {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\n }\n\n &:focus-visible {\n outline: var(--qds-control-input-focus-border-width) solid\n var(--qds-theme-control-input-focus-border);\n }\n\n &:placeholder-shown {\n color: var(--qds-theme-control-text-placeholder);\n }\n\n &:not(:focus):user-invalid {\n border-color: var(--qds-theme-feedback-result-failure);\n }\n}\n\n[data-size='small'] {\n font: var(--qds-control-small-text);\n padding-block: var(--qds-control-small-padding-auto-height);\n}\n\n[data-size='standard'] {\n font: var(--qds-control-standard-text);\n padding-block: var(--qds-control-standard-padding-auto-height);\n}\n\n[data-size='large'] {\n font: var(--qds-control-large-text);\n padding-block: var(--qds-control-large-padding-auto-height);\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 Host,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core'\n\nimport type {\n Attributes,\n QdsFocusEventDetail,\n QdsInputEventDetail,\n} from '../../helpers'\nimport {\n inheritAriaAttributes,\n invariant,\n pickFocusEventAttributes,\n pickInputEventAttributes,\n} from '../../helpers'\nimport type { EnterKeyHint, InputMode, Value } from '../controls'\nimport { CUSTOM_ERROR_FLAGS, NO_ERROR_FLAGS, VALID_STATE } from '../controls'\nimport type { Size } from '../shared'\n\nexport type TextAreaAutoComplete = 'off' | 'on'\n// TODO: `hard` value isn't supported by Firefox or Safari\nexport type Wrap = 'off' | 'soft'\n\n/**\n * The `<qds-textarea>` element represents a multi-line plain-text editing\n * control, useful when you want to allow users to enter a sizeable amount of\n * free-form text, for example a comment on a review or feedback form.\n *\n * @see https://quartz.se.com/build/components/textarea\n */\n@Component({\n tag: 'qds-textarea',\n formAssociated: true,\n shadow: { delegatesFocus: true },\n styleUrl: 'textarea.css',\n})\nexport class TextArea implements ComponentInterface {\n /**\n * The textarea's size.\n *\n * > **_NOTE:_** The native [`size` HTML attribute][] is not supported. CSS\n * `width` should be used instead if this functionality is needed.\n *\n * [`size` HTML attribute]: https://developer.mozilla.org/docs/Web/HTML/Attributes/size\n */\n @Prop() public readonly size?: Size = 'standard'\n\n /**\n * Indicates whether the value of the textarea can be automatically completed\n * by the browser. Possible values:\n *\n * `off`: The user must explicitly enter a value into this field for every\n * use, or the document provides its own auto-completion method; the browser\n * does not automatically complete the entry.\n * `on`: The browser can automatically complete the value based on values\n * that the user has entered during previous uses.\n *\n * If the `autocomplete` attribute is not specified on a `<qds-textarea>`\n * element, then the browser uses the `autocomplete` attribute value of the\n * `<qds-textarea>` element's form owner. The form owner is either the\n * [`<form>`][] element that this `<qds-textarea>` element is a descendant of\n * or the form element whose `id` is specified by the `form` attribute of the\n * `qds-textarea` element. For more information, see the [`autocomplete`]\n * attribute in [`<form>`][].\n *\n * [`<form>`]: https://developer.mozilla.org/docs/Web/HTML/Element/form\n * [`autocomplete`]: https://developer.mozilla.org/docs/Web/HTML/Element/form#autocomplete\n *\n * @webnative\n */\n @Prop({ attribute: 'autocomplete' })\n public readonly autoComplete?: TextAreaAutoComplete\n\n /**\n * The visible width of the text control, in average character widths. If it\n * is specified, it must be a positive integer. If it is not specified, the\n * default value is `20`.\n *\n * @webnative\n */\n @Prop() public readonly cols?: number\n\n /**\n * Prevents the textarea from being interacted with: it cannot be pressed or\n * focused.\n *\n * @webnative\n */\n @Prop() public disabled?: boolean\n\n /**\n * What action label (or icon) to present for the enter key on virtual\n * keyboards. Possible values:\n *\n * - `\"done\"`: Typically meaning there is nothing more to input and the input\n * method editor (IME) will be closed.\n * - `\"enter\"`:\tTypically inserting a new line.\n * - `\"go\"`: \tTypically meaning to take the user to the target of the text\n * they typed.\n * - `\"next\"`: \tTypically taking the user to the next field that will accept\n * text.\n * - `\"previous\"`: Typically taking the user to the previous field that will\n * accept text.\n * - `\"search\"`: Typically taking the user to the results of searching for\n * the text they have typed.\n * - `\"send\"`: Typically delivering the text to its target.\n *\n * @webnative\n */\n // FIXME: Can't use `attribute` option here to name this `enterKeyHint` instead.\n @Prop() public readonly enterkeyhint?: EnterKeyHint\n\n /**\n * The [`<form>`][] element to associate the input with (its form owner).\n *\n * The value of this attribute must be the id of a `<form>` in the same\n * document. If this attribute is not set, the `<qds-textarea>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This attribute lets you associate `<qds-textarea>` elements to `<form>`s\n * anywhere in the document, not just inside a `<form>`. It can also override\n * an ancestor `<form>` element.\n *\n * [`<form>`]: https://developer.mozilla.org/docs/Web/HTML/Element/form\n *\n * @readonly\n * @webnative\n */\n // eslint-disable-next-line unicorn/no-null\n @Prop() public readonly form: ElementInternals['form'] | string = null\n\n /**\n * Provide a hint to browsers as to the type of virtual keyboard\n * configuration to use when editing this element or its contents.\n *\n * @webnative\n */\n // FIXME: Can't use `attribute` option here to name this `inputMode` instead.\n @Prop() public readonly inputmode?: InputMode\n\n /**\n * Returns a list of the [`<label>`][] elements associated with the\n * `qds-textarea` element.\n *\n * [`<label>`]: https://developer.mozilla.org/docs/Web/HTML/Element/label\n *\n * @readonly\n * @webnative\n */\n @Prop() public readonly labels: ElementInternals['labels'] =\n {} as ElementInternals['labels']\n\n /**\n * The maximum number of characters (as UTF-16 code units) the user can enter\n * into the textarea. This must be an non-negative integer value. If no\n * `maxlength` is specified, or an invalid value is specified, the textarea\n * has no maximum length.\n *\n * The textarea will fail [constraint validation][] if the length of the text\n * entered into the field is greater than `maxlength` UTF-16 code units long.\n * By default, browsers prevent users from entering more characters than\n * allowed by the `maxlength` attribute. See [Client-side validation][] for\n * more information.\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n * [Client-side validation]: https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation\n *\n * @webnative\n */\n @Prop({ attribute: 'maxlength' }) public readonly maxLength?: number\n\n /**\n * The minimum number of characters (as UTF-16 code units) the user can enter\n * into the textarea. This must be an non-negative integer value smaller than\n * or equal to the value specified by `maxlength`. If no `minlength` is\n * specified, or an invalid value is specified, the textarea has no minimum\n * length.\n *\n * The textarea will fail [constraint validation][] if the length of the text\n * entered into the field is fewer than `minlength` UTF-16 code units long,\n * preventing form submission. See [Client-side validation][] for more\n * information.\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n * [Client-side validation]: https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation\n *\n * @webnative\n */\n @Prop({ attribute: 'minlength' }) public readonly minLength?: number\n\n /**\n * The name of the textarea, which is submitted with the form data.\n *\n * @webnative\n */\n @Prop() public readonly name?: string\n\n /**\n * Text that appears in the textarea when it has no value set.\n *\n * @webnative\n */\n @Prop() public readonly placeholder?: string\n\n /**\n * A value must be specified for the textarea before the owning form can be\n * submitted.\n *\n * See [Client-side validation][] and the [HTML attribute: `required`][] for\n * more information.\n *\n * [Client-side validation]: https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation\n * [HTML attribute: `required`]: https://developer.mozilla.org/docs/Web/HTML/Attributes/required\n *\n * @webnative\n */\n @Prop() public readonly required?: boolean\n\n /**\n * The number of visible text lines for the control. If it is specified, it\n * must be a positive integer. If it is not specified, the default value is\n * `2`.\n *\n * @webnative\n */\n @Prop() public readonly rows?: number\n\n /**\n * Get or set the selection direction of a text selection.\n *\n * > **_NOTE:_** This property has no effect when used as an attribute.\n *\n * @webnative\n */\n @Prop({ mutable: true })\n // FIXME: Use `HTMLTextAreaElement['selectionDirection']` instead.\n // eslint-disable-next-line unicorn/no-null\n public selectionDirection: HTMLInputElement['selectionDirection'] = null\n\n /**\n * Get or set the ending position or offset of a text selection.\n *\n * > **_NOTE:_** This property has no effect when used as an attribute.\n *\n * @webnative\n */\n @Prop({ mutable: true })\n // FIXME: Use `HTMLTextAreaElement['selectionEnd']` instead.\n // eslint-disable-next-line unicorn/no-null\n public selectionEnd: HTMLInputElement['selectionEnd'] = null\n\n /**\n * Get or set the starting position or offset of a text selection.\n *\n * > **_NOTE:_** This property has no effect when used as an attribute.\n *\n * @webnative\n */\n @Prop({ mutable: true })\n // FIXME: Use `HTMLTextAreaElement['selectionStart']` instead.\n // eslint-disable-next-line unicorn/no-null\n public selectionStart: HTMLInputElement['selectionStart'] = null\n\n /**\n * The error message that would be shown to the user if the `<qds-select>`\n * was to be checked for validity.\n *\n * @readonly\n * @webnative\n */\n @Prop()\n public readonly validationMessage: ElementInternals['validationMessage'] = ''\n\n /**\n * The [`ValidityState`][] object for this `<qds-select>`.\n *\n * [`ValidityState`]: https://developer.mozilla.org/docs/Web/API/ValidityState\n *\n * @readonly\n * @webnative\n */\n @Prop() public readonly validity: ElementInternals['validity'] = VALID_STATE\n\n /**\n * The value of the textarea.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public value?: Value\n\n /**\n * True if `<qds-textarea>` will be validated when the form is submitted;\n * false otherwise.\n *\n * @readonly\n * @webnative\n */\n @Prop() public readonly willValidate: ElementInternals['willValidate'] = false\n\n /**\n * Indicates how the control should wrap the value for form submission.\n * Possible values are:\n *\n * - `hard`: The browser automatically inserts line breaks (`CR+LF`) so that\n * each line is no longer than the width of the control; the `cols` attribute\n * must be specified for this to take effect\n * - `soft`: The browser ensures that all line breaks in the entered value\n * are a `CR+LF` pair, but no additional line breaks are added to the value.\n * - `off`: Like `soft` but changes appearance to `white-space: pre` so line\n * segments exceeding `cols` are not wrapped and the `<qds-textarea>` becomes\n * horizontally scrollable.\n *\n * If this attribute is not specified, `soft` is its default value.\n *\n * @webnative\n */\n @Prop() public readonly wrap?: Wrap\n\n @AttachInternals() private readonly internals!: ElementInternals\n\n /**\n * Emitted when the textarea loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when an alteration to the textarea's value is committed by the\n * user.\n */\n @Event({ eventName: 'qdsChange', cancelable: false })\n private readonly changeEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the textarea gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when the textarea's value changes.\n */\n @Event({ eventName: 'qdsInput', cancelable: false })\n private readonly inputEmitter!: EventEmitter<QdsInputEventDetail>\n\n @Element() private readonly host!: HTMLElement\n\n @State() private tabIndex?: number\n\n #inheritedAttributes: Attributes = {}\n\n #textarea?: HTMLTextAreaElement\n\n get #computedDisabled(): boolean {\n return (\n (this.host.matches(':disabled') || (this.disabled ?? false)) &&\n this.host.getAttribute('disabled') !== 'false'\n )\n }\n\n get #computedValue(): Parameters<ElementInternals['setFormValue']>[0] {\n if (typeof this.value === 'number') return this.value.toString()\n // eslint-disable-next-line unicorn/no-null\n return this.value === undefined ? null : this.value\n }\n\n @Listen('click')\n protected onClick(event: MouseEvent): void {\n if (this.#computedDisabled) event.stopImmediatePropagation()\n }\n\n @Watch('disabled')\n protected disabledChanged(): void {\n if (this.#computedDisabled)\n // eslint-disable-next-line unicorn/no-null\n this.internals.setFormValue(null)\n else this.internals.setFormValue(this.#computedValue)\n }\n\n @Watch('selectionDirection')\n protected selectionDirectionChanged(): void {\n invariant(this.#textarea)\n\n // @ts-expect-error: `null` is a valid value according to the HTML spec.\n this.#textarea.selectionDirection = this.selectionDirection\n }\n\n @Watch('selectionEnd')\n protected selectionEndChanged(): void {\n invariant(this.#textarea)\n\n // @ts-expect-error: `null` is a valid value according to the HTML spec.\n this.#textarea.selectionEnd = this.selectionEnd\n }\n\n @Watch('selectionStart')\n protected selectionStartChanged(): void {\n invariant(this.#textarea)\n\n // @ts-expect-error: `null` is a valid value according to the HTML spec.\n this.#textarea.selectionStart = this.selectionStart\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('maxLength')\n @Watch('minLength')\n @Watch('required')\n @Watch('value')\n protected validationChanged(): void {\n invariant(this.#textarea)\n\n if (this.maxLength !== undefined) this.#textarea.maxLength = this.maxLength\n if (this.minLength !== undefined) this.#textarea.minLength = this.minLength\n this.#textarea.required = this.required ?? false\n // eslint-disable-next-line unicorn/no-null\n if (this.value != null) this.#textarea.value = this.value.toString()\n\n const { valid } = this.#textarea.validity\n if (valid)\n this.internals.setValidity(NO_ERROR_FLAGS, undefined, this.#textarea)\n else\n this.internals.setValidity(\n this.#textarea.validity,\n this.#textarea.validationMessage,\n this.#textarea,\n )\n }\n\n @Watch('value')\n protected valueChanged(): void {\n if (!this.#computedDisabled)\n this.internals.setFormValue(this.#computedValue)\n }\n\n public componentWillLoad(): void {\n this.#defineGetter('form', () => this.internals.form)\n this.#defineGetter('willValidate', () => this.internals.willValidate)\n this.#defineGetter('validity', () => this.internals.validity)\n this.#defineGetter(\n 'validationMessage',\n () => this.internals.validationMessage,\n )\n this.#defineGetter('labels', () => this.internals.labels)\n\n this.#defineGetter('selectionDirection', this.#getSelectionDirection)\n this.#defineGetter('selectionStart', this.#getSelectionStart)\n this.#defineGetter('selectionEnd', this.#getSelectionEnd)\n\n this.#inheritedAttributes = inheritAriaAttributes(this.host)\n this.tabindexChanged(this.host.getAttribute('tabindex') ?? '0')\n }\n\n public componentDidLoad(): void {\n invariant(this.#textarea)\n\n this.validationChanged()\n this.valueChanged()\n }\n\n public render() {\n return (\n <Host>\n <textarea\n autoCapitalize={this.host.autocapitalize}\n autoComplete={this.autoComplete}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.host.autofocus}\n class=\"qds-textarea\"\n cols={this.cols}\n data-size={this.size ?? 'standard'}\n disabled={this.disabled}\n enterKeyHint={this.enterkeyhint}\n inputMode={this.inputmode}\n maxLength={this.maxLength}\n minLength={this.minLength}\n onBlur={this.#onBlur}\n onChange={this.#onChange}\n onFocus={this.#onFocus}\n onInput={this.#onInput}\n placeholder={this.placeholder}\n ref={this.#ref}\n rows={this.rows}\n spellcheck={this.host.spellcheck}\n tabIndex={this.#computedDisabled ? undefined : this.tabIndex}\n wrap={this.wrap}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.#inheritedAttributes}\n />\n <slot onSlotchange={this.#onSlotchange} />\n </Host>\n )\n }\n\n public checkValidity: ElementInternals['checkValidity'] = () =>\n this.internals.checkValidity()\n\n public reportValidity: ElementInternals['reportValidity'] = () =>\n this.internals.reportValidity()\n\n public setCustomValidity: HTMLTextAreaElement['setCustomValidity'] = (\n error,\n ) => {\n invariant(this.#textarea)\n\n this.#textarea.setCustomValidity(error)\n if (error)\n this.internals.setValidity(CUSTOM_ERROR_FLAGS, error, this.#textarea)\n else this.internals.setValidity(NO_ERROR_FLAGS)\n }\n\n public select: HTMLTextAreaElement['select'] = () => {\n invariant(this.#textarea)\n\n this.#textarea.select()\n }\n\n public setRangeText = (\n replacement: string,\n start: number,\n end: number,\n selectionMode?: SelectionMode,\n ): void => {\n invariant(this.#textarea)\n\n this.#textarea.setRangeText(replacement, start, end, selectionMode)\n\n if (this.value !== this.#textarea.value) {\n this.value = this.#textarea.value\n this.inputEmitter.emit()\n this.changeEmitter.emit()\n }\n }\n\n public setSelectionRange: HTMLTextAreaElement['setSelectionRange'] = (\n start,\n end,\n direction,\n ) => {\n invariant(this.#textarea)\n\n this.#textarea.setSelectionRange(start, end, direction)\n }\n\n readonly #getSelectionDirection: () => HTMLTextAreaElement['selectionDirection'] =\n () => {\n invariant(this.#textarea)\n\n return this.#textarea.selectionDirection\n }\n\n readonly #getSelectionStart: () => HTMLTextAreaElement['selectionStart'] =\n () => {\n invariant(this.#textarea)\n\n return this.#textarea.selectionStart\n }\n\n readonly #getSelectionEnd: () => HTMLTextAreaElement['selectionEnd'] = () => {\n invariant(this.#textarea)\n\n return this.#textarea.selectionEnd\n }\n\n readonly #ref = (textarea?: HTMLTextAreaElement): void => {\n this.#textarea = textarea\n }\n\n readonly #onBlur = (event: FocusEvent): void => {\n this.blurEmitter.emit(pickFocusEventAttributes(event))\n }\n\n readonly #onChange = (): void => {\n this.changeEmitter.emit()\n }\n\n readonly #onFocus = (event: FocusEvent): void => {\n this.focusEmitter.emit(pickFocusEventAttributes(event))\n }\n\n readonly #onInput = (event: InputEvent): void => {\n invariant(this.#textarea)\n\n this.value = this.#textarea.value\n this.inputEmitter.emit(pickInputEventAttributes(event))\n }\n\n readonly #onSlotchange = (): void => {\n invariant(this.#textarea)\n this.#textarea.innerHTML = this.host.innerHTML\n }\n\n #defineGetter(p: PropertyKey, get: () => unknown): void {\n Object.defineProperty(this.host, p, { enumerable: true, get })\n }\n}\n"],"version":3}
|