@trackunit/react-components 0.1.337 → 0.1.339

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/index.cjs.js CHANGED
@@ -19,7 +19,6 @@ var reactUse = require('react-use');
19
19
  var reactRouter = require('@tanstack/react-router');
20
20
  var react = require('@floating-ui/react');
21
21
  var omit = require('lodash/omit');
22
- var usePortal = require('react-useportal');
23
22
  var reactHelmetAsync = require('react-helmet-async');
24
23
  var tailwindMerge = require('tailwind-merge');
25
24
  var reactTabs = require('@radix-ui/react-tabs');
@@ -53,7 +52,6 @@ var IconSpriteOutline__default = /*#__PURE__*/_interopDefaultLegacy(IconSpriteOu
53
52
  var IconSpriteSolid__default = /*#__PURE__*/_interopDefaultLegacy(IconSpriteSolid);
54
53
  var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
55
54
  var omit__default = /*#__PURE__*/_interopDefaultLegacy(omit);
56
- var usePortal__default = /*#__PURE__*/_interopDefaultLegacy(usePortal);
57
55
 
58
56
  const docs = {
59
57
  source: {
@@ -3789,103 +3787,6 @@ const MoreMenu = ({ className, dataTestId, popoverProps, iconProps = {
3789
3787
  return (jsxRuntime.jsx("div", { className: cvaMoreMenu({ className }), "data-testid": dataTestId, ref: actionMenuRef, children: jsxRuntime.jsxs(Popover, Object.assign({}, popoverProps, { children: [jsxRuntime.jsx(PopoverTrigger, { children: customButton !== null && customButton !== void 0 ? customButton : jsxRuntime.jsx(IconButton, Object.assign({}, iconButtonProps, { icon: jsxRuntime.jsx(Icon, Object.assign({ name: "EllipsisHorizontal" }, iconProps)) })) }), jsxRuntime.jsx(PopoverContent, { portalId: customPortalId, children: close => (typeof children === "function" ? children(close) : children) })] })) }));
3790
3788
  };
3791
3789
 
3792
- const cvaModalContainer = cssClassVarianceUtilities.cvaMerge(["h-full", "w-full", "flex", "items-center"]);
3793
- const cvaModalCard = cssClassVarianceUtilities.cvaMerge([
3794
- "m-auto",
3795
- "shadow-2xl",
3796
- "w-[calc(100%-1rem)]",
3797
- "max-h-[min(100%-1rem,30%+600px)]",
3798
- "max-w-[min(100%-1rem,30%+600px)]",
3799
- ]);
3800
- const cvaModalBackdrop = cssClassVarianceUtilities.cvaMerge([
3801
- "flex",
3802
- "justify-center",
3803
- "items-center",
3804
- "fixed",
3805
- "top-0",
3806
- "left-0",
3807
- "w-full",
3808
- "h-full",
3809
- "z-20",
3810
- "invisible",
3811
- "opacity-0",
3812
- "transition-all",
3813
- ], {
3814
- variants: {
3815
- show: {
3816
- true: "animate-modal-fade",
3817
- false: "",
3818
- },
3819
- noShadow: {
3820
- true: "",
3821
- false: "bg-black/50",
3822
- },
3823
- },
3824
- });
3825
-
3826
- /**
3827
- * The Backdrop for the modal.
3828
-
3829
- * @param {ModalBackdropProps} props - The props for the ModalBackdrop component
3830
- * @returns {JSX.Element} ModalBackdrop component
3831
- */
3832
- const ModalBackdrop = ({ children, isVisible, onClick, noShadow }) => {
3833
- const ref = React__namespace.useRef(null);
3834
- return (jsxRuntime.jsx("div", { className: cvaModalBackdrop({ show: isVisible, noShadow }), onMouseDown: e => {
3835
- // only react on click on backdrop - accessing first child to get around styled element element
3836
- if (ref.current !== null && e.target === ref.current.children[0]) {
3837
- onClick();
3838
- }
3839
- }, ref: ref, children: children }));
3840
- };
3841
-
3842
- /**
3843
- * - Modals are used to present critical information or request user input needed to complete a user's workflow.
3844
- * - Modals interrupt a user's workflow by design.
3845
- * - The modal component provides a foundation for creating dialogs, lightboxes, etc.
3846
-
3847
- */
3848
- const Modal = React__namespace.forwardRef(({ isOpen, children, dataTestId, className, role = "", noBackdropShadow = false, onDismissClick = () => {
3849
- return;
3850
- }, }, ref) => {
3851
- return (jsxRuntime.jsx(ModalBackdrop, { isVisible: isOpen, noShadow: noBackdropShadow, onClick: onDismissClick, children: isOpen ? (jsxRuntime.jsx("div", { className: cvaModalContainer(), ref: ref, role: role, children: jsxRuntime.jsx(Card, { className: cvaModalCard({ className }), dataTestId: dataTestId, children: children }) })) : null }));
3852
- });
3853
- Modal.displayName = "Modal";
3854
-
3855
- /**
3856
- * The useModal component should be used to inform the user of important information.
3857
-
3858
- * @param {UseModalProps} props - The props for the useModal hook
3859
- * @returns {*} useModal return
3860
- */
3861
- const useModal = ({ closeOnOutsideClick } = {}) => {
3862
- const modalRef = React.useRef(null);
3863
- const { isOpen, togglePortal, openPortal, closePortal, Portal } = usePortal__default["default"]({
3864
- closeOnOutsideClick,
3865
- onPortalClick: ({ target }) => {
3866
- var _a;
3867
- if (!closeOnOutsideClick) {
3868
- return;
3869
- }
3870
- // eslint-disable-next-line local-rules/no-typescript-assertion
3871
- const clickingOutsideModal = !((_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.contains(target));
3872
- if (clickingOutsideModal) {
3873
- closePortal();
3874
- }
3875
- },
3876
- });
3877
- const PortalWrapper = (props) => (jsxRuntime.jsx(Portal, { children: jsxRuntime.jsx(Modal, Object.assign({ isOpen: isOpen, ref: modalRef }, props)) }));
3878
- PortalWrapper.displayName = "Modal";
3879
- const WrappedModal = React.useCallback(PortalWrapper, [Portal, isOpen]);
3880
- return {
3881
- Modal: WrappedModal,
3882
- toggleModal: togglePortal,
3883
- openModal: openPortal,
3884
- closeModal: closePortal,
3885
- isOpen,
3886
- };
3887
- };
3888
-
3889
3790
  const cvaNotice = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"]);
3890
3791
  const cvaNoticeLabel = cssClassVarianceUtilities.cvaMerge(["pl-1", "pr-1", "font-medium", "text-sm"], {
3891
3792
  variants: {
@@ -4700,8 +4601,6 @@ exports.Indicator = Indicator;
4700
4601
  exports.KPICard = KPICard;
4701
4602
  exports.MenuItem = MenuItem;
4702
4603
  exports.MenuList = MenuList;
4703
- exports.Modal = Modal;
4704
- exports.ModalBackdrop = ModalBackdrop;
4705
4604
  exports.MoreMenu = MoreMenu;
4706
4605
  exports.Notice = Notice;
4707
4606
  exports.PackageNameStoryComponent = PackageNameStoryComponent;
@@ -4766,7 +4665,6 @@ exports.useIsFullscreen = useIsFullscreen;
4766
4665
  exports.useIsTextCutOff = useIsTextCutOff;
4767
4666
  exports.useLocalStorage = useLocalStorage;
4768
4667
  exports.useLocalStorageReducer = useLocalStorageReducer;
4769
- exports.useModal = useModal;
4770
4668
  exports.useOptionallyElevatedState = useOptionallyElevatedState;
4771
4669
  exports.useOverflowItems = useOverflowItems;
4772
4670
  exports.usePopoverContext = usePopoverContext;
package/index.esm.js CHANGED
@@ -16,7 +16,6 @@ import { usePrevious, useMeasure, useCopyToClipboard } from 'react-use';
16
16
  import { Link, useBlocker } from '@tanstack/react-router';
17
17
  import { useFloating, FloatingFocusManager, autoUpdate, offset, flip, shift, size, useClick, useDismiss, useHover as useHover$1, useRole, useInteractions, useMergeRefs, FloatingPortal, arrow, useTransitionStatus, FloatingArrow } from '@floating-ui/react';
18
18
  import omit from 'lodash/omit';
19
- import usePortal from 'react-useportal';
20
19
  import { HelmetProvider, Helmet } from 'react-helmet-async';
21
20
  import { twMerge } from 'tailwind-merge';
22
21
  import { Trigger, Content, List, Root } from '@radix-ui/react-tabs';
@@ -3757,103 +3756,6 @@ const MoreMenu = ({ className, dataTestId, popoverProps, iconProps = {
3757
3756
  return (jsx("div", { className: cvaMoreMenu({ className }), "data-testid": dataTestId, ref: actionMenuRef, children: jsxs(Popover, Object.assign({}, popoverProps, { children: [jsx(PopoverTrigger, { children: customButton !== null && customButton !== void 0 ? customButton : jsx(IconButton, Object.assign({}, iconButtonProps, { icon: jsx(Icon, Object.assign({ name: "EllipsisHorizontal" }, iconProps)) })) }), jsx(PopoverContent, { portalId: customPortalId, children: close => (typeof children === "function" ? children(close) : children) })] })) }));
3758
3757
  };
3759
3758
 
3760
- const cvaModalContainer = cvaMerge(["h-full", "w-full", "flex", "items-center"]);
3761
- const cvaModalCard = cvaMerge([
3762
- "m-auto",
3763
- "shadow-2xl",
3764
- "w-[calc(100%-1rem)]",
3765
- "max-h-[min(100%-1rem,30%+600px)]",
3766
- "max-w-[min(100%-1rem,30%+600px)]",
3767
- ]);
3768
- const cvaModalBackdrop = cvaMerge([
3769
- "flex",
3770
- "justify-center",
3771
- "items-center",
3772
- "fixed",
3773
- "top-0",
3774
- "left-0",
3775
- "w-full",
3776
- "h-full",
3777
- "z-20",
3778
- "invisible",
3779
- "opacity-0",
3780
- "transition-all",
3781
- ], {
3782
- variants: {
3783
- show: {
3784
- true: "animate-modal-fade",
3785
- false: "",
3786
- },
3787
- noShadow: {
3788
- true: "",
3789
- false: "bg-black/50",
3790
- },
3791
- },
3792
- });
3793
-
3794
- /**
3795
- * The Backdrop for the modal.
3796
-
3797
- * @param {ModalBackdropProps} props - The props for the ModalBackdrop component
3798
- * @returns {JSX.Element} ModalBackdrop component
3799
- */
3800
- const ModalBackdrop = ({ children, isVisible, onClick, noShadow }) => {
3801
- const ref = React.useRef(null);
3802
- return (jsx("div", { className: cvaModalBackdrop({ show: isVisible, noShadow }), onMouseDown: e => {
3803
- // only react on click on backdrop - accessing first child to get around styled element element
3804
- if (ref.current !== null && e.target === ref.current.children[0]) {
3805
- onClick();
3806
- }
3807
- }, ref: ref, children: children }));
3808
- };
3809
-
3810
- /**
3811
- * - Modals are used to present critical information or request user input needed to complete a user's workflow.
3812
- * - Modals interrupt a user's workflow by design.
3813
- * - The modal component provides a foundation for creating dialogs, lightboxes, etc.
3814
-
3815
- */
3816
- const Modal = React.forwardRef(({ isOpen, children, dataTestId, className, role = "", noBackdropShadow = false, onDismissClick = () => {
3817
- return;
3818
- }, }, ref) => {
3819
- return (jsx(ModalBackdrop, { isVisible: isOpen, noShadow: noBackdropShadow, onClick: onDismissClick, children: isOpen ? (jsx("div", { className: cvaModalContainer(), ref: ref, role: role, children: jsx(Card, { className: cvaModalCard({ className }), dataTestId: dataTestId, children: children }) })) : null }));
3820
- });
3821
- Modal.displayName = "Modal";
3822
-
3823
- /**
3824
- * The useModal component should be used to inform the user of important information.
3825
-
3826
- * @param {UseModalProps} props - The props for the useModal hook
3827
- * @returns {*} useModal return
3828
- */
3829
- const useModal = ({ closeOnOutsideClick } = {}) => {
3830
- const modalRef = useRef(null);
3831
- const { isOpen, togglePortal, openPortal, closePortal, Portal } = usePortal({
3832
- closeOnOutsideClick,
3833
- onPortalClick: ({ target }) => {
3834
- var _a;
3835
- if (!closeOnOutsideClick) {
3836
- return;
3837
- }
3838
- // eslint-disable-next-line local-rules/no-typescript-assertion
3839
- const clickingOutsideModal = !((_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.contains(target));
3840
- if (clickingOutsideModal) {
3841
- closePortal();
3842
- }
3843
- },
3844
- });
3845
- const PortalWrapper = (props) => (jsx(Portal, { children: jsx(Modal, Object.assign({ isOpen: isOpen, ref: modalRef }, props)) }));
3846
- PortalWrapper.displayName = "Modal";
3847
- const WrappedModal = useCallback(PortalWrapper, [Portal, isOpen]);
3848
- return {
3849
- Modal: WrappedModal,
3850
- toggleModal: togglePortal,
3851
- openModal: openPortal,
3852
- closeModal: closePortal,
3853
- isOpen,
3854
- };
3855
- };
3856
-
3857
3759
  const cvaNotice = cvaMerge(["flex", "items-center"]);
3858
3760
  const cvaNoticeLabel = cvaMerge(["pl-1", "pr-1", "font-medium", "text-sm"], {
3859
3761
  variants: {
@@ -4644,4 +4546,4 @@ const cvaClickable = cvaMerge([
4644
4546
  },
4645
4547
  });
4646
4548
 
4647
- export { Alert, Badge, Breadcrumb, BreadcrumbContainer, BreadcrumbItem, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CompletionStatusIndicator, CopyableText, Drawer, EmptyState, EmptyValue, ExternalLink, Heading, Icon, IconButton, Indicator, KPICard, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, Notice, PackageNameStoryComponent, Page, PageContent, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tab, TabContent, TabList, Tabs, Tag, Text, Timeline, TimelineElement, Tooltip, ValueBar, VirtualizedList, WidgetBody, cvaButton, cvaButtonPrefixSuffix, cvaButtonSpinner, cvaButtonSpinnerContainer, cvaClickable, cvaIconButton, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside, useContainerProps, useContinuousTimeout, useDebounce, useDevicePixelRatio, useGeometry, useHover, useIsFirstRender, useIsFullscreen, useIsTextCutOff, useLocalStorage, useLocalStorageReducer, useModal, useOptionallyElevatedState, useOverflowItems, usePopoverContext, usePrompt, useResize, useSelfUpdatingRef, useTimeout, useVisibilityChange };
4549
+ export { Alert, Badge, Breadcrumb, BreadcrumbContainer, BreadcrumbItem, Button, Card, CardBody, CardFooter, CardHeader, Collapse, CompletionStatusIndicator, CopyableText, Drawer, EmptyState, EmptyValue, ExternalLink, Heading, Icon, IconButton, Indicator, KPICard, MenuItem, MenuList, MoreMenu, Notice, PackageNameStoryComponent, Page, PageContent, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tab, TabContent, TabList, Tabs, Tag, Text, Timeline, TimelineElement, Tooltip, ValueBar, VirtualizedList, WidgetBody, cvaButton, cvaButtonPrefixSuffix, cvaButtonSpinner, cvaButtonSpinnerContainer, cvaClickable, cvaIconButton, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside, useContainerProps, useContinuousTimeout, useDebounce, useDevicePixelRatio, useGeometry, useHover, useIsFirstRender, useIsFullscreen, useIsTextCutOff, useLocalStorage, useLocalStorageReducer, useOptionallyElevatedState, useOverflowItems, usePopoverContext, usePrompt, useResize, useSelfUpdatingRef, useTimeout, useVisibilityChange };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.1.337",
3
+ "version": "0.1.339",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -16,7 +16,6 @@
16
16
  "@radix-ui/react-tabs": "^1.0.4",
17
17
  "@trackunit/ui-icons": "*",
18
18
  "@trackunit/shared-utils": "*",
19
- "react-useportal": "1.0.18",
20
19
  "react-helmet-async": "^1.3.0",
21
20
  "zod": "3.22.4",
22
21
  "lodash": "4.17.21",
@@ -14,7 +14,6 @@ export * from "./Icon/Icon";
14
14
  export * from "./Indicator";
15
15
  export * from "./KPICard/KPICard";
16
16
  export * from "./Menu";
17
- export * from "./Modal";
18
17
  export * from "./Notice";
19
18
  export * from "./Page";
20
19
  export * from "./PageHeader";
@@ -1,35 +0,0 @@
1
- import * as React from "react";
2
- import { CommonProps } from "../../common/CommonProps";
3
- export interface ModalProps extends CommonProps {
4
- /**
5
- * Whether modal is open or not.
6
- */
7
- isOpen?: boolean;
8
- /**
9
- * Whether modal should be closed when clicked outside of it.
10
- */
11
- onDismissClick?: () => void;
12
- /**
13
- * Child elements to be rendered inside the modal.
14
- */
15
- children: React.ReactNode;
16
- /**
17
- * Test id to be applied to the modal.
18
- */
19
- dataTestId?: string;
20
- /**
21
- * Aria role to be applied to element
22
- */
23
- role?: string;
24
- /**
25
- * Whether modal has backdrop shadow or not
26
- */
27
- noBackdropShadow?: boolean;
28
- }
29
- /**
30
- * - Modals are used to present critical information or request user input needed to complete a user's workflow.
31
- * - Modals interrupt a user's workflow by design.
32
- * - The modal component provides a foundation for creating dialogs, lightboxes, etc.
33
-
34
- */
35
- export declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,6 +0,0 @@
1
- export declare const cvaModalContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
2
- export declare const cvaModalCard: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
3
- export declare const cvaModalBackdrop: (props?: ({
4
- show?: boolean | null | undefined;
5
- noShadow?: boolean | null | undefined;
6
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -1,14 +0,0 @@
1
- import * as React from "react";
2
- export interface ModalBackdropProps {
3
- onClick: () => void;
4
- children: React.ReactNode;
5
- isVisible?: boolean;
6
- noShadow?: boolean;
7
- }
8
- /**
9
- * The Backdrop for the modal.
10
-
11
- * @param {ModalBackdropProps} props - The props for the ModalBackdrop component
12
- * @returns {JSX.Element} ModalBackdrop component
13
- */
14
- export declare const ModalBackdrop: ({ children, isVisible, onClick, noShadow }: ModalBackdropProps) => JSX.Element;
@@ -1,3 +0,0 @@
1
- export * from "./Modal";
2
- export * from "./ModalBackdrop";
3
- export * from "./useModal";
@@ -1,21 +0,0 @@
1
- /// <reference types="react" />
2
- import { ModalProps } from "./Modal";
3
- export interface UseModalProps {
4
- closeOnOutsideClick?: boolean;
5
- }
6
- /**
7
- * The useModal component should be used to inform the user of important information.
8
-
9
- * @param {UseModalProps} props - The props for the useModal hook
10
- * @returns {*} useModal return
11
- */
12
- export declare const useModal: ({ closeOnOutsideClick }?: UseModalProps) => {
13
- Modal: {
14
- (props: ModalProps): JSX.Element;
15
- displayName: string;
16
- };
17
- toggleModal: any;
18
- openModal: any;
19
- closeModal: any;
20
- isOpen: any;
21
- };