@mintplayer/web-components 1.0.0 → 1.2.0
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/a11y/index.mjs +2 -56
- package/calendar/index.mjs +2 -363
- package/checkbox/index.mjs +4 -0
- package/checkbox/src/components/index.d.ts +2 -0
- package/checkbox/src/components/mp-checkbox.d.ts +69 -0
- package/checkbox/src/index.d.ts +2 -0
- package/chunks/color-C4VT0EL7.mjs +847 -0
- package/chunks/form-check.styles-jBlHetYX.mjs +151 -0
- package/chunks/live-announcer-CZDTKulf.mjs +58 -0
- package/chunks/mp-calendar.element-UC68iDbi.mjs +365 -0
- package/chunks/mp-checkbox-BokLL7BS.mjs +211 -0
- package/chunks/mp-datatable-Con0yQue.mjs +1125 -0
- package/chunks/mp-pagination-BGxsawFL.mjs +326 -0
- package/chunks/mp-select-BDS1-YGn.mjs +254 -0
- package/chunks/mp-splitter-C8cGCmac.mjs +633 -0
- package/chunks/mp-tab-page-D1b4x-y2.mjs +414 -0
- package/chunks/mp-timepicker.element-BwEiwX92.mjs +428 -0
- package/chunks/mp-toggle-button-dLZNDUVz.mjs +534 -0
- package/chunks/mp-treeview-Bfq4_IVW.mjs +474 -0
- package/code-snippet/index.mjs +16 -13
- package/datatable/index.mjs +7 -0
- package/datatable/src/components/index.d.ts +2 -0
- package/datatable/src/components/mp-datatable.d.ts +260 -0
- package/datatable/src/index.d.ts +6 -0
- package/datatable/src/sort/compute-next-sort.d.ts +18 -0
- package/datatable/src/sort/index.d.ts +3 -0
- package/datatable/src/sort/sort-rows.d.ts +6 -0
- package/datatable/src/styles/datatable.styles.d.ts +2 -0
- package/datatable/src/styles/index.d.ts +1 -0
- package/datatable/src/types/column-def.d.ts +41 -0
- package/datatable/src/types/index.d.ts +2 -0
- package/datatable/src/types/tree.d.ts +42 -0
- package/datepicker/index.mjs +240 -0
- package/datepicker/src/index.d.ts +1 -0
- package/datepicker/src/mp-datepicker.element.d.ts +94 -0
- package/datepicker/src/mp-datepicker.element.template.d.ts +2 -0
- package/datetime-picker/index.mjs +427 -0
- package/datetime-picker/src/index.d.ts +1 -0
- package/datetime-picker/src/mp-datetime-picker.element.d.ts +174 -0
- package/datetime-picker/src/mp-datetime-picker.element.template.d.ts +2 -0
- package/dock/index.mjs +2402 -0
- package/dock/src/components/index.d.ts +1 -0
- package/dock/src/components/mint-dock-manager.element.d.ts +313 -0
- package/dock/src/components/mint-dock-manager.element.template.d.ts +2 -0
- package/dock/src/index.d.ts +2 -0
- package/dock/src/types/dock-layout.d.ts +65 -0
- package/dock/src/types/index.d.ts +1 -0
- package/file-manager/index.mjs +1263 -0
- package/file-manager/src/components/index.d.ts +2 -0
- package/file-manager/src/components/mp-file-manager.d.ts +320 -0
- package/file-manager/src/index.d.ts +5 -0
- package/file-manager/src/styles/file-manager.styles.d.ts +2 -0
- package/file-manager/src/styles/index.d.ts +1 -0
- package/file-manager/src/types/file-system-node.d.ts +24 -0
- package/file-manager/src/types/index.d.ts +3 -0
- package/file-manager/src/types/messages.d.ts +43 -0
- package/multi-range/index.mjs +407 -0
- package/multi-range/src/index.d.ts +2 -0
- package/multi-range/src/mint-multi-range.element.d.ts +124 -0
- package/multi-range/src/mint-multi-range.element.template.d.ts +2 -0
- package/multi-range/src/types/multi-range-orientation.d.ts +1 -0
- package/otp-input/index.mjs +362 -0
- package/otp-input/src/index.d.ts +4 -0
- package/otp-input/src/mint-otp-input.element.d.ts +134 -0
- package/otp-input/src/mint-otp-input.element.template.d.ts +2 -0
- package/otp-input/src/types/otp-input-case.d.ts +1 -0
- package/otp-input/src/types/otp-input-size.d.ts +1 -0
- package/otp-input/src/types/otp-input-type.d.ts +1 -0
- package/overlay/index.mjs +260 -0
- package/overlay/src/index.d.ts +2 -0
- package/overlay/src/overlay-controller.d.ts +205 -0
- package/package.json +1 -1
- package/pagination/index.mjs +5 -0
- package/pagination/src/components/index.d.ts +2 -0
- package/pagination/src/components/mp-pagination.d.ts +95 -0
- package/pagination/src/index.d.ts +2 -0
- package/pagination/src/styles/index.d.ts +1 -0
- package/pagination/src/styles/pagination.styles.d.ts +2 -0
- package/query-builder/index.mjs +3720 -0
- package/query-builder/src/context.d.ts +14 -0
- package/query-builder/src/dnd/drag-controller.d.ts +69 -0
- package/query-builder/src/index.d.ts +23 -0
- package/query-builder/src/model/default-tree.d.ts +7 -0
- package/query-builder/src/model/editor.d.ts +15 -0
- package/query-builder/src/model/errors.d.ts +6 -0
- package/query-builder/src/model/expression.d.ts +22 -0
- package/query-builder/src/model/field-def.d.ts +17 -0
- package/query-builder/src/model/messages.d.ts +17 -0
- package/query-builder/src/model/operator-overrides.d.ts +21 -0
- package/query-builder/src/model/operators.d.ts +8 -0
- package/query-builder/src/model/saved-query.d.ts +6 -0
- package/query-builder/src/model/sort.d.ts +9 -0
- package/query-builder/src/model/tree-ops.d.ts +56 -0
- package/query-builder/src/mp-query-builder.element.d.ts +158 -0
- package/query-builder/src/mp-query-builder.element.template.d.ts +2 -0
- package/query-builder/src/mp-query-condition.element.d.ts +44 -0
- package/query-builder/src/mp-query-condition.element.template.d.ts +2 -0
- package/query-builder/src/mp-query-group.element.d.ts +52 -0
- package/query-builder/src/mp-query-group.element.template.d.ts +2 -0
- package/query-builder/src/mp-query-subquery.element.d.ts +37 -0
- package/query-builder/src/mp-query-subquery.element.template.d.ts +2 -0
- package/query-builder/src/preview/render-expression.d.ts +23 -0
- package/query-builder/src/value-editors/builtin-editors.d.ts +6 -0
- package/query-builder/src/visitor/visit-tree.d.ts +29 -0
- package/query-builder/src/visitor/visitor-types.d.ts +15 -0
- package/radio/index.mjs +162 -0
- package/radio/src/components/index.d.ts +2 -0
- package/radio/src/components/mp-radio.d.ts +63 -0
- package/radio/src/index.d.ts +2 -0
- package/ribbon/index.mjs +3151 -0
- package/ribbon/src/index.d.ts +10 -0
- package/ribbon/src/items/index.d.ts +15 -0
- package/ribbon/src/items/mp-ribbon-button.element.d.ts +10 -0
- package/ribbon/src/items/mp-ribbon-checkbox.element.d.ts +11 -0
- package/ribbon/src/items/mp-ribbon-color-picker.element.d.ts +12 -0
- package/ribbon/src/items/mp-ribbon-combobox.element.d.ts +19 -0
- package/ribbon/src/items/mp-ribbon-dropdown-button.element.d.ts +16 -0
- package/ribbon/src/items/mp-ribbon-gallery-item.element.d.ts +15 -0
- package/ribbon/src/items/mp-ribbon-gallery.element.d.ts +11 -0
- package/ribbon/src/items/mp-ribbon-group-button.element.d.ts +18 -0
- package/ribbon/src/items/mp-ribbon-item-base.d.ts +68 -0
- package/ribbon/src/items/mp-ribbon-menu-item.element.d.ts +13 -0
- package/ribbon/src/items/mp-ribbon-menu-separator.element.d.ts +6 -0
- package/ribbon/src/items/mp-ribbon-split-button.element.d.ts +23 -0
- package/ribbon/src/items/mp-ribbon-template-item.element.d.ts +12 -0
- package/ribbon/src/items/mp-ribbon-toggle-button.element.d.ts +12 -0
- package/ribbon/src/mp-quick-access-toolbar.element.d.ts +35 -0
- package/ribbon/src/mp-ribbon-contextual-tab-set.element.d.ts +18 -0
- package/ribbon/src/mp-ribbon-group.element.d.ts +59 -0
- package/ribbon/src/mp-ribbon-tab.element.d.ts +72 -0
- package/ribbon/src/mp-ribbon.element.d.ts +211 -0
- package/ribbon/src/types/ribbon.types.d.ts +4 -0
- package/scheduler/index.mjs +3567 -0
- package/scheduler/src/components/mp-scheduler.d.ts +238 -0
- package/scheduler/src/drag/drag-manager.d.ts +90 -0
- package/scheduler/src/drag/drag-preview.d.ts +42 -0
- package/scheduler/src/drag/drag-state-machine.d.ts +102 -0
- package/scheduler/src/drag/drag-types.d.ts +104 -0
- package/scheduler/src/drag/index.d.ts +4 -0
- package/scheduler/src/events/event-types.d.ts +58 -0
- package/scheduler/src/events/index.d.ts +2 -0
- package/scheduler/src/events/scheduler-event-emitter.d.ts +52 -0
- package/scheduler/src/index.d.ts +6 -0
- package/scheduler/src/input/index.d.ts +2 -0
- package/scheduler/src/input/input-handler.d.ts +105 -0
- package/scheduler/src/input/pointer-event.d.ts +39 -0
- package/scheduler/src/state/scheduler-state.d.ts +189 -0
- package/scheduler/src/styles/scheduler.styles.d.ts +2 -0
- package/scheduler/src/views/base-view.d.ts +87 -0
- package/scheduler/src/views/day-view.d.ts +25 -0
- package/scheduler/src/views/index.d.ts +6 -0
- package/scheduler/src/views/month-view.d.ts +27 -0
- package/scheduler/src/views/timeline-view.d.ts +23 -0
- package/scheduler/src/views/week-view.d.ts +28 -0
- package/scheduler/src/views/year-view.d.ts +25 -0
- package/scheduler-core/index.mjs +174 -0
- package/scheduler-core/src/index.d.ts +3 -0
- package/scheduler-core/src/models/drag-state.d.ts +43 -0
- package/scheduler-core/src/models/event.d.ts +111 -0
- package/scheduler-core/src/models/events.d.ts +108 -0
- package/scheduler-core/src/models/index.d.ts +7 -0
- package/scheduler-core/src/models/options.d.ts +88 -0
- package/scheduler-core/src/models/resource.d.ts +58 -0
- package/scheduler-core/src/models/time-slot.d.ts +31 -0
- package/scheduler-core/src/models/types.d.ts +20 -0
- package/scheduler-core/src/services/date.service.d.ts +140 -0
- package/scheduler-core/src/services/index.d.ts +4 -0
- package/scheduler-core/src/services/position.service.d.ts +35 -0
- package/scheduler-core/src/services/resource.service.d.ts +83 -0
- package/scheduler-core/src/services/timeline.service.d.ts +103 -0
- package/scheduler-core/src/utils/color.d.ts +24 -0
- package/scheduler-core/src/utils/dom.d.ts +54 -0
- package/scheduler-core/src/utils/id.d.ts +16 -0
- package/scheduler-core/src/utils/index.d.ts +3 -0
- package/select/index.mjs +4 -0
- package/select/src/components/index.d.ts +2 -0
- package/select/src/components/mp-select.d.ts +82 -0
- package/select/src/index.d.ts +2 -0
- package/splitter/index.mjs +10 -0
- package/splitter/src/components/index.d.ts +2 -0
- package/splitter/src/components/mp-splitter.d.ts +109 -0
- package/splitter/src/index.d.ts +11 -0
- package/splitter/src/input/index.d.ts +4 -0
- package/splitter/src/input/input-handler.d.ts +36 -0
- package/splitter/src/input/pointer-event.d.ts +9 -0
- package/splitter/src/managers/index.d.ts +2 -0
- package/splitter/src/managers/resize-manager.d.ts +13 -0
- package/splitter/src/state/index.d.ts +2 -0
- package/splitter/src/state/splitter-state.d.ts +24 -0
- package/splitter/src/styles/index.d.ts +1 -0
- package/splitter/src/styles/splitter.styles.d.ts +2 -0
- package/splitter/src/types/direction.d.ts +1 -0
- package/splitter/src/types/index.d.ts +5 -0
- package/splitter/src/types/panel-info.d.ts +6 -0
- package/splitter/src/types/point.d.ts +4 -0
- package/splitter/src/types/resize-operation.d.ts +13 -0
- package/tab-control/index.mjs +6 -0
- package/tab-control/src/components/index.d.ts +3 -0
- package/tab-control/src/components/mp-tab-control.d.ts +50 -0
- package/tab-control/src/components/mp-tab-page.d.ts +35 -0
- package/tab-control/src/index.d.ts +4 -0
- package/tab-control/src/styles/index.d.ts +1 -0
- package/tab-control/src/styles/tab-control.styles.d.ts +2 -0
- package/tab-control/src/types/index.d.ts +1 -0
- package/tab-control/src/types/tabs-position.d.ts +1 -0
- package/tile-manager/index.mjs +867 -0
- package/tile-manager/src/components/index.d.ts +2 -0
- package/tile-manager/src/components/mint-tile-manager.element.d.ts +204 -0
- package/tile-manager/src/components/mint-tile-manager.element.template.d.ts +2 -0
- package/tile-manager/src/index.d.ts +4 -0
- package/tile-manager/src/types/grid-rect.d.ts +12 -0
- package/tile-manager/src/types/index.d.ts +3 -0
- package/tile-manager/src/types/tile-layout-snapshot.d.ts +15 -0
- package/tile-manager/src/types/tile-position.d.ts +10 -0
- package/tile-manager/src/utils/index.d.ts +1 -0
- package/tile-manager/src/utils/pack.d.ts +24 -0
- package/timepicker/index.mjs +5 -0
- package/timepicker/src/index.d.ts +2 -0
- package/timepicker/src/mp-time-list.element.d.ts +76 -0
- package/timepicker/src/mp-time-list.element.template.d.ts +2 -0
- package/timepicker/src/mp-timepicker.element.d.ts +87 -0
- package/timepicker/src/mp-timepicker.element.template.d.ts +2 -0
- package/toggle-button/index.mjs +5 -0
- package/toggle-button/src/components/index.d.ts +2 -0
- package/toggle-button/src/components/mp-toggle-button.d.ts +50 -0
- package/toggle-button/src/index.d.ts +3 -0
- package/toggle-button/src/styles/index.d.ts +1 -0
- package/toggle-button/src/styles/toggle-button.styles.d.ts +2 -0
- package/treeview/index.mjs +5 -0
- package/treeview/src/components/index.d.ts +2 -0
- package/treeview/src/components/mp-treeview.d.ts +113 -0
- package/treeview/src/index.d.ts +4 -0
- package/treeview/src/styles/index.d.ts +1 -0
- package/treeview/src/styles/treeview.styles.d.ts +2 -0
- package/treeview/src/types/index.d.ts +1 -0
- package/treeview/src/types/tree-node.d.ts +14 -0
- package/custom-elements.json +0 -1774
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
+
import { FirstDayOfWeek } from '@mintplayer/web-components/calendar';
|
|
3
|
+
/**
|
|
4
|
+
* mp-datepicker — Bootstrap-styled date picker WC.
|
|
5
|
+
*
|
|
6
|
+
* Renders an `<input class="form-control" readonly>` displaying the selected
|
|
7
|
+
* date, a calendar trigger button, and a popup containing `<mp-calendar>` via
|
|
8
|
+
* a default slot. Consumers can replace the calendar by projecting their own
|
|
9
|
+
* `<mp-calendar slot="calendar">` content, or rely on the bundled default.
|
|
10
|
+
*
|
|
11
|
+
* Properties forwarded to the inner calendar: selectedDate, currentMonth,
|
|
12
|
+
* disableDateFn, min, max, firstDayOfWeek, locale.
|
|
13
|
+
*
|
|
14
|
+
* Events (bubbles + composed):
|
|
15
|
+
* - `selected-date-change` fires when the inner calendar emits one.
|
|
16
|
+
* - `current-month-change` fires when the inner calendar emits one.
|
|
17
|
+
* - `opened` / `closed` fire on popup open/close.
|
|
18
|
+
*/
|
|
19
|
+
export declare class MpDatepickerElement extends LitElement {
|
|
20
|
+
static styles: import('lit').CSSResult[];
|
|
21
|
+
static properties: {
|
|
22
|
+
selectedDate: {
|
|
23
|
+
attribute: boolean;
|
|
24
|
+
};
|
|
25
|
+
currentMonth: {
|
|
26
|
+
attribute: boolean;
|
|
27
|
+
};
|
|
28
|
+
disableDateFn: {
|
|
29
|
+
attribute: boolean;
|
|
30
|
+
};
|
|
31
|
+
min: {
|
|
32
|
+
attribute: boolean;
|
|
33
|
+
};
|
|
34
|
+
max: {
|
|
35
|
+
attribute: boolean;
|
|
36
|
+
};
|
|
37
|
+
firstDayOfWeek: {
|
|
38
|
+
attribute: string;
|
|
39
|
+
type: NumberConstructor;
|
|
40
|
+
reflect: boolean;
|
|
41
|
+
};
|
|
42
|
+
locale: {
|
|
43
|
+
attribute: string;
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
reflect: boolean;
|
|
46
|
+
};
|
|
47
|
+
disabled: {
|
|
48
|
+
attribute: string;
|
|
49
|
+
type: BooleanConstructor;
|
|
50
|
+
reflect: boolean;
|
|
51
|
+
};
|
|
52
|
+
placeholder: {
|
|
53
|
+
attribute: string;
|
|
54
|
+
type: StringConstructor;
|
|
55
|
+
reflect: boolean;
|
|
56
|
+
};
|
|
57
|
+
triggerLabel: {
|
|
58
|
+
attribute: string;
|
|
59
|
+
type: StringConstructor;
|
|
60
|
+
reflect: boolean;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
selectedDate: Date | null;
|
|
64
|
+
currentMonth: Date | null;
|
|
65
|
+
disableDateFn: ((date: Date) => boolean) | null;
|
|
66
|
+
min: Date | null;
|
|
67
|
+
max: Date | null;
|
|
68
|
+
firstDayOfWeek: FirstDayOfWeek;
|
|
69
|
+
locale: string | undefined;
|
|
70
|
+
disabled: boolean;
|
|
71
|
+
placeholder: string;
|
|
72
|
+
triggerLabel: string;
|
|
73
|
+
private readonly instanceId;
|
|
74
|
+
private readonly popupId;
|
|
75
|
+
private triggerEl?;
|
|
76
|
+
private inputGroupEl?;
|
|
77
|
+
private popupEl?;
|
|
78
|
+
/**
|
|
79
|
+
* The overlay positions against the entire `.input-group` wrapper (so the
|
|
80
|
+
* popup aligns with the input's left edge, not the trigger button's left
|
|
81
|
+
* edge — which would float in mid-air visually disconnected from the
|
|
82
|
+
* field). The trigger button still owns ARIA + focus-return semantics.
|
|
83
|
+
*/
|
|
84
|
+
private readonly overlay;
|
|
85
|
+
open(): Promise<void>;
|
|
86
|
+
close(returnFocus?: boolean): void;
|
|
87
|
+
get isOpen(): boolean;
|
|
88
|
+
private formatDisplay;
|
|
89
|
+
private onTriggerClick;
|
|
90
|
+
private onTriggerKeyDown;
|
|
91
|
+
private onSelectedDateChange;
|
|
92
|
+
private onCurrentMonthChange;
|
|
93
|
+
protected render(): TemplateResult;
|
|
94
|
+
}
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import { html as d, unsafeCSS as c, LitElement as b, nothing as h } from "lit";
|
|
2
|
+
import { query as s } from "lit/decorators.js";
|
|
3
|
+
import { L as m } from "../chunks/live-announcer-CZDTKulf.mjs";
|
|
4
|
+
import { OverlayController as p } from "../overlay/index.mjs";
|
|
5
|
+
import "../chunks/mp-calendar.element-UC68iDbi.mjs";
|
|
6
|
+
import "../chunks/mp-timepicker.element-BwEiwX92.mjs";
|
|
7
|
+
d`<!-- Rendered dynamically by render(). Codegen-wc emits styles from the
|
|
8
|
+
sibling .scss; the template export is intentionally unused. -->`;
|
|
9
|
+
const g = c(`:host {
|
|
10
|
+
display: inline-block;
|
|
11
|
+
position: relative;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
font-family: inherit;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.input-group {
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
position: relative;
|
|
19
|
+
width: 100%;
|
|
20
|
+
align-items: stretch;
|
|
21
|
+
border-radius: var(--bs-border-radius, 0.375rem);
|
|
22
|
+
}
|
|
23
|
+
.input-group:focus-within {
|
|
24
|
+
box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
|
|
25
|
+
}
|
|
26
|
+
.input-group:focus-within input.form-control,
|
|
27
|
+
.input-group:focus-within button.trigger {
|
|
28
|
+
border-color: var(--bs-primary);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
input.form-control {
|
|
32
|
+
flex: 1 1 auto;
|
|
33
|
+
min-width: 0;
|
|
34
|
+
padding: 0.375rem 0.75rem;
|
|
35
|
+
font-size: 1rem;
|
|
36
|
+
line-height: 1.5;
|
|
37
|
+
color: var(--bs-body-color);
|
|
38
|
+
background-color: var(--bs-body-bg);
|
|
39
|
+
border: 1px solid var(--bs-border-color);
|
|
40
|
+
border-inline-end-width: 0;
|
|
41
|
+
border-start-start-radius: var(--bs-border-radius, 0.375rem);
|
|
42
|
+
border-end-start-radius: var(--bs-border-radius, 0.375rem);
|
|
43
|
+
border-start-end-radius: 0;
|
|
44
|
+
border-end-end-radius: 0;
|
|
45
|
+
outline: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
input.form-control:disabled {
|
|
49
|
+
background-color: var(--bs-secondary-bg);
|
|
50
|
+
opacity: 1;
|
|
51
|
+
cursor: not-allowed;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
button.trigger {
|
|
55
|
+
flex: 0 0 auto;
|
|
56
|
+
padding: 0.375rem 0.75rem;
|
|
57
|
+
font-size: 1rem;
|
|
58
|
+
line-height: 1.5;
|
|
59
|
+
color: var(--bs-body-color);
|
|
60
|
+
background-color: var(--bs-body-bg);
|
|
61
|
+
border: 1px solid var(--bs-border-color);
|
|
62
|
+
border-inline-start: 0;
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
}
|
|
65
|
+
button.trigger.clear {
|
|
66
|
+
border-inline-start: 0;
|
|
67
|
+
border-inline-end: 0;
|
|
68
|
+
}
|
|
69
|
+
button.trigger.time {
|
|
70
|
+
border-start-end-radius: var(--bs-border-radius, 0.375rem);
|
|
71
|
+
border-end-end-radius: var(--bs-border-radius, 0.375rem);
|
|
72
|
+
}
|
|
73
|
+
button.trigger:hover:not(:disabled) {
|
|
74
|
+
background-color: var(--bs-secondary-bg);
|
|
75
|
+
}
|
|
76
|
+
button.trigger:focus-visible {
|
|
77
|
+
outline: 2px solid var(--bs-primary);
|
|
78
|
+
outline-offset: -2px;
|
|
79
|
+
}
|
|
80
|
+
button.trigger:disabled {
|
|
81
|
+
opacity: 0.65;
|
|
82
|
+
cursor: not-allowed;
|
|
83
|
+
}
|
|
84
|
+
button.trigger svg {
|
|
85
|
+
width: 1em;
|
|
86
|
+
height: 1em;
|
|
87
|
+
vertical-align: -0.125em;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.popup {
|
|
91
|
+
position: fixed;
|
|
92
|
+
z-index: 1050;
|
|
93
|
+
display: none;
|
|
94
|
+
padding: 0.5rem;
|
|
95
|
+
background-color: var(--bs-body-bg);
|
|
96
|
+
border: 1px solid var(--bs-border-color);
|
|
97
|
+
border-radius: var(--bs-border-radius, 0.375rem);
|
|
98
|
+
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
|
|
99
|
+
max-width: min(360px, 100vw - 16px);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:host([data-open=date]) .popup-date,
|
|
103
|
+
:host([data-open=time]) .popup-time {
|
|
104
|
+
display: block;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.popup-footer {
|
|
108
|
+
display: flex;
|
|
109
|
+
justify-content: flex-end;
|
|
110
|
+
padding-top: 0.5rem;
|
|
111
|
+
}
|
|
112
|
+
.popup-footer button {
|
|
113
|
+
padding: 0.25rem 0.75rem;
|
|
114
|
+
font-size: 0.875rem;
|
|
115
|
+
color: #fff;
|
|
116
|
+
background-color: var(--bs-primary);
|
|
117
|
+
border: 1px solid var(--bs-primary);
|
|
118
|
+
border-radius: var(--bs-border-radius, 0.375rem);
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
}
|
|
121
|
+
.popup-footer button:hover {
|
|
122
|
+
filter: brightness(0.95);
|
|
123
|
+
}
|
|
124
|
+
.popup-footer button:focus-visible {
|
|
125
|
+
outline: 2px solid var(--bs-primary);
|
|
126
|
+
outline-offset: 2px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@media (pointer: coarse) {
|
|
130
|
+
button.trigger,
|
|
131
|
+
.popup-footer button {
|
|
132
|
+
min-height: 40px;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
@media (prefers-reduced-motion: reduce) {
|
|
136
|
+
.popup {
|
|
137
|
+
transition: none !important;
|
|
138
|
+
}
|
|
139
|
+
}`);
|
|
140
|
+
var f = Object.defineProperty, l = (u, e, t, i) => {
|
|
141
|
+
for (var a = void 0, o = u.length - 1, n; o >= 0; o--)
|
|
142
|
+
(n = u[o]) && (a = n(e, t, a) || a);
|
|
143
|
+
return a && f(e, t, a), a;
|
|
144
|
+
};
|
|
145
|
+
const v = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM2 2a1 1 0 0 0-1 1v1h14V3a1 1 0 0 0-1-1H2zm13 3H1v9a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V5z"/></svg>', y = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 3.5a.5.5 0 0 0-1 0V9a.5.5 0 0 0 .252.434l3.5 2a.5.5 0 0 0 .496-.868L8 8.71V3.5z"/><path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm7-8A7 7 0 1 1 1 8a7 7 0 0 1 14 0z"/></svg>', w = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/></svg>';
|
|
146
|
+
let C = 0;
|
|
147
|
+
class r extends b {
|
|
148
|
+
constructor() {
|
|
149
|
+
super(...arguments), this.value = null, this.min = null, this.max = null, this.disableDateFn = null, this.firstDayOfWeek = 1, this.locale = void 0, this.hour12 = "auto", this.step = 15, this.defaultTime = { hour: 0, minute: 0 }, this.placeholder = "", this.showClear = !1, this.disabled = !1, this.inputLabel = "Selected date and time", this.dateButtonLabel = "Choose date", this.timeButtonLabel = "Choose time", this.clearLabel = "Clear", this.todayLabel = "Today", this.nowLabel = "Now", this._openPopup = null, this._calendarMonth = null, this.instanceId = `mp-dtp-${++C}`, this.datePopupId = `${this.instanceId}-popup-date`, this.timePopupId = `${this.instanceId}-popup-time`, this.dateOverlay = new p(this, {
|
|
150
|
+
anchor: () => this.inputGroupEl ?? this.dateTriggerEl ?? null,
|
|
151
|
+
trigger: () => this.dateTriggerEl ?? null,
|
|
152
|
+
panel: () => this.datePopupEl ?? null,
|
|
153
|
+
panelWidth: "anchor-min",
|
|
154
|
+
onOpen: () => {
|
|
155
|
+
this.dispatchEvent(
|
|
156
|
+
new CustomEvent("opened", { detail: "date", bubbles: !0, composed: !0 })
|
|
157
|
+
);
|
|
158
|
+
},
|
|
159
|
+
onClose: () => {
|
|
160
|
+
this._openPopup === "date" && (this._openPopup = null), this.dispatchEvent(
|
|
161
|
+
new CustomEvent("closed", { detail: "date", bubbles: !0, composed: !0 })
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
}), this.timeOverlay = new p(this, {
|
|
165
|
+
anchor: () => this.inputGroupEl ?? this.timeTriggerEl ?? null,
|
|
166
|
+
trigger: () => this.timeTriggerEl ?? null,
|
|
167
|
+
panel: () => this.timePopupEl ?? null,
|
|
168
|
+
panelWidth: "anchor-min",
|
|
169
|
+
onOpen: () => {
|
|
170
|
+
this.dispatchEvent(
|
|
171
|
+
new CustomEvent("opened", { detail: "time", bubbles: !0, composed: !0 })
|
|
172
|
+
);
|
|
173
|
+
},
|
|
174
|
+
onClose: () => {
|
|
175
|
+
this._openPopup === "time" && (this._openPopup = null), this.dispatchEvent(
|
|
176
|
+
new CustomEvent("closed", { detail: "time", bubbles: !0, composed: !0 })
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
}), this.liveAnnouncer = new m(this), this.lastAnnouncedValue = null, this.onDateTriggerClick = async (e) => {
|
|
180
|
+
this.disabled || (e.stopPropagation(), this.dateOverlay.isOpen ? this.dateOverlay.close() : await this.openDate());
|
|
181
|
+
}, this.onTimeTriggerClick = async (e) => {
|
|
182
|
+
this.disabled || (e.stopPropagation(), this.timeOverlay.isOpen ? this.timeOverlay.close() : await this.openTime());
|
|
183
|
+
}, this.onDateTriggerKeyDown = async (e) => {
|
|
184
|
+
this.disabled || (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.dateOverlay.isOpen || await this.openDate());
|
|
185
|
+
}, this.onTimeTriggerKeyDown = async (e) => {
|
|
186
|
+
this.disabled || (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.timeOverlay.isOpen || await this.openTime());
|
|
187
|
+
}, this.onClearClick = (e) => {
|
|
188
|
+
this.disabled || (e.stopPropagation(), this.clear());
|
|
189
|
+
}, this.onCalendarSelectedDateChange = (e) => {
|
|
190
|
+
const t = e.detail;
|
|
191
|
+
if (!(t instanceof Date)) return;
|
|
192
|
+
const i = this.value !== null && this.value.getFullYear() === t.getFullYear() && this.value.getMonth() === t.getMonth() && this.value.getDate() === t.getDate();
|
|
193
|
+
this.updateDatePart(t), i && this.dateOverlay.close();
|
|
194
|
+
}, this.onCalendarCurrentMonthChange = (e) => {
|
|
195
|
+
const t = e.detail;
|
|
196
|
+
t instanceof Date && (this._calendarMonth = t);
|
|
197
|
+
}, this.onTimeListSelectedTimeChange = (e) => {
|
|
198
|
+
const t = e.detail;
|
|
199
|
+
t instanceof Date && (this.updateTimePart(t), this.timeOverlay.close());
|
|
200
|
+
}, this.onTodayClick = () => {
|
|
201
|
+
this.updateDatePart(/* @__PURE__ */ new Date());
|
|
202
|
+
}, this.onNowClick = () => {
|
|
203
|
+
const e = /* @__PURE__ */ new Date(), t = Math.floor(e.getMinutes() / this.step) * this.step, i = new Date(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), t, 0, 0);
|
|
204
|
+
this.updateTimePart(i);
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
static {
|
|
208
|
+
this.styles = [g];
|
|
209
|
+
}
|
|
210
|
+
static {
|
|
211
|
+
this.properties = {
|
|
212
|
+
value: { attribute: !1 },
|
|
213
|
+
min: { attribute: !1 },
|
|
214
|
+
max: { attribute: !1 },
|
|
215
|
+
disableDateFn: { attribute: !1 },
|
|
216
|
+
firstDayOfWeek: { attribute: "first-day-of-week", type: Number, reflect: !0 },
|
|
217
|
+
locale: { attribute: "locale", type: String, reflect: !0 },
|
|
218
|
+
hour12: { attribute: "hour12" },
|
|
219
|
+
step: { attribute: "step", type: Number, reflect: !0 },
|
|
220
|
+
defaultTime: { attribute: !1 },
|
|
221
|
+
placeholder: { attribute: "placeholder", type: String, reflect: !0 },
|
|
222
|
+
showClear: { attribute: "show-clear", type: Boolean, reflect: !0 },
|
|
223
|
+
disabled: { attribute: "disabled", type: Boolean, reflect: !0 },
|
|
224
|
+
inputLabel: { attribute: "input-label", type: String, reflect: !0 },
|
|
225
|
+
dateButtonLabel: { attribute: "date-button-label", type: String, reflect: !0 },
|
|
226
|
+
timeButtonLabel: { attribute: "time-button-label", type: String, reflect: !0 },
|
|
227
|
+
clearLabel: { attribute: "clear-label", type: String, reflect: !0 },
|
|
228
|
+
todayLabel: { attribute: "today-label", type: String, reflect: !0 },
|
|
229
|
+
nowLabel: { attribute: "now-label", type: String, reflect: !0 },
|
|
230
|
+
_openPopup: { state: !0 },
|
|
231
|
+
_calendarMonth: { state: !0 }
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
willUpdate(e) {
|
|
235
|
+
e.has("value") && this.value && !this._calendarMonth && (this._calendarMonth = new Date(this.value.getFullYear(), this.value.getMonth(), 1));
|
|
236
|
+
}
|
|
237
|
+
updated(e) {
|
|
238
|
+
super.updated?.(e), e.has("_openPopup") && (this._openPopup === null ? this.removeAttribute("data-open") : this.setAttribute("data-open", this._openPopup));
|
|
239
|
+
}
|
|
240
|
+
/* ---- Public API ---- */
|
|
241
|
+
setValue(e, t = !0) {
|
|
242
|
+
const i = e === null && this.value === null || e instanceof Date && this.value instanceof Date && e.getTime() === this.value.getTime();
|
|
243
|
+
this.value = e ? new Date(e.getTime()) : null, e && (this._calendarMonth = new Date(e.getFullYear(), e.getMonth(), 1)), this.requestUpdate(), t && !i && (this.dispatchEvent(
|
|
244
|
+
new CustomEvent("value-change", {
|
|
245
|
+
detail: this.value ? new Date(this.value.getTime()) : null,
|
|
246
|
+
bubbles: !0,
|
|
247
|
+
composed: !0
|
|
248
|
+
})
|
|
249
|
+
), this.announceValue());
|
|
250
|
+
}
|
|
251
|
+
/** Polite live-region announce on value change. Skipped on first render. */
|
|
252
|
+
announceValue() {
|
|
253
|
+
const e = this.value ? this.value.getTime() : null;
|
|
254
|
+
if (this.lastAnnouncedValue, e === this.lastAnnouncedValue) return;
|
|
255
|
+
if (this.lastAnnouncedValue = e, this.value === null) {
|
|
256
|
+
this.liveAnnouncer.announce(`${this.clearLabel}`);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const t = this.value.toLocaleString(this.locale ?? void 0, {
|
|
260
|
+
dateStyle: "long",
|
|
261
|
+
timeStyle: "short",
|
|
262
|
+
hour12: this.resolvedHour12()
|
|
263
|
+
});
|
|
264
|
+
this.liveAnnouncer.announce(`${t} selected`);
|
|
265
|
+
}
|
|
266
|
+
clear() {
|
|
267
|
+
this.disabled || this.setValue(null);
|
|
268
|
+
}
|
|
269
|
+
get openPopup() {
|
|
270
|
+
return this._openPopup;
|
|
271
|
+
}
|
|
272
|
+
async openDate() {
|
|
273
|
+
this.disabled || (this.timeOverlay.isOpen && this.timeOverlay.close(!1), this._openPopup = "date", await this.dateOverlay.open());
|
|
274
|
+
}
|
|
275
|
+
async openTime() {
|
|
276
|
+
this.disabled || (this.dateOverlay.isOpen && this.dateOverlay.close(!1), this._openPopup = "time", await this.timeOverlay.open());
|
|
277
|
+
}
|
|
278
|
+
closePopups() {
|
|
279
|
+
this.dateOverlay.isOpen && this.dateOverlay.close(), this.timeOverlay.isOpen && this.timeOverlay.close();
|
|
280
|
+
}
|
|
281
|
+
/* ---- Display ---- */
|
|
282
|
+
formatDisplay() {
|
|
283
|
+
return this.value ? this.value.toLocaleString(this.locale ?? void 0, {
|
|
284
|
+
dateStyle: "short",
|
|
285
|
+
timeStyle: "short",
|
|
286
|
+
hour12: this.resolvedHour12()
|
|
287
|
+
}) : "";
|
|
288
|
+
}
|
|
289
|
+
resolvedHour12() {
|
|
290
|
+
if (this.hour12 === !0) return !0;
|
|
291
|
+
if (this.hour12 === !1) return !1;
|
|
292
|
+
}
|
|
293
|
+
/* ---- Value composition ---- */
|
|
294
|
+
updateDatePart(e) {
|
|
295
|
+
const t = this.value ? { hour: this.value.getHours(), minute: this.value.getMinutes() } : { hour: this.defaultTime.hour, minute: this.defaultTime.minute }, i = new Date(
|
|
296
|
+
e.getFullYear(),
|
|
297
|
+
e.getMonth(),
|
|
298
|
+
e.getDate(),
|
|
299
|
+
t.hour,
|
|
300
|
+
t.minute,
|
|
301
|
+
0,
|
|
302
|
+
0
|
|
303
|
+
);
|
|
304
|
+
this.setValue(i);
|
|
305
|
+
}
|
|
306
|
+
updateTimePart(e) {
|
|
307
|
+
const t = /* @__PURE__ */ new Date(), i = this.value ?? t, a = new Date(
|
|
308
|
+
i.getFullYear(),
|
|
309
|
+
i.getMonth(),
|
|
310
|
+
i.getDate(),
|
|
311
|
+
e.getHours(),
|
|
312
|
+
e.getMinutes(),
|
|
313
|
+
0,
|
|
314
|
+
0
|
|
315
|
+
);
|
|
316
|
+
this.setValue(a);
|
|
317
|
+
}
|
|
318
|
+
/* ---- Render ---- */
|
|
319
|
+
render() {
|
|
320
|
+
const e = this.formatDisplay(), t = this.value !== null, i = this.showClear && t && !this.disabled, a = this._calendarMonth ?? (this.value ? new Date(this.value.getFullYear(), this.value.getMonth(), 1) : /* @__PURE__ */ new Date()), o = this.value ?? null, n = this.value ?? null;
|
|
321
|
+
return d`
|
|
322
|
+
<div class="input-group">
|
|
323
|
+
<input
|
|
324
|
+
class="form-control"
|
|
325
|
+
type="text"
|
|
326
|
+
readonly
|
|
327
|
+
aria-readonly="true"
|
|
328
|
+
aria-label="${this.inputLabel}"
|
|
329
|
+
.value="${e}"
|
|
330
|
+
placeholder="${this.placeholder || h}"
|
|
331
|
+
?disabled="${this.disabled}"
|
|
332
|
+
/>
|
|
333
|
+
${i ? d`<button
|
|
334
|
+
class="trigger clear"
|
|
335
|
+
type="button"
|
|
336
|
+
aria-label="${this.clearLabel}"
|
|
337
|
+
?disabled="${this.disabled}"
|
|
338
|
+
@click="${this.onClearClick}"
|
|
339
|
+
.innerHTML="${w}"
|
|
340
|
+
></button>` : h}
|
|
341
|
+
<button
|
|
342
|
+
class="trigger date"
|
|
343
|
+
type="button"
|
|
344
|
+
aria-haspopup="dialog"
|
|
345
|
+
aria-expanded="${this._openPopup === "date" ? "true" : "false"}"
|
|
346
|
+
aria-controls="${this.datePopupId}"
|
|
347
|
+
aria-label="${this.dateButtonLabel}"
|
|
348
|
+
?disabled="${this.disabled}"
|
|
349
|
+
@click="${this.onDateTriggerClick}"
|
|
350
|
+
@keydown="${this.onDateTriggerKeyDown}"
|
|
351
|
+
.innerHTML="${v}"
|
|
352
|
+
></button>
|
|
353
|
+
<button
|
|
354
|
+
class="trigger time"
|
|
355
|
+
type="button"
|
|
356
|
+
aria-haspopup="dialog"
|
|
357
|
+
aria-expanded="${this._openPopup === "time" ? "true" : "false"}"
|
|
358
|
+
aria-controls="${this.timePopupId}"
|
|
359
|
+
aria-label="${this.timeButtonLabel}"
|
|
360
|
+
?disabled="${this.disabled}"
|
|
361
|
+
@click="${this.onTimeTriggerClick}"
|
|
362
|
+
@keydown="${this.onTimeTriggerKeyDown}"
|
|
363
|
+
.innerHTML="${y}"
|
|
364
|
+
></button>
|
|
365
|
+
</div>
|
|
366
|
+
${this.liveAnnouncer.template()}
|
|
367
|
+
|
|
368
|
+
<div class="popup popup-date" id="${this.datePopupId}" role="dialog" aria-label="${this.dateButtonLabel}">
|
|
369
|
+
<slot name="calendar"
|
|
370
|
+
@selected-date-change="${this.onCalendarSelectedDateChange}"
|
|
371
|
+
@current-month-change="${this.onCalendarCurrentMonthChange}"
|
|
372
|
+
>
|
|
373
|
+
<mp-calendar
|
|
374
|
+
.selectedDate="${o}"
|
|
375
|
+
.currentMonth="${a}"
|
|
376
|
+
.disableDateFn="${this.disableDateFn}"
|
|
377
|
+
.min="${this.min}"
|
|
378
|
+
.max="${this.max}"
|
|
379
|
+
.firstDayOfWeek="${this.firstDayOfWeek}"
|
|
380
|
+
.locale="${this.locale}"
|
|
381
|
+
@selected-date-change="${this.onCalendarSelectedDateChange}"
|
|
382
|
+
@current-month-change="${this.onCalendarCurrentMonthChange}"
|
|
383
|
+
></mp-calendar>
|
|
384
|
+
</slot>
|
|
385
|
+
<div class="popup-footer">
|
|
386
|
+
<button type="button" @click="${this.onTodayClick}">${this.todayLabel}</button>
|
|
387
|
+
</div>
|
|
388
|
+
</div>
|
|
389
|
+
|
|
390
|
+
<div class="popup popup-time" id="${this.timePopupId}" role="dialog" aria-label="${this.timeButtonLabel}">
|
|
391
|
+
<slot name="time-list"
|
|
392
|
+
@selected-time-change="${this.onTimeListSelectedTimeChange}"
|
|
393
|
+
>
|
|
394
|
+
<mp-time-list
|
|
395
|
+
.selectedTime="${n}"
|
|
396
|
+
.step="${this.step}"
|
|
397
|
+
.hour12="${this.hour12}"
|
|
398
|
+
.locale="${this.locale}"
|
|
399
|
+
@selected-time-change="${this.onTimeListSelectedTimeChange}"
|
|
400
|
+
></mp-time-list>
|
|
401
|
+
</slot>
|
|
402
|
+
<div class="popup-footer">
|
|
403
|
+
<button type="button" @click="${this.onNowClick}">${this.nowLabel}</button>
|
|
404
|
+
</div>
|
|
405
|
+
</div>
|
|
406
|
+
`;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
l([
|
|
410
|
+
s("button.date")
|
|
411
|
+
], r.prototype, "dateTriggerEl");
|
|
412
|
+
l([
|
|
413
|
+
s("button.time")
|
|
414
|
+
], r.prototype, "timeTriggerEl");
|
|
415
|
+
l([
|
|
416
|
+
s(".input-group")
|
|
417
|
+
], r.prototype, "inputGroupEl");
|
|
418
|
+
l([
|
|
419
|
+
s(".popup-date")
|
|
420
|
+
], r.prototype, "datePopupEl");
|
|
421
|
+
l([
|
|
422
|
+
s(".popup-time")
|
|
423
|
+
], r.prototype, "timePopupEl");
|
|
424
|
+
typeof customElements < "u" && !customElements.get("mp-datetime-picker") && customElements.define("mp-datetime-picker", r);
|
|
425
|
+
export {
|
|
426
|
+
r as MpDatetimePickerElement
|
|
427
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './mp-datetime-picker.element';
|