@jackcrane/ui 0.1.12 → 0.1.13

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.
package/dist/jcui.cjs.js CHANGED
@@ -27367,39 +27367,65 @@ const styles$1 = {
27367
27367
  };
27368
27368
  const useModal = ({ title: title2, content: content2, footer: footer2 }) => {
27369
27369
  const [open2, setOpen] = React__namespace.useState(false);
27370
- const Modal = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Root, { open: open2, onOpenChange: setOpen, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Portal, { children: [
27371
- /* @__PURE__ */ jsxRuntimeExports.jsx(Overlay, { className: `${styles$1.overlay} ${hatchStyles.hatch}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.overlayBackdrop }) }),
27372
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
27373
- Content,
27374
- {
27375
- className: `${styles$1.content} ${chamferStyles.chamfer}`,
27376
- children: [
27377
- title2 && /* @__PURE__ */ jsxRuntimeExports.jsxs(
27378
- "div",
27379
- {
27380
- style: {
27381
- display: "flex",
27382
- flexDirection: "row",
27383
- justifyContent: "space-between",
27384
- alignItems: "center",
27385
- margin: -12,
27386
- marginBottom: 0,
27387
- padding: 12,
27388
- borderBottom: "var(--border-thickness) solid var(--border-color)"
27389
- },
27390
- className: classNames(hatchStyles.hatch),
27391
- children: [
27392
- /* @__PURE__ */ jsxRuntimeExports.jsx(Title, { className: styles$1.title, children: title2 }),
27393
- /* @__PURE__ */ jsxRuntimeExports.jsx(Close, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", variant: "danger", children: "Close" }) })
27394
- ]
27395
- }
27396
- ),
27397
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.body, children: content2 }),
27398
- footer2 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classNames(styles$1.footer, hatchStyles.hatch), children: footer2 })
27399
- ]
27400
- }
27401
- )
27402
- ] }) });
27370
+ const modalConfigRef = React__namespace.useRef({
27371
+ open: open2,
27372
+ setOpen,
27373
+ title: title2,
27374
+ content: content2,
27375
+ footer: footer2
27376
+ });
27377
+ modalConfigRef.current = {
27378
+ open: open2,
27379
+ setOpen,
27380
+ title: title2,
27381
+ content: content2,
27382
+ footer: footer2
27383
+ };
27384
+ const Modal = React__namespace.useMemo(
27385
+ () => function Modal2() {
27386
+ const {
27387
+ open: isOpen,
27388
+ setOpen: onOpenChange,
27389
+ title: currentTitle,
27390
+ content: currentContent,
27391
+ footer: currentFooter
27392
+ } = modalConfigRef.current;
27393
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Root, { open: isOpen, onOpenChange, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Portal, { children: [
27394
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Overlay, { className: `${styles$1.overlay} ${hatchStyles.hatch}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.overlayBackdrop }) }),
27395
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
27396
+ Content,
27397
+ {
27398
+ className: `${styles$1.content} ${chamferStyles.chamfer}`,
27399
+ children: [
27400
+ currentTitle && /* @__PURE__ */ jsxRuntimeExports.jsxs(
27401
+ "div",
27402
+ {
27403
+ style: {
27404
+ display: "flex",
27405
+ flexDirection: "row",
27406
+ justifyContent: "space-between",
27407
+ alignItems: "center",
27408
+ margin: -12,
27409
+ marginBottom: 0,
27410
+ padding: 12,
27411
+ borderBottom: "var(--border-thickness) solid var(--border-color)"
27412
+ },
27413
+ className: classNames(hatchStyles.hatch),
27414
+ children: [
27415
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Title, { className: styles$1.title, children: currentTitle }),
27416
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Close, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", variant: "danger", children: "Close" }) })
27417
+ ]
27418
+ }
27419
+ ),
27420
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.body, children: currentContent }),
27421
+ currentFooter && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classNames(styles$1.footer, hatchStyles.hatch), children: currentFooter })
27422
+ ]
27423
+ }
27424
+ )
27425
+ ] }) });
27426
+ },
27427
+ []
27428
+ );
27403
27429
  const trigger2 = (node) => /* @__PURE__ */ jsxRuntimeExports.jsx(Trigger, { asChild: true, children: node });
27404
27430
  return { Modal, trigger: trigger2, open: open2, setOpen };
