@majapisoftwares/ui 4.1.17 → 4.2.0

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 (160) hide show
  1. package/bootstrap/AppProps.d.ts +4 -5
  2. package/components/Accordion/Accordion.d.ts +1 -1
  3. package/components/Alert/Alert.d.ts +1 -1
  4. package/components/Alert/Alert.jsx +19 -19
  5. package/components/Autocomplete/Autocomplete.d.ts +1 -1
  6. package/components/Autocomplete/Autocomplete.jsx +3 -3
  7. package/components/Autocomplete/UnstyledAutocomplete.d.ts +2 -2
  8. package/components/Autocomplete/UnstyledAutocomplete.jsx +23 -24
  9. package/components/Badge/Badge.d.ts +1 -1
  10. package/components/Badge/Badge.jsx +9 -9
  11. package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  12. package/components/Button/Button.d.ts +2 -2
  13. package/components/Button/Button.jsx +5 -5
  14. package/components/Carousel/Carousel.d.ts +2 -2
  15. package/components/Carousel/Carousel.jsx +13 -13
  16. package/components/Checkbox/Checkbox.d.ts +1 -1
  17. package/components/Checkbox/Checkbox.jsx +12 -12
  18. package/components/Code/Code.d.ts +1 -1
  19. package/components/Code/Code.jsx +15 -15
  20. package/components/ConfirmationButton/ConfirmationButton.d.ts +3 -3
  21. package/components/ConfirmationButton/ConfirmationButton.jsx +10 -10
  22. package/components/ContextMenu/ContextMenu.d.ts +1 -1
  23. package/components/ContextMenu/ContextMenu.jsx +22 -22
  24. package/components/DateInput/DateInput.d.ts +1 -1
  25. package/components/DateInput/DateInput.jsx +1 -1
  26. package/components/DateInput/DateTimeInput.d.ts +1 -1
  27. package/components/DateInput/DateTimeInput.jsx +1 -1
  28. package/components/DateInput/useRefValue.d.ts +1 -1
  29. package/components/DatePicker/DatePicker.d.ts +3 -3
  30. package/components/DatePicker/DatePicker.jsx +8 -8
  31. package/components/DateRangePicker/DateRangePicker.d.ts +2 -2
  32. package/components/DateRangePicker/DateRangePicker.jsx +8 -8
  33. package/components/Dialog/Dialog.d.ts +2 -2
  34. package/components/Dialog/Dialog.jsx +23 -23
  35. package/components/Dialog/Dialogs.jsx +4 -4
  36. package/components/Dialog/dialogs.state.d.ts +2 -2
  37. package/components/Drawer/Drawer.d.ts +1 -1
  38. package/components/Drawer/Drawer.jsx +41 -41
  39. package/components/DropdownMenu/DropdownMenu.d.ts +1 -1
  40. package/components/DropdownMenu/DropdownMenu.jsx +23 -23
  41. package/components/ErrorBoundary/ErrorBoundary.d.ts +1 -1
  42. package/components/ErrorBoundary/ErrorBoundary.jsx +4 -4
  43. package/components/ErrorPage/ErrorPage.d.ts +1 -1
  44. package/components/ErrorPage/ErrorPage.jsx +16 -16
  45. package/components/FileInput/FileInput.d.ts +4 -4
  46. package/components/FileInput/FileInput.jsx +2 -2
  47. package/components/FileInput/PreviewFile.d.ts +2 -2
  48. package/components/FileSelect/FileSelect.d.ts +1 -1
  49. package/components/Footer/Footer.d.ts +1 -1
  50. package/components/Footer/Footer.jsx +22 -22
  51. package/components/GridPattern/GridPattern.d.ts +1 -1
  52. package/components/GridPattern/GridPattern.jsx +7 -7
  53. package/components/Header/Header.d.ts +1 -1
  54. package/components/Header/Header.jsx +2 -2
  55. package/components/ImageInput/ImageInput.d.ts +1 -1
  56. package/components/Input/Input.d.ts +1 -1
  57. package/components/Input/Input.jsx +7 -7
  58. package/components/Input/InputIcon.d.ts +1 -1
  59. package/components/Input/MultiSelectInput.d.ts +2 -2
  60. package/components/Input/MultiSelectInput.jsx +15 -15
  61. package/components/Input/NumericInput.d.ts +3 -3
  62. package/components/Input/NumericInput.jsx +1 -1
  63. package/components/Input/PatternInput.d.ts +3 -3
  64. package/components/Input/PatternInput.jsx +1 -1
  65. package/components/Input/UnstyledInput.d.ts +1 -1
  66. package/components/Input/UnstyledInput.jsx +12 -12
  67. package/components/Input2/InputWrapper.d.ts +1 -1
  68. package/components/Input2/InputWrapper.jsx +7 -7
  69. package/components/Link/Link.d.ts +1 -1
  70. package/components/Magnet/Magnet.d.ts +1 -1
  71. package/components/Markdown/Markdown.d.ts +1 -1
  72. package/components/Markdown/Markdown.jsx +1 -1
  73. package/components/Menu/Menu.d.ts +3 -3
  74. package/components/Menu/Menu.jsx +19 -19
  75. package/components/Modal/Modal.d.ts +1 -1
  76. package/components/Modal/Modal.jsx +26 -26
  77. package/components/ModeToggle/ModeToggle.d.ts +1 -1
  78. package/components/ModeToggle/ModeToggle.jsx +3 -3
  79. package/components/MultiSelect/MultiSelect.d.ts +2 -2
  80. package/components/MultiSelect/MultiSelect.jsx +2 -2
  81. package/components/MultiSelect/MultiSelectInput.d.ts +1 -1
  82. package/components/MultiText/MultiText.d.ts +1 -1
  83. package/components/MultiText/MultiText.jsx +0 -1
  84. package/components/NavigationDrawer/NavigationDrawer.d.ts +1 -1
  85. package/components/NavigationDrawer/NavigationDrawer.jsx +11 -11
  86. package/components/NavigationDrawer/NavigationItem.d.ts +1 -1
  87. package/components/NavigationDrawer/NavigationItem.jsx +2 -2
  88. package/components/NoSsr/NoSsr.d.ts +1 -1
  89. package/components/Notifications/Notifications.jsx +29 -29
  90. package/components/Notifications/notifications.state.d.ts +2 -2
  91. package/components/Notifications/notifications.state.js +1 -1
  92. package/components/Pagination/Pagination.jsx +15 -15
  93. package/components/Particles/Particles.jsx +55 -55
  94. package/components/PictureCropInput/PictureCropInput.d.ts +2 -2
  95. package/components/PictureCropInput/PictureCropInput.jsx +39 -39
  96. package/components/PictureCropInput/canvasPreview.d.ts +1 -1
  97. package/components/Popover/Popover.d.ts +1 -1
  98. package/components/Popover/Popover.jsx +6 -6
  99. package/components/Resizable/Resizable.d.ts +1 -1
  100. package/components/Resizable/Resizable.jsx +4 -4
  101. package/components/ScrollArea/ScrollArea.d.ts +1 -1
  102. package/components/ScrollArea/ScrollArea.jsx +11 -11
  103. package/components/Select/Select.d.ts +1 -1
  104. package/components/Select/Select.jsx +21 -21
  105. package/components/Skeleton/Skeleton.d.ts +1 -1
  106. package/components/StarBorder/StarBorder.d.ts +1 -2
  107. package/components/StarBorder/StarBorder.jsx +1 -1
  108. package/components/Switch/Switch.d.ts +2 -2
  109. package/components/Switch/Switch.jsx +9 -9
  110. package/components/Table/DataTable.d.ts +1 -1
  111. package/components/Table/DataTable.jsx +54 -54
  112. package/components/Table/Table.d.ts +1 -1
  113. package/components/Table/Table.jsx +7 -7
  114. package/components/Table/TableActionButton.d.ts +2 -2
  115. package/components/Table/TableActionButton.jsx +3 -3
  116. package/components/Table/TableBody.d.ts +1 -1
  117. package/components/Table/TableBody.jsx +4 -4
  118. package/components/Table/TableCell.d.ts +1 -1
  119. package/components/Table/TableCell.jsx +4 -4
  120. package/components/Table/TableFooter.d.ts +1 -1
  121. package/components/Table/TableFooter.jsx +2 -2
  122. package/components/Table/TableHead.d.ts +1 -1
  123. package/components/Table/TableHead.jsx +4 -4
  124. package/components/Table/TableHeader.d.ts +1 -1
  125. package/components/Table/TableHeader.jsx +10 -10
  126. package/components/Table/TableRow.d.ts +1 -1
  127. package/components/Table/TableRow.jsx +2 -2
  128. package/components/Tabs/Tabs.d.ts +2 -2
  129. package/components/Tabs/Tabs.jsx +6 -6
  130. package/components/TabsSwitcher/Tab.d.ts +1 -1
  131. package/components/TabsSwitcher/TabsSwitcher.d.ts +1 -1
  132. package/components/Text/Text.d.ts +1 -1
  133. package/components/Text/Text.jsx +1 -0
  134. package/components/Textarea/Textarea.d.ts +2 -2
  135. package/components/Textarea/Textarea.jsx +1 -1
  136. package/components/Tooltip/Tooltip.d.ts +1 -1
  137. package/components/Tooltip/Tooltip.jsx +12 -12
  138. package/components/VisibilityActivatedButton/VisibilityActivatedButton.d.ts +1 -1
  139. package/form.d.ts +4 -4
  140. package/form2.d.ts +1 -1
  141. package/form2.jsx +1 -0
  142. package/hooks/useDebounceEffect.d.ts +1 -1
  143. package/hooks/useDebouncedValue.d.ts +1 -1
  144. package/hooks/useDebouncedValue.js +1 -1
  145. package/hooks/useLagRadar.jsx +19 -19
  146. package/package.json +1 -2
  147. package/tsconfig.tsbuildinfo +1 -1
  148. package/types.d.ts +1 -1
  149. package/types.js +1 -1
  150. package/utils/UseState.d.ts +2 -3
  151. package/utils/csvBlobToJson.d.ts +1 -1
  152. package/utils/csvBlobToJson.js +0 -1
  153. package/utils/ms.d.ts +1 -1
  154. package/utils/ms.js +6 -6
  155. package/utils/recursiveChildrenMap.d.ts +1 -1
  156. package/utils/smoothScrollToHref.d.ts +1 -1
  157. package/utils/smoothScrollToHref.js +7 -3
  158. package/utils/stopPropagation.d.ts +1 -1
  159. package/utils/xlsxBlobToJson.d.ts +1 -1
  160. package/utils/xlsxBlobToJson.js +3 -0
