@caseparts-org/caseblocks 0.0.118 → 0.0.119

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_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
+ ._overlay_1mnoo_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_1mnoo_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_1mnoo_11{border-radius:0;width:100%;box-shadow:none;height:100dvh;max-height:100dvh}}._toolbar_1mnoo_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);gap:var(--spacing-spacing-2xs);z-index:1}._toolbarPlain_1mnoo_44{background-color:transparent;border-bottom:none}._headerGroup_1mnoo_49{display:flex;flex-direction:row;align-items:center;gap:var(--spacing-spacing-2xs);flex:1 1 0}._headerLeft_1mnoo_57{justify-content:flex-start}._headerRight_1mnoo_61{justify-content:flex-end}._closeButton_1mnoo_65{-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_1mnoo_78{overflow:auto;padding:var(--spacing-spacing-default)}@media (max-width:767px){._content_1mnoo_78{padding:var(--spacing-spacing-2xs)}}
@@ -1,13 +1,29 @@
1
1
  import { default as React } from 'react';
2
2
  export type ModalHeaderSize = "sm" | "md" | "lg";
3
- export type ModalHeaderVariant = "default" | "plain";
3
+ export type ModalTextVariant = "display" | "body";
4
+ export type ModalToolbarVariant = "standard" | "plain";
4
5
  export interface ModalProps extends React.HTMLAttributes<HTMLDivElement> {
5
6
  isOpen: boolean;
6
- caption?: string;
7
7
  onClose: () => void;
8
8
  closeOnOverlayClick?: boolean;
9
- contentWrapperClassName?: string;
10
- headerSize?: ModalHeaderSize;
11
- headerVariant?: ModalHeaderVariant;
12
9
  }
13
- export declare function Modal({ isOpen, caption, onClose, closeOnOverlayClick, headerSize, headerVariant, className, contentWrapperClassName, children, ...otherProps }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
10
+ type ModalCompound = React.FC<ModalProps> & {
11
+ Toolbar: React.FC<ModalToolbarProps>;
12
+ Header: React.FC<ModalHeaderProps>;
13
+ CloseButton: React.FC<ModalCloseButtonProps>;
14
+ Content: React.FC<ModalContentProps>;
15
+ };
16
+ export interface ModalToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
17
+ variant?: ModalToolbarVariant;
18
+ }
19
+ export interface ModalHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
20
+ align?: "left" | "right";
21
+ size?: ModalHeaderSize;
22
+ variant?: ModalTextVariant;
23
+ }
24
+ export interface ModalCloseButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
25
+ size?: ModalHeaderSize;
26
+ }
27
+ export type ModalContentProps = React.HTMLAttributes<HTMLDivElement>;
28
+ export declare const Modal: ModalCompound;
29
+ export {};
@@ -1,75 +1,67 @@
1
- import { jsx as a, jsxs as s } from "react/jsx-runtime";
2
- import { c as t } from "../../clsx-OuTLNxxd.js";
3
- import { Text as p } from "../../atoms/Text/Text.js";
4
- import { Icon as y } from "../../atoms/Icon/Icon.js";
5
- import '../../assets/Modal.css';const g = "_overlay_1du2l_1", x = "_container_1du2l_11", N = "_header_1du2l_30", T = "_closeButton_1du2l_43", k = "_content_1du2l_56", z = "_headerPlain_1du2l_64", e = {
6
- overlay: g,
7
- container: x,
8
- header: N,
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { c as a } from "../../clsx-OuTLNxxd.js";
3
+ import { Text as _ } from "../../atoms/Text/Text.js";
4
+ import { Icon as u } from "../../atoms/Icon/Icon.js";
5
+ import '../../assets/Modal.css';const h = "_overlay_1mnoo_1", f = "_container_1mnoo_11", p = "_toolbar_1mnoo_30", b = "_toolbarPlain_1mnoo_44", g = "_headerGroup_1mnoo_49", v = "_headerLeft_1mnoo_57", y = "_headerRight_1mnoo_61", T = "_closeButton_1mnoo_65", x = "_content_1mnoo_78", n = {
6
+ overlay: h,
7
+ container: f,
8
+ toolbar: p,
9
+ toolbarPlain: b,
10
+ headerGroup: g,
11
+ headerLeft: v,
12
+ headerRight: y,
9
13
  closeButton: T,
10
- content: k,
11
- headerPlain: z
12
- }, B = {
14
+ content: x
15
+ }, C = {
13
16
  sm: "sm",
14
17
  md: "md",
15
18
  lg: "lg"
16
- }, C = {
19
+ }, z = {
17
20
  sm: "sm",
18
21
  md: "md",
19
22
  lg: "md"
20
- };
21
- function I({
22
- isOpen: i,
23
- caption: o,
24
- onClose: l,
25
- closeOnOverlayClick: d = !0,
26
- headerSize: n = "md",
27
- headerVariant: r = "default",
28
- className: m,
29
- contentWrapperClassName: u,
30
- children: _,
31
- ...h
32
- }) {
33
- if (!i) return null;
34
- const f = (c) => {
35
- d && c.target === c.currentTarget && l();
36
- }, v = r === "default" && !!o;
37
- return /* @__PURE__ */ a("div", { className: t(e.overlay), onClick: f, children: /* @__PURE__ */ s("div", { className: t(e.container, m), role: "dialog", "aria-modal": "true", ...h, children: [
38
- /* @__PURE__ */ s(
39
- "div",
40
- {
41
- className: t(
42
- e.header,
43
- e[`header-${n}`],
44
- r === "plain" && e.headerPlain
45
- ),
46
- children: [
47
- v ? /* @__PURE__ */ a(
48
- p,
49
- {
50
- as: "div",
51
- size: B[n],
52
- variant: "display",
53
- className: e.caption,
54
- children: o
55
- }
56
- ) : /* @__PURE__ */ a("div", { className: e.captionSpacer }),
57
- /* @__PURE__ */ a(
58
- "button",
59
- {
60
- type: "button",
61
- className: e.closeButton,
62
- "aria-label": "Close",
63
- onClick: l,
64
- children: /* @__PURE__ */ a(y, { iconKey: "fa-regular fa-xmark", size: C[n] })
65
- }
66
- )
67
- ]
68
- }
69
- ),
70
- /* @__PURE__ */ a("div", { className: t(e.content, u), children: _ })
71
- ] }) });
72
- }
23
+ }, c = ({
24
+ isOpen: o,
25
+ onClose: e,
26
+ closeOnOverlayClick: t = !0,
27
+ className: l,
28
+ children: s,
29
+ ...i
30
+ }) => {
31
+ if (!o) return null;
32
+ const d = (m) => {
33
+ t && m.target === m.currentTarget && e();
34
+ };
35
+ return /* @__PURE__ */ r("div", { className: a(n.overlay), onClick: d, children: /* @__PURE__ */ r("div", { className: a(n.container, l), role: "dialog", "aria-modal": "true", ...i, children: s }) });
36
+ }, B = ({ variant: o = "standard", className: e, children: t, ...l }) => /* @__PURE__ */ r(
37
+ "div",
38
+ {
39
+ className: a(n.toolbar, o === "plain" && n.toolbarPlain, e),
40
+ ...l,
41
+ children: t
42
+ }
43
+ ), N = ({
44
+ align: o = "left",
45
+ size: e = "md",
46
+ variant: t = "display",
47
+ className: l,
48
+ children: s,
49
+ ...i
50
+ }) => {
51
+ const d = typeof s == "string";
52
+ return /* @__PURE__ */ r(
53
+ "div",
54
+ {
55
+ className: a(n.headerGroup, o === "left" ? n.headerLeft : n.headerRight, l),
56
+ ...i,
57
+ children: d ? /* @__PURE__ */ r(_, { as: "div", size: C[e], variant: t, children: s }) : s
58
+ }
59
+ );
60
+ }, G = ({ size: o = "md", className: e, ...t }) => /* @__PURE__ */ r("button", { type: "button", className: a(n.closeButton, e), "aria-label": "Close", ...t, children: /* @__PURE__ */ r(u, { iconKey: "fa-regular fa-xmark", size: z[o] }) }), L = ({ className: o, children: e, ...t }) => /* @__PURE__ */ r("div", { className: a(n.content, o), ...t, children: e });
61
+ c.Toolbar = B;
62
+ c.Header = N;
63
+ c.CloseButton = G;
64
+ c.Content = L;
73
65
  export {
74
- I as Modal
66
+ c as Modal
75
67
  };
