@quartzds/core 1.0.0-beta.81 → 1.0.0-beta.83

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.
Files changed (264) hide show
  1. package/components/index.js +2 -2
  2. package/components/{p-7b04d43e.js → p-002e77af.js} +656 -328
  3. package/components/p-002e77af.js.map +1 -0
  4. package/components/{p-9df62f97.js → p-065d722e.js} +18 -7
  5. package/components/{p-9df62f97.js.map → p-065d722e.js.map} +1 -1
  6. package/components/{p-7f6e797a.js → p-252b0946.js} +17 -12
  7. package/components/p-252b0946.js.map +1 -0
  8. package/components/{p-d279ae53.js → p-2e88c3cc.js} +11 -3
  9. package/components/p-2e88c3cc.js.map +1 -0
  10. package/components/{p-698edde1.js → p-786e2b51.js} +79 -44
  11. package/components/p-786e2b51.js.map +1 -0
  12. package/components/{p-b82bac0a.js → p-84aae53b.js} +20 -11
  13. package/components/p-84aae53b.js.map +1 -0
  14. package/components/{p-028b9d2e.js → p-86a0fdf3.js} +11 -4
  15. package/components/p-86a0fdf3.js.map +1 -0
  16. package/components/{p-82461767.js → p-9a9561a8.js} +8 -80
  17. package/components/p-9a9561a8.js.map +1 -0
  18. package/components/{p-f5ba28ff.js → p-ae6eda4e.js} +41 -30
  19. package/components/p-ae6eda4e.js.map +1 -0
  20. package/components/{p-f85b490c.js → p-ed500f42.js} +72 -28
  21. package/components/p-ed500f42.js.map +1 -0
  22. package/components/{p-355efdb1.js → p-ee2621aa.js} +11 -5
  23. package/components/p-ee2621aa.js.map +1 -0
  24. package/components/{p-4141d6ed.js → p-efdb8fa2.js} +2 -2
  25. package/components/p-efdb8fa2.js.map +1 -0
  26. package/components/qds-badge-counter.js +1 -1
  27. package/components/qds-badge-indicator.js +1 -1
  28. package/components/qds-breadcrumb-item.js +65 -15
  29. package/components/qds-breadcrumb-item.js.map +1 -1
  30. package/components/qds-button.js +1 -1
  31. package/components/qds-checkbox.js +1 -1
  32. package/components/qds-chip.js +46 -25
  33. package/components/qds-chip.js.map +1 -1
  34. package/components/qds-dialog.js +9 -4
  35. package/components/qds-dialog.js.map +1 -1
  36. package/components/qds-divider.js +1 -1
  37. package/components/qds-dropdown.js +25 -18
  38. package/components/qds-dropdown.js.map +1 -1
  39. package/components/qds-form-message.js +18 -8
  40. package/components/qds-form-message.js.map +1 -1
  41. package/components/qds-icon.js +1 -1
  42. package/components/qds-inline-link.js +18 -17
  43. package/components/qds-inline-link.js.map +1 -1
  44. package/components/qds-input.js +117 -54
  45. package/components/qds-input.js.map +1 -1
  46. package/components/qds-label.js +1 -1
  47. package/components/qds-list-item.js +21 -22
  48. package/components/qds-list-item.js.map +1 -1
  49. package/components/qds-loader.js +5 -3
  50. package/components/qds-loader.js.map +1 -1
  51. package/components/qds-nav-list-item.js +32 -16
  52. package/components/qds-nav-list-item.js.map +1 -1
  53. package/components/qds-progress-bar.js +25 -7
  54. package/components/qds-progress-bar.js.map +1 -1
  55. package/components/qds-radio.js +25 -24
  56. package/components/qds-radio.js.map +1 -1
  57. package/components/qds-select.js +119 -31
  58. package/components/qds-select.js.map +1 -1
  59. package/components/qds-standalone-link.js +26 -19
  60. package/components/qds-standalone-link.js.map +1 -1
  61. package/components/qds-switch.js +70 -21
  62. package/components/qds-switch.js.map +1 -1
  63. package/components/qds-tab.js +71 -45
  64. package/components/qds-tab.js.map +1 -1
  65. package/components/qds-tabbar.js +34 -27
  66. package/components/qds-tabbar.js.map +1 -1
  67. package/components/qds-table-body.js +3 -3
  68. package/components/qds-table-body.js.map +1 -1
  69. package/components/qds-table-cell.js +3 -5
  70. package/components/qds-table-cell.js.map +1 -1
  71. package/components/qds-table-head-cell.js +3 -7
  72. package/components/qds-table-head-cell.js.map +1 -1
  73. package/components/qds-table-head.js +3 -3
  74. package/components/qds-table-head.js.map +1 -1
  75. package/components/qds-table-row.js +3 -3
  76. package/components/qds-table-row.js.map +1 -1
  77. package/components/qds-table.js +3 -3
  78. package/components/qds-table.js.map +1 -1
  79. package/components/qds-tag.js +1 -1
  80. package/components/qds-textarea.js +94 -39
  81. package/components/qds-textarea.js.map +1 -1
  82. package/components/qds-title.js +1 -1
  83. package/components/qds-tooltip.js +1 -1
  84. package/dist/cjs/helpers-cdd65bd0.js.map +1 -1
  85. package/dist/cjs/{index-a9985af0.js → index-644fe556.js} +720 -273
  86. package/dist/cjs/index-644fe556.js.map +1 -0
  87. package/dist/cjs/index.cjs.js +2 -2
  88. package/dist/cjs/{library-57845012.js → library-1fda56bc.js} +2 -2
  89. package/dist/cjs/{library-57845012.js.map → library-1fda56bc.js.map} +1 -1
  90. package/dist/cjs/loader.cjs.js +2 -2
  91. package/dist/cjs/qds-badge-counter_2.cjs.entry.js +151 -0
  92. package/dist/cjs/qds-badge-counter_2.cjs.entry.js.map +1 -0
  93. package/dist/cjs/qds-breadcrumb-item.cjs.entry.js +53 -12
  94. package/dist/cjs/qds-breadcrumb-item.cjs.entry.js.map +1 -1
  95. package/dist/cjs/qds-button.cjs.entry.js +73 -38
  96. package/dist/cjs/qds-button.cjs.entry.js.map +1 -1
  97. package/dist/cjs/qds-checkbox.cjs.entry.js +67 -22
  98. package/dist/cjs/qds-checkbox.cjs.entry.js.map +1 -1
  99. package/dist/cjs/qds-chip.cjs.entry.js +43 -21
  100. package/dist/cjs/qds-chip.cjs.entry.js.map +1 -1
  101. package/dist/cjs/qds-dialog.cjs.entry.js +8 -3
  102. package/dist/cjs/qds-dialog.cjs.entry.js.map +1 -1
  103. package/dist/cjs/qds-divider.cjs.entry.js +9 -3
  104. package/dist/cjs/qds-divider.cjs.entry.js.map +1 -1
  105. package/dist/cjs/qds-dropdown.cjs.entry.js +24 -17
  106. package/dist/cjs/qds-dropdown.cjs.entry.js.map +1 -1
  107. package/dist/cjs/qds-form-message.cjs.entry.js +16 -6
  108. package/dist/cjs/qds-form-message.cjs.entry.js.map +1 -1
  109. package/dist/cjs/qds-icon.cjs.entry.js +7 -5
  110. package/dist/cjs/qds-icon.cjs.entry.js.map +1 -1
  111. package/dist/cjs/qds-inline-link.cjs.entry.js +16 -15
  112. package/dist/cjs/qds-inline-link.cjs.entry.js.map +1 -1
  113. package/dist/cjs/qds-input.cjs.entry.js +110 -43
  114. package/dist/cjs/qds-input.cjs.entry.js.map +1 -1
  115. package/dist/cjs/qds-label.cjs.entry.js +16 -5
  116. package/dist/cjs/qds-label.cjs.entry.js.map +1 -1
  117. package/dist/cjs/qds-list-item.cjs.entry.js +17 -18
  118. package/dist/cjs/qds-list-item.cjs.entry.js.map +1 -1
  119. package/dist/cjs/qds-loader.cjs.entry.js +4 -2
  120. package/dist/cjs/qds-loader.cjs.entry.js.map +1 -1
  121. package/dist/cjs/qds-nav-list-item.cjs.entry.js +29 -13
  122. package/dist/cjs/qds-nav-list-item.cjs.entry.js.map +1 -1
  123. package/dist/cjs/qds-progress-bar.cjs.entry.js +25 -7
  124. package/dist/cjs/qds-progress-bar.cjs.entry.js.map +1 -1
  125. package/dist/cjs/qds-radio.cjs.entry.js +22 -21
  126. package/dist/cjs/qds-radio.cjs.entry.js.map +1 -1
  127. package/dist/cjs/qds-select.cjs.entry.js +116 -26
  128. package/dist/cjs/qds-select.cjs.entry.js.map +1 -1
  129. package/dist/cjs/qds-standalone-link.cjs.entry.js +24 -17
  130. package/dist/cjs/qds-standalone-link.cjs.entry.js.map +1 -1
  131. package/dist/cjs/qds-switch.cjs.entry.js +68 -18
  132. package/dist/cjs/qds-switch.cjs.entry.js.map +1 -1
  133. package/dist/cjs/qds-tab.cjs.entry.js +64 -38
  134. package/dist/cjs/qds-tab.cjs.entry.js.map +1 -1
  135. package/dist/cjs/qds-tabbar.cjs.entry.js +27 -20
  136. package/dist/cjs/qds-tabbar.cjs.entry.js.map +1 -1
  137. package/dist/cjs/qds-table-body.cjs.entry.js +2 -2
  138. package/dist/cjs/qds-table-body.cjs.entry.js.map +1 -1
  139. package/dist/cjs/qds-table-cell.cjs.entry.js +2 -4
  140. package/dist/cjs/qds-table-cell.cjs.entry.js.map +1 -1
  141. package/dist/cjs/qds-table-head-cell.cjs.entry.js +2 -6
  142. package/dist/cjs/qds-table-head-cell.cjs.entry.js.map +1 -1
  143. package/dist/cjs/qds-table-head.cjs.entry.js +2 -2
  144. package/dist/cjs/qds-table-head.cjs.entry.js.map +1 -1
  145. package/dist/cjs/qds-table-row.cjs.entry.js +2 -2
  146. package/dist/cjs/qds-table-row.cjs.entry.js.map +1 -1
  147. package/dist/cjs/qds-table.cjs.entry.js +2 -2
  148. package/dist/cjs/qds-table.cjs.entry.js.map +1 -1
  149. package/dist/cjs/qds-tag_2.cjs.entry.js +30 -16
  150. package/dist/cjs/qds-tag_2.cjs.entry.js.map +1 -1
  151. package/dist/cjs/qds-textarea.cjs.entry.js +92 -33
  152. package/dist/cjs/qds-textarea.cjs.entry.js.map +1 -1
  153. package/dist/cjs/{qds-badge-counter_3.cjs.entry.js → qds-tooltip.cjs.entry.js} +40 -152
  154. package/dist/cjs/qds-tooltip.cjs.entry.js.map +1 -0
  155. package/dist/cjs/qds.cjs.js +3 -3
  156. package/dist/cjs/qds.cjs.js.map +1 -1
  157. package/dist/custom-elements.json +103 -229
  158. package/dist/docs.d.ts +8 -0
  159. package/dist/docs.json +870 -630
  160. package/dist/esm/{helpers-4eb4fa44.js → helpers-d08540f8.js} +2 -2
  161. package/dist/esm/helpers-d08540f8.js.map +1 -0
  162. package/dist/esm/{index-5291e8ff.js → index-be1284b6.js} +720 -273
  163. package/dist/esm/index-be1284b6.js.map +1 -0
  164. package/dist/esm/index.js +2 -2
  165. package/dist/esm/{library-9edbe354.js → library-a92b7d9e.js} +2 -2
  166. package/dist/esm/{library-9edbe354.js.map → library-a92b7d9e.js.map} +1 -1
  167. package/dist/esm/loader.js +3 -3
  168. package/dist/esm/qds-badge-counter_2.entry.js +146 -0
  169. package/dist/esm/qds-badge-counter_2.entry.js.map +1 -0
  170. package/dist/esm/qds-breadcrumb-item.entry.js +54 -13
  171. package/dist/esm/qds-breadcrumb-item.entry.js.map +1 -1
  172. package/dist/esm/qds-button.entry.js +74 -39
  173. package/dist/esm/qds-button.entry.js.map +1 -1
  174. package/dist/esm/qds-checkbox.entry.js +69 -24
  175. package/dist/esm/qds-checkbox.entry.js.map +1 -1
  176. package/dist/esm/qds-chip.entry.js +44 -22
  177. package/dist/esm/qds-chip.entry.js.map +1 -1
  178. package/dist/esm/qds-dialog.entry.js +9 -4
  179. package/dist/esm/qds-dialog.entry.js.map +1 -1
  180. package/dist/esm/qds-divider.entry.js +10 -4
  181. package/dist/esm/qds-divider.entry.js.map +1 -1
  182. package/dist/esm/qds-dropdown.entry.js +25 -18
  183. package/dist/esm/qds-dropdown.entry.js.map +1 -1
  184. package/dist/esm/qds-form-message.entry.js +17 -7
  185. package/dist/esm/qds-form-message.entry.js.map +1 -1
  186. package/dist/esm/qds-icon.entry.js +8 -6
  187. package/dist/esm/qds-icon.entry.js.map +1 -1
  188. package/dist/esm/qds-inline-link.entry.js +17 -16
  189. package/dist/esm/qds-inline-link.entry.js.map +1 -1
  190. package/dist/esm/qds-input.entry.js +112 -45
  191. package/dist/esm/qds-input.entry.js.map +1 -1
  192. package/dist/esm/qds-label.entry.js +17 -6
  193. package/dist/esm/qds-label.entry.js.map +1 -1
  194. package/dist/esm/qds-list-item.entry.js +18 -19
  195. package/dist/esm/qds-list-item.entry.js.map +1 -1
  196. package/dist/esm/qds-loader.entry.js +4 -2
  197. package/dist/esm/qds-loader.entry.js.map +1 -1
  198. package/dist/esm/qds-nav-list-item.entry.js +30 -14
  199. package/dist/esm/qds-nav-list-item.entry.js.map +1 -1
  200. package/dist/esm/qds-progress-bar.entry.js +25 -7
  201. package/dist/esm/qds-progress-bar.entry.js.map +1 -1
  202. package/dist/esm/qds-radio.entry.js +23 -22
  203. package/dist/esm/qds-radio.entry.js.map +1 -1
  204. package/dist/esm/qds-select.entry.js +118 -28
  205. package/dist/esm/qds-select.entry.js.map +1 -1
  206. package/dist/esm/qds-standalone-link.entry.js +25 -18
  207. package/dist/esm/qds-standalone-link.entry.js.map +1 -1
  208. package/dist/esm/qds-switch.entry.js +70 -20
  209. package/dist/esm/qds-switch.entry.js.map +1 -1
  210. package/dist/esm/qds-tab.entry.js +65 -39
  211. package/dist/esm/qds-tab.entry.js.map +1 -1
  212. package/dist/esm/qds-tabbar.entry.js +28 -21
  213. package/dist/esm/qds-tabbar.entry.js.map +1 -1
  214. package/dist/esm/qds-table-body.entry.js +3 -3
  215. package/dist/esm/qds-table-body.entry.js.map +1 -1
  216. package/dist/esm/qds-table-cell.entry.js +3 -5
  217. package/dist/esm/qds-table-cell.entry.js.map +1 -1
  218. package/dist/esm/qds-table-head-cell.entry.js +3 -7
  219. package/dist/esm/qds-table-head-cell.entry.js.map +1 -1
  220. package/dist/esm/qds-table-head.entry.js +3 -3
  221. package/dist/esm/qds-table-head.entry.js.map +1 -1
  222. package/dist/esm/qds-table-row.entry.js +3 -3
  223. package/dist/esm/qds-table-row.entry.js.map +1 -1
  224. package/dist/esm/qds-table.entry.js +3 -3
  225. package/dist/esm/qds-table.entry.js.map +1 -1
  226. package/dist/esm/qds-tag_2.entry.js +31 -17
  227. package/dist/esm/qds-tag_2.entry.js.map +1 -1
  228. package/dist/esm/qds-textarea.entry.js +94 -35
  229. package/dist/esm/qds-textarea.entry.js.map +1 -1
  230. package/dist/esm/{qds-badge-counter_3.entry.js → qds-tooltip.entry.js} +42 -152
  231. package/dist/esm/qds-tooltip.entry.js.map +1 -0
  232. package/dist/esm/qds.js +4 -4
  233. package/dist/esm/qds.js.map +1 -1
  234. package/dist/types/components/breadcrumb-item/breadcrumb-item.d.ts +4 -0
  235. package/dist/types/components/checkbox/checkbox.d.ts +0 -6
  236. package/dist/types/components/chip/chip.d.ts +0 -6
  237. package/dist/types/components/input/input.d.ts +1 -30
  238. package/dist/types/components/select/select.d.ts +1 -8
  239. package/dist/types/components/switch/switch.d.ts +0 -6
  240. package/dist/types/components/tag/tag.d.ts +1 -1
  241. package/dist/types/components/textarea/textarea.d.ts +1 -29
  242. package/dist/types/components.d.ts +623 -91
  243. package/dist/types/stencil-public-runtime.d.ts +6 -0
  244. package/dist/vscode.html-custom-data.json +0 -80
  245. package/hydrate/index.d.ts +28 -5
  246. package/hydrate/index.js +2753 -1052
  247. package/hydrate/index.mjs +2753 -1052
  248. package/package.json +3 -3
  249. package/components/p-028b9d2e.js.map +0 -1
  250. package/components/p-355efdb1.js.map +0 -1
  251. package/components/p-4141d6ed.js.map +0 -1
  252. package/components/p-698edde1.js.map +0 -1
  253. package/components/p-7b04d43e.js.map +0 -1
  254. package/components/p-7f6e797a.js.map +0 -1
  255. package/components/p-82461767.js.map +0 -1
  256. package/components/p-b82bac0a.js.map +0 -1
  257. package/components/p-d279ae53.js.map +0 -1
  258. package/components/p-f5ba28ff.js.map +0 -1
  259. package/components/p-f85b490c.js.map +0 -1
  260. package/dist/cjs/index-a9985af0.js.map +0 -1
  261. package/dist/cjs/qds-badge-counter_3.cjs.entry.js.map +0 -1
  262. package/dist/esm/helpers-4eb4fa44.js.map +0 -1
  263. package/dist/esm/index-5291e8ff.js.map +0 -1
  264. package/dist/esm/qds-badge-counter_3.entry.js.map +0 -1
