diff --git a/.github/workflows/deploy-storybook.yml b/.github/workflows/deploy-storybook.yml index e6a5e062..8f2bf412 100644 --- a/.github/workflows/deploy-storybook.yml +++ b/.github/workflows/deploy-storybook.yml @@ -4,9 +4,8 @@ on: # Pull request hook without any config. Launches for every pull request pull_request: # Launches build when release is published - push: - tags: - - 'v*' + release: + types: [published] env: REPO_NAME_ALPHANUMERIC: safereactcomponents diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index e7e48bba..8eb1b6be 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -60,7 +60,7 @@ jobs: uses: actions/create-release@v1 id: create_release with: - draft: false + draft: true prerelease: false release_name: ${{ steps.version.outputs.version }} tag_name: ${{ steps.version.outputs.version }} diff --git a/package.json b/package.json index b498c69f..b4107cf8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gnosis.pm/safe-react-components", - "version": "0.9.1", + "version": "0.9.2", "description": "Gnosis UI components", "main": "dist/index.min.js", "typings": "dist/index.d.ts", diff --git a/src/inputs/AddressInput/AddressInput.stories.tsx b/src/inputs/AddressInput/AddressInput.stories.tsx index 92c0f544..dd40a849 100644 --- a/src/inputs/AddressInput/AddressInput.stories.tsx +++ b/src/inputs/AddressInput/AddressInput.stories.tsx @@ -70,7 +70,6 @@ export const SimpleAddressInput = ({ showErrors: boolean; }): React.ReactElement => { const [address, setAddress] = useState(''); - const onChangeAddress = useCallback((address) => setAddress(address), []); const [currentNetworkPrefix, setCurrentNetworkPrefix] = useState('rin'); @@ -85,13 +84,16 @@ export const SimpleAddressInput = ({ address && showErrors ? inValidNetworkError || inValidAddressError : ''; // fake ENS Resolution - const getAddressFromDomain = () => - new Promise((resolve) => { - setTimeout( - () => resolve('0x83eC7B0506556a7749306D69681aDbDbd08f0769'), - 2000 - ); - }); + const getAddressFromDomain = useCallback( + () => + new Promise((resolve) => { + setTimeout( + () => resolve('0x83eC7B0506556a7749306D69681aDbDbd08f0769'), + 2000 + ); + }), + [] + ); return (
@@ -113,7 +115,7 @@ export const SimpleAddressInput = ({ name="address" placeholder={'Ethereum address'} address={address} - onChangeAddress={onChangeAddress} + onChangeAddress={setAddress} getAddressFromDomain={getAddressFromDomain} hiddenLabel={hiddenLabel} error={error} @@ -161,7 +163,6 @@ export const AddressInputWithENSResolution = (): React.ReactElement => { const [address, setAddress] = useState(''); const [showError, setShowError] = useState(false); const [error, setError] = useState(''); - const onChangeAddress = useCallback((address) => setAddress(address), []); const [customENSThrottleDelay, setCustomENSThrottleDelay] = useState< number | undefined @@ -213,7 +214,7 @@ export const AddressInputWithENSResolution = (): React.ReactElement => { address={address} helperText={'Type safe.test to check ENS resolution!'} disabled={!customENSThrottleDelay} - onChangeAddress={onChangeAddress} + onChangeAddress={setAddress} getAddressFromDomain={getAddressFromDomain} customENSThrottleDelay={customENSThrottleDelay} /> @@ -251,7 +252,6 @@ export const AddressInputWithENSResolution = (): React.ReactElement => { export const SafeAddressInputValidation = (): React.ReactElement => { const [address, setAddress] = useState(''); - const onChangeAddress = useCallback((address) => setAddress(address), []); const [isValidSafeAddress, setIsValidSafeAddress] = useState(false); const [showLoadingSpinner, setShowLoadingSpinner] = useState(false); @@ -296,7 +296,7 @@ export const SafeAddressInputValidation = (): React.ReactElement => { showNetworkPrefix={false} error={showError ? error : ''} address={address} - onChangeAddress={onChangeAddress} + onChangeAddress={setAddress} showLoadingSpinner={showLoadingSpinner} InputProps={{ endAdornment: isValidSafeAddress && ( @@ -315,8 +315,7 @@ export const SafeAddressInputValidation = (): React.ReactElement => { export const AddressInputWithSimpleAddressValidation = (): React.ReactElement => { - const [address, setAddress] = useState(''); - const onChangeAddress = useCallback((address) => setAddress(address), []); + const [address, setAddress] = useState('0x123...'); const [hasError, setHasError] = useState(); useEffect(() => { @@ -334,7 +333,7 @@ export const AddressInputWithSimpleAddressValidation = networkPrefix="rin" error={hasError ? error : ''} address={address} - onChangeAddress={onChangeAddress} + onChangeAddress={setAddress} /> {/* Address In the State */} Address In the State: @@ -347,7 +346,6 @@ export const AddressInputWithoutPrefix = (): React.ReactElement => { const [address, setAddress] = useState( '0x83eC7B0506556a7749306D69681aDbDbd08f0769' ); - const onChangeAddress = useCallback((address) => setAddress(address), []); return (
@@ -356,7 +354,7 @@ export const AddressInputWithoutPrefix = (): React.ReactElement => { name="address" placeholder={'Ethereum address'} address={address} - onChangeAddress={onChangeAddress} + onChangeAddress={setAddress} /> {/* Address In the State */} Address In the State: @@ -369,7 +367,6 @@ export const AddressInputLoading = (): React.ReactElement => { const [address, setAddress] = useState( '0x83eC7B0506556a7749306D69681aDbDbd08f0769' ); - const onChangeAddress = useCallback((address) => setAddress(address), []); return ( @@ -377,11 +374,11 @@ export const AddressInputLoading = (): React.ReactElement => { label="Address" name="address" networkPrefix="rin" - showNetworkPrefix={false} + showNetworkPrefix placeholder={'Ethereum address'} showLoadingSpinner address={address} - onChangeAddress={onChangeAddress} + onChangeAddress={setAddress} /> ); @@ -391,7 +388,6 @@ export const AddressInputWithAdornment = (): React.ReactElement => { const [address, setAddress] = useState( '0x83eC7B0506556a7749306D69681aDbDbd08f0769' ); - const onChangeAddress = useCallback((address) => setAddress(address), []); return (
@@ -399,7 +395,7 @@ export const AddressInputWithAdornment = (): React.ReactElement => { label="Address" name="address" networkPrefix="rin" - showNetworkPrefix={false} + showNetworkPrefix showLoadingSpinner={false} placeholder={'Ethereum address'} InputProps={{ @@ -410,7 +406,7 @@ export const AddressInputWithAdornment = (): React.ReactElement => { ), }} address={address} - onChangeAddress={onChangeAddress} + onChangeAddress={setAddress} />
); @@ -420,7 +416,6 @@ export const AddressInputDisabled = (): React.ReactElement => { const [address, setAddress] = useState( '0x83eC7B0506556a7749306D69681aDbDbd08f0769' ); - const onChangeAddress = useCallback((address) => setAddress(address), []); return (
@@ -428,12 +423,12 @@ export const AddressInputDisabled = (): React.ReactElement => { label="Address" name="address" networkPrefix="rin" - showNetworkPrefix={false} + showNetworkPrefix showLoadingSpinner={false} disabled placeholder={'Ethereum address'} address={address} - onChangeAddress={onChangeAddress} + onChangeAddress={setAddress} />
); @@ -443,7 +438,6 @@ export const AddressInputWithErrors = (): React.ReactElement => { const [address, setAddress] = useState( '0x83eC7B0506556a7749306D69681aDbDbd08f0769' ); - const onChangeAddress = useCallback((address) => setAddress(address), []); return (
@@ -455,7 +449,7 @@ export const AddressInputWithErrors = (): React.ReactElement => { placeholder={'Ethereum address'} showLoadingSpinner={false} address={address} - onChangeAddress={onChangeAddress} + onChangeAddress={setAddress} error={'Invalid Address'} />
diff --git a/src/inputs/AddressInput/index.tsx b/src/inputs/AddressInput/index.tsx index 5e4f7643..d7f30c09 100644 --- a/src/inputs/AddressInput/index.tsx +++ b/src/inputs/AddressInput/index.tsx @@ -47,7 +47,7 @@ function AddressInput({ showLoadingSpinner, InputProps, inputProps, - hiddenLabel = true, + hiddenLabel = false, ...rest }: AddressInputProps): ReactElement { const [isLoadingENSResolution, setIsLoadingENSResolution] = useState(false); diff --git a/tests/inputs/AddressInput/__snapshots__/AddressInput.stories.storyshot b/tests/inputs/AddressInput/__snapshots__/AddressInput.stories.storyshot index 4383181b..d8178fed 100644 --- a/tests/inputs/AddressInput/__snapshots__/AddressInput.stories.storyshot +++ b/tests/inputs/AddressInput/__snapshots__/AddressInput.stories.storyshot @@ -387,7 +387,7 @@ exports[`Storyshots Inputs/AddressInput Address Input With Simple Address Valida onSubmit={[Function]} >