27405
27431
  };
package/dist/jcui.es.js CHANGED
@@ -27349,39 +27349,65 @@ const styles$1 = {
27349
27349
  };
27350
27350
  const useModal = ({ title: title2, content: content2, footer: footer2 }) => {
27351
27351
  const [open2, setOpen] = React.useState(false);
27352
- const Modal = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Root, { open: open2, onOpenChange: setOpen, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Portal, { children: [
27353
- /* @__PURE__ */ jsxRuntimeExports.jsx(Overlay, { className: `${styles$1.overlay} ${hatchStyles.hatch}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.overlayBackdrop }) }),
27354
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
27355
- Content,
27356
- {
27357
- className: `${styles$1.content} ${chamferStyles.chamfer}`,
27358
- children: [
27359
- title2 && /* @__PURE__ */ jsxRuntimeExports.jsxs(
27360
- "div",
27361
- {
27362
- style: {
27363
- display: "flex",
27364
- flexDirection: "row",
27365
- justifyContent: "space-between",
27366
- alignItems: "center",
27367
- margin: -12,
27368
- marginBottom: 0,
27369
- padding: 12,
27370
- borderBottom: "var(--border-thickness) solid var(--border-color)"
27371
- },
27372
- className: classNames(hatchStyles.hatch),
27373
- children: [
27374
- /* @__PURE__ */ jsxRuntimeExports.jsx(Title, { className: styles$1.title, children: title2 }),
27375
- /* @__PURE__ */ jsxRuntimeExports.jsx(Close, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", variant: "danger", children: "Close" }) })
27376
- ]
27377
- }
27378
- ),
27379
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.body, children: content2 }),
27380
- footer2 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classNames(styles$1.footer, hatchStyles.hatch), children: footer2 })
27381
- ]
27382
- }
27383
- )
27384
- ] }) });
27352
+ const modalConfigRef = React.useRef({
27353
+ open: open2,
27354
+ setOpen,
27355
+ title: title2,
27356
+ content: content2,
27357
+ footer: footer2
27358
+ });
27359
+ modalConfigRef.current = {
27360
+ open: open2,
27361
+ setOpen,
27362
+ title: title2,
27363
+ content: content2,
27364
+ footer: footer2
27365
+ };
27366
+ const Modal = React.useMemo(
27367
+ () => function Modal2() {
27368
+ const {
27369
+ open: isOpen,
27370
+ setOpen: onOpenChange,
27371
+ title: currentTitle,
27372
+ content: currentContent,
27373
+ footer: currentFooter
27374
+ } = modalConfigRef.current;
27375
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Root, { open: isOpen, onOpenChange, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Portal, { children: [
27376
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Overlay, { className: `${styles$1.overlay} ${hatchStyles.hatch}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.overlayBackdrop }) }),
27377
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
27378
+ Content,
27379
+ {
27380
+ className: `${styles$1.content} ${chamferStyles.chamfer}`,
27381
+ children: [
27382
+ currentTitle && /* @__PURE__ */ jsxRuntimeExports.jsxs(
27383
+ "div",
27384
+ {
27385
+ style: {
27386
+ display: "flex",
27387
+ flexDirection: "row",
27388
+ justifyContent: "space-between",
27389
+ alignItems: "center",
27390
+ margin: -12,
27391
+ marginBottom: 0,
27392
+ padding: 12,
27393
+ borderBottom: "var(--border-thickness) solid var(--border-color)"
27394
+ },
27395
+ className: classNames(hatchStyles.hatch),
27396
+ children: [
27397
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Title, { className: styles$1.title, children: currentTitle }),
27398
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Close, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", variant: "danger", children: "Close" }) })
27399
+ ]
27400
+ }
27401
+ ),
27402
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.body, children: currentContent }),
27403
+ currentFooter && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classNames(styles$1.footer, hatchStyles.hatch), children: currentFooter })
27404
+ ]
27405
+ }
27406
+ )
27407
+ ] }) });
27408
+ },
27409
+ []
27410
+ );
27385
27411
  const trigger2 = (node) => /* @__PURE__ */ jsxRuntimeExports.jsx(Trigger, { asChild: true, children: node });
27386
27412
  return { Modal, trigger: trigger2, open: open2, setOpen };
27387
27413
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jackcrane/ui",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "dist/jcui.cjs.js",