agroptima-design-system 0.28.5-beta.3 → 0.28.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -24,7 +24,6 @@ export interface ModalProps {
|
|
|
24
24
|
id: string
|
|
25
25
|
title: string
|
|
26
26
|
variant?: Variant
|
|
27
|
-
closeButton?: boolean
|
|
28
27
|
scrollable?: boolean
|
|
29
28
|
className?: string
|
|
30
29
|
onClose?: () => void
|
|
@@ -46,22 +45,23 @@ export function Modal({
|
|
|
46
45
|
buttons,
|
|
47
46
|
onClose,
|
|
48
47
|
children,
|
|
49
|
-
closeButton = false,
|
|
50
48
|
variant = 'details',
|
|
51
49
|
...props
|
|
52
50
|
}: ModalProps) {
|
|
51
|
+
const isDetails = variant === 'details'
|
|
52
|
+
const showCloseButton = onClose && isDetails
|
|
53
53
|
return (
|
|
54
54
|
<ModalDialog
|
|
55
55
|
aria-labelledby={`${id}-title`}
|
|
56
56
|
aria-describedby={`${id}-body`}
|
|
57
57
|
onClose={onClose}
|
|
58
|
-
details={
|
|
58
|
+
details={isDetails}
|
|
59
59
|
{...props}
|
|
60
60
|
>
|
|
61
61
|
<ModalHeader>
|
|
62
62
|
{ICONS[variant]}
|
|
63
63
|
<ModalTitle id={`${id}-title`}>{title}</ModalTitle>
|
|
64
|
-
{
|
|
64
|
+
{showCloseButton && <ModalCloseButton onClick={onClose} />}
|
|
65
65
|
</ModalHeader>
|
|
66
66
|
<ModalBody id={`${id}-body`}>{children}</ModalBody>
|
|
67
67
|
<ModalFooter>
|
|
@@ -46,9 +46,6 @@ const meta = {
|
|
|
46
46
|
onClose: {
|
|
47
47
|
description: 'Function to be called when the modal is closed',
|
|
48
48
|
},
|
|
49
|
-
closeButton: {
|
|
50
|
-
description: 'If the modal should have a close button',
|
|
51
|
-
},
|
|
52
49
|
},
|
|
53
50
|
parameters: figmaPrimaryDesign,
|
|
54
51
|
}
|
|
@@ -158,7 +155,6 @@ export const DeleteOrDiscard = {
|
|
|
158
155
|
export const LargeModal = () => (
|
|
159
156
|
<Modal
|
|
160
157
|
title="Large Modal"
|
|
161
|
-
closeButton
|
|
162
158
|
onClose={() => alert('Close')}
|
|
163
159
|
buttons={[
|
|
164
160
|
{ label: 'Close', variant: 'neutral', onClick: () => alert('Close') },
|
|
@@ -273,7 +269,6 @@ export const FormModal = () => (
|
|
|
273
269
|
>
|
|
274
270
|
<Modal
|
|
275
271
|
title="Form Modal"
|
|
276
|
-
closeButton
|
|
277
272
|
onClose={() => alert('Close')}
|
|
278
273
|
buttons={[
|
|
279
274
|
{
|