@commmerce/ui 1.14.0 → 1.16.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.
@@ -41,14 +41,30 @@ declare const strings: {
41
41
  last90Days: string;
42
42
  thisMonth: string;
43
43
  lastMonth: string;
44
+ thisWeek: string;
45
+ lastWeek: string;
46
+ last28Days: string;
47
+ last12Months: string;
48
+ thisYear: string;
49
+ lastYear: string;
50
+ /** The preset that lets people pick their own dates in the calendar. */
51
+ custom: string;
52
+ /** With `confirm`: the footer buttons, and the footer line while the range is not complete. */
53
+ apply: string;
54
+ cancel: string;
55
+ noRange: string;
44
56
  };
45
57
  declare module '../localize.js' {
46
58
  interface CmStrings {
47
59
  dateRangePicker: typeof strings;
48
60
  }
49
61
  }
50
- /** Built-in preset ranges. Each ends today except `yesterday` and `last-month`. */
51
- export type DateRangePresetKey = 'today' | 'yesterday' | 'last-7-days' | 'last-30-days' | 'last-90-days' | 'this-month' | 'last-month';
62
+ /**
63
+ * Built-in preset ranges. Each ends today except `yesterday`, `last-week`, `last-month` and `last-year`, which are the
64
+ * whole previous day, week, month or year. Weeks start on the picker's first day of the week. `custom` is not a range:
65
+ * it is the "Custom" button that leaves the dates to the calendar (since 1.16).
66
+ */
67
+ export type DateRangePresetKey = 'today' | 'yesterday' | 'this-week' | 'last-week' | 'last-7-days' | 'last-28-days' | 'last-30-days' | 'last-90-days' | 'last-12-months' | 'this-month' | 'last-month' | 'this-year' | 'last-year' | 'custom';
52
68
  /** A custom preset: a label and ISO start and end dates. */
