@majapisoftwares/ui 4.1.17 → 4.3.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 (165) 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 +10 -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 +5 -4
  60. package/components/Input/MultiSelectInput.jsx +41 -21
  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/SelectInput.d.ts +12 -0
  66. package/components/Input/SelectInput.jsx +25 -0
  67. package/components/Input/UnstyledInput.d.ts +1 -1
  68. package/components/Input/UnstyledInput.jsx +12 -12
  69. package/components/Input/useInputRefValue.d.ts +11 -0
  70. package/components/Input/useInputRefValue.jsx +51 -0
  71. package/components/Input2/InputWrapper.d.ts +1 -1
  72. package/components/Input2/InputWrapper.jsx +7 -7
  73. package/components/Link/Link.d.ts +1 -1
  74. package/components/Magnet/Magnet.d.ts +1 -1
  75. package/components/Markdown/Markdown.d.ts +1 -1
  76. package/components/Markdown/Markdown.jsx +1 -1
  77. package/components/Menu/Menu.d.ts +3 -3
  78. package/components/Menu/Menu.jsx +19 -19
  79. package/components/Modal/Modal.d.ts +1 -1
  80. package/components/Modal/Modal.jsx +26 -26
  81. package/components/ModeToggle/ModeToggle.d.ts +1 -1
  82. package/components/ModeToggle/ModeToggle.jsx +3 -3
  83. package/components/MultiSelect/MultiSelect.d.ts +2 -2
  84. package/components/MultiSelect/MultiSelect.jsx +2 -2
  85. package/components/MultiSelect/MultiSelectInput.d.ts +1 -1
  86. package/components/MultiText/MultiText.d.ts +1 -1
  87. package/components/MultiText/MultiText.jsx +0 -1
  88. package/components/NavigationDrawer/NavigationDrawer.d.ts +1 -1
  89. package/components/NavigationDrawer/NavigationDrawer.jsx +11 -11
  90. package/components/NavigationDrawer/NavigationItem.d.ts +1 -1
  91. package/components/NavigationDrawer/NavigationItem.jsx +2 -2
  92. package/components/NoSsr/NoSsr.d.ts +1 -1
  93. package/components/Notifications/Notifications.jsx +29 -29
  94. package/components/Notifications/notifications.state.d.ts +2 -2
  95. package/components/Notifications/notifications.state.js +1 -1
  96. package/components/Pagination/Pagination.jsx +15 -15
  97. package/components/Particles/Particles.jsx +55 -55
  98. package/components/PictureCropInput/PictureCropInput.d.ts +2 -2
  99. package/components/PictureCropInput/PictureCropInput.jsx +39 -39
  100. package/components/PictureCropInput/canvasPreview.d.ts +1 -1
  101. package/components/Popover/Popover.d.ts +1 -1
  102. package/components/Popover/Popover.jsx +6 -6
  103. package/components/Resizable/Resizable.d.ts +1 -1
  104. package/components/Resizable/Resizable.jsx +4 -4
  105. package/components/ScrollArea/ScrollArea.d.ts +1 -1
  106. package/components/ScrollArea/ScrollArea.jsx +11 -11
  107. package/components/Select/Select.d.ts +3 -2
  108. package/components/Select/Select.jsx +22 -22
  109. package/components/Skeleton/Skeleton.d.ts +1 -1
  110. package/components/StarBorder/StarBorder.d.ts +1 -2
  111. package/components/StarBorder/StarBorder.jsx +1 -1
  112. package/components/Switch/Switch.d.ts +2 -2
  113. package/components/Switch/Switch.jsx +9 -9
  114. package/components/Table/DataTable.d.ts +1 -1
  115. package/components/Table/DataTable.jsx +54 -54
  116. package/components/Table/Table.d.ts +1 -1
  117. package/components/Table/Table.jsx +7 -7
  118. package/components/Table/TableActionButton.d.ts +2 -2
  119. package/components/Table/TableActionButton.jsx +3 -3
  120. package/components/Table/TableBody.d.ts +1 -1
  121. package/components/Table/TableBody.jsx +4 -4
  122. package/components/Table/TableCell.d.ts +1 -1
  123. package/components/Table/TableCell.jsx +4 -4
  124. package/components/Table/TableFooter.d.ts +1 -1
  125. package/components/Table/TableFooter.jsx +2 -2
  126. package/components/Table/TableHead.d.ts +1 -1
  127. package/components/Table/TableHead.jsx +4 -4
  128. package/components/Table/TableHeader.d.ts +1 -1
  129. package/components/Table/TableHeader.jsx +10 -10
  130. package/components/Table/TableRow.d.ts +1 -1
  131. package/components/Table/TableRow.jsx +2 -2
  132. package/components/Tabs/Tabs.d.ts +2 -2
  133. package/components/Tabs/Tabs.jsx +6 -6
  134. package/components/TabsSwitcher/Tab.d.ts +1 -1
  135. package/components/TabsSwitcher/TabsSwitcher.d.ts +1 -1
  136. package/components/Text/Text.d.ts +1 -1
  137. package/components/Text/Text.jsx +1 -0
  138. package/components/Textarea/Textarea.d.ts +2 -2
  139. package/components/Textarea/Textarea.jsx +1 -1
  140. package/components/Tooltip/Tooltip.d.ts +1 -1
  141. package/components/Tooltip/Tooltip.jsx +12 -12
  142. package/components/VisibilityActivatedButton/VisibilityActivatedButton.d.ts +1 -1
  143. package/form.d.ts +4 -4
  144. package/form2.d.ts +1 -1
  145. package/form2.jsx +1 -0
  146. package/hooks/useDebounceEffect.d.ts +1 -1
  147. package/hooks/useDebouncedValue.d.ts +1 -1
  148. package/hooks/useDebouncedValue.js +1 -1
  149. package/hooks/useLagRadar.jsx +19 -19
  150. package/package.json +1 -2
  151. package/tsconfig.tsbuildinfo +1 -1
  152. package/types.d.ts +1 -1
  153. package/types.js +1 -1
  154. package/utils/UseState.d.ts +2 -3
  155. package/utils/csvBlobToJson.d.ts +1 -1
  156. package/utils/csvBlobToJson.js +0 -1
  157. package/utils/ms.d.ts +1 -1
  158. package/utils/ms.js +6 -6
  159. package/utils/preventDefault.d.ts +2 -1
  160. package/utils/recursiveChildrenMap.d.ts +1 -1
  161. package/utils/smoothScrollToHref.d.ts +1 -1
  162. package/utils/smoothScrollToHref.js +7 -3
  163. package/utils/stopPropagation.d.ts +2 -2
  164. package/utils/xlsxBlobToJson.d.ts +1 -1
  165. package/utils/xlsxBlobToJson.js +3 -0
