funuicss 2.0.25 → 2.5.1

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.
Files changed (86) hide show
  1. package/css/fun.css +1005 -3758
  2. package/index.d.ts +35 -0
  3. package/index.js +76 -0
  4. package/index.tsx +35 -0
  5. package/js/Fun.js +2 -2
  6. package/js/Fun.tsx +9 -8
  7. package/package.json +2 -1
  8. package/tsconfig.tsbuildinfo +1 -1
  9. package/ui/alert/Alert.d.ts +5 -3
  10. package/ui/alert/Alert.js +27 -23
  11. package/ui/alert/Alert.tsx +71 -86
  12. package/ui/aos/AOS.d.ts +1 -1
  13. package/ui/appbar/AppBar.d.ts +1 -1
  14. package/ui/avatar/Avatar.d.ts +2 -1
  15. package/ui/breadcrumb/BreadCrumb.d.ts +2 -1
  16. package/ui/button/Button.d.ts +1 -1
  17. package/ui/card/Card.d.ts +1 -1
  18. package/ui/card/CardBody.d.ts +2 -2
  19. package/ui/card/CardFab.d.ts +2 -2
  20. package/ui/card/CardFooter.d.ts +2 -2
  21. package/ui/card/CardHeader.d.ts +2 -2
  22. package/ui/div/Div.d.ts +1 -1
  23. package/ui/drop/Action.d.ts +1 -1
  24. package/ui/drop/Down.d.ts +1 -1
  25. package/ui/drop/Item.d.ts +1 -1
  26. package/ui/drop/Menu.d.ts +1 -1
  27. package/ui/drop/Up.d.ts +1 -1
  28. package/ui/grid/Col.d.ts +2 -1
  29. package/ui/grid/Grid.d.ts +2 -1
  30. package/ui/input/Iconic.d.ts +2 -2
  31. package/ui/input/Input.d.ts +2 -0
  32. package/ui/input/Input.js +50 -9
  33. package/ui/input/Input.tsx +34 -7
  34. package/ui/list/Item.d.ts +1 -1
  35. package/ui/list/List.d.ts +1 -1
  36. package/ui/loader/Loader.d.ts +2 -1
  37. package/ui/modal/Action.d.ts +1 -1
  38. package/ui/modal/Close.d.ts +2 -1
  39. package/ui/modal/Content.d.ts +1 -1
  40. package/ui/modal/Header.d.ts +2 -2
  41. package/ui/modal/Header.tsx +1 -1
  42. package/ui/modal/Modal.d.ts +8 -2
  43. package/ui/modal/Modal.js +33 -21
  44. package/ui/modal/Modal.tsx +99 -52
  45. package/ui/notification/Content.d.ts +1 -1
  46. package/ui/notification/Footer.d.ts +1 -1
  47. package/ui/notification/Header.d.ts +1 -1
  48. package/ui/notification/Notification.d.ts +1 -1
  49. package/ui/page/NotFound.d.ts +1 -1
  50. package/ui/page/NotFound.js +5 -5
  51. package/ui/page/NotFound.tsx +6 -7
  52. package/ui/page/UnAuthorized.d.ts +1 -1
  53. package/ui/page/UnAuthorized.js +4 -2
  54. package/ui/page/UnAuthorized.tsx +7 -5
  55. package/ui/progress/Bar.d.ts +1 -1
  56. package/ui/sidebar/SideBar.d.ts +2 -1
  57. package/ui/sidebar/SideContent.d.ts +1 -1
  58. package/ui/snackbar/SnackBar.d.ts +4 -1
  59. package/ui/snackbar/SnackBar.js +16 -14
  60. package/ui/snackbar/SnackBar.tsx +41 -25
  61. package/ui/specials/Circle.d.ts +3 -2
  62. package/ui/specials/Circle.js +2 -2
  63. package/ui/specials/Circle.tsx +5 -3
  64. package/ui/specials/FullCenteredPage.d.ts +1 -1
  65. package/ui/specials/Hr.d.ts +1 -1
  66. package/ui/specials/RowFlex.d.ts +1 -1
  67. package/ui/specials/Section.d.ts +1 -1
  68. package/ui/table/Body.d.ts +1 -1
  69. package/ui/table/Data.d.ts +1 -1
  70. package/ui/table/Head.d.ts +1 -1
  71. package/ui/table/Row.d.ts +1 -1
  72. package/ui/table/Table.d.ts +1 -1
  73. package/ui/table/Table.js +11 -7
  74. package/ui/table/Table.tsx +20 -8
  75. package/ui/text/Text.d.ts +5 -5
  76. package/ui/text/Text.js +20 -11
  77. package/ui/text/Text.tsx +62 -33
  78. package/ui/tooltip/Tip.d.ts +2 -1
  79. package/ui/tooltip/Tip.js +9 -5
  80. package/ui/tooltip/Tip.tsx +12 -2
  81. package/ui/tooltip/ToolTip.d.ts +1 -1
  82. package/ui/tooltip/ToolTip.js +1 -1
  83. package/ui/tooltip/ToolTip.tsx +7 -1
  84. package/ui/video/FunPlayer.d.ts +0 -7
  85. package/ui/video/FunPlayer.js +202 -179
  86. package/ui/video/FunPlayer.tsx +218 -218
