@sparkle-learning/core 0.0.54 → 0.0.55

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 (104) hide show
  1. package/dist/cjs/{PrivateRoute-e2047db2.js → PrivateRoute-f97245ce.js} +2 -2
  2. package/dist/cjs/{appdata.service-d28cf2d6.js → appdata.service-c8d71e05.js} +1 -1
  3. package/dist/cjs/assignment.service-690fb59c.js +19 -0
  4. package/dist/cjs/{facilitator.service-0b9f6ac7.js → facilitator.service-ff0e1659.js} +1 -1
  5. package/dist/cjs/{feed.service-6df9382f.js → feed.service-8eca4de6.js} +1 -1
  6. package/dist/cjs/header-mobile-collapse_61.cjs.entry.js +9 -9
  7. package/dist/cjs/{httpService-d8a5b474.js → httpService-d2e7bf8f.js} +1 -1
  8. package/dist/cjs/index.cjs.js +3 -3
  9. package/dist/cjs/{ion-action-sheet_4.cjs.entry.js → ion-action-sheet_7.cjs.entry.js} +728 -0
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/cjs/{media.service-2bc73d37.js → media.service-8a1b9bc5.js} +1 -1
  12. package/dist/cjs/{signalR.service-0d5da1d3.js → signalR.service-bd6b42f9.js} +1 -1
  13. package/dist/cjs/sparkle-assignment.cjs.entry.js +90 -5
  14. package/dist/cjs/sparkle-core.cjs.js +1 -1
  15. package/dist/cjs/sparkle-discussion-questions_2.cjs.entry.js +2 -2
  16. package/dist/cjs/sparkle-facilitator-notes-form.cjs.entry.js +3 -3
  17. package/dist/cjs/sparkle-feed-post.cjs.entry.js +116 -0
  18. package/dist/cjs/sparkle-feedback.cjs.entry.js +3 -3
  19. package/dist/cjs/sparkle-file-upload.cjs.entry.js +53 -0
  20. package/dist/cjs/sparkle-goal-form.cjs.entry.js +4 -4
  21. package/dist/cjs/sparkle-input.cjs.entry.js +56 -0
  22. package/dist/cjs/{student.service-d8ec2551.js → student.service-7e5385be.js} +1 -1
  23. package/dist/cjs/{token.service-bfb0089b.js → token.service-7a41953d.js} +11 -0
  24. package/dist/collection/collection-manifest.json +2 -0
  25. package/dist/collection/components/sparkle-assignment/sparkle-assignment.css +27 -0
  26. package/dist/collection/components/sparkle-assignment/sparkle-assignment.js +141 -7
  27. package/dist/collection/components/sparkle-feed-post/sparkle-feed-post.js +2 -10
  28. package/dist/collection/components/sparkle-file-upload/sparkle-file-upload.css +0 -0
  29. package/dist/collection/components/sparkle-file-upload/sparkle-file-upload.js +105 -0
  30. package/dist/collection/components/sparkle-input/sparkle-input.css +0 -0
  31. package/dist/collection/components/sparkle-input/sparkle-input.js +212 -0
  32. package/dist/collection/services/token.service.js +11 -0
  33. package/dist/esm/{PrivateRoute-c6e80d5d.js → PrivateRoute-90ac95b8.js} +2 -2
  34. package/dist/esm/{appdata.service-d1058e00.js → appdata.service-2e84e167.js} +1 -1
  35. package/dist/esm/assignment.service-8d31f141.js +17 -0
  36. package/dist/esm/{facilitator.service-53e05a01.js → facilitator.service-18c47bdf.js} +1 -1
  37. package/dist/esm/{feed.service-8385ad7a.js → feed.service-b4f3cae4.js} +1 -1
  38. package/dist/esm/header-mobile-collapse_61.entry.js +10 -10
  39. package/dist/esm/{httpService-db476835.js → httpService-7986aeed.js} +2 -2
  40. package/dist/esm/index.js +4 -4
  41. package/dist/esm/{ion-action-sheet_4.entry.js → ion-action-sheet_7.entry.js} +729 -4
  42. package/dist/esm/ion-loading.entry.js +1 -1
  43. package/dist/esm/ion-menu.entry.js +1 -1
  44. package/dist/esm/ion-modal.entry.js +1 -1
  45. package/dist/esm/ion-picker.entry.js +1 -1
  46. package/dist/esm/ion-toast.entry.js +1 -1
  47. package/dist/esm/loader.js +1 -1
  48. package/dist/esm/{media.service-b68cbfff.js → media.service-6e90bc41.js} +1 -1
  49. package/dist/esm/{overlays-3b4dca92.js → overlays-4233a39d.js} +1 -1
  50. package/dist/esm/{signalR.service-4a2d5a92.js → signalR.service-c33fba50.js} +1 -1
  51. package/dist/esm/sparkle-assignment.entry.js +91 -6
  52. package/dist/esm/sparkle-core.js +1 -1
  53. package/dist/esm/sparkle-discussion-questions_2.entry.js +2 -2
  54. package/dist/esm/sparkle-facilitator-notes-form.entry.js +4 -4
  55. package/dist/esm/sparkle-feed-post.entry.js +112 -0
  56. package/dist/esm/sparkle-feedback.entry.js +4 -4
  57. package/dist/esm/sparkle-file-upload.entry.js +49 -0
  58. package/dist/esm/sparkle-goal-form.entry.js +5 -5
  59. package/dist/esm/sparkle-input.entry.js +52 -0
  60. package/dist/esm/{student.service-6457aaa0.js → student.service-08af124f.js} +1 -1
  61. package/dist/esm/{token.service-20f1a256.js → token.service-71a5d33f.js} +11 -0
  62. package/dist/sparkle-core/index.esm.js +1 -1
  63. package/dist/sparkle-core/p-08420531.entry.js +1 -0
  64. package/dist/sparkle-core/p-08cca80d.entry.js +1 -0
  65. package/dist/sparkle-core/p-0e8e539f.entry.js +1 -0
  66. package/dist/sparkle-core/{p-11ac00b0.js → p-1adc98f6.js} +1 -1
  67. package/dist/sparkle-core/{p-71720d6e.entry.js → p-38c842d5.entry.js} +1 -1
  68. package/dist/sparkle-core/{p-38f707fb.js → p-39a31e43.js} +1 -1
  69. package/dist/sparkle-core/{p-6a1fc0af.entry.js → p-3daf2915.entry.js} +1 -1
  70. package/dist/sparkle-core/{p-dcff298d.entry.js → p-42ed7d5f.entry.js} +1 -1
  71. package/dist/sparkle-core/{p-6fab3a4b.js → p-4b4a8703.js} +1 -1
  72. package/dist/sparkle-core/{p-98f7780c.entry.js → p-4d1cfcbe.entry.js} +1 -1
  73. package/dist/sparkle-core/p-4fba3e4c.js +1 -0
  74. package/dist/sparkle-core/{p-54dd894f.entry.js → p-6bde0192.entry.js} +1 -1
  75. package/dist/sparkle-core/{p-6faa194c.entry.js → p-6d2f4093.entry.js} +1 -1
  76. package/dist/sparkle-core/{p-ed9de327.js → p-7dae0f0e.js} +1 -1
  77. package/dist/sparkle-core/p-973fe404.entry.js +22 -0
  78. package/dist/sparkle-core/{p-967a2ed7.js → p-b06e2bef.js} +1 -1
  79. package/dist/sparkle-core/{p-e863bf1d.entry.js → p-b6fec622.entry.js} +1 -1
  80. package/dist/sparkle-core/{p-630a4fa0.js → p-b8d71ff4.js} +1 -1
  81. package/dist/sparkle-core/{p-17b6b07e.js → p-c9f753a4.js} +1 -1
  82. package/dist/sparkle-core/{p-d51f30ca.js → p-da391f3f.js} +1 -1
  83. package/dist/sparkle-core/{p-38fa5987.js → p-e0cad1bb.js} +1 -1
  84. package/dist/sparkle-core/{p-ce4b22f7.entry.js → p-f196c124.entry.js} +1 -1
  85. package/dist/sparkle-core/p-f47fe1fe.entry.js +1 -0
  86. package/dist/sparkle-core/{p-e50c8b04.entry.js → p-f714f77a.entry.js} +1 -1
  87. package/dist/sparkle-core/{p-377b04c2.entry.js → p-ff080f82.entry.js} +1 -1
  88. package/dist/sparkle-core/{p-2ff67662.js → p-ff7a8a71.js} +1 -1
  89. package/dist/sparkle-core/sparkle-core.esm.js +1 -1
  90. package/dist/types/components/sparkle-assignment/sparkle-assignment.d.ts +11 -1
  91. package/dist/types/components/sparkle-feed-post/sparkle-feed-post.d.ts +1 -1
  92. package/dist/types/components/sparkle-file-upload/sparkle-file-upload.d.ts +15 -0
  93. package/dist/types/components/sparkle-input/sparkle-input.d.ts +23 -0
  94. package/dist/types/components.d.ts +62 -0
  95. package/dist/types/services/token.service.d.ts +1 -0
  96. package/package.json +1 -1
  97. package/dist/cjs/ion-select_3.cjs.entry.js +0 -627
  98. package/dist/cjs/ion-textarea.cjs.entry.js +0 -248
  99. package/dist/esm/ion-select_3.entry.js +0 -621
  100. package/dist/esm/ion-textarea.entry.js +0 -244
  101. package/dist/sparkle-core/p-0f1c5899.entry.js +0 -18
  102. package/dist/sparkle-core/p-33a7151d.entry.js +0 -1
  103. package/dist/sparkle-core/p-641bfc92.entry.js +0 -1
  104. package/dist/sparkle-core/p-ca907214.entry.js +0 -4