@@ -1,10 +1,9 @@
1
- import { AppProps as NAppProps } from "next/app";
2
- import { NextComponentType, NextPageContext } from "next/dist/shared/lib/utils";
3
- import { ReactNode } from "react";
4
- type AppProps<LayoutProps = void> = Omit<NAppProps, "Component"> & {
1
+ import type { AppProps as NAppProps } from "next/app";
2
+ import type { NextComponentType, NextPageContext } from "next/dist/shared/lib/utils";
3
+ import type { ReactNode } from "react";
4
+ export type AppProps<LayoutProps = void> = Omit<NAppProps, "Component"> & {
5
5
  Component: NextComponentType<NextPageContext, any, any> & {
6
6
  getLayout: (children: ReactNode, props: LayoutProps) => ReactNode;
7
7
  layoutProps: LayoutProps;
8
8
  };
9
9
  };
10
- export default AppProps;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  declare function Accordion({ children, className, type, }: {
3
3
  children?: ReactNode;
4
4
  className?: string;
@@ -1,4 +1,4 @@
1
- import { DetailedHTMLProps, HTMLAttributes, ReactNode } from "react";
1
+ import type { DetailedHTMLProps, HTMLAttributes, ReactNode } from "react";
2
2
  declare const styles: {
3
3
  variants: {
4
4
  default: {
@@ -30,24 +30,24 @@ const icons = {
30
30
  };
31
31
  export default function Alert({ variant = "default", title, children, className, actions, ...props }) {
32
32
  const Icon = icons[variant];
33
- return (<div className={clsx("rounded-md p-4", styles.variants[variant].root, className)} {...props}>
34
- <div className="flex">
35
- <div className="shrink-0">
36
- <Icon className={clsx("h-5 w-5", styles.variants[variant].icon)} aria-hidden="true"/>
37
- </div>
38
- <div className="ml-3 flex w-full flex-col items-start justify-between sm:flex-row">
39
- <div>
40
- <h3 className={clsx("text-sm font-medium", styles.variants[variant].title)}>
41
- {title}
42
- </h3>
43
- {children && (<div className={clsx("mt-2 text-sm", styles.variants[variant].content)}>
44
- {children}
45
- </div>)}
46
- </div>
47
- {actions && (<Group className={clsx("-mx-4 -mb-2 mt-1 sm:-mx-2 sm:-my-2", styles.variants[variant].content)}>
48
- {actions}
49
- </Group>)}
50
- </div>
51
- </div>
33
+ return (<div className={clsx("rounded-md p-4", styles.variants[variant].root, className)} {...props}>
34
+ <div className="flex">
35
+ <div className="shrink-0">
36
+ <Icon className={clsx("h-5 w-5", styles.variants[variant].icon)} aria-hidden="true"/>
37
+ </div>
38
+ <div className="ml-3 flex w-full flex-col items-start justify-between sm:flex-row">
39
+ <div>
40
+ <h3 className={clsx("text-sm font-medium", styles.variants[variant].title)}>
41
+ {title}
42
+ </h3>
43
+ {children && (<div className={clsx("mt-2 text-sm", styles.variants[variant].content)}>
44
+ {children}
45
+ </div>)}
46
+ </div>
47
+ {actions && (<Group className={clsx("-mx-4 mt-1 -mb-2 sm:-mx-2 sm:-my-2", styles.variants[variant].content)}>
48
+ {actions}
49
+ </Group>)}
50
+ </div>
51
+ </div>
52
52
  </div>);
53
53
  }
@@ -1,4 +1,4 @@
1
- import { UnstyledAutocompleteProps } from "../Autocomplete/UnstyledAutocomplete";
1
+ import { type UnstyledAutocompleteProps } from "../Autocomplete/UnstyledAutocomplete";
2
2
  export type AutocompleteProps<T extends {
3
3
  _id: string;
4
4
  }> = UnstyledAutocompleteProps<T>;
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useState } from "react";
2
2
  import clsx from "../../utils/clsx";
3
- import UnstyledAutocomplete from "../Autocomplete/UnstyledAutocomplete";
3
+ import UnstyledAutocomplete, {} from "../Autocomplete/UnstyledAutocomplete";
4
4
  import Input from "../Input";
5
5
  const defaultMenuItemsClassName = "z-10 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-hidden dark:bg-zinc-800";
6
6
  export default function Autocomplete({ query: defaultQuery = "", onChangeQuery, emptyText = "No item found.", className, ...props }) {
@@ -17,7 +17,7 @@ export default function Autocomplete({ query: defaultQuery = "", onChangeQuery,
17
17
  }
18
18
  // eslint-disable-next-line react-hooks/exhaustive-deps
19
19
  }, [onChangeQuery, query]);
20
- return (<div className={clsx("relative", className)}>
21
- <UnstyledAutocomplete {...props} as={Input} query={query} onChangeQuery={setQuery} emptyTextClassName={clsx(defaultMenuItemsClassName, "p-4 text-sm text-zinc-500 dark:text-zinc-400 mt-1 absolute w-full")} optionsClassName={clsx(defaultMenuItemsClassName, "max-h-72 scroll-py-2 overflow-y-auto py-2 text-sm text-zinc-800 dark:text-zinc-200 absolute z-10 mt-1 w-full")} optionClassName={({ active }) => clsx("cursor-default select-none px-4 py-2 data-disabled:cursor-not-allowed data-disabled:opacity-50", active && "bg-primary-600 text-white")} emptyText={emptyText}/>
20
+ return (<div className={clsx("relative", className)}>
21
+ <UnstyledAutocomplete {...props} as={Input} query={query} onChangeQuery={setQuery} emptyTextClassName={clsx(defaultMenuItemsClassName, "p-4 text-sm text-zinc-500 dark:text-zinc-400 mt-1 absolute w-full")} optionsClassName={clsx(defaultMenuItemsClassName, "max-h-72 scroll-py-2 overflow-y-auto py-2 text-sm text-zinc-800 dark:text-zinc-200 absolute z-10 mt-1 w-full")} optionClassName={({ active }) => clsx("cursor-default select-none px-4 py-2 data-disabled:cursor-not-allowed data-disabled:opacity-50", active && "bg-primary-600 text-white")} emptyText={emptyText}/>
22
22
  </div>);
23
23
  }
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
- import Input, { UnstyledInputProps } from "../Input";
1
+ import { type ReactNode } from "react";
2
+ import Input, { type UnstyledInputProps } from "../Input";
3
3
  export interface UnstyledAutocompleteProps<T extends {
4
4
  _id: string;
5
5
  }> extends Omit<UnstyledInputProps<false>, "as" | "onSelect" | "inputClassName" | "innerClassName" | "value"> {
@@ -1,7 +1,7 @@
1
1
  import { Combobox } from "@headlessui/react";
2
2
  import Loading from "../Loading";
3
- import { useCallback, useEffect, useMemo, useState } from "react";
4
- import { defaultInputClassName, defaultLeadingInputClassName, defaultTrailingClassName, defaultTrailingInputClassName, UnstyledInput, } from "../Input";
3
+ import { useCallback, useEffect, useMemo, useState, } from "react";
4
+ import Input, { defaultInputClassName, defaultLeadingInputClassName, defaultTrailingClassName, defaultTrailingInputClassName, UnstyledInput, } from "../Input";
5
5
  import clsx from "../../utils/clsx";
6
6
  import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/20/solid";
7
7
  import { useUpdateEffect } from "react-use";
@@ -31,14 +31,13 @@ export default function UnstyledAutocomplete({ placeholder, emptyText, items = [
31
31
  .toLowerCase()
32
32
  .includes(query.toLowerCase()))), [filterFunction, filterProperty, items, query]);
33
33
  trailing = loading ? (<Loading />) : (trailing ||
34
- (!readOnly ? (<Combobox.Button className="pointer-events-auto -mr-1 flex items-center">
35
- <ChevronUpDownIcon className="h-5 w-5 text-zinc-400" aria-hidden="true"/>
34
+ (!readOnly ? (<Combobox.Button className="pointer-events-auto -mr-1 flex items-center">
35
+ <ChevronUpDownIcon className="h-5 w-5 text-zinc-400" aria-hidden="true"/>
36
36
  </Combobox.Button>) : undefined));
37
37
  const ComponentInput = as || UnstyledInput;
38
38
  const doRender = useCallback((item) => renderFunction ? renderFunction(item) : item[renderProperty], [renderFunction, renderProperty]);
39
39
  useUpdateEffect(() => {
40
40
  onSelect?.(selectedItem);
41
- // eslint-disable-next-line react-hooks/exhaustive-deps
42
41
  }, [selectedItem]);
43
42
  useEffect(() => {
44
43
  if (selectedItem !== value) {
@@ -46,28 +45,28 @@ export default function UnstyledAutocomplete({ placeholder, emptyText, items = [
46
45
  }
47
46
  // eslint-disable-next-line react-hooks/exhaustive-deps
48
47
  }, [value]);
49
- return (<Combobox onChange={setSelectedItem} value={selectedItem} nullable>
50
- {({ open }) => (<div>
51
- <div className="relative">
48
+ return (<Combobox onChange={setSelectedItem} value={selectedItem} nullable>
49
+ {({ open }) => (<div>
50
+ <div className="relative">
52
51
  <ComponentInput
53
52
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
54
- {...props} as={Combobox.Input} placeholder={placeholder} onChange={(event) => setQuery(event.target.value)} trailing={trailing} trailingClassName={clsx(defaultTrailingClassName, trailingClassName)} inputClassName={clsx(defaultInputClassName, inputElementClassName)} innerClassName={inputInnerClassName} trailingInputClassName={clsx(defaultTrailingInputClassName, trailingInputClassName)} leadingInputClassName={clsx(defaultLeadingInputClassName, leadingInputClassName)} displayValue={displayValue} readOnly={readOnly}/>
55
- </div>
56
-
57
- {filteredItems.length > 0 && !readOnly && (<Combobox.Options static={isStatic} className={optionsClassName}>
53
+ {...props} as={Combobox.Input} placeholder={placeholder} onChange={(event) => setQuery(event.target.value)} trailing={trailing} trailingClassName={clsx(defaultTrailingClassName, trailingClassName)} inputClassName={clsx(defaultInputClassName, inputElementClassName)} innerClassName={inputInnerClassName} trailingInputClassName={clsx(defaultTrailingInputClassName, trailingInputClassName)} leadingInputClassName={clsx(defaultLeadingInputClassName, leadingInputClassName)} displayValue={displayValue} readOnly={readOnly}/>
54
+ </div>
55
+
56
+ {filteredItems.length > 0 && !readOnly && (<Combobox.Options static={isStatic} className={optionsClassName}>
58
57
  {(itemsRenderLimit
59
58
  ? take(filteredItems, itemsRenderLimit)
60
- : filteredItems).map((item) => (<Combobox.Option key={item._id} value={item} className={({ active, selected }) => clsx("flex gap-2", optionClassName && optionClassName({ active, selected }))} disabled={disabledItems?.includes(item._id)} data-disabled={disabledItems?.includes(item._id) ? "" : undefined}>
61
- {({ selected, active }) => (<>
62
- {selected ? (<span className={clsx("flex items-center", active ? "text-white" : "text-primary-500")}>
63
- <CheckIcon className="h-5 w-5" aria-hidden="true"/>
64
- </span>) : null}
65
- {doRender(item)}
66
- </>)}
67
- </Combobox.Option>))}
68
- </Combobox.Options>)}
69
-
70
- {open && emptyText && query !== "" && filteredItems.length === 0 && (<p className={emptyTextClassName}>{emptyText}</p>)}
71
- </div>)}
59
+ : filteredItems).map((item) => (<Combobox.Option key={item._id} value={item} className={({ active, selected }) => clsx("flex gap-2", optionClassName && optionClassName({ active, selected }))} disabled={disabledItems?.includes(item._id)} data-disabled={disabledItems?.includes(item._id) ? "" : undefined}>
60
+ {({ selected, active }) => (<>
61
+ {selected ? (<span className={clsx("flex items-center", active ? "text-white" : "text-primary-500")}>
62
+ <CheckIcon className="h-5 w-5" aria-hidden="true"/>
63
+ </span>) : null}
64
+ {doRender(item)}
65
+ </>)}
66
+ </Combobox.Option>))}
67
+ </Combobox.Options>)}
68
+
69
+ {open && emptyText && query !== "" && filteredItems.length === 0 && (<p className={emptyTextClassName}>{emptyText}</p>)}
70
+ </div>)}
72
71
  </Combobox>);
73
72
  }
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  declare const colorMap: {
3
3
  default: {
4
4
  badge: string;
@@ -1,6 +1,7 @@
1
1
  import clsx from "../../utils/clsx";
2
2
  import Link from "next/link";
3
- import { useCallback } from "react";
3
+ import { useCallback, } from "react";
4
+ import preventDefault from "../../utils/preventDefault";
4
5
  const colorMap = {
5
6
  default: {
6
7
  badge: "bg-zinc-200 dark:bg-zinc-700 text-zinc-700 dark:text-zinc-100",
@@ -37,14 +38,14 @@ function Badge({ color = "default", size = "md", className, children, onActionCl
37
38
  e.preventDefault();
38
39
  onActionClick?.();
39
40
  }, [onActionClick]);
40
- return (<Component className={clsx("inline-flex items-center py-0.5 font-medium", sizeMap.badge[size], colorMap[color].badge, className)} href={href} shallow={shallow} onClick={onClick} {...props}>
41
- {children}
42
- {onActionClick && (<button type="button" className={clsx("ml-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full focus:text-white focus:outline-hidden", sizeMap.button[size], colorMap[color].button)} onClick={handleActionClick}>
43
- <span className="sr-only">Delete</span>
44
- <svg className="h-2 w-2" stroke="currentColor" fill="none" viewBox="0 0 8 8">
45
- <path strokeLinecap="round" strokeWidth="1.5" d="M1 1l6 6m0-6L1 7"/>
46
- </svg>
47
- </button>)}
41
+ return (<Component className={clsx("inline-flex items-center py-0.5 font-medium", sizeMap.badge[size], colorMap[color].badge, className)} href={href} shallow={shallow} onClick={onClick} {...props}>
42
+ {children}
43
+ {onActionClick && (<div className={clsx("ml-1 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full focus:text-white focus:outline-hidden", sizeMap.button[size], colorMap[color].button)} onClick={handleActionClick} onPointerDown={preventDefault}>
44
+ <span className="sr-only">Remove</span>
45
+ <svg className="h-2 w-2" stroke="currentColor" fill="none" viewBox="0 0 8 8">
46
+ <path strokeLinecap="round" strokeWidth="1.5" d="M1 1l6 6m0-6L1 7"/>
47
+ </svg>
48
+ </div>)}
48
49
  </Component>);
49
50
  }
50
51
  export default Badge;
@@ -1,4 +1,4 @@
1
- import { ReactElement } from "react";
1
+ import type { ReactElement } from "react";
2
2
  type BaseBreadcrumbPage = {
3
3
  href?: string;
4
4
  loading?: boolean;
@@ -1,5 +1,5 @@
1
- import { UnstyledButtonProps } from "./UnstyledButton";
2
- import { ReactElement, Ref } from "react";
1
+ import { type UnstyledButtonProps } from "./UnstyledButton";
2
+ import { type ReactElement, type Ref } from "react";
3
3
  declare const styles: {
4
4
  root: string;
5
5
  variant: {
@@ -1,4 +1,4 @@
1
- import UnstyledButton from "./UnstyledButton";
1
+ import UnstyledButton, {} from "./UnstyledButton";
2
2
  import clsx from "../../utils/clsx";
3
3
  import { cloneElement } from "react";
4
4
  import Loading from "../Loading";
@@ -102,11 +102,11 @@ const Button = ({ variant = "outlined", color = "default", size = "md", classNam
102
102
  }
103
103
  return (<UnstyledButton {...props} className={clsx(styles.root, styles.variant[variant], variant !== "custom" && styles.color[color], variant !== "custom" && styles.variantColor[`${variant}-${color}`], icon ? styles.icon[size].button : styles.size[size].button, rounded ? "rounded-full" : "rounded-sm", {
104
104
  [styles.disabled]: disabled,
105
- }, className)} type={type} disabled={disabled}>
105
+ }, className)} type={type} disabled={disabled}>
106
106
  {leading &&
107
107
  cloneElement(leading, {
108
108
  className: clsx(styles.icon[size].icon, styles.icon[size].leading, leading?.props?.className, leadingClassName),
109
- })}
109
+ })}
110
110
  {!icon
111
111
  ? children
112
112
  : Array.isArray(children)
@@ -119,11 +119,11 @@ const Button = ({ variant = "outlined", color = "default", size = "md", classNam
119
119
  return cloneElement(child, {
120
120
  className: clsx(styles.icon[size].icon, child?.props?.className),
121
121
  });
122
- })()}
122
+ })()}
123
123
  {trailing &&
124
124
  cloneElement(trailing, {
125
125
  className: clsx(styles.icon[size].icon, styles.icon[size].trailing, trailing?.props?.className, trailingClassName),
126
- })}
126
+ })}
127
127
  </UnstyledButton>);
128
128
  };
129
129
  export default Button;
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
- import { EmblaOptionsType, EmblaPluginType } from "embla-carousel";
1
+ import { type ReactNode } from "react";
2
+ import type { EmblaOptionsType, EmblaPluginType } from "embla-carousel";
3
3
  export type CarouselProps = {
4
4
  children?: ReactNode;
5
5
  carouselClassName?: string;
@@ -30,23 +30,23 @@ export default function Carousel({ children, className, carouselClassName, navig
30
30
  }
31
31
  };
32
32
  }, [embla, width, height]);
33
- return (<div data-axis={options.axis}>
34
- <div className={clsx("overflow-hidden", className)} ref={mergeRefs([ref, emblaRef])}>
35
- <div className={clsx("flex", carouselClassName)}>{children}</div>
36
- {navigation && (<div className="flex h-full">
33
+ return (<div data-axis={options.axis}>
34
+ <div className={clsx("overflow-hidden", className)} ref={mergeRefs([ref, emblaRef])}>
35
+ <div className={clsx("flex", carouselClassName)}>{children}</div>
36
+ {navigation && (<div className="flex h-full">
37
37
  <Button icon variant="text" className={clsx({
38
38
  hidden: !canScrollPrev,
39
- })} disabled={!canScrollPrev} onClick={() => embla?.scrollPrev()}>
40
- <ChevronLeftIcon />
41
- </Button>
42
- <div className="grow"/>
39
+ })} disabled={!canScrollPrev} onClick={() => embla?.scrollPrev()}>
40
+ <ChevronLeftIcon />
41
+ </Button>
42
+ <div className="grow"/>
43
43
  <Button icon variant="text" className={clsx({
44
44
  hidden: !canScrollNext,
45
- })} disabled={!canScrollNext} onClick={() => embla?.scrollNext()}>
46
- <ChevronRightIcon />
47
- </Button>
48
- </div>)}
49
- </div>
45
+ })} disabled={!canScrollNext} onClick={() => embla?.scrollNext()}>
46
+ <ChevronRightIcon />
47
+ </Button>
48
+ </div>)}
49
+ </div>
50
50
  </div>);
