chop-logic-components 1.0.4 → 1.0.5

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 (41) hide show
  1. package/README.md +5 -2
  2. package/dist/components/containers/form/Form.styled.d.ts +0 -1
  3. package/dist/components/containers/form/types.d.ts +4 -1
  4. package/dist/components/containers/grid/Grid.styled.d.ts +0 -1
  5. package/dist/components/containers/grid/types.d.ts +3 -6
  6. package/dist/components/containers/tabs/types.d.ts +3 -2
  7. package/dist/components/inputs/_common/error-message/ErrorMessage.styled.d.ts +0 -1
  8. package/dist/components/inputs/_common/input-inner-button/InputInnerButton.styled.d.ts +0 -1
  9. package/dist/components/inputs/_common/label/Label.styled.d.ts +0 -1
  10. package/dist/components/inputs/button/types.d.ts +3 -2
  11. package/dist/components/inputs/checkbox/Checkbox.styled.d.ts +0 -1
  12. package/dist/components/inputs/checkbox/controller.d.ts +0 -1
  13. package/dist/components/inputs/checkbox/types.d.ts +5 -4
  14. package/dist/components/inputs/multi-select/MultiSelect.styled.d.ts +0 -1
  15. package/dist/components/inputs/multi-select/types.d.ts +3 -3
  16. package/dist/components/inputs/numeric/NumericInput.styled.d.ts +0 -1
  17. package/dist/components/inputs/numeric/types.d.ts +11 -5
  18. package/dist/components/inputs/select/Select.styled.d.ts +0 -1
  19. package/dist/components/inputs/select/types.d.ts +4 -4
  20. package/dist/components/inputs/text/TextInput.styled.d.ts +0 -1
  21. package/dist/components/inputs/text/types.d.ts +11 -2
  22. package/dist/components/modals/alert/Alert.styled.d.ts +0 -1
  23. package/dist/components/modals/alert/types.d.ts +2 -2
  24. package/dist/components/modals/dialog/Dialog.styled.d.ts +0 -1
  25. package/dist/components/modals/dialog/types.d.ts +2 -1
  26. package/dist/components/modals/tooltip/Tooltip.styled.d.ts +0 -1
  27. package/dist/components/modals/tooltip/controller.d.ts +0 -1
  28. package/dist/components/modals/tooltip/types.d.ts +2 -1
  29. package/dist/constants/style-variables.d.ts +2 -2
  30. package/dist/favicon.ico +0 -0
  31. package/dist/hooks/use-modal-focus-trap/index.d.ts +0 -1
  32. package/dist/hooks/use-tooltip-position/index.d.ts +0 -1
  33. package/dist/index.cjs.js +92 -92
  34. package/dist/index.cjs.js.map +1 -1
  35. package/dist/index.es.js +3026 -3050
  36. package/dist/index.es.js.map +1 -1
  37. package/dist/logo.png +0 -0
  38. package/dist/utils/__tests__/get-initial-color-mode.test.d.ts +1 -0
  39. package/dist/utils/get-initial-color-mode.d.ts +1 -0
  40. package/dist/utils/types.d.ts +13 -0
  41. package/package.json +13 -13
package/README.md CHANGED
@@ -4,9 +4,12 @@ Welcome to **Chop Logic Components**, a comprehensive React components library p
4
4
 
5
5
  ## About the Library
6
6
 
7
- Chop Logic is designed to speed up development by providing reusable, accessible, and highly customizable components. Whether you're building complex forms, creating dynamic layouts, or managing component logic with hooks, Chop Logic has the tools to make it easier.
7
+ Chop Logic is designed to speed up development by providing reusable, accessible, and highly customizable components. Whether you're building complex forms, creating dynamic layouts, or managing component logic with hooks, Chop Logic Components has the tools to make it easier.
8
8
 
