@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.
- package/bootstrap/AppProps.d.ts +4 -5
- package/components/Accordion/Accordion.d.ts +1 -1
- package/components/Alert/Alert.d.ts +1 -1
- package/components/Alert/Alert.jsx +19 -19
- package/components/Autocomplete/Autocomplete.d.ts +1 -1
- package/components/Autocomplete/Autocomplete.jsx +3 -3
- package/components/Autocomplete/UnstyledAutocomplete.d.ts +2 -2
- package/components/Autocomplete/UnstyledAutocomplete.jsx +23 -24
- package/components/Badge/Badge.d.ts +1 -1
- package/components/Badge/Badge.jsx +9 -9
- package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/components/Button/Button.d.ts +2 -2
- package/components/Button/Button.jsx +5 -5
- package/components/Carousel/Carousel.d.ts +2 -2
- package/components/Carousel/Carousel.jsx +13 -13
- package/components/Checkbox/Checkbox.d.ts +1 -1
- package/components/Checkbox/Checkbox.jsx +12 -12
- package/components/Code/Code.d.ts +1 -1
- package/components/Code/Code.jsx +15 -15
- package/components/ConfirmationButton/ConfirmationButton.d.ts +3 -3
- package/components/ConfirmationButton/ConfirmationButton.jsx +10 -10
- package/components/ContextMenu/ContextMenu.d.ts +1 -1
- package/components/ContextMenu/ContextMenu.jsx +22 -22
- package/components/DateInput/DateInput.d.ts +1 -1
- package/components/DateInput/DateInput.jsx +1 -1
- package/components/DateInput/DateTimeInput.d.ts +1 -1
- package/components/DateInput/DateTimeInput.jsx +1 -1
- package/components/DateInput/useRefValue.d.ts +1 -1
- package/components/DatePicker/DatePicker.d.ts +3 -3
- package/components/DatePicker/DatePicker.jsx +8 -8
- package/components/DateRangePicker/DateRangePicker.d.ts +2 -2
- package/components/DateRangePicker/DateRangePicker.jsx +8 -8
- package/components/Dialog/Dialog.d.ts +2 -2
- package/components/Dialog/Dialog.jsx +23 -23
- package/components/Dialog/Dialogs.jsx +4 -4
- package/components/Dialog/dialogs.state.d.ts +2 -2
- package/components/Drawer/Drawer.d.ts +1 -1
- package/components/Drawer/Drawer.jsx +41 -41
- package/components/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/components/DropdownMenu/DropdownMenu.jsx +23 -23
- package/components/ErrorBoundary/ErrorBoundary.d.ts +1 -1
- package/components/ErrorBoundary/ErrorBoundary.jsx +4 -4
- package/components/ErrorPage/ErrorPage.d.ts +1 -1
- package/components/ErrorPage/ErrorPage.jsx +16 -16
- package/components/FileInput/FileInput.d.ts +4 -4
- package/components/FileInput/FileInput.jsx +2 -2
- package/components/FileInput/PreviewFile.d.ts +2 -2
- package/components/FileSelect/FileSelect.d.ts +1 -1
- package/components/Footer/Footer.d.ts +1 -1
- package/components/Footer/Footer.jsx +22 -22
- package/components/GridPattern/GridPattern.d.ts +1 -1
- package/components/GridPattern/GridPattern.jsx +7 -7
- package/components/Header/Header.d.ts +1 -1
- package/components/Header/Header.jsx +2 -2
- package/components/ImageInput/ImageInput.d.ts +1 -1
- package/components/Input/Input.d.ts +1 -1
- package/components/Input/Input.jsx +7 -7
- package/components/Input/InputIcon.d.ts +1 -1
- package/components/Input/MultiSelectInput.d.ts +2 -2
- package/components/Input/MultiSelectInput.jsx +15 -15
- package/components/Input/NumericInput.d.ts +3 -3
- package/components/Input/NumericInput.jsx +1 -1
- package/components/Input/PatternInput.d.ts +3 -3
- package/components/Input/PatternInput.jsx +1 -1
- package/components/Input/UnstyledInput.d.ts +1 -1
- package/components/Input/UnstyledInput.jsx +12 -12
- package/components/Input2/InputWrapper.d.ts +1 -1
- package/components/Input2/InputWrapper.jsx +7 -7
- package/components/Link/Link.d.ts +1 -1
- package/components/Magnet/Magnet.d.ts +1 -1
- package/components/Markdown/Markdown.d.ts +1 -1
- package/components/Markdown/Markdown.jsx +1 -1
- package/components/Menu/Menu.d.ts +3 -3
- package/components/Menu/Menu.jsx +19 -19
- package/components/Modal/Modal.d.ts +1 -1
- package/components/Modal/Modal.jsx +26 -26
- package/components/ModeToggle/ModeToggle.d.ts +1 -1
- package/components/ModeToggle/ModeToggle.jsx +3 -3
- package/components/MultiSelect/MultiSelect.d.ts +2 -2
- package/components/MultiSelect/MultiSelect.jsx +2 -2
- package/components/MultiSelect/MultiSelectInput.d.ts +1 -1
- package/components/MultiText/MultiText.d.ts +1 -1
- package/components/MultiText/MultiText.jsx +0 -1
- package/components/NavigationDrawer/NavigationDrawer.d.ts +1 -1
- package/components/NavigationDrawer/NavigationDrawer.jsx +11 -11
- package/components/NavigationDrawer/NavigationItem.d.ts +1 -1
- package/components/NavigationDrawer/NavigationItem.jsx +2 -2
- package/components/NoSsr/NoSsr.d.ts +1 -1
- package/components/Notifications/Notifications.jsx +29 -29
- package/components/Notifications/notifications.state.d.ts +2 -2
- package/components/Notifications/notifications.state.js +1 -1
- package/components/Pagination/Pagination.jsx +15 -15
- package/components/Particles/Particles.jsx +55 -55
- package/components/PictureCropInput/PictureCropInput.d.ts +2 -2
- package/components/PictureCropInput/PictureCropInput.jsx +39 -39
- package/components/PictureCropInput/canvasPreview.d.ts +1 -1
- package/components/Popover/Popover.d.ts +1 -1
- package/components/Popover/Popover.jsx +6 -6
- package/components/Resizable/Resizable.d.ts +1 -1
- package/components/Resizable/Resizable.jsx +4 -4
- package/components/ScrollArea/ScrollArea.d.ts +1 -1
- package/components/ScrollArea/ScrollArea.jsx +11 -11
- package/components/Select/Select.d.ts +1 -1
- package/components/Select/Select.jsx +21 -21
- package/components/Skeleton/Skeleton.d.ts +1 -1
- package/components/StarBorder/StarBorder.d.ts +1 -2
- package/components/StarBorder/StarBorder.jsx +1 -1
- package/components/Switch/Switch.d.ts +2 -2
- package/components/Switch/Switch.jsx +9 -9
- package/components/Table/DataTable.d.ts +1 -1
- package/components/Table/DataTable.jsx +54 -54
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.jsx +7 -7
- package/components/Table/TableActionButton.d.ts +2 -2
- package/components/Table/TableActionButton.jsx +3 -3
- package/components/Table/TableBody.d.ts +1 -1
- package/components/Table/TableBody.jsx +4 -4
- package/components/Table/TableCell.d.ts +1 -1
- package/components/Table/TableCell.jsx +4 -4
- package/components/Table/TableFooter.d.ts +1 -1
- package/components/Table/TableFooter.jsx +2 -2
- package/components/Table/TableHead.d.ts +1 -1
- package/components/Table/TableHead.jsx +4 -4
- package/components/Table/TableHeader.d.ts +1 -1
- package/components/Table/TableHeader.jsx +10 -10
- package/components/Table/TableRow.d.ts +1 -1
- package/components/Table/TableRow.jsx +2 -2
- package/components/Tabs/Tabs.d.ts +2 -2
- package/components/Tabs/Tabs.jsx +6 -6
- package/components/TabsSwitcher/Tab.d.ts +1 -1
- package/components/TabsSwitcher/TabsSwitcher.d.ts +1 -1
- package/components/Text/Text.d.ts +1 -1
- package/components/Text/Text.jsx +1 -0
- package/components/Textarea/Textarea.d.ts +2 -2
- package/components/Textarea/Textarea.jsx +1 -1
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.jsx +12 -12
- package/components/VisibilityActivatedButton/VisibilityActivatedButton.d.ts +1 -1
- package/form.d.ts +4 -4
- package/form2.d.ts +1 -1
- package/form2.jsx +1 -0
- package/hooks/useDebounceEffect.d.ts +1 -1
- package/hooks/useDebouncedValue.d.ts +1 -1
- package/hooks/useDebouncedValue.js +1 -1
- package/hooks/useLagRadar.jsx +19 -19
- package/package.json +1 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/types.d.ts +1 -1
- package/types.js +1 -1
- package/utils/UseState.d.ts +2 -3
- package/utils/csvBlobToJson.d.ts +1 -1
- package/utils/csvBlobToJson.js +0 -1
- package/utils/ms.d.ts +1 -1
- package/utils/ms.js +6 -6
- package/utils/recursiveChildrenMap.d.ts +1 -1
- package/utils/smoothScrollToHref.d.ts +1 -1
- package/utils/smoothScrollToHref.js +7 -3
- package/utils/stopPropagation.d.ts +1 -1
- package/utils/xlsxBlobToJson.d.ts +1 -1
- package/utils/xlsxBlobToJson.js +3 -0
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import Input from "./Input";
|
|
1
|
+
import Input, {} from "./Input";
|
|
2
2
|
import DropdownMenu from "../DropdownMenu";
|
|
3
3
|
import Button from "../Button";
|
|
4
4
|
import { ChevronDownIcon } from "@heroicons/react/16/solid";
|
|
5
5
|
import { xor } from "lodash-es";
|
|
6
6
|
function MultiSelectInput({ options, value, onChange, emptyLabel = "None", ref, ...props }) {
|
|
7
|
-
return (<DropdownMenu.Root>
|
|
8
|
-
<DropdownMenu.Trigger asChild>
|
|
9
|
-
<Input as={Button} {...props} ref={ref} trailing={<ChevronDownIcon />} inputClassName="text-left dark:hover:bg-zinc-700/70">
|
|
7
|
+
return (<DropdownMenu.Root>
|
|
8
|
+
<DropdownMenu.Trigger asChild>
|
|
9
|
+
<Input as={Button} {...props} ref={ref} trailing={<ChevronDownIcon />} inputClassName="text-left dark:hover:bg-zinc-700/70">
|
|
10
10
|
{value?.length
|
|
11
11
|
? options
|
|
12
12
|
.map((project) => value.includes(project.value) ? project.name : null)
|
|
13
13
|
.filter(Boolean)
|
|
14
14
|
.join(", ")
|
|
15
|
-
: emptyLabel}
|
|
16
|
-
</Input>
|
|
17
|
-
</DropdownMenu.Trigger>
|
|
18
|
-
<DropdownMenu.Content>
|
|
19
|
-
<DropdownMenu.Item onClick={() => onChange?.([])}>
|
|
20
|
-
{emptyLabel}
|
|
21
|
-
</DropdownMenu.Item>
|
|
22
|
-
{options.map((options) => (<DropdownMenu.CheckboxItem key={options.name} checked={value?.includes(options.value)} onClick={() => onChange?.(xor(value, [options.value]))}>
|
|
23
|
-
{options.name}
|
|
24
|
-
</DropdownMenu.CheckboxItem>))}
|
|
25
|
-
</DropdownMenu.Content>
|
|
15
|
+
: emptyLabel}
|
|
16
|
+
</Input>
|
|
17
|
+
</DropdownMenu.Trigger>
|
|
18
|
+
<DropdownMenu.Content>
|
|
19
|
+
<DropdownMenu.Item onClick={() => onChange?.([])}>
|
|
20
|
+
{emptyLabel}
|
|
21
|
+
</DropdownMenu.Item>
|
|
22
|
+
{options.map((options) => (<DropdownMenu.CheckboxItem key={options.name} checked={value?.includes(options.value)} onClick={() => onChange?.(xor(value, [options.value]))}>
|
|
23
|
+
{options.name}
|
|
24
|
+
</DropdownMenu.CheckboxItem>))}
|
|
25
|
+
</DropdownMenu.Content>
|
|
26
26
|
</DropdownMenu.Root>);
|
|
27
27
|
}
|
|
28
28
|
export default MultiSelectInput;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ComponentProps } from "react";
|
|
2
|
-
import { InputProps } from "./Input";
|
|
3
|
-
import { NumericFormatProps } from "react-number-format";
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { type InputProps } from "./Input";
|
|
3
|
+
import { type NumericFormatProps } from "react-number-format";
|
|
4
4
|
declare function NumericInput({ ref, ...props }: Omit<NumericFormatProps, "customInput"> & InputProps<undefined>): import("react").JSX.Element;
|
|
5
5
|
export type NumericInputProps = ComponentProps<typeof NumericInput>;
|
|
6
6
|
export default NumericInput;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ComponentProps } from "react";
|
|
2
|
-
import { InputProps } from "./Input";
|
|
3
|
-
import { PatternFormatProps } from "react-number-format";
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { type InputProps } from "./Input";
|
|
3
|
+
import { type PatternFormatProps } from "react-number-format";
|
|
4
4
|
declare function PatternInput(props: Omit<PatternFormatProps, "customInput"> & InputProps<undefined>): import("react").JSX.Element;
|
|
5
5
|
export type PatternInputProps = ComponentProps<typeof PatternInput>;
|
|
6
6
|
export default PatternInput;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentType, DetailedHTMLProps, InputHTMLAttributes, ReactNode } from "react";
|
|
1
|
+
import { type ComponentType, type DetailedHTMLProps, type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
2
|
export type UnstyledInputCommonProps = {
|
|
3
3
|
label?: ReactNode;
|
|
4
4
|
inputClassName?: string;
|
|
@@ -9,20 +9,20 @@ function UnstyledInput({ id, label, className, inputClassName, labelClassName, h
|
|
|
9
9
|
}, trailingInputClassName && {
|
|
10
10
|
[trailingInputClassName]: !!trailing,
|
|
11
11
|
});
|
|
12
|
-
return (<div className={className}>
|
|
13
|
-
{label && (<label htmlFor={id} className={labelClassName}>
|
|
14
|
-
{label}
|
|
15
|
-
</label>)}
|
|
16
|
-
<div style={{ position: "relative" }} className={innerClassName}>
|
|
17
|
-
{leading && <div className={leadingClassName}>{leading}</div>}
|
|
12
|
+
return (<div className={className}>
|
|
13
|
+
{label && (<label htmlFor={id} className={labelClassName}>
|
|
14
|
+
{label}
|
|
15
|
+
</label>)}
|
|
16
|
+
<div style={{ position: "relative" }} className={innerClassName}>
|
|
17
|
+
{leading && <div className={leadingClassName}>{leading}</div>}
|
|
18
18
|
<Component
|
|
19
19
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20
|
-
{...props} className={inputClassName} id={id} type={type} value={value}>
|
|
21
|
-
{children}
|
|
22
|
-
</Component>
|
|
23
|
-
{trailing && <div className={trailingClassName}>{trailing}</div>}
|
|
24
|
-
</div>
|
|
25
|
-
{helpText && <div className={helpTextClassName}>{helpText}</div>}
|
|
20
|
+
{...props} className={inputClassName} id={id} type={type} value={value}>
|
|
21
|
+
{children}
|
|
22
|
+
</Component>
|
|
23
|
+
{trailing && <div className={trailingClassName}>{trailing}</div>}
|
|
24
|
+
</div>
|
|
25
|
+
{helpText && <div className={helpTextClassName}>{helpText}</div>}
|
|
26
26
|
</div>);
|
|
27
27
|
}
|
|
28
28
|
export default UnstyledInput;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import clsx from "../../utils/clsx";
|
|
2
2
|
export default function InputWrapper({ children, className, label, id, helpText, error, required, }) {
|
|
3
|
-
return (<div className={clsx("ui-input-wrapper", className)} data-error={error ? "" : undefined}>
|
|
4
|
-
{label && (<label htmlFor={id} className="ui-input-wrapper-label">
|
|
5
|
-
{label}
|
|
6
|
-
{required && <span className="text-red-500"> *</span>}
|
|
7
|
-
</label>)}
|
|
8
|
-
{children}
|
|
9
|
-
{helpText && <div className="ui-input-wrapper-help-text">{helpText}</div>}
|
|
3
|
+
return (<div className={clsx("ui-input-wrapper", className)} data-error={error ? "" : undefined}>
|
|
4
|
+
{label && (<label htmlFor={id} className="ui-input-wrapper-label">
|
|
5
|
+
{label}
|
|
6
|
+
{required && <span className="text-red-500"> *</span>}
|
|
7
|
+
</label>)}
|
|
8
|
+
{children}
|
|
9
|
+
{helpText && <div className="ui-input-wrapper-help-text">{helpText}</div>}
|
|
10
10
|
</div>);
|
|
11
11
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, ReactElement, ReactNode, Ref } from "react";
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactElement, type ReactNode, type Ref } from "react";
|
|
2
2
|
import Button from "../Button/Button";
|
|
3
|
-
import { UnstyledButtonProps } from "../Button/UnstyledButton";
|
|
4
|
-
import { TextProps } from "../Text";
|
|
3
|
+
import { type UnstyledButtonProps } from "../Button/UnstyledButton";
|
|
4
|
+
import { type TextProps } from "../Text";
|
|
5
5
|
export declare 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 type MenuProps = {
|
|
7
7
|
className?: string;
|
package/components/Menu/Menu.jsx
CHANGED
|
@@ -3,21 +3,21 @@ import { Menu as HuiMenu, Transition } from "@headlessui/react";
|
|
|
3
3
|
import { ChevronDownIcon } from "@heroicons/react/20/solid";
|
|
4
4
|
import clsx from "../../utils/clsx";
|
|
5
5
|
import Button from "../Button/Button";
|
|
6
|
-
import UnstyledButton from "../Button/UnstyledButton";
|
|
7
|
-
import Text from "../Text";
|
|
6
|
+
import UnstyledButton, {} from "../Button/UnstyledButton";
|
|
7
|
+
import Text, {} from "../Text";
|
|
8
8
|
import { useMount } from "react-use";
|
|
9
9
|
export const defaultMenuItemsClassName = "z-10 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-hidden dark:bg-zinc-800";
|
|
10
10
|
const Item = function MenuItem({ className, icon, children, ...props }) {
|
|
11
|
-
return (<HuiMenu.Item>
|
|
11
|
+
return (<HuiMenu.Item>
|
|
12
12
|
{({ active }) => (<UnstyledButton {...props} type="button" className={clsx("flex w-full items-center text-left", active
|
|
13
13
|
? "bg-zinc-100 text-zinc-900 dark:bg-zinc-700/50 dark:text-zinc-100"
|
|
14
|
-
: "text-zinc-700 dark:text-zinc-200", "block px-4 py-2 text-sm", className)}>
|
|
14
|
+
: "text-zinc-700 dark:text-zinc-200", "block px-4 py-2 text-sm", className)}>
|
|
15
15
|
{icon &&
|
|
16
16
|
cloneElement(icon, {
|
|
17
17
|
className: clsx("w-5 mr-2", icon.props.className),
|
|
18
|
-
})}
|
|
19
|
-
{children}
|
|
20
|
-
</UnstyledButton>)}
|
|
18
|
+
})}
|
|
19
|
+
{children}
|
|
20
|
+
</UnstyledButton>)}
|
|
21
21
|
</HuiMenu.Item>);
|
|
22
22
|
};
|
|
23
23
|
const Label = function MenuLabel(props) {
|
|
@@ -27,16 +27,16 @@ const Menu = function Menu({ className, iconClassName, position = "right", child
|
|
|
27
27
|
useMount(() => {
|
|
28
28
|
console.warn("<Menu> was deprecated and should be replaced with <DropdownMenu>");
|
|
29
29
|
});
|
|
30
|
-
return (<HuiMenu as="div" className={clsx("relative inline-block text-left", className)} {...props}>
|
|
31
|
-
<div>
|
|
30
|
+
return (<HuiMenu as="div" className={clsx("relative inline-block text-left", className)} {...props}>
|
|
31
|
+
<div>
|
|
32
32
|
{button ? (<HuiMenu.Button as={Fragment}>{button}</HuiMenu.Button>) : (<HuiMenu.Button
|
|
33
33
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
34
|
-
as={Button} className={clsx("flex w-full", buttonProps?.className)} trailing={<ChevronDownIcon className={iconClassName}/>} {...buttonProps}>
|
|
35
|
-
{label}
|
|
36
|
-
</HuiMenu.Button>)}
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
<Transition as={Fragment} enter="transition ease-out duration-100" enterFrom="transform opacity-0 scale-95" enterTo="transform opacity-100 scale-100" leave="transition ease-in duration-75" leaveFrom="transform opacity-100 scale-100" leaveTo="transform opacity-0 scale-95">
|
|
34
|
+
as={Button} className={clsx("flex w-full", buttonProps?.className)} trailing={<ChevronDownIcon className={iconClassName}/>} {...buttonProps}>
|
|
35
|
+
{label}
|
|
36
|
+
</HuiMenu.Button>)}
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<Transition as={Fragment} enter="transition ease-out duration-100" enterFrom="transform opacity-0 scale-95" enterTo="transform opacity-100 scale-100" leave="transition ease-in duration-75" leaveFrom="transform opacity-100 scale-100" leaveTo="transform opacity-0 scale-95">
|
|
40
40
|
<HuiMenu.Items unmount={unmount} className={clsx(defaultMenuItemsClassName, "absolute mt-2 min-w-[14rem]", {
|
|
41
41
|
"right-0": position.includes("right"),
|
|
42
42
|
"origin-top-right": position.includes("right") && !position.includes("bottom"),
|
|
@@ -45,10 +45,10 @@ const Menu = function Menu({ className, iconClassName, position = "right", child
|
|
|
45
45
|
"origin-bottom-left": position.includes("left") && position.includes("bottom"),
|
|
46
46
|
"left-0": position.includes("left"),
|
|
47
47
|
"bottom-0": position.includes("bottom"),
|
|
48
|
-
}, menuItemsClassName)}>
|
|
49
|
-
<div className="py-1">{children}</div>
|
|
50
|
-
</HuiMenu.Items>
|
|
51
|
-
</Transition>
|
|
48
|
+
}, menuItemsClassName)}>
|
|
49
|
+
<div className="py-1">{children}</div>
|
|
50
|
+
</HuiMenu.Items>
|
|
51
|
+
</Transition>
|
|
52
52
|
</HuiMenu>);
|
|
53
53
|
};
|
|
54
54
|
export default Object.assign(Menu, { Label, Item });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, CSSProperties, ReactElement, ReactNode } from "react";
|
|
1
|
+
import { type ComponentPropsWithoutRef, type CSSProperties, type ReactElement, type ReactNode } from "react";
|
|
2
2
|
import Button from "../Button";
|
|
3
3
|
declare function Modal({ open, onClose, children, overlayClassName, panelClassName, dialogClassName, dialogOuterPanelClassName, dialogOverflowClassName, style, }: {
|
|
4
4
|
open?: boolean;
|
|
@@ -7,40 +7,40 @@ import { XMarkIcon } from "@heroicons/react/24/solid";
|
|
|
7
7
|
import clsx from "../../utils/clsx";
|
|
8
8
|
export default function Modal({ open, onClose, children, overlayClassName, panelClassName, dialogClassName, dialogOuterPanelClassName, dialogOverflowClassName, style, }) {
|
|
9
9
|
const handleOnClose = useCallback(() => onClose?.(), [onClose]);
|
|
10
|
-
return (<Transition.Root show={open} as={Fragment}>
|
|
11
|
-
<Dialog as="div" className={clsx("relative z-10", dialogClassName)} onClose={handleOnClose} style={style}>
|
|
12
|
-
<Transition.Child as={Fragment} enter="ease-out duration-300" enterFrom="opacity-0" enterTo="opacity-100" leave="ease-in duration-200" leaveFrom="opacity-100" leaveTo="opacity-0">
|
|
13
|
-
<div className={clsx("fixed inset-0 bg-white/75 transition-opacity dark:bg-black/75", overlayClassName)}/>
|
|
14
|
-
</Transition.Child>
|
|
15
|
-
|
|
16
|
-
<div className={clsx("fixed inset-0 z-10 overflow-y-auto", dialogOverflowClassName)}>
|
|
17
|
-
<div className={clsx("flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", dialogOuterPanelClassName)}>
|
|
18
|
-
<Transition.Child as={Fragment} enter="ease-out duration-300" enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" enterTo="opacity-100 translate-y-0 sm:scale-100" leave="ease-in duration-200" leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95">
|
|
19
|
-
<Dialog.Panel className={clsx("relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all dark:bg-zinc-900 dark:ring-1 dark:ring-white/5
|
|
20
|
-
{children}
|
|
21
|
-
</Dialog.Panel>
|
|
22
|
-
</Transition.Child>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</Dialog>
|
|
10
|
+
return (<Transition.Root show={open} as={Fragment}>
|
|
11
|
+
<Dialog as="div" className={clsx("relative z-10", dialogClassName)} onClose={handleOnClose} style={style}>
|
|
12
|
+
<Transition.Child as={Fragment} enter="ease-out duration-300" enterFrom="opacity-0" enterTo="opacity-100" leave="ease-in duration-200" leaveFrom="opacity-100" leaveTo="opacity-0">
|
|
13
|
+
<div className={clsx("fixed inset-0 bg-white/75 transition-opacity dark:bg-black/75", overlayClassName)}/>
|
|
14
|
+
</Transition.Child>
|
|
15
|
+
|
|
16
|
+
<div className={clsx("fixed inset-0 z-10 overflow-y-auto", dialogOverflowClassName)}>
|
|
17
|
+
<div className={clsx("flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", dialogOuterPanelClassName)}>
|
|
18
|
+
<Transition.Child as={Fragment} enter="ease-out duration-300" enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" enterTo="opacity-100 translate-y-0 sm:scale-100" leave="ease-in duration-200" leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95">
|
|
19
|
+
<Dialog.Panel className={clsx("relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-sm dark:bg-zinc-900 dark:ring-1 dark:ring-white/5", panelClassName)}>
|
|
20
|
+
{children}
|
|
21
|
+
</Dialog.Panel>
|
|
22
|
+
</Transition.Child>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</Dialog>
|
|
26
26
|
</Transition.Root>);
|
|
27
27
|
}
|
|
28
28
|
Modal.Container = ModalContainer;
|
|
29
29
|
function ModalContainer({ children, className, }) {
|
|
30
|
-
return (<Stack className={clsx("gap-4! px-4 pb-4
|
|
31
|
-
{children}
|
|
30
|
+
return (<Stack className={clsx("gap-4! px-4 pt-5 pb-4 sm:p-6", className)}>
|
|
31
|
+
{children}
|
|
32
32
|
</Stack>);
|
|
33
33
|
}
|
|
34
34
|
Modal.Title = ModalTitle;
|
|
35
35
|
function ModalTitle({ children, className, }) {
|
|
36
|
-
return (<Dialog.Title as="h3" className={clsx("text-center text-lg font-medium
|
|
37
|
-
{children}
|
|
36
|
+
return (<Dialog.Title as="h3" className={clsx("text-center text-lg leading-6 font-medium text-zinc-900 dark:text-zinc-100", className)}>
|
|
37
|
+
{children}
|
|
38
38
|
</Dialog.Title>);
|
|
39
39
|
}
|
|
40
40
|
Modal.Content = ModalContent;
|
|
41
41
|
function ModalContent({ children, className, }) {
|
|
42
|
-
return (<div className={clsx("text-center text-sm text-zinc-500 dark:text-zinc-400", className)}>
|
|
43
|
-
{children}
|
|
42
|
+
return (<div className={clsx("text-center text-sm text-zinc-500 dark:text-zinc-400", className)}>
|
|
43
|
+
{children}
|
|
44
44
|
</div>);
|
|
45
45
|
}
|
|
46
46
|
Modal.Actions = ModalActions;
|
|
@@ -49,17 +49,17 @@ function ModalActions({ children, className, }) {
|
|
|
49
49
|
}
|
|
50
50
|
Modal.Icon = ModalIcon;
|
|
51
51
|
function ModalIcon({ children, }) {
|
|
52
|
-
return (<div className="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-800">
|
|
52
|
+
return (<div className="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-800">
|
|
53
53
|
{children &&
|
|
54
54
|
cloneElement(children, {
|
|
55
55
|
className: "h-6 w-6 text-green-600 dark:text-green-400",
|
|
56
56
|
"aria-hidden": "true",
|
|
57
|
-
})}
|
|
57
|
+
})}
|
|
58
58
|
</div>);
|
|
59
59
|
}
|
|
60
60
|
Modal.CloseButton = ModalCloseButton;
|
|
61
61
|
function ModalCloseButton({ className, ...props }) {
|
|
62
|
-
return (<Button icon className={clsx("absolute
|
|
63
|
-
<XMarkIcon />
|
|
62
|
+
return (<Button icon className={clsx("absolute top-2 right-2", className)} variant="text" {...props}>
|
|
63
|
+
<XMarkIcon />
|
|
64
64
|
</Button>);
|
|
65
65
|
}
|
|
@@ -4,9 +4,9 @@ import clsx from "../../utils/clsx";
|
|
|
4
4
|
import useModeToggle from "./useModeToggle";
|
|
5
5
|
const ModeToggle = function ModeToggle({ ariaLabel = "Toggle dark mode", className, iconClassName, ref, }) {
|
|
6
6
|
const toggleMode = useModeToggle();
|
|
7
|
-
return (<Button ref={ref} icon variant="text" aria-label={ariaLabel} onClick={toggleMode} className={className}>
|
|
8
|
-
<SunIcon className={clsx("dark:hidden", iconClassName)}/>
|
|
9
|
-
<MoonIcon className={clsx("hidden dark:block", iconClassName)}/>
|
|
7
|
+
return (<Button ref={ref} icon variant="text" aria-label={ariaLabel} onClick={toggleMode} className={className}>
|
|
8
|
+
<SunIcon className={clsx("dark:hidden", iconClassName)}/>
|
|
9
|
+
<MoonIcon className={clsx("hidden dark:block", iconClassName)}/>
|
|
10
10
|
</Button>);
|
|
11
11
|
};
|
|
12
12
|
export default ModeToggle;
|
|
@@ -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 MultiSelectProps<T extends object | string> extends Omit<UnstyledInputProps<false>, "as" | "onSelect" | "inputClassName" | "innerClassName" | "value" | "onChange"> {
|
|
4
4
|
placeholder?: string;
|
|
5
5
|
emptyText?: string;
|
|
@@ -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 { defaultHelpTextClassName, defaultInputClassName, defaultLabelClassName, defaultLeadingInputClassName, defaultTrailingClassName, defaultTrailingInputClassName, UnstyledInput, } from "../Input";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useState, } from "react";
|
|
4
|
+
import Input, { defaultHelpTextClassName, defaultInputClassName, defaultLabelClassName, defaultLeadingInputClassName, defaultTrailingClassName, defaultTrailingInputClassName, UnstyledInput, } from "../Input";
|
|
5
5
|
import clsx from "../../utils/clsx";
|
|
6
6
|
import { isEqual, take } from "lodash-es";
|
|
7
7
|
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/20/solid";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
2
|
export declare function getValue<Id extends string | number, T extends object | string>(id: Id, item: T): string | number;
|
|
3
3
|
export declare function MultiSelectInput<Id extends string | number, T extends object | string>({ className, selectedItems, doRender, removeItem, valueProperty, readOnly, items, ...props }: {
|
|
4
4
|
className?: string;
|
|
@@ -58,7 +58,6 @@ function MultiText({ value, onChangeValue, onChange, onBlur, name, id, className
|
|
|
58
58
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
62
61
|
}, [innerValue]);
|
|
63
62
|
return (<InputWrapper id={id} className={className} helpText={(invalid ? invalidHelpText : undefined) || helpText} label={label} error={invalid || error} required={required}>
|
|
64
63
|
<div className="ui-multi-text" onClick={() => inputRef.current?.focus()} data-focused={innerFocused ? "" : undefined} data-error={invalid || error ? "" : undefined} data-loading={loading ? "" : undefined} data-readonly={readOnly ? "" : undefined}>
|
|
@@ -10,20 +10,20 @@ export default function NavigationDrawer({ children, navigationChildren, positio
|
|
|
10
10
|
navigationDrawerState.setOpen(open);
|
|
11
11
|
}
|
|
12
12
|
}, []);
|
|
13
|
-
return (<>
|
|
14
|
-
<Drawer open={isOpen} onChangeOpen={handleChangeOpen} className="lg:hidden" position={position} title={title} noPadding={noPadding} panelClassName={panelClassName}>
|
|
15
|
-
{navigationChildren}
|
|
16
|
-
</Drawer>
|
|
17
|
-
<div className={clsx("fixed
|
|
13
|
+
return (<>
|
|
14
|
+
<Drawer open={isOpen} onChangeOpen={handleChangeOpen} className="lg:hidden" position={position} title={title} noPadding={noPadding} panelClassName={panelClassName}>
|
|
15
|
+
{navigationChildren}
|
|
16
|
+
</Drawer>
|
|
17
|
+
<div className={clsx("fixed top-0 left-0 z-10 hidden h-full w-full max-w-xs flex-1 overflow-y-auto px-4 py-4 pt-20 lg:block", "bg-zinc-100/95 backdrop-blur-sm [@supports(backdrop-filter:blur(0))]:bg-zinc-100/75", "dark:bg-zinc-900/95 dark:[@supports(backdrop-filter:blur(0))]:bg-zinc-900/75", "transition-transform", {
|
|
18
18
|
"translate-x-0": isOpen,
|
|
19
19
|
"-translate-x-full": !isOpen,
|
|
20
|
-
}, panelClassName)}>
|
|
21
|
-
{navigationChildren}
|
|
22
|
-
</div>
|
|
20
|
+
}, panelClassName)}>
|
|
21
|
+
{navigationChildren}
|
|
22
|
+
</div>
|
|
23
23
|
<div className={clsx("flex min-h-screen flex-col ring-offset-zinc-100 transition-all duration-300", {
|
|
24
24
|
"lg:pl-80 lg:duration-150": isOpen,
|
|
25
|
-
})}>
|
|
26
|
-
{children}
|
|
27
|
-
</div>
|
|
25
|
+
})}>
|
|
26
|
+
{children}
|
|
27
|
+
</div>
|
|
28
28
|
</>);
|
|
29
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from "react";
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
2
2
|
export default function NavigationItem({ icon, children, href, exact, alternativeActiveHrefs, className, disabled, active, }: {
|
|
3
3
|
icon?: ReactElement<{
|
|
4
4
|
className?: string;
|
|
@@ -18,7 +18,7 @@ export default function NavigationItem({ icon, children, href, exact, alternativ
|
|
|
18
18
|
return (<Button variant={active ? "light" : "text"} color={active ? "primary" : "default"} className={clsx("w-full justify-start border-transparent", className)} leading={icon &&
|
|
19
19
|
cloneElement(icon, {
|
|
20
20
|
className: clsx(icon.props?.className, "w-5! mr-3"),
|
|
21
|
-
})} href={href} onClick={isMobile ? navigationDrawerState.close : undefined} disabled={disabled}>
|
|
22
|
-
{children}
|
|
21
|
+
})} href={href} onClick={isMobile ? navigationDrawerState.close : undefined} disabled={disabled}>
|
|
22
|
+
{children}
|
|
23
23
|
</Button>);
|
|
24
24
|
}
|
|
@@ -4,7 +4,7 @@ import notificationsState from "./notifications.state";
|
|
|
4
4
|
import { CheckCircleIcon, ExclamationCircleIcon, } from "@heroicons/react/24/outline";
|
|
5
5
|
import { XMarkIcon } from "@heroicons/react/20/solid";
|
|
6
6
|
import Button from "../Button";
|
|
7
|
-
import { cloneElement, useEffect } from "react";
|
|
7
|
+
import { cloneElement, useEffect, } from "react";
|
|
8
8
|
import clsx from "../../utils/clsx";
|
|
9
9
|
export default function Notifications({ notificationClassName, }) {
|
|
10
10
|
const { notifications, remove, setRendered } = useSnapshot(notificationsState);
|
|
@@ -14,8 +14,8 @@ export default function Notifications({ notificationClassName, }) {
|
|
|
14
14
|
setRendered(false);
|
|
15
15
|
};
|
|
16
16
|
}, [setRendered]);
|
|
17
|
-
return (<ul id="ui-notifications" className="pointer-events-none fixed inset-0 z-30 flex flex-col items-center justify-end gap-3 px-4 py-6 sm:items-end sm:justify-start sm:p-6">
|
|
18
|
-
<AnimatePresence initial={false}>
|
|
17
|
+
return (<ul id="ui-notifications" className="pointer-events-none fixed inset-0 z-30 flex flex-col items-center justify-end gap-3 px-4 py-6 sm:items-end sm:justify-start sm:p-6">
|
|
18
|
+
<AnimatePresence initial={false}>
|
|
19
19
|
{notifications.map(({ _id, dismissable, title, message, icon, actions, style, className, }) => {
|
|
20
20
|
const iconChild = (typeof icon === "string"
|
|
21
21
|
? {
|
|
@@ -24,37 +24,37 @@ export default function Notifications({ notificationClassName, }) {
|
|
|
24
24
|
}[icon]
|
|
25
25
|
: icon);
|
|
26
26
|
// noinspection SuspiciousTypeOfGuard
|
|
27
|
-
return (<motion.li key={_id} layout initial={{ opacity: 0, y: 50, scale: 0.3 }} animate={{ opacity: 1, y: 0, scale: 1 }} exit={{ opacity: 0, scale: 0.5, transition: { duration: 0.2 } }} className={clsx("pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-lg ring-1 ring-black/5 dark:bg-zinc-800 dark:ring-white/10", notificationClassName, className)} style={style}>
|
|
28
|
-
<div className="p-4">
|
|
29
|
-
<div className="flex items-start">
|
|
30
|
-
{iconChild && (<div className="mr-2 shrink-0">
|
|
27
|
+
return (<motion.li key={_id} layout initial={{ opacity: 0, y: 50, scale: 0.3 }} animate={{ opacity: 1, y: 0, scale: 1 }} exit={{ opacity: 0, scale: 0.5, transition: { duration: 0.2 } }} className={clsx("pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-lg ring-1 ring-black/5 dark:bg-zinc-800 dark:ring-white/10", notificationClassName, className)} style={style}>
|
|
28
|
+
<div className="p-4">
|
|
29
|
+
<div className="flex items-start">
|
|
30
|
+
{iconChild && (<div className="mr-2 shrink-0">
|
|
31
31
|
{cloneElement(iconChild, {
|
|
32
32
|
className: clsx("h-6 w-6 text-zinc-400 dark:text-zinc-600", iconChild.props?.className),
|
|
33
33
|
"aria-hidden": "true",
|
|
34
|
-
})}
|
|
35
|
-
</div>)}
|
|
36
|
-
<div className="ml-1 w-0 flex-1 pt-0.5">
|
|
37
|
-
<p className="text-sm font-medium text-zinc-900 dark:text-zinc-100">
|
|
38
|
-
{title || message}
|
|
39
|
-
</p>
|
|
40
|
-
{title && message && (<p className="mt-1 text-sm text-zinc-500 dark:text-zinc-400">
|
|
41
|
-
{message}
|
|
42
|
-
</p>)}
|
|
43
|
-
{actions && (<div className="-m-3 mt-0 flex">
|
|
44
|
-
{actions}
|
|
45
|
-
</div>)}
|
|
46
|
-
</div>
|
|
47
|
-
{dismissable && (<div className="ml-4 flex shrink-0">
|
|
34
|
+
})}
|
|
35
|
+
</div>)}
|
|
36
|
+
<div className="ml-1 w-0 flex-1 pt-0.5">
|
|
37
|
+
<p className="text-sm font-medium text-zinc-900 dark:text-zinc-100">
|
|
38
|
+
{title || message}
|
|
39
|
+
</p>
|
|
40
|
+
{title && message && (<p className="mt-1 text-sm text-zinc-500 dark:text-zinc-400">
|
|
41
|
+
{message}
|
|
42
|
+
</p>)}
|
|
43
|
+
{actions && (<div className="-m-3 mt-0 flex">
|
|
44
|
+
{actions}
|
|
45
|
+
</div>)}
|
|
46
|
+
</div>
|
|
47
|
+
{dismissable && (<div className="ml-4 flex shrink-0">
|
|
48
48
|
<Button icon onClick={() => {
|
|
49
49
|
remove(_id);
|
|
50
|
-
}} className="h-5 w-5 p-0!" variant="text">
|
|
51
|
-
<XMarkIcon className="h-5 w-5 text-zinc-400" aria-label="Close"/>
|
|
52
|
-
</Button>
|
|
53
|
-
</div>)}
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
50
|
+
}} className="h-5 w-5 p-0!" variant="text">
|
|
51
|
+
<XMarkIcon className="h-5 w-5 text-zinc-400" aria-label="Close"/>
|
|
52
|
+
</Button>
|
|
53
|
+
</div>)}
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
56
|
</motion.li>);
|
|
57
|
-
})}
|
|
58
|
-
</AnimatePresence>
|
|
57
|
+
})}
|
|
58
|
+
</AnimatePresence>
|
|
59
59
|
</ul>);
|
|
60
60
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StringValue } from "ms";
|
|
2
|
-
import { CSSProperties, ReactElement, ReactNode } from "react";
|
|
1
|
+
import { type StringValue } from "ms";
|
|
2
|
+
import type { CSSProperties, ReactElement, ReactNode } from "react";
|
|
3
3
|
type Notification = {
|
|
4
4
|
_id: string;
|
|
5
5
|
message: string | ReactElement;
|