@jackcrane/ui 0.1.17 → 0.1.19

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,6 +1,7 @@
1
- export function JCUIProvider({ children, theme: initialTheme, className, ...props }: {
1
+ export function JCUIProvider({ children, theme: initialTheme, modalMobileBreakpoint, className, ...props }: {
2
2
  [x: string]: any;
3
3
  children: any;
4
4
  theme?: string;
5
+ modalMobileBreakpoint?: number;
5
6
  className: any;
6
7
  }): import("react/jsx-runtime").JSX.Element;
package/dist/jcui.cjs.js CHANGED
@@ -1592,7 +1592,7 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
1592
1592
  --button-color: var(--body-color);
1593
1593
  }
1594
1594
  /* modal.module.css */
1595
- @keyframes _overlayIn_cozou_1 {
1595
+ @keyframes _overlayIn_1fxeg_1 {
1596
1596
  from {
1597
1597
  opacity: 0;
1598
1598
  }
@@ -1600,7 +1600,7 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
1600
1600
  opacity: 1;
1601
1601
  }
1602
1602
  }
1603
- @keyframes _overlayOut_cozou_1 {
1603
+ @keyframes _overlayOut_1fxeg_1 {
1604
1604
  from {
1605
1605
  opacity: 1;
1606
1606
  }
@@ -1608,7 +1608,7 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
1608
1608
  opacity: 0;
1609
1609
  }
1610
1610
  }
1611
- @keyframes _panelIn_cozou_1 {
1611
+ @keyframes _panelIn_1fxeg_1 {
1612
1612
  from {
1613
1613
  opacity: 0;
1614
1614
  transform: translateX(400px);
@@ -1618,7 +1618,7 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
1618
1618
  transform: translateX(0);
1619
1619
  }
1620
1620
  }
1621
- @keyframes _panelOut_cozou_1 {
1621
+ @keyframes _panelOut_1fxeg_1 {
1622
1622
  from {
1623
1623
  opacity: 1;
1624
1624
  transform: translateX(0);
@@ -1628,23 +1628,23 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
1628
1628
  transform: translateX(100%);
1629
1629
  }
1630
1630
  }
1631
- ._overlay_cozou_43 {
1631
+ ._overlay_1fxeg_43 {
1632
1632
  position: fixed;
1633
1633
  inset: 0;
1634
1634
  z-index: 98;
1635
1635
  }
1636
- ._overlayBackdrop_cozou_49 {
1636
+ ._overlayBackdrop_1fxeg_49 {
1637
1637
  position: absolute;
1638
1638
  inset: 0;
1639
1639
  background: color-mix(in srgb, var(--body-bg) 50%, transparent);
1640
1640
  }
1641
- ._overlay_cozou_43[data-state="open"] {
1642
- animation: _overlayIn_cozou_1 160ms ease-out;
1641
+ ._overlay_1fxeg_43[data-state="open"] {
1642
+ animation: _overlayIn_1fxeg_1 160ms ease-out;
1643
1643
  }
1644
- ._overlay_cozou_43[data-state="closed"] {
1645
- animation: _overlayOut_cozou_1 120ms ease-in;
1644
+ ._overlay_1fxeg_43[data-state="closed"] {
1645
+ animation: _overlayOut_1fxeg_1 120ms ease-in;
1646
1646
  }
1647
- ._content_cozou_63 {
1647
+ ._content_1fxeg_63 {
1648
1648
  position: fixed;
1649
1649
  top: 10px;
1650
1650
  right: 10px;
@@ -1657,20 +1657,29 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
1657
1657
  display: flex;
1658
1658
  flex-direction: column;
1659
1659
  }
1660
- ._content_cozou_63[data-state="open"] {
1661
- animation: _panelIn_cozou_1 180ms cubic-bezier(0.16, 1, 0.3, 1);
1660
+ ._content_1fxeg_63[data-state="open"] {
1661
+ animation: _panelIn_1fxeg_1 180ms cubic-bezier(0.16, 1, 0.3, 1);
1662
1662
  }
1663
- ._content_cozou_63[data-state="closed"] {
1664
- animation: _panelOut_cozou_1 140ms ease-in;
1663
+ ._content_1fxeg_63[data-state="closed"] {
1664
+ animation: _panelOut_1fxeg_1 140ms ease-in;
1665
1665
  }
1666
- ._title_cozou_88 {
1666
+ body.jcui-modal-mobile ._content_1fxeg_63 {
1667
+ top: 0;
1668
+ right: 0;
1669
+ bottom: 0;
1670
+ left: 0;
1671
+ min-width: 0;
1672
+ }
1673
+ ._title_1fxeg_96 {
1667
1674
  margin: 0;
1668
1675
  }
1669
- ._body_cozou_92 {
1676
+ ._body_1fxeg_100 {
1670
1677
  flex: 1;
1678
+ min-height: 0;
1679
+ overflow-y: auto;
1671
1680
  padding-top: 1rem;
1672
1681
  }
1673
- ._footer_cozou_97 {
1682
+ ._footer_1fxeg_107 {
1674
1683
  margin: -12px;
1675
1684
  margin-top: 0px;
1676
1685
  padding: 12px;
@@ -27812,12 +27821,12 @@ var Overlay = DialogOverlay;
27812
27821
  var Content = DialogContent;
27813
27822
  var Title = DialogTitle;
27814
27823
  var Close = DialogClose;
27815
- const overlay = "_overlay_cozou_43";
27816
- const overlayBackdrop = "_overlayBackdrop_cozou_49";
27817
- const content$1 = "_content_cozou_63";
27818
- const title = "_title_cozou_88";
27819
- const body = "_body_cozou_92";
27820
- const footer = "_footer_cozou_97";
27824
+ const overlay = "_overlay_1fxeg_43";
27825
+ const overlayBackdrop = "_overlayBackdrop_1fxeg_49";
27826
+ const content$1 = "_content_1fxeg_63";
27827
+ const title = "_title_1fxeg_96";
27828
+ const body = "_body_1fxeg_100";
27829
+ const footer = "_footer_1fxeg_107";
27821
27830
  const styles$1 = {
27822
27831
  overlay,
27823
27832
  overlayBackdrop,
@@ -27905,6 +27914,7 @@ const global = {
27905
27914
  const JCUIProvider = ({
27906
27915
  children: children2,
27907
27916
  theme: initialTheme = DEFAULT_THEME,
27917
+ modalMobileBreakpoint = 600,
27908
27918
  className,
27909
27919
  ...props
27910
27920
  }) => {
@@ -27924,6 +27934,26 @@ const JCUIProvider = ({
27924
27934
  body2.classList.remove(themeClass, globalClass);
27925
27935
  };
27926
27936
  }, [themeClass, globalClass]);
27937
+ React.useEffect(() => {
27938
+ if (typeof document === "undefined" || typeof window === "undefined") {
27939
+ return void 0;
27940
+ }
27941
+ const body2 = document.body;
27942
+ const parsedBreakpoint = Number(modalMobileBreakpoint);
27943
+ const breakpoint = Number.isFinite(parsedBreakpoint) && parsedBreakpoint > 0 ? parsedBreakpoint : 600;
27944
+ const updateModalMobileState = () => {
27945
+ const isMobile = window.innerWidth <= breakpoint;
27946
+ body2.classList.toggle("jcui-modal-mobile", isMobile);
27947
+ body2.style.setProperty("--jcui-modal-mobile-breakpoint", `${breakpoint}px`);
27948
+ };
27949
+ updateModalMobileState();
27950
+ window.addEventListener("resize", updateModalMobileState);
27951
+ return () => {
27952
+ window.removeEventListener("resize", updateModalMobileState);
27953
+ body2.classList.remove("jcui-modal-mobile");
27954
+ body2.style.removeProperty("--jcui-modal-mobile-breakpoint");
27955
+ };
27956
+ }, [modalMobileBreakpoint]);
27927
27957
  const contextValue = React.useMemo(() => ({ theme, setTheme }), [theme]);
27928
27958
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
27929
27959
  "div",
package/dist/jcui.es.js CHANGED
@@ -1592,7 +1592,7 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
1592
1592
  --button-color: var(--body-color);
1593
1593
  }
1594
1594
  /* modal.module.css */
1595
- @keyframes _overlayIn_cozou_1 {
1595
+ @keyframes _overlayIn_1fxeg_1 {
1596
1596
  from {
1597
1597
  opacity: 0;
1598
1598
  }
@@ -1600,7 +1600,7 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
1600
1600
  opacity: 1;
1601
1601
  }
1602
1602
  }
1603
- @keyframes _overlayOut_cozou_1 {
1603
+ @keyframes _overlayOut_1fxeg_1 {
1604
1604
  from {
1605
1605
  opacity: 1;
1606
1606
  }
@@ -1608,7 +1608,7 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
1608
1608
  opacity: 0;
1609
1609
  }
1610
1610
  }
1611
- @keyframes _panelIn_cozou_1 {
1611
+ @keyframes _panelIn_1fxeg_1 {
1612
1612
  from {
1613
1613
  opacity: 0;
1614
1614
  transform: translateX(400px);
@@ -1618,7 +1618,7 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
1618
1618
  transform: translateX(0);
1619
1619
  }
1620
1620
  }
1621
- @keyframes _panelOut_cozou_1 {
1621
+ @keyframes _panelOut_1fxeg_1 {
1622
1622
  from {
1623
1623
  opacity: 1;
1624
1624
  transform: translateX(0);
@@ -1628,23 +1628,23 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
1628
1628
  transform: translateX(100%);
1629
1629
  }
1630
1630
  }
1631
- ._overlay_cozou_43 {
1631
+ ._overlay_1fxeg_43 {
1632
1632
  position: fixed;
1633
1633
  inset: 0;
1634
1634
  z-index: 98;
1635
1635
  }
1636
- ._overlayBackdrop_cozou_49 {
1636
+ ._overlayBackdrop_1fxeg_49 {
1637
1637
  position: absolute;
1638
1638
  inset: 0;
1639
1639
  background: color-mix(in srgb, var(--body-bg) 50%, transparent);
1640
1640
  }
1641
- ._overlay_cozou_43[data-state="open"] {
1642
- animation: _overlayIn_cozou_1 160ms ease-out;
1641
+ ._overlay_1fxeg_43[data-state="open"] {
1642
+ animation: _overlayIn_1fxeg_1 160ms ease-out;
1643
1643
  }
1644
- ._overlay_cozou_43[data-state="closed"] {
1645
- animation: _overlayOut_cozou_1 120ms ease-in;
1644
+ ._overlay_1fxeg_43[data-state="closed"] {
1645
+ animation: _overlayOut_1fxeg_1 120ms ease-in;
1646
1646
  }
1647
- ._content_cozou_63 {
1647
+ ._content_1fxeg_63 {
1648
1648
  position: fixed;
1649
1649
  top: 10px;
1650
1650
  right: 10px;
@@ -1657,20 +1657,29 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
1657
1657
  display: flex;
1658
1658
  flex-direction: column;
1659
1659
  }
1660
- ._content_cozou_63[data-state="open"] {
1661
- animation: _panelIn_cozou_1 180ms cubic-bezier(0.16, 1, 0.3, 1);
1660
+ ._content_1fxeg_63[data-state="open"] {
1661
+ animation: _panelIn_1fxeg_1 180ms cubic-bezier(0.16, 1, 0.3, 1);
1662
1662
  }
1663
- ._content_cozou_63[data-state="closed"] {
1664
- animation: _panelOut_cozou_1 140ms ease-in;
1663
+ ._content_1fxeg_63[data-state="closed"] {
1664
+ animation: _panelOut_1fxeg_1 140ms ease-in;
1665
1665
  }
1666
- ._title_cozou_88 {
1666
+ body.jcui-modal-mobile ._content_1fxeg_63 {
1667
+ top: 0;
1668
+ right: 0;
1669
+ bottom: 0;
1670
+ left: 0;
1671
+ min-width: 0;
1672
+ }
1673
+ ._title_1fxeg_96 {
1667
1674
  margin: 0;
1668
1675
  }
1669
- ._body_cozou_92 {
1676
+ ._body_1fxeg_100 {
1670
1677
  flex: 1;
1678
+ min-height: 0;
1679
+ overflow-y: auto;
1671
1680
  padding-top: 1rem;
1672
1681
  }
1673
- ._footer_cozou_97 {
1682
+ ._footer_1fxeg_107 {
1674
1683
  margin: -12px;
1675
1684
  margin-top: 0px;
1676
1685
  padding: 12px;
@@ -27794,12 +27803,12 @@ var Overlay = DialogOverlay;
27794
27803
  var Content = DialogContent;
27795
27804
  var Title = DialogTitle;
27796
27805
  var Close = DialogClose;
27797
- const overlay = "_overlay_cozou_43";
27798
- const overlayBackdrop = "_overlayBackdrop_cozou_49";
27799
- const content$1 = "_content_cozou_63";
27800
- const title = "_title_cozou_88";
27801
- const body = "_body_cozou_92";
27802
- const footer = "_footer_cozou_97";
27806
+ const overlay = "_overlay_1fxeg_43";
27807
+ const overlayBackdrop = "_overlayBackdrop_1fxeg_49";
27808
+ const content$1 = "_content_1fxeg_63";
27809
+ const title = "_title_1fxeg_96";
27810
+ const body = "_body_1fxeg_100";
27811
+ const footer = "_footer_1fxeg_107";
27803
27812
  const styles$1 = {
27804
27813
  overlay,
27805
27814
  overlayBackdrop,
@@ -27887,6 +27896,7 @@ const global$1 = {
27887
27896
  const JCUIProvider = ({
27888
27897
  children: children2,
27889
27898
  theme: initialTheme = DEFAULT_THEME,
27899
+ modalMobileBreakpoint = 600,
27890
27900
  className,
27891
27901
  ...props
27892
27902
  }) => {
@@ -27906,6 +27916,26 @@ const JCUIProvider = ({
27906
27916
  body2.classList.remove(themeClass, globalClass);
27907
27917
  };
27908
27918
  }, [themeClass, globalClass]);
27919
+ useEffect(() => {
27920
+ if (typeof document === "undefined" || typeof window === "undefined") {
27921
+ return void 0;
27922
+ }
27923
+ const body2 = document.body;
27924
+ const parsedBreakpoint = Number(modalMobileBreakpoint);
27925
+ const breakpoint = Number.isFinite(parsedBreakpoint) && parsedBreakpoint > 0 ? parsedBreakpoint : 600;
27926
+ const updateModalMobileState = () => {
27927
+ const isMobile = window.innerWidth <= breakpoint;
27928
+ body2.classList.toggle("jcui-modal-mobile", isMobile);
27929
+ body2.style.setProperty("--jcui-modal-mobile-breakpoint", `${breakpoint}px`);
27930
+ };
27931
+ updateModalMobileState();
27932
+ window.addEventListener("resize", updateModalMobileState);
27933
+ return () => {
27934
+ window.removeEventListener("resize", updateModalMobileState);
27935
+ body2.classList.remove("jcui-modal-mobile");
27936
+ body2.style.removeProperty("--jcui-modal-mobile-breakpoint");
27937
+ };
27938
+ }, [modalMobileBreakpoint]);
27909
27939
  const contextValue = useMemo(() => ({ theme, setTheme }), [theme]);
27910
27940
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
27911
27941
  "div",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jackcrane/ui",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "dist/jcui.cjs.js",