@ionic/core 8.0.0 → 8.0.1-dev.11713535425.1a4afba3
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/input-shims.js +5 -5
- package/components/ion-input.js +12 -3
- package/dist/cjs/{input-shims-20d639e6.js → input-shims-9e59ef62.js} +5 -5
- package/dist/cjs/ion-app_8.cjs.entry.js +1 -1
- package/dist/cjs/ion-input.cjs.entry.js +12 -3
- package/dist/collection/components/datetime/test/color/datetime.e2e.js +14 -7
- package/dist/collection/components/input/input.js +12 -3
- package/dist/collection/components/toggle/test/enable-on-off-labels/toggle.e2e.js +51 -31
- package/dist/collection/utils/input-shims/hacks/scroll-assist.js +5 -5
- package/dist/docs.json +1 -1
- package/dist/esm/{input-shims-4530285e.js → input-shims-0314bbe5.js} +5 -5
- package/dist/esm/ion-app_8.entry.js +1 -1
- package/dist/esm/ion-input.entry.js +12 -3
- package/dist/esm-es5/input-shims-0314bbe5.js +4 -0
- package/dist/esm-es5/ion-app_8.entry.js +1 -1
- package/dist/esm-es5/ion-input.entry.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/{p-46111310.js → p-2690b1de.js} +1 -1
- package/dist/ionic/{p-e832408b.system.entry.js → p-4d2b2d23.system.entry.js} +1 -1
- package/dist/ionic/p-c4e495a3.system.js +1 -1
- package/dist/ionic/{p-32dfbcdc.entry.js → p-cc258008.entry.js} +1 -1
- package/dist/ionic/p-df8f26d1.entry.js +4 -0
- package/dist/ionic/p-dfb78785.system.js +4 -0
- package/dist/ionic/{p-c4eafa12.system.entry.js → p-ead3aefc.system.entry.js} +1 -1
- package/hydrate/index.js +12 -3
- package/package.json +1 -1
- package/dist/esm-es5/input-shims-4530285e.js +0 -4
- package/dist/ionic/p-46f407f0.system.js +0 -4
- package/dist/ionic/p-76971b4f.entry.js +0 -4
|
@@ -336,7 +336,7 @@ const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, keyboardH
|
|
|
336
336
|
const focusOut = () => {
|
|
337
337
|
hasKeyboardBeenPresentedForTextField = false;
|
|
338
338
|
win === null || win === void 0 ? void 0 : win.removeEventListener('ionKeyboardDidShow', keyboardShow);
|
|
339
|
-
componentEl.removeEventListener('focusout', focusOut
|
|
339
|
+
componentEl.removeEventListener('focusout', focusOut);
|
|
340
340
|
};
|
|
341
341
|
/**
|
|
342
342
|
* When the input is about to receive
|
|
@@ -356,13 +356,13 @@ const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, keyboardH
|
|
|
356
356
|
}
|
|
357
357
|
jsSetFocus(componentEl, inputEl, contentEl, footerEl, keyboardHeight, addScrollPadding, disableClonedInput, platformHeight);
|
|
358
358
|
win === null || win === void 0 ? void 0 : win.addEventListener('ionKeyboardDidShow', keyboardShow);
|
|
359
|
-
componentEl.addEventListener('focusout', focusOut
|
|
359
|
+
componentEl.addEventListener('focusout', focusOut);
|
|
360
360
|
};
|
|
361
|
-
componentEl.addEventListener('focusin', focusIn
|
|
361
|
+
componentEl.addEventListener('focusin', focusIn);
|
|
362
362
|
return () => {
|
|
363
|
-
componentEl.removeEventListener('focusin', focusIn
|
|
363
|
+
componentEl.removeEventListener('focusin', focusIn);
|
|
364
364
|
win === null || win === void 0 ? void 0 : win.removeEventListener('ionKeyboardDidShow', keyboardShow);
|
|
365
|
-
componentEl.removeEventListener('focusout', focusOut
|
|
365
|
+
componentEl.removeEventListener('focusout', focusOut);
|
|
366
366
|
};
|
|
367
367
|
};
|
|
368
368
|
/**
|
package/components/ion-input.js
CHANGED
|
@@ -75,6 +75,7 @@ const Input = /*@__PURE__*/ proxyCustomElement(class Input extends HTMLElement {
|
|
|
75
75
|
ev.preventDefault();
|
|
76
76
|
ev.stopPropagation();
|
|
77
77
|
// Attempt to focus input again after pressing clear button
|
|
78
|
+
console.log('hi there');
|
|
78
79
|
this.setFocus();
|
|
79
80
|
}
|
|
80
81
|
this.value = '';
|
|
@@ -401,7 +402,7 @@ const Input = /*@__PURE__*/ proxyCustomElement(class Input extends HTMLElement {
|
|
|
401
402
|
* TODO(FW-5592): Remove hasStartEndSlots condition
|
|
402
403
|
*/
|
|
403
404
|
const labelShouldFloat = labelPlacement === 'stacked' || (labelPlacement === 'floating' && (hasValue || hasFocus || hasStartEndSlots));
|
|
404
|
-
return (h(Host, { key: '
|
|
405
|
+
return (h(Host, { key: 'c151cc531804483693052773aeeec1ee5f0c8a47', class: createColorClasses(this.color, {
|
|
405
406
|
[mode]: true,
|
|
406
407
|
'has-value': hasValue,
|
|
407
408
|
'has-focus': hasFocus,
|
|
@@ -412,14 +413,22 @@ const Input = /*@__PURE__*/ proxyCustomElement(class Input extends HTMLElement {
|
|
|
412
413
|
'in-item': inItem,
|
|
413
414
|
'in-item-color': hostContext('ion-item.ion-color', this.el),
|
|
414
415
|
'input-disabled': disabled,
|
|
415
|
-
}) }, h("label", { key: '
|
|
416
|
+
}) }, h("label", { key: 'fbe253f1e0dd24ad13333f4dc06dd13f6b33a042', class: "input-wrapper", htmlFor: inputId }, this.renderLabelContainer(), h("div", { key: '817707ed2e4dce8b5ae2391960d1be367a1e2ddf', class: "native-wrapper" }, h("slot", { key: '776c6b305b275e0babdfd6116ccc3f5399c97d38', name: "start" }), h("input", Object.assign({ key: 'eb5bdc9fda239c8edd7ed7fdc78517728a351a50', class: "native-input", ref: (input) => (this.nativeInput = input), id: inputId, disabled: disabled, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, multiple: this.multiple, name: this.name, pattern: this.pattern, placeholder: this.placeholder || '', readOnly: readonly, required: this.required, spellcheck: this.spellcheck, step: this.step, type: this.type, value: value, onInput: this.onInput, onChange: this.onChange, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeydown, onCompositionstart: this.onCompositionStart, onCompositionend: this.onCompositionEnd }, this.inheritedAttributes)), this.clearInput && !readonly && !disabled && (h("button", { key: '57ff8319da7ca85f3ce41a7581c55b4d91202542', "aria-label": "reset", type: "button", class: "input-clear-icon", onPointerDown: (ev) => {
|
|
416
417
|
/**
|
|
417
418
|
* This prevents mobile browsers from
|
|
418
419
|
* blurring the input when the clear
|
|
419
420
|
* button is activated.
|
|
420
421
|
*/
|
|
421
422
|
ev.preventDefault();
|
|
422
|
-
},
|
|
423
|
+
}, onFocusin: (ev) => {
|
|
424
|
+
/**
|
|
425
|
+
* Prevent the focusin event from bubbling otherwise it will cause the focusin
|
|
426
|
+
* event listener in scroll assist to fire. When this fires, focus will be moved
|
|
427
|
+
* back to the input even if the clear button was never tapped. This poses issues
|
|
428
|
+
* for screen readers as it means users would be unable to swipe past the clear button.
|
|
429
|
+
*/
|
|
430
|
+
ev.stopPropagation();
|
|
431
|
+
}, onClick: this.clearTextInput }, h("ion-icon", { key: 'c4c74c4387e8e81b4e00e0800ad7fd65d190a4ca', "aria-hidden": "true", icon: mode === 'ios' ? closeCircle : closeSharp }))), h("slot", { key: '6cf9e37091750a70ae97faa0104822f92cd313f5', name: "end" })), shouldRenderHighlight && h("div", { key: 'd4d032e244ae917cbedddac633d83501a1a2cf5b', class: "input-highlight" })), this.renderBottomContent()));
|
|
423
432
|
}
|
|
424
433
|
get el() { return this; }
|
|
425
434
|
static get watchers() { return {
|
|
@@ -340,7 +340,7 @@ const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, keyboardH
|
|
|
340
340
|
const focusOut = () => {
|
|
341
341
|
hasKeyboardBeenPresentedForTextField = false;
|
|
342
342
|
index.win === null || index.win === void 0 ? void 0 : index.win.removeEventListener('ionKeyboardDidShow', keyboardShow);
|
|
343
|
-
componentEl.removeEventListener('focusout', focusOut
|
|
343
|
+
componentEl.removeEventListener('focusout', focusOut);
|
|
344
344
|
};
|
|
345
345
|
/**
|
|
346
346
|
* When the input is about to receive
|
|
@@ -360,13 +360,13 @@ const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, keyboardH
|
|
|
360
360
|
}
|
|
361
361
|
jsSetFocus(componentEl, inputEl, contentEl, footerEl, keyboardHeight, addScrollPadding, disableClonedInput, platformHeight);
|
|
362
362
|
index.win === null || index.win === void 0 ? void 0 : index.win.addEventListener('ionKeyboardDidShow', keyboardShow);
|
|
363
|
-
componentEl.addEventListener('focusout', focusOut
|
|
363
|
+
componentEl.addEventListener('focusout', focusOut);
|
|
364
364
|
};
|
|
365
|
-
componentEl.addEventListener('focusin', focusIn
|
|
365
|
+
componentEl.addEventListener('focusin', focusIn);
|
|
366
366
|
return () => {
|
|
367
|
-
componentEl.removeEventListener('focusin', focusIn
|
|
367
|
+
componentEl.removeEventListener('focusin', focusIn);
|
|
368
368
|
index.win === null || index.win === void 0 ? void 0 : index.win.removeEventListener('ionKeyboardDidShow', keyboardShow);
|
|
369
|
-
componentEl.removeEventListener('focusout', focusOut
|
|
369
|
+
componentEl.removeEventListener('focusout', focusOut);
|
|
370
370
|
};
|
|
371
371
|
};
|
|
372
372
|
/**
|
|
@@ -45,7 +45,7 @@ const App = class {
|
|
|
45
45
|
* platforms proceed into this block.
|
|
46
46
|
*/
|
|
47
47
|
const platform = ionicGlobal.isPlatform(window, 'ios') ? 'ios' : 'android';
|
|
48
|
-
Promise.resolve().then(function () { return require('./input-shims-
|
|
48
|
+
Promise.resolve().then(function () { return require('./input-shims-9e59ef62.js'); }).then((module) => module.startInputShims(ionicGlobal.config, platform));
|
|
49
49
|
}
|
|
50
50
|
const hardwareBackButtonModule = await Promise.resolve().then(function () { return require('./hardware-back-button-44e7c052.js'); });
|
|
51
51
|
const supportsHardwareBackButtonEvents = isHybrid || hardwareBackButton.shouldUseCloseWatcher();
|
|
@@ -79,6 +79,7 @@ const Input = class {
|
|
|
79
79
|
ev.preventDefault();
|
|
80
80
|
ev.stopPropagation();
|
|
81
81
|
// Attempt to focus input again after pressing clear button
|
|
82
|
+
console.log('hi there');
|
|
82
83
|
this.setFocus();
|
|
83
84
|
}
|
|
84
85
|
this.value = '';
|
|
@@ -405,7 +406,7 @@ const Input = class {
|
|
|
405
406
|
* TODO(FW-5592): Remove hasStartEndSlots condition
|
|
406
407
|
*/
|
|
407
408
|
const labelShouldFloat = labelPlacement === 'stacked' || (labelPlacement === 'floating' && (hasValue || hasFocus || hasStartEndSlots));
|
|
408
|
-
return (index.h(index.Host, { key: '
|
|
409
|
+
return (index.h(index.Host, { key: 'c151cc531804483693052773aeeec1ee5f0c8a47', class: theme.createColorClasses(this.color, {
|
|
409
410
|
[mode]: true,
|
|
410
411
|
'has-value': hasValue,
|
|
411
412
|
'has-focus': hasFocus,
|
|
@@ -416,14 +417,22 @@ const Input = class {
|
|
|
416
417
|
'in-item': inItem,
|
|
417
418
|
'in-item-color': theme.hostContext('ion-item.ion-color', this.el),
|
|
418
419
|
'input-disabled': disabled,
|
|
419
|
-
}) }, index.h("label", { key: '
|
|
420
|
+
}) }, index.h("label", { key: 'fbe253f1e0dd24ad13333f4dc06dd13f6b33a042', class: "input-wrapper", htmlFor: inputId }, this.renderLabelContainer(), index.h("div", { key: '817707ed2e4dce8b5ae2391960d1be367a1e2ddf', class: "native-wrapper" }, index.h("slot", { key: '776c6b305b275e0babdfd6116ccc3f5399c97d38', name: "start" }), index.h("input", Object.assign({ key: 'eb5bdc9fda239c8edd7ed7fdc78517728a351a50', class: "native-input", ref: (input) => (this.nativeInput = input), id: inputId, disabled: disabled, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, multiple: this.multiple, name: this.name, pattern: this.pattern, placeholder: this.placeholder || '', readOnly: readonly, required: this.required, spellcheck: this.spellcheck, step: this.step, type: this.type, value: value, onInput: this.onInput, onChange: this.onChange, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeydown, onCompositionstart: this.onCompositionStart, onCompositionend: this.onCompositionEnd }, this.inheritedAttributes)), this.clearInput && !readonly && !disabled && (index.h("button", { key: '57ff8319da7ca85f3ce41a7581c55b4d91202542', "aria-label": "reset", type: "button", class: "input-clear-icon", onPointerDown: (ev) => {
|
|
420
421
|
/**
|
|
421
422
|
* This prevents mobile browsers from
|
|
422
423
|
* blurring the input when the clear
|
|
423
424
|
* button is activated.
|
|
424
425
|
*/
|
|
425
426
|
ev.preventDefault();
|
|
426
|
-
},
|
|
427
|
+
}, onFocusin: (ev) => {
|
|
428
|
+
/**
|
|
429
|
+
* Prevent the focusin event from bubbling otherwise it will cause the focusin
|
|
430
|
+
* event listener in scroll assist to fire. When this fires, focus will be moved
|
|
431
|
+
* back to the input even if the clear button was never tapped. This poses issues
|
|
432
|
+
* for screen readers as it means users would be unable to swipe past the clear button.
|
|
433
|
+
*/
|
|
434
|
+
ev.stopPropagation();
|
|
435
|
+
}, onClick: this.clearTextInput }, index.h("ion-icon", { key: 'c4c74c4387e8e81b4e00e0800ad7fd65d190a4ca', "aria-hidden": "true", icon: mode === 'ios' ? index$1.closeCircle : index$1.closeSharp }))), index.h("slot", { key: '6cf9e37091750a70ae97faa0104822f92cd313f5', name: "end" })), shouldRenderHighlight && index.h("div", { key: 'd4d032e244ae917cbedddac633d83501a1a2cf5b', class: "input-highlight" })), this.renderBottomContent()));
|
|
427
436
|
}
|
|
428
437
|
get el() { return index.getElement(this); }
|
|
429
438
|
static get watchers() { return {
|
|
@@ -6,15 +6,22 @@ import { configs, test } from "../../../../utils/test/playwright/index";
|
|
|
6
6
|
/**
|
|
7
7
|
* This behavior does not vary across directions
|
|
8
8
|
*/
|
|
9
|
-
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
|
9
|
+
configs({ directions: ['ltr'], palettes: ['light', 'dark'] }).forEach(({ title, screenshot, config }) => {
|
|
10
10
|
test.describe(title('datetime: color'), () => {
|
|
11
11
|
test('should not have visual regressions', async ({ page }) => {
|
|
12
|
-
await page.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
await page.setContent(`
|
|
13
|
+
<div id="container" style="width: 250px;">
|
|
14
|
+
<ion-datetime
|
|
15
|
+
color="danger"
|
|
16
|
+
value="2022-05-03"
|
|
17
|
+
show-default-title="true"
|
|
18
|
+
show-default-buttons="true"
|
|
19
|
+
></ion-datetime>
|
|
20
|
+
</div>
|
|
21
|
+
`, config);
|
|
22
|
+
const container = page.locator('#container');
|
|
23
|
+
await page.locator('.datetime-ready').waitFor();
|
|
24
|
+
await expect(container).toHaveScreenshot(screenshot(`datetime-color`));
|
|
18
25
|
});
|
|
19
26
|
});
|
|
20
27
|
});
|
|
@@ -69,6 +69,7 @@ export class Input {
|
|
|
69
69
|
ev.preventDefault();
|
|
70
70
|
ev.stopPropagation();
|
|
71
71
|
// Attempt to focus input again after pressing clear button
|
|
72
|
+
console.log('hi there');
|
|
72
73
|
this.setFocus();
|
|
73
74
|
}
|
|
74
75
|
this.value = '';
|
|
@@ -395,7 +396,7 @@ export class Input {
|
|
|
395
396
|
* TODO(FW-5592): Remove hasStartEndSlots condition
|
|
396
397
|
*/
|
|
397
398
|
const labelShouldFloat = labelPlacement === 'stacked' || (labelPlacement === 'floating' && (hasValue || hasFocus || hasStartEndSlots));
|
|
398
|
-
return (h(Host, { key: '
|
|
399
|
+
return (h(Host, { key: 'c151cc531804483693052773aeeec1ee5f0c8a47', class: createColorClasses(this.color, {
|
|
399
400
|
[mode]: true,
|
|
400
401
|
'has-value': hasValue,
|
|
401
402
|
'has-focus': hasFocus,
|
|
@@ -406,14 +407,22 @@ export class Input {
|
|
|
406
407
|
'in-item': inItem,
|
|
407
408
|
'in-item-color': hostContext('ion-item.ion-color', this.el),
|
|
408
409
|
'input-disabled': disabled,
|
|
409
|
-
}) }, h("label", { key: '
|
|
410
|
+
}) }, h("label", { key: 'fbe253f1e0dd24ad13333f4dc06dd13f6b33a042', class: "input-wrapper", htmlFor: inputId }, this.renderLabelContainer(), h("div", { key: '817707ed2e4dce8b5ae2391960d1be367a1e2ddf', class: "native-wrapper" }, h("slot", { key: '776c6b305b275e0babdfd6116ccc3f5399c97d38', name: "start" }), h("input", Object.assign({ key: 'eb5bdc9fda239c8edd7ed7fdc78517728a351a50', class: "native-input", ref: (input) => (this.nativeInput = input), id: inputId, disabled: disabled, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, multiple: this.multiple, name: this.name, pattern: this.pattern, placeholder: this.placeholder || '', readOnly: readonly, required: this.required, spellcheck: this.spellcheck, step: this.step, type: this.type, value: value, onInput: this.onInput, onChange: this.onChange, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeydown, onCompositionstart: this.onCompositionStart, onCompositionend: this.onCompositionEnd }, this.inheritedAttributes)), this.clearInput && !readonly && !disabled && (h("button", { key: '57ff8319da7ca85f3ce41a7581c55b4d91202542', "aria-label": "reset", type: "button", class: "input-clear-icon", onPointerDown: (ev) => {
|
|
410
411
|
/**
|
|
411
412
|
* This prevents mobile browsers from
|
|
412
413
|
* blurring the input when the clear
|
|
413
414
|
* button is activated.
|
|
414
415
|
*/
|
|
415
416
|
ev.preventDefault();
|
|
416
|
-
},
|
|
417
|
+
}, onFocusin: (ev) => {
|
|
418
|
+
/**
|
|
419
|
+
* Prevent the focusin event from bubbling otherwise it will cause the focusin
|
|
420
|
+
* event listener in scroll assist to fire. When this fires, focus will be moved
|
|
421
|
+
* back to the input even if the clear button was never tapped. This poses issues
|
|
422
|
+
* for screen readers as it means users would be unable to swipe past the clear button.
|
|
423
|
+
*/
|
|
424
|
+
ev.stopPropagation();
|
|
425
|
+
}, onClick: this.clearTextInput }, h("ion-icon", { key: 'c4c74c4387e8e81b4e00e0800ad7fd65d190a4ca', "aria-hidden": "true", icon: mode === 'ios' ? closeCircle : closeSharp }))), h("slot", { key: '6cf9e37091750a70ae97faa0104822f92cd313f5', name: "end" })), shouldRenderHighlight && h("div", { key: 'd4d032e244ae917cbedddac633d83501a1a2cf5b', class: "input-highlight" })), this.renderBottomContent()));
|
|
417
426
|
}
|
|
418
427
|
static get is() { return "ion-input"; }
|
|
419
428
|
static get encapsulation() { return "scoped"; }
|
|
@@ -3,39 +3,59 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { expect } from "@playwright/test";
|
|
5
5
|
import { configs, test } from "../../../../utils/test/playwright/index";
|
|
6
|
-
configs().forEach(({ title, screenshot, config }) => {
|
|
7
|
-
test.describe(title('toggle:
|
|
8
|
-
test.beforeEach(async ({ page }) => {
|
|
9
|
-
await page.goto(`/src/components/toggle/test/enable-on-off-labels`, config);
|
|
10
|
-
});
|
|
6
|
+
configs({ palettes: ['light', 'dark'] }).forEach(({ title, screenshot, config }) => {
|
|
7
|
+
test.describe(title('toggle: enable-on-off-labels'), () => {
|
|
11
8
|
test('should not have visual regressions', async ({ page }) => {
|
|
12
|
-
await page.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
await page.setContent(`
|
|
10
|
+
<style>
|
|
11
|
+
#container {
|
|
12
|
+
display: grid;
|
|
13
|
+
grid-template-columns: repeat(2, auto);
|
|
14
|
+
justify-content: space-evenly;
|
|
15
|
+
gap: 8px;
|
|
16
|
+
padding: 16px 0;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
|
|
20
|
+
<div id="container">
|
|
21
|
+
<ion-toggle enable-on-off-labels="true">Unchecked</ion-toggle>
|
|
22
|
+
<ion-toggle enable-on-off-labels="true" checked>Checked</ion-toggle>
|
|
23
|
+
</div>
|
|
24
|
+
`, config);
|
|
25
|
+
const container = page.locator('#container');
|
|
26
|
+
await expect(container).toHaveScreenshot(screenshot(`toggle-on-off-labels`));
|
|
24
27
|
});
|
|
25
|
-
test('should not have visual regressions', async ({ page }) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
test('should not have visual regressions with color', async ({ page }) => {
|
|
29
|
+
await page.setContent(`
|
|
30
|
+
<style>
|
|
31
|
+
#container {
|
|
32
|
+
display: grid;
|
|
33
|
+
grid-template-columns: repeat(2, auto);
|
|
34
|
+
justify-content: space-evenly;
|
|
35
|
+
gap: 8px;
|
|
36
|
+
padding: 16px 0;
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
39
|
+
|
|
40
|
+
<div id="container">
|
|
41
|
+
<ion-toggle color="secondary" enable-on-off-labels="true">Unchecked</ion-toggle>
|
|
42
|
+
<ion-toggle color="secondary" enable-on-off-labels="true" checked>Checked</ion-toggle>
|
|
43
|
+
<ion-toggle color="success" enable-on-off-labels="true">Unchecked</ion-toggle>
|
|
44
|
+
<ion-toggle color="success" enable-on-off-labels="true" checked>Checked</ion-toggle>
|
|
45
|
+
<ion-toggle color="danger" enable-on-off-labels="true">Unchecked</ion-toggle>
|
|
46
|
+
<ion-toggle color="danger" enable-on-off-labels="true" checked>Checked</ion-toggle>
|
|
47
|
+
<ion-toggle color="tertiary" enable-on-off-labels="true">Unchecked</ion-toggle>
|
|
48
|
+
<ion-toggle color="tertiary" enable-on-off-labels="true" checked>Checked</ion-toggle>
|
|
49
|
+
<ion-toggle color="light" enable-on-off-labels="true">Unchecked</ion-toggle>
|
|
50
|
+
<ion-toggle color="light" enable-on-off-labels="true" checked>Checked</ion-toggle>
|
|
51
|
+
<ion-toggle color="medium" enable-on-off-labels="true">Unchecked</ion-toggle>
|
|
52
|
+
<ion-toggle color="medium" enable-on-off-labels="true" checked>Checked</ion-toggle>
|
|
53
|
+
<ion-toggle color="dark" enable-on-off-labels="true">Unchecked</ion-toggle>
|
|
54
|
+
<ion-toggle color="dark" enable-on-off-labels="true" checked>Checked</ion-toggle>
|
|
55
|
+
</div>
|
|
56
|
+
`, config);
|
|
57
|
+
const container = page.locator('#container');
|
|
58
|
+
await expect(container).toHaveScreenshot(screenshot(`toggle-on-off-labels-color`));
|
|
39
59
|
});
|
|
40
60
|
});
|
|
41
61
|
});
|
|
@@ -96,7 +96,7 @@ export const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, ke
|
|
|
96
96
|
const focusOut = () => {
|
|
97
97
|
hasKeyboardBeenPresentedForTextField = false;
|
|
98
98
|
win === null || win === void 0 ? void 0 : win.removeEventListener('ionKeyboardDidShow', keyboardShow);
|
|
99
|
-
componentEl.removeEventListener('focusout', focusOut
|
|
99
|
+
componentEl.removeEventListener('focusout', focusOut);
|
|
100
100
|
};
|
|
101
101
|
/**
|
|
102
102
|
* When the input is about to receive
|
|
@@ -116,13 +116,13 @@ export const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, ke
|
|
|
116
116
|
}
|
|
117
117
|
jsSetFocus(componentEl, inputEl, contentEl, footerEl, keyboardHeight, addScrollPadding, disableClonedInput, platformHeight);
|
|
118
118
|
win === null || win === void 0 ? void 0 : win.addEventListener('ionKeyboardDidShow', keyboardShow);
|
|
119
|
-
componentEl.addEventListener('focusout', focusOut
|
|
119
|
+
componentEl.addEventListener('focusout', focusOut);
|
|
120
120
|
};
|
|
121
|
-
componentEl.addEventListener('focusin', focusIn
|
|
121
|
+
componentEl.addEventListener('focusin', focusIn);
|
|
122
122
|
return () => {
|
|
123
|
-
componentEl.removeEventListener('focusin', focusIn
|
|
123
|
+
componentEl.removeEventListener('focusin', focusIn);
|
|
124
124
|
win === null || win === void 0 ? void 0 : win.removeEventListener('ionKeyboardDidShow', keyboardShow);
|
|
125
|
-
componentEl.removeEventListener('focusout', focusOut
|
|
125
|
+
componentEl.removeEventListener('focusout', focusOut);
|
|
126
126
|
};
|
|
127
127
|
};
|
|
128
128
|
/**
|
package/dist/docs.json
CHANGED
|
@@ -338,7 +338,7 @@ const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, keyboardH
|
|
|
338
338
|
const focusOut = () => {
|
|
339
339
|
hasKeyboardBeenPresentedForTextField = false;
|
|
340
340
|
win === null || win === void 0 ? void 0 : win.removeEventListener('ionKeyboardDidShow', keyboardShow);
|
|
341
|
-
componentEl.removeEventListener('focusout', focusOut
|
|
341
|
+
componentEl.removeEventListener('focusout', focusOut);
|
|
342
342
|
};
|
|
343
343
|
/**
|
|
344
344
|
* When the input is about to receive
|
|
@@ -358,13 +358,13 @@ const enableScrollAssist = (componentEl, inputEl, contentEl, footerEl, keyboardH
|
|
|
358
358
|
}
|
|
359
359
|
jsSetFocus(componentEl, inputEl, contentEl, footerEl, keyboardHeight, addScrollPadding, disableClonedInput, platformHeight);
|
|
360
360
|
win === null || win === void 0 ? void 0 : win.addEventListener('ionKeyboardDidShow', keyboardShow);
|
|
361
|
-
componentEl.addEventListener('focusout', focusOut
|
|
361
|
+
componentEl.addEventListener('focusout', focusOut);
|
|
362
362
|
};
|
|
363
|
-
componentEl.addEventListener('focusin', focusIn
|
|
363
|
+
componentEl.addEventListener('focusin', focusIn);
|
|
364
364
|
return () => {
|
|
365
|
-
componentEl.removeEventListener('focusin', focusIn
|
|
365
|
+
componentEl.removeEventListener('focusin', focusIn);
|
|
366
366
|
win === null || win === void 0 ? void 0 : win.removeEventListener('ionKeyboardDidShow', keyboardShow);
|
|
367
|
-
componentEl.removeEventListener('focusout', focusOut
|
|
367
|
+
componentEl.removeEventListener('focusout', focusOut);
|
|
368
368
|
};
|
|
369
369
|
};
|
|
370
370
|
/**
|
|
@@ -41,7 +41,7 @@ const App = class {
|
|
|
41
41
|
* platforms proceed into this block.
|
|
42
42
|
*/
|
|
43
43
|
const platform = isPlatform(window, 'ios') ? 'ios' : 'android';
|
|
44
|
-
import('./input-shims-
|
|
44
|
+
import('./input-shims-0314bbe5.js').then((module) => module.startInputShims(config, platform));
|
|
45
45
|
}
|
|
46
46
|
const hardwareBackButtonModule = await import('./hardware-back-button-ba8f64c2.js');
|
|
47
47
|
const supportsHardwareBackButtonEvents = isHybrid || shouldUseCloseWatcher();
|
|
@@ -75,6 +75,7 @@ const Input = class {
|
|
|
75
75
|
ev.preventDefault();
|
|
76
76
|
ev.stopPropagation();
|
|
77
77
|
// Attempt to focus input again after pressing clear button
|
|
78
|
+
console.log('hi there');
|
|
78
79
|
this.setFocus();
|
|
79
80
|
}
|
|
80
81
|
this.value = '';
|
|
@@ -401,7 +402,7 @@ const Input = class {
|
|
|
401
402
|
* TODO(FW-5592): Remove hasStartEndSlots condition
|
|
402
403
|
*/
|
|
403
404
|
const labelShouldFloat = labelPlacement === 'stacked' || (labelPlacement === 'floating' && (hasValue || hasFocus || hasStartEndSlots));
|
|
404
|
-
return (h(Host, { key: '
|
|
405
|
+
return (h(Host, { key: 'c151cc531804483693052773aeeec1ee5f0c8a47', class: createColorClasses(this.color, {
|
|
405
406
|
[mode]: true,
|
|
406
407
|
'has-value': hasValue,
|
|
407
408
|
'has-focus': hasFocus,
|
|
@@ -412,14 +413,22 @@ const Input = class {
|
|
|
412
413
|
'in-item': inItem,
|
|
413
414
|
'in-item-color': hostContext('ion-item.ion-color', this.el),
|
|
414
415
|
'input-disabled': disabled,
|
|
415
|
-
}) }, h("label", { key: '
|
|
416
|
+
}) }, h("label", { key: 'fbe253f1e0dd24ad13333f4dc06dd13f6b33a042', class: "input-wrapper", htmlFor: inputId }, this.renderLabelContainer(), h("div", { key: '817707ed2e4dce8b5ae2391960d1be367a1e2ddf', class: "native-wrapper" }, h("slot", { key: '776c6b305b275e0babdfd6116ccc3f5399c97d38', name: "start" }), h("input", Object.assign({ key: 'eb5bdc9fda239c8edd7ed7fdc78517728a351a50', class: "native-input", ref: (input) => (this.nativeInput = input), id: inputId, disabled: disabled, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, multiple: this.multiple, name: this.name, pattern: this.pattern, placeholder: this.placeholder || '', readOnly: readonly, required: this.required, spellcheck: this.spellcheck, step: this.step, type: this.type, value: value, onInput: this.onInput, onChange: this.onChange, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeydown, onCompositionstart: this.onCompositionStart, onCompositionend: this.onCompositionEnd }, this.inheritedAttributes)), this.clearInput && !readonly && !disabled && (h("button", { key: '57ff8319da7ca85f3ce41a7581c55b4d91202542', "aria-label": "reset", type: "button", class: "input-clear-icon", onPointerDown: (ev) => {
|
|
416
417
|
/**
|
|
417
418
|
* This prevents mobile browsers from
|
|
418
419
|
* blurring the input when the clear
|
|
419
420
|
* button is activated.
|
|
420
421
|
*/
|
|
421
422
|
ev.preventDefault();
|
|
422
|
-
},
|
|
423
|
+
}, onFocusin: (ev) => {
|
|
424
|
+
/**
|
|
425
|
+
* Prevent the focusin event from bubbling otherwise it will cause the focusin
|
|
426
|
+
* event listener in scroll assist to fire. When this fires, focus will be moved
|
|
427
|
+
* back to the input even if the clear button was never tapped. This poses issues
|
|
428
|
+
* for screen readers as it means users would be unable to swipe past the clear button.
|
|
429
|
+
*/
|
|
430
|
+
ev.stopPropagation();
|
|
431
|
+
}, onClick: this.clearTextInput }, h("ion-icon", { key: 'c4c74c4387e8e81b4e00e0800ad7fd65d190a4ca', "aria-hidden": "true", icon: mode === 'ios' ? closeCircle : closeSharp }))), h("slot", { key: '6cf9e37091750a70ae97faa0104822f92cd313f5', name: "end" })), shouldRenderHighlight && h("div", { key: 'd4d032e244ae917cbedddac633d83501a1a2cf5b', class: "input-highlight" })), this.renderBottomContent()));
|
|
423
432
|
}
|
|
424
433
|
get el() { return getElement(this); }
|
|
425
434
|
static get watchers() { return {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{__awaiter,__generator,__spreadArray}from"tslib";
|
|
2
|
+
/*!
|
|
3
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
4
|
+
*/import{w as win,d as doc}from"./index-a5d50daf.js";import{g as getScrollElement,c as scrollByPoint,f as findClosestIonContent}from"./index-5cc724f3.js";import{a as addEventListener,b as removeEventListener,r as raf,c as componentOnReady}from"./helpers-da915de8.js";import{a as KeyboardResize,K as Keyboard}from"./keyboard-73175e24.js";import"./index-9b0d46f4.js";import"./capacitor-59395cbd.js";var cloneMap=new WeakMap;var relocateInput=function(r,n,e,t,i){if(t===void 0){t=0}if(i===void 0){i=false}if(cloneMap.has(r)===e){return}if(e){addClone(r,n,t,i)}else{removeClone(r,n)}};var isFocused=function(r){return r===r.getRootNode().activeElement};var addClone=function(r,n,e,t){if(t===void 0){t=false}var i=n.parentNode;var o=n.cloneNode(false);o.classList.add("cloned-input");o.tabIndex=-1;if(t){o.disabled=true}i.appendChild(o);cloneMap.set(r,o);var a=r.ownerDocument;var u=a.dir==="rtl"?9999:-9999;r.style.pointerEvents="none";n.style.transform="translate3d(".concat(u,"px,").concat(e,"px,0) scale(0)")};var removeClone=function(r,n){var e=cloneMap.get(r);if(e){cloneMap.delete(r);e.remove()}r.style.pointerEvents="";n.style.transform=""};var SCROLL_AMOUNT_PADDING=50;var enableHideCaretOnScroll=function(r,n,e){if(!e||!n){return function(){return}}var t=function(e){if(isFocused(n)){relocateInput(r,n,e)}};var i=function(){return relocateInput(r,n,false)};var o=function(){return t(true)};var a=function(){return t(false)};addEventListener(e,"ionScrollStart",o);addEventListener(e,"ionScrollEnd",a);n.addEventListener("blur",i);return function(){removeEventListener(e,"ionScrollStart",o);removeEventListener(e,"ionScrollEnd",a);n.removeEventListener("blur",i)}};var SKIP_SELECTOR="input, textarea, [no-blur], [contenteditable]";var enableInputBlurring=function(){var r=true;var n=false;var e=document;var t=function(){n=true};var i=function(){r=true};var o=function(t){if(n){n=false;return}var i=e.activeElement;if(!i){return}if(i.matches(SKIP_SELECTOR)){return}var o=t.target;if(o===i){return}if(o.matches(SKIP_SELECTOR)||o.closest(SKIP_SELECTOR)){return}r=false;setTimeout((function(){if(!r){i.blur()}}),50)};addEventListener(e,"ionScrollStart",t);e.addEventListener("focusin",i,true);e.addEventListener("touchend",o,false);return function(){removeEventListener(e,"ionScrollStart",t,true);e.removeEventListener("focusin",i,true);e.removeEventListener("touchend",o,false)}};var SCROLL_ASSIST_SPEED=.3;var getScrollData=function(r,n,e,t){var i;var o=(i=r.closest("ion-item,[ion-item]"))!==null&&i!==void 0?i:r;return calcScrollData(o.getBoundingClientRect(),n.getBoundingClientRect(),e,t)};var calcScrollData=function(r,n,e,t){var i=r.top;var o=r.bottom;var a=n.top;var u=Math.min(n.bottom,t-e);var c=a+15;var d=u-SCROLL_AMOUNT_PADDING;var f=d-o;var l=c-i;var s=Math.round(f<0?-f:l>0?-l:0);var v=Math.min(s,i-a);var S=Math.abs(v);var _=S/SCROLL_ASSIST_SPEED;var w=Math.min(400,Math.max(150,_));return{scrollAmount:v,scrollDuration:w,scrollPadding:e,inputSafeY:-(i-c)+4}};var PADDING_TIMER_KEY="$ionPaddingTimer";var setScrollPadding=function(r,n,e){var t=r[PADDING_TIMER_KEY];if(t){clearTimeout(t)}if(n>0){r.style.setProperty("--keyboard-offset","".concat(n,"px"))}else{r[PADDING_TIMER_KEY]=setTimeout((function(){r.style.setProperty("--keyboard-offset","0px");if(e){e()}}),120)}};var setClearScrollPaddingListener=function(r,n,e){var t=function(){if(n){setScrollPadding(n,0,e)}};r.addEventListener("focusout",t,{once:true})};var currentPadding=0;var SKIP_SCROLL_ASSIST="data-ionic-skip-scroll-assist";var enableScrollAssist=function(r,n,e,t,i,o,a,u){if(u===void 0){u=false}var c=o&&(a===undefined||a.mode===KeyboardResize.None);var d=false;var f=win!==undefined?win.innerHeight:0;var l=function(i){if(d===false){d=true;return}jsSetFocus(r,n,e,t,i.detail.keyboardHeight,c,u,f,false)};var s=function(){d=false;win===null||win===void 0?void 0:win.removeEventListener("ionKeyboardDidShow",l);r.removeEventListener("focusout",s)};var v=function(){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(o){if(n.hasAttribute(SKIP_SCROLL_ASSIST)){n.removeAttribute(SKIP_SCROLL_ASSIST);return[2]}jsSetFocus(r,n,e,t,i,c,u,f);win===null||win===void 0?void 0:win.addEventListener("ionKeyboardDidShow",l);r.addEventListener("focusout",s);return[2]}))}))};r.addEventListener("focusin",v);return function(){r.removeEventListener("focusin",v);win===null||win===void 0?void 0:win.removeEventListener("ionKeyboardDidShow",l);r.removeEventListener("focusout",s)}};var setManualFocus=function(r){if(document.activeElement===r){return}r.setAttribute(SKIP_SCROLL_ASSIST,"true");r.focus()};var jsSetFocus=function(r,n,e,t,i,o){var a=[];for(var u=6;u<arguments.length;u++){a[u-6]=arguments[u]}return __awaiter(void 0,__spreadArray([r,n,e,t,i,o],a,true),void 0,(function(r,n,e,t,i,o,a,u,c){var d,f,l,s,v,S;if(a===void 0){a=false}if(u===void 0){u=0}if(c===void 0){c=true}return __generator(this,(function(_){switch(_.label){case 0:if(!e&&!t){return[2]}d=getScrollData(r,e||t,i,u);if(e&&Math.abs(d.scrollAmount)<4){setManualFocus(n);if(o&&e!==null){setScrollPadding(e,currentPadding);setClearScrollPaddingListener(n,e,(function(){return currentPadding=0}))}return[2]}relocateInput(r,n,true,d.inputSafeY,a);setManualFocus(n);raf((function(){return r.click()}));if(o&&e){currentPadding=d.scrollPadding;setScrollPadding(e,currentPadding)}if(!(typeof window!=="undefined"))return[3,3];l=function(){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(f!==undefined){clearTimeout(f)}window.removeEventListener("ionKeyboardDidShow",s);window.removeEventListener("ionKeyboardDidShow",l);if(!e)return[3,2];return[4,scrollByPoint(e,0,d.scrollAmount,d.scrollDuration)];case 1:t.sent();t.label=2;case 2:relocateInput(r,n,false,d.inputSafeY);setManualFocus(n);if(o){setClearScrollPaddingListener(n,e,(function(){return currentPadding=0}))}return[2]}}))}))};s=function(){window.removeEventListener("ionKeyboardDidShow",s);window.addEventListener("ionKeyboardDidShow",l)};if(!e)return[3,2];return[4,getScrollElement(e)];case 1:v=_.sent();S=v.scrollHeight-v.clientHeight;if(c&&d.scrollAmount>S-v.scrollTop){if(n.type==="password"){d.scrollAmount+=SCROLL_AMOUNT_PADDING;window.addEventListener("ionKeyboardDidShow",s)}else{window.addEventListener("ionKeyboardDidShow",l)}f=setTimeout(l,1e3);return[2]}_.label=2;case 2:l();_.label=3;case 3:return[2]}}))}))};var INPUT_BLURRING=true;var startInputShims=function(r,n){return __awaiter(void 0,void 0,void 0,(function(){var e,t,i,o,a,u,c,d,f,l,s,v,S,_,w,p;return __generator(this,(function(I){switch(I.label){case 0:if(doc===undefined){return[2]}e=n==="ios";t=n==="android";i=r.getNumber("keyboardHeight",290);o=r.getBoolean("scrollAssist",true);a=r.getBoolean("hideCaretOnScroll",e);u=r.getBoolean("inputBlurring",false);c=r.getBoolean("scrollPadding",true);d=Array.from(doc.querySelectorAll("ion-input, ion-textarea"));f=new WeakMap;l=new WeakMap;return[4,Keyboard.getResizeMode()];case 1:s=I.sent();v=function(r){return __awaiter(void 0,void 0,void 0,(function(){var n,e,u,d,v,S,v;return __generator(this,(function(_){switch(_.label){case 0:return[4,new Promise((function(n){return componentOnReady(r,n)}))];case 1:_.sent();n=r.shadowRoot||r;e=n.querySelector("input")||n.querySelector("textarea");u=findClosestIonContent(r);d=!u?r.closest("ion-footer"):null;if(!e){return[2]}if(!!u&&a&&!f.has(r)){v=enableHideCaretOnScroll(r,e,u);f.set(r,v)}S=e.type==="date"||e.type==="datetime-local";if(!S&&(!!u||!!d)&&o&&!l.has(r)){v=enableScrollAssist(r,e,u,d,i,c,s,t);l.set(r,v)}return[2]}}))}))};S=function(r){if(a){var n=f.get(r);if(n){n()}f.delete(r)}if(o){var n=l.get(r);if(n){n()}l.delete(r)}};if(u&&INPUT_BLURRING){enableInputBlurring()}for(_=0,w=d;_<w.length;_++){p=w[_];v(p)}doc.addEventListener("ionInputDidLoad",(function(r){v(r.detail)}));doc.addEventListener("ionInputDidUnload",(function(r){S(r.detail)}));return[2]}}))}))};export{startInputShims};
|