chop-logic-components 0.6.1 → 0.7.0

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 (47) hide show
  1. package/dist/__mocks__/select-values.d.ts +2 -2
  2. package/dist/components/controls/button/Button.d.ts +4 -12
  3. package/dist/components/controls/button/__docs__/Button.stories.d.ts +5 -1
  4. package/dist/components/controls/button/__docs__/ButtonExample.d.ts +1 -1
  5. package/dist/components/controls/button/types.d.ts +12 -0
  6. package/dist/components/inputs/checkbox/Checkbox.d.ts +3 -8
  7. package/dist/components/inputs/checkbox/__docs__/CheckboxExample.d.ts +1 -1
  8. package/dist/components/inputs/checkbox/types.d.ts +6 -0
  9. package/dist/components/inputs/multi-select/MultiSelect.d.ts +1 -13
  10. package/dist/components/inputs/multi-select/__docs__/MultiSelectExample.d.ts +1 -1
  11. package/dist/components/inputs/multi-select/elements/Combobox.d.ts +1 -1
  12. package/dist/components/inputs/multi-select/elements/Dropdown.d.ts +2 -9
  13. package/dist/components/inputs/multi-select/elements/Option.d.ts +1 -1
  14. package/dist/components/inputs/multi-select/types.d.ts +20 -0
  15. package/dist/components/inputs/select/Select.d.ts +1 -12
  16. package/dist/components/inputs/select/__docs__/SelectExample.d.ts +1 -1
  17. package/dist/components/inputs/select/elements/Combobox.d.ts +1 -1
  18. package/dist/components/inputs/select/elements/Dropdown.d.ts +1 -1
  19. package/dist/components/inputs/select/elements/Option.d.ts +1 -1
  20. package/dist/components/inputs/select/types.d.ts +12 -0
  21. package/dist/components/inputs/text/TextInput.d.ts +1 -7
  22. package/dist/components/inputs/text/__docs__/TextInputExample.d.ts +1 -1
  23. package/dist/components/inputs/text/types.d.ts +7 -0
  24. package/dist/components/modals/alert/Alert.d.ts +4 -0
  25. package/dist/components/modals/alert/__docs__/Alert.stories.d.ts +9 -0
  26. package/dist/components/modals/alert/__docs__/AlertExample.d.ts +2 -0
  27. package/dist/components/modals/alert/__tests__/Alert.test.d.ts +1 -0
  28. package/dist/components/modals/alert/elements/Header.d.ts +10 -0
  29. package/dist/components/modals/alert/helpers/get-alert-icon.d.ts +4 -0
  30. package/dist/components/modals/alert/helpers/get-alert-title.d.ts +3 -0
  31. package/dist/components/modals/alert/types.d.ts +8 -0
  32. package/dist/components/modals/dialog/Dialog.d.ts +1 -6
  33. package/dist/components/modals/dialog/__docs__/DialogExample.d.ts +1 -1
  34. package/dist/components/modals/dialog/types.d.ts +7 -0
  35. package/dist/components/modals/tooltip/Tooltip.d.ts +1 -7
  36. package/dist/components/modals/tooltip/__docs__/Tooltip.stories.d.ts +4 -4
  37. package/dist/components/modals/tooltip/__docs__/TooltipExample.d.ts +1 -1
  38. package/dist/components/modals/tooltip/types.d.ts +8 -0
  39. package/dist/enums/icon.d.ts +50 -45
  40. package/dist/index.cjs.js +44 -44
  41. package/dist/index.cjs.js.map +1 -1
  42. package/dist/index.es.js +4893 -4945
  43. package/dist/index.es.js.map +1 -1
  44. package/dist/style.css +1 -1
  45. package/package.json +11 -11
  46. /package/dist/components/elements/__tests__/{error-message.test.d.ts → ErrorMessage.test.d.ts} +0 -0
  47. /package/dist/components/elements/__tests__/{label.test.d.ts → Label.test.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
- import { SelectValue } from '../../../../../../../src/components/inputs/select/Select';
2
- import { MultiSelectValue } from '../../../../../../../src/components/inputs/multi-select/MultiSelect';
1
+ import { SelectValue } from '../../../../../../../src/components/inputs/select/types';
2
+ import { MultiSelectValue } from '../../../../../../../src/components/inputs/multi-select/types';
3
3
 
4
4
  export declare const SELECT_LANGUAGES: SelectValue[];
5
5
  export declare const MULTI_SELECT_VALUES: MultiSelectValue[];
@@ -1,13 +1,5 @@
1
- import { Icon } from '../../../../../../../../../src/enums/icon';
2
- import { default as React, MouseEventHandler } from 'react';
1
+ import { ChopLogicButtonProps } from './types';
2
+ import { default as React } from 'react';
3
3
 
4
- export type ChopLogicButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
5
- text?: string;
6
- onClick?: MouseEventHandler<HTMLButtonElement> | (() => void);
7
- view?: 'primary' | 'secondary' | 'danger' | 'icon';
8
- disabled?: boolean;
9
- icon?: Icon;
10
- label?: string;
11
- };
12
- declare const Button: React.FC<ChopLogicButtonProps>;
13
- export default Button;
4
+ declare const ChopLogicButton: React.FC<ChopLogicButtonProps>;
5
+ export default ChopLogicButton;
@@ -4,4 +4,8 @@ import { Meta, StoryObj } from '@storybook/react';
4
4
  declare const meta: Meta<typeof ButtonExample>;
