@geoinsight/react-components 0.6.10 → 0.7.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 (91) hide show
  1. package/dist/cjs/index.js +9 -7
  2. package/dist/cjs/types/components/accordion/accordion-button.d.ts +4 -0
  3. package/dist/cjs/types/components/accordion/accordion-content.d.ts +4 -0
  4. package/dist/cjs/types/components/accordion/accordion-item.d.ts +4 -0
  5. package/dist/cjs/types/components/accordion/accordion.d.ts +4 -0
  6. package/dist/cjs/types/components/accordion/index.d.ts +4 -0
  7. package/dist/cjs/types/components/accordion/index.stories.d.ts +6 -0
  8. package/dist/cjs/types/components/accordion/index.types.d.ts +34 -0
  9. package/dist/cjs/types/components/button/index.d.ts +5 -0
  10. package/dist/cjs/types/components/button/index.stories.d.ts +7 -0
  11. package/dist/cjs/types/components/button/index.types.d.ts +41 -0
  12. package/dist/cjs/types/components/form/FormInput.d.ts +4 -0
  13. package/dist/cjs/types/components/form/FormSelect.d.ts +4 -0
  14. package/dist/cjs/types/components/form/FormTextArea.d.ts +4 -0
  15. package/dist/cjs/types/components/form/index.d.ts +4 -0
  16. package/dist/cjs/types/components/form/index.stories.d.ts +7 -0
  17. package/dist/cjs/types/components/form/index.types.d.ts +45 -0
  18. package/dist/cjs/types/components/input/index.d.ts +4 -0
  19. package/dist/cjs/types/components/input/index.stories.d.ts +8 -0
  20. package/dist/cjs/types/components/input/index.types.d.ts +40 -0
  21. package/dist/cjs/types/components/loading/index.d.ts +4 -0
  22. package/dist/cjs/types/components/loading/index.stories.d.ts +6 -0
  23. package/dist/cjs/types/components/loading/index.types.d.ts +11 -0
  24. package/dist/cjs/types/components/modal/index.d.ts +4 -0
  25. package/dist/cjs/types/components/modal/index.stories.d.ts +6 -0
  26. package/dist/cjs/types/components/modal/index.types.d.ts +31 -0
  27. package/dist/cjs/types/components/select/index.d.ts +4 -0
  28. package/dist/cjs/types/components/select/index.stories.d.ts +7 -0
  29. package/dist/cjs/types/components/select/index.types.d.ts +30 -0
  30. package/dist/cjs/types/components/text-area/index.d.ts +5 -0
  31. package/dist/cjs/types/components/text-area/index.stories.d.ts +7 -0
  32. package/dist/cjs/types/components/text-area/index.types.d.ts +37 -0
  33. package/dist/cjs/types/context/accordion/index.d.ts +10 -0
  34. package/dist/cjs/types/context/loading/index.d.ts +24 -0
  35. package/dist/cjs/types/context/loading/index.stories.d.ts +8 -0
  36. package/dist/cjs/types/context/modal/index.d.ts +25 -0
  37. package/dist/cjs/types/context/modal/index.stories.d.ts +6 -0
  38. package/dist/cjs/types/context/theme/index.d.ts +18 -0
  39. package/dist/cjs/types/decorators/withColorScheme.d.ts +7 -0
  40. package/dist/cjs/types/decorators/withLoading.d.ts +2 -0
  41. package/dist/cjs/types/decorators/withModal.d.ts +2 -0
  42. package/dist/cjs/types/decorators/withWrapper.d.ts +2 -0
  43. package/dist/cjs/types/index.d.ts +15 -0
  44. package/dist/cjs/types/utils/palette.d.ts +1 -0
  45. package/dist/cjs/types/utils/recursive.d.ts +6 -0
  46. package/dist/esm/index.js +9 -7
  47. package/dist/esm/types/components/accordion/accordion-button.d.ts +4 -0
  48. package/dist/esm/types/components/accordion/accordion-content.d.ts +4 -0
  49. package/dist/esm/types/components/accordion/accordion-item.d.ts +4 -0
  50. package/dist/esm/types/components/accordion/accordion.d.ts +4 -0
  51. package/dist/esm/types/components/accordion/index.d.ts +4 -0
  52. package/dist/esm/types/components/accordion/index.stories.d.ts +6 -0
  53. package/dist/esm/types/components/accordion/index.types.d.ts +34 -0
  54. package/dist/esm/types/components/button/index.d.ts +5 -0
  55. package/dist/esm/types/components/button/index.stories.d.ts +7 -0
  56. package/dist/esm/types/components/button/index.types.d.ts +41 -0
  57. package/dist/esm/types/components/form/FormInput.d.ts +4 -0
  58. package/dist/esm/types/components/form/FormSelect.d.ts +4 -0
  59. package/dist/esm/types/components/form/FormTextArea.d.ts +4 -0
  60. package/dist/esm/types/components/form/index.d.ts +4 -0
  61. package/dist/esm/types/components/form/index.stories.d.ts +7 -0
  62. package/dist/esm/types/components/form/index.types.d.ts +45 -0
  63. package/dist/esm/types/components/input/index.d.ts +4 -0
  64. package/dist/esm/types/components/input/index.stories.d.ts +8 -0
  65. package/dist/esm/types/components/input/index.types.d.ts +40 -0
  66. package/dist/esm/types/components/loading/index.d.ts +4 -0
  67. package/dist/esm/types/components/loading/index.stories.d.ts +6 -0
  68. package/dist/esm/types/components/loading/index.types.d.ts +11 -0
  69. package/dist/esm/types/components/modal/index.d.ts +4 -0
  70. package/dist/esm/types/components/modal/index.stories.d.ts +6 -0
  71. package/dist/esm/types/components/modal/index.types.d.ts +31 -0
  72. package/dist/esm/types/components/select/index.d.ts +4 -0
  73. package/dist/esm/types/components/select/index.stories.d.ts +7 -0
  74. package/dist/esm/types/components/select/index.types.d.ts +30 -0
  75. package/dist/esm/types/components/text-area/index.d.ts +5 -0
  76. package/dist/esm/types/components/text-area/index.stories.d.ts +7 -0
  77. package/dist/esm/types/components/text-area/index.types.d.ts +37 -0
  78. package/dist/esm/types/context/accordion/index.d.ts +10 -0
  79. package/dist/esm/types/context/loading/index.d.ts +24 -0
  80. package/dist/esm/types/context/loading/index.stories.d.ts +8 -0
  81. package/dist/esm/types/context/modal/index.d.ts +25 -0
  82. package/dist/esm/types/context/modal/index.stories.d.ts +6 -0
  83. package/dist/esm/types/context/theme/index.d.ts +18 -0
  84. package/dist/esm/types/decorators/withColorScheme.d.ts +7 -0
  85. package/dist/esm/types/decorators/withLoading.d.ts +2 -0
  86. package/dist/esm/types/decorators/withModal.d.ts +2 -0
  87. package/dist/esm/types/decorators/withWrapper.d.ts +2 -0
  88. package/dist/esm/types/index.d.ts +15 -0
  89. package/dist/esm/types/utils/palette.d.ts +1 -0
  90. package/dist/esm/types/utils/recursive.d.ts +6 -0
  91. package/package.json +1 -1
