@mhmo91/schmancy 0.2.59 → 0.2.60
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/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/date-range-Bole0xTK.js +166 -0
- package/dist/date-range-Bole0xTK.js.map +1 -0
- package/dist/date-range-Df_6BLmA.cjs +72 -0
- package/dist/date-range-Df_6BLmA.cjs.map +1 -0
- package/dist/date-range.cjs +1 -1
- package/dist/date-range.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/{teleport.component-CQ-n025U.js → teleport.component-ByTxHtT5.js} +2 -2
- package/dist/{teleport.component-CQ-n025U.js.map → teleport.component-ByTxHtT5.js.map} +1 -1
- package/dist/{teleport.component-BU8VUQ9X.cjs → teleport.component-C8AeNbog.cjs} +2 -2
- package/dist/{teleport.component-BU8VUQ9X.cjs.map → teleport.component-C8AeNbog.cjs.map} +1 -1
- package/dist/teleport.js +1 -1
- package/package.json +3 -2
- package/types/src/date-range/date-range.d.ts +4 -4
- package/types/src/date-range/date-utils.d.ts +15 -0
- package/dist/date-range-3yVvaRLG.cjs +0 -72
- package/dist/date-range-3yVvaRLG.cjs.map +0 -1
- package/dist/date-range-D5cDTxz2.js +0 -148
- package/dist/date-range-D5cDTxz2.js.map +0 -1
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import "rxjs";
|
|
2
|
-
import "lit/directives/class-map.js";
|
|
3
|
-
import "lit/directives/style-map.js";
|
|
4
|
-
import { $ as u } from "./litElement.mixin-C2ixT_uz.js";
|
|
5
|
-
import "./tailwind.mixin-BNM2vRly.js";
|
|
6
|
-
import { html as p } from "lit";
|
|
7
|
-
import { property as d, query as h, state as y, customElement as g } from "lit/decorators.js";
|
|
8
|
-
import { ifDefined as l } from "lit/directives/if-defined.js";
|
|
9
|
-
import a from "moment";
|
|
10
|
-
var f = Object.defineProperty, D = Object.getOwnPropertyDescriptor, r = (t, e, s, n) => {
|
|
11
|
-
for (var i, c = n > 1 ? void 0 : n ? D(e, s) : e, m = t.length - 1; m >= 0; m--) (i = t[m]) && (c = (n ? i(e, s, c) : i(c)) || c);
|
|
12
|
-
return n && c && f(e, s, c), c;
|
|
13
|
-
};
|
|
14
|
-
let o = class extends u() {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(...arguments), this.type = "date", this.selectedDateRange = "Today";
|
|
17
|
-
}
|
|
18
|
-
connectedCallback() {
|
|
19
|
-
super.connectedCallback(), this.initPresetRanges(), this.updateSelectedDateRange();
|
|
20
|
-
}
|
|
21
|
-
updated(t) {
|
|
22
|
-
t.has("type") && (this.initPresetRanges(), this.updateSelectedDateRange());
|
|
23
|
-
}
|
|
24
|
-
getDateFormat() {
|
|
25
|
-
return this.type === "date" ? "YYYY-MM-DD" : "YYYY-MM-DDTHH:mm";
|
|
26
|
-
}
|
|
27
|
-
getDisplayFormat() {
|
|
28
|
-
return this.type === "date" ? "MMM DD, YYYY" : "MMM DD, YYYY hh:mm A";
|
|
29
|
-
}
|
|
30
|
-
initPresetRanges() {
|
|
31
|
-
const t = this.getDateFormat();
|
|
32
|
-
this.presetRanges = [{ label: "Yesterday", range: { dateFrom: a().subtract(1, "days").startOf("day").format(t), dateTo: a().subtract(1, "days").endOf("day").format(t) }, step: "day" }, { label: "Today", range: { dateFrom: a().startOf("day").format(t), dateTo: a().endOf("day").format(t) }, step: "day" }, { label: "Tomorrow", range: { dateFrom: a().add(1, "days").startOf("day").format(t), dateTo: a().add(1, "days").endOf("day").format(t) }, step: "day" }, { label: "This Week", range: { dateFrom: a().startOf("isoWeek").format(t), dateTo: a().endOf("isoWeek").format(t) }, step: "week" }, { label: "Last Week", range: { dateFrom: a().subtract(1, "weeks").startOf("isoWeek").format(t), dateTo: a().subtract(1, "weeks").endOf("isoWeek").format(t) }, step: "week" }, { label: "This Month", range: { dateFrom: a().startOf("month").format(t), dateTo: a().endOf("month").format(t) }, step: "month" }];
|
|
33
|
-
}
|
|
34
|
-
updateSelectedDateRange() {
|
|
35
|
-
const t = this.presetRanges.find((e) => e.range.dateFrom === this.dateFrom.value && e.range.dateTo === this.dateTo.value);
|
|
36
|
-
if (t) this.selectedDateRange = t.label;
|
|
37
|
-
else {
|
|
38
|
-
const e = a(this.dateFrom.value).format(this.getDisplayFormat()), s = a(this.dateTo.value).format(this.getDisplayFormat());
|
|
39
|
-
this.selectedDateRange = `${e} - ${s}`;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
setDateRange(t, e) {
|
|
43
|
-
this.dateFrom.value = t, this.dateTo.value = e, this.dispatchEvent(new CustomEvent("change", { detail: { dateFrom: t, dateTo: e }, bubbles: !0, composed: !0 })), this.requestUpdate();
|
|
44
|
-
}
|
|
45
|
-
handlePresetChange(t) {
|
|
46
|
-
const e = this.presetRanges.find((i) => i.label === t);
|
|
47
|
-
if (!e) return;
|
|
48
|
-
const { dateFrom: s, dateTo: n } = e.range;
|
|
49
|
-
this.setDateRange(s, n), this.selectedDateRange = t, this.schmancyMenu.open = !1;
|
|
50
|
-
}
|
|
51
|
-
handleDateRangeChange() {
|
|
52
|
-
this.setDateRange(this.dateFrom.value, this.dateTo.value), this.updateSelectedDateRange(), this.schmancyMenu.open = !1;
|
|
53
|
-
}
|
|
54
|
-
shiftDateRange(t) {
|
|
55
|
-
const e = this.getDateFormat(), s = a(this.dateTo.value).diff(a(this.dateFrom.value), "days") || 1, n = a(this.dateFrom.value).add(t * s, "days").format(e), i = a(this.dateTo.value).add(t * s, "days").format(e);
|
|
56
|
-
this.setDateRange(n, i), this.updateSelectedDateRange();
|
|
57
|
-
}
|
|
58
|
-
render() {
|
|
59
|
-
var t;
|
|
60
|
-
return p`
|
|
61
|
-
<!-- schmancy-menu typically provides a slot="button" for the trigger,
|
|
62
|
-
and then projects the menu items inside. -->
|
|
63
|
-
<schmancy-menu class="z-100 w-max" role="menu" aria-label="Date range presets and custom input">
|
|
64
|
-
<!-- The toggle/trigger slot -->
|
|
65
|
-
<schmancy-grid slot="button" align="center" cols="auto 1fr auto">
|
|
66
|
-
<schmancy-icon-button
|
|
67
|
-
type="button"
|
|
68
|
-
aria-label="Shift date range backward"
|
|
69
|
-
@click=${(e) => {
|
|
70
|
-
e.preventDefault(), this.shiftDateRange(-1);
|
|
71
|
-
}}
|
|
72
|
-
>
|
|
73
|
-
arrow_left
|
|
74
|
-
</schmancy-icon-button>
|
|
75
|
-
|
|
76
|
-
<schmancy-button
|
|
77
|
-
class="w-max"
|
|
78
|
-
variant="outlined"
|
|
79
|
-
type="button"
|
|
80
|
-
aria-haspopup="menu"
|
|
81
|
-
.ariaExpanded=${String(((t = this.schmancyMenu) == null ? void 0 : t.open) || !1)}
|
|
82
|
-
>
|
|
83
|
-
${this.selectedDateRange || "Date range"}
|
|
84
|
-
</schmancy-button>
|
|
85
|
-
|
|
86
|
-
<schmancy-icon-button
|
|
87
|
-
type="button"
|
|
88
|
-
aria-label="Shift date range forward"
|
|
89
|
-
@click=${(e) => {
|
|
90
|
-
e.preventDefault(), this.shiftDateRange(1);
|
|
91
|
-
}}
|
|
92
|
-
>
|
|
93
|
-
arrow_right
|
|
94
|
-
</schmancy-icon-button>
|
|
95
|
-
</schmancy-grid>
|
|
96
|
-
|
|
97
|
-
<!-- The menu surface: presets + manual date selection -->
|
|
98
|
-
${this.presetRanges.map((e) => p`
|
|
99
|
-
<schmancy-menu-item role="menuitem" class="w-full" @click=${() => this.handlePresetChange(e.label)}>
|
|
100
|
-
<schmancy-grid class="w-full" align="center" cols="auto 1fr auto"> ${e.label} </schmancy-grid>
|
|
101
|
-
</schmancy-menu-item>
|
|
102
|
-
`)}
|
|
103
|
-
|
|
104
|
-
<!-- Manual date range inputs + "Apply" button -->
|
|
105
|
-
<schmancy-grid gap="sm" flow="row" class="p-4">
|
|
106
|
-
<schmancy-input
|
|
107
|
-
id="checkin"
|
|
108
|
-
.type=${this.type}
|
|
109
|
-
.label=${this.dateFrom.label}
|
|
110
|
-
.value=${this.dateFrom.value}
|
|
111
|
-
min=${l(this.minDate)}
|
|
112
|
-
@change=${(e) => {
|
|
113
|
-
e.preventDefault(), e.stopPropagation();
|
|
114
|
-
const s = this.getDateFormat(), n = a(e.detail.value, s).format(s);
|
|
115
|
-
this.dateFrom.value = n, this.checkOutInput.setAttribute("min", n);
|
|
116
|
-
}}
|
|
117
|
-
></schmancy-input>
|
|
118
|
-
|
|
119
|
-
<schmancy-input
|
|
120
|
-
id="checkout"
|
|
121
|
-
.type=${this.type}
|
|
122
|
-
.label=${this.dateTo.label}
|
|
123
|
-
.value=${this.dateTo.value}
|
|
124
|
-
min=${l(this.dateFrom.value)}
|
|
125
|
-
max=${l(this.maxDate)}
|
|
126
|
-
@change=${(e) => {
|
|
127
|
-
e.preventDefault(), e.stopPropagation();
|
|
128
|
-
const s = this.getDateFormat(), n = a(e.detail.value, s).format(s);
|
|
129
|
-
this.dateTo.value = n;
|
|
130
|
-
}}
|
|
131
|
-
></schmancy-input>
|
|
132
|
-
|
|
133
|
-
<schmancy-button
|
|
134
|
-
type="button"
|
|
135
|
-
variant="outlined"
|
|
136
|
-
@click=${(e) => {
|
|
137
|
-
e.preventDefault(), e.stopPropagation(), this.handleDateRangeChange();
|
|
138
|
-
}}
|
|
139
|
-
>
|
|
140
|
-
Apply
|
|
141
|
-
</schmancy-button>
|
|
142
|
-
</schmancy-grid>
|
|
143
|
-
</schmancy-menu>
|
|
144
|
-
`;
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
r([d({ type: String })], o.prototype, "type", 2), r([d({ type: Object })], o.prototype, "dateFrom", 2), r([d({ type: Object })], o.prototype, "dateTo", 2), r([d({ type: String })], o.prototype, "minDate", 2), r([d({ type: String })], o.prototype, "maxDate", 2), r([h("#checkin")], o.prototype, "checkInInput", 2), r([h("#checkout")], o.prototype, "checkOutInput", 2), r([h("schmancy-menu")], o.prototype, "schmancyMenu", 2), r([y()], o.prototype, "selectedDateRange", 2), o = r([g("schmancy-date-range")], o);
|
|
148
|
-
//# sourceMappingURL=date-range-D5cDTxz2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date-range-D5cDTxz2.js","sources":["../src/date-range/date-range.ts"],"sourcesContent":["import { $LitElement } from '@mixins/index'\nimport { SchmancyInputChangeEvent } from '@schmancy/input'\nimport SchmancyMenu from '@schmancy/menu/menu'\nimport { html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\nimport moment from 'moment'\n\n/**\n * A date range selector that supports presets and manual date input.\n */\n@customElement('schmancy-date-range')\nexport default class SchmancyDateRange extends $LitElement() {\n\t// Either \"date\" or \"datetime-local\"\n\t@property({ type: String }) type: 'date' | 'datetime-local' = 'date'\n\n\t@property({ type: Object }) dateFrom!: { label: string; value: string }\n\t@property({ type: Object }) dateTo!: { label: string; value: string }\n\n\t// Optional min/max constraints\n\t@property({ type: String }) minDate?: string\n\t@property({ type: String }) maxDate?: string\n\n\t@query('#checkin') checkInInput!: HTMLInputElement\n\t@query('#checkout') checkOutInput!: HTMLInputElement\n\n\t// The <schmancy-menu> that displays presets + manual date inputs\n\t@query('schmancy-menu') schmancyMenu!: SchmancyMenu\n\n\t// Display text in the trigger button\n\t@state() selectedDateRange: string = 'Today'\n\n\t// Preset date range definitions\n\tpresetRanges!: Array<{\n\t\tlabel: string\n\t\trange: { dateFrom: string; dateTo: string }\n\t\tstep: moment.unitOfTime.DurationConstructor\n\t}>\n\n\tconnectedCallback(): void {\n\t\tsuper.connectedCallback()\n\t\tthis.initPresetRanges()\n\t\tthis.updateSelectedDateRange()\n\t}\n\n\tupdated(changedProps: Map<string, unknown>) {\n\t\tif (changedProps.has('type')) {\n\t\t\t// Re-init presets if \"type\" changes from date -> datetime\n\t\t\tthis.initPresetRanges()\n\t\t\tthis.updateSelectedDateRange()\n\t\t}\n\t}\n\n\t/**\n\t * Format strings for the internal <input> and for display text.\n\t */\n\tprivate getDateFormat(): string {\n\t\treturn this.type === 'date' ? 'YYYY-MM-DD' : 'YYYY-MM-DDTHH:mm'\n\t}\n\tprivate getDisplayFormat(): string {\n\t\treturn this.type === 'date' ? 'MMM DD, YYYY' : 'MMM DD, YYYY hh:mm A'\n\t}\n\n\t/**\n\t * Build up a list of preset ranges (yesterday, today, etc.).\n\t */\n\tprivate initPresetRanges() {\n\t\tconst format = this.getDateFormat()\n\t\tthis.presetRanges = [\n\t\t\t{\n\t\t\t\tlabel: 'Yesterday',\n\t\t\t\trange: {\n\t\t\t\t\tdateFrom: moment().subtract(1, 'days').startOf('day').format(format),\n\t\t\t\t\tdateTo: moment().subtract(1, 'days').endOf('day').format(format),\n\t\t\t\t},\n\t\t\t\tstep: 'day',\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: 'Today',\n\t\t\t\trange: {\n\t\t\t\t\tdateFrom: moment().startOf('day').format(format),\n\t\t\t\t\tdateTo: moment().endOf('day').format(format),\n\t\t\t\t},\n\t\t\t\tstep: 'day',\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: 'Tomorrow',\n\t\t\t\trange: {\n\t\t\t\t\tdateFrom: moment().add(1, 'days').startOf('day').format(format),\n\t\t\t\t\tdateTo: moment().add(1, 'days').endOf('day').format(format),\n\t\t\t\t},\n\t\t\t\tstep: 'day',\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: 'This Week',\n\t\t\t\trange: {\n\t\t\t\t\tdateFrom: moment().startOf('isoWeek').format(format),\n\t\t\t\t\tdateTo: moment().endOf('isoWeek').format(format),\n\t\t\t\t},\n\t\t\t\tstep: 'week',\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: 'Last Week',\n\t\t\t\trange: {\n\t\t\t\t\tdateFrom: moment().subtract(1, 'weeks').startOf('isoWeek').format(format),\n\t\t\t\t\tdateTo: moment().subtract(1, 'weeks').endOf('isoWeek').format(format),\n\t\t\t\t},\n\t\t\t\tstep: 'week',\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: 'This Month',\n\t\t\t\trange: {\n\t\t\t\t\tdateFrom: moment().startOf('month').format(format),\n\t\t\t\t\tdateTo: moment().endOf('month').format(format),\n\t\t\t\t},\n\t\t\t\tstep: 'month',\n\t\t\t},\n\t\t\t// Add more if desired (e.g. \"Last Month,\" \"Custom,\" etc.)\n\t\t]\n\t}\n\n\t/**\n\t * Based on the current dateFrom/dateTo, see if it matches a preset.\n\t * Otherwise display a \"Custom\" range: \"Jan 01, 2023 - Jan 07, 2023\".\n\t */\n\tprivate updateSelectedDateRange() {\n\t\tconst preset = this.presetRanges.find(\n\t\t\tp => p.range.dateFrom === this.dateFrom.value && p.range.dateTo === this.dateTo.value,\n\t\t)\n\t\tif (preset) {\n\t\t\tthis.selectedDateRange = preset.label\n\t\t} else {\n\t\t\t// Construct a custom label\n\t\t\tconst fromStr = moment(this.dateFrom.value).format(this.getDisplayFormat())\n\t\t\tconst toStr = moment(this.dateTo.value).format(this.getDisplayFormat())\n\t\t\tthis.selectedDateRange = `${fromStr} - ${toStr}`\n\t\t}\n\t}\n\n\t/**\n\t * Update the internal date range and fire a 'change' event to notify external code.\n\t */\n\tprivate setDateRange(fromDate: string, toDate: string) {\n\t\tthis.dateFrom.value = fromDate\n\t\tthis.dateTo.value = toDate\n\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent<TSchmancDateRangePayload>('change', {\n\t\t\t\tdetail: { dateFrom: fromDate, dateTo: toDate },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true, // If you want it to pass shadow boundaries\n\t\t\t}),\n\t\t)\n\t\tthis.requestUpdate()\n\t}\n\n\t/**\n\t * Called when user selects a preset from the list.\n\t * Updates date range and closes the menu.\n\t */\n\tprivate handlePresetChange(label: string) {\n\t\tconst preset = this.presetRanges.find(range => range.label === label)\n\t\tif (!preset) return\n\t\tconst { dateFrom, dateTo } = preset.range\n\t\tthis.setDateRange(dateFrom, dateTo)\n\t\tthis.selectedDateRange = label\n\t\tthis.schmancyMenu.open = false\n\t}\n\n\t/**\n\t * Applies the date range from the inputs.\n\t * Closes the menu when done.\n\t */\n\tprivate handleDateRangeChange() {\n\t\tthis.setDateRange(this.dateFrom.value, this.dateTo.value)\n\t\tthis.updateSelectedDateRange()\n\t\tthis.schmancyMenu.open = false\n\t}\n\n\t/**\n\t * Shift the current date range forward or backward by the same number of days.\n\t * If the range is 7 days wide, shift 7 days, etc.\n\t */\n\tprivate shiftDateRange(factor: number) {\n\t\tconst format = this.getDateFormat()\n\t\tconst currentDiff = moment(this.dateTo.value).diff(moment(this.dateFrom.value), 'days') || 1\n\t\tconst newDateFrom = moment(this.dateFrom.value)\n\t\t\t.add(factor * currentDiff, 'days')\n\t\t\t.format(format)\n\t\tconst newDateTo = moment(this.dateTo.value)\n\t\t\t.add(factor * currentDiff, 'days')\n\t\t\t.format(format)\n\n\t\tthis.setDateRange(newDateFrom, newDateTo)\n\t\tthis.updateSelectedDateRange()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<!-- schmancy-menu typically provides a slot=\"button\" for the trigger, \n and then projects the menu items inside. -->\n\t\t\t<schmancy-menu class=\"z-100 w-max\" role=\"menu\" aria-label=\"Date range presets and custom input\">\n\t\t\t\t<!-- The toggle/trigger slot -->\n\t\t\t\t<schmancy-grid slot=\"button\" align=\"center\" cols=\"auto 1fr auto\">\n\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\taria-label=\"Shift date range backward\"\n\t\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\tthis.shiftDateRange(-1)\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\tarrow_left\n\t\t\t\t\t</schmancy-icon-button>\n\n\t\t\t\t\t<schmancy-button\n\t\t\t\t\t\tclass=\"w-max\"\n\t\t\t\t\t\tvariant=\"outlined\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\taria-haspopup=\"menu\"\n\t\t\t\t\t\t.ariaExpanded=${String(this.schmancyMenu?.open || false)}\n\t\t\t\t\t>\n\t\t\t\t\t\t${this.selectedDateRange || 'Date range'}\n\t\t\t\t\t</schmancy-button>\n\n\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\taria-label=\"Shift date range forward\"\n\t\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\tthis.shiftDateRange(1)\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\tarrow_right\n\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t</schmancy-grid>\n\n\t\t\t\t<!-- The menu surface: presets + manual date selection -->\n\t\t\t\t${this.presetRanges.map(\n\t\t\t\t\tpreset => html`\n\t\t\t\t\t\t<schmancy-menu-item role=\"menuitem\" class=\"w-full\" @click=${() => this.handlePresetChange(preset.label)}>\n\t\t\t\t\t\t\t<schmancy-grid class=\"w-full\" align=\"center\" cols=\"auto 1fr auto\"> ${preset.label} </schmancy-grid>\n\t\t\t\t\t\t</schmancy-menu-item>\n\t\t\t\t\t`,\n\t\t\t\t)}\n\n\t\t\t\t<!-- Manual date range inputs + \"Apply\" button -->\n\t\t\t\t<schmancy-grid gap=\"sm\" flow=\"row\" class=\"p-4\">\n\t\t\t\t\t<schmancy-input\n\t\t\t\t\t\tid=\"checkin\"\n\t\t\t\t\t\t.type=${this.type}\n\t\t\t\t\t\t.label=${this.dateFrom.label}\n\t\t\t\t\t\t.value=${this.dateFrom.value}\n\t\t\t\t\t\tmin=${ifDefined(this.minDate)}\n\t\t\t\t\t\t@change=${(event: SchmancyInputChangeEvent) => {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\t\t\tconst fmt = this.getDateFormat()\n\t\t\t\t\t\t\tconst selectedDate = moment(event.detail.value, fmt).format(fmt)\n\t\t\t\t\t\t\tthis.dateFrom.value = selectedDate\n\t\t\t\t\t\t\t// Update the checkout input's min attribute:\n\t\t\t\t\t\t\tthis.checkOutInput.setAttribute('min', selectedDate)\n\t\t\t\t\t\t}}\n\t\t\t\t\t></schmancy-input>\n\n\t\t\t\t\t<schmancy-input\n\t\t\t\t\t\tid=\"checkout\"\n\t\t\t\t\t\t.type=${this.type}\n\t\t\t\t\t\t.label=${this.dateTo.label}\n\t\t\t\t\t\t.value=${this.dateTo.value}\n\t\t\t\t\t\tmin=${ifDefined(this.dateFrom.value)}\n\t\t\t\t\t\tmax=${ifDefined(this.maxDate)}\n\t\t\t\t\t\t@change=${(event: SchmancyInputChangeEvent) => {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\t\t\tconst fmt = this.getDateFormat()\n\t\t\t\t\t\t\tconst selectedDate = moment(event.detail.value, fmt).format(fmt)\n\t\t\t\t\t\t\tthis.dateTo.value = selectedDate\n\t\t\t\t\t\t}}\n\t\t\t\t\t></schmancy-input>\n\n\t\t\t\t\t<schmancy-button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"outlined\"\n\t\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t\tthis.handleDateRangeChange()\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\tApply\n\t\t\t\t\t</schmancy-button>\n\t\t\t\t</schmancy-grid>\n\t\t\t</schmancy-menu>\n\t\t`\n\t}\n}\n\n/**\n * The payload for a date range change event.\n */\nexport type TSchmancDateRangePayload = {\n\tdateFrom?: string\n\tdateTo?: string\n}\n\n/**\n * A custom event fired when the date range is updated.\n */\nexport type SchmancyDateRangeChangeEvent = CustomEvent<TSchmancDateRangePayload>\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-date-range': SchmancyDateRange\n\t}\n}\n"],"names":["SchmancyDateRange","$LitElement","constructor","super","arguments","this","type","selectedDateRange","connectedCallback","initPresetRanges","updateSelectedDateRange","changedProps","has","format","getDateFormat","presetRanges","label","range","dateFrom","moment","subtract","startOf","dateTo","endOf","step","add","preset","find","p","value","fromStr","getDisplayFormat","toStr","fromDate","toDate","dispatchEvent","CustomEvent","detail","bubbles","composed","requestUpdate","setDateRange","schmancyMenu","open","handleDateRangeChange","factor","currentDiff","diff","newDateFrom","newDateTo","html","e","preventDefault","shiftDateRange","String","map","handlePresetChange","ifDefined","minDate","event","stopPropagation","fmt","selectedDate","checkOutInput","setAttribute","maxDate","__decorateClass","property","prototype","Object","query","state","customElement"],"mappings":";;;;;;;;;;;;;AAYA,IAAqBA,IAArB,cAA+CC,EAAAA,EAAAA;AAAAA,EAA/C,cAAAC;AAAAC,aAAAC,SAE+DC,GAAAA,KAAAC,OAAA,QAgBzBD,KAAAE,oBAAA;AAAA,EAAA;AAAA,EASrC,oBACCJ;AAAAA,UAAMK,kBACNH,GAAAA,KAAKI,oBACLJ,KAAKK,wBAAAA;AAAAA,EAAwB;AAAA,EAG9B,QAAQC,GAAAA;AACHA,MAAaC,IAAI,MAAA,MAEpBP,KAAKI,iBAAAA,GACLJ,KAAKK,wBAAAA;AAAAA,EACN;AAAA,EAMO,gBACA;AAAA,WAAAL,KAAKC,SAAS,SAAS,eAAe;AAAA,EAAA;AAAA,EAEtC,mBACA;AAAA,WAAAD,KAAKC,SAAS,SAAS,iBAAiB;AAAA,EAAA;AAAA,EAMxC,mBACD;AAAA,UAAAO,IAASR,KAAKS,cAAAA;AACpBT,SAAKU,eAAe,CACnB,EACCC,OAAO,aACPC,OAAO,EACNC,UAAUC,EAASC,EAAAA,SAAS,GAAG,MAAQC,EAAAA,QAAQ,KAAOR,EAAAA,OAAOA,CAC7DS,GAAAA,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