@@ -2113,6 +2113,493 @@ Popover.style = {
2113
2113
  md: popoverMdCss
2114
2114
  };
2115
2115
 
2116
+ /*!
2117
+ * (C) Ionic http://ionicframework.com - MIT License
2118
+ */
2119
+ const watchForOptions = (containerEl, tagName, onChange) => {
2120
+ if (typeof MutationObserver === 'undefined') {
2121
+ return;
2122
+ }
2123
+ const mutation = new MutationObserver((mutationList) => {
2124
+ onChange(getSelectedOption(mutationList, tagName));
2125
+ });
2126
+ mutation.observe(containerEl, {
2127
+ childList: true,
2128
+ subtree: true,
2129
+ });
2130
+ return mutation;
2131
+ };
2132
+ const getSelectedOption = (mutationList, tagName) => {
2133
+ let newOption;
2134
+ mutationList.forEach((mut) => {
2135
+ // eslint-disable-next-line @typescript-eslint/prefer-for-of
2136
+ for (let i = 0; i < mut.addedNodes.length; i++) {
2137
+ newOption = findCheckedOption(mut.addedNodes[i], tagName) || newOption;
2138
+ }
2139
+ });
2140
+ return newOption;
2141
+ };
2142
+ const findCheckedOption = (el, tagName) => {
2143
+ if (el.nodeType !== 1) {
2144
+ return undefined;
2145
+ }
2146
+ const options = el.tagName === tagName.toUpperCase() ? [el] : Array.from(el.querySelectorAll(tagName));
2147
+ return options.find((o) => o.value === el.value);
2148
+ };
2149
+
2150
+ const selectIosCss = ":host{--placeholder-color:currentColor;--placeholder-opacity:0.33;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;position:relative;align-items:center;font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:2}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.in-item){position:static;max-width:45%}:host(.select-disabled){opacity:0.4;pointer-events:none}:host(.ion-focused) button{border:2px solid #5e9ed6}.select-placeholder{color:var(--placeholder-color);opacity:var(--placeholder-opacity)}label{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;appearance:none;outline:none;display:flex;align-items:center;opacity:0}[dir=rtl] label,:host-context([dir=rtl]) label{left:unset;right:unset;right:0}label::-moz-focus-inner{border:0}button{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}.select-icon{position:relative}.select-text{flex:1;min-width:16px;font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.select-icon-inner{left:5px;top:50%;margin-top:-2px;position:absolute;width:0;height:0;border-top:5px solid;border-right:5px solid transparent;border-left:5px solid transparent;color:currentColor;pointer-events:none}[dir=rtl] .select-icon-inner,:host-context([dir=rtl]) .select-icon-inner{left:unset;right:unset;right:5px}:host{--padding-top:10px;--padding-end:10px;--padding-bottom:10px;--padding-start:20px}.select-icon{width:12px;height:18px;opacity:0.33}";
2151
+
2152
+ const selectMdCss = ":host{--placeholder-color:currentColor;--placeholder-opacity:0.33;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;position:relative;align-items:center;font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:2}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.in-item){position:static;max-width:45%}:host(.select-disabled){opacity:0.4;pointer-events:none}:host(.ion-focused) button{border:2px solid #5e9ed6}.select-placeholder{color:var(--placeholder-color);opacity:var(--placeholder-opacity)}label{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;appearance:none;outline:none;display:flex;align-items:center;opacity:0}[dir=rtl] label,:host-context([dir=rtl]) label{left:unset;right:unset;right:0}label::-moz-focus-inner{border:0}button{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}.select-icon{position:relative}.select-text{flex:1;min-width:16px;font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.select-icon-inner{left:5px;top:50%;margin-top:-2px;position:absolute;width:0;height:0;border-top:5px solid;border-right:5px solid transparent;border-left:5px solid transparent;color:currentColor;pointer-events:none}[dir=rtl] .select-icon-inner,:host-context([dir=rtl]) .select-icon-inner{left:unset;right:unset;right:5px}:host{--padding-top:10px;--padding-end:0;--padding-bottom:10px;--padding-start:16px}.select-icon{width:19px;height:19px;transition:transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);opacity:0.55}:host-context(.item-label-stacked) .select-icon,:host-context(.item-label-floating:not(.item-fill-outline)) .select-icon,:host-context(.item-label-floating.item-fill-outline){transform:translate3d(0, -9px, 0)}:host-context(.item-has-focus) .select-icon{transform:rotate(180deg)}:host-context(.item-has-focus.item-label-stacked) .select-icon,:host-context(.item-has-focus.item-label-floating:not(.item-fill-outline)) .select-icon{transform:translate3d(0, -9px, 0) rotate(180deg)}:host-context(ion-item.ion-focused) .select-icon,:host-context(.item-has-focus) .select-icon{color:var(--highlight-color-focused);opacity:1}";
2153
+
2154
+ const Select = class {
2155
+ constructor(hostRef) {
2156
+ index$1.registerInstance(this, hostRef);
2157
+ this.ionChange = index$1.createEvent(this, "ionChange", 7);
2158
+ this.ionCancel = index$1.createEvent(this, "ionCancel", 7);
2159
+ this.ionDismiss = index$1.createEvent(this, "ionDismiss", 7);
2160
+ this.ionFocus = index$1.createEvent(this, "ionFocus", 7);
2161
+ this.ionBlur = index$1.createEvent(this, "ionBlur", 7);
2162
+ this.ionStyle = index$1.createEvent(this, "ionStyle", 7);
2163
+ this.inputId = `ion-sel-${selectIds++}`;
2164
+ this.didInit = false;
2165
+ this.isExpanded = false;
2166
+ /**
2167
+ * If `true`, the user cannot interact with the select.
2168
+ */
2169
+ this.disabled = false;
2170
+ /**
2171
+ * The text to display on the cancel button.
2172
+ */
2173
+ this.cancelText = 'Cancel';
2174
+ /**
2175
+ * The text to display on the ok button.
2176
+ */
2177
+ this.okText = 'OK';
2178
+ /**
2179
+ * The name of the control, which is submitted with the form data.
2180
+ */
2181
+ this.name = this.inputId;
2182
+ /**
2183
+ * If `true`, the select can accept multiple values.
2184
+ */
2185
+ this.multiple = false;
2186
+ /**
2187
+ * The interface the select should use: `action-sheet`, `popover` or `alert`.
2188
+ */
2189
+ this.interface = 'alert';
2190
+ /**
2191
+ * Any additional options that the `alert`, `action-sheet` or `popover` interface
2192
+ * can take. See the [ion-alert docs](./alert), the
2193
+ * [ion-action-sheet docs](./action-sheet) and the
2194
+ * [ion-popover docs](./popover) for the
2195
+ * create options for each interface.
2196
+ *
2197
+ * Note: `interfaceOptions` will not override `inputs` or `buttons` with the `alert` interface.
2198
+ */
2199
+ this.interfaceOptions = {};
2200
+ this.onClick = (ev) => {
2201
+ this.setFocus();
2202
+ this.open(ev);
2203
+ };
2204
+ this.onFocus = () => {
2205
+ this.ionFocus.emit();
2206
+ };
2207
+ this.onBlur = () => {
2208
+ this.ionBlur.emit();
2209
+ };
2210
+ }
2211
+ styleChanged() {
2212
+ this.emitStyle();
2213
+ }
2214
+ valueChanged() {
2215
+ this.emitStyle();
2216
+ // TODO: FW-1160 - Remove the `didInit` property when ionChange behavior is changed in v7.
2217
+ if (this.didInit) {
2218
+ this.ionChange.emit({
2219
+ value: this.value,
2220
+ });
2221
+ }
2222
+ }
2223
+ async connectedCallback() {
2224
+ this.updateOverlayOptions();
2225
+ this.emitStyle();
2226
+ this.mutationO = watchForOptions(this.el, 'ion-select-option', async () => {
2227
+ this.updateOverlayOptions();
2228
+ });
2229
+ }
2230
+ disconnectedCallback() {
2231
+ if (this.mutationO) {
2232
+ this.mutationO.disconnect();
2233
+ this.mutationO = undefined;
2234
+ }
2235
+ }
2236
+ componentDidLoad() {
2237
+ this.didInit = true;
2238
+ }
2239
+ /**
2240
+ * Open the select overlay. The overlay is either an alert, action sheet, or popover,
2241
+ * depending on the `interface` property on the `ion-select`.
2242
+ *
2243
+ * @param event The user interface event that called the open.
2244
+ */
2245
+ async open(event) {
2246
+ if (this.disabled || this.isExpanded) {
2247
+ return undefined;
2248
+ }
2249
+ this.isExpanded = true;
2250
+ const overlay = (this.overlay = await this.createOverlay(event));
2251
+ overlay.onDidDismiss().then(() => {
2252
+ this.overlay = undefined;
2253
+ this.isExpanded = false;
2254
+ this.ionDismiss.emit();
2255
+ this.setFocus();
2256
+ });
2257
+ await overlay.present();
2258
+ // focus selected option for popovers
2259
+ if (this.interface === 'popover') {
2260
+ let indexOfSelected = this.childOpts.map((o) => o.value).indexOf(this.value);
2261
+ indexOfSelected = indexOfSelected > -1 ? indexOfSelected : 0; // default to first option if nothing selected
2262
+ const selectedEl = overlay.querySelector(`.select-interface-option:nth-child(${indexOfSelected + 1})`);
2263
+ if (selectedEl) {
2264
+ helpers.focusElement(selectedEl);
2265
+ }
2266
+ }
2267
+ return overlay;
2268
+ }
2269
+ createOverlay(ev) {
2270
+ let selectInterface = this.interface;
2271
+ if (selectInterface === 'action-sheet' && this.multiple) {
2272
+ console.warn(`Select interface cannot be "${selectInterface}" with a multi-value select. Using the "alert" interface instead.`);
2273
+ selectInterface = 'alert';
2274
+ }
2275
+ if (selectInterface === 'popover' && !ev) {
2276
+ console.warn(`Select interface cannot be a "${selectInterface}" without passing an event. Using the "alert" interface instead.`);
2277
+ selectInterface = 'alert';
2278
+ }
2279
+ if (selectInterface === 'action-sheet') {
2280
+ return this.openActionSheet();
2281
+ }
2282
+ if (selectInterface === 'popover') {
2283
+ return this.openPopover(ev);
2284
+ }
2285
+ return this.openAlert();
2286
+ }
2287
+ updateOverlayOptions() {
2288
+ const overlay = this.overlay;
2289
+ if (!overlay) {
2290
+ return;
2291
+ }
2292
+ const childOpts = this.childOpts;
2293
+ const value = this.value;
2294
+ switch (this.interface) {
2295
+ case 'action-sheet':
2296
+ overlay.buttons = this.createActionSheetButtons(childOpts, value);
2297
+ break;
2298
+ case 'popover':
2299
+ const popover = overlay.querySelector('ion-select-popover');
2300
+ if (popover) {
2301
+ popover.options = this.createPopoverOptions(childOpts, value);
2302
+ }
2303
+ break;
2304
+ case 'alert':
2305
+ const inputType = this.multiple ? 'checkbox' : 'radio';
2306
+ overlay.inputs = this.createAlertInputs(childOpts, inputType, value);
2307
+ break;
2308
+ }
2309
+ }
2310
+ createActionSheetButtons(data, selectValue) {
2311
+ const actionSheetButtons = data.map((option) => {
2312
+ const value = getOptionValue(option);
2313
+ // Remove hydrated before copying over classes
2314
+ const copyClasses = Array.from(option.classList)
2315
+ .filter((cls) => cls !== 'hydrated')
2316
+ .join(' ');
2317
+ const optClass = `${OPTION_CLASS} ${copyClasses}`;
2318
+ return {
2319
+ role: isOptionSelected(selectValue, value, this.compareWith) ? 'selected' : '',
2320
+ text: option.textContent,
2321
+ cssClass: optClass,
2322
+ handler: () => {
2323
+ this.value = value;
2324
+ },
2325
+ };
2326
+ });
2327
+ // Add "cancel" button
2328
+ actionSheetButtons.push({
2329
+ text: this.cancelText,
2330
+ role: 'cancel',
2331
+ handler: () => {
2332
+ this.ionCancel.emit();
2333
+ },
2334
+ });
2335
+ return actionSheetButtons;
2336
+ }
2337
+ createAlertInputs(data, inputType, selectValue) {
2338
+ const alertInputs = data.map((option) => {
2339
+ const value = getOptionValue(option);
2340
+ // Remove hydrated before copying over classes
2341
+ const copyClasses = Array.from(option.classList)
2342
+ .filter((cls) => cls !== 'hydrated')
2343
+ .join(' ');
2344
+ const optClass = `${OPTION_CLASS} ${copyClasses}`;
2345
+ return {
2346
+ type: inputType,
2347
+ cssClass: optClass,
2348
+ label: option.textContent || '',
2349
+ value,
2350
+ checked: isOptionSelected(selectValue, value, this.compareWith),
2351
+ disabled: option.disabled,
2352
+ };
2353
+ });
2354
+ return alertInputs;
2355
+ }
2356
+ createPopoverOptions(data, selectValue) {
2357
+ const popoverOptions = data.map((option) => {
2358
+ const value = getOptionValue(option);
2359
+ // Remove hydrated before copying over classes
2360
+ const copyClasses = Array.from(option.classList)
2361
+ .filter((cls) => cls !== 'hydrated')
2362
+ .join(' ');
2363
+ const optClass = `${OPTION_CLASS} ${copyClasses}`;
2364
+ return {
2365
+ text: option.textContent || '',
2366
+ cssClass: optClass,
2367
+ value,
2368
+ checked: isOptionSelected(selectValue, value, this.compareWith),
2369
+ disabled: option.disabled,
2370
+ handler: (selected) => {
2371
+ this.value = selected;
2372
+ if (!this.multiple) {
2373
+ this.close();
2374
+ }
2375
+ },
2376
+ };
2377
+ });
2378
+ return popoverOptions;
2379
+ }
2380
+ async openPopover(ev) {
2381
+ const interfaceOptions = this.interfaceOptions;
2382
+ const mode = ionicGlobal.getIonMode(this);
2383
+ const showBackdrop = mode === 'md' ? false : true;
2384
+ const multiple = this.multiple;
2385
+ const value = this.value;
2386
+ let event = ev;
2387
+ let size = 'auto';
2388
+ const item = this.el.closest('ion-item');
2389
+ // If the select is inside of an item containing a floating
2390
+ // or stacked label then the popover should take up the
2391
+ // full width of the item when it presents
2392
+ if (item && (item.classList.contains('item-label-floating') || item.classList.contains('item-label-stacked'))) {
2393
+ event = Object.assign(Object.assign({}, ev), { detail: {
2394
+ ionShadowTarget: item,
2395
+ } });
2396
+ size = 'cover';
2397
+ }
2398
+ const popoverOpts = Object.assign(Object.assign({ mode,
2399
+ event, alignment: 'center', size,
2400
+ showBackdrop }, interfaceOptions), { component: 'ion-select-popover', cssClass: ['select-popover', interfaceOptions.cssClass], componentProps: {
2401
+ header: interfaceOptions.header,
2402
+ subHeader: interfaceOptions.subHeader,
2403
+ message: interfaceOptions.message,
2404
+ multiple,
2405
+ value,
2406
+ options: this.createPopoverOptions(this.childOpts, value),
2407
+ } });
2408
+ return overlays.popoverController.create(popoverOpts);
2409
+ }
2410
+ async openActionSheet() {
2411
+ const mode = ionicGlobal.getIonMode(this);
2412
+ const interfaceOptions = this.interfaceOptions;
2413
+ const actionSheetOpts = Object.assign(Object.assign({ mode }, interfaceOptions), { buttons: this.createActionSheetButtons(this.childOpts, this.value), cssClass: ['select-action-sheet', interfaceOptions.cssClass] });
2414
+ return overlays.actionSheetController.create(actionSheetOpts);
2415
+ }
2416
+ async openAlert() {
2417
+ const label = this.getLabel();
2418
+ const labelText = label ? label.textContent : null;
2419
+ const interfaceOptions = this.interfaceOptions;
2420
+ const inputType = this.multiple ? 'checkbox' : 'radio';
2421
+ const mode = ionicGlobal.getIonMode(this);
2422
+ const alertOpts = Object.assign(Object.assign({ mode }, interfaceOptions), { header: interfaceOptions.header ? interfaceOptions.header : labelText, inputs: this.createAlertInputs(this.childOpts, inputType, this.value), buttons: [
2423
+ {
2424
+ text: this.cancelText,
2425
+ role: 'cancel',
2426
+ handler: () => {
2427
+ this.ionCancel.emit();
2428
+ },
2429
+ },
2430
+ {
2431
+ text: this.okText,
2432
+ handler: (selectedValues) => {
2433
+ this.value = selectedValues;
2434
+ },
2435
+ },
2436
+ ], cssClass: [
2437
+ 'select-alert',
2438
+ interfaceOptions.cssClass,
2439
+ this.multiple ? 'multiple-select-alert' : 'single-select-alert',
2440
+ ] });
2441
+ return overlays.alertController.create(alertOpts);
2442
+ }
2443
+ /**
2444
+ * Close the select interface.
2445
+ */
2446
+ close() {
2447
+ // TODO check !this.overlay || !this.isFocus()
2448
+ if (!this.overlay) {
2449
+ return Promise.resolve(false);
2450
+ }
2451
+ return this.overlay.dismiss();
2452
+ }
2453
+ getLabel() {
2454
+ return helpers.findItemLabel(this.el);
2455
+ }
2456
+ hasValue() {
2457
+ return this.getText() !== '';
2458
+ }
2459
+ get childOpts() {
2460
+ return Array.from(this.el.querySelectorAll('ion-select-option'));
2461
+ }
2462
+ getText() {
2463
+ const selectedText = this.selectedText;
2464
+ if (selectedText != null && selectedText !== '') {
2465
+ return selectedText;
2466
+ }
2467
+ return generateText(this.childOpts, this.value, this.compareWith);
2468
+ }
2469
+ setFocus() {
2470
+ if (this.focusEl) {
2471
+ this.focusEl.focus();
2472
+ }
2473
+ }
2474
+ emitStyle() {
2475
+ this.ionStyle.emit({
2476
+ interactive: true,
2477
+ 'interactive-disabled': this.disabled,
2478
+ select: true,
2479
+ 'select-disabled': this.disabled,
2480
+ 'has-placeholder': this.placeholder !== undefined,
2481
+ 'has-value': this.hasValue(),
2482
+ 'has-focus': this.isExpanded,
2483
+ });
2484
+ }
2485
+ render() {
2486
+ const { disabled, el, inputId, isExpanded, name, placeholder, value } = this;
2487
+ const mode = ionicGlobal.getIonMode(this);
2488
+ const { labelText, labelId } = helpers.getAriaLabel(el, inputId);
2489
+ helpers.renderHiddenInput(true, el, name, parseValue(value), disabled);
2490
+ const displayValue = this.getText();
2491
+ let addPlaceholderClass = false;
2492
+ let selectText = displayValue;
2493
+ if (selectText === '' && placeholder !== undefined) {
2494
+ selectText = placeholder;
2495
+ addPlaceholderClass = true;
2496
+ }
2497
+ const selectTextClasses = {
2498
+ 'select-text': true,
2499
+ 'select-placeholder': addPlaceholderClass,
2500
+ };
2501
+ const textPart = addPlaceholderClass ? 'placeholder' : 'text';
2502
+ // If there is a label then we need to concatenate it with the
2503
+ // current value (or placeholder) and a comma so it separates
2504
+ // nicely when the screen reader announces it, otherwise just
2505
+ // announce the value / placeholder
2506
+ const displayLabel = labelText !== undefined ? (selectText !== '' ? `${selectText}, ${labelText}` : labelText) : selectText;
2507
+ return (index$1.h(index$1.Host, { onClick: this.onClick, role: "button", "aria-haspopup": "listbox", "aria-disabled": disabled ? 'true' : null, "aria-label": displayLabel, class: {
2508
+ [mode]: true,
2509
+ 'in-item': theme.hostContext('ion-item', el),
2510
+ 'select-disabled': disabled,
2511
+ 'select-expanded': isExpanded,
2512
+ } }, index$1.h("div", { "aria-hidden": "true", class: selectTextClasses, part: textPart }, selectText), index$1.h("div", { class: "select-icon", role: "presentation", part: "icon" }, index$1.h("div", { class: "select-icon-inner" })), index$1.h("label", { id: labelId }, displayLabel), index$1.h("button", { type: "button", disabled: disabled, id: inputId, "aria-labelledby": labelId, "aria-haspopup": "listbox", "aria-expanded": `${isExpanded}`, onFocus: this.onFocus, onBlur: this.onBlur, ref: (focusEl) => (this.focusEl = focusEl) })));
2513
+ }
2514
+ get el() { return index$1.getElement(this); }
2515
+ static get watchers() { return {
2516
+ "disabled": ["styleChanged"],
2517
+ "placeholder": ["styleChanged"],
2518
+ "isExpanded": ["styleChanged"],
2519
+ "value": ["valueChanged"]
2520
+ }; }
2521
+ };
2522
+ const isOptionSelected = (currentValue, compareValue, compareWith) => {
2523
+ if (currentValue === undefined) {
2524
+ return false;
2525
+ }
2526
+ if (Array.isArray(currentValue)) {
2527
+ return currentValue.some((val) => compareOptions(val, compareValue, compareWith));
2528
+ }
2529
+ else {
2530
+ return compareOptions(currentValue, compareValue, compareWith);
2531
+ }
2532
+ };
2533
+ const getOptionValue = (el) => {
2534
+ const value = el.value;
2535
+ return value === undefined ? el.textContent || '' : value;
2536
+ };
2537
+ const parseValue = (value) => {
2538
+ if (value == null) {
2539
+ return undefined;
2540
+ }
2541
+ if (Array.isArray(value)) {
2542
+ return value.join(',');
2543
+ }
2544
+ return value.toString();
2545
+ };
2546
+ const compareOptions = (currentValue, compareValue, compareWith) => {
2547
+ if (typeof compareWith === 'function') {
2548
+ return compareWith(currentValue, compareValue);
2549
+ }
2550
+ else if (typeof compareWith === 'string') {
2551
+ return currentValue[compareWith] === compareValue[compareWith];
2552
+ }
2553
+ else {
2554
+ return Array.isArray(compareValue) ? compareValue.includes(currentValue) : currentValue === compareValue;
2555
+ }
2556
+ };
2557
+ const generateText = (opts, value, compareWith) => {
2558
+ if (value === undefined) {
2559
+ return '';
2560
+ }
2561
+ if (Array.isArray(value)) {
2562
+ return value
2563
+ .map((v) => textForValue(opts, v, compareWith))
2564
+ .filter((opt) => opt !== null)
2565
+ .join(', ');
2566
+ }
2567
+ else {
2568
+ return textForValue(opts, value, compareWith) || '';
2569
+ }
2570
+ };
2571
+ const textForValue = (opts, value, compareWith) => {
2572
+ const selectOpt = opts.find((opt) => {
2573
+ return compareOptions(getOptionValue(opt), value, compareWith);
2574
+ });
2575
+ return selectOpt ? selectOpt.textContent : null;
2576
+ };
2577
+ let selectIds = 0;
2578
+ const OPTION_CLASS = 'select-interface-option';
2579
+ Select.style = {
2580
+ ios: selectIosCss,
2581
+ md: selectMdCss
2582
+ };
2583
+
2584
+ const selectOptionCss = ":host{display:none}";
2585
+
2586
+ const SelectOption = class {
2587
+ constructor(hostRef) {
2588
+ index$1.registerInstance(this, hostRef);
2589
+ this.inputId = `ion-selopt-${selectOptionIds++}`;
2590
+ /**
2591
+ * If `true`, the user cannot interact with the select option. This property does not apply when `interface="action-sheet"` as `ion-action-sheet` does not allow for disabled buttons.
2592
+ */
2593
+ this.disabled = false;
2594
+ }
2595
+ render() {
2596
+ return index$1.h(index$1.Host, { role: "option", id: this.inputId, class: ionicGlobal.getIonMode(this) });
2597
+ }
2598
+ get el() { return index$1.getElement(this); }
2599
+ };
2600
+ let selectOptionIds = 0;
2601
+ SelectOption.style = selectOptionCss;
2602
+
2116
2603
  const selectPopoverIosCss = ".sc-ion-select-popover-ios-h ion-list.sc-ion-select-popover-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}ion-list-header.sc-ion-select-popover-ios,ion-label.sc-ion-select-popover-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}";
