@mhmo91/schmancy 0.2.58 → 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 +3 -3
- package/dist/{input-DoURQ3xM.cjs → input-BrLbi5wu.cjs} +2 -2
- package/dist/input-BrLbi5wu.cjs.map +1 -0
- package/dist/{input-BAg8B5xw.js → input-D_30_4Cf.js} +2 -2
- package/dist/input-D_30_4Cf.js.map +1 -0
- package/dist/input.cjs +1 -1
- package/dist/input.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-DZNBBuCJ.js → teleport.component-ByTxHtT5.js} +3 -3
- package/dist/{teleport.component-DZNBBuCJ.js.map → teleport.component-ByTxHtT5.js.map} +1 -1
- package/dist/{teleport.component-BKdHmXBi.cjs → teleport.component-C8AeNbog.cjs} +2 -2
- package/dist/{teleport.component-BKdHmXBi.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
- package/dist/input-BAg8B5xw.js.map +0 -1
- package/dist/input-DoURQ3xM.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-C8AeNbog.cjs");
|
|
2
2
|
//# sourceMappingURL=card.cjs.map
|
package/dist/card.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "./teleport.component-
|
|
1
|
+
import "./teleport.component-ByTxHtT5.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-C8AeNbog.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-ByTxHtT5.js";
|
|
2
2
|
export {
|
|
3
3
|
n as SchmancyContentDrawer,
|
|
4
4
|
t as SchmancyContentDrawerID,
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import "rxjs";
|
|
2
|
+
import "lit/directives/class-map.js";
|
|
3
|
+
import "lit/directives/style-map.js";
|
|
4
|
+
import { $ as y } from "./litElement.mixin-C2ixT_uz.js";
|
|
5
|
+
import "./tailwind.mixin-BNM2vRly.js";
|
|
6
|
+
import { html as u } from "lit";
|
|
7
|
+
import { property as c, query as l, state as g, customElement as f } from "lit/decorators.js";
|
|
8
|
+
import { ifDefined as h } from "lit/directives/if-defined.js";
|
|
9
|
+
import s from "moment";
|
|
10
|
+
function p(e, t) {
|
|
11
|
+
if (!e) return null;
|
|
12
|
+
const a = s(e);
|
|
13
|
+
return a.isValid() ? a.format(t) : null;
|
|
14
|
+
}
|
|
15
|
+
var D = Object.defineProperty, b = Object.getOwnPropertyDescriptor, m = (e, t, a, n) => {
|
|
16
|
+
for (var o, i = n > 1 ? void 0 : n ? b(t, a) : t, d = e.length - 1; d >= 0; d--) (o = e[d]) && (i = (n ? o(t, a, i) : o(i)) || i);
|
|
17
|
+
return n && i && D(t, a, i), i;
|
|
18
|
+
};
|
|
19
|
+
let r = class extends y() {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments), this.type = "date", this.selectedDateRange = "Today";
|
|
22
|
+
}
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
super.connectedCallback(), this.initPresetRanges();
|
|
25
|
+
const e = this.getDateFormat(), t = function(a, n, o) {
|
|
26
|
+
const i = p(a, o), d = p(n, o);
|
|
27
|
+
return { dateFrom: i, dateTo: d, isValid: i !== null && d !== null };
|
|
28
|
+
}(this.dateFrom.value, this.dateTo.value, e);
|
|
29
|
+
if (t.isValid) this.dateFrom.value = t.dateFrom, this.dateTo.value = t.dateTo, this.updateSelectedDateRange();
|
|
30
|
+
else {
|
|
31
|
+
const a = s().format(e);
|
|
32
|
+
this.dateFrom.value = a, this.dateTo.value = a;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
setDateRange(e, t) {
|
|
36
|
+
this.dateFrom.value = e, this.dateTo.value = t, this.dispatchEvent(new CustomEvent("change", { detail: { dateFrom: e, dateTo: t }, bubbles: !0, composed: !0 })), this.requestUpdate();
|
|
37
|
+
}
|
|
38
|
+
updated(e) {
|
|
39
|
+
e.has("type") && (this.initPresetRanges(), this.updateSelectedDateRange());
|
|
40
|
+
}
|
|
41
|
+
getDateFormat() {
|
|
42
|
+
return this.type === "date" ? "YYYY-MM-DD" : "YYYY-MM-DDTHH:mm";
|
|
43
|
+
}
|
|
44
|
+
getDisplayFormat() {
|
|
45
|
+
return this.type === "date" ? "MMM DD, YYYY" : "MMM DD, YYYY hh:mm A";
|
|
46
|
+
}
|
|
47
|
+
initPresetRanges() {
|
|
48
|
+
const e = this.getDateFormat();
|
|
49
|
+
this.presetRanges = [{ label: "Yesterday", range: { dateFrom: s().subtract(1, "days").startOf("day").format(e), dateTo: s().subtract(1, "days").endOf("day").format(e) }, step: "day" }, { label: "Today", range: { dateFrom: s().startOf("day").format(e), dateTo: s().endOf("day").format(e) }, step: "day" }, { label: "Tomorrow", range: { dateFrom: s().add(1, "days").startOf("day").format(e), dateTo: s().add(1, "days").endOf("day").format(e) }, step: "day" }, { label: "This Week", range: { dateFrom: s().startOf("isoWeek").format(e), dateTo: s().endOf("isoWeek").format(e) }, step: "week" }, { label: "Last Week", range: { dateFrom: s().subtract(1, "weeks").startOf("isoWeek").format(e), dateTo: s().subtract(1, "weeks").endOf("isoWeek").format(e) }, step: "week" }, { label: "This Month", range: { dateFrom: s().startOf("month").format(e), dateTo: s().endOf("month").format(e) }, step: "month" }];
|
|
50
|
+
}
|
|
51
|
+
updateSelectedDateRange() {
|
|
52
|
+
const e = this.presetRanges.find((t) => t.range.dateFrom === this.dateFrom.value && t.range.dateTo === this.dateTo.value);
|
|
53
|
+
if (e) this.selectedDateRange = e.label;
|
|
54
|
+
else {
|
|
55
|
+
const t = s(this.dateFrom.value), a = s(this.dateTo.value);
|
|
56
|
+
if (t.isSame(a, "day")) this.selectedDateRange = t.format("MMM DD, YYYY"), t.format("HH:mm") === "00:00" && a.format("HH:mm") === "23:59" || (this.selectedDateRange += ` ${t.format("HH:mm")}:${a.format("HH:mm")}`);
|
|
57
|
+
else {
|
|
58
|
+
const n = t.format(this.getDisplayFormat()), o = a.format(this.getDisplayFormat());
|
|
59
|
+
this.selectedDateRange = `${n} - ${o}`;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
handlePresetChange(e) {
|
|
64
|
+
const t = this.presetRanges.find((o) => o.label === e);
|
|
65
|
+
if (!t) return;
|
|
66
|
+
const { dateFrom: a, dateTo: n } = t.range;
|
|
67
|
+
this.setDateRange(a, n), this.selectedDateRange = e, this.schmancyMenu.open = !1;
|
|
68
|
+
}
|
|
69
|
+
handleDateRangeChange() {
|
|
70
|
+
this.setDateRange(this.dateFrom.value, this.dateTo.value), this.updateSelectedDateRange(), this.schmancyMenu.open = !1;
|
|
71
|
+
}
|
|
72
|
+
shiftDateRange(e) {
|
|
73
|
+
const t = this.getDateFormat(), a = s(this.dateTo.value).diff(s(this.dateFrom.value), "days") || 1, n = s(this.dateFrom.value).add(e * a, "days").format(t), o = s(this.dateTo.value).add(e * a, "days").format(t);
|
|
74
|
+
this.setDateRange(n, o), this.updateSelectedDateRange();
|
|
75
|
+
}
|
|
76
|
+
render() {
|
|
77
|
+
var e;
|
|
78
|
+
return u`
|
|
79
|
+
<!-- schmancy-menu typically provides a slot="button" for the trigger,
|
|
80
|
+
and then projects the menu items inside. -->
|
|
81
|
+
<schmancy-menu class="z-100 w-max" role="menu" aria-label="Date range presets and custom input">
|
|
82
|
+
<!-- The toggle/trigger slot -->
|
|
83
|
+
<schmancy-grid slot="button" align="center" cols="auto 1fr auto">
|
|
84
|
+
<schmancy-icon-button
|
|
85
|
+
type="button"
|
|
86
|
+
aria-label="Shift date range backward"
|
|
87
|
+
@click=${(t) => {
|
|
88
|
+
t.preventDefault(), this.shiftDateRange(-1);
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
arrow_left
|
|
92
|
+
</schmancy-icon-button>
|
|
93
|
+
|
|
94
|
+
<schmancy-button
|
|
95
|
+
class="w-max"
|
|
96
|
+
variant="outlined"
|
|
97
|
+
type="button"
|
|
98
|
+
aria-haspopup="menu"
|
|
99
|
+
.ariaExpanded=${String(((e = this.schmancyMenu) == null ? void 0 : e.open) || !1)}
|
|
100
|
+
>
|
|
101
|
+
${this.selectedDateRange || "Date range"}
|
|
102
|
+
</schmancy-button>
|
|
103
|
+
|
|
104
|
+
<schmancy-icon-button
|
|
105
|
+
type="button"
|
|
106
|
+
aria-label="Shift date range forward"
|
|
107
|
+
@click=${(t) => {
|
|
108
|
+
t.preventDefault(), this.shiftDateRange(1);
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
arrow_right
|
|
112
|
+
</schmancy-icon-button>
|
|
113
|
+
</schmancy-grid>
|
|
114
|
+
|
|
115
|
+
<!-- The menu surface: presets + manual date selection -->
|
|
116
|
+
${this.presetRanges.map((t) => u`
|
|
117
|
+
<schmancy-menu-item role="menuitem" class="w-full" @click=${() => this.handlePresetChange(t.label)}>
|
|
118
|
+
<schmancy-grid class="w-full" align="center" cols="auto 1fr auto"> ${t.label} </schmancy-grid>
|
|
119
|
+
</schmancy-menu-item>
|
|
120
|
+
`)}
|
|
121
|
+
|
|
122
|
+
<!-- Manual date range inputs + "Apply" button -->
|
|
123
|
+
<schmancy-grid gap="sm" flow="row" class="p-4">
|
|
124
|
+
<schmancy-input
|
|
125
|
+
id="checkin"
|
|
126
|
+
.type=${this.type}
|
|
127
|
+
.label=${this.dateFrom.label}
|
|
128
|
+
.value=${this.dateFrom.value}
|
|
129
|
+
min=${h(this.minDate)}
|
|
130
|
+
@change=${(t) => {
|
|
131
|
+
t.preventDefault(), t.stopPropagation();
|
|
132
|
+
const a = this.getDateFormat(), n = s(t.detail.value, a).format(a);
|
|
133
|
+
this.dateFrom.value = n, this.checkOutInput.setAttribute("min", n);
|
|
134
|
+
}}
|
|
135
|
+
></schmancy-input>
|
|
136
|
+
|
|
137
|
+
<schmancy-input
|
|
138
|
+
id="checkout"
|
|
139
|
+
.type=${this.type}
|
|
140
|
+
.label=${this.dateTo.label}
|
|
141
|
+
.value=${this.dateTo.value}
|
|
142
|
+
min=${h(this.dateFrom.value)}
|
|
143
|
+
max=${h(this.maxDate)}
|
|
144
|
+
@change=${(t) => {
|
|
145
|
+
t.preventDefault(), t.stopPropagation();
|
|
146
|
+
const a = this.getDateFormat(), n = s(t.detail.value, a).format(a);
|
|
147
|
+
this.dateTo.value = n;
|
|
148
|
+
}}
|
|
149
|
+
></schmancy-input>
|
|
150
|
+
|
|
151
|
+
<schmancy-button
|
|
152
|
+
type="button"
|
|
153
|
+
variant="outlined"
|
|
154
|
+
@click=${(t) => {
|
|
155
|
+
t.preventDefault(), t.stopPropagation(), this.handleDateRangeChange();
|
|
156
|
+
}}
|
|
157
|
+
>
|
|
158
|
+
Apply
|
|
159
|
+
</schmancy-button>
|
|
160
|
+
</schmancy-grid>
|
|
161
|
+
</schmancy-menu>
|
|
162
|
+
`;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
m([c({ type: String })], r.prototype, "type", 2), m([c({ type: Object })], r.prototype, "dateFrom", 2), m([c({ type: Object })], r.prototype, "dateTo", 2), m([c({ type: String })], r.prototype, "minDate", 2), m([c({ type: String })], r.prototype, "maxDate", 2), m([l("#checkin")], r.prototype, "checkInInput", 2), m([l("#checkout")], r.prototype, "checkOutInput", 2), m([l("schmancy-menu")], r.prototype, "schmancyMenu", 2), m([g()], r.prototype, "selectedDateRange", 2), r = m([f("schmancy-date-range")], r);
|
|
166
|
+
//# sourceMappingURL=date-range-Bole0xTK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-range-Bole0xTK.js","sources":["../src/date-range/date-utils.ts","../src/date-range/date-range.ts"],"sourcesContent":["import moment from 'moment'\n\ntype DateFormat = 'YYYY-MM-DD' | 'YYYY-MM-DDTHH:mm'\n\n/**\n * Ensures that a date string conforms to a specific format.\n * If the date is already in the correct format, it returns the original string.\n * If the date is in a different format, it attempts to convert it to the specified format.\n * If the date is invalid or cannot be converted, it returns null.\n *\n * @param dateString The date string to validate and format.\n * @param expectedFormat The expected date format (e.g., 'YYYY-MM-DD', 'YYYY-MM-DDTHH:mm').\n * @returns The formatted date string, or null if the date is invalid.\n */\nfunction enforceDateFormat(dateString: string | undefined, expectedFormat: DateFormat): string | null {\n\tif (!dateString) {\n\t\treturn null // Or handle the undefined case differently if needed\n\t}\n\n\tconst parsedDate = moment(dateString)\n\n\tif (!parsedDate.isValid()) {\n\t\treturn null // Date is invalid\n\t}\n\n\treturn parsedDate.format(expectedFormat)\n}\n\n/**\n * Validates if the initial date range values are in the expected format.\n *\n * @param dateFrom The dateFrom value to validate.\n * @param dateTo The dateTo value to validate.\n * @param expectedFormat The expected date format.\n * @returns An object indicating whether each date is valid, and the formatted date or null if invalid.\n */\nfunction validateInitialDateRange(\n\tdateFrom: string | undefined,\n\tdateTo: string | undefined,\n\texpectedFormat: DateFormat,\n): {\n\tdateFrom: string | null\n\tdateTo: string | null\n\tisValid: boolean\n} {\n\tconst formattedDateFrom = enforceDateFormat(dateFrom, expectedFormat)\n\tconst formattedDateTo = enforceDateFormat(dateTo, expectedFormat)\n\n\tconst isValid = formattedDateFrom !== null && formattedDateTo !== null\n\n\treturn {\n\t\tdateFrom: formattedDateFrom,\n\t\tdateTo: formattedDateTo,\n\t\tisValid,\n\t}\n}\n\nexport { validateInitialDateRange }\n","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'\nimport { validateInitialDateRange } from './date-utils' // Import the utility\n\ntype DateFormat = 'YYYY-MM-DD' | 'YYYY-MM-DDTHH:mm'\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\n\t\t// Validate and format initial date range\n\t\tconst dateFormat = this.getDateFormat() as DateFormat\n\t\tconst validatedRange = validateInitialDateRange(this.dateFrom.value, this.dateTo.value, dateFormat)\n\n\t\tif (validatedRange.isValid) {\n\t\t\tthis.dateFrom.value = validatedRange.dateFrom!\n\t\t\tthis.dateTo.value = validatedRange.dateTo!\n\t\t\tthis.updateSelectedDateRange()\n\t\t} else {\n\t\t\tconsole.error('Invalid initial date range. Falling back to default.')\n\t\t\t// Handle invalid initial dates (e.g., set to default values, display an error)\n\t\t\tconst now = moment().format(dateFormat)\n\t\t\tthis.dateFrom.value = now\n\t\t\tthis.dateTo.value = now\n\t\t}\n\t}\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\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 fromMoment = moment(this.dateFrom.value)\n\t\t\tconst toMoment = moment(this.dateTo.value)\n\t\t\tconsole.log(fromMoment.format('HH:mm'), toMoment.format('HH:mm'), fromMoment.format('HH:mm'))\n\t\t\tif (fromMoment.isSame(toMoment, 'day')) {\n\t\t\t\tthis.selectedDateRange = fromMoment.format('MMM DD, YYYY')\n\t\t\t\t// append the time if fromMoment is not the start of the day and toMoment is not the end of the day\n\t\t\t\tif (fromMoment.format('HH:mm') !== '00:00' || toMoment.format('HH:mm') !== '23:59') {\n\t\t\t\t\tthis.selectedDateRange += ` ${fromMoment.format('HH:mm')}:${toMoment.format('HH:mm')}`\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst fromStr = fromMoment.format(this.getDisplayFormat())\n\t\t\t\tconst toStr = toMoment.format(this.getDisplayFormat())\n\t\t\t\tthis.selectedDateRange = `${fromStr} - ${toStr}`\n\t\t\t}\n\t\t}\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":["enforceDateFormat","dateString","expectedFormat","parsedDate","moment","isValid","format","SchmancyDateRange","$LitElement","super","arguments","this","type","selectedDateRange","connectedCallback","initPresetRanges","dateFormat","getDateFormat","validatedRange","dateFrom","dateTo","formattedDateFrom","formattedDateTo","value","updateSelectedDateRange","now","fromDate","toDate","dispatchEvent","CustomEvent","detail","bubbles","composed","requestUpdate","changedProps","has","getDisplayFormat","presetRanges","label","range","subtract","startOf","endOf","step","add","preset","find","p","fromMoment","toMoment","isSame","fromStr","toStr","setDateRange","schmancyMenu","open","handleDateRangeChange","factor","currentDiff","diff","newDateFrom","newDateTo","render","html","e","preventDefault","shiftDateRange","String","map","handlePresetChange","ifDefined","minDate","event","stopPropagation","fmt","selectedDate","checkOutInput","setAttribute","maxDate","__decorateClass","property","prototype","Object","query","state","customElement"],"mappings":";;;;;;;;;AAcA,SAASA,EAAkBC,GAAgCC,GAC1D;AAAA,MAAA,CAAKD,EACG,QAAA;AAGF,QAAAE,IAAaC,EAAOH,CAAAA;AAEtB,SAACE,EAAWE,YAITF,EAAWG,OAAOJ,CAHjB,IAAA;AAIT;;;;;ACXA,IA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AAMsE,OAJE3E,CAAAA,CAAAA,GAAAA,EAIQ0E,WAAA,YAAA,CAAA,GACAF,EAAA,CAA3BC,EAAS,EAAEpE,MAAMsE,YALE3E,EAKQ0E,WAAA,UAAA,CAGAF,GAAAA,EAAA,CAA3BC,EAAS,EAAEpE,MAAMuD,OAAAA,CAAAA,CAAAA,GARE5D,EAQQ0E,WAAA,WAAA,IACAF,EAAA,CAA3BC,EAAS,EAAEpE,MAAMuD,OATE5D,CAAAA,CAAAA,GAAAA,EASQ0E,WAAA,WAAA,CAAA,GAETF,EAAA,CAAlBI,EAAM,UAXa5E,CAAAA,GAAAA,EAWD0E,WAAA,gBAAA,CAAA,GACCF,EAAA,CAAnBI,EAAM,eAZa5E,EAYA0E,WAAA,iBAAA,CAAA,GAGIF,EAAA,CAAvBI,EAAM,mBAfa5E,EAeI0E,WAAA,gBAAA,CAGfF,GAAAA,EAAA,CAARK,EAlBmB7E,CAAAA,GAAAA,EAkBX0E,WAAA,qBAAA,CAAA,GAlBW1E,IAArBwE,EAAA,CADCM,EAAc,qBACM9E,CAAAA,GAAAA,CAAAA;"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";require("rxjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const p=require("./litElement.mixin-UoPWmzJY.cjs");require("./tailwind.mixin-Bkx1Uuxe.cjs");const m=require("lit"),c=require("lit/decorators.js"),h=require("lit/directives/if-defined.js"),s=require("moment");function u(t,e){if(!t)return null;const a=s(t);return a.isValid()?a.format(e):null}var y=Object.defineProperty,g=Object.getOwnPropertyDescriptor,d=(t,e,a,n)=>{for(var r,i=n>1?void 0:n?g(e,a):e,l=t.length-1;l>=0;l--)(r=t[l])&&(i=(n?r(e,a,i):r(i))||i);return n&&i&&y(e,a,i),i};let o=class extends p.$LitElement(){constructor(){super(...arguments),this.type="date",this.selectedDateRange="Today"}connectedCallback(){super.connectedCallback(),this.initPresetRanges();const t=this.getDateFormat(),e=function(a,n,r){const i=u(a,r),l=u(n,r);return{dateFrom:i,dateTo:l,isValid:i!==null&&l!==null}}(this.dateFrom.value,this.dateTo.value,t);if(e.isValid)this.dateFrom.value=e.dateFrom,this.dateTo.value=e.dateTo,this.updateSelectedDateRange();else{const a=s().format(t);this.dateFrom.value=a,this.dateTo.value=a}}setDateRange(t,e){this.dateFrom.value=t,this.dateTo.value=e,this.dispatchEvent(new CustomEvent("change",{detail:{dateFrom:t,dateTo:e},bubbles:!0,composed:!0})),this.requestUpdate()}updated(t){t.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 t=this.getDateFormat();this.presetRanges=[{label:"Yesterday",range:{dateFrom:s().subtract(1,"days").startOf("day").format(t),dateTo:s().subtract(1,"days").endOf("day").format(t)},step:"day"},{label:"Today",range:{dateFrom:s().startOf("day").format(t),dateTo:s().endOf("day").format(t)},step:"day"},{label:"Tomorrow",range:{dateFrom:s().add(1,"days").startOf("day").format(t),dateTo:s().add(1,"days").endOf("day").format(t)},step:"day"},{label:"This Week",range:{dateFrom:s().startOf("isoWeek").format(t),dateTo:s().endOf("isoWeek").format(t)},step:"week"},{label:"Last Week",range:{dateFrom:s().subtract(1,"weeks").startOf("isoWeek").format(t),dateTo:s().subtract(1,"weeks").endOf("isoWeek").format(t)},step:"week"},{label:"This Month",range:{dateFrom:s().startOf("month").format(t),dateTo:s().endOf("month").format(t)},step:"month"}]}updateSelectedDateRange(){const t=this.presetRanges.find(e=>e.range.dateFrom===this.dateFrom.value&&e.range.dateTo===this.dateTo.value);if(t)this.selectedDateRange=t.label;else{const e=s(this.dateFrom.value),a=s(this.dateTo.value);if(e.isSame(a,"day"))this.selectedDateRange=e.format("MMM DD, YYYY"),e.format("HH:mm")==="00:00"&&a.format("HH:mm")==="23:59"||(this.selectedDateRange+=` ${e.format("HH:mm")}:${a.format("HH:mm")}`);else{const n=e.format(this.getDisplayFormat()),r=a.format(this.getDisplayFormat());this.selectedDateRange=`${n} - ${r}`}}}handlePresetChange(t){const e=this.presetRanges.find(r=>r.label===t);if(!e)return;const{dateFrom:a,dateTo:n}=e.range;this.setDateRange(a,n),this.selectedDateRange=t,this.schmancyMenu.open=!1}handleDateRangeChange(){this.setDateRange(this.dateFrom.value,this.dateTo.value),this.updateSelectedDateRange(),this.schmancyMenu.open=!1}shiftDateRange(t){const e=this.getDateFormat(),a=s(this.dateTo.value).diff(s(this.dateFrom.value),"days")||1,n=s(this.dateFrom.value).add(t*a,"days").format(e),r=s(this.dateTo.value).add(t*a,"days").format(e);this.setDateRange(n,r),this.updateSelectedDateRange()}render(){var t;return m.html`
|
|
2
|
+
<!-- schmancy-menu typically provides a slot="button" for the trigger,
|
|
3
|
+
and then projects the menu items inside. -->
|
|
4
|
+
<schmancy-menu class="z-100 w-max" role="menu" aria-label="Date range presets and custom input">
|
|
5
|
+
<!-- The toggle/trigger slot -->
|
|
6
|
+
<schmancy-grid slot="button" align="center" cols="auto 1fr auto">
|
|
7
|
+
<schmancy-icon-button
|
|
8
|
+
type="button"
|
|
9
|
+
aria-label="Shift date range backward"
|
|
10
|
+
@click=${e=>{e.preventDefault(),this.shiftDateRange(-1)}}
|
|
11
|
+
>
|
|
12
|
+
arrow_left
|
|
13
|
+
</schmancy-icon-button>
|
|
14
|
+
|
|
15
|
+
<schmancy-button
|
|
16
|
+
class="w-max"
|
|
17
|
+
variant="outlined"
|
|
18
|
+
type="button"
|
|
19
|
+
aria-haspopup="menu"
|
|
20
|
+
.ariaExpanded=${String(((t=this.schmancyMenu)==null?void 0:t.open)||!1)}
|
|
21
|
+
>
|
|
22
|
+
${this.selectedDateRange||"Date range"}
|
|
23
|
+
</schmancy-button>
|
|
24
|
+
|
|
25
|
+
<schmancy-icon-button
|
|
26
|
+
type="button"
|
|
27
|
+
aria-label="Shift date range forward"
|
|
28
|
+
@click=${e=>{e.preventDefault(),this.shiftDateRange(1)}}
|
|
29
|
+
>
|
|
30
|
+
arrow_right
|
|
31
|
+
</schmancy-icon-button>
|
|
32
|
+
</schmancy-grid>
|
|
33
|
+
|
|
34
|
+
<!-- The menu surface: presets + manual date selection -->
|
|
35
|
+
${this.presetRanges.map(e=>m.html`
|
|
36
|
+
<schmancy-menu-item role="menuitem" class="w-full" @click=${()=>this.handlePresetChange(e.label)}>
|
|
37
|
+
<schmancy-grid class="w-full" align="center" cols="auto 1fr auto"> ${e.label} </schmancy-grid>
|
|
38
|
+
</schmancy-menu-item>
|
|
39
|
+
`)}
|
|
40
|
+
|
|
41
|
+
<!-- Manual date range inputs + "Apply" button -->
|
|
42
|
+
<schmancy-grid gap="sm" flow="row" class="p-4">
|
|
43
|
+
<schmancy-input
|
|
44
|
+
id="checkin"
|
|
45
|
+
.type=${this.type}
|
|
46
|
+
.label=${this.dateFrom.label}
|
|
47
|
+
.value=${this.dateFrom.value}
|
|
48
|
+
min=${h.ifDefined(this.minDate)}
|
|
49
|
+
@change=${e=>{e.preventDefault(),e.stopPropagation();const a=this.getDateFormat(),n=s(e.detail.value,a).format(a);this.dateFrom.value=n,this.checkOutInput.setAttribute("min",n)}}
|
|
50
|
+
></schmancy-input>
|
|
51
|
+
|
|
52
|
+
<schmancy-input
|
|
53
|
+
id="checkout"
|
|
54
|
+
.type=${this.type}
|
|
55
|
+
.label=${this.dateTo.label}
|
|
56
|
+
.value=${this.dateTo.value}
|
|
57
|
+
min=${h.ifDefined(this.dateFrom.value)}
|
|
58
|
+
max=${h.ifDefined(this.maxDate)}
|
|
59
|
+
@change=${e=>{e.preventDefault(),e.stopPropagation();const a=this.getDateFormat(),n=s(e.detail.value,a).format(a);this.dateTo.value=n}}
|
|
60
|
+
></schmancy-input>
|
|
61
|
+
|
|
62
|
+
<schmancy-button
|
|
63
|
+
type="button"
|
|
64
|
+
variant="outlined"
|
|
65
|
+
@click=${e=>{e.preventDefault(),e.stopPropagation(),this.handleDateRangeChange()}}
|
|
66
|
+
>
|
|
67
|
+
Apply
|
|
68
|
+
</schmancy-button>
|
|
69
|
+
</schmancy-grid>
|
|
70
|
+
</schmancy-menu>
|
|
71
|
+
`}};d([c.property({type:String})],o.prototype,"type",2),d([c.property({type:Object})],o.prototype,"dateFrom",2),d([c.property({type:Object})],o.prototype,"dateTo",2),d([c.property({type:String})],o.prototype,"minDate",2),d([c.property({type:String})],o.prototype,"maxDate",2),d([c.query("#checkin")],o.prototype,"checkInInput",2),d([c.query("#checkout")],o.prototype,"checkOutInput",2),d([c.query("schmancy-menu")],o.prototype,"schmancyMenu",2),d([c.state()],o.prototype,"selectedDateRange",2),o=d([c.customElement("schmancy-date-range")],o);
|
|
72
|
+
//# sourceMappingURL=date-range-Df_6BLmA.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-range-Df_6BLmA.cjs","sources":["../src/date-range/date-utils.ts","../src/date-range/date-range.ts"],"sourcesContent":["import moment from 'moment'\n\ntype DateFormat = 'YYYY-MM-DD' | 'YYYY-MM-DDTHH:mm'\n\n/**\n * Ensures that a date string conforms to a specific format.\n * If the date is already in the correct format, it returns the original string.\n * If the date is in a different format, it attempts to convert it to the specified format.\n * If the date is invalid or cannot be converted, it returns null.\n *\n * @param dateString The date string to validate and format.\n * @param expectedFormat The expected date format (e.g., 'YYYY-MM-DD', 'YYYY-MM-DDTHH:mm').\n * @returns The formatted date string, or null if the date is invalid.\n */\nfunction enforceDateFormat(dateString: string | undefined, expectedFormat: DateFormat): string | null {\n\tif (!dateString) {\n\t\treturn null // Or handle the undefined case differently if needed\n\t}\n\n\tconst parsedDate = moment(dateString)\n\n\tif (!parsedDate.isValid()) {\n\t\treturn null // Date is invalid\n\t}\n\n\treturn parsedDate.format(expectedFormat)\n}\n\n/**\n * Validates if the initial date range values are in the expected format.\n *\n * @param dateFrom The dateFrom value to validate.\n * @param dateTo The dateTo value to validate.\n * @param expectedFormat The expected date format.\n * @returns An object indicating whether each date is valid, and the formatted date or null if invalid.\n */\nfunction validateInitialDateRange(\n\tdateFrom: string | undefined,\n\tdateTo: string | undefined,\n\texpectedFormat: DateFormat,\n): {\n\tdateFrom: string | null\n\tdateTo: string | null\n\tisValid: boolean\n} {\n\tconst formattedDateFrom = enforceDateFormat(dateFrom, expectedFormat)\n\tconst formattedDateTo = enforceDateFormat(dateTo, expectedFormat)\n\n\tconst isValid = formattedDateFrom !== null && formattedDateTo !== null\n\n\treturn {\n\t\tdateFrom: formattedDateFrom,\n\t\tdateTo: formattedDateTo,\n\t\tisValid,\n\t}\n}\n\nexport { validateInitialDateRange }\n","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'\nimport { validateInitialDateRange } from './date-utils' // Import the utility\n\ntype DateFormat = 'YYYY-MM-DD' | 'YYYY-MM-DDTHH:mm'\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\n\t\t// Validate and format initial date range\n\t\tconst dateFormat = this.getDateFormat() as DateFormat\n\t\tconst validatedRange = validateInitialDateRange(this.dateFrom.value, this.dateTo.value, dateFormat)\n\n\t\tif (validatedRange.isValid) {\n\t\t\tthis.dateFrom.value = validatedRange.dateFrom!\n\t\t\tthis.dateTo.value = validatedRange.dateTo!\n\t\t\tthis.updateSelectedDateRange()\n\t\t} else {\n\t\t\tconsole.error('Invalid initial date range. Falling back to default.')\n\t\t\t// Handle invalid initial dates (e.g., set to default values, display an error)\n\t\t\tconst now = moment().format(dateFormat)\n\t\t\tthis.dateFrom.value = now\n\t\t\tthis.dateTo.value = now\n\t\t}\n\t}\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\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 fromMoment = moment(this.dateFrom.value)\n\t\t\tconst toMoment = moment(this.dateTo.value)\n\t\t\tconsole.log(fromMoment.format('HH:mm'), toMoment.format('HH:mm'), fromMoment.format('HH:mm'))\n\t\t\tif (fromMoment.isSame(toMoment, 'day')) {\n\t\t\t\tthis.selectedDateRange = fromMoment.format('MMM DD, YYYY')\n\t\t\t\t// append the time if fromMoment is not the start of the day and toMoment is not the end of the day\n\t\t\t\tif (fromMoment.format('HH:mm') !== '00:00' || toMoment.format('HH:mm') !== '23:59') {\n\t\t\t\t\tthis.selectedDateRange += ` ${fromMoment.format('HH:mm')}:${toMoment.format('HH:mm')}`\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst fromStr = fromMoment.format(this.getDisplayFormat())\n\t\t\t\tconst toStr = toMoment.format(this.getDisplayFormat())\n\t\t\t\tthis.selectedDateRange = `${fromStr} - ${toStr}`\n\t\t\t}\n\t\t}\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":["enforceDateFormat","dateString","expectedFormat","parsedDate","moment","isValid","format","SchmancyDateRange","$LitElement","super","arguments","this","type","selectedDateRange","connectedCallback","initPresetRanges","dateFormat","getDateFormat","validatedRange","dateFrom","dateTo","formattedDateFrom","formattedDateTo","value","updateSelectedDateRange","now","fromDate","toDate","dispatchEvent","CustomEvent","detail","bubbles","composed","requestUpdate","changedProps","has","presetRanges","label","range","subtract","startOf","endOf","step","add","preset","find","p","fromMoment","toMoment","isSame","fromStr","getDisplayFormat","toStr","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":"2TAcA,SAASA,EAAkBC,EAAgCC,EAAAA,CAC1D,GAAKD,CAAAA,EACG,OAAA,KAGF,MAAAE,EAAaC,EAAOH,CAEtB,EAAA,OAACE,EAAWE,QAAAA,EAITF,EAAWG,OAAOJ,CAAAA,EAHjB,IAIT,iMCXA,IAAqBK,EAArB,cAA+CC,EAAAA,YAAAA,CAAAA,CAA/C,aAAAC,CAAAA,MAAAA,GAAAC,SAE+DC,EAAAA,KAAAC,KAAA,OAgBzBD,KAAAE,kBAAA,OAAA,CASrC,mBACCJ,CAAAA,MAAMK,kBACNH,EAAAA,KAAKI,iBAGC,EAAA,MAAAC,EAAaL,KAAKM,cAAAA,EAClBC,EDZR,SACCC,EACAC,EACAlB,EAMM,CAAA,MAAAmB,EAAoBrB,EAAkBmB,EAAUjB,CAChDoB,EAAAA,EAAkBtB,EAAkBoB,EAAQlB,CAAAA,EAI3C,MAAA,CACNiB,SAAUE,EACVD,OAAQE,EACRjB,QALegB,IAAsB,MAAQC,IAAoB,IAApBA,CAO/C,ECPkDX,KAAKQ,SAASI,MAAOZ,KAAKS,OAAOG,MAAOP,CAAAA,EAExF,GAAIE,EAAeb,QACbM,KAAAQ,SAASI,MAAQL,EAAeC,SAChCR,KAAAS,OAAOG,MAAQL,EAAeE,OACnCT,KAAKa,wBACC,MAAA,CAGN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2
|
//# sourceMappingURL=date-range.cjs.map
|
package/dist/date-range.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "./date-range-
|
|
1
|
+
import "./date-range-Bole0xTK.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-CvQB_OPX.cjs");const r=require("./area.component-CWwc52Uy.cjs");require("./autocomplete-B29VQiPY.cjs"),require("./spinner-CBX7eCsA.cjs");const o=require("./icon-button-CaEPMYHW.cjs"),e=require("./teleport.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./animated-text-CvQB_OPX.cjs");const r=require("./area.component-CWwc52Uy.cjs");require("./autocomplete-B29VQiPY.cjs"),require("./spinner-CBX7eCsA.cjs");const o=require("./icon-button-CaEPMYHW.cjs"),e=require("./teleport.component-C8AeNbog.cjs"),S=require("./checkbox-BNi0XYlX.cjs");require("./chips-BbMv4qYo.cjs");const u=require("./payment-card-form-BwzL71bJ.cjs");require("./date-range-Df_6BLmA.cjs");const y=require("./delay-CbylHdl-.cjs"),c=require("./ripple-C2BHbhcS.cjs");require("./divider-BPWZZ0t2.cjs"),require("./form-BeLadN-A.cjs"),require("./icon-BOUn9Lbw.cjs"),require("./input-BrLbi5wu.cjs");const t=require("./flex-DICGGeg0.cjs"),m=require("./list-CQJYVqBV.cjs");require("./menu-BKUoQyCS.cjs");const a=require("./outlet-D_JSZeRn.cjs");require("./option-GQjTaa4v.cjs");const b=require("./radio-group-DSob8tt0.cjs"),l=require("./rxjs-utils.cjs");require("rxjs"),require("./index-DyJ0oDpR.cjs");const d=require("./select-B_G2xt3n.cjs"),n=require("./sheet-BoPm_Ysx.cjs"),h=require("./slider-DFSq11C6.cjs"),p=require("./surface-BCP4Nk6f.cjs");require("./table-MEstD23V.cjs"),require("./tabs-group-DyNlrJrc.cjs"),require("./textarea-DgjTD3MS.cjs");const i=require("./theme.component-BpS8ehqb.cjs"),g=require("./theme.interface-Xg5Zi46a.cjs");require("./theme-button-DmdmN56f.cjs");const f=require("./tree-DzG0MTVn.cjs"),q=require("./types.cjs"),O=require("./typewriter-DNihFwgs.cjs"),w=require("./typography-Di2lcsba.cjs"),D=require("./intersection-CVvaDv96.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,"SchmancyButton",{enumerable:!0,get:()=>o.SchmancyButton}),Object.defineProperty(exports,"SchmnacyIconButton",{enumerable:!0,get:()=>o.SchmnacyIconButton}),exports.$drawer=e.$drawer,exports.HereMorty=e.HereMorty,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,"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:()=>S.SchmancyCheckbox}),Object.defineProperty(exports,"SchmancyPaymentCardForm",{enumerable:!0,get:()=>u.SchmancyPaymentCardForm}),Object.defineProperty(exports,"SchmancyDelay",{enumerable:!0,get:()=>y.SchmancyDelay}),exports.delayContext=y.delayContext,exports.color=c.color,exports.fullHeight=c.fullHeight,exports.ripple=c.ripple,Object.defineProperty(exports,"SchmancyFlex",{enumerable:!0,get:()=>t.SchmancyFlex}),Object.defineProperty(exports,"SchmancyFlexV2",{enumerable:!0,get:()=>t.SchmancyFlexV2}),Object.defineProperty(exports,"SchmancyGrid",{enumerable:!0,get:()=>t.SchmancyGrid}),Object.defineProperty(exports,"SchmancyScroll",{enumerable:!0,get:()=>t.SchmancyScroll}),Object.defineProperty(exports,"List",{enumerable:!0,get:()=>m.List}),Object.defineProperty(exports,"SchmancyListItem",{enumerable:!0,get:()=>m.SchmancyListItem}),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:()=>b.RadioGroup}),exports.mutationObserver=l.mutationObserver,Object.defineProperty(exports,"SchmancySelect",{enumerable:!0,get:()=>d.SchmancySelect}),exports.SchmancySheetPosition=n.SchmancySheetPosition,exports.SheetHereMorty=n.SheetHereMorty,exports.SheetWhereAreYouRicky=n.SheetWhereAreYouRicky,exports.sheet=n.sheet,Object.defineProperty(exports,"SchmancySlide",{enumerable:!0,get:()=>h.SchmancySlide}),Object.defineProperty(exports,"SchmancySlider",{enumerable:!0,get:()=>h.SchmancySlider}),Object.defineProperty(exports,"SchmancySurface",{enumerable:!0,get:()=>p.SchmancySurface}),Object.defineProperty(exports,"SchmancyThemeComponent",{enumerable:!0,get:()=>i.SchmancyThemeComponent}),exports.formateTheme=i.formateTheme,exports.tailwindStyles=i.tailwindStyles,exports.SchmancyTheme=g.SchmancyTheme,Object.defineProperty(exports,"SchmancyTree",{enumerable:!0,get:()=>f.SchmancyTree}),exports.SchmancyEvents=q.SchmancyEvents,Object.defineProperty(exports,"TypewriterElement",{enumerable:!0,get:()=>O.TypewriterElement}),Object.defineProperty(exports,"SchmancyTypography",{enumerable:!0,get:()=>w.SchmancyTypography}),exports.intersection$=D.intersection$;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -3,17 +3,17 @@ import { F as C, H as d, b as T, S as b, a as u, r as N } from "./area.component
|
|
|
3
3
|
import "./autocomplete-BYaStWXT.js";
|
|
4
4
|
import "./spinner-DxDUWBpa.js";
|
|
5
5
|
import { S as R, a as v } from "./icon-button-DIGpWi22.js";
|
|
6
|
-
import { $ as M, H as g, e as E, b as A, f as F, c as Y, d as $, g as k, S as G, a as O, i as W, k as L, l as _, m as B, j as P, n as j, o as K, W as V, s as q, h as z, t as J } from "./teleport.component-
|
|
6
|
+
import { $ as M, H as g, e as E, b as A, f as F, c as Y, d as $, g as k, S as G, a as O, i as W, k as L, l as _, m as B, j as P, n as j, o as K, W as V, s as q, h as z, t as J } from "./teleport.component-ByTxHtT5.js";
|
|
7
7
|
import { S as U } from "./checkbox-BDRhgA8Q.js";
|
|
8
8
|
import "./chips-DLKWllS2.js";
|
|
9
9
|
import { S as Z } from "./payment-card-form-CIWTaRBz.js";
|
|
10
|
-
import "./date-range-
|
|
10
|
+
import "./date-range-Bole0xTK.js";
|
|
11
11
|
import { S as ra, d as ea } from "./delay-D_NrsrNB.js";
|
|
12
12
|
import { c as oa, f as ca, r as ma } from "./ripple-BumgqsDT.js";
|
|
13
13
|
import "./divider-D2GJitrx.js";
|
|
14
14
|
import "./form-BA83AMjT.js";
|
|
15
15
|
import "./icon-BVEUJQHT.js";
|
|
16
|
-
import "./input-
|
|
16
|
+
import "./input-D_30_4Cf.js";
|
|
17
17
|
import { S as sa, c as Sa, a as ha, b as ia } from "./flex-DL52jmYy.js";
|
|
18
18
|
import { L as pa, S as fa } from "./list-DjB7q6Qk.js";
|
|
19
19
|
import "./menu-BNZPGmxK.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const c=require("lit"),i=require("lit/decorators.js"),m=require("lit/directives/class-map.js"),l=require("lit/directives/if-defined.js"),f=require("lit/directives/ref.js"),b=require("lit/directives/when.js"),s=require("rxjs");require("lit/directives/style-map.js");const v=require("./tailwind.mixin-Bkx1Uuxe.cjs"),y=require("./ripple-C2BHbhcS.cjs"),h=require("./theme.interface-Xg5Zi46a.cjs");var g=Object.defineProperty,$=Object.getOwnPropertyDescriptor,r=(e,o,n,p)=>{for(var u,a=p>1?void 0:p?$(o,n):o,d=e.length-1;d>=0;d--)(u=e[d])&&(a=(p?u(o,n,a):u(a))||a);return p&&a&&g(o,n,a),a};let t=class extends v.TailwindElement(){constructor(){if(super(),this.id="",this.label="",this.type="text",this.name=`name_${Date.now()}`,this.placeholder="",this.value="",this.required=!1,this.disabled=!1,this.readonly=!1,this.clickable=!1,this.spellcheck=!1,this.align="left",this.autofocus=!1,this.autocomplete="
|
|
1
|
+
"use strict";const c=require("lit"),i=require("lit/decorators.js"),m=require("lit/directives/class-map.js"),l=require("lit/directives/if-defined.js"),f=require("lit/directives/ref.js"),b=require("lit/directives/when.js"),s=require("rxjs");require("lit/directives/style-map.js");const v=require("./tailwind.mixin-Bkx1Uuxe.cjs"),y=require("./ripple-C2BHbhcS.cjs"),h=require("./theme.interface-Xg5Zi46a.cjs");var g=Object.defineProperty,$=Object.getOwnPropertyDescriptor,r=(e,o,n,p)=>{for(var u,a=p>1?void 0:p?$(o,n):o,d=e.length-1;d>=0;d--)(u=e[d])&&(a=(p?u(o,n,a):u(a))||a);return p&&a&&g(o,n,a),a};let t=class extends v.TailwindElement(){constructor(){if(super(),this.id="",this.label="",this.type="text",this.name=`name_${Date.now()}`,this.placeholder="",this.value="",this.required=!1,this.disabled=!1,this.readonly=!1,this.clickable=!1,this.spellcheck=!1,this.align="left",this.autofocus=!1,this.autocomplete="on",this.tabIndex=0,this.error=!1,this.inputRef=f.createRef(),"attachInternals"in this)try{this.internals=this.attachInternals()}catch{this.internals=void 0}}willUpdate(e){this.id||(this.id="schmancy-input-"+t._idCounter++),super.willUpdate(e)}get form(){var e;return((e=this.internals)==null?void 0:e.form)??null}updated(e){var o,n,p;super.updated(e),e.has("value")&&((o=this.internals)==null||o.setFormValue(this.value)),e.has("error")&&(this.error?(n=this.internals)==null||n.setValidity({customError:!0},"Invalid input",this.inputElement):(p=this.internals)==null||p.setValidity({}))}checkValidity(){var e;return((e=this.inputRef.value)==null?void 0:e.checkValidity())??!0}reportValidity(){var e;return((e=this.inputRef.value)==null?void 0:e.reportValidity())??!0}setCustomValidity(e){var o;(o=this.inputRef.value)==null||o.setCustomValidity(e)}firstUpdated(){this.autofocus&&this.focus(),s.fromEvent(this.inputElement,"input").pipe(s.map(e=>e.target.value),s.distinctUntilChanged(),s.takeUntil(this.disconnecting)).subscribe(e=>{this.value=e,this.dispatchEvent(new CustomEvent("input",{detail:{value:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{value:e},bubbles:!0,composed:!0}))}),s.fromEvent(this.inputElement,"change").pipe(s.map(e=>e.target.value),s.distinctUntilChanged(),s.takeUntil(this.disconnecting)).subscribe(e=>{this.value=e,this.dispatchEvent(new CustomEvent("change",{detail:{value:e},bubbles:!0,composed:!0}))}),s.fromEvent(this.inputElement,"keyup").pipe(s.filter(e=>e.key==="Enter"),s.takeUntil(this.disconnecting)).subscribe(e=>{const{value:o}=e.target;this.value=o,this.dispatchEvent(new CustomEvent("enter",{detail:{value:o},bubbles:!0,composed:!0}))}),s.fromEvent(this.inputElement,"animationstart").pipe(s.filter(e=>e.animationName==="onAutoFillStart"),s.takeUntil(this.disconnecting)).subscribe(e=>{const{value:o}=e.target;this.value=o,this.dispatchEvent(new CustomEvent("change",{detail:{value:o},bubbles:!0,composed:!0}))})}select(){var e;return(e=this.inputRef.value)==null?void 0:e.select()}getValidity(){var e;return(e=this.inputRef.value)==null?void 0:e.validity}focus(e){var o;(o=this.inputRef.value)==null||o.focus(e),this.dispatchEvent(new Event("focus"))}click(){var e;(e=this.inputRef.value)==null||e.click(),this.dispatchEvent(new Event("click"))}blur(){var e;(e=this.inputRef.value)==null||e.blur(),this.dispatchEvent(new Event("blur"))}render(){const e={"w-full flex-1 h-[50px] rounded-[8px] border-0 px-[8px] sm:px-[12px] md:px-[16px]":!0,"outline-secondary-default focus:outline-1 ":!0,"disabled:opacity-40 disabled:cursor-not-allowed":!0,"placeholder:text-muted":!0,"ring-0 ring-inset focus:ring-1 focus:ring-inset":!0,"ring-secondary-default ring-outline focus:ring-secondary-default":!this.error,"ring-error-default focus:ring-error-default":this.error,"caret-transparent focus:outline-hidden cursor-pointer text-select-none":this.readonly,"cursor-pointer":this.clickable,"text-center":this.align==="center","text-right":this.align==="right"},o={"opacity-40":this.disabled,"block mb-[4px]":!0};return c.html`
|
|
2
2
|
${b.when(this.label,()=>c.html`
|
|
3
3
|
<label
|
|
4
4
|
for=${this.id}
|
|
@@ -50,4 +50,4 @@
|
|
|
50
50
|
</div>
|
|
51
51
|
`)}
|
|
52
52
|
`}};t._idCounter=0,t.formAssociated=!0,t.shadowRootOptions={...c.LitElement.shadowRootOptions,delegatesFocus:!0},r([i.property({reflect:!0})],t.prototype,"id",2),r([i.property({type:String})],t.prototype,"label",2),r([i.property({reflect:!0})],t.prototype,"type",2),r([i.property()],t.prototype,"name",2),r([i.property()],t.prototype,"placeholder",2),r([i.property({type:String,reflect:!0})],t.prototype,"value",2),r([i.property({type:String,reflect:!0})],t.prototype,"pattern",2),r([i.property({type:Boolean,reflect:!0})],t.prototype,"required",2),r([i.property({type:Boolean,reflect:!0})],t.prototype,"disabled",2),r([i.property({type:Boolean,reflect:!0})],t.prototype,"readonly",2),r([i.property({type:Boolean,reflect:!0})],t.prototype,"clickable",2),r([i.property({type:Boolean,reflect:!0})],t.prototype,"spellcheck",2),r([i.property({type:String,reflect:!0})],t.prototype,"align",2),r([i.property()],t.prototype,"inputmode",2),r([i.property({type:Number})],t.prototype,"minlength",2),r([i.property({type:Number})],t.prototype,"maxlength",2),r([i.property()],t.prototype,"min",2),r([i.property()],t.prototype,"max",2),r([i.property({type:Number,reflect:!0})],t.prototype,"step",2),r([i.property({type:Boolean})],t.prototype,"autofocus",2),r([i.property({type:String})],t.prototype,"autocomplete",2),r([i.property({type:Number,reflect:!0})],t.prototype,"tabIndex",2),r([i.property()],t.prototype,"hint",2),r([i.property({type:Boolean,reflect:!0})],t.prototype,"error",2),r([i.query("input")],t.prototype,"inputElement",2),t=r([i.customElement("schmancy-input")],t);
|
|
53
|
-
//# sourceMappingURL=input-
|
|
53
|
+
//# sourceMappingURL=input-BrLbi5wu.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-BrLbi5wu.cjs","sources":["../src/input/input.ts"],"sourcesContent":["import { html, LitElement, nothing, PropertyValueMap } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\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, takeUntil } from 'rxjs'\n\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, 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\n/**\n * Custom events the component may emit:\n * - 'input': on every keystroke\n * - 'change': on native blur/change\n * - 'enter': specifically when user presses Enter\n */\nexport type SchmancyInputInputEvent = CustomEvent<EventDetails>\nexport type SchmancyInputChangeEvent = CustomEvent<EventDetails>\nexport type SchmancyInputEnterEvent = CustomEvent<EventDetails>\n\n@customElement('schmancy-input')\nexport default class SchmancyInput extends TailwindElement() {\n\t// ----------------------------\n\t// A) Public properties\n\t// ----------------------------\n\n\t/** If user does NOT set `id`, we'll autogenerate one. */\n\tstatic _idCounter = 0\n\n\t@property({ reflect: true })\n\tpublic override id = ''\n\n\t/**\n\t * The label for the control. If populated, we render a `<label for=\"...\">`.\n\t * If empty, we add an `aria-label` to the <input> for better screenreader support.\n\t */\n\t@property({ type: String }) label = ''\n\n\t/**\n\t * The type of input. (e.g. 'text', 'password', 'email', etc.)\n\t */\n\t@property({ reflect: true })\n\tpublic type: HTMLInputElement['type'] = 'text'\n\n\t/**\n\t * Name attribute (for form submissions). By default, a unique fallback.\n\t */\n\t@property()\n\tpublic name = `name_${Date.now()}`\n\n\t@property()\n\tpublic placeholder = ''\n\n\t/** Current value of the input. */\n\t@property({ type: String, reflect: true })\n\tpublic value = ''\n\n\t/** Pattern validation attribute. */\n\t@property({ type: String, reflect: true })\n\tpublic pattern?: string\n\n\t/** Whether the control is required for form validation. */\n\t@property({ type: Boolean, reflect: true })\n\tpublic required = false\n\n\t/** Whether the control is disabled. */\n\t@property({ type: Boolean, reflect: true })\n\tpublic disabled = false\n\n\t/** Whether the input is read-only. */\n\t@property({ type: Boolean, reflect: true })\n\tpublic readonly = false\n\n\t/** If true, we visually show a pointer cursor even if readOnly. */\n\t@property({ type: Boolean, reflect: true }) public clickable = false\n\n\t/** Whether browser spellcheck is enabled. */\n\t@property({ type: Boolean, reflect: true })\n\tpublic spellcheck = false\n\n\t/**\n\t * Text alignment within the input.\n\t * - 'left' | 'center' | 'right'\n\t */\n\t@property({ type: String, reflect: true })\n\tpublic align: 'left' | 'center' | 'right' = 'left'\n\n\t/** inputmode attribute (affects on-screen keyboards in mobile). */\n\t@property()\n\tpublic inputmode?: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'\n\n\t@property({ type: Number })\n\tpublic minlength?: number\n\n\t@property({ type: Number })\n\tpublic maxlength?: number\n\n\t@property()\n\tpublic min?: string\n\n\t@property()\n\tpublic max?: string\n\n\t@property({ type: Number, reflect: true })\n\tpublic step?: number\n\n\t/** If true, auto-focus this input on first render. */\n\t@property({ type: Boolean })\n\tpublic autofocus = false\n\n\t/** Autocomplete/autofill hints. */\n\t@property({ type: String })\n\tpublic autocomplete: AutoFill = 'on'\n\n\t/**\n\t * tabIndex for focusing by tab key. Typically 0 or -1.\n\t */\n\t@property({ type: Number, reflect: true })\n\tpublic tabIndex = 0\n\n\t/**\n\t * A small hint text or error message to display under the input.\n\t */\n\t@property()\n\tpublic hint?: string\n\n\t/**\n\t * If true, we style the input as an error state, and possibly display\n\t * the hint as an error message.\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tpublic error = false\n\n\t// ----------------------------\n\t// B) Queries & Refs\n\t// ----------------------------\n\t@query('input') private inputElement!: HTMLInputElement\n\tprivate inputRef = createRef<HTMLInputElement>()\n\n\t// ----------------------------\n\t// C) Form-associated logic\n\t// ----------------------------\n\tstatic formAssociated = true\n\tprotected static shadowRootOptions = {\n\t\t...LitElement.shadowRootOptions,\n\t\tdelegatesFocus: true, // so focus() goes to <input>\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// no-op for older browsers / polyfills\n\t\t\t\tthis.internals = undefined\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * If user did not provide an ID, auto-generate one so <label for=\"...\">\n\t * and various aria-* attributes can reference it.\n\t */\n\tprotected override willUpdate(changedProps: PropertyValueMap<any> | Map<PropertyKey, unknown>) {\n\t\tif (!this.id) {\n\t\t\tthis.id = `schmancy-input-${SchmancyInput._idCounter++}`\n\t\t}\n\t\tsuper.willUpdate(changedProps)\n\t}\n\n\t/** The form this element is associated with, if any. */\n\tget form() {\n\t\treturn this.internals?.form ?? null\n\t}\n\n\tprotected override updated(changedProps: Map<string, unknown>) {\n\t\tsuper.updated(changedProps)\n\t\tif (changedProps.has('value')) {\n\t\t\t// Reflect the current value to the form internals, so it’s submitted.\n\t\t\tthis.internals?.setFormValue(this.value)\n\t\t}\n\n\t\tif (changedProps.has('error')) {\n\t\t\t// If we have an error state, we can set custom error validity, or none if resolved.\n\t\t\tif (this.error) {\n\t\t\t\tthis.internals?.setValidity({ customError: true }, 'Invalid input', this.inputElement)\n\t\t\t} else {\n\t\t\t\tthis.internals?.setValidity({})\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Native form methods:\n\t * - checkValidity()\n\t * - reportValidity()\n\t * - setCustomValidity()\n\t */\n\tpublic checkValidity() {\n\t\treturn this.inputRef.value?.checkValidity() ?? true\n\t}\n\tpublic reportValidity() {\n\t\treturn this.inputRef.value?.reportValidity() ?? true\n\t}\n\tpublic setCustomValidity(message: string) {\n\t\tthis.inputRef.value?.setCustomValidity(message)\n\t}\n\n\t// ----------------------------\n\t// D) Lifecycle Hooks\n\t// ----------------------------\n\tfirstUpdated() {\n\t\t// Autofocus if desired\n\t\tif (this.autofocus) {\n\t\t\tthis.focus()\n\t\t}\n\n\t\t// 1) Subscribe to 'input' events (every keystroke)\n\t\tfromEvent<InputEvent>(this.inputElement, 'input')\n\t\t\t.pipe(\n\t\t\t\tmap(ev => (ev.target as HTMLInputElement).value),\n\t\t\t\tdistinctUntilChanged(),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe(value => {\n\t\t\t\tthis.value = value\n\t\t\t\t// Fire custom 'input' event with details\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent<EventDetails>('input', {\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\t// dispatch change event\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// 2) Subscribe to 'change' events (native behavior, usually on blur)\n\t\tfromEvent<Event>(this.inputElement, 'change')\n\t\t\t.pipe(\n\t\t\t\tmap(ev => (ev.target as HTMLInputElement).value),\n\t\t\t\tdistinctUntilChanged(),\n\t\t\t\ttakeUntil(this.disconnecting),\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// 3) Emit a custom 'enter' event when user presses Enter\n\t\tfromEvent<KeyboardEvent>(this.inputElement, 'keyup')\n\t\t\t.pipe(\n\t\t\t\tfilter(ev => ev.key === 'Enter'),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe(ev => {\n\t\t\t\tconst { value } = ev.target as HTMLInputElement\n\t\t\t\tthis.value = value\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// 4) Detect autofill animation (Chrome, etc.)\n\t\tfromEvent<AnimationEvent>(this.inputElement, 'animationstart')\n\t\t\t.pipe(\n\t\t\t\tfilter(ev => ev.animationName === 'onAutoFillStart'),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe(ev => {\n\t\t\t\tconst { value } = ev.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// ----------------------------\n\t// E) Utility Methods\n\t// ----------------------------\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 native validity state of the inner <input>. */\n\tpublic getValidity(): ValidityState | undefined {\n\t\treturn this.inputRef.value?.validity\n\t}\n\n\t/**\n\t * Override to forward focus to the internal <input>.\n\t * Also dispatch a 'focus' event for external listeners.\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 * Override to forward clicks to the internal <input>.\n\t * Also dispatch a 'click' event for external listeners.\n\t */\n\tpublic override click() {\n\t\tthis.inputRef.value?.click()\n\t\tthis.dispatchEvent(new Event('click'))\n\t}\n\n\t/** Forward blur to the internal <input>. */\n\tpublic override blur() {\n\t\tthis.inputRef.value?.blur()\n\t\tthis.dispatchEvent(new Event('blur'))\n\t}\n\n\t// ----------------------------\n\t// F) Rendering\n\t// ----------------------------\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'outline-secondary-default focus:outline-1 ': 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// If not in error state, use standard ring color:\n\t\t\t'ring-secondary-default ring-outline focus:ring-secondary-default': !this.error,\n\t\t\t// Error ring override:\n\t\t\t'ring-error-default focus:ring-error-default': this.error,\n\t\t\t// If read-only but \"clickable\" is true, show pointer. Otherwise normal text cursor.\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// Alignment classes:\n\t\t\t'text-center': this.align === 'center',\n\t\t\t'text-right': this.align === 'right',\n\t\t}\n\n\t\tconst labelClasses = {\n\t\t\t'opacity-40': this.disabled,\n\t\t\t'block mb-[4px]': true,\n\t\t}\n\n\t\t/**\n\t\t * - If `this.label` is present, we render a proper `<label for=\"${this.id}\">`.\n\t\t * - If not, we add an aria-label to the <input> for better accessibility.\n\t\t * - If there's a `hint`, we reference it via aria-describedby.\n\t\t * - If there's an error, we set aria-invalid and could set aria-errormessage.\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\tfor=${this.id}\n\t\t\t\t\t\tid=\"label-${this.id}\"\n\t\t\t\t\t\tclass=${classMap(labelClasses)}\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>\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\n\t\t\t<form @submit=${(e: Event) => e.preventDefault()} .autocomplete=${this.autocomplete === 'off' ? 'off' : 'on'}>\n\t\t\t\t<input\n\t\t\t\t\t${color({\n\t\t\t\t\t\tbgColor: SchmancyTheme.sys.color.surface.highest,\n\t\t\t\t\t\tcolor: SchmancyTheme.sys.color.surface.on,\n\t\t\t\t\t})}\n\t\t\t\t\t${ref(this.inputRef)}\n\t\t\t\t\tid=${this.id}\n\t\t\t\t\tname=${this.name}\n\t\t\t\t\tclass=${classMap(inputClasses)}\n\t\t\t\t\t.value=${this.value}\n\t\t\t\t\t.type=${this.type}\n\t\t\t\t\t.autocomplete=${this.autocomplete}\n\t\t\t\t\t.spellcheck=${this.spellcheck}\n\t\t\t\t\tplaceholder=${this.placeholder}\n\t\t\t\t\tinputmode=${ifDefined(this.inputmode)}\n\t\t\t\t\tpattern=${ifDefined(this.pattern)}\n\t\t\t\t\tstep=${ifDefined(this.step)}\n\t\t\t\t\tminlength=${ifDefined(this.minlength)}\n\t\t\t\t\tmaxlength=${ifDefined(this.maxlength)}\n\t\t\t\t\tmin=${ifDefined(this.min)}\n\t\t\t\t\tmax=${ifDefined(this.max)}\n\t\t\t\t\t?required=${this.required}\n\t\t\t\t\t?disabled=${this.disabled}\n\t\t\t\t\t?readonly=${this.readonly}\n\t\t\t\t\taria-invalid=${this.error ? 'true' : 'false'}\n\t\t\t\t\taria-required=${this.required ? 'true' : 'false'}\n\t\t\t\t\taria-labelledby=${this.label ? `label-${this.id}` : nothing}\n\t\t\t\t\taria-describedby=${this.hint ? `hint-${this.id}` : nothing}\n\t\t\t\t\taria-label=${ifDefined(!this.label ? this.placeholder || 'Input' : undefined)}\n\t\t\t\t/>\n\t\t\t</form>\n\n\t\t\t${when(\n\t\t\t\tthis.hint,\n\t\t\t\t() => html`\n\t\t\t\t\t<div\n\t\t\t\t\t\tid=\"hint-${this.id}\"\n\t\t\t\t\t\tclass=\"pt-[4px]\"\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>\n\t\t\t\t\t\t<schmancy-typography align=\"left\" type=\"body\" token=\"sm\"> ${this.hint} </schmancy-typography>\n\t\t\t\t\t</div>\n\t\t\t\t`,\n\t\t\t)}\n\t\t`\n\t}\n}\n"],"names":["SchmancyInput","TailwindElement","super","this","id","label","type","name","Date","now","placeholder","value","required","disabled","readonly","clickable","spellcheck","align","autofocus","autocomplete","tabIndex","error","inputRef","createRef","internals","attachInternals","undefined","changedProps","_idCounter","willUpdate","form","updated","has","setFormValue","setValidity","customError","inputElement","checkValidity","reportValidity","message","setCustomValidity","focus","fromEvent","pipe","map","ev","target","distinctUntilChanged","takeUntil","disconnecting","subscribe","dispatchEvent","CustomEvent","detail","bubbles","composed","filter","key","animationName","select","validity","options","Event","click","blur","render","inputClasses","labelClasses","html","when","classMap","color","SchmancyTheme","sys","default","primary","e","preventDefault","bgColor","surface","highest","on","ref","ifDefined","inputmode","pattern","step","minlength","maxlength","min","max","nothing","hint","formAssociated","shadowRootOptions","LitElement","delegatesFocus","__decorateClass","property","reflect","prototype","String","Boolean","Number","query","customElement"],"mappings":"slBAoCA,IAAqBA,EAArB,cAA2CC,EAAAA,gBAiI1C,CAAA,CAAA,aAEC,CAAA,GADMC,MAzHPC,EAAAA,KAAgBC,GAAK,GAMeD,KAAAE,MAAA,GAMpCF,KAAOG,KAAiC,OAMxCH,KAAOI,KAAO,QAAQC,KAAKC,IAG3BN,CAAAA,GAAAA,KAAOO,YAAc,GAIrBP,KAAOQ,MAAQ,GAQfR,KAAOS,SAAW,GAIlBT,KAAOU,SAAAA,GAIPV,KAAOW,SAAW,GAG0BX,KAAOY,UAAY,GAI/DZ,KAAOa,WAAAA,GAOPb,KAAOc,MAAqC,OAuB5Cd,KAAOe,UAAAA,GAIPf,KAAOgB,aAAyB,KAMhChB,KAAOiB,SAAW,EAalBjB,KAAOkB,MAAQ,GAM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,CADNC,EAAAA,SAAS,CAAE5F,KAAMiG,OAAQJ,UAlFNnG,CAAAA,CAAAA,EAAAA,EAmFboG,UAAA,OAAA,CAIAH,EAAAA,EAAA,CADNC,WAAS,CAAE5F,KAAMgG,OAtFEtG,CAAAA,CAAAA,EAAAA,EAuFboG,UAAA,YAAA,CAIAH,EAAAA,EAAA,CADNC,WAAS,CAAE5F,KAAM+F,MA1FErG,CAAAA,CAAAA,EAAAA,EA2FboG,UAAA,eAAA,GAMAH,EAAA,CADNC,EAAAA,SAAS,CAAE5F,KAAMiG,OAAQJ,QAAS,EAAA,CAAA,CAAA,EAhGfnG,EAiGboG,UAAA,WAAA,CAMAH,EAAAA,EAAA,CADNC,EAASA,SAtGUlG,CAAAA,EAAAA,EAuGboG,UAAA,OAAA,CAAA,EAOAH,EAAA,CADNC,EAAAA,SAAS,CAAE5F,KAAMgG,QAASH,UA7GPnG,CAAAA,CAAAA,EAAAA,EA8GboG,UAAA,QAAA,CAKiBH,EAAAA,EAAA,CAAvBO,EAAAA,MAAM,OAnHaxG,CAAAA,EAAAA,EAmHIoG,UAAA,eAAA,GAnHJpG,EAArBiG,EAAA,CADCQ,EAAAA,cAAc,gBACMzG,CAAAA,EAAAA,CAAAA"}
|
|
@@ -15,7 +15,7 @@ var q = Object.defineProperty, B = Object.getOwnPropertyDescriptor, i = (t, r, o
|
|
|
15
15
|
};
|
|
16
16
|
let e = class extends V() {
|
|
17
17
|
constructor() {
|
|
18
|
-
if (super(), this.id = "", this.label = "", this.type = "text", this.name = `name_${Date.now()}`, this.placeholder = "", this.value = "", this.required = !1, this.disabled = !1, this.readonly = !1, this.clickable = !1, this.spellcheck = !1, this.align = "left", this.autofocus = !1, this.autocomplete = "
|
|
18
|
+
if (super(), this.id = "", this.label = "", this.type = "text", this.name = `name_${Date.now()}`, this.placeholder = "", this.value = "", this.required = !1, this.disabled = !1, this.readonly = !1, this.clickable = !1, this.spellcheck = !1, this.align = "left", this.autofocus = !1, this.autocomplete = "on", this.tabIndex = 0, this.error = !1, this.inputRef = R(), "attachInternals" in this) try {
|
|
19
19
|
this.internals = this.attachInternals();
|
|
20
20
|
} catch {
|
|
21
21
|
this.internals = void 0;
|
|
@@ -134,4 +134,4 @@ let e = class extends V() {
|
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
136
|
e._idCounter = 0, e.formAssociated = !0, e.shadowRootOptions = { ...x.shadowRootOptions, delegatesFocus: !0 }, i([s({ reflect: !0 })], e.prototype, "id", 2), i([s({ type: String })], e.prototype, "label", 2), i([s({ reflect: !0 })], e.prototype, "type", 2), i([s()], e.prototype, "name", 2), i([s()], e.prototype, "placeholder", 2), i([s({ type: String, reflect: !0 })], e.prototype, "value", 2), i([s({ type: String, reflect: !0 })], e.prototype, "pattern", 2), i([s({ type: Boolean, reflect: !0 })], e.prototype, "required", 2), i([s({ type: Boolean, reflect: !0 })], e.prototype, "disabled", 2), i([s({ type: Boolean, reflect: !0 })], e.prototype, "readonly", 2), i([s({ type: Boolean, reflect: !0 })], e.prototype, "clickable", 2), i([s({ type: Boolean, reflect: !0 })], e.prototype, "spellcheck", 2), i([s({ type: String, reflect: !0 })], e.prototype, "align", 2), i([s()], e.prototype, "inputmode", 2), i([s({ type: Number })], e.prototype, "minlength", 2), i([s({ type: Number })], e.prototype, "maxlength", 2), i([s()], e.prototype, "min", 2), i([s()], e.prototype, "max", 2), i([s({ type: Number, reflect: !0 })], e.prototype, "step", 2), i([s({ type: Boolean })], e.prototype, "autofocus", 2), i([s({ type: String })], e.prototype, "autocomplete", 2), i([s({ type: Number, reflect: !0 })], e.prototype, "tabIndex", 2), i([s()], e.prototype, "hint", 2), i([s({ type: Boolean, reflect: !0 })], e.prototype, "error", 2), i([k("input")], e.prototype, "inputElement", 2), e = i([w("schmancy-input")], e);
|
|
137
|
-
//# sourceMappingURL=input-
|
|
137
|
+
//# sourceMappingURL=input-D_30_4Cf.js.map
|