@stackone/malachite 2.67.0 → 2.68.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.
package/COMPONENTS.md CHANGED
@@ -25,7 +25,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
25
25
  - **`Divider`** — Separator; supports a dashed line style. Horizontal by default and spanning its container; `orientation="vertical"` draws a rule between inline controls (e.g. groups in a toolbar) and holds its width in a tight flex row. `length` sizes it along its own axis on a fixed scale, and it never shrinks below 1px. _Key props:_ `orientation="horizontal" | "vertical"`, `length` (`small` | `medium` | `large`), `lineStyle="solid" | "dashed"`, `DividerVariant`, `SpacingSize`, `PaddingSize`.
26
26
  - **`OverflowRow`** — Horizontal row that collapses items that do not fit into an overflow affordance.
27
27
  - **`ActionBar`** — A row of actions that collapses into a single `ActionMenu` once its container drops below `collapseBelow`. Measures the nearest genuinely-wider ancestor rather than itself, since the row shrinks to its own content. `dividerBefore` renders a vertical rule in the row and a divider in the collapsed menu, so both forms group the actions the same way. _Key props:_ `buttons` (`label`, `onClick`, `icon`, `variant`, `size`, `radius`, `tooltip`, `disabled`, `dividerBefore`), `collapseBelow`, `menuLabel`, `className`.