51
51
  }
52
52
  Carousel.Slide = CarouselSlide;
@@ -1,4 +1,4 @@
1
- import { DetailedHTMLProps, InputHTMLAttributes, ReactNode } from "react";
1
+ import { type DetailedHTMLProps, type InputHTMLAttributes, type ReactNode } from "react";
2
2
  export type CheckboxProps = {
3
3
  label?: ReactNode;
4
4
  description?: ReactNode;
@@ -28,18 +28,18 @@ function Checkbox({ id, label, description, className, labelClassName, descripti
28
28
  innerRef.current.indeterminate = !!indeterminate;
29
29
  }
30
30
  }, [indeterminate]);
31
- return (<div className={clsx("relative flex items-start", className)}>
32
- <div className="flex h-5 items-center">
33
- <input {...props} id={id} aria-describedby={descriptionId} type={type} className={inputClassName} ref={mergeRefs([ref, innerRef])}/>
34
- </div>
35
- {(label || description) && (<div className={clsx("ml-3 text-sm", labelOuterClassName)}>
36
- {label && (<label htmlFor={id} className={labelClassName}>
37
- {label}
38
- </label>)}
39
- {description && (<p id={descriptionId} className={descriptionClassName}>
40
- {description}
41
- </p>)}
42
- </div>)}
31
+ return (<div className={clsx("relative flex items-start", className)}>
32
+ <div className="flex h-5 items-center">
33
+ <input {...props} id={id} aria-describedby={descriptionId} type={type} className={inputClassName} ref={mergeRefs([ref, innerRef])}/>
34
+ </div>
35
+ {(label || description) && (<div className={clsx("ml-3 text-sm", labelOuterClassName)}>
36
+ {label && (<label htmlFor={id} className={labelClassName}>
37
+ {label}
38
+ </label>)}
39
+ {description && (<p id={descriptionId} className={descriptionClassName}>
40
+ {description}
41
+ </p>)}
42
+ </div>)}
43
43
  </div>);
44
44
  }