@@ -61,49 +61,49 @@ export default function DataTable({ title, subtitle, headerContent, data, idAcce
61
61
  }, [sort]);
62
62
  return (<Stack className={clsx({
63
63
  "flex flex-1 flex-col": autoHeight,
64
- }, className)}>
65
- {(title || subtitle || headerContent) && (<Table.Header title={title} subtitle={subtitle}>
66
- {headerContent}
67
- </Table.Header>)}
68
- <Table autoHeight={autoHeight} className={tableClassName}>
69
- <Table.Head>
70
- <Table.Row>
64
+ }, className)}>
65
+ {(title || subtitle || headerContent) && (<Table.Header title={title} subtitle={subtitle}>
66
+ {headerContent}
67
+ </Table.Header>)}
68
+ <Table autoHeight={autoHeight} className={tableClassName}>
69
+ <Table.Head>
70
+ <Table.Row>
71
71
  {columns.map((column, i) => {
72
72
  const id = column.id ||
73
73
  (typeof column.title === "string"
74
74
  ? column.title
75
75
  : i.toString());
76
76
  const columnSort = getColumnSort(id);
77
- return (<Table.Cell key={id} className={column.headerClassName}>
78
- {column.sortable ? (<span className="group inline-flex cursor-pointer" onClick={handleColumnClick(id)}>
79
- {column.title}
77
+ return (<Table.Cell key={id} className={column.headerClassName}>
78
+ {column.sortable ? (<span className="group inline-flex cursor-pointer" onClick={handleColumnClick(id)}>
79
+ {column.title}
80
80
  <span className={clsx("mb-auto ml-2 flex-none rounded-sm text-zinc-400", {
81
81
  "bg-zinc-200 text-zinc-900 group-hover:bg-zinc-300": columnSort?.[1],
82
82
  "invisible group-hover:visible group-focus:visible": !columnSort?.[1],
83
- })}>
83
+ })}>
84
84
  <ChevronUpIcon className={clsx("h-5 w-5", {
85
85
  "scale-y-flip": columnSort?.[1] === "desc",
86
- })} aria-hidden="true"/>
87
- </span>
88
- </span>) : (column.title)}
86
+ })} aria-hidden="true"/>
87
+ </span>
88
+ </span>) : (column.title)}
89
89
  </Table.Cell>);