53
69
  export interface DateRangePreset {
54
70
  label: string;
@@ -56,21 +72,26 @@ export interface DateRangePreset {
56
72
  end: string;
57
73
  }
58
74
  /**
59
- * Resolves a preset key or object to a label and ISO dates (relative to today). Unknown keys return null.
75
+ * Resolves a preset key or object to a label and ISO dates (relative to today). Unknown keys and `custom` return null.
60
76
  * `label` translates a key's label (it gets the key in camelCase, e.g. `last7Days`); English otherwise.
77
+ * `firstDayOfWeek` (0 Sunday … 6 Saturday, default 0) sets where `this-week` and `last-week` start.
61
78
  */
62
- export declare function resolvePreset(p: DateRangePresetKey | DateRangePreset, today?: Date, label?: (key: string) => string): DateRangePreset | null;
79
+ export declare function resolvePreset(p: DateRangePresetKey | DateRangePreset, today?: Date, label?: (key: string) => string, firstDayOfWeek?: number): DateRangePreset | null;
63
80
  /**
64
81
  * Date range field for report and order filters: type a start and end date or pick them in a calendar, or choose
65
82
  * a preset range such as "Last 7 days". The calendar is the same APG date picker grid as `cm-date-picker`: the first
66
83
  * date picked is the start, the second the end. Participates in native forms: submits `<name>-start` and
67
84
  * `<name>-end` (or `start-name` / `end-name`) as ISO `yyyy-mm-dd`.
85
+ *
86
+ * For reports (since 1.16), like an analytics date picker: add `custom` to `presets`, `months="2"` to show two months
87
+ * side by side, and `confirm` so presets and dates are only a draft until Apply.
68
88
  * @element cm-date-range-picker
69
89
  * @fires change - When the range changes: both dates picked, a preset chosen, or a typed date committed.
70
90
  * @fires input - Same moment as `change`.
71
91
  * @csspart box - The bordered box around the two inputs and the calendar button.
72
92
  * @csspart calendar - The month grid.
73
93
  * @csspart presets - The list of preset ranges.
94
+ * @csspart footer - With `confirm`: the line with the draft range and the Cancel and Apply buttons.
74
95
  */
75
96
  export declare class CmDateRangePicker extends CmLocalizedElement {
76
97
  #private;
@@ -125,6 +146,17 @@ export declare class CmDateRangePicker extends CmLocalizedElement {
125
146
  toAttribute: (v: unknown) => unknown;
126
147
  };
127
148
  };
149
+ preset: {
150
+ reflect: boolean;
151
+ };
152
+ months: {
153
+ type: NumberConstructor;
154
+ reflect: boolean;
155
+ };
156
+ confirm: {
157
+ type: BooleanConstructor;
158
+ reflect: boolean;
159
+ };
128
160
  startLabel: {
129
161
  attribute: string;
130
162
  string: string;
@@ -166,6 +198,12 @@ export declare class CmDateRangePicker extends CmLocalizedElement {
166
198
  _hover: {
167
199
  state: boolean;
168
200
  };
201
+ _view: {
202
+ state: boolean;
203
+ };
204
+ _draftPreset: {
205
+ state: boolean;
206
+ };
169
207
  };
170
208
  /** Visible label above the box, e.g. "Order date". Required for accessibility unless the element has an aria-label. */
171
209
  label: string;
@@ -204,6 +242,19 @@ export declare class CmDateRangePicker extends CmLocalizedElement {
204
242
  * `this-month`, `last-month`) or `{ label, start, end }` objects. In HTML, a space-separated list of keys.
205
243
  */
206
244
  presets: Array<DateRangePresetKey | DateRangePreset>;
245
+ /**
246
+ * Key of the preset the range came from (`last-7-days`), or empty for dates picked or typed. Set it to a key to
247
+ * choose that range relative to today, e.g. a report that opens on "Last 28 days"; the picker keeps it up to date
248
+ * when people change the range. The key need not be in `presets`.
249
+ */
250
+ preset: string;
251
+ /** Months shown side by side in the calendar: 1 (default) or 2. Phones (640px or narrower) always show one. */
252
+ months: number;
253
+ /**
254
+ * Presets and dates picked in the calendar are a draft until Apply; Cancel, Escape or a click outside drop it.
255
+ * Without it, choosing a preset or the end date changes the range at once.
256
+ */
257
+ confirm: boolean;
207
258
  /** Accessible name of the start input. Default: the built-in string `start` ("Start date"). */
208
259
  startLabel: string;
209
260
  /** Accessible name of the end input. Default: the built-in string `end` ("End date"). */
@@ -222,6 +273,10 @@ export declare class CmDateRangePicker extends CmLocalizedElement {
222
273
  _draftStart: string;
223
274
  _draftEnd: string;
224
275
  _hover: Date | null;
276
+ /** First month shown. */
277
+ _view: Date;
278
+ /** With `confirm`: the preset key of the draft range. */
279
+ _draftPreset: string;
225
280
  static styles: import("lit").CSSResult[];
226
281
  connectedCallback(): void;
227
282
  disconnectedCallback(): void;
@@ -9,7 +9,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
10
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
11
  };
12
- var _CmDateRangePicker_instances, _CmDateRangePicker_localeProp, _CmDateRangePicker_internals, _CmDateRangePicker_v, _CmDateRangePicker_id, _CmDateRangePicker_default, _CmDateRangePicker_keepText, _CmDateRangePicker_focusGrid, _CmDateRangePicker_locale_get, _CmDateRangePicker_fmt_get, _CmDateRangePicker_firstDay_get, _CmDateRangePicker_picking, _CmDateRangePicker_pattern_get, _CmDateRangePicker_format, _CmDateRangePicker_layer, _CmDateRangePicker_emit, _CmDateRangePicker_setRange, _CmDateRangePicker_commitText, _CmDateRangePicker_pick, _CmDateRangePicker_applyPreset, _CmDateRangePicker_focusTrigger, _CmDateRangePicker_toggle, _CmDateRangePicker_onInputKey, _CmDateRangePicker_onGridKey, _CmDateRangePicker_onPopKey, _CmDateRangePicker_onOutside, _CmDateRangePicker_mark;
12
+ var _CmDateRangePicker_instances, _CmDateRangePicker_localeProp, _CmDateRangePicker_internals, _CmDateRangePicker_v, _CmDateRangePicker_id, _CmDateRangePicker_default, _CmDateRangePicker_ownPreset, _CmDateRangePicker_custom, _CmDateRangePicker_keepText, _CmDateRangePicker_focusGrid, _CmDateRangePicker_locale_get, _CmDateRangePicker_fmt_get, _CmDateRangePicker_firstDay_get, _CmDateRangePicker_monthCount_get, _CmDateRangePicker_show, _CmDateRangePicker_listed_get, _CmDateRangePicker_hasCustom_get, _CmDateRangePicker_picking, _CmDateRangePicker_pattern_get, _CmDateRangePicker_format, _CmDateRangePicker_layer, _CmDateRangePicker_emit, _CmDateRangePicker_setRange, _CmDateRangePicker_commitText, _CmDateRangePicker_pick, _CmDateRangePicker_applyPreset, _CmDateRangePicker_pickCustom, _CmDateRangePicker_apply, _CmDateRangePicker_cancel, _CmDateRangePicker_focusTrigger, _CmDateRangePicker_toggle, _CmDateRangePicker_onInputKey, _CmDateRangePicker_onGridKey, _CmDateRangePicker_onPopKey, _CmDateRangePicker_onOutside, _CmDateRangePicker_mark;
13
13
  import { LitElement, html, css, nothing } from 'lit';
14
14
  import { live } from 'lit/directives/live.js';
15
15
  import { base, define, nextId, logicalKey } from '../base.js';
@@ -58,29 +58,49 @@ const strings = defineStrings('dateRangePicker', {
58
58
  last90Days: 'Last 90 days',
59
59
  thisMonth: 'This month',
60
60
  lastMonth: 'Last month',
61
+ thisWeek: 'This week',
62
+ lastWeek: 'Last week',
63
+ last28Days: 'Last 28 days',
64
+ last12Months: 'Last 12 months',
65
+ thisYear: 'This year',
66
+ lastYear: 'Last year',
67
+ /** The preset that lets people pick their own dates in the calendar. */
68
+ custom: 'Custom',
69
+ /** With `confirm`: the footer buttons, and the footer line while the range is not complete. */
70
+ apply: 'Apply',
71
+ cancel: 'Cancel',
72
+ noRange: 'No dates chosen',
61
73
  });
74
+ const weekStart = (t, firstDay) => addDays(t, -((t.getDay() - firstDay + 7) % 7));
62
75
  const PRESETS = {
63
76
  'today': ['Today', (t) => [t, t]],
64
77
  'yesterday': ['Yesterday', (t) => [addDays(t, -1), addDays(t, -1)]],
78
+ 'this-week': ['This week', (t, f) => [weekStart(t, f), t]],
79
+ 'last-week': ['Last week', (t, f) => [addDays(weekStart(t, f), -7), addDays(weekStart(t, f), -1)]],
65
80
  'last-7-days': ['Last 7 days', (t) => [addDays(t, -6), t]],
81
+ 'last-28-days': ['Last 28 days', (t) => [addDays(t, -27), t]],
66
82
  'last-30-days': ['Last 30 days', (t) => [addDays(t, -29), t]],
67
83
  'last-90-days': ['Last 90 days', (t) => [addDays(t, -89), t]],
84
+ 'last-12-months': ['Last 12 months', (t) => [addDays(addMonths(t, -12), 1), t]],
68
85
  'this-month': ['This month', (t) => [startOfMonth(t), t]],
69
86
  'last-month': ['Last month', (t) => [startOfMonth(addMonths(t, -1)), endOfMonth(addMonths(t, -1))]],
87
+ 'this-year': ['This year', (t) => [new Date(t.getFullYear(), 0, 1), t]],
88
+ 'last-year': ['Last year', (t) => [new Date(t.getFullYear() - 1, 0, 1), new Date(t.getFullYear() - 1, 11, 31)]],
70
89
  };
71
90
  const presetKey = (k) => k.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
72
91
  /**
73
- * Resolves a preset key or object to a label and ISO dates (relative to today). Unknown keys return null.
92
+ * Resolves a preset key or object to a label and ISO dates (relative to today). Unknown keys and `custom` return null.
74
93
  * `label` translates a key's label (it gets the key in camelCase, e.g. `last7Days`); English otherwise.
94
+ * `firstDayOfWeek` (0 Sunday … 6 Saturday, default 0) sets where `this-week` and `last-week` start.
75
95
  */
76
- export function resolvePreset(p, today = new Date(), label) {
96
+ export function resolvePreset(p, today = new Date(), label, firstDayOfWeek = 0) {
77
97
  if (typeof p === 'object' && p)
78
98
  return p;
79
99
  const def = PRESETS[p];
80
- if (!def)
100
+ if (!def || !Object.prototype.hasOwnProperty.call(PRESETS, p))
81
101
  return null;
82
102
  const t = new Date(today.getFullYear(), today.getMonth(), today.getDate());
83
- const [s, e] = def[1](t);
103
+ const [s, e] = def[1](t, firstDayOfWeek);
84
104
  return { label: label?.(presetKey(p)) || def[0], start: toISO(s), end: toISO(e) };
85
105
  }
86
106
  /**
@@ -88,12 +108,16 @@ export function resolvePreset(p, today = new Date(), label) {
88
108
  * a preset range such as "Last 7 days". The calendar is the same APG date picker grid as `cm-date-picker`: the first
89
109
  * date picked is the start, the second the end. Participates in native forms: submits `<name>-start` and
90
110
  * `<name>-end` (or `start-name` / `end-name`) as ISO `yyyy-mm-dd`.
111
+ *
112
+ * For reports (since 1.16), like an analytics date picker: add `custom` to `presets`, `months="2"` to show two months
113
+ * side by side, and `confirm` so presets and dates are only a draft until Apply.
91
114
  * @element cm-date-range-picker
92
115
  * @fires change - When the range changes: both dates picked, a preset chosen, or a typed date committed.
93
116
  * @fires input - Same moment as `change`.
94
117
  * @csspart box - The bordered box around the two inputs and the calendar button.
95
118
  * @csspart calendar - The month grid.
96
119
  * @csspart presets - The list of preset ranges.
120
+ * @csspart footer - With `confirm`: the line with the draft range and the Cancel and Apply buttons.
97
121
  */
98
122
  export class CmDateRangePicker extends CmLocalizedElement {
99
123
  constructor() {
@@ -127,6 +151,19 @@ export class CmDateRangePicker extends CmLocalizedElement {
127
151
  * `this-month`, `last-month`) or `{ label, start, end }` objects. In HTML, a space-separated list of keys.
128
152
  */
129
153
  this.presets = [];
154
+ /**
155
+ * Key of the preset the range came from (`last-7-days`), or empty for dates picked or typed. Set it to a key to
156
+ * choose that range relative to today, e.g. a report that opens on "Last 28 days"; the picker keeps it up to date
157
+ * when people change the range. The key need not be in `presets`.
158
+ */
159
+ this.preset = '';
160
+ /** Months shown side by side in the calendar: 1 (default) or 2. Phones (640px or narrower) always show one. */
161
+ this.months = 1;
162
+ /**
163
+ * Presets and dates picked in the calendar are a draft until Apply; Cancel, Escape or a click outside drop it.
164
+ * Without it, choosing a preset or the end date changes the range at once.
165
+ */
166
+ this.confirm = false;
130
167
  /** The form will not submit until both dates are set. */
131
168
  this.required = false;
132
169
  /** Blocks interaction. Also set by a disabled `<fieldset>`. */
@@ -141,10 +178,18 @@ export class CmDateRangePicker extends CmLocalizedElement {
141
178
  this._draftStart = '';
142
179
  this._draftEnd = '';
143
180
  this._hover = null;
181
+ /** First month shown. */
182
+ this._view = startOfMonth(new Date());
183
+ /** With `confirm`: the preset key of the draft range. */
184
+ this._draftPreset = '';
144
185
  _CmDateRangePicker_internals.set(this, this.attachInternals());
145
186
  _CmDateRangePicker_v.set(this, new FieldValidity(this, __classPrivateFieldGet(this, _CmDateRangePicker_internals, "f")));
146
187
  _CmDateRangePicker_id.set(this, nextId('cm-drp'));
147
188
  _CmDateRangePicker_default.set(this, null);
189
+ /** The preset key was set by the picker itself (not by the app), so it must not move the range. */
190
+ _CmDateRangePicker_ownPreset.set(this, false);
191
+ /** "Custom" was pressed in the open calendar. */
192
+ _CmDateRangePicker_custom.set(this, false);
148
193
  _CmDateRangePicker_keepText.set(this, false);
149
194
  _CmDateRangePicker_focusGrid.set(this, false);
150
195
  _CmDateRangePicker_picking.set(this, 'start');
@@ -178,6 +223,7 @@ export class CmDateRangePicker extends CmLocalizedElement {
178
223
  if (next) {
179
224
  e.preventDefault();
180
225
  this._focus = clamp(next, fromISO(this.min), fromISO(this.max));
226
+ __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_show).call(this, this._focus);
181
227
  __classPrivateFieldSet(this, _CmDateRangePicker_focusGrid, true, "f");
182
228
  return;
183
229
  }
@@ -210,7 +256,7 @@ export class CmDateRangePicker extends CmLocalizedElement {
210
256
  connectedCallback() {
211
257
  super.connectedCallback();
212
258
  if (!__classPrivateFieldGet(this, _CmDateRangePicker_default, "f"))
213
- __classPrivateFieldSet(this, _CmDateRangePicker_default, [this.start, this.end], "f");
259
+ __classPrivateFieldSet(this, _CmDateRangePicker_default, [this.start, this.end, this.preset], "f");
214
260
  document.addEventListener('pointerdown', __classPrivateFieldGet(this, _CmDateRangePicker_onOutside, "f"), true);
215
261
  }
216
262
  disconnectedCallback() {
@@ -224,7 +270,7 @@ export class CmDateRangePicker extends CmLocalizedElement {
224
270
  checkValidity() { return __classPrivateFieldGet(this, _CmDateRangePicker_internals, "f").checkValidity(); }
225
271
  reportValidity() { return __classPrivateFieldGet(this, _CmDateRangePicker_v, "f").report(() => __classPrivateFieldGet(this, _CmDateRangePicker_internals, "f").reportValidity()); }
226
272
  formResetCallback() {
227
- [this.start, this.end] = __classPrivateFieldGet(this, _CmDateRangePicker_default, "f") ?? ['', ''];
273
+ [this.start, this.end, this.preset] = __classPrivateFieldGet(this, _CmDateRangePicker_default, "f") ?? ['', '', ''];
228
274
  this._startText = __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_format).call(this, this.start);
229
275
  this._endText = __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_format).call(this, this.end);
230
276
  this.open = false;
@@ -239,9 +285,15 @@ export class CmDateRangePicker extends CmLocalizedElement {
239
285
  return;
240
286
  this._draftStart = fromISO(this.start) ? this.start : '';
241
287
  this._draftEnd = fromISO(this.end) ? this.end : '';
288
+ this._draftPreset = this.preset;
242
289
  this._hover = null;
290
+ __classPrivateFieldSet(this, _CmDateRangePicker_custom, false, "f");
243
291
  const t = new Date();
244
- this._focus = clamp(fromISO(this.start) ?? new Date(t.getFullYear(), t.getMonth(), t.getDate()), fromISO(this.min), fromISO(this.max));
292
+ // The end month is on the right when two months show, so a range such as "Last 30 days" is in view.
293
+ const anchor = __classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_monthCount_get) === 2 ? fromISO(this.end) ?? fromISO(this.start) : fromISO(this.start);
294
+ this._view = startOfMonth(addMonths(clamp(anchor ?? new Date(t.getFullYear(), t.getMonth(), t.getDate()), fromISO(this.min), fromISO(this.max)), 1 - __classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_monthCount_get)));
295
+ this._focus = clamp(fromISO(this.start) ?? (anchor ?? new Date(t.getFullYear(), t.getMonth(), t.getDate())), fromISO(this.min), fromISO(this.max));
296
+ __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_show).call(this, this._focus);
245
297
  __classPrivateFieldSet(this, _CmDateRangePicker_picking, 'start', "f");
246
298
  __classPrivateFieldSet(this, _CmDateRangePicker_focusGrid, true, "f");
247
299
  this.open = true;
@@ -259,6 +311,15 @@ export class CmDateRangePicker extends CmLocalizedElement {
259
311
  return asList(this.disabledDates).includes(iso) || !!this.isDateDisabled?.(iso);
260
312
  }
261
313
  willUpdate(changed) {
314
+ // The app chose a preset by key: the range is that preset's dates today.
315
+ if (changed.has('preset') && !__classPrivateFieldGet(this, _CmDateRangePicker_ownPreset, "f") && this.preset) {
316
+ const r = resolvePreset(this.preset, new Date(), undefined, __classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_firstDay_get));
317
+ if (r) {
318
+ this.start = r.start;
319
+ this.end = r.end;
320
+ }
321
+ }
322
+ __classPrivateFieldSet(this, _CmDateRangePicker_ownPreset, false, "f");
262
323
  if (!__classPrivateFieldGet(this, _CmDateRangePicker_keepText, "f")) {
263
324
  if (changed.has('start'))
264
325
  this._startText = __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_format).call(this, this.start);
@@ -327,7 +388,31 @@ export class CmDateRangePicker extends CmLocalizedElement {
327
388
  const described = [message && `${__classPrivateFieldGet(this, _CmDateRangePicker_id, "f")}-err`, this.helpText && `${__classPrivateFieldGet(this, _CmDateRangePicker_id, "f")}-help`].filter(Boolean).join(' ');
328
389
  const hostLabel = this.getAttribute('aria-label');
329
390
  const name = this.label || hostLabel || '';
330
- const presets = asList(this.presets).map((p) => resolvePreset(p, new Date(), (k) => this.t(k))).filter((p) => !!p);
391
+ const presets = this.open ? __classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_listed_get) : [];
392
+ // The pressed preset: with `confirm` the draft's, else the range's. A key wins over matching dates.
393
+ const [rs, re, key] = this.confirm ? [this._draftStart, this._draftEnd, this._draftPreset] : [this.start, this.end, this.preset];
394
+ const keyed = !__classPrivateFieldGet(this, _CmDateRangePicker_custom, "f") && !!key && presets.some((p) => p.key === key);
395
+ const pressed = (p) => !__classPrivateFieldGet(this, _CmDateRangePicker_custom, "f") && (keyed ? p.key === key : p.start === rs && p.end === re);
396
+ const customPressed = __classPrivateFieldGet(this, _CmDateRangePicker_custom, "f") || (!presets.some(pressed) && !!(rs || re));
397
+ const months = __classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_monthCount_get);
398
+ const grid = (i) => renderGrid({
399
+ id: months === 1 ? __classPrivateFieldGet(this, _CmDateRangePicker_id, "f") : `${__classPrivateFieldGet(this, _CmDateRangePicker_id, "f")}-m${i}`, fmt, firstDay: __classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_firstDay_get), month: addMonths(this._view, i), focus: this._focus,
400
+ min: fromISO(this.min), max: fromISO(this.max),
401
+ isDisabled: (d) => this.isUnavailable(toISO(d)),
402
+ mark: (d) => __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_mark).call(this, d),
403
+ note: (d) => { const m = __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_mark).call(this, d); return m === 'start' ? this.t('startNote') : m === 'end' ? this.t('endNote') : ''; },
404
+ onPick: (d) => __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_pick).call(this, d), onKey: __classPrivateFieldGet(this, _CmDateRangePicker_onGridKey, "f"),
405
+ onMonth: (step) => {
406
+ this._view = addMonths(this._view, step);
407
+ this._focus = clamp(addMonths(this._focus, step), fromISO(this.min), fromISO(this.max));
408
+ __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_show).call(this, this._focus);
409
+ },
410
+ previousLabel: this.t('previousMonth'), nextLabel: this.t('nextMonth'),
411
+ onHover: (d) => { if (__classPrivateFieldGet(this, _CmDateRangePicker_picking, "f") === 'end')
412
+ this._hover = d; },
413
+ hideNav: months === 1 ? undefined : i === 0 ? 'next' : 'previous',
414
+ });
415
+ const ds = fromISO(this._draftStart), de = fromISO(this._draftEnd);
331
416
  const status = __classPrivateFieldGet(this, _CmDateRangePicker_picking, "f") === 'end' && this._draftStart