5
5
  export default meta;
6
6
  type Story = StoryObj<typeof ButtonExample>;
7
- export declare const Primary: Story;
7
+ export declare const PrimaryButton: Story;
8
+ export declare const SecondaryButton: Story;
9
+ export declare const DangerButton: Story;
10
+ export declare const IconButton: Story;
11
+ export declare const DisabledButton: Story;
@@ -1,4 +1,4 @@
1
- import { ChopLogicButtonProps } from '../Button';
1
+ import { ChopLogicButtonProps } from '../types';
2
2
  import { default as React } from 'react';
3
3
 
4
4
  declare const ExampleButton: React.FC<ChopLogicButtonProps>;
@@ -0,0 +1,12 @@
1
+ import { MouseEventHandler } from 'react';
2
+ import { Icon } from '../../../../../../../../../src/enums/icon';
3
+
4
+ export type ChopLogicButtonView = 'primary' | 'secondary' | 'danger' | 'icon';
5
+ export type ChopLogicButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
6
+ text?: string;
7
+ onClick?: MouseEventHandler<HTMLButtonElement> | (() => void);
8
+ view?: ChopLogicButtonView;
9
+ disabled?: boolean;
10
+ icon?: Icon;
11
+ label?: string;
12
+ };
@@ -1,10 +1,5 @@
1
+ import { ChopLogicCheckboxProps } from './types';
1
2
  import { default as React } from 'react';
2
3
 
3
- export type ChopLogicCheckboxProps = React.InputHTMLAttributes<HTMLInputElement> & {
4
- id: string;
5
- name: string;
6
- label: string;
7
- isLabelHidden?: boolean;
8
- };
9
- declare const Checkbox: React.FC<ChopLogicCheckboxProps>;
10
- export default Checkbox;
4
+ declare const ChopLogicCheckbox: React.FC<ChopLogicCheckboxProps>;
5
+ export default ChopLogicCheckbox;
@@ -1,4 +1,4 @@
1
- import { ChopLogicCheckboxProps } from '../Checkbox';
1
+ import { ChopLogicCheckboxProps } from '../types';
2
2
  import { default as React } from 'react';
3
3
 
4
4
  declare const Example: React.FC<ChopLogicCheckboxProps>;
@@ -0,0 +1,6 @@
1
+ export type ChopLogicCheckboxProps = React.InputHTMLAttributes<HTMLInputElement> & {
2
+ id: string;
3
+ name: string;
4
+ label: string;
5
+ isLabelHidden?: boolean;
6
+ };
@@ -1,16 +1,4 @@
1
+ import { ChopLogicMultiSelectProps } from './types';
1
2
 