90
- })}
91
- {actions && <Table.Cell />}
92
- </Table.Row>
93
- {isLoading && (<tr className="absolute right-3 top-2 rounded-full bg-zinc-50/50 dark:bg-zinc-900/50">
94
- <td>
95
- <Loading className="mt-px"/>
96
- </td>
97
- </tr>)}
98
- </Table.Head>
99
- <Table.Body>
90
+ })}
91
+ {actions && <Table.Cell />}
92
+ </Table.Row>
93
+ {isLoading && (<tr className="absolute top-2 right-3 rounded-full bg-zinc-50/50 dark:bg-zinc-900/50">
94
+ <td>
95
+ <Loading className="mt-px"/>
96
+ </td>
97
+ </tr>)}
98
+ </Table.Head>
99
+ <Table.Body>
100
100
  {data?.map((item) => {
101
101
  const RowComponent = rowWrapper || Fragment;
102
102
  return (<RowComponent key={item[idAccessor]} {...(RowComponent !== Fragment
103
103
  ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
104
104
  { item: item }
105
- : {})}>
106
- <Table.Row onClick={handleRowClick(item)}>
105
+ : {})}>
106
+ <Table.Row onClick={handleRowClick(item)}>
107
107
  {columns.map((column, i) => {
108
108
  const value = column.accessor
109
109
  ? item[column.accessor]
@@ -112,44 +112,44 @@ export default function DataTable({ title, subtitle, headerContent, data, idAcce
112
112
  (typeof column.title === "string" ? column.title : i)} className={column.cellClassName} title={column.cellClassName?.includes("max-w") &&
113
113
  typeof value === "string"
114
114
  ? value
115
- : undefined}>
116
- {value}
115
+ : undefined}>
116
+ {value}
117
117
  </Table.Cell>);
118
- })}
119
- {actions && (<Table.Cell actions>
118
+ })}
119
+ {actions && (<Table.Cell actions>
120
120
  {actions.map((action, i) => {
121
121
  const ActionComponent = action.wrapper || Fragment;
122
122
  return (<ActionComponent key={i} {...(ActionComponent !== Fragment
123
123
  ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
124
124
  { item: item }
125
- : {})}>
125
+ : {})}>
126
126
  <Table.ActionButton title={action.title} onClick={() => action.onClick?.(item)} href={typeof action.href === "function"
127
127
  ? action.href?.(item)
128
- : action.href} target={action.target}>
129
- {action.icon}
130
- </Table.ActionButton>
128
+ : action.href} target={action.target}>
129
+ {action.icon}
130
+ </Table.ActionButton>
131
131
  </ActionComponent>);
132
- })}
133
- </Table.Cell>)}
134
- </Table.Row>
132
+ })}
133
+ </Table.Cell>)}
134
+ </Table.Row>
135
135
  </RowComponent>);