package/dist/esm/index.js CHANGED
@@ -188,8 +188,8 @@ const AccordionContent = function AccordionContent({ children, label, toggle, })
188
188
  // how do I solve reseting the form outside the form
189
189
  function Form({ children, onSubmit, submitButton = {
190
190
  label: "Submit",
191
- }, ...rest }) {
192
- const methods = useForm();
191
+ }, initialState, ...rest }) {
192
+ const methods = useForm(initialState);
193
193
  const { formState: { isValid }, } = methods;
194
194
  const [result, setResult] = useState({
195
195
  message: "",
@@ -207,7 +207,7 @@ function Input({ inputClassName = "", classNameGroup = "", error = {
207
207
  icon.className), children: icon.element }))] })] }));
208
208
  }
209
209
 
210
- function FormInput({ name, isRequired, error, ...rest }) {
210
+ function FormInput({ name, isRequired, error, defaultValue, ...rest }) {
211
211
  const { control } = useFormContext();
212
212
  return (jsx(Controller, { name: name, control: control, rules: {
213
213
  ...(isRequired
@@ -219,7 +219,7 @@ function FormInput({ name, isRequired, error, ...rest }) {
219
219
  return (jsx(Input, { isRequired: true, error: {
220
220
  is: !!error,
221
221
  message: error?.message,
222
- }, ...field, ...rest }));
222
+ }, defaultValue: defaultValue, ...field, ...rest }));
223
223
  } }));
