@sebgroup/green-react 1.0.0-beta.4 → 1.0.0-beta.7

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.
@@ -4,6 +4,7 @@ export interface FormProps extends HTMLProps<HTMLFormElement> {
4
4
  children?: ReactNode;
5
5
  direction?: FormDirection;
6
6
  formSize?: Size;
7
+ onFormSubmit?: (values: any) => void;
7
8
  }
8
- export declare function Form({ children, direction, formSize, }: FormProps): JSX.Element;
9
+ export declare const Form: React.FC<FormProps>;
9
10
  export default Form;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { FormProps } from './form';
3
+ interface FormContextReturnType {
4
+ setValues: React.Dispatch<React.SetStateAction<Record<string, any>>>;
5
+ setErrors: React.Dispatch<React.SetStateAction<Record<string, any>>>;
6
+ setFields: React.Dispatch<React.SetStateAction<Record<string, any>>>;
7
+ errors?: Record<string, any>;
8
+ values?: Record<string, any>;
9
+ }
10
+ export declare const FormContext: React.Context<FormContextReturnType>;
11
+ export declare const useFormContext: () => FormContextReturnType;
12
+ export declare const FormProvider: ({ children, direction, formSize, onSubmit, onFormSubmit, ...props }: React.PropsWithChildren<FormProps>) => JSX.Element;
13
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { IValidator } from './types';
3
+ export interface FormItemsProps {
4
+ children: React.ReactNode;
5
+ validate?: IValidator;
6
+ name: string;
7
+ }
8
+ export declare const FormItems: React.FC<FormItemsProps>;
9
+ export default FormItems;
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ export interface GroupProps {
3
+ children: ReactNode;
4
+ error?: Error | string;
5
+ groupBorder?: boolean;
6
+ invalid?: boolean;
7
+ }
8
+ export declare function Group({ children, error, groupBorder }: GroupProps): JSX.Element;
9
+ export default Group;
@@ -1,5 +1,8 @@
1
1
  export * from './button/button';
2
2
  export * from './buttonGroup/buttonGroup';
3
3
  export * from './form';
4
+ export * from './formItems';
5
+ export * from './group/group';
4
6
  export * from './input/input';
5
7
  export * from './text/text';