136
- })}
137
- {isLoading && !data?.length && (<Table.Row>
136
+ })}
137
+ {isLoading && !data?.length && (<Table.Row>
138
138
  {columns.map((column, i) => (<Table.Cell key={column.id ||
139
- (typeof column.title === "string" ? column.title : i)}>
140
- <Skeleton className="h-3"/>
141
- </Table.Cell>))}
142
- {actions && (<Table.Cell actions>
143
- <Skeleton className="inline-block h-3 w-6"/>
144
- </Table.Cell>)}
145
- </Table.Row>)}
146
- {!isLoading && !data?.length && (<Table.Row>
147
- <Table.Cell colSpan={columns.length + (actions ? 1 : 0)}>
148
- <Text variant="secondary">{noRecordsText}</Text>
149
- </Table.Cell>
150
- </Table.Row>)}
151
- </Table.Body>
152
- </Table>
153
- {pagination ? (<Table.FooterWithPagination totalItems={totalItems} itemsPerPage={itemsPerPage} currentPage={currentPage} onChangePage={onChangePage} previousText={previousText} nextText={nextText} showingText={showingText} toText={toText} ofText={ofText} resultsText={resultsText}/>) : undefined}
139
+ (typeof column.title === "string" ? column.title : i)}>
140
+ <Skeleton className="h-3"/>
141
+ </Table.Cell>))}
142
+ {actions && (<Table.Cell actions>
143
+ <Skeleton className="inline-block h-3 w-6"/>
144
+ </Table.Cell>)}
145
+ </Table.Row>)}
146
+ {!isLoading && !data?.length && (<Table.Row>
147
+ <Table.Cell colSpan={columns.length + (actions ? 1 : 0)}>
148
+ <Text variant="secondary">{noRecordsText}</Text>
149
+ </Table.Cell>
150
+ </Table.Row>)}
151
+ </Table.Body>
152
+ </Table>
153
+ {pagination ? (<Table.FooterWithPagination totalItems={totalItems} itemsPerPage={itemsPerPage} currentPage={currentPage} onChangePage={onChangePage} previousText={previousText} nextText={nextText} showingText={showingText} toText={toText} ofText={ofText} resultsText={resultsText}/>) : undefined}
154
154
  </Stack>);
155
155
  }
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import type { ReactNode } from "react";
2
2
  import TableActionButton from "./TableActionButton";
3
3
  import TableBody from "./TableBody";
4
4
  import TableCell from "./TableCell";
@@ -10,15 +10,15 @@ import TableFooterWithPagination from "./TableFooterWithPagination";
10
10
  export default function Table({ children, className, hideBorder, autoHeight, }) {
11
11
  return (<div className={clsx("overflow-hidden bg-white dark:bg-zinc-800", {
12
12
  "relative flex-1": autoHeight,
13
- "shadow-sm ring-1 ring-black/5 dark:ring-white/10 md:rounded-lg": !hideBorder,
14
- }, className)}>
13
+ "shadow-sm ring-1 ring-black/5 md:rounded-lg dark:ring-white/10": !hideBorder,
14
+ }, className)}>
15
15
  <div className={clsx("overflow-auto", {
16
16
  "absolute inset-0": autoHeight,
17
- })}>
18
- <table className={clsx("w-full max-w-full divide-y divide-zinc-300 dark:divide-zinc-600")}>
19
- {children}
20
- </table>
21
- </div>
17
+ })}>
18
+ <table className={clsx("w-full max-w-full divide-y divide-zinc-300 dark:divide-zinc-600")}>
19
+ {children}
20
+ </table>
21
+ </div>
22
22
  </div>);
