From 1a5465dc340aa007fa0b423420d2bf54b82278ad Mon Sep 17 00:00:00 2001 From: DaneEveritt Date: Sun, 5 Jun 2022 14:56:42 -0400 Subject: [PATCH] Update react, add some V2 components for V1 usage --- package.json | 12 +- .../components/elements/button/Button.tsx | 36 ++++++ .../components/elements/button/index.ts | 2 + .../elements/button/style.module.css | 30 +++++ .../components/elements/dialog/Dialog.tsx | 112 ++++++++++++++++++ .../components/elements/dialog/index.ts | 2 + .../elements/dialog/style.module.css | 20 ++++ .../components/elements/dropdown/Dropdown.tsx | 62 ++++++++++ .../elements/dropdown/DropdownButton.tsx | 24 ++++ .../elements/dropdown/DropdownItem.tsx | 43 +++++++ .../components/elements/dropdown/index.ts | 2 + .../elements/dropdown/style.module.css | 58 +++++++++ .../components/elements/inputs/Checkbox.tsx | 11 ++ .../components/elements/inputs/InputField.tsx | 11 ++ .../components/elements/inputs/index.ts | 3 + .../elements/inputs/styles.module.css | 21 ++++ .../elements/transitions/FadeTransition.tsx | 31 +++++ .../components/elements/transitions/index.ts | 8 ++ resources/scripts/globals.d.ts | 1 + resources/scripts/macros.d.ts | 43 +++---- yarn.lock | 75 +++++++++--- 21 files changed, 564 insertions(+), 43 deletions(-) create mode 100644 resources/scripts/components/elements/button/Button.tsx create mode 100644 resources/scripts/components/elements/button/index.ts create mode 100644 resources/scripts/components/elements/button/style.module.css create mode 100644 resources/scripts/components/elements/dialog/Dialog.tsx create mode 100644 resources/scripts/components/elements/dialog/index.ts create mode 100644 resources/scripts/components/elements/dialog/style.module.css create mode 100644 resources/scripts/components/elements/dropdown/Dropdown.tsx create mode 100644 resources/scripts/components/elements/dropdown/DropdownButton.tsx create mode 100644 resources/scripts/components/elements/dropdown/DropdownItem.tsx create mode 100644 resources/scripts/components/elements/dropdown/index.ts create mode 100644 resources/scripts/components/elements/dropdown/style.module.css create mode 100644 resources/scripts/components/elements/inputs/Checkbox.tsx create mode 100644 resources/scripts/components/elements/inputs/InputField.tsx create mode 100644 resources/scripts/components/elements/inputs/index.ts create mode 100644 resources/scripts/components/elements/inputs/styles.module.css create mode 100644 resources/scripts/components/elements/transitions/FadeTransition.tsx create mode 100644 resources/scripts/components/elements/transitions/index.ts diff --git a/package.json b/package.json index 0d80e4a7f..f4d8bf6d1 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,13 @@ "@fortawesome/fontawesome-svg-core": "^1.2.32", "@fortawesome/free-solid-svg-icons": "^5.15.1", "@fortawesome/react-fontawesome": "^0.1.11", + "@headlessui/react": "^1.6.4", + "@heroicons/react": "^1.0.6", + "@hot-loader/react-dom": "^16.14.0", "@tailwindcss/forms": "^0.5.2", "axios": "^0.21.1", "chart.js": "^2.8.0", + "classnames": "^2.3.1", "codemirror": "^5.57.0", "date-fns": "^2.16.1", "debounce": "^1.2.0", @@ -20,7 +24,7 @@ "i18next-xhr-backend": "^3.2.2", "qrcode.react": "^1.0.1", "query-string": "^6.7.0", - "react": "^16.13.1", + "react": "^16.14.0", "react-copy-to-clipboard": "^5.0.2", "react-dom": "npm:@hot-loader/react-dom", "react-fast-compare": "^3.2.0", @@ -64,9 +68,9 @@ "@types/node": "^14.11.10", "@types/qrcode.react": "^1.0.1", "@types/query-string": "^6.3.0", - "@types/react": "^16.9.41", + "@types/react": "^16.14.0", "@types/react-copy-to-clipboard": "^4.3.0", - "@types/react-dom": "^16.9.8", + "@types/react-dom": "^16.9.16", "@types/react-helmet": "^6.0.0", "@types/react-redux": "^7.1.1", "@types/react-router": "^5.1.3", @@ -103,7 +107,7 @@ "terser-webpack-plugin": "^4.2.3", "ts-essentials": "^9.1.2", "twin.macro": "^2.8.2", - "typescript": "^4.2.4", + "typescript": "^4.7.3", "webpack": "^4.43.0", "webpack-assets-manifest": "^3.1.1", "webpack-bundle-analyzer": "^3.8.0", diff --git a/resources/scripts/components/elements/button/Button.tsx b/resources/scripts/components/elements/button/Button.tsx new file mode 100644 index 000000000..55c8ca81b --- /dev/null +++ b/resources/scripts/components/elements/button/Button.tsx @@ -0,0 +1,36 @@ +import React, { forwardRef } from 'react'; +import classNames from 'classnames'; +import styles from './style.module.css'; + +export type ButtonProps = JSX.IntrinsicElements['button'] & { + square?: boolean; + small?: boolean; +} + +const Button = forwardRef( + ({ children, square, small, className, ...rest }, ref) => { + return ( + + ); + }, +); + +const TextButton = forwardRef(({ className, ...props }, ref) => ( + // @ts-expect-error +