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.
Files changed (56) hide show
  1. package/dist/components/containers/form/__docs__/FormExample.d.ts +1 -0
  2. package/dist/components/containers/form/controller.d.ts +1 -1
  3. package/dist/components/containers/form/types.d.ts +3 -4
  4. package/dist/components/containers/grid/Grid.d.ts +1 -0
  5. package/dist/components/containers/grid/__docs__/GridExample.d.ts +1 -0
  6. package/dist/components/containers/grid/elements/Body.d.ts +1 -0
  7. package/dist/components/containers/grid/elements/DataCell.d.ts +1 -1
  8. package/dist/components/containers/grid/elements/Head.d.ts +1 -0
  9. package/dist/components/containers/grid/elements/Row.d.ts +1 -1
  10. package/dist/components/containers/grid/helpers.d.ts +2 -1
  11. package/dist/components/containers/grid/types.d.ts +3 -2
  12. package/dist/components/containers/tabs/types.d.ts +2 -1
  13. package/dist/components/inputs/button/types.d.ts +1 -1
  14. package/dist/components/inputs/checkbox/controller.d.ts +2 -0
  15. package/dist/components/inputs/checkbox/types.d.ts +2 -1
  16. package/dist/components/inputs/multi-select/MultiSelect.d.ts +1 -0
  17. package/dist/components/inputs/multi-select/controller.d.ts +1 -1
  18. package/dist/components/inputs/multi-select/elements/Combobox.d.ts +1 -0
  19. package/dist/components/inputs/multi-select/elements/Dropdown.d.ts +1 -0
  20. package/dist/components/inputs/multi-select/elements/Option.d.ts +1 -0
  21. package/dist/components/inputs/multi-select/helpers.d.ts +1 -1
  22. package/dist/components/inputs/multi-select/types.d.ts +1 -2
  23. package/dist/components/inputs/numeric/controller.d.ts +1 -1
  24. package/dist/components/inputs/numeric/types.d.ts +4 -3
  25. package/dist/components/inputs/select/Select.d.ts +1 -0
  26. package/dist/components/inputs/select/controller.d.ts +1 -1
  27. package/dist/components/inputs/select/elements/Combobox.d.ts +2 -1
  28. package/dist/components/inputs/select/elements/Dropdown.d.ts +2 -1
  29. package/dist/components/inputs/select/elements/Option.d.ts +1 -0
  30. package/dist/components/inputs/select/helpers.d.ts +1 -1
  31. package/dist/components/inputs/select/types.d.ts +1 -7
  32. package/dist/components/inputs/text/controller.d.ts +1 -1
  33. package/dist/components/inputs/text/types.d.ts +6 -7
  34. package/dist/components/modals/alert/Alert.d.ts +1 -0
  35. package/dist/components/modals/alert/helpers.d.ts +1 -0
  36. package/dist/components/modals/dialog/Dialog.d.ts +1 -0
  37. package/dist/components/modals/dialog/types.d.ts +2 -2
  38. package/dist/components/modals/tooltip/Tooltip.d.ts +1 -0
  39. package/dist/components/modals/tooltip/controller.d.ts +4 -2
  40. package/dist/components/modals/tooltip/types.d.ts +2 -2
  41. package/dist/constants/style-variables.d.ts +4 -4
  42. package/dist/constants/themes.d.ts +4 -0
  43. package/dist/hooks/use-container-dimensions/index.d.ts +1 -0
  44. package/dist/hooks/use-modal-focus-trap/index.d.ts +2 -0
  45. package/dist/hooks/use-tooltip-position/index.d.ts +2 -0
  46. package/dist/index.cjs.js +118 -118
  47. package/dist/index.cjs.js.map +1 -1
  48. package/dist/index.es.js +4180 -4181
  49. package/dist/index.es.js.map +1 -1
  50. package/dist/utils/__tests__/handle-dropdown-list-key-press.test.d.ts +1 -0
  51. package/dist/utils/get-chop-logic-theme.d.ts +3 -0
  52. package/dist/utils/handle-dropdown-list-key-press.d.ts +8 -0
  53. package/dist/utils/types.d.ts +41 -5
  54. package/package.json +19 -15
  55. package/dist/utils/get-initial-color-mode.d.ts +0 -1
  56. /package/dist/utils/__tests__/{get-initial-color-mode.test.d.ts → get-chop-logic-theme.test.d.ts} +0 -0
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { ChopLogicFormProps } from '../types';
2
3
 
