@hyphen/hyphen-components 2.25.0 → 2.25.2

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.
@@ -3847,7 +3847,9 @@ var SidebarProvider = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
3847
3847
  children = _ref.children,
3848
3848
  props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
3849
3849
  var isMobile = useIsMobile();
3850
- var _useState = React.useState(openProp != null ? openProp : defaultOpen),
3850
+ var _useState = React.useState(function () {
3851
+ return isMobile ? false : openProp != null ? openProp : defaultOpen;
3852
+ }),
3851
3853
  openMobile = _useState[0],
3852
3854
  setOpenMobile = _useState[1];
3853
3855
  // Manages sidebar open state with a fallback to internal state when openProp is not provided
@@ -3855,6 +3857,14 @@ var SidebarProvider = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
3855
3857
  _open = _useState2[0],
3856
3858
  _setOpen = _useState2[1];
3857
3859
  var open = openProp != null ? openProp : _open;
3860
+ // Update open state when openProp or isMobile changes
3861
+ React.useEffect(function () {
3862
+ if (isMobile) {
3863
+ setOpenMobile(false); // Always start closed on mobile
3864
+ } else {
3865
+ _setOpen(openProp != null ? openProp : defaultOpen); // Use desktop state
3866
+ }
3867
+ }, [isMobile, openProp, defaultOpen]);
3858
3868
  var setOpen = React.useCallback(function (value) {
3859
3869
  var newOpenState = typeof value === 'function' ? value(open) : value;
3860
3870
  if (newOpenState !== open) {
@@ -3888,12 +3898,6 @@ var SidebarProvider = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
3888
3898
  return window.removeEventListener('keydown', handleKeyDown);
3889
3899
  };
3890
3900
  }, [toggleSidebar]);
3891
- // Update open state when `isMobile` changes
3892
- React.useEffect(function () {
3893
- if (isMobile && open) {
3894
- setOpenMobile(open);
3895
- }
3896
- }, [isMobile, open]);
3897
3901
  // Assign state for data attributes
3898
3902
  var state = open ? 'expanded' : 'collapsed';
3899
3903
  var contextValue = React.useMemo(function () {
@@ -3942,7 +3946,8 @@ var Sidebar = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
3942
3946
  placement: side
3943
3947
  }, React.createElement(Box, {
3944
3948
  "data-sidebar": "sidebar",
3945
- "data-mobile": "true"
3949
+ "data-mobile": "true",
3950
+ height: "100"
3946
3951
  }, children));
3947
3952
  }
3948
3953
  if (collapsible === 'none') {
@@ -4006,7 +4011,7 @@ var SidebarTrigger = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
4006
4011
  variant: "tertiary",
4007
4012
  size: "sm",
4008
4013
  iconPrefix: "dock-left",
4009
- className: className,
4014
+ className: classNames('m-left-sm m-left-0-tablet', className),
4010
4015
  onClick: function onClick(event) {
4011
4016
  _onClick == null || _onClick(event);
4012
4017
  toggleSidebar();
@@ -4020,7 +4025,7 @@ var SidebarInset = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
4020
4025
  props = _objectWithoutPropertiesLoose(_ref4, _excluded4);
4021
4026
  return React.createElement("main", _extends({
4022
4027
  ref: ref,
4023
- className: classNames('display-flex flex-auto flex-direction-column g-lg align-items-flex-start p-lg background-color-secondary', className)
4028
+ className: classNames('display-flex flex-auto flex-direction-column g-lg align-items-flex-start p-h-0 p-top-lg p-bottom-0 p-lg-tablet background-color-secondary', className)
4024
4029
  }, props));
4025
4030
  });
4026
4031
  SidebarInset.displayName = 'SidebarInset';