@jackcrane/ui 0.1.18 → 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_3g5sg_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_3g5sg_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_3g5sg_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_3g5sg_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_3g5sg_43 {
1631
+ ._overlay_1fxeg_43 {
1632
1632
  position: fixed;
1633
1633
  inset: 0;
1634
1634
  z-index: 98;
1635
1635
  }
1636
- ._overlayBackdrop_3g5sg_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_3g5sg_43[data-state="open"] {
1642
- animation: _overlayIn_3g5sg_1 160ms ease-out;
1641
+ ._overlay_1fxeg_43[data-state="open"] {
1642
+ animation: _overlayIn_1fxeg_1 160ms ease-out;
1643
1643
  }
1644
- ._overlay_3g5sg_43[data-state="closed"] {
1645
- animation: _overlayOut_3g5sg_1 120ms ease-in;
1644
+ ._overlay_1fxeg_43[data-state="closed"] {
1645
+ animation: _overlayOut_1fxeg_1 120ms ease-in;
1646
1646
  }
1647
- ._content_3g5sg_63 {
1647
+ ._content_1fxeg_63 {
1648
1648
  position: fixed;
1649
1649
  top: 10px;
1650
1650
  right: 10px;
@@ -1657,22 +1657,29 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
1657
1657
  display: flex;
1658
1658
  flex-direction: column;
1659
1659
  }
1660
- ._content_3g5sg_63[data-state="open"] {
1661
- animation: _panelIn_3g5sg_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_3g5sg_63[data-state="closed"] {
1664
- animation: _panelOut_3g5sg_1 140ms ease-in;
1663
+ ._content_1fxeg_63[data-state="closed"] {
1664
+ animation: _panelOut_1fxeg_1 140ms ease-in;
1665
1665
  }
1666
- ._title_3g5sg_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_3g5sg_92 {
1676
+ ._body_1fxeg_100 {
1670
1677
  flex: 1;
1671
1678
  min-height: 0;
1672
1679
  overflow-y: auto;
1673
1680
  padding-top: 1rem;
1674
1681
  }
1675
- ._footer_3g5sg_99 {
1682
+ ._footer_1fxeg_107 {
1676
1683
  margin: -12px;
1677
1684
  margin-top: 0px;
1678
1685
  padding: 12px;
@@ -27814,12 +27821,12 @@ var Overlay = DialogOverlay;
27814
27821
  var Content = DialogContent;
27815
27822
  var Title = DialogTitle;
27816
27823
  var Close = DialogClose;
27817
- const overlay = "_overlay_3g5sg_43";
27818
- const overlayBackdrop = "_overlayBackdrop_3g5sg_49";
27819
- const content$1 = "_content_3g5sg_63";
27820
- const title = "_title_3g5sg_88";
27821
- const body = "_body_3g5sg_92";
27822
- const footer = "_footer_3g5sg_99";
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";
27823
27830
  const styles$1 = {
27824
27831
  overlay,
27825
27832
  overlayBackdrop,
@@ -27907,6 +27914,7 @@ const global = {
27907
27914
  const JCUIProvider = ({
27908
27915
  children: children2,
27909
27916
  theme: initialTheme = DEFAULT_THEME,
27917
+ modalMobileBreakpoint = 600,
27910
27918
  className,
27911
27919
  ...props
27912
27920
  }) => {
@@ -27926,6 +27934,26 @@ const JCUIProvider = ({
27926
27934
  body2.classList.remove(themeClass, globalClass);
27927
27935
  };
27928
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]);
27929
27957
  const contextValue = React.useMemo(() => ({ theme, setTheme }), [theme]);
27930
27958
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
27931
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_3g5sg_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_3g5sg_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_3g5sg_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_3g5sg_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_3g5sg_43 {
1631
+ ._overlay_1fxeg_43 {
1632
1632
  position: fixed;
1633
1633
  inset: 0;
1634
1634
  z-index: 98;
1635
1635
  }
1636
- ._overlayBackdrop_3g5sg_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_3g5sg_43[data-state="open"] {
1642
- animation: _overlayIn_3g5sg_1 160ms ease-out;
1641
+ ._overlay_1fxeg_43[data-state="open"] {
1642
+ animation: _overlayIn_1fxeg_1 160ms ease-out;
1643
1643
  }
1644
- ._overlay_3g5sg_43[data-state="closed"] {
1645
- animation: _overlayOut_3g5sg_1 120ms ease-in;
1644
+ ._overlay_1fxeg_43[data-state="closed"] {
1645
+ animation: _overlayOut_1fxeg_1 120ms ease-in;
1646
1646
  }
1647
- ._content_3g5sg_63 {
1647
+ ._content_1fxeg_63 {
1648
1648
  position: fixed;
1649
1649
  top: 10px;
1650
1650
  right: 10px;
@@ -1657,22 +1657,29 @@ div.jcui_chamfer:not(.jcui_disabled):focus-within {
1657
1657
  display: flex;
1658
1658
  flex-direction: column;
1659
1659
  }
1660
- ._content_3g5sg_63[data-state="open"] {
1661
- animation: _panelIn_3g5sg_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_3g5sg_63[data-state="closed"] {
1664
- animation: _panelOut_3g5sg_1 140ms ease-in;
1663
+ ._content_1fxeg_63[data-state="closed"] {
1664
+ animation: _panelOut_1fxeg_1 140ms ease-in;
1665
1665
  }
1666
- ._title_3g5sg_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_3g5sg_92 {
1676
+ ._body_1fxeg_100 {
1670
1677
  flex: 1;
1671
1678
  min-height: 0;
1672
1679
  overflow-y: auto;
1673
1680
  padding-top: 1rem;
1674
1681
  }
1675
- ._footer_3g5sg_99 {
1682
+ ._footer_1fxeg_107 {
1676
1683
  margin: -12px;
1677
1684
  margin-top: 0px;
1678
1685
  padding: 12px;
@@ -27796,12 +27803,12 @@ var Overlay = DialogOverlay;
27796
27803
  var Content = DialogContent;
27797
27804
  var Title = DialogTitle;
27798
27805
  var Close = DialogClose;
27799
- const overlay = "_overlay_3g5sg_43";
27800
- const overlayBackdrop = "_overlayBackdrop_3g5sg_49";
27801
- const content$1 = "_content_3g5sg_63";
27802
- const title = "_title_3g5sg_88";
27803
- const body = "_body_3g5sg_92";
27804
- const footer = "_footer_3g5sg_99";
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";
27805
27812
  const styles$1 = {
27806
27813
  overlay,
27807
27814
  overlayBackdrop,
@@ -27889,6 +27896,7 @@ const global$1 = {
27889
27896
  const JCUIProvider = ({
27890
27897
  children: children2,
27891
27898
  theme: initialTheme = DEFAULT_THEME,
27899
+ modalMobileBreakpoint = 600,
27892
27900
  className,
27893
27901
  ...props
27894
27902
  }) => {
@@ -27908,6 +27916,26 @@ const JCUIProvider = ({
27908
27916
  body2.classList.remove(themeClass, globalClass);
27909
27917
  };
27910
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]);
27911
27939
  const contextValue = useMemo(() => ({ theme, setTheme }), [theme]);
27912
27940
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
27913
27941
  "div",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jackcrane/ui",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "dist/jcui.cjs.js",