@@ -1,7 +1,7 @@
1
- import { ReactNode } from 'react';
2
- import * as React from 'react'
3
- import { TfiCheck, TfiInfoAlt } from "react-icons/tfi";
1
+ 'use client'
4
2
  import { PiInfo , PiCheckCircleDuotone , PiWarning , PiX , PiSpinner } from "react-icons/pi";
3
+ import React, { ReactNode, useEffect, useState } from 'react';
4
+
5
5
  interface AlertProps {
6
6
  message?: string;
7
7
  funcss?: string;
@@ -11,14 +11,17 @@ interface AlertProps {
11
11
  fullWidth?: boolean;
12
12
  isLoading?: boolean;
13
13
  children?: ReactNode;
14
- animation?:string ;
15
- duration?:string
16
- raised?:boolean ,
17
- card?:boolean,
18
- variant?:string,
19
- flat?:boolean,
20
- standard?:boolean,
21
- style?:React.CSSProperties
14
+ animation?: string;
15
+ duration?: string;
16
+ raised?: boolean;
17
+ card?: boolean;
18
+ variant?: string;
19
+ flat?: boolean;
20
+ standard?: boolean;
21
+ style?: React.CSSProperties;
22
+ autoHide?: boolean;
23
+ autoHideDuration?: number;
24
+ onClose?: () => void;
22
25
  }
23
26
 
24
27
  export default function Alert({
@@ -30,92 +33,74 @@ export default function Alert({
30
33
  raised,
31
34
  fullWidth,
32
35
  isLoading,
33
- children,
36
+ children,
34
37
  animation,
35
- duration ,
38
+ duration,
36
39
  variant,
37
40
  flat,
38
41
  standard,
39
42
  card,
40
43
  style,
44
+ autoHide = false,
45
+ autoHideDuration = 3000,
46
+ onClose,
41
47
  ...rest
42
48
  }: AlertProps) {
43
- return (
44
- <div className={
45
- `
46
- ${fixed ? 'alert-container ' : ''}
47
- ${fixed === "top-left" ? "top-left" : ""}
48
- ${fixed === "top-right" ? "top-right" : ""}
49
- ${fixed === "bottom-left" ? "bottom-left" : ""}
50
- ${fixed === "bottom-right" ? "bottom-right" : ""}
51
- ${fixed === "middle" ? "middle-alert" : ""}
52
- ${fixed === "top-middle" ? "top-middle" : ""}
53
- ${fixed === "bottom-middle" ? "bottom-middle" : ""}`
54
- }>
55
- {outlined ? (
56
- <div
57
- style={{
58
- animation: `${duration ? duration : "0.3"}s ${animation ? animation : "ScaleUp"}`,
59
- ...style
60
- }}
61
- className={`alert ${card ? "card" : ""} ${flat ? "flat" : ""} ${raised ? 'raised' : ''} ${type}-outline
49
+ const [visible, setVisible] = useState(true);
62
50
 
63
- ${fullWidth ? "width-100-p" : ""}
64
- `}
65
- {...rest}
66
- >
67
- <div className="alert-icon">
68
- {!isLoading ? (
69
- <div className={`text-${type}`}>
70
- {type === "success" && <PiCheckCircleDuotone />}
71
- {type === "info" && <PiInfo />}
72
- {type === "warning" && <PiWarning />}
73
- {type === "danger" && <PiX />}
74
- </div>
75
- ) : (
76
- <span className='rotate'> <PiSpinner /> </span>
77
- )}
78
- </div>
79
- <div className="alert-text">
80
- {message ? message : children ? children : ""}
81
- </div>
82
- </div>
83
- ) : (
84
- ""
85
- )}
51
+ useEffect(() => {
52
+ let timeout: NodeJS.Timeout;
53
+ if (autoHide) {
54
+ timeout = setTimeout(() => {
55
+ setVisible(false);
56
+ onClose?.();
57
+ }, autoHideDuration);
58
+ }
59
+ return () => clearTimeout(timeout);
60
+ }, [autoHide, autoHideDuration, onClose]);
86
61
 
87
- {!outlined ? (
88
- <div
89
- style={{
90
- animation: `${duration ? duration : "0.3"}s ${animation ? animation : "ScaleUp"}`,
91
- ...style
92
- }}
93
- className={`alert ${card ? "card" : ""} ${flat ? "flat" : ""} ${raised ? 'raised' : ''}
94
- ${variant ? variant : standard ? "" : type}
95
- ${standard ? "top-" + type : ""}
96
- ${funcss || ""}
97
- ${fullWidth ? "width-100-p" : ""}
98
- `}
99
- >
100
- <div className="alert-icon">
101
- {!isLoading ? (
102
- <div className={`text-${type}`}>
103
- {type === "success" && <PiCheckCircleDuotone />}
104
- {type === "info" && <PiInfo />}
105
- {type === "warning" && <PiWarning />}
106
- {type === "danger" && <PiX />}
107
- </div>
108
- ) : (
109
- <span className='rotate'> <PiSpinner /> </span>
110
- )}
111
- </div>
112
- <div className="alert-text">
113
- {message ? message : children ? children : ""}
114
- </div>
62
+ if (!visible) return null;
63
+
64
+ return (
65
+ <div
66
+ className={`${
67
+ fixed ? 'alert-container ' : ''
68
+ } ${fixed === 'top-left' ? 'top-left' : ''}
69
+ ${fixed === 'top-right' ? 'top-right' : ''}
70
+ ${fixed === 'bottom-left' ? 'bottom-left' : ''}
71
+ ${fixed === 'bottom-right' ? 'bottom-right' : ''}
72
+ ${fixed === 'middle' ? 'middle-alert' : ''}
73
+ ${fixed === 'top-middle' ? 'top-middle' : ''}
74
+ ${fixed === 'bottom-middle' ? 'bottom-middle' : ''}`}
75
+ >
76
+ <div
77
+ style={{
78
+ animation: `${duration || '0.3'}s ${animation || 'ScaleUp'}`,
79
+ ...style,
80
+ }}
81
+ className={`alert ${card ? 'card' : ''} ${flat ? 'flat' : ''} ${raised ? 'raised' : ''} ${
82
+ outlined
83
+ ? `${type}-outline`
84
+ : `${variant || (standard ? `top-${type}` : type)}`
85
+ } ${funcss || ''} ${fullWidth ? 'width-100-p' : ''}`}
86
+ {...rest}
87
+ >
88
+ <div className="alert-icon">
89
+ {!isLoading ? (
90
+ <div className={`text-${type}`}>
91
+ {type === 'success' && <PiCheckCircleDuotone />}
92
+ {type === 'info' && <PiInfo />}
93
+ {type === 'warning' && <PiWarning />}
94
+ {type === 'danger' && <PiX />}
95
+ </div>
96
+ ) : (
97
+ <span className="rotate">
98
+ <PiSpinner />
99
+ </span>
100
+ )}
115
101
  </div>
116
- ) : (
117
- ""
118
- )}
102
+ <div className="alert-text">{message || children}</div>
103
+ </div>
119
104
  </div>
120
105
  );
121
106
  }
package/ui/aos/AOS.d.ts CHANGED
@@ -5,5 +5,5 @@ interface ListItemProps {
5
5
  animation?: string;
6
6
  anchorPlacement?: string;
7
7
  }
8
- export default function Animation({ children, funcss, animation, anchorPlacement, ...rest }: ListItemProps): any;
8
+ export default function Animation({ children, funcss, animation, anchorPlacement, ...rest }: ListItemProps): React.JSX.Element;
9
9
  export {};
@@ -15,5 +15,5 @@ interface NavbarProps {
15
15
  sideBar?: number;
16
16
  width?: string;
17
17
  }
18
- export default function AppBar({ fixedTop, funcss, padding, fixedBottom, justify, children, left, center, right, sideBar, width, visibleLinks, sidebarTrigger, transparent }: NavbarProps): any;
18
+ export default function AppBar({ fixedTop, funcss, padding, fixedBottom, justify, children, left, center, right, sideBar, width, visibleLinks, sidebarTrigger, transparent }: NavbarProps): React.JSX.Element;
19
19
  export {};
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import * as React from 'react';
2
3
  interface AvatarProps {
3
4
  funcss?: string;
4
5
  children?: ReactNode;
@@ -6,5 +7,5 @@ interface AvatarProps {
6
7
  bg?: string;
7
8
  content?: ReactNode;
8
9
  }
9
- export default function Avatar({ funcss, children, size, bg, content, }: AvatarProps): any;
10
+ export default function Avatar({ funcss, children, size, bg, content, }: AvatarProps): React.JSX.Element;
10
11
  export {};
@@ -1,7 +1,8 @@
1
+ import * as React from 'react';
1
2
  interface BreadCrumbProps {
2
3
  type?: 'slash' | 'greater' | 'less' | 'straight';
3
4
  funcss?: string;
4
5
  color?: string;
5
6
  }
6
- export default function BreadCrumb({ type, funcss, color }: BreadCrumbProps): any;
7
+ export default function BreadCrumb({ type, funcss, color }: BreadCrumbProps): React.JSX.Element;
7
8
  export {};
@@ -381,5 +381,5 @@ interface ButtonProps {
381
381
  style?: React.CSSProperties;
382
382
  onClick?: () => void;
383
383
  }
384
- export default function Button({ color, bg, funcss, startIcon, endIcon, text, rounded, raised, height, width, float, hoverUp, fullWidth, outlined, small, hoverless, smaller, big, bigger, jumbo, flat, hoverNone, fillAnimation, fillDirection, fillTextColor, outlineSize, isLoading, status, children, bold, style, onClick, ...rest }: ButtonProps): any;
384
+ export default function Button({ color, bg, funcss, startIcon, endIcon, text, rounded, raised, height, width, float, hoverUp, fullWidth, outlined, small, hoverless, smaller, big, bigger, jumbo, flat, hoverNone, fillAnimation, fillDirection, fillTextColor, outlineSize, isLoading, status, children, bold, style, onClick, ...rest }: ButtonProps): React.JSX.Element;
385
385
  export {};
package/ui/card/Card.d.ts CHANGED
@@ -28,5 +28,5 @@ interface CardProps {
28
28
  xl?: boolean;
29
29
  style?: React.CSSProperties;
30
30
  }
31
- export default function Card({ color, bg, width, height, minHeight, minWidth, margin, padding, funcss, children, roundEdge, maxHeight, maxWidth, horizontal, id, header, body, footer, noGap, fab, image, shadowless, flat, responsiveMedium, xl, responsiveSmall, style, ...rest }: CardProps): any;
31
+ export default function Card({ color, bg, width, height, minHeight, minWidth, margin, padding, funcss, children, roundEdge, maxHeight, maxWidth, horizontal, id, header, body, footer, noGap, fab, image, shadowless, flat, responsiveMedium, xl, responsiveSmall, style, ...rest }: CardProps): React.JSX.Element;
32
32
  export {};
@@ -1,7 +1,7 @@
1
- import { ReactNode, HTMLProps } from 'react';
1
+ import React, { ReactNode, HTMLProps } from 'react';
2
2
  interface CardBodyProps extends HTMLProps<HTMLDivElement> {
3
3
  funcss?: string;
4
4
  children?: ReactNode;
5
5
  }
6
- export default function CardBody({ funcss, children, ...rest }: CardBodyProps): any;
6
+ export default function CardBody({ funcss, children, ...rest }: CardBodyProps): React.JSX.Element;
7
7
  export {};
@@ -1,8 +1,8 @@
1
- import { ReactNode, HTMLProps } from 'react';
1
+ import React, { ReactNode, HTMLProps } from 'react';
2
2
  interface CardFabProps extends HTMLProps<HTMLDivElement> {
3
3
  funcss?: string;
4
4
  position?: string;
5
5
  children?: ReactNode;
6
6
  }
7
- export default function CardFab({ funcss, position, children, ...rest }: CardFabProps): any;
7
+ export default function CardFab({ funcss, position, children, ...rest }: CardFabProps): React.JSX.Element;
8
8
  export {};
@@ -1,7 +1,7 @@
1
- import { ReactNode, HTMLProps } from 'react';
1
+ import React, { ReactNode, HTMLProps } from 'react';
2
2
  interface CardFooterProps extends HTMLProps<HTMLDivElement> {
3
3
  funcss?: string;
4
4
  children?: ReactNode;
5
5
  }
6
- export default function CardFooter({ funcss, children, ...rest }: CardFooterProps): any;
6
+ export default function CardFooter({ funcss, children, ...rest }: CardFooterProps): React.JSX.Element;
7
7
  export {};
@@ -1,7 +1,7 @@
1
- import { ReactNode, HTMLProps } from 'react';
1
+ import React, { ReactNode, HTMLProps } from 'react';
2
2
  interface CardHeaderProps extends HTMLProps<HTMLDivElement> {
3
3
  funcss?: string;
4
4
  children?: ReactNode;
5
5
  }
6
- export default function CardHeader({ funcss, children, ...rest }: CardHeaderProps): any;
6
+ export default function CardHeader({ funcss, children, ...rest }: CardHeaderProps): React.JSX.Element;
7
7
  export {};
package/ui/div/Div.d.ts CHANGED
@@ -15,5 +15,5 @@ type DivProps = {
15
15
  customStyle?: React.CSSProperties;
16
16
  onClick?: React.MouseEventHandler<HTMLDivElement>;
17
17
  };
18
- declare const Div: ({ children, funcss, content, minHeight, maxHeight, maxWidth, minWidth, height, width, padding, margin, fit, customStyle, ...rest }: DivProps) => any;
18
+ declare const Div: ({ children, funcss, content, minHeight, maxHeight, maxWidth, minWidth, height, width, padding, margin, fit, customStyle, ...rest }: DivProps) => React.JSX.Element;
19
19
  export default Div;
@@ -3,5 +3,5 @@ type DropActionProps = {
3
3
  children: React.ReactNode;
4
4
  funcss?: string;
5
5
  };
6
- declare const DropAction: ({ children, funcss }: DropActionProps) => any;
6
+ declare const DropAction: ({ children, funcss }: DropActionProps) => React.JSX.Element;
7
7
  export default DropAction;
package/ui/drop/Down.d.ts CHANGED
@@ -5,5 +5,5 @@ type DropDownProps = {
5
5
  id?: string;
6
6
  side?: string;
7
7
  };
8
- declare const DropDown: ({ funcss, children, id, side, }: DropDownProps) => any;
8
+ declare const DropDown: ({ funcss, children, id, side, }: DropDownProps) => React.JSX.Element;
9
9
  export default DropDown;
package/ui/drop/Item.d.ts CHANGED
@@ -4,5 +4,5 @@ type DropItemProps = {
4
4
  funcss?: string;
5
5
  onClick?: () => void;
6
6
  };
7
- export default function DropItem({ children, funcss, onClick }: DropItemProps): any;
7
+ export default function DropItem({ children, funcss, onClick }: DropItemProps): React.JSX.Element;
8
8
  export {};
package/ui/drop/Menu.d.ts CHANGED
@@ -8,5 +8,5 @@ type DropMenuProps = {
8
8
  id?: string;
9
9
  width?: string;
10
10
  };
11
- export default function DropMenu({ children, funcss, hoverable, duration, animation, id, width, }: DropMenuProps): any;
11
+ export default function DropMenu({ children, funcss, hoverable, duration, animation, id, width, }: DropMenuProps): React.JSX.Element;
12
12
  export {};
package/ui/drop/Up.d.ts CHANGED
@@ -5,5 +5,5 @@ type DropUpProps = {
5
5
  id?: string;
6
6
  side?: string;
7
7
  };
8
- declare const DropUp: ({ funcss, children, id, side, }: DropUpProps) => any;
8
+ declare const DropUp: ({ funcss, children, id, side, }: DropUpProps) => React.JSX.Element;
9
9
  export default DropUp;
package/ui/grid/Col.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ReactNode, HTMLProps } from 'react';
2
+ import * as React from 'react';
2
3
  interface ColProps extends HTMLProps<HTMLDivElement> {
3
4
  sm?: number;
4
5
  md?: number;
@@ -10,5 +11,5 @@ interface ColProps extends HTMLProps<HTMLDivElement> {
10
11
  mdOrder?: number;
11
12
  lgOrder?: number;
12
13
  }
13
- export default function Col({ sm, md, lg, children, funcss, id, smOrder, mdOrder, lgOrder, ...rest }: ColProps): any;
14
+ export default function Col({ sm, md, lg, children, funcss, id, smOrder, mdOrder, lgOrder, ...rest }: ColProps): React.JSX.Element;
14
15
  export {};
package/ui/grid/Grid.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ReactNode, CSSProperties, HTMLProps } from 'react';
2
+ import * as React from 'react';
2
3
  interface GridProps extends HTMLProps<HTMLDivElement> {
3
4
  children?: ReactNode;
4
5
  funcss?: string;
@@ -8,5 +9,5 @@ interface GridProps extends HTMLProps<HTMLDivElement> {
8
9
  id?: string;
9
10
  direction?: CSSProperties['flexDirection'];
10
11
  }
11
- export default function Grid({ children, funcss, justify, align, id, direction, ...rest }: GridProps): any;
12
+ export default function Grid({ children, funcss, justify, align, id, direction, ...rest }: GridProps): React.JSX.Element;
12
13
  export {};
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  interface IconicInputProps {
3
3
  funcss?: string;
4
4
  children?: ReactNode;
@@ -7,5 +7,5 @@ interface IconicInputProps {
7
7
  leftIcon?: ReactNode;
8
8
  rightIcon?: ReactNode;
9
9
  }
10
- export default function IconicInput({ funcss, children, leftIcon, rightIcon, input, iconicBg, }: IconicInputProps): any;
10
+ export default function IconicInput({ funcss, children, leftIcon, rightIcon, input, iconicBg, }: IconicInputProps): React.JSX.Element;
11
11
  export {};
@@ -7,6 +7,7 @@ interface InputProps {
7
7
  file?: boolean;
8
8
  noBorder?: boolean;
9
9
  icon?: React.ReactNode;
10
+ extra?: React.ReactNode;
10
11
  button?: React.ReactNode;
11
12
  id?: string;
12
13
  status?: 'success' | 'warning' | 'danger' | '';
@@ -16,6 +17,7 @@ interface InputProps {
16
17
  rightRounded?: boolean;
17
18
  rounded?: boolean;
18
19
  fullWidth?: boolean;
20
+ btn?: boolean;
19
21
  type?: string;
20
22
  label?: string;
21
23
  name?: string;
package/ui/input/Input.js CHANGED
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  var __assign = (this && this.__assign) || function () {
3
4
  __assign = Object.assign || function(t) {
@@ -10,6 +11,29 @@ var __assign = (this && this.__assign) || function () {
10
11
  };
11
12
  return __assign.apply(this, arguments);
12
13
  };
14
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ var desc = Object.getOwnPropertyDescriptor(m, k);
17
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
+ desc = { enumerable: true, get: function() { return m[k]; } };
19
+ }
20
+ Object.defineProperty(o, k2, desc);
21
+ }) : (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ o[k2] = m[k];
24
+ }));
25
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
27
+ }) : function(o, v) {
28
+ o["default"] = v;
29
+ });
30
+ var __importStar = (this && this.__importStar) || function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
13
37
  var __rest = (this && this.__rest) || function (s, e) {
14
38
  var t = {};
15
39
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -25,11 +49,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25
49
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
50
  };
27
51
  Object.defineProperty(exports, "__esModule", { value: true });
28
- var react_1 = __importDefault(require("react"));
52
+ var react_1 = __importStar(require("react"));
29
53
  var pi_1 = require("react-icons/pi");
30
54
  var Button_1 = __importDefault(require("../button/Button"));
31
55
  var Input = function (_a) {
32
- var select = _a.select, bordered = _a.bordered, borderless = _a.borderless, multiline = _a.multiline, file = _a.file, noBorder = _a.noBorder, icon = _a.icon, button = _a.button, id = _a.id, status = _a.status, funcss = _a.funcss, flat = _a.flat, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, rounded = _a.rounded, fullWidth = _a.fullWidth, type = _a.type, label = _a.label, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, options = _a.options, rows = _a.rows, bg = _a.bg, rest = __rest(_a, ["select", "bordered", "borderless", "multiline", "file", "noBorder", "icon", "button", "id", "status", "funcss", "flat", "leftRounded", "rightRounded", "rounded", "fullWidth", "type", "label", "name", "value", "defaultValue", "onChange", "options", "rows", "bg"]);
56
+ var select = _a.select, bordered = _a.bordered, borderless = _a.borderless, multiline = _a.multiline, file = _a.file, extra = _a.extra, noBorder = _a.noBorder, icon = _a.icon, btn = _a.btn, button = _a.button, id = _a.id, status = _a.status, funcss = _a.funcss, flat = _a.flat, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, rounded = _a.rounded, fullWidth = _a.fullWidth, type = _a.type, label = _a.label, name = _a.name, value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, options = _a.options, rows = _a.rows, bg = _a.bg, rest = __rest(_a, ["select", "bordered", "borderless", "multiline", "file", "extra", "noBorder", "icon", "btn", "button", "id", "status", "funcss", "flat", "leftRounded", "rightRounded", "rounded", "fullWidth", "type", "label", "name", "value", "defaultValue", "onChange", "options", "rows", "bg"]);
57
+ var _b = (0, react_1.useState)(''), fileName = _b[0], setFileName = _b[1];
58
+ var handleChange = function (e) {
59
+ var _a;
60
+ var file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
61
+ if (file) {
62
+ setFileName(file.name);
63
+ }
64
+ if (onChange)
65
+ onChange(e);
66
+ };
33
67
  if (select) {
34
68
  if (bordered) {
35
69
  return (react_1.default.createElement("select", __assign({}, rest, { id: id, className: "\n ".concat(status === 'success' ? 'success-input' : '', "\n ").concat(status === 'warning' ? 'warning-input' : '', "\n ").concat(status === 'danger' ? 'danger-input' : '', "\n input \n ").concat(rounded ? "rounded" : '', "\n ").concat(bg ? bg : '', "\n ").concat(funcss, " ").concat(flat ? 'flat' : '', "\n ").concat(leftRounded ? 'leftRounded' : rightRounded ? 'rightRounded' : '', "\n borderedInput\n "), onChange: onChange, defaultValue: defaultValue, name: name, style: {
@@ -39,14 +73,14 @@ var Input = function (_a) {
39
73
  : ''));
40
74
  }
41
75
  else if (borderless) {
42
- return (react_1.default.createElement("select", __assign({}, rest, { id: id, className: "\n ".concat(status === 'success' ? 'success-input' : '', "\n ").concat(status === 'warning' ? 'warning-input' : '', "\n ").concat(status === 'danger' ? 'danger-input' : '', "\n input \n ").concat(rounded ? "rounded" : '', "\n ").concat(bg ? bg : '', "\n ").concat(funcss, " ").concat(flat ? 'flat' : '', "\n ").concat(leftRounded ? 'leftRounded' : rightRounded ? 'rightRounded' : '', "\n borderless\n "), onChange: onChange, defaultValue: defaultValue, placeholder: label, name: name, value: value, style: {
76
+ return (react_1.default.createElement("select", __assign({}, rest, { id: id, className: "\n ".concat(status === 'success' ? 'success-input' : '', "\n ").concat(status === 'warning' ? 'warning-input' : '', "\n ").concat(status === 'danger' ? 'danger-input' : '', "\n input \n ").concat(rounded ? "rounded" : '', "\n ").concat(bg ? bg : '', "\n ").concat(funcss, " ").concat(flat ? 'flat' : '', "\n ").concat(leftRounded ? 'leftRounded' : rightRounded ? 'rightRounded' : '', "\n borderless\n "), onChange: onChange, defaultValue: defaultValue, name: name, value: value, style: {
43
77
  width: "".concat(fullWidth ? '100%' : '')
44
78
  } }), options
45
79
  ? options.map(function (doc) { return (react_1.default.createElement("option", { value: doc.value, key: doc.value }, doc.text)); })
46
80
  : ''));
47
81
  }
48
82
  else {
49
- return (react_1.default.createElement("select", __assign({}, rest, { id: id, className: "\n ".concat(status === 'success' ? 'success-input' : '', "\n ").concat(status === 'warning' ? 'warning-input' : '', "\n ").concat(status === 'danger' ? 'danger-input' : '', "\n input \n ").concat(rounded ? "rounded" : '', "\n ").concat(bg ? bg : '', "\n ").concat(funcss, " ").concat(flat ? 'flat' : '', "\n ").concat(leftRounded ? 'leftRounded' : rightRounded ? 'rightRounded' : '', "\n "), onChange: onChange, defaultValue: defaultValue, placeholder: label, name: name, value: value, style: {
83
+ return (react_1.default.createElement("select", __assign({}, rest, { id: id, className: "\n ".concat(status === 'success' ? 'success-input' : '', "\n ").concat(status === 'warning' ? 'warning-input' : '', "\n ").concat(status === 'danger' ? 'danger-input' : '', "\n input \n ").concat(rounded ? "rounded" : '', "\n ").concat(bg ? bg : '', "\n ").concat(funcss, " ").concat(flat ? 'flat' : '', "\n ").concat(leftRounded ? 'leftRounded' : rightRounded ? 'rightRounded' : '', "\n "), onChange: onChange, defaultValue: defaultValue, name: name, value: value, style: {
50
84
  width: "".concat(fullWidth ? '100%' : '')
51
85
  } }), options
52
86
  ? options.map(function (doc) { return (react_1.default.createElement("option", { value: doc.value, key: doc.value }, doc.text)); })
@@ -71,11 +105,18 @@ var Input = function (_a) {
71
105
  }
72
106
  }
73
107
  else if (file) {
74
- return (react_1.default.createElement("div", { className: "fileInput" },
75
- button ? (button) : (react_1.default.createElement(Button_1.default, { funcss: " ".concat(funcss, " "), startIcon: icon ? icon : react_1.default.createElement(pi_1.PiCloudArrowUp, null), bg: "primary", fullWidth: true, raised: true }, label ? label : 'Upload File')),
76
- react_1.default.createElement("input", __assign({ name: name, id: id, className: "\n ".concat(status === 'success' ? 'success-input' : '', "\n ").concat(status === 'warning' ? 'warning-input' : '', "\n ").concat(status === 'danger' ? 'danger-input' : '', "\n input \n ").concat(rounded ? "rounded" : '', "\n ").concat(bg ? bg : '', "\n ").concat(funcss, " ").concat(flat ? 'flat' : '', "\n ").concat(leftRounded ? 'leftRounded' : rightRounded ? 'rightRounded' : '', "\n borderedInput\n filedInput\n "), onChange: onChange, type: 'file', style: {
77
- width: "".concat(fullWidth ? '100%' : '')
78
- }, value: value }, rest))));
108
+ if (btn)
109
+ return (react_1.default.createElement("div", { className: "fileInput" },
110
+ button ? (button) : (react_1.default.createElement(Button_1.default, { funcss: " ".concat(funcss, " "), startIcon: icon ? icon : react_1.default.createElement(pi_1.PiCloudArrowUp, null), bg: "primary", fullWidth: true, raised: true }, fileName || label || 'Upload File')),
111
+ react_1.default.createElement("input", __assign({ name: name, id: id, className: "\n ".concat(status === 'success' ? 'success-input' : '', "\n ").concat(status === 'warning' ? 'warning-input' : '', "\n ").concat(status === 'danger' ? 'danger-input' : '', "\n input \n ").concat(rounded ? "rounded" : '', "\n ").concat(bg ? bg : '', "\n ").concat(funcss, " ").concat(flat ? 'flat' : '', "\n ").concat(leftRounded ? 'leftRounded' : rightRounded ? 'rightRounded' : '', "\n borderedInput\n filedInput\n "), onChange: handleChange, type: 'file', style: {
112
+ width: "".concat(fullWidth ? '100%' : '')
113
+ }, value: value }, rest))));
114
+ return (react_1.default.createElement("div", { className: "_upload_container" },
115
+ react_1.default.createElement("label", { htmlFor: id || "fileInput", className: "_upload_label" },
116
+ react_1.default.createElement("div", { className: "_upload_icon" }, icon || react_1.default.createElement(react_1.default.Fragment, null, "\u21EA")),
117
+ react_1.default.createElement("div", { className: "_upload_text" }, fileName || label || "Upload File"),
118
+ react_1.default.createElement("div", { className: "text-small opacity-3" }, extra || '')),
119
+ react_1.default.createElement("input", __assign({ onChange: handleChange, type: "file", id: id || "fileInput", className: "_upload_input" }, rest))));
79
120
  }
80
121
  else {
81
122
  if (bordered) {
@@ -1,4 +1,5 @@
1
- import React from 'react';
1
+ 'use client'
2
+ import React, { useState } from 'react';
2
3
  import { PiCheck, PiCloudArrowUp } from 'react-icons/pi';
3
4
  import Button from '../button/Button';
4
5
 
@@ -10,6 +11,7 @@ interface InputProps {
10
11
  file?: boolean;
11
12
  noBorder?: boolean;
12
13
  icon?: React.ReactNode;
14
+ extra?: React.ReactNode;
13
15
  button?: React.ReactNode;
14
16
  id?: string;
15
17
  status?: 'success' | 'warning' | 'danger' | '';
@@ -19,6 +21,7 @@ interface InputProps {
19
21
  rightRounded?: boolean;
20
22
  rounded?: boolean;
21
23
  fullWidth?: boolean;
24
+ btn?: boolean;
22
25
  type?: string;
23
26
  label?: string;
24
27
  name?: string;
@@ -32,14 +35,17 @@ interface InputProps {
32
35
  bg?: string;
33
36
  }
34
37
 
38
+
35
39
  const Input: React.FC<InputProps> = ({
36
40
  select,
37
41
  bordered,
38
42
  borderless,
39
43
  multiline,
40
44
  file,
45
+ extra,
41
46
  noBorder,
42
47
  icon,
48
+ btn,
43
49
  button,
44
50
  id,
45
51
  status,
@@ -60,6 +66,17 @@ const Input: React.FC<InputProps> = ({
60
66
  bg,
61
67
  ...rest
62
68
  }) => {
69
+ const [fileName, setFileName] = useState('');
70
+
71
+ const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
72
+ const file = e.target.files?.[0];
73
+ if (file) {
74
+ setFileName(file.name);
75
+ }
76
+ if (onChange) onChange(e);
77
+ };
78
+
79
+
63
80
  if (select) {
64
81
  if (bordered) {
65
82
  return (
@@ -112,7 +129,6 @@ const Input: React.FC<InputProps> = ({
112
129
  `}
113
130
  onChange={onChange}
114
131
  defaultValue={defaultValue}
115
- placeholder={label}
116
132
  name={name}
117
133
  value={value}
118
134
  style={{
@@ -145,7 +161,6 @@ const Input: React.FC<InputProps> = ({
145
161
  `}
146
162
  onChange={onChange}
147
163
  defaultValue={defaultValue}
148
- placeholder={label}
149
164
  name={name}
150
165
  value={value}
151
166
  style={{
@@ -245,7 +260,8 @@ const Input: React.FC<InputProps> = ({
245
260
  );
246
261
  }
247
262
  } else if (file) {
248
- return (
263
+ if(btn)
264
+ return (
249
265
  <div className="fileInput">
250
266
  {button ? (
251
267
  button
@@ -257,7 +273,7 @@ const Input: React.FC<InputProps> = ({
257
273
  fullWidth
258
274
  raised
259
275
  >
260
- {label ? label : 'Upload File'}
276
+ {fileName || label || 'Upload File'}
261
277
  </Button>
262
278
  )}
263
279
  <input
@@ -275,16 +291,27 @@ const Input: React.FC<InputProps> = ({
275
291
  borderedInput
276
292
  filedInput
277
293
  `}
278
- onChange={onChange}
294
+ onChange={handleChange}
279
295
  type={'file'}
280
296
  style={{
281
297
  width: `${fullWidth ? '100%' : ''}`
282
298
  }}
299
+
283
300
  value={value}
284
301
  {...rest}
285
302
  />
286
303
  </div>
287
- );
304
+ )
305
+ return (
306
+ <div className="_upload_container">
307
+ <label htmlFor={id || "fileInput"} className="_upload_label">
308
+ <div className="_upload_icon">{ icon || <>&#8682;</>}</div>
309
+ <div className="_upload_text">{fileName || label || `Upload File`}</div>
310
+ <div className="text-small opacity-3">{extra || ''}</div>
311
+ </label>
312
+ <input onChange={handleChange} type="file" id={id || "fileInput"} className="_upload_input" {...rest} />
313
+ </div>
314
+ )
288
315
  } else {
289
316
  if (bordered) {
290
317
  return (
package/ui/list/Item.d.ts CHANGED
@@ -3,5 +3,5 @@ interface ListItemProps {
3
3
  children?: React.ReactNode;
4
4
  funcss?: string;
5
5
  }
6
- export default function ListItem({ children, funcss, ...rest }: ListItemProps): any;
6
+ export default function ListItem({ children, funcss, ...rest }: ListItemProps): React.JSX.Element;
7
7
  export {};