diff --git a/package-lock.json b/package-lock.json index 712f57a6..59d8b076 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "utopia-ui", - "version": "3.0.93", + "version": "3.0.96", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "utopia-ui", - "version": "3.0.93", + "version": "3.0.96", "license": "GPL-3.0-only", "dependencies": { "@heroicons/react": "^2.0.17", diff --git a/package.json b/package.json index aa2efef2..773e6b15 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "utopia-ui", - "version": "3.0.93", + "version": "3.0.96", "description": "Reuseable React Components to build mapping apps for real life communities and networks", "repository": "https://github.com/utopia-os/utopia-ui", "homepage": "https://utopia-os.org/", @@ -12,6 +12,11 @@ "types": "./dist/index.d.ts", "import": "./dist/index.esm.js", "require": "./dist/index.cjs" + }, + "./Profile": { + "types": "./dist/Profile.d.ts", + "import": "./dist/Profile.esm.js", + "require": "./dist/Profile.cjs.js" } }, "type": "module", diff --git a/rollup.config.js b/rollup.config.js index ed8799f3..65741665 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -17,17 +17,22 @@ const aliasConfig = alias({ export default [ { - input: 'src/index.tsx', + input: { + index: 'src/index.tsx', + Profile: 'src/Components/Profile/index.tsx', + }, output: [ { - file: 'dist/index.esm.js', + dir: 'dist/', format: 'esm', sourcemap: true, + entryFileNames: '[name].esm.js', }, { - file: 'dist/index.cjs', + dir: 'dist/', format: 'cjs', sourcemap: true, + entryFileNames: '[name].cjs.js', }, ], plugins: [ @@ -78,8 +83,15 @@ export default [ ], }, { - input: 'dist/types/src/index.d.ts', - output: [{ file: 'dist/index.d.ts', format: 'es' }], + input: { + index: path.resolve(__dirname, 'dist/types/src/index.d.ts'), + Profile: path.resolve(__dirname, 'dist/types/src/Components/Profile/index.d.ts'), + }, + output: { + dir: path.resolve(__dirname, 'dist'), + format: 'es', + entryFileNames: '[name].d.ts', + }, plugins: [ aliasConfig, dts({ @@ -88,7 +100,7 @@ export default [ }, }), ], - external: [/\.css$/], //, /\.d\.ts$/ + external: [/\.css$/], watch: false, }, ] diff --git a/src/Components/Input/RichTextEditor.tsx b/src/Components/Input/RichTextEditor.tsx new file mode 100644 index 00000000..bdb6aebb --- /dev/null +++ b/src/Components/Input/RichTextEditor.tsx @@ -0,0 +1,65 @@ +import { useEffect, useRef, useState } from 'react' + +interface TextAreaProps { + labelTitle?: string + labelStyle?: string + containerStyle?: string + dataField?: string + inputStyle?: string + defaultValue: string + placeholder?: string + required?: boolean + size?: string + updateFormValue?: (value: string) => void +} + +/** + * @category Input + */ +export function RichTextEditor({ + labelTitle, + dataField, + labelStyle, + containerStyle, + inputStyle, + defaultValue, + placeholder, + required = true, + updateFormValue, +}: TextAreaProps) { + const ref = useRef(null) + const [inputValue, setInputValue] = useState(defaultValue) + + useEffect(() => { + setInputValue(defaultValue) + }, [defaultValue]) + + const handleChange = (e: React.ChangeEvent) => { + const newValue = e.target.value + setInputValue(newValue) + if (updateFormValue) { + updateFormValue(newValue) + } + } + + return ( +
+ {labelTitle ? ( + + ) : null} + +
+ ) +} diff --git a/src/Components/Profile/Subcomponents/ProfileTextForm.tsx b/src/Components/Profile/Subcomponents/ProfileTextForm.tsx index f0ad7153..8738ab17 100644 --- a/src/Components/Profile/Subcomponents/ProfileTextForm.tsx +++ b/src/Components/Profile/Subcomponents/ProfileTextForm.tsx @@ -4,7 +4,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { useEffect, useState } from 'react' -import { TextAreaInput } from '#components/Input' +import { RichTextEditor } from '#components/Input/RichTextEditor' import { MarkdownHint } from './MarkdownHint' @@ -47,7 +47,7 @@ export const ProfileTextForm = ({ - )} - @@ -102,7 +103,8 @@ export const TabsForm = ({ containerStyle='tw:grow' inputStyle={`tw:h-full ${!item.layer.itemType.show_start_end_input && 'tw:border-t-0 tw:rounded-tl-none'}`} /> - diff --git a/src/Components/Templates/LoadingMapOverlay.tsx b/src/Components/Templates/LoadingMapOverlay.tsx new file mode 100644 index 00000000..9d3eb69f --- /dev/null +++ b/src/Components/Templates/LoadingMapOverlay.tsx @@ -0,0 +1,11 @@ +import { MapOverlayPage } from '#components/Templates/MapOverlayPage' + +export const LoadingMapOverlay = () => { + return ( + +
+
+
+
+ ) +} diff --git a/src/Components/Templates/MapOverlayPage.tsx b/src/Components/Templates/MapOverlayPage.tsx index 1d3bbc70..0e994b28 100644 --- a/src/Components/Templates/MapOverlayPage.tsx +++ b/src/Components/Templates/MapOverlayPage.tsx @@ -45,7 +45,7 @@ export function MapOverlayPage({ >
{children}