@mintplayer/web-components 2.5.0 → 2.7.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.
Files changed (44) hide show
  1. package/a11y/index.mjs +9 -8
  2. package/checkbox/index.mjs +1 -1
  3. package/chunks/error-text-B45eDAt1.mjs +17 -0
  4. package/chunks/{form-associated-axmc5sY0.mjs → form-associated-BR-fUvZ1.mjs} +11 -26
  5. package/chunks/{id-D5QCG603.mjs → id-BstjfRrz.mjs} +97 -72
  6. package/chunks/{mp-checkbox-Ph2mMRGz.mjs → mp-checkbox-6EJwdUIn.mjs} +6 -5
  7. package/chunks/{mp-datatable-BwTlh9A_.mjs → mp-datatable-25O1GtvU.mjs} +1 -1
  8. package/chunks/mp-datetime-picker.element-MPTRHwyc.mjs +530 -0
  9. package/chunks/{mp-radio-BjW1HNSc.mjs → mp-radio-DvKgrTFL.mjs} +2 -2
  10. package/chunks/{mp-select-Ctu-v1-p.mjs → mp-select-CKX0eM5C.mjs} +5 -4
  11. package/chunks/{mp-timepicker.element-Bz393NDQ.mjs → mp-timepicker.element-COZEUIoE.mjs} +56 -52
  12. package/chunks/{mp-toggle-button-Kz6sIgBJ.mjs → mp-toggle-button-C4Loq_p4.mjs} +5 -4
  13. package/chunks/{overlay-controller-DPt13i8p.mjs → overlay-controller-D6agzzOI.mjs} +19 -4
  14. package/datatable/index.mjs +1 -1
  15. package/datepicker/index.mjs +1 -1
  16. package/datetime-picker/index.mjs +2 -431
  17. package/datetime-picker/src/mp-datetime-picker.element.d.ts +66 -0
  18. package/file-manager/index.mjs +1 -1
  19. package/navbar/index.mjs +1 -1
  20. package/otp-input/index.mjs +4 -3
  21. package/overlay/index.mjs +1 -1
  22. package/overlay/src/overlay-controller.d.ts +13 -0
  23. package/package.json +1 -1
  24. package/query-builder/index.mjs +2 -2
  25. package/radio/index.mjs +1 -1
  26. package/radio-group/index.mjs +2 -2
  27. package/ribbon/index.mjs +1 -1
  28. package/scheduler/index.mjs +1996 -813
  29. package/scheduler/src/components/mp-scheduler.d.ts +269 -11
  30. package/scheduler/src/state/scheduler-state.d.ts +10 -0
  31. package/scheduler/src/views/timeline-view.d.ts +51 -3
  32. package/scheduler/src/views/year-view.d.ts +4 -2
  33. package/scheduler-core/index.mjs +9 -8
  34. package/scheduler-core/src/models/event.d.ts +6 -2
  35. package/scheduler-core/src/models/messages.d.ts +60 -0
  36. package/scheduler-core/src/models/options.d.ts +22 -6
  37. package/scheduler-core/src/models/permissions.d.ts +35 -4
  38. package/scheduler-core/src/models/time-slot.d.ts +11 -6
  39. package/select/index.mjs +1 -1
  40. package/timepicker/index.mjs +4 -3
  41. package/timepicker/src/mp-time-list.element.d.ts +44 -7
  42. package/timepicker/src/mp-timepicker.element.d.ts +5 -0
  43. package/toggle-button/index.mjs +1 -1
  44. package/tree-select/index.mjs +1 -1
@@ -1,13 +1,13 @@
1
- import { html as n, unsafeCSS as h, LitElement as p, nothing as c } from "lit";
1
+ import { html as l, unsafeCSS as p, LitElement as m, nothing as c } from "lit";
2
2
  import { query as u } from "lit/decorators.js";
3
- import { O as b } from "./overlay-controller-DPt13i8p.mjs";
3
+ import { O as f } from "./overlay-controller-D6agzzOI.mjs";
4
4
  import "lit/directives/ref.js";
5
- import { H as f } from "./host-aria-WSGs7SPQ.mjs";
6
- import { R as g } from "./roving-focus-CrL9982a.mjs";
7
- n`<!-- Time-slot listbox rendered dynamically by render(). This file exists only
5
+ import { H as g } from "./host-aria-WSGs7SPQ.mjs";
6
+ import { R as y } from "./roving-focus-CrL9982a.mjs";
7
+ l`<!-- Time-slot listbox rendered dynamically by render(). This file exists only
8
8
  so the codegen-wc target emits a \`styles\` export from the sibling .scss;
9
9
  the \`template\` export is intentionally unused. -->`;
