chop-logic-components 0.4.0 → 0.6.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.
- package/dist/components/{button → controls/button}/Button.d.ts +3 -2
- package/dist/components/{button → controls/button}/__docs__/Button.stories.d.ts +1 -1
- package/dist/components/elements/portal/Portal.d.ts +6 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/components/inputs/checkbox/__docs__/Checkbox.stories.d.ts +1 -1
- package/dist/components/inputs/multi-select/__docs__/MultiSelect.stories.d.ts +1 -1
- package/dist/components/inputs/select/__docs__/Select.stories.d.ts +1 -1
- package/dist/components/inputs/text/__docs__/TextInput.stories.d.ts +1 -1
- package/dist/components/modals/dialog/Dialog.d.ts +9 -0
- package/dist/components/modals/dialog/__docs__/Dialog.stories.d.ts +7 -0
- package/dist/components/modals/dialog/__docs__/DialogExample.d.ts +5 -0
- package/dist/components/modals/dialog/elements/Header.d.ts +8 -0
- package/dist/components/modals/dialog/elements/Layout.d.ts +9 -0
- package/dist/components/modals/tooltip/Tooltip.d.ts +10 -0
- package/dist/components/modals/tooltip/__docs__/Tooltip.stories.d.ts +10 -0
- package/dist/components/modals/tooltip/__docs__/TooltipExample.d.ts +5 -0
- package/dist/components/modals/tooltip/__tests__/Tooltip.test.d.ts +1 -0
- package/dist/hooks/__tests__/use-click-outside.test.d.ts +1 -0
- package/dist/hooks/__tests__/use-key-press.test.d.ts +1 -0
- package/dist/hooks/__tests__/use-modal-focus.test.d.ts +1 -0
- package/dist/hooks/__tests__/use-mount.test.d.ts +1 -0
- package/dist/hooks/__tests__/use-window-dimensions.test.d.ts +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/{utils → hooks}/use-click-outside.d.ts +2 -5
- package/dist/hooks/use-container-dimensions.d.ts +8 -0
- package/dist/hooks/use-key-press.d.ts +9 -0
- package/dist/hooks/use-modal-focus-trap.d.ts +6 -0
- package/dist/hooks/use-mount.d.ts +1 -0
- package/dist/hooks/use-tooltip-position.d.ts +11 -0
- package/dist/hooks/use-window-dimensions.d.ts +5 -0
- package/dist/index.cjs.js +183 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +20331 -626
- package/dist/index.es.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/utils/__tests__/move-focus-on-element-by-id.test.d.ts +1 -0
- package/package.json +11 -10
- /package/dist/components/{button/__docs__/Example.d.ts → controls/button/__docs__/ButtonExample.d.ts} +0 -0
- /package/dist/components/{button → controls/button}/__tests__/Button.test.d.ts +0 -0
- /package/dist/components/{misc → elements}/error-message/ErrorMessage.d.ts +0 -0
- /package/dist/components/{misc → elements}/label/Label.d.ts +0 -0
- /package/dist/components/inputs/checkbox/__docs__/{Example.d.ts → CheckboxExample.d.ts} +0 -0
- /package/dist/components/inputs/multi-select/__docs__/{Example.d.ts → MultiSelectExample.d.ts} +0 -0
- /package/dist/components/inputs/select/__docs__/{Example.d.ts → SelectExample.d.ts} +0 -0
- /package/dist/components/inputs/text/__docs__/{Example.d.ts → TextInputExample.d.ts} +0 -0
- /package/dist/{utils/__tests__/use-click-outside.test.d.ts → components/modals/dialog/__tests__/Dialog.test.d.ts} +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { Icon } from '
|
|
1
|
+
import { Icon } from '../../../../../../../../../src/enums/icon';
|
|
2
2
|
import { default as React, MouseEventHandler } from 'react';
|
|
3
3
|
|
|
4
4
|
export type ChopLogicButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
5
5
|
text?: string;
|
|
6
6
|
onClick?: MouseEventHandler<HTMLButtonElement> | (() => void);
|
|
7
|
-
view?: 'primary' | 'secondary' | 'danger';
|
|
7
|
+
view?: 'primary' | 'secondary' | 'danger' | 'icon';
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
icon?: Icon;
|
|
10
|
+
label?: string;
|
|
10
11
|
};
|
|
11
12
|
declare const Button: React.FC<ChopLogicButtonProps>;
|
|
12
13
|
export default Button;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { default as ChopLogicButton } from './button/Button';
|
|
1
|
+
export { default as ChopLogicButton } from './controls/button/Button';
|
|
2
2
|
export { default as ChopLogicTextInput } from './inputs/text/TextInput';
|
|
3
3
|
export { default as ChopLogicSelect } from './inputs/select/Select';
|
|
4
4
|
export { default as ChopLogicCheckbox } from './inputs/checkbox/Checkbox';
|
|
5
|
+
export { default as ChopLogicDialog } from './modals/dialog/Dialog';
|
|
6
|
+
export { default as ChopLogicTooltip } from './modals/tooltip/Tooltip';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
|
|
3
|
+
export type ChopLogicModalProps = PropsWithChildren & React.HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
isOpened: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
8
|
+
declare const ChopLogicDialog: React.FC<ChopLogicModalProps>;
|
|
9
|
+
export default ChopLogicDialog;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React, PropsWithChildren } from 'react';
|
|
2
|
+
|
|
3
|
+
type ModalLayoutProps = PropsWithChildren & React.HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
title: string;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
isOpened: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const ChopLogicModalLayout: React.FC<ModalLayoutProps>;
|
|
9
|
+
export default ChopLogicModalLayout;
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
};
|
|
9
|
+
declare const ChopLogicTooltip: React.FC<ChopLogicTooltipProps>;
|
|
10
|
+
export default ChopLogicTooltip;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as TooltipExample } from './TooltipExample';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
declare const meta: Meta<typeof TooltipExample>;
|
|
5
|
+
export default meta;
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { useMount } from './use-mount';
|
|
2
|
+
export { useClickOutside } from './use-click-outside';
|
|
3
|
+
export { useModalFocusTrap } from './use-modal-focus-trap';
|
|
4
|
+
export { useKeyPress } from './use-key-press';
|
|
5
|
+
export { useContainerDimensions } from './use-container-dimensions';
|
|
6
|
+
export { useWindowDimensions } from './use-window-dimensions';
|
|
7
|
+
export { useTooltipPosition } from './use-tooltip-position';
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Hook that handles clicks outside of the passed ref
|
|
5
|
-
*/
|
|
6
3
|
type UseClickOutsideParams = {
|
|
7
|
-
ref: React.
|
|
4
|
+
ref: React.RefObject<HTMLDivElement>;
|
|
8
5
|
onClickOutsideHandler: () => void;
|
|
9
|
-
dependentRef?: React.
|
|
6
|
+
dependentRef?: React.RefObject<HTMLDivElement>;
|
|
10
7
|
};
|
|
11
8
|
export declare const useClickOutside: ({ ref, onClickOutsideHandler, dependentRef }: UseClickOutsideParams) => void;
|
|
12
9
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Dimensions } from './use-window-dimensions';
|
|
2
|
+
|
|
3
|
+
type useContainerDimensionsParams = {
|
|
4
|
+
ref: React.RefObject<HTMLDivElement | HTMLSpanElement>;
|
|
5
|
+
isVisible?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const useContainerDimensions: ({ ref, isVisible }: useContainerDimensionsParams) => Dimensions;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
type useKeyPressParams = {
|
|
4
|
+
keyCode: string;
|
|
5
|
+
ref: React.RefObject<HTMLDivElement>;
|
|
6
|
+
onKeyPress: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const useKeyPress: ({ ref, keyCode, onKeyPress }: useKeyPressParams) => void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useMount: (isOpened: boolean, delay?: number) => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type useTooltipPositionParams = {
|
|
2
|
+
wrapperRef: React.RefObject<HTMLSpanElement | HTMLDivElement>;
|
|
3
|
+
tooltipRef: React.RefObject<HTMLSpanElement | HTMLDivElement>;
|
|
4
|
+
isOpened: boolean;
|
|
5
|
+
spacing?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const useTooltipPosition: ({ wrapperRef, tooltipRef, isOpened, spacing }: useTooltipPositionParams) => {
|
|
8
|
+
top: number;
|
|
9
|
+
left: number;
|
|
10
|
+
};
|
|
11
|
+
export {};
|