@eliseubatista99/react-scaffold-core 0.1.1 → 0.1.3

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 (34) hide show
  1. package/README.md +21 -21
  2. package/dist/components/button/button.d.ts +7 -0
  3. package/dist/components/button/index.d.ts +1 -0
  4. package/dist/components/button/stories/button.stories.d.ts +18 -0
  5. package/dist/components/drawer/drawer.hook.d.ts +0 -3
  6. package/dist/components/form/form.d.ts +20 -0
  7. package/dist/components/form/form.hook.d.ts +8 -0
  8. package/dist/components/form/index.d.ts +1 -0
  9. package/dist/components/form/stories/form.stories.d.ts +25 -0
  10. package/dist/components/image/image.d.ts +8 -0
  11. package/dist/components/image/index.d.ts +1 -0
  12. package/dist/components/index.d.ts +7 -0
  13. package/dist/components/inputField/index.d.ts +1 -0
  14. package/dist/components/inputField/inputField.d.ts +18 -0
  15. package/dist/components/inputField/stories/inputField.stories.d.ts +20 -0
  16. package/dist/components/loader/index.d.ts +1 -0
  17. package/dist/components/loader/loader.d.ts +6 -0
  18. package/dist/components/loader/stories/loader.stories.d.ts +19 -0
  19. package/dist/components/loader/stories/setup.d.ts +2 -0
  20. package/dist/components/pageLayout/index.d.ts +1 -0
  21. package/dist/components/pageLayout/pageLayout.d.ts +15 -0
  22. package/dist/components/pageLayout/stories/pageLayout.stories.d.ts +19 -0
  23. package/dist/components/pageLayout/stories/setup.d.ts +2 -0
  24. package/dist/components/svgImage/index.d.ts +1 -0
  25. package/dist/components/svgImage/svgImage.d.ts +14 -0
  26. package/dist/hooks/index.d.ts +2 -0
  27. package/dist/hooks/useDrag/index.d.ts +1 -0
  28. package/dist/hooks/useDrag/useDrag.d.ts +17 -0
  29. package/dist/hooks/usePointer/index.d.ts +1 -0
  30. package/dist/hooks/usePointer/usePointer.d.ts +8 -0
  31. package/dist/hooks/useResponsive/useResponsive.d.ts +1 -0
  32. package/dist/index.cjs.js +24 -6
  33. package/dist/index.es.js +2684 -1160
  34. package/package.json +3 -2
