From 047848ae9547474f5b746f6683b26b9753ebacb8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 10 Jan 2024 17:34:31 +0000 Subject: [PATCH 01/13] Update pnpm to v8.14.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 96943ff5..e6d717c1 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,6 @@ "turbo": "1.11.3", "@turbo/gen": "1.11.3" }, - "packageManager": "pnpm@8.14.0", + "packageManager": "pnpm@8.14.1", "name": "ui" } From 942b559e65083d4d0581ab8c1331b452410e8eb5 Mon Sep 17 00:00:00 2001 From: DorijanH Date: Tue, 16 Jan 2024 09:41:47 +0100 Subject: [PATCH 02/13] fix(react-ui/dropdown-button): onClick prop type --- apps/docs/components/ExampleDropdownButton.tsx | 3 ++- packages/react-ui/DropdownButton/DropdownButton.tsx | 2 +- .../changes/Fixed [DropdownButton] `onClick` prop type | 0 packages/react-ui/temp/react-ui.api.md | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 packages/react-ui/changes/Fixed [DropdownButton] `onClick` prop type diff --git a/apps/docs/components/ExampleDropdownButton.tsx b/apps/docs/components/ExampleDropdownButton.tsx index 512eb568..06dfd0ab 100644 --- a/apps/docs/components/ExampleDropdownButton.tsx +++ b/apps/docs/components/ExampleDropdownButton.tsx @@ -20,7 +20,8 @@ export function ExampleDropdownButton() { options={[ { label: 'Option 1', value: 'option1' }, { label: 'Option 2', value: 'option2' }, - ]}> + ]} + > Export {/* // @highlight-end */} diff --git a/packages/react-ui/DropdownButton/DropdownButton.tsx b/packages/react-ui/DropdownButton/DropdownButton.tsx index c37e4ac9..41a2f319 100644 --- a/packages/react-ui/DropdownButton/DropdownButton.tsx +++ b/packages/react-ui/DropdownButton/DropdownButton.tsx @@ -14,7 +14,7 @@ export type DropdownButtonOption = { * The props of the {@link DropdownButton} component. * @public */ -export type DropdownButtonProps = ButtonProps & { +export type DropdownButtonProps = Omit & { options?: DropdownButtonOption[]; icon?: ReactElement; onClick?: (event: any, value: any) => void; diff --git a/packages/react-ui/changes/Fixed [DropdownButton] `onClick` prop type b/packages/react-ui/changes/Fixed [DropdownButton] `onClick` prop type new file mode 100644 index 00000000..e69de29b diff --git a/packages/react-ui/temp/react-ui.api.md b/packages/react-ui/temp/react-ui.api.md index ca594e16..e6dd4237 100644 --- a/packages/react-ui/temp/react-ui.api.md +++ b/packages/react-ui/temp/react-ui.api.md @@ -96,7 +96,7 @@ export type DropdownButtonOption = { }; // @public -export type DropdownButtonProps = ButtonProps & { +export type DropdownButtonProps = Omit & { options?: DropdownButtonOption[]; icon?: ReactElement; onClick?: (event: any, value: any) => void; From 5cd63425fca5fc267d96e4232f328b76a4667023 Mon Sep 17 00:00:00 2001 From: DorijanH Date: Tue, 16 Jan 2024 10:01:27 +0100 Subject: [PATCH 03/13] feat(react-ui/confirm-button): iconButton optional prop --- apps/docs/components/ExampleConfirmButton.tsx | 7 +++-- .../components/ExampleConfirmButtonIcon.tsx | 19 ++++++++++++ .../react-ui/components/confirm-button.mdx | 5 ++++ .../react-ui/ConfirmButton/ConfirmButton.tsx | 29 +++++++++++++++++-- ...[ConfirmButton] `iconButton` optional prop | 0 packages/react-ui/temp/react-ui.api.md | 3 +- 6 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 apps/docs/components/ExampleConfirmButtonIcon.tsx create mode 100644 packages/react-ui/changes/Added [ConfirmButton] `iconButton` optional prop diff --git a/apps/docs/components/ExampleConfirmButton.tsx b/apps/docs/components/ExampleConfirmButton.tsx index 6601676c..77df1b97 100644 --- a/apps/docs/components/ExampleConfirmButton.tsx +++ b/apps/docs/components/ExampleConfirmButton.tsx @@ -4,11 +4,12 @@ export function ExampleConfirmButton() { return ( // @highlight-start { }}> + onConfirm={() => { }} + header={'Potvrdite brisanje'} + message='Jeste li sigurni da želite obrisati ovaj zapis?' + > Obriši // @highlight-end diff --git a/apps/docs/components/ExampleConfirmButtonIcon.tsx b/apps/docs/components/ExampleConfirmButtonIcon.tsx new file mode 100644 index 00000000..1e1eab93 --- /dev/null +++ b/apps/docs/components/ExampleConfirmButtonIcon.tsx @@ -0,0 +1,19 @@ +import { ConfirmButton } from '@enterwell/react-ui'; +import { Delete } from '@mui/icons-material'; + +export function ExampleConfirmButtonIcon() { + return ( + // @highlight-start + { }} + header={'Potvrdite brisanje'} + message='Jeste li sigurni da želite obrisati ovaj zapis?' + > + + + // @highlight-end + ) +} \ No newline at end of file diff --git a/apps/docs/pages/react-ui/components/confirm-button.mdx b/apps/docs/pages/react-ui/components/confirm-button.mdx index 4a216a8d..f97befae 100644 --- a/apps/docs/pages/react-ui/components/confirm-button.mdx +++ b/apps/docs/pages/react-ui/components/confirm-button.mdx @@ -5,6 +5,7 @@ title: ConfirmButton import { ConfirmButton } from '@enterwell/react-ui'; import { ComponentWithSource } from '../../../components/docs/ComponentWithSource.tsx'; import { ExampleConfirmButton } from '../../../components/ExampleConfirmButton.tsx'; +import { ExampleConfirmButtonIcon } from '../../../components/ExampleConfirmButtonIcon.tsx'; import { ComponentDescription, ComponentParameters, ComponentSource } from '../../../components/docs/ComponentDocs'; # ConfirmButton @@ -21,6 +22,10 @@ import { ComponentDescription, ComponentParameters, ComponentSource } from '../. +## As icon button + + + ## Inspect
diff --git a/packages/react-ui/ConfirmButton/ConfirmButton.tsx b/packages/react-ui/ConfirmButton/ConfirmButton.tsx index 482ad452..e48b37fd 100644 --- a/packages/react-ui/ConfirmButton/ConfirmButton.tsx +++ b/packages/react-ui/ConfirmButton/ConfirmButton.tsx @@ -1,6 +1,6 @@ import { ConfirmDialog, type ConfirmDialogProps } from '../ConfirmDialog'; import { useState } from 'react'; -import { Button, type ButtonProps } from '@mui/material'; +import { Button, IconButton, type ButtonProps } from '@mui/material'; /** * The keys of the {@link ConfirmDialog} props that are destructured from shared props. @@ -16,6 +16,10 @@ export type ConfirmButtonProps = Omit & Pick & { + /** + * @defaultValue `false` + */ + iconButton?: boolean; onConfirm?: () => void; slots?: { // Omit already used props and shared props, re-add color so we can @@ -31,7 +35,14 @@ export type ConfirmButtonProps = * @public */ export function ConfirmButton({ - header, message, confirmButtonText, color, onConfirm, slots, ...rest + header, + message, + confirmButtonText, + color, + iconButton = false, + onConfirm, + slots, + ...rest }: ConfirmButtonProps) { const [open, setOpen] = useState(false); @@ -42,7 +53,19 @@ export function ConfirmButton({ return ( <> -