@sebgroup/green-react 1.0.0-beta.9 → 1.0.1

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.
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ interface AccordionItemProps {
3
+ item: AccordionItemInterface;
4
+ index: number;
5
+ uuid: string;
6
+ }
7
+ export interface AccordionItemInterface {
8
+ label: string;
9
+ labelElementLevel: 2 | 3 | 4 | 5 | 6;
10
+ subLabel?: string;
11
+ content: JSX.Element;
12
+ onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
13
+ onOpen?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
14
+ onClose?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
15
+ }
16
+ declare const AccordionItem: ({ item, index, uuid }: AccordionItemProps) => JSX.Element;
17
+ export default AccordionItem;
@@ -0,0 +1,6 @@
1
+ import { AccordionItemInterface } from './accordion-item';
2
+ export interface AccordionInterface {
3
+ items: AccordionItemInterface[];
4
+ }
5
+ declare const Accordion: ({ items }: AccordionInterface) => JSX.Element;
6
+ export default Accordion;
@@ -0,0 +1,16 @@
1
+ import React, { AriaAttributes, ReactNode } from 'react';
2
+ import { AlertRibbonType } from '@sebgroup/extract';
3
+ export interface AlertRibbonProps {
4
+ children: ReactNode;
5
+ type?: AlertRibbonType;
6
+ header?: ReactNode;
7
+ footer?: ReactNode;
8
+ isCloseable?: boolean;
9
+ closeText?: string;
10
+ onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
11
+ role?: 'alert';
12
+ ["aria-live"]?: AriaAttributes["aria-live"];
13
+ closeAriaLabel?: string;
14
+ }
15
+ export declare function AlertRibbon({ type, header, footer, children, closeText, isCloseable, onClose, role, "aria-live": ariaLive, closeAriaLabel }: AlertRibbonProps): JSX.Element;
16
+ export default AlertRibbon;
@@ -1,9 +1,12 @@
1
- import { HTMLProps } from 'react';
1
+ import { HTMLProps, ReactNode } from 'react';
2
+ import { BadgeType } from '@sebgroup/extract';
2
3
  export interface BadgeProps extends HTMLProps<HTMLSpanElement> {
3
- title: string;
4
- badgeType?: string;
4
+ children?: ReactNode;
5
+ badgeType?: BadgeType;
5
6
  isCloseable?: boolean;
6
7
  closeText?: string;
8
+ customColor?: string;
9
+ customBackgroundColor?: string;
7
10
  }
8
- export declare function Badge({ title, badgeType, isCloseable, closeText, ...props }: BadgeProps): JSX.Element;
11
+ export declare function Badge({ children, badgeType, isCloseable, closeText, customColor, customBackgroundColor, ...props }: BadgeProps): JSX.Element | null;
9
12
  export default Badge;
@@ -6,7 +6,7 @@ interface HookResult {
6
6
  state: DatepickerState;
7
7
  }
8
8
  interface DatepickerHook {
9
- (datepickerRef: RefObject<HTMLElement>, datepickerDialogRef: RefObject<HTMLElement>, dateInputRef: RefObject<HTMLInputElement>, options?: DatepickerOptions): HookResult;
9
+ (datepickerRef: RefObject<HTMLElement>, datepickerDialogRef: RefObject<HTMLElement>, dateInputRef: RefObject<HTMLInputElement>, datepickerTriggerRef: RefObject<HTMLButtonElement>, options?: DatepickerOptions): HookResult;
10
10
  }
11
11
  export declare const useDatepicker: DatepickerHook;
12
12
  export {};
