@caseparts-org/caseblocks 0.0.293 → 0.0.294

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_1t770_1{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000}._container_1t770_11{display:flex;flex-direction:column;overflow:hidden;background-color:var(--surface-surface-primary);color:var(--text-text-primary);border-radius:var(--border-radius-lg);box-shadow:0 4px 6px #0000001a;width:min(var(--modal-width, 800px),92vw);max-height:80vh}@media (max-width:767px){._container_1t770_11{border-radius:0;width:100%;box-shadow:none;height:100dvh;max-height:100dvh}}._toolbar_1t770_30{position:sticky;top:0;display:flex;flex-direction:row;align-items:center;justify-content:space-between;border-bottom:1px solid var(--border-border-secondary-btn);padding:var(--spacing-spacing-2xs) var(--spacing-spacing-default);gap:var(--spacing-spacing-2xs);z-index:1}@media (max-width:767px){._toolbar_1t770_30{padding:var(--spacing-spacing-2xs)}}._toolbarPlain_1t770_46{background-color:transparent;border-bottom:none}._headerGroup_1t770_51{display:flex;flex-direction:row;align-items:center;gap:var(--spacing-spacing-2xs);flex:1 1 0}._headerLeft_1t770_59{justify-content:flex-start}._headerRight_1t770_63{justify-content:flex-end}._closeButton_1t770_67{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;background:transparent;border-radius:var(--radius-radius-md);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;transition:background-color .2s ease-in}._closeButton_1t770_67:hover{background-color:var(--color-neutrals-neutral-2)}._content_1t770_86{overflow:auto;padding:var(--spacing-spacing-default)}@media (max-width:767px){._content_1t770_86{padding:var(--spacing-spacing-2xs)}}
1
+ ._overlay_1fxsx_1{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000}._container_1fxsx_11{position:relative;display:flex;flex-direction:column;overflow:hidden;background-color:var(--surface-surface-primary);color:var(--text-text-primary);border-radius:var(--border-radius-lg);box-shadow:0 4px 6px #0000001a;width:min(var(--modal-width, 800px),92vw);max-height:80vh}@media (max-width:767px){._container_1fxsx_11{border-radius:0;width:100%;box-shadow:none;height:100dvh;max-height:100dvh}}._toolbar_1fxsx_31{position:sticky;top:0;display:flex;flex-direction:row;align-items:center;justify-content:space-between;border-bottom:1px solid var(--border-border-secondary-btn);padding:var(--spacing-spacing-2xs) var(--spacing-spacing-default);gap:var(--spacing-spacing-2xs);z-index:1}@media (max-width:767px){._toolbar_1fxsx_31{padding:var(--spacing-spacing-2xs)}}._toolbarPlain_1fxsx_47{background-color:transparent;border-bottom:none}._headerGroup_1fxsx_52{display:flex;flex-direction:row;align-items:center;gap:var(--spacing-spacing-2xs);flex:1 1 0}._headerLeft_1fxsx_60{justify-content:flex-start}._headerRight_1fxsx_64{justify-content:flex-end}._closeButton_1fxsx_68{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;background:transparent;border-radius:var(--radius-radius-md);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;transition:background-color .2s ease-in}._closeButton_1fxsx_68:hover{background-color:var(--color-neutrals-neutral-2)}._closeButtonTopRight_1fxsx_87{position:absolute;top:var(--spacing-spacing-2xs);right:var(--spacing-spacing-2xs);z-index:2;padding:var(--spacing-spacing-2xs)}._content_1fxsx_95{overflow:auto;padding:var(--spacing-spacing-default)}@media (max-width:767px){._content_1fxsx_95{padding:var(--spacing-spacing-2xs)}}
@@ -24,6 +24,7 @@ export interface ModalHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
24
24
  }
25
25
  export interface ModalCloseButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
26
26
  size?: ModalHeaderSize;
27
+ position?: "top-right";
27
28
  }
28
29
  export type ModalContentProps = React.HTMLAttributes<HTMLDivElement>;
29
30
  export declare const Modal: ModalCompound;
@@ -1,99 +1,109 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
- import p from "react";
3
- import { r as b } from "../../index-BkF-BQ3Q.js";
4
- import { c as a } from "../../clsx-OuTLNxxd.js";
2
+ import x from "react";
3
+ import { r as p } from "../../index-BkF-BQ3Q.js";
4
+ import { c as s } from "../../clsx-OuTLNxxd.js";
5
5
  import { Text as g } from "../../atoms/Text/Text.js";
