@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
package/a11y/index.mjs
CHANGED
|
@@ -1,58 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createRef as s, ref as n } from "lit/directives/ref.js";
|
|
3
|
-
const l = "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";
|
|
4
|
-
class c {
|
|
5
|
-
constructor(e, t = {}) {
|
|
6
|
-
this.clearTimer = null, this.pendingMessage = null, this.regionRef = s(), this.host = e, this.politeness = t.politeness ?? "polite", this.clearAfterMs = t.clearAfterMs ?? 1500, e.addController(this);
|
|
7
|
-
}
|
|
8
|
-
hostUpdated() {
|
|
9
|
-
if (this.pendingMessage !== null && this.regionRef.value) {
|
|
10
|
-
const e = this.pendingMessage;
|
|
11
|
-
this.pendingMessage = null, this.writeMessage(e);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
hostDisconnected() {
|
|
15
|
-
this.clearTimer !== null && (clearTimeout(this.clearTimer), this.clearTimer = null);
|
|
16
|
-
}
|
|
17
|
-
announce(e) {
|
|
18
|
-
if (!e) return;
|
|
19
|
-
if (!this.regionRef.value) {
|
|
20
|
-
this.pendingMessage = e, this.host.requestUpdate();
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
this.writeMessage(e);
|
|
24
|
-
}
|
|
25
|
-
/** Returns the live-region template fragment. Call once inside the host's render(). */
|
|
26
|
-
template() {
|
|
27
|
-
const e = this.politeness === "assertive" ? "alert" : "status";
|
|
28
|
-
return r`<div
|
|
29
|
-
${n(this.regionRef)}
|
|
30
|
-
role=${e}
|
|
31
|
-
aria-live=${this.politeness}
|
|
32
|
-
aria-atomic="true"
|
|
33
|
-
style=${l}
|
|
34
|
-
></div>`;
|
|
35
|
-
}
|
|
36
|
-
writeMessage(e) {
|
|
37
|
-
const t = this.regionRef.value;
|
|
38
|
-
if (t) {
|
|
39
|
-
if (t.textContent === e) {
|
|
40
|
-
t.textContent = "", queueMicrotask(() => {
|
|
41
|
-
const i = this.regionRef.value;
|
|
42
|
-
i && (i.textContent = e), this.scheduleClear();
|
|
43
|
-
});
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
t.textContent = e, this.scheduleClear();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
scheduleClear() {
|
|
50
|
-
this.clearTimer !== null && clearTimeout(this.clearTimer), this.clearTimer = setTimeout(() => {
|
|
51
|
-
const e = this.regionRef.value;
|
|
52
|
-
e && (e.textContent = ""), this.clearTimer = null;
|
|
53
|
-
}, this.clearAfterMs);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
import { L as e } from "../chunks/live-announcer-CZDTKulf.mjs";
|
|
56
2
|
export {
|
|
57
|
-
|
|
3
|
+
e as LiveAnnouncerController
|
|
58
4
|
};
|
package/calendar/index.mjs
CHANGED
|
@@ -1,365 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
u`<!-- The calendar is rendered dynamically by render(). This file exists only so
|
|
3
|
-
the codegen-wc target emits a \`styles\` export from the sibling .scss; the
|
|
4
|
-
\`template\` export is intentionally unused. -->`;
|
|
5
|
-
const p = b(`:host {
|
|
6
|
-
display: inline-block;
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
color: var(--bs-body-color);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.text-muted {
|
|
12
|
-
color: var(--bs-secondary-color) !important;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
table {
|
|
16
|
-
border-collapse: collapse;
|
|
17
|
-
border: 1px solid var(--bs-border-color);
|
|
18
|
-
background-color: var(--bs-body-bg);
|
|
19
|
-
color: var(--bs-body-color);
|
|
20
|
-
margin-bottom: 0;
|
|
21
|
-
width: auto;
|
|
22
|
-
}
|
|
23
|
-
table td, table th {
|
|
24
|
-
width: 40px;
|
|
25
|
-
height: 40px;
|
|
26
|
-
text-align: center;
|
|
27
|
-
cursor: default;
|
|
28
|
-
padding: 0;
|
|
29
|
-
}
|
|
30
|
-
table td span, table th span {
|
|
31
|
-
white-space: nowrap;
|
|
32
|
-
}
|
|
33
|
-
table td.selected {
|
|
34
|
-
background-color: var(--bs-primary);
|
|
35
|
-
color: #fff;
|
|
36
|
-
}
|
|
37
|
-
table td.cursor-pointer {
|
|
38
|
-
cursor: pointer;
|
|
39
|
-
}
|
|
40
|
-
table td:focus {
|
|
41
|
-
outline: none;
|
|
42
|
-
}
|
|
43
|
-
table td:focus-visible {
|
|
44
|
-
outline: 2px solid var(--bs-primary);
|
|
45
|
-
outline-offset: -2px;
|
|
46
|
-
}
|
|
47
|
-
table th {
|
|
48
|
-
background-color: var(--bs-tertiary-bg);
|
|
49
|
-
font-weight: bolder;
|
|
50
|
-
}
|
|
51
|
-
table tr {
|
|
52
|
-
border-top: none;
|
|
53
|
-
}
|
|
54
|
-
table tr:first-child > td {
|
|
55
|
-
border-bottom: 1px solid var(--bs-border-color);
|
|
56
|
-
}
|
|
57
|
-
table tr:nth-of-type(2) > th:not(:nth-of-type(1)) {
|
|
58
|
-
border-bottom: 1px solid var(--bs-border-color);
|
|
59
|
-
}
|
|
60
|
-
table tr:not(:nth-of-type(2)) > th:nth-of-type(1) {
|
|
61
|
-
border-right: 1px solid var(--bs-border-color);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.chevron-btn {
|
|
65
|
-
background: transparent;
|
|
66
|
-
border: 0;
|
|
67
|
-
padding: 0;
|
|
68
|
-
cursor: pointer;
|
|
69
|
-
color: inherit;
|
|
70
|
-
font: inherit;
|
|
71
|
-
width: 100%;
|
|
72
|
-
height: 100%;
|
|
73
|
-
display: inline-flex;
|
|
74
|
-
align-items: center;
|
|
75
|
-
justify-content: center;
|
|
76
|
-
}
|
|
77
|
-
.chevron-btn:focus {
|
|
78
|
-
outline: none;
|
|
79
|
-
}
|
|
80
|
-
.chevron-btn:focus-visible {
|
|
81
|
-
outline: 2px solid var(--bs-primary);
|
|
82
|
-
outline-offset: -2px;
|
|
83
|
-
}
|
|
84
|
-
.chevron-btn svg {
|
|
85
|
-
width: 16px;
|
|
86
|
-
height: 16px;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.month-label {
|
|
90
|
-
font-weight: bolder;
|
|
91
|
-
}`), m = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/></svg>', w = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/></svg>';
|
|
92
|
-
let M = 0;
|
|
93
|
-
class y extends D {
|
|
94
|
-
constructor() {
|
|
95
|
-
super(...arguments), this.selectedDate = null, this.currentMonth = null, this.disableDateFn = null, this.min = null, this.max = null, this.firstDayOfWeek = 1, this.locale = void 0, this._focusedDate = null, this.pendingFocusMove = !1, this.instanceId = `mp-cal-${++M}`, this.monthLabelId = `${this.instanceId}-month`;
|
|
96
|
-
}
|
|
97
|
-
static {
|
|
98
|
-
this.styles = [p];
|
|
99
|
-
}
|
|
100
|
-
static {
|
|
101
|
-
this.properties = {
|
|
102
|
-
selectedDate: { attribute: !1 },
|
|
103
|
-
currentMonth: { attribute: !1 },
|
|
104
|
-
disableDateFn: { attribute: !1 },
|
|
105
|
-
min: { attribute: !1 },
|
|
106
|
-
max: { attribute: !1 },
|
|
107
|
-
firstDayOfWeek: { attribute: "first-day-of-week", type: Number, reflect: !0 },
|
|
108
|
-
locale: { attribute: "locale", type: String, reflect: !0 },
|
|
109
|
-
_focusedDate: { state: !0 }
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
connectedCallback() {
|
|
113
|
-
super.connectedCallback(), this.currentMonth === null && (this.currentMonth = /* @__PURE__ */ new Date());
|
|
114
|
-
}
|
|
115
|
-
updated(t) {
|
|
116
|
-
if (this.pendingFocusMove) {
|
|
117
|
-
this.pendingFocusMove = !1;
|
|
118
|
-
const e = this._focusedDate;
|
|
119
|
-
e && this.renderRoot.querySelector(
|
|
120
|
-
`[id="${this.cellId(e)}"]`
|
|
121
|
-
)?.focus();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
cellId(t) {
|
|
125
|
-
return `${this.instanceId}-cell-${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
|
|
126
|
-
}
|
|
127
|
-
isSameDate(t, e) {
|
|
128
|
-
return t === null && e === null ? !0 : t === null || e === null ? !1 : t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth() && t.getDate() === e.getDate();
|
|
129
|
-
}
|
|
130
|
-
isToday(t) {
|
|
131
|
-
return this.isSameDate(t, /* @__PURE__ */ new Date());
|
|
132
|
-
}
|
|
133
|
-
/** Disabled if out of [min, max] (date-only) or rejected by disableDateFn. */
|
|
134
|
-
isDisabled(t) {
|
|
135
|
-
return this.min && this.dateOnly(t) < this.dateOnly(this.min) || this.max && this.dateOnly(t) > this.dateOnly(this.max) ? !0 : !!this.disableDateFn && this.disableDateFn(t);
|
|
136
|
-
}
|
|
137
|
-
dateOnly(t) {
|
|
138
|
-
return new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime();
|
|
139
|
-
}
|
|
140
|
-
/** Compute the weeks rendered for the current month, honoring firstDayOfWeek. */
|
|
141
|
-
getWeeks(t) {
|
|
142
|
-
const e = new Date(t.getFullYear(), t.getMonth(), 1), n = new Date(t.getFullYear(), t.getMonth() + 1, 0), r = this.startOfWeek(e), i = this.endOfWeek(n), s = this.daysBetween(r, i) + 1, l = [];
|
|
143
|
-
for (let a = 0; a < s; a++) {
|
|
144
|
-
const h = new Date(r.getFullYear(), r.getMonth(), r.getDate() + a);
|
|
145
|
-
l.push({
|
|
146
|
-
date: h,
|
|
147
|
-
dayOfMonth: h.getDate(),
|
|
148
|
-
isInMonth: h.getFullYear() === t.getFullYear() && h.getMonth() === t.getMonth()
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
const o = [];
|
|
152
|
-
for (let a = 0; a < l.length; a += 7) {
|
|
153
|
-
const h = l.slice(a, a + 7), d = h.find((f) => f.isInMonth), g = d ? d.date : h[0].date;
|
|
154
|
-
o.push({
|
|
155
|
-
number: this.weekOfYear(g),
|
|
156
|
-
days: h
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
return o;
|
|
160
|
-
}
|
|
161
|
-
/** First day of the visible grid — Monday-on-top by default. */
|
|
162
|
-
startOfWeek(t) {
|
|
163
|
-
const n = (t.getDay() - this.firstDayOfWeek + 7) % 7;
|
|
164
|
-
return new Date(t.getFullYear(), t.getMonth(), t.getDate() - n);
|
|
165
|
-
}
|
|
166
|
-
endOfWeek(t) {
|
|
167
|
-
const e = t.getDay(), n = (this.firstDayOfWeek + 6 - e + 7) % 7;
|
|
168
|
-
return new Date(t.getFullYear(), t.getMonth(), t.getDate() + n);
|
|
169
|
-
}
|
|
170
|
-
daysBetween(t, e) {
|
|
171
|
-
return Math.floor((this.dateOnly(e) - this.dateOnly(t)) / 864e5);
|
|
172
|
-
}
|
|
173
|
-
/** ISO-8601 week-of-year. */
|
|
174
|
-
weekOfYear(t) {
|
|
175
|
-
const e = new Date(Date.UTC(t.getFullYear(), t.getMonth(), t.getDate()));
|
|
176
|
-
e.setUTCDate(e.getUTCDate() + 4 - (e.getUTCDay() || 7));
|
|
177
|
-
const n = new Date(Date.UTC(e.getUTCFullYear(), 0, 1));
|
|
178
|
-
return Math.ceil(((e.getTime() - n.getTime()) / 864e5 + 1) / 7);
|
|
179
|
-
}
|
|
180
|
-
/** Localized weekday short + long names, in the order driven by firstDayOfWeek. */
|
|
181
|
-
weekdayNames() {
|
|
182
|
-
const t = new Date(2024, 0, 7), e = [];
|
|
183
|
-
for (let n = 0; n < 7; n++) {
|
|
184
|
-
const r = new Date(t);
|
|
185
|
-
r.setDate(t.getDate() + (this.firstDayOfWeek + n) % 7), e.push({
|
|
186
|
-
short: r.toLocaleString(this.locale ?? "default", { weekday: "short" }),
|
|
187
|
-
long: r.toLocaleString(this.locale ?? "default", { weekday: "long" })
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
return e;
|
|
191
|
-
}
|
|
192
|
-
monthLabel(t) {
|
|
193
|
-
const e = t.toLocaleString(this.locale ?? "default", { month: "long" });
|
|
194
|
-
return `${e.charAt(0).toUpperCase()}${e.slice(1)} ${t.getFullYear()}`;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* The cell that should carry tabindex="0". One per month — focused, else
|
|
198
|
-
* selected, else today, else first enabled day. Mirrors APG convention.
|
|
199
|
-
*/
|
|
200
|
-
focusableDate() {
|
|
201
|
-
const t = this.currentMonth;
|
|
202
|
-
if (!t) return null;
|
|
203
|
-
const e = (o) => o.getFullYear() === t.getFullYear() && o.getMonth() === t.getMonth(), n = (o) => o && e(o) ? o : null, r = n(this._focusedDate);
|
|
204
|
-
if (r) return r;
|
|
205
|
-
const i = n(this.selectedDate);
|
|
206
|
-
if (i) return i;
|
|
207
|
-
const l = n(/* @__PURE__ */ new Date());
|
|
208
|
-
if (l) return l;
|
|
209
|
-
for (const o of this.getWeeks(t))
|
|
210
|
-
for (const a of o.days)
|
|
211
|
-
if (a && a.isInMonth && !this.isDisabled(a.date)) return a.date;
|
|
212
|
-
return null;
|
|
213
|
-
}
|
|
214
|
-
/* ---- Public API ---- */
|
|
215
|
-
previousMonth() {
|
|
216
|
-
this.currentMonth && this.setCurrentMonth(
|
|
217
|
-
new Date(this.currentMonth.getFullYear(), this.currentMonth.getMonth() - 1, 1)
|
|
218
|
-
);
|
|
219
|
-
}
|
|
220
|
-
nextMonth() {
|
|
221
|
-
this.currentMonth && this.setCurrentMonth(
|
|
222
|
-
new Date(this.currentMonth.getFullYear(), this.currentMonth.getMonth() + 1, 1)
|
|
223
|
-
);
|
|
224
|
-
}
|
|
225
|
-
goto(t) {
|
|
226
|
-
!t || !t.isInMonth || this.isDisabled(t.date) || (this.setSelectedDate(t.date), this._focusedDate = t.date, this.requestUpdate());
|
|
227
|
-
}
|
|
228
|
-
/* ---- Internal setters with event dispatch ---- */
|
|
229
|
-
setCurrentMonth(t) {
|
|
230
|
-
const e = this.currentMonth;
|
|
231
|
-
e && this.isSameYearMonth(e, t) || (this.currentMonth = t, this.requestUpdate(), this.dispatchEvent(
|
|
232
|
-
new CustomEvent("current-month-change", {
|
|
233
|
-
detail: new Date(t.getFullYear(), t.getMonth(), 1),
|
|
234
|
-
bubbles: !0,
|
|
235
|
-
composed: !0
|
|
236
|
-
})
|
|
237
|
-
));
|
|
238
|
-
}
|
|
239
|
-
setSelectedDate(t) {
|
|
240
|
-
this.selectedDate = t, this.requestUpdate(), this.dispatchEvent(
|
|
241
|
-
new CustomEvent("selected-date-change", {
|
|
242
|
-
detail: new Date(t.getFullYear(), t.getMonth(), t.getDate()),
|
|
243
|
-
bubbles: !0,
|
|
244
|
-
composed: !0
|
|
245
|
-
})
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
isSameYearMonth(t, e) {
|
|
249
|
-
return t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth();
|
|
250
|
-
}
|
|
251
|
-
/* ---- Keyboard ---- */
|
|
252
|
-
onCellKeyDown(t, e) {
|
|
253
|
-
if (!e || !e.isInMonth) return;
|
|
254
|
-
const n = t.key, r = n === "ArrowLeft" || n === "ArrowRight" || n === "ArrowUp" || n === "ArrowDown" || n === "Home" || n === "End" || n === "PageUp" || n === "PageDown", i = n === "Enter" || n === " ";
|
|
255
|
-
if (!r && !i) return;
|
|
256
|
-
if (t.preventDefault(), i) {
|
|
257
|
-
this.goto(e);
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
const s = e.date;
|
|
261
|
-
let l = new Date(s);
|
|
262
|
-
const o = getComputedStyle(this).direction === "rtl";
|
|
263
|
-
switch (n) {
|
|
264
|
-
case "ArrowLeft":
|
|
265
|
-
l.setDate(s.getDate() + (o ? 1 : -1));
|
|
266
|
-
break;
|
|
267
|
-
case "ArrowRight":
|
|
268
|
-
l.setDate(s.getDate() + (o ? -1 : 1));
|
|
269
|
-
break;
|
|
270
|
-
case "ArrowUp":
|
|
271
|
-
l.setDate(s.getDate() - 7);
|
|
272
|
-
break;
|
|
273
|
-
case "ArrowDown":
|
|
274
|
-
l.setDate(s.getDate() + 7);
|
|
275
|
-
break;
|
|
276
|
-
case "Home": {
|
|
277
|
-
const a = (s.getDay() - this.firstDayOfWeek + 7) % 7;
|
|
278
|
-
l.setDate(s.getDate() - a);
|
|
279
|
-
break;
|
|
280
|
-
}
|
|
281
|
-
case "End": {
|
|
282
|
-
const a = (this.firstDayOfWeek + 6 - s.getDay() + 7) % 7;
|
|
283
|
-
l.setDate(s.getDate() + a);
|
|
284
|
-
break;
|
|
285
|
-
}
|
|
286
|
-
case "PageUp":
|
|
287
|
-
l = t.ctrlKey ? new Date(s.getFullYear() - 1, s.getMonth(), s.getDate()) : new Date(s.getFullYear(), s.getMonth() - 1, s.getDate());
|
|
288
|
-
break;
|
|
289
|
-
case "PageDown":
|
|
290
|
-
l = t.ctrlKey ? new Date(s.getFullYear() + 1, s.getMonth(), s.getDate()) : new Date(s.getFullYear(), s.getMonth() + 1, s.getDate());
|
|
291
|
-
break;
|
|
292
|
-
}
|
|
293
|
-
this.moveFocusTo(l);
|
|
294
|
-
}
|
|
295
|
-
moveFocusTo(t) {
|
|
296
|
-
this.currentMonth && (this.isSameYearMonth(this.currentMonth, t) || this.setCurrentMonth(new Date(t.getFullYear(), t.getMonth(), 1)), this._focusedDate = t, this.pendingFocusMove = !0, this.requestUpdate());
|
|
297
|
-
}
|
|
298
|
-
/* ---- Render ---- */
|
|
299
|
-
render() {
|
|
300
|
-
const t = this.currentMonth ?? /* @__PURE__ */ new Date(), e = this.getWeeks(t), n = this.weekdayNames(), r = this.focusableDate();
|
|
301
|
-
return u`
|
|
302
|
-
<table role="grid" aria-labelledby="${this.monthLabelId}">
|
|
303
|
-
<tr>
|
|
304
|
-
<td>
|
|
305
|
-
<button
|
|
306
|
-
type="button"
|
|
307
|
-
class="chevron-btn"
|
|
308
|
-
aria-label="Previous month"
|
|
309
|
-
@click="${() => this.previousMonth()}"
|
|
310
|
-
.innerHTML="${m}"
|
|
311
|
-
></button>
|
|
312
|
-
</td>
|
|
313
|
-
<td colspan="6" id="${this.monthLabelId}" class="month-label" aria-live="polite">
|
|
314
|
-
${this.monthLabel(t)}
|
|
315
|
-
</td>
|
|
316
|
-
<td>
|
|
317
|
-
<button
|
|
318
|
-
type="button"
|
|
319
|
-
class="chevron-btn"
|
|
320
|
-
aria-label="Next month"
|
|
321
|
-
@click="${() => this.nextMonth()}"
|
|
322
|
-
.innerHTML="${w}"
|
|
323
|
-
></button>
|
|
324
|
-
</td>
|
|
325
|
-
</tr>
|
|
326
|
-
<tr role="row">
|
|
327
|
-
<th aria-hidden="true"></th>
|
|
328
|
-
${n.map(
|
|
329
|
-
(i) => u`<th scope="col" role="columnheader" title="${i.long}">${i.short}</th>`
|
|
330
|
-
)}
|
|
331
|
-
</tr>
|
|
332
|
-
${e.map(
|
|
333
|
-
(i) => u`
|
|
334
|
-
<tr role="row">
|
|
335
|
-
<th scope="row" role="rowheader">${i.number}</th>
|
|
336
|
-
${i.days.map((s) => this.renderCell(s, r))}
|
|
337
|
-
</tr>
|
|
338
|
-
`
|
|
339
|
-
)}
|
|
340
|
-
</table>
|
|
341
|
-
`;
|
|
342
|
-
}
|
|
343
|
-
renderCell(t, e) {
|
|
344
|
-
const n = !!t && t.isInMonth, r = !!t && this.isDisabled(t.date), i = !!t && t.isInMonth && this.isSameDate(this.selectedDate, t.date), s = !!t && t.isInMonth && this.isToday(t.date), l = !!t && t.isInMonth && this.isSameDate(e, t.date), o = [];
|
|
345
|
-
i && o.push("selected"), n && !r && o.push("cursor-pointer");
|
|
346
|
-
const a = o.length ? o.join(" ") : void 0, h = t && t.isInMonth ? this.cellId(t.date) : void 0;
|
|
347
|
-
return u`<td
|
|
348
|
-
role="gridcell"
|
|
349
|
-
id="${h ?? c}"
|
|
350
|
-
class="${a ?? c}"
|
|
351
|
-
tabindex="${n ? l ? 0 : -1 : c}"
|
|
352
|
-
aria-selected="${n ? i ? "true" : "false" : c}"
|
|
353
|
-
aria-current="${s ? "date" : c}"
|
|
354
|
-
aria-disabled="${r ? "true" : c}"
|
|
355
|
-
@click="${() => this.goto(t)}"
|
|
356
|
-
@keydown="${(d) => this.onCellKeyDown(d, t)}"
|
|
357
|
-
>
|
|
358
|
-
${n ? u`<span class="${r ? "text-muted" : ""}">${t.dayOfMonth}</span>` : c}
|
|
359
|
-
</td>`;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
typeof customElements < "u" && !customElements.get("mp-calendar") && customElements.define("mp-calendar", y);
|
|
1
|
+
import { M as r } from "../chunks/mp-calendar.element-UC68iDbi.mjs";
|
|
363
2
|
export {
|
|
364
|
-
|
|
3
|
+
r as MpCalendarElement
|
|
365
4
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
+
import { ToggleButtonColor } from '@mintplayer/web-components/toggle-button';
|
|
3
|
+
export type MpCheckboxType = 'checkbox' | 'switch' | 'toggle_button';
|
|
4
|
+
export interface CheckboxChangeEventDetail {
|
|
5
|
+
checked: boolean;
|
|
6
|
+
indeterminate: boolean;
|
|
7
|
+
value: string | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* `<mp-checkbox>` — a Bootstrap-styled checkbox with three visual variants
|
|
11
|
+
* via the `type` attribute:
|
|
12
|
+
*
|
|
13
|
+
* - `checkbox` (default) — `.form-check` with a square indicator.
|
|
14
|
+
* - `switch` — `.form-check.form-switch` for the iOS-style sliding switch.
|
|
15
|
+
* - `toggle_button` — `.btn-check` rendered as a `.btn .btn-<color>`.
|
|
16
|
+
*
|
|
17
|
+
* Supports first-class **tri-state** via the `indeterminate` attribute /
|
|
18
|
+
* property. The visual indeterminate styling is the browser's native
|
|
19
|
+
* `<input>.indeterminate` DOM property; we additionally reflect
|
|
20
|
+
* `aria-checked="mixed"` for AT and mirror the value to a reflected
|
|
21
|
+
* boolean attribute so consumers can target the state from CSS.
|
|
22
|
+
* The native `change` event clears `indeterminate` on the next user click
|
|
23
|
+
* (per HTML spec); consumers that want the master/select-all pattern can
|
|
24
|
+
* re-derive and re-set `indeterminate` from the resulting state.
|
|
25
|
+
*
|
|
26
|
+
* Emits `change` with `detail: { checked, indeterminate, value }`.
|
|
27
|
+
*/
|
|
28
|
+
export declare class MpCheckbox extends LitElement {
|
|
29
|
+
static styles: import('lit').CSSResult[];
|
|
30
|
+
static shadowRootOptions: {
|
|
31
|
+
delegatesFocus: boolean;
|
|
32
|
+
clonable?: boolean;
|
|
33
|
+
customElementRegistry?: CustomElementRegistry;
|
|
34
|
+
mode: ShadowRootMode;
|
|
35
|
+
serializable?: boolean;
|
|
36
|
+
slotAssignment?: SlotAssignmentMode;
|
|
37
|
+
};
|
|
38
|
+
static get observedAttributes(): string[];
|
|
39
|
+
private _type;
|
|
40
|
+
private _checked;
|
|
41
|
+
private _indeterminate;
|
|
42
|
+
private _disabled;
|
|
43
|
+
private _name;
|
|
44
|
+
private _value;
|
|
45
|
+
private _color;
|
|
46
|
+
private readonly _inputId;
|
|
47
|
+
private readonly _inputRef;
|
|
48
|
+
get type(): MpCheckboxType;
|
|
49
|
+
set type(value: MpCheckboxType);
|
|
50
|
+
get checked(): boolean;
|
|
51
|
+
set checked(value: boolean);
|
|
52
|
+
get indeterminate(): boolean;
|
|
53
|
+
set indeterminate(value: boolean);
|
|
54
|
+
get disabled(): boolean;
|
|
55
|
+
set disabled(value: boolean);
|
|
56
|
+
get name(): string | null;
|
|
57
|
+
set name(value: string | null);
|
|
58
|
+
get value(): string | null;
|
|
59
|
+
set value(value: string | null);
|
|
60
|
+
get color(): ToggleButtonColor;
|
|
61
|
+
set color(value: ToggleButtonColor);
|
|
62
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
63
|
+
render(): TemplateResult;
|
|
64
|
+
protected updated(): void;
|
|
65
|
+
private renderCheckOrSwitch;
|
|
66
|
+
private renderToggleButton;
|
|
67
|
+
private reflectBoolean;
|
|
68
|
+
private onInputChange;
|
|
69
|
+
}
|