@mhmo91/schmancy 0.2.100 → 0.2.101

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.
Files changed (52) hide show
  1. package/dist/card.cjs +1 -1
  2. package/dist/card.js +1 -1
  3. package/dist/content-drawer.cjs +1 -1
  4. package/dist/content-drawer.js +1 -1
  5. package/dist/date-range-_0s6SDfu.js +166 -0
  6. package/dist/date-range-_0s6SDfu.js.map +1 -0
  7. package/dist/date-range-vQa6u7Kc.cjs +72 -0
  8. package/dist/date-range-vQa6u7Kc.cjs.map +1 -0
  9. package/dist/date-range.cjs +1 -1
  10. package/dist/date-range.js +1 -1
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.js +5 -5
  13. package/dist/list-Cd7iC1no.cjs +17 -0
  14. package/dist/{list-Dy8fudM4.cjs.map → list-Cd7iC1no.cjs.map} +1 -1
  15. package/dist/{list-CXPHvvQw.js → list-ClmkvF6W.js} +12 -12
  16. package/dist/{list-CXPHvvQw.js.map → list-ClmkvF6W.js.map} +1 -1
  17. package/dist/list.cjs +1 -1
  18. package/dist/list.js +1 -1
  19. package/dist/menu-DS5Lkay4.cjs +36 -0
  20. package/dist/menu-DS5Lkay4.cjs.map +1 -0
  21. package/dist/menu-DilY6y1N.js +99 -0
  22. package/dist/menu-DilY6y1N.js.map +1 -0
  23. package/dist/menu.cjs +1 -1
  24. package/dist/menu.js +1 -1
  25. package/dist/nav-drawer.cjs +1 -1
  26. package/dist/nav-drawer.js +1 -1
  27. package/dist/{sheet-CMTmiZXv.cjs → sheet-BS8CLge_.cjs} +2 -2
  28. package/dist/sheet-BS8CLge_.cjs.map +1 -0
  29. package/dist/{sheet-DrKmM05e.js → sheet-QdCPv8wr.js} +2 -2
  30. package/dist/sheet-QdCPv8wr.js.map +1 -0
  31. package/dist/sheet.cjs +1 -1
  32. package/dist/sheet.js +1 -1
  33. package/dist/teleport.cjs +1 -1
  34. package/dist/{teleport.component-CGUs59ol.cjs → teleport.component-DbLxhqqJ.cjs} +2 -2
  35. package/dist/{teleport.component-CGUs59ol.cjs.map → teleport.component-DbLxhqqJ.cjs.map} +1 -1
  36. package/dist/{teleport.component-B2hJQblG.js → teleport.component-lGN5dIBu.js} +5 -5
  37. package/dist/{teleport.component-B2hJQblG.js.map → teleport.component-lGN5dIBu.js.map} +1 -1
  38. package/dist/teleport.js +1 -1
  39. package/package.json +1 -1
  40. package/types/src/list/list.d.ts +0 -9
  41. package/types/src/menu/menu.d.ts +6 -5
  42. package/dist/date-range-DBxAQrWq.cjs +0 -72
  43. package/dist/date-range-DBxAQrWq.cjs.map +0 -1
  44. package/dist/date-range-eiBhfMFP.js +0 -167
  45. package/dist/date-range-eiBhfMFP.js.map +0 -1
  46. package/dist/list-Dy8fudM4.cjs +0 -17
  47. package/dist/menu-Cpld82tG.js +0 -93
  48. package/dist/menu-Cpld82tG.js.map +0 -1
  49. package/dist/menu-qiBmvTtT.cjs +0 -29
  50. package/dist/menu-qiBmvTtT.cjs.map +0 -1
  51. package/dist/sheet-CMTmiZXv.cjs.map +0 -1
  52. package/dist/sheet-DrKmM05e.js.map +0 -1
package/dist/card.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";require("./teleport.component-CGUs59ol.cjs");
1
+ "use strict";require("./teleport.component-DbLxhqqJ.cjs");
2
2
  //# sourceMappingURL=card.cjs.map
package/dist/card.js CHANGED
@@ -1,2 +1,2 @@
1
- import "./teleport.component-B2hJQblG.js";
1
+ import "./teleport.component-lGN5dIBu.js";
2
2
  //# sourceMappingURL=card.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-CGUs59ol.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-DbLxhqqJ.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
