@ionic/core 8.5.2-nightly.20250326 → 8.5.3-dev.11743446543.135a05ae
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/checkbox.js +18 -6
- package/components/ion-datetime.js +5 -5
- package/components/ion-toggle.js +2 -2
- package/components/picker.js +54 -77
- package/dist/cjs/ion-checkbox.cjs.entry.js +18 -6
- package/dist/cjs/ion-datetime_3.cjs.entry.js +5 -5
- package/dist/cjs/ion-picker.cjs.entry.js +54 -77
- package/dist/cjs/ion-toggle.cjs.entry.js +2 -2
- package/dist/collection/components/checkbox/checkbox.ios.css +5 -16
- package/dist/collection/components/checkbox/checkbox.js +16 -4
- package/dist/collection/components/checkbox/checkbox.md.css +5 -16
- package/dist/collection/components/datetime/datetime.js +5 -5
- package/dist/collection/components/picker/picker.js +54 -77
- package/dist/collection/components/toggle/toggle.js +2 -2
- package/dist/docs.json +1 -1
- package/dist/esm/ion-checkbox.entry.js +18 -6
- package/dist/esm/ion-datetime_3.entry.js +5 -5
- package/dist/esm/ion-picker.entry.js +54 -77
- package/dist/esm/ion-toggle.entry.js +2 -2
- package/dist/esm-es5/ion-checkbox.entry.js +1 -1
- package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
- package/dist/esm-es5/ion-picker.entry.js +1 -1
- package/dist/esm-es5/ion-toggle.entry.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-2567237c.entry.js +4 -0
- package/dist/ionic/p-2720f98d.entry.js +4 -0
- package/dist/ionic/{p-df54ab6b.system.entry.js → p-2a445f16.system.entry.js} +1 -1
- package/dist/ionic/{p-e89451e8.system.entry.js → p-4ea4c73a.system.entry.js} +1 -1
- package/dist/ionic/p-96eec056.entry.js +4 -0
- package/dist/ionic/{p-e29c5aab.system.entry.js → p-b1339f3e.system.entry.js} +1 -1
- package/dist/ionic/p-bd52cead.entry.js +4 -0
- package/dist/ionic/p-bf64af90.system.js +1 -1
- package/dist/ionic/p-e3284879.system.entry.js +4 -0
- package/dist/types/components/checkbox/checkbox.d.ts +2 -0
- package/dist/types/components/picker/picker.d.ts +8 -0
- package/hydrate/index.js +79 -90
- package/hydrate/index.mjs +79 -90
- package/package.json +1 -1
- package/dist/ionic/p-056b4c2a.system.entry.js +0 -4
- package/dist/ionic/p-0904eb08.entry.js +0 -4
- package/dist/ionic/p-180b4f9a.entry.js +0 -4
- package/dist/ionic/p-7514f2f5.entry.js +0 -4
- package/dist/ionic/p-ff6be116.entry.js +0 -4
|
@@ -323,13 +323,59 @@ const Picker = class {
|
|
|
323
323
|
* or trailing zeros when looking at the item text.
|
|
324
324
|
*/
|
|
325
325
|
this.searchColumn = (colEl, value, zeroBehavior = 'start') => {
|
|
326
|
+
if (!value) {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
326
329
|
const behavior = zeroBehavior === 'start' ? /^0+/ : /0$/;
|
|
330
|
+
value = value.replace(behavior, '');
|
|
327
331
|
const option = Array.from(colEl.querySelectorAll('ion-picker-column-option')).find((el) => {
|
|
328
332
|
return el.disabled !== true && el.textContent.replace(behavior, '') === value;
|
|
329
333
|
});
|
|
330
334
|
if (option) {
|
|
331
335
|
colEl.setValue(option.value);
|
|
332
336
|
}
|
|
337
|
+
return !!option;
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Attempts to intelligently search the first and second
|
|
341
|
+
* column as if they're number columns for the provided numbers
|
|
342
|
+
* where the first two numbers are the first column
|
|
343
|
+
* and the last 2 are the last column. Tries to allow for the first
|
|
344
|
+
* number to be ignored for situations where typos occurred.
|
|
345
|
+
*/
|
|
346
|
+
this.multiColumnSearch = (firstColumn, secondColumn, input) => {
|
|
347
|
+
if (input.length === 0) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
const inputArray = input.split('');
|
|
351
|
+
const hourValue = inputArray.slice(0, 2).join('');
|
|
352
|
+
// Try to find a match for the first two digits in the first column
|
|
353
|
+
const foundHour = this.searchColumn(firstColumn, hourValue);
|
|
354
|
+
// If we have more than 2 digits and found a match for hours,
|
|
355
|
+
// use the remaining digits for the second column (minutes)
|
|
356
|
+
if (inputArray.length > 2 && foundHour) {
|
|
357
|
+
const minuteValue = inputArray.slice(2, 4).join('');
|
|
358
|
+
this.searchColumn(secondColumn, minuteValue);
|
|
359
|
+
}
|
|
360
|
+
// If we couldn't find a match for the two-digit hour, try single digit approaches
|
|
361
|
+
else if (!foundHour && inputArray.length >= 1) {
|
|
362
|
+
// First try the first digit as a single-digit hour
|
|
363
|
+
let singleDigitHour = inputArray[0];
|
|
364
|
+
let singleDigitFound = this.searchColumn(firstColumn, singleDigitHour);
|
|
365
|
+
// If that didn't work, try the second digit as a single-digit hour
|
|
366
|
+
// (handles case where user made a typo in the first digit, or they typed over themselves)
|
|
367
|
+
if (!singleDigitFound) {
|
|
368
|
+
inputArray.shift();
|
|
369
|
+
singleDigitHour = inputArray[0];
|
|
370
|
+
singleDigitFound = this.searchColumn(firstColumn, singleDigitHour);
|
|
371
|
+
}
|
|
372
|
+
// If we found a single-digit hour and have remaining digits,
|
|
373
|
+
// use up to 2 of the remaining digits for the second column
|
|
374
|
+
if (singleDigitFound && inputArray.length > 1) {
|
|
375
|
+
const remainingDigits = inputArray.slice(1, 3).join('');
|
|
376
|
+
this.searchColumn(secondColumn, remainingDigits);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
333
379
|
};
|
|
334
380
|
this.selectMultiColumn = () => {
|
|
335
381
|
const { inputEl, el } = this;
|
|
@@ -340,82 +386,13 @@ const Picker = class {
|
|
|
340
386
|
const firstColumn = numericPickers[0];
|
|
341
387
|
const lastColumn = numericPickers[1];
|
|
342
388
|
let value = inputEl.value;
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
case 2:
|
|
349
|
-
/**
|
|
350
|
-
* If the first character is `0` or `1` it is
|
|
351
|
-
* possible that users are trying to type `09`
|
|
352
|
-
* or `11` into the hour field, so we should look
|
|
353
|
-
* at that first.
|
|
354
|
-
*/
|
|
355
|
-
const firstCharacter = inputEl.value.substring(0, 1);
|
|
356
|
-
value = firstCharacter === '0' || firstCharacter === '1' ? inputEl.value : firstCharacter;
|
|
357
|
-
this.searchColumn(firstColumn, value);
|
|
358
|
-
/**
|
|
359
|
-
* If only checked the first value,
|
|
360
|
-
* we can check the second value
|
|
361
|
-
* for a match in the minutes column
|
|
362
|
-
*/
|
|
363
|
-
if (value.length === 1) {
|
|
364
|
-
minuteValue = inputEl.value.substring(inputEl.value.length - 1);
|
|
365
|
-
this.searchColumn(lastColumn, minuteValue, 'end');
|
|
366
|
-
}
|
|
367
|
-
break;
|
|
368
|
-
case 3:
|
|
369
|
-
/**
|
|
370
|
-
* If the first character is `0` or `1` it is
|
|
371
|
-
* possible that users are trying to type `09`
|
|
372
|
-
* or `11` into the hour field, so we should look
|
|
373
|
-
* at that first.
|
|
374
|
-
*/
|
|
375
|
-
const firstCharacterAgain = inputEl.value.substring(0, 1);
|
|
376
|
-
value =
|
|
377
|
-
firstCharacterAgain === '0' || firstCharacterAgain === '1'
|
|
378
|
-
? inputEl.value.substring(0, 2)
|
|
379
|
-
: firstCharacterAgain;
|
|
380
|
-
this.searchColumn(firstColumn, value);
|
|
381
|
-
/**
|
|
382
|
-
* If only checked the first value,
|
|
383
|
-
* we can check the second value
|
|
384
|
-
* for a match in the minutes column
|
|
385
|
-
*/
|
|
386
|
-
minuteValue = value.length === 1 ? inputEl.value.substring(1) : inputEl.value.substring(2);
|
|
387
|
-
this.searchColumn(lastColumn, minuteValue, 'end');
|
|
388
|
-
break;
|
|
389
|
-
case 4:
|
|
390
|
-
/**
|
|
391
|
-
* If the first character is `0` or `1` it is
|
|
392
|
-
* possible that users are trying to type `09`
|
|
393
|
-
* or `11` into the hour field, so we should look
|
|
394
|
-
* at that first.
|
|
395
|
-
*/
|
|
396
|
-
const firstCharacterAgainAgain = inputEl.value.substring(0, 1);
|
|
397
|
-
value =
|
|
398
|
-
firstCharacterAgainAgain === '0' || firstCharacterAgainAgain === '1'
|
|
399
|
-
? inputEl.value.substring(0, 2)
|
|
400
|
-
: firstCharacterAgainAgain;
|
|
401
|
-
this.searchColumn(firstColumn, value);
|
|
402
|
-
/**
|
|
403
|
-
* If only checked the first value,
|
|
404
|
-
* we can check the second value
|
|
405
|
-
* for a match in the minutes column
|
|
406
|
-
*/
|
|
407
|
-
const minuteValueAgain = value.length === 1
|
|
408
|
-
? inputEl.value.substring(1, inputEl.value.length)
|
|
409
|
-
: inputEl.value.substring(2, inputEl.value.length);
|
|
410
|
-
this.searchColumn(lastColumn, minuteValueAgain, 'end');
|
|
411
|
-
break;
|
|
412
|
-
default:
|
|
413
|
-
const startIndex = inputEl.value.length - 4;
|
|
414
|
-
const newString = inputEl.value.substring(startIndex);
|
|
415
|
-
inputEl.value = newString;
|
|
416
|
-
this.selectMultiColumn();
|
|
417
|
-
break;
|
|
389
|
+
if (value.length > 4) {
|
|
390
|
+
const startIndex = inputEl.value.length - 4;
|
|
391
|
+
const newString = inputEl.value.substring(startIndex);
|
|
392
|
+
inputEl.value = newString;
|
|
393
|
+
value = newString;
|
|
418
394
|
}
|
|
395
|
+
this.multiColumnSearch(firstColumn, lastColumn, value);
|
|
419
396
|
};
|
|
420
397
|
/**
|
|
421
398
|
* Searches the value of the active column
|
|
@@ -484,7 +461,7 @@ const Picker = class {
|
|
|
484
461
|
this.emitInputModeChange();
|
|
485
462
|
}
|
|
486
463
|
render() {
|
|
487
|
-
return (index.h(index.Host, { key: '
|
|
464
|
+
return (index.h(index.Host, { key: '28f81e4ed44a633178561757c5199c2c98f94b74', onPointerDown: (ev) => this.onPointerDown(ev), onClick: () => this.onClick() }, index.h("input", { key: 'abb3d1ad25ef63856af7804111175a4d50008bc0', "aria-hidden": "true", tabindex: -1, inputmode: "numeric", type: "number", onKeyDown: (ev) => {
|
|
488
465
|
var _a;
|
|
489
466
|
/**
|
|
490
467
|
* The "Enter" key represents
|
|
@@ -499,7 +476,7 @@ const Picker = class {
|
|
|
499
476
|
if (ev.key === 'Enter') {
|
|
500
477
|
(_a = this.inputEl) === null || _a === void 0 ? void 0 : _a.blur();
|
|
501
478
|
}
|
|
502
|
-
}, ref: (el) => (this.inputEl = el), onInput: () => this.onInputChange(), onBlur: () => this.exitInputMode() }), index.h("div", { key: '
|
|
479
|
+
}, ref: (el) => (this.inputEl = el), onInput: () => this.onInputChange(), onBlur: () => this.exitInputMode() }), index.h("div", { key: '334a5abdc02e6b127c57177f626d7e4ff5526183', class: "picker-before" }), index.h("div", { key: 'ffd6271931129e88fc7c820e919d684899e420c5', class: "picker-after" }), index.h("div", { key: '78d1d95fd09e04f154ea59f24a1cece72c47ed7b', class: "picker-highlight", ref: (el) => (this.highlightEl = el) }), index.h("slot", { key: '0bd5b9f875d3c71f6cbbde2054baeb1b0a2e8cd5' })));
|
|
503
480
|
}
|
|
504
481
|
get el() { return index.getElement(this); }
|
|
505
482
|
};
|
|
@@ -206,10 +206,10 @@ const Toggle = class {
|
|
|
206
206
|
[`toggle-alignment-${alignment}`]: alignment !== undefined,
|
|
207
207
|
[`toggle-label-placement-${labelPlacement}`]: true,
|
|
208
208
|
[`toggle-${rtl}`]: true,
|
|
209
|
-
}) }, index.h("label", { key: 'f49531391f4513d084061c27ebc4c4eb1dcd02ab', class: "toggle-wrapper" }, index.h("input", Object.assign({ key: '
|
|
209
|
+
}) }, index.h("label", { key: 'f49531391f4513d084061c27ebc4c4eb1dcd02ab', class: "toggle-wrapper" }, index.h("input", Object.assign({ key: 'cf2b9147f9fb408c446c16df596dc73695fab3b5', type: "checkbox", role: "switch", "aria-checked": `${checked}`, checked: checked, disabled: disabled, id: inputId, onFocus: () => this.onFocus(), onBlur: () => this.onBlur(), ref: (focusEl) => (this.focusEl = focusEl), required: required }, { switch: true }, this.inheritedAttributes)), index.h("div", { key: '36639ea6755d2baf1fc8ce7542edf26cc5a1a484', class: {
|
|
210
210
|
'label-text-wrapper': true,
|
|
211
211
|
'label-text-wrapper-hidden': !this.hasLabel,
|
|
212
|
-
}, part: "label" }, index.h("slot", { key: '
|
|
212
|
+
}, part: "label" }, index.h("slot", { key: 'd9cde59b79670012f33745522248ba3e34822c0a' }), this.renderHintText()), index.h("div", { key: 'b0c784a0fe0ce909d01f611210ccc0663e32dfd4', class: "native-wrapper" }, this.renderToggleControl()))));
|
|
213
213
|
}
|
|
214
214
|
get el() { return index.getElement(this); }
|
|
215
215
|
static get watchers() { return {
|
|
@@ -145,23 +145,12 @@
|
|
|
145
145
|
display: none;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
/**
|
|
149
|
+
* The native input must be hidden with display instead of visibility or
|
|
150
|
+
* aria-hidden to avoid accessibility issues with nested interactive elements.
|
|
151
|
+
*/
|
|
148
152
|
input {
|
|
149
|
-
|
|
150
|
-
top: 0;
|
|
151
|
-
left: 0;
|
|
152
|
-
right: 0;
|
|
153
|
-
bottom: 0;
|
|
154
|
-
width: 100%;
|
|
155
|
-
height: 100%;
|
|
156
|
-
margin: 0;
|
|
157
|
-
padding: 0;
|
|
158
|
-
border: 0;
|
|
159
|
-
outline: 0;
|
|
160
|
-
clip: rect(0 0 0 0);
|
|
161
|
-
opacity: 0;
|
|
162
|
-
overflow: hidden;
|
|
163
|
-
-webkit-appearance: none;
|
|
164
|
-
-moz-appearance: none;
|
|
153
|
+
display: none;
|
|
165
154
|
}
|
|
166
155
|
|
|
167
156
|
.native-wrapper {
|
|
@@ -20,6 +20,7 @@ import { getIonMode } from "../../global/ionic-global";
|
|
|
20
20
|
export class Checkbox {
|
|
21
21
|
constructor() {
|
|
22
22
|
this.inputId = `ion-cb-${checkboxIds++}`;
|
|
23
|
+
this.inputLabelId = `${this.inputId}-lbl`;
|
|
23
24
|
this.helperTextId = `${this.inputId}-helper-text`;
|
|
24
25
|
this.errorTextId = `${this.inputId}-error-text`;
|
|
25
26
|
this.inheritedAttributes = {};
|
|
@@ -48,6 +49,14 @@ export class Checkbox {
|
|
|
48
49
|
this.onBlur = () => {
|
|
49
50
|
this.ionBlur.emit();
|
|
50
51
|
};
|
|
52
|
+
this.onKeyDown = (ev) => {
|
|
53
|
+
if (ev.key === ' ') {
|
|
54
|
+
ev.preventDefault();
|
|
55
|
+
if (!this.disabled) {
|
|
56
|
+
this.toggleChecked(ev);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
51
60
|
this.onClick = (ev) => {
|
|
52
61
|
if (this.disabled) {
|
|
53
62
|
return;
|
|
@@ -106,8 +115,11 @@ export class Checkbox {
|
|
|
106
115
|
const { color, checked, disabled, el, getSVGPath, indeterminate, inheritedAttributes, inputId, justify, labelPlacement, name, value, alignment, required, } = this;
|
|
107
116
|
const mode = getIonMode(this);
|
|
108
117
|
const path = getSVGPath(mode, indeterminate);
|
|
118
|
+
const hasLabelContent = el.textContent !== '';
|
|
109
119
|
renderHiddenInput(true, el, name, checked ? value : '', disabled);
|
|
110
|
-
|
|
120
|
+
// The host element must have a checkbox role to ensure proper VoiceOver
|
|
121
|
+
// support in Safari for accessibility.
|
|
122
|
+
return (h(Host, { key: '90bb17a4fae17088524555968a002327400807cf', role: "checkbox", "aria-checked": indeterminate ? 'mixed' : `${checked}`, "aria-describedby": this.getHintTextID(), "aria-invalid": this.getHintTextID() === this.errorTextId, "aria-labelledby": hasLabelContent ? this.inputLabelId : null, "aria-label": inheritedAttributes['aria-label'] || null, "aria-disabled": disabled ? 'true' : null, tabindex: disabled ? undefined : 0, onKeyDown: this.onKeyDown, class: createColorClasses(color, {
|
|
111
123
|
[mode]: true,
|
|
112
124
|
'in-item': hostContext('ion-item', el),
|
|
113
125
|
'checkbox-checked': checked,
|
|
@@ -117,10 +129,10 @@ export class Checkbox {
|
|
|
117
129
|
[`checkbox-justify-${justify}`]: justify !== undefined,
|
|
118
130
|
[`checkbox-alignment-${alignment}`]: alignment !== undefined,
|
|
119
131
|
[`checkbox-label-placement-${labelPlacement}`]: true,
|
|
120
|
-
}), onClick: this.onClick }, h("label", { key: '
|
|
132
|
+
}), onClick: this.onClick }, h("label", { key: '58b5762aa358dff81910874631e06620a2ae1561', class: "checkbox-wrapper", htmlFor: inputId }, h("input", Object.assign({ key: '6abe299d690c345d36d6fd76ab113fdccfbbac52', type: "checkbox", checked: checked ? true : undefined, disabled: disabled, id: inputId, onChange: this.toggleChecked, onFocus: () => this.onFocus(), onBlur: () => this.onBlur(), ref: (focusEl) => (this.focusEl = focusEl), required: required }, inheritedAttributes)), h("div", { key: '2654168e45ccfdbcfe13af8c97e0e21d61ba0150', class: {
|
|
121
133
|
'label-text-wrapper': true,
|
|
122
|
-
'label-text-wrapper-hidden':
|
|
123
|
-
}, part: "label" }, h("slot", { key: '
|
|
134
|
+
'label-text-wrapper-hidden': !hasLabelContent,
|
|
135
|
+
}, part: "label", id: this.inputLabelId }, h("slot", { key: 'a91f3f67d9ddd6b616e48799aba11cae3564d1ab' }), this.renderHintText()), h("div", { key: 'd5a9170b084d09df6b02f416e744085b5bcf0dde', class: "native-wrapper" }, h("svg", { key: 'b1968ce4aa9d652a9f2bdc427ea3a65e6c04df51', class: "checkbox-icon", viewBox: "0 0 24 24", part: "container" }, path)))));
|
|
124
136
|
}
|
|
125
137
|
getSVGPath(mode, indeterminate) {
|
|
126
138
|
let path = indeterminate ? (h("path", { d: "M6 12L18 12", part: "mark" })) : (h("path", { d: "M5.9,12.5l3.8,3.8l8.8-8.8", part: "mark" }));
|
|
@@ -145,23 +145,12 @@
|
|
|
145
145
|
display: none;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
/**
|
|
149
|
+
* The native input must be hidden with display instead of visibility or
|
|
150
|
+
* aria-hidden to avoid accessibility issues with nested interactive elements.
|
|
151
|
+
*/
|
|
148
152
|
input {
|
|
149
|
-
|
|
150
|
-
top: 0;
|
|
151
|
-
left: 0;
|
|
152
|
-
right: 0;
|
|
153
|
-
bottom: 0;
|
|
154
|
-
width: 100%;
|
|
155
|
-
height: 100%;
|
|
156
|
-
margin: 0;
|
|
157
|
-
padding: 0;
|
|
158
|
-
border: 0;
|
|
159
|
-
outline: 0;
|
|
160
|
-
clip: rect(0 0 0 0);
|
|
161
|
-
opacity: 0;
|
|
162
|
-
overflow: hidden;
|
|
163
|
-
-webkit-appearance: none;
|
|
164
|
-
-moz-appearance: none;
|
|
153
|
+
display: none;
|
|
165
154
|
}
|
|
166
155
|
|
|
167
156
|
.native-wrapper {
|
|
@@ -1225,7 +1225,7 @@ export class Datetime {
|
|
|
1225
1225
|
const activePart = this.getActivePartsWithFallback();
|
|
1226
1226
|
return (h("ion-picker-column", { "aria-label": "Select an hour", color: this.color, disabled: disabled, value: activePart.hour, numericInput: true, onIonChange: (ev) => {
|
|
1227
1227
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
|
|
1228
|
-
this.setActiveParts(Object.assign(Object.assign({},
|
|
1228
|
+
this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { hour: ev.detail.value }));
|
|
1229
1229
|
ev.stopPropagation();
|
|
1230
1230
|
} }, hoursData.map((hour) => (h("ion-picker-column-option", { part: hour.value === activePart.hour ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: hour.value, disabled: hour.disabled, value: hour.value }, hour.text)))));
|
|
1231
1231
|
}
|
|
@@ -1236,7 +1236,7 @@ export class Datetime {
|
|
|
1236
1236
|
const activePart = this.getActivePartsWithFallback();
|
|
1237
1237
|
return (h("ion-picker-column", { "aria-label": "Select a minute", color: this.color, disabled: disabled, value: activePart.minute, numericInput: true, onIonChange: (ev) => {
|
|
1238
1238
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
|
|
1239
|
-
this.setActiveParts(Object.assign(Object.assign({},
|
|
1239
|
+
this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { minute: ev.detail.value }));
|
|
1240
1240
|
ev.stopPropagation();
|
|
1241
1241
|
} }, minutesData.map((minute) => (h("ion-picker-column-option", { part: minute.value === activePart.minute ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: minute.value, disabled: minute.disabled, value: minute.value }, minute.text)))));
|
|
1242
1242
|
}
|
|
@@ -1250,7 +1250,7 @@ export class Datetime {
|
|
|
1250
1250
|
return (h("ion-picker-column", { "aria-label": "Select a day period", style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, onIonChange: (ev) => {
|
|
1251
1251
|
const hour = calculateHourFromAMPM(workingParts, ev.detail.value);
|
|
1252
1252
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
|
|
1253
|
-
this.setActiveParts(Object.assign(Object.assign({},
|
|
1253
|
+
this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { ampm: ev.detail.value, hour }));
|
|
1254
1254
|
ev.stopPropagation();
|
|
1255
1255
|
} }, dayPeriodData.map((dayPeriod) => (h("ion-picker-column-option", { part: dayPeriod.value === activePart.ampm ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: dayPeriod.value, disabled: dayPeriod.disabled, value: dayPeriod.value }, dayPeriod.text)))));
|
|
1256
1256
|
}
|
|
@@ -1557,7 +1557,7 @@ export class Datetime {
|
|
|
1557
1557
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
1558
1558
|
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
1559
1559
|
renderHiddenInput(true, el, name, formatValue(value), disabled);
|
|
1560
|
-
return (h(Host, { key: '
|
|
1560
|
+
return (h(Host, { key: '08d429533a09c600b936ad1e022658051c765595', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
|
|
1561
1561
|
[mode]: true,
|
|
1562
1562
|
['datetime-readonly']: readonly,
|
|
1563
1563
|
['datetime-disabled']: disabled,
|
|
@@ -1567,7 +1567,7 @@ export class Datetime {
|
|
|
1567
1567
|
[`datetime-size-${size}`]: true,
|
|
1568
1568
|
[`datetime-prefer-wheel`]: hasWheelVariant,
|
|
1569
1569
|
[`datetime-grid`]: isGridStyle,
|
|
1570
|
-
})) }, h("div", { key: '
|
|
1570
|
+
})) }, h("div", { key: 'f4ff0fcd1e059767a7ef14fcc76ebfd55d23a97b', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
|
|
1571
1571
|
}
|
|
1572
1572
|
static get is() { return "ion-datetime"; }
|
|
1573
1573
|
static get encapsulation() { return "shadow"; }
|
|
@@ -313,13 +313,59 @@ export class Picker {
|
|
|
313
313
|
* or trailing zeros when looking at the item text.
|
|
314
314
|
*/
|
|
315
315
|
this.searchColumn = (colEl, value, zeroBehavior = 'start') => {
|
|
316
|
+
if (!value) {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
316
319
|
const behavior = zeroBehavior === 'start' ? /^0+/ : /0$/;
|
|
320
|
+
value = value.replace(behavior, '');
|
|
317
321
|
const option = Array.from(colEl.querySelectorAll('ion-picker-column-option')).find((el) => {
|
|
318
322
|
return el.disabled !== true && el.textContent.replace(behavior, '') === value;
|
|
319
323
|
});
|
|
320
324
|
if (option) {
|
|
321
325
|
colEl.setValue(option.value);
|
|
322
326
|
}
|
|
327
|
+
return !!option;
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* Attempts to intelligently search the first and second
|
|
331
|
+
* column as if they're number columns for the provided numbers
|
|
332
|
+
* where the first two numbers are the first column
|
|
333
|
+
* and the last 2 are the last column. Tries to allow for the first
|
|
334
|
+
* number to be ignored for situations where typos occurred.
|
|
335
|
+
*/
|
|
336
|
+
this.multiColumnSearch = (firstColumn, secondColumn, input) => {
|
|
337
|
+
if (input.length === 0) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
const inputArray = input.split('');
|
|
341
|
+
const hourValue = inputArray.slice(0, 2).join('');
|
|
342
|
+
// Try to find a match for the first two digits in the first column
|
|
343
|
+
const foundHour = this.searchColumn(firstColumn, hourValue);
|
|
344
|
+
// If we have more than 2 digits and found a match for hours,
|
|
345
|
+
// use the remaining digits for the second column (minutes)
|
|
346
|
+
if (inputArray.length > 2 && foundHour) {
|
|
347
|
+
const minuteValue = inputArray.slice(2, 4).join('');
|
|
348
|
+
this.searchColumn(secondColumn, minuteValue);
|
|
349
|
+
}
|
|
350
|
+
// If we couldn't find a match for the two-digit hour, try single digit approaches
|
|
351
|
+
else if (!foundHour && inputArray.length >= 1) {
|
|
352
|
+
// First try the first digit as a single-digit hour
|
|
353
|
+
let singleDigitHour = inputArray[0];
|
|
354
|
+
let singleDigitFound = this.searchColumn(firstColumn, singleDigitHour);
|
|
355
|
+
// If that didn't work, try the second digit as a single-digit hour
|
|
356
|
+
// (handles case where user made a typo in the first digit, or they typed over themselves)
|
|
357
|
+
if (!singleDigitFound) {
|
|
358
|
+
inputArray.shift();
|
|
359
|
+
singleDigitHour = inputArray[0];
|
|
360
|
+
singleDigitFound = this.searchColumn(firstColumn, singleDigitHour);
|
|
361
|
+
}
|
|
362
|
+
// If we found a single-digit hour and have remaining digits,
|
|
363
|
+
// use up to 2 of the remaining digits for the second column
|
|
364
|
+
if (singleDigitFound && inputArray.length > 1) {
|
|
365
|
+
const remainingDigits = inputArray.slice(1, 3).join('');
|
|
366
|
+
this.searchColumn(secondColumn, remainingDigits);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
323
369
|
};
|
|
324
370
|
this.selectMultiColumn = () => {
|
|
325
371
|
const { inputEl, el } = this;
|
|
@@ -330,82 +376,13 @@ export class Picker {
|
|
|
330
376
|
const firstColumn = numericPickers[0];
|
|
331
377
|
const lastColumn = numericPickers[1];
|
|
332
378
|
let value = inputEl.value;
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
case 2:
|
|
339
|
-
/**
|
|
340
|
-
* If the first character is `0` or `1` it is
|
|
341
|
-
* possible that users are trying to type `09`
|
|
342
|
-
* or `11` into the hour field, so we should look
|
|
343
|
-
* at that first.
|
|
344
|
-
*/
|
|
345
|
-
const firstCharacter = inputEl.value.substring(0, 1);
|
|
346
|
-
value = firstCharacter === '0' || firstCharacter === '1' ? inputEl.value : firstCharacter;
|
|
347
|
-
this.searchColumn(firstColumn, value);
|
|
348
|
-
/**
|
|
349
|
-
* If only checked the first value,
|
|
350
|
-
* we can check the second value
|
|
351
|
-
* for a match in the minutes column
|
|
352
|
-
*/
|
|
353
|
-
if (value.length === 1) {
|
|
354
|
-
minuteValue = inputEl.value.substring(inputEl.value.length - 1);
|
|
355
|
-
this.searchColumn(lastColumn, minuteValue, 'end');
|
|
356
|
-
}
|
|
357
|
-
break;
|
|
358
|
-
case 3:
|
|
359
|
-
/**
|
|
360
|
-
* If the first character is `0` or `1` it is
|
|
361
|
-
* possible that users are trying to type `09`
|
|
362
|
-
* or `11` into the hour field, so we should look
|
|
363
|
-
* at that first.
|
|
364
|
-
*/
|
|
365
|
-
const firstCharacterAgain = inputEl.value.substring(0, 1);
|
|
366
|
-
value =
|
|
367
|
-
firstCharacterAgain === '0' || firstCharacterAgain === '1'
|
|
368
|
-
? inputEl.value.substring(0, 2)
|
|
369
|
-
: firstCharacterAgain;
|
|
370
|
-
this.searchColumn(firstColumn, value);
|
|
371
|
-
/**
|
|
372
|
-
* If only checked the first value,
|
|
373
|
-
* we can check the second value
|
|
374
|
-
* for a match in the minutes column
|
|
375
|
-
*/
|
|
376
|
-
minuteValue = value.length === 1 ? inputEl.value.substring(1) : inputEl.value.substring(2);
|
|
377
|
-
this.searchColumn(lastColumn, minuteValue, 'end');
|
|
378
|
-
break;
|
|
379
|
-
case 4:
|
|
380
|
-
/**
|
|
381
|
-
* If the first character is `0` or `1` it is
|
|
382
|
-
* possible that users are trying to type `09`
|
|
383
|
-
* or `11` into the hour field, so we should look
|
|
384
|
-
* at that first.
|
|
385
|
-
*/
|
|
386
|
-
const firstCharacterAgainAgain = inputEl.value.substring(0, 1);
|
|
387
|
-
value =
|
|
388
|
-
firstCharacterAgainAgain === '0' || firstCharacterAgainAgain === '1'
|
|
389
|
-
? inputEl.value.substring(0, 2)
|
|
390
|
-
: firstCharacterAgainAgain;
|
|
391
|
-
this.searchColumn(firstColumn, value);
|
|
392
|
-
/**
|
|
393
|
-
* If only checked the first value,
|
|
394
|
-
* we can check the second value
|
|
395
|
-
* for a match in the minutes column
|
|
396
|
-
*/
|
|
397
|
-
const minuteValueAgain = value.length === 1
|
|
398
|
-
? inputEl.value.substring(1, inputEl.value.length)
|
|
399
|
-
: inputEl.value.substring(2, inputEl.value.length);
|
|
400
|
-
this.searchColumn(lastColumn, minuteValueAgain, 'end');
|
|
401
|
-
break;
|
|
402
|
-
default:
|
|
403
|
-
const startIndex = inputEl.value.length - 4;
|
|
404
|
-
const newString = inputEl.value.substring(startIndex);
|
|
405
|
-
inputEl.value = newString;
|
|
406
|
-
this.selectMultiColumn();
|
|
407
|
-
break;
|
|
379
|
+
if (value.length > 4) {
|
|
380
|
+
const startIndex = inputEl.value.length - 4;
|
|
381
|
+
const newString = inputEl.value.substring(startIndex);
|
|
382
|
+
inputEl.value = newString;
|
|
383
|
+
value = newString;
|
|
408
384
|
}
|
|
385
|
+
this.multiColumnSearch(firstColumn, lastColumn, value);
|
|
409
386
|
};
|
|
410
387
|
/**
|
|
411
388
|
* Searches the value of the active column
|
|
@@ -474,7 +451,7 @@ export class Picker {
|
|
|
474
451
|
this.emitInputModeChange();
|
|
475
452
|
}
|
|
476
453
|
render() {
|
|
477
|
-
return (h(Host, { key: '
|
|
454
|
+
return (h(Host, { key: '28f81e4ed44a633178561757c5199c2c98f94b74', onPointerDown: (ev) => this.onPointerDown(ev), onClick: () => this.onClick() }, h("input", { key: 'abb3d1ad25ef63856af7804111175a4d50008bc0', "aria-hidden": "true", tabindex: -1, inputmode: "numeric", type: "number", onKeyDown: (ev) => {
|
|
478
455
|
var _a;
|
|
479
456
|
/**
|
|
480
457
|
* The "Enter" key represents
|
|
@@ -489,7 +466,7 @@ export class Picker {
|
|
|
489
466
|
if (ev.key === 'Enter') {
|
|
490
467
|
(_a = this.inputEl) === null || _a === void 0 ? void 0 : _a.blur();
|
|
491
468
|
}
|
|
492
|
-
}, ref: (el) => (this.inputEl = el), onInput: () => this.onInputChange(), onBlur: () => this.exitInputMode() }), h("div", { key: '
|
|
469
|
+
}, ref: (el) => (this.inputEl = el), onInput: () => this.onInputChange(), onBlur: () => this.exitInputMode() }), h("div", { key: '334a5abdc02e6b127c57177f626d7e4ff5526183', class: "picker-before" }), h("div", { key: 'ffd6271931129e88fc7c820e919d684899e420c5', class: "picker-after" }), h("div", { key: '78d1d95fd09e04f154ea59f24a1cece72c47ed7b', class: "picker-highlight", ref: (el) => (this.highlightEl = el) }), h("slot", { key: '0bd5b9f875d3c71f6cbbde2054baeb1b0a2e8cd5' })));
|
|
493
470
|
}
|
|
494
471
|
static get is() { return "ion-picker"; }
|
|
495
472
|
static get encapsulation() { return "shadow"; }
|
|
@@ -202,10 +202,10 @@ export class Toggle {
|
|
|
202
202
|
[`toggle-alignment-${alignment}`]: alignment !== undefined,
|
|
203
203
|
[`toggle-label-placement-${labelPlacement}`]: true,
|
|
204
204
|
[`toggle-${rtl}`]: true,
|
|
205
|
-
}) }, h("label", { key: 'f49531391f4513d084061c27ebc4c4eb1dcd02ab', class: "toggle-wrapper" }, h("input", Object.assign({ key: '
|
|
205
|
+
}) }, h("label", { key: 'f49531391f4513d084061c27ebc4c4eb1dcd02ab', class: "toggle-wrapper" }, h("input", Object.assign({ key: 'cf2b9147f9fb408c446c16df596dc73695fab3b5', type: "checkbox", role: "switch", "aria-checked": `${checked}`, checked: checked, disabled: disabled, id: inputId, onFocus: () => this.onFocus(), onBlur: () => this.onBlur(), ref: (focusEl) => (this.focusEl = focusEl), required: required }, { switch: true }, this.inheritedAttributes)), h("div", { key: '36639ea6755d2baf1fc8ce7542edf26cc5a1a484', class: {
|
|
206
206
|
'label-text-wrapper': true,
|
|
207
207
|
'label-text-wrapper-hidden': !this.hasLabel,
|
|
208
|
-
}, part: "label" }, h("slot", { key: '
|
|
208
|
+
}, part: "label" }, h("slot", { key: 'd9cde59b79670012f33745522248ba3e34822c0a' }), this.renderHintText()), h("div", { key: 'b0c784a0fe0ce909d01f611210ccc0663e32dfd4', class: "native-wrapper" }, this.renderToggleControl()))));
|
|
209
209
|
}
|
|
210
210
|
static get is() { return "ion-toggle"; }
|
|
211
211
|
static get encapsulation() { return "shadow"; }
|
package/dist/docs.json
CHANGED