jy-headless 0.1.10 → 0.1.11

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.
@@ -1,4 +1,4 @@
1
- import { HTMLAttributes, ReactNode } from 'react';
1
+ import { HTMLAttributes, JSX, ReactNode } from 'react';
2
2
  interface AccordionProps extends HTMLAttributes<HTMLDetailsElement> {
3
3
  isOpen: boolean;
4
4
  setIsOpen: (value: boolean) => void;
@@ -15,7 +15,7 @@ declare const Accordion: {
15
15
  };
16
16
  };
17
17
  interface SummaryProps extends HTMLAttributes<HTMLDivElement> {
18
- icon?: ReactNode;
18
+ icon?: ReactNode | JSX.Element;
19
19
  }
20
20
  interface DetailProps extends HTMLAttributes<HTMLDivElement> {
21
21
  }
@@ -1,7 +1,7 @@
1
- import { HTMLAttributes, ReactNode } from 'react';
1
+ import { HTMLAttributes, JSX, ReactNode } from 'react';
2
2
  interface ImageInput extends HTMLAttributes<HTMLInputElement> {
3
3
  onFileChange: (url: string) => void;
4
- defaultElement?: ReactNode;
4
+ defaultElement?: ReactNode | JSX.Element;
5
5
  preview: string;
6
6
  }
7
7
  declare const ImageInput: ({ id, preview, defaultElement, onFileChange, onChange, style, className, children, }: ImageInput) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,12 @@
1
- import { CSSProperties, InputHTMLAttributes, ReactNode } from 'react';
1
+ import { CSSProperties, InputHTMLAttributes, JSX, ReactNode } from 'react';
2
2
  export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
3
3
  showLimit?: boolean;
4
4
  containerStyle?: CSSProperties;
5
5
  containerClassName?: string;
6
- prefixElement?: ReactNode;
7
- suffixElement?: ReactNode;
6
+ prefixElement?: ReactNode | JSX.Element;
7
+ suffixElement?: ReactNode | JSX.Element;
8
8
  showError?: boolean;
9
- error?: ReactNode | string;
9
+ error?: ReactNode | JSX.Element | string;
10
10
  }
11
11
  declare const Input: ({ prefixElement, suffixElement, className, style, containerStyle, containerClassName, showError, error, maxLength, showLimit, ...restProps }: InputProps) => import("react/jsx-runtime").JSX.Element;
12
12
  export default Input;
@@ -1,8 +1,8 @@
1
- import { CSSProperties, ReactNode } from 'react';
1
+ import { CSSProperties, JSX, ReactNode } from 'react';
2
2
  import { ButtonProps } from '../button/Button';
3
3
  interface ModalProps {
4
- opener: ReactNode;
5
- children: ReactNode;
4
+ opener: ReactNode | JSX.Element;
5
+ children: ReactNode | JSX.Element;
6
6
  targetSelector?: string;
7
7
  }
8
8
  declare const Modal: {
@@ -11,7 +11,7 @@ declare const Modal: {
11
11
  ({ backgroundColor, children, style, className, zIndex, }: ModalOverlayProps): import("react/jsx-runtime").JSX.Element;
12
12
  displayName: string;
13
13
  };
14
- Closer: {
14
+ Close: {
15
15
  ({ ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
16
16
  displayName: string;
17
17
  };
@@ -19,7 +19,7 @@ declare const Modal: {
19
19
  interface ModalOverlayProps {
20
20
  backgroundColor?: string;
21
21
  zIndex?: number;
22
- children: ReactNode;
22
+ children: ReactNode | JSX.Element;
23
23
  style?: CSSProperties;
24
24
  className?: string;
25
25
  }
@@ -1,7 +1,7 @@
1
1
  import { CSSProperties, HTMLAttributes } from 'react';
2
2
  interface TabProps extends HTMLAttributes<HTMLDivElement> {
3
3
  currentTab: string;
4
- onChangeTab: (id: string) => void;
4
+ onChangeTab?: (id: string) => void;
5
5
  }
6
6
  declare const Tab: {
7
7
  ({ children, currentTab, onChangeTab, ...restProps }: TabProps): import("react/jsx-runtime").JSX.Element;
package/dist/index.esm.js CHANGED
@@ -888,9 +888,9 @@ const ModalCloseButton = (_a) => {
888
888
  return jsxRuntimeExports.jsx(Button, Object.assign({}, props, { onClick: () => setIsShow(false) }));
889
889
  };
890
890
  ModalOverlay.displayName = 'Modal.Overlay';
891
- ModalCloseButton.displayName = 'Modal.Closer';
891
+ ModalCloseButton.displayName = 'Modal.Close';
892
892
  Modal.Overlay = ModalOverlay;
893
- Modal.Closer = ModalCloseButton;
893
+ Modal.Close = ModalCloseButton;
894
894
 
895
895
  const TabContext = createContext({
896
896
  currentTabId: '',
@@ -910,8 +910,8 @@ const TabItem = (_a) => {
910
910
  if (!context) {
911
911
  throw new Error('ModalCloseButton must be used within a ModalContext.Provider');
912
912
  }
913
- const { currentTabId, onChangeTab } = context;
914
- return (jsxRuntimeExports.jsx("span", Object.assign({}, restProps, { onClick: () => onChangeTab(tabId), children: children })));
913
+ const { onChangeTab } = context;
914
+ return (jsxRuntimeExports.jsx("span", Object.assign({}, restProps, { onClick: () => onChangeTab === null || onChangeTab === undefined ? undefined : onChangeTab(tabId), children: children })));
915
915
  };
916
916
  TabItem.displayName = 'Tab.Item';
917
917
  Tab.Item = TabItem;
package/dist/index.js CHANGED
@@ -890,9 +890,9 @@ const ModalCloseButton = (_a) => {
890
890
  return jsxRuntimeExports.jsx(Button, Object.assign({}, props, { onClick: () => setIsShow(false) }));
891
891
  };
892
892
  ModalOverlay.displayName = 'Modal.Overlay';
893
- ModalCloseButton.displayName = 'Modal.Closer';
893
+ ModalCloseButton.displayName = 'Modal.Close';
894
894
  Modal.Overlay = ModalOverlay;
895
- Modal.Closer = ModalCloseButton;
895
+ Modal.Close = ModalCloseButton;
896
896
 
897
897
  const TabContext = React.createContext({
898
898
  currentTabId: '',
@@ -912,8 +912,8 @@ const TabItem = (_a) => {
912
912
  if (!context) {
913
913
  throw new Error('ModalCloseButton must be used within a ModalContext.Provider');
914
914
  }
915
- const { currentTabId, onChangeTab } = context;
916
- return (jsxRuntimeExports.jsx("span", Object.assign({}, restProps, { onClick: () => onChangeTab(tabId), children: children })));
915
+ const { onChangeTab } = context;
916
+ return (jsxRuntimeExports.jsx("span", Object.assign({}, restProps, { onClick: () => onChangeTab === null || onChangeTab === undefined ? undefined : onChangeTab(tabId), children: children })));
917
917
  };
918
918
  TabItem.displayName = 'Tab.Item';
919
919
  Tab.Item = TabItem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jy-headless",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "A lightweight and customizable headless UI library for React components",
5
5
  "main": "dist/index.cjs",
6
6
  "typings": "dist/index.d.ts",