332
417
  ? this.t('chooseEnd', { date: fmt.medium(fromISO(this._draftStart)) })
333
418
  : this.t('chooseStart');
@@ -359,22 +444,19 @@ export class CmDateRangePicker extends CmLocalizedElement {
359
444
  <div class="pop" id="${__classPrivateFieldGet(this, _CmDateRangePicker_id, "f")}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t('dialog')}
360
445
  ?hidden=${!this.open} @keydown=${__classPrivateFieldGet(this, _CmDateRangePicker_onPopKey, "f")}>
361
446
  ${this.open ? html `<div class="body">
362
- ${presets.length ? html `<ul class="presets" part="presets" aria-label=${this.t('presets')}>${presets.map((p) => html `<li>
363
- <button type="button" class="preset" aria-pressed=${p.start === this.start && p.end === this.end ? 'true' : 'false'}
364
- @click=${() => __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_applyPreset).call(this, p)}>${p.label}</button></li>`)}</ul>` : nothing}
365
- <div class="cal">${renderGrid({
366
- id: __classPrivateFieldGet(this, _CmDateRangePicker_id, "f"), fmt, firstDay: __classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_firstDay_get), month: startOfMonth(this._focus), focus: this._focus,
367
- min: fromISO(this.min), max: fromISO(this.max),
368
- isDisabled: (d) => this.isUnavailable(toISO(d)),
369
- mark: (d) => __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_mark).call(this, d),
370
- note: (d) => { const m = __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_mark).call(this, d); return m === 'start' ? this.t('startNote') : m === 'end' ? this.t('endNote') : ''; },
371
- onPick: (d) => __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_pick).call(this, d), onKey: __classPrivateFieldGet(this, _CmDateRangePicker_onGridKey, "f"),
372
- onMonth: (step) => { this._focus = clamp(addMonths(this._focus, step), fromISO(this.min), fromISO(this.max)); },
373
- previousLabel: this.t('previousMonth'), nextLabel: this.t('nextMonth'),
374
- onHover: (d) => { if (__classPrivateFieldGet(this, _CmDateRangePicker_picking, "f") === 'end')
375
- this._hover = d; },
376
- })}
447
+ ${presets.length || __classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_hasCustom_get) ? html `<ul class="presets" part="presets" aria-label=${this.t('presets')}>${presets.map((p) => html `<li>
448
+ <button type="button" class="preset" data-preset=${p.key || nothing} aria-pressed=${pressed(p) ? 'true' : 'false'}
449
+ @click=${() => __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_applyPreset).call(this, p)}>${p.label}</button></li>`)}${__classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_hasCustom_get) ? html `<li>
450
+ <button type="button" class="preset" data-preset="custom" aria-pressed=${customPressed ? 'true' : 'false'}
451
+ @click=${() => __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_pickCustom).call(this)}>${this.t('custom')}</button></li>` : nothing}</ul>` : nothing}
452
+ <div>
453
+ <div class="cals">${Array.from({ length: months }, (_, i) => html `<div class="cal">${grid(i)}</div>`)}</div>
377
454
  <p class="status" aria-live="polite">${status}</p>
455
+ ${this.confirm ? html `<div class="foot" part="footer">
456
+ <span class="draft">${ds && de ? `${fmt.medium(ds)} – ${fmt.medium(de)}` : ds ? `${fmt.medium(ds)} –` : this.t('noRange')}</span>
457
+ <button type="button" class="act" @click=${() => __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_cancel).call(this)}>${this.t('cancel')}</button>
458
+ <button type="button" class="act primary" ?disabled=${!ds || !de} @click=${() => __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_apply).call(this)}>${this.t('apply')}</button>
459
+ </div>` : nothing}
378
460
  </div>
379
461
  </div>` : nothing}