23
23
  }
24
24
  Table.Row = TableRow;
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
- import { ButtonProps } from "../Button/Button";
1
+ import { type ReactNode } from "react";
2
+ import { type ButtonProps } from "../Button/Button";
3
3
  export type TableActionButtonProps<T extends HTMLElement = HTMLButtonElement> = {
4
4
  title?: ReactNode;
5
5
  } & ButtonProps<T>;
@@ -1,6 +1,6 @@
1
1
  import clsx from "../../utils/clsx";
2
2
  import { cloneElement, } from "react";
3
- import Button from "../Button/Button";
3
+ import Button, {} from "../Button/Button";
4
4
  import Tooltip from "../Tooltip";
5
5
  export default function TableActionButton({ children, className, title, onClick, ...props }) {
6
6
  const handleClick = (e) => {
@@ -8,10 +8,10 @@ export default function TableActionButton({ children, className, title, onClick,
8
8
  onClick?.(e);
9
9
  };
10
10
  const child = children;
11
- const button = (<Button icon variant="text" className={clsx("p-1!", className)} onClick={handleClick} {...props}>
11
+ const button = (<Button icon variant="text" className={clsx("p-1!", className)} onClick={handleClick} {...props}>
12
12
  {cloneElement(child, {
13
13
  className: clsx("h-[20px]! w-[20px]!", child.props.className),
14
- })}
14
+ })}
15
15
  </Button>);
16
16
  if (title) {
17
17
  return <Tooltip content={title}>{button}</Tooltip>;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  export type TableBodyProps = {
3
3
  children?: ReactNode;
4
4
  className?: string;
@@ -2,9 +2,9 @@ import { useMemo } from "react";
2
2
  import TableHeadContext from "./TableHeadContext";
3
3
  import clsx from "../../utils/clsx";
4
4
  export default function TableBody({ children, className }) {
5
- return (<TableHeadContext.Provider value={useMemo(() => ({ isHead: false, sticky: false }), [])}>
6
- <tbody className={clsx("divide-y divide-zinc-200 bg-white dark:divide-zinc-700 dark:bg-zinc-800 [&_tr:last-of-type]:border-b [&_tr:last-of-type]:border-zinc-200 dark:[&_tr:last-of-type]:border-zinc-700", className)}>
7
- {children}
8
- </tbody>
5
+ return (<TableHeadContext.Provider value={useMemo(() => ({ isHead: false, sticky: false }), [])}>
6
+ <tbody className={clsx("divide-y divide-zinc-200 bg-white dark:divide-zinc-700 dark:bg-zinc-800 [&_tr:last-of-type]:border-b [&_tr:last-of-type]:border-zinc-200 dark:[&_tr:last-of-type]:border-zinc-700", className)}>
7
+ {children}
8
+ </tbody>
9
9
  </TableHeadContext.Provider>);
10
10
  }
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  export type TableCellProps = {
3
3
  children?: ReactNode;
4
4
  className?: string;
@@ -8,11 +8,11 @@ export default function TableCell({ children, className, actions, colSpan, title
8
8
  "py-0.5 text-right pr-2.5 sm:pr-5": actions,
9
9
  });
10
10
  if (isHead) {
11
- return (<th className={clsx(commonClassName, "sticky left-0 bg-zinc-50 py-2 text-left font-semibold text-zinc-900 dark:bg-zinc-900 dark:text-zinc-50", className)} colSpan={colSpan} title={title}>
12
- {children}
11
+ return (<th className={clsx(commonClassName, "sticky left-0 bg-zinc-50 py-2 text-left font-semibold text-zinc-900 dark:bg-zinc-900 dark:text-zinc-50", className)} colSpan={colSpan} title={title}>
12
+ {children}
13
13
  </th>);
14
14
  }
15
- return (<td className={clsx(commonClassName, "whitespace-nowrap text-zinc-500 dark:text-zinc-300", className)} colSpan={colSpan} title={title}>
16
- {children}
15
+ return (<td className={clsx(commonClassName, "whitespace-nowrap text-zinc-500 dark:text-zinc-300", className)} colSpan={colSpan} title={title}>
16
+ {children}
17
17
  </td>);
18
18
  }
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import type { ReactNode } from "react";
2
2
  export interface TableFooterProps {
3
3
  children?: ReactNode;
4
4
  }
@@ -1,5 +1,5 @@
1
1
  export default function TableFooter({ children }) {
2
- return (<div className="flex items-center justify-between border border-x-0 border-zinc-200 bg-white p-3 sm:border-x sm:px-5 md:rounded-lg dark:border-white/10 dark:bg-zinc-900">
3
- {children}
2
+ return (<div className="flex items-center justify-between border border-x-0 border-zinc-200 bg-white p-3 sm:border-x sm:px-5 md:rounded-lg dark:border-white/10 dark:bg-zinc-900">
3
+ {children}
4
4
  </div>);
5
5
  }
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  export type TableHeadProps = {
3
3
  children?: ReactNode;
4
4
  };
@@ -1,9 +1,9 @@
1
1
  import { useMemo } from "react";
2
2
  import TableHeadContext from "./TableHeadContext";
3
3
  export default function TableHead({ children }) {
4
- return (<TableHeadContext.Provider value={useMemo(() => ({ isHead: true }), [])}>
5
- <thead className="sticky top-0 bg-zinc-50 dark:bg-zinc-900">
6
- {children}
7
- </thead>
4
+ return (<TableHeadContext.Provider value={useMemo(() => ({ isHead: true }), [])}>
5
+ <thead className="sticky top-0 bg-zinc-50 dark:bg-zinc-900">
6
+ {children}
7
+ </thead>
8
8
  </TableHeadContext.Provider>);
9
9
  }
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import type { ReactNode } from "react";
2
2
  export type TableHeaderProps = {
3
3
  title?: ReactNode;
4
4
  subtitle?: ReactNode;
@@ -1,15 +1,15 @@
1
1
  import Text from "../Text";
2
2
  import Stack from "../Stack";
3
3
  export default function TableHeader({ title, subtitle, children, }) {
4
- return (<div className="px-4 md:px-0">
5
- <div className="sm:flex sm:items-center">
6
- {(title || subtitle) && (<Stack className="sm:flex-auto">
7
- {title && (<Text variant="label" size="lg">
8
- {title}
9
- </Text>)}
10
- {subtitle && <Text variant="secondary">{subtitle}</Text>}
11
- </Stack>)}
12
- {children && (<div className="mt-4 sm:ml-16 sm:mt-0 sm:flex-none">{children}</div>)}
13
- </div>
4
+ return (<div className="px-4 md:px-0">
5
+ <div className="sm:flex sm:items-center">
6
+ {(title || subtitle) && (<Stack className="sm:flex-auto">
7
+ {title && (<Text variant="label" size="lg">
8
+ {title}
9
+ </Text>)}
10
+ {subtitle && <Text variant="secondary">{subtitle}</Text>}
11
+ </Stack>)}
12
+ {children && (<div className="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">{children}</div>)}
13
+ </div>
14
14
  </div>);
15
15
  }
@@ -1,4 +1,4 @@
1
- import { MouseEventHandler, ReactNode } from "react";
1
+ import type { MouseEventHandler, ReactNode } from "react";
2
2
  export type TableRowProps = {
3
3
  children?: ReactNode;
4
4
  onClick?: MouseEventHandler<HTMLTableRowElement>;
@@ -2,8 +2,8 @@ import clsx from "../../utils/clsx";
2
2
  function TableRow({ children, onClick, className, ...props }) {
3
3
  return (<tr onClick={onClick} className={clsx({
4
4
  "group/row cursor-pointer hover:bg-black/5 dark:hover:bg-white/5": !!onClick,
5
- }, className)} {...props}>
6
- {children}
5
+ }, className)} {...props}>
6
+ {children}
7
7
  </tr>);
8
8
  }
9
9
  export default TableRow;
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
- import { ButtonProps } from "../Button";
1
+ import type { ReactNode } from "react";
2
+ import { type ButtonProps } from "../Button";
3
3
  export default function Tabs({ children, className, }: {
4
4
  children: ReactNode;
5
5
  className?: string;
@@ -1,13 +1,13 @@
1
1
  import clsx from "../../utils/clsx";
2
- import Button from "../Button";
2
+ import Button, {} from "../Button";
3
3
  export default function Tabs({ children, className, }) {
4
4
  return <div className={clsx("ui-tabs", className)}>{children}</div>;
5
5
  }
6
6
  export function Tab({ children, selected, onClick, className, ...props }) {
7
- return (<div className="relative">
8
- <Button className={clsx("ui-tabs-tab", className)} data-selected={selected ? "" : undefined} onClick={onClick} variant="custom" {...props}>
9
- {children}
10
- </Button>
11
- {selected && <div className="ui-tabs-indicator"/>}
7
+ return (<div className="relative">
8
+ <Button className={clsx("ui-tabs-tab", className)} data-selected={selected ? "" : undefined} onClick={onClick} variant="custom" {...props}>
9
+ {children}
10
+ </Button>
11
+ {selected && <div className="ui-tabs-indicator"/>}
12
12
  </div>);
13
13
  }
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import type { ReactNode } from "react";
2
2
  /**
3
3
  * Tab represents an individual tab. When active,
4
4
  * it renders an animated rounded background using the latest motion package.
@@ -1,4 +1,4 @@
1
- import { ReactElement } from "react";
1
+ import { type ReactElement } from "react";
2
2
  type TabElement = ReactElement<{
3
3
  value: string;
4
4
  active?: boolean;
@@ -1,4 +1,4 @@
1
- import { ComponentProps, DetailedHTMLProps, HTMLAttributes } from "react";
1
+ import type { ComponentProps, DetailedHTMLProps, HTMLAttributes } from "react";
2
2
  import NextLink from "next/link";
3
3
  export declare const defaultTextStyles: {
4
4
  variant: {
@@ -1,4 +1,5 @@
1
1
  import clsx from "../../utils/clsx";
2
+ import NextLink from "next/link";
2
3
  import Link from "../Link";
3
4
  export const defaultTextStyles = {
4
5
  variant: {
@@ -1,5 +1,5 @@
1
- import { InputProps } from "../Input";
2
- import { TextareaAutosizeProps } from "react-textarea-autosize/dist/declarations/src";
1
+ import { type InputProps } from "../Input";
2
+ import type { TextareaAutosizeProps } from "react-textarea-autosize";
3
3
  export type TextareaProps = InputProps<false> & Partial<Pick<TextareaAutosizeProps, "maxRows" | "minRows" | "onHeightChange" | "cacheMeasurements">>;
4
4
  declare function Textarea(props: TextareaProps): import("react").JSX.Element;
5
5
  export default Textarea;
@@ -1,4 +1,4 @@
1
- import Input from "../Input";
1
+ import Input, {} from "../Input";
2
2
  import TextareaAutosize from "react-textarea-autosize";
3
3
  function Textarea(props) {
4
4
  return <Input as={TextareaAutosize} {...props}/>;
@@ -1,4 +1,4 @@
1
- import { ReactNode, Ref } from "react";
1
+ import type { ReactNode, Ref } from "react";
2
2
  declare function Tooltip({ children, content, side, delayDuration, className, arrowClassName, ref, }: {
3
3
  children?: ReactNode;
4
4
  content?: ReactNode;
@@ -4,18 +4,18 @@ function Tooltip({ children, content, side, delayDuration, className, arrowClass
4
4
  if (!content) {
5
5
  return <>{children}</>;
6
6
  }
7
- return (<RTooltip.Provider>
8
- <RTooltip.Root delayDuration={delayDuration}>
9
- <RTooltip.Trigger asChild ref={ref}>
10
- {children}
11
- </RTooltip.Trigger>
12
- <RTooltip.Portal>
13
- <RTooltip.Content className={clsx("z-20 rounded-sm bg-zinc-950 px-2 py-1 text-center text-sm text-zinc-50 shadow-sm", "dark:bg-zinc-50 dark:text-zinc-950", "data-[state=closed]:animate-fade-out data-[state=delayed-open]:data-[side=bottom]:animate-elastic-slide-up-and-fade data-[state=delayed-open]:data-[side=left]:animate-elastic-slide-right-and-fade data-[state=delayed-open]:data-[side=right]:animate-elastic-slide-left-and-fade data-[state=delayed-open]:data-[side=top]:animate-elastic-slide-down-and-fade will-change-[transform,opacity]", className)} sideOffset={5} side={side}>
14
- {content}
15
- <RTooltip.Arrow className={clsx("fill-zinc-950 dark:fill-zinc-50", arrowClassName)}/>
16
- </RTooltip.Content>
17
- </RTooltip.Portal>
18
- </RTooltip.Root>
7
+ return (<RTooltip.Provider>
8
+ <RTooltip.Root delayDuration={delayDuration}>
9
+ <RTooltip.Trigger asChild ref={ref}>
10
+ {children}
11
+ </RTooltip.Trigger>
12
+ <RTooltip.Portal>
13
+ <RTooltip.Content className={clsx("z-20 rounded-sm bg-zinc-950 px-2 py-1 text-center text-sm text-zinc-50 shadow-sm", "dark:bg-zinc-50 dark:text-zinc-950", "data-[state=closed]:animate-fade-out data-[state=delayed-open]:data-[side=bottom]:animate-elastic-slide-up-and-fade data-[state=delayed-open]:data-[side=left]:animate-elastic-slide-right-and-fade data-[state=delayed-open]:data-[side=right]:animate-elastic-slide-left-and-fade data-[state=delayed-open]:data-[side=top]:animate-elastic-slide-down-and-fade will-change-[transform,opacity]", className)} sideOffset={5} side={side}>
14
+ {content}
15
+ <RTooltip.Arrow className={clsx("fill-zinc-950 dark:fill-zinc-50", arrowClassName)}/>
16
+ </RTooltip.Content>
17
+ </RTooltip.Portal>
18
+ </RTooltip.Root>
19
19
  </RTooltip.Provider>);
20
20
  }
21
21
  export default Tooltip;
@@ -1,4 +1,4 @@
1
- import { ComponentProps } from "react";
1
+ import { type ComponentProps } from "react";
2
2
  import Button from "../Button";
3
3
  export default function VisibilityActivatedButton({ rootMargin, threshold, root, ...props }: ComponentProps<typeof Button> & {
4
4
  root?: Element | Document | null;
package/form.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { FormEvent } from "react";
2
- import { ArrayKey, IsTuple, TupleKeys } from "react-hook-form/dist/types/path/common";
3
- import { Get, PartialDeep, RequiredDeep, WritableDeep } from "type-fest";
4
- import { DeepPartial } from "redux";
1
+ import { type FormEvent } from "react";
2
+ import type { ArrayKey, IsTuple, TupleKeys } from "react-hook-form/dist/types/path/common";
3
+ import type { Get, PartialDeep, RequiredDeep, WritableDeep } from "type-fest";
4
+ import type { DeepPartial } from "redux";
5
5
  type Any = any;
6
6
  export type DeepMapValues<T, V> = {
7
7
  [K in keyof T]: T[K] extends Array<Any> ? DeepMapValues<T[K][0], V> & V : T[K] extends object ? DeepMapValues<T[K], V> : V;
package/form2.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ControllerFieldState, ControllerProps, ControllerRenderProps, FieldPath, FieldValues, UseFormProps, UseFormReturn, UseFormStateReturn } from "react-hook-form";
1
+ import { type ControllerFieldState, type ControllerProps, type ControllerRenderProps, type FieldPath, type FieldValues, type UseFormProps, type UseFormReturn, type UseFormStateReturn } from "react-hook-form";
2
2
  import * as z from "zod";
3
3
  import React from "react";
4
4
  export declare function useForm<TSchema extends z.Schema<any, any>, TFieldValues extends FieldValues = z.infer<TSchema>>({ schema, ...props }: UseFormProps<TFieldValues> & {
package/form2.jsx CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Controller as RHFController, useForm as useRHForm, } from "react-hook-form";
2
2
  import { zodResolver } from "@hookform/resolvers/zod";
3
+ import * as z from "zod";
3
4
  import React, { useMemo } from "react";
4
5
  import { get } from "lodash-es";
5
6
  export function useForm({ schema, ...props }) {
@@ -1,2 +1,2 @@
1
- import { DependencyList } from "react";
1
+ import { type DependencyList } from "react";
2
2
  export default function useDebounceEffect(fn: () => void, waitTime: number, deps?: DependencyList): void;
@@ -1,2 +1,2 @@
1
- import { StringValue } from "ms";
1
+ import { type StringValue } from "ms";
2
2
  export default function useDebounce<T = unknown>(value: T, delay: StringValue | number): T;
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useState } from "react";
2
- import ms from "ms";
2
+ import ms, {} from "ms";
3
3
  export default function useDebounce(value, delay) {
4
4
  const [debouncedValue, setDebouncedValue] = useState(value);
5
5
  useEffect(() => {
@@ -19,25 +19,25 @@ function lagRadar(config = {}) {
19
19
  inset = 3, // circle inset px
20
20
  parent = document.body, // DOM node to attach to
21
21
  } = config;
22
- const styles = document.createTextNode(`
23
- .lagRadar {
24
- position: fixed;
25
- bottom: 0.5rem;
26
- right: 0.5rem;
27
- }
28
- .lagRadar {
29
- pointer-events: none;
30
- }
31
- .lagRadar-sweep > * {
32
- shape-rendering: crispEdges;
33
- }
34
- .lagRadar-face {
35
- fill: transparent;
36
- }
37
- .lagRadar-hand {
38
- stroke-width: 4px;
39
- stroke-linecap: round;
40
- }
22
+ const styles = document.createTextNode(`
23
+ .lagRadar {
24
+ position: fixed;
25
+ bottom: 0.5rem;
26
+ right: 0.5rem;
27
+ }
28
+ .lagRadar {
29
+ pointer-events: none;
30
+ }
31
+ .lagRadar-sweep > * {
32
+ shape-rendering: crispEdges;
33
+ }
34
+ .lagRadar-face {
35
+ fill: transparent;
36
+ }
37
+ .lagRadar-hand {
38
+ stroke-width: 4px;
39
+ stroke-linecap: round;
40
+ }
41
41
  `);
42
42
  function $svg(tag, props = {}, children = []) {
43
43
  const el = document.createElementNS("http://www.w3.org/2000/svg", tag);
package/package.json CHANGED
@@ -4,6 +4,5 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/majapisoftwares/ui.git"
6
6
  },
7
- "version": "4.1.17",
8
- "type": "module"
7
+ "version": "4.2.0"
9
8
  }