@latte-macchiat-io/latte-vanilla-components 0.0.237 → 0.0.239

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latte-macchiat-io/latte-vanilla-components",
3
- "version": "0.0.237",
3
+ "version": "0.0.239",
4
4
  "description": "Beautiful components for amazing projects, with a touch of Vanilla 🥤",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -1,2 +1,2 @@
1
- export { Modal, type ModalProps } from './';
1
+ export { Modal, type ModalProps, type ModalRenderProp } from './';
2
2
  export { type ModalVariants } from './styles.css';
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { clsx } from 'clsx';
4
- import { ReactNode, useState } from 'react';
4
+ import { ReactNode, ReactElement, useState } from 'react';
5
5
 
6
6
  import { modal, modalContentCloseButton, modalContentRecipe, type ModalVariants } from './styles.css';
7
7
 
@@ -10,13 +10,22 @@ import { Actions } from '../Actions';
10
10
  import { Button } from '../Button';
11
11
  import { Icon } from '../Icon';
12
12
 
13
- type ModalRenderProp = (args: { closeModal: () => void }) => ReactNode;
13
+ export type ModalRenderProp = (args: { closeModal: () => void }) => ReactElement;
14
+
15
+ type ModalChildren =
16
+ | ReactElement
17
+ | ReactElement[]
18
+ | string
19
+ | number
20
+ | null
21
+ | undefined
22
+ | ModalRenderProp;
14
23
 
15
24
  export type ModalProps = React.HTMLAttributes<HTMLDivElement> &
16
25
  ModalVariants & {
17
26
  triggerLabel: string;
18
27
  withCloseButton?: boolean;
19
- children: ReactNode | ModalRenderProp;
28
+ children: ModalChildren;
20
29
  };
21
30
 
22
31
  export const Modal = ({ triggerLabel, className, children, align, withCloseButton = false }: ModalProps) => {