@@ -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-B2hJQblG.js";
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-lGN5dIBu.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 g } from "./litElement.mixin-pfcnUcRO.js";
5
+ import "./tailwind.mixin-D4STgS5j.js";
6
+ import { html as u } from "lit";
7
+ import { property as l, query as c, state as y, 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(t, e) {
11
+ if (!t) return null;
12
+ const a = s(t);
13
+ return a.isValid() ? a.format(e) : null;
14
+ }
15
+ var D = Object.defineProperty, b = Object.getOwnPropertyDescriptor, d = (t, e, a, o) => {
16
+ for (var n, r = o > 1 ? void 0 : o ? b(e, a) : e, m = t.length - 1; m >= 0; m--) (n = t[m]) && (r = (o ? n(e, a, r) : n(r)) || r);
17
+ return o && r && D(e, a, r), r;
18
+ };
19
+ let i = class extends g() {
20
+ constructor() {
21
+ super(...arguments), this.type = "date", this.selectedDateRange = "Today";
22
+ }
23
+ connectedCallback() {
24
+ super.connectedCallback(), this.initPresetRanges();
25
+ const t = this.getDateFormat(), e = function(a, o, n) {
26
+ const r = p(a, n), m = p(o, n);
27
+ return { dateFrom: r, dateTo: m, isValid: r !== null && m !== null };
28
+ }(this.dateFrom.value, this.dateTo.value, t);
29
+ if (e.isValid) this.dateFrom.value = e.dateFrom, this.dateTo.value = e.dateTo, this.updateSelectedDateRange();
30
+ else {
31
+ const a = s().format(t);
32
+ this.dateFrom.value = a, this.dateTo.value = a;
33
+ }
34
+ }
35
+ setDateRange(t, e) {
36
+ this.dateFrom.value = t, this.dateTo.value = e, this.dispatchEvent(new CustomEvent("change", { detail: { dateFrom: t, dateTo: e }, bubbles: !0, composed: !0 })), this.requestUpdate();
37
+ }
38
+ updated(t) {
39
+ t.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 t = this.getDateFormat();
49
+ 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" }];
50
+ }
51
+ updateSelectedDateRange() {
52
+ const t = this.presetRanges.find((e) => e.range.dateFrom === this.dateFrom.value && e.range.dateTo === this.dateTo.value);
53
+ if (t) this.selectedDateRange = t.label;
54
+ else {
55
+ const e = s(this.dateFrom.value), a = s(this.dateTo.value);
56
+ 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")}`);
57
+ else {
58
+ const o = e.format(this.getDisplayFormat()), n = a.format(this.getDisplayFormat());
59
+ this.selectedDateRange = `${o} - ${n}`;
60
+ }
61
+ }
62
+ }
63
+ handlePresetChange(t) {
64
+ const e = this.presetRanges.find((n) => n.label === t);
65
+ if (!e) return;
66
+ const { dateFrom: a, dateTo: o } = e.range;
67
+ this.setDateRange(a, o), this.selectedDateRange = t;
68
+ }
69
+ shiftDateRange(t, e) {
70
+ e.stopPropagation();
71
+ const a = this.getDateFormat(), o = s(this.dateTo.value).diff(s(this.dateFrom.value), "days") || 1, n = s(this.dateFrom.value).add(t * o, "days").format(a), r = s(this.dateTo.value).add(t * o, "days").format(a);
72
+ this.setDateRange(n, r), this.updateSelectedDateRange();
73
+ }
74
+ handleDateRangeChange(t) {
75
+ t.stopPropagation(), this.setDateRange(this.dateFrom.value, this.dateTo.value), this.updateSelectedDateRange();
76
+ }
77
+ render() {
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
+ this.shiftDateRange(-1, t);
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(!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
+ this.shiftDateRange(1, t);
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 e = this.getDateFormat(), a = s(t.detail.value, e).format(e);
133
+ this.dateFrom.value = a, this.checkOutInput.setAttribute("min", a);
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 e = this.getDateFormat(), a = s(t.detail.value, e).format(e);
147
+ this.dateTo.value = a;
148
+ }}
149
+ ></schmancy-input>
150
+
151
+ <schmancy-button
152
+ type="button"
153
+ variant="outlined"
154
+ @click=${(t) => {
155
+ this.handleDateRangeChange(t);
156
+ }}
157
+ >
158
+ Apply
159
+ </schmancy-button>
160
+ </schmancy-grid>
161
+ </schmancy-menu>
162
+ `;
163
+ }
164
+ };
165
+ d([l({ type: String })], i.prototype, "type", 2), d([l({ type: Object })], i.prototype, "dateFrom", 2), d([l({ type: Object })], i.prototype, "dateTo", 2), d([l({ type: String })], i.prototype, "minDate", 2), d([l({ type: String })], i.prototype, "maxDate", 2), d([c("#checkin")], i.prototype, "checkInInput", 2), d([c("#checkout")], i.prototype, "checkOutInput", 2), d([c("schmancy-menu")], i.prototype, "schmancyMenu", 2), d([y()], i.prototype, "selectedDateRange", 2), i = d([f("schmancy-date-range")], i);
166
+ //# sourceMappingURL=date-range-_0s6SDfu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-range-_0s6SDfu.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\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}\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, event: Event) {\n\t\tevent.stopPropagation() // Prevent click from bubbling to the schmancy-button\n\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\t/**\n\t * Applies the date range from the inputs.\n\t * Closes the menu when done.\n\t */\n\tprivate handleDateRangeChange(event: Event) {\n\t\tevent.stopPropagation() // Prevent click from bubbling to the schmancy-button\n\t\tthis.setDateRange(this.dateFrom.value, this.dateTo.value)\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\tthis.shiftDateRange(-1, e) // Pass the event\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(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\tthis.shiftDateRange(1, e) // Pass the event\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\tthis.handleDateRangeChange(e)\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","constructor","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","factor","event","stopPropagation","currentDiff","diff","newDateFrom","newDateTo","render","html","e","shiftDateRange","String","map","handlePresetChange","ifDefined","minDate","preventDefault","fmt","selectedDate","checkOutInput","setAttribute","maxDate","handleDateRangeChange","__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,IAAqBK,IAArB,cAA+CC;EAA/C,cAAAC;AAAAC,UAAAC,GAAAA,SAAAA,GAE+DC,KAAAC,OAAA,QAgBzBD,KAAAE,oBAAA;AAAA,EAAA;AAAA,EASrC,oBAAAC;AACCL,UAAMK,kBAAAA,GACNH,KAAKI,iBAAAA;AAGC,UAAAC,IAAaL,KAAKM,cAClBC,GAAAA,IDZR,SACCC,GACAC,GACAnB,GAAAA;AAMM,YAAAoB,IAAoBtB,EAAkBoB,GAAUlB,CAAAA,GAChDqB,IAAkBvB,EAAkBqB,GAAQnB,CAAAA;AAI3C,aAAA,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,CAAA,GAGIF,EAAA,CAAvBI,EAAM,mBAfa3E,EAeIyE,WAAA,gBAAA,CAGfF,GAAAA,EAAA,CAARK,EAlBmB5E,CAAAA,GAAAA,EAkBXyE,WAAA,qBAAA,CAAA,GAlBWzE,IAArBuE,EAAA,CADCM,EAAc,qBACM7E,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-RgeLRf4d.cjs");require("./tailwind.mixin-CJgIYh7g.cjs");const h=require("lit"),d=require("lit/decorators.js"),m=require("lit/directives/if-defined.js"),s=require("moment");function u(e,t){if(!e)return null;const a=s(e);return a.isValid()?a.format(t):null}var y=Object.defineProperty,g=Object.getOwnPropertyDescriptor,c=(e,t,a,r)=>{for(var n,o=r>1?void 0:r?g(t,a):t,l=e.length-1;l>=0;l--)(n=e[l])&&(o=(r?n(t,a,o):n(o))||o);return r&&o&&y(t,a,o),o};let i=class extends p.$LitElement(){constructor(){super(...arguments),this.type="date",this.selectedDateRange="Today"}connectedCallback(){super.connectedCallback(),this.initPresetRanges();const e=this.getDateFormat(),t=function(a,r,n){const o=u(a,n),l=u(r,n);return{dateFrom:o,dateTo:l,isValid:o!==null&&l!==null}}(this.dateFrom.value,this.dateTo.value,e);if(t.isValid)this.dateFrom.value=t.dateFrom,this.dateTo.value=t.dateTo,this.updateSelectedDateRange();else{const a=s().format(e);this.dateFrom.value=a,this.dateTo.value=a}}setDateRange(e,t){this.dateFrom.value=e,this.dateTo.value=t,this.dispatchEvent(new CustomEvent("change",{detail:{dateFrom:e,dateTo:t},bubbles:!0,composed:!0})),this.requestUpdate()}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: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"}]}updateSelectedDateRange(){const e=this.presetRanges.find(t=>t.range.dateFrom===this.dateFrom.value&&t.range.dateTo===this.dateTo.value);if(e)this.selectedDateRange=e.label;else{const t=s(this.dateFrom.value),a=s(this.dateTo.value);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")}`);else{const r=t.format(this.getDisplayFormat()),n=a.format(this.getDisplayFormat());this.selectedDateRange=`${r} - ${n}`}}}handlePresetChange(e){const t=this.presetRanges.find(n=>n.label===e);if(!t)return;const{dateFrom:a,dateTo:r}=t.range;this.setDateRange(a,r),this.selectedDateRange=e}shiftDateRange(e,t){t.stopPropagation();const a=this.getDateFormat(),r=s(this.dateTo.value).diff(s(this.dateFrom.value),"days")||1,n=s(this.dateFrom.value).add(e*r,"days").format(a),o=s(this.dateTo.value).add(e*r,"days").format(a);this.setDateRange(n,o),this.updateSelectedDateRange()}handleDateRangeChange(e){e.stopPropagation(),this.setDateRange(this.dateFrom.value,this.dateTo.value),this.updateSelectedDateRange()}render(){return h.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=>{this.shiftDateRange(-1,e)}}
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(!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=>{this.shiftDateRange(1,e)}}
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=>h.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=${m.ifDefined(this.minDate)}
49
+ @change=${e=>{e.preventDefault(),e.stopPropagation();const t=this.getDateFormat(),a=s(e.detail.value,t).format(t);this.dateFrom.value=a,this.checkOutInput.setAttribute("min",a)}}
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=${m.ifDefined(this.dateFrom.value)}
58
+ max=${m.ifDefined(this.maxDate)}
59
+ @change=${e=>{e.preventDefault(),e.stopPropagation();const t=this.getDateFormat(),a=s(e.detail.value,t).format(t);this.dateTo.value=a}}
60
+ ></schmancy-input>
61
+
62
+ <schmancy-button
63
+ type="button"
64
+ variant="outlined"
65
+ @click=${e=>{this.handleDateRangeChange(e)}}
66
+ >
67
+ Apply
68
+ </schmancy-button>
69
+ </schmancy-grid>
70
+ </schmancy-menu>
71
+ `}};c([d.property({type:String})],i.prototype,"type",2),c([d.property({type:Object})],i.prototype,"dateFrom",2),c([d.property({type:Object})],i.prototype,"dateTo",2),c([d.property({type:String})],i.prototype,"minDate",2),c([d.property({type:String})],i.prototype,"maxDate",2),c([d.query("#checkin")],i.prototype,"checkInInput",2),c([d.query("#checkout")],i.prototype,"checkOutInput",2),c([d.query("schmancy-menu")],i.prototype,"schmancyMenu",2),c([d.state()],i.prototype,"selectedDateRange",2),i=c([d.customElement("schmancy-date-range")],i);
72
+ //# sourceMappingURL=date-range-vQa6u7Kc.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-range-vQa6u7Kc.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\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}\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, event: Event) {\n\t\tevent.stopPropagation() // Prevent click from bubbling to the schmancy-button\n\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\t/**\n\t * Applies the date range from the inputs.\n\t * Closes the menu when done.\n\t */\n\tprivate handleDateRangeChange(event: Event) {\n\t\tevent.stopPropagation() // Prevent click from bubbling to the schmancy-button\n\t\tthis.setDateRange(this.dateFrom.value, this.dateTo.value)\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\tthis.shiftDateRange(-1, e) // Pass the event\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(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\tthis.shiftDateRange(1, e) // Pass the event\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\tthis.handleDateRangeChange(e)\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","factor","event","stopPropagation","currentDiff","diff","newDateFrom","newDateTo","html","e","shiftDateRange","String","map","handlePresetChange","ifDefined","minDate","preventDefault","fmt","selectedDate","checkOutInput","setAttribute","maxDate","handleDateRangeChange","__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,KAAK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B,OAAOP,MAAO+C,CAAKhE,EAAAA,OAAOgE,GAC5D3D,KAAKS,OAAOG,MAAQgD,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAOXT,GACTnD,CAAAA,KAAKgE,sBAAsBb,CAAC,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAC5B,CAlSsBc,EAAAA,EAAA,CAA3BC,WAAS,CAAEjE,KAAMoD,MAAAA,CAAAA,CAAAA,EAFEzD,EAEQuE,UAAA,OAAA,GAEAF,EAAA,CAA3BC,WAAS,CAAEjE,KAAMmE,MAJExE,CAAAA,CAAAA,EAAAA,EAIQuE,UAAA,WAAA,CAAA,EACAF,EAAA,CAA3BC,WAAS,CAAEjE,KAAMmE,UALExE,EAKQuE,UAAA,SAAA,CAGAF,EAAAA,EAAA,CAA3BC,WAAS,CAAEjE,KAAMoD,MAAAA,CAAAA,CAAAA,EAREzD,EAQQuE,UAAA,UAAA,CACAF,EAAAA,EAAA,CAA3BC,WAAS,CAAEjE,KAAMoD,UATEzD,EASQuE,UAAA,UAAA,CAETF,EAAAA,EAAA,CAAlBI,EAAAA,MAAM,aAXazE,EAWDuE,UAAA,eAAA,CACCF,EAAAA,EAAA,CAAnBI,EAAAA,MAAM,WAZazE,CAAAA,EAAAA,EAYAuE,UAAA,gBAAA,GAGIF,EAAA,CAAvBI,EAAAA,MAAM,eAAA,CAAA,EAfazE,EAeIuE,UAAA,eAAA,GAGfF,EAAA,CAARK,EAAMA,MAlBa1E,CAAAA,EAAAA,EAkBXuE,UAAA,oBAAA,CAAA,EAlBWvE,EAArBqE,EAAA,CADCM,EAAAA,cAAc,qBACM3E,CAAAA,EAAAA,CAAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";require("./date-range-DBxAQrWq.cjs");
1
+ "use strict";require("./date-range-vQa6u7Kc.cjs");
2
2
  //# sourceMappingURL=date-range.cjs.map
@@ -1,2 +1,2 @@
1
- import "./date-range-eiBhfMFP.js";
1
+ import "./date-range-_0s6SDfu.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-CoNHPVcy.cjs");const r=require("./area.component-D_L_-rhD.cjs");require("./autocomplete-ButddDCL.cjs"),require("./spinner-DGtAaEn5.cjs");const o=require("./icon-button-CQafspg2.cjs"),e=require("./teleport.component-CGUs59ol.cjs"),u=require("./checkbox-CC0UeBQR.cjs");require("./chips-9AOuHsA9.cjs");const b=require("./payment-card-form-C03BsKJ1.cjs");require("./date-range-DBxAQrWq.cjs");const m=require("./delay-DMiYzQSi.cjs"),c=require("./ripple-C2BHbhcS.cjs");require("./divider-Cv8bePwT.cjs"),require("./form-BCqsvcur.cjs"),require("./icon-VtRCgMjd.cjs"),require("./input-CZPti4j7.cjs");const t=require("./flex-CCO2kjCx.cjs"),a=require("./list-Dy8fudM4.cjs");require("./menu-qiBmvTtT.cjs");const i=require("./outlet-B9NdhBgt.cjs");require("./option-DFjInzHW.cjs");const l=require("./radio-group-DrwawzHG.cjs"),p=require("./rxjs-utils.cjs");require("rxjs"),require("./index-DyJ0oDpR.cjs");const d=require("./select-C3UtMXwp.cjs"),n=require("./sheet-CMTmiZXv.cjs"),S=require("./slider-BQQQ9rrx.cjs"),h=require("./surface-DbSB7aBq.cjs");require("./table-CJzGX5VB.cjs"),require("./tabs-group-BO-vC7go.cjs"),require("./textarea-B1XE6nT1.cjs");const y=require("./theme.component-4cjbFqy7.cjs"),f=require("./theme.interface-Xg5Zi46a.cjs");require("./theme-button-mmu8bUNx.cjs");const g=require("./tree-D07FpMNb.cjs"),q=require("./types.cjs"),O=require("./typewriter-C9L0TA4Y.cjs"),w=require("./typography-BHeQxLl8.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:()=>u.SchmancyCheckbox}),Object.defineProperty(exports,"SchmancyPaymentCardForm",{enumerable:!0,get:()=>b.SchmancyPaymentCardForm}),Object.defineProperty(exports,"SchmancyDelay",{enumerable:!0,get:()=>m.SchmancyDelay}),exports.delayContext=m.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:()=>a.List}),Object.defineProperty(exports,"SchmancyListItem",{enumerable:!0,get:()=>a.SchmancyListItem}),exports.SchmancyListTypeContext=a.SchmancyListTypeContext,exports.$notify=i.$notify,Object.defineProperty(exports,"SchmancyNotification",{enumerable:!0,get:()=>i.SchmancyNotification}),Object.defineProperty(exports,"SchmancyNotificationOutlet",{enumerable:!0,get:()=>i.SchmancyNotificationOutlet}),Object.defineProperty(exports,"RadioGroup",{enumerable:!0,get:()=>l.RadioGroup}),exports.mutationObserver=p.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:()=>S.SchmancySlide}),Object.defineProperty(exports,"SchmancySlider",{enumerable:!0,get:()=>S.SchmancySlider}),Object.defineProperty(exports,"SchmancySurface",{enumerable:!0,get:()=>h.SchmancySurface}),exports.SchmancySurfaceTypeContext=h.SchmancySurfaceTypeContext,Object.defineProperty(exports,"SchmancyThemeComponent",{enumerable:!0,get:()=>y.SchmancyThemeComponent}),exports.formateTheme=y.formateTheme,exports.tailwindStyles=y.tailwindStyles,exports.SchmancyTheme=f.SchmancyTheme,Object.defineProperty(exports,"SchmancyTree",{enumerable:!0,get:()=>g.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$;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./animated-text-CoNHPVcy.cjs");const r=require("./area.component-D_L_-rhD.cjs");require("./autocomplete-ButddDCL.cjs"),require("./spinner-DGtAaEn5.cjs");const o=require("./icon-button-CQafspg2.cjs"),e=require("./teleport.component-DbLxhqqJ.cjs"),u=require("./checkbox-CC0UeBQR.cjs");require("./chips-9AOuHsA9.cjs");const b=require("./payment-card-form-C03BsKJ1.cjs");require("./date-range-vQa6u7Kc.cjs");const m=require("./delay-DMiYzQSi.cjs"),c=require("./ripple-C2BHbhcS.cjs");require("./divider-Cv8bePwT.cjs"),require("./form-BCqsvcur.cjs"),require("./icon-VtRCgMjd.cjs"),require("./input-CZPti4j7.cjs");const t=require("./flex-CCO2kjCx.cjs"),a=require("./list-Cd7iC1no.cjs");require("./menu-DS5Lkay4.cjs");const i=require("./outlet-B9NdhBgt.cjs");require("./option-DFjInzHW.cjs");const l=require("./radio-group-DrwawzHG.cjs"),p=require("./rxjs-utils.cjs");require("rxjs"),require("./index-DyJ0oDpR.cjs");const d=require("./select-C3UtMXwp.cjs"),n=require("./sheet-BS8CLge_.cjs"),S=require("./slider-BQQQ9rrx.cjs"),h=require("./surface-DbSB7aBq.cjs");require("./table-CJzGX5VB.cjs"),require("./tabs-group-BO-vC7go.cjs"),require("./textarea-B1XE6nT1.cjs");const y=require("./theme.component-4cjbFqy7.cjs"),f=require("./theme.interface-Xg5Zi46a.cjs");require("./theme-button-mmu8bUNx.cjs");const g=require("./tree-D07FpMNb.cjs"),q=require("./types.cjs"),O=require("./typewriter-C9L0TA4Y.cjs"),w=require("./typography-BHeQxLl8.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:()=>u.SchmancyCheckbox}),Object.defineProperty(exports,"SchmancyPaymentCardForm",{enumerable:!0,get:()=>b.SchmancyPaymentCardForm}),Object.defineProperty(exports,"SchmancyDelay",{enumerable:!0,get:()=>m.SchmancyDelay}),exports.delayContext=m.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:()=>a.List}),Object.defineProperty(exports,"SchmancyListItem",{enumerable:!0,get:()=>a.SchmancyListItem}),exports.SchmancyListTypeContext=a.SchmancyListTypeContext,exports.$notify=i.$notify,Object.defineProperty(exports,"SchmancyNotification",{enumerable:!0,get:()=>i.SchmancyNotification}),Object.defineProperty(exports,"SchmancyNotificationOutlet",{enumerable:!0,get:()=>i.SchmancyNotificationOutlet}),Object.defineProperty(exports,"RadioGroup",{enumerable:!0,get:()=>l.RadioGroup}),exports.mutationObserver=p.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:()=>S.SchmancySlide}),Object.defineProperty(exports,"SchmancySlider",{enumerable:!0,get:()=>S.SchmancySlider}),Object.defineProperty(exports,"SchmancySurface",{enumerable:!0,get:()=>h.SchmancySurface}),exports.SchmancySurfaceTypeContext=h.SchmancySurfaceTypeContext,Object.defineProperty(exports,"SchmancyThemeComponent",{enumerable:!0,get:()=>y.SchmancyThemeComponent}),exports.formateTheme=y.formateTheme,exports.tailwindStyles=y.tailwindStyles,exports.SchmancyTheme=f.SchmancyTheme,Object.defineProperty(exports,"SchmancyTree",{enumerable:!0,get:()=>g.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,11 +3,11 @@ import { F as C, H as d, b as T, S as u, a as b, r as N } from "./area.component
3
3
  import "./autocomplete-mnVXXSzl.js";
4
4
  import "./spinner-mbCqGAta.js";
5
5
  import { S as R, a as v } from "./icon-button-CJ-eY6wF.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 L, i as O, k as W, 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-B2hJQblG.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 L, i as O, k as W, 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-lGN5dIBu.js";
7
7
  import { S as U } from "./checkbox-CwxyfGAd.js";
8
8
  import "./chips-Rnq5GOEq.js";
9
9
  import { S as Z } from "./payment-card-form-E08S_U7K.js";
10
- import "./date-range-eiBhfMFP.js";
10
+ import "./date-range-_0s6SDfu.js";
11
11
  import { S as ra, d as ea } from "./delay-w1zFi9km.js";
12
12
  import { c as oa, f as ca, r as ma } from "./ripple-BumgqsDT.js";
13
13
  import "./divider-QNGduBj3.js";
@@ -15,8 +15,8 @@ import "./form-G748qOFO.js";
15
15
  import "./icon-VpDcG-1m.js";
16
16
  import "./input-Bl7sD2lt.js";
17
17
  import { S as sa, c as Sa, a as ha, b as ia } from "./flex-BD4c3vZt.js";
18
- import { L as pa, a as fa, S as xa } from "./list-CXPHvvQw.js";
19
- import "./menu-Cpld82tG.js";
18
+ import { L as pa, a as fa, S as xa } from "./list-ClmkvF6W.js";
19
+ import "./menu-DilY6y1N.js";
20
20
  import { $ as wa, S as Da, a as Ca } from "./outlet-Ivt5XK7t.js";
21
21
  import "./option-CXpO0NeB.js";
22
22
  import { R as Ta } from "./radio-group-BzITeo1Z.js";
@@ -24,7 +24,7 @@ import { mutationObserver as ba } from "./rxjs-utils.js";
24
24
  import "rxjs";
25
25
  import "./index-CuY8m6ta.js";
26
26
  import { S as Ha } from "./select-B6Us7Kk8.js";
27
- import { S as va, b as Ia, a as Ma, s as ga } from "./sheet-DrKmM05e.js";
27
+ import { S as va, b as Ia, a as Ma, s as ga } from "./sheet-QdCPv8wr.js";
28
28
  import { S as Aa, a as Fa } from "./slider-BYmWjukU.js";
29
29
  import { a as $a, S as ka } from "./surface-CN6Y9D0w.js";
30
30
  import "./table-BGHYGmrv.js";
@@ -0,0 +1,17 @@
1
+ "use strict";const h=require("./consume-Bb7_UzYd.cjs");require("rxjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const y=require("./tailwind.mixin-CJgIYh7g.cjs"),d=require("./provide-DSU87U5x.cjs"),p=require("lit"),r=require("lit/decorators.js"),m=require("lit/directives/when.js"),u=d.n(void 0),f=d.n("surface");var g=Object.defineProperty,v=Object.getOwnPropertyDescriptor,a=(i,t,s,n)=>{for(var o,e=n>1?void 0:n?v(t,s):t,l=i.length-1;l>=0;l--)(o=i[l])&&(e=(n?o(t,s,e):o(e))||e);return n&&e&&g(t,s,e),e};exports.SchmancyListItem=class extends y.TailwindElement(){constructor(){super(...arguments),this.selected=!1}get imgClasses(){return["h-[24px]","w-[24px]","object-contain"]}firstUpdated(){var i,t;(i=this.leading)==null||i.forEach(s=>{s.classList.add(...this.imgClasses)}),(t=this.trailing)==null||t.forEach(s=>{s.classList.add(...this.imgClasses)})}render(){const i={"rounded-none":this.rounded===!1,"rounded-full":this.rounded,"relative inset-0 w-full flex items-center min-h-[56px] py-[8px] px-[16px] duration-500 transition-colors focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:z-1 outline-secondary-default outline-hidden":!0,"bg-secondary-container text-secondery-onContainer":this.selected},t={"z-0 duration-500 transition-opacity":!0,"rounded-none":this.rounded===!1,"rounded-full":this.rounded,"hover:bg-surface-on opacity-[0.08] cursor-pointer absolute inset-0 ":!this.readonly};return p.html` <li .tabIndex=${this.readonly?-1:0} class=${this.classMap(i)}>
2
+ ${m.when(!this.readonly,()=>p.html` <div class="${this.classMap(t)}"></div>`)}
3
+ <slot></slot>
4
+ </li>`}},a([h.c({context:f,subscribe:!0}),r.property()],exports.SchmancyListItem.prototype,"variant",2),a([r.property({type:Boolean})],exports.SchmancyListItem.prototype,"rounded",2),a([r.property({type:Boolean})],exports.SchmancyListItem.prototype,"readonly",2),a([r.property({type:Boolean})],exports.SchmancyListItem.prototype,"selected",2),a([r.queryAssignedElements({slot:"leading",flatten:!0})],exports.SchmancyListItem.prototype,"leading",2),a([r.queryAssignedElements({slot:"trailing",flatten:!0})],exports.SchmancyListItem.prototype,"trailing",2),exports.SchmancyListItem=a([r.customElement("schmancy-list-item")],exports.SchmancyListItem);var b=Object.defineProperty,L=Object.getOwnPropertyDescriptor,c=(i,t,s,n)=>{for(var o,e=n>1?void 0:n?L(t,s):t,l=i.length-1;l>=0;l--)(o=i[l])&&(e=(n?o(t,s,e):o(e))||e);return n&&e&&b(t,s,e),e};exports.List=class extends y.TailwindElement(p.css`
5
+ :host {
6
+ display: block;
7
+ padding-top: 8px;
8
+ padding-bottom: 8px;
9
+ }
10
+ `){constructor(){super(...arguments),this.fill="auto",this.elevation=0}render(){return p.html`
11
+ <schmancy-surface .elevation=${this.elevation} .fill=${this.fill} type=${this.surface}>
12
+ <ul>
13
+ <slot></slot>
14
+ </ul>
15
+ </schmancy-surface>
16
+ `}},c([d.e({context:u}),r.property()],exports.List.prototype,"surface",2),c([r.property({type:String,reflect:!0})],exports.List.prototype,"fill",2),c([r.property({type:Number})],exports.List.prototype,"elevation",2),exports.List=c([r.customElement("schmancy-list")],exports.List),exports.SchmancyListTypeContext=u;
17
+ //# sourceMappingURL=list-Cd7iC1no.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-Dy8fudM4.cjs","sources":["../src/list/context.ts","../src/surface/context.ts","../src/list/list-item.ts","../src/list/list.ts"],"sourcesContent":["import { createContext } from '@lit/context'\nimport { TSurfaceColor } from '@schmancy/types/surface'\nexport const SchmancyListTypeContext = createContext<TSurfaceColor>(undefined)\n","import { createContext } from '@lit/context'\nimport { TSurfaceColor } from '@schmancy/types/surface'\nexport const SchmancySurfaceTypeContext = createContext<TSurfaceColor>('surface')\n","import { consume } from '@lit/context'\nimport { TailwindElement } from '@mixins/index'\nimport { SchmancySurfaceTypeContext } from '@schmancy/surface/context'\nimport { TSurfaceColor } from '@schmancy/types/surface'\nimport { html } from 'lit'\nimport { customElement, property, queryAssignedElements } from 'lit/decorators.js'\nimport { when } from 'lit/directives/when.js'\n\n/**\n * @element schmancy-list-item\n * @slot leading - leading content\n * @slot trailing - trailing content\n * @slot - default content\n */\n@customElement('schmancy-list-item')\nexport class SchmancyListItem extends TailwindElement() {\n\t@consume({ context: SchmancySurfaceTypeContext, subscribe: true })\n\t@property()\n\tvariant: TSurfaceColor\n\n\t@property({ type: Boolean })\n\trounded: boolean\n\n\t@property({ type: Boolean }) readonly: boolean\n\n\t@property({ type: Boolean }) selected: boolean = false\n\n\t@queryAssignedElements({\n\t\tslot: 'leading',\n\t\tflatten: true,\n\t})\n\tprivate leading!: HTMLElement[]\n\n\t@queryAssignedElements({\n\t\tslot: 'trailing',\n\t\tflatten: true,\n\t})\n\tprivate trailing!: HTMLElement[]\n\n\tprotected get imgClasses(): string[] {\n\t\treturn ['h-[24px]', 'w-[24px]', 'object-contain']\n\t}\n\n\tfirstUpdated() {\n\t\tthis.leading?.forEach(img => {\n\t\t\timg.classList.add(...this.imgClasses)\n\t\t})\n\t\tthis.trailing?.forEach(img => {\n\t\t\timg.classList.add(...this.imgClasses)\n\t\t})\n\t}\n\n\trender() {\n\t\tconst classes = {\n\t\t\t'rounded-none': this.rounded === false,\n\t\t\t'rounded-full': this.rounded,\n\t\t\t'relative inset-0 w-full flex items-center min-h-[56px] py-[8px] px-[16px] duration-500 transition-colors focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:z-1 outline-secondary-default outline-hidden':\n\t\t\t\ttrue,\n\t\t\t'bg-secondary-container text-secondery-onContainer': this.selected,\n\t\t}\n\n\t\tconst stateLayerClasses = {\n\t\t\t'z-0 duration-500 transition-opacity': true,\n\t\t\t'rounded-none': this.rounded === false,\n\t\t\t'rounded-full': this.rounded,\n\t\t\t'hover:bg-surface-on opacity-[0.08] cursor-pointer absolute inset-0 ': !this.readonly,\n\t\t}\n\t\treturn html` <li .tabIndex=${this.readonly ? -1 : 0} class=${this.classMap(classes)}>\n\t\t\t${when(!this.readonly, () => html` <div class=\"${this.classMap(stateLayerClasses)}\"></div>`)}\n\t\t\t<slot></slot>\n\t\t</li>`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-list-item': SchmancyListItem\n\t}\n}\n","import { provide } from '@lit/context'\nimport { TailwindElement } from '@mixins/index'\nimport { SchmancySurfaceFill } from '@schmancy/surface'\nimport { TSurfaceColor } from '@schmancy/types/surface'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { SchmancyListTypeContext } from './context'\n\n/**\n * `<schmancy-list>` component.\n *\n * A list component that wraps its content within a customizable surface.\n * It allows you to set the surface type and fill style, and can optionally\n * enable scrolling behavior by delegating the scroller attribute to the surface.\n *\n * @element schmancy-list\n * @slot - The default slot for list items.\n *\n * @example\n * <schmancy-list surface=\"container\" scroller>\n * <schmancy-list-item>List Item 1</schmancy-list-item>\n * </schmancy-list>\n */\n@customElement('schmancy-list')\nexport class List extends TailwindElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\tpadding-top: 8px;\n\t\tpadding-bottom: 8px;\n\t}\n`) {\n\t/**\n\t * Defines the type or color of the surface used by the component.\n\t * This value is provided to descendant components via context.\n\t *\n\t * @attr surface\n\t * @type {TSurfaceColor}\n\t * @default 'surface'\n\t */\n\t@provide({ context: SchmancyListTypeContext })\n\t@property()\n\tsurface: TSurfaceColor\n\n\t/**\n\t * Determines the fill style of the underlying surface.\n\t *\n\t * @attr fill\n\t * @type {SchmancySurfaceFill}\n\t * @default 'auto'\n\t */\n\t@property({ type: String, reflect: true })\n\tfill: SchmancySurfaceFill = 'auto'\n\n\t/**\n\t * When set to true, the surface component will handle scrolling behavior.\n\t * This is achieved by passing the boolean attribute to <schmancy-surface>.\n\t *\n\t * @attr scroller\n\t * @type {boolean}\n\t * @default false\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tscroller: boolean = false\n\n\t/**\n\t * Defines the elevation level of the surface.\n\t *\n\t * @attr elevation\n\t * @type {number}\n\t * @default 0\n\t */\n\t@property({ type: Number })\n\televation: 0 | 1 | 2 | 3 | 4 | 5 = 0\n\n\t/**\n\t * Renders the component's template.\n\t * The list content is wrapped inside a `<schmancy-surface>` element.\n\t * The scroller property is delegated to the surface so that it controls\n\t * the scrollable behavior.\n\t *\n\t * @returns The HTML template for the component.\n\t */\n\trender() {\n\t\treturn html`\n\t\t\t<schmancy-surface .elevation=${this.elevation} .fill=${this.fill} type=${this.surface} ?scroller=${this.scroller}>\n\t\t\t\t<ul>\n\t\t\t\t\t<slot></slot>\n\t\t\t\t</ul>\n\t\t\t</schmancy-surface>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-list': List\n\t}\n}\n"],"names":["SchmancyListTypeContext","createContext","SchmancySurfaceTypeContext","SchmancyListItem","TailwindElement","super","arguments","this","selected","leading","forEach","img","classList","add","imgClasses","trailing","classes","rounded","stateLayerClasses","readonly","html","classMap","when","__decorateClass","consume","context","subscribe","property","prototype","type","Boolean","queryAssignedElements","slot","flatten","customElement","List","css","fill","scroller","elevation","surface","provide","String","reflect","Number"],"mappings":"4TAEaA,EAAAA,EAA0BC,IAA6B,MAAA,ECAvDC,EAA6BD,IAA6B,2MCa1DE,QAAAA,iBAAN,cAA+BC,EAAAA,gBAA/B,CAAA,CAAA,cAAAC,MAAAC,GAAAA,SAAAA,EAU2CC,KAAAC,SAAAA,EAAA,CAcjD,IAAA,aACQ,MAAA,CAAC,WAAY,WAAY,gBAAA,CAAgB,CAGjD,wBACMD,EAAAA,KAAAE,UAAAF,MAAAA,EAASG,QAAeC,GAC5BA,CAAAA,EAAIC,UAAUC,IAAON,GAAAA,KAAKO,UAAU,CAAA,IAEhCP,EAAAA,KAAAQ,WAAAR,MAAAA,EAAUG,QAAeC,IAC7BA,EAAIC,UAAUC,OAAON,KAAKO,UAAAA,CAAU,EACpC,CAGF,QACC,CAAA,MAAME,EAAU,CACf,eAAgBT,KAAKU,UAArB,GACA,eAAgBV,KAAKU,QACrB,0PACC,GACD,oDAAqDV,KAAKC,QAAAA,EAGrDU,EAAoB,CACzB,sCAAA,GACA,eAAgBX,KAAKU,UAArB,GACA,eAAgBV,KAAKU,QACrB,uEAAwEV,KAAKY,QAAAA,EAEvE,OAAAC,wBAAsBb,KAAKY,YAAgB,CAAA,UAAWZ,KAAKc,SAASL,CAAAA,CAAAA;AAAAA,KACxEM,QAAMf,KAAKY,SAAU,IAAMC,EAAoBA,oBAAAb,KAAKc,SAASH,CAAA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Q,CAAEhB,QAASzB,CACnB2B,CAAAA,EAAAA,EAASA,SAhBEQ,CAAAA,EAAAA,aAiBZP,UAAA,UAAA,CAUAL,EAAAA,EAAA,CADCI,EAAAA,SAAS,CAAEE,KAAMa,OAAQC,QAAS,EAAA,CAAA,CAAA,EA1BvBR,aA2BZP,UAAA,OAAA,CAWAL,EAAAA,EAAA,CADCI,EAAAA,SAAS,CAAEE,KAAMC,QAASa,QAAAA,EArCfR,CAAAA,CAAAA,EAAAA,aAsCZP,UAAA,WAAA,CAAA,EAUAL,EAAA,CADCI,WAAS,CAAEE,KAAMe,MAAAA,CAAAA,CAAAA,EA/CNT,aAgDZP,UAAA,YAAA,CAhDYO,EAAAA,QAANA,KAAAZ,EAAA,CADNW,EAAAA,cAAc,eAAA,CAAA,EACFC"}
1
+ {"version":3,"file":"list-Cd7iC1no.cjs","sources":["../src/list/context.ts","../src/surface/context.ts","../src/list/list-item.ts","../src/list/list.ts"],"sourcesContent":["import { createContext } from '@lit/context'\nimport { TSurfaceColor } from '@schmancy/types/surface'\nexport const SchmancyListTypeContext = createContext<TSurfaceColor>(undefined)\n","import { createContext } from '@lit/context'\nimport { TSurfaceColor } from '@schmancy/types/surface'\nexport const SchmancySurfaceTypeContext = createContext<TSurfaceColor>('surface')\n","import { consume } from '@lit/context'\nimport { TailwindElement } from '@mixins/index'\nimport { SchmancySurfaceTypeContext } from '@schmancy/surface/context'\nimport { TSurfaceColor } from '@schmancy/types/surface'\nimport { html } from 'lit'\nimport { customElement, property, queryAssignedElements } from 'lit/decorators.js'\nimport { when } from 'lit/directives/when.js'\n\n/**\n * @element schmancy-list-item\n * @slot leading - leading content\n * @slot trailing - trailing content\n * @slot - default content\n */\n@customElement('schmancy-list-item')\nexport class SchmancyListItem extends TailwindElement() {\n\t@consume({ context: SchmancySurfaceTypeContext, subscribe: true })\n\t@property()\n\tvariant: TSurfaceColor\n\n\t@property({ type: Boolean })\n\trounded: boolean\n\n\t@property({ type: Boolean }) readonly: boolean\n\n\t@property({ type: Boolean }) selected: boolean = false\n\n\t@queryAssignedElements({\n\t\tslot: 'leading',\n\t\tflatten: true,\n\t})\n\tprivate leading!: HTMLElement[]\n\n\t@queryAssignedElements({\n\t\tslot: 'trailing',\n\t\tflatten: true,\n\t})\n\tprivate trailing!: HTMLElement[]\n\n\tprotected get imgClasses(): string[] {\n\t\treturn ['h-[24px]', 'w-[24px]', 'object-contain']\n\t}\n\n\tfirstUpdated() {\n\t\tthis.leading?.forEach(img => {\n\t\t\timg.classList.add(...this.imgClasses)\n\t\t})\n\t\tthis.trailing?.forEach(img => {\n\t\t\timg.classList.add(...this.imgClasses)\n\t\t})\n\t}\n\n\trender() {\n\t\tconst classes = {\n\t\t\t'rounded-none': this.rounded === false,\n\t\t\t'rounded-full': this.rounded,\n\t\t\t'relative inset-0 w-full flex items-center min-h-[56px] py-[8px] px-[16px] duration-500 transition-colors focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:z-1 outline-secondary-default outline-hidden':\n\t\t\t\ttrue,\n\t\t\t'bg-secondary-container text-secondery-onContainer': this.selected,\n\t\t}\n\n\t\tconst stateLayerClasses = {\n\t\t\t'z-0 duration-500 transition-opacity': true,\n\t\t\t'rounded-none': this.rounded === false,\n\t\t\t'rounded-full': this.rounded,\n\t\t\t'hover:bg-surface-on opacity-[0.08] cursor-pointer absolute inset-0 ': !this.readonly,\n\t\t}\n\t\treturn html` <li .tabIndex=${this.readonly ? -1 : 0} class=${this.classMap(classes)}>\n\t\t\t${when(!this.readonly, () => html` <div class=\"${this.classMap(stateLayerClasses)}\"></div>`)}\n\t\t\t<slot></slot>\n\t\t</li>`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-list-item': SchmancyListItem\n\t}\n}\n","import { provide } from '@lit/context'\nimport { TailwindElement } from '@mixins/index'\nimport { SchmancySurfaceFill } from '@schmancy/surface'\nimport { TSurfaceColor } from '@schmancy/types/surface'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { SchmancyListTypeContext } from './context'\n\n/**\n * `<schmancy-list>` component.\n *\n * A list component that wraps its content within a customizable surface.\n * It allows you to set the surface type and fill style, and can optionally\n * enable scrolling behavior by delegating the scroller attribute to the surface.\n *\n * @element schmancy-list\n * @slot - The default slot for list items.\n *\n * @example\n * <schmancy-list surface=\"container\" scroller>\n * <schmancy-list-item>List Item 1</schmancy-list-item>\n * </schmancy-list>\n */\n@customElement('schmancy-list')\nexport class List extends TailwindElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\tpadding-top: 8px;\n\t\tpadding-bottom: 8px;\n\t}\n`) {\n\t/**\n\t * Defines the type or color of the surface used by the component.\n\t * This value is provided to descendant components via context.\n\t *\n\t * @attr surface\n\t * @type {TSurfaceColor}\n\t * @default 'surface'\n\t */\n\t@provide({ context: SchmancyListTypeContext })\n\t@property()\n\tsurface: TSurfaceColor\n\n\t/**\n\t * Determines the fill style of the underlying surface.\n\t *\n\t * @attr fill\n\t * @type {SchmancySurfaceFill}\n\t * @default 'auto'\n\t */\n\t@property({ type: String, reflect: true })\n\tfill: SchmancySurfaceFill = 'auto'\n\n\t/**\n\t * Defines the elevation level of the surface.\n\t *\n\t * @attr elevation\n\t * @type {number}\n\t * @default 0\n\t */\n\t@property({ type: Number })\n\televation: 0 | 1 | 2 | 3 | 4 | 5 = 0\n\n\t/**\n\t * Renders the component's template.\n\t * The list content is wrapped inside a `<schmancy-surface>` element.\n\t * The scroller property is delegated to the surface so that it controls\n\t * the scrollable behavior.\n\t *\n\t * @returns The HTML template for the component.\n\t */\n\trender() {\n\t\treturn html`\n\t\t\t<schmancy-surface .elevation=${this.elevation} .fill=${this.fill} type=${this.surface}>\n\t\t\t\t<ul>\n\t\t\t\t\t<slot></slot>\n\t\t\t\t</ul>\n\t\t\t</schmancy-surface>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-list': List\n\t}\n}\n"],"names":["SchmancyListTypeContext","createContext","SchmancySurfaceTypeContext","SchmancyListItem","TailwindElement","super","arguments","this","selected","leading","forEach","img","classList","add","imgClasses","trailing","classes","rounded","stateLayerClasses","readonly","html","classMap","when","__decorateClass","consume","context","subscribe","property","prototype","type","Boolean","queryAssignedElements","slot","flatten","customElement","List","css","fill","elevation","surface","provide","String","reflect","Number"],"mappings":"4TAEaA,EAAAA,EAA0BC,IAA6B,MAAA,ECAvDC,EAA6BD,IAA6B,2MCa1DE,QAAAA,iBAAN,cAA+BC,EAAAA,gBAA/B,CAAA,CAAA,cAAAC,MAAAC,GAAAA,SAAAA,EAU2CC,KAAAC,SAAAA,EAAA,CAcjD,IAAA,aACQ,MAAA,CAAC,WAAY,WAAY,gBAAA,CAAgB,CAGjD,wBACMD,EAAAA,KAAAE,UAAAF,MAAAA,EAASG,QAAeC,GAC5BA,CAAAA,EAAIC,UAAUC,IAAON,GAAAA,KAAKO,UAAU,CAAA,IAEhCP,EAAAA,KAAAQ,WAAAR,MAAAA,EAAUG,QAAeC,IAC7BA,EAAIC,UAAUC,OAAON,KAAKO,UAAAA,CAAU,EACpC,CAGF,QACC,CAAA,MAAME,EAAU,CACf,eAAgBT,KAAKU,UAArB,GACA,eAAgBV,KAAKU,QACrB,0PACC,GACD,oDAAqDV,KAAKC,QAAAA,EAGrDU,EAAoB,CACzB,sCAAA,GACA,eAAgBX,KAAKU,UAArB,GACA,eAAgBV,KAAKU,QACrB,uEAAwEV,KAAKY,QAAAA,EAEvE,OAAAC,wBAAsBb,KAAKY,YAAgB,CAAA,UAAWZ,KAAKc,SAASL,CAAAA,CAAAA;AAAAA,KACxEM,QAAMf,KAAKY,SAAU,IAAMC,EAAoBA,oBAAAb,KAAKc,SAASH,CAAAA,CAAAA,UAAAA,CAAAA;AAAAA;AAAAA,QAA6B,CAAA,EAlD9FK,EAAA,CAFCC,EAAAA,EAAQ,CAAEC,QAASvB,EAA4BwB,UAAW,EAAA,CAAA,EAC1DC,EAASA,SAF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,aA2BZP,UAAA,OAAA,CAAA,EAUAL,EAAA,CADCI,WAAS,CAAEE,KAAMc,MApCNR,CAAAA,CAAAA,EAAAA,aAqCZP,UAAA,YAAA,CArCYO,EAAAA,QAANA,KAAAZ,EAAA,CADNW,EAAAA,cAAc,eACFC,CAAAA,EAAAA"}
@@ -5,10 +5,10 @@ import "lit/directives/style-map.js";
5
5
  import { T as y } from "./tailwind.mixin-D4STgS5j.js";
6
6
  import { n as h, e as v } from "./provide-BLSgVvMJ.js";
7
7
  import { html as u, css as b } from "lit";
8
- import { property as l, queryAssignedElements as f, customElement as m } from "lit/decorators.js";
8
+ import { property as p, queryAssignedElements as f, customElement as m } from "lit/decorators.js";
9
9
  import { when as x } from "lit/directives/when.js";
10
10
  const $ = h(void 0), O = h("surface");
11
- var j = Object.defineProperty, w = Object.getOwnPropertyDescriptor, c = (s, e, o, r) => {
11
+ var j = Object.defineProperty, w = Object.getOwnPropertyDescriptor, l = (s, e, o, r) => {
12
12
  for (var n, t = r > 1 ? void 0 : r ? w(e, o) : e, a = s.length - 1; a >= 0; a--) (n = s[a]) && (t = (r ? n(e, o, t) : n(t)) || t);
13
13
  return r && t && j(e, o, t), t;
14
14
  };
@@ -35,12 +35,12 @@ let i = class extends y() {
35
35
  </li>`;
36
36
  }
37
37
  };
38
- c([g({ context: O, subscribe: !0 }), l()], i.prototype, "variant", 2), c([l({ type: Boolean })], i.prototype, "rounded", 2), c([l({ type: Boolean })], i.prototype, "readonly", 2), c([l({ type: Boolean })], i.prototype, "selected", 2), c([f({ slot: "leading", flatten: !0 })], i.prototype, "leading", 2), c([f({ slot: "trailing", flatten: !0 })], i.prototype, "trailing", 2), i = c([m("schmancy-list-item")], i);
39
- var B = Object.defineProperty, C = Object.getOwnPropertyDescriptor, d = (s, e, o, r) => {
40
- for (var n, t = r > 1 ? void 0 : r ? C(e, o) : e, a = s.length - 1; a >= 0; a--) (n = s[a]) && (t = (r ? n(e, o, t) : n(t)) || t);
41
- return r && t && B(e, o, t), t;
38
+ l([g({ context: O, subscribe: !0 }), p()], i.prototype, "variant", 2), l([p({ type: Boolean })], i.prototype, "rounded", 2), l([p({ type: Boolean })], i.prototype, "readonly", 2), l([p({ type: Boolean })], i.prototype, "selected", 2), l([f({ slot: "leading", flatten: !0 })], i.prototype, "leading", 2), l([f({ slot: "trailing", flatten: !0 })], i.prototype, "trailing", 2), i = l([m("schmancy-list-item")], i);
39
+ var C = Object.defineProperty, E = Object.getOwnPropertyDescriptor, d = (s, e, o, r) => {
40
+ for (var n, t = r > 1 ? void 0 : r ? E(e, o) : e, a = s.length - 1; a >= 0; a--) (n = s[a]) && (t = (r ? n(e, o, t) : n(t)) || t);
41
+ return r && t && C(e, o, t), t;
42
42
  };
43
- let p = class extends y(b`
43
+ let c = class extends y(b`
44
44
  :host {
45
45
  display: block;
46
46
  padding-top: 8px;
@@ -48,11 +48,11 @@ let p = class extends y(b`
48
48
  }
49
49
  `) {
50
50
  constructor() {
51
- super(...arguments), this.fill = "auto", this.scroller = !1, this.elevation = 0;
51
+ super(...arguments), this.fill = "auto", this.elevation = 0;
52
52
  }
53
53
  render() {
54
54
  return u`
55
- <schmancy-surface .elevation=${this.elevation} .fill=${this.fill} type=${this.surface} ?scroller=${this.scroller}>
55
+ <schmancy-surface .elevation=${this.elevation} .fill=${this.fill} type=${this.surface}>
56
56
  <ul>
57
57
  <slot></slot>
58
58
  </ul>
@@ -60,10 +60,10 @@ let p = class extends y(b`
60
60
  `;
61
61
  }
62
62
  };
63
- d([v({ context: $ }), l()], p.prototype, "surface", 2), d([l({ type: String, reflect: !0 })], p.prototype, "fill", 2), d([l({ type: Boolean, reflect: !0 })], p.prototype, "scroller", 2), d([l({ type: Number })], p.prototype, "elevation", 2), p = d([m("schmancy-list")], p);
63
+ d([v({ context: $ }), p()], c.prototype, "surface", 2), d([p({ type: String, reflect: !0 })], c.prototype, "fill", 2), d([p({ type: Number })], c.prototype, "elevation", 2), c = d([m("schmancy-list")], c);
64
64
  export {
65
- p as L,
65
+ c as L,
66
66
  $ as S,
67
67
  i as a
68
68
  };
69
- //# sourceMappingURL=list-CXPHvvQw.js.map
69
+ //# sourceMappingURL=list-ClmkvF6W.js.map