@majapisoftwares/ui 4.1.16 → 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 (167) hide show
  1. package/base.css +4 -4
  2. package/bootstrap/AppProps.d.ts +4 -5
  3. package/components/Accordion/Accordion.d.ts +1 -1
  4. package/components/Alert/Alert.d.ts +1 -1
  5. package/components/Alert/Alert.jsx +19 -19
  6. package/components/AntiClickjacking/AntiClickjacking.d.ts +1 -0
  7. package/components/AntiClickjacking/AntiClickjacking.jsx +17 -0
  8. package/components/AntiClickjacking/index.d.ts +2 -0
  9. package/components/AntiClickjacking/index.jsx +2 -0
  10. package/components/Autocomplete/Autocomplete.d.ts +1 -1
  11. package/components/Autocomplete/Autocomplete.jsx +3 -3
  12. package/components/Autocomplete/UnstyledAutocomplete.d.ts +2 -2
  13. package/components/Autocomplete/UnstyledAutocomplete.jsx +23 -24
  14. package/components/Badge/Badge.d.ts +1 -1
  15. package/components/Badge/Badge.jsx +9 -9
  16. package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  17. package/components/Button/Button.d.ts +2 -2
  18. package/components/Button/Button.jsx +5 -5
  19. package/components/Carousel/Carousel.d.ts +2 -2
  20. package/components/Carousel/Carousel.jsx +13 -13
  21. package/components/Checkbox/Checkbox.d.ts +1 -1
  22. package/components/Checkbox/Checkbox.jsx +12 -12
  23. package/components/Code/Code.d.ts +1 -1
  24. package/components/Code/Code.jsx +15 -15
  25. package/components/ConfirmationButton/ConfirmationButton.d.ts +3 -3
  26. package/components/ConfirmationButton/ConfirmationButton.jsx +10 -10
  27. package/components/ContextMenu/ContextMenu.d.ts +1 -1
  28. package/components/ContextMenu/ContextMenu.jsx +22 -22
  29. package/components/DateInput/DateInput.d.ts +1 -1
  30. package/components/DateInput/DateInput.jsx +1 -1
  31. package/components/DateInput/DateTimeInput.d.ts +1 -1
  32. package/components/DateInput/DateTimeInput.jsx +1 -1
  33. package/components/DateInput/useRefValue.d.ts +1 -1
  34. package/components/DatePicker/DatePicker.d.ts +3 -3
  35. package/components/DatePicker/DatePicker.jsx +8 -8
  36. package/components/DateRangePicker/DateRangePicker.d.ts +2 -2
  37. package/components/DateRangePicker/DateRangePicker.jsx +8 -8
  38. package/components/Dialog/Dialog.d.ts +2 -2
  39. package/components/Dialog/Dialog.jsx +23 -23
  40. package/components/Dialog/Dialogs.jsx +4 -4
  41. package/components/Dialog/dialogs.state.d.ts +2 -2
  42. package/components/Drawer/Drawer.d.ts +1 -1
  43. package/components/Drawer/Drawer.jsx +41 -41
  44. package/components/DropdownMenu/DropdownMenu.d.ts +1 -1
  45. package/components/DropdownMenu/DropdownMenu.jsx +23 -23
  46. package/components/ErrorBoundary/ErrorBoundary.d.ts +1 -1
  47. package/components/ErrorBoundary/ErrorBoundary.jsx +4 -4
  48. package/components/ErrorPage/ErrorPage.d.ts +1 -1
  49. package/components/ErrorPage/ErrorPage.jsx +16 -16
  50. package/components/FileInput/FileInput.d.ts +4 -4
  51. package/components/FileInput/FileInput.jsx +2 -2
  52. package/components/FileInput/PreviewFile.d.ts +2 -2
  53. package/components/FileSelect/FileSelect.d.ts +1 -1
  54. package/components/FileSelect/FileSelect.jsx +16 -13
  55. package/components/Footer/Footer.d.ts +1 -1
  56. package/components/Footer/Footer.jsx +22 -22
  57. package/components/GridPattern/GridPattern.d.ts +1 -1
  58. package/components/GridPattern/GridPattern.jsx +7 -7
  59. package/components/Header/Header.d.ts +1 -1
  60. package/components/Header/Header.jsx +2 -2
  61. package/components/ImageInput/ImageInput.d.ts +1 -1
  62. package/components/Input/Input.d.ts +1 -1
  63. package/components/Input/Input.jsx +7 -7
  64. package/components/Input/InputIcon.d.ts +1 -1
  65. package/components/Input/MultiSelectInput.d.ts +2 -2
  66. package/components/Input/MultiSelectInput.jsx +15 -15
  67. package/components/Input/NumericInput.d.ts +3 -3
  68. package/components/Input/NumericInput.jsx +1 -1
  69. package/components/Input/PatternInput.d.ts +3 -3
  70. package/components/Input/PatternInput.jsx +1 -1
  71. package/components/Input/UnstyledInput.d.ts +1 -1
  72. package/components/Input/UnstyledInput.jsx +12 -12
  73. package/components/Input2/InputWrapper.d.ts +1 -1
  74. package/components/Input2/InputWrapper.jsx +7 -7
  75. package/components/Link/Link.d.ts +1 -1
  76. package/components/Magnet/Magnet.d.ts +1 -1
  77. package/components/Markdown/Markdown.d.ts +1 -1
  78. package/components/Markdown/Markdown.jsx +2 -2
  79. package/components/Menu/Menu.d.ts +3 -3
  80. package/components/Menu/Menu.jsx +19 -19
  81. package/components/Modal/Modal.d.ts +1 -1
  82. package/components/Modal/Modal.jsx +26 -26
  83. package/components/ModeToggle/ModeToggle.d.ts +1 -1
  84. package/components/ModeToggle/ModeToggle.jsx +3 -3
  85. package/components/MultiSelect/MultiSelect.d.ts +2 -2
  86. package/components/MultiSelect/MultiSelect.jsx +2 -2
  87. package/components/MultiSelect/MultiSelectInput.d.ts +1 -1
  88. package/components/MultiText/MultiText.d.ts +1 -1
  89. package/components/MultiText/MultiText.jsx +0 -1
  90. package/components/NavigationDrawer/NavigationDrawer.d.ts +1 -1
  91. package/components/NavigationDrawer/NavigationDrawer.jsx +11 -11
  92. package/components/NavigationDrawer/NavigationItem.d.ts +1 -1
  93. package/components/NavigationDrawer/NavigationItem.jsx +2 -2
  94. package/components/NoSsr/NoSsr.d.ts +1 -1
  95. package/components/Notifications/Notifications.jsx +29 -29
  96. package/components/Notifications/notifications.state.d.ts +2 -2
  97. package/components/Notifications/notifications.state.js +1 -1
  98. package/components/Pagination/Pagination.jsx +15 -15
  99. package/components/Particles/Particles.jsx +55 -55
  100. package/components/PictureCropInput/PictureCropInput.d.ts +2 -2
  101. package/components/PictureCropInput/PictureCropInput.jsx +39 -39
  102. package/components/PictureCropInput/canvasPreview.d.ts +1 -1
  103. package/components/Popover/Popover.d.ts +1 -1
  104. package/components/Popover/Popover.jsx +6 -6
  105. package/components/Resizable/Resizable.d.ts +1 -1
  106. package/components/Resizable/Resizable.jsx +4 -4
  107. package/components/ScrollArea/ScrollArea.d.ts +1 -1
  108. package/components/ScrollArea/ScrollArea.jsx +11 -11
  109. package/components/Select/Select.d.ts +1 -1
  110. package/components/Select/Select.jsx +21 -21
  111. package/components/Skeleton/Skeleton.d.ts +1 -1
  112. package/components/Skeleton/Skeleton.jsx +4 -4
  113. package/components/StarBorder/StarBorder.d.ts +1 -2
  114. package/components/StarBorder/StarBorder.jsx +1 -1
  115. package/components/Switch/Switch.d.ts +2 -2
  116. package/components/Switch/Switch.jsx +9 -9
  117. package/components/Table/DataTable.d.ts +1 -1
  118. package/components/Table/DataTable.jsx +54 -54
  119. package/components/Table/Table.d.ts +1 -1
  120. package/components/Table/Table.jsx +7 -7
  121. package/components/Table/TableActionButton.d.ts +2 -2
  122. package/components/Table/TableActionButton.jsx +3 -3
  123. package/components/Table/TableBody.d.ts +1 -1
  124. package/components/Table/TableBody.jsx +4 -4
  125. package/components/Table/TableCell.d.ts +1 -1
  126. package/components/Table/TableCell.jsx +4 -4
  127. package/components/Table/TableFooter.d.ts +1 -1
  128. package/components/Table/TableFooter.jsx +2 -2
  129. package/components/Table/TableHead.d.ts +1 -1
  130. package/components/Table/TableHead.jsx +4 -4
  131. package/components/Table/TableHeader.d.ts +1 -1
  132. package/components/Table/TableHeader.jsx +10 -10
  133. package/components/Table/TableRow.d.ts +1 -1
  134. package/components/Table/TableRow.jsx +2 -2
  135. package/components/Tabs/Tabs.d.ts +2 -2
  136. package/components/Tabs/Tabs.jsx +6 -6
  137. package/components/TabsSwitcher/Tab.d.ts +1 -1
  138. package/components/TabsSwitcher/TabsSwitcher.d.ts +1 -1
  139. package/components/Text/Text.d.ts +1 -1
  140. package/components/Text/Text.jsx +1 -0
  141. package/components/Textarea/Textarea.d.ts +2 -2
  142. package/components/Textarea/Textarea.jsx +1 -1
  143. package/components/Tooltip/Tooltip.d.ts +1 -1
  144. package/components/Tooltip/Tooltip.jsx +12 -12
  145. package/components/VisibilityActivatedButton/VisibilityActivatedButton.d.ts +1 -1
  146. package/form.d.ts +4 -4
  147. package/form2.d.ts +1 -1
  148. package/form2.jsx +1 -0
  149. package/hooks/useDebounceEffect.d.ts +1 -1
  150. package/hooks/useDebouncedValue.d.ts +1 -1
  151. package/hooks/useDebouncedValue.js +1 -1
  152. package/hooks/useLagRadar.jsx +19 -19
  153. package/package.json +1 -2
  154. package/tsconfig.tsbuildinfo +1 -1
  155. package/types.d.ts +1 -1
  156. package/types.js +1 -1
  157. package/utils/UseState.d.ts +2 -3
  158. package/utils/csvBlobToJson.d.ts +1 -1
  159. package/utils/csvBlobToJson.js +0 -1
  160. package/utils/ms.d.ts +1 -1
  161. package/utils/ms.js +6 -6
  162. package/utils/recursiveChildrenMap.d.ts +1 -1
  163. package/utils/smoothScrollToHref.d.ts +1 -1
  164. package/utils/smoothScrollToHref.js +7 -3
  165. package/utils/stopPropagation.d.ts +1 -1
  166. package/utils/xlsxBlobToJson.d.ts +1 -1
  167. package/utils/xlsxBlobToJson.js +3 -0
