@algorisys/zen-ui-vanilla 13.10.1 → 13.11.1

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 (106) hide show
  1. package/AGENTS.md +2 -2
  2. package/dist/_core/index.d.ts +1 -0
  3. package/dist/_core/messages-all.d.ts +5 -0
  4. package/dist/_core/messages.d.ts +5 -0
  5. package/dist/_core/planning-gesture.d.ts +31 -0
  6. package/dist/_core/planning.d.ts +71 -9
  7. package/dist/components/data-table/data-table.d.ts.map +1 -1
  8. package/dist/components/event-calendar/event-calendar-item.d.ts.map +1 -1
  9. package/dist/components/event-calendar/event-calendar-model.d.ts +6 -0
  10. package/dist/components/event-calendar/event-calendar-model.d.ts.map +1 -1
  11. package/dist/components/planning-calendar/planning-calendar.d.ts +65 -3
  12. package/dist/components/planning-calendar/planning-calendar.d.ts.map +1 -1
  13. package/dist/components/rich-text/rich-text.d.ts +5 -7
  14. package/dist/components/rich-text/rich-text.d.ts.map +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index108.js +12 -4
  18. package/dist/index108.js.map +1 -1
  19. package/dist/index112.js +244 -144
  20. package/dist/index112.js.map +1 -1
  21. package/dist/index113.js +6 -6
  22. package/dist/index114.js +1 -1
  23. package/dist/index115.js +1 -1
  24. package/dist/index116.js +1 -1
  25. package/dist/index118.js +2 -2
  26. package/dist/index120.js +2 -2
  27. package/dist/index168.js +1 -1
  28. package/dist/index175.js +1 -1
  29. package/dist/index187.js +1 -1
  30. package/dist/index191.js +1 -1
  31. package/dist/index194.js +2 -2
  32. package/dist/index199.js +1 -1
  33. package/dist/index211.js +5 -0
  34. package/dist/index211.js.map +1 -1
  35. package/dist/index230.js +107 -75
  36. package/dist/index230.js.map +1 -1
  37. package/dist/index231.js +95 -7
  38. package/dist/index231.js.map +1 -1
  39. package/dist/index232.js +7 -48
  40. package/dist/index232.js.map +1 -1
  41. package/dist/index233.js +45 -37
  42. package/dist/index233.js.map +1 -1
  43. package/dist/index234.js +38 -149
  44. package/dist/index234.js.map +1 -1
  45. package/dist/index235.js +138 -177
  46. package/dist/index235.js.map +1 -1
  47. package/dist/index236.js +190 -90
  48. package/dist/index236.js.map +1 -1
  49. package/dist/index237.js +90 -444
  50. package/dist/index237.js.map +1 -1
  51. package/dist/index238.js +436 -98
  52. package/dist/index238.js.map +1 -1
  53. package/dist/index239.js +106 -2
  54. package/dist/index239.js.map +1 -1
  55. package/dist/index240.js +2 -18804
  56. package/dist/index240.js.map +1 -1
  57. package/dist/index241.js +18798 -117
  58. package/dist/index241.js.map +1 -1
  59. package/dist/index242.js +122 -13
  60. package/dist/index242.js.map +1 -1
  61. package/dist/index243.js +13 -3012
  62. package/dist/index243.js.map +1 -1
  63. package/dist/index244.js +3006 -123
  64. package/dist/index244.js.map +1 -1
  65. package/dist/index245.js +125 -140
  66. package/dist/index245.js.map +1 -1
  67. package/dist/index246.js +138 -93
  68. package/dist/index246.js.map +1 -1
  69. package/dist/index247.js +91 -104
  70. package/dist/index247.js.map +1 -1
  71. package/dist/index248.js +95 -111
  72. package/dist/index248.js.map +1 -1
  73. package/dist/index249.js +127 -4
  74. package/dist/index249.js.map +1 -1
  75. package/dist/index250.js +5 -34
  76. package/dist/index250.js.map +1 -1
  77. package/dist/index251.js +34 -9
  78. package/dist/index251.js.map +1 -1
  79. package/dist/index252.js +10 -7
  80. package/dist/index252.js.map +1 -1
  81. package/dist/index253.js +6 -15
  82. package/dist/index253.js.map +1 -1
  83. package/dist/index254.js +15 -11
  84. package/dist/index254.js.map +1 -1
  85. package/dist/index255.js +11 -3
  86. package/dist/index255.js.map +1 -1
  87. package/dist/index256.js +7 -0
  88. package/dist/index256.js.map +1 -0
  89. package/dist/index99.js.map +1 -1
  90. package/dist/previews/analytic-chart.jpg +0 -0
  91. package/dist/previews/chunk-uploader.jpg +0 -0
  92. package/dist/previews/code-editor.jpg +0 -0
  93. package/dist/previews/countdown.jpg +0 -0
  94. package/dist/previews/loading.jpg +0 -0
  95. package/dist/previews/map.jpg +0 -0
  96. package/dist/previews/tile.jpg +0 -0
  97. package/dist/style.css +1 -1
  98. package/package.json +1 -1
  99. package/skills/zen-ui/SKILL.md +1 -1
  100. package/skills/zen-ui/references/api/event-calendar-event-calendar.md +1 -0
  101. package/skills/zen-ui/references/api/index.md +1 -1
  102. package/skills/zen-ui/references/api/locale.md +5 -0
  103. package/skills/zen-ui/references/api/planning-calendar.md +30 -1
  104. package/skills/zen-ui/references/api/rich-text.md +1 -1
  105. package/skills/zen-ui/references/api/scan-input.md +1 -1
  106. package/skills/zen-ui/references/catalogue.md +2 -2
