diff --git a/packages/ui/lib/components/Button/Button.tsx b/packages/ui/lib/components/Button/Button.tsx index 4126fa26939..c2c0f175bc4 100644 --- a/packages/ui/lib/components/Button/Button.tsx +++ b/packages/ui/lib/components/Button/Button.tsx @@ -1,5 +1,5 @@ import type { ReactNode, ForwardedRef } from 'react' -import type { SizeStyleProp, Size } from '../../types' +import type { SizeStyleProp } from '../../types' import { twMerge } from 'tailwind-merge' import { forwardRef } from 'react' import { Box, Props as BoxProps } from '../Box/Box' diff --git a/packages/ui/lib/components/Display/Address.tsx b/packages/ui/lib/components/Display/Address.tsx index 12ff099200d..310043f18bd 100644 --- a/packages/ui/lib/components/Display/Address.tsx +++ b/packages/ui/lib/components/Display/Address.tsx @@ -34,7 +34,7 @@ export const Address: React.FC = ({ onCopied, }) => { // manage clipboard copy status - const [isCopied, setCopied] = useClipboard(address, { + const [, setCopied] = useClipboard(address, { successDuration: 0, }) //state to hold the resolved name, initialized with the resolvedName prop diff --git a/packages/ui/lib/components/Form/AddressInput.tsx b/packages/ui/lib/components/Form/AddressInput.tsx index f891a5f839c..728dcbc262d 100644 --- a/packages/ui/lib/components/Form/AddressInput.tsx +++ b/packages/ui/lib/components/Form/AddressInput.tsx @@ -37,6 +37,7 @@ export interface Props extends InputProps { withIcon?: boolean isTruncated?: boolean onResolveName: (address: string) => Promise + ref?: ForwardedRef } const WalletIcon = (props: IconBaseProps) => ( @@ -58,6 +59,7 @@ export const WrappedAddressInput = ({ onChange, onResolveName, error, + ref, ...inputProps }: Props) => { const [errorMessage, setErrorMessage] = useState('') @@ -146,6 +148,7 @@ export const WrappedAddressInput = ({ description={description} iconClass={resolveNameMutation.isPending ? 'animate-spin' : ''} icon={resolveNameMutation.isPending ? LoadingIcon : WalletIcon} + ref={ref} onChange={(e) => { const value: string = e.target.value resolveNameMutation.reset() // Reset the mutation to handle new input values. @@ -168,26 +171,11 @@ export const WrappedAddressInput = ({ * */ export const AddressInput = forwardRef( - (props: Props, ref: ForwardedRef) => { - const { - size = 'medium', - value, - defaultValue, - className, - description, - label, - withIcon = true, - isTruncated = false, // address not truncated by default - onChange, - onResolveName, - ...inputProps - } = props - return ( - - - - ) - } + (props: Props, ref: ForwardedRef) => ( + + + + ) ) AddressInput.displayName = 'AddressInput' diff --git a/packages/ui/lib/components/PriceFormatter/PriceFormatter.tsx b/packages/ui/lib/components/PriceFormatter/PriceFormatter.tsx index 314382515fb..c5ceaf256bd 100644 --- a/packages/ui/lib/components/PriceFormatter/PriceFormatter.tsx +++ b/packages/ui/lib/components/PriceFormatter/PriceFormatter.tsx @@ -1,5 +1,3 @@ -import React from 'react' - export interface PriceFormatterProps { price: string precision?: number diff --git a/packages/ui/lib/components/PriceFormatter/formatPrice.ts b/packages/ui/lib/components/PriceFormatter/formatPrice.ts deleted file mode 100644 index f448f6e3029..00000000000 --- a/packages/ui/lib/components/PriceFormatter/formatPrice.ts +++ /dev/null @@ -1,59 +0,0 @@ -import React from 'react' - -interface PriceFormatterProps { - price: string - precision?: number -} - -function PriceFormatter({ price, precision = 4 }: PriceFormatterProps) { - if (!price) return '' - - const decimalIndex = price.indexOf('.') - - const removeTrailingZeroes = (number: string): string => { - for (let i = number.length - 1; i >= 0; i--) { - if (number.charAt(i) === '.') { - return number.substring(0, i) - } else if (number.charAt(i) !== '0') { - return number.substring(0, i + 1) - } - } - - return number - } - - // If not decimal - return - if (decimalIndex === -1 || decimalIndex === price.length - 1) { - return price - } - - const fractionalPart = price.substring(decimalIndex + 1) - - // Numbers of zeroes - let numZeroes = 0 - for (let i = 0; i < fractionalPart.length; i++) { - if (fractionalPart.charAt(i) === '0') { - numZeroes++ - } else { - break - } - } - - if (numZeroes > 3) { - return ( - <> - {`${price.substring(0, decimalIndex)}.0`} - {numZeroes - 1} - {removeTrailingZeroes( - price.substring(decimalIndex + 1 + numZeroes).substring(0, 4) - )} - - ) - } else { - return removeTrailingZeroes( - price.substring(0, decimalIndex + 1 + numZeroes + precision) - ) - } -} - -export default PriceFormatter \ No newline at end of file diff --git a/packages/ui/package.json b/packages/ui/package.json index 79292c3593a..0a688513d6c 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -34,11 +34,9 @@ "@radix-ui/react-tooltip": "1.1.4", "@tailwindcss/aspect-ratio": "0.4.2", "@tailwindcss/forms": "0.5.9", - "@tailwindcss/line-clamp": "0.4.4", "@tailwindcss/typography": "0.5.15", "@tanstack/react-query": "5.62.0", "@tw-classed/react": "1.7.0", - "@unlock-protocol/networks": "workspace:./packages/networks", "ethers": "6.13.4", "prism-react-renderer": "2.4.0", "react-dropzone": "14.3.5", diff --git a/yarn.lock b/yarn.lock index c5413f47976..c19683303eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15988,15 +15988,6 @@ __metadata: languageName: node linkType: hard -"@tailwindcss/line-clamp@npm:0.4.4": - version: 0.4.4 - resolution: "@tailwindcss/line-clamp@npm:0.4.4" - peerDependencies: - tailwindcss: ">=2.0.0 || >=3.0.0 || >=3.0.0-alpha.1" - checksum: 10/3d2ad992aa9263fe9b5cdb23bcfca521a6ab00f65e0f7167be35d2cb46b1635af72889ff9f6d5b2febf5aa5a36e3128eaad8ed43e43af4512c74c74f1058c4c0 - languageName: node - linkType: hard - "@tailwindcss/typography@npm:0.5.15": version: 0.5.15 resolution: "@tailwindcss/typography@npm:0.5.15" @@ -18366,13 +18357,11 @@ __metadata: "@storybook/react-vite": "npm:8.4.6" "@tailwindcss/aspect-ratio": "npm:0.4.2" "@tailwindcss/forms": "npm:0.5.9" - "@tailwindcss/line-clamp": "npm:0.4.4" "@tailwindcss/typography": "npm:0.5.15" "@tanstack/react-query": "npm:5.62.0" "@tw-classed/react": "npm:1.7.0" "@types/react": "npm:18.3.12" "@types/react-dom": "npm:18.3.1" - "@unlock-protocol/networks": "workspace:./packages/networks" "@unlock-protocol/unlock-js": "workspace:./packages/unlock-js" "@vitejs/plugin-react": "npm:4.3.4" autoprefixer: "npm:10.4.20"