@@ -1,7 +1,7 @@
1
- import React, { ComponentProps, ReactElement, ReactNode } from "react";
2
- import { DateRange, Matcher, ModifiersClassNames } from "react-day-picker";
1
+ import React, { type ComponentProps, type ReactElement, type ReactNode } from "react";
2
+ import type { DayPickerProps } from "react-day-picker";
3
+ import { type DateRange, type Matcher, type ModifiersClassNames } from "react-day-picker";
3
4
  import Button from "../Button";
4
- import type { DayPickerProps } from "react-day-picker/src/types/props";
5
5
  export type { DateRange };
6
6
  export default function DatePicker({ value, onValueChange, children, buttonProps, fromDate, toDate, footer, monthFooter, modifiers, modifiersClassNames, disabled, defaultMonth, }: {
7
7
  value?: Date | string;
@@ -22,8 +22,8 @@ export default function DatePicker({ value, onValueChange, children, buttonProps
22
22
  const buttonText = useMemo(() => {
23
23
  return date ? dayjs(date).format("ll") : "";
24
24
  }, [date]);
25
- const children2 = children ? (children(buttonText)) : (<Button {...buttonProps} leading={buttonProps?.leading || <CalendarIcon />} className={clsx(dayPickerButtonClassName, buttonProps?.className)}>
26
- {buttonText}
25
+ const children2 = children ? (children(buttonText)) : (<Button {...buttonProps} leading={buttonProps?.leading || <CalendarIcon />} className={clsx(dayPickerButtonClassName, buttonProps?.className)}>
26
+ {buttonText}
27
27
  </Button>);
28
28
  const defaultDisabled = useMemo(() => [
29
29
  ...(fromDate
@@ -45,11 +45,11 @@ export default function DatePicker({ value, onValueChange, children, buttonProps
45
45
  setOpen(false);
46
46
  setDate(value);
47
47
  }, []);
48
- return (<Popover.Root open={open} onOpenChange={setOpen}>
49
- <Popover.Trigger asChild>{children2}</Popover.Trigger>
50
- <Popover.Content>
51
- <DayPicker mode="single" selected={date} onSelect={onSelect} showOutsideDays classNames={dayPickerClassNames} startMonth={fromDate} endMonth={toDate} footer={monthFooter} modifiers={modifiers} modifiersClassNames={modifiersClassNames} disabled={disabled || defaultDisabled} defaultMonth={defaultMonth}/>
52
- {footer}
53
- </Popover.Content>
48
+ return (<Popover.Root open={open} onOpenChange={setOpen}>
49
+ <Popover.Trigger asChild>{children2}</Popover.Trigger>
50
+ <Popover.Content>
51
+ <DayPicker mode="single" selected={date} onSelect={onSelect} showOutsideDays classNames={dayPickerClassNames} startMonth={fromDate} endMonth={toDate} footer={monthFooter} modifiers={modifiers} modifiersClassNames={modifiersClassNames} disabled={disabled || defaultDisabled} defaultMonth={defaultMonth}/>
52
+ {footer}
53
+ </Popover.Content>
54
54
  </Popover.Root>);
55
55
  }
@@ -1,5 +1,5 @@
1
- import React, { ComponentProps, ReactElement, ReactNode } from "react";
2
- import { DateRange } from "react-day-picker";
1
+ import React, { type ComponentProps, type ReactElement, type ReactNode } from "react";
2
+ import { type DateRange } from "react-day-picker";
3
3
  import Button from "../Button";
4
4
  export type { DateRange };
5
5
  export default function DateRangePicker({ value, onValueChange, children, buttonProps, fromDate, toDate, min, max, footer, monthFooter, }: {
@@ -27,8 +27,8 @@ export default function DateRangePicker({ value, onValueChange, children, button
27
27
  }
28
28
  return buttonText;
29
29
  }, [range]);
30
- const children2 = children ? (children(buttonText)) : (<Button {...buttonProps} leading={buttonProps?.leading || <CalendarIcon />} className={clsx(dayPickerButtonClassName, buttonProps?.className)}>
31
- {buttonText}
30
+ const children2 = children ? (children(buttonText)) : (<Button {...buttonProps} leading={buttonProps?.leading || <CalendarIcon />} className={clsx(dayPickerButtonClassName, buttonProps?.className)}>
31
+ {buttonText}
32
32
  </Button>);
33
33
  const hidden = useMemo(() => [
34
34
  ...(fromDate
@@ -46,11 +46,11 @@ export default function DateRangePicker({ value, onValueChange, children, button
46
46
  ]
47
47
  : []),
48
48
  ], [fromDate, toDate]);
49
- return (<Popover.Root>
50
- <Popover.Trigger asChild>{children2}</Popover.Trigger>
51
- <Popover.Content>
52
- <DayPicker mode="range" defaultMonth={value?.from} selected={range} onSelect={setRange} numberOfMonths={2} showOutsideDays classNames={dayPickerClassNames} startMonth={fromDate} endMonth={toDate} hidden={hidden} min={min} max={max} footer={monthFooter} excludeDisabled/>
53
- {footer}
54
- </Popover.Content>
49
+ return (<Popover.Root>
50
+ <Popover.Trigger asChild>{children2}</Popover.Trigger>
51
+ <Popover.Content>
52
+ <DayPicker mode="range" defaultMonth={value?.from} selected={range} onSelect={setRange} numberOfMonths={2} showOutsideDays classNames={dayPickerClassNames} startMonth={fromDate} endMonth={toDate} hidden={hidden} min={min} max={max} footer={monthFooter} excludeDisabled/>
53
+ {footer}
54
+ </Popover.Content>
55
55
  </Popover.Root>);
56
56
  }
@@ -1,6 +1,6 @@
1
1
  import * as RDialog from "@radix-ui/react-dialog";
2
- import { DialogContentProps } from "@radix-ui/react-dialog";
3
- import { ReactNode } from "react";
2
+ import type { DialogContentProps } from "@radix-ui/react-dialog";
3
+ import { type ReactNode } from "react";
4
4
  export interface DialogProps {
5
5
  title: ReactNode;
6
6
  description?: ReactNode;
@@ -7,29 +7,29 @@ import { modalContentClassName } from "../../styles/Modal.classNames";
7
7
  import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
8
8
  export default function Dialog({ children, title, description, open, onOpenChange, contentClassName, contentOverflowClassName, closeButtonClassName, overlayClassName, titleClassName, descriptionClassName, hideTitle, contentProps, hideCloseButton, }) {
9
9
  const TitleWrapper = !hideTitle ? Fragment : VisuallyHidden;
10
- return (<RDialog.Root open={open} onOpenChange={onOpenChange}>
11
- <RDialog.Portal>
12
- <RDialog.Overlay className={clsx("ui-dialog-overlay", "fixed inset-0 z-20 flex items-center justify-center bg-black/50", "data-[state=closed]:animate-fade-out data-[state=open]:animate-slide-up-and-fade will-change-[opacity,transform]", overlayClassName)}>
13
- <RDialog.Content className={clsx(modalContentClassName, "ui-dialog-content", "relative p-0 focus:outline-hidden", contentClassName, contentProps?.className)} {...(!description ? { "aria-describedby": undefined } : {})} {...contentProps}>
14
- <div className={clsx("flex max-h-[85vh] w-[90vw] max-w-[450px] flex-col gap-3 overflow-auto p-4", contentOverflowClassName)}>
15
- <TitleWrapper>
16
- <RDialog.Title className={clsx("ui-dialog-title", "text-lg leading-none font-medium text-zinc-900 dark:text-zinc-50", titleClassName)}>
17
- {title}
18
- </RDialog.Title>
19
- </TitleWrapper>
20
- {description && (<RDialog.Description className={clsx("ui-dialog-description", "text-zinc-700 dark:text-zinc-300", descriptionClassName)}>
21
- {description}
22
- </RDialog.Description>)}
23
- {children}
24
- {!hideCloseButton && (<RDialog.Close asChild>
25
- <Button className={clsx("absolute top-1 right-1 p-1.5", "ui-dialog-close-button", closeButtonClassName)} aria-label="Close" variant="text" icon>
26
- <XMarkIcon />
27
- </Button>
28
- </RDialog.Close>)}
29
- </div>
30
- </RDialog.Content>
31
- </RDialog.Overlay>
32
- </RDialog.Portal>
10
+ return (<RDialog.Root open={open} onOpenChange={onOpenChange}>
11
+ <RDialog.Portal>
12
+ <RDialog.Overlay className={clsx("ui-dialog-overlay", "fixed inset-0 z-20 flex items-center justify-center bg-black/50", "data-[state=closed]:animate-fade-out data-[state=open]:animate-slide-up-and-fade will-change-[opacity,transform]", overlayClassName)}>
13
+ <RDialog.Content className={clsx(modalContentClassName, "ui-dialog-content", "relative p-0 focus:outline-hidden", contentClassName, contentProps?.className)} {...(!description ? { "aria-describedby": undefined } : {})} {...contentProps}>
14
+ <div className={clsx("flex max-h-[85vh] w-[90vw] max-w-[450px] flex-col gap-3 overflow-auto p-4", contentOverflowClassName)}>
15
+ <TitleWrapper>
16
+ <RDialog.Title className={clsx("ui-dialog-title", "text-lg leading-none font-medium text-zinc-900 dark:text-zinc-50", titleClassName)}>
17
+ {title}
18
+ </RDialog.Title>
19
+ </TitleWrapper>
20
+ {description && (<RDialog.Description className={clsx("ui-dialog-description", "text-zinc-700 dark:text-zinc-300", descriptionClassName)}>
21
+ {description}
22
+ </RDialog.Description>)}
23
+ {children}
24
+ {!hideCloseButton && (<RDialog.Close asChild>
25
+ <Button className={clsx("absolute top-1 right-1 p-1.5", "ui-dialog-close-button", closeButtonClassName)} aria-label="Close" variant="text" icon>
26
+ <XMarkIcon />
27
+ </Button>
28
+ </RDialog.Close>)}
29
+ </div>
30
+ </RDialog.Content>
31
+ </RDialog.Overlay>
32
+ </RDialog.Portal>
33
33
  </RDialog.Root>);
34
34
  }
35
35
  Dialog.Close = RDialog.Close;
@@ -10,12 +10,12 @@ export default function Dialogs() {
10
10
  setRendered(false);
11
11
  };
12
12
  }, [setRendered]);
13
- return (<>
13
+ return (<>
14
14
  {dialogs.map((dialog) => (<Dialog key={dialog._id} open={dialog.open} onOpenChange={() => {
15
15
  closeDialog(dialog._id);
16
16
  dialog.props.onClose?.(dialog._id);
17
- }} {...dialog.props} title={dialog.props.title} description={dialog.props.description}>
18
- {dialog.props.content}
19
- </Dialog>))}
17
+ }} {...dialog.props} title={dialog.props.title} description={dialog.props.description}>
18
+ {dialog.props.content}
19
+ </Dialog>))}
20
20
  </>);
21
21
  }
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
- import { DialogProps } from "./Dialog";
1
+ import type { ReactNode } from "react";
2
+ import type { DialogProps } from "./Dialog";
3
3
  export type IDialog = {
4
4
  _id: string;
5
5
  open: boolean;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  export type DialogProps = {
3
3
  open?: boolean;
4
4
  onClose?: (open: boolean) => void;
@@ -1,4 +1,4 @@
1
- import { Fragment, useCallback, useEffect, useState } from "react";
1
+ import { Fragment, useCallback, useEffect, useState, } from "react";
2
2
  import { Dialog as HuiDialog, Transition } from "@headlessui/react";
3
3
  import { XMarkIcon } from "@heroicons/react/24/outline";
4
4
  import Button from "../Button/Button";
@@ -21,52 +21,52 @@ export default function Drawer({ open: defaultOpen, onClose, onChangeOpen, title
21
21
  useEffect(() => {
22
22
  setOpen(defaultOpen);
23
23
  }, [defaultOpen]);
24
- return (<Transition.Root show={open} as={Fragment}>
25
- <HuiDialog as="div" className={clsx("relative z-20", className)} onClose={setOpen}>
26
- {!hideOverlay ? (<Transition.Child as={Fragment} enter="ease-in-out duration-300" enterFrom="opacity-0" enterTo="opacity-100" leave="ease-in-out duration-300" leaveFrom="opacity-100" leaveTo="opacity-0">
27
- <div className="fixed inset-0 bg-black/70 bg-opacity-75 transition-opacity"/>
28
- </Transition.Child>) : (<div className="fixed inset-0"/>)}
29
-
30
- <div className="fixed inset-0 overflow-hidden">
31
- <div className="absolute inset-0 overflow-hidden">
24
+ return (<Transition.Root show={open} as={Fragment}>
25
+ <HuiDialog as="div" className={clsx("relative z-20", className)} onClose={setOpen}>
26
+ {!hideOverlay ? (<Transition.Child as={Fragment} enter="ease-in-out duration-300" enterFrom="opacity-0" enterTo="opacity-100" leave="ease-in-out duration-300" leaveFrom="opacity-100" leaveTo="opacity-0">
27
+ <div className="bg-opacity-75 fixed inset-0 bg-black/70 transition-opacity"/>
28
+ </Transition.Child>) : (<div className="fixed inset-0"/>)}
29
+
30
+ <div className="fixed inset-0 overflow-hidden">
31
+ <div className="absolute inset-0 overflow-hidden">
32
32
  <div className={clsx("pointer-events-none fixed inset-y-0 flex max-w-full", {
33
33
  ["left-0 pr-10"]: !noPadding && position === "left",
34
34
  ["right-0 pl-10"]: !noPadding && position === "right",
35
- })}>
35
+ })}>
36
36
  <Transition.Child as={Fragment} enter="transform transition ease-in-out duration-300 sm:duration-500" enterFrom={position === "right"
37
37
  ? "translate-x-full"
38
38
  : "-translate-x-full"} enterTo={position === "right" ? "translate-x-0" : "translate-x-0"} leave="transform transition ease-in-out duration-300 sm:duration-500" leaveFrom={position === "right" ? "translate-x-0" : "translate-x-0"} leaveTo={position === "right"
39
39
  ? "translate-x-full"
40
- : "-translate-x-full"}>
41
- <HuiDialog.Panel className="pointer-events-auto w-screen max-w-md">
42
- <div className={clsx("flex h-full flex-col divide-y divide-zinc-200 bg-white shadow-xl dark:bg-zinc-900", panelClassName)}>
43
- <div className="flex min-h-0 flex-1 flex-col overflow-y-auto pb-6">
44
- <div className="sticky top-0 z-10 bg-white/95 px-4 py-6 backdrop-blur-sm sm:px-6 [@supports(backdrop-filter:blur(0))]:bg-white/50 dark:[@supports(backdrop-filter:blur(0))]:bg-zinc-900/75">
45
- <div className="flex items-start">
46
- {title && (<HuiDialog.Title className="text-lg font-medium text-zinc-900">
47
- {title}
48
- </HuiDialog.Title>)}
49
- <div className="grow"/>
50
- <div className="ml-3 flex h-7 items-center">
51
- <Button icon variant="text" onClick={useCallback(() => setOpen(false), [])}>
52
- <XMarkIcon className="h-6 w-6" aria-hidden="true"/>
53
- </Button>
54
- </div>
55
- </div>
56
- </div>
57
- <div className="relative flex-1 px-4 pt-1 sm:px-6">
58
- {children}
59
- </div>
60
- </div>
61
- {actions && (<Group className="shrink-0 justify-end px-4 py-4">
62
- {actions}
63
- </Group>)}
64
- </div>
65
- </HuiDialog.Panel>
66
- </Transition.Child>
67
- </div>
68
- </div>
69
- </div>
70
- </HuiDialog>
40
+ : "-translate-x-full"}>
41
+ <HuiDialog.Panel className="pointer-events-auto w-screen max-w-md">
42
+ <div className={clsx("flex h-full flex-col divide-y divide-zinc-200 bg-white shadow-xl dark:bg-zinc-900", panelClassName)}>
43
+ <div className="flex min-h-0 flex-1 flex-col overflow-y-auto pb-6">
44
+ <div className="sticky top-0 z-10 bg-white/95 px-4 py-6 backdrop-blur-sm sm:px-6 [@supports(backdrop-filter:blur(0))]:bg-white/50 dark:[@supports(backdrop-filter:blur(0))]:bg-zinc-900/75">
45
+ <div className="flex items-start">
46
+ {title && (<HuiDialog.Title className="text-lg font-medium text-zinc-900">
47
+ {title}
48
+ </HuiDialog.Title>)}
49
+ <div className="grow"/>
50
+ <div className="ml-3 flex h-7 items-center">
51
+ <Button icon variant="text" onClick={useCallback(() => setOpen(false), [])}>
52
+ <XMarkIcon className="h-6 w-6" aria-hidden="true"/>
53
+ </Button>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ <div className="relative flex-1 px-4 pt-1 sm:px-6">
58
+ {children}
59
+ </div>
60
+ </div>
61
+ {actions && (<Group className="shrink-0 justify-end px-4 py-4">
62
+ {actions}
63
+ </Group>)}
64
+ </div>
65
+ </HuiDialog.Panel>
66
+ </Transition.Child>
67
+ </div>
68
+ </div>
69
+ </div>
70
+ </HuiDialog>
71
71
  </Transition.Root>);
72
72
  }
@@ -1,4 +1,4 @@
1
- import React, { ComponentProps } from "react";
1
+ import React, { type ComponentProps } from "react";
2
2
  import * as RDropdownMenu from "@radix-ui/react-dropdown-menu";
3
3
  declare function DropdownMenuContent({ className, arrowClassName, children, sideOffset, collisionPadding, ...props }: ComponentProps<typeof RDropdownMenu.Content> & {
4
4
  arrowClassName?: string;
@@ -6,11 +6,11 @@ import Link from "next/link";
6
6
  import { dropdownCheckboxItemClassName, dropdownItemClassName, dropdownItemIndicatorClassName, dropdownLabelClassName, dropdownSeparatorClassName, } from "../../styles/Dropdown.classNames";
7
7
  import { modalArrowClassName, modalContentClassName, } from "../../styles/Modal.classNames";
8
8
  function DropdownMenuContent({ className, arrowClassName, children, sideOffset = 4, collisionPadding = 8, ...props }) {
9
- return (<RDropdownMenu.Portal>
10
- <RDropdownMenu.Content sideOffset={sideOffset} collisionPadding={collisionPadding} {...props} className={clsx(modalContentClassName, "ui-dropdown-menu-content", className)}>
11
- {children}
12
- <RDropdownMenu.Arrow className={clsx(modalArrowClassName, "ui-dropdown-menu-arrow", arrowClassName)}/>
13
- </RDropdownMenu.Content>
9
+ return (<RDropdownMenu.Portal>
10
+ <RDropdownMenu.Content sideOffset={sideOffset} collisionPadding={collisionPadding} {...props} className={clsx(modalContentClassName, "ui-dropdown-menu-content", className)}>
11
+ {children}
12
+ <RDropdownMenu.Arrow className={clsx(modalArrowClassName, "ui-dropdown-menu-arrow", arrowClassName)}/>
13
+ </RDropdownMenu.Content>
14
14
  </RDropdownMenu.Portal>);
15
15
  }
16
16
  function DropdownMenuSeparator({ className, ...props }) {
@@ -20,8 +20,8 @@ function DropdownMenuItem({ className, href, target, ...props }) {
20
20
  const Wrapper = href ? Link : Fragment;
21
21
  return (
22
22
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
- <Wrapper {...(href ? { href, target } : {})}>
24
- <RDropdownMenu.Item {...props} className={clsx(dropdownItemClassName, "ui-dropdown-menu-item", className)}/>
23
+ <Wrapper {...(href ? { href, target } : {})}>
24
+ <RDropdownMenu.Item {...props} className={clsx(dropdownItemClassName, "ui-dropdown-menu-item", className)}/>
25
25
  </Wrapper>);
26
26
  }
27
27
  function DropdownMenuLabel({ className, ...props }) {
@@ -31,31 +31,31 @@ function DropdownMenuItemIndicator({ className, ...props }) {
31
31
  return (<RDropdownMenu.ItemIndicator className={clsx(dropdownItemIndicatorClassName, "ui-dropdown-menu-checkbox-item-indicator", className)} {...props}/>);
32
32
  }
33
33
  function DropdownMenuCheckboxItem({ className, children, indicatorClassName, ...props }) {
34
- return (<RDropdownMenu.CheckboxItem {...props} className={clsx(dropdownCheckboxItemClassName, "ui-dropdown-menu-checkbox-item", className)}>
35
- <DropdownMenuItemIndicator className={indicatorClassName}>
36
- <CheckIcon />
37
- </DropdownMenuItemIndicator>
38
- {children}
34
+ return (<RDropdownMenu.CheckboxItem {...props} className={clsx(dropdownCheckboxItemClassName, "ui-dropdown-menu-checkbox-item", className)}>
35
+ <DropdownMenuItemIndicator className={indicatorClassName}>
36
+ <CheckIcon />
37
+ </DropdownMenuItemIndicator>
38
+ {children}
39
39
  </RDropdownMenu.CheckboxItem>);
40
40
  }
41
41
  function DropdownMenuSubContent({ className, children, sideOffset = 2, alignOffset = -5, ...props }) {
42
- return (<RDropdownMenu.Portal>
43
- <RDropdownMenu.SubContent sideOffset={sideOffset} alignOffset={alignOffset} {...props} className={clsx(modalContentClassName, "ui-dropdown-menu-sub-content", className)}>
44
- {children}
45
- </RDropdownMenu.SubContent>
42
+ return (<RDropdownMenu.Portal>
43
+ <RDropdownMenu.SubContent sideOffset={sideOffset} alignOffset={alignOffset} {...props} className={clsx(modalContentClassName, "ui-dropdown-menu-sub-content", className)}>
44
+ {children}
45
+ </RDropdownMenu.SubContent>
46
46
  </RDropdownMenu.Portal>);
47
47
  }
48
48
  function DropdownMenuSubTrigger({ className, href, children, ...props }) {
49
49
  const Wrapper = href ? Link : Fragment;
50
50
  return (
51
51
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
- <Wrapper {...(href ? { href } : {})}>
53
- <RDropdownMenu.SubTrigger {...props} className={clsx(dropdownItemClassName, "ui-dropdown-menu-sub-trigger", className)}>
54
- {children}
55
- <div className={clsx("absolute right-1.5 top-1.5 inline-flex items-center justify-center", "[&>svg]:h-4 [&>svg]:w-4")}>
56
- <ChevronRightIcon />
57
- </div>
58
- </RDropdownMenu.SubTrigger>
52
+ <Wrapper {...(href ? { href } : {})}>
53
+ <RDropdownMenu.SubTrigger {...props} className={clsx(dropdownItemClassName, "ui-dropdown-menu-sub-trigger", className)}>
54
+ {children}
55
+ <div className={clsx("absolute top-1.5 right-1.5 inline-flex items-center justify-center", "[&>svg]:h-4 [&>svg]:w-4")}>
56
+ <ChevronRightIcon />
57
+ </div>
58
+ </RDropdownMenu.SubTrigger>
59
59
  </Wrapper>);
60
60
  }
61
61
  const DropdownMenu = {
@@ -1,4 +1,4 @@
1
- import { Component, ErrorInfo, ReactNode } from "react";
1
+ import { Component, type ErrorInfo, type ReactNode } from "react";
2
2
  export default class ErrorBoundary extends Component<{
3
3
  title?: ReactNode;
4
4
  content?: ReactNode;
@@ -20,10 +20,10 @@ export default class ErrorBoundary extends Component {
20
20
  // Check if the error is thrown
21
21
  if (this.state.hasError) {
22
22
  // You can render any custom fallback UI
23
- return (<Alert variant="error" title={this.props.title || "Oops, there was an unexpected error"} actions={this.props.tryAgain && (<Button variant="text" color="error" onClick={() => this.setState({ hasError: false })}>
24
- {this.props.tryAgain}
25
- </Button>)}>
26
- {this.props.content}
23
+ return (<Alert variant="error" title={this.props.title || "Oops, there was an unexpected error"} actions={this.props.tryAgain && (<Button variant="text" color="error" onClick={() => this.setState({ hasError: false })}>
24
+ {this.props.tryAgain}
25
+ </Button>)}>
26
+ {this.props.content}
27
27
  </Alert>);
28
28
  }
29
29
  // Return children components in case of no error
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import type { ReactNode } from "react";
2
2
  export type ErrorProps = {
3
3
  error: number;
4
4
  background?: string;
@@ -1,23 +1,23 @@
1
1
  import Button from "../Button/Button";
2
2
  import { NextSeo } from "next-seo";
3
- export default function ErrorPage({ error, background = "https://images.unsplash.com/photo-1545972154-9bb223aac798?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=3050&q=80&exp=8&con=-15&sat=-75", title, description, defaultActionLabel = "Go back home", defaultActionHref = "/", action = (<Button variant="text" href={defaultActionHref} className="inline-flex items-center rounded-md border border-transparent bg-white bg-opacity-75 px-4 py-2 text-sm font-medium text-black text-opacity-75 sm:bg-opacity-25 sm:hover:bg-opacity-50">
4
- {defaultActionLabel}
3
+ export default function ErrorPage({ error, background = "https://images.unsplash.com/photo-1545972154-9bb223aac798?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=3050&q=80&exp=8&con=-15&sat=-75", title, description, defaultActionLabel = "Go back home", defaultActionHref = "/", action = (<Button variant="text" href={defaultActionHref} className="bg-opacity-75 text-opacity-75 sm:bg-opacity-25 sm:hover:bg-opacity-50 inline-flex items-center rounded-md border border-transparent bg-white px-4 py-2 text-sm font-medium text-black">
4
+ {defaultActionLabel}
5
5
  </Button>), }) {
6
6
  return (<main className="min-h-full bg-slate-400 bg-cover bg-top sm:bg-top" style={{
7
7
  backgroundImage: `url("${background}")`,
8
- }}>
9
- <NextSeo title={error.toString()}/>
10
- <div className="mx-auto max-w-7xl px-4 py-16 text-center sm:px-6 sm:py-24 lg:px-8 lg:py-48">
11
- <p className="text-base font-semibold text-black text-opacity-50">
12
- {error}
13
- </p>
14
- <h1 className="mt-2 text-4xl font-bold tracking-tight text-white sm:text-5xl">
15
- {title}
16
- </h1>
17
- <p className="mt-2 text-lg font-medium text-black text-opacity-50">
18
- {description}
19
- </p>
20
- <div className="mt-6">{action}</div>
21
- </div>
8
+ }}>
9
+ <NextSeo title={error.toString()}/>
10
+ <div className="mx-auto max-w-7xl px-4 py-16 text-center sm:px-6 sm:py-24 lg:px-8 lg:py-48">
11
+ <p className="text-opacity-50 text-base font-semibold text-black">
12
+ {error}
13
+ </p>
14
+ <h1 className="mt-2 text-4xl font-bold tracking-tight text-white sm:text-5xl">
15
+ {title}
16
+ </h1>
17
+ <p className="text-opacity-50 mt-2 text-lg font-medium text-black">
18
+ {description}
19
+ </p>
20
+ <div className="mt-6">{action}</div>
21
+ </div>
22
22
  </main>);
23
23
  }
@@ -1,7 +1,7 @@
1
- import { ComponentPropsWithRef, ComponentType, ReactNode } from "react";
2
- import { InputProps } from "../Input";
3
- import { FileSelectProps } from "../FileSelect";
4
- import { PreviewFileProps } from "./PreviewFile";
1
+ import { type ComponentPropsWithRef, type ComponentType, type ReactNode } from "react";
2
+ import { type InputProps } from "../Input";
3
+ import { type FileSelectProps } from "../FileSelect";
4
+ import { type PreviewFileProps } from "./PreviewFile";
5
5
  export type FileFile = {
6
6
  _id: string;
7
7
  file: File;
@@ -2,11 +2,11 @@ import clsx from "../../utils/clsx";
2
2
  import { memo, useCallback, useEffect, useMemo, useRef, useState, } from "react";
3
3
  import { useDeepCompareEffect } from "react-use";
4
4
  import { defaultHelpTextClassName, defaultLabelClassName, } from "../Input";
5
- import FileSelect from "../FileSelect";
5
+ import FileSelect, {} from "../FileSelect";
6
6
  import isomorphicObjectId from "@majapisoftwares/next/utils/isomorphicObjectId";
7
7
  import { isEqual } from "lodash-es";
8
8
  import Text from "../Text";
9
- import PreviewFile from "./PreviewFile";
9
+ import PreviewFile, {} from "./PreviewFile";
10
10
  import concurrentForOf from "@majapisoftwares/next/utils/concurrentForOf";
11
11
  import paginated from "@majapisoftwares/next/utils/paginated";
12
12
  import Pagination from "../Pagination";
@@ -1,5 +1,5 @@
1
- import { FileInputFile } from "./FileInput";
2
- import { ReactNode } from "react";
1
+ import type { FileInputFile } from "./FileInput";
2
+ import { type ReactNode } from "react";
3
3
  export type PreviewFileProps = {
4
4
  file: FileInputFile;
5
5
  readOnly?: boolean;
@@ -1,4 +1,4 @@
1
- import { ReactElement, ReactNode, Ref } from "react";
1
+ import { type ReactElement, type ReactNode, type Ref } from "react";
2
2
  export interface FileSelectProps {
3
3
  uploadAFileText?: string;
4
4
  orDragAndDropText?: string;
@@ -6,6 +6,7 @@ import numeral from "numeral";
6
6
  import { ArrowUpTrayIcon } from "@heroicons/react/24/solid";
7
7
  import { DocumentIcon } from "@heroicons/react/24/outline";
8
8
  import Loading from "../Loading";
9
+ import { uniq } from "lodash-es";
9
10
  const translateAllowedType = (type) => ({
10
11
  "image/png": "PNG",
11
12
  ".png": "PNG",
@@ -85,25 +86,27 @@ function FileSelect({ maxFileSize, allowedFileTypes, id, limit, onAcceptFiles, c
85
86
  })}/>
86
87
  <div>{uploadingText}</div>
87
88
  </div>) : !canDrop || disabled ? (<div className={clsx("relative flex flex-col items-center justify-center gap-2 text-center", innerClassName)}>
88
- {cloneElement(icon, {
89
+ <div className="relative flex flex-col items-center justify-center gap-2 text-center">
90
+ {cloneElement(icon, {
89
91
  className: clsx("mx-auto h-12 w-12 text-zinc-400", icon.props.className),
90
92
  })}
91
- <div className="text-sm">
92
- <label htmlFor={id} className={clsx("text-primary-600 focus-within:ring-primary-500 hover:text-primary-500 relative rounded-md font-medium focus-within:ring-2 focus-within:ring-offset-2 focus-within:outline-hidden dark:ring-offset-slate-900", {
93
+ <div className="text-sm">
94
+ <label htmlFor={id} className={clsx("text-primary-600 focus-within:ring-primary-500 hover:text-primary-500 relative rounded-md font-medium focus-within:ring-2 focus-within:ring-offset-2 focus-within:outline-hidden dark:ring-offset-slate-900", {
93
95
  "cursor-pointer": !disabled,
94
96
  "cursor-not-allowed": disabled,
95
97
  })}>
96
- <span>{uploadAFileText}</span>
97
- {!disabled && (<input id={id} name={id} type="file" className="sr-only" accept={allowedFileTypes?.join(",")} onChange={handleFileBrowse} multiple={limit !== 1} ref={ref}/>)}
98
- </label>
99
- <span className="pl-1">{orDragAndDropText}</span>
100
- </div>
101
- <p className="text-xs text-zinc-500">
102
- {allowedFileTypes
103
- ? allowedFileTypes.map(translateAllowedType).join(", ")
98
+ <span>{uploadAFileText}</span>
99
+ {!disabled && (<input id={id} name={id} type="file" className="sr-only" accept={allowedFileTypes?.join(",")} onChange={handleFileBrowse} multiple={limit !== 1} ref={ref}/>)}
100
+ </label>
101
+ <span className="pl-1">{orDragAndDropText}</span>
102
+ </div>
103
+ <p className="text-xs text-zinc-500">
104
+ {allowedFileTypes
105
+ ? uniq(allowedFileTypes.map(translateAllowedType)).join(", ")
104
106
  : anyFileText}{" "}
105
- {upToText} {numeral(maxFileSize).format("0b")}
106
- </p>
107
+ {upToText} {numeral(maxFileSize).format("0b")}
108
+ </p>
109
+ </div>
107
110
  {additionalBottomInfo}
108
111
  </div>) : (<div className={clsx("flex flex-col items-center justify-center gap-2 text-center", innerClassName)}>
109
112
  <ArrowUpTrayIcon className={clsx("w-10 text-7xl", {
@@ -1,4 +1,4 @@
1
- import { ReactElement, ReactNode } from "react";
1
+ import { type ReactElement, type ReactNode } from "react";
2
2
  export type FooterProps = {
3
3
  main?: {
4
4
  name: string;
@@ -1,30 +1,30 @@
1
1
  import { cloneElement } from "react";
2
2
  const CURRENT_YEAR = new Date().getFullYear();
3
3
  export default function Footer({ main, social, companyName, allRightsReserved = "All rights reserved", children, }) {
4
- return (<>
5
- <div className="flex min-h-screen flex-col">{children}</div>
6
- <footer className="border-t border-slate-900/5 bg-white dark:border-slate-50/5 dark:bg-zinc-900">
7
- <div className="mx-auto max-w-7xl overflow-hidden px-4 py-12 sm:px-6 lg:px-8">
8
- {main && (<nav className="-mx-5 -my-2 mb-8 flex flex-wrap justify-center" aria-label="Footer">
9
- {main.map((item) => (<div key={item.name} className="px-5 py-2">
10
- <a href={item.href} className="text-base text-zinc-500 hover:text-zinc-900">
11
- {item.name}
12
- </a>
13
- </div>))}
14
- </nav>)}
15
- {social && (<div className="mb-8 flex justify-center space-x-6">
16
- {social.map((item) => (<a key={item.name} href={item.href} className="text-zinc-400 hover:text-zinc-500">
17
- <span className="sr-only">{item.name}</span>
4
+ return (<>
5
+ <div className="flex min-h-screen flex-col">{children}</div>
6
+ <footer className="border-t border-slate-900/5 bg-white dark:border-slate-50/5 dark:bg-zinc-900">
7
+ <div className="mx-auto max-w-7xl overflow-hidden px-4 py-12 sm:px-6 lg:px-8">
8
+ {main && (<nav className="-mx-5 -my-2 mb-8 flex flex-wrap justify-center" aria-label="Footer">
9
+ {main.map((item) => (<div key={item.name} className="px-5 py-2">
10
+ <a href={item.href} className="text-base text-zinc-500 hover:text-zinc-900">
11
+ {item.name}
12
+ </a>
13
+ </div>))}
14
+ </nav>)}
15
+ {social && (<div className="mb-8 flex justify-center space-x-6">
16
+ {social.map((item) => (<a key={item.name} href={item.href} className="text-zinc-400 hover:text-zinc-500">
17
+ <span className="sr-only">{item.name}</span>
18
18
  {cloneElement(item.icon, {
19
19
  className: "h-6 w-6",
20
20
  "aria-hidden": "true",
21
- })}
22
- </a>))}
23
- </div>)}
24
- <p className="text-center text-base text-zinc-400">
25
- {companyName} &copy; {CURRENT_YEAR}. {allRightsReserved}.
26
- </p>
27
- </div>
28
- </footer>
21
+ })}
22
+ </a>))}
23
+ </div>)}
24
+ <p className="text-center text-base text-zinc-400">
25
+ {companyName} &copy; {CURRENT_YEAR}. {allRightsReserved}.
26
+ </p>
27
+ </div>
28
+ </footer>
29
29
  </>);
30
30
  }
@@ -1,2 +1,2 @@
1
- import { SVGProps } from "react";
1
+ import { type SVGProps } from "react";
2
2
  export default function GridPattern(props: SVGProps<SVGPatternElement>): import("react").JSX.Element;