3
4
  declare const FormExample: React.FC<ChopLogicFormProps>;
@@ -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?: React.FormEventHandler<HTMLFormElement>;
25
- onSubmit?: React.FormEventHandler<HTMLFormElement>;
23
+ onReset?: FormEventHandler<HTMLFormElement>;
24
+ onSubmit?: FormEventHandler<HTMLFormElement>;
26
25
  };
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { ChopLogicGridProps } from './types';
2
3
 
3
4
  declare const ChopLogicGrid: React.FC<ChopLogicGridProps>;
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { ChopLogicGridProps } from '../types';
2
3
 
3
4
  declare const GridExample: React.FC<ChopLogicGridProps>;
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { ChopLogicGridColumn, ChopLogicGridItem, RenderDataItemCallback } from '../types';
2
3
 
3
4
  type ChopLogicGridBodyProps = {
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
 
3
3
  declare const GridDataCell: React.FC<{
4
- value: string | JSX.Element;
4
+ value: React.ReactElement | string;
5
5
  }>;
6
6
  export default GridDataCell;
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { ChopLogicGridColumn } from '../types';
2
3
 
3
4
  type ChopLogicGridHeadProps = {
@@ -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 | JSX.Element)[];
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 | JSX.Element)[];
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?: React.ReactElement;
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) => JSX.Element;
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: React.ReactElement;
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> | (() => void);
7
+ onClick?: MouseEventHandler<HTMLButtonElement>;
8
8
  view?: ChopLogicButtonView;
9
9
  icon?: ChopLogicIconName;
10
10
  text?: string;