6
- import { Icon as y } from "../../atoms/Icon/Icon.js";
7
- import '../../assets/Modal.css';const v = "_overlay_1t770_1", x = "_container_1t770_11", T = "_toolbar_1t770_30", z = "_toolbarPlain_1t770_46", B = "_headerGroup_1t770_51", M = "_headerLeft_1t770_59", N = "_headerRight_1t770_63", R = "_closeButton_1t770_67", w = "_content_1t770_86", r = {
8
- overlay: v,
9
- container: x,
10
- toolbar: T,
11
- toolbarPlain: z,
12
- headerGroup: B,
13
- headerLeft: M,
14
- headerRight: N,
15
- closeButton: R,
16
- content: w
17
- }, P = {
6
+ import { Icon as b } from "../../atoms/Icon/Icon.js";
7
+ import '../../assets/Modal.css';const y = "_overlay_1fxsx_1", T = "_container_1fxsx_11", v = "_toolbar_1fxsx_31", B = "_toolbarPlain_1fxsx_47", R = "_headerGroup_1fxsx_52", z = "_headerLeft_1fxsx_60", M = "_headerRight_1fxsx_64", N = "_closeButton_1fxsx_68", w = "_closeButtonTopRight_1fxsx_87", P = "_content_1fxsx_95", e = {
8
+ overlay: y,
9
+ container: T,
10
+ toolbar: v,
11
+ toolbarPlain: B,
12
+ headerGroup: R,
13
+ headerLeft: z,
14
+ headerRight: M,
15
+ closeButton: N,
16
+ closeButtonTopRight: w,
17
+ content: P
18
+ }, C = {
18
19
  sm: "sm",
19
20
  md: "md",
20
21
  lg: "lg"
21
- }, C = {
22
+ }, D = {
22
23
  sm: "xs",
23
24
  md: "sm",
24
25
  lg: "md"
25
- }, i = ({
26
- isOpen: e,
27
- onClose: o,
26
+ }, d = ({
27
+ isOpen: o,
28
+ onClose: r,
28
29
  closeOnOverlayClick: t = !0,
29
- width: s,
30
+ width: a,
30
31
  className: l,
31
32
  style: u,
32
- children: m,
33
- ..._
33
+ children: f,
34
+ ...m
34
35
  }) => {
35
- const d = p.useRef(!1);
36
- if (!e || typeof document > "u") return null;
37
- const f = (c) => {
38
- t && (d.current = c.target === c.currentTarget);
36
+ const i = x.useRef(!1);
37
+ if (!o || typeof document > "u") return null;
38
+ const _ = (c) => {
39
+ t && (i.current = c.target === c.currentTarget);
39
40
  }, h = (c) => {
40
41
  if (!t) {
41
- d.current = !1;
42
+ i.current = !1;
42
43
  return;
43
44
  }
44
- d.current && c.target === c.currentTarget && o(), d.current = !1;
45
+ i.current && c.target === c.currentTarget && r(), i.current = !1;
45
46
  };
46
- return b.createPortal(
47
+ return p.createPortal(
47
48
  /* @__PURE__ */ n(
48
49
  "div",
49
50
  {
50
- className: a(r.overlay),
51
- onMouseDown: f,
51
+ className: s(e.overlay),
52
+ onMouseDown: _,
52
53
  onMouseUp: h,
53
54
  children: /* @__PURE__ */ n(
54
55
  "div",
55
56
  {
56
- className: a(r.container, l),
57
+ className: s(e.container, l),
57
58
  role: "dialog",
58
59
  "aria-modal": "true",
59
- style: { ...u, "--modal-width": s },
60
- ..._,
61
- children: m
60
+ style: { ...u, "--modal-width": a },
61
+ ...m,
62
+ children: f
62
63
  }
63
64
  )
64
65
  }
65
66
  ),
66
67
  document.body
67
68
  );
68
- }, D = ({ variant: e = "standard", className: o, children: t, ...s }) => /* @__PURE__ */ n(
69
+ }, G = ({ variant: o = "standard", className: r, children: t, ...a }) => /* @__PURE__ */ n(
69
70
  "div",
70
71
  {
71
- className: a(r.toolbar, e === "plain" && r.toolbarPlain, o),
72
- ...s,
72
+ className: s(e.toolbar, o === "plain" && e.toolbarPlain, r),
73
+ ...a,
73
74
  children: t
74
75
  }
75
- ), G = ({
76
- align: e = "left",
77
- size: o = "md",
76
+ ), L = ({
77
+ align: o = "left",
78
+ size: r = "md",
78
79
  variant: t = "body",
79
- className: s,
80
+ className: a,
80
81
  children: l,
81
82
  ...u
82
83
  }) => {
83
- const m = typeof l == "string";
84
+ const f = typeof l == "string";
84
85
  return /* @__PURE__ */ n(
85
86
  "div",
86
87
  {
87
- className: a(r.headerGroup, e === "left" ? r.headerLeft : r.headerRight, s),
88
+ className: s(e.headerGroup, o === "left" ? e.headerLeft : e.headerRight, a),
88
89
  ...u,
89
- children: m ? /* @__PURE__ */ n(g, { as: "div", size: P[o], variant: t, weight: "semibold", children: l }) : l
90
+ children: f ? /* @__PURE__ */ n(g, { as: "div", size: C[r], variant: t, weight: "semibold", children: l }) : l
90
91
  }
91
92
  );
92
- }, L = ({ size: e = "md", className: o, ...t }) => /* @__PURE__ */ n("button", { type: "button", className: a(r.closeButton, o), "aria-label": "Close", ...t, children: /* @__PURE__ */ n(y, { iconKey: "fa-regular fa-xmark", size: C[e] }) }), S = ({ className: e, children: o, ...t }) => /* @__PURE__ */ n("div", { className: a(r.content, e), ...t, children: o });
93
- i.Toolbar = D;
94
- i.Header = G;
95
- i.CloseButton = L;
96
- i.Content = S;
93
+ }, S = ({ size: o = "md", position: r, className: t, ...a }) => /* @__PURE__ */ n(
94
+ "button",
95
+ {
96
+ type: "button",
97
+ className: s(e.closeButton, r === "top-right" && e.closeButtonTopRight, t),
98
+ "aria-label": "Close",
99
+ ...a,
100
+ children: /* @__PURE__ */ n(b, { iconKey: "fa-regular fa-xmark", size: D[o] })
101
+ }
102
+ ), I = ({ className: o, children: r, ...t }) => /* @__PURE__ */ n("div", { className: s(e.content, o), ...t, children: r });
103
+ d.Toolbar = G;
104
+ d.Header = L;
105
+ d.CloseButton = S;
106
+ d.Content = I;
97
107
  export {
98
- i as Modal
108
+ d as Modal
99
109
  };
@@ -4,4 +4,5 @@ declare const meta: Meta<typeof Modal>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Modal>;
6
6
  export declare const PlainToolbar: Story;
7
+ export declare const Headerless: Story;
7
8
  export declare const Sizes: Story;
@@ -1,8 +1,8 @@
1
- import { jsx as e, jsxs as l } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
2
  import { useState as r } from "react";
3
3
  import { Modal as n } from "./Modal.js";
4
4
  import { Text as o } from "../../atoms/Text/Text.js";
5
- import { Button as a } from "../../atoms/Button/Button.js";
5
+ import { Button as t } from "../../atoms/Button/Button.js";
6
6
  const O = {
7
7
  title: "Case Parts/Molecules/Modal",
8
8
  component: n,
@@ -13,54 +13,86 @@ const O = {
13
13
  },
14
14
  args: { isOpen: !0, closeOnOverlayClick: !0 }
15
15
  };
16
- function C() {
17
- const [t, i] = r(!0);
18
- return /* @__PURE__ */ l("div", { style: { padding: 24 }, children: [
19
- /* @__PURE__ */ e(a, { variant: "primary", size: "md", onClick: () => i(!0), children: "Open Modal" }),
20
- /* @__PURE__ */ l(n, { isOpen: t, onClose: () => i(!1), children: [
21
- /* @__PURE__ */ l(n.Toolbar, { variant: "plain", children: [
16
+ function u() {
17
+ const [a, l] = r(!0);
18
+ return /* @__PURE__ */ i("div", { style: { padding: 24 }, children: [
19
+ /* @__PURE__ */ e(t, { variant: "primary", size: "md", onClick: () => l(!0), children: "Open Modal" }),
20
+ /* @__PURE__ */ i(n, { isOpen: a, onClose: () => l(!1), children: [
21
+ /* @__PURE__ */ i(n.Toolbar, { variant: "plain", children: [
22
22
  /* @__PURE__ */ e(n.Header, { align: "left", size: "lg", variant: "display", children: "Plain Toolbar" }),
23
- /* @__PURE__ */ e(n.Header, { align: "right", children: /* @__PURE__ */ e(n.CloseButton, { onClick: () => i(!1) }) })
23
+ /* @__PURE__ */ e(n.Header, { align: "right", children: /* @__PURE__ */ e(n.CloseButton, { onClick: () => l(!1) }) })
24
24
  ] }),
25
25
  /* @__PURE__ */ e(n.Content, { children: /* @__PURE__ */ e(o, { as: "p", size: "md", children: "This modal uses a toolbar without a background or bottom border." }) })
26
26
  ] })
27
27
  ] });
28
28
  }
29
29
  const H = {
30
- render: () => /* @__PURE__ */ e(C, {})
30
+ render: () => /* @__PURE__ */ e(u, {})
31
31
  };
32
- function u() {
33
- const [t, i] = r(!1), [h, s] = r(!1), [m, d] = r(!1), [p, c] = r(!1);
34
- return /* @__PURE__ */ l("div", { style: { width: "200px", display: "grid", gap: 12 }, children: [
35
- /* @__PURE__ */ e(a, { variant: "secondary", size: "sm", onClick: () => i(!0), children: "Small Header" }),
36
- /* @__PURE__ */ l(n, { isOpen: t, onClose: () => i(!1), children: [
37
- /* @__PURE__ */ l(n.Toolbar, { children: [
32
+ function g() {
33
+ const [a, l] = r(!0);
34
+ return /* @__PURE__ */ i("div", { style: { padding: 24 }, children: [
35
+ /* @__PURE__ */ e(t, { variant: "primary", size: "md", onClick: () => l(!0), children: "Open Modal" }),
36
+ /* @__PURE__ */ i(n, { isOpen: a, onClose: () => l(!1), "aria-label": "Headerless modal", children: [
37
+ /* @__PURE__ */ e(n.CloseButton, { position: "top-right", onClick: () => l(!1) }),
38
+ /* @__PURE__ */ e(n.Content, { style: { padding: 0 }, children: /* @__PURE__ */ i(
39
+ "div",
40
+ {
41
+ style: {
42
+ display: "grid",
43
+ gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 300px), 1fr))"
44
+ },
45
+ children: [
46
+ /* @__PURE__ */ i("section", { style: { padding: "3rem" }, children: [
47
+ /* @__PURE__ */ e(o, { as: "h2", size: "lg", weight: "semibold", children: "First section" }),
48
+ /* @__PURE__ */ e(o, { as: "p", size: "md", children: "Content can extend to the top of the modal without a toolbar." })
49
+ ] }),
50
+ /* @__PURE__ */ i("section", { style: { padding: "3rem", background: "var(--surface-surface-secondary)" }, children: [
51
+ /* @__PURE__ */ e(o, { as: "h2", size: "lg", weight: "semibold", children: "Second section" }),
52
+ /* @__PURE__ */ e(o, { as: "p", size: "md", children: "The close button stays in the top-right corner while this content scrolls." }),
53
+ /* @__PURE__ */ e(o, { as: "p", size: "md", children: "Leave enough space around the button so it does not overlap your content." })
54
+ ] })
55
+ ]
56
+ }
57
+ ) })
58
+ ] })
59
+ ] });
60
+ }
61
+ const k = {
62
+ render: () => /* @__PURE__ */ e(g, {})
63
+ };
64
+ function C() {
65
+ const [a, l] = r(!1), [h, s] = r(!1), [m, d] = r(!1), [p, c] = r(!1);
66
+ return /* @__PURE__ */ i("div", { style: { width: "200px", display: "grid", gap: 12 }, children: [
67
+ /* @__PURE__ */ e(t, { variant: "secondary", size: "sm", onClick: () => l(!0), children: "Small Header" }),
68
+ /* @__PURE__ */ i(n, { isOpen: a, onClose: () => l(!1), children: [
69
+ /* @__PURE__ */ i(n.Toolbar, { children: [
38
70
  /* @__PURE__ */ e(n.Header, { align: "left", size: "sm", children: "Small Header" }),
39
- /* @__PURE__ */ e(n.Header, { align: "right", children: /* @__PURE__ */ e(n.CloseButton, { size: "sm", onClick: () => i(!1) }) })
71
+ /* @__PURE__ */ e(n.Header, { align: "right", children: /* @__PURE__ */ e(n.CloseButton, { size: "sm", onClick: () => l(!1) }) })
40
72
  ] }),
41
73
  /* @__PURE__ */ e(n.Content, { children: /* @__PURE__ */ e(o, { as: "p", size: "sm", children: "Small header modal content." }) })
42
74
  ] }),
43
- /* @__PURE__ */ e(a, { variant: "primary", size: "md", onClick: () => s(!0), children: "Medium Header" }),
44
- /* @__PURE__ */ l(n, { isOpen: h, onClose: () => s(!1), children: [
45
- /* @__PURE__ */ l(n.Toolbar, { children: [
75
+ /* @__PURE__ */ e(t, { variant: "primary", size: "md", onClick: () => s(!0), children: "Medium Header" }),
76
+ /* @__PURE__ */ i(n, { isOpen: h, onClose: () => s(!1), children: [
77
+ /* @__PURE__ */ i(n.Toolbar, { children: [
46
78
  /* @__PURE__ */ e(n.Header, { align: "left", size: "md", children: "Medium Header" }),
47
79
  /* @__PURE__ */ e(n.Header, { align: "right", children: /* @__PURE__ */ e(n.CloseButton, { size: "md", onClick: () => s(!1) }) })
48
80
  ] }),
49
81
  /* @__PURE__ */ e(n.Content, { children: /* @__PURE__ */ e(o, { as: "p", size: "md", children: "Medium header modal content." }) })
50
82
  ] }),
51
- /* @__PURE__ */ e(a, { variant: "cta-primary", size: "lg", onClick: () => d(!0), children: "Large Header" }),
52
- /* @__PURE__ */ l(n, { isOpen: m, onClose: () => d(!1), children: [
53
- /* @__PURE__ */ l(n.Toolbar, { children: [
83
+ /* @__PURE__ */ e(t, { variant: "cta-primary", size: "lg", onClick: () => d(!0), children: "Large Header" }),
84
+ /* @__PURE__ */ i(n, { isOpen: m, onClose: () => d(!1), children: [
85
+ /* @__PURE__ */ i(n.Toolbar, { children: [
54
86
  /* @__PURE__ */ e(n.Header, { align: "left", size: "lg", children: "Large Header" }),
55
87
  /* @__PURE__ */ e(n.Header, { align: "right", children: /* @__PURE__ */ e(n.CloseButton, { size: "md", onClick: () => d(!1) }) })
56
88
  ] }),
57
89
  /* @__PURE__ */ e(n.Content, { children: /* @__PURE__ */ e(o, { as: "p", size: "lg", children: "Large header modal content." }) })
58
90
  ] }),
59
- /* @__PURE__ */ e(a, { variant: "tertiary", size: "md", onClick: () => c(!0), children: "Custom Toolbar" }),
60
- /* @__PURE__ */ l(n, { isOpen: p, onClose: () => c(!1), children: [
61
- /* @__PURE__ */ l(n.Toolbar, { children: [
91
+ /* @__PURE__ */ e(t, { variant: "tertiary", size: "md", onClick: () => c(!0), children: "Custom Toolbar" }),
92
+ /* @__PURE__ */ i(n, { isOpen: p, onClose: () => c(!1), children: [
93
+ /* @__PURE__ */ i(n.Toolbar, { children: [
62
94
  /* @__PURE__ */ e(n.Header, { align: "left", size: "md", variant: "display", children: "Custom Toolbar" }),
63
- /* @__PURE__ */ l(n.Header, { align: "right", children: [
95
+ /* @__PURE__ */ i(n.Header, { align: "right", children: [
64
96
  /* @__PURE__ */ e("button", { onClick: () => alert("Sent!"), children: "Send Email" }),
65
97
  /* @__PURE__ */ e(n.CloseButton, { size: "md", onClick: () => c(!1) })
66
98
  ] })
@@ -69,11 +101,12 @@ function u() {
69
101
  ] })
70
102
  ] });
71
103
  }
72
- const k = {
73
- render: () => /* @__PURE__ */ e(u, {})
104
+ const T = {
105
+ render: () => /* @__PURE__ */ e(C, {})
74
106
  };
75
107
  export {
108
+ k as Headerless,
76
109
  H as PlainToolbar,
77
- k as Sizes,
110
+ T as Sizes,
78
111
  O as default
79
112
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.293",
4
+ "version": "0.0.294",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",