28
- - **`Popover`** — An anchored, non-modal panel for arbitrary content — a workspace switcher, an org flyout. The panel renders in its own shadow root, so malachite components inside it are styled, and joins the top layer like the other overlays. It prefers its `placement` and flips to the opposite side when there is no room, clamping along the other axis. Click-opened panels take focus and hand it back to the trigger on close; `openOn="hover"` also opens on focus and stays open while the pointer or focus is in the panel. A nested Popover counts as inside its parent for outside-press and hover dismissal, and Escape closes the topmost only. A click panel also closes when focus moves somewhere outside it and its trigger, and on close it hands focus back to the trigger only if focus would otherwise fall to the page. _Key props:_ `trigger`, `children`, `open`, `defaultOpen`, `onOpenChange`, `placement` (`bottom-start` | `bottom-end` | `top-start` | `top-center` | `right-start` | `right-end` | `left-start`), `openOn` (`click` | `hover`), `width` (`content` | `trigger`), `padding` (`none` | `small` | `medium`), `anchorRef` (position against another element, e.g. the section a trigger row sits in), `offset` (`small` 8px | `medium` 12px | `large` 14px), `elevation` (`default` | `raised`), `initialFocus` (a ref, or a function read when the panel is shown, for what takes focus in place of the first focusable; it is read again as the panel's content changes, so focus follows content that mounts late or a focused element that is removed, but never leaves an element the user moved to; `initialFocusRef` is its deprecated form, read on open only), `openOnArrowKey` (a click panel also opens, focus inside, on the arrow key its placement points at — ArrowDown for a `bottom-*` placement; a text field trigger keeps its arrow keys), `role` (`dialog` | `menu` | `listbox`; `menu` brings no roving focus of its own), `aria-label` or `aria-labelledby` (one is required), `className`. The panel is capped to the viewport width, and only overlays opened from inside it (menus, dropdowns, modals) count as inside for outside-press dismissal. A side placement stays level with its anchor and scrolls within the room below, sliding up only when under 160px is left. Parts for the panel body: `Popover.Header` (`title`, `action`), `Popover.Action` (`icon`, `aria-label`, `onClick`, `href` (a link that opens in a new tab on Cmd/Ctrl-click or a middle click; a plain click runs `onClick` when one is given), `disabled`, `tooltip`), `Popover.List` (a scrolling list; `scrollToSelected` scrolls the list, never the page, to its selected row, one marked `aria-current`, `aria-selected` or a checked radio, each time the popover is shown, once that row mounts), `Popover.Section` (a bordered section) and `Popover.Empty` (an empty-state line).
28
+ - **`Popover`** — An anchored, non-modal panel for arbitrary content — a workspace switcher, an org flyout. The panel renders in its own shadow root, so malachite components inside it are styled, and joins the top layer like the other overlays. It prefers its `placement` and flips to the opposite side when there is no room, clamping along the other axis. Click-opened panels take focus and hand it back to the trigger on close; `openOn="hover"` also opens on focus and stays open while the pointer or focus is in the panel. A nested Popover counts as inside its parent for outside-press and hover dismissal, and Escape closes the topmost only. A click panel also closes when focus moves somewhere outside it and its trigger, and on close it hands focus back to the trigger only if focus would otherwise fall to the page. _Key props:_ `trigger`, `children`, `open`, `defaultOpen`, `onOpenChange`, `placement` (`bottom-start` | `bottom-end` | `top-start` | `top-center` | `right-start` | `right-end` | `left-start`), `openOn` (`click` | `hover`), `width` (`content` | `trigger`), `padding` (`none` | `small` | `medium`), `anchorRef` (position against another element, e.g. the section a trigger row sits in), `offset` (`small` 8px | `medium` 12px | `large` 14px), `elevation` (`default` | `raised`), `initialFocus` (a ref, or a function read when the panel is shown, for what takes focus in place of the first focusable; it is read again as the panel's content changes, so focus follows content that mounts late or a focused element that is removed, but never leaves an element the user moved to; `initialFocusRef` is its deprecated form, read on open only), `openOnArrowKey` (a click panel also opens, focus inside, on the arrow key its placement points at — ArrowDown for a `bottom-*` placement; a text field trigger keeps its arrow keys), `role` (`dialog` | `menu` | `listbox`; `menu` brings no roving focus of its own), `aria-label` or `aria-labelledby` (one is required), `className`. The panel is capped to the viewport width, and only overlays opened from inside it (menus, dropdowns, modals) count as inside for outside-press dismissal. A side placement stays level with its anchor and scrolls within the room below, sliding up only when under 160px is left. Parts for the panel body: `Popover.Header` (`title`, `action`), `Popover.Action` (`icon`, `aria-label`, `onClick`, `href` (a link that opens in a new tab on Cmd/Ctrl-click or a middle click; a plain click runs `onClick` when one is given), `disabled`, `tooltip`), `Popover.List` (a scrolling list; `scrollToSelected` scrolls the list, never the page, to its selected row, one marked `aria-current`, `aria-selected` or a checked radio, each time the popover is shown, once that row mounts), `Popover.Section` (a bordered section), `Popover.Empty` (an empty-state line), `Popover.Search` (pads a `Search` above the list without a second rule), `Popover.Note` (a footnote section in small secondary text) and `Popover.Status` (`message`, `tone` (`default` | `error`), `action` (`label`, `onClick`, `pending`), `focusable`): one `status` live region for the panel's life, announcing each message it is given and staying mounted, visually hidden, while there is none, so clear `message` rather than unmounting it. Errors announce through the same region. `focusable` with a ref makes it an `initialFocus` target; resolve to it only while it has a message, since an empty one is invisible. Reach for `Status` when the message changes while the panel is open or carries an action (loading, failed, sign-in needed), and `Empty` for a static line in a list that simply has nothing in it.
29
29
  - **`Modal`** — Centred dialog over a scrim, with header slots (icon/title/subtitle/extra), a scrolling body and a pinned footer. Locks background scroll and dismisses on ESC, the close button, or a scrim click unless `closeOnOverlayClick` is off; `busy` suppresses the two pointer routes while a request is in flight and sets `aria-busy`, so a stray click cannot tear the dialog down mid-write — but never ESC, which is the only guaranteed keyboard exit from a focus trap and so always reaches `onClose`. ESC, the Tab focus trap and `aria-modal` all apply to the topmost overlay only, so these may be stacked — a dialog opened from a panel keeps Tab to itself and the panel stops claiming to be modal. The Tab trap follows focus into a malachite popup portaled out of the dialog’s own tree — a `MultiSelect` listbox or a `Popover` opened from the body — and traps Tab within that popup while it holds focus, so Tab walks and wraps that popup’s own stops rather than being yanked back to the dialog’s first control or escaping the dialog altogether. A `Dropdown` list or an `ActionMenu` is dismissed by Tab rather than trapping it: it closes and focus returns to its trigger, so Tab carries on from there. A consumer’s own portaled popup is not known to the trap and Tab will pull focus out of it. Set `role="alertdialog"` for a consequential choice, which asks assistive tech to announce the body and not just the name, and point `aria-describedby` at whichever element carries it. Width comes from the `size` union (`small` 420px | `medium` 612px | `large` 760px) rather than a raw pixel prop. `titleAdornment` sits immediately after the title behind a hairline divider, for naming the thing being acted on — distinct from `headerExtra`, which pins to the far right. `tray` paints a tinted plate around the card and hangs a `caption` beneath it; the plate is the dialog element itself, so that caption stays inside the `aria-modal` subtree rather than being stranded outside it by the visual nesting, and it is added to `aria-describedby` automatically because it says what the dialog is asking. It takes a tone (`neutral` | `warning` | `error` | `success`) rather than a colour, so no consumer can paint it off-palette — and the tone sets the plate and its caption colour together, so the two cannot disagree. The caption is a `{ label?, message }` pair rather than a node, because its row height, type scale and colour belong to the plate. `size` names the card, and the plate’s 4px ring is added on top. Like `SidePanel` it sits in a z-index band from 1000 — one step per stacked overlay, so what paints on top is what holds the keyboard — and stays out of the browser top layer, so a host app’s own dialogs can still cover it. `callouts` stacks full-bleed `Alert` bands at the top of the body, as on `SidePanel`; they ignore `bodyPadding` and lead `aria-describedby`, ahead of the consumer’s own description and the tray caption. For a confirmation use `ConfirmationDialog`, which is a preset over this. _Key props:_ `open`, `onClose`, `title`, `subtitle`, `icon`, `headerExtra`, `titleAdornment`, `tray`, `callouts`, `renderLink`, `headerDivider`, `footer`, `size`, `showCloseButton`, `closeOnOverlayClick`, `bodyPadding`, `busy`, `role` (`dialog` | `alertdialog`), `aria-label`, `aria-labelledby`, `aria-describedby`.
30
30
  - **`SidePanel`** — Right-hand slide-in overlay panel (drawer) with header slots (back/icon/title/subtitle/extra), scrollable body and optional footer. Locks background scroll and dismisses on ESC, an overlay click or close. ESC and the Tab focus trap apply to the topmost overlay only, so a `Modal` may be stacked over it. The Tab trap follows focus into a malachite popup portaled out of the panel’s own tree — a `MultiSelect` listbox or a `Popover` opened from the body — and traps Tab within that popup while it holds focus, so Tab walks and wraps that popup’s own stops rather than being yanked back to the panel’s first control or escaping the panel altogether. A `Dropdown` list or an `ActionMenu` is dismissed by Tab rather than trapping it: it closes and focus returns to its trigger, so Tab carries on from there. A consumer’s own portaled popup is not known to the trap and Tab will pull focus out of it. `callouts` stacks full-bleed `Alert` bands at the top of the body, above `children` and unaffected by `bodyPadding` — the same band `ConfirmationDialog` gives its `callout` — and `renderLink` routes their root-relative markdown links through the app’s router. The callouts are announced as the panel’s description, ahead of `description`.
31
31
  - **`useHasOpenOverlay`** — Hook reporting whether any modal-type overlay - `SidePanel` or `Modal` - is open anywhere in the app. For host chrome that has to get out of an overlay’s way, a floating support widget being the case it was added for: overlays render through a portal, so a host has no DOM signal of its own to read, and reading the library’s internal markers would couple it to something it does not own. Dropdowns and tooltips are deliberately not counted - they do not trap focus, and chrome does not need to move for them. _Key props:_ No arguments. Returns a boolean.
@@ -1,190 +1,205 @@
1
- import { jsxs as b, jsx as e, Fragment as H } from "react/jsx-runtime";
2
- import { useId as J, useRef as P, useEffect as Q, useLayoutEffect as ee } from "react";
1
+ import { jsxs as b, jsx as n, Fragment as H } from "react/jsx-runtime";
2
+ import { useId as J, useRef as M, useEffect as Q, useLayoutEffect as ee } from "react";
3
3
  import { Button as te } from "./Button.js";
4
4
  import ne from "./CustomIcons/CaretDoubleLeftIcon.js";
5
- import re from "./CustomIcons/CaretDoubleRightIcon.js";
6
- import le from "./CustomIcons/CaretLeftIcon.js";
7
- import ae from "./CustomIcons/CaretRightIcon.js";
5
+ import ae from "./CustomIcons/CaretDoubleRightIcon.js";
6
+ import re from "./CustomIcons/CaretLeftIcon.js";
7
+ import le from "./CustomIcons/CaretRightIcon.js";
8
8
  import { SegmentedControl as se } from "./SegmentedControl.js";
9
- import { monthLabel as oe, monthWeeks as ie, dayKeyOf as K, sameDay as y, dayKeyString as _, weekdayLabels as ce, spokenDay as de, partsOf as ue, formatTimeReadout as me, addMonths as fe, compareDays as D, addMonthsToDay as U, addDays as $, startOfWeek as j } from "./dateMath.js";
10
- import { DIVIDER_V as B, DIVIDER_H as S, LINK_BUTTON as he, LINK_HOVER as pe, PRESET_BUTTON as be, PRESET_HOVER as Ne, NAV_BUTTON as C, HEADING_TEXT as M, RANGE_BAND as ge, RANGE_BAND_SPAN as xe, CELL_CLASS as G, dayToneClass as z } from "./datePickerStyles.js";
9
+ import { monthLabel as oe, monthWeeks as ie, dayKeyOf as K, sameDay as x, dayKeyString as A, weekdayLabels as ce, spokenDay as de, partsOf as ue, formatTimeReadout as me, addMonths as fe, compareDays as _, daysInMonth as he, addMonthsToDay as U, addDays as D, startOfWeek as j } from "./dateMath.js";
10
+ import { DIVIDER_V as B, DIVIDER_H as P, LINK_BUTTON as pe, LINK_HOVER as be, PRESET_BUTTON as ye, PRESET_HOVER as Ne, NAV_BUTTON as I, HEADING_TEXT as S, RANGE_BAND as ge, RANGE_BAND_SPAN as xe, CELL_CLASS as G, dayToneClass as z } from "./datePickerStyles.js";
11
11
  import { FOCUS_RING as v } from "./focusRing.js";
12
- const ye = 40, ve = 240, R = (n, r = 1) => Array.from({ length: Math.ceil(n / r) }, (t, s) => s * r), we = (n, r, t, s) => {
13
- switch (n) {
12
+ const ve = 40, we = 240, R = (e, a = 1) => Array.from({ length: Math.ceil(e / a) }, (t, r) => r * a), De = (e, a, t, r) => {
13
+ switch (e) {
14
14
  case "ArrowLeft":
15
- return $(t, -1);
15
+ return D(t, -1);
16
16
  case "ArrowRight":
17
- return $(t, 1);
17
+ return D(t, 1);
18
18
  case "ArrowUp":
19
- return $(t, -7);
19
+ return D(t, -7);
20
20
  case "ArrowDown":
21
- return $(t, 7);
21
+ return D(t, 7);
22
22
  case "Home":
23
- return j(t, s);
23
+ return j(t, r);
24
24
  case "End":
25
- return $(j(t, s), 6);
25
+ return D(j(t, r), 6);
26
26
  case "PageUp":
27
- return U(t, r ? -12 : -1);
27
+ return U(t, a ? -12 : -1);
28
28
  case "PageDown":
29
- return U(t, r ? 12 : 1);
29
+ return U(t, a ? 12 : 1);
30
30
  default:
31
31
  return null;
32
32
  }
33
- }, $e = ({ view: n, labelId: r, onViewChange: t, isMonthReachable: s }) => {
34
- const p = (g) => {
35
- const l = fe(n, g);
36
- return { target: l, disabled: !s(l) };
37
- }, d = p(-1), u = p(-12), h = p(1), N = p(12), m = ({ target: g, disabled: l }) => {
38
- l || t(g);
33
+ }, $e = (e, a, t) => {
34
+ const r = he(e), h = Math.min(a, r);
35
+ for (let c = 0; c < r; c++)
36
+ for (const d of [h - c, h + c])
37
+ if (d >= 1 && d <= r && !t({ ...e, day: d }))
38
+ return { ...e, day: d };
39
+ return { ...e, day: h };
40
+ }, Ce = ({
41
+ view: e,
42
+ labelId: a,
43
+ onViewChange: t,
44
+ focusDay: r,
45
+ onFocusDayChange: h,
46
+ isDayDisabled: c,
47
+ isMonthReachable: d
48
+ }) => {
49
+ const f = (i) => {
50
+ const o = fe(e, i);
51
+ return { target: o, disabled: !d(o) };
52
+ }, y = f(-1), p = f(-12), N = f(1), l = f(12), u = ({ target: i, disabled: o }) => {
53
+ o || (t(i), h($e(i, r.day, c)));
39
54
  };
40
55
  return /* @__PURE__ */ b("div", { className: "flex items-center justify-between p-2", children: [
41
56
  /* @__PURE__ */ b("div", { className: "flex items-center gap-0.5", children: [
42
- /* @__PURE__ */ e(
57
+ /* @__PURE__ */ n(
43
58
  "button",
44
59
  {
45
60
  type: "button",
46
- "aria-label": "Previous month",
47
- className: `${C} ${v}`,
48
- "aria-disabled": d.disabled || void 0,
49
- onClick: () => m(d),
50
- children: /* @__PURE__ */ e(le, { size: 14 })
61
+ "aria-label": "Previous year",
62
+ className: `${I} ${v}`,
63
+ "aria-disabled": p.disabled || void 0,
64
+ onClick: () => u(p),
65
+ children: /* @__PURE__ */ n(ne, { size: 14 })
51
66
  }
52
67
  ),
53
- /* @__PURE__ */ e(
68
+ /* @__PURE__ */ n(
54
69
  "button",
55
70
  {
56
71
  type: "button",
57
- "aria-label": "Previous year",
58
- className: `${C} ${v}`,
59
- "aria-disabled": u.disabled || void 0,
60
- onClick: () => m(u),
61
- children: /* @__PURE__ */ e(ne, { size: 14 })
72
+ "aria-label": "Previous month",
73
+ className: `${I} ${v}`,
74
+ "aria-disabled": y.disabled || void 0,
75
+ onClick: () => u(y),
76
+ children: /* @__PURE__ */ n(re, { size: 14 })
62
77
  }
63
78
  )
64
79
  ] }),
65
- /* @__PURE__ */ e("span", { id: r, "aria-live": "polite", className: M, children: oe(n) }),
80
+ /* @__PURE__ */ n("span", { id: a, "aria-live": "polite", className: S, children: oe(e) }),
66
81
  /* @__PURE__ */ b("div", { className: "flex items-center gap-0.5", children: [
67
- /* @__PURE__ */ e(
82
+ /* @__PURE__ */ n(
68
83
  "button",
69
84
  {
70
85
  type: "button",
71
86
  "aria-label": "Next month",
72
- className: `${C} ${v}`,
73
- "aria-disabled": h.disabled || void 0,
74
- onClick: () => m(h),
75
- children: /* @__PURE__ */ e(ae, { size: 14 })
87
+ className: `${I} ${v}`,
88
+ "aria-disabled": N.disabled || void 0,
89
+ onClick: () => u(N),
90
+ children: /* @__PURE__ */ n(le, { size: 14 })
76
91
  }
77
92
  ),
78
- /* @__PURE__ */ e(
93
+ /* @__PURE__ */ n(
79
94
  "button",
80
95
  {
81
96
  type: "button",
82
97
  "aria-label": "Next year",
83
- className: `${C} ${v}`,
84
- "aria-disabled": N.disabled || void 0,
85
- onClick: () => m(N),
86
- children: /* @__PURE__ */ e(re, { size: 14 })
98
+ className: `${I} ${v}`,
99
+ "aria-disabled": l.disabled || void 0,
100
+ onClick: () => u(l),
101
+ children: /* @__PURE__ */ n(ae, { size: 14 })
87
102
  }
88
103
  )
89
104
  ] })
90
105
  ] });
91
- }, Ie = (n, r, t) => !r || !t || D(r, t) === 0 ? null : y(n, r) ? "start" : y(n, t) ? "end" : D(n, r) > 0 && D(n, t) < 0 ? "middle" : null, ke = ({
92
- mode: n,
93
- zone: r,
106
+ }, Ie = (e, a, t) => !a || !t || _(a, t) === 0 ? null : x(e, a) ? "start" : x(e, t) ? "end" : _(e, a) > 0 && _(e, t) < 0 ? "middle" : null, ke = ({
107
+ mode: e,
108
+ zone: a,
94
109
  weekStart: t,
95
- view: s,
96
- onViewChange: p,
97
- focusDay: d,
98
- onFocusDayChange: u,
99
- draft: h,
100
- today: N,
101
- isDayDisabled: m,
102
- isMonthReachable: g,
110
+ view: r,
111
+ onViewChange: h,
112
+ focusDay: c,
113
+ onFocusDayChange: d,
114
+ draft: f,
115
+ today: y,
116
+ isDayDisabled: p,
117
+ isMonthReachable: N,
103
118
  onPickDay: l,
104
- initialFocusRef: f,
119
+ initialFocusRef: u,
105
120
  labelId: i
106
121
  }) => {
107
- const o = P(null), x = P(!1), L = ie(s, t), T = h.start ? K(h.start, r) : null, E = n === "range" && h.end ? K(h.end, r) : null, I = L.some((c) => c.some((a) => y(a, d))) ? d : { ...s, day: 1 };
122
+ const o = M(null), g = M(!1), L = ie(r, t), k = f.start ? K(f.start, a) : null, T = e === "range" && f.end ? K(f.end, a) : null, $ = L.some((m) => m.some((s) => x(s, c))) ? c : { ...r, day: 1 };
108
123
  Q(() => {
109
- var c, a;
110
- x.current && (x.current = !1, (a = (c = o.current) == null ? void 0 : c.querySelector(`[data-day="${_(d)}"]`)) == null || a.focus({ preventScroll: !0 }));
111
- }, [d]);
112
- const W = (c) => {
113
- if (c.key === "Enter" || c.key === " ") {
114
- c.preventDefault(), m(I) || l(I);
124
+ var m, s;
125
+ g.current && (g.current = !1, (s = (m = o.current) == null ? void 0 : m.querySelector(`[data-day="${A(c)}"]`)) == null || s.focus({ preventScroll: !0 }));
126
+ }, [c]);
127
+ const F = (m) => {
128
+ if (m.key === "Enter" || m.key === " ") {
129
+ m.preventDefault(), p($) || l($);
115
130
  return;
116
131
  }
117
- const a = we(c.key, c.shiftKey, I, t);
118
- if (!a)
132
+ const s = De(m.key, m.shiftKey, $, t);
133
+ if (!s)
119
134
  return;
120
- c.preventDefault();
121
- const w = a.month !== s.month || a.year !== s.year;
122
- w && !g(a) || (w && p({ year: a.year, month: a.month }), x.current = !0, u(a));
123
- }, X = ce(t);
135
+ m.preventDefault();
136
+ const w = s.month !== r.month || s.year !== r.year;
137
+ w && !N(s) || (w && h({ year: s.year, month: s.month }), g.current = !0, d(s));
138
+ }, W = ce(t);
124
139
  return /* @__PURE__ */ b(
125
140
  "div",
126
141
  {
127
142
  ref: o,
128
143
  role: "grid",
129
144
  "aria-labelledby": i,
130
- "aria-multiselectable": n === "range" || void 0,
145
+ "aria-multiselectable": e === "range" || void 0,
131
146
  className: "flex w-[276px] flex-col",
132
- onKeyDown: W,
147
+ onKeyDown: F,
133
148
  children: [
134
- /* @__PURE__ */ e("div", { role: "row", className: "grid grid-cols-7 px-[14px] py-2", children: X.map((c) => /* @__PURE__ */ e(
149
+ /* @__PURE__ */ n("div", { role: "row", className: "grid grid-cols-7 px-[14px] py-2", children: W.map((m) => /* @__PURE__ */ n(
135
150
  "span",
136
151
  {
137
152
  role: "columnheader",
138
- "aria-label": c.long,
139
- className: `flex h-6 items-center justify-center ${M}`,
140
- children: c.short
153
+ "aria-label": m.long,
154
+ className: `flex h-6 items-center justify-center ${S}`,
155
+ children: m.short
141
156
  },
142
- c.short
157
+ m.short
143
158
  )) }),
144
- L.map((c) => /* @__PURE__ */ e(
159
+ L.map((m) => /* @__PURE__ */ n(
145
160
  "div",
146
161
  {
147
162
  role: "row",
148
163
  className: "grid grid-cols-7 px-[14px] py-2",
149
- children: c.map((a) => {
150
- const w = _(a), k = m(a), A = n === "range" ? Ie(a, T, E) : null, q = y(a, T) || y(a, E) || A === "middle", F = y(a, T) || y(a, E), O = y(a, N), Y = a.month !== s.month, V = y(a, I);
164
+ children: m.map((s) => {
165
+ const w = A(s), C = p(s), E = e === "range" ? Ie(s, k, T) : null, X = x(s, k) || x(s, T) || E === "middle", q = x(s, k) || x(s, T), O = x(s, y), Y = s.month !== r.month, V = x(s, $);
151
166
  return /* @__PURE__ */ b(
152
167
  "div",
153
168
  {
154
169
  role: "presentation",
155
170
  className: "relative flex h-6 items-center justify-center",
156
171
  children: [
157
- A && /* @__PURE__ */ e(
172
+ E && /* @__PURE__ */ n(
158
173
  "span",
159
174
  {
160
175
  "aria-hidden": "true",
161
- className: `${ge} ${xe[A]}`
176
+ className: `${ge} ${xe[E]}`
162
177
  }
163
178
  ),
164
- /* @__PURE__ */ e(
179
+ /* @__PURE__ */ n(
165
180
  "button",
166
181
  {
167
182
  ref: V ? (Z) => {
168
- f.current = Z;
183
+ u.current = Z;
169
184
  } : void 0,
170
185
  type: "button",
171
186
  role: "gridcell",
172
- "aria-selected": q,
187
+ "aria-selected": X,
173
188
  "data-day": w,
174
189
  tabIndex: V ? 0 : -1,
175
- "aria-label": de(a),
190
+ "aria-label": de(s),
176
191
  "aria-current": O ? "date" : void 0,
177
- "aria-disabled": k || void 0,
178
- className: `${G(k)} ${z({
179
- selected: F,
192
+ "aria-disabled": C || void 0,
193
+ className: `${G(C)} ${z({
194
+ selected: q,
180
195
  today: O,
181
196
  outside: Y,
182
- disabled: k
197
+ disabled: C
183
198
  })}`,
184
199
  onClick: () => {
185
- u(a), k || l(a);
200
+ d(s), C || l(s);
186
201
  },
187
- children: a.day
202
+ children: s.day
188
203
  }
189
204
  )
190
205
  ]
@@ -193,34 +208,34 @@ const ye = 40, ve = 240, R = (n, r = 1) => Array.from({ length: Math.ceil(n / r)
193
208
  );
194
209
  })
195
210
  },
196
- _(c[0])
211
+ A(m[0])
197
212
  ))
198
213
  ]
199
214
  }
200
215
  );
201
- }, Ce = ({ label: n, values: r, selected: t, isDisabled: s, onPick: p }) => {
202
- const d = P(null), u = t === null ? -1 : r.filter((l) => l <= t).length - 1;
216
+ }, Te = ({ label: e, values: a, selected: t, isDisabled: r, onPick: h }) => {
217
+ const c = M(null), d = t === null ? -1 : a.filter((l) => l <= t).length - 1;
203
218
  ee(() => {
204
- d.current && u >= 0 && (d.current.scrollTop = u * ye);
205
- }, [u]);
206
- const h = Math.max(
219
+ c.current && d >= 0 && (c.current.scrollTop = d * ve);
220
+ }, [d]);
221
+ const f = Math.max(
207
222
  0,
208
- r.findIndex((l) => !s(l))
209
- ), N = (l) => l === (u >= 0 ? u : h) ? 0 : -1, m = (l, f) => {
210
- var o, x;
211
- const i = r[l];
212
- i === void 0 || s(i) || (p(i), f && ((x = (o = d.current) == null ? void 0 : o.querySelector(`[data-value="${i}"]`)) == null || x.focus({ preventScroll: !0 })));
223
+ a.findIndex((l) => !r(l))
224
+ ), y = (l) => l === (d >= 0 ? d : f) ? 0 : -1, p = (l, u) => {
225
+ var o, g;
226
+ const i = a[l];
227
+ i === void 0 || r(i) || (h(i), u && ((g = (o = c.current) == null ? void 0 : o.querySelector(`[data-value="${i}"]`)) == null || g.focus({ preventScroll: !0 })));
213
228
  };
214
- return /* @__PURE__ */ e(
229
+ return /* @__PURE__ */ n(
215
230
  "div",
216
231
  {
217
- ref: d,
232
+ ref: c,
218
233
  role: "listbox",
219
- "aria-label": n,
234
+ "aria-label": e,
220
235
  className: "flex flex-col items-center overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
221
- style: { height: ve },
236
+ style: { height: we },
222
237
  onKeyDown: (l) => {
223
- const f = u >= 0 ? u : -1, i = {
238
+ const u = d >= 0 ? d : -1, i = {
224
239
  ArrowDown: 1,
225
240
  ArrowUp: -1,
226
241
  PageDown: 5,
@@ -228,20 +243,20 @@ const ye = 40, ve = 240, R = (n, r = 1) => Array.from({ length: Math.ceil(n / r)
228
243
  };
229
244
  let o = null;
230
245
  if (l.key in i) {
231
- o = f < 0 ? h : f + i[l.key];
232
- const x = Math.sign(i[l.key]);
233
- for (; o >= 0 && o < r.length && s(r[o]); )
234
- o += x;
246
+ o = u < 0 ? f : u + i[l.key];
247
+ const g = Math.sign(i[l.key]);
248
+ for (; o >= 0 && o < a.length && r(a[o]); )
249
+ o += g;
235
250
  } else if (l.key === "Home")
236
- o = r.findIndex((x) => !s(x));
251
+ o = a.findIndex((g) => !r(g));
237
252
  else if (l.key === "End")
238
- for (o = r.length - 1; o >= 0 && s(r[o]); )
253
+ for (o = a.length - 1; o >= 0 && r(a[o]); )
239
254
  o -= 1;
240
- o !== null && (l.preventDefault(), m(o, !0));
255
+ o !== null && (l.preventDefault(), p(o, !0));
241
256
  },
242
- children: r.map((l, f) => {
243
- const i = s(l), o = l === t;
244
- return /* @__PURE__ */ e("div", { className: "flex shrink-0 items-center py-2", children: /* @__PURE__ */ e(
257
+ children: a.map((l, u) => {
258
+ const i = r(l), o = l === t;
259
+ return /* @__PURE__ */ n("div", { className: "flex shrink-0 items-center py-2", children: /* @__PURE__ */ n(
245
260
  "button",
246
261
  {
247
262
  type: "button",
@@ -249,142 +264,145 @@ const ye = 40, ve = 240, R = (n, r = 1) => Array.from({ length: Math.ceil(n / r)
249
264
  "data-value": l,
250
265
  "aria-selected": o,
251
266
  "aria-disabled": i || void 0,
252
- tabIndex: N(f),
267
+ tabIndex: y(u),
253
268
  className: `${G(i)} ${z({
254
269
  selected: o,
255
270
  today: !1,
256
271
  outside: !1,
257
272
  disabled: i
258
273
  })}`,
259
- onClick: () => m(f, !1),
274
+ onClick: () => p(u, !1),
260
275
  children: String(l).padStart(2, "0")
261
276
  }
262
277
  ) }, l);
263
278
  })
264
279
  }
265
280
  );
266
- }, Te = ({
267
- mode: n,
268
- zone: r,
281
+ }, Ee = ({
282
+ mode: e,
283
+ zone: a,
269
284
  precision: t,
270
- minuteStep: s,
271
- draft: p,
272
- active: d,
273
- onActiveChange: u,
274
- isTimeDisabled: h,
275
- onPickTime: N
285
+ minuteStep: r,
286
+ draft: h,
287
+ active: c,
288
+ onActiveChange: d,
289
+ isTimeDisabled: f,
290
+ onPickTime: y
276
291
  }) => {
277
- const m = n === "range" ? p[d] : p.start, g = m ? ue(m, r) : null, l = [
292
+ const p = e === "range" ? h[c] : h.start, N = p ? ue(p, a) : null, l = [
278
293
  { unit: "hours", label: "Hours", values: R(24) },
279
- { unit: "minutes", label: "Minutes", values: R(60, s) },
294
+ { unit: "minutes", label: "Minutes", values: R(60, r) },
280
295
  ...t === "second" ? [{ unit: "seconds", label: "Seconds", values: R(60) }] : []
281
296
  ];
282
297
  return /* @__PURE__ */ b("div", { className: "flex flex-col gap-1", children: [
283
- /* @__PURE__ */ e("div", { className: "flex min-h-8 items-center justify-center p-2", children: n === "range" ? /* @__PURE__ */ e(
298
+ /* @__PURE__ */ n("div", { className: "flex min-h-8 items-center justify-center p-2", children: e === "range" ? /* @__PURE__ */ n(
284
299
  se,
285
300
  {
286
301
  size: "small",
287
302
  "aria-label": "Time for",
288
- value: d,
289
- onChange: u,
303
+ value: c,
304
+ onChange: d,
290
305
  options: [
291
306
  { value: "start", label: "Start" },
292
307
  { value: "end", label: "End" }
293
308
  ]
294
309
  }
295
- ) : /* @__PURE__ */ e("span", { className: `${M} whitespace-nowrap`, children: me(m, r, t) }) }),
296
- /* @__PURE__ */ e("div", { className: S }),
297
- /* @__PURE__ */ e(
310
+ ) : /* @__PURE__ */ n("span", { className: `${S} whitespace-nowrap`, children: me(p, a, t) }) }),
311
+ /* @__PURE__ */ n("div", { className: P }),
312
+ /* @__PURE__ */ n(
298
313
  "div",
299
314
  {
300
315
  className: "grid px-[14px]",
301
316
  style: { gridTemplateColumns: `repeat(${l.length}, 35.67px)` },
302
- children: l.map((f) => /* @__PURE__ */ e(
303
- Ce,
317
+ children: l.map((u) => /* @__PURE__ */ n(
318
+ Te,
304
319
  {
305
- label: f.label,
306
- values: f.values,
307
- selected: g ? g[f.unit] : null,
308
- isDisabled: (i) => h(f.unit, i),
309
- onPick: (i) => N(f.unit, i)
320
+ label: u.label,
321
+ values: u.values,
322
+ selected: N ? N[u.unit] : null,
323
+ isDisabled: (i) => f(u.unit, i),
324
+ onPick: (i) => y(u.unit, i)
310
325
  },
311
- f.unit
326
+ u.unit
312
327
  ))
313
328
  }
314
329
  )
315
330
  ] });
316
- }, Ee = ({
317
- presets: n,
318
- onPreset: r
319
- }) => /* @__PURE__ */ e("div", { className: "flex w-36 flex-col gap-0.5 p-1", role: "group", "aria-label": "Presets", children: n.map((t, s) => /* @__PURE__ */ e(
331
+ }, Ae = ({
332
+ presets: e,
333
+ onPreset: a
334
+ }) => /* @__PURE__ */ n("div", { className: "flex w-36 flex-col gap-0.5 p-1", role: "group", "aria-label": "Presets", children: e.map((t, r) => /* @__PURE__ */ n(
320
335
  "button",
321
336
  {
322
337
  type: "button",
323
- className: `${be} ${Ne} ${v}`,
324
- onClick: () => r(s),
338
+ className: `${ye} ${Ne} ${v}`,
339
+ onClick: () => a(r),
325
340
  children: t
326
341
  },
327
342
  t
328
- )) }), Ue = (n) => {
329
- const r = `${J().replace(/[^a-zA-Z0-9_-]/g, "")}-month`, {
343
+ )) }), Be = (e) => {
344
+ const a = `${J().replace(/[^a-zA-Z0-9_-]/g, "")}-month`, {
330
345
  presets: t,
331
- onPreset: s,
332
- precision: p,
333
- todayLabel: d,
334
- todayDisabled: u,
335
- onToday: h,
336
- showApply: N,
337
- applyDisabled: m,
338
- onApply: g
339
- } = n;
346
+ onPreset: r,
347
+ precision: h,
348
+ todayLabel: c,
349
+ todayDisabled: d,
350
+ onToday: f,
351
+ showApply: y,
352
+ applyDisabled: p,
353
+ onApply: N
354
+ } = e;
340
355
  return /* @__PURE__ */ b("div", { className: "flex flex-col gap-1 p-1.5", children: [
341
- n.mode === "range" && /* @__PURE__ */ e("span", { className: "sr-only", "aria-live": "polite", children: n.active === "end" && n.draft.start && !n.draft.end ? "Choose the end date" : "" }),
356
+ e.mode === "range" && /* @__PURE__ */ n("span", { className: "sr-only", "aria-live": "polite", children: e.active === "end" && e.draft.start && !e.draft.end ? "Choose the end date" : "" }),
342
357
  /* @__PURE__ */ b("div", { className: "flex", children: [
343
358
  t && t.length > 0 && /* @__PURE__ */ b(H, { children: [
344
- /* @__PURE__ */ e(Ee, { presets: t, onPreset: s }),
345
- /* @__PURE__ */ e("div", { className: `${B} mx-1` })
359
+ /* @__PURE__ */ n(Ae, { presets: t, onPreset: r }),
360
+ /* @__PURE__ */ n("div", { className: `${B} mx-1` })
346
361
  ] }),
347
362
  /* @__PURE__ */ b("div", { className: "flex flex-col gap-1", children: [
348
- /* @__PURE__ */ e(
349
- $e,
363
+ /* @__PURE__ */ n(
364
+ Ce,
350
365
  {
351
- view: n.view,
352
- labelId: r,
353
- onViewChange: n.onViewChange,
354
- isMonthReachable: n.isMonthReachable
366
+ view: e.view,
367
+ labelId: a,
368
+ onViewChange: e.onViewChange,
369
+ focusDay: e.focusDay,
370
+ onFocusDayChange: e.onFocusDayChange,
371
+ isDayDisabled: e.isDayDisabled,
372
+ isMonthReachable: e.isMonthReachable
355
373
  }
356
374
  ),
357
- /* @__PURE__ */ e("div", { className: S }),
358
- /* @__PURE__ */ e(ke, { ...n, labelId: r })
375
+ /* @__PURE__ */ n("div", { className: P }),
376
+ /* @__PURE__ */ n(ke, { ...e, labelId: a })
359
377
  ] }),
360
- p !== "day" && /* @__PURE__ */ b(H, { children: [
361
- /* @__PURE__ */ e("div", { className: B }),
362
- /* @__PURE__ */ e(Te, { ...n })
378
+ h !== "day" && /* @__PURE__ */ b(H, { children: [
379
+ /* @__PURE__ */ n("div", { className: B }),
380
+ /* @__PURE__ */ n(Ee, { ...e })
363
381
  ] })
364
382
  ] }),
365
- /* @__PURE__ */ e("div", { className: S }),
383
+ /* @__PURE__ */ n("div", { className: P }),
366
384
  /* @__PURE__ */ b(
367
385
  "div",
368
386
  {
369
- className: `flex items-center p-2 ${N ? "justify-between" : "justify-center"}`,
387
+ className: `flex items-center p-2 ${y ? "justify-between" : "justify-center"}`,
370
388
  children: [
371
- /* @__PURE__ */ e(
389
+ /* @__PURE__ */ n(
372
390
  "button",
373
391
  {
374
392
  type: "button",
375
- className: `${he} ${pe} ${v}`,
376
- disabled: u,
377
- onClick: h,
378
- children: d
393
+ className: `${pe} ${be} ${v}`,
394
+ disabled: d,
395
+ onClick: f,
396
+ children: c
379
397
  }
380
398
  ),
381
- N && /* @__PURE__ */ e(
399
+ y && /* @__PURE__ */ n(
382
400
  te,
383
401
  {
384
402
  size: "small",
385
403
  variant: "filled",
386
- disabled: m,
387
- onClick: g,
404
+ disabled: p,
405
+ onClick: N,
388
406
  children: "Apply"
389
407
  }
390
408
  )
@@ -394,6 +412,6 @@ const ye = 40, ve = 240, R = (n, r = 1) => Array.from({ length: Math.ceil(n / r)
394
412
  ] });
395
413
  };
396
414
  export {
397
- Ue as default
415
+ Be as default
398
416
  };
399
417
  //# sourceMappingURL=DatePickerPanel.js.map