2
- export type ChopLogicMultiSelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {
3
- id: string;
4
- name: string;
5
- label: string;
6
- values: MultiSelectValue[];
7
- onSelectChange?: (values?: MultiSelectValue[]) => void;
8
- placeholder?: string;
9
- };
10
- export type MultiSelectValue = {
11
- id: string;
12
- label: string;
13
- selected: boolean;
14
- };
15
3
  declare const ChopLogicMultiSelect: React.FC<ChopLogicMultiSelectProps>;
16
4
  export default ChopLogicMultiSelect;
@@ -1,4 +1,4 @@
1
- import { ChopLogicMultiSelectProps } from '../MultiSelect';
1
+ import { ChopLogicMultiSelectProps } from '../types';
2
2
  import { default as React } from 'react';
3
3
 
4
4
  declare const Example: React.FC<ChopLogicMultiSelectProps>;
@@ -1,4 +1,4 @@
1
- import { MultiSelectValue } from '../MultiSelect';
1
+ import { MultiSelectValue } from '../types';
2
2
 
3
3
  type SelectComboboxProps = {
4
4
  isOpened: boolean;
@@ -1,11 +1,4 @@
1
- import { MultiSelectValue } from '../MultiSelect';
1
+ import { MultiSelectDropdownProps } from '../types';
2
2
 
3
- type SelectDropdownProps = {
4
- values: MultiSelectValue[];
5
- isOpened: boolean;
6
- dropdownId: string;
7
- onClose: () => void;
8
- onSelect: (id: string) => void;
9
- };
10
- declare const SelectDropdown: React.FC<SelectDropdownProps>;
3
+ declare const SelectDropdown: React.FC<MultiSelectDropdownProps>;
11
4
  export default SelectDropdown;
@@ -1,4 +1,4 @@
1
- import { MultiSelectValue } from '../MultiSelect';
1
+ import { MultiSelectValue } from '../types';
2
2
 
3
3
  type SelectOptionProps = {
4
4
  value: MultiSelectValue;
@@ -0,0 +1,20 @@
1
+ export type MultiSelectValue = {
2
+ id: string;
3
+ label: string;
4
+ selected: boolean;
5
+ };
6
+ export type ChopLogicMultiSelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {
7
+ id: string;
8
+ name: string;
9
+ label: string;
10
+ values: MultiSelectValue[];
11
+ onSelectChange?: (values?: MultiSelectValue[]) => void;
12
+ placeholder?: string;
13
+ };
14
+ export type MultiSelectDropdownProps = {
15
+ values: MultiSelectValue[];
16
+ isOpened: boolean;
17
+ dropdownId: string;
18
+ onClose: () => void;
19
+ onSelect: (id: string) => void;
20
+ };
@@ -1,15 +1,4 @@
1
+ import { ChopLogicSelectProps } from './types';
1
2
 
2
- export type ChopLogicSelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {
3
- id: string;
4
- name: string;
5
- label: string;
6
- values: SelectValue[];
7
- onSelectChange?: (value?: SelectValue) => void;
8
- placeholder?: string;
9
- };
10
- export type SelectValue = {
11
- id: string;
12
- label: string;
13
- };
14
3
  declare const ChopLogicSelect: React.FC<ChopLogicSelectProps>;
15
4
  export default ChopLogicSelect;
@@ -1,4 +1,4 @@
1
- import { ChopLogicSelectProps } from '../Select';
1
+ import { ChopLogicSelectProps } from '../types';
2
2
  import { default as React } from 'react';
3
3
 
4
4
  declare const Example: React.FC<ChopLogicSelectProps>;
@@ -1,4 +1,4 @@
1
- import { SelectValue } from '../Select';
1
+ import { SelectValue } from '../types';
2
2
 
3
3
  type SelectComboboxProps = {
4
4
  isOpened: boolean;
@@ -1,4 +1,4 @@
1
- import { SelectValue } from '../Select';
1
+ import { SelectValue } from '../types';
2
2
 
3
3
  type SelectDropdownProps = {
4
4
  values: SelectValue[];
@@ -1,4 +1,4 @@
1
- import { SelectValue } from '../Select';
1
+ import { SelectValue } from '../types';
2
2
 
3
3
  type SelectOptionProps = {
4
4
  value: SelectValue;
@@ -0,0 +1,12 @@
1
+ export type ChopLogicSelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {
2
+ id: string;
3
+ name: string;
4
+ label: string;
5
+ values: SelectValue[];
6
+ onSelectChange?: (value?: SelectValue) => void;
7
+ placeholder?: string;
8
+ };
9
+ export type SelectValue = {
10
+ id: string;
11
+ label: string;
12
+ };
@@ -1,11 +1,5 @@
1
+ import { ChopLogicTextInputProps } from './types';
1
2
  import { default as React } from 'react';
2
3
 
3
- export type ChopLogicTextInputProps = React.InputHTMLAttributes<HTMLInputElement> & {
4
- id: string;
5
- name: string;
6
- label: string;
7
- valid?: boolean;
8
- errorMessage?: string;
9
- };
10
4
  declare const TextInput: React.FC<ChopLogicTextInputProps>;
11
5
  export default TextInput;
@@ -1,4 +1,4 @@
1
- import { ChopLogicTextInputProps } from '../TextInput';
1
+ import { ChopLogicTextInputProps } from '../types';
2
2
  import { default as React } from 'react';
3
3
 
4
4
  declare const Example: React.FC<ChopLogicTextInputProps>;
@@ -0,0 +1,7 @@
1
+ export type ChopLogicTextInputProps = React.InputHTMLAttributes<HTMLInputElement> & {
2
+ id: string;
3
+ name: string;
4
+ label: string;
5
+ valid?: boolean;
6
+ errorMessage?: string;
7
+ };
@@ -0,0 +1,4 @@
1
+ import { ChopLogicAlertProps } from './types';
2
+
3
+ declare const ChopLogicAlert: React.FC<ChopLogicAlertProps>;
4
+ export default ChopLogicAlert;
@@ -0,0 +1,9 @@
1
+ import { ChopLogicAlertProps } from '../types';
2
+ import { Meta, StoryObj } from '@storybook/react';
3
+ import { default as React } from 'react';
4
+
5
+ declare const ExampleComponent: React.FC<ChopLogicAlertProps>;
6
+ declare const meta: Meta<typeof ExampleComponent>;
7
+ export default meta;
8
+ type Story = StoryObj<typeof ExampleComponent>;
9
+ export declare const Default: Story;
@@ -0,0 +1,2 @@
1
+ declare const Example: () => import("react/jsx-runtime").JSX.Element;
2
+ export default Example;
@@ -0,0 +1,10 @@
1
+ import { ChopLogicAlertMode } from '../types';
2
+ import { default as React } from 'react';
3
+
4
+ type ChopLogicAlertHeaderProps = {
5
+ onClose: () => void;
6
+ title?: string;
7
+ mode: ChopLogicAlertMode;
8
+ };
9
+ declare const ChopLogicAlertHeader: React.FC<ChopLogicAlertHeaderProps>;
10
+ export default ChopLogicAlertHeader;
@@ -0,0 +1,4 @@
1
+ import { ChopLogicAlertMode } from '../types';
2
+ import { Icon } from '../../../../../../../../../../src/enums/icon';
3
+
4
+ export declare function getAlertIcon(mode: ChopLogicAlertMode): Icon;
@@ -0,0 +1,3 @@
1
+ import { ChopLogicAlertMode } from '../types';
2
+
3
+ export declare function getAlertTitle(mode: ChopLogicAlertMode, title?: string): string;
@@ -0,0 +1,8 @@
1
+ export type ChopLogicAlertMode = 'success' | 'error' | 'warning' | 'info' | 'help';
2
+ export type ChopLogicAlertProps = React.HTMLAttributes<HTMLDivElement> & {
3
+ isOpened: boolean;
4
+ onClose: () => void;
5
+ message: string;
6
+ title?: string;
7
+ mode?: ChopLogicAlertMode;
8
+ };
@@ -1,9 +1,4 @@
1
- import { PropsWithChildren } from 'react';
1
+ import { ChopLogicModalProps } from './types';
2
2
 
3
- export type ChopLogicModalProps = PropsWithChildren & React.HTMLAttributes<HTMLDivElement> & {
4
- isOpened: boolean;
5
- onClose: () => void;
6
- title: string;
7
- };
8
3
  declare const ChopLogicDialog: React.FC<ChopLogicModalProps>;
9
4
  export default ChopLogicDialog;
@@ -1,4 +1,4 @@
1
- import { ChopLogicModalProps } from '../Dialog';
1
+ import { ChopLogicModalProps } from '../types';
2
2
  import { default as React } from 'react';
3
3
 
4
4
  declare const Example: React.FC<ChopLogicModalProps>;
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ export type ChopLogicModalProps = PropsWithChildren & React.HTMLAttributes<HTMLDivElement> & {
4
+ isOpened: boolean;
5
+ onClose: () => void;
6
+ title: string;
7
+ };
@@ -1,10 +1,4 @@
1
- import { PropsWithChildren } from 'react';
1
+ import { ChopLogicTooltipProps } from './types';
2
2
 
3
- export type ChopLogicTooltipProps = PropsWithChildren & React.HTMLAttributes<HTMLElement> & {
4
- tooltipContent: string | React.ReactElement;
5
- id: string;
6
- containerTag?: 'span' | 'div' | 'p' | 'strong' | 'em';
7
- visibleOn?: 'hover' | 'click' | 'focus' | 'contextmenu';
8
- };
9
3
  declare const ChopLogicTooltip: React.FC<ChopLogicTooltipProps>;
10
4
  export default ChopLogicTooltip;
@@ -4,7 +4,7 @@ import { Meta, StoryObj } from '@storybook/react';
4
4
  declare const meta: Meta<typeof TooltipExample>;
5
5
  export default meta;
6
6
  type Story = StoryObj<typeof TooltipExample>;
7
- export declare const Default: Story;
8
- export declare const ClickToShow: Story;
9
- export declare const FocusToShow: Story;
10
- export declare const ContextMenuToShow: Story;
7
+ export declare const VisibleOnHover: Story;
8
+ export declare const VisibleOnClick: Story;
9
+ export declare const VisibleOnFocus: Story;
10
+ export declare const VisibleOnContextMenu: Story;
@@ -1,4 +1,4 @@
1
- import { ChopLogicTooltipProps } from '../Tooltip';
1
+ import { ChopLogicTooltipProps } from '../types';
2
2
  import { default as React } from 'react';
3
3
 
4
4
  declare const TooltipExample: React.FC<ChopLogicTooltipProps>;
@@ -0,0 +1,8 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ export type ChopLogicTooltipProps = PropsWithChildren & React.HTMLAttributes<HTMLElement> & {
4
+ tooltipContent: string | React.ReactElement;
5
+ id: string;
6
+ containerTag?: 'span' | 'div' | 'p' | 'strong' | 'em';
7
+ visibleOn?: 'hover' | 'click' | 'focus' | 'contextmenu';
8
+ };
@@ -1,47 +1,52 @@
1
1
  export declare enum Icon {
2
- CheckMark = "chop-icon__check",
3
- Home = "chop-icon__home",
4
- Menu = "chop-icon__menu",
5
- Enlarge = "chop-icon__enlarge2",
6
- Shrink = "chop-icon__shrink2",
7
- Settings = "chop-icon__cog",
8
- Delete = "chop-icon__bin2",
9
- Up = "chop-icon__circle-up",
10
- Down = "chop-icon__circle-down",
11
- Right = "chop-icon__circle-right",
12
- Left = "chop-icon__circle-left",
13
- Sound = "chop-icon__volume-medium",
14
- NoSound = "chop-icon__volume-mute2",
15
- LightMode = "chop-icon__sun",
16
- DarkMode = "chop-icon__contrast",
17
- Cancel = "chop-icon__close",
18
- Sidebar = "chop-icon__magic-wand",
19
- Telegram = "chop-icon__telegram",
20
- Github = "chop-icon__github",
21
- Mail = "chop-icon__mail4",
22
- Propositions = "chop-icon__cube",
23
- Resolution = "chop-icon__libreoffice",
24
- Predicates = "chop-icon__cubes",
25
- TruthTables = "chop-icon__delicious",
26
- Syllogisms = "chop-icon__dice",
27
- English = "chop-icon__english-lang",
28
- Russian = "chop-icon__russian-lang",
29
- Required = "chop-icon__fire",
30
- Checked = "chop-icon__checkbox-checked",
31
- Unchecked = "chop-icon__checkbox-unchecked",
32
- Info = "chop-icon__exclamation-triangle",
33
- LinkedIn = "chop-icon__linkedin-square",
34
- File = "chop-icon__file-empty",
35
- Files = "chop-icon__files-empty",
36
- Facebook = "chop-icon__facebook2",
37
- CaretUp = "chop-icon__caret-up",
38
- CaretDown = "chop-icon__caret-down",
39
- SavePDF = "chop-icon__file-pdf",
40
- ExportXML = "chop-icon__download",
41
- ImportXML = "chop-icon__upload",
42
- Copy = "chop-icon__copy",
43
- Paste = "chop-icon__paste",
44
- Cut = "chop-icon__scissors",
45
- Reset = "chop-icon__trash",
46
- Clear = "chop-icon__cross"
2
+ CheckMark = "cl-icon__check",
3
+ Home = "cl-icon__home",
4
+ Menu = "cl-icon__menu",
5
+ Enlarge = "cl-icon__enlarge2",
6
+ Shrink = "cl-icon__shrink2",
7
+ Settings = "cl-icon__cog",
8
+ Delete = "cl-icon__bin2",
9
+ Up = "cl-icon__circle-up",
10
+ Down = "cl-icon__circle-down",
11
+ Right = "cl-icon__circle-right",
12
+ Left = "cl-icon__circle-left",
13
+ Sound = "cl-icon__volume-medium",
14
+ NoSound = "cl-icon__volume-mute2",
15
+ LightMode = "cl-icon__sun",
16
+ DarkMode = "cl-icon__contrast",
17
+ Cancel = "cl-icon__close",
18
+ Sidebar = "cl-icon__magic-wand",
19
+ Telegram = "cl-icon__telegram",
20
+ Github = "cl-icon__github",
21
+ Mail = "cl-icon__mail4",
22
+ Propositions = "cl-icon__cube",
23
+ Resolution = "cl-icon__libreoffice",
24
+ Predicates = "cl-icon__cubes",
25
+ TruthTables = "cl-icon__delicious",
26
+ Syllogisms = "cl-icon__dice",
27
+ English = "cl-icon__english-lang",
28
+ Russian = "cl-icon__russian-lang",
29
+ Required = "cl-icon__fire",
30
+ Checked = "cl-icon__checkbox-checked",
31
+ Unchecked = "cl-icon__checkbox-unchecked",
32
+ Info = "cl-icon__exclamation-triangle",
33
+ LinkedIn = "cl-icon__linkedin-square",
34
+ File = "cl-icon__file-empty",
35
+ Files = "cl-icon__files-empty",
36
+ Facebook = "cl-icon__facebook2",
37
+ CaretUp = "cl-icon__caret-up",
38
+ CaretDown = "cl-icon__caret-down",
39
+ SavePDF = "cl-icon__file-pdf",
40
+ ExportXML = "cl-icon__download",
41
+ ImportXML = "cl-icon__upload",
42
+ Copy = "cl-icon__copy",
43
+ Paste = "cl-icon__paste",
44
+ Cut = "cl-icon__scissors",
45
+ Reset = "cl-icon__trash",
46
+ Clear = "cl-icon__cross",
47
+ Support = "cl-icon__support",
48
+ Bomb = "cl-icon__bomb",
49
+ Quill = "cl-icon__quill",
50
+ Warning = "cl-icon__warning",
51
+ Notification = "cl-icon__notification"
47
52
  }