@me1a/ui 1.2.4 → 1.2.5

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 (129) hide show
  1. package/dist/components/components/iconify/iconify.d.ts +7 -0
  2. package/dist/components/components/iconify/index.d.ts +2 -0
  3. package/dist/components/components/iconify/types.d.ts +2 -0
  4. package/dist/components/components/index.d.ts +2 -0
  5. package/dist/components/components/snackbar/index.d.ts +2 -0
  6. package/dist/components/components/snackbar/snackbar-provider.d.ts +5 -0
  7. package/dist/components/components/snackbar/styles.d.ts +6 -0
  8. package/dist/components/hooks/index.d.ts +1 -0
  9. package/dist/components/hooks/use-boolean.d.ts +9 -0
  10. package/dist/components/iconify/iconify.d.ts +7 -0
  11. package/dist/components/iconify/index.d.ts +2 -0
  12. package/dist/components/iconify/types.d.ts +2 -0
  13. package/dist/components/index.cjs.js +12760 -0
  14. package/dist/components/index.cjs.js.map +1 -0
  15. package/dist/{example → components}/index.d.ts +1 -1
  16. package/dist/components/index.es.js +12736 -0
  17. package/dist/components/index.es.js.map +1 -0
  18. package/dist/components/redux/index.d.ts +1 -0
  19. package/dist/components/snackbar/index.d.ts +2 -0
  20. package/dist/components/snackbar/snackbar-provider.d.ts +5 -0
  21. package/dist/components/snackbar/styles.d.ts +6 -0
  22. package/dist/hook-forms/components/iconify/iconify.d.ts +7 -0
  23. package/dist/hook-forms/components/iconify/index.d.ts +2 -0
  24. package/dist/hook-forms/components/iconify/types.d.ts +2 -0
  25. package/dist/hook-forms/components/index.d.ts +2 -0
  26. package/dist/hook-forms/components/snackbar/index.d.ts +2 -0
  27. package/dist/hook-forms/components/snackbar/snackbar-provider.d.ts +5 -0
  28. package/dist/hook-forms/components/snackbar/styles.d.ts +6 -0
  29. package/dist/hook-forms/hooks/index.d.ts +1 -0
  30. package/dist/hook-forms/hooks/use-boolean.d.ts +9 -0
  31. package/dist/hook-forms/index.d.ts +1 -1
  32. package/dist/hook-forms/redux/index.d.ts +1 -0
  33. package/dist/hooks/components/iconify/iconify.d.ts +7 -0
  34. package/dist/hooks/components/iconify/index.d.ts +2 -0
  35. package/dist/hooks/components/iconify/types.d.ts +2 -0
  36. package/dist/hooks/components/index.d.ts +2 -0
  37. package/dist/hooks/components/snackbar/index.d.ts +2 -0
  38. package/dist/hooks/components/snackbar/snackbar-provider.d.ts +5 -0
  39. package/dist/hooks/components/snackbar/styles.d.ts +6 -0
  40. package/dist/hooks/hook-forms/form-provider.d.ts +8 -0
  41. package/dist/hooks/hook-forms/index.d.ts +11 -0
  42. package/dist/hooks/hook-forms/rhf-autocomplete.d.ts +11 -0
  43. package/dist/hooks/hook-forms/rhf-checkbox.d.ts +19 -0
  44. package/dist/hooks/hook-forms/rhf-radio-group.d.ts +13 -0
  45. package/dist/hooks/hook-forms/rhf-select.d.ts +11 -0
  46. package/dist/hooks/hook-forms/rhf-slider.d.ts +7 -0
  47. package/dist/hooks/hook-forms/rhf-switch.d.ts +7 -0
  48. package/dist/hooks/hook-forms/rhf-text-field.d.ts +6 -0
  49. package/dist/hooks/hooks/index.d.ts +1 -0
  50. package/dist/hooks/hooks/use-boolean.d.ts +9 -0
  51. package/dist/hooks/index.cjs.js +27 -0
  52. package/dist/hooks/index.cjs.js.map +1 -0
  53. package/dist/hooks/index.d.ts +2 -0
  54. package/dist/hooks/index.es.js +25 -0
  55. package/dist/hooks/index.es.js.map +1 -0
  56. package/dist/hooks/redux/index.d.ts +1 -0
  57. package/dist/hooks/use-boolean.d.ts +9 -0
  58. package/dist/index.cjs.js +3926 -3923
  59. package/dist/index.cjs.js.map +1 -1
  60. package/dist/index.d.ts +1 -1
  61. package/dist/index.es.js +2546 -2543
  62. package/dist/index.es.js.map +1 -1
  63. package/dist/redux/components/iconify/iconify.d.ts +7 -0
  64. package/dist/redux/components/iconify/index.d.ts +2 -0
  65. package/dist/redux/components/iconify/types.d.ts +2 -0
  66. package/dist/redux/components/index.d.ts +2 -0
  67. package/dist/redux/components/snackbar/index.d.ts +2 -0
  68. package/dist/redux/components/snackbar/snackbar-provider.d.ts +5 -0
  69. package/dist/redux/components/snackbar/styles.d.ts +6 -0
  70. package/dist/redux/hook-forms/form-provider.d.ts +8 -0
  71. package/dist/redux/hook-forms/index.d.ts +11 -0
  72. package/dist/redux/hook-forms/rhf-autocomplete.d.ts +11 -0
  73. package/dist/redux/hook-forms/rhf-checkbox.d.ts +19 -0
  74. package/dist/redux/hook-forms/rhf-radio-group.d.ts +13 -0
  75. package/dist/redux/hook-forms/rhf-select.d.ts +11 -0
  76. package/dist/redux/hook-forms/rhf-slider.d.ts +7 -0
  77. package/dist/redux/hook-forms/rhf-switch.d.ts +7 -0
  78. package/dist/redux/hook-forms/rhf-text-field.d.ts +6 -0
  79. package/dist/redux/hooks/index.d.ts +1 -0
  80. package/dist/redux/hooks/use-boolean.d.ts +9 -0
  81. package/dist/redux/index.cjs.js +1347 -0
  82. package/dist/redux/index.cjs.js.map +1 -0
  83. package/dist/redux/index.d.ts +2 -0
  84. package/dist/redux/index.es.js +1317 -0
  85. package/dist/redux/index.es.js.map +1 -0
  86. package/dist/redux/redux/index.d.ts +1 -0
  87. package/dist/redux-toolkit/components/iconify/iconify.d.ts +7 -0
  88. package/dist/redux-toolkit/components/iconify/index.d.ts +2 -0
  89. package/dist/redux-toolkit/components/iconify/types.d.ts +2 -0
  90. package/dist/redux-toolkit/components/index.d.ts +2 -0
  91. package/dist/redux-toolkit/components/snackbar/index.d.ts +2 -0
  92. package/dist/redux-toolkit/components/snackbar/snackbar-provider.d.ts +5 -0
  93. package/dist/redux-toolkit/components/snackbar/styles.d.ts +6 -0
  94. package/dist/redux-toolkit/hook-forms/form-provider.d.ts +8 -0
  95. package/dist/redux-toolkit/hook-forms/index.d.ts +11 -0
  96. package/dist/redux-toolkit/hook-forms/rhf-autocomplete.d.ts +11 -0
  97. package/dist/redux-toolkit/hook-forms/rhf-checkbox.d.ts +19 -0
  98. package/dist/redux-toolkit/hook-forms/rhf-radio-group.d.ts +13 -0
  99. package/dist/redux-toolkit/hook-forms/rhf-select.d.ts +11 -0
  100. package/dist/redux-toolkit/hook-forms/rhf-slider.d.ts +7 -0
  101. package/dist/redux-toolkit/hook-forms/rhf-switch.d.ts +7 -0
  102. package/dist/redux-toolkit/hook-forms/rhf-text-field.d.ts +6 -0
  103. package/dist/redux-toolkit/hooks/index.d.ts +1 -0
  104. package/dist/redux-toolkit/hooks/use-boolean.d.ts +9 -0
  105. package/dist/redux-toolkit/index.cjs.js +3 -0
  106. package/dist/redux-toolkit/index.cjs.js.map +1 -0
  107. package/dist/redux-toolkit/index.d.ts +2 -0
  108. package/dist/redux-toolkit/index.es.js +2 -0
  109. package/dist/redux-toolkit/index.es.js.map +1 -0
  110. package/dist/redux-toolkit/redux/index.d.ts +1 -0
  111. package/package.json +27 -8
  112. package/dist/example/example/index.d.ts +0 -1
  113. package/dist/example/example/simple.d.ts +0 -4
  114. package/dist/example/index.cjs.js +0 -1381
  115. package/dist/example/index.cjs.js.map +0 -1
  116. package/dist/example/index.es.js +0 -1379
  117. package/dist/example/index.es.js.map +0 -1
  118. package/dist/example/simple.d.ts +0 -4
  119. package/dist/hook-forms/example/index.d.ts +0 -1
  120. package/dist/hook-forms/example/simple.d.ts +0 -4
  121. /package/dist/{example → components}/hook-forms/form-provider.d.ts +0 -0
  122. /package/dist/{example → components}/hook-forms/index.d.ts +0 -0
  123. /package/dist/{example → components}/hook-forms/rhf-autocomplete.d.ts +0 -0
  124. /package/dist/{example → components}/hook-forms/rhf-checkbox.d.ts +0 -0
  125. /package/dist/{example → components}/hook-forms/rhf-radio-group.d.ts +0 -0
  126. /package/dist/{example → components}/hook-forms/rhf-select.d.ts +0 -0
  127. /package/dist/{example → components}/hook-forms/rhf-slider.d.ts +0 -0
  128. /package/dist/{example → components}/hook-forms/rhf-switch.d.ts +0 -0
  129. /package/dist/{example → components}/hook-forms/rhf-text-field.d.ts +0 -0
