@caseparts-org/caseblocks 0.0.114 → 0.0.116

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.
@@ -1 +1 @@
1
- ._overlay_vmpn5_1{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#00000080;display:flex;align-items:center;justify-content:center;z-index:1000}._container_vmpn5_11{background-color:var(--surface-surface-primary);color:var(--text-text-primary);border-radius:var(--border-radius-sm);box-shadow:0 4px 6px #0000001a;width:min(800px,92vw);max-height:80vh;display:flex;flex-direction:column;overflow:hidden}@media (max-width:767px){._container_vmpn5_11{border-radius:0;width:100%;box-shadow:none;height:100dvh;max-height:100dvh}}._header_vmpn5_30{position:sticky;top:0;display:flex;flex-direction:row;align-items:center;justify-content:space-between;background-color:var(--surface-surface-secondary);border-bottom:1px solid var(--border-border-secondary-btn);padding:var(--spacing-spacing-2xs);z-index:1}._closeButton_vmpn5_53{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;background:transparent;padding:var(--spacing-spacing-4xs);cursor:pointer;display:flex;align-items:center;justify-content:center;color:inherit;padding:0}._content_vmpn5_69{overflow:auto;padding:var(--spacing-spacing-default)}@media (max-width:767px){._content_vmpn5_69{padding:var(--spacing-spacing-2xs)}}._headerPlain_vmpn5_77{background-color:transparent;border-bottom:none}
1
+ ._overlay_1du2l_1{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#00000080;display:flex;align-items:center;justify-content:center;z-index:1000}._container_1du2l_11{background-color:var(--surface-surface-primary);color:var(--text-text-primary);border-radius:var(--border-radius-sm);box-shadow:0 4px 6px #0000001a;width:min(800px,92vw);max-height:80vh;display:flex;flex-direction:column;overflow:hidden}@media (max-width:767px){._container_1du2l_11{border-radius:0;width:100%;box-shadow:none;height:100dvh;max-height:100dvh}}._header_1du2l_30{position:sticky;top:0;display:flex;flex-direction:row;align-items:center;justify-content:space-between;background-color:var(--surface-surface-secondary);border-bottom:1px solid var(--border-border-secondary-btn);padding:var(--spacing-spacing-2xs);z-index:1}._closeButton_1du2l_43{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;background:transparent;padding:var(--spacing-spacing-4xs);cursor:pointer;display:flex;align-items:center;justify-content:center;color:inherit;padding:0}._content_1du2l_56{overflow:auto;padding:var(--spacing-spacing-default)}@media (max-width:767px){._content_1du2l_56{padding:var(--spacing-spacing-2xs)}}._headerPlain_1du2l_64{background-color:transparent;border-bottom:none}
@@ -1,15 +1,14 @@
1
1
  import * as React from "react";
2
- type PositionKeyword = "top" | "right" | "bottom" | "left";
3
- type Position = "top left" | "top center" | "top right" | "right top" | "right center" | "right bottom" | "bottom left" | "bottom center" | "bottom right" | "left top" | "left center" | "left bottom" | PositionKeyword;
4
- type PopoverAPI = {
2
+ export type PopoverAPI = {
5
3
  close: () => void;
6
4
  open: () => void;
7
5
  toggle: () => void;
8
6
  };
9
- export declare function usePopover(): PopoverAPI;
7
+ type PositionKeyword = "top" | "right" | "bottom" | "left";
8
+ type Position = "top left" | "top center" | "top right" | "right top" | "right center" | "right bottom" | "bottom left" | "bottom center" | "bottom right" | "left top" | "left center" | "left bottom" | PositionKeyword;
10
9
  export type PopoverProps = {
11
10
  trigger: React.ReactElement;
12
- children: React.ReactNode | ((api: PopoverAPI) => React.ReactNode);
11
+ children: React.ReactNode | ((_api: PopoverAPI) => React.ReactNode);
13
12
  position?: Position;
14
13
  popoverClassName?: string;
15
14
  contentClassName?: string;
@@ -1,85 +1,79 @@
1
- import { jsxs as H, jsx as k } from "react/jsx-runtime";
2
- import * as s from "react";
1
+ import { jsxs as F, Fragment as H, jsx as k } from "react/jsx-runtime";
2
+ import * as f from "react";
3
3
  import { r as N } from "../../index-B4KbmMH3.js";
4
4
  import { c as z } from "../../clsx-OuTLNxxd.js";
5
- import '../../assets/Popover.css';const W = "_popover_vlr81_1", q = "_content_vlr81_7", M = {
5
+ import '../../assets/Popover.css';const W = "_popover_vlr81_1", q = "_content_vlr81_7", P = {
6
6
  popover: W,
7
7
  content: q
8
- }, S = s.createContext(null);
9
- function K() {
10
- const o = s.useContext(S);
11
- if (!o)
12
- throw new Error("usePopover must be used within a Popover");
13
- return o;
14
- }
15
- function D(o) {
16
- return o ? o.includes(" ") ? o : `${o} center` : "top center";
8
+ };
9
+ function D(r) {
10
+ return r ? r.includes(" ") ? r : `${r} center` : "top center";
17
11
  }
18
- function F(o) {
19
- const p = D(o).toLowerCase(), [c, l] = p.split(" ");
20
- return { side: ["top", "right", "bottom", "left"].includes(c) ? c : "top", align: l === "left" || l === "top" ? "start" : l === "right" || l === "bottom" ? "end" : "center" };
12
+ function U(r) {
13
+ const d = D(r).toLowerCase(), [s, c] = d.split(" ");
14
+ return { side: ["top", "right", "bottom", "left"].includes(s) ? s : "top", align: c === "left" || c === "top" ? "start" : c === "right" || c === "bottom" ? "end" : "center" };
21
15
  }
22
- function U(o, p, c, l, d = 8) {
23
- const n = o.getBoundingClientRect(), u = p.getBoundingClientRect();
24
- let a = 0, f = 0;
25
- c === "top" ? a = n.top - u.height - d : c === "bottom" ? a = n.bottom + d : c === "left" ? f = n.left - u.width - d : c === "right" && (f = n.right + d), c === "top" || c === "bottom" ? l === "start" ? f = n.left : l === "end" ? f = n.right - u.width : f = n.left + n.width / 2 - u.width / 2 : l === "start" ? a = n.top : l === "end" ? a = n.bottom - u.height : a = n.top + n.height / 2 - u.height / 2;
16
+ function $(r, d, s, c, p = 8) {
17
+ const n = r.getBoundingClientRect(), l = d.getBoundingClientRect();
18
+ let a = 0, u = 0;
19
+ s === "top" ? a = n.top - l.height - p : s === "bottom" ? a = n.bottom + p : s === "left" ? u = n.left - l.width - p : s === "right" && (u = n.right + p), s === "top" || s === "bottom" ? c === "start" ? u = n.left : c === "end" ? u = n.right - l.width : u = n.left + n.width / 2 - l.width / 2 : c === "start" ? a = n.top : c === "end" ? a = n.bottom - l.height : a = n.top + n.height / 2 - l.height / 2;
26
20
  const w = window.innerWidth, h = window.innerHeight;
27
- return a = Math.max(4, Math.min(h - u.height - 4, a)), f = Math.max(4, Math.min(w - u.width - 4, f)), { top: a, left: f };
21
+ return a = Math.max(4, Math.min(h - l.height - 4, a)), u = Math.max(4, Math.min(w - l.width - 4, u)), { top: a, left: u };
28
22
  }
29
- const Q = ({
30
- trigger: o,
31
- children: p,
32
- position: c,
33
- popoverClassName: l,
34
- contentClassName: d,
23
+ const K = ({
24
+ trigger: r,
25
+ children: d,
26
+ position: s,
27
+ popoverClassName: c,
28
+ contentClassName: p,
35
29
  disabled: n,
36
- closeOnOutsideClick: u = !0,
30
+ closeOnOutsideClick: l = !0,
37
31
  closeOnInsideClickAttr: a = !0,
38
- open: f,
32
+ open: u,
39
33
  onOpenChange: w
40
34
  }) => {
41
- const { side: h, align: y } = F(c), [C, j] = s.useState(!1), P = typeof f == "boolean", r = P ? f : C, [v, R] = s.useState(null), b = s.useRef(null), m = s.useRef(null), x = (t) => {
42
- const e = typeof t == "function" ? t(r) : t;
43
- P ? w == null || w(e) : j(e);
44
- }, L = () => {
45
- n || x((t) => !t);
46
- }, E = () => x(!1), _ = () => x(!0), B = s.cloneElement(o, {
35
+ const { side: h, align: y } = U(s), [M, S] = f.useState(!1), x = typeof u == "boolean", o = x ? u : M, [m, R] = f.useState(null), b = f.useRef(null), v = f.useRef(null), L = (t) => {
36
+ const e = typeof t == "function" ? t(o) : t;
37
+ x ? w == null || w(e) : S(e);
38
+ }, _ = () => {
39
+ n || L((t) => !t);
40
+ }, E = () => L(!1), j = () => L(!0), B = f.cloneElement(r, {
47
41
  ref: (t) => {
48
- const { ref: e } = o;
42
+ const { ref: e } = r;
49
43
  typeof e == "function" ? e(t) : e && (e.current = t), b.current = t;
50
44
  },
51
45
  onClick: (t) => {
52
46
  var e, i;
53
- (i = (e = o.props).onClick) == null || i.call(e, t), L();
47
+ (i = (e = r.props).onClick) == null || i.call(e, t), _();
54
48
  },
55
49
  "aria-haspopup": "dialog",
56
- "aria-expanded": r || void 0,
57
- "aria-controls": r ? "popover-panel" : void 0,
58
- style: { ...o.props.style || {}, outline: "none" }
50
+ "aria-expanded": o || void 0,
51
+ "aria-controls": o ? "popover-panel" : void 0,
52
+ style: { ...r.props.style || {}, outline: "none" }
59
53
  });
60
- return s.useLayoutEffect(() => {
61
- if (!r) {
54
+ return f.useLayoutEffect(() => {
55
+ if (!o) {
62
56
  R(null);
63
57
  return;
64
58
  }
65
- const t = b.current, e = m.current;
59
+ const t = b.current, e = v.current;
66
60
  if (!t || !e) return;
67
61
  const i = () => {
68
- R(U(t, e, h, y, 8));
62
+ R($(t, e, h, y, 8));
69
63
  };
70
64
  return i(), window.addEventListener("resize", i), window.addEventListener("scroll", i, !0), () => {
71
65
  window.removeEventListener("resize", i), window.removeEventListener("scroll", i, !0);
72
66
  };
73
- }, [r, h, y, p]), s.useEffect(() => {
74
- if (!r || !u) return;
67
+ }, [o, h, y, d]), f.useEffect(() => {
68
+ if (!o || !l) return;
75
69
  const t = (e) => {
76
- const i = m.current, g = b.current;
70
+ const i = v.current, g = b.current;
77
71
  !i || !g || i.contains(e.target) || g.contains(e.target) || E();
78
72
  };
79
73
  return window.addEventListener("mousedown", t), () => window.removeEventListener("mousedown", t);
80
- }, [r, u]), s.useEffect(() => {
81
- if (!r || !a) return;
82
- const t = m.current;
74
+ }, [o, l]), f.useEffect(() => {
75
+ if (!o || !a) return;
76
+ const t = v.current;
83
77
  if (!t) return;
84
78
  const e = (i) => {
85
79
  const g = i.target;
@@ -87,40 +81,40 @@ const Q = ({
87
81
  g.closest('[data-popover-close="true"]') && E();
88
82
  };
89
83
  return t.addEventListener("click", e), () => t.removeEventListener("click", e);
90
- }, [r, a]), s.useEffect(() => {
91
- if (!r) return;
84
+ }, [o, a]), f.useEffect(() => {
85
+ if (!o) return;
92
86
  const t = (e) => {
93
87
  e.key === "Escape" && E();
94
88
  };
95
89
  return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
96
- }, [r]), s.useEffect(() => {
97
- if (r && m.current) {
98
- const t = m.current.querySelector(
90
+ }, [o]), f.useEffect(() => {
91
+ if (o && v.current) {
92
+ const t = v.current.querySelector(
99
93
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
100
94
  );
101
95
  t == null || t.focus();
102
96
  }
103
- }, [r]), /* @__PURE__ */ H(S.Provider, { value: { close: E, open: _, toggle: L }, children: [
97
+ }, [o]), /* @__PURE__ */ F(H, { children: [
104
98
  B,
105
- r && typeof document < "u" && N.createPortal(
99
+ o && typeof document < "u" && N.createPortal(
106
100
  /* @__PURE__ */ k(
107
101
  "div",
108
102
  {
109
103
  id: "popover-panel",
110
- ref: m,
104
+ ref: v,
111
105
  role: "dialog",
112
106
  "aria-modal": "false",
113
- className: z(M.popover, l),
107
+ className: z(P.popover, c),
114
108
  "data-side": h,
115
109
  "data-align": y,
116
110
  style: {
117
111
  position: "absolute",
118
- top: (v == null ? void 0 : v.top) ?? 0,
119
- left: (v == null ? void 0 : v.left) ?? 0,
120
- visibility: v ? "visible" : "hidden",
112
+ top: (m == null ? void 0 : m.top) ?? 0,
113
+ left: (m == null ? void 0 : m.left) ?? 0,
114
+ visibility: m ? "visible" : "hidden",
121
115
  zIndex: 20
122
116
  },
123
- children: /* @__PURE__ */ k("div", { className: z(M.content, d), children: typeof p == "function" ? p({ close: E, open: _, toggle: L }) : p })
117
+ children: /* @__PURE__ */ k("div", { className: z(P.content, p), children: typeof d == "function" ? d({ close: E, open: j, toggle: _ }) : d })
124
118
  }
125
119
  ),
126
120
  document.body
@@ -128,6 +122,5 @@ const Q = ({
128
122
  ] });
129
123
  };
130
124
  export {
131
- Q as Popover,
132
- K as usePopover
125
+ K as Popover
133
126
  };
@@ -1,13 +1,12 @@
1
- import { jsx as n, jsxs as s } from "react/jsx-runtime";
2
- import { c as t } from "../../clsx-OuTLNxxd.js";
3
- import { Text as h } from "../../atoms/Text/Text.js";
4
- import { Icon as f } from "../../atoms/Icon/Icon.js";
5
- import '../../assets/Modal.css';const y = "_overlay_vmpn5_1", g = "_container_vmpn5_11", x = "_header_vmpn5_30", N = "_closeButton_vmpn5_53", S = "_captionSpacer_vmpn5_66", T = "_content_vmpn5_69", k = "_headerPlain_vmpn5_77", e = {
1
+ import { jsx as a, jsxs as s } from "react/jsx-runtime";
2
+ import { c as n } from "../../clsx-OuTLNxxd.js";
3
+ import { Text as v } from "../../atoms/Text/Text.js";
4
+ import { Icon as p } from "../../atoms/Icon/Icon.js";
5
+ import '../../assets/Modal.css';const y = "_overlay_1du2l_1", g = "_container_1du2l_11", x = "_header_1du2l_30", N = "_closeButton_1du2l_43", T = "_content_1du2l_56", k = "_headerPlain_1du2l_64", e = {
6
6
  overlay: y,
7
7
  container: g,
8
8
  header: x,
9
9
  closeButton: N,
10
- captionSpacer: S,
11
10
  content: T,
12
11
  headerPlain: k
13
12
  }, z = {
@@ -19,57 +18,57 @@ import '../../assets/Modal.css';const y = "_overlay_vmpn5_1", g = "_container_vm
19
18
  md: "md",
20
19
  lg: "md"
21
20
  };
22
- function I({
21
+ function j({
23
22
  isOpen: i,
24
23
  caption: o,
25
- onClose: c,
26
- closeOnOverlayClick: m = !0,
27
- headerSize: a = "md",
24
+ onClose: l,
25
+ closeOnOverlayClick: d = !0,
26
+ headerSize: t = "md",
28
27
  headerVariant: r = "default",
29
- className: d,
30
- children: p,
28
+ className: m,
29
+ children: u,
31
30
  ..._
32
31
  }) {
33
32
  if (!i) return null;
34
- const v = (l) => {
35
- m && l.target === l.currentTarget && c();
36
- }, u = r === "default" && !!o;
37
- return /* @__PURE__ */ n("div", { className: t(e.overlay), onClick: v, children: /* @__PURE__ */ s("div", { className: t(e.container, d), role: "dialog", "aria-modal": "true", ..._, children: [
33
+ const h = (c) => {
34
+ d && c.target === c.currentTarget && l();
35
+ }, f = r === "default" && !!o;
36
+ return /* @__PURE__ */ a("div", { className: n(e.overlay), onClick: h, children: /* @__PURE__ */ s("div", { className: n(e.container, m), role: "dialog", "aria-modal": "true", ..._, children: [
38
37
  /* @__PURE__ */ s(
39
38
  "div",
40
39
  {
41
- className: t(
40
+ className: n(
42
41
  e.header,
43
- e[`header-${a}`],
42
+ e[`header-${t}`],
44
43
  r === "plain" && e.headerPlain
45
44
  ),
46
45
  children: [
47
- u ? /* @__PURE__ */ n(
48
- h,
46
+ f ? /* @__PURE__ */ a(
47
+ v,
49
48
  {
50
49
  as: "div",
51
- size: z[a],
50
+ size: z[t],
52
51
  variant: "display",
53
52
  className: e.caption,
54
53
  children: o
55
54
  }
56
- ) : /* @__PURE__ */ n("div", { className: e.captionSpacer }),
57
- /* @__PURE__ */ n(
55
+ ) : /* @__PURE__ */ a("div", { className: e.captionSpacer }),
56
+ /* @__PURE__ */ a(
58
57
  "button",
59
58
  {
60
59
  type: "button",
61
60
  className: e.closeButton,
62
61
  "aria-label": "Close",
63
- onClick: c,
64
- children: /* @__PURE__ */ n(f, { iconKey: "fa-regular fa-xmark", size: B[a] })
62
+ onClick: l,
63
+ children: /* @__PURE__ */ a(p, { iconKey: "fa-regular fa-xmark", size: B[t] })
65
64
  }
66
65
  )
67
66
  ]
68
67
  }
69
68
  ),
70
- /* @__PURE__ */ n("div", { className: e.content, children: p })
69
+ /* @__PURE__ */ a("div", { className: e.content, children: u })
71
70
  ] }) });
72
71
  }
73
72
  export {
74
- I as Modal
73
+ j as Modal
75
74
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.114",
4
+ "version": "0.0.116",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",