chop-logic-components 1.0.5 → 1.0.6
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/dist/components/containers/form/__docs__/FormExample.d.ts +1 -0
- package/dist/components/containers/form/controller.d.ts +1 -1
- package/dist/components/containers/form/types.d.ts +3 -4
- package/dist/components/containers/grid/Grid.d.ts +1 -0
- package/dist/components/containers/grid/__docs__/GridExample.d.ts +1 -0
- package/dist/components/containers/grid/elements/Body.d.ts +1 -0
- package/dist/components/containers/grid/elements/DataCell.d.ts +1 -1
- package/dist/components/containers/grid/elements/Head.d.ts +1 -0
- package/dist/components/containers/grid/elements/Row.d.ts +1 -1
- package/dist/components/containers/grid/helpers.d.ts +2 -1
- package/dist/components/containers/grid/types.d.ts +3 -2
- package/dist/components/containers/tabs/types.d.ts +2 -1
- package/dist/components/inputs/button/types.d.ts +1 -1
- package/dist/components/inputs/checkbox/controller.d.ts +2 -0
- package/dist/components/inputs/checkbox/types.d.ts +2 -1
- package/dist/components/inputs/multi-select/MultiSelect.d.ts +1 -0
- package/dist/components/inputs/multi-select/controller.d.ts +1 -1
- package/dist/components/inputs/multi-select/elements/Combobox.d.ts +1 -0
- package/dist/components/inputs/multi-select/elements/Dropdown.d.ts +1 -0
- package/dist/components/inputs/multi-select/elements/Option.d.ts +1 -0
- package/dist/components/inputs/multi-select/helpers.d.ts +1 -1
- package/dist/components/inputs/multi-select/types.d.ts +1 -2
- package/dist/components/inputs/numeric/controller.d.ts +1 -1
- package/dist/components/inputs/numeric/types.d.ts +4 -3
- package/dist/components/inputs/select/Select.d.ts +1 -0
- package/dist/components/inputs/select/controller.d.ts +1 -1
- package/dist/components/inputs/select/elements/Combobox.d.ts +2 -1
- package/dist/components/inputs/select/elements/Dropdown.d.ts +2 -1
- package/dist/components/inputs/select/elements/Option.d.ts +1 -0
- package/dist/components/inputs/select/helpers.d.ts +1 -1
- package/dist/components/inputs/select/types.d.ts +1 -7
- package/dist/components/inputs/text/controller.d.ts +1 -1
- package/dist/components/inputs/text/types.d.ts +6 -7
- package/dist/components/modals/alert/Alert.d.ts +1 -0
- package/dist/components/modals/alert/helpers.d.ts +1 -0
- package/dist/components/modals/dialog/Dialog.d.ts +1 -0
- package/dist/components/modals/dialog/types.d.ts +2 -2
- package/dist/components/modals/tooltip/Tooltip.d.ts +1 -0
- package/dist/components/modals/tooltip/controller.d.ts +4 -2
- package/dist/components/modals/tooltip/types.d.ts +2 -2
- package/dist/constants/style-variables.d.ts +4 -4
- package/dist/constants/themes.d.ts +4 -0
- package/dist/hooks/use-container-dimensions/index.d.ts +1 -0
- package/dist/hooks/use-modal-focus-trap/index.d.ts +2 -0
- package/dist/hooks/use-tooltip-position/index.d.ts +2 -0
- package/dist/index.cjs.js +118 -118
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +4180 -4181
- package/dist/index.es.js.map +1 -1
- package/dist/utils/__tests__/handle-dropdown-list-key-press.test.d.ts +1 -0
- package/dist/utils/get-chop-logic-theme.d.ts +3 -0
- package/dist/utils/handle-dropdown-list-key-press.d.ts +8 -0
- package/dist/utils/types.d.ts +41 -5
- package/package.json +19 -15
- package/dist/utils/get-initial-color-mode.d.ts +0 -1
- /package/dist/utils/__tests__/{get-initial-color-mode.test.d.ts → get-chop-logic-theme.test.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormEvent } from 'react';
|
|
1
|
+
import { default as React, FormEvent } from 'react';
|
|
2
2
|
import { ChopLogicFormData, ChopLogicFormInputParams } from './types';
|
|
3
3
|
|
|
4
4
|
export declare function useChopLogicFormController({ initialValues, onReset, onSubmit, onClickSubmit, }: {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
1
|
+
import { FormEventHandler, PropsWithChildren } from 'react';
|
|
2
2
|
import { CommonComponentProps } from '../../../../../../../../../src/utils/types';
|
|
3
3
|
|
|
4
4
|
export type ChopLogicFormData = {
|
|
5
5
|
[key: string]: unknown;
|
|
6
6
|
};
|
|
7
7
|
export type ChopLogicFormValidationState = [string, boolean][];
|
|
8
|
-
export type ChopLogicFormInput = HTMLInputElement | HTMLSelectElement;
|
|
9
8
|
export type ChopLogicFormInputParams = {
|
|
10
9
|
name: string;
|
|
11
10
|
value: unknown;
|
|
@@ -21,6 +20,6 @@ export type ChopLogicFormProps = PropsWithChildren & CommonComponentProps & {
|
|
|
21
20
|
initialValues?: ChopLogicFormData;
|
|
22
21
|
hasReset?: boolean;
|
|
23
22
|
onClickSubmit?: (data: ChopLogicFormData) => void;
|
|
24
|
-
onReset?:
|
|
25
|
-
onSubmit?:
|
|
23
|
+
onReset?: FormEventHandler<HTMLFormElement>;
|
|
24
|
+
onSubmit?: FormEventHandler<HTMLFormElement>;
|
|
26
25
|
};
|
|
@@ -6,7 +6,7 @@ export type GridRowProps = {
|
|
|
6
6
|
selectRowById: (id: string) => void;
|
|
7
7
|
deselectRowById: (id: string) => void;
|
|
8
8
|
selectable: boolean;
|
|
9
|
-
values: (string |
|
|
9
|
+
values: (string | React.ReactElement)[];
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
};
|
|
12
12
|
declare const GridRow: React.FC<GridRowProps>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
import { ChopLogicGridColumn, ChopLogicGridItem, RenderDataItemCallback } from './types';
|
|
2
3
|
|
|
3
4
|
export declare function getGridRowValues({ item, columns, renderDataItem, }: {
|
|
4
5
|
item: ChopLogicGridItem;
|
|
5
6
|
columns: ChopLogicGridColumn[];
|
|
6
7
|
renderDataItem?: RenderDataItemCallback;
|
|
7
|
-
}): (string |
|
|
8
|
+
}): (string | React.ReactElement)[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
1
2
|
import { CommonComponentProps } from '../../../../../../../../../src/utils/types';
|
|
2
3
|
|
|
3
4
|
export type ChopLogicGridProps = CommonComponentProps & {
|
|
@@ -11,7 +12,7 @@ export type ChopLogicGridProps = CommonComponentProps & {
|
|
|
11
12
|
export type ChopLogicGridColumn = {
|
|
12
13
|
field: string;
|
|
13
14
|
title?: string;
|
|
14
|
-
component?:
|
|
15
|
+
component?: ReactElement;
|
|
15
16
|
highlighted?: boolean;
|
|
16
17
|
className?: string;
|
|
17
18
|
};
|
|
@@ -20,4 +21,4 @@ export type ChopLogicGridItem = {
|
|
|
20
21
|
disabled?: boolean;
|
|
21
22
|
[key: string]: unknown;
|
|
22
23
|
};
|
|
23
|
-
export type RenderDataItemCallback = (item: ChopLogicGridItem, field: string) =>
|
|
24
|
+
export type RenderDataItemCallback = (item: ChopLogicGridItem, field: string) => ReactElement;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
1
2
|
import { CommonComponentProps } from '../../../../../../../../../src/utils/types';
|
|
2
3
|
|
|
3
4
|
export type ChopLogicTabsProps = CommonComponentProps & {
|
|
@@ -6,7 +7,7 @@ export type ChopLogicTabsProps = CommonComponentProps & {
|
|
|
6
7
|
mode?: ChopLogicTabsMode;
|
|
7
8
|
};
|
|
8
9
|
export type ChopLogicTabItem = {
|
|
9
|
-
content:
|
|
10
|
+
content: ReactElement;
|
|
10
11
|
title: string;
|
|
11
12
|
id: string;
|
|
12
13
|
disabled?: boolean;
|
|
@@ -4,7 +4,7 @@ import { ChopLogicIconName } from '../../../../../../../../../src/components/mis
|
|
|
4
4
|
|
|
5
5
|
export type ChopLogicButtonView = 'primary' | 'secondary' | 'danger' | 'icon';
|
|
6
6
|
export type ChopLogicButtonProps = Partial<CommonInputProps> & {
|
|
7
|
-
onClick?: MouseEventHandler<HTMLButtonElement
|
|
7
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
8
8
|
view?: ChopLogicButtonView;
|
|
9
9
|
icon?: ChopLogicIconName;
|
|
10
10
|
text?: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { ChangeEventHandler } from 'react';
|
|
1
2
|
import { CommonInputProps } from '../../../../../../../../../src/utils/types';
|
|
2
3
|
|
|
3
4
|
export type ChopLogicCheckboxProps = CommonInputProps & {
|
|
4
5
|
noLabel?: boolean;
|
|
5
6
|
iconPosition?: 'left' | 'right';
|
|
6
|
-
onChange?:
|
|
7
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
7
8
|
defaultChecked?: boolean;
|
|
8
9
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SelectValue } from '
|
|
1
|
+
import { SelectValue } from '../../../../../../../../../src/utils/types.ts';
|
|
2
2
|
import { MultiSelectValue } from './types';
|
|
3
3
|
|
|
4
4
|
export declare function useChopLogicMultiSelectController({ name, defaultValue, onChange, options, }: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { SelectValue } from '../../../../../../../../../src/utils/types.ts';
|
|
1
2
|
import { ChopLogicFormData } from '../../../../../../../../../src/components/containers/form/types';
|
|
2
|
-
import { SelectValue } from '../select/types';
|
|
3
3
|
import { MultiSelectValue } from './types';
|
|
4
4
|
|
|
5
5
|
export declare function getMultiSelectInitialValues({ name, options, initialValues, defaultValue, }: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { CommonInputProps } from '../../../../../../../../../src/utils/types';
|
|
2
|
-
import { SelectValue } from '../select/types';
|
|
1
|
+
import { CommonInputProps, SelectValue } from '../../../../../../../../../src/utils/types';
|
|
3
2
|
|
|
4
3
|
export type MultiSelectValue = SelectValue & {
|
|
5
4
|
selected: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEventHandler } from 'react';
|
|
1
|
+
import { default as React, ChangeEventHandler } from 'react';
|
|
2
2
|
import { NumericValidationFunction } from './types';
|
|
3
3
|
|
|
4
4
|
export declare function useChopLogicNumericInputController({ name, defaultValue, onChange, onSpinButtonClick, min, max, step, required, validator, }: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChangeEventHandler, FocusEventHandler } from 'react';
|
|
1
2
|
import { CommonInputProps } from '../../../../../../../../../src/utils/types';
|
|
2
3
|
|
|
3
4
|
export type NumericValidationFunction = (input?: number) => boolean;
|
|
@@ -11,7 +12,7 @@ export type ChopLogicNumericInputProps = CommonInputProps & {
|
|
|
11
12
|
readOnly?: boolean;
|
|
12
13
|
defaultValue?: number;
|
|
13
14
|
onSpinButtonClick?: (value?: number) => void;
|
|
14
|
-
onChange?:
|
|
15
|
-
onBlur?:
|
|
16
|
-
onFocus?:
|
|
15
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
16
|
+
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
17
|
+
onFocus?: FocusEventHandler<HTMLInputElement>;
|
|
17
18
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { SelectValue } from '../../../../../../../../../src/utils/types.ts';
|
|
1
2
|
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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommonInputProps } from '../../../../../../../../../src/utils/types';
|
|
1
|
+
import { CommonInputProps, SelectValue } from '../../../../../../../../../src/utils/types';
|
|
2
2
|
|
|
3
3
|
export type ChopLogicSelectProps = CommonInputProps & {
|
|
4
4
|
options: SelectValue[];
|
|
@@ -6,12 +6,6 @@ export type ChopLogicSelectProps = CommonInputProps & {
|
|
|
6
6
|
placeholder?: string;
|
|
7
7
|
defaultValue?: string | number | readonly string[];
|
|
8
8
|
};
|
|
9
|
-
export type SelectValue = {
|
|
10
|
-
id: string;
|
|
11
|
-
label: string;
|
|
12
|
-
} & {
|
|
13
|
-
[key in string]: unknown;
|
|
14
|
-
};
|
|
15
9
|
export type SelectOptionProps = {
|
|
16
10
|
value: SelectValue;
|
|
17
11
|
isSelected: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEventHandler } from 'react';
|
|
1
|
+
import { default as React, ChangeEventHandler } from 'react';
|
|
2
2
|
import { RegExpWithFlags, TextValidationFunction } from './types';
|
|
3
3
|
|
|
4
4
|
export declare function useChopLogicTextInputController({ name, defaultValue, onChange, onClear, required, validator, }: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChangeEventHandler, FocusEventHandler, HTMLInputAutoCompleteAttribute } from 'react';
|
|
1
2
|
import { CommonInputProps } from '../../../../../../../../../src/utils/types';
|
|
2
3
|
|
|
3
4
|
export type RegExpWithFlags = {
|
|
@@ -6,19 +7,17 @@ export type RegExpWithFlags = {
|
|
|
6
7
|
};
|
|
7
8
|
export type TextValidationFunction = (input: string) => boolean;
|
|
8
9
|
export type ChopLogicTextInputProps = CommonInputProps & {
|
|
9
|
-
name: string;
|
|
10
|
-
label: string;
|
|
11
10
|
errorMessage?: string;
|
|
12
11
|
clearable?: boolean;
|
|
13
12
|
readOnly?: boolean;
|
|
14
|
-
onClear?: () => void;
|
|
15
13
|
type?: 'text' | 'email' | 'password';
|
|
16
14
|
validator?: RegExpWithFlags | TextValidationFunction;
|
|
17
15
|
maxLength?: number;
|
|
18
16
|
placeholder?: string;
|
|
19
17
|
defaultValue?: string;
|
|
20
|
-
autoComplete?:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
autoComplete?: HTMLInputAutoCompleteAttribute;
|
|
19
|
+
onClear?: () => void;
|
|
20
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
21
|
+
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
22
|
+
onFocus?: FocusEventHandler<HTMLInputElement>;
|
|
24
23
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
1
|
+
import { HTMLAttributes, PropsWithChildren } from 'react';
|
|
2
2
|
import { CommonComponentProps } from '../../../../../../../../../src/utils/types';
|
|
3
3
|
|
|
4
4
|
export type ChopLogicDialogProps = CommonComponentProps & PropsWithChildren & {
|
|
@@ -6,7 +6,7 @@ export type ChopLogicDialogProps = CommonComponentProps & PropsWithChildren & {
|
|
|
6
6
|
onClose: () => void;
|
|
7
7
|
title: string;
|
|
8
8
|
};
|
|
9
|
-
export type DialogLayoutProps = PropsWithChildren &
|
|
9
|
+
export type DialogLayoutProps = PropsWithChildren & HTMLAttributes<HTMLDivElement> & {
|
|
10
10
|
title: string;
|
|
11
11
|
onClose: () => void;
|
|
12
12
|
isOpened: boolean;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
1
3
|
export declare const useChopLogicTooltipController: ({ id }: {
|
|
2
4
|
id?: string;
|
|
3
5
|
}) => {
|
|
@@ -9,6 +11,6 @@ export declare const useChopLogicTooltipController: ({ id }: {
|
|
|
9
11
|
top: number;
|
|
10
12
|
left: number;
|
|
11
13
|
isOpened: boolean;
|
|
12
|
-
wrapperRef:
|
|
13
|
-
tooltipRef:
|
|
14
|
+
wrapperRef: React.MutableRefObject<null>;
|
|
15
|
+
tooltipRef: React.RefObject<HTMLDivElement>;
|
|
14
16
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
1
|
+
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
2
|
import { CommonComponentProps } from '../../../../../../../../../src/utils/types';
|
|
3
3
|
|
|
4
4
|
export type ChopLogicTooltipProps = PropsWithChildren & CommonComponentProps & {
|
|
5
|
-
tooltipContent: string |
|
|
5
|
+
tooltipContent: string | ReactElement;
|
|
6
6
|
containerTag?: TooltipContainerTag;
|
|
7
7
|
visibleOn?: 'hover' | 'click' | 'focus' | 'contextmenu';
|
|
8
8
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare const COLORS: Readonly<{
|
|
2
2
|
primary: "hsl(0, 0%, 13%)";
|
|
3
|
+
secondary: "hsl(215, 69%, 49%)";
|
|
4
|
+
tertiary: "hsl(205, 48%, 56%)";
|
|
3
5
|
background: "hsl(0, 0%, 100%)";
|
|
4
6
|
highlight: "hsl(65, 43%, 95%)";
|
|
5
7
|
shade: "hsl(206, 19%, 93%)";
|
|
6
|
-
secondary: "hsl(215, 69%, 49%)";
|
|
7
|
-
tertiary: "hsl(205, 48%, 56%)";
|
|
8
8
|
accent: "hsl(16, 100%, 45%)";
|
|
9
9
|
transparentBackground: "hsla(0, 0%, 0%, 0.3)";
|
|
10
10
|
}>;
|
|
@@ -34,8 +34,8 @@ export declare const BORDERS: Readonly<{
|
|
|
34
34
|
}>;
|
|
35
35
|
export declare const Z_INDEXES: Readonly<{
|
|
36
36
|
dropdown: 1000;
|
|
37
|
-
modal:
|
|
38
|
-
tooltip:
|
|
37
|
+
modal: 1000;
|
|
38
|
+
tooltip: 1000;
|
|
39
39
|
}>;
|
|
40
40
|
export declare const GRADIENTS: Readonly<{
|
|
41
41
|
primary: "linear-gradient(0deg, #222222, #266dd3)";
|