@3mo/date-time-fields 0.10.1 → 0.10.2
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/FieldDateTime.d.ts.map +1 -1
- package/dist/FieldDateTime.js +11 -3
- package/dist/FieldDateTimeRange.js +4 -4
- package/dist/custom-elements.json +28 -94
- package/dist/selection/calendar/Calendar.d.ts +9 -5
- package/dist/selection/calendar/Calendar.d.ts.map +1 -1
- package/dist/selection/calendar/Calendar.js +52 -37
- package/dist/selection/calendar/SelectableCalendar.d.ts +6 -5
- package/dist/selection/calendar/SelectableCalendar.d.ts.map +1 -1
- package/dist/selection/calendar/SelectableCalendar.js +52 -16
- package/dist/selection/calendar/index.d.ts +0 -1
- package/dist/selection/calendar/index.d.ts.map +1 -1
- package/dist/selection/calendar/index.js +0 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/selection/calendar/SelectableRangeCalendar.d.ts +0 -22
- package/dist/selection/calendar/SelectableRangeCalendar.d.ts.map +0 -1
- package/dist/selection/calendar/SelectableRangeCalendar.js +0 -70
package/package.json
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type PropertyValues } from '@a11d/lit';
|
|
2
|
-
import { type DateTime } from '@3mo/date-time';
|
|
3
|
-
import { SelectableCalendar } from './SelectableCalendar.js';
|
|
4
|
-
/** @fires change */
|
|
5
|
-
export declare class SelectableRangeCalendar extends SelectableCalendar {
|
|
6
|
-
dateRange?: DateTimeRange;
|
|
7
|
-
private readonly monthElement;
|
|
8
|
-
protected updated(pops: PropertyValues<this>): void;
|
|
9
|
-
protected static get calendarStyles(): import("@a11d/lit").CSSResult;
|
|
10
|
-
private static getRangeStyles;
|
|
11
|
-
protected getDayElementClasses(day: DateTime): {
|
|
12
|
-
start: boolean;
|
|
13
|
-
end: boolean;
|
|
14
|
-
selected: boolean;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
declare global {
|
|
18
|
-
interface HTMLElementTagNameMap {
|
|
19
|
-
'mo-selectable-range-calendar': SelectableRangeCalendar;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=SelectableRangeCalendar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectableRangeCalendar.d.ts","sourceRoot":"","sources":["../../../selection/calendar/SelectableRangeCalendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,KAAK,cAAc,EAAE,MAAM,WAAW,CAAA;AAC3F,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,oBAAoB;AACpB,qBACa,uBAAwB,SAAQ,kBAAkB;IAClC,SAAS,CAAC,EAAE,aAAa,CAAA;IAEpC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;cAEzC,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC;IASrD,qBAA8B,cAAc,kCAoB3C;IAED,OAAO,CAAC,MAAM,CAAC,cAAc;cAgBV,oBAAoB,CAAC,GAAG,EAAE,QAAQ;;;;;CAUrD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,8BAA8B,EAAE,uBAAuB,CAAA;KACvD;CACD"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { component, css, property, query, unsafeCSS } from '@a11d/lit';
|
|
3
|
-
import { SelectableCalendar } from './SelectableCalendar.js';
|
|
4
|
-
/** @fires change */
|
|
5
|
-
let SelectableRangeCalendar = class SelectableRangeCalendar extends SelectableCalendar {
|
|
6
|
-
updated(pops) {
|
|
7
|
-
super.updated(pops);
|
|
8
|
-
this.monthElement.dataset.selection = this.dataset.selection;
|
|
9
|
-
this.monthElement.toggleAttribute('data-start-exists', !!this.dateRange?.start);
|
|
10
|
-
this.monthElement.toggleAttribute('data-end-exists', !!this.dateRange?.end);
|
|
11
|
-
this.monthElement.toggleAttribute('data-start-behind', this.dateRange?.start?.isBefore(this.navigatingValue.monthEnd.weekEnd) ?? false);
|
|
12
|
-
this.monthElement.toggleAttribute('data-end-ahead', this.dateRange?.end?.isAfter(this.navigatingValue.monthEnd.weekEnd) ?? false);
|
|
13
|
-
}
|
|
14
|
-
static get calendarStyles() {
|
|
15
|
-
return css `
|
|
16
|
-
.month {
|
|
17
|
-
&:not(:hover) {
|
|
18
|
-
${this.getRangeStyles({ start: '.selected.start', end: '.selected.end' })}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&:hover {
|
|
22
|
-
/* After start is selected: */
|
|
23
|
-
&[data-selection=end] {
|
|
24
|
-
${this.getRangeStyles({ start: '.selected.start', end: ':hover' })}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* After end is selected: */
|
|
28
|
-
&[data-selection=start] {
|
|
29
|
-
${this.getRangeStyles({ start: ':hover', end: '.selected.end' })}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
34
|
-
}
|
|
35
|
-
static getRangeStyles({ start, end }) {
|
|
36
|
-
return css `
|
|
37
|
-
.day${unsafeCSS(start)}, .day${unsafeCSS(end)} {
|
|
38
|
-
background: var(--mo-color-accent-transparent) !important;
|
|
39
|
-
color: var(--mo-color-accent);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.day${unsafeCSS(start)} ~ :not(${unsafeCSS(end)}):not(${unsafeCSS(end)} ~ *), /* Start is visible, end is visible or not */
|
|
43
|
-
&[data-start-exists]:has(${unsafeCSS(end)}):not(:has(${unsafeCSS(start)})) .day:not(${unsafeCSS(end)}):not(${unsafeCSS(end)} ~ *), /* Start is not visible, end is visible */
|
|
44
|
-
&[data-start-before][data-end-ahead] .day /* Start is before, end is after */
|
|
45
|
-
{
|
|
46
|
-
background: color-mix(in srgb, var(--mo-color-accent), transparent 92%);
|
|
47
|
-
}
|
|
48
|
-
`;
|
|
49
|
-
}
|
|
50
|
-
getDayElementClasses(day) {
|
|
51
|
-
const start = this.dateRange?.start?.dayStart.equals(day.dayStart) ?? false;
|
|
52
|
-
const end = this.dateRange?.end?.dayStart.equals(day.dayStart) ?? false;
|
|
53
|
-
return {
|
|
54
|
-
...super.getDayElementClasses(day),
|
|
55
|
-
start,
|
|
56
|
-
end,
|
|
57
|
-
selected: start || end,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
__decorate([
|
|
62
|
-
property({ type: Object })
|
|
63
|
-
], SelectableRangeCalendar.prototype, "dateRange", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
query('.month')
|
|
66
|
-
], SelectableRangeCalendar.prototype, "monthElement", void 0);
|
|
67
|
-
SelectableRangeCalendar = __decorate([
|
|
68
|
-
component('mo-selectable-range-calendar')
|
|
69
|
-
], SelectableRangeCalendar);
|
|
70
|
-
export { SelectableRangeCalendar };
|