package/README.md CHANGED
@@ -1,21 +1,21 @@
1
- <h1 align="center">Core</h1>
2
-
3
- ---
4
-
5
- A library which provides basic components, hooks, helpers and providers to easily build a React application and avoid repeating the usual code.
6
-
7
- ## Installation
8
-
9
- ```shell
10
- npm i @eliseubatista99/react-scaffold-core
11
- ```
12
-
13
- ## Content
14
-
15
- - [Providers](https://github.com/eliseubatista99/react-scaffold/tree/main/src/packages/core/src/providers): Useful providers to handle complex actions like navigation and showing, hiding and managing feedback components;
16
-
17
- - [Hooks](https://github.com/eliseubatista99/react-scaffold/tree/main/src/packages/core/src/hooks): Hooks that handle atomic actions, like fetching and endpoint.
18
-
19
- - [Helpers](https://github.com/eliseubatista99/react-scaffold/tree/main/src/packages/core/src/helpers): Classes to help with generic repetitive tasks, like transforming a string into Pascal Case.
20
-
21
- - [Components](https://github.com/eliseubatista99/react-scaffold/tree/main/src/packages/core/src/components): Basic, customizable components with pre-configured styles and behaviors.
1
+ <h1 align="center">Core</h1>
2
+
3
+ ---
4
+
5
+ A library which provides basic components, hooks, helpers and providers to easily build a React application and avoid repeating the usual code.
6
+
7
+ ## Installation
8
+
9
+ ```shell
10
+ npm i @eliseubatista99/react-scaffold-core
11
+ ```
12
+
13
+ ## Content
14
+
15
+ - [Providers](https://github.com/eliseubatista99/react-scaffold/tree/main/src/packages/core/src/providers): Useful providers to handle complex actions like navigation and showing, hiding and managing feedback components;
16
+
17
+ - [Hooks](https://github.com/eliseubatista99/react-scaffold/tree/main/src/packages/core/src/hooks): Hooks that handle atomic actions, like fetching and endpoint.
18
+
19
+ - [Helpers](https://github.com/eliseubatista99/react-scaffold/tree/main/src/packages/core/src/helpers): Classes to help with generic repetitive tasks, like transforming a string into Pascal Case.
20
+
21
+ - [Components](https://github.com/eliseubatista99/react-scaffold/tree/main/src/packages/core/src/components): Basic, customizable components with pre-configured styles and behaviors.
@@ -0,0 +1,7 @@
1
+ import { default as React, CSSProperties } from 'react';
2
+ export type ButtonProps = {
3
+ onClick: () => void;
4
+ children?: React.ReactNode;
5
+ styles?: CSSProperties;
6
+ };
7
+ export declare const Button: ({ children, onClick, styles }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './button';
@@ -0,0 +1,18 @@
1
+ import { StoryObj } from '@storybook/react-vite';
2
+ declare const meta: {
3
+ title: string;
4
+ component: ({ children, onClick, styles }: import('../button').ButtonProps) => import("react/jsx-runtime").JSX.Element;
5
+ parameters: {
6
+ layout: string;
7
+ };
8
+ tags: string[];
9
+ args: {
10
+ children: string;
11
+ onClick: () => void;
12
+ };
13
+ };
14
+ export default meta;
15
+ type Story = StoryObj<typeof meta>;
16
+ export declare const Default: Story;
17
+ export declare const XboxPrimary: Story;
18
+ export declare const XboxSecondary: Story;
@@ -6,7 +6,4 @@ export declare const useDrawerHelper: ({ id, onCloseDrawer, drawerCloseOffset, }
6
6
  drawerRef: React.RefObject<HTMLDivElement | null>;
7
7
  drawerBottomDistance: number;
8
8
  handleRef: React.RefObject<HTMLDivElement | null>;
9
- onDragStart: (e: React.PointerEvent<HTMLDivElement>) => void;
10
- onDrag: (e: React.PointerEvent<HTMLDivElement>) => void;
11
- onDragEnd: (_: React.PointerEvent<HTMLDivElement>) => void;
12
9
  };
@@ -0,0 +1,20 @@
1
+ import { default as React } from 'react';
2
+ export interface FormFieldOutputData {
3
+ name: string;
4
+ value?: unknown;
5
+ }
6
+ export interface FormFieldInputData {
7
+ name: string;
8
+ content: JSX.Element;
9
+ }
10
+ export interface FormSubmitButton {
11
+ styles?: React.CSSProperties;
12
+ content: React.ReactNode;
13
+ }
14
+ export interface FormProps {
15
+ fields: FormFieldInputData[];
16
+ submitButton: FormSubmitButton;
17
+ onSubmit: (data: FormFieldOutputData[]) => void;
18
+ styles?: React.CSSProperties;
19
+ }
20
+ export declare const Form: (props: FormProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { FormProps } from './form';
3
+ export type FormFieldValidation = (value: string) => string | undefined;
4
+ export declare const useFormHelper: ({ onSubmit, fields }: FormProps) => {
5
+ ref: React.RefObject<HTMLFormElement | null>;
6
+ submitForm: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
7
+ handleFormSubmission: (event: React.FormEvent<HTMLFormElement>) => void;
8
+ };
@@ -0,0 +1 @@
1
+ export * from './form';
@@ -0,0 +1,25 @@
1
+ import { StoryObj } from '@storybook/react-vite';
2
+ declare const meta: {
3
+ title: string;
4
+ component: (props: import('../form').FormProps) => import("react/jsx-runtime").JSX.Element;
5
+ parameters: {
6
+ layout: string;
7
+ };
8
+ tags: string[];
9
+ args: {
10
+ fields: {
11
+ name: string;
12
+ content: import("react/jsx-runtime").JSX.Element;
13
+ }[];
14
+ submitButton: {
15
+ content: import("react/jsx-runtime").JSX.Element;
16
+ };
17
+ onSubmit: (data: import('../form').FormFieldOutputData[]) => void;
18
+ styles: {
19
+ width: string;
20
+ };
21
+ };
22
+ };
23
+ export default meta;
24
+ type Story = StoryObj<typeof meta>;
25
+ export declare const Default: Story;
@@ -0,0 +1,8 @@
1
+ import { CSSProperties } from 'react';
2
+ export type ImageProps = {
3
+ src: string;
4
+ alt?: string;
5
+ onClick?: () => void;
6
+ styles?: CSSProperties;
7
+ };
8
+ export declare const Image: ({ src, alt, onClick, styles }: ImageProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './image';
@@ -1,4 +1,11 @@
1
+ export * from './button';
1
2
  export * from './drawer';
3
+ export * from './form';
4
+ export * from './image';
5
+ export * from './inputField';
6
+ export * from './loader';
2
7
  export * from './modal';
8
+ export * from './pageLayout';
9
+ export * from './svgImage';
3
10
  export * from './toast';
4
11
  export * from './typography';
@@ -0,0 +1 @@
1
+ export * from './inputField';
@@ -0,0 +1,18 @@
1
+ import { HTMLInputAutoCompleteAttribute, CSSProperties, HTMLInputTypeAttribute } from 'react';
2
+ export interface InputFieldProps {
3
+ name: string;
4
+ label?: React.ReactNode;
5
+ leftIcon?: React.ReactNode;
6
+ rightIcon?: React.ReactNode;
7
+ bottomMessage?: React.ReactNode;
8
+ step?: string | number;
9
+ placeHolder?: string;
10
+ autoComplete?: HTMLInputAutoCompleteAttribute;
11
+ value?: string;
12
+ initialValue?: string;
13
+ type?: HTMLInputTypeAttribute;
14
+ onChange?: (value: string) => void;
15
+ inputStyles?: CSSProperties;
16
+ containerProps?: CSSProperties;
17
+ }
18
+ export declare const InputField: ({ name, label, leftIcon, rightIcon, bottomMessage, placeHolder, autoComplete, value, initialValue, type, onChange, inputStyles, containerProps, step, }: InputFieldProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { StoryObj } from '@storybook/react-vite';
2
+ declare const meta: {
3
+ title: string;
4
+ component: ({ name, label, leftIcon, rightIcon, bottomMessage, placeHolder, autoComplete, value, initialValue, type, onChange, inputStyles, containerProps, step, }: import('../inputField').InputFieldProps) => import("react/jsx-runtime").JSX.Element;
5
+ parameters: {
6
+ layout: string;
7
+ };
8
+ tags: string[];
9
+ args: {
10
+ name: string;
11
+ placeHolder: string;
12
+ };
13
+ };
14
+ export default meta;
15
+ type Story = StoryObj<typeof meta>;
16
+ export declare const Default: Story;
17
+ export declare const WithLabel: Story;
18
+ export declare const WithErrorMessage: Story;
19
+ export declare const CountrySearch: Story;
20
+ export declare const SearchInput: Story;
@@ -0,0 +1 @@
1
+ export * from './loader';
@@ -0,0 +1,6 @@
1
+ export interface LoaderProps {
2
+ id: string;
3
+ children?: React.ReactNode;
4
+ styles?: React.CSSProperties;
5
+ }
6
+ export declare const Loader: ({ id, styles, children }: LoaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { StoryObj } from '@storybook/react-vite';
2
+ declare const meta: {
3
+ title: string;
4
+ component: (props: import('../loader').LoaderProps) => import("react/jsx-runtime").JSX.Element;
5
+ parameters: {
6
+ layout: string;
7
+ };
8
+ tags: string[];
9
+ args: {
10
+ id: string;
11
+ styles: {
12
+ background: string;
13
+ };
14
+ };
15
+ };
16
+ export default meta;
17
+ type Story = StoryObj<typeof meta>;
18
+ export declare const Opaque: Story;
19
+ export declare const Transparent: Story;
@@ -0,0 +1,2 @@
1
+ import { LoaderProps } from '../loader';
2
+ export declare const LoaderStoriesSetup: (props: LoaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './pageLayout';
@@ -0,0 +1,15 @@
1
+ export interface PageLayoutHeaderAndFooterProps {
2
+ content: React.ReactNode;
3
+ visibility?: "always" | "fixed";
4
+ styles?: React.CSSProperties;
5
+ }
6
+ export interface PageLayoutProps {
7
+ header?: PageLayoutHeaderAndFooterProps;
8
+ footer?: PageLayoutHeaderAndFooterProps;
9
+ floatingContent?: React.ReactNode;
10
+ allowScroll?: boolean;
11
+ containerStyles?: React.CSSProperties;
12
+ pageStyles?: React.CSSProperties;
13
+ children?: React.ReactNode;
14
+ }
15
+ export declare const PageLayout: ({ header, containerStyles, pageStyles, children, allowScroll, footer, floatingContent, }: PageLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { StoryObj } from '@storybook/react-vite';
2
+ import { PageLayoutProps } from '../pageLayout';
3
+ declare const meta: {
4
+ title: string;
5
+ component: ({ children, ...props }: PageLayoutProps) => import("react/jsx-runtime").JSX.Element;
6
+ parameters: {
7
+ layout: string;
8
+ };
9
+ tags: string[];
10
+ args: PageLayoutProps;
11
+ };
12
+ export default meta;
13
+ type Story = StoryObj<typeof meta>;
14
+ export declare const Default: Story;
15
+ export declare const WithHeaderAlwaysVisible: Story;
16
+ export declare const WithFixedHeader: Story;
17
+ export declare const WithFooterAlwaysVisible: Story;
18
+ export declare const WithFixedFooter: Story;
19
+ export declare const NoHeaderAndNoFooter: Story;
@@ -0,0 +1,2 @@
1
+ import { PageLayoutProps } from '../pageLayout';
2
+ export declare const PageLayoutStoriesSetup: ({ children, ...props }: PageLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './svgImage';
@@ -0,0 +1,14 @@
1
+ import { Property } from 'csstype';
2
+ import { default as React, CSSProperties } from 'react';
3
+ export type SvgImageProps = {
4
+ viewBox?: string;
5
+ width?: Property.Width;
6
+ height?: Property.Height;
7
+ fill?: Property.Fill;
8
+ stroke?: Property.Stroke;
9
+ src: React.ReactElement<React.SVGProps<SVGElement>>;
10
+ alt?: string;
11
+ onClick?: () => void;
12
+ styles?: CSSProperties;
13
+ };
14
+ export declare const SvgImage: ({ src, width, height, stroke, viewBox, fill, alt, onClick, styles, }: SvgImageProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,6 @@
1
1
  export * from './useDidMount';
2
+ export * from './useDrag';
2
3
  export * from './useFetch';
4
+ export * from './usePointer';
3
5
  export * from './useResponsive';
4
6
  export * from './useTranslations';
@@ -0,0 +1 @@
1
+ export * from './useDrag';
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ export interface DragData {
3
+ startPosX?: number;
4
+ startPosY?: number;
5
+ posX?: number;
6
+ posY?: number;
7
+ distanceX?: number;
8
+ distanceY?: number;
9
+ isDragging: boolean;
10
+ }
11
+ export interface UseDragInput {
12
+ ref?: React.RefObject<HTMLDivElement | null>;
13
+ onDragStart?: (data: DragData) => void;
14
+ onDrag?: (data: DragData) => void;
15
+ onDragEnd?: (data: DragData) => void;
16
+ }
17
+ export declare const useDrag: ({ ref, onDrag, onDragStart, onDragEnd, }: UseDragInput) => void;
@@ -0,0 +1 @@
1
+ export * from './usePointer';
@@ -0,0 +1,8 @@
1
+ export type MousePositionData = {
2
+ x?: number;
3
+ y?: number;
4
+ };
5
+ export declare const usePointer: () => {
6
+ pointerPosition: MousePositionData;
7
+ isPointerDown: boolean;
8
+ };
@@ -4,6 +4,7 @@ export type BreakpointConfiguration = Record<Breakpoint, number>;
4
4
  export declare const defaultBreakpoints: BreakpointConfiguration;
5
5
  export interface UseResponsiveOutput {
6
6
  currentWidth: number;
7
+ currentHeight: number;
7
8
  currentBreakpoint: Breakpoint;
8
9
  currentSize: Size;
9
10
  }