package/dist/index112.js CHANGED
@@ -1,215 +1,315 @@
1
- import { cn as y } from "./index194.js";
1
+ import { cn as B } from "./index194.js";
2
2
  import "./index210.js";
3
3
  import "./index169.js";
4
- import { planningRange as te, planningColumns as oe, nowPct as re, placeAppointment as ae, layoutLanes as ie, formatTimeRange as se, shiftPlanningAnchor as J, planningRangeLabel as le } from "./index230.js";
4
+ import { planningColumns as Le, planningAxis as Ee, planningRange as He, nowPct as Re, placeAppointment as ge, layoutLanes as Ie, formatTimeRange as ie, shiftPlanningAnchor as he, planningRangeLabel as $e, planningKeyboardMove as Me } from "./index230.js";
5
+ import { startPlanningGesture as Ve } from "./index231.js";
5
6
  import "./index116.js";
6
7
  import "./index119.js";
7
- import { calendarLanePx as de } from "./index231.js";
8
- import { Button as k } from "./index4.js";
9
- import { Icon as S } from "./index6.js";
10
- import { Disposer as ze, toNodes as pe, applyProps as ce } from "./index195.js";
11
- import { useLocale as me } from "./index31.js";
12
- const fe = {
8
+ import { calendarLanePx as We } from "./index232.js";
9
+ import { Button as F } from "./index4.js";
10
+ import { Icon as se } from "./index6.js";
11
+ import { Disposer as Oe, toNodes as le, applyProps as Te } from "./index195.js";
12
+ import { useLocale as Ke } from "./index31.js";
13
+ const Ne = {
13
14
  default: "zen-bg-zen-muted zen-text-zen-foreground zen-border-zen-border",
14
15
  info: "zen-bg-zen-info-soft zen-text-zen-info zen-border-zen-info",
15
16
  success: "zen-bg-zen-success-soft zen-text-zen-success zen-border-zen-success",
16
17
  warning: "zen-bg-zen-warning-soft zen-text-zen-warning zen-border-zen-warning",
17
18
  error: "zen-bg-zen-error-soft zen-text-zen-error zen-border-zen-error"
18
- }, ue = {
19
+ }, Be = {
19
20
  day: "planningCalendar.views.day",
20
21
  week: "planningCalendar.views.week",
21
22
  month: "planningCalendar.views.month"
22
- }, be = ["day", "week", "month"], ge = 3, e = (m, r, p) => {
23
- const s = document.createElement(m);
24
- return r && (s.className = r), p !== void 0 && (s.textContent = p), s;
23
+ }, Fe = ["day", "week", "month"], Ge = 3, t = (_, n, w) => {
24
+ const p = document.createElement(_);
25
+ return n && (p.className = n), w !== void 0 && (p.textContent = w), p;
25
26
  };
26
- function Te(m) {
27
- let r = { ...m };
28
- const p = () => Math.max(14, de(r.density, r.laneHeight)), s = me(), _ = new ze();
29
- let P, W = m.defaultView ?? "week", M = m.defaultDate ?? /* @__PURE__ */ new Date();
30
- const d = e("div");
31
- let f = [];
32
- const z = (t) => (f.push(t), t);
33
- let u = [];
34
- const Q = () => r.view ?? W, U = () => r.date ?? M, Y = (t) => {
35
- r.view === void 0 && (W = t), r.onViewChange?.(t), w();
36
- }, A = (t) => {
37
- r.date === void 0 && (M = t), r.onDateChange?.(t), w();
27
+ let Ue = 0;
28
+ function _n(_) {
29
+ let n = { ..._ };
30
+ const w = () => Math.max(14, We(n.density, n.laneHeight)), p = Ke(), G = new Oe();
31
+ let U, de = _.defaultView ?? "week", pe = _.defaultDate ?? /* @__PURE__ */ new Date();
32
+ const ce = `zen-planning-calendar-${++Ue}`, g = t("div"), h = t("div", "zen-contents"), q = t("span", "zen-sr-only");
33
+ q.id = ce;
34
+ const D = t("div", "zen-sr-only");
35
+ D.setAttribute("aria-live", "polite"), D.setAttribute("aria-atomic", "true"), g.append(h, q, D);
36
+ let P = [];
37
+ const y = (e) => (P.push(e), e);
38
+ let S = [];
39
+ const X = (e, i, s) => {
40
+ e.addEventListener(i, s), S.push(() => e.removeEventListener(i, s));
38
41
  };
39
- function Z(t, b, L) {
40
- const D = e("div", "zen-flex zen-flex-wrap zen-items-center zen-gap-2"), O = z(
41
- k({
42
+ let x = { start: /* @__PURE__ */ new Date(), end: /* @__PURE__ */ new Date() }, j = /* @__PURE__ */ new Map(), L = null, E = null;
43
+ const ye = () => n.view ?? de, xe = () => n.date ?? pe, H = () => n.weekStartsOn ?? 1, ze = () => Math.max(1, n.snapMinutes ?? 15), ve = (e) => {
44
+ n.view === void 0 && (de = e), n.onViewChange?.(e), O();
45
+ }, W = (e) => {
46
+ n.date === void 0 && (pe = e), n.onDateChange?.(e), O();
47
+ }, Ce = (e, i) => !!n.onAppointmentChange && !e.busy && (n.canEditAppointment?.(e, i) ?? !0), Ae = (e) => h.querySelector(`[data-plan-appointment="${CSS.escape(e)}"]`), ke = () => {
48
+ const e = g.ownerDocument.activeElement;
49
+ return e && h.contains(e) ? e.getAttribute("data-plan-appointment") : null;
50
+ };
51
+ let A = null;
52
+ const J = () => {
53
+ L?.remove(), L = null, E?.classList.remove("zen-opacity-40"), E = null;
54
+ }, _e = (e, i) => {
55
+ if (L?.remove(), L = null, !i) {
56
+ J();
57
+ return;
58
+ }
59
+ E !== e && (E?.classList.remove("zen-opacity-40"), E = e, e.classList.add("zen-opacity-40"));
60
+ const s = j.get(i.rowId), z = ge(i, x);
61
+ if (!s || !z) return;
62
+ const l = t(
63
+ "div",
64
+ "zen-pointer-events-none zen-absolute zen-z-10 zen-flex zen-items-center zen-overflow-hidden zen-rounded-zen-sm zen-border-2 zen-border-dashed zen-border-zen-primary zen-bg-zen-primary-soft zen-px-1.5 zen-text-xs zen-font-medium zen-text-zen-foreground"
65
+ );
66
+ l.setAttribute("aria-hidden", "true"), l.setAttribute("data-plan-ghost", ""), l.style.setProperty("inset-inline-start", `${z.startPct}%`), l.style.width = `${z.widthPct}%`, l.style.top = "4px", l.style.height = `${w() - 6}px`, l.append(t("span", "zen-truncate", ie(i.start, i.end))), s.append(l), L = l;
67
+ }, ue = (e, i, s, z) => {
68
+ const l = (n.rows ?? []).find((T) => T.id === s.rowId) ?? i;
69
+ z === "keyboard" && (A = { id: e.id, until: Date.now() + 2e3 }), n.onAppointmentChange?.({ appointment: e, row: i, toRow: l, start: s.start, end: s.end, source: z });
70
+ const R = ie(s.start, s.end);
71
+ D.textContent = "", D.textContent = l.id === i.id ? p.t("planningCalendar.proposed", { title: e.title, time: R }) : p.t("planningCalendar.proposedRow", { title: e.title, row: l.title, time: R }), z === "keyboard" && (s.start < x.start || s.start >= x.end) && W(s.start);
72
+ };
73
+ function De(e, i, s) {
74
+ const z = t("div", "zen-flex zen-flex-wrap zen-items-center zen-gap-2"), l = y(
75
+ F({
42
76
  variant: "outline",
43
77
  size: "sm",
44
- "aria-label": s.t("planningCalendar.previous"),
78
+ "aria-label": p.t("planningCalendar.previous"),
45
79
  // Logical, not physical: under RTL the axis runs the other way, so a
46
80
  // left-pointing chevron would send you forward.
47
- children: z(S({ name: "chevron-left", size: 14, class: "rtl:zen-rotate-180" })),
48
- onClick: () => A(J(t, b, -1))
81
+ children: y(se({ name: "chevron-left", size: 14, class: "rtl:zen-rotate-180" })),
82
+ onClick: () => W(he(e, i, -1, H()))
49
83
  })
50
- ), R = z(
51
- k({ variant: "outline", size: "sm", children: s.t("planningCalendar.today"), onClick: () => A(L) })
52
- ), B = z(
53
- k({
84
+ ), R = y(
85
+ F({ variant: "outline", size: "sm", children: p.t("planningCalendar.today"), onClick: () => W(s) })
86
+ ), T = y(
87
+ F({
54
88
  variant: "outline",
55
89
  size: "sm",
56
- "aria-label": s.t("planningCalendar.next"),
57
- children: z(S({ name: "chevron-right", size: 14, class: "rtl:zen-rotate-180" })),
58
- onClick: () => A(J(t, b, 1))
90
+ "aria-label": p.t("planningCalendar.next"),
91
+ children: y(se({ name: "chevron-right", size: 14, class: "rtl:zen-rotate-180" })),
92
+ onClick: () => W(he(e, i, 1, H()))
59
93
  })
60
- ), H = e(
94
+ ), fe = t(
61
95
  "span",
62
96
  "zen-mx-1 zen-text-sm zen-font-medium zen-text-zen-foreground",
63
- le(t, b)
64
- ), g = e("div", "zen-ms-auto zen-flex zen-gap-1");
65
- g.setAttribute("role", "group"), g.setAttribute("aria-label", s.t("planningCalendar.view"));
66
- for (const v of r.views ?? be)
67
- g.append(
68
- z(
69
- k({
70
- variant: t === v ? "solid" : "outline",
97
+ $e(e, i, H())
98
+ ), I = t("div", "zen-ms-auto zen-flex zen-gap-1");
99
+ I.setAttribute("role", "group"), I.setAttribute("aria-label", p.t("planningCalendar.view"));
100
+ for (const b of n.views ?? Fe)
101
+ I.append(
102
+ y(
103
+ F({
104
+ variant: e === b ? "solid" : "outline",
71
105
  size: "sm",
72
- "aria-pressed": String(t === v),
73
- children: s.t(ue[v]),
74
- onClick: () => Y(v)
106
+ "aria-pressed": String(e === b),
107
+ children: p.t(Be[b]),
108
+ onClick: () => ve(b)
75
109
  })
76
110
  ).el
77
111
  );
78
- return D.append(O.el, R.el, B.el, H, g), D;
112
+ if (z.append(l.el, R.el, T.el, fe, I), n.toolbarActions != null) {
113
+ const b = t("div", "zen-flex zen-flex-wrap zen-items-center zen-gap-2");
114
+ b.append(...le(n.toolbarActions)), z.append(b);
115
+ }
116
+ return z;
79
117
  }
80
- function w() {
81
- for (const i of f) i.destroy();
82
- f = [];
83
- for (const i of u) i();
84
- u = [], d.replaceChildren();
118
+ function O() {
119
+ const e = ke();
120
+ J();
121
+ for (const d of P) d.destroy();
122
+ P = [];
123
+ for (const d of S) d();
124
+ S = [], h.replaceChildren(), j = /* @__PURE__ */ new Map();
85
125
  const {
86
- rows: t,
87
- emptyMessage: b,
88
- class: L,
89
- children: D,
90
- defaultView: O,
91
- defaultDate: R,
92
- view: B,
93
- date: H,
94
- views: g,
95
- now: v,
96
- hideToolbar: ve,
97
- onViewChange: xe,
98
- onDateChange: he,
99
- onAppointmentClick: we,
100
- ...ee
101
- } = r;
102
- d.className = y("zen-flex zen-w-full zen-flex-col zen-gap-3", L);
103
- const E = Q(), V = U(), $ = r.now ?? /* @__PURE__ */ new Date(), K = te(E, V), X = oe(E, V, { now: $ }), j = re(K, $), T = (t ?? []).map((i) => {
104
- const c = i.appointments.map((o) => ({ appointment: o, placement: ae(o, K) })).filter(
105
- (o) => o.placement !== null
106
- ), { lanes: x, laneCount: C } = ie(c.map((o) => o.appointment));
126
+ rows: i,
127
+ emptyMessage: s,
128
+ class: z,
129
+ children: l,
130
+ defaultView: R,
131
+ defaultDate: T,
132
+ view: fe,
133
+ date: I,
134
+ views: b,
135
+ now: qe,
136
+ hideToolbar: Xe,
137
+ onViewChange: je,
138
+ onDateChange: Je,
139
+ onAppointmentClick: Qe,
140
+ toolbarActions: Ye,
141
+ onAppointmentChange: Ze,
142
+ canEditAppointment: en,
143
+ allowRowChange: nn,
144
+ snapMinutes: tn,
145
+ renderAppointment: on,
146
+ appointmentClass: rn,
147
+ weekStartsOn: an,
148
+ dayStartHour: sn,
149
+ dayEndHour: ln,
150
+ hourStep: dn,
151
+ workingHours: pn,
152
+ nonWorkingDays: cn,
153
+ laneHeight: zn,
154
+ density: un,
155
+ ...Pe
156
+ } = n;
157
+ g.className = B("zen-flex zen-w-full zen-flex-col zen-gap-3", z), q.textContent = p.t(n.allowRowChange ? "planningCalendar.editHintRows" : "planningCalendar.editHint");
158
+ const $ = ye(), Q = xe(), Y = n.now ?? /* @__PURE__ */ new Date(), Z = Le($, Q, {
159
+ now: Y,
160
+ weekStartsOn: H(),
161
+ dayStartHour: n.dayStartHour,
162
+ dayEndHour: n.dayEndHour,
163
+ hourStep: n.hourStep,
164
+ workingHours: n.workingHours,
165
+ nonWorkingDays: n.nonWorkingDays
166
+ });
167
+ x = Ee(Z, He($, Q, H()));
168
+ const me = Re(x, Y), ee = (i ?? []).map((d) => {
169
+ const k = d.appointments.map((r) => ({ appointment: r, placement: ge(r, x) })).filter(
170
+ (r) => r.placement !== null
171
+ ), { lanes: M, laneCount: K } = Ie(k.map((r) => r.appointment));
107
172
  return {
108
- row: i,
109
- blocks: c.map((o, l) => ({ ...o, lane: x[l] })),
110
- laneCount: Math.max(C, 1)
173
+ row: d,
174
+ blocks: k.map((r, f) => ({ ...r, lane: M[f] })),
175
+ laneCount: Math.max(K, 1)
111
176
  };
112
177
  });
113
- if (!r.hideToolbar && T.length > 0 && d.append(Z(E, V, $)), T.length === 0) {
114
- const i = e("p", "zen-m-0 zen-py-6 zen-text-center zen-text-sm zen-text-zen-muted-fg");
115
- i.append(...pe(b ?? s.t("planningCalendar.noResources"))), d.append(i);
178
+ if (!n.hideToolbar && (ee.length > 0 || n.toolbarActions != null) && h.append(De($, Q, Y)), ee.length === 0) {
179
+ const d = t("p", "zen-m-0 zen-py-6 zen-text-center zen-text-sm zen-text-zen-muted-fg");
180
+ d.append(...le(s ?? p.t("planningCalendar.noResources"))), h.append(d);
116
181
  } else {
117
- const i = e(
182
+ const d = t(
118
183
  "div",
119
184
  "zen-overflow-x-auto zen-rounded-zen-md zen-border zen-border-zen-border"
120
- ), c = e("div", "zen-min-w-[45rem]"), x = e("div", "zen-flex zen-border-b zen-border-zen-border zen-bg-zen-muted");
121
- x.append(
122
- e(
185
+ ), k = t("div", "zen-min-w-[45rem]"), M = t("div", "zen-flex zen-border-b zen-border-zen-border zen-bg-zen-muted");
186
+ M.append(
187
+ t(
123
188
  "div",
124
189
  "zen-w-40 zen-shrink-0 zen-border-e zen-border-zen-border zen-px-3 zen-py-2 zen-text-xs zen-font-semibold zen-text-zen-muted-fg",
125
- s.t("planningCalendar.resource")
190
+ p.t("planningCalendar.resource")
126
191
  )
127
192
  );
128
- const C = e("div", "zen-flex zen-flex-1");
129
- for (const o of X) {
130
- const l = e(
193
+ const K = t("div", "zen-flex zen-flex-1");
194
+ for (const r of Z) {
195
+ const f = t(
131
196
  "div",
132
- y(
197
+ B(
133
198
  "zen-flex-1 zen-border-e zen-border-zen-border zen-px-1 zen-py-2 zen-text-center last:zen-border-e-0",
134
- o.nonWorking && "zen-bg-zen-muted",
135
- o.today && "zen-bg-zen-primary-soft"
199
+ r.nonWorking && "zen-bg-zen-muted",
200
+ r.today && "zen-bg-zen-primary-soft"
136
201
  )
137
202
  );
138
- l.append(e("div", "zen-text-xs zen-font-medium zen-text-zen-foreground", o.label)), o.sublabel && l.append(e("div", "zen-[font-size:var(--zen-schedule-label-font-size)] zen-text-zen-muted-fg", o.sublabel)), C.append(l);
203
+ f.append(t("div", "zen-text-xs zen-font-medium zen-text-zen-foreground", r.label)), r.sublabel && f.append(t("div", "zen-[font-size:var(--zen-schedule-label-font-size)] zen-text-zen-muted-fg", r.sublabel)), K.append(f);
139
204
  }
140
- x.append(C), c.append(x);
141
- for (const o of T) {
142
- const l = e("div", "zen-flex zen-border-b zen-border-zen-border last:zen-border-b-0"), I = e(
205
+ M.append(K), k.append(M);
206
+ for (const r of ee) {
207
+ const f = t("div", "zen-flex zen-border-b zen-border-zen-border last:zen-border-b-0"), te = t(
143
208
  "div",
144
209
  "zen-w-40 zen-shrink-0 zen-border-e zen-border-zen-border zen-px-3 zen-py-2"
145
210
  );
146
- I.append(
147
- e("div", "zen-truncate zen-text-sm zen-font-medium zen-text-zen-foreground", o.row.title)
148
- ), o.row.subtitle && I.append(e("div", "zen-truncate zen-text-xs zen-text-zen-muted-fg", o.row.subtitle)), l.append(I);
149
- const h = e("div", "zen-relative zen-flex-1");
150
- h.style.minHeight = `${o.laneCount * p() + 8}px`;
151
- const N = e("div", "zen-absolute zen-inset-0 zen-flex");
152
- N.setAttribute("aria-hidden", "true");
153
- for (const n of X)
154
- N.append(
155
- e(
211
+ te.append(
212
+ t("div", "zen-truncate zen-text-sm zen-font-medium zen-text-zen-foreground", r.row.title)
213
+ ), r.row.subtitle && te.append(t("div", "zen-truncate zen-text-xs zen-text-zen-muted-fg", r.row.subtitle)), f.append(te);
214
+ const v = t("div", "zen-relative zen-flex-1");
215
+ v.setAttribute("data-plan-lane", r.row.id), v.style.minHeight = `${r.laneCount * w() + 8}px`, j.set(r.row.id, v);
216
+ const oe = t("div", "zen-absolute zen-inset-0 zen-flex");
217
+ oe.setAttribute("aria-hidden", "true");
218
+ for (const c of Z)
219
+ oe.append(
220
+ t(
156
221
  "div",
157
- y(
222
+ B(
158
223
  "zen-flex-1 zen-border-e zen-border-zen-border last:zen-border-e-0",
159
- n.nonWorking && "zen-bg-zen-muted",
160
- n.today && "zen-bg-zen-primary-soft"
224
+ c.nonWorking && "zen-bg-zen-muted",
225
+ c.today && "zen-bg-zen-primary-soft"
161
226
  )
162
227
  )
163
228
  );
164
- if (h.append(N), j !== null) {
165
- const n = e("div", "zen-absolute zen-top-0 zen-bottom-0 zen-w-px zen-bg-zen-error");
166
- n.setAttribute("aria-hidden", "true"), n.style.setProperty("inset-inline-start", `${j}%`), h.append(n);
229
+ if (v.append(oe), me !== null) {
230
+ const c = t("div", "zen-absolute zen-top-0 zen-bottom-0 zen-w-px zen-bg-zen-error");
231
+ c.setAttribute("aria-hidden", "true"), c.style.setProperty("inset-inline-start", `${me}%`), v.append(c);
167
232
  }
168
- for (const n of o.blocks) {
169
- const a = document.createElement("button");
170
- a.type = "button", a.className = y(
233
+ for (const c of r.blocks) {
234
+ const { appointment: a } = c, m = r.row, re = Ce(a, m), be = c.placement.widthPct < Ge, o = document.createElement("button");
235
+ o.type = "button", o.setAttribute("data-plan-appointment", a.id), o.className = B(
171
236
  "zen-absolute zen-flex zen-items-center zen-gap-1 zen-overflow-hidden zen-rounded-zen-sm zen-border zen-px-1.5 zen-text-start zen-text-xs",
172
237
  "focus-visible:zen-outline-none focus-visible:zen-ring-2 focus-visible:zen-ring-zen-ring",
173
- fe[n.appointment.state ?? "default"],
238
+ Ne[a.state ?? "default"],
174
239
  // Square off the cut edge so a block continuing past the view does
175
240
  // not look like it ends there.
176
- n.placement.clippedStart && "zen-rounded-s-none zen-border-s-0",
177
- n.placement.clippedEnd && "zen-rounded-e-none zen-border-e-0",
178
- r.onAppointmentClick && "hover:zen-brightness-95"
179
- ), a.style.setProperty("inset-inline-start", `${n.placement.startPct}%`), a.style.width = `${n.placement.widthPct}%`, a.style.top = `${n.lane * p() + 4}px`, a.style.height = `${p() - 6}px`;
180
- const q = se(n.appointment.start, n.appointment.end);
181
- a.title = `${n.appointment.title} · ${q}`, a.append(e("span", "zen-sr-only", q)), n.placement.widthPct >= ge && (n.appointment.icon && a.append(z(S({ name: n.appointment.icon, size: 12, class: "zen-shrink-0" })).el), a.append(e("span", "zen-truncate zen-font-medium", n.appointment.title)), n.appointment.subtitle && a.append(e("span", "zen-truncate zen-opacity-70", n.appointment.subtitle)));
182
- const F = r.onAppointmentClick;
183
- if (F) {
184
- const G = () => F(n.appointment, o.row);
185
- a.addEventListener("click", G);
186
- const ne = a;
187
- u.push(() => ne.removeEventListener("click", G));
188
- }
189
- h.append(a);
241
+ c.placement.clippedStart && "zen-rounded-s-none zen-border-s-0",
242
+ c.placement.clippedEnd && "zen-rounded-e-none zen-border-e-0",
243
+ n.onAppointmentClick && "hover:zen-brightness-95",
244
+ re && "zen-cursor-grab",
245
+ a.busy && "zen-cursor-wait zen-opacity-60",
246
+ n.appointmentClass?.(a, m)
247
+ ), o.style.setProperty("inset-inline-start", `${c.placement.startPct}%`), o.style.width = `${c.placement.widthPct}%`, o.style.top = `${c.lane * w() + 4}px`, o.style.height = `${w() - 6}px`, re && (o.style.userSelect = "none", o.style.setProperty("-webkit-touch-callout", "none"), o.setAttribute("aria-describedby", ce), o.setAttribute(
248
+ "aria-keyshortcuts",
249
+ n.allowRowChange ? "Alt+ArrowLeft Alt+ArrowRight Alt+ArrowUp Alt+ArrowDown" : "Alt+ArrowLeft Alt+ArrowRight"
250
+ )), a.busy && o.setAttribute("aria-busy", "true");
251
+ const ae = ie(a.start, a.end);
252
+ o.title = `${a.title} · ${ae}`, o.append(t("span", "zen-sr-only", ae)), a.busy && o.append(t("span", "zen-sr-only", p.t("planningCalendar.busy"))), n.renderAppointment ? o.append(...le(n.renderAppointment(a, { row: m, compact: be, timeLabel: ae }))) : be || (a.icon && o.append(y(se({ name: a.icon, size: 12, class: "zen-shrink-0" })).el), o.append(t("span", "zen-truncate zen-font-medium", a.title)), a.subtitle && o.append(t("span", "zen-truncate zen-opacity-70", a.subtitle)));
253
+ const we = n.onAppointmentClick;
254
+ we && X(o, "click", () => we(a, m)), re && (X(o, "pointerdown", (u) => {
255
+ Ve({
256
+ event: u,
257
+ target: o,
258
+ root: g,
259
+ axis: x,
260
+ view: $,
261
+ snapMinutes: ze(),
262
+ appointment: a,
263
+ rowId: m.id,
264
+ allowRowChange: !!n.allowRowChange,
265
+ scroller: d,
266
+ onPreview: (C) => _e(o, C),
267
+ onCommit: (C) => ue(a, m, C, "pointer")
268
+ });
269
+ }), X(o, "keydown", (u) => {
270
+ if (!u.altKey || u.ctrlKey || u.metaKey) return;
271
+ let C = null;
272
+ if (u.key === "ArrowUp" || u.key === "ArrowDown") {
273
+ if (!n.allowRowChange) return;
274
+ const N = n.rows ?? [], V = N[N.findIndex((Se) => Se.id === m.id) + (u.key === "ArrowDown" ? 1 : -1)];
275
+ if (!V) return;
276
+ C = { start: a.start, end: a.end, rowId: V.id };
277
+ } else {
278
+ const N = getComputedStyle(o).direction === "rtl", V = Me(a, u.key, { view: $, rtl: N, snapMinutes: ze() });
279
+ if (!V) return;
280
+ C = { ...V, rowId: m.id };
281
+ }
282
+ u.preventDefault(), u.stopPropagation(), ue(a, m, C, "keyboard");
283
+ })), v.append(o);
190
284
  }
191
- l.append(h), c.append(l);
285
+ f.append(v), k.append(f);
192
286
  }
193
- i.append(c), d.append(i);
287
+ d.append(k), h.append(d);
288
+ }
289
+ U?.(), U = Te(g, Pe);
290
+ const ne = A && A.until > Date.now() ? A.id : e;
291
+ if (ne) {
292
+ const d = Ae(ne);
293
+ d && (d.focus(), A?.id === ne && (A = null));
194
294
  }
195
- P?.(), P = ce(d, ee);
196
295
  }
197
- return w(), _.add(() => P?.()), _.add(() => {
198
- for (const t of f) t.destroy();
199
- f = [];
200
- for (const t of u) t();
201
- u = [];
296
+ return O(), G.add(() => U?.()), G.add(() => {
297
+ J();
298
+ for (const e of P) e.destroy();
299
+ P = [];
300
+ for (const e of S) e();
301
+ S = [];
202
302
  }), {
203
- el: d,
204
- update(t) {
205
- r = { ...r, ...t }, w();
303
+ el: g,
304
+ update(e) {
305
+ n = { ...n, ...e }, O();
206
306
  },
207
307
  destroy() {
208
- _.dispose(), d.remove();
308
+ G.dispose(), g.remove();
209
309
  }
210
310
  };
211
311
  }
212
312
  export {
213
- Te as PlanningCalendar
313
+ _n as PlanningCalendar
214
314
  };
215
315
  //# sourceMappingURL=index112.js.map