The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
uses default onCopy event in input
Alaister Youngab7320b6bbef
diff --git a/package-lock.json b/package-lock.jsonindex 0881d78353b..a822c693ee5 100644--- a/package-lock.json+++ b/package-lock.json@@ -3160,6 +3160,16 @@"node": ">=10"}},+ "node_modules/@devtools-ds/themes/node_modules/react-merge-refs": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/react-merge-refs/-/react-merge-refs-1.1.0.tgz",+ "integrity": "sha512-alTKsjEL0dKH/ru1Iyn7vliS2QRcBp9zZPGoWxUOvRGWPUYgjo+V01is7p04It6KhgrzhJGnIj9GgX8W4bZoCQ==",+ "dev": true,+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/gregberge"+ }+ },"node_modules/@devtools-ds/themes/node_modules/tslib": {"version": "1.14.1","resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",@@ -31894,16 +31904,6 @@"inline-style-parser": "0.1.1"}},- "node_modules/react-merge-refs": {- "version": "1.1.0",- "resolved": "https://registry.npmjs.org/react-merge-refs/-/react-merge-refs-1.1.0.tgz",- "integrity": "sha512-alTKsjEL0dKH/ru1Iyn7vliS2QRcBp9zZPGoWxUOvRGWPUYgjo+V01is7p04It6KhgrzhJGnIj9GgX8W4bZoCQ==",- "dev": true,- "funding": {- "type": "github",- "url": "https://github.com/sponsors/gregberge"- }- },"node_modules/react-onclickoutside": {"version": "6.13.0","resolved": "https://registry.npmjs.org/react-onclickoutside/-/react-onclickoutside-6.13.0.tgz",@@ -41631,6 +41631,12 @@"tslib": "^1.9.3"}},+ "react-merge-refs": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/react-merge-refs/-/react-merge-refs-1.1.0.tgz",+ "integrity": "sha512-alTKsjEL0dKH/ru1Iyn7vliS2QRcBp9zZPGoWxUOvRGWPUYgjo+V01is7p04It6KhgrzhJGnIj9GgX8W4bZoCQ==",+ "dev": true+ },"tslib": {"version": "1.14.1","resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",@@ -63919,12 +63925,6 @@}}},- "react-merge-refs": {- "version": "1.1.0",- "resolved": "https://registry.npmjs.org/react-merge-refs/-/react-merge-refs-1.1.0.tgz",- "integrity": "sha512-alTKsjEL0dKH/ru1Iyn7vliS2QRcBp9zZPGoWxUOvRGWPUYgjo+V01is7p04It6KhgrzhJGnIj9GgX8W4bZoCQ==",- "dev": true- },"react-onclickoutside": {"version": "6.13.0","resolved": "https://registry.npmjs.org/react-onclickoutside/-/react-onclickoutside-6.13.0.tgz",@@ -68107,7 +68107,7 @@"@types/react": "^17.0.37","@types/react-copy-to-clipboard": "^5.0.4","@types/react-dom": "^17.0.11",- "@types/react-syntax-highlighter": "*",+ "@types/react-syntax-highlighter": "^15.5.6","autoprefixer": "^10.4.2","clsx": "^1.2.1","cmdk-supabase": "^0.2.2",diff --git a/package.json b/package.jsonindex 8b9cd0ba811..a33c008ccc8 100644--- a/package.json+++ b/package.json@@ -59,8 +59,5 @@"functions","database","auth"- ],- "dependencies": {- "react-merge-refs": "^2.0.2"- }+ ]}diff --git a/packages/ui/src/components/Input/Input.tsx b/packages/ui/src/components/Input/Input.tsxindex 4971e1c4da6..8cba5fd28b4 100644--- a/packages/ui/src/components/Input/Input.tsx+++ b/packages/ui/src/components/Input/Input.tsx@@ -1,5 +1,4 @@-import React, { useEffect, useState, useRef } from 'react'-import { mergeRefs } from "react-merge-refs";+import React, { useEffect, useState } from 'react'import { IconCopy } from '../Icon/icons/IconCopy'import { Button } from '../Button'@@ -13,9 +12,10 @@ import { HIDDEN_PLACEHOLDER } from './../../lib/constants'import styleHandler from '../../lib/theme/styleHandler'import { useFormContext } from '../Form/FormContext'-export interface Props extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {+export interface Props+ extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'onCopy'> {copy?: boolean- onCopy?: (value: string) => void+ onCopy?: () => voiddefaultValue?: string | numberdescriptionText?: string | React.ReactNode | undefineddisabled?: boolean@@ -68,7 +68,6 @@ function Input({}: Props) {const [copyLabel, setCopyLabel] = useState('Copy')const [hidden, setHidden] = useState(true)- const localRef = useRef<HTMLInputElement>(null)const __styles = styleHandler('input')@@ -112,7 +111,7 @@ function Input({setTimeout(function () {setCopyLabel('Copy')}, 3000)- onCopy?.(value)+ onCopy?.()},function () {/* clipboard write failed */@@ -121,20 +120,6 @@ function Input({)}- useEffect(() => {- function onCopyEvent(event) {- const selection = document.getSelection();-- onCopy(selection.toString())- }-- localRef?.current?.addEventListener("copy", onCopyEvent);-- return () => {- localRef?.current?.removeEventListener("copy", onCopyEvent);- }- }, [])-function onReveal() {setHidden(false)}@@ -172,7 +157,7 @@ function Input({onChange={onInputChange}onBlur={handleBlurEvent}placeholder={placeholder}- ref={mergeRefs([inputRef, localRef])}+ ref={inputRef}type={type}value={reveal && hidden ? HIDDEN_PLACEHOLDER : value}className={inputClasses.join(' ')}@@ -201,7 +186,7 @@ function Input({}export interface TextAreaProps- extends Omit<React.InputHTMLAttributes<HTMLTextAreaElement>, 'size'> {+ extends Omit<React.InputHTMLAttributes<HTMLTextAreaElement>, 'size' | 'onCopy'> {descriptionText?: stringerror?: stringicon?: any@@ -216,7 +201,7 @@ export interface TextAreaPropsborderless?: booleanvalidation?: (x: any) => voidcopy?: boolean- onCopy?: (value: string) => void+ onCopy?: () => voidactions?: React.ReactNode}@@ -259,7 +244,7 @@ function TextArea({setTimeout(function () {setCopyLabel('Copy')}, 3000)- onCopy?.(value)+ onCopy?.()},function () {/* clipboard write failed */