@@ -1,110 +1,81 @@
1
- import { jsx as e, jsxs as d } from "react/jsx-runtime";
2
- import { useState as l } from "react";
3
- import { Modal as a } from "./Modal.js";
4
- import { Text as n } from "../../atoms/Text/Text.js";
5
- import { Button as t } from "../../atoms/Button/Button.js";
6
- const S = {
1
+ import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
+ import { useState as t } from "react";
3
+ import { Modal as l } from "./Modal.js";
4
+ import { Text as r } from "../../atoms/Text/Text.js";
5
+ import { Button as s } from "../../atoms/Button/Button.js";
6
+ const v = {
7
7
  title: "Case Parts/Molecules/Modal",
8
- component: a,
8
+ component: l,
9
9
  argTypes: {
10
- isOpen: {
11
- control: { type: "boolean" },
12
- description: "Controls visibility of the modal"
13
- },
14
- caption: {
15
- control: { type: "text" },
16
- description: "Caption text displayed in the header"
17
- },
18
- closeOnOverlayClick: {
19
- control: { type: "boolean" },
20
- description: "Close when clicking on overlay"
21
- },
22
- headerSize: {
23
- control: { type: "radio" },
24
- options: ["sm", "md", "lg"],
25
- description: "Header size controlling caption and X icon"
26
- },
27
- headerVariant: {
28
- control: { type: "radio" },
29
- options: ["default", "plain"],
30
- description: "Header variant: styled (default) or plain"
31
- }
10
+ isOpen: { control: { type: "boolean" }, description: "Controls visibility of the modal" },
11
+ closeOnOverlayClick: { control: { type: "boolean" }, description: "Close when clicking on overlay" }
32
12
  },
33
- args: {
34
- isOpen: !0,
35
- caption: "Sample Modal",
36
- closeOnOverlayClick: !0,
37
- headerSize: "md",
38
- headerVariant: "default"
39
- }
13
+ args: { isOpen: !0, closeOnOverlayClick: !0 }
40
14
  };
41
- function m(i) {
42
- const [o, r] = l(!!i.isOpen);
43
- return /* @__PURE__ */ d("div", { style: { padding: 24 }, children: [
44
- /* @__PURE__ */ e(t, { variant: "primary", size: "md", onClick: () => r(!0), children: "Open Modal" }),
45
- /* @__PURE__ */ d(
46
- a,
47
- {
48
- isOpen: o,
49
- caption: i.caption ?? "Sample Modal",
50
- onClose: () => r(!1),
51
- closeOnOverlayClick: i.closeOnOverlayClick ?? !0,
52
- headerSize: i.headerSize ?? "md",
53
- headerVariant: i.headerVariant ?? "default",
54
- children: [
55
- /* @__PURE__ */ e(n, { as: "p", size: "md", children: "This is a reusable modal with a non-scrollable header. Click the overlay or the X to close." }),
56
- /* @__PURE__ */ e("div", { style: { height: 600 }, children: /* @__PURE__ */ e(n, { as: "p", size: "sm", children: "Scrollable content spacer..." }) })
57
- ]
58
- }
59
- )
15
+ function C(i) {
16
+ const [a, o] = t(!!i.isOpen);
17
+ return /* @__PURE__ */ n("div", { style: { padding: 24 }, children: [
18
+ /* @__PURE__ */ e(s, { variant: "primary", size: "md", onClick: () => o(!0), children: "Open Modal" }),
19
+ /* @__PURE__ */ n(l, { isOpen: a, onClose: () => o(!1), closeOnOverlayClick: i.closeOnOverlayClick ?? !0, children: [
20
+ /* @__PURE__ */ n(l.Toolbar, { children: [
21
+ /* @__PURE__ */ e(l.Header, { align: "left", size: "lg", variant: "display", children: "Sample Modal" }),
22
+ /* @__PURE__ */ e(l.Header, { align: "right", children: /* @__PURE__ */ e(l.CloseButton, { onClick: () => o(!1) }) })
23
+ ] }),
24
+ /* @__PURE__ */ n(l.Content, { children: [
25
+ /* @__PURE__ */ e(r, { as: "p", size: "md", children: "This is a reusable modal with a non-scrollable toolbar. Click the overlay or the X to close." }),
26
+ /* @__PURE__ */ e("div", { style: { height: 600 }, children: /* @__PURE__ */ e(r, { as: "p", size: "sm", children: "Scrollable content spacer..." }) })
27
+ ] })
28
+ ] })
60
29
  ] });
61
30
  }
62
- const C = {
63
- render: (i) => /* @__PURE__ */ e(m, { ...i })
31
+ const k = {
32
+ render: (i) => /* @__PURE__ */ e(C, { ...i })
64
33
  };
65
- function h() {
66
- const [i, o] = l(!1), [r, s] = l(!1), [p, c] = l(!1);
67
- return /* @__PURE__ */ d("div", { style: { display: "grid", gap: 12 }, children: [
68
- /* @__PURE__ */ e(t, { variant: "secondary", size: "sm", onClick: () => o(!0), children: "Small Header" }),
69
- /* @__PURE__ */ e(
70
- a,
71
- {
72
- isOpen: i,
73
- caption: "Small Header",
74
- onClose: () => o(!1),
75
- headerSize: "sm",
76
- children: /* @__PURE__ */ e(n, { as: "p", size: "sm", children: "Small header modal content." })
77
- }
78
- ),
79
- /* @__PURE__ */ e(t, { variant: "primary", size: "md", onClick: () => s(!0), children: "Medium Header" }),
80
- /* @__PURE__ */ e(
81
- a,
82
- {
83
- isOpen: r,
84
- caption: "Medium Header",
85
- onClose: () => s(!1),
86
- headerSize: "md",
87
- children: /* @__PURE__ */ e(n, { as: "p", size: "md", children: "Medium header modal content." })
88
- }
89
- ),
90
- /* @__PURE__ */ e(t, { variant: "cta-primary", size: "lg", onClick: () => c(!0), children: "Large Header" }),
91
- /* @__PURE__ */ e(
92
- a,
93
- {
94
- isOpen: p,
95
- caption: "Large Header",
96
- onClose: () => c(!1),
97
- headerSize: "lg",
98
- children: /* @__PURE__ */ e(n, { as: "p", size: "lg", children: "Large header modal content." })
99
- }
100
- )
34
+ function g() {
35
+ const [i, a] = t(!1), [o, d] = t(!1), [m, c] = t(!1), [p, h] = t(!1);
36
+ return /* @__PURE__ */ n("div", { style: { width: "200px", display: "grid", gap: 12 }, children: [
37
+ /* @__PURE__ */ e(s, { variant: "secondary", size: "sm", onClick: () => a(!0), children: "Small Header" }),
38
+ /* @__PURE__ */ n(l, { isOpen: i, onClose: () => a(!1), children: [
39
+ /* @__PURE__ */ n(l.Toolbar, { children: [
40
+ /* @__PURE__ */ e(l.Header, { align: "left", size: "sm", variant: "display", children: "Small Header" }),
41
+ /* @__PURE__ */ e(l.Header, { align: "right", children: /* @__PURE__ */ e(l.CloseButton, { size: "sm", onClick: () => a(!1) }) })
42
+ ] }),
43
+ /* @__PURE__ */ e(l.Content, { children: /* @__PURE__ */ e(r, { as: "p", size: "sm", children: "Small header modal content." }) })
44
+ ] }),
45
+ /* @__PURE__ */ e(s, { variant: "primary", size: "md", onClick: () => d(!0), children: "Medium Header" }),
46
+ /* @__PURE__ */ n(l, { isOpen: o, onClose: () => d(!1), children: [
47
+ /* @__PURE__ */ n(l.Toolbar, { children: [
48
+ /* @__PURE__ */ e(l.Header, { align: "left", size: "md", variant: "display", children: "Medium Header" }),
49
+ /* @__PURE__ */ e(l.Header, { align: "right", children: /* @__PURE__ */ e(l.CloseButton, { size: "md", onClick: () => d(!1) }) })
50
+ ] }),
51
+ /* @__PURE__ */ e(l.Content, { children: /* @__PURE__ */ e(r, { as: "p", size: "md", children: "Medium header modal content." }) })
52
+ ] }),
53
+ /* @__PURE__ */ e(s, { variant: "cta-primary", size: "lg", onClick: () => c(!0), children: "Large Header" }),
54
+ /* @__PURE__ */ n(l, { isOpen: m, onClose: () => c(!1), children: [
55
+ /* @__PURE__ */ n(l.Toolbar, { children: [
56
+ /* @__PURE__ */ e(l.Header, { align: "left", size: "lg", variant: "display", children: "Large Header" }),
57
+ /* @__PURE__ */ e(l.Header, { align: "right", children: /* @__PURE__ */ e(l.CloseButton, { size: "md", onClick: () => c(!1) }) })
58
+ ] }),
59
+ /* @__PURE__ */ e(l.Content, { children: /* @__PURE__ */ e(r, { as: "p", size: "lg", children: "Large header modal content." }) })
60
+ ] }),
61
+ /* @__PURE__ */ e(s, { variant: "tertiary", size: "md", onClick: () => h(!0), children: "Custom Toolbar" }),
62
+ /* @__PURE__ */ n(l, { isOpen: p, onClose: () => h(!1), children: [
63
+ /* @__PURE__ */ n(l.Toolbar, { children: [
64
+ /* @__PURE__ */ e(l.Header, { align: "left", size: "md", variant: "display", children: "Custom Toolbar" }),
65
+ /* @__PURE__ */ n(l.Header, { align: "right", children: [
66
+ /* @__PURE__ */ e("button", { onClick: () => alert("Sent!"), children: "Send Email" }),
67
+ /* @__PURE__ */ e(l.CloseButton, { size: "md", onClick: () => h(!1) })
68
+ ] })
69
+ ] }),
70
+ /* @__PURE__ */ e(l.Content, { children: /* @__PURE__ */ e(r, { as: "p", size: "md", children: "Modal with custom toolbar functions." }) })
71
+ ] })
101
72
  ] });
102
73
  }
103
- const v = {
104
- render: () => /* @__PURE__ */ e(h, {})
74
+ const b = {
75
+ render: () => /* @__PURE__ */ e(g, {})
105
76
  };
106
77
  export {
107
- C as Basic,
108
- v as Sizes,
109
- S as default
78
+ k as Basic,
79
+ b as Sizes,
80
+ v as default
110
81
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.118",
4
+ "version": "0.0.119",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",