@companix/uikit 0.1.25 → 0.1.26

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 (56) hide show
  1. package/dist/__hooks/use-rerender.d.ts +1 -0
  2. package/dist/__hooks/use-sync-submit.d.ts +1 -0
  3. package/dist/bundle.es.js +45 -43
  4. package/dist/bundle.es10.js +1 -1
  5. package/dist/bundle.es13.js +4 -4
  6. package/dist/bundle.es14.js +3 -3
  7. package/dist/bundle.es15.js +2 -2
  8. package/dist/bundle.es17.js +1 -1
  9. package/dist/bundle.es23.js +5 -5
  10. package/dist/bundle.es25.js +1 -1
  11. package/dist/bundle.es26.js +1 -1
  12. package/dist/bundle.es28.js +1 -1
  13. package/dist/bundle.es29.js +12 -11
  14. package/dist/bundle.es31.js +4 -4
  15. package/dist/bundle.es32.js +2 -2
  16. package/dist/bundle.es35.js +2 -2
  17. package/dist/bundle.es41.js +1 -1
  18. package/dist/bundle.es42.js +2 -2
  19. package/dist/bundle.es45.js +1 -1
  20. package/dist/bundle.es52.js +10 -25
  21. package/dist/bundle.es53.js +17 -29
  22. package/dist/bundle.es54.js +36 -48
  23. package/dist/bundle.es55.js +49 -55
  24. package/dist/bundle.es56.js +56 -8
  25. package/dist/bundle.es57.js +8 -26
  26. package/dist/bundle.es58.js +27 -5
  27. package/dist/bundle.es59.js +5 -66
  28. package/dist/bundle.es60.js +66 -23
  29. package/dist/bundle.es61.js +22 -23
  30. package/dist/bundle.es62.js +24 -90
  31. package/dist/bundle.es63.js +90 -18
  32. package/dist/bundle.es64.js +17 -93
  33. package/dist/bundle.es65.js +93 -73
  34. package/dist/bundle.es66.js +73 -23
  35. package/dist/bundle.es67.js +20 -35
  36. package/dist/bundle.es68.js +39 -24
  37. package/dist/bundle.es69.js +24 -79
  38. package/dist/bundle.es70.js +71 -85
  39. package/dist/bundle.es71.js +93 -10
  40. package/dist/bundle.es72.js +10 -70
  41. package/dist/bundle.es73.js +5 -11
  42. package/dist/bundle.es74.js +68 -41
  43. package/dist/bundle.es75.js +10 -31
  44. package/dist/bundle.es76.js +41 -64
  45. package/dist/bundle.es77.js +33 -41
  46. package/dist/bundle.es78.js +62 -11
  47. package/dist/bundle.es79.js +40 -31
  48. package/dist/bundle.es80.js +15 -70
  49. package/dist/bundle.es81.js +32 -14
  50. package/dist/bundle.es82.js +70 -75
  51. package/dist/bundle.es83.js +71 -45
  52. package/dist/bundle.es84.js +48 -13
  53. package/dist/bundle.es85.js +16 -0
  54. package/dist/bundle.es86.js +16 -0
  55. package/dist/index.d.ts +1 -0
  56. package/package.json +1 -1