10
- const y = h(`:host {
10
+ const v = p(`:host {
11
11
  display: block;
12
12
  box-sizing: border-box;
13
13
  max-height: 250px;
@@ -57,12 +57,16 @@ ul {
57
57
  min-height: 44px;
58
58
  }
59
59
  }`);
60
- let v = 0;
61
- class w extends p {
60
+ let w = 0;
61
+ function h(r) {
62
+ return r ? r.getHours() * 60 + r.getMinutes() : null;
63
+ }
64
+ class x extends m {
62
65
  constructor() {
63
- super(...arguments), this.selectedTime = null, this.step = 15, this.min = null, this.max = null, this.hour12 = "auto", this.locale = void 0, this._focusedMinutes = null, this.instanceId = `mp-tl-${++v}`, this.roving = new g({
66
+ super(...arguments), this.selectedTime = null, this.step = 15, this.minMinutes = null, this.maxMinutes = null, this.hour12 = "auto", this.locale = void 0, this._focusedMinutes = null, this.instanceId = `mp-tl-${++w}`, this.roving = new y({
64
67
  items: () => Array.from(this.renderRoot?.querySelectorAll("button.slot") ?? []),
65
68
  orientation: "vertical",
69
+ isDisabled: () => !1,
66
70
  onActiveChange: (e) => {
67
71
  const t = Number(e.dataset.minutes);
68
72
  Number.isNaN(t) || (this._focusedMinutes = t, this.requestUpdate());
@@ -71,22 +75,22 @@ class w extends p {
71
75
  const t = e.key;
72
76
  if (t === "PageUp" || t === "PageDown") {
73
77
  e.preventDefault();
74
- const s = this.slots(), i = this.focusableMinutes(), r = t === "PageUp" ? Math.max(s[0].minutes, i - 60) : Math.min(s[s.length - 1].minutes, i + 60), o = s.findIndex((m) => m.minutes === r);
75
- o >= 0 && this.roving.moveTo(o);
78
+ const i = this.slots(), s = this.focusableMinutes(), o = t === "PageUp" ? Math.max(i[0].minutes, s - 60) : Math.min(i[i.length - 1].minutes, s + 60), n = i.findIndex((b) => b.minutes === o);
79
+ n >= 0 && this.roving.moveTo(n);
76
80
  return;
77
81
  }
78
82
  this.roving.onKeydown(e) && e.preventDefault();
79
83
  };
80
84
  }
81
85
  static {
82
- this.styles = [y];
86
+ this.styles = [v];
83
87
  }
84
88
  static {
85
89
  this.properties = {
86
90
  selectedTime: { attribute: !1 },
87
91
  step: { attribute: "step", type: Number, reflect: !0 },
88
- min: { attribute: !1 },
89
- max: { attribute: !1 },
92
+ minMinutes: { attribute: "min-minutes", type: Number },
93
+ maxMinutes: { attribute: "max-minutes", type: Number },
90
94
  hour12: { attribute: "hour12" },
91
95
  locale: { attribute: "locale", type: String, reflect: !0 },
92
96
  _focusedMinutes: { state: !0 }
@@ -100,7 +104,7 @@ class w extends p {
100
104
  }
101
105
  updated() {
102
106
  const e = this.renderRoot?.querySelector(
103
- `button.slot[data-minutes="${this.focusableMinutes()}"]:not([disabled])`
107
+ `button.slot[data-minutes="${this.focusableMinutes()}"]`
104
108
  );
105
109
  e ? this.roving.setActiveItem(e) : this.roving.sync();
106
110
  }
@@ -113,12 +117,12 @@ class w extends p {
113
117
  slots() {
114
118
  const e = /* @__PURE__ */ new Date();
115
119
  e.setHours(0, 0, 0, 0);
116
- const t = Math.floor(1440 / this.step), s = [];
117
- for (let i = 0; i < t; i++) {
118
- const r = i * this.step, o = new Date(e.getTime() + r * 6e4);
119
- s.push({ minutes: r, date: o, label: this.formatTime(o) });
120
+ const t = Math.floor(1440 / this.step), i = [];
121
+ for (let s = 0; s < t; s++) {
122
+ const o = s * this.step, n = new Date(e.getTime() + o * 6e4);
123
+ i.push({ minutes: o, date: n, label: this.formatTime(n) });
120
124
  }
121
- return s;
125
+ return i;
122
126
  }
123
127
  formatTime(e) {
124
128
  const t = this.resolvedHour12();
@@ -138,7 +142,7 @@ class w extends p {
138
142
  return e.getHours() * 60 + e.getMinutes();
139
143
  }
140
144
  isDisabledMinutes(e) {
141
- return !!(this.min && e < this.timeMinutes(this.min) || this.max && e > this.timeMinutes(this.max));
145
+ return this.minMinutes !== null && e < this.minMinutes || this.maxMinutes !== null && e > this.maxMinutes;
142
146
  }
143
147
  isSelected(e) {
144
148
  return this.selectedTime ? this.timeMinutes(this.selectedTime) === e : !1;
@@ -160,10 +164,10 @@ class w extends p {
160
164
  if (this.isDisabledMinutes(e)) return;
161
165
  const t = /* @__PURE__ */ new Date();
162
166
  t.setHours(0, 0, 0, 0);
163
- const s = new Date(t.getTime() + e * 6e4);
164
- this.selectedTime = s, this._focusedMinutes = e, this.requestUpdate(), this.dispatchEvent(
167
+ const i = new Date(t.getTime() + e * 6e4);
168
+ this.selectedTime = i, this._focusedMinutes = e, this.requestUpdate(), this.dispatchEvent(
165
169
  new CustomEvent("selected-time-change", {
166
- detail: new Date(s.getTime()),
170
+ detail: new Date(i.getTime()),
167
171
  bubbles: !0,
168
172
  composed: !0
169
173
  })
@@ -172,34 +176,33 @@ class w extends p {
172
176
  /* ---- Render ---- */
173
177
  render() {
174
178
  const e = this.slots(), t = this.focusableMinutes();
175
- return n`
179
+ return l`
176
180
  <ul role="presentation">
177
- ${e.map((s) => this.renderSlot(s, t))}
181
+ ${e.map((i) => this.renderSlot(i, t))}
178
182
  </ul>
179
183
  `;
180
184
  }