224
224
  }
225
225
 
@@ -328,8 +328,7 @@ setFormSelected, clearError, resetForm, onFormBlur, handleSelect, ...rest }) {
328
328
  }
329
329
 
330
330
  function FormSelect({ name, isRequired, error, fieldsToReset, ...rest }) {
331
- const { control, setValue, clearErrors, unregister } = useFormContext();
332
- console.log(fieldsToReset);
331
+ const { control, setValue, clearErrors, unregister, resetField } = useFormContext();
333
332
  return (jsx(Controller, { name: name, control: control, rules: {
334
333
  ...(isRequired
335
334
  ? {
@@ -340,7 +339,10 @@ function FormSelect({ name, isRequired, error, fieldsToReset, ...rest }) {
340
339
  return (jsx(Select, { isRequired: true, error: {
341
340
  is: !!error,
342
341
  message: error?.message,
343
- }, setFormSelected: setValue, resetForm: () => fieldsToReset && fieldsToReset.map((field) => unregister(field)), clearError: clearErrors, onFormBlur: onBlur, ...restField, ...rest }));
342
+ }, setFormSelected: setValue, resetForm: () => fieldsToReset && fieldsToReset.map((field) => {
343
+ setValue(field, undefined);
344
+ unregister(field);
345
+ }), clearError: clearErrors, onFormBlur: onBlur, ...restField, ...rest }));
344
346
  } }));
345
347
  }
346
348
 