2117
2604
 
2118
2605
  const selectPopoverMdCss = ".sc-ion-select-popover-md-h ion-list.sc-ion-select-popover-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}ion-list-header.sc-ion-select-popover-md,ion-label.sc-ion-select-popover-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}ion-list.sc-ion-select-popover-md ion-radio.sc-ion-select-popover-md{opacity:0}ion-item.sc-ion-select-popover-md{--inner-border-width:0}.item-radio-checked.sc-ion-select-popover-md{--background:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.08);--background-focused:var(--ion-color-primary, #3880ff);--background-focused-opacity:0.2;--background-hover:var(--ion-color-primary, #3880ff);--background-hover-opacity:0.12}.item-checkbox-checked.sc-ion-select-popover-md{--background-activated:var(--ion-item-color, var(--ion-text-color, #000));--background-focused:var(--ion-item-color, var(--ion-text-color, #000));--background-hover:var(--ion-item-color, var(--ion-text-color, #000));--color:var(--ion-color-primary, #3880ff)}";
@@ -2201,7 +2688,248 @@ SelectPopover.style = {
2201
2688
  md: selectPopoverMdCss
2202
2689
  };
2203
2690
 
2691
+ const textareaIosCss = ".sc-ion-textarea-ios-h{--background:initial;--color:initial;--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:0.5;--padding-top:0;--padding-end:0;--padding-bottom:0;--padding-start:0;--border-radius:0;display:block;position:relative;flex:1;width:100%;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);white-space:pre-wrap;z-index:2;box-sizing:border-box}.ion-color.sc-ion-textarea-ios-h{background:initial}.ion-color.sc-ion-textarea-ios-h{color:var(--ion-color-base)}ion-item.sc-ion-textarea-ios-h,ion-item .sc-ion-textarea-ios-h{align-self:baseline}ion-item.sc-ion-textarea-ios-h:not(.item-label),ion-item:not(.item-label) .sc-ion-textarea-ios-h{--padding-start:0}.textarea-wrapper.sc-ion-textarea-ios{display:grid;min-width:inherit;max-width:inherit;min-height:inherit;max-height:inherit}.textarea-wrapper.sc-ion-textarea-ios::after{white-space:pre-wrap;content:attr(data-replicated-value) \" \";visibility:hidden}.native-textarea.sc-ion-textarea-ios,.textarea-wrapper.sc-ion-textarea-ios::after{padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;grid-area:1/1/2/2}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.native-textarea.sc-ion-textarea-ios,.textarea-wrapper.sc-ion-textarea-ios::after{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.native-textarea.sc-ion-textarea-ios{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;max-width:100%;max-height:100%;border:0;outline:none;background:transparent;box-sizing:border-box;resize:none;appearance:none;overflow:hidden}.native-textarea.sc-ion-textarea-ios::placeholder{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea[disabled].sc-ion-textarea-ios{opacity:0.4}.cloned-input.sc-ion-textarea-ios{left:0;top:0;position:absolute;pointer-events:none}[dir=rtl].sc-ion-textarea-ios .cloned-input.sc-ion-textarea-ios,[dir=rtl].sc-ion-textarea-ios-h .cloned-input.sc-ion-textarea-ios,[dir=rtl] .sc-ion-textarea-ios-h .cloned-input.sc-ion-textarea-ios{left:unset;right:unset;right:0}[auto-grow].sc-ion-textarea-ios-h .cloned-input.sc-ion-textarea-ios{height:100%}.item-label-floating.item-has-placeholder.sc-ion-textarea-ios-h:not(.item-has-value),.item-label-floating.item-has-placeholder:not(.item-has-value) .sc-ion-textarea-ios-h{opacity:0}.item-label-floating.item-has-placeholder.sc-ion-textarea-ios-h:not(.item-has-value).item-has-focus,.item-label-floating.item-has-placeholder:not(.item-has-value).item-has-focus .sc-ion-textarea-ios-h{transition:opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1);opacity:1}.sc-ion-textarea-ios-h{--padding-top:10px;--padding-end:10px;--padding-bottom:10px;--padding-start:0;font-size:inherit}.item-label-stacked.sc-ion-textarea-ios-h,.item-label-stacked .sc-ion-textarea-ios-h,.item-label-floating.sc-ion-textarea-ios-h,.item-label-floating .sc-ion-textarea-ios-h{--padding-top:8px;--padding-bottom:8px;--padding-start:0px}";
2692
+
2693
+ const textareaMdCss = ".sc-ion-textarea-md-h{--background:initial;--color:initial;--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:0.5;--padding-top:0;--padding-end:0;--padding-bottom:0;--padding-start:0;--border-radius:0;display:block;position:relative;flex:1;width:100%;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);white-space:pre-wrap;z-index:2;box-sizing:border-box}.ion-color.sc-ion-textarea-md-h{background:initial}.ion-color.sc-ion-textarea-md-h{color:var(--ion-color-base)}ion-item.sc-ion-textarea-md-h,ion-item .sc-ion-textarea-md-h{align-self:baseline}ion-item.sc-ion-textarea-md-h:not(.item-label),ion-item:not(.item-label) .sc-ion-textarea-md-h{--padding-start:0}.textarea-wrapper.sc-ion-textarea-md{display:grid;min-width:inherit;max-width:inherit;min-height:inherit;max-height:inherit}.textarea-wrapper.sc-ion-textarea-md::after{white-space:pre-wrap;content:attr(data-replicated-value) \" \";visibility:hidden}.native-textarea.sc-ion-textarea-md,.textarea-wrapper.sc-ion-textarea-md::after{padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;grid-area:1/1/2/2}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.native-textarea.sc-ion-textarea-md,.textarea-wrapper.sc-ion-textarea-md::after{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.native-textarea.sc-ion-textarea-md{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;max-width:100%;max-height:100%;border:0;outline:none;background:transparent;box-sizing:border-box;resize:none;appearance:none;overflow:hidden}.native-textarea.sc-ion-textarea-md::placeholder{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea[disabled].sc-ion-textarea-md{opacity:0.4}.cloned-input.sc-ion-textarea-md{left:0;top:0;position:absolute;pointer-events:none}[dir=rtl].sc-ion-textarea-md .cloned-input.sc-ion-textarea-md,[dir=rtl].sc-ion-textarea-md-h .cloned-input.sc-ion-textarea-md,[dir=rtl] .sc-ion-textarea-md-h .cloned-input.sc-ion-textarea-md{left:unset;right:unset;right:0}[auto-grow].sc-ion-textarea-md-h .cloned-input.sc-ion-textarea-md{height:100%}.item-label-floating.item-has-placeholder.sc-ion-textarea-md-h:not(.item-has-value),.item-label-floating.item-has-placeholder:not(.item-has-value) .sc-ion-textarea-md-h{opacity:0}.item-label-floating.item-has-placeholder.sc-ion-textarea-md-h:not(.item-has-value).item-has-focus,.item-label-floating.item-has-placeholder:not(.item-has-value).item-has-focus .sc-ion-textarea-md-h{transition:opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1);opacity:1}.sc-ion-textarea-md-h{--padding-top:10px;--padding-end:0;--padding-bottom:11px;--padding-start:8px;margin-left:0;margin-right:0;margin-top:8px;margin-bottom:0;font-size:inherit}.item-label-stacked.sc-ion-textarea-md-h,.item-label-stacked .sc-ion-textarea-md-h,.item-label-floating.sc-ion-textarea-md-h,.item-label-floating .sc-ion-textarea-md-h{--padding-top:8px;--padding-bottom:8px;--padding-start:0}";
2694
+
2695
+ const Textarea = class {
2696
+ constructor(hostRef) {
2697
+ index$1.registerInstance(this, hostRef);
2698
+ this.ionChange = index$1.createEvent(this, "ionChange", 7);
2699
+ this.ionInput = index$1.createEvent(this, "ionInput", 7);
2700
+ this.ionStyle = index$1.createEvent(this, "ionStyle", 7);
2701
+ this.ionBlur = index$1.createEvent(this, "ionBlur", 7);
2702
+ this.ionFocus = index$1.createEvent(this, "ionFocus", 7);
2703
+ this.inputId = `ion-textarea-${textareaIds++}`;
2704
+ this.didBlurAfterEdit = false;
2705
+ this.inheritedAttributes = {};
2706
+ /**
2707
+ * This is required for a WebKit bug which requires us to
2708
+ * blur and focus an input to properly focus the input in
2709
+ * an item with delegatesFocus. It will no longer be needed
2710
+ * with iOS 14.
2711
+ *
2712
+ * @internal
2713
+ */
2714
+ this.fireFocusEvents = true;
2715
+ this.hasFocus = false;
2716
+ /**
2717
+ * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.
2718
+ * Available options: `"off"`, `"none"`, `"on"`, `"sentences"`, `"words"`, `"characters"`.
2719
+ */
2720
+ this.autocapitalize = 'none';
2721
+ /**
2722
+ * This Boolean attribute lets you specify that a form control should have input focus when the page loads.
2723
+ */
2724
+ this.autofocus = false;
2725
+ /**
2726
+ * If `true`, the value will be cleared after focus upon edit. Defaults to `true` when `type` is `"password"`, `false` for all other types.
2727
+ */
2728
+ this.clearOnEdit = false;
2729
+ /**
2730
+ * Set the amount of time, in milliseconds, to wait to trigger the `ionChange` event after each keystroke. This also impacts form bindings such as `ngModel` or `v-model`.
2731
+ */
2732
+ this.debounce = 0;
2733
+ /**
2734
+ * If `true`, the user cannot interact with the textarea.
2735
+ */
2736
+ this.disabled = false;
2737
+ /**
2738
+ * The name of the control, which is submitted with the form data.
2739
+ */
2740
+ this.name = this.inputId;
2741
+ /**
2742
+ * If `true`, the user cannot modify the value.
2743
+ */
2744
+ this.readonly = false;
2745
+ /**
2746
+ * If `true`, the user must fill in a value before submitting a form.
2747
+ */
2748
+ this.required = false;
2749
+ /**
2750
+ * If `true`, the element will have its spelling and grammar checked.
2751
+ */
2752
+ this.spellcheck = false;
2753
+ /**
2754
+ * If `true`, the textarea container will grow and shrink based
2755
+ * on the contents of the textarea.
2756
+ */
2757
+ this.autoGrow = false;
2758
+ /**
2759
+ * The value of the textarea.
2760
+ */
2761
+ this.value = '';
2762
+ this.onInput = (ev) => {
2763
+ if (this.nativeInput) {
2764
+ this.value = this.nativeInput.value;
2765
+ }
2766
+ this.emitStyle();
2767
+ this.ionInput.emit(ev);
2768
+ };
2769
+ this.onFocus = (ev) => {
2770
+ this.hasFocus = true;
2771
+ this.focusChange();
2772
+ if (this.fireFocusEvents) {
2773
+ this.ionFocus.emit(ev);
2774
+ }
2775
+ };
2776
+ this.onBlur = (ev) => {
2777
+ this.hasFocus = false;
2778
+ this.focusChange();
2779
+ if (this.fireFocusEvents) {
2780
+ this.ionBlur.emit(ev);
2781
+ }
2782
+ };
2783
+ this.onKeyDown = () => {
2784
+ this.checkClearOnEdit();
2785
+ };
2786
+ }
2787
+ debounceChanged() {
2788
+ this.ionChange = helpers.debounceEvent(this.ionChange, this.debounce);
2789
+ }
2790
+ disabledChanged() {
2791
+ this.emitStyle();
2792
+ }
2793
+ /**
2794
+ * Update the native input element when the value changes
2795
+ */
2796
+ valueChanged() {
2797
+ const nativeInput = this.nativeInput;
2798
+ const value = this.getValue();
2799
+ if (nativeInput && nativeInput.value !== value) {
2800
+ nativeInput.value = value;
2801
+ }
2802
+ this.runAutoGrow();
2803
+ this.emitStyle();
2804
+ this.ionChange.emit({ value });
2805
+ }
2806
+ connectedCallback() {
2807
+ this.emitStyle();
2808
+ this.debounceChanged();
2809
+ {
2810
+ document.dispatchEvent(new CustomEvent('ionInputDidLoad', {
2811
+ detail: this.el,
2812
+ }));
2813
+ }
2814
+ }
2815
+ disconnectedCallback() {
2816
+ {
2817
+ document.dispatchEvent(new CustomEvent('ionInputDidUnload', {
2818
+ detail: this.el,
2819
+ }));
2820
+ }
2821
+ }
2822
+ componentWillLoad() {
2823
+ this.inheritedAttributes = Object.assign(Object.assign({}, helpers.inheritAriaAttributes(this.el)), helpers.inheritAttributes(this.el, ['title']));
2824
+ }
2825
+ componentDidLoad() {
2826
+ this.runAutoGrow();
2827
+ }
2828
+ /**
2829
+ * Sets focus on the native `textarea` in `ion-textarea`. Use this method instead of the global
2830
+ * `textarea.focus()`.
2831
+ */
2832
+ async setFocus() {
2833
+ if (this.nativeInput) {
2834
+ this.nativeInput.focus();
2835
+ }
2836
+ }
2837
+ /**
2838
+ * Sets blur on the native `textarea` in `ion-textarea`. Use this method instead of the global
2839
+ * `textarea.blur()`.
2840
+ * @internal
2841
+ */
2842
+ async setBlur() {
2843
+ if (this.nativeInput) {
2844
+ this.nativeInput.blur();
2845
+ }
2846
+ }
2847
+ /**
2848
+ * Returns the native `<textarea>` element used under the hood.
2849
+ */
2850
+ getInputElement() {
2851
+ return Promise.resolve(this.nativeInput);
2852
+ }
2853
+ emitStyle() {
2854
+ this.ionStyle.emit({
2855
+ interactive: true,
2856
+ textarea: true,
2857
+ input: true,
2858
+ 'interactive-disabled': this.disabled,
2859
+ 'has-placeholder': this.placeholder !== undefined,
2860
+ 'has-value': this.hasValue(),
2861
+ 'has-focus': this.hasFocus,
2862
+ });
2863
+ }
2864
+ runAutoGrow() {
2865
+ if (this.nativeInput && this.autoGrow) {
2866
+ index$1.writeTask(() => {
2867
+ var _a;
2868
+ if (this.textareaWrapper) {
2869
+ // Replicated value is an attribute to be used in the stylesheet
2870
+ // to set the inner contents of a pseudo element.
2871
+ this.textareaWrapper.dataset.replicatedValue = (_a = this.value) !== null && _a !== void 0 ? _a : '';
2872
+ }
2873
+ });
2874
+ }
2875
+ }
2876
+ /**
2877
+ * Check if we need to clear the text input if clearOnEdit is enabled
2878
+ */
2879
+ checkClearOnEdit() {
2880
+ if (!this.clearOnEdit) {
2881
+ return;
2882
+ }
2883
+ // Did the input value change after it was blurred and edited?
2884
+ if (this.didBlurAfterEdit && this.hasValue()) {
2885
+ // Clear the input
2886
+ this.value = '';
2887
+ }
2888
+ // Reset the flag
2889
+ this.didBlurAfterEdit = false;
2890
+ }
2891
+ focusChange() {
2892
+ // If clearOnEdit is enabled and the input blurred but has a value, set a flag
2893
+ if (this.clearOnEdit && !this.hasFocus && this.hasValue()) {
2894
+ this.didBlurAfterEdit = true;
2895
+ }
2896
+ this.emitStyle();
2897
+ }
2898
+ hasValue() {
2899
+ return this.getValue() !== '';
2900
+ }
2901
+ getValue() {
2902
+ return this.value || '';
2903
+ }
2904
+ render() {
2905
+ const mode = ionicGlobal.getIonMode(this);
2906
+ const value = this.getValue();
2907
+ const labelId = this.inputId + '-lbl';
2908
+ const label = helpers.findItemLabel(this.el);
2909
+ if (label) {
2910
+ label.id = labelId;
2911
+ }
2912
+ return (index$1.h(index$1.Host, { "aria-disabled": this.disabled ? 'true' : null, class: theme.createColorClasses(this.color, {
2913
+ [mode]: true,
2914
+ }) }, index$1.h("div", { class: "textarea-wrapper", ref: (el) => (this.textareaWrapper = el) }, index$1.h("textarea", Object.assign({ class: "native-textarea", "aria-labelledby": label ? labelId : null, ref: (el) => (this.nativeInput = el), autoCapitalize: this.autocapitalize, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, disabled: this.disabled, maxLength: this.maxlength, minLength: this.minlength, name: this.name, placeholder: this.placeholder || '', readOnly: this.readonly, required: this.required, spellcheck: this.spellcheck, cols: this.cols, rows: this.rows, wrap: this.wrap, onInput: this.onInput, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeyDown }, this.inheritedAttributes), value))));
2915
+ }
2916
+ get el() { return index$1.getElement(this); }
2917
+ static get watchers() { return {
2918
+ "debounce": ["debounceChanged"],
2919
+ "disabled": ["disabledChanged"],
2920
+ "value": ["valueChanged"]
2921
+ }; }
2922
+ };
2923
+ let textareaIds = 0;
2924
+ Textarea.style = {
2925
+ ios: textareaIosCss,
2926
+ md: textareaMdCss
2927
+ };
2928
+
2204
2929
  exports.ion_action_sheet = ActionSheet;
2205
2930
  exports.ion_alert = Alert;
2206
2931
  exports.ion_popover = Popover;
2932
+ exports.ion_select = Select;
2933
+ exports.ion_select_option = SelectOption;
2207
2934
  exports.ion_select_popover = SelectPopover;
2935
+ exports.ion_textarea = Textarea;