45
45
  export default Checkbox;
@@ -1,4 +1,4 @@
1
- import { Language, PrismTheme } from "prism-react-renderer";
1
+ import { type Language, type PrismTheme } from "prism-react-renderer";
2
2
  export type CodeProps = {
3
3
  children: string;
4
4
  language: Language;
@@ -1,25 +1,25 @@
1
1
  import { Fragment } from "react";
2
- import { Highlight } from "prism-react-renderer";
2
+ import { Highlight, } from "prism-react-renderer";
3
3
  import clsx from "../../utils/clsx";
4
4
  import CopyButton from "../CopyButton";
5
5
  export default function Code({ children, language, className, copy, copyText, copiedText, theme, copyClassName, }) {
6
6
  return (<div className={clsx("group relative", className, {
7
7
  dark: !theme,
8
- })}>
9
- <div className="prose max-w-none">
10
- <Highlight code={children.trimEnd()} language={language} theme={theme}>
11
- {({ className, style, tokens, getTokenProps }) => (<pre className={className} style={style}>
12
- <code>
13
- {tokens.map((line, lineIndex) => (<Fragment key={lineIndex}>
8
+ })}>
9
+ <div className="prose max-w-none">
10
+ <Highlight code={children.trimEnd()} language={language} theme={theme}>
11
+ {({ className, style, tokens, getTokenProps }) => (<pre className={className} style={style}>
12
+ <code>
13
+ {tokens.map((line, lineIndex) => (<Fragment key={lineIndex}>
14
14
  {line
15
15
  .filter((token) => !token.empty)
16
- .map((token, tokenIndex) => (<span key={tokenIndex} {...getTokenProps({ token })}/>))}
17
- {"\n"}
18
- </Fragment>))}
19
- </code>
20
- </pre>)}
21
- </Highlight>
22
- </div>
23
- {copy && (<CopyButton text={children} copyText={copyText} copiedText={copiedText} className={copyClassName}/>)}
16
+ .map((token, tokenIndex) => (<span key={tokenIndex} {...getTokenProps({ token })}/>))}
17
+ {"\n"}
18
+ </Fragment>))}
19
+ </code>
20
+ </pre>)}
21
+ </Highlight>
22
+ </div>
23
+ {copy && (<CopyButton text={children} copyText={copyText} copiedText={copiedText} className={copyClassName}/>)}
24
24
  </div>);