@@ -0,0 +1,4 @@
1
+ import "./index.css";
2
+ import { AccordionButton as AccordionButtonProps } from "./index.types";
3
+ export declare function AccordionButton({ children, is, label, ...rest }: AccordionButtonProps): import("react/jsx-runtime").JSX.Element;
4
+ export default AccordionButton;
@@ -0,0 +1,4 @@
1
+ import "./index.css";
2
+ import { AccordionContent as AccordionContentProps } from "./index.types";
3
+ export declare const AccordionContent: ({ children, label, toggle, }: AccordionContentProps) => false | "" | import("react/jsx-runtime").JSX.Element | undefined;
4
+ export default AccordionContent;
@@ -0,0 +1,4 @@
1
+ import "./index.css";
2
+ import { AccordionItem as AccordionItemProps } from "./index.types";
3
+ export declare function AccordionItem({ children, label, isExpanded, }: AccordionItemProps): import("react/jsx-runtime").JSX.Element;
4
+ export default AccordionItem;
@@ -0,0 +1,4 @@
1
+ import "./index.css";
2
+ import { Accordion as AccordionProps } from "./index.types";
3
+ export declare function Accordion({ children, expanded, }: AccordionProps): import("react/jsx-runtime").JSX.Element;
4
+ export default Accordion;
@@ -0,0 +1,4 @@
1
+ export { Accordion } from "./accordion";
2
+ export { AccordionItem } from "./accordion-item";
3
+ export { AccordionButton } from "./accordion-button";
4
+ export { AccordionContent } from "./accordion-content";
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { Accordion } from "./accordion";
3
+ declare const meta: Meta<typeof Accordion>;
4
+ type Story = StoryObj<typeof Accordion>;
5
+ export declare const Primary: Story;
6
+ export default meta;
@@ -0,0 +1,34 @@
1
+ import { ReactNode } from "react";
2
+ import { ButtonAsButton, ButtonAsLink } from "../button/index.types";
3
+ export interface Accordion {
4
+ /**
5
+ * Accordion children
6
+ */
7
+ children: ReactNode | ReactNode[];
8
+ /**
9
+ * Expand all items
10
+ */
11
+ expanded: "all" | "none" | "custom";
12
+ }
13
+ export interface ToggleArray {
14
+ [key: string]: {
15
+ depth: number;
16
+ isToggle: boolean;
17
+ paddingLeft?: string;
18
+ };
19
+ }
20
+ export interface AccordionItem {
21
+ children: ReactNode | ReactNode[];
22
+ label?: string;
23
+ isExpanded?: boolean;
24
+ }
25
+ export type AccordionButton = ButtonAsButton & ButtonAsLink & {
26
+ is?: "button" | "link";
27
+ label?: string;
28
+ toggle?: ToggleArray;
29
+ };
30
+ export interface AccordionContent {
31
+ children: ReactNode | ReactNode[];
32
+ label?: string;
33
+ toggle?: ToggleArray;
34
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { ButtonAsButton, ButtonAsLink } from "./index.types";
3
+ import "./index.css";
4
+ export declare function Button({ children, className, icon, isNewWindow, mode, size, as, CustomAnchor, ...rest }: ButtonAsButton | ButtonAsLink): JSX.Element;
5
+ export default Button;
@@ -0,0 +1,7 @@
1
+ import { StoryObj, Meta } from "@storybook/react";
2
+ import { Button } from "./index";
3
+ declare const meta: Meta<typeof Button>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Button>;
6
+ export declare const Primary: Story;
7
+ export declare const Secondary: Story;
@@ -0,0 +1,41 @@
1
+ /// <reference types="react" />
2
+ type Mode = "primary" | "secondary" | "icon";
3
+ type Size = "small" | "medium" | "large";
4
+ export type ButtonAsButton = Base & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof Base> & {
5
+ as?: "button";
6
+ };
7
+ export type ButtonAsLink = Base & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof Base> & {
8
+ as?: "link";
9
+ };
10
+ export interface Base {
11
+ /**
12
+ * What to put inside the button (string or html elements)
13
+ */
14
+ children?: JSX.Element | string;
15
+ /**
16
+ * Custom css class name
17
+ */
18
+ className?: string;
19
+ /**
20
+ * If you want to add an icon image next to the children. Needs to be an react html element.
21
+ */
22
+ icon?: JSX.Element;
23
+ /**
24
+ * If you want to open a new window on the browser when you click the button. Only applies to html anchor elements.
25
+ */
26
+ isNewWindow?: boolean;
27
+ /**
28
+ * Css mode used to style the button.
29
+ */
30
+ mode?: Mode;
31
+ /**
32
+ * Button size.
33
+ */
34
+ size?: Size;
35
+ /**
36
+ * Button type.
37
+ */
38
+ as?: "button" | "link";
39
+ CustomAnchor?: React.ComponentClass<any>;
40
+ }
41
+ export {};
@@ -0,0 +1,4 @@
1
+ import "./index.css";
2
+ import { FormInputs } from "./index.types";
3
+ export declare function FormInput({ name, isRequired, error, defaultValue, ...rest }: FormInputs): import("react/jsx-runtime").JSX.Element;
4
+ export default FormInput;
@@ -0,0 +1,4 @@
1
+ import "./index.css";
2
+ import { FormSelect as FormSelectProps } from "./index.types";
3
+ export declare function FormSelect({ name, isRequired, error, fieldsToReset, ...rest }: FormSelectProps): import("react/jsx-runtime").JSX.Element;
4
+ export default FormSelect;
@@ -0,0 +1,4 @@
1
+ import "./index.css";
2
+ import { FormInputs } from "./index.types";
3
+ export declare function FormTextArea({ name, isRequired, error, ...rest }: FormInputs): import("react/jsx-runtime").JSX.Element;
4
+ export default FormTextArea;
@@ -0,0 +1,4 @@
1
+ import { Form as FormProps } from "./index.types";
2
+ import "./index.css";
3
+ export declare function Form({ children, onSubmit, submitButton, initialState, ...rest }: FormProps): import("react/jsx-runtime").JSX.Element;
4
+ export default Form;
@@ -0,0 +1,7 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { Form } from "./index";
3
+ declare const meta: Meta<typeof Form>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Form>;
6
+ export declare const InsertForm: Story;
7
+ export declare const UpdateForm: Story;
@@ -0,0 +1,45 @@
1
+ import { Dispatch, JSXElementConstructor, ReactElement, ReactNode, SetStateAction } from "react";
2
+ import { FieldError, FieldErrorsImpl, FieldValues, FormState, Merge } from "react-hook-form";
3
+ import { Input } from "../input/index.types";
4
+ import { TextArea } from "../text-area/index.types";
5
+ import { Select } from "../select/index.types";
6
+ export interface Form {
7
+ /**
8
+ * Custom css class name.
9
+ */
10
+ className?: string;
11
+ children?: ReactNode | ReactNode[];
12
+ onSubmit: (data: FieldValues, setResult: SetResult) => void;
13
+ submitButton?: {
14
+ label: string;
15
+ };
16
+ initialState?: FormState<FieldValues>;
17
+ }
18
+ export interface ReactNodeControlled extends ReactElement<any, string | JSXElementConstructor<any>> {
19
+ props: ControlledInput;
20
+ }
21
+ export type ControlledInput = Input & TextArea & {
22
+ name: string;
23
+ error: string;
24
+ };
25
+ export type SetResult = Dispatch<SetStateAction<{
26
+ message?: string;
27
+ isSuccess: boolean;
28
+ }>>;
29
+ export interface FormInputs extends Input {
30
+ name: string;
31
+ isRequired?: boolean;
32
+ error?: {
33
+ message?: string | false | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined;
34
+ is?: boolean;
35
+ };
36
+ }
37
+ export interface FormSelect extends Select {
38
+ name: string;
39
+ isRequired?: boolean;
40
+ error?: {
41
+ message?: string | false | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined;
42
+ is?: boolean;
43
+ };
44
+ fieldsToReset?: string[];
45
+ }
@@ -0,0 +1,4 @@
1
+ import { Input as InputProps } from "./index.types";
2
+ import "./index.css";
3
+ export declare function Input({ inputClassName, classNameGroup, error, inputRef, styleGroup, placeholder, label, labelClass, icon, ...rest }: InputProps): import("react/jsx-runtime").JSX.Element;
4
+ export default Input;
@@ -0,0 +1,8 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { Input } from "./index";
3
+ declare const meta: Meta<typeof Input>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Input>;
6
+ export declare const Primary: Story;
7
+ export declare const Error: Story;
8
+ export declare const Search: Story;
@@ -0,0 +1,40 @@
1
+ import { dataTheme } from "data-theme";
2
+ import { CSSProperties, ReactNode, Ref } from "react";
3
+ import { FieldError, FieldErrorsImpl, Merge } from "react-hook-form";
4
+ export interface Input extends React.InputHTMLAttributes<HTMLInputElement> {
5
+ /**
6
+ * Custom css class name.
7
+ */
8
+ inputClassName?: string;
9
+ /**
10
+ * Custom css class name for group wrapper.
11
+ */
12
+ classNameGroup?: string;
13
+ /**
14
+ * Data theme for the html. `${themes}`
15
+ */
16
+ paletteTheme?: dataTheme;
17
+ /**
18
+ * Error message to show when input has an error.
19
+ */
20
+ error?: {
21
+ message?: string | false | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined;
22
+ is?: boolean;
23
+ };
24
+ /**
25
+ * Ref react elemnt to use
26
+ */
27
+ inputRef?: Ref<HTMLInputElement>;
28
+ /**
29
+ * Style input group wrapper
30
+ */
31
+ styleGroup?: CSSProperties;
32
+ isRequired?: boolean;
33
+ label?: string;
34
+ labelClass?: string;
35
+ icon?: {
36
+ className?: string;
37
+ element?: ReactNode;
38
+ position?: "right" | "left";
39
+ };
40
+ }
@@ -0,0 +1,4 @@
1
+ import { Loading as LoadingProps } from "./index.types";
2
+ import "./index.css";
3
+ export declare function Loading({ img, children }: LoadingProps): import("react/jsx-runtime").JSX.Element;
4
+ export default Loading;
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { Loading } from "./index";
3
+ declare const meta: Meta<typeof Loading>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Loading>;
6
+ export declare const Primary: Story;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ export interface Loading {
3
+ /**
4
+ * Image or gif used
5
+ */
6
+ img?: string;
7
+ /**
8
+ * Message that its sent
9
+ */
10
+ children?: React.ReactNode;
11
+ }
@@ -0,0 +1,4 @@
1
+ import { Modal as ModalProps } from "./index.types";
2
+ import "./index.css";
3
+ export declare function Modal({ modalref, children, title, subtitle, footer, hasCloseButton, handleClose, }: ModalProps): import("react/jsx-runtime").JSX.Element;
4
+ export default Modal;
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { Modal } from "./index";
3
+ declare const meta: Meta<typeof Modal>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Modal>;
6
+ export declare const Primary: Story;
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ export interface Modal {
3
+ /**
4
+ * Children
5
+ */
6
+ children?: React.ReactNode;
7
+ /**
8
+ * Modal footer
9
+ */
10
+ footer?: React.ReactNode;
11
+ /**
12
+ * Close click function
13
+ */
14
+ handleClose?: any;
15
+ /**
16
+ * Modal close button
17
+ */
18
+ hasCloseButton?: boolean;
19
+ /**
20
+ * Modal body ref
21
+ */
22
+ modalref?: React.LegacyRef<HTMLDivElement>;
23
+ /**
24
+ * Subtitle of the modal
25
+ */
26
+ subtitle?: React.ReactNode;
27
+ /**
28
+ * Title of the modal
29
+ */
30
+ title?: React.ReactNode;
31
+ }
@@ -0,0 +1,4 @@
1
+ import { Select as SelectProps } from "./index.types";
2
+ import "./index.css";
3
+ export declare function Select({ inputClassName, classNameGroup, options, styleGroup, defaultValue, setFormSelected, clearError, resetForm, onFormBlur, handleSelect, ...rest }: SelectProps): import("react/jsx-runtime").JSX.Element;
4
+ export default Select;
@@ -0,0 +1,7 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { Select } from "./index";
3
+ declare const meta: Meta<typeof Select>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Select>;
6
+ export declare const Primary: Story;
7
+ export declare const Error: Story;
@@ -0,0 +1,30 @@
1
+ import { CSSProperties } from "react";
2
+ import { dataTheme } from "data-theme";
3
+ export interface Select extends React.InputHTMLAttributes<HTMLInputElement> {
4
+ /**
5
+ * Custom css class name.
6
+ */
7
+ inputClassName?: string;
8
+ /**
9
+ * Custom css class name for group wrapper.
10
+ */
11
+ classNameGroup?: string;
12
+ /**
13
+ * Data theme for the html. `${themes}`
14
+ */
15
+ paletteTheme?: dataTheme;
16
+ /**
17
+ * Error message to show when input has an error.
18
+ */
19
+ options?: string[];
20
+ /**
21
+ * Style input group wrapper
22
+ */
23
+ styleGroup?: CSSProperties;
24
+ defaultValue?: string;
25
+ setFormSelected?: any;
26
+ clearError?: any;
27
+ resetForm?: any;
28
+ onFormBlur?: any;
29
+ handleSelect?: any;
30
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { TextArea as TextAreaProps } from "./index.types";
3
+ import "./index.css";
4
+ export declare function TextArea({ className, disabled, hasToggleButton, hideHeight, placeholder, showHeight, style, textareaClassName, label, labelClass, error, ...rest }: TextAreaProps): JSX.Element;
5
+ export default TextArea;
@@ -0,0 +1,7 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { TextArea } from "./index";
3
+ declare const meta: Meta<typeof TextArea>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof TextArea>;
6
+ export declare const Active: Story;
7
+ export declare const Disabled: Story;
@@ -0,0 +1,37 @@
1
+ import { CSSProperties } from "react";
2
+ export interface TextArea extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
3
+ /**
4
+ * Custom css class name textarea wrapper.
5
+ */
6
+ className?: string;
7
+ /**
8
+ * Disable prop
9
+ */
10
+ disabled?: boolean;
11
+ /**
12
+ * Check if there is a toggle button
13
+ */
14
+ hasToggleButton?: boolean;
15
+ /**
16
+ * Minimum height if toggle button is true
17
+ */
18
+ hideHeight?: string;
19
+ /**
20
+ * Placeholder for textarea html tag
21
+ */
22
+ placeholder?: string;
23
+ /**
24
+ * Maximum height if toggle button is false
25
+ */
26
+ showHeight?: string;
27
+ /**
28
+ * Style textarea group wrapper
29
+ */
30
+ style?: CSSProperties;
31
+ /**
32
+ * Classname of the textarea
33
+ */
34
+ textareaClassName?: string;
35
+ label?: string;
36
+ labelClass?: string;
37
+ }
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { Accordion, ToggleArray } from "../../components/accordion/index.types";
3
+ interface State {
4
+ toggle?: ToggleArray;
5
+ setToggle: (prev: any) => void;
6
+ }
7
+ declare const AccordionContext: React.Context<State | undefined>;
8
+ declare function AccordionProvider({ children, expanded }: Accordion): import("react/jsx-runtime").JSX.Element;
9
+ declare function useAccordion(): State;
10
+ export { useAccordion, AccordionContext, AccordionProvider };
@@ -0,0 +1,24 @@
1
+ import React, { ReactNode, RefObject } from "react";
2
+ type State = {
3
+ isLoading: boolean;
4
+ message?: string | React.ReactNode;
5
+ ref?: RefObject<ReactNode>;
6
+ };
7
+ type Context = {
8
+ state: State;
9
+ setRef: (ref: RefObject<ReactNode>) => void;
10
+ setMessage: (message: string) => void;
11
+ startLoading: () => void;
12
+ stopLoading: () => void;
13
+ };
14
+ type LoadingProviderProps = {
15
+ children: React.ReactNode;
16
+ };
17
+ type UseLoadingProps = {
18
+ ref?: RefObject<ReactNode>;
19
+ message?: string;
20
+ };
21
+ declare const LoadingContext: React.Context<Context | undefined>;
22
+ declare function LoadingProvider({ children }: LoadingProviderProps): import("react/jsx-runtime").JSX.Element;
23
+ declare function useLoading({ ref, message }?: UseLoadingProps): Context;
24
+ export { LoadingContext, LoadingProvider, useLoading };
@@ -0,0 +1,8 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { LoadingProvider } from ".";
3
+ declare const meta: Meta<typeof LoadingProvider>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof LoadingProvider>;
6
+ export declare const Basic: Story;
7
+ export declare const CustomMessage: Story;
8
+ export declare const CustomImage: Story;
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import Modal from "../../components/modal";
3
+ type Modal = {
4
+ title?: React.ReactNode;
5
+ subtitle?: React.ReactNode;
6
+ content?: React.ReactNode;
7
+ hasCloseButton?: boolean;
8
+ footer?: React.ReactNode;
9
+ };
10
+ interface State extends Modal {
11
+ isModal: boolean;
12
+ }
13
+ type Context = {
14
+ state: State;
15
+ openModal: (modal?: Modal) => void;
16
+ closeModal: () => void;
17
+ };
18
+ type ModalProviderProps = {
19
+ children: React.ReactNode;
20
+ };
21
+ type UseModalProps = {};
22
+ declare const ModalContext: React.Context<Context | undefined>;
23
+ declare function ModalProvider({ children }: ModalProviderProps): import("react/jsx-runtime").JSX.Element;
24
+ declare function useModal({}?: UseModalProps): Context;
25
+ export { ModalContext, ModalProvider, useModal };
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { ModalProvider } from ".";
3
+ declare const meta: Meta<typeof ModalProvider>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof ModalProvider>;
6
+ export declare const Basic: Story;
@@ -0,0 +1,18 @@
1
+ import { DataPalette } from "data-palette";
2
+ import React from "react";
3
+ type DataTheme = "light" | "dark";
4
+ type State = {
5
+ dataTheme?: DataTheme;
6
+ switchDataTheme: (mode: DataTheme) => void;
7
+ dataPalette?: DataPalette;
8
+ switchDataPalette: (mode: DataPalette) => void;
9
+ };
10
+ type ThemeProviderProps = {
11
+ children: React.ReactNode;
12
+ dataTheme?: DataTheme;
13
+ dataPalette?: DataPalette;
14
+ };
15
+ declare const ThemeContext: React.Context<State | undefined>;
16
+ declare function ThemeProvider({ children, dataTheme: dataThemeProp, dataPalette: dataPaletteProp, }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
17
+ declare function useTheme(): State;
18
+ export { ThemeContext, ThemeProvider, useTheme };
@@ -0,0 +1,7 @@
1
+ import { StoryContext, StoryFn } from "@storybook/react";
2
+ import "../styles/variables.css";
3
+ export declare const withColorScheme: (Story: StoryFn, context: StoryContext) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const Wrapped: ({ Story, context, }: {
5
+ Story: StoryFn;
6
+ context: StoryContext;
7
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { StoryContext, StoryFn } from "@storybook/react";
2
+ export declare const withLoading: (Story: StoryFn, context: StoryContext) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { StoryContext, StoryFn } from "@storybook/react";
2
+ export declare const withModal: (Story: StoryFn, context: StoryContext) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { StoryContext, StoryFn } from "@storybook/react";
2
+ export declare const withWrapper: (Story: StoryFn, context: StoryContext) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import "../src/styles/variables.css";
2
+ export { Accordion, AccordionItem, AccordionButton, AccordionContent } from "./components/accordion";
3
+ export { Button } from "./components/button";
4
+ export { Form } from "./components/form";
5
+ export { FormInput } from "./components/form/FormInput";
6
+ export { FormTextArea } from "./components/form/FormTextArea";
7
+ export { FormSelect } from "./components/form/FormSelect";
8
+ export { Input } from "./components/input";
9
+ export { Loading } from "./components/loading";
10
+ export { Modal } from "./components/modal";
11
+ export { Select } from "./components/select";
12
+ export { TextArea } from "./components/text-area";
13
+ export { LoadingContext, LoadingProvider, useLoading } from "./context/loading";
14
+ export { ModalContext, ModalProvider, useModal } from "./context/modal";
15
+ export { ThemeContext, ThemeProvider, useTheme } from "./context/theme";
@@ -0,0 +1 @@
1
+ export declare const palette: readonly ["forest", "water", "earth"];
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from "react";
2
+ import { ToggleArray } from "../components/accordion/index.types";
3
+ export declare function recursiveChildren(children: ReactNode | ReactNode[], i?: number): ReactNode;
4
+ export declare function recursiveToggle(children: ReactNode[], toggleArray: ToggleArray | undefined, i: number | undefined, props: {
5
+ expanded: "all" | "none" | "custom";
6
+ }): ToggleArray | undefined;