@mhmo91/schmancy 0.2.12 → 0.2.14
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-Bf_u0TPH.js +130 -0
- package/dist/date-range-Bf_u0TPH.js.map +1 -0
- package/dist/date-range-C6ObEwpy.cjs +58 -0
- package/dist/date-range-C6ObEwpy.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 +3 -3
- package/dist/{input-BNWPVs3H.js → input-CjHwAdCr.js} +2 -2
- package/dist/input-CjHwAdCr.js.map +1 -0
- package/dist/{input-shCt07iX.cjs → input-Dg9UEyST.cjs} +2 -2
- package/dist/input-Dg9UEyST.cjs.map +1 -0
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/{teleport.component-DOO3qoVk.cjs → teleport.component-CBt5HLNC.cjs} +2 -2
- package/dist/{teleport.component-DOO3qoVk.cjs.map → teleport.component-CBt5HLNC.cjs.map} +1 -1
- package/dist/{teleport.component-DZlkBtyW.js → teleport.component-Dc1Ygxut.js} +3 -3
- package/dist/{teleport.component-DZlkBtyW.js.map → teleport.component-Dc1Ygxut.js.map} +1 -1
- package/dist/teleport.js +1 -1
- package/package.json +1 -1
- package/types/src/date-range/date-range.d.ts +49 -9
- package/types/src/input/input.d.ts +0 -4
- package/dist/date-range-AqKuO1c4.js +0 -112
- package/dist/date-range-AqKuO1c4.js.map +0 -1
- package/dist/date-range-wOUZirqC.cjs +0 -53
- package/dist/date-range-wOUZirqC.cjs.map +0 -1
- package/dist/input-BNWPVs3H.js.map +0 -1
- package/dist/input-shCt07iX.cjs.map +0 -1
package/dist/card.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require("./teleport.component-
|
|
1
|
+
"use strict";require("./teleport.component-CBt5HLNC.cjs");
|
|
2
2
|
//# sourceMappingURL=card.cjs.map
|
package/dist/card.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "./teleport.component-
|
|
1
|
+
import "./teleport.component-Dc1Ygxut.js";
|
|
2
2
|
//# sourceMappingURL=card.js.map
|
package/dist/content-drawer.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-CBt5HLNC.cjs");Object.defineProperty(exports,"SchmancyContentDrawer",{enumerable:!0,get:()=>e.SchmancyContentDrawer}),exports.SchmancyContentDrawerID=e.SchmancyContentDrawerID,Object.defineProperty(exports,"SchmancyContentDrawerMain",{enumerable:!0,get:()=>e.SchmancyContentDrawerMain}),exports.SchmancyContentDrawerMaxHeight=e.SchmancyContentDrawerMaxHeight,exports.SchmancyContentDrawerMinWidth=e.SchmancyContentDrawerMinWidth,Object.defineProperty(exports,"SchmancyContentDrawerSheet",{enumerable:!0,get:()=>e.SchmancyContentDrawerSheet}),exports.SchmancyContentDrawerSheetMode=e.SchmancyContentDrawerSheetMode,exports.SchmancyContentDrawerSheetState=e.SchmancyContentDrawerSheetState,exports.schmancyContentDrawer=e.schmancyContentDrawer;
|
|
2
2
|
//# sourceMappingURL=content-drawer.cjs.map
|
package/dist/content-drawer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as n, b as t, f as r, c, d as h, g as S, S as o, a as s, s as m } from "./teleport.component-
|
|
1
|
+
import { e as n, b as t, f as r, c, d as h, g as S, S as o, a as s, s as m } from "./teleport.component-Dc1Ygxut.js";
|
|
2
2
|
export {
|
|
3
3
|
n as SchmancyContentDrawer,
|
|
4
4
|
t as SchmancyContentDrawerID,
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import "rxjs";
|
|
2
|
+
import "lit/directives/class-map.js";
|
|
3
|
+
import "lit/directives/style-map.js";
|
|
4
|
+
import { $ as u } from "./litElement.mixin-Bn8Rl6md.js";
|
|
5
|
+
import "./tailwind.mixin-C5OzBKVB.js";
|
|
6
|
+
import { html as p } from "lit";
|
|
7
|
+
import { property as d, query as m, 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, n = (t, e, s, r) => {
|
|
11
|
+
for (var c, i = r > 1 ? void 0 : r ? D(e, s) : e, h = t.length - 1; h >= 0; h--) (c = t[h]) && (i = (r ? c(e, s, i) : c(i)) || i);
|
|
12
|
+
return r && i && f(e, s, i), i;
|
|
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
|
+
this.selectedDateRange = t ? t.label : `${a(this.dateFrom.value).format(this.getDisplayFormat())} - ${a(this.dateTo.value).format(this.getDisplayFormat())}`;
|
|
37
|
+
}
|
|
38
|
+
setDateRange(t, e) {
|
|
39
|
+
this.dateFrom.value = t, this.dateTo.value = e, this.dispatchEvent(new CustomEvent("change", { detail: { dateFrom: t, dateTo: e } })), this.requestUpdate();
|
|
40
|
+
}
|
|
41
|
+
handlePresetChange(t) {
|
|
42
|
+
const e = this.presetRanges.find((s) => s.label === t);
|
|
43
|
+
if (e) {
|
|
44
|
+
const { dateFrom: s, dateTo: r } = e.range;
|
|
45
|
+
this.setDateRange(s, r), this.selectedDateRange = t, this.schmancyMenu.open = !1;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
handleDateRangeChange() {
|
|
49
|
+
this.setDateRange(this.dateFrom.value, this.dateTo.value), this.updateSelectedDateRange(), this.schmancyMenu.open = !1;
|
|
50
|
+
}
|
|
51
|
+
shiftDateRange(t) {
|
|
52
|
+
const e = this.getDateFormat(), s = a(this.dateTo.value).diff(a(this.dateFrom.value), "days") || 1, r = a(this.dateFrom.value).add(t * s, "days").format(e), c = a(this.dateTo.value).add(t * s, "days").format(e);
|
|
53
|
+
this.setDateRange(r, c), this.updateSelectedDateRange();
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
return p`
|
|
57
|
+
<div class="date-range-selector relative">
|
|
58
|
+
<schmancy-menu class="z-100 w-max">
|
|
59
|
+
<!-- The button slot: left/right arrows and the display text -->
|
|
60
|
+
<schmancy-grid slot="button" align="center" cols="auto 1fr auto">
|
|
61
|
+
<schmancy-icon-button
|
|
62
|
+
@click=${(t) => {
|
|
63
|
+
t.preventDefault(), t.stopPropagation(), this.shiftDateRange(-1);
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
arrow_left
|
|
67
|
+
</schmancy-icon-button>
|
|
68
|
+
<schmancy-button class="w-max" variant="outlined" type="button">
|
|
69
|
+
${this.selectedDateRange || "Date range"}
|
|
70
|
+
</schmancy-button>
|
|
71
|
+
<schmancy-icon-button
|
|
72
|
+
@click=${(t) => {
|
|
73
|
+
t.preventDefault(), t.stopPropagation(), this.shiftDateRange(1);
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
arrow_right
|
|
77
|
+
</schmancy-icon-button>
|
|
78
|
+
</schmancy-grid>
|
|
79
|
+
|
|
80
|
+
<!-- The menu surface -->
|
|
81
|
+
<schmancy-surface elevation="2">
|
|
82
|
+
${this.presetRanges.map((t) => p`
|
|
83
|
+
<schmancy-menu-item class="w-full" @click=${() => this.handlePresetChange(t.label)}>
|
|
84
|
+
<schmancy-grid class="w-full" align="center" cols="auto 1fr auto"> ${t.label} </schmancy-grid>
|
|
85
|
+
</schmancy-menu-item>
|
|
86
|
+
`)}
|
|
87
|
+
<schmancy-grid gap="sm" flow="row" class="p-4">
|
|
88
|
+
<schmancy-input
|
|
89
|
+
id="checkin"
|
|
90
|
+
min=${l(this.minDate)}
|
|
91
|
+
.type=${this.type}
|
|
92
|
+
label="${this.dateFrom.label}"
|
|
93
|
+
.value=${this.dateFrom.value}
|
|
94
|
+
@change=${(t) => {
|
|
95
|
+
t.preventDefault(), t.stopPropagation();
|
|
96
|
+
const e = this.getDateFormat(), s = a(t.detail.value, e).format(e);
|
|
97
|
+
this.dateFrom.value = s, this.checkOutInput.setAttribute("min", s);
|
|
98
|
+
}}
|
|
99
|
+
></schmancy-input>
|
|
100
|
+
<schmancy-input
|
|
101
|
+
id="checkout"
|
|
102
|
+
min=${l(this.dateFrom.value)}
|
|
103
|
+
max=${l(this.maxDate)}
|
|
104
|
+
.type=${this.type}
|
|
105
|
+
label="${this.dateTo.label}"
|
|
106
|
+
.value=${this.dateTo.value}
|
|
107
|
+
@change=${(t) => {
|
|
108
|
+
t.preventDefault(), t.stopPropagation();
|
|
109
|
+
const e = this.getDateFormat(), s = a(t.detail.value, e).format(e);
|
|
110
|
+
this.dateTo.value = s;
|
|
111
|
+
}}
|
|
112
|
+
></schmancy-input>
|
|
113
|
+
|
|
114
|
+
<schmancy-button
|
|
115
|
+
variant="outlined"
|
|
116
|
+
@click=${(t) => {
|
|
117
|
+
t.preventDefault(), t.stopPropagation(), this.handleDateRangeChange();
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
Apply
|
|
121
|
+
</schmancy-button>
|
|
122
|
+
</schmancy-grid>
|
|
123
|
+
</schmancy-surface>
|
|
124
|
+
</schmancy-menu>
|
|
125
|
+
</div>
|
|
126
|
+
`;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
n([d({ type: String })], o.prototype, "type", 2), n([d({ type: Object })], o.prototype, "dateFrom", 2), n([d({ type: Object })], o.prototype, "dateTo", 2), n([d({ type: String })], o.prototype, "minDate", 2), n([d({ type: String })], o.prototype, "maxDate", 2), n([m("#checkin")], o.prototype, "checkInInput", 2), n([m("#checkout")], o.prototype, "checkOutInput", 2), n([m("schmancy-menu")], o.prototype, "schmancyMenu", 2), n([y()], o.prototype, "selectedDateRange", 2), o = n([g("schmancy-date-range")], o);
|
|
130
|
+
//# sourceMappingURL=date-range-Bf_u0TPH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-range-Bf_u0TPH.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// The input type – either \"date\" or \"datetime-local\".\n\t@property({ type: String }) type: 'date' | 'datetime-local' = 'date'\n\n\t// The date range properties.\n\t@property({ type: Object }) dateFrom!: { label: string; value: string }\n\t@property({ type: Object }) dateTo!: { label: string; value: string }\n\n\t// Optional minimum and maximum dates.\n\t@property({ type: String }) minDate?: string\n\t@property({ type: String }) maxDate?: string\n\n\t// Query elements from the rendered template.\n\t@query('#checkin') checkInInput!: HTMLInputElement\n\t@query('#checkout') checkOutInput!: HTMLInputElement\n\t@query('schmancy-menu') schmancyMenu!: SchmancyMenu\n\n\t// The currently selected preset or custom date range display text.\n\t@state() selectedDateRange: string = 'Today'\n\n\t// Array of preset date ranges.\n\tpresetRanges!: Array<{\n\t\tlabel: string\n\t\trange: { dateFrom: string; dateTo: string }\n\t\tstep: moment.unitOfTime.DurationConstructor\n\t\tselected?: boolean\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// Reinitialize presets if the date input type changes.\n\t\t\tthis.initPresetRanges()\n\t\t\tthis.updateSelectedDateRange()\n\t\t}\n\t}\n\n\t/**\n\t * Returns the date format string based on the current type.\n\t */\n\tprivate getDateFormat(): string {\n\t\treturn this.type === 'date' ? 'YYYY-MM-DD' : 'YYYY-MM-DDTHH:mm'\n\t}\n\n\t/**\n\t * Returns the display format for showing dates.\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 * Initializes the preset date ranges.\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\t// Use ISO week boundaries for consistency.\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// You can add a \"Custom\" option here if needed.\n\t\t]\n\t}\n\n\t/**\n\t * Updates the selectedDateRange state based on the current dateFrom and dateTo values.\n\t */\n\tprivate updateSelectedDateRange() {\n\t\tconst preset = this.presetRanges.find(\n\t\t\trange => range.range.dateFrom === this.dateFrom.value && range.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\tthis.selectedDateRange = `${moment(this.dateFrom.value).format(\n\t\t\t\tthis.getDisplayFormat(),\n\t\t\t)} - ${moment(this.dateTo.value).format(this.getDisplayFormat())}`\n\t\t}\n\t}\n\n\t/**\n\t * Updates the internal date range state and dispatches a change event.\n\t */\n\tsetDateRange(fromDate: string, toDate: string) {\n\t\tthis.dateFrom.value = fromDate\n\t\tthis.dateTo.value = toDate\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent<TSchmancDateRangePayload>('change', {\n\t\t\t\tdetail: { dateFrom: fromDate, dateTo: toDate },\n\t\t\t}),\n\t\t)\n\t\tthis.requestUpdate()\n\t}\n\n\t/**\n\t * Called when a preset is selected. Updates the date range and closes the menu.\n\t */\n\thandlePresetChange(presetLabel: string) {\n\t\tconst preset = this.presetRanges.find(range => range.label === presetLabel)\n\t\tif (preset) {\n\t\t\tconst { dateFrom, dateTo } = preset.range\n\t\t\tthis.setDateRange(dateFrom, dateTo)\n\t\t\tthis.selectedDateRange = presetLabel\n\t\t\t// Close the menu after a preset selection.\n\t\t\tthis.schmancyMenu.open = false\n\t\t}\n\t}\n\n\t/**\n\t * Called when the user applies a manual date change.\n\t */\n\thandleDateRangeChange() {\n\t\tthis.setDateRange(this.dateFrom.value, this.dateTo.value)\n\t\tthis.updateSelectedDateRange()\n\t\t// Close the menu after applying manual changes.\n\t\tthis.schmancyMenu.open = false\n\t}\n\n\t/**\n\t * Shifts the current date range by multiplying the range length with the given factor.\n\t * Use a negative factor to shift backward.\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\t\tthis.setDateRange(newDateFrom, newDateTo)\n\t\tthis.updateSelectedDateRange()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"date-range-selector relative\">\n\t\t\t\t<schmancy-menu class=\"z-100 w-max\">\n\t\t\t\t\t<!-- The button slot: left/right arrows and the display text -->\n\t\t\t\t\t<schmancy-grid slot=\"button\" align=\"center\" cols=\"auto 1fr auto\">\n\t\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t\t\tthis.shiftDateRange(-1)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tarrow_left\n\t\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t\t\t<schmancy-button class=\"w-max\" variant=\"outlined\" type=\"button\">\n\t\t\t\t\t\t\t${this.selectedDateRange || 'Date range'}\n\t\t\t\t\t\t</schmancy-button>\n\t\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t\t\tthis.shiftDateRange(1)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tarrow_right\n\t\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t\t</schmancy-grid>\n\n\t\t\t\t\t<!-- The menu surface -->\n\t\t\t\t\t<schmancy-surface elevation=\"2\">\n\t\t\t\t\t\t${this.presetRanges.map(\n\t\t\t\t\t\t\tpreset => html`\n\t\t\t\t\t\t\t\t<schmancy-menu-item class=\"w-full\" @click=${() => this.handlePresetChange(preset.label)}>\n\t\t\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\t\t</schmancy-menu-item>\n\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<schmancy-grid gap=\"sm\" flow=\"row\" class=\"p-4\">\n\t\t\t\t\t\t\t<schmancy-input\n\t\t\t\t\t\t\t\tid=\"checkin\"\n\t\t\t\t\t\t\t\tmin=${ifDefined(this.minDate)}\n\t\t\t\t\t\t\t\t.type=${this.type}\n\t\t\t\t\t\t\t\tlabel=\"${this.dateFrom.label}\"\n\t\t\t\t\t\t\t\t.value=${this.dateFrom.value}\n\t\t\t\t\t\t\t\t@change=${(event: SchmancyInputChangeEvent) => {\n\t\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\t\t\t\t\tconst format = this.getDateFormat()\n\t\t\t\t\t\t\t\t\tconst selectedDate = moment(event.detail.value, format).format(format)\n\t\t\t\t\t\t\t\t\tthis.dateFrom.value = selectedDate\n\t\t\t\t\t\t\t\t\t// Update the checkout input's minimum date.\n\t\t\t\t\t\t\t\t\tthis.checkOutInput.setAttribute('min', selectedDate)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t></schmancy-input>\n\t\t\t\t\t\t\t<schmancy-input\n\t\t\t\t\t\t\t\tid=\"checkout\"\n\t\t\t\t\t\t\t\tmin=${ifDefined(this.dateFrom.value)}\n\t\t\t\t\t\t\t\tmax=${ifDefined(this.maxDate)}\n\t\t\t\t\t\t\t\t.type=${this.type}\n\t\t\t\t\t\t\t\tlabel=\"${this.dateTo.label}\"\n\t\t\t\t\t\t\t\t.value=${this.dateTo.value}\n\t\t\t\t\t\t\t\t@change=${(event: SchmancyInputChangeEvent) => {\n\t\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\t\t\t\t\tconst format = this.getDateFormat()\n\t\t\t\t\t\t\t\t\tconst selectedDate = moment(event.detail.value, format).format(format)\n\t\t\t\t\t\t\t\t\tthis.dateTo.value = selectedDate\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t></schmancy-input>\n\n\t\t\t\t\t\t\t<schmancy-button\n\t\t\t\t\t\t\t\tvariant=\"outlined\"\n\t\t\t\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t\t\t\tthis.handleDateRangeChange()\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tApply\n\t\t\t\t\t\t\t</schmancy-button>\n\t\t\t\t\t\t</schmancy-grid>\n\t\t\t\t\t</schmancy-surface>\n\t\t\t\t</schmancy-menu>\n\t\t\t</div>\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","value","getDisplayFormat","fromDate","toDate","dispatchEvent","CustomEvent","detail","requestUpdate","presetLabel","setDateRange","schmancyMenu","open","factor","currentDiff","diff","newDateFrom","newDateTo","html","e","preventDefault","stopPropagation","shiftDateRange","map","handlePresetChange","ifDefined","minDate","event","selectedDate","checkOutInput","setAttribute","maxDate","handleDateRangeChange","__decorateClass","property","String","prototype","Object","query","state","customElement"],"mappings":";;;;;;;;;;;;;AAYA,IAAqBA,IAArB,cAA+CC;EAA/C,cAAAC;AAAAC,UAAAC,GAAAA,SAAAA,GAE+DC,KAAAC,OAAA,QAgBzBD,KAAAE,oBAAA;AAAA,EAAA;AAAA,EAUrC,oBAAAC;AACCL,UAAMK,kBACNH,GAAAA,KAAKI,iBACLJ,GAAAA,KAAKK,wBAAwB;AAAA,EAAA;AAAA,EAG9B,QAAQC,GAAAA;AACHA,MAAaC,IAAI,MAEpBP,MAAAA,KAAKI,oBACLJ,KAAKK,wBAAAA;AAAAA,EACN;AAAA,EAMO,gBACA;AAAA,WAAAL,KAAKC,SAAS,SAAS,eAAe;AAAA,EAAA;AAAA,EAMtC,mBACA;AAAA,WAAAD,KAAKC,SAAS,SAAS,iBAAiB;AAAA,EAAA;AAAA,EAMxC,mBACD;AAAA,UAAAO,IAASR,KAAKS;AACpBT,SAAKU,eAAe,CACnB,EACCC,OAAO,aACPC,OAAO,EACNC,UAAUC,EAASC,EAAAA,SAAS,GAAG,MAAA,EAAQC,QAAQ,KAAOR,EAAAA,OAAOA,CAC7DS,GAAAA,QAAQH,EAASC,EAAAA,SAAS,GAAG,MAAQG,EAAAA,MAAM,KAAOV,EAAAA,OAAOA,CAE1DW,EAAAA,GAAAA,MAAM,SAEP,EACCR,OAAO,SACPC,OAAO,EACNC,UAAUC,IAASE,QAAQ,KAAA,EAAOR,OA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4.cjs");require("./tailwind.mixin-C3pXEh-C.cjs");const m=require("lit"),r=require("lit/decorators.js"),l=require("lit/directives/if-defined.js"),a=require("moment");var p=Object.defineProperty,y=Object.getOwnPropertyDescriptor,o=(e,t,s,i)=>{for(var d,c=i>1?void 0:i?y(t,s):t,h=e.length-1;h>=0;h--)(d=e[h])&&(c=(i?d(t,s,c):d(c))||c);return i&&c&&p(t,s,c),c};let n=class extends u.$LitElement(){constructor(){super(...arguments),this.type="date",this.selectedDateRange="Today"}connectedCallback(){super.connectedCallback(),this.initPresetRanges(),this.updateSelectedDateRange()}updated(e){e.has("type")&&(this.initPresetRanges(),this.updateSelectedDateRange())}getDateFormat(){return this.type==="date"?"YYYY-MM-DD":"YYYY-MM-DDTHH:mm"}getDisplayFormat(){return this.type==="date"?"MMM DD, YYYY":"MMM DD, YYYY hh:mm A"}initPresetRanges(){const e=this.getDateFormat();this.presetRanges=[{label:"Yesterday",range:{dateFrom:a().subtract(1,"days").startOf("day").format(e),dateTo:a().subtract(1,"days").endOf("day").format(e)},step:"day"},{label:"Today",range:{dateFrom:a().startOf("day").format(e),dateTo:a().endOf("day").format(e)},step:"day"},{label:"Tomorrow",range:{dateFrom:a().add(1,"days").startOf("day").format(e),dateTo:a().add(1,"days").endOf("day").format(e)},step:"day"},{label:"This Week",range:{dateFrom:a().startOf("isoWeek").format(e),dateTo:a().endOf("isoWeek").format(e)},step:"week"},{label:"Last Week",range:{dateFrom:a().subtract(1,"weeks").startOf("isoWeek").format(e),dateTo:a().subtract(1,"weeks").endOf("isoWeek").format(e)},step:"week"},{label:"This Month",range:{dateFrom:a().startOf("month").format(e),dateTo:a().endOf("month").format(e)},step:"month"}]}updateSelectedDateRange(){const e=this.presetRanges.find(t=>t.range.dateFrom===this.dateFrom.value&&t.range.dateTo===this.dateTo.value);this.selectedDateRange=e?e.label:`${a(this.dateFrom.value).format(this.getDisplayFormat())} - ${a(this.dateTo.value).format(this.getDisplayFormat())}`}setDateRange(e,t){this.dateFrom.value=e,this.dateTo.value=t,this.dispatchEvent(new CustomEvent("change",{detail:{dateFrom:e,dateTo:t}})),this.requestUpdate()}handlePresetChange(e){const t=this.presetRanges.find(s=>s.label===e);if(t){const{dateFrom:s,dateTo:i}=t.range;this.setDateRange(s,i),this.selectedDateRange=e,this.schmancyMenu.open=!1}}handleDateRangeChange(){this.setDateRange(this.dateFrom.value,this.dateTo.value),this.updateSelectedDateRange(),this.schmancyMenu.open=!1}shiftDateRange(e){const t=this.getDateFormat(),s=a(this.dateTo.value).diff(a(this.dateFrom.value),"days")||1,i=a(this.dateFrom.value).add(e*s,"days").format(t),d=a(this.dateTo.value).add(e*s,"days").format(t);this.setDateRange(i,d),this.updateSelectedDateRange()}render(){return m.html`
|
|
2
|
+
<div class="date-range-selector relative">
|
|
3
|
+
<schmancy-menu class="z-100 w-max">
|
|
4
|
+
<!-- The button slot: left/right arrows and the display text -->
|
|
5
|
+
<schmancy-grid slot="button" align="center" cols="auto 1fr auto">
|
|
6
|
+
<schmancy-icon-button
|
|
7
|
+
@click=${e=>{e.preventDefault(),e.stopPropagation(),this.shiftDateRange(-1)}}
|
|
8
|
+
>
|
|
9
|
+
arrow_left
|
|
10
|
+
</schmancy-icon-button>
|
|
11
|
+
<schmancy-button class="w-max" variant="outlined" type="button">
|
|
12
|
+
${this.selectedDateRange||"Date range"}
|
|
13
|
+
</schmancy-button>
|
|
14
|
+
<schmancy-icon-button
|
|
15
|
+
@click=${e=>{e.preventDefault(),e.stopPropagation(),this.shiftDateRange(1)}}
|
|
16
|
+
>
|
|
17
|
+
arrow_right
|
|
18
|
+
</schmancy-icon-button>
|
|
19
|
+
</schmancy-grid>
|
|
20
|
+
|
|
21
|
+
<!-- The menu surface -->
|
|
22
|
+
<schmancy-surface elevation="2">
|
|
23
|
+
${this.presetRanges.map(e=>m.html`
|
|
24
|
+
<schmancy-menu-item class="w-full" @click=${()=>this.handlePresetChange(e.label)}>
|
|
25
|
+
<schmancy-grid class="w-full" align="center" cols="auto 1fr auto"> ${e.label} </schmancy-grid>
|
|
26
|
+
</schmancy-menu-item>
|
|
27
|
+
`)}
|
|
28
|
+
<schmancy-grid gap="sm" flow="row" class="p-4">
|
|
29
|
+
<schmancy-input
|
|
30
|
+
id="checkin"
|
|
31
|
+
min=${l.ifDefined(this.minDate)}
|
|
32
|
+
.type=${this.type}
|
|
33
|
+
label="${this.dateFrom.label}"
|
|
34
|
+
.value=${this.dateFrom.value}
|
|
35
|
+
@change=${e=>{e.preventDefault(),e.stopPropagation();const t=this.getDateFormat(),s=a(e.detail.value,t).format(t);this.dateFrom.value=s,this.checkOutInput.setAttribute("min",s)}}
|
|
36
|
+
></schmancy-input>
|
|
37
|
+
<schmancy-input
|
|
38
|
+
id="checkout"
|
|
39
|
+
min=${l.ifDefined(this.dateFrom.value)}
|
|
40
|
+
max=${l.ifDefined(this.maxDate)}
|
|
41
|
+
.type=${this.type}
|
|
42
|
+
label="${this.dateTo.label}"
|
|
43
|
+
.value=${this.dateTo.value}
|
|
44
|
+
@change=${e=>{e.preventDefault(),e.stopPropagation();const t=this.getDateFormat(),s=a(e.detail.value,t).format(t);this.dateTo.value=s}}
|
|
45
|
+
></schmancy-input>
|
|
46
|
+
|
|
47
|
+
<schmancy-button
|
|
48
|
+
variant="outlined"
|
|
49
|
+
@click=${e=>{e.preventDefault(),e.stopPropagation(),this.handleDateRangeChange()}}
|
|
50
|
+
>
|
|
51
|
+
Apply
|
|
52
|
+
</schmancy-button>
|
|
53
|
+
</schmancy-grid>
|
|
54
|
+
</schmancy-surface>
|
|
55
|
+
</schmancy-menu>
|
|
56
|
+
</div>
|
|
57
|
+
`}};o([r.property({type:String})],n.prototype,"type",2),o([r.property({type:Object})],n.prototype,"dateFrom",2),o([r.property({type:Object})],n.prototype,"dateTo",2),o([r.property({type:String})],n.prototype,"minDate",2),o([r.property({type:String})],n.prototype,"maxDate",2),o([r.query("#checkin")],n.prototype,"checkInInput",2),o([r.query("#checkout")],n.prototype,"checkOutInput",2),o([r.query("schmancy-menu")],n.prototype,"schmancyMenu",2),o([r.state()],n.prototype,"selectedDateRange",2),n=o([r.customElement("schmancy-date-range")],n);
|
|
58
|
+
//# sourceMappingURL=date-range-C6ObEwpy.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-range-C6ObEwpy.cjs","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// The input type – either \"date\" or \"datetime-local\".\n\t@property({ type: String }) type: 'date' | 'datetime-local' = 'date'\n\n\t// The date range properties.\n\t@property({ type: Object }) dateFrom!: { label: string; value: string }\n\t@property({ type: Object }) dateTo!: { label: string; value: string }\n\n\t// Optional minimum and maximum dates.\n\t@property({ type: String }) minDate?: string\n\t@property({ type: String }) maxDate?: string\n\n\t// Query elements from the rendered template.\n\t@query('#checkin') checkInInput!: HTMLInputElement\n\t@query('#checkout') checkOutInput!: HTMLInputElement\n\t@query('schmancy-menu') schmancyMenu!: SchmancyMenu\n\n\t// The currently selected preset or custom date range display text.\n\t@state() selectedDateRange: string = 'Today'\n\n\t// Array of preset date ranges.\n\tpresetRanges!: Array<{\n\t\tlabel: string\n\t\trange: { dateFrom: string; dateTo: string }\n\t\tstep: moment.unitOfTime.DurationConstructor\n\t\tselected?: boolean\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// Reinitialize presets if the date input type changes.\n\t\t\tthis.initPresetRanges()\n\t\t\tthis.updateSelectedDateRange()\n\t\t}\n\t}\n\n\t/**\n\t * Returns the date format string based on the current type.\n\t */\n\tprivate getDateFormat(): string {\n\t\treturn this.type === 'date' ? 'YYYY-MM-DD' : 'YYYY-MM-DDTHH:mm'\n\t}\n\n\t/**\n\t * Returns the display format for showing dates.\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 * Initializes the preset date ranges.\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\t// Use ISO week boundaries for consistency.\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// You can add a \"Custom\" option here if needed.\n\t\t]\n\t}\n\n\t/**\n\t * Updates the selectedDateRange state based on the current dateFrom and dateTo values.\n\t */\n\tprivate updateSelectedDateRange() {\n\t\tconst preset = this.presetRanges.find(\n\t\t\trange => range.range.dateFrom === this.dateFrom.value && range.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\tthis.selectedDateRange = `${moment(this.dateFrom.value).format(\n\t\t\t\tthis.getDisplayFormat(),\n\t\t\t)} - ${moment(this.dateTo.value).format(this.getDisplayFormat())}`\n\t\t}\n\t}\n\n\t/**\n\t * Updates the internal date range state and dispatches a change event.\n\t */\n\tsetDateRange(fromDate: string, toDate: string) {\n\t\tthis.dateFrom.value = fromDate\n\t\tthis.dateTo.value = toDate\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent<TSchmancDateRangePayload>('change', {\n\t\t\t\tdetail: { dateFrom: fromDate, dateTo: toDate },\n\t\t\t}),\n\t\t)\n\t\tthis.requestUpdate()\n\t}\n\n\t/**\n\t * Called when a preset is selected. Updates the date range and closes the menu.\n\t */\n\thandlePresetChange(presetLabel: string) {\n\t\tconst preset = this.presetRanges.find(range => range.label === presetLabel)\n\t\tif (preset) {\n\t\t\tconst { dateFrom, dateTo } = preset.range\n\t\t\tthis.setDateRange(dateFrom, dateTo)\n\t\t\tthis.selectedDateRange = presetLabel\n\t\t\t// Close the menu after a preset selection.\n\t\t\tthis.schmancyMenu.open = false\n\t\t}\n\t}\n\n\t/**\n\t * Called when the user applies a manual date change.\n\t */\n\thandleDateRangeChange() {\n\t\tthis.setDateRange(this.dateFrom.value, this.dateTo.value)\n\t\tthis.updateSelectedDateRange()\n\t\t// Close the menu after applying manual changes.\n\t\tthis.schmancyMenu.open = false\n\t}\n\n\t/**\n\t * Shifts the current date range by multiplying the range length with the given factor.\n\t * Use a negative factor to shift backward.\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\t\tthis.setDateRange(newDateFrom, newDateTo)\n\t\tthis.updateSelectedDateRange()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"date-range-selector relative\">\n\t\t\t\t<schmancy-menu class=\"z-100 w-max\">\n\t\t\t\t\t<!-- The button slot: left/right arrows and the display text -->\n\t\t\t\t\t<schmancy-grid slot=\"button\" align=\"center\" cols=\"auto 1fr auto\">\n\t\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t\t\tthis.shiftDateRange(-1)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tarrow_left\n\t\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t\t\t<schmancy-button class=\"w-max\" variant=\"outlined\" type=\"button\">\n\t\t\t\t\t\t\t${this.selectedDateRange || 'Date range'}\n\t\t\t\t\t\t</schmancy-button>\n\t\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t\t\tthis.shiftDateRange(1)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tarrow_right\n\t\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t\t</schmancy-grid>\n\n\t\t\t\t\t<!-- The menu surface -->\n\t\t\t\t\t<schmancy-surface elevation=\"2\">\n\t\t\t\t\t\t${this.presetRanges.map(\n\t\t\t\t\t\t\tpreset => html`\n\t\t\t\t\t\t\t\t<schmancy-menu-item class=\"w-full\" @click=${() => this.handlePresetChange(preset.label)}>\n\t\t\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\t\t</schmancy-menu-item>\n\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<schmancy-grid gap=\"sm\" flow=\"row\" class=\"p-4\">\n\t\t\t\t\t\t\t<schmancy-input\n\t\t\t\t\t\t\t\tid=\"checkin\"\n\t\t\t\t\t\t\t\tmin=${ifDefined(this.minDate)}\n\t\t\t\t\t\t\t\t.type=${this.type}\n\t\t\t\t\t\t\t\tlabel=\"${this.dateFrom.label}\"\n\t\t\t\t\t\t\t\t.value=${this.dateFrom.value}\n\t\t\t\t\t\t\t\t@change=${(event: SchmancyInputChangeEvent) => {\n\t\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\t\t\t\t\tconst format = this.getDateFormat()\n\t\t\t\t\t\t\t\t\tconst selectedDate = moment(event.detail.value, format).format(format)\n\t\t\t\t\t\t\t\t\tthis.dateFrom.value = selectedDate\n\t\t\t\t\t\t\t\t\t// Update the checkout input's minimum date.\n\t\t\t\t\t\t\t\t\tthis.checkOutInput.setAttribute('min', selectedDate)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t></schmancy-input>\n\t\t\t\t\t\t\t<schmancy-input\n\t\t\t\t\t\t\t\tid=\"checkout\"\n\t\t\t\t\t\t\t\tmin=${ifDefined(this.dateFrom.value)}\n\t\t\t\t\t\t\t\tmax=${ifDefined(this.maxDate)}\n\t\t\t\t\t\t\t\t.type=${this.type}\n\t\t\t\t\t\t\t\tlabel=\"${this.dateTo.label}\"\n\t\t\t\t\t\t\t\t.value=${this.dateTo.value}\n\t\t\t\t\t\t\t\t@change=${(event: SchmancyInputChangeEvent) => {\n\t\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\t\t\t\t\tconst format = this.getDateFormat()\n\t\t\t\t\t\t\t\t\tconst selectedDate = moment(event.detail.value, format).format(format)\n\t\t\t\t\t\t\t\t\tthis.dateTo.value = selectedDate\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t></schmancy-input>\n\n\t\t\t\t\t\t\t<schmancy-button\n\t\t\t\t\t\t\t\tvariant=\"outlined\"\n\t\t\t\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t\t\t\tthis.handleDateRangeChange()\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tApply\n\t\t\t\t\t\t\t</schmancy-button>\n\t\t\t\t\t\t</schmancy-grid>\n\t\t\t\t\t</schmancy-surface>\n\t\t\t\t</schmancy-menu>\n\t\t\t</div>\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","value","getDisplayFormat","fromDate","toDate","dispatchEvent","CustomEvent","detail","requestUpdate","presetLabel","setDateRange","schmancyMenu","open","factor","currentDiff","diff","newDateFrom","newDateTo","render","html","e","preventDefault","stopPropagation","shiftDateRange","map","handlePresetChange","ifDefined","minDate","event","selectedDate","checkOutInput","setAttribute","maxDate","handleDateRangeChange","__decorateClass","property","String","prototype","Object","query","state","customElement"],"mappings":"2fAYA,IAAqBA,EAArB,cAA+CC,EAAAA,cAA/C,aAAAC,CAAAC,MAAAC,GAAAA,SAAAA,EAE+DC,KAAAC,KAAA,OAgBzBD,KAAAE,kBAAA,OAAA,CAUrC,mBAAAC,CACCL,MAAMK,kBACNH,EAAAA,KAAKI,iBACLJ,EAAAA,KAAKK,wBAAwB,CAAA,CAG9B,QAAQC,EAAAA,CACHA,EAAaC,IAAI,MAEpBP,IAAAA,KAAKI,mBACLJ,KAAKK,wBAAAA,EACN,CAMO,eACA,CAAA,OAAAL,KAAKC,OAAS,OAAS,aAAe,kBAAA,CAMtC,mBACA,OAAAD,KAAKC,OAAS,OAAS,eAAiB,sBAAA,CAMxC,kBAAAG,CACD,MAAAI,EAASR,KAAKS,cAAAA,EACpBT,KAAKU,aAAe,CACnB,CACCC,MAAO,YACPC,MAAO,CACNC,SAAUC,EAAAA,EAASC,SAAS,EAAG,MAAQC,EAAAA,QAAQ,OAAOR,OAAOA,CAAAA,EAC7DS,OAAQH,EAAAA,EAASC,SAAS,EAAG,QAAQG,MAAM,KAAA,EAAOV,OAAOA,CAAAA,CAAAA,EAE1DW,KAAM,KAAA,EAEP,CACCR,MAAO,QACPC,MAAO,CACNC,SAAUC,EAAAA,EAASE,QAAQ,KAAOR,EAAAA,OAAOA,CACzC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4B,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAMXT,GAAAA,CACTA,EAAEC,eAAAA,EACFD,EAAEE,gBAAAA,EACF5C,KAAKuD,sBAAsB,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAC3B,CArQoBC,EAAAA,EAAA,CAA3BC,WAAS,CAAExD,KAAMyD,MAAAA,CAAAA,CAAAA,EAFE/D,EAEQgE,UAAA,OAAA,GAGAH,EAAA,CAA3BC,WAAS,CAAExD,KAAM2D,MALEjE,CAAAA,CAAAA,EAAAA,EAKQgE,UAAA,WAAA,CAAA,EACAH,EAAA,CAA3BC,WAAS,CAAExD,KAAM2D,UANEjE,EAMQgE,UAAA,SAAA,CAGAH,EAAAA,EAAA,CAA3BC,WAAS,CAAExD,KAAMyD,MAAAA,CAAAA,CAAAA,EATE/D,EASQgE,UAAA,UAAA,CACAH,EAAAA,EAAA,CAA3BC,WAAS,CAAExD,KAAMyD,UAVE/D,EAUQgE,UAAA,UAAA,CAGTH,EAAAA,EAAA,CAAlBK,EAAAA,MAAM,aAbalE,EAaDgE,UAAA,eAAA,CACCH,EAAAA,EAAA,CAAnBK,EAAAA,MAAM,WAdalE,CAAAA,EAAAA,EAcAgE,UAAA,gBAAA,GACIH,EAAA,CAAvBK,EAAAA,MAAM,eAAA,CAAA,EAfalE,EAeIgE,UAAA,eAAA,GAGfH,EAAA,CAARM,EAAMA,MAlBanE,CAAAA,EAAAA,EAkBXgE,UAAA,oBAAA,CAAA,EAlBWhE,EAArB6D,EAAA,CADCO,EAAAA,cAAc,qBACMpE,CAAAA,EAAAA,CAAAA"}
|
package/dist/date-range.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require("./date-range-
|
|
1
|
+
"use strict";require("./date-range-C6ObEwpy.cjs");
|
|
2
2
|
//# sourceMappingURL=date-range.cjs.map
|
package/dist/date-range.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "./date-range-
|
|
1
|
+
import "./date-range-Bf_u0TPH.js";
|
|
2
2
|
//# sourceMappingURL=date-range.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./animated-text-B7ot87Yb.cjs");const r=require("./area.component-Dvbv9xus.cjs");require("./autocomplete-GCjmIPKP.cjs"),require("./spinner-BE0oj65n.cjs");const o=require("./icon-button-CEcYwu6h.cjs"),e=require("./teleport.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./animated-text-B7ot87Yb.cjs");const r=require("./area.component-Dvbv9xus.cjs");require("./autocomplete-GCjmIPKP.cjs"),require("./spinner-BE0oj65n.cjs");const o=require("./icon-button-CEcYwu6h.cjs"),e=require("./teleport.component-CBt5HLNC.cjs"),h=require("./checkbox-B6wuWHQT.cjs");require("./chips-DW4wk4ns.cjs");const S=require("./payment-card-form-ClNJIflz.cjs");require("./date-range-C6ObEwpy.cjs");const y=require("./delay-ZjnwZygz.cjs"),n=require("./ripple-C2BHbhcS.cjs");require("./divider-C-olgct1.cjs"),require("./form-BftBHIa9.cjs"),require("./icon-C3VNzTd2.cjs"),require("./input-Dg9UEyST.cjs");const c=require("./scroll-CUpYxnFS.cjs");require("./menu-BsjLQTfd.cjs");const a=require("./outlet-BMkGxj9Y.cjs");require("./option-CEN9FFeV.cjs");const u=require("./radio-group-Dq8G5fBE.cjs"),b=require("./rxjs-utils.cjs");require("rxjs"),require("./index-DyJ0oDpR.cjs"),require("./select-DSOpxxMT.cjs");const t=require("./sheet-BnBjA5tD.cjs"),m=require("./slider-CJdYHduh.cjs"),l=require("./surface-DxPFMsdk.cjs");require("./table-Co0-nm4Y.cjs"),require("./tabs-group-Doix3mBX.cjs"),require("./textarea-BfNvgfZ_.cjs");const i=require("./theme.component-C_KvokK0.cjs"),d=require("./theme.interface-Xg5Zi46a.cjs");require("./theme-button-CQiYi_67.cjs");const p=require("./tree-BGkPGaY8.cjs"),g=require("./types.cjs"),f=require("./typewriter-ChAfM5s5.cjs"),q=require("./typography-NRVaaUrd.cjs");exports.FINDING_MORTIES=r.FINDING_MORTIES,exports.HERE_RICKY=r.HERE_RICKY,exports.HISTORY_STRATEGY=r.HISTORY_STRATEGY,Object.defineProperty(exports,"SchmancyArea",{enumerable:!0,get:()=>r.SchmancyArea}),exports.area=r.area,exports.routerHistory=r.routerHistory,Object.defineProperty(exports,"SchmnacyButton",{enumerable:!0,get:()=>o.SchmnacyButton}),Object.defineProperty(exports,"SchmnacyIconButton",{enumerable:!0,get:()=>o.SchmnacyIconButton}),exports.HereMorty=e.HereMorty,Object.defineProperty(exports,"List",{enumerable:!0,get:()=>e.List}),Object.defineProperty(exports,"SchmancyContentDrawer",{enumerable:!0,get:()=>e.SchmancyContentDrawer}),exports.SchmancyContentDrawerID=e.SchmancyContentDrawerID,Object.defineProperty(exports,"SchmancyContentDrawerMain",{enumerable:!0,get:()=>e.SchmancyContentDrawerMain}),exports.SchmancyContentDrawerMaxHeight=e.SchmancyContentDrawerMaxHeight,exports.SchmancyContentDrawerMinWidth=e.SchmancyContentDrawerMinWidth,Object.defineProperty(exports,"SchmancyContentDrawerSheet",{enumerable:!0,get:()=>e.SchmancyContentDrawerSheet}),exports.SchmancyContentDrawerSheetMode=e.SchmancyContentDrawerSheetMode,exports.SchmancyContentDrawerSheetState=e.SchmancyContentDrawerSheetState,Object.defineProperty(exports,"SchmancyDrawerAppbar",{enumerable:!0,get:()=>e.SchmancyDrawerAppbar}),exports.SchmancyDrawerNavbarMode=e.SchmancyDrawerNavbarMode,exports.SchmancyDrawerNavbarState=e.SchmancyDrawerNavbarState,Object.defineProperty(exports,"SchmancyListItem",{enumerable:!0,get:()=>e.SchmancyListItem}),Object.defineProperty(exports,"SchmancyNavigationDrawer",{enumerable:!0,get:()=>e.SchmancyNavigationDrawer}),Object.defineProperty(exports,"SchmancyNavigationDrawerContent",{enumerable:!0,get:()=>e.SchmancyNavigationDrawerContent}),Object.defineProperty(exports,"SchmancyNavigationDrawerSidebar",{enumerable:!0,get:()=>e.SchmancyNavigationDrawerSidebar}),Object.defineProperty(exports,"SchmancyTeleportation",{enumerable:!0,get:()=>e.SchmancyTeleportation}),exports.WhereAreYouRicky=e.WhereAreYouRicky,exports.schmancyContentDrawer=e.schmancyContentDrawer,exports.schmancyNavDrawer=e.schmancyNavDrawer,exports.teleport=e.teleport,Object.defineProperty(exports,"SchmancyCheckbox",{enumerable:!0,get:()=>h.SchmancyCheckbox}),Object.defineProperty(exports,"SchmancyPaymentCardForm",{enumerable:!0,get:()=>S.SchmancyPaymentCardForm}),Object.defineProperty(exports,"SchmancyDelay",{enumerable:!0,get:()=>y.SchmancyDelay}),exports.delayContext=y.delayContext,exports.color=n.color,exports.fullHeight=n.fullHeight,exports.ripple=n.ripple,Object.defineProperty(exports,"SchmancyFlex",{enumerable:!0,get:()=>c.SchmancyFlex}),Object.defineProperty(exports,"SchmancyGrid",{enumerable:!0,get:()=>c.SchmancyGrid}),Object.defineProperty(exports,"SchmancyScroll",{enumerable:!0,get:()=>c.SchmancyScroll}),exports.$notify=a.$notify,Object.defineProperty(exports,"SchmancyNotification",{enumerable:!0,get:()=>a.SchmancyNotification}),Object.defineProperty(exports,"SchmancyNotificationOutlet",{enumerable:!0,get:()=>a.SchmancyNotificationOutlet}),Object.defineProperty(exports,"RadioGroup",{enumerable:!0,get:()=>u.RadioGroup}),exports.mutationObserver=b.mutationObserver,exports.SchmancySheetPosition=t.SchmancySheetPosition,exports.SheetHereMorty=t.SheetHereMorty,exports.SheetWhereAreYouRicky=t.SheetWhereAreYouRicky,exports.hook=t.hook,exports.sheet=t.sheet,Object.defineProperty(exports,"SchmancySlide",{enumerable:!0,get:()=>m.SchmancySlide}),Object.defineProperty(exports,"SchmancySlider",{enumerable:!0,get:()=>m.SchmancySlider}),Object.defineProperty(exports,"SchmancySurface",{enumerable:!0,get:()=>l.SchmancySurface}),Object.defineProperty(exports,"SchmancyThemeComponent",{enumerable:!0,get:()=>i.SchmancyThemeComponent}),exports.formateTheme=i.formateTheme,exports.tailwindStyles=i.tailwindStyles,exports.SchmancyTheme=d.SchmancyTheme,Object.defineProperty(exports,"SchmancyTree",{enumerable:!0,get:()=>p.SchmancyTree}),exports.SchmancyEvents=g.SchmancyEvents,Object.defineProperty(exports,"TypewriterElement",{enumerable:!0,get:()=>f.TypewriterElement}),Object.defineProperty(exports,"SchmancyTypography",{enumerable:!0,get:()=>q.SchmancyTypography});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -3,17 +3,17 @@ import { F as d, H as T, b, S as u, a as N, r as H } from "./area.component-BlcO
|
|
|
3
3
|
import "./autocomplete-vfdJnjAx.js";
|
|
4
4
|
import "./spinner-Cz48LKw5.js";
|
|
5
5
|
import { S as v, a as I } from "./icon-button-cThH-HDx.js";
|
|
6
|
-
import { H as g, L as E, e as k, b as A, f as Y, c as F, d as G, g as O, S as W, a as L, j as _, l as B, m as P, h as $, n as j, k as K, o as q, p as z, W as J, s as Q, i as U, t as V } from "./teleport.component-
|
|
6
|
+
import { H as g, L as E, e as k, b as A, f as Y, c as F, d as G, g as O, S as W, a as L, j as _, l as B, m as P, h as $, n as j, k as K, o as q, p as z, W as J, s as Q, i as U, t as V } from "./teleport.component-Dc1Ygxut.js";
|
|
7
7
|
import { S as Z } from "./checkbox-BrVJwQYt.js";
|
|
8
8
|
import "./chips-CCNEOlx2.js";
|
|
9
9
|
import { S as ra } from "./payment-card-form-CSjKMW71.js";
|
|
10
|
-
import "./date-range-
|
|
10
|
+
import "./date-range-Bf_u0TPH.js";
|
|
11
11
|
import { S as ta, d as oa } from "./delay-DrTqFWuI.js";
|
|
12
12
|
import { c as ma, f as na, r as sa } from "./ripple-BumgqsDT.js";
|
|
13
13
|
import "./divider-DE_qGu0Z.js";
|
|
14
14
|
import "./form-CiopR1cw.js";
|
|
15
15
|
import "./icon-uV29Oo_I.js";
|
|
16
|
-
import "./input-
|
|
16
|
+
import "./input-CjHwAdCr.js";
|
|
17
17
|
import { S as ha, a as ia, b as ya } from "./scroll-BJ_3vZ-c.js";
|
|
18
18
|
import "./menu-CK0Aunqg.js";
|
|
19
19
|
import { $ as fa, S as xa, a as Da } from "./outlet-CbHO2KGb.js";
|
|
@@ -92,7 +92,7 @@ let e = class extends R() {
|
|
|
92
92
|
.value=${this.value}
|
|
93
93
|
id=${this.id}
|
|
94
94
|
name=${this.name}
|
|
95
|
-
type=${this.type}
|
|
95
|
+
.type=${this.type}
|
|
96
96
|
step=${a(this.step)}
|
|
97
97
|
.autocomplete=${this.autocomplete}
|
|
98
98
|
placeholder=${this.placeholder}
|
|
@@ -121,4 +121,4 @@ let e = class extends R() {
|
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
123
|
e.formAssociated = !0, e.shadowRootOptions = { ...$.shadowRootOptions, delegatesFocus: !0 }, i([r()], e.prototype, "label", 2), i([r({ reflect: !0 })], e.prototype, "type", 2), i([r({ type: Boolean, reflect: !0 })], e.prototype, "clickable", 2), i([r()], e.prototype, "name", 2), i([r()], e.prototype, "placeholder", 2), i([r({ type: String, reflect: !0 })], e.prototype, "value", 2), i([r({ type: String, reflect: !0 })], e.prototype, "pattern", 2), i([r({ type: Boolean, reflect: !0 })], e.prototype, "required", 2), i([r({ type: Boolean, reflect: !0 })], e.prototype, "disabled", 2), i([r({ type: Boolean, reflect: !0 })], e.prototype, "readonly", 2), i([r({ type: Boolean, reflect: !0 })], e.prototype, "spellcheck", 2), i([r({ type: String, reflect: !0 })], e.prototype, "align", 2), i([r()], e.prototype, "inputmode", 2), i([r({ type: Number })], e.prototype, "minlength", 2), i([r({ type: Number })], e.prototype, "maxlength", 2), i([r()], e.prototype, "min", 2), i([r()], e.prototype, "max", 2), i([r({ type: Number, reflect: !0 })], e.prototype, "step", 2), i([r({ type: Boolean })], e.prototype, "autofocus", 2), i([r({ type: String })], e.prototype, "autocomplete", 2), i([r({ type: Number, reflect: !0 })], e.prototype, "tabIndex", 2), i([r()], e.prototype, "hint", 2), i([r({ type: Boolean, reflect: !0 })], e.prototype, "error", 2), i([x("input")], e.prototype, "inputElement", 2), e = i([E("schmancy-input")], e);
|
|
124
|
-
//# sourceMappingURL=input-
|
|
124
|
+
//# sourceMappingURL=input-CjHwAdCr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-CjHwAdCr.js","sources":["../src/input/input.ts"],"sourcesContent":["import { LitElement, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js' // <-- Import if not provided by TailwindElement\nimport { ifDefined } from 'lit/directives/if-defined.js'\nimport { createRef, ref } from 'lit/directives/ref.js'\nimport { when } from 'lit/directives/when.js'\nimport { distinctUntilChanged, filter, fromEvent, map } from 'rxjs'\n\n// If TailwindElement extends LitElement and has extra mixins, import it.\n// Otherwise, just extend LitElement. Adjust accordingly.\nimport { TailwindElement } from '@mixins/index'\n\n// color directive + theme interface\nimport { color } from '@schmancy/directives'\nimport { SchmancyTheme } from '@schmancy/theme/theme.interface'\n\n// If you want to be form-associated, you can define the type on `ElementInternals`.\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-input': SchmancyInput\n\t}\n}\n\ntype EventDetails = {\n\tvalue: string\n}\n\nexport type SchmancyInputChangeEvent = CustomEvent<EventDetails>\n\n/**\n * `schmancy-input` – A custom input component.\n */\n@customElement('schmancy-input')\nexport default class SchmancyInput extends TailwindElement() {\n\t/**\n\t * The label of the control.\n\t * @attr\n\t * @type {string}\n\t * @default ''\n\t */\n\t@property() label = ''\n\n\t/**\n\t * The type of the control.\n\t * @attr\n\t * @default 'text'\n\t */\n\t@property({ reflect: true })\n\tpublic type:\n\t\t| 'email'\n\t\t| 'number'\n\t\t| 'password'\n\t\t| 'search'\n\t\t| 'tel'\n\t\t| 'text'\n\t\t| 'url'\n\t\t| 'date'\n\t\t| 'datetime-local'\n\t\t| 'time'\n\t\t| 'month'\n\t\t| 'week'\n\t\t| 'color'\n\t\t| 'file' = 'text'\n\n\t@property({ type: Boolean, reflect: true }) public clickable = false\n\n\t/**\n\t * The name of the control.\n\t * @attr\n\t * @default 'name_' + Date.now()\n\t */\n\t@property() name = 'name_' + Date.now()\n\n\t/**\n\t * The placeholder of the control.\n\t * @attr\n\t * @default ''\n\t */\n\t@property() placeholder = ''\n\n\t/**\n\t * The value of the control.\n\t * @attr\n\t * @default ''\n\t */\n\t@property({ type: String, reflect: true }) public value = ''\n\n\t/**\n\t * The pattern attribute of the control.\n\t * @attr\n\t */\n\t@property({ type: String, reflect: true })\n\tpublic pattern?: string\n\n\t@property({ type: Boolean, reflect: true }) required = false\n\t@property({ type: Boolean, reflect: true }) disabled = false\n\t@property({ type: Boolean, reflect: true }) readonly = false\n\t@property({ type: Boolean, reflect: true }) spellcheck = false\n\n\t@property({ type: String, reflect: true }) align: 'left' | 'center' | 'right' = 'left'\n\n\t/**\n\t * The inputmode attribute of the control.\n\t * @attr\n\t * @default undefined\n\t */\n\t@property()\n\tpublic inputmode?: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'\n\n\t/**\n\t * The minlength attribute of the control.\n\t * @attr\n\t */\n\t@property({ type: Number })\n\tpublic minlength?: number\n\n\t/**\n\t * The maxlength attribute of the control.\n\t * @attr\n\t */\n\t@property({ type: Number })\n\tpublic maxlength?: number\n\n\t/**\n\t * The min attribute of the control.\n\t * @attr\n\t */\n\t@property()\n\tpublic min?: string\n\n\t/**\n\t * The max attribute of the control.\n\t * @attr\n\t */\n\t@property()\n\tpublic max?: string\n\n\t/**\n\t * The step attribute of the control.\n\t * @attr\n\t */\n\t@property({ type: Number, reflect: true })\n\tpublic step?: number\n\n\t/**\n\t * The autofocus attribute of the control.\n\t * @attr\n\t * @default false\n\t */\n\t@property({ type: Boolean })\n\tpublic autofocus = false\n\n\t/**\n\t * The autocomplete attribute of the control.\n\t * @attr\n\t */\n\t@property({ type: String })\n\tpublic autocomplete: AutoFill = 'off'\n\n\t/**\n\t * tabIndex for focusing by tab key.\n\t */\n\t@property({ type: Number, reflect: true })\n\tpublic tabIndex = 0\n\n\t@property()\n\thint?: string\n\n\t@property({ type: Boolean, reflect: true }) public error = false\n\n\t@query('input') inputElement!: HTMLInputElement\n\tinputRef = createRef<HTMLInputElement>()\n\n\t/** Form-associated custom elements support. */\n\tstatic formAssociated = true\n\tprotected static shadowRootOptions = {\n\t\t...LitElement.shadowRootOptions,\n\t\tdelegatesFocus: true,\n\t}\n\n\tprivate internals?: ElementInternals\n\n\tconstructor() {\n\t\tsuper()\n\t\tif ('attachInternals' in this) {\n\t\t\ttry {\n\t\t\t\tthis.internals = this.attachInternals()\n\t\t\t} catch {\n\t\t\t\t// older browsers or polyfills might fail\n\t\t\t\tthis.internals = undefined\n\t\t\t}\n\t\t}\n\t}\n\n\tget form() {\n\t\treturn this.internals?.form ?? null\n\t}\n\n\t/**\n\t * (Optional) Whenever value changes, sync with form internals for\n\t * form submission (if you're using form-associated custom elements).\n\t */\n\tprotected updated(changedProps: Map<string, unknown>) {\n\t\tsuper.updated(changedProps)\n\t\tif (changedProps.has('value')) {\n\t\t\tthis.internals?.setFormValue(this.value)\n\t\t}\n\t}\n\n\t/** Checks for validity of the control and shows the browser message if it's invalid. */\n\tpublic reportValidity() {\n\t\treturn this.inputRef.value?.reportValidity()\n\t}\n\n\t/** Checks for validity of the control and emits the invalid event if it is invalid. */\n\tpublic checkValidity() {\n\t\treturn this.inputRef.value?.checkValidity()\n\t}\n\n\t/** Sets a custom validity message. */\n\tpublic setCustomValidity(message: string) {\n\t\tthis.inputRef.value?.setCustomValidity(message)\n\t}\n\n\tfirstUpdated() {\n\t\tif (this.autofocus) {\n\t\t\tthis.focus()\n\t\t}\n\n\t\t// Subscribe to 'input' changes\n\t\tfromEvent<InputEvent>(this.inputElement, 'input')\n\t\t\t.pipe(\n\t\t\t\tmap(event => (event.target as HTMLInputElement).value),\n\t\t\t\tdistinctUntilChanged(),\n\t\t\t)\n\t\t\t.subscribe(value => {\n\t\t\t\tthis.value = value\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent<EventDetails>('change', {\n\t\t\t\t\t\tdetail: { value },\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t})\n\n\t\t// Subscribe to 'change' changes (on blur for native inputs)\n\t\tfromEvent<Event>(this.inputElement, 'change')\n\t\t\t.pipe(\n\t\t\t\tmap(event => (event.target as HTMLInputElement).value),\n\t\t\t\tdistinctUntilChanged(),\n\t\t\t)\n\t\t\t.subscribe(value => {\n\t\t\t\tthis.value = value\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent<EventDetails>('change', {\n\t\t\t\t\t\tdetail: { value },\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t})\n\n\t\t// Emit custom event on Enter key\n\t\tfromEvent<KeyboardEvent>(this.inputElement, 'keyup')\n\t\t\t.pipe(filter(event => event.key === 'Enter'))\n\t\t\t.subscribe(event => {\n\t\t\t\tconst { value } = event.target as HTMLInputElement\n\t\t\t\t// You can remove `distinctUntilChanged()` here if you want *every* Enter\n\t\t\t\t// press to dispatch, even if the value hasn't changed.\n\t\t\t\tthis.value = value\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent<EventDetails>('change', {\n\t\t\t\t\t\tdetail: { value },\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent<EventDetails>('enter', {\n\t\t\t\t\t\tdetail: { value },\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t})\n\n\t\t// Detect autofill animation\n\t\tfromEvent<AnimationEvent>(this.inputElement, 'animationstart')\n\t\t\t.pipe(filter(ev => ev.animationName === 'onAutoFillStart'))\n\t\t\t.subscribe(event => {\n\t\t\t\tconst { value } = event.target as HTMLInputElement\n\t\t\t\tthis.value = value\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent<EventDetails>('change', {\n\t\t\t\t\t\tdetail: { value },\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t})\n\t}\n\n\t/** Selects all text within the input. */\n\tpublic select() {\n\t\treturn this.inputRef.value?.select()\n\t}\n\n\t/** Returns the internal validity state object. */\n\tpublic getValidity(): ValidityState | undefined {\n\t\treturn this.inputRef.value?.validity\n\t}\n\n\t/**\n\t * Override focus so that focusing <schmancy-input> actually focuses\n\t * the internal <input>.\n\t */\n\tpublic override focus(options?: FocusOptions) {\n\t\tthis.inputRef.value?.focus(options)\n\t\tthis.dispatchEvent(new Event('focus'))\n\t}\n\n\t/**\n\t * Same with click; bubble a click out if needed, but delegate to internal input.\n\t */\n\tpublic override click() {\n\t\tthis.inputRef.value?.click()\n\t\tthis.dispatchEvent(new Event('click'))\n\t}\n\n\t/**\n\t * Same with blur; bubble the event.\n\t */\n\tpublic override blur() {\n\t\tthis.inputRef.value?.blur()\n\t\tthis.dispatchEvent(new Event('blur'))\n\t}\n\n\tprotected override render() {\n\t\tconst inputClasses = {\n\t\t\t'w-full flex-1 h-[50px] rounded-[8px] border-0 px-[8px] sm:px-[12px] md:px-[16px]': true,\n\t\t\t'disabled:opacity-40 disabled:cursor-not-allowed': true,\n\t\t\t'placeholder:text-muted': true,\n\t\t\t'ring-0 ring-inset focus:ring-1 focus:ring-inset': true,\n\t\t\t'ring-primary-default ring-outline focus:ring-primary-default': !this.error,\n\t\t\t'ring-error-default focus:ring-error-default': this.error,\n\t\t\t'caret-transparent focus:outline-hidden cursor-pointer text-select-none': this.readonly,\n\t\t\t'cursor-pointer': this.clickable,\n\t\t\t'text-center': this.align === 'center',\n\t\t\t'text-right': this.align === 'right',\n\t\t}\n\t\tconst labelClasses = {\n\t\t\t'opacity-40': this.disabled,\n\t\t\t'block mb-[4px]': true,\n\t\t}\n\t\treturn html`\n\t\t\t${when(\n\t\t\t\tthis.label,\n\t\t\t\t() => html`\n\t\t\t\t\t<label\n\t\t\t\t\t\t${color({\n\t\t\t\t\t\t\tcolor: this.error ? SchmancyTheme.sys.color.error.default : SchmancyTheme.sys.color.primary.default,\n\t\t\t\t\t\t})}\n\t\t\t\t\t\tclass=\"${classMap(labelClasses)}\"\n\t\t\t\t\t\tfor=${this.id}\n\t\t\t\t\t>\n\t\t\t\t\t\t<schmancy-typography type=\"label\" token=\"lg\">${this.label}</schmancy-typography>\n\t\t\t\t\t</label>\n\t\t\t\t`,\n\t\t\t)}\n\t\t\t<input\n\t\t\t\t${color({\n\t\t\t\t\tbgColor: SchmancyTheme.sys.color.surface.highest,\n\t\t\t\t\tcolor: SchmancyTheme.sys.color.surface.on,\n\t\t\t\t})}\n\t\t\t\t${ref(this.inputRef)}\n\t\t\t\t.value=${this.value}\n\t\t\t\tid=${this.id}\n\t\t\t\tname=${this.name}\n\t\t\t\t.type=${this.type}\n\t\t\t\tstep=${ifDefined(this.step)}\n\t\t\t\t.autocomplete=${this.autocomplete}\n\t\t\t\tplaceholder=${this.placeholder}\n\t\t\t\t?required=${this.required}\n\t\t\t\tinputmode=${ifDefined(this.inputmode)}\n\t\t\t\tclass=${classMap(inputClasses)}\n\t\t\t\t?disabled=${this.disabled}\n\t\t\t\t?readOnly=${this.readonly}\n\t\t\t\tminlength=${ifDefined(this.minlength)}\n\t\t\t\tmaxlength=${ifDefined(this.maxlength)}\n\t\t\t\tmin=${ifDefined(this.min)}\n\t\t\t\tmax=${ifDefined(this.max)}\n\t\t\t\tpattern=${ifDefined(this.pattern)}\n\t\t\t/>\n\t\t\t${when(\n\t\t\t\tthis.hint,\n\t\t\t\t() => html`\n\t\t\t\t\t<schmancy-typography\n\t\t\t\t\t\t${color({\n\t\t\t\t\t\t\tcolor: this.error ? SchmancyTheme.sys.color.error.default : SchmancyTheme.sys.color.primary.default,\n\t\t\t\t\t\t})}\n\t\t\t\t\t\tclass=\"pt-[4px]\"\n\t\t\t\t\t\ttype=\"body\"\n\t\t\t\t\t\ttoken=\"sm\"\n\t\t\t\t\t>\n\t\t\t\t\t\t${this.hint}\n\t\t\t\t\t</schmancy-typography>\n\t\t\t\t`,\n\t\t\t)}\n\t\t`\n\t}\n}\n"],"names":["SchmancyInput","TailwindElement","constructor","super","this","label","type","clickable","name","Date","now","placeholder","value","required","disabled","readonly","spellcheck","align","autofocus","autocomplete","tabIndex","error","inputRef","createRef","internals","attachInternals","form","changedProps","updated","has","setFormValue","reportValidity","checkValidity","message","setCustomValidity","focus","fromEvent","inputElement","pipe","map","event","target","distinctUntilChanged","subscribe","dispatchEvent","CustomEvent","detail","bubbles","composed","filter","key","ev","animationName","select","validity","options","Event","click","blur","inputClasses","labelClasses","html","when","color","SchmancyTheme","sys","default","primary","classMap","id","bgColor","surface","highest","on","ref","ifDefined","step","inputmode","minlength","maxlength","min","max","pattern","hint","formAssociated","shadowRootOptions","LitElement","delegatesFocus","__decorateClass","property","prototype","reflect","Boolean","String","Number","query","customElement"],"mappings":";;;;;;;;;;;;;;;AAiCA,IAAqBA,IAArB,cAA2CC,EAAAA,EAAAA;AAAAA,EAqJ1C,cAAAC;AAEC,QADMC,MAAAA,GA/IaC,KAAAC,QAAA,IAQpBD,KAAOE,OAcK,QAEgCF,KAAOG,gBAOhCH,KAAAI,OAAA,UAAUC,KAAKC,IAAAA,GAORN,KAAAO,cAAA,IAOiBP,KAAOQ,QAAQ,IASHR,KAAAS,eACAT,KAAAU,WAAA,IACAV,KAAAW,WAAAA,IACEX,KAAAY,aAAAA,IAEuBZ,KAAAa,QAAA,QAmDhFb,KAAOc,YAAY,IA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b0F,WAAA,aAAA,CAAA,GAOAF,EAAA,CADNC,EA9FmBzF,CAAAA,GAAAA,EA+Fb0F,WAAA,OAAA,CAOAF,GAAAA,EAAA,CADNC,EAAAA,CAAAA,GArGmBzF,EAsGb0F,WAAA,OAAA,CAAA,GAOAF,EAAA,CADNC,EAAS,EAAEnF,MAAMwF,QAAQH,SAAS,GAAA,CAAA,CAAA,GA5Gf3F,EA6Gb0F,WAAA,QAAA,CAAA,GAQAF,EAAA,CADNC,EAAS,EAAEnF,MAAMsF,QAAAA,CAAAA,CAAAA,GApHE5F,EAqHb0F,WAAA,aAAA,CAAA,GAOAF,EAAA,CADNC,EAAS,EAAEnF,MAAMuF,OAAAA,CAAAA,CAAAA,GA3HE7F,EA4Hb0F,WAAA,gBAAA,CAAA,GAMAF,EAAA,CADNC,EAAS,EAAEnF,MAAMwF,QAAQH,SAAS,GAAA,CAAA,CAAA,GAjIf3F,EAkIb0F,WAAA,YAAA,CAAA,GAGPF,EAAA,CADCC,EApImBzF,CAAAA,GAAAA,EAqIpB0F,WAAA,QAAA,CAEmDF,GAAAA,EAAA,CAAlDC,EAAS,EAAEnF,MAAMsF,SAASD,SAAAA,GAvIP3F,CAAAA,CAAAA,GAAAA,EAuI+B0F,WAAA,SAAA,CAEnCF,GAAAA,EAAA,CAAfO,EAAM,OAzIa/F,CAAAA,GAAAA,EAyIJ0F,WAAA,gBAAA,CAzII1F,GAAAA,IAArBwF,EAAA,CADCQ,EAAc,gBACMhG,CAAAA,GAAAA,CAAAA;"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
.value=${this.value}
|
|
15
15
|
id=${this.id}
|
|
16
16
|
name=${this.name}
|
|
17
|
-
type=${this.type}
|
|
17
|
+
.type=${this.type}
|
|
18
18
|
step=${n.ifDefined(this.step)}
|
|
19
19
|
.autocomplete=${this.autocomplete}
|
|
20
20
|
placeholder=${this.placeholder}
|
|
@@ -40,4 +40,4 @@
|
|
|
40
40
|
</schmancy-typography>
|
|
41
41
|
`)}
|
|
42
42
|
`}};t.formAssociated=!0,t.shadowRootOptions={...h.LitElement.shadowRootOptions,delegatesFocus:!0},i([r.property()],t.prototype,"label",2),i([r.property({reflect:!0})],t.prototype,"type",2),i([r.property({type:Boolean,reflect:!0})],t.prototype,"clickable",2),i([r.property()],t.prototype,"name",2),i([r.property()],t.prototype,"placeholder",2),i([r.property({type:String,reflect:!0})],t.prototype,"value",2),i([r.property({type:String,reflect:!0})],t.prototype,"pattern",2),i([r.property({type:Boolean,reflect:!0})],t.prototype,"required",2),i([r.property({type:Boolean,reflect:!0})],t.prototype,"disabled",2),i([r.property({type:Boolean,reflect:!0})],t.prototype,"readonly",2),i([r.property({type:Boolean,reflect:!0})],t.prototype,"spellcheck",2),i([r.property({type:String,reflect:!0})],t.prototype,"align",2),i([r.property()],t.prototype,"inputmode",2),i([r.property({type:Number})],t.prototype,"minlength",2),i([r.property({type:Number})],t.prototype,"maxlength",2),i([r.property()],t.prototype,"min",2),i([r.property()],t.prototype,"max",2),i([r.property({type:Number,reflect:!0})],t.prototype,"step",2),i([r.property({type:Boolean})],t.prototype,"autofocus",2),i([r.property({type:String})],t.prototype,"autocomplete",2),i([r.property({type:Number,reflect:!0})],t.prototype,"tabIndex",2),i([r.property()],t.prototype,"hint",2),i([r.property({type:Boolean,reflect:!0})],t.prototype,"error",2),i([r.query("input")],t.prototype,"inputElement",2),t=i([r.customElement("schmancy-input")],t);
|
|
43
|
-
//# sourceMappingURL=input-
|
|
43
|
+
//# sourceMappingURL=input-Dg9UEyST.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-Dg9UEyST.cjs","sources":["../src/input/input.ts"],"sourcesContent":["import { LitElement, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js' // <-- Import if not provided by TailwindElement\nimport { ifDefined } from 'lit/directives/if-defined.js'\nimport { createRef, ref } from 'lit/directives/ref.js'\nimport { when } from 'lit/directives/when.js'\nimport { distinctUntilChanged, filter, fromEvent, map } from 'rxjs'\n\n// If TailwindElement extends LitElement and has extra mixins, import it.\n// Otherwise, just extend LitElement. Adjust accordingly.\nimport { TailwindElement } from '@mixins/index'\n\n// color directive + theme interface\nimport { color } from '@schmancy/directives'\nimport { SchmancyTheme } from '@schmancy/theme/theme.interface'\n\n// If you want to be form-associated, you can define the type on `ElementInternals`.\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-input': SchmancyInput\n\t}\n}\n\ntype EventDetails = {\n\tvalue: string\n}\n\nexport type SchmancyInputChangeEvent = CustomEvent<EventDetails>\n\n/**\n * `schmancy-input` – A custom input component.\n */\n@customElement('schmancy-input')\nexport default class SchmancyInput extends TailwindElement() {\n\t/**\n\t * The label of the control.\n\t * @attr\n\t * @type {string}\n\t * @default ''\n\t */\n\t@property() label = ''\n\n\t/**\n\t * The type of the control.\n\t * @attr\n\t * @default 'text'\n\t */\n\t@property({ reflect: true })\n\tpublic type:\n\t\t| 'email'\n\t\t| 'number'\n\t\t| 'password'\n\t\t| 'search'\n\t\t| 'tel'\n\t\t| 'text'\n\t\t| 'url'\n\t\t| 'date'\n\t\t| 'datetime-local'\n\t\t| 'time'\n\t\t| 'month'\n\t\t| 'week'\n\t\t| 'color'\n\t\t| 'file' = 'text'\n\n\t@property({ type: Boolean, reflect: true }) public clickable = false\n\n\t/**\n\t * The name of the control.\n\t * @attr\n\t * @default 'name_' + Date.now()\n\t */\n\t@property() name = 'name_' + Date.now()\n\n\t/**\n\t * The placeholder of the control.\n\t * @attr\n\t * @default ''\n\t */\n\t@property() placeholder = ''\n\n\t/**\n\t * The value of the control.\n\t * @attr\n\t * @default ''\n\t */\n\t@property({ type: String, reflect: true }) public value = ''\n\n\t/**\n\t * The pattern attribute of the control.\n\t * @attr\n\t */\n\t@property({ type: String, reflect: true })\n\tpublic pattern?: string\n\n\t@property({ type: Boolean, reflect: true }) required = false\n\t@property({ type: Boolean, reflect: true }) disabled = false\n\t@property({ type: Boolean, reflect: true }) readonly = false\n\t@property({ type: Boolean, reflect: true }) spellcheck = false\n\n\t@property({ type: String, reflect: true }) align: 'left' | 'center' | 'right' = 'left'\n\n\t/**\n\t * The inputmode attribute of the control.\n\t * @attr\n\t * @default undefined\n\t */\n\t@property()\n\tpublic inputmode?: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'\n\n\t/**\n\t * The minlength attribute of the control.\n\t * @attr\n\t */\n\t@property({ type: Number })\n\tpublic minlength?: number\n\n\t/**\n\t * The maxlength attribute of the control.\n\t * @attr\n\t */\n\t@property({ type: Number })\n\tpublic maxlength?: number\n\n\t/**\n\t * The min attribute of the control.\n\t * @attr\n\t */\n\t@property()\n\tpublic min?: string\n\n\t/**\n\t * The max attribute of the control.\n\t * @attr\n\t */\n\t@property()\n\tpublic max?: string\n\n\t/**\n\t * The step attribute of the control.\n\t * @attr\n\t */\n\t@property({ type: Number, reflect: true })\n\tpublic step?: number\n\n\t/**\n\t * The autofocus attribute of the control.\n\t * @attr\n\t * @default false\n\t */\n\t@property({ type: Boolean })\n\tpublic autofocus = false\n\n\t/**\n\t * The autocomplete attribute of the control.\n\t * @attr\n\t */\n\t@property({ type: String })\n\tpublic autocomplete: AutoFill = 'off'\n\n\t/**\n\t * tabIndex for focusing by tab key.\n\t */\n\t@property({ type: Number, reflect: true })\n\tpublic tabIndex = 0\n\n\t@property()\n\thint?: string\n\n\t@property({ type: Boolean, reflect: true }) public error = false\n\n\t@query('input') inputElement!: HTMLInputElement\n\tinputRef = createRef<HTMLInputElement>()\n\n\t/** Form-associated custom elements support. */\n\tstatic formAssociated = true\n\tprotected static shadowRootOptions = {\n\t\t...LitElement.shadowRootOptions,\n\t\tdelegatesFocus: true,\n\t}\n\n\tprivate internals?: ElementInternals\n\n\tconstructor() {\n\t\tsuper()\n\t\tif ('attachInternals' in this) {\n\t\t\ttry {\n\t\t\t\tthis.internals = this.attachInternals()\n\t\t\t} catch {\n\t\t\t\t// older browsers or polyfills might fail\n\t\t\t\tthis.internals = undefined\n\t\t\t}\n\t\t}\n\t}\n\n\tget form() {\n\t\treturn this.internals?.form ?? null\n\t}\n\n\t/**\n\t * (Optional) Whenever value changes, sync with form internals for\n\t * form submission (if you're using form-associated custom elements).\n\t */\n\tprotected updated(changedProps: Map<string, unknown>) {\n\t\tsuper.updated(changedProps)\n\t\tif (changedProps.has('value')) {\n\t\t\tthis.internals?.setFormValue(this.value)\n\t\t}\n\t}\n\n\t/** Checks for validity of the control and shows the browser message if it's invalid. */\n\tpublic reportValidity() {\n\t\treturn this.inputRef.value?.reportValidity()\n\t}\n\n\t/** Checks for validity of the control and emits the invalid event if it is invalid. */\n\tpublic checkValidity() {\n\t\treturn this.inputRef.value?.checkValidity()\n\t}\n\n\t/** Sets a custom validity message. */\n\tpublic setCustomValidity(message: string) {\n\t\tthis.inputRef.value?.setCustomValidity(message)\n\t}\n\n\tfirstUpdated() {\n\t\tif (this.autofocus) {\n\t\t\tthis.focus()\n\t\t}\n\n\t\t// Subscribe to 'input' changes\n\t\tfromEvent<InputEvent>(this.inputElement, 'input')\n\t\t\t.pipe(\n\t\t\t\tmap(event => (event.target as HTMLInputElement).value),\n\t\t\t\tdistinctUntilChanged(),\n\t\t\t)\n\t\t\t.subscribe(value => {\n\t\t\t\tthis.value = value\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent<EventDetails>('change', {\n\t\t\t\t\t\tdetail: { value },\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t})\n\n\t\t// Subscribe to 'change' changes (on blur for native inputs)\n\t\tfromEvent<Event>(this.inputElement, 'change')\n\t\t\t.pipe(\n\t\t\t\tmap(event => (event.target as HTMLInputElement).value),\n\t\t\t\tdistinctUntilChanged(),\n\t\t\t)\n\t\t\t.subscribe(value => {\n\t\t\t\tthis.value = value\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent<EventDetails>('change', {\n\t\t\t\t\t\tdetail: { value },\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t})\n\n\t\t// Emit custom event on Enter key\n\t\tfromEvent<KeyboardEvent>(this.inputElement, 'keyup')\n\t\t\t.pipe(filter(event => event.key === 'Enter'))\n\t\t\t.subscribe(event => {\n\t\t\t\tconst { value } = event.target as HTMLInputElement\n\t\t\t\t// You can remove `distinctUntilChanged()` here if you want *every* Enter\n\t\t\t\t// press to dispatch, even if the value hasn't changed.\n\t\t\t\tthis.value = value\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent<EventDetails>('change', {\n\t\t\t\t\t\tdetail: { value },\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent<EventDetails>('enter', {\n\t\t\t\t\t\tdetail: { value },\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t})\n\n\t\t// Detect autofill animation\n\t\tfromEvent<AnimationEvent>(this.inputElement, 'animationstart')\n\t\t\t.pipe(filter(ev => ev.animationName === 'onAutoFillStart'))\n\t\t\t.subscribe(event => {\n\t\t\t\tconst { value } = event.target as HTMLInputElement\n\t\t\t\tthis.value = value\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent<EventDetails>('change', {\n\t\t\t\t\t\tdetail: { value },\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t})\n\t}\n\n\t/** Selects all text within the input. */\n\tpublic select() {\n\t\treturn this.inputRef.value?.select()\n\t}\n\n\t/** Returns the internal validity state object. */\n\tpublic getValidity(): ValidityState | undefined {\n\t\treturn this.inputRef.value?.validity\n\t}\n\n\t/**\n\t * Override focus so that focusing <schmancy-input> actually focuses\n\t * the internal <input>.\n\t */\n\tpublic override focus(options?: FocusOptions) {\n\t\tthis.inputRef.value?.focus(options)\n\t\tthis.dispatchEvent(new Event('focus'))\n\t}\n\n\t/**\n\t * Same with click; bubble a click out if needed, but delegate to internal input.\n\t */\n\tpublic override click() {\n\t\tthis.inputRef.value?.click()\n\t\tthis.dispatchEvent(new Event('click'))\n\t}\n\n\t/**\n\t * Same with blur; bubble the event.\n\t */\n\tpublic override blur() {\n\t\tthis.inputRef.value?.blur()\n\t\tthis.dispatchEvent(new Event('blur'))\n\t}\n\n\tprotected override render() {\n\t\tconst inputClasses = {\n\t\t\t'w-full flex-1 h-[50px] rounded-[8px] border-0 px-[8px] sm:px-[12px] md:px-[16px]': true,\n\t\t\t'disabled:opacity-40 disabled:cursor-not-allowed': true,\n\t\t\t'placeholder:text-muted': true,\n\t\t\t'ring-0 ring-inset focus:ring-1 focus:ring-inset': true,\n\t\t\t'ring-primary-default ring-outline focus:ring-primary-default': !this.error,\n\t\t\t'ring-error-default focus:ring-error-default': this.error,\n\t\t\t'caret-transparent focus:outline-hidden cursor-pointer text-select-none': this.readonly,\n\t\t\t'cursor-pointer': this.clickable,\n\t\t\t'text-center': this.align === 'center',\n\t\t\t'text-right': this.align === 'right',\n\t\t}\n\t\tconst labelClasses = {\n\t\t\t'opacity-40': this.disabled,\n\t\t\t'block mb-[4px]': true,\n\t\t}\n\t\treturn html`\n\t\t\t${when(\n\t\t\t\tthis.label,\n\t\t\t\t() => html`\n\t\t\t\t\t<label\n\t\t\t\t\t\t${color({\n\t\t\t\t\t\t\tcolor: this.error ? SchmancyTheme.sys.color.error.default : SchmancyTheme.sys.color.primary.default,\n\t\t\t\t\t\t})}\n\t\t\t\t\t\tclass=\"${classMap(labelClasses)}\"\n\t\t\t\t\t\tfor=${this.id}\n\t\t\t\t\t>\n\t\t\t\t\t\t<schmancy-typography type=\"label\" token=\"lg\">${this.label}</schmancy-typography>\n\t\t\t\t\t</label>\n\t\t\t\t`,\n\t\t\t)}\n\t\t\t<input\n\t\t\t\t${color({\n\t\t\t\t\tbgColor: SchmancyTheme.sys.color.surface.highest,\n\t\t\t\t\tcolor: SchmancyTheme.sys.color.surface.on,\n\t\t\t\t})}\n\t\t\t\t${ref(this.inputRef)}\n\t\t\t\t.value=${this.value}\n\t\t\t\tid=${this.id}\n\t\t\t\tname=${this.name}\n\t\t\t\t.type=${this.type}\n\t\t\t\tstep=${ifDefined(this.step)}\n\t\t\t\t.autocomplete=${this.autocomplete}\n\t\t\t\tplaceholder=${this.placeholder}\n\t\t\t\t?required=${this.required}\n\t\t\t\tinputmode=${ifDefined(this.inputmode)}\n\t\t\t\tclass=${classMap(inputClasses)}\n\t\t\t\t?disabled=${this.disabled}\n\t\t\t\t?readOnly=${this.readonly}\n\t\t\t\tminlength=${ifDefined(this.minlength)}\n\t\t\t\tmaxlength=${ifDefined(this.maxlength)}\n\t\t\t\tmin=${ifDefined(this.min)}\n\t\t\t\tmax=${ifDefined(this.max)}\n\t\t\t\tpattern=${ifDefined(this.pattern)}\n\t\t\t/>\n\t\t\t${when(\n\t\t\t\tthis.hint,\n\t\t\t\t() => html`\n\t\t\t\t\t<schmancy-typography\n\t\t\t\t\t\t${color({\n\t\t\t\t\t\t\tcolor: this.error ? SchmancyTheme.sys.color.error.default : SchmancyTheme.sys.color.primary.default,\n\t\t\t\t\t\t})}\n\t\t\t\t\t\tclass=\"pt-[4px]\"\n\t\t\t\t\t\ttype=\"body\"\n\t\t\t\t\t\ttoken=\"sm\"\n\t\t\t\t\t>\n\t\t\t\t\t\t${this.hint}\n\t\t\t\t\t</schmancy-typography>\n\t\t\t\t`,\n\t\t\t)}\n\t\t`\n\t}\n}\n"],"names":["SchmancyInput","TailwindElement","super","this","label","type","clickable","name","Date","now","placeholder","value","required","disabled","readonly","spellcheck","align","autofocus","autocomplete","tabIndex","error","inputRef","createRef","internals","attachInternals","form","changedProps","updated","has","setFormValue","reportValidity","checkValidity","message","setCustomValidity","focus","fromEvent","inputElement","pipe","map","event","target","distinctUntilChanged","subscribe","dispatchEvent","CustomEvent","detail","bubbles","composed","filter","key","ev","animationName","select","getValidity","validity","options","Event","click","blur","render","inputClasses","labelClasses","html","when","color","SchmancyTheme","sys","default","primary","classMap","id","bgColor","surface","highest","on","ref","ifDefined","step","inputmode","minlength","maxlength","min","max","pattern","hint","formAssociated","shadowRootOptions","LitElement","delegatesFocus","__decorateClass","property","prototype","reflect","Boolean","String","Number","query","customElement"],"mappings":"slBAiCA,IAAqBA,EAArB,cAA2CC,EAAAA,gBAAAA,CAAAA,CAqJ1C,aAEC,CAAA,GADMC,MA/IaC,EAAAA,KAAAC,MAAA,GAQpBD,KAAOE,KAcK,OAEgCF,KAAOG,UAAAA,GAOhCH,KAAAI,KAAA,QAAUC,KAAKC,IAAAA,EAORN,KAAAO,YAAA,GAOiBP,KAAOQ,MAAQ,GASHR,KAAAS,SAAA,GACAT,KAAAU,SAAAA,GACAV,KAAAW,SAAAA,GACEX,KAAAY,WAAA,GAEuBZ,KAAAa,MAAA,OAmDhFb,KAAOc,UAAAA,GAOPd,KAAOe,aAAyB,MAMhCf,KAAOgB,SAAW,EAK0BhB,KAAOiB,MAAQ,GAG3DjB,KAAAkB,SAAWC,YAaN,EAAA,oBAAqBnB,KACpB,GAAA,CACEA,KAAAoB,UAAYpB,KAAKqB,gBAAgB,CAAA,MAGtCrB,CAAAA,KAAKoB,gBAAY,CAEnB,CAGD,IAAA,MACQ,OAAA,QAAApB,EAAAA,KAAKoB,YAALpB,YAAAA,EAAgBsB,OAAQ,IAAA,CAOtB,QAAQC,EAAAA,OACjBxB,MAAMyB,QAAQD,CAAAA,EACVA,EAAaE,IAAI,OACfzB,KAAAA,EAAAA,KAAAoB,YAAApB,MAAAA,EAAW0B,aAAa1B,KAAKQ,OACnC,CAIM,gBAAAmB,OACC,OAAA3B,EAAAA,KAAKkB,SAASV,QAAdR,YA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AErF,KAAMyF,MAAAA,CAAAA,CAAAA,EA3HE9F,EA4Hb2F,UAAA,eAAA,CAAA,EAMAF,EAAA,CADNC,EAAAA,SAAS,CAAErF,KAAM0F,OAAQH,QAAS,EAAA,CAAA,CAAA,EAjIf5F,EAkIb2F,UAAA,WAAA,CAGPF,EAAAA,EAAA,CADCC,EAASA,SApIU1F,CAAAA,EAAAA,EAqIpB2F,UAAA,OAAA,GAEmDF,EAAA,CAAlDC,EAAAA,SAAS,CAAErF,KAAMwF,QAASD,QAAAA,MAvIP5F,EAuI+B2F,UAAA,QAAA,CAAA,EAEnCF,EAAA,CAAfO,EAAAA,MAAM,UAzIahG,EAyIJ2F,UAAA,eAAA,CAAA,EAzII3F,EAArByF,EAAA,CADCQ,EAAAA,cAAc,gBACMjG,CAAAA,EAAAA,CAAAA"}
|
package/dist/input.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require("./input-
|
|
1
|
+
"use strict";require("./input-Dg9UEyST.cjs");
|
|
2
2
|
//# sourceMappingURL=input.cjs.map
|
package/dist/input.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "./input-
|
|
1
|
+
import "./input-CjHwAdCr.js";
|
|
2
2
|
//# sourceMappingURL=input.js.map
|
package/dist/list.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-CBt5HLNC.cjs");Object.defineProperty(exports,"List",{enumerable:!0,get:()=>e.List}),Object.defineProperty(exports,"SchmancyListItem",{enumerable:!0,get:()=>e.SchmancyListItem});
|
|
2
2
|
//# sourceMappingURL=list.cjs.map
|
package/dist/list.js
CHANGED
package/dist/nav-drawer.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-CBt5HLNC.cjs");Object.defineProperty(exports,"SchmancyDrawerAppbar",{enumerable:!0,get:()=>e.SchmancyDrawerAppbar}),exports.SchmancyDrawerNavbarMode=e.SchmancyDrawerNavbarMode,exports.SchmancyDrawerNavbarState=e.SchmancyDrawerNavbarState,Object.defineProperty(exports,"SchmancyNavigationDrawer",{enumerable:!0,get:()=>e.SchmancyNavigationDrawer}),Object.defineProperty(exports,"SchmancyNavigationDrawerContent",{enumerable:!0,get:()=>e.SchmancyNavigationDrawerContent}),Object.defineProperty(exports,"SchmancyNavigationDrawerSidebar",{enumerable:!0,get:()=>e.SchmancyNavigationDrawerSidebar}),exports.schmancyNavDrawer=e.schmancyNavDrawer;
|
|
2
2
|
//# sourceMappingURL=nav-drawer.cjs.map
|
package/dist/nav-drawer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as c, l as n, m as e, n as m, k as i, o, i as s } from "./teleport.component-
|
|
1
|
+
import { j as c, l as n, m as e, n as m, k as i, o, i as s } from "./teleport.component-Dc1Ygxut.js";
|
|
2
2
|
export {
|
|
3
3
|
c as SchmancyDrawerAppbar,
|
|
4
4
|
n as SchmancyDrawerNavbarMode,
|
package/dist/teleport.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-CBt5HLNC.cjs");exports.HereMorty=e.HereMorty,Object.defineProperty(exports,"SchmancyTeleportation",{enumerable:!0,get:()=>e.SchmancyTeleportation}),exports.WhereAreYouRicky=e.WhereAreYouRicky,exports.teleport=e.teleport;
|
|
2
2
|
//# sourceMappingURL=teleport.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const h=require("lit"),c=require("lit/decorators.js"),s=require("rxjs");require("./animated-text-B7ot87Yb.cjs");const M=require("./area.component-Dvbv9xus.cjs");require("./autocomplete-GCjmIPKP.cjs"),require("./spinner-BE0oj65n.cjs"),require("./icon-button-CEcYwu6h.cjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const b=require("./tailwind.mixin-C3pXEh-C.cjs"),x=require("./theme.interface-Xg5Zi46a.cjs");require("./checkbox-B6wuWHQT.cjs"),require("./chips-DW4wk4ns.cjs"),require("./payment-card-form-ClNJIflz.cjs");const d=require("./types.cjs"),l=require("./provide-_VUNOf1R.cjs"),g=require("./litElement.mixin-CqG5Vzn4.cjs"),p=require("./consume-Di0U0iBU.cjs");require("./date-range-
|
|
1
|
+
"use strict";const h=require("lit"),c=require("lit/decorators.js"),s=require("rxjs");require("./animated-text-B7ot87Yb.cjs");const M=require("./area.component-Dvbv9xus.cjs");require("./autocomplete-GCjmIPKP.cjs"),require("./spinner-BE0oj65n.cjs"),require("./icon-button-CEcYwu6h.cjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const b=require("./tailwind.mixin-C3pXEh-C.cjs"),x=require("./theme.interface-Xg5Zi46a.cjs");require("./checkbox-B6wuWHQT.cjs"),require("./chips-DW4wk4ns.cjs"),require("./payment-card-form-ClNJIflz.cjs");const d=require("./types.cjs"),l=require("./provide-_VUNOf1R.cjs"),g=require("./litElement.mixin-CqG5Vzn4.cjs"),p=require("./consume-Di0U0iBU.cjs");require("./date-range-C6ObEwpy.cjs"),require("./delay-ZjnwZygz.cjs");const w=require("./ripple-C2BHbhcS.cjs");require("./divider-C-olgct1.cjs"),require("./form-BftBHIa9.cjs"),require("./icon-C3VNzTd2.cjs"),require("./input-Dg9UEyST.cjs"),require("./scroll-CUpYxnFS.cjs");const Y=require("./surface-DxPFMsdk.cjs"),C=require("lit/directives/when.js");require("./menu-BsjLQTfd.cjs"),require("./outlet-BMkGxj9Y.cjs"),require("./option-CEN9FFeV.cjs"),require("./radio-group-Dq8G5fBE.cjs"),require("./index-DyJ0oDpR.cjs"),require("./select-DSOpxxMT.cjs");const L=require("./sheet-BnBjA5tD.cjs");require("./slider-CJdYHduh.cjs"),require("./table-Co0-nm4Y.cjs"),require("./tabs-group-Doix3mBX.cjs"),require("./textarea-BfNvgfZ_.cjs"),require("./theme.component-C_KvokK0.cjs"),require("./theme-button-CQiYi_67.cjs"),require("./tree-BGkPGaY8.cjs"),require("./typewriter-ChAfM5s5.cjs"),require("./typography-NRVaaUrd.cjs");const T=require("rxjs/operators");var K=Object.defineProperty,F=Object.getOwnPropertyDescriptor;let X=class extends b.TailwindElement(h.css`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
}
|
|
@@ -170,4 +170,4 @@
|
|
|
170
170
|
class="${this.classMap({"fixed inset-0 z-49 hidden":!0})}"
|
|
171
171
|
></div>
|
|
172
172
|
`}},v([p.c({context:W,subscribe:!0}),c.state()],exports.SchmancyNavigationDrawerSidebar.prototype,"mode",2),v([p.c({context:P,subscribe:!0}),c.state()],exports.SchmancyNavigationDrawerSidebar.prototype,"state",2),v([c.query("#overlay")],exports.SchmancyNavigationDrawerSidebar.prototype,"overlay",2),v([c.query("nav")],exports.SchmancyNavigationDrawerSidebar.prototype,"nav",2),v([c.property({type:String})],exports.SchmancyNavigationDrawerSidebar.prototype,"width",2),exports.SchmancyNavigationDrawerSidebar=v([c.customElement("schmancy-nav-drawer-navbar")],exports.SchmancyNavigationDrawerSidebar);const U="whereAreYouRicky",A="hereMorty",D=new class{constructor(){this.activeTeleportations=new Map,this.flipRequests=new s.Subject,this.find=e=>s.zip([s.fromEvent(window,A).pipe(s.filter(t=>!!t.detail.component.uuid&&!!e.id&&t.detail.component.id===e.id&&t.detail.component.uuid!==e.uuid),s.map(t=>t.detail.component),s.take(1)),s.of(e).pipe(s.tap(()=>{window.dispatchEvent(new CustomEvent(U,{detail:{id:e.id,callerID:e.uuid}}))}))]).pipe(s.map(([t])=>t),s.timeout(0)),this.flip=e=>{const{from:t,to:n}=e,o=n.element.style.zIndex;n.element.style.transformOrigin="top left",n.element.style.setProperty("visibility","visible"),n.element.style.zIndex="1000";const a=[{transform:`translate(${t.rect.left-n.rect.left}px, ${t.rect.top-n.rect.top}px) scale(${t.rect.width/n.rect.width}, ${t.rect.height/n.rect.height})`},{transform:"translate(0, 0) scale(1, 1)"}];n.element.animate(a,{duration:250,delay:10,easing:"cubic-bezier(0.455, 0.03, 0.515, 0.955)"}).onfinish=()=>{n.element.style.zIndex=o,n.element.style.transformOrigin=""}},this.flipRequests.pipe(s.bufferTime(1),s.map(e=>e.map(({from:t,to:n,host:o},a)=>({from:t,to:n,host:o,i:a}))),s.concatMap(e=>s.zip(e.map(t=>s.of(this.flip(t)))))).subscribe()}};function V(e){return s.interval(50).pipe(T.map(()=>e.getBoundingClientRect()),T.distinctUntilChanged((t,n)=>t.width===n.width&&t.height===n.height&&t.top===n.top&&t.right===n.right&&t.bottom===n.bottom&&t.left===n.left),T.take(1))}var xe=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,O=(e,t,n,o)=>{for(var a,r=o>1?void 0:o?Ce(t,n):t,i=e.length-1;i>=0;i--)(a=e[i])&&(r=(o?a(t,n,r):a(r))||r);return o&&r&&xe(t,n,r),r};exports.SchmancyTeleportation=class extends g.$LitElement(h.css``){constructor(){super(...arguments),this.uuid=Math.floor(Math.random()*Date.now()),this.delay=0,this.debugging=!1}get _slottedChildren(){return this.shadowRoot.querySelector("slot").assignedElements({flatten:!0})}connectedCallback(){if(this.id===void 0)throw new Error("id is required");super.connectedCallback(),s.merge(s.fromEvent(window,M.FINDING_MORTIES).pipe(s.tap({next:()=>{this.dispatchEvent(new CustomEvent(M.HERE_RICKY,{detail:{component:this},bubbles:!0,composed:!0}))}})),s.fromEvent(window,U).pipe(s.tap({next:e=>{e.detail.id===this.id&&this.uuid&&e.detail.callerID!==this.uuid&&this.dispatchEvent(new CustomEvent(A,{detail:{component:this},bubbles:!0,composed:!0}))}}))).pipe(s.takeUntil(this.disconnecting)).subscribe()}async firstUpdated(){s.of(D.activeTeleportations.get(this.id)).pipe(s.filter(e=>!!e),s.takeUntil(this.disconnecting),s.throwIfEmpty()).subscribe({next:e=>{this.style.setProperty("visibility","hidden"),V(this).pipe(s.takeUntil(this.disconnecting)).subscribe({next:t=>{D.activeTeleportations.set(this.id,t),D.flipRequests.next({from:{rect:e},to:{rect:t,element:this._slottedChildren[0]},host:this})}})},error:()=>{this.style.setProperty("visibility","visible"),V(this).pipe(s.takeUntil(this.disconnecting)).subscribe({next:e=>{D.activeTeleportations.set(this.id,e)}})},complete:()=>{}})}render(){return h.html`<slot></slot>`}},O([c.property({type:Number,reflect:!0})],exports.SchmancyTeleportation.prototype,"uuid",2),O([c.property({type:String})],exports.SchmancyTeleportation.prototype,"id",2),O([c.property({type:Number})],exports.SchmancyTeleportation.prototype,"delay",2),exports.SchmancyTeleportation=O([c.customElement("schmancy-teleport")],exports.SchmancyTeleportation),exports.HereMorty=A,exports.SchmancyContentDrawerID=R,exports.SchmancyContentDrawerMaxHeight=j,exports.SchmancyContentDrawerMinWidth=N,exports.SchmancyContentDrawerSheetMode=k,exports.SchmancyContentDrawerSheetState=H,exports.SchmancyDrawerNavbarMode=W,exports.SchmancyDrawerNavbarState=P,exports.WhereAreYouRicky=U,exports.schmancyContentDrawer=re,exports.schmancyNavDrawer=ye,exports.teleport=D;
|
|
173
|
-
//# sourceMappingURL=teleport.component-
|
|
173
|
+
//# sourceMappingURL=teleport.component-CBt5HLNC.cjs.map
|