@@ -1,3 +1,5 @@
1
+ import { default as React } from 'react';
2
+
1
3
  export declare function useChopLogicCheckboxController({ name, defaultChecked, onChange, }: {
2
4
  name: string;
3
5
  defaultChecked?: boolean;
@@ -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?: React.ChangeEventHandler<HTMLInputElement>;
7
+ onChange?: ChangeEventHandler<HTMLInputElement>;
7
8
  defaultChecked?: boolean;
8
9
  };
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { ChopLogicMultiSelectProps } from './types';
2
3
 
3
4
  declare const ChopLogicMultiSelect: React.FC<ChopLogicMultiSelectProps>;
@@ -1,4 +1,4 @@
1
- import { SelectValue } from '../select/types';
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,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { MultiSelectValue } from '../types';
2
3
 
3
4
  type SelectComboboxProps = {
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { MultiSelectDropdownProps } from '../types';
2
3
 
3
4
  declare const MultiSelectDropdown: React.FC<MultiSelectDropdownProps>;
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { MultiSelectValue } from '../types';
2
3
 
3
4
  type SelectOptionProps = {
@@ -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?: React.ChangeEventHandler<HTMLInputElement>;
15
- onBlur?: React.FocusEventHandler<HTMLInputElement>;
16
- onFocus?: React.FocusEventHandler<HTMLInputElement>;
15
+ onChange?: ChangeEventHandler<HTMLInputElement>;
16
+ onBlur?: FocusEventHandler<HTMLInputElement>;
17
+ onFocus?: FocusEventHandler<HTMLInputElement>;
17
18
  };
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { ChopLogicSelectProps } from './types';
2
3
 
3
4
  declare const ChopLogicSelect: React.FC<ChopLogicSelectProps>;
@@ -1,4 +1,4 @@
1
- import { SelectValue } from './types';
1
+ import { SelectValue } from '../../../../../../../../../src/utils/types.ts';
2
2
 
3
3
  export declare function useChopLogicSelectController({ name, defaultValue, onChange, options, }: {
4
4
  name: string;
@@ -1,4 +1,5 @@
1
- import { SelectValue } from '../types';
1
+ import { default as React } from 'react';
2
+ import { SelectValue } from '../../../../../../../../../../src/utils/types.ts';
2
3
 
3
4
  type SelectComboboxProps = {
4
5
  opened: boolean;
@@ -1,4 +1,5 @@
1
- import { SelectValue } from '../types';
1
+ import { default as React } from 'react';
2
+ import { SelectValue } from '../../../../../../../../../../src/utils/types.ts';
2
3
 
3
4
  type SelectDropdownProps = {
4
5
  options: SelectValue[];
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { SelectOptionProps } from '../types';
2
3
 
3
4
  declare const SelectOption: React.FC<SelectOptionProps>;
@@ -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?: React.HTMLInputAutoCompleteAttribute;
21
- onChange?: React.ChangeEventHandler<HTMLInputElement>;
22
- onBlur?: React.FocusEventHandler<HTMLInputElement>;
23
- onFocus?: React.FocusEventHandler<HTMLInputElement>;
18
+ autoComplete?: HTMLInputAutoCompleteAttribute;
19
+ onClear?: () => void;
20
+ onChange?: ChangeEventHandler<HTMLInputElement>;
21
+ onBlur?: FocusEventHandler<HTMLInputElement>;
22
+ onFocus?: FocusEventHandler<HTMLInputElement>;
24
23
  };
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { ChopLogicAlertProps } from './types';
2
3
 
3
4
  declare const ChopLogicAlert: React.FC<ChopLogicAlertProps>;
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { ChopLogicIconName } from '../../../../../../../../../src/components/misc/icon/Icon';
2
3
  import { ChopLogicAlertMode } from './types';
3
4
 
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { ChopLogicDialogProps } from './types';
2
3
 
3
4
  declare const ChopLogicDialog: React.FC<ChopLogicDialogProps>;
@@ -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 & React.HTMLAttributes<HTMLDivElement> & {
9
+ export type DialogLayoutProps = PropsWithChildren & HTMLAttributes<HTMLDivElement> & {
10
10
  title: string;
11
11
  onClose: () => void;
12
12
  isOpened: boolean;
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { ChopLogicTooltipProps } from './types';
2
3
 
3
4
  declare const ChopLogicTooltip: React.FC<ChopLogicTooltipProps>;
@@ -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: import('react').MutableRefObject<null>;
13
- tooltipRef: import('react').RefObject<HTMLDivElement>;
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 | React.ReactElement;
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: 2000;
38
- tooltip: 3000;
37
+ modal: 1000;
38
+ tooltip: 1000;
39
39
  }>;
40
40
  export declare const GRADIENTS: Readonly<{
41
41
  primary: "linear-gradient(0deg, #222222, #266dd3)";
@@ -0,0 +1,4 @@
1
+ import { ChopLogicTheme } from '../../../../../../../src/utils/types.ts';
2
+
3
+ export declare const LIGHT_THEME: ChopLogicTheme;
4
+ export declare const DARK_THEME: ChopLogicTheme;
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  import { Dimensions } from '../use-window-dimensions';
2
3
 
3
4
  type useContainerDimensionsParams = {
@@ -1,3 +1,5 @@
1
+ import { default as React } from 'react';
2
+
1
3
  type ModalFocusTrapParams = {
2
4
  modalRef: React.RefObject<HTMLDivElement>;
3
5
  isOpened: boolean;
@@ -1,3 +1,5 @@
1
+ import { default as React } from 'react';
2
+
1
3
  type useTooltipPositionParams = {
2
4
  wrapperRef: React.RefObject<HTMLSpanElement | HTMLDivElement>;
3
5
  tooltipRef: React.RefObject<HTMLSpanElement | HTMLDivElement>;