@@ -1,9 +1,6 @@
1
- import { DropdownOption } from '@sebgroup/extract';
2
- export interface DropdownProps {
3
- id?: string;
4
- children?: string;
5
- options: DropdownOption[];
6
- loop?: boolean;
1
+ import { DropdownArgs, OnChange } from '@sebgroup/extract';
2
+ export interface DropdownProps extends DropdownArgs {
3
+ onChange?: OnChange;
7
4
  }
8
- export declare const Dropdown: ({ id, options, loop, children }: DropdownProps) => JSX.Element;
5
+ export declare const Dropdown: ({ compareWith, display, id, informationLabel, label, loop, multiSelect, onChange, options, searchFilter, searchable, texts, useValue, validator, value, }: DropdownProps) => JSX.Element;
9
6
  export default Dropdown;
@@ -1,19 +1,29 @@
1
- import { DropdownHandler, DropdownOption } from '@sebgroup/extract';
2
- import { HTMLAttributes, RefObject } from 'react';
3
- interface HookArgs {
4
- id?: string;
5
- text?: string;
6
- options: DropdownOption[];
7
- loop?: boolean;
1
+ import { DropdownHandler, OnChange, DropdownArgs } from '@sebgroup/extract';
2
+ import { HTMLAttributes, InputHTMLAttributes, RefObject } from 'react';
3
+ import { IValidator } from '@sebgroup/extract';
4
+ interface HookArgs extends DropdownArgs {
8
5
  togglerRef: RefObject<HTMLElement>;
9
6
  listboxRef: RefObject<HTMLElement>;
7
+ onChange?: OnChange;
8
+ validator?: IValidator;
10
9
  }
11
10
  declare type Props = HTMLAttributes<HTMLElement>;
11
+ interface CheckboxItem {
12
+ labelProps: Props;
13
+ inputProps: InputHTMLAttributes<HTMLInputElement>;
14
+ spanProps: Props;
15
+ }
16
+ interface MultiSelectProps {
17
+ fieldsetProps?: Props;
18
+ legendProps?: Props;
19
+ checkboxes?: CheckboxItem[];
20
+ }
12
21
  interface HookResult {
13
22
  dropdown?: DropdownHandler;
14
23
  togglerProps: Props;
15
24
  listboxProps: Props;
16
25
  listItems: Props[];
26
+ multiSelectProps: MultiSelectProps;
17
27
  }
18
- export declare const useDropdown: ({ id, text, options, loop, togglerRef, listboxRef }: HookArgs) => HookResult;
28
+ export declare const useDropdown: ({ id, value, texts, options, loop, multiSelect, searchable, searchFilter, compareWith, useValue, display, togglerRef, listboxRef, onChange, validator, }: HookArgs) => HookResult;
19
29
  export {};
@@ -1,11 +1,13 @@
1
1
  import { MouseEventHandler, ReactNode } from 'react';
2
- import { ButtonType, ButtonVariant } from '@sebgroup/extract';
2
+ import { ButtonSize, ButtonType, ButtonVariant } from '@sebgroup/extract';
3
3
  export interface ButtonProps {
4
4
  children?: ReactNode;
5
5
  type?: ButtonType;
6
6
  variant?: ButtonVariant;
7
7
  active?: boolean;
8
8
  onClick?: MouseEventHandler<HTMLButtonElement>;
9
+ disabled?: boolean;
10
+ size?: ButtonSize;
9
11
  }
10
- export declare function Button({ children, variant, onClick, active, type, }: ButtonProps): JSX.Element;
12
+ export declare function Button({ children, variant, onClick, disabled, active, type, size }: ButtonProps): JSX.Element;
11
13
  export default Button;
@@ -1,5 +1,5 @@
1
+ import { IValidator } from '@sebgroup/extract';
1
2
  import React from 'react';
2
- import { IValidator } from './types';
3
3
  export interface FormItemsProps {
4
4
  children: React.ReactNode;
5
5
  validate?: IValidator;
@@ -1,5 +1,6 @@
1
1
  import { InputHTMLAttributes } from 'react';
2
- import { CheckboxProps, IValidator, NumberInputProps, RadioButtonProps, TextInputProps } from '../types';
2
+ import { CheckboxProps, NumberInputProps, RadioButtonProps, TextInputProps } from '../types';
3
+ import { IValidator } from '@sebgroup/extract';
3
4
  import React from 'react';
4
5
  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
6
  export declare const RenderInput: Renderer;
@@ -1,12 +1,14 @@
1
1
  import React from 'react';
2
- import { IValidator } from '../types';
2
+ import { IValidator } from '@sebgroup/extract';
3
3
  export interface RadioGroupProps {
4
4
  title?: string;
5
+ defaultSelected?: string;
6
+ valueSelected?: string;
5
7
  description?: string;
6
8
  validator?: IValidator;
7
9
  onChangeRadio?: (value: string) => string;
8
10
  onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
9
11
  name?: string;
10
12
  }
11
- export declare const RadioGroup: ({ description, title, validator, onChangeRadio, onChange, name, children }: React.PropsWithChildren<RadioGroupProps>) => JSX.Element;
13
+ export declare const RadioGroup: ({ defaultSelected, valueSelected, description, title, validator, onChangeRadio, onChange, name, children, }: React.PropsWithChildren<RadioGroupProps>) => JSX.Element;
12
14
  export default RadioGroup;
@@ -1,4 +1,4 @@
1
- import { IndicatorType, ValidatorRules } from '@sebgroup/extract';
1
+ import { IValidator } from '@sebgroup/extract';
2
2
  import { HTMLProps } from 'react';
3
3
  export interface TextInputProps extends HTMLProps<HTMLInputElement> {
4
4
  type?: 'text' | 'email' | 'number';
@@ -21,8 +21,3 @@ export interface RadioButtonProps extends HTMLProps<HTMLInputElement> {
21
21
  value: string;
22
22
  }
23
23
  export declare type InputListener<T> = (newValue?: T) => unknown;
24
- export interface IValidator {
25
- message: string;
26
- indicator: IndicatorType;
27
- rules?: ValidatorRules;
28
- }
@@ -0,0 +1 @@
1
+ export declare const Check: JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const ChevronDown: JSX.Element;
@@ -0,0 +1,4 @@
1
+ export * from './square-exclamation';
2
+ export * from './square-info';
3
+ export * from './check';
4
+ export * from './chevronDown';
@@ -0,0 +1 @@
1
+ export declare const SquareExclamation: JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const SquareInfo: JSX.Element;
@@ -0,0 +1,2 @@
1
+ export * from './list';
2
+ export * as ValueList from './valueList';
@@ -0,0 +1,17 @@
1
+ import { ReactElement } from 'react';
2
+ interface ValueListProps {
3
+ children?: ReactElement<ValueListItemProps> | ReactElement<ValueListItemProps>[];
4
+ inverted?: boolean;
5
+ }
6
+ interface ValueListItemProps {
7
+ children: string;
8
+ }
9
+ export declare const Label: ({ children }: ValueListItemProps) => JSX.Element;
10
+ export declare const Value: ({ children }: ValueListItemProps) => JSX.Element;
11
+ export declare const List: ({ children, inverted }: ValueListProps) => JSX.Element;
12
+ declare const _default: {
13
+ List: ({ children, inverted }: ValueListProps) => JSX.Element;
14
+ Label: ({ children }: ValueListItemProps) => JSX.Element;
15
+ Value: ({ children }: ValueListItemProps) => JSX.Element;
16
+ };
17
+ export default _default;
@@ -0,0 +1 @@
1
+ export * from './select';
@@ -0,0 +1,38 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { IValidator } from '@sebgroup/extract';
3
+ import { SelectorAttributesProps, LabelProps } from '../../types';
4
+ export interface SelectProps extends SelectorAttributesProps, LabelProps {
5
+ children: ReactNode;
6
+ validator?: IValidator;
7
+ onChange?: (event: React.ChangeEvent<HTMLSelectElement>) => void;
8
+ onSelect?: (event: React.ChangeEvent<HTMLSelectElement>) => void;
9
+ defaultValue?: string | number;
10
+ value?: string | number;
11
+ }
12
+ interface OptionProps {
13
+ children: string;
14
+ value: string | number;
15
+ disabled?: boolean;
16
+ invalid?: boolean;
17
+ autocomplete?: string;
18
+ autofocus?: boolean;
19
+ form?: string;
20
+ name?: string;
21
+ required?: boolean;
22
+ size?: number;
23
+ selected?: boolean;
24
+ }
25
+ interface OptionGroupProps {
26
+ label: string;
27
+ children: React.ReactElement<OptionProps> | React.ReactElement<OptionProps>[];
28
+ disabled?: boolean;
29
+ }
30
+ export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
31
+ export declare const Option: ({ value, children, ...rest }: OptionProps) => JSX.Element;
32
+ export declare const OptionGroup: ({ label, disabled, children, }: OptionGroupProps) => JSX.Element;
33
+ declare const _default: {
34
+ Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
35
+ Option: ({ value, children, ...rest }: OptionProps) => JSX.Element;
36
+ OptionGroup: ({ label, disabled, children, }: OptionGroupProps) => JSX.Element;
37
+ };
38
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { AbstractStepper, StepperArgs, StepperData } from '@sebgroup/extract';
2
+ export { StepperArgs };
3
+ export declare const useStepper: ({ min, max, value, step, id, onChange }: StepperArgs) => [AbstractStepper, StepperData];
@@ -0,0 +1,9 @@
1
+ import { StepperArgs } from './hook';
2
+ import { IValidator } from "@sebgroup/extract";
3
+ export interface StepperProps extends StepperArgs {
4
+ label?: string;
5
+ description?: string;
6
+ statusMessage?: string;
7
+ validator?: IValidator;
8
+ }
9
+ export declare function Stepper({ label, description, statusMessage, validator, ...stepperArgs }: StepperProps): JSX.Element;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@sebgroup/green-react",
3
- "version": "1.0.0-beta.9",
3
+ "version": "1.0.1",
4
4
  "peerDependencies": {
5
- "react": "^17.0.0",
6
- "react-dom": "^17.0.0"
5
+ "react": "^17 || ^18",
6
+ "react-dom": "^17 || ^18"
7
7
  },
8
8
  "dependencies": {
9
- "@sebgroup/chlorophyll": "^1.0.0-beta.9",
10
- "@sebgroup/extract": "^1.0.0-beta.9"
9
+ "@sebgroup/chlorophyll": "^1.0.0",
10
+ "@sebgroup/extract": "^1.0.0"
11
11
  },
12
12
  "description": "React components built on top of @sebgroup/chlorophyll.",
13
13
  "repository": {
@@ -0,0 +1 @@
1
+ export * from './props';
@@ -0,0 +1,9 @@
1
+ export interface SelectorAttributesProps {
2
+ id?: string;
3
+ className?: string;
4
+ testId?: string;
5
+ }
6
+ export interface LabelProps {
7
+ label?: string;
8
+ labelInformation?: string;
9
+ }
@@ -1,12 +0,0 @@
1
- import { AlertType } from '@sebgroup/extract';
2
- import { ReactNode } from 'react';
3
- export interface AlertProps {
4
- children: ReactNode;
5
- type: AlertType;
6
- header?: ReactNode;
7
- footer?: ReactNode;
8
- isCloseable?: boolean;
9
- closeText?: string;
10
- }
11
- export declare function Alert({ type, header, footer, children, closeText, isCloseable, }: AlertProps): JSX.Element;
12
- export default Alert;