voyager-ionic-core 8.8.2 → 8.8.4
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/ion-checkbox.js +1 -1
- package/components/ion-datetime.js +1 -1
- package/components/ion-input-otp.js +1 -1
- package/components/ion-picker-column.js +1 -1
- package/components/ion-select-modal.js +1 -1
- package/components/ion-select-popover.js +1 -1
- package/components/ion-select.js +1 -1
- package/components/{p-D6pdfDIA.js → p-BTF2nRLo.js} +1 -1
- package/components/{p-e-EDj2CO.js → p-EK4xUz-q.js} +1 -1
- package/components/p-FBcnjE5W.js +4 -0
- package/components/p-SBseW5KJ.js +4 -0
- package/css/palettes/dark.always.css +1 -1
- package/css/palettes/dark.always.css.map +1 -1
- package/css/palettes/dark.class.css +1 -1
- package/css/palettes/dark.class.css.map +1 -1
- package/css/palettes/dark.system.css +1 -1
- package/css/palettes/dark.system.css.map +1 -1
- package/css/palettes/high-contrast-dark.always.css +1 -1
- package/css/palettes/high-contrast-dark.always.css.map +1 -1
- package/css/palettes/high-contrast-dark.class.css +1 -1
- package/css/palettes/high-contrast-dark.class.css.map +1 -1
- package/css/palettes/high-contrast-dark.system.css +1 -1
- package/css/palettes/high-contrast-dark.system.css.map +1 -1
- package/dist/cjs/ion-checkbox.cjs.entry.js +39 -32
- package/dist/cjs/ion-datetime_3.cjs.entry.js +17 -6
- package/dist/cjs/ion-input-otp.cjs.entry.js +21 -6
- package/dist/cjs/ion-picker-column.cjs.entry.js +4 -4
- package/dist/collection/components/checkbox/checkbox.js +39 -32
- package/dist/collection/components/datetime/datetime.js +17 -6
- package/dist/collection/components/input-otp/input-otp.js +21 -6
- package/dist/collection/components/picker-column/picker-column.js +5 -5
- package/dist/docs.json +1 -1
- package/dist/esm/ion-checkbox.entry.js +39 -32
- package/dist/esm/ion-datetime_3.entry.js +17 -6
- package/dist/esm/ion-input-otp.entry.js +21 -6
- package/dist/esm/ion-picker-column.entry.js +5 -5
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-078037da.entry.js +4 -0
- package/dist/ionic/p-23ec35e4.entry.js +4 -0
- package/dist/ionic/p-4c67ce4c.entry.js +4 -0
- package/dist/ionic/p-87125490.entry.js +4 -0
- package/dist/types/components/checkbox/checkbox.d.ts +0 -1
- package/dist/types/components/datetime/datetime.d.ts +1 -0
- package/hydrate/index.js +46 -22
- package/hydrate/index.mjs +46 -22
- package/package.json +4 -4
- package/components/p-C7AoMl7c.js +0 -4
- package/components/p-cvHphHJA.js +0 -4
- package/dist/ionic/p-2d4eb1b4.entry.js +0 -4
- package/dist/ionic/p-3e143d1d.entry.js +0 -4
- package/dist/ionic/p-9fae83d8.entry.js +0 -4
- package/dist/ionic/p-c744307d.entry.js +0 -4
|
@@ -113,48 +113,55 @@ export class Checkbox {
|
|
|
113
113
|
this.onDivLabelClick = (ev) => {
|
|
114
114
|
ev.stopPropagation();
|
|
115
115
|
};
|
|
116
|
-
this.onSlotChange = () => {
|
|
117
|
-
this.hasLabelContent = this.el.textContent !== '';
|
|
118
|
-
};
|
|
119
116
|
}
|
|
120
117
|
connectedCallback() {
|
|
121
118
|
const { el } = this;
|
|
122
|
-
// Watch for class changes to update validation state.
|
|
123
119
|
if (Build.isBrowser && typeof MutationObserver !== 'undefined') {
|
|
124
|
-
this.validationObserver = new MutationObserver(() => {
|
|
125
|
-
|
|
126
|
-
if (
|
|
127
|
-
this.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
120
|
+
this.validationObserver = new MutationObserver((mutations) => {
|
|
121
|
+
// Watch for label content changes
|
|
122
|
+
if (mutations.some((mutation) => mutation.type === 'characterData' || mutation.type === 'childList')) {
|
|
123
|
+
this.hasLabelContent = this.el.textContent !== '';
|
|
124
|
+
}
|
|
125
|
+
// Watch for class changes to update validation state.
|
|
126
|
+
if (mutations.some((mutation) => mutation.type === 'attributes' && mutation.target === el)) {
|
|
127
|
+
const newIsInvalid = checkInvalidState(el);
|
|
128
|
+
if (this.isInvalid !== newIsInvalid) {
|
|
129
|
+
this.isInvalid = newIsInvalid;
|
|
130
|
+
/**
|
|
131
|
+
* Screen readers tend to announce changes
|
|
132
|
+
* to `aria-describedby` when the attribute
|
|
133
|
+
* is changed during a blur event for a
|
|
134
|
+
* native form control.
|
|
135
|
+
* However, the announcement can be spotty
|
|
136
|
+
* when using a non-native form control
|
|
137
|
+
* and `forceUpdate()`.
|
|
138
|
+
* This is due to `forceUpdate()` internally
|
|
139
|
+
* rescheduling the DOM update to a lower
|
|
140
|
+
* priority queue regardless if it's called
|
|
141
|
+
* inside a Promise or not, thus causing
|
|
142
|
+
* the screen reader to potentially miss the
|
|
143
|
+
* change.
|
|
144
|
+
* By using a State variable inside a Promise,
|
|
145
|
+
* it guarantees a re-render immediately at
|
|
146
|
+
* a higher priority.
|
|
147
|
+
*/
|
|
148
|
+
Promise.resolve().then(() => {
|
|
149
|
+
this.hintTextId = this.getHintTextId();
|
|
150
|
+
});
|
|
151
|
+
}
|
|
149
152
|
}
|
|
150
153
|
});
|
|
151
154
|
this.validationObserver.observe(el, {
|
|
152
155
|
attributes: true,
|
|
153
156
|
attributeFilter: ['class'],
|
|
157
|
+
characterData: true,
|
|
158
|
+
childList: true,
|
|
159
|
+
subtree: true,
|
|
154
160
|
});
|
|
155
161
|
}
|
|
156
162
|
// Always set initial state
|
|
157
163
|
this.isInvalid = checkInvalidState(el);
|
|
164
|
+
this.hasLabelContent = this.el.textContent !== '';
|
|
158
165
|
}
|
|
159
166
|
componentWillLoad() {
|
|
160
167
|
this.inheritedAttributes = Object.assign({}, inheritAriaAttributes(this.el));
|
|
@@ -204,7 +211,7 @@ export class Checkbox {
|
|
|
204
211
|
renderHiddenInput(true, el, name, checked ? value : '', disabled);
|
|
205
212
|
// The host element must have a checkbox role to ensure proper VoiceOver
|
|
206
213
|
// support in Safari for accessibility.
|
|
207
|
-
return (h(Host, { key: '
|
|
214
|
+
return (h(Host, { key: '0da370f94c5cdf3b08bc9008395558334a300f35', role: "checkbox", "aria-checked": indeterminate ? 'mixed' : `${checked}`, "aria-describedby": this.hintTextId, "aria-invalid": this.isInvalid ? 'true' : undefined, "aria-labelledby": this.hasLabelContent ? this.inputLabelId : null, "aria-label": inheritedAttributes['aria-label'] || null, "aria-disabled": disabled ? 'true' : null, "aria-required": required ? 'true' : undefined, tabindex: disabled ? undefined : 0, onKeyDown: this.onKeyDown, onFocus: this.onFocus, onBlur: this.onBlur, onClick: this.onClick, class: createColorClasses(color, {
|
|
208
215
|
[mode]: true,
|
|
209
216
|
'in-item': hostContext('ion-item', el),
|
|
210
217
|
'checkbox-checked': checked,
|
|
@@ -214,10 +221,10 @@ export class Checkbox {
|
|
|
214
221
|
[`checkbox-justify-${justify}`]: justify !== undefined,
|
|
215
222
|
[`checkbox-alignment-${alignment}`]: alignment !== undefined,
|
|
216
223
|
[`checkbox-label-placement-${labelPlacement}`]: true,
|
|
217
|
-
}) }, h("label", { key: '
|
|
224
|
+
}) }, h("label", { key: '991f1763356671230af119a5fbdc22d0a39974e7', class: "checkbox-wrapper", htmlFor: inputId }, h("input", Object.assign({ key: '982f8a7f84d013b272b17607936355d2b6c251f4', type: "checkbox", checked: checked ? true : undefined, disabled: disabled, id: inputId, onChange: this.toggleChecked, required: required }, inheritedAttributes)), h("div", { key: 'c8f9e8baa20ac68e69fd3c6fcf0e7a26a1084d83', class: {
|
|
218
225
|
'label-text-wrapper': true,
|
|
219
226
|
'label-text-wrapper-hidden': !this.hasLabelContent,
|
|
220
|
-
}, part: "label", id: this.inputLabelId, onClick: this.onDivLabelClick }, h("slot", { key: '
|
|
227
|
+
}, part: "label", id: this.inputLabelId, onClick: this.onDivLabelClick }, h("slot", { key: '6018205e0a73dec826c7881d687f1c2ca8dcb0ab' }), this.renderHintText()), h("div", { key: '57530b9d6ff59ee7ab98f960cd65d66ee87cfd1d', class: "native-wrapper" }, h("svg", { key: '63d719154ff44459e9ca448e3f5d7de94d9ab248', class: "checkbox-icon", viewBox: "0 0 24 24", part: "container", "aria-hidden": "true" }, path)))));
|
|
221
228
|
}
|
|
222
229
|
getSVGPath(mode, indeterminate) {
|
|
223
230
|
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" }));
|
|
@@ -622,6 +622,12 @@ export class Datetime {
|
|
|
622
622
|
this.el.classList.add('datetime-ready');
|
|
623
623
|
});
|
|
624
624
|
};
|
|
625
|
+
this.loadTimeoutCleanup = () => {
|
|
626
|
+
if (this.loadTimeout) {
|
|
627
|
+
clearTimeout(this.loadTimeout);
|
|
628
|
+
this.loadTimeout = undefined;
|
|
629
|
+
}
|
|
630
|
+
};
|
|
625
631
|
this.processValue = (value) => {
|
|
626
632
|
const hasValue = value !== null && value !== undefined && value !== '' && (!Array.isArray(value) || value.length > 0);
|
|
627
633
|
const valueToProcess = hasValue ? parseDate(value) : this.defaultParts;
|
|
@@ -769,9 +775,10 @@ export class Datetime {
|
|
|
769
775
|
if (!prevMonth) {
|
|
770
776
|
return;
|
|
771
777
|
}
|
|
778
|
+
const left = prevMonth.offsetWidth * 2;
|
|
772
779
|
calendarBodyRef.scrollTo({
|
|
773
780
|
top: 0,
|
|
774
|
-
left:
|
|
781
|
+
left: left * (isRTL(this.el) ? 1 : -1),
|
|
775
782
|
behavior: 'smooth',
|
|
776
783
|
});
|
|
777
784
|
};
|
|
@@ -893,15 +900,16 @@ export class Datetime {
|
|
|
893
900
|
}
|
|
894
901
|
connectedCallback() {
|
|
895
902
|
this.clearFocusVisible = startFocusVisible(this.el).destroy;
|
|
903
|
+
this.loadTimeout = setTimeout(() => {
|
|
904
|
+
this.ensureReadyIfVisible();
|
|
905
|
+
}, 100);
|
|
896
906
|
}
|
|
897
907
|
disconnectedCallback() {
|
|
898
908
|
if (this.clearFocusVisible) {
|
|
899
909
|
this.clearFocusVisible();
|
|
900
910
|
this.clearFocusVisible = undefined;
|
|
901
911
|
}
|
|
902
|
-
|
|
903
|
-
clearTimeout(this.loadTimeout);
|
|
904
|
-
}
|
|
912
|
+
this.loadTimeoutCleanup();
|
|
905
913
|
}
|
|
906
914
|
initializeListeners() {
|
|
907
915
|
this.initializeCalendarListener();
|
|
@@ -949,7 +957,10 @@ export class Datetime {
|
|
|
949
957
|
* we still initialize listeners and mark the component as ready.
|
|
950
958
|
*
|
|
951
959
|
* We schedule this after everything has had a chance to run.
|
|
960
|
+
*
|
|
961
|
+
* We also clean up the load timeout to ensure that we don't have multiple timeouts running.
|
|
952
962
|
*/
|
|
963
|
+
this.loadTimeoutCleanup();
|
|
953
964
|
this.loadTimeout = setTimeout(() => {
|
|
954
965
|
this.ensureReadyIfVisible();
|
|
955
966
|
}, 100);
|
|
@@ -1708,7 +1719,7 @@ export class Datetime {
|
|
|
1708
1719
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
1709
1720
|
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
1710
1721
|
renderHiddenInput(true, el, name, formatValue(value), disabled);
|
|
1711
|
-
return (h(Host, { key: '
|
|
1722
|
+
return (h(Host, { key: '59e0811aa273e88dfb8e4b703e6824088a457380', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
|
|
1712
1723
|
[mode]: true,
|
|
1713
1724
|
['datetime-readonly']: readonly,
|
|
1714
1725
|
['datetime-disabled']: disabled,
|
|
@@ -1718,7 +1729,7 @@ export class Datetime {
|
|
|
1718
1729
|
[`datetime-size-${size}`]: true,
|
|
1719
1730
|
[`datetime-prefer-wheel`]: hasWheelVariant,
|
|
1720
1731
|
[`datetime-grid`]: isGridStyle,
|
|
1721
|
-
})) }, h("div", { key: '
|
|
1732
|
+
})) }, h("div", { key: '3753ff3dde3085070916c3de83687a219a49e553', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
|
|
1722
1733
|
}
|
|
1723
1734
|
static get is() { return "ion-datetime"; }
|
|
1724
1735
|
static get encapsulation() { return "shadow"; }
|
|
@@ -130,9 +130,18 @@ export class InputOTP {
|
|
|
130
130
|
* - Tab: Allows normal tab navigation between components
|
|
131
131
|
*/
|
|
132
132
|
this.onKeyDown = (index) => (event) => {
|
|
133
|
-
const { length } = this;
|
|
133
|
+
const { disabled, length, readonly } = this;
|
|
134
134
|
const rtl = isRTL(this.el);
|
|
135
135
|
const input = event.target;
|
|
136
|
+
if (disabled) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (readonly) {
|
|
140
|
+
if (event.key === 'Backspace' || event.key === 'Delete') {
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
136
145
|
// Meta shortcuts are used to copy, paste, and select text
|
|
137
146
|
// We don't want to handle these keys here
|
|
138
147
|
const metaShortcuts = ['a', 'c', 'v', 'x', 'r', 'z', 'y'];
|
|
@@ -195,10 +204,13 @@ export class InputOTP {
|
|
|
195
204
|
*/
|
|
196
205
|
this.onInput = (index) => (event) => {
|
|
197
206
|
var _a, _b;
|
|
198
|
-
const { length, validKeyPattern } = this;
|
|
207
|
+
const { disabled, length, readonly, validKeyPattern } = this;
|
|
199
208
|
const input = event.target;
|
|
200
209
|
const value = input.value;
|
|
201
210
|
const previousValue = this.previousInputValues[index] || '';
|
|
211
|
+
if (disabled || readonly) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
202
214
|
// 1. Autofill handling
|
|
203
215
|
// If the length of the value increases by more than 1 from the previous
|
|
204
216
|
// value, treat this as autofill. This is to prevent the case where the
|
|
@@ -317,8 +329,11 @@ export class InputOTP {
|
|
|
317
329
|
*/
|
|
318
330
|
this.onPaste = (event) => {
|
|
319
331
|
var _a, _b;
|
|
320
|
-
const { inputRefs, length, validKeyPattern } = this;
|
|
332
|
+
const { disabled, inputRefs, length, readonly, validKeyPattern } = this;
|
|
321
333
|
event.preventDefault();
|
|
334
|
+
if (disabled || readonly) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
322
337
|
const pastedText = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text');
|
|
323
338
|
// If there is no pasted text, still emit the input change event
|
|
324
339
|
// because this is how the native input element behaves
|
|
@@ -605,7 +620,7 @@ export class InputOTP {
|
|
|
605
620
|
const tabbableIndex = this.getTabbableIndex();
|
|
606
621
|
const pattern = this.getPattern();
|
|
607
622
|
const hasDescription = ((_b = (_a = el.querySelector('.input-otp-description')) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== '';
|
|
608
|
-
return (h(Host, { key: '
|
|
623
|
+
return (h(Host, { key: '5c1386ae6b8038ec33ca94fd818c9353b1b37f75', class: createColorClasses(color, {
|
|
609
624
|
[mode]: true,
|
|
610
625
|
'has-focus': hasFocus,
|
|
611
626
|
[`input-otp-size-${size}`]: true,
|
|
@@ -613,10 +628,10 @@ export class InputOTP {
|
|
|
613
628
|
[`input-otp-fill-${fill}`]: true,
|
|
614
629
|
'input-otp-disabled': disabled,
|
|
615
630
|
'input-otp-readonly': readonly,
|
|
616
|
-
}) }, h("div", Object.assign({ key: '
|
|
631
|
+
}) }, h("div", Object.assign({ key: '9a19129688e55095f8386826c73ef3f9744becff', role: "group", "aria-label": "One-time password input", class: "input-otp-group" }, inheritedAttributes), Array.from({ length }).map((_, index) => (h(Fragment, null, h("div", { class: "native-wrapper" }, h("input", { class: "native-input", id: `${inputId}-${index}`, "aria-label": `Input ${index + 1} of ${length}`, type: "text", autoCapitalize: autocapitalize, inputmode: inputmode, pattern: pattern, disabled: disabled, readOnly: readonly, tabIndex: index === tabbableIndex ? 0 : -1, value: inputValues[index] || '', autocomplete: "one-time-code", ref: (el) => (inputRefs[index] = el), onInput: this.onInput(index), onBlur: this.onBlur, onFocus: this.onFocus(index), onKeyDown: this.onKeyDown(index), onPaste: this.onPaste })), this.showSeparator(index) && h("div", { class: "input-otp-separator" }))))), h("div", { key: '7853819c3610c4691191f1836b947bf4ec17939d', class: {
|
|
617
632
|
'input-otp-description': true,
|
|
618
633
|
'input-otp-description-hidden': !hasDescription,
|
|
619
|
-
} }, h("slot", { key: '
|
|
634
|
+
} }, h("slot", { key: 'f4674d47d3d3991f21a0a79321ebc323968071dc' }))));
|
|
620
635
|
}
|
|
621
636
|
static get is() { return "ion-input-otp"; }
|
|
622
637
|
static get encapsulation() { return "scoped"; }
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Host, h } from "@stencil/core";
|
|
5
5
|
import { doc } from "../../utils/browser/index";
|
|
6
|
-
import {
|
|
6
|
+
import { raf } from "../../utils/helpers";
|
|
7
7
|
import { hapticSelectionChanged, hapticSelectionEnd, hapticSelectionStart } from "../../utils/native/haptic";
|
|
8
8
|
import { isPlatform } from "../../utils/platform";
|
|
9
9
|
import { createColorClasses } from "../../utils/theme";
|
|
@@ -451,7 +451,7 @@ export class PickerColumn {
|
|
|
451
451
|
* Because this initial call to scrollActiveItemIntoView has to fire before
|
|
452
452
|
* the scroll listener is set up, we need to manage the active class manually.
|
|
453
453
|
*/
|
|
454
|
-
const oldActive =
|
|
454
|
+
const oldActive = el.querySelector(`.${PICKER_ITEM_ACTIVE_CLASS}`);
|
|
455
455
|
if (oldActive) {
|
|
456
456
|
this.setPickerItemActiveState(oldActive, false);
|
|
457
457
|
}
|
|
@@ -551,14 +551,14 @@ export class PickerColumn {
|
|
|
551
551
|
render() {
|
|
552
552
|
const { color, disabled, isActive, numericInput } = this;
|
|
553
553
|
const mode = getIonMode(this);
|
|
554
|
-
return (h(Host, { key: '
|
|
554
|
+
return (h(Host, { key: '234c96a501d7ac413b9b0ea56b33017681e25b40', class: createColorClasses(color, {
|
|
555
555
|
[mode]: true,
|
|
556
556
|
['picker-column-active']: isActive,
|
|
557
557
|
['picker-column-numeric-input']: numericInput,
|
|
558
558
|
['picker-column-disabled']: disabled,
|
|
559
|
-
}) }, h("slot", { key: '
|
|
559
|
+
}) }, h("slot", { key: '9dc15ea0601ddd2cb2e0a745e91e036a8bd96f8b', name: "prefix" }), h("div", { key: 'de4fe28ee4bc46b7c0420d6ab0df0e7809443da9', class: "picker-opts", ref: (el) => {
|
|
560
560
|
this.scrollEl = el;
|
|
561
|
-
}, role: "slider", tabindex: this.disabled ? undefined : 0, "aria-label": this.ariaLabel, "aria-valuemin": 0, "aria-valuemax": 0, "aria-valuenow": 0, "aria-valuetext": this.getOptionValueText(this.activeItem), "aria-orientation": "vertical", onKeyDown: (ev) => this.onKeyDown(ev) }, h("div", { key: '
|
|
561
|
+
}, role: "slider", tabindex: this.disabled ? undefined : 0, "aria-label": this.ariaLabel, "aria-valuemin": 0, "aria-valuemax": 0, "aria-valuenow": 0, "aria-valuetext": this.getOptionValueText(this.activeItem), "aria-orientation": "vertical", onKeyDown: (ev) => this.onKeyDown(ev) }, h("div", { key: '5297617462cc30e9444039ae032d8bdf718349af', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { key: '55ea39ef867bcb1a11a912d52ecd20cb886c5fb3', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { key: '3496730ce6182ebfd33e0ee4bafc130feb575a31', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("slot", { key: '44c3628aa957d60f799dc7019f72fe8b676c7843' }), h("div", { key: '5a1809f6c949678a67e0d4b5bfe93ea335c0161d', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { key: '98fd57f1c66dbaebc2db2dd5da142671b3159fd1', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { key: '85590708abddfa885994e549deac64866fec938f', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0")), h("slot", { key: 'bb7e674f543696a80fcbfb1f68f2e975826898a6', name: "suffix" })));
|
|
562
562
|
}
|
|
563
563
|
static get is() { return "ion-picker-column"; }
|
|
564
564
|
static get encapsulation() { return "shadow"; }
|
package/dist/docs.json
CHANGED
|
@@ -110,48 +110,55 @@ const Checkbox = class {
|
|
|
110
110
|
this.onDivLabelClick = (ev) => {
|
|
111
111
|
ev.stopPropagation();
|
|
112
112
|
};
|
|
113
|
-
this.onSlotChange = () => {
|
|
114
|
-
this.hasLabelContent = this.el.textContent !== '';
|
|
115
|
-
};
|
|
116
113
|
}
|
|
117
114
|
connectedCallback() {
|
|
118
115
|
const { el } = this;
|
|
119
|
-
// Watch for class changes to update validation state.
|
|
120
116
|
if (typeof MutationObserver !== 'undefined') {
|
|
121
|
-
this.validationObserver = new MutationObserver(() => {
|
|
122
|
-
|
|
123
|
-
if (
|
|
124
|
-
this.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
117
|
+
this.validationObserver = new MutationObserver((mutations) => {
|
|
118
|
+
// Watch for label content changes
|
|
119
|
+
if (mutations.some((mutation) => mutation.type === 'characterData' || mutation.type === 'childList')) {
|
|
120
|
+
this.hasLabelContent = this.el.textContent !== '';
|
|
121
|
+
}
|
|
122
|
+
// Watch for class changes to update validation state.
|
|
123
|
+
if (mutations.some((mutation) => mutation.type === 'attributes' && mutation.target === el)) {
|
|
124
|
+
const newIsInvalid = checkInvalidState(el);
|
|
125
|
+
if (this.isInvalid !== newIsInvalid) {
|
|
126
|
+
this.isInvalid = newIsInvalid;
|
|
127
|
+
/**
|
|
128
|
+
* Screen readers tend to announce changes
|
|
129
|
+
* to `aria-describedby` when the attribute
|
|
130
|
+
* is changed during a blur event for a
|
|
131
|
+
* native form control.
|
|
132
|
+
* However, the announcement can be spotty
|
|
133
|
+
* when using a non-native form control
|
|
134
|
+
* and `forceUpdate()`.
|
|
135
|
+
* This is due to `forceUpdate()` internally
|
|
136
|
+
* rescheduling the DOM update to a lower
|
|
137
|
+
* priority queue regardless if it's called
|
|
138
|
+
* inside a Promise or not, thus causing
|
|
139
|
+
* the screen reader to potentially miss the
|
|
140
|
+
* change.
|
|
141
|
+
* By using a State variable inside a Promise,
|
|
142
|
+
* it guarantees a re-render immediately at
|
|
143
|
+
* a higher priority.
|
|
144
|
+
*/
|
|
145
|
+
Promise.resolve().then(() => {
|
|
146
|
+
this.hintTextId = this.getHintTextId();
|
|
147
|
+
});
|
|
148
|
+
}
|
|
146
149
|
}
|
|
147
150
|
});
|
|
148
151
|
this.validationObserver.observe(el, {
|
|
149
152
|
attributes: true,
|
|
150
153
|
attributeFilter: ['class'],
|
|
154
|
+
characterData: true,
|
|
155
|
+
childList: true,
|
|
156
|
+
subtree: true,
|
|
151
157
|
});
|
|
152
158
|
}
|
|
153
159
|
// Always set initial state
|
|
154
160
|
this.isInvalid = checkInvalidState(el);
|
|
161
|
+
this.hasLabelContent = this.el.textContent !== '';
|
|
155
162
|
}
|
|
156
163
|
componentWillLoad() {
|
|
157
164
|
this.inheritedAttributes = Object.assign({}, inheritAriaAttributes(this.el));
|
|
@@ -201,7 +208,7 @@ const Checkbox = class {
|
|
|
201
208
|
renderHiddenInput(true, el, name, checked ? value : '', disabled);
|
|
202
209
|
// The host element must have a checkbox role to ensure proper VoiceOver
|
|
203
210
|
// support in Safari for accessibility.
|
|
204
|
-
return (h(Host, { key: '
|
|
211
|
+
return (h(Host, { key: '0da370f94c5cdf3b08bc9008395558334a300f35', role: "checkbox", "aria-checked": indeterminate ? 'mixed' : `${checked}`, "aria-describedby": this.hintTextId, "aria-invalid": this.isInvalid ? 'true' : undefined, "aria-labelledby": this.hasLabelContent ? this.inputLabelId : null, "aria-label": inheritedAttributes['aria-label'] || null, "aria-disabled": disabled ? 'true' : null, "aria-required": required ? 'true' : undefined, tabindex: disabled ? undefined : 0, onKeyDown: this.onKeyDown, onFocus: this.onFocus, onBlur: this.onBlur, onClick: this.onClick, class: createColorClasses(color, {
|
|
205
212
|
[mode]: true,
|
|
206
213
|
'in-item': hostContext('ion-item', el),
|
|
207
214
|
'checkbox-checked': checked,
|
|
@@ -211,10 +218,10 @@ const Checkbox = class {
|
|
|
211
218
|
[`checkbox-justify-${justify}`]: justify !== undefined,
|
|
212
219
|
[`checkbox-alignment-${alignment}`]: alignment !== undefined,
|
|
213
220
|
[`checkbox-label-placement-${labelPlacement}`]: true,
|
|
214
|
-
}) }, h("label", { key: '
|
|
221
|
+
}) }, h("label", { key: '991f1763356671230af119a5fbdc22d0a39974e7', class: "checkbox-wrapper", htmlFor: inputId }, h("input", Object.assign({ key: '982f8a7f84d013b272b17607936355d2b6c251f4', type: "checkbox", checked: checked ? true : undefined, disabled: disabled, id: inputId, onChange: this.toggleChecked, required: required }, inheritedAttributes)), h("div", { key: 'c8f9e8baa20ac68e69fd3c6fcf0e7a26a1084d83', class: {
|
|
215
222
|
'label-text-wrapper': true,
|
|
216
223
|
'label-text-wrapper-hidden': !this.hasLabelContent,
|
|
217
|
-
}, part: "label", id: this.inputLabelId, onClick: this.onDivLabelClick }, h("slot", { key: '
|
|
224
|
+
}, part: "label", id: this.inputLabelId, onClick: this.onDivLabelClick }, h("slot", { key: '6018205e0a73dec826c7881d687f1c2ca8dcb0ab' }), this.renderHintText()), h("div", { key: '57530b9d6ff59ee7ab98f960cd65d66ee87cfd1d', class: "native-wrapper" }, h("svg", { key: '63d719154ff44459e9ca448e3f5d7de94d9ab248', class: "checkbox-icon", viewBox: "0 0 24 24", part: "container", "aria-hidden": "true" }, path)))));
|
|
218
225
|
}
|
|
219
226
|
getSVGPath(mode, indeterminate) {
|
|
220
227
|
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" }));
|
|
@@ -811,6 +811,12 @@ const Datetime = class {
|
|
|
811
811
|
this.el.classList.add('datetime-ready');
|
|
812
812
|
});
|
|
813
813
|
};
|
|
814
|
+
this.loadTimeoutCleanup = () => {
|
|
815
|
+
if (this.loadTimeout) {
|
|
816
|
+
clearTimeout(this.loadTimeout);
|
|
817
|
+
this.loadTimeout = undefined;
|
|
818
|
+
}
|
|
819
|
+
};
|
|
814
820
|
this.processValue = (value) => {
|
|
815
821
|
const hasValue = value !== null && value !== undefined && value !== '' && (!Array.isArray(value) || value.length > 0);
|
|
816
822
|
const valueToProcess = hasValue ? parseDate(value) : this.defaultParts;
|
|
@@ -958,9 +964,10 @@ const Datetime = class {
|
|
|
958
964
|
if (!prevMonth) {
|
|
959
965
|
return;
|
|
960
966
|
}
|
|
967
|
+
const left = prevMonth.offsetWidth * 2;
|
|
961
968
|
calendarBodyRef.scrollTo({
|
|
962
969
|
top: 0,
|
|
963
|
-
left:
|
|
970
|
+
left: left * (isRTL(this.el) ? 1 : -1),
|
|
964
971
|
behavior: 'smooth',
|
|
965
972
|
});
|
|
966
973
|
};
|
|
@@ -1082,15 +1089,16 @@ const Datetime = class {
|
|
|
1082
1089
|
}
|
|
1083
1090
|
connectedCallback() {
|
|
1084
1091
|
this.clearFocusVisible = startFocusVisible(this.el).destroy;
|
|
1092
|
+
this.loadTimeout = setTimeout(() => {
|
|
1093
|
+
this.ensureReadyIfVisible();
|
|
1094
|
+
}, 100);
|
|
1085
1095
|
}
|
|
1086
1096
|
disconnectedCallback() {
|
|
1087
1097
|
if (this.clearFocusVisible) {
|
|
1088
1098
|
this.clearFocusVisible();
|
|
1089
1099
|
this.clearFocusVisible = undefined;
|
|
1090
1100
|
}
|
|
1091
|
-
|
|
1092
|
-
clearTimeout(this.loadTimeout);
|
|
1093
|
-
}
|
|
1101
|
+
this.loadTimeoutCleanup();
|
|
1094
1102
|
}
|
|
1095
1103
|
initializeListeners() {
|
|
1096
1104
|
this.initializeCalendarListener();
|
|
@@ -1138,7 +1146,10 @@ const Datetime = class {
|
|
|
1138
1146
|
* we still initialize listeners and mark the component as ready.
|
|
1139
1147
|
*
|
|
1140
1148
|
* We schedule this after everything has had a chance to run.
|
|
1149
|
+
*
|
|
1150
|
+
* We also clean up the load timeout to ensure that we don't have multiple timeouts running.
|
|
1141
1151
|
*/
|
|
1152
|
+
this.loadTimeoutCleanup();
|
|
1142
1153
|
this.loadTimeout = setTimeout(() => {
|
|
1143
1154
|
this.ensureReadyIfVisible();
|
|
1144
1155
|
}, 100);
|
|
@@ -1897,7 +1908,7 @@ const Datetime = class {
|
|
|
1897
1908
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
1898
1909
|
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
1899
1910
|
renderHiddenInput(true, el, name, formatValue(value), disabled);
|
|
1900
|
-
return (h(Host, { key: '
|
|
1911
|
+
return (h(Host, { key: '59e0811aa273e88dfb8e4b703e6824088a457380', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
|
|
1901
1912
|
[mode]: true,
|
|
1902
1913
|
['datetime-readonly']: readonly,
|
|
1903
1914
|
['datetime-disabled']: disabled,
|
|
@@ -1907,7 +1918,7 @@ const Datetime = class {
|
|
|
1907
1918
|
[`datetime-size-${size}`]: true,
|
|
1908
1919
|
[`datetime-prefer-wheel`]: hasWheelVariant,
|
|
1909
1920
|
[`datetime-grid`]: isGridStyle,
|
|
1910
|
-
})) }, h("div", { key: '
|
|
1921
|
+
})) }, h("div", { key: '3753ff3dde3085070916c3de83687a219a49e553', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
|
|
1911
1922
|
}
|
|
1912
1923
|
get el() { return getElement(this); }
|
|
1913
1924
|
static get watchers() { return {
|
|
@@ -140,9 +140,18 @@ const InputOTP = class {
|
|
|
140
140
|
* - Tab: Allows normal tab navigation between components
|
|
141
141
|
*/
|
|
142
142
|
this.onKeyDown = (index) => (event) => {
|
|
143
|
-
const { length } = this;
|
|
143
|
+
const { disabled, length, readonly } = this;
|
|
144
144
|
const rtl = isRTL(this.el);
|
|
145
145
|
const input = event.target;
|
|
146
|
+
if (disabled) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (readonly) {
|
|
150
|
+
if (event.key === 'Backspace' || event.key === 'Delete') {
|
|
151
|
+
event.preventDefault();
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
146
155
|
// Meta shortcuts are used to copy, paste, and select text
|
|
147
156
|
// We don't want to handle these keys here
|
|
148
157
|
const metaShortcuts = ['a', 'c', 'v', 'x', 'r', 'z', 'y'];
|
|
@@ -205,10 +214,13 @@ const InputOTP = class {
|
|
|
205
214
|
*/
|
|
206
215
|
this.onInput = (index) => (event) => {
|
|
207
216
|
var _a, _b;
|
|
208
|
-
const { length, validKeyPattern } = this;
|
|
217
|
+
const { disabled, length, readonly, validKeyPattern } = this;
|
|
209
218
|
const input = event.target;
|
|
210
219
|
const value = input.value;
|
|
211
220
|
const previousValue = this.previousInputValues[index] || '';
|
|
221
|
+
if (disabled || readonly) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
212
224
|
// 1. Autofill handling
|
|
213
225
|
// If the length of the value increases by more than 1 from the previous
|
|
214
226
|
// value, treat this as autofill. This is to prevent the case where the
|
|
@@ -327,8 +339,11 @@ const InputOTP = class {
|
|
|
327
339
|
*/
|
|
328
340
|
this.onPaste = (event) => {
|
|
329
341
|
var _a, _b;
|
|
330
|
-
const { inputRefs, length, validKeyPattern } = this;
|
|
342
|
+
const { disabled, inputRefs, length, readonly, validKeyPattern } = this;
|
|
331
343
|
event.preventDefault();
|
|
344
|
+
if (disabled || readonly) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
332
347
|
const pastedText = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text');
|
|
333
348
|
// If there is no pasted text, still emit the input change event
|
|
334
349
|
// because this is how the native input element behaves
|
|
@@ -615,7 +630,7 @@ const InputOTP = class {
|
|
|
615
630
|
const tabbableIndex = this.getTabbableIndex();
|
|
616
631
|
const pattern = this.getPattern();
|
|
617
632
|
const hasDescription = ((_b = (_a = el.querySelector('.input-otp-description')) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== '';
|
|
618
|
-
return (h(Host, { key: '
|
|
633
|
+
return (h(Host, { key: '5c1386ae6b8038ec33ca94fd818c9353b1b37f75', class: createColorClasses(color, {
|
|
619
634
|
[mode]: true,
|
|
620
635
|
'has-focus': hasFocus,
|
|
621
636
|
[`input-otp-size-${size}`]: true,
|
|
@@ -623,10 +638,10 @@ const InputOTP = class {
|
|
|
623
638
|
[`input-otp-fill-${fill}`]: true,
|
|
624
639
|
'input-otp-disabled': disabled,
|
|
625
640
|
'input-otp-readonly': readonly,
|
|
626
|
-
}) }, h("div", Object.assign({ key: '
|
|
641
|
+
}) }, h("div", Object.assign({ key: '9a19129688e55095f8386826c73ef3f9744becff', role: "group", "aria-label": "One-time password input", class: "input-otp-group" }, inheritedAttributes), Array.from({ length }).map((_, index) => (h(Fragment, null, h("div", { class: "native-wrapper" }, h("input", { class: "native-input", id: `${inputId}-${index}`, "aria-label": `Input ${index + 1} of ${length}`, type: "text", autoCapitalize: autocapitalize, inputmode: inputmode, pattern: pattern, disabled: disabled, readOnly: readonly, tabIndex: index === tabbableIndex ? 0 : -1, value: inputValues[index] || '', autocomplete: "one-time-code", ref: (el) => (inputRefs[index] = el), onInput: this.onInput(index), onBlur: this.onBlur, onFocus: this.onFocus(index), onKeyDown: this.onKeyDown(index), onPaste: this.onPaste })), this.showSeparator(index) && h("div", { class: "input-otp-separator" }))))), h("div", { key: '7853819c3610c4691191f1836b947bf4ec17939d', class: {
|
|
627
642
|
'input-otp-description': true,
|
|
628
643
|
'input-otp-description-hidden': !hasDescription,
|
|
629
|
-
} }, h("slot", { key: '
|
|
644
|
+
} }, h("slot", { key: 'f4674d47d3d3991f21a0a79321ebc323968071dc' }))));
|
|
630
645
|
}
|
|
631
646
|
get el() { return getElement(this); }
|
|
632
647
|
static get watchers() { return {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { r as registerInstance, c as createEvent, h, d as Host, g as getElement } from './index-IGIE5vDm.js';
|
|
5
5
|
import { d as doc } from './index-ZjP4CjeZ.js';
|
|
6
|
-
import { r as raf
|
|
6
|
+
import { r as raf } from './helpers-Tl8jw6S2.js';
|
|
7
7
|
import { b as hapticSelectionStart, a as hapticSelectionChanged, h as hapticSelectionEnd } from './haptic-DzAMWJuk.js';
|
|
8
8
|
import { a as isPlatform, b as getIonMode } from './ionic-global-DfbeLwcV.js';
|
|
9
9
|
import { c as createColorClasses } from './theme-DiVJyqlX.js';
|
|
@@ -448,7 +448,7 @@ const PickerColumn = class {
|
|
|
448
448
|
* Because this initial call to scrollActiveItemIntoView has to fire before
|
|
449
449
|
* the scroll listener is set up, we need to manage the active class manually.
|
|
450
450
|
*/
|
|
451
|
-
const oldActive =
|
|
451
|
+
const oldActive = el.querySelector(`.${PICKER_ITEM_ACTIVE_CLASS}`);
|
|
452
452
|
if (oldActive) {
|
|
453
453
|
this.setPickerItemActiveState(oldActive, false);
|
|
454
454
|
}
|
|
@@ -548,14 +548,14 @@ const PickerColumn = class {
|
|
|
548
548
|
render() {
|
|
549
549
|
const { color, disabled, isActive, numericInput } = this;
|
|
550
550
|
const mode = getIonMode(this);
|
|
551
|
-
return (h(Host, { key: '
|
|
551
|
+
return (h(Host, { key: '234c96a501d7ac413b9b0ea56b33017681e25b40', class: createColorClasses(color, {
|
|
552
552
|
[mode]: true,
|
|
553
553
|
['picker-column-active']: isActive,
|
|
554
554
|
['picker-column-numeric-input']: numericInput,
|
|
555
555
|
['picker-column-disabled']: disabled,
|
|
556
|
-
}) }, h("slot", { key: '
|
|
556
|
+
}) }, h("slot", { key: '9dc15ea0601ddd2cb2e0a745e91e036a8bd96f8b', name: "prefix" }), h("div", { key: 'de4fe28ee4bc46b7c0420d6ab0df0e7809443da9', class: "picker-opts", ref: (el) => {
|
|
557
557
|
this.scrollEl = el;
|
|
558
|
-
}, role: "slider", tabindex: this.disabled ? undefined : 0, "aria-label": this.ariaLabel, "aria-valuemin": 0, "aria-valuemax": 0, "aria-valuenow": 0, "aria-valuetext": this.getOptionValueText(this.activeItem), "aria-orientation": "vertical", onKeyDown: (ev) => this.onKeyDown(ev) }, h("div", { key: '
|
|
558
|
+
}, role: "slider", tabindex: this.disabled ? undefined : 0, "aria-label": this.ariaLabel, "aria-valuemin": 0, "aria-valuemax": 0, "aria-valuenow": 0, "aria-valuetext": this.getOptionValueText(this.activeItem), "aria-orientation": "vertical", onKeyDown: (ev) => this.onKeyDown(ev) }, h("div", { key: '5297617462cc30e9444039ae032d8bdf718349af', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { key: '55ea39ef867bcb1a11a912d52ecd20cb886c5fb3', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { key: '3496730ce6182ebfd33e0ee4bafc130feb575a31', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("slot", { key: '44c3628aa957d60f799dc7019f72fe8b676c7843' }), h("div", { key: '5a1809f6c949678a67e0d4b5bfe93ea335c0161d', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { key: '98fd57f1c66dbaebc2db2dd5da142671b3159fd1', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { key: '85590708abddfa885994e549deac64866fec938f', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0")), h("slot", { key: 'bb7e674f543696a80fcbfb1f68f2e975826898a6', name: "suffix" })));
|
|
559
559
|
}
|
|
560
560
|
get el() { return getElement(this); }
|
|
561
561
|
static get watchers() { return {
|