25
25
  }
@@ -1,6 +1,6 @@
1
- import { MenuProps } from "../Menu/Menu";
2
- import { ReactNode } from "react";
3
- import { ButtonProps } from "../Button";
1
+ import { type MenuProps } from "../Menu/Menu";
2
+ import type { ReactNode } from "react";
3
+ import { type ButtonProps } from "../Button";
4
4
  export type ConfirmationButtonProps = {
5
5
  confirmation: string;
6
6
  label: ReactNode;
@@ -1,13 +1,13 @@
1
- import Menu from "../Menu/Menu";
2
- import Button from "../Button";
1
+ import Menu, {} from "../Menu/Menu";
2
+ import Button, {} from "../Button";
3
3
  export default function ConfirmationButton({ label, confirm, confirmation, onConfirm, loading, className, cancel = "Cancel", position, buttonClassName, buttonProps, menuProps, }) {
4
- return (<Menu position={position} button={<Button color="error" loading={loading} className={buttonClassName} {...buttonProps}>
5
- {label}
6
- </Button>} className={className} {...menuProps}>
7
- <Menu.Label>{confirmation}</Menu.Label>
8
- <Menu.Item className="text-red-500!" onClick={onConfirm}>
9
- {confirm || label}
10
- </Menu.Item>
11
- <Menu.Item>{cancel}</Menu.Item>
4
+ return (<Menu position={position} button={<Button color="error" loading={loading} className={buttonClassName} {...buttonProps}>
5
+ {label}
6
+ </Button>} className={className} {...menuProps}>
7
+ <Menu.Label>{confirmation}</Menu.Label>
8
+ <Menu.Item className="text-red-500!" onClick={onConfirm}>
9
+ {confirm || label}
10
+ </Menu.Item>
11
+ <Menu.Item>{cancel}</Menu.Item>
12
12
  </Menu>);
13
13
  }
@@ -1,4 +1,4 @@
1
- import React, { ComponentProps } from "react";
1
+ import React, { type ComponentProps } from "react";
2
2
  import * as RContextMenu from "@radix-ui/react-context-menu";
3
3
  declare function ContextMenuContent({ className, children, ...props }: ComponentProps<typeof RContextMenu.Content>): React.JSX.Element;
4
4
  declare function ContextMenuSeparator({ className, ...props }: ComponentProps<typeof RContextMenu.Separator>): React.JSX.Element;
@@ -7,10 +7,10 @@ import { dropdownCheckboxItemClassName, dropdownItemClassName, dropdownItemIndic
7
7
  import { modalContentClassName } from "../../styles/Modal.classNames";
8
8
  import { ChevronRightIcon } from "@heroicons/react/20/solid";
9
9
  function ContextMenuContent({ className, children, ...props }) {
10
- return (<RContextMenu.Portal>
11
- <RContextMenu.Content {...props} className={clsx(modalContentClassName, "ui-context-menu-content", className)}>
12
- {children}
13
- </RContextMenu.Content>
10
+ return (<RContextMenu.Portal>
11
+ <RContextMenu.Content {...props} className={clsx(modalContentClassName, "ui-context-menu-content", className)}>
12
+ {children}
13
+ </RContextMenu.Content>
14
14
  </RContextMenu.Portal>);
15
15
  }
16
16
  function ContextMenuSeparator({ className, ...props }) {
@@ -20,39 +20,39 @@ function ContextMenuItem({ className, href, ...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 } : {})}>
24
- <RContextMenu.Item {...props} className={clsx(dropdownItemClassName, "ui-context-menu-item", className)}/>
23
+ <Wrapper {...(href ? { href } : {})}>
24
+ <RContextMenu.Item {...props} className={clsx(dropdownItemClassName, "ui-context-menu-item", className)}/>
25
25
  </Wrapper>);
26
26
  }
27
27
  function ContextMenuItemIndicator({ className, ...props }) {
28
28
  return (<RContextMenu.ItemIndicator className={clsx(dropdownItemIndicatorClassName, "ui-context-menu-checkbox-item-indicator", className)} {...props}/>);
29
29
  }
30
30
  function ContextMenuCheckboxItem({ className, children, indicatorClassName, ...props }) {
31
- return (<RContextMenu.CheckboxItem {...props} className={clsx(dropdownCheckboxItemClassName, "ui-context-menu-checkbox-item", className)}>
32
- <ContextMenuItemIndicator className={clsx("ui-context-menu-checkbox-item-indicator", indicatorClassName)}>
33
- <CheckIcon />
34
- </ContextMenuItemIndicator>
35
- {children}
31
+ return (<RContextMenu.CheckboxItem {...props} className={clsx(dropdownCheckboxItemClassName, "ui-context-menu-checkbox-item", className)}>
32
+ <ContextMenuItemIndicator className={clsx("ui-context-menu-checkbox-item-indicator", indicatorClassName)}>
33
+ <CheckIcon />
34
+ </ContextMenuItemIndicator>
35
+ {children}
36
36
  </RContextMenu.CheckboxItem>);
37
37
  }
38
38
  function ContextMenuSubContent({ className, children, sideOffset = 2, alignOffset = -4, ...props }) {
39
- return (<RContextMenu.Portal>
40
- <RContextMenu.SubContent sideOffset={sideOffset} alignOffset={alignOffset} {...props} className={clsx(modalContentClassName, "ui-context-menu-sub-content", className)}>
41
- {children}
42
- </RContextMenu.SubContent>
39
+ return (<RContextMenu.Portal>
40
+ <RContextMenu.SubContent sideOffset={sideOffset} alignOffset={alignOffset} {...props} className={clsx(modalContentClassName, "ui-context-menu-sub-content", className)}>
41
+ {children}
42
+ </RContextMenu.SubContent>
43
43
  </RContextMenu.Portal>);
44
44
  }
45
45
  function ContextMenuSubTrigger({ className, href, children, ...props }) {
46
46
  const Wrapper = href ? Link : Fragment;
47
47
  return (
48
48
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
- <Wrapper {...(href ? { href } : {})}>
50
- <RContextMenu.SubTrigger {...props} className={clsx(dropdownSubTriggerClassName, "ui-context-menu-sub-trigger", className)}>
51
- {children}
52
- <div className={clsx("absolute right-1.5 top-1.5 inline-flex items-center justify-center", "[&>svg]:h-4 [&>svg]:w-4")}>
53
- <ChevronRightIcon />
54
- </div>
55
- </RContextMenu.SubTrigger>
49
+ <Wrapper {...(href ? { href } : {})}>
50
+ <RContextMenu.SubTrigger {...props} className={clsx(dropdownSubTriggerClassName, "ui-context-menu-sub-trigger", className)}>
51
+ {children}
52
+ <div className={clsx("absolute top-1.5 right-1.5 inline-flex items-center justify-center", "[&>svg]:h-4 [&>svg]:w-4")}>
53
+ <ChevronRightIcon />
54
+ </div>
55
+ </RContextMenu.SubTrigger>
56
56
  </Wrapper>);
57
57
  }
58
58
  const ContextMenu = {
@@ -1,4 +1,4 @@
1
- import { InputProps } from "../Input";
1
+ import { type InputProps } from "../Input";
2
2
  declare function DateInput({ readOnly, value, onValueChange, ref, ...props }: Omit<InputProps<false>, "value"> & {
3
3
  value?: string;
4
4
  onValueChange?: (value?: string) => void;
@@ -1,5 +1,5 @@
1
1
  import { useMemo } from "react";
2
- import Input from "../Input";
2
+ import Input, {} from "../Input";
3
3
  import { CalendarIcon } from "@heroicons/react/20/solid";
4
4
  import { useRefValue } from "./useRefValue";
5
5
  import dayjs from "dayjs";
@@ -1,3 +1,3 @@
1
- import { InputProps } from "../Input";
1
+ import { type InputProps } from "../Input";
2
2
  declare function DateTimeInput({ readOnly, ref, ...props }: InputProps<false>): import("react").JSX.Element;
3
3
  export default DateTimeInput;
@@ -1,4 +1,4 @@
1
- import Input from "../Input";
1
+ import Input, {} from "../Input";
2
2
  import { CalendarIcon } from "@heroicons/react/20/solid";
3
3
  import { useRefValue } from "./useRefValue";
4
4
  function DateTimeInput({ readOnly, ref, ...props }) {
@@ -1,4 +1,4 @@
1
- import { Ref } from "react";
1
+ import { type Ref } from "react";
2
2
  import "dayjs/locale/pt-br";
3
3
  export declare function parseDate(value: string): string;
4
4
  export declare function formatDate(value: string): string;
@@ -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, }: {