@primer/components 31.2.0-rc.5ccefd7d → 31.2.0-rc.85bcb6e0

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.
package/lib/Overlay.js CHANGED
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _constants = require("./constants");
13
13
 
14
+ var _useIsomorphicLayoutEffect = _interopRequireDefault(require("./utils/useIsomorphicLayoutEffect"));
15
+
14
16
  var _hooks = require("./hooks");
15
17
 
16
18
  var _Portal = _interopRequireDefault(require("./Portal"));
@@ -139,7 +141,7 @@ const Overlay = /*#__PURE__*/_react.default.forwardRef(({
139
141
  combinedRef.current.style.height = `${combinedRef.current.clientHeight}px`;
140
142
  }
141
143
  }, [height, combinedRef]);
142
- (0, _react.useLayoutEffect)(() => {
144
+ (0, _useIsomorphicLayoutEffect.default)(() => {
143
145
  var _overlayRef$current;
144
146
 
145
147
  const {
@@ -10,6 +10,8 @@ var _react = _interopRequireDefault(require("react"));
10
10
 
11
11
  var _reactDom = require("react-dom");
12
12
 
13
+ var _useIsomorphicLayoutEffect = _interopRequireDefault(require("../utils/useIsomorphicLayoutEffect"));
14
+
13
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
16
 
15
17
  const PRIMER_PORTAL_ROOT_ID = '__primerPortalRoot__';
@@ -72,7 +74,7 @@ const Portal = ({
72
74
 
73
75
  const elementRef = _react.default.useRef(hostElement);
74
76
 
75
- _react.default.useLayoutEffect(() => {
77
+ (0, _useIsomorphicLayoutEffect.default)(() => {
76
78
  let containerName = _containerName;
77
79
 
78
80
  if (containerName === undefined) {
@@ -93,7 +95,6 @@ const Portal = ({
93
95
  parentElement.removeChild(element);
94
96
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
95
97
  }, [elementRef]);
96
-
97
98
  return /*#__PURE__*/(0, _reactDom.createPortal)(children, elementRef.current);
98
99
  };
99
100
 
@@ -13,6 +13,8 @@ var _useProvidedRefOrCreate = require("./useProvidedRefOrCreate");
13
13
 
14
14
  var _useResizeObserver = require("./useResizeObserver");
15
15
 
16
+ var _useIsomorphicLayoutEffect = _interopRequireDefault(require("../utils/useIsomorphicLayoutEffect"));
17
+
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
19
 
18
20
  /**
@@ -39,8 +41,7 @@ function useAnchoredPosition(settings, dependencies = []) {
39
41
  }, // eslint-disable-next-line react-hooks/exhaustive-deps
40
42
  [floatingElementRef, anchorElementRef, ...dependencies]);
41
43
 
42
- _react.default.useLayoutEffect(updatePosition, [updatePosition]);
43
-
44
+ (0, _useIsomorphicLayoutEffect.default)(updatePosition, [updatePosition]);
44
45
  (0, _useResizeObserver.useResizeObserver)(updatePosition);
45
46
  return {
46
47
  floatingElementRef,
@@ -1,4 +1,4 @@
1
- import React, { ForwardedRef } from 'react';
1
+ import { ForwardedRef } from 'react';
2
2
  /**
3
3
  * Creates a ref by combining multiple constituent refs. The ref returned by this hook
4
4
  * should be passed as the ref for the element that needs to be shared. This is
@@ -7,4 +7,4 @@ import React, { ForwardedRef } from 'react';
7
7
  * though, as it breaks encapsulation.
8
8
  * @param refs
9
9
  */
10
- export declare function useCombinedRefs<T>(...refs: (ForwardedRef<T> | null | undefined)[]): React.MutableRefObject<T | null>;
10
+ export declare function useCombinedRefs<T>(...refs: (ForwardedRef<T> | null | undefined)[]): import("react").MutableRefObject<T | null>;
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useCombinedRefs = useCombinedRefs;
7
7
 
8
- var _react = _interopRequireWildcard(require("react"));
8
+ var _react = require("react");
9
9
 
10
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
+ var _useIsomorphicLayoutEffect = _interopRequireDefault(require("../utils/useIsomorphicLayoutEffect"));
11
11
 
12
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
14
  /**
15
15
  * Creates a ref by combining multiple constituent refs. The ref returned by this hook
@@ -21,8 +21,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
21
21
  */
22
22
  function useCombinedRefs(...refs) {
23
23
  const combinedRef = (0, _react.useRef)(null);
24
-
25
- _react.default.useLayoutEffect(() => {
24
+ (0, _useIsomorphicLayoutEffect.default)(() => {
26
25
  function setRefs(current = null) {
27
26
  for (const ref of refs) {
28
27
  if (!ref) {
@@ -44,6 +43,5 @@ function useCombinedRefs(...refs) {
44
43
  setRefs(combinedRef.current);
45
44
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
46
45
  }, [...refs, combinedRef.current]);
47
-
48
46
  return combinedRef;
49
47
  }
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useResizeObserver = useResizeObserver;
7
7
 
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _useIsomorphicLayoutEffect = _interopRequireDefault(require("../utils/useIsomorphicLayoutEffect"));
9
9
 
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
12
12
  function useResizeObserver(callback) {
13
- _react.default.useLayoutEffect(() => {
13
+ (0, _useIsomorphicLayoutEffect.default)(() => {
14
14
  const observer = new window.ResizeObserver(() => callback());
15
15
  observer.observe(document.documentElement);
16
16
  return () => {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WithOnRemoveFn = exports.Interactive = exports.DefaultToken = exports.default = void 0;
6
+ exports.WithOnRemoveFn = exports.WithLeadingVisual = exports.Interactive = exports.DefaultToken = exports.default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -19,6 +19,8 @@ var _Token = _interopRequireDefault(require("../Token/Token"));
19
19
 
20
20
  var _Text = _interopRequireDefault(require("../Text"));
21
21
 
22
+ var _octiconsReact = require("@primer/octicons-react");
23
+
22
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
25
 
24
26
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -36,7 +38,7 @@ var _default = {
36
38
  }]
37
39
  };
38
40
  exports.default = _default;
39
- const excludedControlKeys = ['id', 'as', 'tabIndex', 'onRemove'];
41
+ const excludedControlKeys = ['id', 'as', 'tabIndex', 'onRemove', 'leadingVisual'];
40
42
 
41
43
  const SingleExampleContainer = ({
42
44
  children,
@@ -115,6 +117,21 @@ Interactive.parameters = {
115
117
  }
116
118
  };
117
119
 
120
+ const WithLeadingVisual = args => {
121
+ return /*#__PURE__*/_react.default.createElement(ExampleCollectionContainer, null, /*#__PURE__*/_react.default.createElement(_Token.default, _extends({}, args, {
122
+ leadingVisual: () => /*#__PURE__*/_react.default.createElement(_octiconsReact.GitBranchIcon, null)
123
+ })));
124
+ };
125
+
126
+ exports.WithLeadingVisual = WithLeadingVisual;
127
+ WithLeadingVisual.displayName = "WithLeadingVisual";
128
+ WithLeadingVisual.storyName = 'with leadingVisual';
129
+ WithLeadingVisual.parameters = {
130
+ controls: {
131
+ exclude: [...excludedControlKeys, 'hideRemoveButton']
132
+ }
133
+ };
134
+
118
135
  const WithOnRemoveFn = args => {
119
136
  return /*#__PURE__*/_react.default.createElement(ExampleCollectionContainer, null, /*#__PURE__*/_react.default.createElement(SingleExampleContainer, {
120
137
  label: "w/ onRemove passed"
@@ -0,0 +1,3 @@
1
+ import { useEffect } from 'react';
2
+ declare const useIsomorphicLayoutEffect: typeof useEffect;
3
+ export default useIsomorphicLayoutEffect;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ const useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? _react.useLayoutEffect : _react.useEffect;
11
+ var _default = useIsomorphicLayoutEffect;
12
+ exports.default = _default;
@@ -1,8 +1,9 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import styled from 'styled-components';
4
- import React, { useEffect, useLayoutEffect, useRef } from 'react';
4
+ import React, { useEffect, useRef } from 'react';
5
5
  import { get, COMMON } from './constants';
6
+ import useLayoutEffect from './utils/useIsomorphicLayoutEffect';
6
7
  import { useOverlay } from './hooks';
7
8
  import Portal from './Portal';
8
9
  import sx from './sx';
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { createPortal } from 'react-dom';
3
+ import useLayoutEffect from '../utils/useIsomorphicLayoutEffect';
3
4
  const PRIMER_PORTAL_ROOT_ID = '__primerPortalRoot__';
4
5
  const DEFAULT_PORTAL_CONTAINER_NAME = '__default__';
5
6
  const portalRootRegistry = {};
@@ -57,7 +58,7 @@ export const Portal = ({
57
58
  hostElement.style.position = 'relative';
58
59
  hostElement.style.zIndex = '1';
59
60
  const elementRef = React.useRef(hostElement);
60
- React.useLayoutEffect(() => {
61
+ useLayoutEffect(() => {
61
62
  let containerName = _containerName;
62
63
 
63
64
  if (containerName === undefined) {
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { getAnchoredPosition } from '../behaviors/anchoredPosition';
3
3
  import { useProvidedRefOrCreate } from './useProvidedRefOrCreate';
4
4
  import { useResizeObserver } from './useResizeObserver';
5
+ import useLayoutEffect from '../utils/useIsomorphicLayoutEffect';
5
6
 
6
7
  /**
7
8
  * Calculates the top and left values for an absolutely-positioned floating element
@@ -24,7 +25,7 @@ export function useAnchoredPosition(settings, dependencies = []) {
24
25
  }
25
26
  }, // eslint-disable-next-line react-hooks/exhaustive-deps
26
27
  [floatingElementRef, anchorElementRef, ...dependencies]);
27
- React.useLayoutEffect(updatePosition, [updatePosition]);
28
+ useLayoutEffect(updatePosition, [updatePosition]);
28
29
  useResizeObserver(updatePosition);
29
30
  return {
30
31
  floatingElementRef,
@@ -1,4 +1,4 @@
1
- import React, { ForwardedRef } from 'react';
1
+ import { ForwardedRef } from 'react';
2
2
  /**
3
3
  * Creates a ref by combining multiple constituent refs. The ref returned by this hook
4
4
  * should be passed as the ref for the element that needs to be shared. This is
@@ -7,4 +7,4 @@ import React, { ForwardedRef } from 'react';
7
7
  * though, as it breaks encapsulation.
8
8
  * @param refs
9
9
  */
10
- export declare function useCombinedRefs<T>(...refs: (ForwardedRef<T> | null | undefined)[]): React.MutableRefObject<T | null>;
10
+ export declare function useCombinedRefs<T>(...refs: (ForwardedRef<T> | null | undefined)[]): import("react").MutableRefObject<T | null>;
@@ -1,4 +1,5 @@
1
- import React, { useRef } from 'react';
1
+ import { useRef } from 'react';
2
+ import useLayoutEffect from '../utils/useIsomorphicLayoutEffect';
2
3
  /**
3
4
  * Creates a ref by combining multiple constituent refs. The ref returned by this hook
4
5
  * should be passed as the ref for the element that needs to be shared. This is
@@ -10,7 +11,7 @@ import React, { useRef } from 'react';
10
11
 
11
12
  export function useCombinedRefs(...refs) {
12
13
  const combinedRef = useRef(null);
13
- React.useLayoutEffect(() => {
14
+ useLayoutEffect(() => {
14
15
  function setRefs(current = null) {
15
16
  for (const ref of refs) {
16
17
  if (!ref) {
@@ -1,6 +1,6 @@
1
- import React from 'react';
1
+ import useLayoutEffect from '../utils/useIsomorphicLayoutEffect';
2
2
  export function useResizeObserver(callback) {
3
- React.useLayoutEffect(() => {
3
+ useLayoutEffect(() => {
4
4
  const observer = new window.ResizeObserver(() => callback());
5
5
  observer.observe(document.documentElement);
6
6
  return () => {
@@ -7,6 +7,7 @@ import { BaseStyles, ThemeProvider } from '..';
7
7
  import Box from '../Box';
8
8
  import Token from '../Token/Token';
9
9
  import Text from '../Text';
10
+ import { GitBranchIcon } from '@primer/octicons-react';
10
11
  export default {
11
12
  title: 'Tokens/Default',
12
13
  component: Token,
@@ -19,7 +20,7 @@ export default {
19
20
  return /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(BaseStyles, null, /*#__PURE__*/React.createElement(Story, null)));
20
21
  }]
21
22
  };
22
- const excludedControlKeys = ['id', 'as', 'tabIndex', 'onRemove'];
23
+ const excludedControlKeys = ['id', 'as', 'tabIndex', 'onRemove', 'leadingVisual'];
23
24
 
24
25
  const SingleExampleContainer = ({
25
26
  children,
@@ -91,6 +92,18 @@ Interactive.parameters = {
91
92
  exclude: [...excludedControlKeys, 'hideRemoveButton', 'text']
92
93
  }
93
94
  };
95
+ export const WithLeadingVisual = args => {
96
+ return /*#__PURE__*/React.createElement(ExampleCollectionContainer, null, /*#__PURE__*/React.createElement(Token, _extends({}, args, {
97
+ leadingVisual: () => /*#__PURE__*/React.createElement(GitBranchIcon, null)
98
+ })));
99
+ };
100
+ WithLeadingVisual.displayName = "WithLeadingVisual";
101
+ WithLeadingVisual.storyName = 'with leadingVisual';
102
+ WithLeadingVisual.parameters = {
103
+ controls: {
104
+ exclude: [...excludedControlKeys, 'hideRemoveButton']
105
+ }
106
+ };
94
107
  export const WithOnRemoveFn = args => {
95
108
  return /*#__PURE__*/React.createElement(ExampleCollectionContainer, null, /*#__PURE__*/React.createElement(SingleExampleContainer, {
96
109
  label: "w/ onRemove passed"
@@ -0,0 +1,3 @@
1
+ import { useEffect } from 'react';
2
+ declare const useIsomorphicLayoutEffect: typeof useEffect;
3
+ export default useIsomorphicLayoutEffect;
@@ -0,0 +1,3 @@
1
+ import { useEffect, useLayoutEffect } from 'react';
2
+ const useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? useLayoutEffect : useEffect;
3
+ export default useIsomorphicLayoutEffect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/components",
3
- "version": "31.2.0-rc.5ccefd7d",
3
+ "version": "31.2.0-rc.85bcb6e0",
4
4
  "description": "Primer react components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
package/script/build CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/bin/bash
2
2
 
3
+ set -e
4
+
3
5
  # Clean up
4
6
  rm -rf dist
5
7
  rm -rf lib
package/src/Overlay.tsx CHANGED
@@ -1,7 +1,8 @@
1
1
  import styled from 'styled-components'
2
- import React, {ReactElement, useEffect, useLayoutEffect, useRef} from 'react'
2
+ import React, {ReactElement, useEffect, useRef} from 'react'
3
3
  import {get, COMMON, SystemPositionProps, SystemCommonProps} from './constants'
4
4
  import {ComponentProps} from './utils/types'
5
+ import useLayoutEffect from './utils/useIsomorphicLayoutEffect'
5
6
  import {useOverlay, TouchOrMouseEvent} from './hooks'
6
7
  import Portal from './Portal'
7
8
  import sx, {SxProp} from './sx'
@@ -1,5 +1,6 @@
1
1
  import React from 'react'
2
2
  import {createPortal} from 'react-dom'
3
+ import useLayoutEffect from '../utils/useIsomorphicLayoutEffect'
3
4
 
4
5
  const PRIMER_PORTAL_ROOT_ID = '__primerPortalRoot__'
5
6
  const DEFAULT_PORTAL_CONTAINER_NAME = '__default__'
@@ -69,7 +70,7 @@ export const Portal: React.FC<PortalProps> = ({children, onMount, containerName:
69
70
  hostElement.style.zIndex = '1'
70
71
  const elementRef = React.useRef(hostElement)
71
72
 
72
- React.useLayoutEffect(() => {
73
+ useLayoutEffect(() => {
73
74
  let containerName = _containerName
74
75
  if (containerName === undefined) {
75
76
  containerName = DEFAULT_PORTAL_CONTAINER_NAME
@@ -2,6 +2,7 @@ import React from 'react'
2
2
  import {PositionSettings, getAnchoredPosition, AnchorPosition} from '../behaviors/anchoredPosition'
3
3
  import {useProvidedRefOrCreate} from './useProvidedRefOrCreate'
4
4
  import {useResizeObserver} from './useResizeObserver'
5
+ import useLayoutEffect from '../utils/useIsomorphicLayoutEffect'
5
6
 
6
7
  export interface AnchoredPositionHookSettings extends Partial<PositionSettings> {
7
8
  floatingElementRef?: React.RefObject<Element>
@@ -41,7 +42,7 @@ export function useAnchoredPosition(
41
42
  [floatingElementRef, anchorElementRef, ...dependencies]
42
43
  )
43
44
 
44
- React.useLayoutEffect(updatePosition, [updatePosition])
45
+ useLayoutEffect(updatePosition, [updatePosition])
45
46
 
46
47
  useResizeObserver(updatePosition)
47
48
 
@@ -1,4 +1,5 @@
1
- import React, {ForwardedRef, useRef} from 'react'
1
+ import {ForwardedRef, useRef} from 'react'
2
+ import useLayoutEffect from '../utils/useIsomorphicLayoutEffect'
2
3
 
3
4
  /**
4
5
  * Creates a ref by combining multiple constituent refs. The ref returned by this hook
@@ -11,7 +12,7 @@ import React, {ForwardedRef, useRef} from 'react'
11
12
  export function useCombinedRefs<T>(...refs: (ForwardedRef<T> | null | undefined)[]) {
12
13
  const combinedRef = useRef<T | null>(null)
13
14
 
14
- React.useLayoutEffect(() => {
15
+ useLayoutEffect(() => {
15
16
  function setRefs(current: T | null = null) {
16
17
  for (const ref of refs) {
17
18
  if (!ref) {
@@ -32,7 +33,6 @@ export function useCombinedRefs<T>(...refs: (ForwardedRef<T> | null | undefined)
32
33
  // eslint-disable-next-line react-hooks/exhaustive-deps
33
34
  setRefs(combinedRef.current)
34
35
  }
35
-
36
36
  // eslint-disable-next-line react-hooks/exhaustive-deps
37
37
  }, [...refs, combinedRef.current])
38
38
 
@@ -1,7 +1,7 @@
1
- import React from 'react'
1
+ import useLayoutEffect from '../utils/useIsomorphicLayoutEffect'
2
2
 
3
3
  export function useResizeObserver(callback: () => void) {
4
- React.useLayoutEffect(() => {
4
+ useLayoutEffect(() => {
5
5
  const observer = new window.ResizeObserver(() => callback())
6
6
  observer.observe(document.documentElement)
7
7
  return () => {
@@ -7,6 +7,7 @@ import {BaseStyles, ThemeProvider} from '..'
7
7
  import Box from '../Box'
8
8
  import Token, {TokenProps} from '../Token/Token'
9
9
  import Text from '../Text'
10
+ import {GitBranchIcon} from '@primer/octicons-react'
10
11
 
11
12
  export default {
12
13
  title: 'Tokens/Default',
@@ -29,7 +30,7 @@ export default {
29
30
  ]
30
31
  } as Meta
31
32
 
32
- const excludedControlKeys = ['id', 'as', 'tabIndex', 'onRemove']
33
+ const excludedControlKeys = ['id', 'as', 'tabIndex', 'onRemove', 'leadingVisual']
33
34
 
34
35
  const SingleExampleContainer: React.FC<{label?: string}> = ({children, label}) => (
35
36
  <Box
@@ -94,6 +95,16 @@ export const Interactive = (args: Omit<TokenProps, 'ref' | 'text'>) => {
94
95
  }
95
96
  Interactive.parameters = {controls: {exclude: [...excludedControlKeys, 'hideRemoveButton', 'text']}}
96
97
 
98
+ export const WithLeadingVisual = (args: Omit<TokenProps, 'ref'>) => {
99
+ return (
100
+ <ExampleCollectionContainer>
101
+ <Token {...args} leadingVisual={() => <GitBranchIcon />} />
102
+ </ExampleCollectionContainer>
103
+ )
104
+ }
105
+ WithLeadingVisual.storyName = 'with leadingVisual'
106
+ WithLeadingVisual.parameters = {controls: {exclude: [...excludedControlKeys, 'hideRemoveButton']}}
107
+
97
108
  export const WithOnRemoveFn = (args: Omit<TokenProps, 'ref'>) => {
98
109
  return (
99
110
  <ExampleCollectionContainer>
@@ -0,0 +1,10 @@
1
+ import {useEffect, useLayoutEffect} from 'react'
2
+
3
+ const useIsomorphicLayoutEffect =
4
+ typeof window !== 'undefined' &&
5
+ typeof window.document !== 'undefined' &&
6
+ typeof window.document.createElement !== 'undefined'
7
+ ? useLayoutEffect
8
+ : useEffect
9
+
10
+ export default useIsomorphicLayoutEffect