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.
Files changed (41) hide show
  1. package/dist/components/{button → controls/button}/Button.d.ts +1 -1
  2. package/dist/components/{button → controls/button}/__docs__/Button.stories.d.ts +1 -1
  3. package/dist/components/index.d.ts +3 -1
  4. package/dist/components/inputs/checkbox/__docs__/Checkbox.stories.d.ts +1 -1
  5. package/dist/components/inputs/multi-select/__docs__/MultiSelect.stories.d.ts +1 -1
  6. package/dist/components/inputs/select/__docs__/Select.stories.d.ts +1 -1
  7. package/dist/components/inputs/text/__docs__/TextInput.stories.d.ts +1 -1
  8. package/dist/components/{modal/Modal.d.ts → modals/dialog/Dialog.d.ts} +2 -2
  9. package/dist/components/{modal/__docs__/Modal.stories.d.ts → modals/dialog/__docs__/Dialog.stories.d.ts} +1 -1
  10. package/dist/components/{modal/__docs__/Example.d.ts → modals/dialog/__docs__/DialogExample.d.ts} +1 -1
  11. package/dist/components/{modal → modals/dialog}/elements/Header.d.ts +1 -1
  12. package/dist/components/{modal → modals/dialog}/elements/Layout.d.ts +1 -1
  13. package/dist/components/modals/tooltip/Tooltip.d.ts +10 -0
  14. package/dist/components/modals/tooltip/__docs__/Tooltip.stories.d.ts +10 -0
  15. package/dist/components/modals/tooltip/__docs__/TooltipExample.d.ts +5 -0
  16. package/dist/components/modals/tooltip/__tests__/Tooltip.test.d.ts +1 -0
  17. package/dist/hooks/__tests__/use-window-dimensions.test.d.ts +1 -0
  18. package/dist/hooks/index.d.ts +3 -0
  19. package/dist/hooks/use-click-outside.d.ts +0 -8
  20. package/dist/hooks/use-container-dimensions.d.ts +8 -0
  21. package/dist/hooks/use-key-press.d.ts +0 -9
  22. package/dist/hooks/use-modal-focus-trap.d.ts +0 -8
  23. package/dist/hooks/use-mount.d.ts +0 -7
  24. package/dist/hooks/use-tooltip-position.d.ts +11 -0
  25. package/dist/hooks/use-window-dimensions.d.ts +5 -0
  26. package/dist/index.cjs.js +183 -10
  27. package/dist/index.cjs.js.map +1 -1
  28. package/dist/index.es.js +20328 -657
  29. package/dist/index.es.js.map +1 -1
  30. package/dist/style.css +1 -1
  31. package/package.json +1 -1
  32. /package/dist/components/{button/__docs__/Example.d.ts → controls/button/__docs__/ButtonExample.d.ts} +0 -0
  33. /package/dist/components/{button → controls/button}/__tests__/Button.test.d.ts +0 -0
  34. /package/dist/components/{misc → elements}/error-message/ErrorMessage.d.ts +0 -0
  35. /package/dist/components/{misc → elements}/label/Label.d.ts +0 -0
  36. /package/dist/components/{misc → elements}/portal/Portal.d.ts +0 -0
  37. /package/dist/components/inputs/checkbox/__docs__/{Example.d.ts → CheckboxExample.d.ts} +0 -0
  38. /package/dist/components/inputs/multi-select/__docs__/{Example.d.ts → MultiSelectExample.d.ts} +0 -0
  39. /package/dist/components/inputs/select/__docs__/{Example.d.ts → SelectExample.d.ts} +0 -0
  40. /package/dist/components/inputs/text/__docs__/{Example.d.ts → TextInputExample.d.ts} +0 -0
  41. /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 '../../../../../../../../src/enums/icon';
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,4 @@
1
- import { default as ExampleButton } from './Example';
1
+ import { default as ExampleButton } from './ButtonExample';
2
2
  import { Meta, StoryObj } from '@storybook/react';
3
3
 
4
4
  declare const meta: Meta<typeof ExampleButton>;
@@ -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';
@@ -1,4 +1,4 @@
1
- import { default as Example } from './Example';
1
+ import { default as Example } from './CheckboxExample';
2
2
  import { Meta, StoryObj } from '@storybook/react';
3
3
 
4
4
  declare const meta: Meta<typeof Example>;
@@ -1,4 +1,4 @@
1
- import { default as Example } from './Example';
1
+ import { default as Example } from './MultiSelectExample';
2
2
  import { Meta, StoryObj } from '@storybook/react';
3
3
 
4
4
  declare const meta: Meta<typeof Example>;
@@ -1,4 +1,4 @@
1
- import { default as Example } from './Example';
1
+ import { default as Example } from './SelectExample';
2
2
  import { Meta, StoryObj } from '@storybook/react';
3
3
 
4
4
  declare const meta: Meta<typeof Example>;
@@ -1,4 +1,4 @@
1
- import { default as Example } from './Example';
1
+ import { default as Example } from './TextInputExample';
2
2
  import { Meta, StoryObj } from '@storybook/react';
3
3
 
4
4
  declare const meta: Meta<typeof Example>;
@@ -5,5 +5,5 @@ export type ChopLogicModalProps = PropsWithChildren & React.HTMLAttributes<HTMLD
5
5
  onClose: () => void;
6
6
  title: string;
7
7
  };
8
- declare const ChopLogicModal: React.FC<ChopLogicModalProps>;
9
- export default ChopLogicModal;
8
+ declare const ChopLogicDialog: React.FC<ChopLogicModalProps>;
9
+ export default ChopLogicDialog;
@@ -1,4 +1,4 @@
1
- import { default as Example } from './Example';
1
+ import { default as Example } from './DialogExample';
2
2
  import { Meta, StoryObj } from '@storybook/react';
3
3
 
4
4
  declare const meta: Meta<typeof Example>;
@@ -1,4 +1,4 @@
1
- import { ChopLogicModalProps } from '../Modal';
1
+ import { ChopLogicModalProps } from '../Dialog';
2
2
  import { default as React } from 'react';
3
3
 
4
4
  declare const Example: React.FC<ChopLogicModalProps>;
@@ -4,5 +4,5 @@ type ChopLogicModalLayoutHeaderProps = {
4
4
  title: string;
5
5
  onClose: () => void;
6
6
  };
7
- declare const ChopLogicModalLayoutHeader: ({ title, onClose }: ChopLogicModalLayoutHeaderProps) => React.ReactElement;
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: ({ title, onClose, isOpened, children, ...rest }: ModalLayoutProps) => React.ReactElement;
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,5 @@
1
+ import { ChopLogicTooltipProps } from '../Tooltip';
2
+ import { default as React } from 'react';
3
+
4
+ declare const TooltipExample: React.FC<ChopLogicTooltipProps>;
5
+ export default TooltipExample;
@@ -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 {};
@@ -0,0 +1,5 @@
1
+ export type Dimensions = {
2
+ width: number;
3
+ height: number;
4
+ };
5
+ export declare function useWindowDimensions(): Dimensions;