@teamturing/react-kit 2.15.0 → 2.15.1

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.
@@ -0,0 +1,3 @@
1
+ import { useEffect } from 'react';
2
+ declare const useSafeLayoutEffect: typeof useEffect;
3
+ export default useSafeLayoutEffect;
package/dist/index.d.ts CHANGED
@@ -86,6 +86,7 @@ export { default as useOutsideClick } from './hook/useOutsideClick';
86
86
  export { default as useProvidedOrCreatedRef } from './hook/useProvidedOrCreatedRef';
87
87
  export { default as useRelocation } from './hook/useRelocation';
88
88
  export { default as useResize } from './hook/useResize';
89
+ export { default as useSafeLayoutEffect } from './hook/useSafeLayoutEffect';
89
90
  export { default as useToggleHandler } from './hook/useToggleHandler';
90
91
  /**
91
92
  * theme
package/dist/index.js CHANGED
@@ -16256,6 +16256,8 @@ const useProvidedOrCreatedRef = providedRef => {
16256
16256
  return providedRef ?? createdRef;
16257
16257
  };
16258
16258
 
16259
+ const useSafeLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? React.useLayoutEffect : React.useEffect;
16260
+
16259
16261
  const Checkbox = ({
16260
16262
  checked,
16261
16263
  validationStatus,
@@ -16263,7 +16265,7 @@ const Checkbox = ({
16263
16265
  ...props
16264
16266
  }, ref) => {
16265
16267
  const checkboxRef = useProvidedOrCreatedRef(ref);
16266
- React.useLayoutEffect(() => {
16268
+ useSafeLayoutEffect(() => {
16267
16269
  if (checkboxRef.current) {
16268
16270
  checkboxRef.current.indeterminate = indeterminate || false;
16269
16271
  }
@@ -22907,6 +22909,7 @@ exports.useOutsideClick = useOutsideClick;
22907
22909
  exports.useProvidedOrCreatedRef = useProvidedOrCreatedRef;
22908
22910
  exports.useRelocation = useRelocation;
22909
22911
  exports.useResize = useResize;
22912
+ exports.useSafeLayoutEffect = useSafeLayoutEffect;
22910
22913
  exports.useToggleHandler = useToggleHandler;
22911
22914
  exports.whiteSpace = whiteSpace;
22912
22915
  exports.wordBreak = wordBreak;
@@ -1,6 +1,7 @@
1
- import { forwardRef, useLayoutEffect } from 'react';
1
+ import { forwardRef } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
3
  import useProvidedOrCreatedRef from '../../hook/useProvidedOrCreatedRef.js';
4
+ import useSafeLayoutEffect from '../../hook/useSafeLayoutEffect.js';
4
5
  import { forcePixelValue } from '../../utils/forcePixelValue.js';
5
6
  import { sx } from '../../utils/styled-system/index.js';
6
7
  import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
@@ -12,7 +13,7 @@ const Checkbox = ({
12
13
  ...props
13
14
  }, ref) => {
14
15
  const checkboxRef = useProvidedOrCreatedRef(ref);
15
- useLayoutEffect(() => {
16
+ useSafeLayoutEffect(() => {
16
17
  if (checkboxRef.current) {
17
18
  checkboxRef.current.indeterminate = indeterminate || false;
18
19
  }
@@ -0,0 +1,5 @@
1
+ import { useLayoutEffect, useEffect } from 'react';
2
+
3
+ const useSafeLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? useLayoutEffect : useEffect;
4
+
5
+ export { useSafeLayoutEffect as default };
package/esm/index.js CHANGED
@@ -43,6 +43,7 @@ export { default as useOutsideClick } from './hook/useOutsideClick.js';
43
43
  export { default as useProvidedOrCreatedRef } from './hook/useProvidedOrCreatedRef.js';
44
44
  export { default as useRelocation } from './hook/useRelocation.js';
45
45
  export { default as useResize } from './hook/useResize.js';
46
+ export { default as useSafeLayoutEffect } from './hook/useSafeLayoutEffect.js';
46
47
  export { default as useToggleHandler } from './hook/useToggleHandler.js';
47
48
  export { default as theme } from './theme/index.js';
48
49
  export { lineClamp, sx, textDecoration, whiteSpace, wordBreak } from './utils/styled-system/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamturing/react-kit",
3
- "version": "2.15.0",
3
+ "version": "2.15.1",
4
4
  "description": "React components, hooks for create teamturing web application",
5
5
  "author": "Sungchang Park <psch300@gmail.com> (https://github.com/psch300)",
6
6
  "homepage": "https://github.com/weareteamturing/bombe#readme",
@@ -62,5 +62,5 @@
62
62
  "react-is": "^18.2.0",
63
63
  "styled-system": "^5.1.5"
64
64
  },
65
- "gitHead": "1bcbd7b8edfacb8d04d1814e3965f3a432fc0e87"
65
+ "gitHead": "4dd8a356f2d54ce591d4f7b988f92b8098c500ef"
66
66
  }