9
- All components are well documented using Storybook. Visit the [DEMO page](https://savourygin.github.io/chop-logic-components) and try them out.
9
+ ## Links
10
+
11
+ - [Storybook Playground](https://savourygin.github.io/chop-logic-components)
12
+ - [Npm](https://www.npmjs.com/package/chop-logic-components)
10
13
 
11
14
  ## Getting Started
12
15
 
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const StyledForm: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, {
3
2
  $columns: number;
4
3
  }>> & string;
@@ -1,4 +1,5 @@
1
1
  import { PropsWithChildren } from 'react';
2
+ import { CommonComponentProps } from '../../../../../../../../../src/utils/types';
2
3
 
3
4
  export type ChopLogicFormData = {
4
5
  [key: string]: unknown;
@@ -15,9 +16,11 @@ export type ChopLogicFormContextProps = {
15
16
  initialValues?: ChopLogicFormData;
16
17
  resetSignal?: number;
17
18
  };
18
- export type ChopLogicFormProps = PropsWithChildren & React.HTMLAttributes<HTMLFormElement> & {
19
+ export type ChopLogicFormProps = PropsWithChildren & CommonComponentProps & {
19
20
  columns?: number;
20
21
  initialValues?: ChopLogicFormData;
21
22
  hasReset?: boolean;
22
23
  onClickSubmit?: (data: ChopLogicFormData) => void;
24
+ onReset?: React.FormEventHandler<HTMLFormElement>;
25
+ onSubmit?: React.FormEventHandler<HTMLFormElement>;
23
26
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const StyledGrid: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, never>> & string;
3
2
  export declare const StyledGridHeader: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, never>> & string;
4
3
  export declare const StyledGridBody: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, never>> & string;
@@ -1,13 +1,10 @@
1
- /// <reference types="react" />
2
- export type ChopLogicGridProps = {
1
+ import { CommonComponentProps } from '../../../../../../../../../src/utils/types';
2
+
3
+ export type ChopLogicGridProps = CommonComponentProps & {
3
4
  columns: ChopLogicGridColumn[];
4
5
  data: ChopLogicGridItem[];
5
6
  caption?: string;
6
- id?: string;
7
7
  selectable?: boolean;
8
- tabIndex?: number;
9
- className?: string;
10
- style?: React.CSSProperties;
11
8
  renderDataItem?: RenderDataItemCallback;
12
9
  onSelect?: (ids: string[]) => void;
13
10
  };
@@ -1,5 +1,6 @@
1
- /// <reference types="react" />
2
- export type ChopLogicTabsProps = React.HTMLAttributes<HTMLDivElement> & {
1
+ import { CommonComponentProps } from '../../../../../../../../../src/utils/types';
2
+
3
+ export type ChopLogicTabsProps = CommonComponentProps & {
3
4
  tabs: ChopLogicTabItem[];
4
5
  defaultTabId?: string;
5
6
  mode?: ChopLogicTabsMode;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const StyledErrorMessage: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
3
2
  $visible: boolean;
4
3
  }>> & string;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const StyledInputInnerButton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const StyledLabel: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>> & string;
3
2
  export declare const StyledLabelText: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
4
3
  export declare const StyledRequiredSign: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
@@ -1,12 +1,13 @@
1
1
  import { MouseEventHandler } from 'react';
2
+ import { CommonInputProps } from '../../../../../../../../../src/utils/types';
2
3
  import { ChopLogicIconName } from '../../../../../../../../../src/components/misc/icon/Icon';
3
4
 
4
5
  export type ChopLogicButtonView = 'primary' | 'secondary' | 'danger' | 'icon';
5
- export type ChopLogicButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
6
+ export type ChopLogicButtonProps = Partial<CommonInputProps> & {
6
7
  onClick?: MouseEventHandler<HTMLButtonElement> | (() => void);
7
8
  view?: ChopLogicButtonView;
8
- label?: string;
9
9
  icon?: ChopLogicIconName;
10
10
  text?: string;
11
11
  extended?: boolean;
12
+ type?: 'button' | 'reset' | 'submit';
12
13
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const StyledCheckboxWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
3
2
  $disabled: boolean;
4
3
  }>> & string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare function useChopLogicCheckboxController({ name, defaultChecked, onChange, }: {
3
2
  name: string;
4
3
  defaultChecked?: boolean;
@@ -1,7 +1,8 @@
1
- /// <reference types="react" />
2
- export type ChopLogicCheckboxProps = React.InputHTMLAttributes<HTMLInputElement> & {
3
- name: string;
4
- label: string;
1
+ import { CommonInputProps } from '../../../../../../../../../src/utils/types';
2
+
3
+ export type ChopLogicCheckboxProps = CommonInputProps & {
5
4
  noLabel?: boolean;
6
5
  iconPosition?: 'left' | 'right';
6
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
7
+ defaultChecked?: boolean;
7
8
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const StyledMultiSelectWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
3
2
  $disabled: boolean;
4
3
  }>> & string;
@@ -1,13 +1,13 @@
1
+ import { CommonInputProps } from '../../../../../../../../../src/utils/types';
1
2
  import { SelectValue } from '../select/types';
2
3
 
3
4
  export type MultiSelectValue = SelectValue & {
4
5
  selected: boolean;
5
6
  };
6
- export type ChopLogicMultiSelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {
7
- name: string;
8
- label: string;
7
+ export type ChopLogicMultiSelectProps = CommonInputProps & {
9
8
  options: SelectValue[];
10
9
  onChange?: (values?: SelectValue[]) => void;
10
+ defaultValue?: string | number | readonly string[];
11
11
  placeholder?: string;
12
12
  };
13
13
  export type MultiSelectDropdownProps = {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const StyledNumericInputContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
2
  export declare const StyledNumericInputWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
4
3
  $disabled: boolean;
@@ -1,11 +1,17 @@
1
- /// <reference types="react" />
1
+ import { CommonInputProps } from '../../../../../../../../../src/utils/types';
2
+
2
3
  export type NumericValidationFunction = (input?: number) => boolean;
3
- export type ChopLogicNumericInputProps = React.InputHTMLAttributes<HTMLInputElement> & {
4
- name: string;
5
- label: string;
4
+ export type ChopLogicNumericInputProps = CommonInputProps & {
6
5
  errorMessage?: string;
7
6
  validator?: NumericValidationFunction;
8
- onClear?: () => void;
9
7
  hasSpinButtons?: boolean;
8
+ min?: number;
9
+ max?: number;
10
+ step?: number;
11
+ readOnly?: boolean;
12
+ defaultValue?: number;
10
13
  onSpinButtonClick?: (value?: number) => void;
14
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
15
+ onBlur?: React.FocusEventHandler<HTMLInputElement>;
16
+ onFocus?: React.FocusEventHandler<HTMLInputElement>;
11
17
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const StyledSelectWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
3
2
  $disabled: boolean;
4
3
  }>> & string;
@@ -1,10 +1,10 @@
1
- /// <reference types="react" />
2
- export type ChopLogicSelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {
3
- name: string;
4
- label: string;
1
+ import { CommonInputProps } from '../../../../../../../../../src/utils/types';
2
+
3
+ export type ChopLogicSelectProps = CommonInputProps & {
5
4
  options: SelectValue[];
6
5
  onChange?: (value?: SelectValue) => void;
7
6
  placeholder?: string;
7
+ defaultValue?: string | number | readonly string[];
8
8
  };
9
9
  export type SelectValue = {
10
10
  id: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const StyledTextInputContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
2
  export declare const StyledTextInputWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
4
3
  $disabled: boolean;
@@ -1,15 +1,24 @@
1
- /// <reference types="react" />
1
+ import { CommonInputProps } from '../../../../../../../../../src/utils/types';
2
+
2
3
  export type RegExpWithFlags = {
3
4
  regexp: string;
4
5
  flags?: string;
5
6
  };
6
7
  export type TextValidationFunction = (input: string) => boolean;
7
- export type ChopLogicTextInputProps = React.InputHTMLAttributes<HTMLInputElement> & {
8
+ export type ChopLogicTextInputProps = CommonInputProps & {
8
9
  name: string;
9
10
  label: string;
10
11
  errorMessage?: string;
11
12
  clearable?: boolean;
13
+ readOnly?: boolean;
12
14
  onClear?: () => void;
13
15
  type?: 'text' | 'email' | 'password';
14
16
  validator?: RegExpWithFlags | TextValidationFunction;
17
+ maxLength?: number;
18
+ placeholder?: string;
19
+ defaultValue?: string;
20
+ autoComplete?: React.HTMLInputAutoCompleteAttribute;
21
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
22
+ onBlur?: React.FocusEventHandler<HTMLInputElement>;
23
+ onFocus?: React.FocusEventHandler<HTMLInputElement>;
15
24
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const StyledAlertHeader: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
3
2
  export declare const StyledAlertWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
4
3
  $isClosing: boolean;
@@ -1,11 +1,11 @@
1
+ import { CommonComponentProps } from '../../../../../../../../../src/utils/types';
1
2
  import { ChopLogicIconName } from '../../../../../../../../../src/components/misc/icon/Icon';
2
3
 
3
4
  export type ChopLogicAlertMode = 'success' | 'error' | 'warning' | 'info' | 'help';
4
- export type ChopLogicAlertProps = React.HTMLAttributes<HTMLDivElement> & {
5
+ export type ChopLogicAlertProps = CommonComponentProps & {
5
6
  isOpened: boolean;
6
7
  onClose: () => void;
7
8
  message: string;
8
- title?: string;
9
9
  mode?: ChopLogicAlertMode;
10
10
  icon?: ChopLogicIconName;
11
11
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const StyledDialogLayout: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
2
  export declare const StyledDialogBackground: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
4
3
  $isClosing: boolean;
@@ -1,6 +1,7 @@
1
1
  import { PropsWithChildren } from 'react';
2
+ import { CommonComponentProps } from '../../../../../../../../../src/utils/types';
2
3
 
3
- export type ChopLogicDialogProps = PropsWithChildren & React.HTMLAttributes<HTMLDivElement> & {
4
+ export type ChopLogicDialogProps = CommonComponentProps & PropsWithChildren & {
4
5
  isOpened: boolean;
5
6
  onClose: () => void;
6
7
  title: string;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const StyledTooltip: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const useChopLogicTooltipController: ({ id }: {
3
2
  id?: string;
4
3
  }) => {
@@ -1,6 +1,7 @@
1
1
  import { PropsWithChildren } from 'react';
2
+ import { CommonComponentProps } from '../../../../../../../../../src/utils/types';
2
3
 
3
- export type ChopLogicTooltipProps = PropsWithChildren & React.HTMLAttributes<HTMLElement> & {
4
+ export type ChopLogicTooltipProps = PropsWithChildren & CommonComponentProps & {
4
5
  tooltipContent: string | React.ReactElement;
5
6
  containerTag?: TooltipContainerTag;
6
7
  visibleOn?: 'hover' | 'click' | 'focus' | 'contextmenu';
@@ -27,8 +27,8 @@ 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
- light: "1px solid #5998c5";
31
- heavy: "1px solid #266dd3";
30
+ thin: "1px solid #5998c5";
31
+ thick: "1px solid #266dd3";
32
32
  accent: "1px solid #e53d00";
33
33
  outline: "2px dashed #e53d00";
34
34
  }>;
Binary file
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type ModalFocusTrapParams = {
3
2
  modalRef: React.RefObject<HTMLDivElement>;
4
3
  isOpened: boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type useTooltipPositionParams = {
3
2
  wrapperRef: React.RefObject<HTMLSpanElement | HTMLDivElement>;
4
3
  tooltipRef: React.RefObject<HTMLSpanElement | HTMLDivElement>;