@geoinsight/react-components 1.0.7 → 1.1.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/.yarn/install-state.gz +0 -0
- package/dist/cjs/components/button/index.d.ts +9 -0
- package/dist/cjs/components/button/index.stories.d.ts +19 -0
- package/dist/cjs/components/button/index.types.d.ts +50 -0
- package/dist/cjs/components/form/form-input.d.ts +4 -0
- package/dist/cjs/components/form/form-select.d.ts +4 -0
- package/dist/cjs/components/form/form-text-area.d.ts +4 -0
- package/dist/cjs/components/form/index.d.ts +4 -0
- package/dist/cjs/components/form/index.stories.d.ts +10 -0
- package/dist/cjs/components/form/index.types.d.ts +72 -0
- package/dist/cjs/components/input/index.d.ts +4 -0
- package/dist/cjs/components/input/index.stories.d.ts +12 -0
- package/dist/cjs/components/input/index.types.d.ts +56 -0
- package/dist/cjs/components/loading/index.d.ts +4 -0
- package/dist/cjs/components/loading/index.stories.d.ts +6 -0
- package/dist/cjs/components/loading/index.types.d.ts +11 -0
- package/dist/cjs/components/menu/index.d.ts +11 -0
- package/dist/cjs/components/menu/index.stories.d.ts +7 -0
- package/dist/cjs/components/menu/menu-button.d.ts +21 -0
- package/dist/cjs/components/menu/menu-content.d.ts +8 -0
- package/dist/cjs/components/menu/menu-item.d.ts +10 -0
- package/dist/cjs/components/menu/menu-root.d.ts +21 -0
- package/dist/cjs/components/menu/menu-utils.d.ts +1 -0
- package/dist/cjs/components/menu/menu-wrapper.d.ts +10 -0
- package/dist/cjs/components/modal/index.d.ts +4 -0
- package/dist/cjs/components/modal/index.stories.d.ts +11 -0
- package/dist/cjs/components/modal/index.types.d.ts +39 -0
- package/dist/cjs/components/range/hooks.d.ts +34 -0
- package/dist/cjs/components/range/index.d.ts +4 -0
- package/dist/cjs/components/range/index.stories.d.ts +9 -0
- package/dist/cjs/components/range/index.types.d.ts +18 -0
- package/dist/cjs/components/range/range-content.d.ts +16 -0
- package/dist/cjs/components/range/range-controls.d.ts +13 -0
- package/dist/cjs/components/range/range-thumb.d.ts +12 -0
- package/dist/cjs/components/range/values.d.ts +1 -0
- package/dist/cjs/components/select/index.d.ts +4 -0
- package/dist/cjs/components/select/index.stories.d.ts +10 -0
- package/dist/cjs/components/select/index.types.d.ts +53 -0
- package/dist/cjs/components/text-area/index.d.ts +5 -0
- package/dist/cjs/components/text-area/index.stories.d.ts +10 -0
- package/dist/cjs/components/text-area/index.types.d.ts +50 -0
- package/dist/cjs/context/loading/index.d.ts +24 -0
- package/dist/cjs/context/loading/index.stories.d.ts +8 -0
- package/dist/cjs/context/map/index.d.ts +20 -0
- package/dist/cjs/context/modal/index.d.ts +29 -0
- package/dist/cjs/context/modal/index.stories.d.ts +6 -0
- package/dist/cjs/context/theme/index.d.ts +18 -0
- package/dist/cjs/decorators/withColorScheme.d.ts +7 -0
- package/dist/cjs/decorators/withLoading.d.ts +2 -0
- package/dist/cjs/decorators/withMap.d.ts +2 -0
- package/dist/cjs/decorators/withModal.d.ts +2 -0
- package/dist/cjs/decorators/withWrapper.d.ts +2 -0
- package/dist/cjs/index.css +0 -164
- package/dist/cjs/index.d.ts +15 -0
- package/dist/cjs/index.js +83 -248
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/html.d.ts +10 -0
- package/dist/cjs/utils/palette.d.ts +1 -0
- package/dist/esm/components/button/index.d.ts +9 -0
- package/dist/esm/components/button/index.stories.d.ts +19 -0
- package/dist/esm/components/button/index.types.d.ts +50 -0
- package/dist/esm/components/form/form-input.d.ts +4 -0
- package/dist/esm/components/form/form-select.d.ts +4 -0
- package/dist/esm/components/form/form-text-area.d.ts +4 -0
- package/dist/esm/components/form/index.d.ts +4 -0
- package/dist/esm/components/form/index.stories.d.ts +10 -0
- package/dist/esm/components/form/index.types.d.ts +72 -0
- package/dist/esm/components/input/index.d.ts +4 -0
- package/dist/esm/components/input/index.stories.d.ts +12 -0
- package/dist/esm/components/input/index.types.d.ts +56 -0
- package/dist/esm/components/loading/index.d.ts +4 -0
- package/dist/esm/components/loading/index.stories.d.ts +6 -0
- package/dist/esm/components/loading/index.types.d.ts +11 -0
- package/dist/esm/components/menu/index.d.ts +11 -0
- package/dist/esm/components/menu/index.stories.d.ts +7 -0
- package/dist/esm/components/menu/menu-button.d.ts +21 -0
- package/dist/esm/components/menu/menu-content.d.ts +8 -0
- package/dist/esm/components/menu/menu-item.d.ts +10 -0
- package/dist/esm/components/menu/menu-root.d.ts +21 -0
- package/dist/esm/components/menu/menu-utils.d.ts +1 -0
- package/dist/esm/components/menu/menu-wrapper.d.ts +10 -0
- package/dist/esm/components/modal/index.d.ts +4 -0
- package/dist/esm/components/modal/index.stories.d.ts +11 -0
- package/dist/esm/components/modal/index.types.d.ts +39 -0
- package/dist/esm/components/range/hooks.d.ts +34 -0
- package/dist/esm/components/range/index.d.ts +4 -0
- package/dist/esm/components/range/index.stories.d.ts +9 -0
- package/dist/esm/components/range/index.types.d.ts +18 -0
- package/dist/esm/components/range/range-content.d.ts +16 -0
- package/dist/esm/components/range/range-controls.d.ts +13 -0
- package/dist/esm/components/range/range-thumb.d.ts +12 -0
- package/dist/esm/components/range/values.d.ts +1 -0
- package/dist/esm/components/select/index.d.ts +4 -0
- package/dist/esm/components/select/index.stories.d.ts +10 -0
- package/dist/esm/components/select/index.types.d.ts +53 -0
- package/dist/esm/components/text-area/index.d.ts +5 -0
- package/dist/esm/components/text-area/index.stories.d.ts +10 -0
- package/dist/esm/components/text-area/index.types.d.ts +50 -0
- package/dist/esm/context/loading/index.d.ts +24 -0
- package/dist/esm/context/loading/index.stories.d.ts +8 -0
- package/dist/esm/context/map/index.d.ts +20 -0
- package/dist/esm/context/modal/index.d.ts +29 -0
- package/dist/esm/context/modal/index.stories.d.ts +6 -0
- package/dist/esm/context/theme/index.d.ts +18 -0
- package/dist/esm/decorators/withColorScheme.d.ts +7 -0
- package/dist/esm/decorators/withLoading.d.ts +2 -0
- package/dist/esm/decorators/withMap.d.ts +2 -0
- package/dist/esm/decorators/withModal.d.ts +2 -0
- package/dist/esm/decorators/withWrapper.d.ts +2 -0
- package/dist/esm/index.css +0 -164
- package/dist/esm/index.d.ts +15 -0
- package/dist/esm/index.js +89 -231
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/html.d.ts +10 -0
- package/dist/esm/utils/palette.d.ts +1 -0
- package/package.json +1 -5
- package/yarn-error.log +12301 -0
- package/storybook-static/152.8abc3852.iframe.bundle.js +0 -2
- package/storybook-static/152.8abc3852.iframe.bundle.js.LICENSE.txt +0 -1
- package/storybook-static/208.291d21a5.iframe.bundle.js +0 -1
- package/storybook-static/220.4dc42c27.iframe.bundle.js +0 -2
- package/storybook-static/220.4dc42c27.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/264.98d49cd2.iframe.bundle.js +0 -1
- package/storybook-static/312.2f98f4ec.iframe.bundle.js +0 -1
- package/storybook-static/396.990f5560.iframe.bundle.js +0 -44
- package/storybook-static/396.990f5560.iframe.bundle.js.map +0 -1
- package/storybook-static/469.cb6076e5.iframe.bundle.js +0 -1
- package/storybook-static/552.45824652.iframe.bundle.js +0 -2
- package/storybook-static/552.45824652.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/555.3fb6fb46.iframe.bundle.js +0 -1
- package/storybook-static/56.9c067d9e.iframe.bundle.js +0 -1
- package/storybook-static/640.fb22d04d.iframe.bundle.js +0 -1
- package/storybook-static/724.476611a3.iframe.bundle.js +0 -1
- package/storybook-static/844.5fbe92f6.iframe.bundle.js +0 -1
- package/storybook-static/848.c8cbb771.iframe.bundle.js +0 -1
- package/storybook-static/880.b3bec938.iframe.bundle.js +0 -411
- package/storybook-static/880.b3bec938.iframe.bundle.js.LICENSE.txt +0 -53
- package/storybook-static/880.b3bec938.iframe.bundle.js.map +0 -1
- package/storybook-static/896.23340cff.iframe.bundle.js +0 -134
- package/storybook-static/896.23340cff.iframe.bundle.js.LICENSE.txt +0 -16
- package/storybook-static/896.23340cff.iframe.bundle.js.map +0 -1
- package/storybook-static/912.7731826c.iframe.bundle.js +0 -1
- package/storybook-static/936.074caa83.iframe.bundle.js +0 -2
- package/storybook-static/936.074caa83.iframe.bundle.js.LICENSE.txt +0 -5
- package/storybook-static/components-button-index-stories.8947be63.iframe.bundle.js +0 -1
- package/storybook-static/components-form-index-stories.539cf993.iframe.bundle.js +0 -1
- package/storybook-static/components-input-index-stories.2c44b5fd.iframe.bundle.js +0 -2
- package/storybook-static/components-input-index-stories.2c44b5fd.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/components-loading-index-stories.1cd8adfc.iframe.bundle.js +0 -2
- package/storybook-static/components-loading-index-stories.1cd8adfc.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/components-map-index-stories.60981082.iframe.bundle.js +0 -1
- package/storybook-static/components-menu-index-stories.cf33511f.iframe.bundle.js +0 -1
- package/storybook-static/components-modal-index-stories.5e137e54.iframe.bundle.js +0 -2
- package/storybook-static/components-modal-index-stories.5e137e54.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/components-select-index-stories.935a9985.iframe.bundle.js +0 -1
- package/storybook-static/components-text-area-index-stories.5507a19e.iframe.bundle.js +0 -2
- package/storybook-static/components-text-area-index-stories.5507a19e.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/context-loading-index-stories.fa3f7a89.iframe.bundle.js +0 -2
- package/storybook-static/context-loading-index-stories.fa3f7a89.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/context-modal-index-stories.9161ad78.iframe.bundle.js +0 -2
- package/storybook-static/context-modal-index-stories.9161ad78.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/favicon.svg +0 -7
- package/storybook-static/iframe.html +0 -355
- package/storybook-static/index.html +0 -127
- package/storybook-static/index.json +0 -1
- package/storybook-static/main.d84ed3e5.iframe.bundle.js +0 -1
- package/storybook-static/project.json +0 -1
- package/storybook-static/runtime~main.508d9d16.iframe.bundle.js +0 -1
- package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js +0 -12
- package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +0 -63
- package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.LEGAL.txt +0 -18
- package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/interactions-8/manager-bundle.js +0 -12
- package/storybook-static/sb-addons/interactions-8/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/links-0/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/links-0/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-common-assets/fonts.css +0 -31
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/WithTooltip-V3YHNWJZ-LVYLGZW2.js +0 -1
- package/storybook-static/sb-manager/chunk-2IXBUOFS.js +0 -7
- package/storybook-static/sb-manager/chunk-INSKDKQB.js +0 -348
- package/storybook-static/sb-manager/chunk-NGTUFCUO.js +0 -9
- package/storybook-static/sb-manager/chunk-NMB3SATH.js +0 -406
- package/storybook-static/sb-manager/chunk-ZEU7PDD3.js +0 -1
- package/storybook-static/sb-manager/formatter-SWP5E3XI-7BGIK6BL.js +0 -156
- package/storybook-static/sb-manager/globals-module-info.js +0 -1
- package/storybook-static/sb-manager/globals.js +0 -1
- package/storybook-static/sb-manager/index.js +0 -1
- package/storybook-static/sb-manager/runtime.js +0 -1
- package/storybook-static/sb-manager/syntaxhighlighter-V7JZZA35-DXZCI2WR.js +0 -1
- package/storybook-static/sb-preview/globals.js +0 -1
- package/storybook-static/sb-preview/runtime.js +0 -112
- package/storybook-static/static/media/code-brackets.2e1112d7.svg +0 -1
- package/storybook-static/static/media/colors.a4bd0486.svg +0 -1
- package/storybook-static/static/media/comments.a3859089.svg +0 -1
- package/storybook-static/static/media/direction.b770f9af.svg +0 -1
- package/storybook-static/static/media/flow.edad2ac1.svg +0 -1
- package/storybook-static/static/media/loading.cbc96c95.gif +0 -0
- package/storybook-static/static/media/plugin.d494b228.svg +0 -1
- package/storybook-static/static/media/repo.6d496322.svg +0 -1
- package/storybook-static/static/media/spinner_2.6f37ee56.png +0 -0
- package/storybook-static/static/media/stackalt.dba9fbb3.svg +0 -1
- package/storybook-static/stories-Introduction-stories-mdx.21cb2fa7.iframe.bundle.js +0 -2
- package/storybook-static/stories-Introduction-stories-mdx.21cb2fa7.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/stories.json +0 -1
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ButtonAsButton, ButtonAsLink } from "./index.types";
|
|
2
|
+
import "./index.css";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
export declare const Anchor: ({ Custom, children, ...rest }: {
|
|
5
|
+
Custom?: import("react").ComponentClass<any, any> | undefined;
|
|
6
|
+
children?: ReactNode[] | undefined;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function Button({ children, className, icon, isNewWindow, mode, size, as, CustomAnchor, ...rest }: ButtonAsButton | ButtonAsLink): JSX.Element;
|
|
9
|
+
export default Button;
|
|
@@ -0,0 +1,19 @@
|
|
|
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 ButtonPrimaryMedium: Story;
|
|
7
|
+
export declare const ButtonPrimaryLarge: Story;
|
|
8
|
+
export declare const ButtonPrimarySmall: Story;
|
|
9
|
+
export declare const ButtonPrimaryDisabled: Story;
|
|
10
|
+
export declare const ButtonPrimaryWithIcon: Story;
|
|
11
|
+
export declare const ButtonSecondary: Story;
|
|
12
|
+
export declare const ButtonSecondaryWithIcon: Story;
|
|
13
|
+
export declare const ButtonSecondaryDisabled: Story;
|
|
14
|
+
export declare const ButtonIcon: Story;
|
|
15
|
+
export declare const LinkPrimary: Story;
|
|
16
|
+
export declare const LinkSecondary: Story;
|
|
17
|
+
export declare const LinkIcon: Story;
|
|
18
|
+
export declare const LinkOutsideButton: Story;
|
|
19
|
+
export declare const LinkOutsideButtonAsPureLink: Story;
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
/**
|
|
40
|
+
* Anchor for the button to follow.
|
|
41
|
+
*/
|
|
42
|
+
CustomAnchor?: React.ComponentClass<any>;
|
|
43
|
+
/**
|
|
44
|
+
* Custom background color for storybook.
|
|
45
|
+
*/
|
|
46
|
+
backgroundColor?: string;
|
|
47
|
+
/** Link to url */
|
|
48
|
+
link?: string;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
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 UpdateFormWithFullInitialState: Story;
|
|
8
|
+
export declare const OnlyInput: Story;
|
|
9
|
+
export declare const OnlyTextArea: Story;
|
|
10
|
+
export declare const OnlySelectDifferentButton: Story;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Dispatch, JSXElementConstructor, ReactElement, ReactNode, SetStateAction } from "react";
|
|
2
|
+
import { FieldError, FieldErrorsImpl, FieldValues, Merge, UseFormReturn } from "react-hook-form";
|
|
3
|
+
import { Input } from "../input/index.types";
|
|
4
|
+
import { TextArea } from "../text-area/index.types";
|
|
5
|
+
export interface Form {
|
|
6
|
+
/**
|
|
7
|
+
* Custom css class name.
|
|
8
|
+
*/
|
|
9
|
+
className?: string;
|
|
10
|
+
/**
|
|
11
|
+
* In case the form has children to pass.
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode | ReactNode[];
|
|
14
|
+
/**
|
|
15
|
+
* Function that submits the form
|
|
16
|
+
*/
|
|
17
|
+
onSubmit: (data: FieldValues, methods: UseFormReturn, setResult: SetResult) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Text that goes on the submit form button.
|
|
20
|
+
*/
|
|
21
|
+
submitButton?: {
|
|
22
|
+
label: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Initial state of the form, values that are defaults. Ex: name: "Test", type: "Test Type", subject: "Test Subject", [type]: "Test Type II",
|
|
26
|
+
*/
|
|
27
|
+
initialState?: {
|
|
28
|
+
defaultValues?: {
|
|
29
|
+
name?: string;
|
|
30
|
+
type?: string;
|
|
31
|
+
subject?: string;
|
|
32
|
+
customValues?: {
|
|
33
|
+
[key: string]: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Custom background color if needed.
|
|
39
|
+
*/
|
|
40
|
+
backgroundColor?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ReactNodeControlled extends ReactElement<any, string | JSXElementConstructor<any>> {
|
|
43
|
+
props: ControlledInput;
|
|
44
|
+
}
|
|
45
|
+
export type ControlledInput = Input & TextArea & {
|
|
46
|
+
name: string;
|
|
47
|
+
error: string;
|
|
48
|
+
};
|
|
49
|
+
export type SetResult = Dispatch<SetStateAction<{
|
|
50
|
+
message?: string;
|
|
51
|
+
isSuccess: boolean;
|
|
52
|
+
}>>;
|
|
53
|
+
export interface FormInputs extends Input {
|
|
54
|
+
name: string;
|
|
55
|
+
isRequired?: boolean;
|
|
56
|
+
error?: {
|
|
57
|
+
message?: string | false | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined;
|
|
58
|
+
is?: boolean;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface FormSelect {
|
|
62
|
+
name: string;
|
|
63
|
+
isRequired?: boolean;
|
|
64
|
+
label: string;
|
|
65
|
+
options: string[];
|
|
66
|
+
error?: {
|
|
67
|
+
message?: string | false | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined;
|
|
68
|
+
is?: boolean;
|
|
69
|
+
};
|
|
70
|
+
fieldsToReset?: string[];
|
|
71
|
+
handleSelect: Function;
|
|
72
|
+
}
|
|
@@ -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, labelClassName, icon, isRequired, backgroundColor, ...rest }: InputProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default Input;
|
|
@@ -0,0 +1,12 @@
|
|
|
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;
|
|
9
|
+
export declare const WithLabel: Story;
|
|
10
|
+
export declare const WithLabelSpecialClass: Story;
|
|
11
|
+
export declare const WithCustomClassName: Story;
|
|
12
|
+
export declare const CustomBackgroundColor: Story;
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
/**Placeholder text for the input */
|
|
6
|
+
placeholder: string;
|
|
7
|
+
/**
|
|
8
|
+
* Custom css class name.
|
|
9
|
+
*/
|
|
10
|
+
inputClassName?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Custom css class name for group wrapper.
|
|
13
|
+
*/
|
|
14
|
+
classNameGroup?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Data theme for the html. `${themes}`
|
|
17
|
+
*/
|
|
18
|
+
paletteTheme?: dataTheme;
|
|
19
|
+
/**
|
|
20
|
+
* Error message to show when input has an error.
|
|
21
|
+
*/
|
|
22
|
+
error?: {
|
|
23
|
+
message?: string | false | FieldError | Merge<FieldError, FieldErrorsImpl<any>> | undefined;
|
|
24
|
+
is?: boolean;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Ref react element to use
|
|
28
|
+
*/
|
|
29
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
30
|
+
/**
|
|
31
|
+
* Style input group wrapper
|
|
32
|
+
*/
|
|
33
|
+
styleGroup?: CSSProperties;
|
|
34
|
+
/**
|
|
35
|
+
* Sets if input is required or not
|
|
36
|
+
*/
|
|
37
|
+
isRequired?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Add a label to the input
|
|
40
|
+
*/
|
|
41
|
+
label?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Styles the label of the input
|
|
44
|
+
*/
|
|
45
|
+
labelClassName?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Add an icon to the right or the left of the input
|
|
48
|
+
*/
|
|
49
|
+
icon?: {
|
|
50
|
+
className?: string;
|
|
51
|
+
element?: ReactNode;
|
|
52
|
+
position?: "right" | "left";
|
|
53
|
+
};
|
|
54
|
+
/** Add custom background color for the input */
|
|
55
|
+
backgroundColor?: string;
|
|
56
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface Loading {
|
|
3
|
+
/**
|
|
4
|
+
* Either pass an image or gif or nothing at all. Passing an empty string will break the component.
|
|
5
|
+
*/
|
|
6
|
+
img?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Message that its sent: string or number
|
|
9
|
+
*/
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MenuButton } from "./menu-button";
|
|
2
|
+
import { MenuContent } from "./menu-content";
|
|
3
|
+
import { MenuItem } from "./menu-item";
|
|
4
|
+
import { MenuRoot } from "./menu-root";
|
|
5
|
+
export declare const Menu: {
|
|
6
|
+
Root: typeof MenuRoot;
|
|
7
|
+
Item: typeof MenuItem;
|
|
8
|
+
Button: typeof MenuButton;
|
|
9
|
+
Content: typeof MenuContent;
|
|
10
|
+
};
|
|
11
|
+
export default Menu;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Menu from ".";
|
|
3
|
+
declare const meta: Meta<typeof Menu>;
|
|
4
|
+
type Story = StoryObj<typeof Menu>;
|
|
5
|
+
export declare const PrimaryOpenByDefault: Story;
|
|
6
|
+
export declare const SecondaryClosedByDefault: Story;
|
|
7
|
+
export default meta;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** React */
|
|
2
|
+
import React, { HtmlHTMLAttributes, ReactNode } from "react";
|
|
3
|
+
/** CSS */
|
|
4
|
+
import "./index.css";
|
|
5
|
+
/** Props */
|
|
6
|
+
type Props = HtmlHTMLAttributes<HTMLDivElement> & {
|
|
7
|
+
anchor?: React.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
8
|
+
Custom?: React.ComponentClass<any>;
|
|
9
|
+
};
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
buttonClassName?: string;
|
|
12
|
+
nested?: boolean;
|
|
13
|
+
subnested?: boolean;
|
|
14
|
+
dropdown?: boolean;
|
|
15
|
+
isLink?: boolean;
|
|
16
|
+
isSelected?: boolean;
|
|
17
|
+
handleCallbackClick?: () => void;
|
|
18
|
+
"data-menu-id"?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function MenuButton({ anchor, children, buttonClassName, nested, subnested, dropdown, isLink, isSelected, handleCallbackClick, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** React */
|
|
2
|
+
import { HTMLAttributes } from "react";
|
|
3
|
+
/** Props */
|
|
4
|
+
type Props = HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
"data-menu-id"?: string | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare function MenuContent({ children, ...props }: Props): import("react/jsx-runtime").JSX.Element | undefined;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** React */
|
|
2
|
+
import { HtmlHTMLAttributes, ReactNode } from "react";
|
|
3
|
+
/** CSS */
|
|
4
|
+
import "./index.css";
|
|
5
|
+
/** Props */
|
|
6
|
+
type Props = HtmlHTMLAttributes<HTMLDivElement> & {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export declare function MenuItem({ children, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** React */
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
|
+
/** Types */
|
|
4
|
+
type Item = {
|
|
5
|
+
id: string;
|
|
6
|
+
isExpanded: boolean;
|
|
7
|
+
};
|
|
8
|
+
/** Context type */
|
|
9
|
+
type MenuContextType = {
|
|
10
|
+
items: Record<string, Item>;
|
|
11
|
+
addItem: (item: Item) => void;
|
|
12
|
+
toggle: (id: string) => void;
|
|
13
|
+
};
|
|
14
|
+
/** Props */
|
|
15
|
+
type MenuRootProps = {
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
isOpenByDefault?: true;
|
|
18
|
+
};
|
|
19
|
+
export declare function MenuRoot({ children, isOpenByDefault }: MenuRootProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function useMenu(): React.Context<MenuContextType>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateId: () => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** React */
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
/** CSS */
|
|
4
|
+
import "./index.css";
|
|
5
|
+
/** Props */
|
|
6
|
+
type MenuWrapperProps = {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export declare function MenuWrapper({ children }: MenuWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Modal as ModalProps } from "./index.types";
|
|
2
|
+
import "./index.css";
|
|
3
|
+
export declare function Modal({ className, modalref, children, title, subtitle, footer, hasOverlay, hasCloseButton, handleClose, ...rest }: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default Modal;
|
|
@@ -0,0 +1,11 @@
|
|
|
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 PrimaryWithOverlay: Story;
|
|
7
|
+
export declare const TitleAndSubtitle: Story;
|
|
8
|
+
export declare const WithoutOverlay: Story;
|
|
9
|
+
export declare const WithFooter: Story;
|
|
10
|
+
export declare const WithFooterAndSubtitle: Story;
|
|
11
|
+
export declare const WithoutCloseButton: Story;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface Modal {
|
|
3
|
+
/**
|
|
4
|
+
* Custom css class name.
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Children
|
|
9
|
+
*/
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Modal footer
|
|
13
|
+
*/
|
|
14
|
+
footer?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Close click function
|
|
17
|
+
*/
|
|
18
|
+
handleClose?: any;
|
|
19
|
+
/**
|
|
20
|
+
* Modal close button
|
|
21
|
+
*/
|
|
22
|
+
hasCloseButton?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Overlay div
|
|
25
|
+
*/
|
|
26
|
+
hasOverlay?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Modal body ref
|
|
29
|
+
*/
|
|
30
|
+
modalref?: React.LegacyRef<HTMLDivElement>;
|
|
31
|
+
/**
|
|
32
|
+
* Subtitle of the modal
|
|
33
|
+
*/
|
|
34
|
+
subtitle?: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Title of the modal
|
|
37
|
+
*/
|
|
38
|
+
title?: React.ReactNode;
|
|
39
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { MutableRefObject } from "react";
|
|
2
|
+
/** Props */
|
|
3
|
+
type Props = {
|
|
4
|
+
allPositions?: number[];
|
|
5
|
+
handlePosition: (pixelPosition: number, thumbPosition: number, index: number, isHandleSelected: boolean) => void;
|
|
6
|
+
handleOverContent: (value: string | number | undefined) => void;
|
|
7
|
+
values: string[] | number[];
|
|
8
|
+
};
|
|
9
|
+
type TimerProps = Props & {
|
|
10
|
+
indexPosition: number;
|
|
11
|
+
};
|
|
12
|
+
type ThumbProps = Props & {
|
|
13
|
+
panelRef: MutableRefObject<null>;
|
|
14
|
+
};
|
|
15
|
+
export declare function usePositions(panelRef: MutableRefObject<null>): {
|
|
16
|
+
panelRef: MutableRefObject<null>;
|
|
17
|
+
allPositions: number[] | undefined;
|
|
18
|
+
setAllPositions: import("react").Dispatch<import("react").SetStateAction<number[] | undefined>>;
|
|
19
|
+
pixelPosition: string | undefined;
|
|
20
|
+
setPixelPosition: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
|
|
21
|
+
thumbPosition: string | undefined;
|
|
22
|
+
setThumbPosition: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
|
|
23
|
+
};
|
|
24
|
+
export declare function getThumbBounds(): DOMRect;
|
|
25
|
+
export declare function useTimer({ allPositions, indexPosition, handlePosition, handleOverContent, values, }: TimerProps): {
|
|
26
|
+
isPlay: boolean;
|
|
27
|
+
setIsPlay: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
28
|
+
handlePlay: () => void;
|
|
29
|
+
handleStop: () => void;
|
|
30
|
+
};
|
|
31
|
+
export declare function useThumb({ allPositions, panelRef, handlePosition, handleOverContent, values, }: ThumbProps): {
|
|
32
|
+
handleDownThumb: () => void;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StoryObj, Meta } from "@storybook/react";
|
|
2
|
+
import { Range } from "./index";
|
|
3
|
+
declare const meta: Meta<typeof Range>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Range>;
|
|
6
|
+
export declare const RangeMonths: Story;
|
|
7
|
+
export declare const RangeTimestamps: Story;
|
|
8
|
+
export declare const RangeTimestampsPeriod: Story;
|
|
9
|
+
export declare const RangeUseCase: Story;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface Range {
|
|
2
|
+
/**
|
|
3
|
+
* Function that handles any external logic
|
|
4
|
+
*/
|
|
5
|
+
handleSelected?: (obj: {
|
|
6
|
+
value?: string | number;
|
|
7
|
+
index: number;
|
|
8
|
+
position: number;
|
|
9
|
+
}) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Period that seperates the ticks
|
|
12
|
+
*/
|
|
13
|
+
period?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Values that populate the range
|
|
16
|
+
*/
|
|
17
|
+
values: string[] | number[];
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** React */
|
|
2
|
+
import { HtmlHTMLAttributes } from "react";
|
|
3
|
+
/** CSS */
|
|
4
|
+
import "./index.css";
|
|
5
|
+
/** Props */
|
|
6
|
+
type Props = HtmlHTMLAttributes<HTMLDivElement> & {
|
|
7
|
+
period?: number;
|
|
8
|
+
values: string[] | number[];
|
|
9
|
+
allPositions?: number[];
|
|
10
|
+
handlePosition: (pixelPosition: number, thumbPosition: number, index: number, isHandleSelected?: boolean) => void;
|
|
11
|
+
handleOverContent: (value: string | number | undefined) => void;
|
|
12
|
+
handleOutContent: () => void;
|
|
13
|
+
over: string | number | undefined;
|
|
14
|
+
};
|
|
15
|
+
export declare function RangeContent({ period, values, allPositions, handlePosition, handleOverContent, handleOutContent, over, }: Props): import("react/jsx-runtime").JSX.Element[];
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** React */
|
|
2
|
+
import { HtmlHTMLAttributes } from "react";
|
|
3
|
+
/** CSS */
|
|
4
|
+
import "./index.css";
|
|
5
|
+
/** Props */
|
|
6
|
+
type Props = HtmlHTMLAttributes<HTMLDivElement> & {
|
|
7
|
+
indexPosition: number;
|
|
8
|
+
isPlay: boolean;
|
|
9
|
+
handlePlay: () => void;
|
|
10
|
+
handleStop: () => void;
|
|
11
|
+
};
|
|
12
|
+
export declare function RangeControls({ indexPosition, isPlay, handlePlay, handleStop, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** React */
|
|
2
|
+
import { HtmlHTMLAttributes } from "react";
|
|
3
|
+
/** CSS */
|
|
4
|
+
import "./index.css";
|
|
5
|
+
/** Props */
|
|
6
|
+
type Props = HtmlHTMLAttributes<HTMLDivElement> & {
|
|
7
|
+
thumbPosition?: string;
|
|
8
|
+
handleOverContent: (value: string | number | undefined) => void;
|
|
9
|
+
handleDownThumb: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function RangeThumb({ thumbPosition, handleOverContent, handleDownThumb }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DATES: string[];
|
|
@@ -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, label, labelClassName, error, backgroundColor, isRequired, ...rest }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default Select;
|
|
@@ -0,0 +1,10 @@
|
|
|
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 PrimaryLabelAndLabelClass: Story;
|
|
8
|
+
export declare const Error: Story;
|
|
9
|
+
export declare const DifferentDefaultSelectedValue: Story;
|
|
10
|
+
export declare const DifferentClassNameGroup: Story;
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
* Options of the select component.
|
|
18
|
+
*/
|
|
19
|
+
options?: string[];
|
|
20
|
+
/**
|
|
21
|
+
* Error message to show when input has an error.
|
|
22
|
+
*/
|
|
23
|
+
error: {
|
|
24
|
+
is: boolean;
|
|
25
|
+
message: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Style input group wrapper
|
|
29
|
+
*/
|
|
30
|
+
styleGroup?: CSSProperties;
|
|
31
|
+
/**Default selected value */
|
|
32
|
+
defaultValue?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Style of the backgroundColor
|
|
35
|
+
*/
|
|
36
|
+
backgroundColor?: string;
|
|
37
|
+
/**Pass a custom function to the select */
|
|
38
|
+
handleSelect?: Function;
|
|
39
|
+
/**Pass a custom function to the select */
|
|
40
|
+
setFormSelected?: Function;
|
|
41
|
+
/**Pass a custom function to the select on clear error*/
|
|
42
|
+
clearError?: Function;
|
|
43
|
+
/**Pass a custom function to the select on reset form*/
|
|
44
|
+
resetForm?: Function;
|
|
45
|
+
/**Pass a custom function to the select on form blur, when closing the select*/
|
|
46
|
+
onFormBlur?: Function;
|
|
47
|
+
/**Pass a custom label to the select*/
|
|
48
|
+
label?: string;
|
|
49
|
+
/**Pass a custom class to the label of the select*/
|
|
50
|
+
labelClassName?: string;
|
|
51
|
+
/**Sets if select is required or not*/
|
|
52
|
+
isRequired: boolean;
|
|
53
|
+
}
|
|
@@ -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({ buttonDisabled, className, disabled, error, hasToggleButton, hideHeight, label, labelClassName, isRequired, placeholder, showHeight, backgroundColor, style, textareaClassName, ...rest }: TextAreaProps): JSX.Element;
|
|
5
|
+
export default TextArea;
|