@app-studio/web 0.8.92 → 0.8.93

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.
@@ -3401,18 +3401,6 @@ var BadgeView = _ref => {
3401
3401
  // Badge component that displays a small indicator, typically used for counts or status
3402
3402
  var Badge = props => /*#__PURE__*/React__default.createElement(BadgeView, Object.assign({}, props));
3403
3403
 
3404
- var useButtonState = () => {
3405
- var [isHovered, setIsHovered] = React__default.useState(false);
3406
- // This custom react hook 'useButtonState' is defined for managing the state of a button, especially for hover interactions.
3407
- return {
3408
- isHovered,
3409
- setIsHovered
3410
- };
3411
- // The 'setIsHovered' function is used to update the value of 'isHovered' state when the hover status of the button changes.
3412
- // A state variable 'isHovered' is declared with its initial value set to 'false', indicating that the button is not hovered by default.
3413
- };
3414
- // The hook returns an object containing 'isHovered' state and the 'setIsHovered' function to enable state management from the consumer component.
3415
-
3416
3404
  // This function initializes the Link component's state using the useState hook and exposes its state and setter function.
3417
3405
  var useLinkState = () => {
3418
3406
  var [isHovered, setIsHovered] = React.useState(false);
@@ -3997,25 +3985,14 @@ var ButtonView = _ref => {
3997
3985
 
3998
3986
  // Importing a custom hook to manage the state specific to the button component.
3999
3987
  var ButtonComponent = props => {
4000
- // Importing the view part of the button, which is presumably a presentational component.
4001
- var {
4002
- isHovered,
4003
- setIsHovered
4004
- } = useButtonState();
4005
- // Defining the button component with generic React Functional Component type augmented with ButtonProps type.
4006
- var handleHover = () => setIsHovered(!isHovered);
3988
+ var [ref, hover] = appStudio.useHover();
4007
3989
  // Destructuring the state and state update function from the custom hook for button state management.
4008
3990
  return (
4009
3991
  /*#__PURE__*/
4010
3992
  // Defines a function to toggle the hover state of the button.
4011
3993
  React__default.createElement(ButtonView, Object.assign({
4012
- isHovered: isHovered,
4013
- // Rendering the ButtonView component and spreading the received props on it.
4014
- setIsHovered: setIsHovered,
4015
- // Passing the isHovered state and the setIsHovered function to the ButtonView.
4016
- onMouseEnter: handleHover,
4017
- // Binding handleHover function to onMouseEnter and onMouseLeave events to toggle hover effect.
4018
- onMouseLeave: handleHover
3994
+ ref: ref,
3995
+ isHovered: hover
4019
3996
  }, props))
4020
3997
  );
4021
3998
  // Exports the Button component for use in other parts of the application.