@@ -3,11 +3,11 @@
3
3
  *
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-7b04d43e.js';
7
- import { b as invariant, p as pickFocusEventAttributes, h as pickInputEventAttributes, i as inheritAriaAttributes } from './p-4141d6ed.js';
8
- import { C as CUSTOM_ERROR_FLAGS, N as NO_ERROR_FLAGS, V as VALID_STATE } from './p-d107c90c.js';
6
+ import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-002e77af.js';
7
+ import { c as invariant, p as pickFocusEventAttributes, h as pickInputEventAttributes, i as inheritAriaAttributes } from './p-efdb8fa2.js';
8
+ import { V as VALID_STATE, C as CUSTOM_ERROR_FLAGS, N as NO_ERROR_FLAGS } from './p-d107c90c.js';
9
9
 
10
- 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[aria-invalid=true]:not(:focus){border-color:var(--qds-theme-feedback-result-failure)}.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)}[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)}";
10
+ 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)}";
11
11
  const QdsTextareaStyle0 = textareaCss;
12
12
 
13
13
  // SPDX-FileCopyrightText: © 2024 Schneider Electric
@@ -41,16 +41,103 @@ const TextArea = /*@__PURE__*/ proxyCustomElement(class TextArea extends H {
41
41
  this.inputEmitter = createEvent(this, "qdsInput", 6);
42
42
  this.internals = this.attachInternals();
43
43
  _TextArea_instances.add(this);
44
+ /**
45
+ * The textarea's size.
46
+ *
47
+ * > **_NOTE:_** The native [`size` HTML attribute][] is not supported. CSS
48
+ * `width` should be used instead if this functionality is needed.
49
+ *
50
+ * [`size` HTML attribute]: https://developer.mozilla.org/docs/Web/HTML/Attributes/size
51
+ */
52
+ this.size = 'standard';
53
+ /**
54
+ * The [`<form>`][] element to associate the input with (its form owner).
55
+ *
56
+ * The value of this attribute must be the id of a `<form>` in the same
57
+ * document. If this attribute is not set, the `<qds-textarea>` is associated
58
+ * with its ancestor `<form>` element, if any.
59
+ *
60
+ * This attribute lets you associate `<qds-textarea>` elements to `<form>`s
61
+ * anywhere in the document, not just inside a `<form>`. It can also override
62
+ * an ancestor `<form>` element.
63
+ *
64
+ * [`<form>`]: https://developer.mozilla.org/docs/Web/HTML/Element/form
65
+ *
66
+ * @readonly
67
+ * @webnative
68
+ */
69
+ // eslint-disable-next-line unicorn/no-null
70
+ this.form = null;
71
+ /**
72
+ * Returns a list of the [`<label>`][] elements associated with the
73
+ * `qds-textarea` element.
74
+ *
75
+ * [`<label>`]: https://developer.mozilla.org/docs/Web/HTML/Element/label
76
+ *
77
+ * @readonly
78
+ * @webnative
79
+ */
80
+ this.labels = {};
81
+ /**
82
+ * Get or set the selection direction of a text selection.
83
+ *
84
+ * > **_NOTE:_** This property has no effect when used as an attribute.
85
+ *
86
+ * @webnative
87
+ */
88
+ this.selectionDirection = null;
89
+ /**
90
+ * Get or set the ending position or offset of a text selection.
91
+ *
92
+ * > **_NOTE:_** This property has no effect when used as an attribute.
93
+ *
94
+ * @webnative
95
+ */
96
+ this.selectionEnd = null;
97
+ /**
98
+ * Get or set the starting 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.selectionStart = null;
105
+ /**
106
+ * The error message that would be shown to the user if the `<qds-select>`
107
+ * was to be checked for validity.
108
+ *
109
+ * @readonly
110
+ * @webnative
111
+ */
112
+ this.validationMessage = '';
113
+ /**
114
+ * The [`ValidityState`][] object for this `<qds-select>`.
115
+ *
116
+ * [`ValidityState`]: https://developer.mozilla.org/docs/Web/API/ValidityState
117
+ *
118
+ * @readonly
119
+ * @webnative
120
+ */
121
+ this.validity = VALID_STATE;
122
+ /**
123
+ * True if `<qds-textarea>` will be validated when the form is submitted;
124
+ * false otherwise.
125
+ *
126
+ * @readonly
127
+ * @webnative
128
+ */
129
+ this.willValidate = false;
44
130
  _TextArea_inheritedAttributes.set(this, {});
45
131
  _TextArea_textarea.set(this, void 0);
46
132
  this.checkValidity = () => this.internals.checkValidity();
47
133
  this.reportValidity = () => this.internals.reportValidity();
48
134
  this.setCustomValidity = (error) => {
135
+ invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
136
+ __classPrivateFieldGet(this, _TextArea_textarea, "f").setCustomValidity(error);
49
137
  if (error)
50
138
  this.internals.setValidity(CUSTOM_ERROR_FLAGS, error, __classPrivateFieldGet(this, _TextArea_textarea, "f"));
51
139
  else
52
140
  this.internals.setValidity(NO_ERROR_FLAGS);
53
- this.invalid = !!error;
54
141
  };
55
142
  this.select = () => {
56
143
  invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
@@ -102,33 +189,6 @@ const TextArea = /*@__PURE__*/ proxyCustomElement(class TextArea extends H {
102
189
  invariant(__classPrivateFieldGet(this, _TextArea_textarea, "f"));
103
190
  __classPrivateFieldGet(this, _TextArea_textarea, "f").innerHTML = this.host.innerHTML;
104
191
  });
105
- this.size = 'standard';
106
- this.autoCapitalize = undefined;
107
- this.autoComplete = undefined;
108
- this.autoFocus = undefined;
109
- this.cols = undefined;
110
- this.disabled = undefined;
111
- this.enterkeyhint = undefined;
112
- this.form = null;
113
- this.inputmode = undefined;
114
- this.labels = {};
115
- this.maxLength = undefined;
116
- this.minLength = undefined;
117
- this.name = undefined;
118
- this.placeholder = undefined;
119
- this.required = undefined;
120
- this.rows = undefined;
121
- this.selectionDirection = null;
122
- this.selectionEnd = null;
123
- this.selectionStart = null;
124
- this.spellCheck = undefined;
125
- this.validationMessage = '';
126
- this.validity = VALID_STATE;
127
- this.value = undefined;
128
- this.willValidate = false;
129
- this.wrap = undefined;
130
- this.invalid = false;
131
- this.tabIndex = undefined;
132
192
  }
133
193
  onClick(event) {
134
194
  if (__classPrivateFieldGet(this, _TextArea_instances, "a", _TextArea_computedDisabled_get))
@@ -176,7 +236,6 @@ const TextArea = /*@__PURE__*/ proxyCustomElement(class TextArea extends H {
176
236
  this.internals.setValidity(NO_ERROR_FLAGS, undefined, __classPrivateFieldGet(this, _TextArea_textarea, "f"));
177
237
  else
178
238
  this.internals.setValidity(__classPrivateFieldGet(this, _TextArea_textarea, "f").validity, __classPrivateFieldGet(this, _TextArea_textarea, "f").validationMessage, __classPrivateFieldGet(this, _TextArea_textarea, "f"));
179
- this.invalid = !valid;
180
239
  }
181
240
  valueChanged() {
182
241
  if (!__classPrivateFieldGet(this, _TextArea_instances, "a", _TextArea_computedDisabled_get))
@@ -200,9 +259,9 @@ const TextArea = /*@__PURE__*/ proxyCustomElement(class TextArea extends H {
200
259
  this.valueChanged();
201
260
  }
202
261
  render() {
203
- return (h(Host, { key: 'c000b86a97a59517b30ea0431865df129597f7d5' }, h("textarea", { key: '16e2d8caffe0fad26a6232b78bae3bdebae164d6', "aria-invalid": this.invalid.toString(), autoCapitalize: this.autoCapitalize, autoComplete: this.autoComplete,
262
+ return (h(Host, { key: 'e7dce6854082dbf81ce04f551493abd12fd02de6' }, h("textarea", { key: '9d856c94923ea96e4cbd21639fd3bc759c778206', autoCapitalize: this.host.autocapitalize, autoComplete: this.autoComplete,
204
263
  // eslint-disable-next-line jsx-a11y/no-autofocus
205
- autoFocus: this.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.spellCheck, tabIndex: __classPrivateFieldGet(this, _TextArea_instances, "a", _TextArea_computedDisabled_get) ? undefined : this.tabIndex, wrap: this.wrap, ...__classPrivateFieldGet(this, _TextArea_inheritedAttributes, "f") }), h("slot", { key: '12d1c6bc9b9bb0df7deb661fbf6a0b718c143aeb', onSlotchange: __classPrivateFieldGet(this, _TextArea_onSlotchange, "f") })));
264
+ 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") }), h("slot", { key: '11e0afeab02ff5041ee39fc53747952ccd994911', onSlotchange: __classPrivateFieldGet(this, _TextArea_onSlotchange, "f") })));
206
265
  }
207
266
  static get delegatesFocus() { return true; }
208
267
  static get formAssociated() { return true; }
@@ -221,9 +280,7 @@ const TextArea = /*@__PURE__*/ proxyCustomElement(class TextArea extends H {
221
280
  static get style() { return QdsTextareaStyle0; }
222
281
  }, [81, "qds-textarea", {
223
282
  "size": [1],
224
- "autoCapitalize": [1, "autocapitalize"],
225
283
  "autoComplete": [1, "autocomplete"],
226
- "autoFocus": [4, "autofocus"],
227
284
  "cols": [2],
228
285
  "disabled": [4],
229
286
  "enterkeyhint": [1],
@@ -239,13 +296,11 @@ const TextArea = /*@__PURE__*/ proxyCustomElement(class TextArea extends H {
239
296
  "selectionDirection": [1025, "selection-direction"],
240
297
  "selectionEnd": [1026, "selection-end"],
241
298
  "selectionStart": [1026, "selection-start"],
242
- "spellCheck": [4, "spellcheck"],
243
299
  "validationMessage": [1, "validation-message"],
244
300
  "validity": [16],
245
301
  "value": [1032],
246
302
  "willValidate": [4, "will-validate"],
247
303
  "wrap": [1],
248
- "invalid": [32],
249
304
  "tabIndex": [32]
250
305
  }, [[0, "click", "onClick"]], {
251
306
  "disabled": ["disabledChanged"],
@@ -1 +1 @@
1
- {"file":"qds-textarea.js","mappings":";;;;;;;;;AAAA,MAAM,WAAW,GAAG,sqCAAsqC,CAAC;AAC3rC,0BAAe,WAAW;;ACD1B;AACA;AACA;;;;;;;;;;;;;;;;;;MAqDa,QAAQ;;;;;;;;;;;QA0VnB,wCAAmC,EAAE,EAAA;QAErC,qCAA+B;QAsJxB,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;YAEL,IAAI,KAAK;gBACP,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,kBAAkB,EAAE,KAAK,EAAE,uBAAA,IAAI,0BAAU,CAAC,CAAA;;gBAClE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,cAAc,CAAC,CAAA;YAC/C,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,K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,QAAQ,EAAE,uBAAA,IAAI,2DAAkB,GAAG,SAAS,GAAG,IAAI,CAAC,QAAQ,EAC5D,IAAI,EAAE,IAAI,CAAC,IAAI,KAEX,uBAAA,IAAI,qCAAqB,GAC7B,EACF,6DAAM,YAAY,EAAE,uBAAA,IAAI,8BAAc,GAAI,CACrC,EACR;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAjJC,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":[],"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 &: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-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\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 {\n AutoCapitalize,\n EnterKeyHint,\n InputMode,\n Value,\n} 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 * 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() 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 * 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 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!: HTMLQdsTextareaElement\n\n @State() private invalid = false\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 this.invalid = !valid\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 aria-invalid={this.invalid.toString()}\n autoCapitalize={this.autoCapitalize}\n autoComplete={this.autoComplete}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.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.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 if (error)\n this.internals.setValidity(CUSTOM_ERROR_FLAGS, error, this.#textarea)\n else this.internals.setValidity(NO_ERROR_FLAGS)\n this.invalid = !!error\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}
1
+ {"file":"qds-textarea.js","mappings":";;;;;;;;;AAAA,MAAM,WAAW,GAAG,gqCAAgqC,CAAC;AACrrC,0BAAe,WAAW;;ACD1B;AACA;AACA;;;;;;;;;;;;;;;;;;MAgDa,QAAQ;IANrB;;;;;;;;;;;;;;;;;;QAe0B,SAAI,GAAU,UAAU,CAAA;;;;;;;;;;;;;;;;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AK,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":[],"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}
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { T as Title, d as defineCustomElement$1 } from './p-7f6e797a.js';
6
+ import { T as Title, d as defineCustomElement$1 } from './p-252b0946.js';
7
7
 
8
8
  const QdsTitle = Title;
9
9
  const defineCustomElement = defineCustomElement$1;
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { T as Tooltip, d as defineCustomElement$1 } from './p-f5ba28ff.js';
6
+ import { T as Tooltip, d as defineCustomElement$1 } from './p-ae6eda4e.js';
7
7
 
8
8
  const QdsTooltip = Tooltip;
9
9
  const defineCustomElement = defineCustomElement$1;
@@ -1 +1 @@
1
- {"file":"helpers-cdd65bd0.js","mappings":";;;;;;;AAAA;AACA;AACA;AAaA,MAAM,iBAAiB,GAAG,CACxB,OAAgB,EAChB,aAAuB,EAAE;IAEzB,MAAM,eAAe,GAAe,EAAE,CAAA;IAEtC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;QAClC,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAA;QAC7C,IAAI,KAAK,KAAK,IAAI,EAAE;YAClB,eAAe,CAAC,SAAS,CAAC,GAAG,KAAK,CAAA;YAClC,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAA;SACnC;KACF;IAED,OAAO,eAAe,CAAA;AACxB,CAAC,CAAA;AAmBD,MAAM,cAAc,GAAoB;IACtC,uBAAuB;IACvB,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,6BAA6B;IAC7B,WAAW;IACX,cAAc;IACd,eAAe;IACf,eAAe;IACf,mBAAmB;IACnB,cAAc;IACd,eAAe;IACf,cAAc;IACd,kBAAkB;IAClB,kBAAkB;IAClB,cAAc;IACd,eAAe;IACf,mBAAmB;IACnB,eAAe;IACf,aAAa;IACb,eAAe;IACf,aAAa;IACb,cAAc;IACd,mBAAmB;IACnB,YAAY;IACZ,iBAAiB;IACjB,YAAY;IACZ,WAAW;IACX,gBAAgB;IAChB,sBAAsB;IACtB,kBAAkB;IAClB,WAAW;IACX,kBAAkB;IAClB,eAAe;IACf,cAAc;IACd,eAAe;IACf,eAAe;IACf,eAAe;IACf,sBAAsB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AAoC,CAAC,CAAA;IAC3E,OAAO,OAAO,CAAA;AAChB;;;;;;;;;;;;;;;","names":[],"sources":["src/helpers.ts"],"sourcesContent":["// SPDX-FileCopyrightText: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n MiddlewareState,\n OffsetOptions as LibraryOffsetOptions,\n ReferenceElement,\n} from '@floating-ui/dom'\nimport type { Except, Replace } from 'type-fest'\n\nimport type { LinkIcon } from './components/shared'\n\nexport type Attributes = Record<string, string | undefined>\n\nconst inheritAttributes = (\n element: Element,\n attributes: string[] = [],\n): Attributes => {\n const attributeObject: Attributes = {}\n\n for (const attribute of attributes) {\n const value = element.getAttribute(attribute)\n if (value !== null) {\n attributeObject[attribute] = value\n element.removeAttribute(attribute)\n }\n }\n\n return attributeObject\n}\n\ntype ARIAAttribute =\n | Replace<Lowercase<keyof ARIAMixin>, 'aria', 'aria-'>\n | 'aria-activedescendant'\n | 'aria-braillelabel'\n | 'aria-brailleroledescription'\n | 'aria-colindextext'\n | 'aria-controls'\n | 'aria-describedby'\n | 'aria-description'\n | 'aria-details'\n | 'aria-errormessage'\n | 'aria-flowto'\n | 'aria-labelledby'\n | 'aria-owns'\n | 'aria-relevant'\n | 'aria-rowindextext'\n\nconst ariaAttributes: ARIAAttribute[] = [\n 'aria-activedescendant',\n 'aria-atomic',\n 'aria-autocomplete',\n 'aria-braillelabel',\n 'aria-brailleroledescription',\n 'aria-busy',\n 'aria-checked',\n 'aria-colcount',\n 'aria-colindex',\n 'aria-colindextext',\n 'aria-colspan',\n 'aria-controls',\n 'aria-current',\n 'aria-describedby',\n 'aria-description',\n 'aria-details',\n 'aria-disabled',\n 'aria-errormessage',\n 'aria-expanded',\n 'aria-flowto',\n 'aria-haspopup',\n 'aria-hidden',\n 'aria-invalid',\n 'aria-keyshortcuts',\n 'aria-label',\n 'aria-labelledby',\n 'aria-level',\n 'aria-live',\n 'aria-multiline',\n 'aria-multiselectable',\n 'aria-orientation',\n 'aria-owns',\n 'aria-placeholder',\n 'aria-posinset',\n 'aria-pressed',\n 'aria-readonly',\n 'aria-relevant',\n 'aria-required',\n 'aria-roledescription',\n 'aria-rowcount',\n 'aria-rowindex',\n 'aria-rowindextext',\n 'aria-rowspan',\n 'aria-selected',\n 'aria-setsize',\n 'aria-sort',\n 'aria-valuemax',\n 'aria-valuemin',\n 'aria-valuenow',\n 'aria-valuetext',\n 'role',\n]\n\n/**\n * Returns an array of aria attributes that should be copied from\n * the shadow host element to a target within the light DOM.\n *\n * @param element The element that the attributes should be copied from.\n */\nexport const inheritAriaAttributes = (\n element: Element,\n): ReturnType<typeof inheritAttributes> =>\n inheritAttributes(element, ariaAttributes)\n\nconst isProduction = process.env.NODE_ENV === 'production'\nconst prefix = 'Invariant failed'\n\n/**\n * Throws an error if the value is falsy.\n *\n * @param value Value to test.\n * @param message Optional message to display in development builds.\n */\nexport function invariant(value: unknown, message?: string): asserts value {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (value) return\n if (isProduction) throw new Error(prefix)\n\n const error = message === undefined ? prefix : `${prefix}: ${message}`\n throw new Error(error)\n}\n\n/**\n * From an object pick a set of keys.\n *\n * @param object Object to pick from.\n * @param keys They keys to pick.\n * @returns New object with only the picked keys.\n */\nexport const pick = <T, K extends keyof T>(\n object: T,\n ...keys: K[]\n): Pick<T, K> => {\n const returnValue: Partial<Pick<T, K>> = {}\n for (const key of keys) returnValue[key] = object[key]\n return returnValue as Pick<T, K>\n}\n\nexport type QdsFocusEventDetail = Pick<FocusEvent, 'relatedTarget'>\nexport type QdsInputEventDetail = Pick<\n InputEvent,\n 'data' | 'inputType' | 'isComposing'\n>\nexport const pickFocusEventAttributes = (\n event: FocusEvent,\n): QdsFocusEventDetail => pick(event, 'relatedTarget')\nexport const pickInputEventAttributes = (\n event: InputEvent,\n): QdsInputEventDetail => pick(event, 'data', 'inputType', 'isComposing')\n\nconst getConversionFactor = (\n element: Element,\n unit: string,\n): number | undefined => {\n switch (unit) {\n case 'cm': {\n return 96 / 2.54\n }\n case 'em': {\n return Number.parseFloat(\n globalThis.getComputedStyle(\n element.parentElement ?? document.documentElement,\n ).fontSize,\n )\n }\n case 'in': {\n return 96\n }\n case 'mm': {\n return 96 / 25.4\n }\n case 'pc': {\n return 16\n }\n case 'pt': {\n return 96 / 72\n }\n case 'px': {\n return 1\n }\n case 'rem': {\n return Number.parseFloat(\n globalThis.getComputedStyle(document.documentElement).fontSize,\n )\n }\n default: {\n return undefined\n }\n }\n}\n\nexport const propertyToPx = (\n element: Element,\n property: string,\n): number | undefined => {\n const value = globalThis.getComputedStyle(element).getPropertyValue(property)\n const number = Number.parseFloat(value)\n if (Number.isNaN(number)) return undefined\n const unit = /\\s*[\\d+.-]*\\s*(.*)/.exec(value)?.[1] ?? ''\n\n const conversionFactor = getConversionFactor(element, unit) ?? 1\n return number * conversionFactor\n}\n\nexport const ignorePromise = <T>(promise: Promise<T>): void => {\n promise.catch(() => {\n invariant(false)\n })\n}\n\nexport const isTouchDevice = (): boolean =>\n 'ontouchstart' in globalThis ||\n ('maxTouchPoints' in globalThis && globalThis.navigator.maxTouchPoints > 0)\n\nexport const roundByDPR = (value: number): number => {\n const dpr = devicePixelRatio || 1\n return Math.round(value * dpr) / dpr\n}\n\n/**\n * Checks if an element's content is overflowing.\n *\n * @param element The element to check.\n * @returns `true` if overflowing, `false` otherwise.\n */\nexport const isOverflowing = (element: Element): boolean => {\n const { clientHeight, clientWidth, scrollHeight, scrollWidth } = element\n return scrollHeight > clientHeight || scrollWidth > clientWidth\n}\n\nexport const determineLinkIcon = (\n href?: URL | string,\n target?: string,\n): LinkIcon | undefined => {\n if (href === undefined) return undefined\n\n let link\n try {\n link = new URL(href, globalThis.location.href)\n } catch {\n return undefined\n }\n const isExternalLink = link.origin !== globalThis.location.origin\n const opensInNewTab = target === '_blank'\n\n if (isExternalLink)\n return opensInNewTab ? 'external-new-tab-link' : 'external-link'\n return opensInNewTab ? 'new-tab-link' : undefined\n}\n\nexport function attachInternals(this: unknown): ElementInternals {\n // @ts-expect-error: This is very unsafe but it's not possible to do this in\n // Stencil.js without creating a form-associated custom\n // element.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return\n return this.attachInternals()\n}\n\nexport const resolveTarget = (\n target?: ReferenceElement | string | (() => ReferenceElement | string),\n): ReferenceElement | undefined => {\n const resolvedTarget = typeof target === 'function' ? target() : target\n if (typeof resolvedTarget !== 'string') return resolvedTarget\n\n const element = document.querySelector(resolvedTarget)\n if (element === null) throw new Error('String must resolve to an Element.')\n return element\n}\n\nexport type OffsetValue = Except<\n Exclude<\n LibraryOffsetOptions,\n // eslint-disable-next-line @typescript-eslint/ban-types\n Function | number\n >,\n 'mainAxis'\n>\nexport type OffsetFunction = (state: MiddlewareState) => OffsetValue\nexport type OffsetOptions = OffsetFunction | OffsetValue\n"],"version":3}
1
+ {"file":"helpers-cdd65bd0.js","mappings":";;;;;;;AAAA;AACA;AACA;AAaA,MAAM,iBAAiB,GAAG,CACxB,OAAgB,EAChB,aAAuB,EAAE;IAEzB,MAAM,eAAe,GAAe,EAAE;IAEtC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;QAClC,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC;QAC7C,IAAI,KAAK,KAAK,IAAI,EAAE;YAClB,eAAe,CAAC,SAAS,CAAC,GAAG,KAAK;YAClC,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC;;;IAItC,OAAO,eAAe;AACxB,CAAC;AAmBD,MAAM,cAAc,GAAoB;IACtC,uBAAuB;IACvB,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,6BAA6B;IAC7B,WAAW;IACX,cAAc;IACd,eAAe;IACf,eAAe;IACf,mBAAmB;IACnB,cAAc;IACd,eAAe;IACf,cAAc;IACd,kBAAkB;IAClB,kBAAkB;IAClB,cAAc;IACd,eAAe;IACf,mBAAmB;IACnB,eAAe;IACf,aAAa;IACb,eA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// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n MiddlewareState,\n OffsetOptions as LibraryOffsetOptions,\n ReferenceElement,\n} from '@floating-ui/dom'\nimport type { Except, Replace } from 'type-fest'\n\nimport type { LinkIcon } from './components/shared'\n\nexport type Attributes = Record<string, string | undefined>\n\nconst inheritAttributes = (\n element: Element,\n attributes: string[] = [],\n): Attributes => {\n const attributeObject: Attributes = {}\n\n for (const attribute of attributes) {\n const value = element.getAttribute(attribute)\n if (value !== null) {\n attributeObject[attribute] = value\n element.removeAttribute(attribute)\n }\n }\n\n return attributeObject\n}\n\ntype ARIAAttribute =\n | Replace<Lowercase<keyof ARIAMixin>, 'aria', 'aria-'>\n | 'aria-activedescendant'\n | 'aria-braillelabel'\n | 'aria-brailleroledescription'\n | 'aria-colindextext'\n | 'aria-controls'\n | 'aria-describedby'\n | 'aria-description'\n | 'aria-details'\n | 'aria-errormessage'\n | 'aria-flowto'\n | 'aria-labelledby'\n | 'aria-owns'\n | 'aria-relevant'\n | 'aria-rowindextext'\n\nconst ariaAttributes: ARIAAttribute[] = [\n 'aria-activedescendant',\n 'aria-atomic',\n 'aria-autocomplete',\n 'aria-braillelabel',\n 'aria-brailleroledescription',\n 'aria-busy',\n 'aria-checked',\n 'aria-colcount',\n 'aria-colindex',\n 'aria-colindextext',\n 'aria-colspan',\n 'aria-controls',\n 'aria-current',\n 'aria-describedby',\n 'aria-description',\n 'aria-details',\n 'aria-disabled',\n 'aria-errormessage',\n 'aria-expanded',\n 'aria-flowto',\n 'aria-haspopup',\n 'aria-hidden',\n 'aria-invalid',\n 'aria-keyshortcuts',\n 'aria-label',\n 'aria-labelledby',\n 'aria-level',\n 'aria-live',\n 'aria-multiline',\n 'aria-multiselectable',\n 'aria-orientation',\n 'aria-owns',\n 'aria-placeholder',\n 'aria-posinset',\n 'aria-pressed',\n 'aria-readonly',\n 'aria-relevant',\n 'aria-required',\n 'aria-roledescription',\n 'aria-rowcount',\n 'aria-rowindex',\n 'aria-rowindextext',\n 'aria-rowspan',\n 'aria-selected',\n 'aria-setsize',\n 'aria-sort',\n 'aria-valuemax',\n 'aria-valuemin',\n 'aria-valuenow',\n 'aria-valuetext',\n 'role',\n]\n\n/**\n * Returns an array of aria attributes that should be copied from\n * the shadow host element to a target within the light DOM.\n *\n * @param element The element that the attributes should be copied from.\n */\nexport const inheritAriaAttributes = (\n element: Element,\n): ReturnType<typeof inheritAttributes> =>\n inheritAttributes(element, ariaAttributes)\n\nconst isProduction = process.env.NODE_ENV === 'production'\nconst prefix = 'Invariant failed'\n\n/**\n * Throws an error if the value is falsy.\n *\n * @param value Value to test.\n * @param message Optional message to display in development builds.\n */\nexport function invariant(value: unknown, message?: string): asserts value {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (value) return\n if (isProduction) throw new Error(prefix)\n\n const error = message === undefined ? prefix : `${prefix}: ${message}`\n throw new Error(error)\n}\n\n/**\n * From an object pick a set of keys.\n *\n * @param object Object to pick from.\n * @param keys They keys to pick.\n * @returns New object with only the picked keys.\n */\nexport const pick = <T, K extends keyof T>(\n object: T,\n ...keys: K[]\n): Pick<T, K> => {\n const returnValue: Partial<Pick<T, K>> = {}\n for (const key of keys) returnValue[key] = object[key]\n return returnValue as Pick<T, K>\n}\n\nexport type QdsFocusEventDetail = Pick<FocusEvent, 'relatedTarget'>\nexport type QdsInputEventDetail = Pick<\n InputEvent,\n 'data' | 'inputType' | 'isComposing'\n>\nexport const pickFocusEventAttributes = (\n event: FocusEvent,\n): QdsFocusEventDetail => pick(event, 'relatedTarget')\nexport const pickInputEventAttributes = (\n event: InputEvent,\n): QdsInputEventDetail => pick(event, 'data', 'inputType', 'isComposing')\n\nconst getConversionFactor = (\n element: Element,\n unit: string,\n): number | undefined => {\n switch (unit) {\n case 'cm': {\n return 96 / 2.54\n }\n case 'em': {\n return Number.parseFloat(\n globalThis.getComputedStyle(\n element.parentElement ?? document.documentElement,\n ).fontSize,\n )\n }\n case 'in': {\n return 96\n }\n case 'mm': {\n return 96 / 25.4\n }\n case 'pc': {\n return 16\n }\n case 'pt': {\n return 96 / 72\n }\n case 'px': {\n return 1\n }\n case 'rem': {\n return Number.parseFloat(\n globalThis.getComputedStyle(document.documentElement).fontSize,\n )\n }\n default: {\n return undefined\n }\n }\n}\n\nexport const propertyToPx = (\n element: Element,\n property: string,\n): number | undefined => {\n const value = globalThis.getComputedStyle(element).getPropertyValue(property)\n const number = Number.parseFloat(value)\n if (Number.isNaN(number)) return undefined\n const unit = /\\s*[\\d+.-]*\\s*(.*)/.exec(value)?.[1] ?? ''\n\n const conversionFactor = getConversionFactor(element, unit) ?? 1\n return number * conversionFactor\n}\n\nexport const ignorePromise = <T>(promise: Promise<T>): void => {\n promise.catch(() => {\n invariant(false)\n })\n}\n\nexport const isTouchDevice = (): boolean =>\n 'ontouchstart' in globalThis ||\n ('maxTouchPoints' in globalThis && globalThis.navigator.maxTouchPoints > 0)\n\nexport const roundByDPR = (value: number): number => {\n const dpr = devicePixelRatio || 1\n return Math.round(value * dpr) / dpr\n}\n\n/**\n * Checks if an element's content is overflowing.\n *\n * @param element The element to check.\n * @returns `true` if overflowing, `false` otherwise.\n */\nexport const isOverflowing = (element: Element): boolean => {\n const { clientHeight, clientWidth, scrollHeight, scrollWidth } = element\n return scrollHeight > clientHeight || scrollWidth > clientWidth\n}\n\nexport const determineLinkIcon = (\n href?: URL | string,\n target?: string,\n): LinkIcon | undefined => {\n if (href === undefined) return undefined\n\n let link\n try {\n link = new URL(href, globalThis.location.href)\n } catch {\n return undefined\n }\n const isExternalLink = link.origin !== globalThis.location.origin\n const opensInNewTab = target === '_blank'\n\n if (isExternalLink)\n return opensInNewTab ? 'external-new-tab-link' : 'external-link'\n return opensInNewTab ? 'new-tab-link' : undefined\n}\n\nexport function attachInternals(this: unknown): ElementInternals {\n // @ts-expect-error: This is very unsafe but it's not possible to do this in\n // Stencil.js without creating a form-associated custom\n // element.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return\n return this.attachInternals()\n}\n\nexport const resolveTarget = (\n target?: ReferenceElement | string | (() => ReferenceElement | string),\n): ReferenceElement | undefined => {\n const resolvedTarget = typeof target === 'function' ? target() : target\n if (typeof resolvedTarget !== 'string') return resolvedTarget\n\n const element = document.querySelector(resolvedTarget)\n if (element === null) throw new Error('String must resolve to an Element.')\n return element\n}\n\nexport type OffsetValue = Except<\n Exclude<\n LibraryOffsetOptions,\n // eslint-disable-next-line @typescript-eslint/ban-types\n Function | number\n >,\n 'mainAxis'\n>\nexport type OffsetFunction = (state: MiddlewareState) => OffsetValue\nexport type OffsetOptions = OffsetFunction | OffsetValue\n"],"version":3}