@ionic/core 7.7.5 → 7.8.0
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/data.js +23 -38
- package/components/ion-datetime-button.js +11 -10
- package/components/ion-datetime.js +69 -7
- package/components/ion-searchbar.js +34 -5
- package/dist/cjs/{data-a5109f09.js → data-4487a815.js} +22 -39
- package/dist/cjs/ion-datetime-button.cjs.entry.js +11 -10
- package/dist/cjs/ion-datetime_3.cjs.entry.js +66 -7
- package/dist/cjs/ion-searchbar.cjs.entry.js +28 -4
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/datetime/datetime.js +50 -7
- package/dist/collection/components/datetime/test/basic/datetime.e2e.js +77 -0
- package/dist/collection/components/datetime/test/format.spec.js +65 -15
- package/dist/collection/components/datetime/utils/format.js +24 -37
- package/dist/collection/components/datetime/utils/validate.js +45 -0
- package/dist/collection/components/datetime-button/datetime-button.js +11 -10
- package/dist/collection/components/datetime-button/test/basic/datetime-button.e2e.js +65 -0
- package/dist/collection/components/searchbar/searchbar.js +84 -5
- package/dist/collection/components/searchbar/test/searchbar.spec.js +20 -2
- package/dist/docs.json +113 -1
- package/dist/esm/{data-0f3ab200.js → data-bb424ba8.js} +23 -38
- package/dist/esm/ion-datetime-button.entry.js +11 -10
- package/dist/esm/ion-datetime_3.entry.js +66 -7
- package/dist/esm/ion-searchbar.entry.js +29 -5
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/data-bb424ba8.js +4 -0
- package/dist/esm-es5/ion-datetime-button.entry.js +1 -1
- package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
- package/dist/esm-es5/ion-searchbar.entry.js +1 -1
- package/dist/esm-es5/ionic.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/html.html-data.json +12 -0
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-2b77099e.system.entry.js +4 -0
- package/dist/ionic/p-3789920e.js +4 -0
- package/dist/ionic/p-4abb3f9e.entry.js +4 -0
- package/dist/ionic/p-60c9fd9e.system.js +1 -1
- package/dist/ionic/p-8a1b0abb.system.js +4 -0
- package/dist/ionic/p-a722d78f.system.entry.js +4 -0
- package/dist/ionic/p-bc56a728.entry.js +4 -0
- package/dist/ionic/p-cfd31f45.system.entry.js +4 -0
- package/dist/ionic/p-e02681a6.entry.js +4 -0
- package/dist/types/components/datetime/datetime-interface.d.ts +10 -0
- package/dist/types/components/datetime/datetime.d.ts +9 -1
- package/dist/types/components/datetime/utils/format.d.ts +7 -13
- package/dist/types/components/datetime/utils/validate.d.ts +8 -0
- package/dist/types/components/searchbar/searchbar.d.ts +38 -0
- package/dist/types/components.d.ts +34 -2
- package/hydrate/index.js +127 -56
- package/package.json +1 -1
- package/dist/esm-es5/data-0f3ab200.js +0 -4
- package/dist/ionic/p-6f5b32c7.system.entry.js +0 -4
- package/dist/ionic/p-7330c044.system.js +0 -4
- package/dist/ionic/p-76afa95f.entry.js +0 -4
- package/dist/ionic/p-81f18ed1.system.entry.js +0 -4
- package/dist/ionic/p-c67c9644.entry.js +0 -4
- package/dist/ionic/p-e447e552.entry.js +0 -4
- package/dist/ionic/p-ef269a56.system.entry.js +0 -4
- package/dist/ionic/p-f7dce541.js +0 -4
package/components/data.js
CHANGED
|
@@ -832,7 +832,25 @@ const getFormattedDayPeriod = (dayPeriod) => {
|
|
|
832
832
|
}
|
|
833
833
|
return dayPeriod.toUpperCase();
|
|
834
834
|
};
|
|
835
|
-
|
|
835
|
+
/**
|
|
836
|
+
* Including time zone options may lead to the rendered text showing a
|
|
837
|
+
* different time from what was selected in the Datetime, which could cause
|
|
838
|
+
* confusion.
|
|
839
|
+
*/
|
|
840
|
+
const stripTimeZone = (formatOptions) => {
|
|
841
|
+
return Object.assign(Object.assign({}, formatOptions), {
|
|
842
|
+
/**
|
|
843
|
+
* Setting the time zone to UTC ensures that the value shown is always the
|
|
844
|
+
* same as what was selected and safeguards against older Safari bugs with
|
|
845
|
+
* Intl.DateTimeFormat.
|
|
846
|
+
*/
|
|
847
|
+
timeZone: 'UTC',
|
|
848
|
+
/**
|
|
849
|
+
* We do not want to display the time zone name
|
|
850
|
+
*/
|
|
851
|
+
timeZoneName: undefined });
|
|
852
|
+
};
|
|
853
|
+
const getLocalizedTime = (locale, refParts, hourCycle, formatOptions = { hour: 'numeric', minute: 'numeric' }) => {
|
|
836
854
|
const timeParts = {
|
|
837
855
|
hour: refParts.hour,
|
|
838
856
|
minute: refParts.minute,
|
|
@@ -840,28 +858,12 @@ const getLocalizedTime = (locale, refParts, hourCycle) => {
|
|
|
840
858
|
if (timeParts.hour === undefined || timeParts.minute === undefined) {
|
|
841
859
|
return 'Invalid Time';
|
|
842
860
|
}
|
|
843
|
-
return new Intl.DateTimeFormat(locale, {
|
|
844
|
-
hour: 'numeric',
|
|
845
|
-
minute: 'numeric',
|
|
846
|
-
/**
|
|
847
|
-
* Setting the timeZone to UTC prevents
|
|
848
|
-
* new Intl.DatetimeFormat from subtracting
|
|
849
|
-
* the user's current timezone offset
|
|
850
|
-
* when formatting the time.
|
|
851
|
-
*/
|
|
852
|
-
timeZone: 'UTC',
|
|
861
|
+
return new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, stripTimeZone(formatOptions)), {
|
|
853
862
|
/**
|
|
854
863
|
* We use hourCycle here instead of hour12 due to:
|
|
855
864
|
* https://bugs.chromium.org/p/chromium/issues/detail?id=1347316&q=hour12&can=2
|
|
856
865
|
*/
|
|
857
|
-
hourCycle
|
|
858
|
-
/**
|
|
859
|
-
* Setting Z at the end indicates that this
|
|
860
|
-
* date string is in the UTC time zone. This
|
|
861
|
-
* prevents new Date from adding the time zone
|
|
862
|
-
* offset when getting the ISO string.
|
|
863
|
-
*/
|
|
864
|
-
}).format(new Date(convertDataToISO(Object.assign({
|
|
866
|
+
hourCycle })).format(new Date(convertDataToISO(Object.assign({
|
|
865
867
|
/**
|
|
866
868
|
* JS uses a simplified ISO 8601 format which allows for
|
|
867
869
|
* date-only formats and date-time formats, but not
|
|
@@ -947,14 +949,6 @@ const generateDayAriaLabel = (locale, today, refParts) => {
|
|
|
947
949
|
*/
|
|
948
950
|
return today ? `Today, ${labelString}` : labelString;
|
|
949
951
|
};
|
|
950
|
-
/**
|
|
951
|
-
* Gets the day of the week, month, and day
|
|
952
|
-
* Used for the header in MD mode.
|
|
953
|
-
*/
|
|
954
|
-
const getMonthAndDay = (locale, refParts) => {
|
|
955
|
-
const date = getNormalizedDate(refParts);
|
|
956
|
-
return new Intl.DateTimeFormat(locale, { weekday: 'short', month: 'short', day: 'numeric', timeZone: 'UTC' }).format(date);
|
|
957
|
-
};
|
|
958
952
|
/**
|
|
959
953
|
* Given a locale and a date object,
|
|
960
954
|
* return a formatted string that includes
|
|
@@ -965,15 +959,6 @@ const getMonthAndYear = (locale, refParts) => {
|
|
|
965
959
|
const date = getNormalizedDate(refParts);
|
|
966
960
|
return new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric', timeZone: 'UTC' }).format(date);
|
|
967
961
|
};
|
|
968
|
-
/**
|
|
969
|
-
* Given a locale and a date object,
|
|
970
|
-
* return a formatted string that includes
|
|
971
|
-
* the short month, numeric day, and full year.
|
|
972
|
-
* Example: Apr 22, 2021
|
|
973
|
-
*/
|
|
974
|
-
const getMonthDayAndYear = (locale, refParts) => {
|
|
975
|
-
return getLocalizedDateTime(locale, refParts, { month: 'short', day: 'numeric', year: 'numeric' });
|
|
976
|
-
};
|
|
977
962
|
/**
|
|
978
963
|
* Given a locale and a date object,
|
|
979
964
|
* return a formatted string that includes
|
|
@@ -1023,7 +1008,7 @@ const getNormalizedDate = (refParts) => {
|
|
|
1023
1008
|
*/
|
|
1024
1009
|
const getLocalizedDateTime = (locale, refParts, options) => {
|
|
1025
1010
|
const date = getNormalizedDate(refParts);
|
|
1026
|
-
return getDateTimeFormat(locale, options).format(date);
|
|
1011
|
+
return getDateTimeFormat(locale, stripTimeZone(options)).format(date);
|
|
1027
1012
|
};
|
|
1028
1013
|
/**
|
|
1029
1014
|
* Given a locale, DatetimeParts, and options
|
|
@@ -1622,4 +1607,4 @@ const getTimeColumnsData = (locale, refParts, hourCycle, minParts, maxParts, all
|
|
|
1622
1607
|
};
|
|
1623
1608
|
};
|
|
1624
1609
|
|
|
1625
|
-
export { getNumDaysInMonth as A, getCombinedDateColumnData as B, getMonthColumnData as C, getDayColumnData as D, getYearColumnData as E, isMonthFirstLocale as F, getTimeColumnsData as G, isLocaleDayPeriodRTL as H, getMonthAndYear as I, getDaysOfWeek as J, getDaysOfMonth as K, getHourCycle as L, getLocalizedTime as M,
|
|
1610
|
+
export { getNumDaysInMonth as A, getCombinedDateColumnData as B, getMonthColumnData as C, getDayColumnData as D, getYearColumnData as E, isMonthFirstLocale as F, getTimeColumnsData as G, isLocaleDayPeriodRTL as H, getMonthAndYear as I, getDaysOfWeek as J, getDaysOfMonth as K, getHourCycle as L, getLocalizedTime as M, getLocalizedDateTime as N, formatValue as O, clampDate as P, parseAmPm as Q, calculateHourFromAMPM as R, getDay as a, isAfter as b, isSameDay as c, getPreviousMonth as d, getNextMonth as e, getPartsFromCalendarDay as f, generateDayAriaLabel as g, getNextYear as h, isBefore as i, getPreviousYear as j, getEndOfWeek as k, getStartOfWeek as l, getPreviousDay as m, getNextDay as n, getPreviousWeek as o, getNextWeek as p, parseMinParts as q, parseMaxParts as r, parseDate as s, convertToArrayOfNumbers as t, convertDataToISO as u, validateParts as v, warnIfValueOutOfBounds as w, getToday as x, getClosestValidDate as y, generateMonths as z };
|
|
@@ -6,7 +6,7 @@ import { a as addEventListener, c as componentOnReady } from './helpers.js';
|
|
|
6
6
|
import { a as printIonError } from './index6.js';
|
|
7
7
|
import { c as createColorClasses } from './theme.js';
|
|
8
8
|
import { b as getIonMode } from './ionic-global.js';
|
|
9
|
-
import { s as parseDate, x as getToday, L as getHourCycle,
|
|
9
|
+
import { s as parseDate, x as getToday, L as getHourCycle, N as getLocalizedDateTime, M as getLocalizedTime } from './data.js';
|
|
10
10
|
import { d as defineCustomElement$2 } from './ripple-effect.js';
|
|
11
11
|
|
|
12
12
|
const iosDatetimeButtonCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host button{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:0px;margin-bottom:0px;position:relative;-webkit-transition:150ms color ease-in-out;transition:150ms color ease-in-out;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:1rem;cursor:pointer;overflow:hidden;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host(.time-active) #time-button,:host(.date-active) #date-button{color:var(--ion-color-base)}:host(.datetime-button-disabled){pointer-events:none}:host(.datetime-button-disabled) button{opacity:0.4}";
|
|
@@ -43,11 +43,12 @@ const DatetimeButton = /*@__PURE__*/ proxyCustomElement(class DatetimeButton ext
|
|
|
43
43
|
* to the locale specified on ion-datetime.
|
|
44
44
|
*/
|
|
45
45
|
this.setDateTimeText = () => {
|
|
46
|
+
var _a, _b, _c, _d, _e;
|
|
46
47
|
const { datetimeEl, datetimePresentation } = this;
|
|
47
48
|
if (!datetimeEl) {
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
|
-
const { value, locale, hourCycle, preferWheel, multiple, titleSelectedDatesFormatter } = datetimeEl;
|
|
51
|
+
const { value, locale, formatOptions, hourCycle, preferWheel, multiple, titleSelectedDatesFormatter } = datetimeEl;
|
|
51
52
|
const parsedValues = this.getParsedDateValues(value);
|
|
52
53
|
/**
|
|
53
54
|
* Both ion-datetime and ion-datetime-button default
|
|
@@ -70,8 +71,8 @@ const DatetimeButton = /*@__PURE__*/ proxyCustomElement(class DatetimeButton ext
|
|
|
70
71
|
switch (datetimePresentation) {
|
|
71
72
|
case 'date-time':
|
|
72
73
|
case 'time-date':
|
|
73
|
-
const dateText =
|
|
74
|
-
const timeText = getLocalizedTime(locale, firstParsedDatetime, computedHourCycle);
|
|
74
|
+
const dateText = getLocalizedDateTime(locale, firstParsedDatetime, (_a = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) !== null && _a !== void 0 ? _a : { month: 'short', day: 'numeric', year: 'numeric' });
|
|
75
|
+
const timeText = getLocalizedTime(locale, firstParsedDatetime, computedHourCycle, formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time);
|
|
75
76
|
if (preferWheel) {
|
|
76
77
|
this.dateText = `${dateText} ${timeText}`;
|
|
77
78
|
}
|
|
@@ -94,20 +95,20 @@ const DatetimeButton = /*@__PURE__*/ proxyCustomElement(class DatetimeButton ext
|
|
|
94
95
|
this.dateText = headerText;
|
|
95
96
|
}
|
|
96
97
|
else {
|
|
97
|
-
this.dateText =
|
|
98
|
+
this.dateText = getLocalizedDateTime(locale, firstParsedDatetime, (_b = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) !== null && _b !== void 0 ? _b : { month: 'short', day: 'numeric', year: 'numeric' });
|
|
98
99
|
}
|
|
99
100
|
break;
|
|
100
101
|
case 'time':
|
|
101
|
-
this.timeText = getLocalizedTime(locale, firstParsedDatetime, computedHourCycle);
|
|
102
|
+
this.timeText = getLocalizedTime(locale, firstParsedDatetime, computedHourCycle, formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time);
|
|
102
103
|
break;
|
|
103
104
|
case 'month-year':
|
|
104
|
-
this.dateText =
|
|
105
|
+
this.dateText = getLocalizedDateTime(locale, firstParsedDatetime, (_c = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) !== null && _c !== void 0 ? _c : { month: 'long', year: 'numeric' });
|
|
105
106
|
break;
|
|
106
107
|
case 'month':
|
|
107
|
-
this.dateText = getLocalizedDateTime(locale, firstParsedDatetime, { month: 'long' });
|
|
108
|
+
this.dateText = getLocalizedDateTime(locale, firstParsedDatetime, (_d = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) !== null && _d !== void 0 ? _d : { month: 'long' });
|
|
108
109
|
break;
|
|
109
110
|
case 'year':
|
|
110
|
-
this.dateText = getLocalizedDateTime(locale, firstParsedDatetime, { year: 'numeric' });
|
|
111
|
+
this.dateText = getLocalizedDateTime(locale, firstParsedDatetime, (_e = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) !== null && _e !== void 0 ? _e : { year: 'numeric' });
|
|
111
112
|
break;
|
|
112
113
|
}
|
|
113
114
|
};
|
|
@@ -336,7 +337,7 @@ const DatetimeButton = /*@__PURE__*/ proxyCustomElement(class DatetimeButton ext
|
|
|
336
337
|
render() {
|
|
337
338
|
const { color, dateText, timeText, selectedButton, datetimeActive, disabled } = this;
|
|
338
339
|
const mode = getIonMode(this);
|
|
339
|
-
return (h(Host, { key: '
|
|
340
|
+
return (h(Host, { key: '861a08f4a239de771875aee9b505e06ac7064b32', class: createColorClasses(color, {
|
|
340
341
|
[mode]: true,
|
|
341
342
|
[`${selectedButton}-active`]: datetimeActive,
|
|
342
343
|
['datetime-button-disabled']: disabled,
|
|
@@ -9,7 +9,7 @@ import { i as isRTL } from './dir.js';
|
|
|
9
9
|
import { c as createColorClasses } from './theme.js';
|
|
10
10
|
import { a as chevronBack, f as chevronForward, c as chevronDown, g as caretUpSharp, h as caretDownSharp } from './index7.js';
|
|
11
11
|
import { b as getIonMode } from './ionic-global.js';
|
|
12
|
-
import { g as generateDayAriaLabel, a as getDay, i as isBefore, b as isAfter, c as isSameDay, d as getPreviousMonth, e as getNextMonth, v as validateParts, f as getPartsFromCalendarDay, h as getNextYear, j as getPreviousYear, k as getEndOfWeek, l as getStartOfWeek, m as getPreviousDay, n as getNextDay, o as getPreviousWeek, p as getNextWeek, q as parseMinParts, r as parseMaxParts, s as parseDate, w as warnIfValueOutOfBounds, t as convertToArrayOfNumbers, u as convertDataToISO, x as getToday, y as getClosestValidDate, z as generateMonths, A as getNumDaysInMonth, B as getCombinedDateColumnData, C as getMonthColumnData, D as getDayColumnData, E as getYearColumnData, F as isMonthFirstLocale, G as getTimeColumnsData, H as isLocaleDayPeriodRTL, I as getMonthAndYear, J as getDaysOfWeek, K as getDaysOfMonth, L as getHourCycle, M as getLocalizedTime, N as
|
|
12
|
+
import { g as generateDayAriaLabel, a as getDay, i as isBefore, b as isAfter, c as isSameDay, d as getPreviousMonth, e as getNextMonth, v as validateParts, f as getPartsFromCalendarDay, h as getNextYear, j as getPreviousYear, k as getEndOfWeek, l as getStartOfWeek, m as getPreviousDay, n as getNextDay, o as getPreviousWeek, p as getNextWeek, q as parseMinParts, r as parseMaxParts, s as parseDate, w as warnIfValueOutOfBounds, t as convertToArrayOfNumbers, u as convertDataToISO, x as getToday, y as getClosestValidDate, z as generateMonths, A as getNumDaysInMonth, B as getCombinedDateColumnData, C as getMonthColumnData, D as getDayColumnData, E as getYearColumnData, F as isMonthFirstLocale, G as getTimeColumnsData, H as isLocaleDayPeriodRTL, I as getMonthAndYear, J as getDaysOfWeek, K as getDaysOfMonth, L as getHourCycle, M as getLocalizedTime, N as getLocalizedDateTime, O as formatValue, P as clampDate, Q as parseAmPm, R as calculateHourFromAMPM } from './data.js';
|
|
13
13
|
import { d as defineCustomElement$c } from './backdrop.js';
|
|
14
14
|
import { d as defineCustomElement$b } from './button.js';
|
|
15
15
|
import { d as defineCustomElement$a } from './buttons.js';
|
|
@@ -189,6 +189,48 @@ const getHighlightStyles = (highlightedDates, dateIsoString, el) => {
|
|
|
189
189
|
return undefined;
|
|
190
190
|
};
|
|
191
191
|
|
|
192
|
+
/**
|
|
193
|
+
* If a time zone is provided in the format options, the rendered text could
|
|
194
|
+
* differ from what was selected in the Datetime, which could cause
|
|
195
|
+
* confusion.
|
|
196
|
+
*/
|
|
197
|
+
const warnIfTimeZoneProvided = (el, formatOptions) => {
|
|
198
|
+
var _a, _b, _c, _d;
|
|
199
|
+
if (((_a = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) === null || _a === void 0 ? void 0 : _a.timeZone) ||
|
|
200
|
+
((_b = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) === null || _b === void 0 ? void 0 : _b.timeZoneName) ||
|
|
201
|
+
((_c = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) === null || _c === void 0 ? void 0 : _c.timeZone) ||
|
|
202
|
+
((_d = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) === null || _d === void 0 ? void 0 : _d.timeZoneName)) {
|
|
203
|
+
printIonWarning('Datetime: "timeZone" and "timeZoneName" are not supported in "formatOptions".', el);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
const checkForPresentationFormatMismatch = (el, presentation, formatOptions) => {
|
|
207
|
+
// formatOptions is not required
|
|
208
|
+
if (!formatOptions)
|
|
209
|
+
return;
|
|
210
|
+
// If formatOptions is provided, the date and/or time objects are required, depending on the presentation
|
|
211
|
+
switch (presentation) {
|
|
212
|
+
case 'date':
|
|
213
|
+
case 'month-year':
|
|
214
|
+
case 'month':
|
|
215
|
+
case 'year':
|
|
216
|
+
if (formatOptions.date === undefined) {
|
|
217
|
+
printIonWarning(`Datetime: The '${presentation}' presentation requires a date object in formatOptions.`, el);
|
|
218
|
+
}
|
|
219
|
+
break;
|
|
220
|
+
case 'time':
|
|
221
|
+
if (formatOptions.time === undefined) {
|
|
222
|
+
printIonWarning(`Datetime: The 'time' presentation requires a time object in formatOptions.`, el);
|
|
223
|
+
}
|
|
224
|
+
break;
|
|
225
|
+
case 'date-time':
|
|
226
|
+
case 'time-date':
|
|
227
|
+
if (formatOptions.date === undefined && formatOptions.time === undefined) {
|
|
228
|
+
printIonWarning(`Datetime: The '${presentation}' presentation requires either a date or time object (or both) in formatOptions.`, el);
|
|
229
|
+
}
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
192
234
|
const datetimeIosCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;background:var(--background);overflow:hidden}ion-picker-column-internal{min-width:26px}:host(.datetime-size-fixed){width:auto;height:auto}:host(.datetime-size-fixed:not(.datetime-prefer-wheel)){max-width:350px}:host(.datetime-size-fixed.datetime-prefer-wheel){min-width:350px;max-width:-webkit-max-content;max-width:-moz-max-content;max-width:max-content}:host(.datetime-size-cover){width:100%}:host .calendar-body,:host .datetime-year{opacity:0}:host(:not(.datetime-ready)) .datetime-year{position:absolute;pointer-events:none}:host(.datetime-ready) .calendar-body{opacity:1}:host(.datetime-ready) .datetime-year{display:none;opacity:1}:host .wheel-order-year-first .day-column{-ms-flex-order:3;order:3;text-align:end}:host .wheel-order-year-first .month-column{-ms-flex-order:2;order:2;text-align:end}:host .wheel-order-year-first .year-column{-ms-flex-order:1;order:1;text-align:start}:host .datetime-calendar,:host .datetime-year{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-flow:column;flex-flow:column}:host(.show-month-and-year) .datetime-year{display:-ms-flexbox;display:flex}@supports (background: -webkit-named-image(apple-pay-logo-black)) and (not (aspect-ratio: 1/1)){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{position:absolute;visibility:hidden;pointer-events:none}@supports (inset-inline-start: 0){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{inset-inline-start:-99999px}}@supports not (inset-inline-start: 0){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{left:-99999px}:host-context([dir=rtl]):host(.show-month-and-year) .calendar-next-prev,:host-context([dir=rtl]).show-month-and-year .calendar-next-prev,:host-context([dir=rtl]):host(.show-month-and-year) .calendar-days-of-week,:host-context([dir=rtl]).show-month-and-year .calendar-days-of-week,:host-context([dir=rtl]):host(.show-month-and-year) .calendar-body,:host-context([dir=rtl]).show-month-and-year .calendar-body,:host-context([dir=rtl]):host(.show-month-and-year) .datetime-time,:host-context([dir=rtl]).show-month-and-year .datetime-time{left:unset;right:unset;right:-99999px}@supports selector(:dir(rtl)){:host(.show-month-and-year:dir(rtl)) .calendar-next-prev,:host(.show-month-and-year:dir(rtl)) .calendar-days-of-week,:host(.show-month-and-year:dir(rtl)) .calendar-body,:host(.show-month-and-year:dir(rtl)) .datetime-time{left:unset;right:unset;right:-99999px}}}}@supports (not (background: -webkit-named-image(apple-pay-logo-black))) or ((background: -webkit-named-image(apple-pay-logo-black)) and (aspect-ratio: 1/1)){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{display:none}}:host(.month-year-picker-open) .datetime-footer{display:none}:host(.datetime-disabled){pointer-events:none}:host(.datetime-disabled) .calendar-days-of-week,:host(.datetime-disabled) .datetime-time{opacity:0.4}:host(.datetime-readonly){pointer-events:none;}:host(.datetime-readonly) .calendar-action-buttons,:host(.datetime-readonly) .calendar-body,:host(.datetime-readonly) .datetime-year{pointer-events:initial}:host(.datetime-readonly) .calendar-day[disabled]:not(.calendar-day-constrained),:host(.datetime-readonly) .datetime-action-buttons ion-button[disabled]{opacity:1}:host .datetime-header .datetime-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host .datetime-action-buttons.has-clear-button{width:100%}:host .datetime-action-buttons ion-buttons{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}.datetime-action-buttons .datetime-action-buttons-container{display:-ms-flexbox;display:flex}:host .calendar-action-buttons{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .calendar-action-buttons ion-item,:host .calendar-action-buttons ion-button{--background:translucent}:host .calendar-action-buttons ion-item ion-label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;width:auto}:host .calendar-action-buttons ion-item ion-icon{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0;padding-top:0;padding-bottom:0}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}.calendar-days-of-week .day-of-week{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0}:host .calendar-body{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;outline:none}:host .calendar-body .calendar-month{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;scroll-snap-align:start;scroll-snap-stop:always;-ms-flex-negative:0;flex-shrink:0;width:100%}:host .calendar-body .calendar-month-disabled{scroll-snap-align:none}:host .calendar-body::-webkit-scrollbar{display:none}:host .calendar-body .calendar-month-grid{display:grid;grid-template-columns:repeat(7, 1fr)}:host .calendar-day-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:0;min-height:0;overflow:visible}.calendar-day{border-radius:50%;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:0px;padding-bottom:0px;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-top:0px;margin-bottom:0px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border:none;outline:none;background:none;color:currentColor;font-family:var(--ion-font-family, inherit);cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;z-index:0}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}.calendar-day:focus{background:rgba(var(--ion-color-base-rgb), 0.2);-webkit-box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2)}:host .datetime-time{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host(.datetime-presentation-time) .datetime-time{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}:host ion-popover{--height:200px}:host .time-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .time-body{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;display:-ms-flexbox;display:flex;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host .time-body-active{color:var(--ion-color-base)}:host(.in-item){position:static}:host(.show-month-and-year) .calendar-action-buttons ion-item{--color:var(--ion-color-base)}:host{--background:var(--ion-color-light, #ffffff);--background-rgb:var(--ion-color-light-rgb);--title-color:var(--ion-color-step-600, #666666)}:host(.datetime-presentation-date-time:not(.datetime-prefer-wheel)),:host(.datetime-presentation-time-date:not(.datetime-prefer-wheel)),:host(.datetime-presentation-date:not(.datetime-prefer-wheel)){min-height:350px}:host .datetime-header{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:16px;padding-bottom:16px;border-bottom:0.55px solid var(--ion-color-step-200, #cccccc);font-size:min(0.875rem, 22.4px)}:host .datetime-header .datetime-title{color:var(--title-color)}:host .datetime-header .datetime-selected-date{margin-top:10px}:host .calendar-action-buttons ion-item{--padding-start:16px;--background-hover:transparent;--background-activated:transparent;font-size:min(1rem, 25.6px);font-weight:600}:host .calendar-action-buttons ion-item ion-icon,:host .calendar-action-buttons ion-buttons ion-button{color:var(--ion-color-base)}:host .calendar-action-buttons ion-buttons{padding-left:0;padding-right:0;padding-top:8px;padding-bottom:0}:host .calendar-action-buttons ion-buttons ion-button{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}:host .calendar-days-of-week{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:0;padding-bottom:0;color:var(--ion-color-step-300, #b3b3b3);font-size:min(0.75rem, 19.2px);font-weight:600;line-height:24px;text-transform:uppercase}@supports (border-radius: mod(1px, 1px)){.calendar-days-of-week .day-of-week{width:clamp(20px, calc(mod(min(1rem, 24px), 24px) * 10), 100%);height:24px;overflow:hidden}.calendar-day{border-radius:max(8px, mod(min(1rem, 24px), 24px) * 10)}}@supports ((border-radius: mod(1px, 1px)) and (background: -webkit-named-image(apple-pay-logo-black)) and (not (contain-intrinsic-size: none))) or (not (border-radius: mod(1px, 1px))){.calendar-days-of-week .day-of-week{width:auto;height:auto;overflow:initial}.calendar-day{border-radius:32px}}:host .calendar-body .calendar-month .calendar-month-grid{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;-ms-flex-align:center;align-items:center;height:calc(100% - 16px)}:host .calendar-day-wrapper{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;height:0;min-height:1rem}:host .calendar-day{width:40px;min-width:40px;height:40px;font-size:min(1.25rem, 32px)}.calendar-day.calendar-day-active{background:rgba(var(--ion-color-base-rgb), 0.2)}:host .calendar-day.calendar-day-today{color:var(--ion-color-base)}:host .calendar-day.calendar-day-active{color:var(--ion-color-base);font-weight:600}:host .calendar-day.calendar-day-today.calendar-day-active{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host .datetime-time{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:8px;padding-bottom:16px;font-size:min(1rem, 25.6px)}:host .datetime-time .time-header{font-weight:600}:host .datetime-buttons{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;border-top:0.55px solid var(--ion-color-step-200, #cccccc)}:host .datetime-buttons ::slotted(ion-buttons),:host .datetime-buttons ion-buttons{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between}:host .datetime-action-buttons{width:100%}";
|
|
193
235
|
const IonDatetimeIosStyle0 = datetimeIosCss;
|
|
194
236
|
|
|
@@ -815,6 +857,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
815
857
|
this.color = 'primary';
|
|
816
858
|
this.name = this.inputId;
|
|
817
859
|
this.disabled = false;
|
|
860
|
+
this.formatOptions = undefined;
|
|
818
861
|
this.readonly = false;
|
|
819
862
|
this.isDateEnabled = undefined;
|
|
820
863
|
this.min = undefined;
|
|
@@ -842,6 +885,11 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
842
885
|
this.size = 'fixed';
|
|
843
886
|
this.preferWheel = false;
|
|
844
887
|
}
|
|
888
|
+
formatOptionsChanged() {
|
|
889
|
+
const { el, formatOptions, presentation } = this;
|
|
890
|
+
checkForPresentationFormatMismatch(el, presentation, formatOptions);
|
|
891
|
+
warnIfTimeZoneProvided(el, formatOptions);
|
|
892
|
+
}
|
|
845
893
|
disabledChanged() {
|
|
846
894
|
this.emitStyle();
|
|
847
895
|
}
|
|
@@ -851,6 +899,10 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
851
899
|
maxChanged() {
|
|
852
900
|
this.processMaxParts();
|
|
853
901
|
}
|
|
902
|
+
presentationChanged() {
|
|
903
|
+
const { el, formatOptions, presentation } = this;
|
|
904
|
+
checkForPresentationFormatMismatch(el, presentation, formatOptions);
|
|
905
|
+
}
|
|
854
906
|
get isGridStyle() {
|
|
855
907
|
const { presentation, preferWheel } = this;
|
|
856
908
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
@@ -1086,7 +1138,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1086
1138
|
});
|
|
1087
1139
|
}
|
|
1088
1140
|
componentWillLoad() {
|
|
1089
|
-
const { el, highlightedDates, multiple, presentation, preferWheel } = this;
|
|
1141
|
+
const { el, formatOptions, highlightedDates, multiple, presentation, preferWheel } = this;
|
|
1090
1142
|
if (multiple) {
|
|
1091
1143
|
if (presentation !== 'date') {
|
|
1092
1144
|
printIonWarning('Multiple date selection is only supported for presentation="date".', el);
|
|
@@ -1103,6 +1155,10 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1103
1155
|
printIonWarning('The highlightedDates property is not supported with preferWheel="true".', el);
|
|
1104
1156
|
}
|
|
1105
1157
|
}
|
|
1158
|
+
if (formatOptions) {
|
|
1159
|
+
checkForPresentationFormatMismatch(el, presentation, formatOptions);
|
|
1160
|
+
warnIfTimeZoneProvided(el, formatOptions);
|
|
1161
|
+
}
|
|
1106
1162
|
const hourValues = (this.parsedHourValues = convertToArrayOfNumbers(this.hourValues));
|
|
1107
1163
|
const minuteValues = (this.parsedMinuteValues = convertToArrayOfNumbers(this.minuteValues));
|
|
1108
1164
|
const monthValues = (this.parsedMonthValues = convertToArrayOfNumbers(this.monthValues));
|
|
@@ -1610,7 +1666,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1610
1666
|
return h("slot", { name: "time-label" }, "Time");
|
|
1611
1667
|
}
|
|
1612
1668
|
renderTimeOverlay() {
|
|
1613
|
-
const { disabled, hourCycle, isTimePopoverOpen, locale } = this;
|
|
1669
|
+
const { disabled, hourCycle, isTimePopoverOpen, locale, formatOptions } = this;
|
|
1614
1670
|
const computedHourCycle = getHourCycle(locale, hourCycle);
|
|
1615
1671
|
const activePart = this.getActivePartsWithFallback();
|
|
1616
1672
|
return [
|
|
@@ -1630,7 +1686,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1630
1686
|
await popoverRef.onWillDismiss();
|
|
1631
1687
|
this.isTimePopoverOpen = false;
|
|
1632
1688
|
}
|
|
1633
|
-
} }, getLocalizedTime(locale, activePart, computedHourCycle)),
|
|
1689
|
+
} }, getLocalizedTime(locale, activePart, computedHourCycle, formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time)),
|
|
1634
1690
|
h("ion-popover", { alignment: "center", translucent: true, overlayIndex: 1, arrow: false, onWillPresent: (ev) => {
|
|
1635
1691
|
/**
|
|
1636
1692
|
* Intersection Observers do not consistently fire between Blink and Webkit
|
|
@@ -1653,7 +1709,8 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1653
1709
|
];
|
|
1654
1710
|
}
|
|
1655
1711
|
getHeaderSelectedDateText() {
|
|
1656
|
-
|
|
1712
|
+
var _a;
|
|
1713
|
+
const { activeParts, formatOptions, multiple, titleSelectedDatesFormatter } = this;
|
|
1657
1714
|
const isArray = Array.isArray(activeParts);
|
|
1658
1715
|
let headerText;
|
|
1659
1716
|
if (multiple && isArray && activeParts.length !== 1) {
|
|
@@ -1669,7 +1726,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1669
1726
|
}
|
|
1670
1727
|
else {
|
|
1671
1728
|
// for exactly 1 day selected (multiple set or not), show a formatted version of that
|
|
1672
|
-
headerText =
|
|
1729
|
+
headerText = getLocalizedDateTime(this.locale, this.getActivePartsWithFallback(), (_a = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) !== null && _a !== void 0 ? _a : { weekday: 'short', month: 'short', day: 'numeric' });
|
|
1673
1730
|
}
|
|
1674
1731
|
return headerText;
|
|
1675
1732
|
}
|
|
@@ -1758,7 +1815,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1758
1815
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
1759
1816
|
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
1760
1817
|
renderHiddenInput(true, el, name, formatValue(value), disabled);
|
|
1761
|
-
return (h(Host, { key: '
|
|
1818
|
+
return (h(Host, { key: 'b12b07aebad0a686f93f70dbe29bd039b4c4104f', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
|
|
1762
1819
|
[mode]: true,
|
|
1763
1820
|
['datetime-readonly']: readonly,
|
|
1764
1821
|
['datetime-disabled']: disabled,
|
|
@@ -1772,9 +1829,11 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1772
1829
|
}
|
|
1773
1830
|
get el() { return this; }
|
|
1774
1831
|
static get watchers() { return {
|
|
1832
|
+
"formatOptions": ["formatOptionsChanged"],
|
|
1775
1833
|
"disabled": ["disabledChanged"],
|
|
1776
1834
|
"min": ["minChanged"],
|
|
1777
1835
|
"max": ["maxChanged"],
|
|
1836
|
+
"presentation": ["presentationChanged"],
|
|
1778
1837
|
"yearValues": ["yearValuesChanged"],
|
|
1779
1838
|
"monthValues": ["monthValuesChanged"],
|
|
1780
1839
|
"dayValues": ["dayValuesChanged"],
|
|
@@ -1790,6 +1849,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1790
1849
|
"color": [1],
|
|
1791
1850
|
"name": [1],
|
|
1792
1851
|
"disabled": [4],
|
|
1852
|
+
"formatOptions": [16],
|
|
1793
1853
|
"readonly": [4],
|
|
1794
1854
|
"isDateEnabled": [16],
|
|
1795
1855
|
"min": [1025],
|
|
@@ -1825,9 +1885,11 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1825
1885
|
"reset": [64],
|
|
1826
1886
|
"cancel": [64]
|
|
1827
1887
|
}, undefined, {
|
|
1888
|
+
"formatOptions": ["formatOptionsChanged"],
|
|
1828
1889
|
"disabled": ["disabledChanged"],
|
|
1829
1890
|
"min": ["minChanged"],
|
|
1830
1891
|
"max": ["maxChanged"],
|
|
1892
|
+
"presentation": ["presentationChanged"],
|
|
1831
1893
|
"yearValues": ["yearValuesChanged"],
|
|
1832
1894
|
"monthValues": ["monthValuesChanged"],
|
|
1833
1895
|
"dayValues": ["dayValuesChanged"],
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h, Host } from '@stencil/core/internal/client';
|
|
5
|
-
import { n as debounceEvent, c as componentOnReady, r as raf } from './helpers.js';
|
|
5
|
+
import { n as debounceEvent, d as inheritAttributes, c as componentOnReady, r as raf } from './helpers.js';
|
|
6
6
|
import { i as isRTL } from './dir.js';
|
|
7
7
|
import { c as createColorClasses } from './theme.js';
|
|
8
8
|
import { b as arrowBackSharp, j as closeCircle, k as closeSharp, s as searchOutline, q as searchSharp } from './index7.js';
|
|
@@ -29,6 +29,7 @@ const Searchbar = /*@__PURE__*/ proxyCustomElement(class Searchbar extends HTMLE
|
|
|
29
29
|
this.isCancelVisible = false;
|
|
30
30
|
this.shouldAlignLeft = true;
|
|
31
31
|
this.inputId = `ion-searchbar-${searchbarIds++}`;
|
|
32
|
+
this.inheritedAttributes = {};
|
|
32
33
|
/**
|
|
33
34
|
* Clears the input field and triggers the control change.
|
|
34
35
|
*/
|
|
@@ -129,6 +130,7 @@ const Searchbar = /*@__PURE__*/ proxyCustomElement(class Searchbar extends HTMLE
|
|
|
129
130
|
this.noAnimate = true;
|
|
130
131
|
this.color = undefined;
|
|
131
132
|
this.animated = false;
|
|
133
|
+
this.autocapitalize = undefined;
|
|
132
134
|
this.autocomplete = 'off';
|
|
133
135
|
this.autocorrect = 'off';
|
|
134
136
|
this.cancelButtonIcon = config.get('backButtonIcon', arrowBackSharp);
|
|
@@ -138,6 +140,8 @@ const Searchbar = /*@__PURE__*/ proxyCustomElement(class Searchbar extends HTMLE
|
|
|
138
140
|
this.disabled = false;
|
|
139
141
|
this.inputmode = undefined;
|
|
140
142
|
this.enterkeyhint = undefined;
|
|
143
|
+
this.maxlength = undefined;
|
|
144
|
+
this.minlength = undefined;
|
|
141
145
|
this.name = this.inputId;
|
|
142
146
|
this.placeholder = 'Search';
|
|
143
147
|
this.searchIcon = undefined;
|
|
@@ -147,6 +151,21 @@ const Searchbar = /*@__PURE__*/ proxyCustomElement(class Searchbar extends HTMLE
|
|
|
147
151
|
this.type = 'search';
|
|
148
152
|
this.value = '';
|
|
149
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* lang and dir are globally enumerated attributes.
|
|
156
|
+
* As a result, creating these as properties
|
|
157
|
+
* can have unintended side effects. Instead, we
|
|
158
|
+
* listen for attribute changes and inherit them
|
|
159
|
+
* to the inner `<input>` element.
|
|
160
|
+
*/
|
|
161
|
+
onLangChanged(newValue) {
|
|
162
|
+
this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { lang: newValue });
|
|
163
|
+
forceUpdate(this);
|
|
164
|
+
}
|
|
165
|
+
onDirChanged(newValue) {
|
|
166
|
+
this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { dir: newValue });
|
|
167
|
+
forceUpdate(this);
|
|
168
|
+
}
|
|
150
169
|
debounceChanged() {
|
|
151
170
|
const { ionInput, debounce, originalIonInput } = this;
|
|
152
171
|
/**
|
|
@@ -171,6 +190,9 @@ const Searchbar = /*@__PURE__*/ proxyCustomElement(class Searchbar extends HTMLE
|
|
|
171
190
|
connectedCallback() {
|
|
172
191
|
this.emitStyle();
|
|
173
192
|
}
|
|
193
|
+
componentWillLoad() {
|
|
194
|
+
this.inheritedAttributes = Object.assign({}, inheritAttributes(this.el, ['lang', 'dir']));
|
|
195
|
+
}
|
|
174
196
|
componentDidLoad() {
|
|
175
197
|
this.originalIonInput = this.ionInput;
|
|
176
198
|
this.positionElements();
|
|
@@ -369,8 +391,8 @@ const Searchbar = /*@__PURE__*/ proxyCustomElement(class Searchbar extends HTMLE
|
|
|
369
391
|
const clearIcon = this.clearIcon || (mode === 'ios' ? closeCircle : closeSharp);
|
|
370
392
|
const searchIcon = this.searchIcon || (mode === 'ios' ? searchOutline : searchSharp);
|
|
371
393
|
const shouldShowCancelButton = this.shouldShowCancelButton();
|
|
372
|
-
const cancelButton = this.showCancelButton !== 'never' && (h("button", { key: '
|
|
373
|
-
return (h(Host, { key: '
|
|
394
|
+
const cancelButton = this.showCancelButton !== 'never' && (h("button", { key: '1a68689b5c14cde6e071c4095457146b9ac2e7ab', "aria-label": cancelButtonText, "aria-hidden": shouldShowCancelButton ? undefined : 'true', type: "button", tabIndex: mode === 'ios' && !shouldShowCancelButton ? -1 : undefined, onMouseDown: this.onCancelSearchbar, onTouchStart: this.onCancelSearchbar, class: "searchbar-cancel-button" }, h("div", { key: '25ae47914baa4b7e0281efb2b296d1799a56c764', "aria-hidden": "true" }, mode === 'md' ? (h("ion-icon", { "aria-hidden": "true", mode: mode, icon: this.cancelButtonIcon, lazy: false })) : (cancelButtonText))));
|
|
395
|
+
return (h(Host, { key: '2cf545c40874bc4a19b6af022f5ec41b3a913495', role: "search", "aria-disabled": this.disabled ? 'true' : null, class: createColorClasses(this.color, {
|
|
374
396
|
[mode]: true,
|
|
375
397
|
'searchbar-animated': animated,
|
|
376
398
|
'searchbar-disabled': this.disabled,
|
|
@@ -380,17 +402,19 @@ const Searchbar = /*@__PURE__*/ proxyCustomElement(class Searchbar extends HTMLE
|
|
|
380
402
|
'searchbar-has-focus': this.focused,
|
|
381
403
|
'searchbar-should-show-clear': this.shouldShowClearButton(),
|
|
382
404
|
'searchbar-should-show-cancel': this.shouldShowCancelButton(),
|
|
383
|
-
}) }, h("div", { key: '
|
|
405
|
+
}) }, h("div", { key: '9cf49297278839bbe6e2ef9936de337daa53c08d', class: "searchbar-input-container" }, h("input", Object.assign({ key: 'bae5db413a302e116012251746d599030f7158ce', "aria-label": "search text", disabled: this.disabled, ref: (el) => (this.nativeInput = el), class: "searchbar-input", inputMode: this.inputmode, enterKeyHint: this.enterkeyhint, name: this.name, onInput: this.onInput, onChange: this.onChange, onBlur: this.onBlur, onFocus: this.onFocus, minLength: this.minlength, maxLength: this.maxlength, placeholder: this.placeholder, type: this.type, value: this.getValue(), autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, spellcheck: this.spellcheck }, this.inheritedAttributes)), mode === 'md' && cancelButton, h("ion-icon", { key: '67c593ca842551d9e99e8239115cc7b43261b542', "aria-hidden": "true", mode: mode, icon: searchIcon, lazy: false, class: "searchbar-search-icon" }), h("button", { key: '6901c3f6c74cce2d3b7e46fbff85ee6e6399bdb1', "aria-label": "reset", type: "button", "no-blur": true, class: "searchbar-clear-button", onPointerDown: (ev) => {
|
|
384
406
|
/**
|
|
385
407
|
* This prevents mobile browsers from
|
|
386
408
|
* blurring the input when the clear
|
|
387
409
|
* button is activated.
|
|
388
410
|
*/
|
|
389
411
|
ev.preventDefault();
|
|
390
|
-
}, onClick: () => this.onClearInput(true) }, h("ion-icon", { key: '
|
|
412
|
+
}, onClick: () => this.onClearInput(true) }, h("ion-icon", { key: 'abd45fb79ee807cf8352aa7bf5b0342f2d686227', "aria-hidden": "true", mode: mode, icon: clearIcon, lazy: false, class: "searchbar-clear-icon" }))), mode === 'ios' && cancelButton));
|
|
391
413
|
}
|
|
392
414
|
get el() { return this; }
|
|
393
415
|
static get watchers() { return {
|
|
416
|
+
"lang": ["onLangChanged"],
|
|
417
|
+
"dir": ["onDirChanged"],
|
|
394
418
|
"debounce": ["debounceChanged"],
|
|
395
419
|
"value": ["valueChanged"],
|
|
396
420
|
"showCancelButton": ["showCancelButtonChanged"]
|
|
@@ -402,6 +426,7 @@ const Searchbar = /*@__PURE__*/ proxyCustomElement(class Searchbar extends HTMLE
|
|
|
402
426
|
}, [34, "ion-searchbar", {
|
|
403
427
|
"color": [513],
|
|
404
428
|
"animated": [4],
|
|
429
|
+
"autocapitalize": [1],
|
|
405
430
|
"autocomplete": [1],
|
|
406
431
|
"autocorrect": [1],
|
|
407
432
|
"cancelButtonIcon": [1, "cancel-button-icon"],
|
|
@@ -411,6 +436,8 @@ const Searchbar = /*@__PURE__*/ proxyCustomElement(class Searchbar extends HTMLE
|
|
|
411
436
|
"disabled": [4],
|
|
412
437
|
"inputmode": [1],
|
|
413
438
|
"enterkeyhint": [1],
|
|
439
|
+
"maxlength": [2],
|
|
440
|
+
"minlength": [2],
|
|
414
441
|
"name": [1],
|
|
415
442
|
"placeholder": [1],
|
|
416
443
|
"searchIcon": [1, "search-icon"],
|
|
@@ -424,6 +451,8 @@ const Searchbar = /*@__PURE__*/ proxyCustomElement(class Searchbar extends HTMLE
|
|
|
424
451
|
"setFocus": [64],
|
|
425
452
|
"getInputElement": [64]
|
|
426
453
|
}, undefined, {
|
|
454
|
+
"lang": ["onLangChanged"],
|
|
455
|
+
"dir": ["onDirChanged"],
|
|
427
456
|
"debounce": ["debounceChanged"],
|
|
428
457
|
"value": ["valueChanged"],
|
|
429
458
|
"showCancelButton": ["showCancelButtonChanged"]
|
|
@@ -834,7 +834,25 @@ const getFormattedDayPeriod = (dayPeriod) => {
|
|
|
834
834
|
}
|
|
835
835
|
return dayPeriod.toUpperCase();
|
|
836
836
|
};
|
|
837
|
-
|
|
837
|
+
/**
|
|
838
|
+
* Including time zone options may lead to the rendered text showing a
|
|
839
|
+
* different time from what was selected in the Datetime, which could cause
|
|
840
|
+
* confusion.
|
|
841
|
+
*/
|
|
842
|
+
const stripTimeZone = (formatOptions) => {
|
|
843
|
+
return Object.assign(Object.assign({}, formatOptions), {
|
|
844
|
+
/**
|
|
845
|
+
* Setting the time zone to UTC ensures that the value shown is always the
|
|
846
|
+
* same as what was selected and safeguards against older Safari bugs with
|
|
847
|
+
* Intl.DateTimeFormat.
|
|
848
|
+
*/
|
|
849
|
+
timeZone: 'UTC',
|
|
850
|
+
/**
|
|
851
|
+
* We do not want to display the time zone name
|
|
852
|
+
*/
|
|
853
|
+
timeZoneName: undefined });
|
|
854
|
+
};
|
|
855
|
+
const getLocalizedTime = (locale, refParts, hourCycle, formatOptions = { hour: 'numeric', minute: 'numeric' }) => {
|
|
838
856
|
const timeParts = {
|
|
839
857
|
hour: refParts.hour,
|
|
840
858
|
minute: refParts.minute,
|
|
@@ -842,28 +860,12 @@ const getLocalizedTime = (locale, refParts, hourCycle) => {
|
|
|
842
860
|
if (timeParts.hour === undefined || timeParts.minute === undefined) {
|
|
843
861
|
return 'Invalid Time';
|
|
844
862
|
}
|
|
845
|
-
return new Intl.DateTimeFormat(locale, {
|
|
846
|
-
hour: 'numeric',
|
|
847
|
-
minute: 'numeric',
|
|
848
|
-
/**
|
|
849
|
-
* Setting the timeZone to UTC prevents
|
|
850
|
-
* new Intl.DatetimeFormat from subtracting
|
|
851
|
-
* the user's current timezone offset
|
|
852
|
-
* when formatting the time.
|
|
853
|
-
*/
|
|
854
|
-
timeZone: 'UTC',
|
|
863
|
+
return new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, stripTimeZone(formatOptions)), {
|
|
855
864
|
/**
|
|
856
865
|
* We use hourCycle here instead of hour12 due to:
|
|
857
866
|
* https://bugs.chromium.org/p/chromium/issues/detail?id=1347316&q=hour12&can=2
|
|
858
867
|
*/
|
|
859
|
-
hourCycle
|
|
860
|
-
/**
|
|
861
|
-
* Setting Z at the end indicates that this
|
|
862
|
-
* date string is in the UTC time zone. This
|
|
863
|
-
* prevents new Date from adding the time zone
|
|
864
|
-
* offset when getting the ISO string.
|
|
865
|
-
*/
|
|
866
|
-
}).format(new Date(convertDataToISO(Object.assign({
|
|
868
|
+
hourCycle })).format(new Date(convertDataToISO(Object.assign({
|
|
867
869
|
/**
|
|
868
870
|
* JS uses a simplified ISO 8601 format which allows for
|
|
869
871
|
* date-only formats and date-time formats, but not
|
|
@@ -949,14 +951,6 @@ const generateDayAriaLabel = (locale, today, refParts) => {
|
|
|
949
951
|
*/
|
|
950
952
|
return today ? `Today, ${labelString}` : labelString;
|
|
951
953
|
};
|
|
952
|
-
/**
|
|
953
|
-
* Gets the day of the week, month, and day
|
|
954
|
-
* Used for the header in MD mode.
|
|
955
|
-
*/
|
|
956
|
-
const getMonthAndDay = (locale, refParts) => {
|
|
957
|
-
const date = getNormalizedDate(refParts);
|
|
958
|
-
return new Intl.DateTimeFormat(locale, { weekday: 'short', month: 'short', day: 'numeric', timeZone: 'UTC' }).format(date);
|
|
959
|
-
};
|
|
960
954
|
/**
|
|
961
955
|
* Given a locale and a date object,
|
|
962
956
|
* return a formatted string that includes
|
|
@@ -967,15 +961,6 @@ const getMonthAndYear = (locale, refParts) => {
|
|
|
967
961
|
const date = getNormalizedDate(refParts);
|
|
968
962
|
return new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric', timeZone: 'UTC' }).format(date);
|
|
969
963
|
};
|
|
970
|
-
/**
|
|
971
|
-
* Given a locale and a date object,
|
|
972
|
-
* return a formatted string that includes
|
|
973
|
-
* the short month, numeric day, and full year.
|
|
974
|
-
* Example: Apr 22, 2021
|
|
975
|
-
*/
|
|
976
|
-
const getMonthDayAndYear = (locale, refParts) => {
|
|
977
|
-
return getLocalizedDateTime(locale, refParts, { month: 'short', day: 'numeric', year: 'numeric' });
|
|
978
|
-
};
|
|
979
964
|
/**
|
|
980
965
|
* Given a locale and a date object,
|
|
981
966
|
* return a formatted string that includes
|
|
@@ -1025,7 +1010,7 @@ const getNormalizedDate = (refParts) => {
|
|
|
1025
1010
|
*/
|
|
1026
1011
|
const getLocalizedDateTime = (locale, refParts, options) => {
|
|
1027
1012
|
const date = getNormalizedDate(refParts);
|
|
1028
|
-
return getDateTimeFormat(locale, options).format(date);
|
|
1013
|
+
return getDateTimeFormat(locale, stripTimeZone(options)).format(date);
|
|
1029
1014
|
};
|
|
1030
1015
|
/**
|
|
1031
1016
|
* Given a locale, DatetimeParts, and options
|
|
@@ -1641,10 +1626,8 @@ exports.getEndOfWeek = getEndOfWeek;
|
|
|
1641
1626
|
exports.getHourCycle = getHourCycle;
|
|
1642
1627
|
exports.getLocalizedDateTime = getLocalizedDateTime;
|
|
1643
1628
|
exports.getLocalizedTime = getLocalizedTime;
|
|
1644
|
-
exports.getMonthAndDay = getMonthAndDay;
|
|
1645
1629
|
exports.getMonthAndYear = getMonthAndYear;
|
|
1646
1630
|
exports.getMonthColumnData = getMonthColumnData;
|
|
1647
|
-
exports.getMonthDayAndYear = getMonthDayAndYear;
|
|
1648
1631
|
exports.getNextDay = getNextDay;
|
|
1649
1632
|
exports.getNextMonth = getNextMonth;
|
|
1650
1633
|
exports.getNextWeek = getNextWeek;
|