181
185
  renderSlot(e, t) {
182
- const s = this.isSelected(e.minutes), i = this.isDisabledMinutes(e.minutes);
183
- return n`<li role="presentation">
186
+ const i = this.isSelected(e.minutes), s = this.isDisabledMinutes(e.minutes);
187
+ return l`<li role="presentation">
184
188
  <button
185
189
  type="button"
186
190
  class="slot"
187
191
  role="option"
188
192
  id="${this.slotId(e.minutes)}"
189
193
  data-minutes="${e.minutes}"
190
- aria-selected="${s ? "true" : "false"}"
191
- aria-disabled="${i ? "true" : c}"
192
- ?disabled="${i}"
194
+ aria-selected="${i ? "true" : "false"}"
195
+ aria-disabled="${s ? "true" : c}"
193
196
  data-focused="${e.minutes === t ? "true" : c}"
194
197
  @click="${() => this.selectMinutes(e.minutes)}"
195
198
  >${e.label}</button>
196
199
  </li>`;
197
200
  }
198
201
  }
199
- typeof customElements < "u" && !customElements.get("mp-time-list") && customElements.define("mp-time-list", w);
200
- n`<!-- Rendered dynamically by render(). This file exists only so the codegen-wc
202
+ typeof customElements < "u" && !customElements.get("mp-time-list") && customElements.define("mp-time-list", x);
203
+ l`<!-- Rendered dynamically by render(). This file exists only so the codegen-wc
201
204
  target emits a \`styles\` export from the sibling .scss. -->`;
202
- const x = h(`:host {
205
+ const M = p(`:host {
203
206
  display: inline-block;
204
207
  position: relative;
205
208
  box-sizing: border-box;
@@ -289,18 +292,18 @@ button.trigger svg {
289
292
  transition: none !important;
290
293
  }
291
294
  }`);
292
- var T = Object.defineProperty, d = (a, e, t, s) => {
293
- for (var i = void 0, r = a.length - 1, o; r >= 0; r--)
294
- (o = a[r]) && (i = o(e, t, i) || i);
295
- return i && T(e, t, i), i;
295
+ var T = Object.defineProperty, d = (r, e, t, i) => {
296
+ for (var s = void 0, o = r.length - 1, n; o >= 0; o--)
297
+ (n = r[o]) && (s = n(e, t, s) || s);
298
+ return s && T(e, t, s), s;
296
299
  };
297
300
  const $ = '<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>';
298
301
  let E = 0;
299
- class l extends p {
302
+ class a extends m {
300
303
  constructor() {
301
- super(...arguments), this.selectedTime = null, this.step = 15, this.min = null, this.max = null, this.hour12 = "auto", this.locale = void 0, this.disabled = !1, this.placeholder = "", this.triggerLabel = "Choose time", this.inputLabel = "Selected time", this.ariaLabelForRender = null, this.ariaLabelledByForSync = null, this.ariaDescribedByForSync = null, this.instanceId = `mp-tp-${++E}`, this.popupId = `${this.instanceId}-popup`, this.hostAria = new f(this, {
304
+ super(...arguments), this.selectedTime = null, this.step = 15, this.min = null, this.max = null, this.hour12 = "auto", this.locale = void 0, this.disabled = !1, this.placeholder = "", this.triggerLabel = "Choose time", this.inputLabel = "Selected time", this.ariaLabelForRender = null, this.ariaLabelledByForSync = null, this.ariaDescribedByForSync = null, this.instanceId = `mp-tp-${++E}`, this.popupId = `${this.instanceId}-popup`, this.hostAria = new g(this, {
302
305
  referenceTarget: () => this.displayInputEl ?? null
303
- }), this.overlay = new b(this, {
306
+ }), this.overlay = new f(this, {
304
307
  anchor: () => this.inputGroupEl ?? this.triggerEl ?? null,
305
308
  trigger: () => this.triggerEl ?? null,
306
309
  panel: () => this.popupEl ?? null,
@@ -326,7 +329,7 @@ class l extends p {
326
329
  };
327
330
  }
328
331
  static {
329
- this.styles = [x];
332
+ this.styles = [M];
330
333
  }
331
334
  static {
332
335
  this.properties = {
@@ -373,7 +376,7 @@ class l extends p {
373
376
  }
374
377
  render() {
375
378
  const e = this.formatDisplay();
376
- return n`
379
+ return l`
377
380
  <div class="input-group">
378
381
  <input
379
382
  class="form-control"
@@ -405,8 +408,8 @@ class l extends p {
405
408
  <mp-time-list
406
409
  .selectedTime="${this.selectedTime}"
407
410
  .step="${this.step}"
408
- .min="${this.min}"
409
- .max="${this.max}"
411
+ .minMinutes="${h(this.min)}"
412
+ .maxMinutes="${h(this.max)}"
410
413
  .hour12="${this.hour12}"
411
414
  .locale="${this.locale}"
412
415
  @selected-time-change="${this.onSelectedTimeChange}"
@@ -418,18 +421,19 @@ class l extends p {
418
421
  }
419
422
  d([
420
423
  u("input.form-control")
421
- ], l.prototype, "displayInputEl");
424
+ ], a.prototype, "displayInputEl");
422
425
  d([
423
426
  u("button.trigger")
424
- ], l.prototype, "triggerEl");
427
+ ], a.prototype, "triggerEl");
425
428
  d([
426
429
  u(".input-group")
427
- ], l.prototype, "inputGroupEl");
430
+ ], a.prototype, "inputGroupEl");
428
431
  d([
429
432
  u(".popup")
430
- ], l.prototype, "popupEl");
431
- typeof customElements < "u" && !customElements.get("mp-timepicker") && customElements.define("mp-timepicker", l);
433
+ ], a.prototype, "popupEl");
434
+ typeof customElements < "u" && !customElements.get("mp-timepicker") && customElements.define("mp-timepicker", a);
432
435
  export {
433
- w as M,
434
- l as a
436
+ x as M,
437
+ a,
438
+ h as m
435
439
  };
@@ -1,7 +1,8 @@
1
1
  import { unsafeCSS as a, LitElement as o, nothing as e, html as c } from "lit";
2
2
  import { createRef as d, ref as i } from "lit/directives/ref.js";
3
3
  import { H as l } from "./host-aria-WSGs7SPQ.mjs";
4
- import { F as h, a as f, e as v } from "./form-associated-axmc5sY0.mjs";
4
+ import { a as h, e as f } from "./error-text-B45eDAt1.mjs";
5
+ import { F as v } from "./form-associated-BR-fUvZ1.mjs";
5
6
  import { i as g } from "./invalid-feedback.styles-he0JYrJm.mjs";
6
7
  const u = a(`.btn {
7
8
  --bs-btn-padding-x: 0.75rem;
@@ -425,11 +426,11 @@ const u = a(`.btn {
425
426
  "outline-dark"
426
427
  ]);
427
428
  let n = 0;
428
- class p extends h(o) {
429
+ class p extends v(o) {
429
430
  constructor() {
430
431
  super(...arguments), this._checked = !1, this._disabled = !1, this._name = null, this._value = null, this._color = "primary", this._inputLabel = null, this._errorText = null, this.hostAria = new l(this, {
431
432
  referenceTarget: () => this._inputRef.value ?? null,
432
- describedByExtras: () => f(this.renderRoot)
433
+ describedByExtras: () => h(this.renderRoot)
433
434
  }), this._inputId = `mp-toggle-button-${++n}`, this._errorId = `mp-toggle-button-${n}-error`, this._inputRef = d(), this.onInputChange = (b) => {
434
435
  const t = b.target.checked;
435
436
  this._checked = t, this.reflectBoolean("checked", t), this.dispatchEvent(
@@ -580,7 +581,7 @@ class p extends h(o) {
580
581
  this.syncFormValue(), this.hostAria.syncReferences();
581
582
  }
582
583
  render() {
583
- const b = v(this._errorId, this._errorText, this.hasAttribute("invalid"));
584
+ const b = f(this._errorId, this._errorText, this.hasAttribute("invalid"));
584
585
  return c`
585
586
  <input
586
587
  ${i(this._inputRef)}
@@ -1,7 +1,7 @@
1
1
  import "lit";
2
2
  import "lit/directives/ref.js";
3
- import { d as v } from "./focus-restore-DxuP1Oe2.mjs";
4
- import { F as k, d, c as g } from "./focus-trap-DTOLJ5bb.mjs";
3
+ import { d as k } from "./focus-restore-DxuP1Oe2.mjs";
4
+ import { F as v, d, c as g } from "./focus-trap-DTOLJ5bb.mjs";
5
5
  const b = [
6
6
  { originX: "start", originY: "bottom", overlayX: "start", overlayY: "top" },
7
7
  { originX: "start", originY: "top", overlayX: "start", overlayY: "bottom" }
@@ -22,7 +22,7 @@ class c {
22
22
  o.key === "Escape" && this._open && this.isTopOfStack() && (this.close(), o.preventDefault());
23
23
  }, this.onMouseDown = (o) => {
24
24
  this._open && (o.composedPath().includes(this.host) || this.close(!1));
25
- }, this.host = t, this.options = e, this.focusTrap = new k(() => this.options.panel(), {
25
+ }, this.host = t, this.options = e, this.focusTrap = new v(() => this.options.panel(), {
26
26
  initialFocus: "none",
27
27
  // open() handles initial focus; the trap only contains Tab
28
28
  returnFocus: !1,
@@ -60,10 +60,25 @@ class c {
60
60
  get isOpen() {
61
61
  return this._open;
62
62
  }
63
+ /**
64
+ * Whether this overlay is the top-most dismissible layer — i.e. whether an
65
+ * Escape belongs to IT rather than to something opened on top of it.
66
+ *
67
+ * The controller already applies this to its own document-level Escape
68
+ * handler. It is public because a host that ALSO handles Escape itself must
69
+ * ask the same question: such a handler sits on the element, so it runs
70
+ * before any document-level one, and would otherwise dismiss itself out from
71
+ * under a nested overlay it contains (an editor closing when the user meant
72
+ * to close the date picker inside it). Decline when this is false, and do not
73
+ * stop propagation, so the event still reaches the layer that owns it.
74
+ */
75
+ get isTopmost() {
76
+ return this.isTopOfStack();
77
+ }
63
78
  async open() {
64
79
  if (this._open) return;
65
80
  this._open = !0;
66
- const t = v();
81
+ const t = k();
67
82
  this.restoreTo = t instanceof HTMLElement && t !== t.ownerDocument.body ? t : null, this.stackToken = c.pushFrame(), this.host.setAttribute("data-menu-open", ""), this.host.requestUpdate(), await this.host.updateComplete, this.position(), this.attachScrollListeners(), this.moveFocusIn(), this.options.modal && this.focusTrap.activate(), setTimeout(() => this.attachMouseDown(), 0), this.options.onOpen?.();
68
83
  }
69
84
  close(t = !0) {
@@ -1,4 +1,4 @@
1
- import { M as s, c as e, d as o, s as r } from "../chunks/mp-datatable-BwTlh9A_.mjs";
1
+ import { M as s, c as e, d as o, s as r } from "../chunks/mp-datatable-25O1GtvU.mjs";
2
2
  export {
3
3
  s as MpDatatable,
4
4
  e as computeNextSort,
@@ -1,6 +1,6 @@
1
1
  import { html as d, unsafeCSS as u, LitElement as p, nothing as c } from "lit";
2
2
  import { query as a } from "lit/decorators.js";
3
- import { O as h } from "../chunks/overlay-controller-DPt13i8p.mjs";
3
+ import { O as h } from "../chunks/overlay-controller-D6agzzOI.mjs";
4
4
  import "lit/directives/ref.js";
5
5
  import { H as b } from "../chunks/host-aria-WSGs7SPQ.mjs";
6
6
  import "../chunks/mp-calendar.element-u6uS31_j.mjs";