380
462
  </div>
@@ -384,13 +466,34 @@ export class CmDateRangePicker extends CmLocalizedElement {
384
466
  </div>`;
385
467
  }
386
468
  }
387
- _CmDateRangePicker_localeProp = new WeakMap(), _CmDateRangePicker_internals = new WeakMap(), _CmDateRangePicker_v = new WeakMap(), _CmDateRangePicker_id = new WeakMap(), _CmDateRangePicker_default = new WeakMap(), _CmDateRangePicker_keepText = new WeakMap(), _CmDateRangePicker_focusGrid = new WeakMap(), _CmDateRangePicker_picking = new WeakMap(), _CmDateRangePicker_layer = new WeakMap(), _CmDateRangePicker_toggle = new WeakMap(), _CmDateRangePicker_onInputKey = new WeakMap(), _CmDateRangePicker_onGridKey = new WeakMap(), _CmDateRangePicker_onPopKey = new WeakMap(), _CmDateRangePicker_onOutside = new WeakMap(), _CmDateRangePicker_instances = new WeakSet(), _CmDateRangePicker_locale_get = function _CmDateRangePicker_locale_get() { return resolveLocale(this, this.locale); }, _CmDateRangePicker_fmt_get = function _CmDateRangePicker_fmt_get() { return dateFormat(__classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_locale_get)); }, _CmDateRangePicker_firstDay_get = function _CmDateRangePicker_firstDay_get() {
469
+ _CmDateRangePicker_localeProp = new WeakMap(), _CmDateRangePicker_internals = new WeakMap(), _CmDateRangePicker_v = new WeakMap(), _CmDateRangePicker_id = new WeakMap(), _CmDateRangePicker_default = new WeakMap(), _CmDateRangePicker_ownPreset = new WeakMap(), _CmDateRangePicker_custom = new WeakMap(), _CmDateRangePicker_keepText = new WeakMap(), _CmDateRangePicker_focusGrid = new WeakMap(), _CmDateRangePicker_picking = new WeakMap(), _CmDateRangePicker_layer = new WeakMap(), _CmDateRangePicker_toggle = new WeakMap(), _CmDateRangePicker_onInputKey = new WeakMap(), _CmDateRangePicker_onGridKey = new WeakMap(), _CmDateRangePicker_onPopKey = new WeakMap(), _CmDateRangePicker_onOutside = new WeakMap(), _CmDateRangePicker_instances = new WeakSet(), _CmDateRangePicker_locale_get = function _CmDateRangePicker_locale_get() { return resolveLocale(this, this.locale); }, _CmDateRangePicker_fmt_get = function _CmDateRangePicker_fmt_get() { return dateFormat(__classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_locale_get)); }, _CmDateRangePicker_firstDay_get = function _CmDateRangePicker_firstDay_get() {
388
470
  const n = Number(this.firstDayOfWeek);
389
471
  return this.firstDayOfWeek == null || Number.isNaN(n) ? localeFirstDay(__classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_locale_get)) : ((Math.trunc(n) % 7) + 7) % 7;
390
- }, _CmDateRangePicker_pattern_get = function _CmDateRangePicker_pattern_get() { return datePattern(__classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_fmt_get), { d: this.t('patternDay'), m: this.t('patternMonth'), y: this.t('patternYear') }); }, _CmDateRangePicker_format = function _CmDateRangePicker_format(v) { const d = fromISO(v); return d ? __classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_fmt_get).short(d) : v; }, _CmDateRangePicker_emit = function _CmDateRangePicker_emit() {
472
+ }, _CmDateRangePicker_monthCount_get = function _CmDateRangePicker_monthCount_get() {
473
+ if (Number(this.months) !== 2)
474
+ return 1;
475
+ return typeof matchMedia === 'function' && matchMedia('(max-width: 640px)').matches ? 1 : 2;
476
+ }, _CmDateRangePicker_show = function _CmDateRangePicker_show(d) {
477
+ const n = __classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_monthCount_get);
478
+ const m = startOfMonth(d);
479
+ if (m < this._view)
480
+ this._view = m;
481
+ else if (m >= addMonths(this._view, n))
482
+ this._view = addMonths(m, 1 - n);
483
+ }, _CmDateRangePicker_listed_get = function _CmDateRangePicker_listed_get() {
484
+ return asList(this.presets).flatMap((p) => {
485
+ const r = resolvePreset(p, new Date(), (k) => this.t(k), __classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_firstDay_get));
486
+ return r ? [{ ...r, key: typeof p === 'string' ? p : '' }] : [];
487
+ });
488
+ }, _CmDateRangePicker_hasCustom_get = function _CmDateRangePicker_hasCustom_get() { return asList(this.presets).includes('custom'); }, _CmDateRangePicker_pattern_get = function _CmDateRangePicker_pattern_get() { return datePattern(__classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_fmt_get), { d: this.t('patternDay'), m: this.t('patternMonth'), y: this.t('patternYear') }); }, _CmDateRangePicker_format = function _CmDateRangePicker_format(v) { const d = fromISO(v); return d ? __classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_fmt_get).short(d) : v; }, _CmDateRangePicker_emit = function _CmDateRangePicker_emit() {
391
489
  this.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
392
490
  this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
393
- }, _CmDateRangePicker_setRange = function _CmDateRangePicker_setRange(start, end) {
491
+ }, _CmDateRangePicker_setRange = function _CmDateRangePicker_setRange(start, end, key) {
492
+ const preset = key ?? __classPrivateFieldGet(this, _CmDateRangePicker_instances, "a", _CmDateRangePicker_listed_get).find((p) => p.key && p.start === start && p.end === end)?.key ?? '';
493
+ if (preset !== this.preset) {
494
+ __classPrivateFieldSet(this, _CmDateRangePicker_ownPreset, true, "f");
495
+ this.preset = preset;
496
+ }
394
497
  if (start === this.start && end === this.end)
395
498
  return;
396
499
  this.start = start;
@@ -413,6 +516,8 @@ _CmDateRangePicker_localeProp = new WeakMap(), _CmDateRangePicker_internals = ne
413
516
  const iso = toISO(d);
414
517
  if (this.isUnavailable(iso))
415
518
  return;
519
+ this._draftPreset = '';
520
+ __classPrivateFieldSet(this, _CmDateRangePicker_custom, true, "f");
416
521
  if (__classPrivateFieldGet(this, _CmDateRangePicker_picking, "f") === 'start' || !this._draftStart || iso < this._draftStart) {
417
522
  this._draftStart = iso;
418
523
  this._draftEnd = '';
@@ -422,12 +527,46 @@ _CmDateRangePicker_localeProp = new WeakMap(), _CmDateRangePicker_internals = ne
422
527
  return;
423
528
  }
424
529
  this._draftEnd = iso;
530
+ __classPrivateFieldSet(this, _CmDateRangePicker_picking, 'start', "f");
531
+ if (this.confirm) {
532
+ this._focus = d;
533
+ __classPrivateFieldSet(this, _CmDateRangePicker_focusGrid, true, "f");
534
+ return;
535
+ }
425
536
  this.open = false;
426
- __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_setRange).call(this, this._draftStart, iso);
537
+ __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_setRange).call(this, this._draftStart, iso, '');
427
538
  __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_focusTrigger).call(this);
428
539
  }, _CmDateRangePicker_applyPreset = function _CmDateRangePicker_applyPreset(p) {
540
+ if (this.confirm) {
541
+ // A draft: shown in the calendar and the footer until Apply.
542
+ this._draftStart = p.start;
543
+ this._draftEnd = p.end;
544
+ this._draftPreset = p.key;
545
+ __classPrivateFieldSet(this, _CmDateRangePicker_custom, false, "f");
546
+ __classPrivateFieldSet(this, _CmDateRangePicker_picking, 'start', "f");
547
+ const end = fromISO(p.end);
548
+ this._focus = clamp(end, fromISO(this.min), fromISO(this.max));
549
+ __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_show).call(this, fromISO(p.start));
550
+ __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_show).call(this, end);
551
+ return;
552
+ }
553
+ this.open = false;
554
+ __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_setRange).call(this, p.start, p.end, p.key);
555
+ __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_focusTrigger).call(this);
556
+ }, _CmDateRangePicker_pickCustom = function _CmDateRangePicker_pickCustom() {
557
+ __classPrivateFieldSet(this, _CmDateRangePicker_custom, true, "f");
558
+ this._draftPreset = '';
559
+ __classPrivateFieldSet(this, _CmDateRangePicker_picking, 'start', "f");
560
+ __classPrivateFieldSet(this, _CmDateRangePicker_focusGrid, true, "f");
561
+ this.requestUpdate();
562
+ }, _CmDateRangePicker_apply = function _CmDateRangePicker_apply() {
563
+ if (!this._draftStart || !this._draftEnd)
564
+ return;
565
+ this.open = false;
566
+ __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_setRange).call(this, this._draftStart, this._draftEnd, __classPrivateFieldGet(this, _CmDateRangePicker_custom, "f") ? '' : this._draftPreset || undefined);
567
+ __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_focusTrigger).call(this);
568
+ }, _CmDateRangePicker_cancel = function _CmDateRangePicker_cancel() {
429
569
  this.open = false;
430
- __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_setRange).call(this, p.start, p.end);
431
570
  __classPrivateFieldGet(this, _CmDateRangePicker_instances, "m", _CmDateRangePicker_focusTrigger).call(this);
432
571
  }, _CmDateRangePicker_focusTrigger = function _CmDateRangePicker_focusTrigger() { this.renderRoot.querySelector('.trigger')?.focus(); }, _CmDateRangePicker_mark = function _CmDateRangePicker_mark(d) {
433
572
  const iso = toISO(d);
@@ -459,6 +598,9 @@ CmDateRangePicker.properties = {
459
598
  disabledDates: { attribute: 'disabled-dates', converter: listConverter },
460
599
  isDateDisabled: { attribute: false },
461
600
  presets: { converter: listConverter },
601
+ preset: { reflect: true },
602
+ months: { type: Number, reflect: true },
603
+ confirm: { type: Boolean, reflect: true },
462
604
  startLabel: { attribute: 'start-label', string: 'start' },
463
605
  endLabel: { attribute: 'end-label', string: 'end' },
464
606
  required: { type: Boolean, reflect: true },
@@ -471,6 +613,8 @@ CmDateRangePicker.properties = {
471
613
  _draftStart: { state: true },
472
614
  _draftEnd: { state: true },
473
615
  _hover: { state: true },
616
+ _view: { state: true },
617
+ _draftPreset: { state: true },
474
618
  };
475
619
  CmDateRangePicker.styles = [
476
620
  base, topLayerStyles, dateFieldStyles, calendarStyles,
@@ -488,12 +632,30 @@ CmDateRangePicker.styles = [
488
632
  }
489
633
  .preset:hover { background: var(--cm-bg-hover); }
490
634
  .preset[aria-pressed='true'] { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
635
+ .cals { display: flex; gap: var(--cm-space-24); }
636
+ .foot {
637
+ display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--cm-space-8);
638
+ margin-block-start: var(--cm-space-12); padding-block-start: var(--cm-space-12); border-block-start: var(--cm-border-1) solid var(--cm-border-subtle);
639
+ }
640
+ .draft { margin-inline-end: auto; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-variant-numeric: tabular-nums; }
641
+ .act {
642
+ min-height: var(--cm-control-height-md, 36px); padding: 0 var(--cm-space-16); border: var(--cm-border-1) solid var(--cm-border-input);
643
+ border-radius: var(--cm-radius-sm); background: var(--cm-bg-surface); color: var(--cm-text-default);
644
+ font: inherit; font-size: var(--cm-font-size-14); font-weight: 500; cursor: pointer;
645
+ }
646
+ .act:hover { background: var(--cm-bg-hover); }
647
+ .act.primary { background: var(--cm-action-primary); border-color: var(--cm-action-primary); color: var(--cm-action-primary-text); }
648
+ .act.primary:hover { background: var(--cm-action-primary-hover); border-color: var(--cm-action-primary-hover); }
649
+ .act:disabled { opacity: 0.5; cursor: not-allowed; }
650
+ .act:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
651
+ @media (pointer: coarse) { .act { min-height: var(--cm-control-height-touch, 44px); } }
491
652
  .status { margin: var(--cm-space-8) 0 0; font-size: var(--cm-type-body-xs-size); line-height: var(--cm-type-body-xs-line-height); color: var(--cm-text-tertiary); }
492
653
  @media (max-width: 640px) {
493
654
  .body { flex-direction: column; }
494
655
  .presets { flex-direction: row; flex-wrap: wrap; min-width: 0; padding: 0 0 var(--cm-space-8); border-inline-end: 0; border-block-end: var(--cm-border-1) solid var(--cm-border-subtle); }
495
656
  .presets li { flex: 0 0 auto; }
496
657
  .preset { width: auto; border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-full); min-height: 32px; }
658
+ .draft { flex-basis: 100%; }
497
659
  }
498
660
  `,
499
661
  ];
