1.0.91 • Published 7 months ago

@os-design/utils v1.0.91

Weekly downloads
518
License
UNLICENSED
Repository
-
Last release
7 months ago

@os-design/utils NPM version BundlePhobia

Utils and hooks used in os-design.

  1. ErrorBoundary – The Error Boundary component. Fully supports Relay (useQueryLoader/loadQuery, useLazyLoadQuery).
  2. isTouchDevice – Detects whether the client device is touch-enabled.
  3. omitEmotionProps – Disables forwarding the specified properties to the element.
  4. useAutoScroll – Auto scrolls if the cursor is near the border of the scrollable element. It works on both mouse and touch devices.
  5. useBodyScroll – Enables or disables scrolling of the body element.
  6. useBrowserLayoutEffect – Mocks the useLayoutEffect on the server side.
  7. useClickOutside – Sets the listener that will be called when the click event occurs outside the target element.
  8. useClosable – Sets the closed state to true after a delay to apply the fade out animation.
  9. useCursorPosition – Returns the position of the cursor. It works on both mouse and touch devices.
  10. useDebounce – The callback function will be called only when N ms has elapsed after the last call attempt.
  11. useDrag – Handles the drag gesture. On touch devices, the event is triggered by a long press. Otherwise, when you click on the element and start dragging it.
  12. useEvent – Sets the listener that will be called whenever the specified event occurs.
  13. useFontSize – Computes the font size of the element.
  14. useForwardedRef – Allows to use the forwardedRef.
  15. useForwardedState – Uses the inner state if the passed value is undefined.
  16. useInterval – The hook to use the setInterval function.
  17. useKeyPress – Sets the listener that will be called whenever the key down event occurs.
  18. useLongPress – Sets the listener that will be called whenever the long press event occurs. It only works on touch devices.
  19. useMemoObject – Reuse the previous version of an object value unless it has changed.
  20. usePreventDefaultEvent – Prevents the default action of the specified event.
  21. usePrevious – Returns the previous value.
  22. useResizeObserver – Sets the listener that will be called whenever the resize event of an element occurs.
  23. useSafeAreaInset – Calculates the safe area inset.
  24. useSize – Returns the width and height of the container. By default, the container is window.
  25. useSwipe – Allows you to implement the swipe gesture in any container. It only works on touch devices.
  26. useThrottle – The callback function will be called no more than once during the N ms, even if it is called many times during that period.
  27. useVh – Sets the --vh css variable.

Installation

Install the package using the following command:

yarn add @os-design/utils

See all the features in the Storybook.

1.0.77

11 months ago

1.0.79

11 months ago

1.0.78

11 months ago

1.0.80

11 months ago

1.0.84

11 months ago

1.0.83

11 months ago

1.0.82

11 months ago

1.0.81

11 months ago

1.0.88

8 months ago

1.0.87

9 months ago

1.0.86

9 months ago

1.0.85

11 months ago

1.0.89

7 months ago

1.0.91

7 months ago

1.0.90

7 months ago

1.0.73

1 year ago

1.0.72

1 year ago

1.0.76

1 year ago

1.0.75

1 year ago

1.0.74

1 year ago

1.0.71

2 years ago

1.0.69

2 years ago

1.0.68

2 years ago

1.0.70

2 years ago

1.0.62

2 years ago

1.0.61

2 years ago

1.0.60

2 years ago

1.0.66

2 years ago

1.0.65

2 years ago

1.0.64

2 years ago

1.0.63

2 years ago

1.0.67

2 years ago

1.0.59

3 years ago

1.0.58

3 years ago

1.0.55

3 years ago

1.0.57

3 years ago

1.0.56

3 years ago

1.0.54

3 years ago

1.0.53

3 years ago

1.0.52

3 years ago

1.0.48

3 years ago

1.0.47

3 years ago

1.0.50

3 years ago

1.0.44

4 years ago

1.0.46

4 years ago

1.0.45

4 years ago

1.0.43

4 years ago

1.0.42

4 years ago

1.0.40

4 years ago

1.0.41

4 years ago

1.0.39

4 years ago

1.0.38

4 years ago

1.0.37

4 years ago

1.0.36

4 years ago

1.0.35

4 years ago

1.0.33

4 years ago

1.0.34

4 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.29

5 years ago

1.0.28

5 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.22

5 years ago

1.0.23

5 years ago

1.0.21

5 years ago

1.0.19

5 years ago

1.0.20

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.9

5 years ago

1.0.10

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.0

5 years ago

0.0.33

5 years ago

0.0.31

5 years ago

0.0.32

5 years ago

0.0.30

5 years ago

0.0.29

5 years ago

0.0.28

5 years ago

0.0.27

5 years ago

0.0.26

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

6 years ago

0.0.18

6 years ago

0.0.16

6 years ago

0.0.17

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago