chop-logic-components 0.13.0 → 1.0.2
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/README.md +49 -1
- package/dist/components/containers/form/Form.d.ts +2 -8
- package/dist/components/containers/form/FormContext.d.ts +1 -15
- package/dist/components/containers/form/__docs__/FormExample.d.ts +1 -1
- package/dist/components/containers/form/controller.d.ts +1 -1
- package/dist/components/containers/form/helpers.d.ts +1 -1
- package/dist/components/containers/form/types.d.ts +23 -0
- package/dist/components/containers/grid/controller.d.ts +16 -0
- package/dist/components/containers/grid/elements/Checkbox.d.ts +2 -2
- package/dist/components/containers/tabs/Tabs.d.ts +1 -12
- package/dist/components/containers/tabs/Tabs.styled.d.ts +1 -1
- package/dist/components/containers/tabs/elements/TabButton.d.ts +1 -1
- package/dist/components/containers/tabs/elements/TabContent.d.ts +3 -4
- package/dist/components/containers/tabs/elements/TabList.d.ts +1 -1
- package/dist/components/containers/tabs/types.d.ts +13 -0
- package/dist/components/inputs/_common/input-inner-button/InputInnerButton.d.ts +2 -2
- package/dist/components/inputs/button/Button.d.ts +2 -11
- package/dist/components/inputs/button/Button.styled.d.ts +1 -1
- package/dist/components/inputs/button/__docs__/ButtonExample.d.ts +1 -1
- package/dist/components/inputs/button/types.d.ts +12 -0
- package/dist/components/inputs/checkbox/Checkbox.d.ts +1 -6
- package/dist/components/inputs/checkbox/__docs__/CheckboxExample.d.ts +1 -1
- package/dist/components/inputs/checkbox/controller.d.ts +9 -0
- package/dist/components/inputs/checkbox/helpers.d.ts +6 -8
- package/dist/components/inputs/checkbox/types.d.ts +7 -0
- package/dist/components/inputs/multi-select/MultiSelect.d.ts +1 -18
- package/dist/components/inputs/multi-select/__docs__/MultiSelectExample.d.ts +1 -1
- package/dist/components/inputs/multi-select/controller.d.ts +15 -0
- package/dist/components/inputs/multi-select/elements/Combobox.d.ts +1 -1
- package/dist/components/inputs/multi-select/elements/Dropdown.d.ts +1 -1
- package/dist/components/inputs/multi-select/elements/Option.d.ts +1 -1
- package/dist/components/inputs/multi-select/helpers.d.ts +5 -15
- package/dist/components/inputs/multi-select/types.d.ts +19 -0
- package/dist/components/inputs/numeric/NumericInput.d.ts +1 -10
- package/dist/components/inputs/numeric/__docs__/NumericInputExample.d.ts +1 -1
- package/dist/components/inputs/numeric/controller.d.ts +22 -0
- package/dist/components/inputs/numeric/helpers.d.ts +2 -22
- package/dist/components/inputs/numeric/types.d.ts +11 -0
- package/dist/components/inputs/select/Select.d.ts +2 -14
- package/dist/components/inputs/select/__docs__/SelectExample.d.ts +1 -1
- package/dist/components/inputs/select/controller.d.ts +15 -0
- package/dist/components/inputs/select/elements/Combobox.d.ts +1 -1
- package/dist/components/inputs/select/elements/Dropdown.d.ts +1 -1
- package/dist/components/inputs/select/elements/Option.d.ts +1 -7
- package/dist/components/inputs/select/helpers.d.ts +2 -15
- package/dist/components/inputs/select/types.d.ts +20 -0
- package/dist/components/inputs/text/TextInput.d.ts +1 -15
- package/dist/components/inputs/text/__docs__/TextInputExample.d.ts +1 -1
- package/dist/components/inputs/text/controller.d.ts +18 -0
- package/dist/components/inputs/text/helpers.d.ts +2 -18
- package/dist/components/inputs/text/types.d.ts +15 -0
- package/dist/components/misc/icon/Icon.d.ts +2 -2
- package/dist/components/modals/alert/Alert.d.ts +1 -10
- package/dist/components/modals/alert/__docs__/Alert.stories.d.ts +1 -1
- package/dist/components/modals/alert/elements/Header.d.ts +1 -8
- package/dist/components/modals/alert/helpers.d.ts +5 -0
- package/dist/components/modals/alert/types.d.ts +17 -0
- package/dist/components/modals/dialog/Dialog.d.ts +2 -7
- package/dist/components/modals/dialog/__docs__/DialogExample.d.ts +2 -2
- package/dist/components/modals/dialog/elements/Header.d.ts +2 -3
- package/dist/components/modals/dialog/elements/Layout.d.ts +3 -7
- package/dist/components/modals/dialog/types.d.ts +12 -0
- package/dist/components/modals/tooltip/Tooltip.d.ts +1 -6
- package/dist/components/modals/tooltip/__docs__/TooltipExample.d.ts +1 -1
- package/dist/components/modals/tooltip/controller.d.ts +15 -0
- package/dist/components/modals/tooltip/types.d.ts +8 -0
- package/dist/constants/style-variables.d.ts +3 -3
- package/dist/index.cjs.js +91 -91
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +2830 -3357
- package/dist/index.es.js.map +1 -1
- package/package.json +2 -2
- package/dist/components/modals/alert/helpers/get-alert-title.d.ts +0 -3
- package/dist/components/modals/alert/helpers/render-alert-icon.d.ts +0 -4
- package/dist/utils/__tests__/create-class-name.test.d.ts +0 -1
- package/dist/utils/create-class-name.d.ts +0 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChopLogicFormData } from '../../../../../../../../../src/components/containers/form/
|
|
2
|
-
import { SelectValue } from './
|
|
1
|
+
import { ChopLogicFormData } from '../../../../../../../../../src/components/containers/form/types';
|
|
2
|
+
import { SelectValue } from './types';
|
|
3
3
|
|
|
4
4
|
export declare function getSelectInitialValue({ name, options, initialValues, defaultValue, }: {
|
|
5
5
|
name: string;
|
|
@@ -7,16 +7,3 @@ export declare function getSelectInitialValue({ name, options, initialValues, de
|
|
|
7
7
|
initialValues?: ChopLogicFormData;
|
|
8
8
|
defaultValue?: string | number | readonly string[];
|
|
9
9
|
}): SelectValue | undefined;
|
|
10
|
-
export declare function useChopLogicSelectController({ name, defaultValue, onChange, options, }: {
|
|
11
|
-
name: string;
|
|
12
|
-
defaultValue?: string | number | readonly string[];
|
|
13
|
-
onChange?: (value?: SelectValue) => void;
|
|
14
|
-
options: SelectValue[];
|
|
15
|
-
}): {
|
|
16
|
-
selected: SelectValue | undefined;
|
|
17
|
-
opened: boolean;
|
|
18
|
-
handleClear: () => void;
|
|
19
|
-
handleClose: () => void;
|
|
20
|
-
handleToggle: () => void;
|
|
21
|
-
handleSelect: (id: string) => void;
|
|
22
|
-
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type ChopLogicSelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {
|
|
3
|
+
name: string;
|
|
4
|
+
label: string;
|
|
5
|
+
options: SelectValue[];
|
|
6
|
+
onChange?: (value?: SelectValue) => void;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
};
|
|
9
|
+
export type SelectValue = {
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
} & {
|
|
13
|
+
[key in string]: unknown;
|
|
14
|
+
};
|
|
15
|
+
export type SelectOptionProps = {
|
|
16
|
+
value: SelectValue;
|
|
17
|
+
isSelected: boolean;
|
|
18
|
+
onSelect: (id: string) => void;
|
|
19
|
+
onClear: () => void;
|
|
20
|
+
};
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { ChopLogicTextInputProps } from './types';
|
|
2
3
|
|
|
3
|
-
export type RegExpWithFlags = {
|
|
4
|
-
regexp: string;
|
|
5
|
-
flags?: string;
|
|
6
|
-
};
|
|
7
|
-
export type TextValidationFunction = (input: string) => boolean;
|
|
8
|
-
export type ChopLogicTextInputProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
9
|
-
name: string;
|
|
10
|
-
label: string;
|
|
11
|
-
valid?: boolean;
|
|
12
|
-
errorMessage?: string;
|
|
13
|
-
clearable?: boolean;
|
|
14
|
-
onClear?: () => void;
|
|
15
|
-
type?: 'text' | 'email' | 'password';
|
|
16
|
-
validator?: RegExpWithFlags | TextValidationFunction;
|
|
17
|
-
};
|
|
18
4
|
declare const ChopLogicTextInput: React.FC<ChopLogicTextInputProps>;
|
|
19
5
|
export default ChopLogicTextInput;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ChangeEventHandler } from 'react';
|
|
2
|
+
import { RegExpWithFlags, TextValidationFunction } from './types';
|
|
3
|
+
|
|
4
|
+
export declare function useChopLogicTextInputController({ name, defaultValue, onChange, onClear, required, validator, }: {
|
|
5
|
+
name: string;
|
|
6
|
+
required: boolean;
|
|
7
|
+
validator?: RegExpWithFlags | TextValidationFunction;
|
|
8
|
+
defaultValue?: string | number | readonly string[];
|
|
9
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
10
|
+
onClear?: () => void;
|
|
11
|
+
}): {
|
|
12
|
+
value: string;
|
|
13
|
+
valid: boolean;
|
|
14
|
+
passwordShown: boolean;
|
|
15
|
+
handleChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
16
|
+
handleClear: () => void;
|
|
17
|
+
togglePassword: () => void;
|
|
18
|
+
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { RegExpWithFlags, TextValidationFunction } from './TextInput';
|
|
1
|
+
import { ChopLogicFormData } from '../../../../../../../../../src/components/containers/form/types';
|
|
2
|
+
import { RegExpWithFlags, TextValidationFunction } from './types';
|
|
4
3
|
|
|
5
4
|
export declare function validateTextInputValue({ value, required, validator, }: {
|
|
6
5
|
value: string;
|
|
@@ -12,18 +11,3 @@ export declare function getTextInputInitialValue({ name, initialValues, defaultV
|
|
|
12
11
|
initialValues?: ChopLogicFormData;
|
|
13
12
|
defaultValue?: string | number | readonly string[];
|
|
14
13
|
}): string;
|
|
15
|
-
export declare function useChopLogicTextInputController({ name, defaultValue, onChange, onClear, required, validator, }: {
|
|
16
|
-
name: string;
|
|
17
|
-
required: boolean;
|
|
18
|
-
validator?: RegExpWithFlags | TextValidationFunction;
|
|
19
|
-
defaultValue?: string | number | readonly string[];
|
|
20
|
-
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
21
|
-
onClear?: () => void;
|
|
22
|
-
}): {
|
|
23
|
-
value: string;
|
|
24
|
-
valid: boolean;
|
|
25
|
-
passwordShown: boolean;
|
|
26
|
-
handleChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
27
|
-
handleClear: () => void;
|
|
28
|
-
togglePassword: () => void;
|
|
29
|
-
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type RegExpWithFlags = {
|
|
3
|
+
regexp: string;
|
|
4
|
+
flags?: string;
|
|
5
|
+
};
|
|
6
|
+
export type TextValidationFunction = (input: string) => boolean;
|
|
7
|
+
export type ChopLogicTextInputProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
8
|
+
name: string;
|
|
9
|
+
label: string;
|
|
10
|
+
errorMessage?: string;
|
|
11
|
+
clearable?: boolean;
|
|
12
|
+
onClear?: () => void;
|
|
13
|
+
type?: 'text' | 'email' | 'password';
|
|
14
|
+
validator?: RegExpWithFlags | TextValidationFunction;
|
|
15
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
|
|
3
|
-
export declare enum
|
|
3
|
+
export declare enum ChopLogicIconName {
|
|
4
4
|
ArrowDown = "arrow-down",
|
|
5
5
|
ArrowUp = "arrow-up",
|
|
6
6
|
Back = "back",
|
|
@@ -31,6 +31,6 @@ export declare enum CLIcon {
|
|
|
31
31
|
Remove = "remove"
|
|
32
32
|
}
|
|
33
33
|
declare const ChopLogicIcon: React.FC<{
|
|
34
|
-
name?:
|
|
34
|
+
name?: ChopLogicIconName;
|
|
35
35
|
}>;
|
|
36
36
|
export default ChopLogicIcon;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChopLogicAlertProps } from './types';
|
|
2
2
|
|
|
3
|
-
export type ChopLogicAlertMode = 'success' | 'error' | 'warning' | 'info' | 'help';
|
|
4
|
-
export type ChopLogicAlertProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
5
|
-
isOpened: boolean;
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
message: string;
|
|
8
|
-
title?: string;
|
|
9
|
-
mode?: ChopLogicAlertMode;
|
|
10
|
-
icon?: CLIcon;
|
|
11
|
-
};
|
|
12
3
|
declare const ChopLogicAlert: React.FC<ChopLogicAlertProps>;
|
|
13
4
|
export default ChopLogicAlert;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import { ChopLogicAlertProps } from '../
|
|
3
|
+
import { ChopLogicAlertProps } from '../types';
|
|
4
4
|
|
|
5
5
|
declare const ExampleComponent: React.FC<ChopLogicAlertProps>;
|
|
6
6
|
declare const meta: Meta<typeof ExampleComponent>;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { ChopLogicAlertMode } from '../Alert';
|
|
2
|
+
import { ChopLogicAlertHeaderProps } from '../types';
|
|
4
3
|
|
|
5
|
-
type ChopLogicAlertHeaderProps = {
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
mode: ChopLogicAlertMode;
|
|
8
|
-
title?: string;
|
|
9
|
-
icon?: CLIcon;
|
|
10
|
-
};
|
|
11
4
|
declare const ChopLogicAlertHeader: React.FC<ChopLogicAlertHeaderProps>;
|
|
12
5
|
export default ChopLogicAlertHeader;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ChopLogicIconName } from '../../../../../../../../../src/components/misc/icon/Icon';
|
|
2
|
+
import { ChopLogicAlertMode } from './types';
|
|
3
|
+
|
|
4
|
+
export declare function getAlertTitle(mode: ChopLogicAlertMode, title?: string): string;
|
|
5
|
+
export declare function renderAlertIcon(mode: ChopLogicAlertMode, icon?: ChopLogicIconName): React.ReactElement | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChopLogicIconName } from '../../../../../../../../../src/components/misc/icon/Icon';
|
|
2
|
+
|
|
3
|
+
export type ChopLogicAlertMode = 'success' | 'error' | 'warning' | 'info' | 'help';
|
|
4
|
+
export type ChopLogicAlertProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
isOpened: boolean;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
message: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
mode?: ChopLogicAlertMode;
|
|
10
|
+
icon?: ChopLogicIconName;
|
|
11
|
+
};
|
|
12
|
+
export type ChopLogicAlertHeaderProps = {
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
mode: ChopLogicAlertMode;
|
|
15
|
+
title?: string;
|
|
16
|
+
icon?: ChopLogicIconName;
|
|
17
|
+
};
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChopLogicDialogProps } from './types';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
isOpened: boolean;
|
|
5
|
-
onClose: () => void;
|
|
6
|
-
title: string;
|
|
7
|
-
};
|
|
8
|
-
declare const ChopLogicDialog: React.FC<ChopLogicModalProps>;
|
|
3
|
+
declare const ChopLogicDialog: React.FC<ChopLogicDialogProps>;
|
|
9
4
|
export default ChopLogicDialog;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ChopLogicDialogProps } from '../types';
|
|
3
3
|
|
|
4
|
-
declare const Example: React.FC<
|
|
4
|
+
declare const Example: React.FC<ChopLogicDialogProps>;
|
|
5
5
|
export default Example;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
declare const ChopLogicModalLayoutHeader: React.FC<{
|
|
4
4
|
title: string;
|
|
5
5
|
onClose: () => void;
|
|
6
|
-
}
|
|
7
|
-
declare const ChopLogicModalLayoutHeader: React.FC<ChopLogicModalLayoutHeaderProps>;
|
|
6
|
+
}>;
|
|
8
7
|
export default ChopLogicModalLayoutHeader;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { default as React
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { DialogLayoutProps } from '../types';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
title: string;
|
|
5
|
-
onClose: () => void;
|
|
6
|
-
isOpened: boolean;
|
|
7
|
-
};
|
|
8
|
-
declare const ChopLogicModalLayout: React.FC<ModalLayoutProps>;
|
|
4
|
+
declare const ChopLogicModalLayout: React.FC<DialogLayoutProps>;
|
|
9
5
|
export default ChopLogicModalLayout;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
|
|
3
|
+
export type ChopLogicDialogProps = PropsWithChildren & React.HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
isOpened: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
8
|
+
export type DialogLayoutProps = PropsWithChildren & React.HTMLAttributes<HTMLDivElement> & {
|
|
9
|
+
title: string;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
isOpened: boolean;
|
|
12
|
+
};
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChopLogicTooltipProps } from './types';
|
|
2
2
|
|
|
3
|
-
export type ChopLogicTooltipProps = PropsWithChildren & React.HTMLAttributes<HTMLElement> & {
|
|
4
|
-
tooltipContent: string | React.ReactElement;
|
|
5
|
-
containerTag?: 'span' | 'div' | 'p' | 'strong' | 'em';
|
|
6
|
-
visibleOn?: 'hover' | 'click' | 'focus' | 'contextmenu';
|
|
7
|
-
};
|
|
8
3
|
declare const ChopLogicTooltip: React.FC<ChopLogicTooltipProps>;
|
|
9
4
|
export default ChopLogicTooltip;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const useChopLogicTooltipController: ({ id }: {
|
|
3
|
+
id?: string;
|
|
4
|
+
}) => {
|
|
5
|
+
elementId: string;
|
|
6
|
+
openTooltip: () => void;
|
|
7
|
+
closeTooltip: () => void;
|
|
8
|
+
toggleTooltip: () => void;
|
|
9
|
+
handleContextMenu: (e: React.MouseEvent) => void;
|
|
10
|
+
top: number;
|
|
11
|
+
left: number;
|
|
12
|
+
isOpened: boolean;
|
|
13
|
+
wrapperRef: import('react').MutableRefObject<null>;
|
|
14
|
+
tooltipRef: import('react').RefObject<HTMLDivElement>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
|
|
3
|
+
export type ChopLogicTooltipProps = PropsWithChildren & React.HTMLAttributes<HTMLElement> & {
|
|
4
|
+
tooltipContent: string | React.ReactElement;
|
|
5
|
+
containerTag?: TooltipContainerTag;
|
|
6
|
+
visibleOn?: 'hover' | 'click' | 'focus' | 'contextmenu';
|
|
7
|
+
};
|
|
8
|
+
export type TooltipContainerTag = 'span' | 'div' | 'p' | 'strong' | 'em';
|
|
@@ -27,10 +27,10 @@ export declare const SHADOWS: Readonly<{
|
|
|
27
27
|
inset: "-5px 5px 20px 5px rgba(0, 0, 0, 0.1) inset";
|
|
28
28
|
}>;
|
|
29
29
|
export declare const BORDERS: Readonly<{
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
light: "1px solid #5998c5";
|
|
31
|
+
heavy: "1px solid #266dd3";
|
|
32
32
|
accent: "1px solid #e53d00";
|
|
33
|
-
|
|
33
|
+
outline: "2px dashed #e53d00";
|
|
34
34
|
}>;
|
|
35
35
|
export declare const Z_INDEXES: Readonly<{
|
|
36
36
|
dropdown: 1000;
|