@@ -0,0 +1 @@
1
+ export * from "react-redux";
@@ -0,0 +1,2 @@
1
+ export * from "notistack";
2
+ export { default as SnackbarProvider } from "./snackbar-provider";
@@ -0,0 +1,5 @@
1
+ type Props = {
2
+ children: React.ReactNode;
3
+ };
4
+ export default function SnackbarProvider({ children }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const StyledNotistack: import("@emotion/styled").StyledComponent<import("notistack").CustomContentProps & import("react").RefAttributes<HTMLDivElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
2
+ type StyledIconProps = {
3
+ color: 'info' | 'success' | 'warning' | 'error';
4
+ };
5
+ export declare const StyledIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & StyledIconProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
6
+ export {};
@@ -0,0 +1,7 @@
1
+ import { BoxProps } from "@mui/material/Box";
2
+ import { IconifyProps } from "./types";
3
+ interface Props extends BoxProps {
4
+ icon: IconifyProps;
5
+ }
6
+ declare const Iconify: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<SVGElement>>;
7
+ export default Iconify;
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export { default } from './iconify';
@@ -0,0 +1,2 @@
1
+ import { IconifyIcon } from '@iconify/react';
2
+ export type IconifyProps = IconifyIcon | string;
@@ -0,0 +1,2 @@
1
+ export * from "./iconify";
2
+ export * from "./snackbar";
@@ -0,0 +1,2 @@
1
+ export * from "notistack";
2
+ export { default as SnackbarProvider } from "./snackbar-provider";
@@ -0,0 +1,5 @@
1
+ type Props = {
2
+ children: React.ReactNode;
3
+ };
4
+ export default function SnackbarProvider({ children }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const StyledNotistack: import("@emotion/styled").StyledComponent<import("notistack").CustomContentProps & import("react").RefAttributes<HTMLDivElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
2
+ type StyledIconProps = {
3
+ color: 'info' | 'success' | 'warning' | 'error';
4
+ };
5
+ export declare const StyledIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & StyledIconProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
6
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./use-boolean";
@@ -0,0 +1,9 @@
1
+ interface ReturnType {
2
+ value: boolean;
3
+ onTrue: () => void;
4
+ onFalse: () => void;
5
+ onToggle: () => void;
6
+ setValue: React.Dispatch<React.SetStateAction<boolean>>;
7
+ }
8
+ export declare function useBoolean(defaultValue?: boolean): ReturnType;
9
+ export {};
@@ -1,2 +1,2 @@
1
- export * from "./example";
2
1
  export * from "./hook-forms";
2
+ export * from "./hooks";
@@ -0,0 +1 @@
1
+ export * from "react-redux";
@@ -0,0 +1,7 @@
1
+ import { BoxProps } from "@mui/material/Box";
2
+ import { IconifyProps } from "./types";
3
+ interface Props extends BoxProps {
4
+ icon: IconifyProps;
5
+ }
6
+ declare const Iconify: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<SVGElement>>;
7
+ export default Iconify;
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export { default } from './iconify';
@@ -0,0 +1,2 @@
1
+ import { IconifyIcon } from '@iconify/react';
2
+ export type IconifyProps = IconifyIcon | string;
@@ -0,0 +1,2 @@
1
+ export * from "./iconify";
2
+ export * from "./snackbar";
@@ -0,0 +1,2 @@
1
+ export * from "notistack";
2
+ export { default as SnackbarProvider } from "./snackbar-provider";
@@ -0,0 +1,5 @@
1
+ type Props = {
2
+ children: React.ReactNode;
3
+ };
4
+ export default function SnackbarProvider({ children }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const StyledNotistack: import("@emotion/styled").StyledComponent<import("notistack").CustomContentProps & import("react").RefAttributes<HTMLDivElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
2
+ type StyledIconProps = {
3
+ color: 'info' | 'success' | 'warning' | 'error';
4
+ };
5
+ export declare const StyledIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & StyledIconProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ import { UseFormReturn, FieldValues } from "react-hook-form";
2
+ type Props<T extends FieldValues> = {
3
+ children: React.ReactNode;
4
+ methods: UseFormReturn<T>;
5
+ onSubmit?: VoidFunction;
6
+ };
7
+ export default function FormProvider<T extends FieldValues>({ children, onSubmit, methods, }: Props<T>): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,11 @@
1
+ export { FormProvider as FormProviderController } from "react-hook-form";
2
+ export * from "react-hook-form";
3
+ export * from "./rhf-select";
4
+ export * from "./rhf-checkbox";
5
+ export { default as RHFSwitch } from "./rhf-switch";
6
+ export { default as RHFSlider } from "./rhf-slider";
7
+ export { default as RHFTextField } from "./rhf-text-field";
8
+ export { default as RHFRadioGroup } from "./rhf-radio-group";
9
+ export { default as FormProvider } from "./form-provider";
10
+ export { yupResolver } from "@hookform/resolvers/yup";
11
+ export * as Yup from "yup";
@@ -0,0 +1,11 @@
1
+ import { AutocompleteProps } from "@mui/material/Autocomplete";
2
+ interface Props<T, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined> extends AutocompleteProps<T, Multiple, DisableClearable, FreeSolo> {
3
+ name: string;
4
+ label?: string;
5
+ placeholder?: string;
6
+ helperText?: React.ReactNode;
7
+ optionKey?: string;
8
+ optionLabel?: string;
9
+ }
10
+ export default function RHFAutocomplete<T, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined>({ name, label, placeholder, optionKey, options, optionLabel, helperText, ...other }: Omit<Props<T, Multiple, DisableClearable, FreeSolo>, "renderInput">): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,19 @@
1
+ import { FormControlLabelProps } from "@mui/material/FormControlLabel";
2
+ interface RHFCheckboxProps extends Omit<FormControlLabelProps, "control"> {
3
+ name: string;
4
+ helperText?: React.ReactNode;
5
+ }
6
+ export declare function RHFCheckbox({ name, helperText, ...other }: RHFCheckboxProps): import("react/jsx-runtime").JSX.Element;
7
+ interface RHFMultiCheckboxProps extends Omit<FormControlLabelProps, "control" | "label"> {
8
+ name: string;
9
+ options: {
10
+ label: string;
11
+ value: number | string;
12
+ }[];
13
+ row?: boolean;
14
+ label?: string;
15
+ spacing?: number;
16
+ helperText?: React.ReactNode;
17
+ }
18
+ export declare function RHFMultiCheckbox({ row, name, label, options, spacing, helperText, sx, ...other }: RHFMultiCheckboxProps): import("react/jsx-runtime").JSX.Element;
19
+ export {};
@@ -0,0 +1,13 @@
1
+ import { RadioGroupProps } from "@mui/material/RadioGroup";
2
+ type Props = RadioGroupProps & {
3
+ name: string;
4
+ options: {
5
+ label: string;
6
+ value: any;
7
+ }[];
8
+ label?: string;
9
+ spacing?: number;
10
+ helperText?: React.ReactNode;
11
+ };
12
+ export default function RHFRadioGroup({ row, name, label, options, spacing, helperText, ...other }: Props): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,11 @@
1
+ import { Theme, SxProps } from "@mui/material/styles";
2
+ import { TextFieldProps } from "@mui/material/TextField";
3
+ type RHFSelectProps = TextFieldProps & {
4
+ name: string;
5
+ native?: boolean;
6
+ maxHeight?: boolean | number;
7
+ children: React.ReactNode;
8
+ PaperPropsSx?: SxProps<Theme>;
9
+ };
10
+ export declare function RHFSelect({ name, native, maxHeight, helperText, children, PaperPropsSx, ...other }: RHFSelectProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,7 @@
1
+ import { SliderProps } from "@mui/material/Slider";
2
+ type Props = SliderProps & {
3
+ name: string;
4
+ helperText?: React.ReactNode;
5
+ };
6
+ export default function RHFSlider({ name, helperText, ...other }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { FormControlLabelProps } from "@mui/material/FormControlLabel";
2
+ interface Props extends Omit<FormControlLabelProps, "control"> {
3
+ name: string;
4
+ helperText?: React.ReactNode;
5
+ }
6
+ export default function RHFSwitch({ name, helperText, ...other }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ import { TextFieldProps } from "@mui/material/TextField";
2
+ type Props = TextFieldProps & {
3
+ name: string;
4
+ };
5
+ export default function RHFTextField({ name, helperText, type, ...other }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./use-boolean";
@@ -0,0 +1,9 @@
1
+ interface ReturnType {
2
+ value: boolean;
3
+ onTrue: () => void;
4
+ onFalse: () => void;
5
+ onToggle: () => void;
6
+ setValue: React.Dispatch<React.SetStateAction<boolean>>;
7
+ }
8
+ export declare function useBoolean(defaultValue?: boolean): ReturnType;
9
+ export {};
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+
5
+ // ----------------------------------------------------------------------
6
+ function useBoolean(defaultValue) {
7
+ const [value, setValue] = react.useState(!!defaultValue);
8
+ const onTrue = react.useCallback(() => {
9
+ setValue(true);
10
+ }, []);
11
+ const onFalse = react.useCallback(() => {
12
+ setValue(false);
13
+ }, []);
14
+ const onToggle = react.useCallback(() => {
15
+ setValue(prev => !prev);
16
+ }, []);
17
+ return {
18
+ value,
19
+ onTrue,
20
+ onFalse,
21
+ onToggle,
22
+ setValue
23
+ };
24
+ }
25
+
26
+ exports.useBoolean = useBoolean;
27
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../src/hooks/use-boolean.ts"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useState } from \"react\";\n\n// ----------------------------------------------------------------------\n\ninterface ReturnType {\n value: boolean;\n onTrue: () => void;\n onFalse: () => void;\n onToggle: () => void;\n setValue: React.Dispatch<React.SetStateAction<boolean>>;\n}\n\n// ----------------------------------------------------------------------\n\nexport function useBoolean(defaultValue?: boolean): ReturnType {\n const [value, setValue] = useState(!!defaultValue);\n\n const onTrue = useCallback(() => {\n setValue(true);\n }, []);\n\n const onFalse = useCallback(() => {\n setValue(false);\n }, []);\n\n const onToggle = useCallback(() => {\n setValue((prev) => !prev);\n }, []);\n\n return {\n value,\n onTrue,\n onFalse,\n onToggle,\n setValue,\n };\n}\n"],"names":["useBoolean","defaultValue","value","setValue","useState","onTrue","useCallback","onFalse","onToggle","prev"],"mappings":";;;;AAcA;AAEM,SAAUA,UAAUA,CAACC,YAAsB,EAAA;EAC/C,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGC,cAAQ,CAAC,CAAC,CAACH,YAAY,CAAC;AAElD,EAAA,MAAMI,MAAM,GAAGC,iBAAW,CAAC,MAAK;IAC9BH,QAAQ,CAAC,IAAI,CAAC;GACf,EAAE,EAAE,CAAC;AAEN,EAAA,MAAMI,OAAO,GAAGD,iBAAW,CAAC,MAAK;IAC/BH,QAAQ,CAAC,KAAK,CAAC;GAChB,EAAE,EAAE,CAAC;AAEN,EAAA,MAAMK,QAAQ,GAAGF,iBAAW,CAAC,MAAK;AAChCH,IAAAA,QAAQ,CAAEM,IAAI,IAAK,CAACA,IAAI,CAAC;GAC1B,EAAE,EAAE,CAAC;EAEN,OAAO;IACLP,KAAK;IACLG,MAAM;IACNE,OAAO;IACPC,QAAQ;AACRL,IAAAA;GACD;AACH;;;;"}
@@ -0,0 +1,2 @@
1
+ export * from "./hook-forms";
2
+ export * from "./hooks";
@@ -0,0 +1,25 @@
1
+ import { useState, useCallback } from 'react';
2
+
3
+ // ----------------------------------------------------------------------
4
+ function useBoolean(defaultValue) {
5
+ const [value, setValue] = useState(!!defaultValue);
6
+ const onTrue = useCallback(() => {
7
+ setValue(true);
8
+ }, []);
9
+ const onFalse = useCallback(() => {
10
+ setValue(false);
11
+ }, []);
12
+ const onToggle = useCallback(() => {
13
+ setValue(prev => !prev);
14
+ }, []);
15
+ return {
16
+ value,
17
+ onTrue,
18
+ onFalse,
19
+ onToggle,
20
+ setValue
21
+ };
22
+ }
23
+
24
+ export { useBoolean };
25
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","sources":["../../../src/hooks/use-boolean.ts"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useState } from \"react\";\n\n// ----------------------------------------------------------------------\n\ninterface ReturnType {\n value: boolean;\n onTrue: () => void;\n onFalse: () => void;\n onToggle: () => void;\n setValue: React.Dispatch<React.SetStateAction<boolean>>;\n}\n\n// ----------------------------------------------------------------------\n\nexport function useBoolean(defaultValue?: boolean): ReturnType {\n const [value, setValue] = useState(!!defaultValue);\n\n const onTrue = useCallback(() => {\n setValue(true);\n }, []);\n\n const onFalse = useCallback(() => {\n setValue(false);\n }, []);\n\n const onToggle = useCallback(() => {\n setValue((prev) => !prev);\n }, []);\n\n return {\n value,\n onTrue,\n onFalse,\n onToggle,\n setValue,\n };\n}\n"],"names":["useBoolean","defaultValue","value","setValue","useState","onTrue","useCallback","onFalse","onToggle","prev"],"mappings":";;AAcA;AAEM,SAAUA,UAAUA,CAACC,YAAsB,EAAA;EAC/C,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGC,QAAQ,CAAC,CAAC,CAACH,YAAY,CAAC;AAElD,EAAA,MAAMI,MAAM,GAAGC,WAAW,CAAC,MAAK;IAC9BH,QAAQ,CAAC,IAAI,CAAC;GACf,EAAE,EAAE,CAAC;AAEN,EAAA,MAAMI,OAAO,GAAGD,WAAW,CAAC,MAAK;IAC/BH,QAAQ,CAAC,KAAK,CAAC;GAChB,EAAE,EAAE,CAAC;AAEN,EAAA,MAAMK,QAAQ,GAAGF,WAAW,CAAC,MAAK;AAChCH,IAAAA,QAAQ,CAAEM,IAAI,IAAK,CAACA,IAAI,CAAC;GAC1B,EAAE,EAAE,CAAC;EAEN,OAAO;IACLP,KAAK;IACLG,MAAM;IACNE,OAAO;IACPC,QAAQ;AACRL,IAAAA;GACD;AACH;;;;"}
@@ -0,0 +1 @@
1
+ export * from "react-redux";
@@ -0,0 +1,9 @@
1
+ interface ReturnType {
2
+ value: boolean;
3
+ onTrue: () => void;
4
+ onFalse: () => void;
5
+ onToggle: () => void;
6
+ setValue: React.Dispatch<React.SetStateAction<boolean>>;
7
+ }
8
+ export declare function useBoolean(defaultValue?: boolean): ReturnType;
9
+ export {};