@caseparts-org/caseblocks 0.0.115 → 0.0.117

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,5 +1,9 @@
1
- import { PopoverAPI } from './usePopover';
2
1
  import * as React from "react";
2
+ export type PopoverAPI = {
3
+ close: () => void;
4
+ open: () => void;
5
+ toggle: () => void;
6
+ };
3
7
  type PositionKeyword = "top" | "right" | "bottom" | "left";
4
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;
5
9
  export type PopoverProps = {
@@ -1,103 +1,102 @@
1
- import { jsxs as H, jsx as k } from "react/jsx-runtime";
1
+ import { jsxs as F, Fragment as H, jsx as k } from "react/jsx-runtime";
2
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 { PopoverContext as W } from "./usePopover.js";
6
- import '../../assets/Popover.css';const q = "_popover_vlr81_1", C = "_content_vlr81_7", M = {
7
- popover: q,
8
- content: C
5
+ import '../../assets/Popover.css';const W = "_popover_vlr81_1", q = "_content_vlr81_7", P = {
6
+ popover: W,
7
+ content: q
9
8
  };
10
9
  function D(r) {
11
10
  return r ? r.includes(" ") ? r : `${r} center` : "top center";
12
11
  }
13
- function F(r) {
12
+ function T(r) {
14
13
  const d = D(r).toLowerCase(), [s, c] = d.split(" ");
15
14
  return { side: ["top", "right", "bottom", "left"].includes(s) ? s : "top", align: c === "left" || c === "top" ? "start" : c === "right" || c === "bottom" ? "end" : "center" };
16
15
  }
17
16
  function U(r, d, s, c, p = 8) {
18
- const o = r.getBoundingClientRect(), l = d.getBoundingClientRect();
17
+ const n = r.getBoundingClientRect(), l = d.getBoundingClientRect();
19
18
  let a = 0, u = 0;
20
- s === "top" ? a = o.top - l.height - p : s === "bottom" ? a = o.bottom + p : s === "left" ? u = o.left - l.width - p : s === "right" && (u = o.right + p), s === "top" || s === "bottom" ? c === "start" ? u = o.left : c === "end" ? u = o.right - l.width : u = o.left + o.width / 2 - l.width / 2 : c === "start" ? a = o.top : c === "end" ? a = o.bottom - l.height : a = o.top + o.height / 2 - l.height / 2;
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;
21
20
  const w = window.innerWidth, h = window.innerHeight;
22
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 };
23
22
  }
24
- const Q = ({
23
+ const J = ({
25
24
  trigger: r,
26
25
  children: d,
27
26
  position: s,
28
27
  popoverClassName: c,
29
28
  contentClassName: p,
30
- disabled: o,
29
+ disabled: n,
31
30
  closeOnOutsideClick: l = !0,
32
31
  closeOnInsideClickAttr: a = !0,
33
32
  open: u,
34
33
  onOpenChange: w
35
34
  }) => {
36
- const { side: h, align: y } = F(s), [S, j] = f.useState(!1), R = typeof u == "boolean", n = R ? u : S, [m, P] = f.useState(null), b = f.useRef(null), v = f.useRef(null), L = (t) => {
37
- const e = typeof t == "function" ? t(n) : t;
38
- R ? w == null || w(e) : j(e);
39
- }, x = () => {
40
- o || L((t) => !t);
41
- }, E = () => L(!1), _ = () => L(!0), B = f.cloneElement(r, {
35
+ const { side: h, align: y } = T(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, {
42
41
  ref: (t) => {
43
42
  const { ref: e } = r;
44
43
  typeof e == "function" ? e(t) : e && (e.current = t), b.current = t;
45
44
  },
46
45
  onClick: (t) => {
47
46
  var e, i;
48
- (i = (e = r.props).onClick) == null || i.call(e, t), x();
47
+ (i = (e = r.props).onClick) == null || i.call(e, t), _();
49
48
  },
50
49
  "aria-haspopup": "dialog",
51
- "aria-expanded": n || void 0,
52
- "aria-controls": n ? "popover-panel" : void 0,
50
+ "aria-expanded": o || void 0,
51
+ "aria-controls": o ? "popover-panel" : void 0,
53
52
  style: { ...r.props.style || {}, outline: "none" }
54
53
  });
55
54
  return f.useLayoutEffect(() => {
56
- if (!n) {
57
- P(null);
55
+ if (!o) {
56
+ R(null);
58
57
  return;
59
58
  }
60
59
  const t = b.current, e = v.current;
61
60
  if (!t || !e) return;
62
61
  const i = () => {
63
- P(U(t, e, h, y, 8));
62
+ R(U(t, e, h, y, 8));
64
63
  };
65
64
  return i(), window.addEventListener("resize", i), window.addEventListener("scroll", i, !0), () => {
66
65
  window.removeEventListener("resize", i), window.removeEventListener("scroll", i, !0);
67
66
  };
68
- }, [n, h, y, d]), f.useEffect(() => {
69
- if (!n || !l) return;
67
+ }, [o, h, y, d]), f.useEffect(() => {
68
+ if (!o || !l) return;
70
69
  const t = (e) => {
71
70
  const i = v.current, g = b.current;
72
71
  !i || !g || i.contains(e.target) || g.contains(e.target) || E();
73
72
  };
74
73
  return window.addEventListener("mousedown", t), () => window.removeEventListener("mousedown", t);
75
- }, [n, l]), f.useEffect(() => {
76
- if (!n || !a) return;
74
+ }, [o, l]), f.useEffect(() => {
75
+ if (!o || !a) return;
77
76
  const t = v.current;
78
77
  if (!t) return;
79
78
  const e = (i) => {
80
79
  const g = i.target;
81
80
  if (!g) return;
82
- g.closest('[data-popover-close="true"]') && E();
81
+ g.closest('[data-popover-close="true"]') && setTimeout(() => E(), 0);
83
82
  };
84
83
  return t.addEventListener("click", e), () => t.removeEventListener("click", e);
85
- }, [n, a]), f.useEffect(() => {
86
- if (!n) return;
84
+ }, [o, a]), f.useEffect(() => {
85
+ if (!o) return;
87
86
  const t = (e) => {
88
87
  e.key === "Escape" && E();
89
88
  };
90
89
  return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
91
- }, [n]), f.useEffect(() => {
92
- if (n && v.current) {
90
+ }, [o]), f.useEffect(() => {
91
+ if (o && v.current) {
93
92
  const t = v.current.querySelector(
94
93
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
95
94
  );
96
95
  t == null || t.focus();
97
96
  }
98
- }, [n]), /* @__PURE__ */ H(W.Provider, { value: { close: E, open: _, toggle: x }, children: [
97
+ }, [o]), /* @__PURE__ */ F(H, { children: [
99
98
  B,
100
- n && typeof document < "u" && N.createPortal(
99
+ o && typeof document < "u" && N.createPortal(
101
100
  /* @__PURE__ */ k(
102
101
  "div",
103
102
  {
@@ -105,7 +104,7 @@ const Q = ({
105
104
  ref: v,
106
105
  role: "dialog",
107
106
  "aria-modal": "false",
108
- className: z(M.popover, c),
107
+ className: z(P.popover, c),
109
108
  "data-side": h,
110
109
  "data-align": y,
111
110
  style: {
@@ -115,7 +114,7 @@ const Q = ({
115
114
  visibility: m ? "visible" : "hidden",
116
115
  zIndex: 20
117
116
  },
118
- children: /* @__PURE__ */ k("div", { className: z(M.content, p), children: typeof d == "function" ? d({ close: E, open: _, toggle: x }) : d })
117
+ children: /* @__PURE__ */ k("div", { className: z(P.content, p), children: typeof d == "function" ? d({ close: E, open: j, toggle: _ }) : d })
119
118
  }
120
119
  ),
121
120
  document.body
@@ -123,5 +122,5 @@ const Q = ({
123
122
  ] });
124
123
  };
125
124
  export {
126
- Q as Popover
125
+ J as Popover
127
126
  };
@@ -6,8 +6,6 @@ export type { SlideInPanelProps } from './atoms/SlideInPanel/SlideInPanel';
6
6
  export { Tooltip } from './atoms/Tooltip/Tooltip';
7
7
  export { Popover } from './atoms/Popover/Popover';
8
8
  export type { PopoverProps } from './atoms/Popover/Popover';
9
- export { usePopover } from './atoms/Popover/usePopover';
10
- export type { PopoverAPI } from './atoms/Popover/usePopover';
11
9
  export { Account } from './molecules/Account/Account';
12
10
  export type { AccountProps } from './molecules/Account/Account';
13
11
  export { Chip } from './molecules/Chip/Chip';
@@ -6,10 +6,10 @@ import { Icon as l } from "./atoms/Icon/Icon.js";
6
6
  import { Root as d } from "./atoms/Root/Root.js";
7
7
  import { Separator as C } from "./atoms/Separator/Separator.js";
8
8
  import { Text as k } from "./atoms/Text/Text.js";
9
- import { Input as v } from "./atoms/Input/Input.js";
10
- import { Link as I } from "./atoms/Link/Link.js";
11
- import { linkClassName as s } from "./atoms/Link/linkClassName.js";
12
- import { configureLink as L, routerOverride as h } from "./atoms/Link/configureLink.js";
9
+ import { Input as B } from "./atoms/Input/Input.js";
10
+ import { Link as v } from "./atoms/Link/Link.js";
11
+ import { linkClassName as L } from "./atoms/Link/linkClassName.js";
12
+ import { configureLink as h, routerOverride as s } from "./atoms/Link/configureLink.js";
13
13
  import { LinkButton as F } from "./atoms/LinkButton/LinkButton.js";
14
14
  import { configureImage as N } from "./atoms/Image/configureImage.js";
15
15
  import { Logo as y } from "./molecules/Logo/Logo.js";
@@ -26,63 +26,61 @@ import { HorizontalScroll as _ } from "./atoms/HorizontalScroll/HorizontalScroll
26
26
  import { SlideInPanel as oo } from "./atoms/SlideInPanel/SlideInPanel.js";
27
27
  import { Tooltip as eo } from "./atoms/Tooltip/Tooltip.js";
28
28
  import { Popover as po } from "./atoms/Popover/Popover.js";
29
- import { usePopover as fo } from "./atoms/Popover/usePopover.js";
30
- import { Account as ao } from "./molecules/Account/Account.js";
31
- import { Chip as io } from "./molecules/Chip/Chip.js";
32
- import { ToggleView as uo } from "./molecules/ToggleView/ToggleView.js";
33
- import { CartSlideInPanel as Co } from "./molecules/Cart/CartSlideInPanel.js";
34
- import { StatefulButton as ko } from "./molecules/StatefulButton/StatefulButton.js";
35
- import { AnimatedCheckMark as vo } from "./molecules/StatefulButton/AnimatedCheckmark.js";
36
- import { AddToCart as Io } from "./molecules/AddToCart/AddToCart.js";
37
- import { Modal as so } from "./molecules/Modal/Modal.js";
29
+ import { Account as fo } from "./molecules/Account/Account.js";
30
+ import { Chip as ao } from "./molecules/Chip/Chip.js";
31
+ import { ToggleView as io } from "./molecules/ToggleView/ToggleView.js";
32
+ import { CartSlideInPanel as uo } from "./molecules/Cart/CartSlideInPanel.js";
33
+ import { StatefulButton as Co } from "./molecules/StatefulButton/StatefulButton.js";
34
+ import { AnimatedCheckMark as ko } from "./molecules/StatefulButton/AnimatedCheckmark.js";
35
+ import { AddToCart as Bo } from "./molecules/AddToCart/AddToCart.js";
36
+ import { Modal as vo } from "./molecules/Modal/Modal.js";
38
37
  import { MainNav as Lo } from "./organisms/MainNav/MainNav.js";
39
- import { ChipSelector as To } from "./organisms/ChipSelector/ChipSelector.js";
40
- import { Product as Mo } from "./organisms/Product/Product.js";
41
- import { Carousel as bo } from "./organisms/Carousel/Carousel.js";
42
- import { Footer as Ho } from "./organisms/Footer/Footer.js";
38
+ import { ChipSelector as ho } from "./organisms/ChipSelector/ChipSelector.js";
39
+ import { Product as To } from "./organisms/Product/Product.js";
40
+ import { Carousel as Mo } from "./organisms/Carousel/Carousel.js";
41
+ import { Footer as bo } from "./organisms/Footer/Footer.js";
43
42
  export {
44
- ao as Account,
45
- Io as AddToCart,
46
- vo as AnimatedCheckMark,
43
+ fo as Account,
44
+ Bo as AddToCart,
45
+ ko as AnimatedCheckMark,
47
46
  V as Availability,
48
47
  q as Avatar,
49
48
  E as BannerCard,
50
49
  W as Breadcrumbs,
51
50
  e as Button,
52
51
  K as CardLink,
53
- bo as Carousel,
54
- Co as CartSlideInPanel,
55
- io as Chip,
56
- To as ChipSelector,
52
+ Mo as Carousel,
53
+ uo as CartSlideInPanel,
54
+ ao as Chip,
55
+ ho as ChipSelector,
57
56
  f as Column,
58
57
  p as Flex,
59
- Ho as Footer,
58
+ bo as Footer,
60
59
  x as Grid,
61
60
  n as Head,
62
61
  _ as HorizontalScroll,
63
62
  l as Icon,
64
- v as Input,
65
- I as Link,
63
+ B as Input,
64
+ v as Link,
66
65
  F as LinkButton,
67
66
  y as Logo,
68
67
  Lo as MainNav,
69
- so as Modal,
68
+ vo as Modal,
70
69
  Y as NotFound,
71
70
  po as Popover,
72
71
  Q as Pricing,
73
- Mo as Product,
72
+ To as Product,
74
73
  G as QuantityInput,
75
74
  d as Root,
76
75
  w as SearchBox,
77
76
  C as Separator,
78
77
  oo as SlideInPanel,
79
- ko as StatefulButton,
78
+ Co as StatefulButton,
80
79
  k as Text,
81
- uo as ToggleView,
80
+ io as ToggleView,
82
81
  eo as Tooltip,
83
82
  N as configureImage,
84
- L as configureLink,
85
- s as linkClassName,
86
- h as routerOverride,
87
- fo as usePopover
83
+ h as configureLink,
84
+ L as linkClassName,
85
+ s as routerOverride
88
86
  };
@@ -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.115",
4
+ "version": "0.0.117",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",
@@ -1,8 +0,0 @@
1
- import * as React from "react";
2
- export type PopoverAPI = {
3
- close: () => void;
4
- open: () => void;
5
- toggle: () => void;
6
- };
7
- export declare const PopoverContext: React.Context<PopoverAPI | null>;
8
- export declare function usePopover(): PopoverAPI;
@@ -1,12 +0,0 @@
1
- import * as e from "react";
2
- const t = e.createContext(null);
3
- function r() {
4
- const o = e.useContext(t);
5
- if (!o)
6
- throw new Error("usePopover must be used within a Popover");
7
- return o;
8
- }
9
- export {
10
- t as PopoverContext,
11
- r as usePopover
12
- };