@@ -85,6 +85,9 @@ export declare class CmTextField extends CmLocalizedElement {
85
85
  reflect: boolean;
86
86
  };
87
87
  autocomplete: {};
88
+ inputMode: {
89
+ attribute: string;
90
+ };
88
91
  size: {
89
92
  reflect: boolean;
90
93
  };
@@ -135,6 +138,12 @@ export declare class CmTextField extends CmLocalizedElement {
135
138
  readonly: boolean;
136
139
  /** Native autocomplete hint, e.g. `email`, `postal-code`. */
137
140
  autocomplete?: string;
141
+ /**
142
+ * Which on-screen keyboard phones open: `email`, `url`, `tel`, `numeric`, `decimal`, `search` or `text`, passed to the
143
+ * inner input. Use it with `type="text"` when your own check replaces the browser's (for example an email rule that
144
+ * matches your server), so the box still opens the right keyboard. Since 1.15.
145
+ */
146
+ inputMode: string;
138
147
  /** `small`: a 32px box with a 13px label, for toolbars, filter rows and filter panels. Default: a 40px box (since 1.6, owner standard; was 36px). On touch screens both are 44px. */
139
148
  size: 'default' | 'medium' | 'small';
140
149
  /**
@@ -87,6 +87,12 @@ export class CmTextField extends CmLocalizedElement {
87
87
  this.disabled = false;
88
88
  /** Shows the value on the filled background; the value is still submitted. */
89
89
  this.readonly = false;
90
+ /**
91
+ * Which on-screen keyboard phones open: `email`, `url`, `tel`, `numeric`, `decimal`, `search` or `text`, passed to the
92
+ * inner input. Use it with `type="text"` when your own check replaces the browser's (for example an email rule that
93
+ * matches your server), so the box still opens the right keyboard. Since 1.15.
94
+ */
95
+ this.inputMode = '';
90
96
  /** `small`: a 32px box with a 13px label, for toolbars, filter rows and filter panels. Default: a 40px box (since 1.6, owner standard; was 36px). On touch screens both are 44px. */
91
97
  this.size = 'default';
92
98
  /** The message when the value doesn't match `pattern`, e.g. "Enter the 6-digit PIN.". Since 1.14. */
@@ -127,13 +133,14 @@ export class CmTextField extends CmLocalizedElement {
127
133
  const control = this.multiline
128
134
  ? html `<textarea class="input" part="input" id=${common.id} rows=${this.rows}
129
135
  .value=${live(this.value)} placeholder=${this.placeholder || nothing}
136
+ inputmode=${this.inputMode || nothing}
130
137
  minlength=${minLength} maxlength=${maxLength}
131
138
  ?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
132
139
  aria-invalid=${common.invalid} aria-describedby=${describedBy}
133
140
  @input=${__classPrivateFieldGet(this, _CmTextField_instances, "m", _CmTextField_onInput)} @change=${__classPrivateFieldGet(this, _CmTextField_instances, "m", _CmTextField_onChange)} @blur=${__classPrivateFieldGet(this, _CmTextField_instances, "m", _CmTextField_onBlur)}></textarea>`
134
141
  : html `<input class="input" part="input" id=${common.id} type=${this.type}
135
142
  .value=${live(this.value)} placeholder=${this.placeholder || nothing}
136
- autocomplete=${this.autocomplete ?? nothing}
143
+ autocomplete=${this.autocomplete ?? nothing} inputmode=${this.inputMode || nothing}
137
144
  min=${this.min || nothing} max=${this.max || nothing} step=${this.step || nothing}
138
145
  pattern=${this.pattern || nothing} minlength=${minLength} maxlength=${maxLength}
139
146
  ?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
@@ -251,6 +258,7 @@ CmTextField.properties = {
251
258
  disabled: { type: Boolean, reflect: true },
252
259
  readonly: { type: Boolean, reflect: true },
253
260
  autocomplete: {},
261
+ inputMode: { attribute: 'inputmode' },
254
262
  size: { reflect: true },
255
263
  min: {},
256
264
  max: {},