chop-logic-components 0.5.1 → 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 +1 -1
- package/dist/components/{button → controls/button}/__docs__/Button.stories.d.ts +1 -1
- 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/{modal/Modal.d.ts → modals/dialog/Dialog.d.ts} +2 -2
- package/dist/components/{modal/__docs__/Modal.stories.d.ts → modals/dialog/__docs__/Dialog.stories.d.ts} +1 -1
- package/dist/components/{modal/__docs__/Example.d.ts → modals/dialog/__docs__/DialogExample.d.ts} +1 -1
- package/dist/components/{modal → modals/dialog}/elements/Header.d.ts +1 -1
- package/dist/components/{modal → modals/dialog}/elements/Layout.d.ts +1 -1
- 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-window-dimensions.test.d.ts +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/use-click-outside.d.ts +0 -8
- package/dist/hooks/use-container-dimensions.d.ts +8 -0
- package/dist/hooks/use-key-press.d.ts +0 -9
- package/dist/hooks/use-modal-focus-trap.d.ts +0 -8
- package/dist/hooks/use-mount.d.ts +0 -7
- 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.es.js +20328 -657
- package/dist/index.es.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- /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/{misc → elements}/portal/Portal.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/components/{modal/__tests__/Modal.test.d.ts → modals/dialog/__tests__/Dialog.test.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
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> & {
|
|
@@ -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';
|
|
@@ -5,5 +5,5 @@ export type ChopLogicModalProps = PropsWithChildren & React.HTMLAttributes<HTMLD
|
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
title: string;
|
|
7
7
|
};
|
|
8
|
-
declare const
|
|
9
|
-
export default
|
|
8
|
+
declare const ChopLogicDialog: React.FC<ChopLogicModalProps>;
|
|
9
|
+
export default ChopLogicDialog;
|
|
@@ -4,5 +4,5 @@ type ChopLogicModalLayoutHeaderProps = {
|
|
|
4
4
|
title: string;
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
};
|
|
7
|
-
declare const ChopLogicModalLayoutHeader:
|
|
7
|
+
declare const ChopLogicModalLayoutHeader: React.FC<ChopLogicModalLayoutHeaderProps>;
|
|
8
8
|
export default ChopLogicModalLayoutHeader;
|
|
@@ -5,5 +5,5 @@ type ModalLayoutProps = PropsWithChildren & React.HTMLAttributes<HTMLDivElement>
|
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
isOpened: boolean;
|
|
7
7
|
};
|
|
8
|
-
declare const ChopLogicModalLayout:
|
|
8
|
+
declare const ChopLogicModalLayout: React.FC<ModalLayoutProps>;
|
|
9
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 {};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -2,3 +2,6 @@ export { useMount } from './use-mount';
|
|
|
2
2
|
export { useClickOutside } from './use-click-outside';
|
|
3
3
|
export { useModalFocusTrap } from './use-modal-focus-trap';
|
|
4
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';
|
|
@@ -5,13 +5,5 @@ type UseClickOutsideParams = {
|
|
|
5
5
|
onClickOutsideHandler: () => void;
|
|
6
6
|
dependentRef?: React.RefObject<HTMLDivElement>;
|
|
7
7
|
};
|
|
8
|
-
/**
|
|
9
|
-
* Custom hook that triggers a callback when a click event occurs outside specified elements.
|
|
10
|
-
*
|
|
11
|
-
* @param {UseClickOutsideParams} ref - Reference to the main element to check if the click is outside
|
|
12
|
-
* @param {UseClickOutsideParams} onClickOutsideHandler - Callback function to execute when a click event occurs outside
|
|
13
|
-
* @param {UseClickOutsideParams} dependentRef - Reference to a dependent element to check if the click is outside
|
|
14
|
-
* @return {void} Function does not return anything
|
|
15
|
-
*/
|
|
16
8
|
export declare const useClickOutside: ({ ref, onClickOutsideHandler, dependentRef }: UseClickOutsideParams) => void;
|
|
17
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 {};
|
|
@@ -5,14 +5,5 @@ type useKeyPressParams = {
|
|
|
5
5
|
ref: React.RefObject<HTMLDivElement>;
|
|
6
6
|
onKeyPress: () => void;
|
|
7
7
|
};
|
|
8
|
-
/**
|
|
9
|
-
* Hook that listens for a specific key press event and triggers an action when the key is pressed.
|
|
10
|
-
*
|
|
11
|
-
* @param {Object} params - An object containing the following properties:
|
|
12
|
-
* - ref: A ref object that refers to the HTML element to attach the event listener to.
|
|
13
|
-
* - keyCode: The key code of the key to listen for.
|
|
14
|
-
* - onKeyPress: A function to be called when the key is pressed.
|
|
15
|
-
* @return {void} This hook does not return anything.
|
|
16
|
-
*/
|
|
17
8
|
export declare const useKeyPress: ({ ref, keyCode, onKeyPress }: useKeyPressParams) => void;
|
|
18
9
|
export {};
|
|
@@ -2,13 +2,5 @@ type ModalFocusTrapParams = {
|
|
|
2
2
|
modalRef: React.RefObject<HTMLDivElement>;
|
|
3
3
|
isOpened: boolean;
|
|
4
4
|
};
|
|
5
|
-
/**
|
|
6
|
-
* Traps the focus within a modal element when it is opened.
|
|
7
|
-
*
|
|
8
|
-
* @param {ModalFocusTrapParams} params - An object containing the modal reference and a boolean indicating whether the modal is opened.
|
|
9
|
-
* @param {React.RefObject<HTMLDivElement>} params.modalRef - A reference to the modal element.
|
|
10
|
-
* @param {boolean} params.isOpened - A boolean indicating whether the modal is opened.
|
|
11
|
-
* @return {void} This function does not return anything.
|
|
12
|
-
*/
|
|
13
5
|
export declare const useModalFocusTrap: ({ modalRef, isOpened }: ModalFocusTrapParams) => void;
|
|
14
6
|
export {};
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom hook that manages the mounting state based on the isOpened prop and a delay.
|
|
3
|
-
*
|
|
4
|
-
* @param {boolean} isOpened - Indicates if the component is opened.
|
|
5
|
-
* @param {number} [delay=300] - The delay in milliseconds before unmounting.
|
|
6
|
-
* @return {boolean} The current state of mounting.
|
|
7
|
-
*/
|
|
8
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 {};
|