8
+ export * from './radioButton/radioGroup';
@@ -1,5 +1,10 @@
1
- import { CheckboxProps, TextInputProps } from '../types';
2
- export declare const TextInput: ({ label, info, onChangeText, ...props }: TextInputProps<string>) => JSX.Element;
3
- export declare const EmailInput: ({ label, info, onChangeText, ...props }: TextInputProps<string>) => JSX.Element;
4
- export declare const NumberInput: ({ label, info, onChangeText, ...props }: TextInputProps<number>) => JSX.Element;
5
- export declare const Checkbox: ({ label, onChecked, ...props }: CheckboxProps) => JSX.Element;
1
+ import { InputHTMLAttributes } from 'react';
2
+ import { CheckboxProps, IValidator, NumberInputProps, RadioButtonProps, TextInputProps } from '../types';
3
+ import React from 'react';
4
+ export declare type Renderer = (type: string, props: InputHTMLAttributes<HTMLInputElement>, onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void, onChangeInput?: (value: string) => string, label?: string, info?: string, validator?: IValidator) => JSX.Element;
5
+ export declare const RenderInput: Renderer;
6
+ export declare const TextInput: ({ label, info, onChange, onChangeInput, validator, ...props }: TextInputProps) => JSX.Element;
7
+ export declare const EmailInput: ({ label, info, onChange, onChangeInput, validator, ...props }: TextInputProps) => JSX.Element;
8
+ export declare const NumberInput: ({ label, info, onChange, onChangeInput, validator, ...props }: NumberInputProps) => JSX.Element;
9
+ export declare const Checkbox: ({ label, onChange, validator, ...props }: CheckboxProps) => JSX.Element;
10
+ export declare const RadioButton: ({ label, validator, ...props }: RadioButtonProps) => JSX.Element;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { IValidator } from '../types';
3
+ export interface RadioGroupProps {
4
+ title?: string;
5
+ description?: string;
6
+ validator?: IValidator;
7
+ onChangeRadio?: (value: string) => string;
8
+ }
9
+ export declare const RadioGroup: ({ description, title, validator, onChangeRadio, children }: React.PropsWithChildren<RadioGroupProps>) => JSX.Element;
10
+ export default RadioGroup;
@@ -1,25 +1,28 @@
1
- import { ChangeEventHandler, FocusEventHandler } from 'react';
2
- export interface InputProps {
3
- id?: string;
4
- label?: string;
5
- onFocus?: FocusEventHandler<HTMLInputElement>;
6
- onBlur?: FocusEventHandler<HTMLInputElement>;
7
- onChange?: ChangeEventHandler<HTMLInputElement>;
8
- }
9
- export interface TextInputProps<T> extends InputProps {
1
+ import { IndicatorType, ValidatorRules } from '@sebgroup/extract';
2
+ import { HTMLProps } from 'react';
3
+ export interface TextInputProps extends HTMLProps<HTMLInputElement> {
10
4
  type?: 'text' | 'email' | 'number';
11
- value?: T;
5
+ label?: string;
12
6
  info?: string;
13
- onChangeText?: (text?: T) => unknown;
7
+ validator?: IValidator;
8
+ onChangeInput?: (value: string) => string;
14
9
  }
15
- export interface NumberInputProps extends TextInputProps<number> {
10
+ export interface NumberInputProps extends TextInputProps {
16
11
  min?: number;
17
12
  max?: number;
18
13
  step?: number;
19
14
  }
20
- export interface CheckboxProps extends InputProps {
21
- checked?: boolean;
22
- value?: string;
23
- onChecked?: (checked: boolean | undefined) => unknown;
15
+ export interface CheckboxProps extends HTMLProps<HTMLInputElement> {
16
+ validator?: IValidator;
17
+ }
18
+ export interface RadioButtonProps extends HTMLProps<HTMLInputElement> {
19
+ label: string;
20
+ validator?: string;
21
+ value: string;
24
22
  }
25
23
  export declare type InputListener<T> = (newValue?: T) => unknown;
24
+ export interface IValidator {
25
+ message: string;
26
+ indicator: IndicatorType;
27
+ rules?: ValidatorRules;
28
+ }
@@ -1,6 +1,5 @@
1
- import { InputHTMLAttributes, RefObject } from 'react';
2
- import { InputListener } from './types';
3
- declare const useInput: <T>(props: InputHTMLAttributes<HTMLInputElement>, evaluator: (element: HTMLInputElement) => T | undefined, notify?: InputListener<T> | undefined) => InputHTMLAttributes<HTMLInputElement> & {
1
+ import React, { InputHTMLAttributes, RefObject } from 'react';
2
+ declare const useInput: (props: InputHTMLAttributes<HTMLInputElement>, onChanges?: ((event: React.ChangeEvent<HTMLInputElement>) => void) | undefined, onChangeInput?: ((value: string) => string) | undefined) => React.InputHTMLAttributes<HTMLInputElement> & {
4
3
  ref: RefObject<HTMLInputElement>;
5
4
  };
6
5
  export default useInput;
@@ -0,0 +1,9 @@
1
+ import { ValidatorRules } from '@sebgroup/extract';
2
+ interface InputTargetType {
3
+ name: string;
4
+ value: string;
5
+ type?: string;
6
+ checked?: boolean;
7
+ }
8
+ export declare const validateInputValue: (target: InputTargetType, rules: ValidatorRules, setError: React.Dispatch<React.SetStateAction<Record<string, any>>>) => string;
9
+ export {};
@@ -1,9 +1,13 @@
1
- import { PropsWithChildren } from 'react';
2
- interface FlexboxProps {
3
- alignContent?: 'start' | 'between' | 'center' | 'stretch' | 'around' | 'end';
4
- alignItems?: 'start' | 'end' | 'center' | 'baseline' | 'stretch';
5
- alignSelf?: 'auto' | 'start' | 'end' | 'center' | 'baseline' | 'stretch';
6
- justifyContent?: 'start' | 'between' | 'center' | 'evenly' | 'around' | 'end';
1
+ import { PropsWithChildren, HTMLProps } from 'react';
2
+ import { AlignContentType, AlignType, FlexDirectionType, FlexWrapType, JustifyContentType } from './types';
3
+ export interface FlexboxProps extends HTMLProps<HTMLDivElement> {
4
+ alignContent?: AlignContentType;
5
+ alignItems?: AlignType;
6
+ alignSelf?: AlignType;
7
+ justifyContent?: JustifyContentType;
8
+ flexDirection?: FlexDirectionType;
9
+ flexWrap?: FlexWrapType;
10
+ className?: string;
7
11
  }
8
- export declare const Flexbox: ({ alignContent, alignItems, alignSelf, children, justifyContent, }: PropsWithChildren<FlexboxProps>) => JSX.Element;
12
+ export declare const Flexbox: ({ alignContent, alignItems, alignSelf, children, justifyContent, flexDirection, flexWrap, className, ...props }: PropsWithChildren<FlexboxProps>) => JSX.Element;
9
13
  export default Flexbox;
@@ -0,0 +1,5 @@
1
+ export declare type AlignContentType = 'start' | 'between' | 'center' | 'stretch' | 'around' | 'end' | 'sm-start' | 'sm-between' | 'sm-center' | 'sm-stretch' | 'sm-around' | 'sm-end' | 'md-start' | 'md-between' | 'md-center' | 'md-stretch' | 'md-around' | 'md-end' | 'lg-start' | 'lg-between' | 'lg-center' | 'lg-stretch' | 'lg-around' | 'lg-end' | 'xl-start' | 'xl-between' | 'xl-center' | 'xl-stretch' | 'xl-around' | 'xl-end' | 'xxl-start' | 'xxl-between' | 'xxl-center' | 'xxl-stretch' | 'xxl-around' | 'xxl-end';
2
+ export declare type AlignType = 'start' | 'end' | 'center' | 'baseline' | 'stretch' | 'sm-start' | 'sm-end' | 'sm-center' | 'sm-baseline' | 'sm-stretch' | 'md-start' | 'md-end' | 'md-center' | 'md-baseline' | 'md-stretch' | 'lg-start' | 'lg-end' | 'lg-center' | 'lg-baseline' | 'lg-stretch' | 'xl-start' | 'xl-end' | 'xl-center' | 'xl-baseline' | 'xl-stretch' | 'xxl-start' | 'xxl-end' | 'xxl-center' | 'xxl-baseline' | 'xxl-stretch';
3
+ export declare type JustifyContentType = 'start' | 'between' | 'center' | 'evenly' | 'around' | 'end' | 'sm-start' | 'sm-between' | 'sm-center' | 'sm-evenly' | 'sm-around' | 'sm-end' | 'md-start' | 'md-between' | 'md-center' | 'md-evenly' | 'md-around' | 'md-end' | 'lg-start' | 'lg-between' | 'lg-center' | 'lg-evenly' | 'lg-around' | 'lg-end' | 'xl-start' | 'xl-between' | 'xl-center' | 'xl-evenly' | 'xl-around' | 'xl-end' | 'xxl-start' | 'xxl-between' | 'xxl-center' | 'xxl-evenly' | 'xxl-around' | 'xxl-end';
4
+ export declare type FlexDirectionType = 'row' | 'row-reverse' | 'column' | 'column-reverse' | 'sm-row' | 'sm-row-reverse' | 'sm-column' | 'sm-column-reverse' | 'md-row' | 'md-row-reverse' | 'md-column' | 'md-column-reverse' | 'lg-row' | 'lg-row-reverse' | 'lg-column' | 'lg-column-reverse' | 'xl-row' | 'xl-row-reverse' | 'xl-column' | 'xl-column-reverse' | 'xxl-row' | 'xxl-row-reverse' | 'xxl-column' | 'xxl-column-reverse';
5
+ export declare type FlexWrapType = 'nowrap' | 'wrap' | 'wrap-reverse' | 'sm-nowrap' | 'sm-wrap' | 'sm-wrap-reverse' | 'md-nowrap' | 'md-wrap' | 'md-wrap-reverse' | 'lg-nowrap' | 'lg-wrap' | 'lg-wrap-reverse' | 'xl-nowrap' | 'xl-wrap' | 'xl-wrap-reverse' | 'xxl-nowrap' | 'xxl-wrap' | 'xxl-wrap-reverse';
@@ -1,2 +1 @@
1
1
  export * from './flexbox/flexbox';
2
- export * from './group/group';
@@ -1,12 +1,13 @@
1
1
  import { ReactNode } from 'react';
2
- interface IList {
2
+ export interface IList {
3
3
  text?: string;
4
4
  href?: string;
5
+ disabled?: boolean;
5
6
  }
6
7
  interface TabsProps {
7
8
  list?: IList[];
8
- disabled?: boolean;
9
+ onTabChange?: (index: number) => void;
9
10
  children?: ReactNode[];
10
11
  }
11
- export declare const Tabs: ({ list, disabled, children, ...props }: TabsProps) => JSX.Element;
12
+ export declare const Tabs: ({ list, onTabChange, children }: TabsProps) => JSX.Element;
12
13
  export default Tabs;
package/package.json CHANGED
@@ -1,16 +1,13 @@
1
1
  {
2
2
  "name": "@sebgroup/green-react",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.7",
4
4
  "peerDependencies": {
5
5
  "react": "^17.0.0",
6
- "react-dom": "^17.0.0",
7
- "merge": "^2.1.1",
8
- "@popperjs/core": "^2.11.0",
9
- "rxjs": "^6.6.7"
6
+ "react-dom": "^17.0.0"
10
7
  },
11
8
  "dependencies": {
12
- "@sebgroup/chlorophyll": "^1.0.0-beta.4",
13
- "@sebgroup/extract": "^1.0.0-beta.4"
9
+ "@sebgroup/chlorophyll": "^1.0.0-beta.7",
10
+ "@sebgroup/extract": "^1.0.0-beta.7"
14
11
  },
15
12
  "description": "React components built on top of @sebgroup/chlorophyll.",
16
13
  "repository": {
@@ -1,6 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export interface GroupProps {
3
- children: ReactNode;
4
- }
5
- export declare function Group({ children }: GroupProps): JSX.Element;
6
- export default Group;