@@ -1,81 +1,26 @@
1
- const a = /* @__PURE__ */ new WeakMap();
2
- function d(t, n, e = !1) {
3
- if (!t || !(t instanceof HTMLElement)) return;
4
- const o = {};
5
- Object.entries(n).forEach(([i, s]) => {
6
- if (i.startsWith("--")) {
7
- t.style.setProperty(i, s);
8
- return;
9
- }
10
- o[i] = t.style[i], t.style[i] = s;
11
- }), !e && a.set(t, o);
12
- }
13
- function p(t, n) {
14
- if (!t || !(t instanceof HTMLElement)) return;
15
- const e = a.get(t);
16
- e && (t.style[n] = e[n]);
17
- }
18
- function w(t) {
19
- if (!t)
20
- return null;
21
- const n = window.getComputedStyle(t), e = (
22
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
23
- // @ts-ignore
24
- n.transform || n.webkitTransform || n.mozTransform
25
- );
26
- let o = e.match(/^matrix3d\((.+)\)$/);
27
- return o ? parseFloat(o[1].split(", ")[13]) : (o = e.match(/^matrix\((.+)\)$/), o ? parseFloat(o[1].split(", ")[5]) : null);
28
- }
29
- function h(t) {
30
- return 8 * (Math.log(t + 1) - 2);
31
- }
32
- const u = /* @__PURE__ */ new Set([
33
- "checkbox",
34
- "radio",
35
- "range",
36
- "color",
37
- "file",
38
- "image",
39
- "button",
40
- "submit",
41
- "reset"
42
- ]);
43
- function T(t) {
44
- return t instanceof HTMLInputElement && !u.has(t.type) || t instanceof HTMLTextAreaElement || t instanceof HTMLElement && t.isContentEditable;
45
- }
46
- function r(t) {
47
- return typeof window < "u" && window.navigator != null ? t.test(window.navigator.platform) : void 0;
48
- }
49
- function f() {
50
- return r(/^Mac/);
51
- }
52
- function c() {
53
- return r(/^iPhone/);
54
- }
55
- function l() {
56
- return r(/^iPad/) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
57
- f() && navigator.maxTouchPoints > 1;
58
- }
59
- function M() {
60
- return c() || l();
61
- }
62
- function g() {
63
- const t = navigator.userAgent;
64
- return typeof window < "u" && (/Firefox/.test(t) && /Mobile/.test(t) || /FxiOS/.test(t));
65
- }
66
- function m(t, n) {
67
- typeof t == "function" ? t(n) : t != null && (t.current = n);
68
- }
69
- function x(...t) {
70
- return (n) => t.forEach((e) => m(e, n));
71
- }
1
+ import r from "react";
2
+ const t = r.createContext({
3
+ drawerRef: { current: null },
4
+ overlayRef: { current: null },
5
+ onPress: () => {
6
+ },
7
+ onRelease: () => {
8
+ },
9
+ onDrag: () => {
10
+ },
11
+ isOpen: !1,
12
+ isDragging: !1,
13
+ keyboardIsOpen: { current: !1 },
14
+ closeDrawer: () => {
15
+ },
16
+ shouldAnimate: { current: !0 }
17
+ }), o = () => {
18
+ const e = r.useContext(t);
19
+ if (!e)
20
+ throw new Error("useDrawerContext must be used within a MobileDrawer.Root");
21
+ return e;
22
+ };
72
23
  export {
73
- x as composeRefs,
74
- h as dampenValue,
75
- w as getTranslate,
76
- M as isIOS,
77
- T as isInput,
78
- g as isMobileFirefox,
79
- p as reset,
80
- d as set
24
+ t as DrawerContext,
25
+ o as useDrawerContext
81
26
  };
