Skip to content

Commit 62d2fed

Browse files
authored
chore(Ref): use component from Stardust UI (#3774)
* chore(Ref): use component from Stardust * chore(Ref): use component from Stardust * fix UT
1 parent a4b8757 commit 62d2fed

40 files changed

+58
-676
lines changed

docs/src/examples/addons/Ref/Types/RefExampleRef.js

-72
This file was deleted.

docs/src/examples/addons/Ref/Types/RefForwardingExample.js

-58
This file was deleted.

docs/src/examples/addons/Ref/Types/index.js

-30
This file was deleted.

docs/src/examples/addons/Ref/index.js

-10
This file was deleted.

index.d.ts

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Third party
2+
3+
export { Ref, RefProps } from '@stardust-ui/react-component-ref'
4+
15
// Addons
26

37
export {
@@ -27,17 +31,6 @@ export {
2731
StrictPortalInnerProps,
2832
} from './dist/commonjs/addons/Portal/PortalInner'
2933
export { default as Radio, RadioProps, StrictRadioProps } from './dist/commonjs/addons/Radio'
30-
export { default as Ref, RefProps, StrictRefProps } from './dist/commonjs/addons/Ref'
31-
export {
32-
default as RefFindNode,
33-
RefFindNodeProps,
34-
StrictRefFindNodeProps,
35-
} from './dist/commonjs/addons/Ref/RefFindNode'
36-
export {
37-
default as RefForward,
38-
RefForwardProps,
39-
StrictRefForwardProps,
40-
} from './dist/commonjs/addons/Ref/RefForward'
4134
export {
4235
default as Responsive,
4336
ResponsiveProps,

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,13 @@
7979
"dependencies": {
8080
"@babel/runtime": "^7.1.2",
8181
"@semantic-ui-react/event-stack": "^3.1.0",
82+
"@stardust-ui/react-component-ref": "~0.38.0",
8283
"classnames": "^2.2.6",
8384
"keyboard-key": "^1.0.4",
8485
"lodash": "^4.17.15",
8586
"prop-types": "^15.7.2",
8687
"react-is": "^16.8.6",
87-
"react-popper": "^1.3.3",
88+
"react-popper": "^1.3.4",
8889
"shallowequal": "^1.1.0"
8990
},
9091
"devDependencies": {
@@ -102,7 +103,7 @@
102103
"@babel/standalone": "^7.4.5",
103104
"@mdx-js/loader": "^0.20.3",
104105
"@stardust-ui/docs-components": "^0.34.1",
105-
"@types/react": "^16.4.14",
106+
"@types/react": "^16.8.25",
106107
"anchor-js": "^4.2.0",
107108
"babel-eslint": "^10.0.2",
108109
"babel-loader": "^8.0.6",

src/addons/MountNode/lib/getNodeRefFromProps.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { isRefObject, toRefObject } from '@stardust-ui/react-component-ref'
12
import _ from 'lodash'
2-
import { isBrowser, isRefObject } from '../../../lib'
33

4-
const toRef = _.memoize((node) => ({ current: node }))
4+
import { isBrowser } from '../../../lib'
55

66
/**
77
* Given `this.props`, return a `node` value or undefined.
@@ -14,7 +14,7 @@ const getNodeRefFromProps = (props) => {
1414

1515
if (isBrowser()) {
1616
if (isRefObject(node)) return node
17-
return _.isNil(node) ? toRef(document.body) : toRef(node)
17+
return _.isNil(node) ? toRefObject(document.body) : toRefObject(node)
1818
}
1919
}
2020

src/addons/Portal/Portal.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import EventStack from '@semantic-ui-react/event-stack'
2+
import { handleRef, Ref } from '@stardust-ui/react-component-ref'
23
import keyboardKey from 'keyboard-key'
34
import _ from 'lodash'
45
import PropTypes from 'prop-types'
@@ -8,10 +9,8 @@ import {
89
AutoControlledComponent as Component,
910
customPropTypes,
1011
doesNodeContainClick,
11-
handleRef,
1212
makeDebugger,
1313
} from '../../lib'
14-
import Ref from '../Ref'
1514
import PortalInner from './PortalInner'
1615

1716
const debug = makeDebugger('portal')

src/addons/Portal/PortalInner.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { handleRef, Ref } from '@stardust-ui/react-component-ref'
12
import _ from 'lodash'
23
import PropTypes from 'prop-types'
34
import React, { Component } from 'react'
45
import { createPortal } from 'react-dom'
56

6-
import { customPropTypes, handleRef, isBrowser, makeDebugger } from '../../lib'
7-
import Ref from '../Ref'
7+
import { customPropTypes, isBrowser, makeDebugger } from '../../lib'
88

99
const debug = makeDebugger('portalInner')
1010

src/addons/Ref/Ref.d.ts

-27
This file was deleted.

src/addons/Ref/Ref.js

-36
This file was deleted.

src/addons/Ref/RefFindNode.d.ts

-21
This file was deleted.

0 commit comments

Comments
 (0)