@@ -1,95 +1,81 @@
1
- import { useLayoutEffect as Y, useEffect as B } from "react";
2
- import { isIOS as R, isInput as g } from "./bundle.es69.js";
3
- const C = 24, F = typeof window < "u" ? Y : B;
4
- function w(...t) {
5
- return (...e) => {
6
- for (const o of t)
7
- typeof o == "function" && o(...e);
8
- };
1
+ const a = /* @__PURE__ */ new WeakMap();
2
+ function d(t, n, e = !1) {
3
+ if (!t || !(t instanceof HTMLElement)) return;
4
+ const o = {};
5
+ Object.entries(n).forEach(([i, s]) => {
6
+ if (i.startsWith("--")) {
7
+ t.style.setProperty(i, s);
8
+ return;
9
+ }
10
+ o[i] = t.style[i], t.style[i] = s;
11
+ }), !e && a.set(t, o);
9
12
  }
10
- const m = typeof document < "u" ? window.visualViewport : null;
11
- function E(t) {
12
- const e = window.getComputedStyle(t);
13
- return /(auto|scroll)/.test(e.overflow + e.overflowX + e.overflowY);
13
+ function p(t, n) {
14
+ if (!t || !(t instanceof HTMLElement)) return;
15
+ const e = a.get(t);
16
+ e && (t.style[n] = e[n]);
14
17
  }
15
- function y(t) {
16
- for (E(t) && (t = t.parentElement); t && !E(t); )
17
- t = t.parentElement;
18
- return t || document.scrollingElement || document.documentElement;
18
+ function w(t) {
19
+ if (!t)
20
+ return null;
21
+ const n = window.getComputedStyle(t), e = (
22
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
23
+ // @ts-ignore
24
+ n.transform || n.webkitTransform || n.mozTransform
25
+ );
26
+ let o = e.match(/^matrix3d\((.+)\)$/);
27
+ return o ? parseFloat(o[1].split(", ")[13]) : (o = e.match(/^matrix\((.+)\)$/), o ? parseFloat(o[1].split(", ")[5]) : null);
19
28
  }
20
- let s = 0, v;
21
- function H(t = {}) {
22
- const { isDisabled: e } = t;
23
- F(() => {
24
- if (!e)
25
- return s++, s === 1 && R() && (v = D()), () => {
26
- s--, s === 0 && v?.();
27
- };
28
- }, [e]);
29
+ function h(t) {
30
+ return 8 * (Math.log(t + 1) - 2);
29
31
  }
30
- function D() {
31
- let t, e = 0;
32
- const o = (r) => {
33
- t = y(r.target), !(t === document.documentElement && t === document.body) && (e = r.changedTouches[0].pageY);
34
- }, c = (r) => {
35
- if (!t || t === document.documentElement || t === document.body) {
36
- r.preventDefault();
37
- return;
38
- }
39
- const n = r.changedTouches[0].pageY, d = t.scrollTop, p = t.scrollHeight - t.clientHeight;
40
- p !== 0 && ((d <= 0 && n > e || d >= p && n < e) && r.preventDefault(), e = n);
41
- }, i = (r) => {
42
- const n = r.target;
43
- g(n) && n !== document.activeElement && (r.preventDefault(), n.style.transform = "translateY(-2000px)", n.focus(), requestAnimationFrame(() => {
44
- n.style.transform = "";
45
- }));
46
- }, u = (r) => {
47
- const n = r.target;
48
- g(n) && (n.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
49
- n.style.transform = "", m && (m.height < window.innerHeight ? requestAnimationFrame(() => {
50
- h(n);
51
- }) : m.addEventListener("resize", () => h(n), { once: !0 }));
52
- }));
53
- }, a = () => {
54
- window.scrollTo(0, 0);
55
- }, f = window.pageXOffset, b = window.pageYOffset, T = w(
56
- L(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`)
57
- );
58
- window.scrollTo(0, 0);
59
- const S = w(
60
- l(document, "touchstart", o, { passive: !1, capture: !0 }),
61
- l(document, "touchmove", c, { passive: !1, capture: !0 }),
62
- l(document, "touchend", i, { passive: !1, capture: !0 }),
63
- l(document, "focus", u, !0),
64
- l(window, "scroll", a)
65
- );
66
- return () => {
67
- T(), S(), window.scrollTo(f, b);
68
- };
32
+ const u = /* @__PURE__ */ new Set([
33
+ "checkbox",
34
+ "radio",
35
+ "range",
36
+ "color",
37
+ "file",
38
+ "image",
39
+ "button",
40
+ "submit",
41
+ "reset"
42
+ ]);
43
+ function T(t) {
44
+ return t instanceof HTMLInputElement && !u.has(t.type) || t instanceof HTMLTextAreaElement || t instanceof HTMLElement && t.isContentEditable;
69
45
  }
70
- function L(t, e, o) {
71
- const c = t.style[e];
72
- return t.style[e] = o, () => {
73
- t.style[e] = c;
74
- };
46
+ function r(t) {
47
+ return typeof window < "u" && window.navigator != null ? t.test(window.navigator.platform) : void 0;
75
48
  }
76
- function l(t, e, o, c) {
77
- return t.addEventListener(e, o, c), () => {
78
- t.removeEventListener(e, o, c);
79
- };
49
+ function f() {
50
+ return r(/^Mac/);
80
51
  }
81
- function h(t) {
82
- const e = document.scrollingElement || document.documentElement;
83
- let o = t;
84
- for (; o && o !== e; ) {
85
- const c = y(o);
86
- if (c !== document.documentElement && c !== document.body && c !== o) {
87
- const i = c.getBoundingClientRect().top, u = o.getBoundingClientRect().top, a = o.getBoundingClientRect().bottom, f = c.getBoundingClientRect().bottom + C;
88
- a > f && (c.scrollTop += u - i);
89
- }
90
- o = c.parentElement;
91
- }
52
+ function c() {
53
+ return r(/^iPhone/);
54
+ }
55
+ function l() {
56
+ return r(/^iPad/) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
57
+ f() && navigator.maxTouchPoints > 1;
58
+ }
59
+ function M() {
60
+ return c() || l();
61
+ }
62
+ function g() {
63
+ const t = navigator.userAgent;
64
+ return typeof window < "u" && (/Firefox/.test(t) && /Mobile/.test(t) || /FxiOS/.test(t));
65
+ }
66
+ function m(t, n) {
67
+ typeof t == "function" ? t(n) : t != null && (t.current = n);
68
+ }
69
+ function x(...t) {
70
+ return (n) => t.forEach((e) => m(e, n));
92
71
  }
93
72
  export {
94
- H as usePreventScroll
73
+ x as composeRefs,
74
+ h as dampenValue,
75
+ w as getTranslate,
76
+ M as isIOS,
77
+ T as isInput,
78
+ g as isMobileFirefox,
79
+ p as reset,
80
+ d as set
95
81
  };
@@ -1,12 +1,95 @@
1
- const O = {
2
- DURATION: 0.5,
3
- EASE: [0.32, 0.72, 0, 1]
4
- }, S = 0.4, T = 0.25, E = 100, L = "drawer-dragging", n = 26;
1
+ import { useLayoutEffect as Y, useEffect as B } from "react";
2
+ import { isIOS as R, isInput as g } from "./bundle.es70.js";
3
+ const C = 24, F = typeof window < "u" ? Y : B;
4
+ function w(...t) {
5
+ return (...e) => {
6
+ for (const o of t)
7
+ typeof o == "function" && o(...e);
8
+ };
9
+ }
10
+ const m = typeof document < "u" ? window.visualViewport : null;
11
+ function E(t) {
12
+ const e = window.getComputedStyle(t);
13
+ return /(auto|scroll)/.test(e.overflow + e.overflowX + e.overflowY);
14
+ }
15
+ function y(t) {
16
+ for (E(t) && (t = t.parentElement); t && !E(t); )
17
+ t = t.parentElement;
18
+ return t || document.scrollingElement || document.documentElement;
19
+ }
20
+ let s = 0, v;
21
+ function H(t = {}) {
22
+ const { isDisabled: e } = t;
23
+ F(() => {
24
+ if (!e)
25
+ return s++, s === 1 && R() && (v = D()), () => {
26
+ s--, s === 0 && v?.();
27
+ };
28
+ }, [e]);
29
+ }
30
+ function D() {
31
+ let t, e = 0;
32
+ const o = (r) => {
33
+ t = y(r.target), !(t === document.documentElement && t === document.body) && (e = r.changedTouches[0].pageY);
34
+ }, c = (r) => {
35
+ if (!t || t === document.documentElement || t === document.body) {
36
+ r.preventDefault();
37
+ return;
38
+ }
39
+ const n = r.changedTouches[0].pageY, d = t.scrollTop, p = t.scrollHeight - t.clientHeight;
40
+ p !== 0 && ((d <= 0 && n > e || d >= p && n < e) && r.preventDefault(), e = n);
41
+ }, i = (r) => {
42
+ const n = r.target;
43
+ g(n) && n !== document.activeElement && (r.preventDefault(), n.style.transform = "translateY(-2000px)", n.focus(), requestAnimationFrame(() => {
44
+ n.style.transform = "";
45
+ }));
46
+ }, u = (r) => {
47
+ const n = r.target;
48
+ g(n) && (n.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
49
+ n.style.transform = "", m && (m.height < window.innerHeight ? requestAnimationFrame(() => {
50
+ h(n);
51
+ }) : m.addEventListener("resize", () => h(n), { once: !0 }));
52
+ }));
53
+ }, a = () => {
54
+ window.scrollTo(0, 0);
55
+ }, f = window.pageXOffset, b = window.pageYOffset, T = w(
56
+ L(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`)
57
+ );
58
+ window.scrollTo(0, 0);
59
+ const S = w(
60
+ l(document, "touchstart", o, { passive: !1, capture: !0 }),
61
+ l(document, "touchmove", c, { passive: !1, capture: !0 }),
62
+ l(document, "touchend", i, { passive: !1, capture: !0 }),
63
+ l(document, "focus", u, !0),
64
+ l(window, "scroll", a)
65
+ );
66
+ return () => {
67
+ T(), S(), window.scrollTo(f, b);
68
+ };
69
+ }
70
+ function L(t, e, o) {
71
+ const c = t.style[e];
72
+ return t.style[e] = o, () => {
73
+ t.style[e] = c;
74
+ };
75
+ }
76
+ function l(t, e, o, c) {
77
+ return t.addEventListener(e, o, c), () => {
78
+ t.removeEventListener(e, o, c);
79
+ };
80
+ }
81
+ function h(t) {
82
+ const e = document.scrollingElement || document.documentElement;
83
+ let o = t;
84
+ for (; o && o !== e; ) {
85
+ const c = y(o);
86
+ if (c !== document.documentElement && c !== document.body && c !== o) {
87
+ const i = c.getBoundingClientRect().top, u = o.getBoundingClientRect().top, a = o.getBoundingClientRect().bottom, f = c.getBoundingClientRect().bottom + C;
88
+ a > f && (c.scrollTop += u - i);
89
+ }
90
+ o = c.parentElement;
91
+ }
92
+ }
5
93
  export {
6
- T as CLOSE_THRESHOLD,
7
- L as DRAG_CLASS,
8
- E as SCROLL_LOCK_TIMEOUT,
9
- O as TRANSITIONS,
10
- S as VELOCITY_THRESHOLD,
11
- n as WINDOW_TOP_OFFSET
94
+ H as usePreventScroll
12
95
  };
@@ -1,72 +1,12 @@
1
- import { jsxs as D, jsx as t } from "react/jsx-runtime";
2
- import { dateToFormat as $, weeks as g, createVoids as p, getDayIndex as b, getFirstDay as u, getMonthMaxDay as k } from "./bundle.es65.js";
3
- import { CalendarHeader as F } from "./bundle.es82.js";
4
- import { useCalendar as j } from "./bundle.es83.js";
5
- import { attr as m } from "@companix/utils-browser";
6
- import { isSameDate as f } from "./bundle.es59.js";
7
- import { useLayoutEffect as I } from "react";
8
- const T = ({ disablePickers: c, value: e, onChange: i, ...l }) => {
9
- const {
10
- viewDate: n,
11
- setViewDate: r,
12
- setNextMonth: N,
13
- setPrevMonth: x,
14
- isMonthDisabled: M,
15
- isYearDisabled: v,
16
- isDayDisabled: w
17
- } = j(l);
18
- I(() => {
19
- e && r(e);
20
- }, [e]);
21
- const o = $(n), h = n.getMonth(), y = n.getFullYear(), C = /* @__PURE__ */ new Date();
22
- return /* @__PURE__ */ D("div", { className: "calendar", children: [
23
- /* @__PURE__ */ t(
24
- F,
25
- {
26
- viewDate: n,
27
- onChange: r,
28
- onNextMonth: N,
29
- onPrevMonth: x,
30
- disablePickers: c,
31
- isMonthDisabled: M,
32
- isYearDisabled: v
33
- }
34
- ),
35
- /* @__PURE__ */ t("div", { className: "calendar-names", children: g.map((d, a) => /* @__PURE__ */ t("div", { className: "calendar-name", children: d }, `week-name-${a}`)) }),
36
- /* @__PURE__ */ D("div", { className: "calendar-days", children: [
37
- p(b(u(o.month, o.year))).map((d, a) => /* @__PURE__ */ t("div", { className: "calendar-day", "data-void": !0 }, `void-${d}-${a}`)),
38
- p(k(o.month, o.year)).map((d, a) => {
39
- const s = new Date(y, h, a + 1);
40
- return /* @__PURE__ */ t(
41
- P,
42
- {
43
- day: a + 1,
44
- disabled: w(s),
45
- selected: !!(e && f(e, s)),
46
- today: f(s, C),
47
- onSelect: () => i?.(s)
48
- },
49
- `date-${d}-${y}-${h}-${a}`
50
- );
51
- })
52
- ] })
53
- ] });
54
- }, P = ({ day: c, disabled: e, selected: i, today: l, onSelect: n }) => {
55
- const r = () => {
56
- e || n?.();
57
- };
58
- return /* @__PURE__ */ t(
59
- "div",
60
- {
61
- className: "calendar-day",
62
- "data-disabled": m(e),
63
- "data-selected": m(i),
64
- "data-today": m(l),
65
- onClick: r,
66
- children: /* @__PURE__ */ t("span", { className: "calendar-day-number", children: c })
67
- }
68
- );
69
- };
1
+ const O = {
2
+ DURATION: 0.5,
3
+ EASE: [0.32, 0.72, 0, 1]
4
+ }, S = 0.4, T = 0.25, E = 100, L = "drawer-dragging", n = 26;
70
5
  export {
71
- T as Calendar
6
+ T as CLOSE_THRESHOLD,
7
+ L as DRAG_CLASS,
8
+ E as SCROLL_LOCK_TIMEOUT,
9
+ O as TRANSITIONS,
10
+ S as VELOCITY_THRESHOLD,
11
+ n as WINDOW_TOP_OFFSET
72
12
  };
@@ -1,14 +1,8 @@
1
- import { jsxs as a, Fragment as m, jsx as e } from "react/jsx-runtime";
2
- import { faXmark as i, faChevronDown as x } from "@companix/icons-solid";
3
- import { Icon as o } from "./bundle.es36.js";
4
- const d = (n) => {
5
- const { customElement: t, clearButton: c, clearButtonIcon: s, value: l, onClear: r } = n;
6
- return /* @__PURE__ */ a(m, { children: [
7
- t,
8
- c && l && /* @__PURE__ */ e("button", { className: "select-close-button", onClick: r, children: s ?? /* @__PURE__ */ e(o, { className: "select-close-icon", icon: i, size: "xxxs" }) }),
9
- /* @__PURE__ */ e(o, { className: "expand-icon select-expand", icon: x, size: "xxxs" })
10
- ] });
1
+ import { useState as r } from "react";
2
+ const t = () => {
3
+ const [, e] = r(/* @__PURE__ */ Symbol());
4
+ return () => e(/* @__PURE__ */ Symbol());
11
5
  };
12
6
  export {
13
- d as SelectRightElements
7
+ t as useRerender
14
8
  };
@@ -1,45 +1,72 @@
1
- import { DefaultMonths as f, getMonthMaxDay as i } from "./bundle.es65.js";
2
- import { useMemo as s } from "react";
3
- import { range as l } from "@companix/utils-js";
4
- const p = { day: 31, month: 12, year: 2050 }, u = { day: 1, month: 1, year: 1900 }, I = ({ min: t = u, max: e = p, now: r }) => {
5
- const h = s(() => l(e.year, t.year).map((n) => ({
6
- title: n.toString(),
7
- value: n
8
- })), [e.year, t.year]), d = s(() => {
9
- const n = f.map((o, a) => ({
10
- title: o,
11
- value: a + 1
12
- }));
13
- if (t.month && r.year === t.year) {
14
- const o = n.findIndex(({ value: a }) => a === t.month);
15
- n.splice(0, o);
1
+ import { jsxs as D, jsx as t } from "react/jsx-runtime";
2
+ import { dateToFormat as $, weeks as g, createVoids as p, getDayIndex as b, getFirstDay as u, getMonthMaxDay as k } from "./bundle.es66.js";
3
+ import { CalendarHeader as F } from "./bundle.es83.js";
4
+ import { useCalendar as j } from "./bundle.es84.js";
5
+ import { attr as m } from "@companix/utils-browser";
6
+ import { isSameDate as f } from "./bundle.es60.js";
7
+ import { useLayoutEffect as I } from "react";
8
+ const T = ({ disablePickers: c, value: e, onChange: i, ...l }) => {
9
+ const {
10
+ viewDate: n,
11
+ setViewDate: r,
12
+ setNextMonth: N,
13
+ setPrevMonth: x,
14
+ isMonthDisabled: M,
15
+ isYearDisabled: v,
16
+ isDayDisabled: w
17
+ } = j(l);
18
+ I(() => {
19
+ e && r(e);
20
+ }, [e]);
21
+ const o = $(n), h = n.getMonth(), y = n.getFullYear(), C = /* @__PURE__ */ new Date();
22
+ return /* @__PURE__ */ D("div", { className: "calendar", children: [
23
+ /* @__PURE__ */ t(
24
+ F,
25
+ {
26
+ viewDate: n,
27
+ onChange: r,
28
+ onNextMonth: N,
29
+ onPrevMonth: x,
30
+ disablePickers: c,
31
+ isMonthDisabled: M,
32
+ isYearDisabled: v
33
+ }
34
+ ),
35
+ /* @__PURE__ */ t("div", { className: "calendar-names", children: g.map((d, a) => /* @__PURE__ */ t("div", { className: "calendar-name", children: d }, `week-name-${a}`)) }),
36
+ /* @__PURE__ */ D("div", { className: "calendar-days", children: [
37
+ p(b(u(o.month, o.year))).map((d, a) => /* @__PURE__ */ t("div", { className: "calendar-day", "data-void": !0 }, `void-${d}-${a}`)),
38
+ p(k(o.month, o.year)).map((d, a) => {
39
+ const s = new Date(y, h, a + 1);
40
+ return /* @__PURE__ */ t(
41
+ P,
42
+ {
43
+ day: a + 1,
44
+ disabled: w(s),
45
+ selected: !!(e && f(e, s)),
46
+ today: f(s, C),
47
+ onSelect: () => i?.(s)
48
+ },
49
+ `date-${d}-${y}-${h}-${a}`
50
+ );
51
+ })
52
+ ] })
53
+ ] });
54
+ }, P = ({ day: c, disabled: e, selected: i, today: l, onSelect: n }) => {
55
+ const r = () => {
56
+ e || n?.();
57
+ };
58
+ return /* @__PURE__ */ t(
59
+ "div",
60
+ {
61
+ className: "calendar-day",
62
+ "data-disabled": m(e),
63
+ "data-selected": m(i),
64
+ "data-today": m(l),
65
+ onClick: r,
66
+ children: /* @__PURE__ */ t("span", { className: "calendar-day-number", children: c })
16
67
  }
17
- if (e.month && r.year === e.year) {
18
- const o = n.findIndex(({ value: a }) => a === e.month);
19
- n.splice(o + 1, n.length);
20
- }
21
- return n;
22
- }, [r.year, t.year, t.month, e.year, e.month]), c = s(() => {
23
- if (r.month === 0)
24
- return [];
25
- const n = i(r.month, r.year), o = Array.from({ length: n }, (a, y) => ({
26
- title: `${y + 1}`,
27
- value: y + 1
28
- }));
29
- if (t.day && r.month === t.month && r.year === t.year) {
30
- const a = o.findIndex(({ value: y }) => y === t.day);
31
- o.splice(0, a);
32
- }
33
- if (e.day && r.month === e.month && r.year === e.year) {
34
- const a = o.findIndex(({ value: y }) => y === e.day);
35
- o.splice(a + 1, o.length);
36
- }
37
- return o;
38
- }, [r.month, r.year, t, e]);
39
- return { years: h, months: d, days: c };
68
+ );
40
69
  };
41
70
  export {
42
- p as defaultMax,
43
- u as defaultMin,
44
- I as useCalendarOptions
71
+ T as Calendar
45
72
  };
@@ -1,35 +1,14 @@
1
- import { jsxs as E, jsx as c } from "react/jsx-runtime";
2
- import { useRef as p, useState as v, useLayoutEffect as N, useEffect as y } from "react";
3
- import { Editor as R } from "./bundle.es42.js";
4
- const k = (d) => {
5
- const {
6
- id: e,
7
- className: f,
8
- inputClassName: i,
9
- placeholderClassName: m,
10
- placeholder: r,
11
- value: s,
12
- inputMode: n,
13
- onCreate: b,
14
- onClick: A
15
- } = d, u = p(null), o = p(null), [h, a] = v(!0);
16
- return N(() => {
17
- const t = document.createElement("span");
18
- t.setAttribute("contenteditable", "true"), t.setAttribute("class", i), t.dataset.placeholder = r, e && t.setAttribute("id", e), n && t.setAttribute("inputmode", n), u.current && u.current.appendChild(t);
19
- const l = new R(t), C = l.onContentChange((x) => {
20
- a(x.length === 0);
21
- });
22
- return b(l), o.current = t, () => {
23
- C(), o.current = null, t.remove();
24
- };
25
- }, []), y(() => {
26
- const t = o.current;
27
- t && (e && t.setAttribute("id", e), n && t.setAttribute("inputmode", n), s && (t.textContent = s, a(!1)), t.setAttribute("class", i), t.setAttribute("role", "textbox"), t.setAttribute("aria-multiline", "true"), r && t.setAttribute("aria-label", r));
28
- }, [e, i, n, r, s]), /* @__PURE__ */ E("div", { role: "presentation", className: f, children: [
29
- h && /* @__PURE__ */ c("span", { "aria-hidden": "true", className: m, children: r }),
30
- /* @__PURE__ */ c("div", { role: "presentation", ref: u, onClick: A })
1
+ import { jsxs as a, Fragment as m, jsx as e } from "react/jsx-runtime";
2
+ import { faXmark as i, faChevronDown as x } from "@companix/icons-solid";
3
+ import { Icon as o } from "./bundle.es36.js";
4
+ const d = (n) => {
5
+ const { customElement: t, clearButton: c, clearButtonIcon: s, value: l, onClear: r } = n;
6
+ return /* @__PURE__ */ a(m, { children: [
7
+ t,
8
+ c && l && /* @__PURE__ */ e("button", { className: "select-close-button", onClick: r, children: s ?? /* @__PURE__ */ e(o, { className: "select-close-icon", icon: i, size: "xxxs" }) }),
9
+ /* @__PURE__ */ e(o, { className: "expand-icon select-expand", icon: x, size: "xxxs" })
31
10
  ] });
32
11
  };
33
12
  export {
34
- k as WriteBarInput
13
+ d as SelectRightElements
35
14
  };