@uniformdev/design-system 18.5.0 → 18.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/esm/index.js CHANGED
@@ -219,6 +219,20 @@ var useBreakpoint = createBreakpoint(breakpoints);
219
219
  var mq = (size) => `@media (min-width: ${breakpoints[size]}px)`;
220
220
  var supports = (cssProp) => `@supports (${cssProp})`;
221
221
 
222
+ // src/utils/useOutsideClick.tsx
223
+ import { useEffect } from "react";
224
+ var useOutsideClick = (containerRef, handler) => {
225
+ useEffect(() => {
226
+ const outsideClick = (event) => {
227
+ if ((containerRef == null ? void 0 : containerRef.current) && !containerRef.current.contains(event.target)) {
228
+ handler();
229
+ }
230
+ };
231
+ document.addEventListener("mousedown", outsideClick);
232
+ return () => document.removeEventListener("mousedown", outsideClick);
233
+ }, [containerRef, handler]);
234
+ };
235
+
222
236
  // src/components/Button/Button.styles.ts
223
237
  import { css } from "@emotion/react";
224
238
  var button = css`
@@ -605,7 +619,7 @@ var scrollbarStyles = css3`
605
619
  import { css as css6 } from "@emotion/react";
606
620
 
607
621
  // src/components/Shortcuts/ShortcutRevealer.tsx
608
- import React2, { useContext, useEffect, useState } from "react";
622
+ import React2, { useContext, useEffect as useEffect2, useState } from "react";
609
623
 
610
624
  // src/components/Shortcuts/ShortcutRevealer.styles.ts
611
625
  import { css as css4 } from "@emotion/react";
@@ -670,7 +684,7 @@ var Context = React2.createContext(false);
670
684
  var revealHotkey = ["ctrl+F1", "ctrl+shift+/"];
671
685
  function ShortcutContext({ children }) {
672
686
  const [reveal, setReveal] = useState(false);
673
- useEffect(() => {
687
+ useEffect2(() => {
674
688
  if (!loggedHotkeyConsole) {
675
689
  loggedHotkeyConsole = true;
676
690
  console.log(
@@ -847,7 +861,7 @@ var IconColorCurrent = css7`
847
861
 
848
862
  // src/components/Icons/IconsProvider.tsx
849
863
  import { paramCase } from "param-case";
850
- import { createContext, useContext as useContext2, useEffect as useEffect2, useState as useState2 } from "react";
864
+ import { createContext, useContext as useContext2, useEffect as useEffect3, useState as useState2 } from "react";
851
865
 
852
866
  // src/components/Icons/customIcons.tsx
853
867
  import { GenIcon } from "react-icons";
@@ -1185,7 +1199,7 @@ function IconsProvider({ children }) {
1185
1199
  setIconsMap({ ...iconMap, ...customIcons });
1186
1200
  setIsLoading(false);
1187
1201
  };
1188
- useEffect2(() => {
1202
+ useEffect3(() => {
1189
1203
  initializeIconsMap();
1190
1204
  }, []);
1191
1205
  return /* @__PURE__ */ jsx5(IconContext.Provider, { value: { iconsMap, isLoading }, children });
@@ -2764,7 +2778,7 @@ var Details = ({ summary: summary2, children, isOpenByDefault = false, ...props
2764
2778
  };
2765
2779
 
2766
2780
  // src/components/Drawer/Drawer.tsx
2767
- import React10, { useEffect as useEffect4, useMemo, useRef as useRef2 } from "react";
2781
+ import React10, { useEffect as useEffect5, useMemo, useRef as useRef2 } from "react";
2768
2782
  import { CgChevronRight } from "react-icons/cg";
2769
2783
 
2770
2784
  // src/components/Drawer/Drawer.styles.ts
@@ -2915,6 +2929,7 @@ var Drawer = React10.forwardRef(
2915
2929
  tabIndex: -1,
2916
2930
  "aria-labelledby": headerId,
2917
2931
  css: drawerStyles(bgColor),
2932
+ "data-test-id": "side-dialog",
2918
2933
  children: [
2919
2934
  /* @__PURE__ */ jsx30(
2920
2935
  Button,
@@ -2934,7 +2949,7 @@ var Drawer = React10.forwardRef(
2934
2949
  }
2935
2950
  );
2936
2951
  }, [children, header, id, stackId, bgColor, onRequestClose, ref]);
2937
- useEffect4(() => {
2952
+ useEffect5(() => {
2938
2953
  registerDrawer({
2939
2954
  drawer: {
2940
2955
  id,
@@ -2951,7 +2966,7 @@ var Drawer = React10.forwardRef(
2951
2966
  }
2952
2967
  });
2953
2968
  }, [component, instanceKey, registerDrawer]);
2954
- useEffect4(() => {
2969
+ useEffect5(() => {
2955
2970
  return () => unregisterDrawer({ id, stackId, instanceKey });
2956
2971
  }, [id, stackId, instanceKey, unregisterDrawer]);
2957
2972
  return null;
@@ -4427,7 +4442,7 @@ var EditTeamIntegrationTile = ({
4427
4442
 
4428
4443
  // src/components/Tiles/IntegrationComingSoon.tsx
4429
4444
  import { css as css46 } from "@emotion/react";
4430
- import { useEffect as useEffect6, useState as useState6 } from "react";
4445
+ import { useEffect as useEffect7, useState as useState6 } from "react";
4431
4446
  import { CgHeart } from "react-icons/cg";
4432
4447
  import { jsx as jsx57, jsxs as jsxs39 } from "@emotion/react/jsx-runtime";
4433
4448
  var IntegrationComingSoon = ({
@@ -4443,7 +4458,7 @@ var IntegrationComingSoon = ({
4443
4458
  setUpVote((prev) => !prev);
4444
4459
  onUpVoteClick();
4445
4460
  };
4446
- useEffect6(() => {
4461
+ useEffect7(() => {
4447
4462
  if (upVote) {
4448
4463
  const timer = setTimeout(() => setUpVote(false), timing);
4449
4464
  return () => {
@@ -4908,7 +4923,7 @@ var TableCellData = React15.forwardRef(
4908
4923
  );
4909
4924
 
4910
4925
  // src/components/Tabs/Tabs.tsx
4911
- import { createContext as createContext4, useContext as useContext5, useEffect as useEffect7 } from "react";
4926
+ import { createContext as createContext4, useContext as useContext5, useEffect as useEffect8 } from "react";
4912
4927
  import {
4913
4928
  Tab as ReakitTab,
4914
4929
  TabList as ReakitTabList,
@@ -4952,11 +4967,11 @@ var useCurrentTab = () => {
4952
4967
  };
4953
4968
  var Tabs = ({ children, onSelectedIdChange, ...props }) => {
4954
4969
  const tab = useTabState(props);
4955
- useEffect7(() => {
4970
+ useEffect8(() => {
4956
4971
  var _a;
4957
4972
  onSelectedIdChange == null ? void 0 : onSelectedIdChange((_a = tab.selectedId) != null ? _a : void 0);
4958
4973
  }, [tab.selectedId, onSelectedIdChange]);
4959
- useEffect7(() => {
4974
+ useEffect8(() => {
4960
4975
  tab.setSelectedId(props.selectedId);
4961
4976
  }, [props.selectedId]);
4962
4977
  return /* @__PURE__ */ jsx65(CurrentTabContext.Provider, { value: tab, children });
@@ -5164,5 +5179,6 @@ export {
5164
5179
  useDrawer,
5165
5180
  useIconContext,
5166
5181
  useMenuContext,
5182
+ useOutsideClick,
5167
5183
  useShortcut
5168
5184
  };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React$1 from 'react';
2
- import React__default, { ReactNode, HTMLAttributes } from 'react';
2
+ import React__default, { RefObject, ReactNode, HTMLAttributes } from 'react';
3
3
  import * as _emotion_react from '@emotion/react';
4
4
  import { SerializedStyles } from '@emotion/react';
5
5
  import * as _emotion_react_types_jsx_namespace from '@emotion/react/types/jsx-namespace';
@@ -52,6 +52,8 @@ declare const mq: (size: BreakpointSize) => string;
52
52
  */
53
53
  declare const supports: (cssProp: string) => string;
54
54
 
55
+ declare const useOutsideClick: (containerRef: RefObject<HTMLElement | null>, handler: () => void) => void;
56
+
55
57
  declare const button: _emotion_react.SerializedStyles;
56
58
  declare const buttonRippleEffect: (props: {
57
59
  hoverColor: string;
@@ -1337,4 +1339,4 @@ type StatusBulletProps = React$1.HTMLAttributes<HTMLSpanElement> & {
1337
1339
  };
1338
1340
  declare const StatusBullet: ({ status, hideText, message, ...props }: StatusBulletProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
1339
1341
 
1340
- export { ActionButtonsProps, AddButton, AddButtonProps, AddListButton, AddListButtonProps, AddListButtonThemeProps, ArrowPositionProps, Badge, BadgeProps, BoxHeightProps, BreakpointSize, BreakpointsMap, Button, ButtonProps, ButtonSizeProps, ButtonThemeProps$1 as ButtonThemeProps, ButtonWithMenu, ButtonWithMenuProps, Callout, CalloutProps, CalloutType, Caption, CaptionProps, Card, CardContainer, CardContainerBgColorProps, CardContainerProps, CardProps, CheckboxWithInfo, CheckboxWithInforProps, ChildFunction, ComboBoxGroupBase, Counter, CounterProps, CreateTeamIntegrationTile, CreateTeamIntegrationTileProps, DashedBox, DashedBoxProps, Details, DetailsProps, Drawer, DrawerContextValue, DrawerItem, DrawerProps, DrawerProvider, DrawerRenderer, DrawerRendererItemProps, DrawerRendererProps, EditTeamIntegrationTile, EditTeamIntegrationTileProps, ErrorMessage, ErrorMessageProps, Fieldset, FieldsetProps, Heading, HeadingProps, HexModalBackground, Icon, IconColor, IconName, IconProps, IconType, IconsProvider, InlineAlert, InlineAlertProps, Input, InputComboBox, InputComboBoxOption, InputComboBoxProps, InputInlineSelect, InputInlineSelectOption, InputInlineSelectProps, InputKeywordSearch, InputKeywordSearchProps, InputProps, InputSelect, InputSelectProps, InputToggle, InputToggleProps, IntegrationComingSoon, IntegrationComingSoonProps, IntegrationHeaderSection, IntegrationHeaderSectionProps, IntegrationLoadingTile, IntegrationLoadingTileProps, IntegrationModalHeader, IntegrationModalHeaderProps, IntegrationModalIcon, IntegrationModalIconProps, IntegrationTile, IntegrationTileProps, Label, LabelProps, Legend, LegendProps, LevelProps, LimitsBar, LimitsBarProps, Link, LinkColorProps, LinkList, LinkListProps, LinkManagerWithRefType, LinkProps, LinkWithRef, LoadingIcon, LoadingIconProps, LoadingIndicator, LoadingOverlay, LoadingOverlayProps, Menu, MenuContext, MenuItem, MenuItemProps, MenuItemSeparator, MenuItemTextThemeProps, MenuProps, PageHeaderSection, PageHeaderSectionProps, Paragraph, ParagraphProps, RegisterDrawerProps, ResolveIcon, ResolveIconProps, ScrollableItemProps, ScrollableList, ScrollableListInputItem, ScrollableListItem, ScrollableListItemProps, ScrollableListProps, ShortcutContext, ShortcutRevealer, StatusBullet, StatusBulletProps, StatusTypeProps, Switch, SwitchProps, TabButton, TabButtonGroup, TabButtonProps, TabContent, TabContentProps, Table, TableBody, TableBodyProps, TableCellData, TableCellDataProps, TableCellHead, TableCellHeadProps, TableFoot, TableFootProps, TableHead, TableHeadProps, TableProps, TableRow, TableRowProps, Tabs, TabsProps, TextAlignProps, Textarea, TextareaProps, Theme, ThemeProps, TileContainer, TileContainerProps, UniformBadge, UniformLogo, UniformLogoProps, UseShortcutOptions, WarningMessage, WarningMessageProps, breakpoints, button, buttonGhost, buttonPrimary, buttonRippleEffect, buttonSecondary, buttonSecondaryInvert, buttonTertiary, buttonUnimportant, fadeIn, fadeInBottom, fadeInLtr, fadeInRtl, fadeOutBottom, growSubtle, input, inputError, inputSelect, isMacLike, labelText, macifyShortcut, mq, ripple, scrollbarStyles, skeletonLoading, supports, useBreakpoint, useCurrentTab, useDrawer, useIconContext, useMenuContext, useShortcut };
1342
+ export { ActionButtonsProps, AddButton, AddButtonProps, AddListButton, AddListButtonProps, AddListButtonThemeProps, ArrowPositionProps, Badge, BadgeProps, BoxHeightProps, BreakpointSize, BreakpointsMap, Button, ButtonProps, ButtonSizeProps, ButtonThemeProps$1 as ButtonThemeProps, ButtonWithMenu, ButtonWithMenuProps, Callout, CalloutProps, CalloutType, Caption, CaptionProps, Card, CardContainer, CardContainerBgColorProps, CardContainerProps, CardProps, CheckboxWithInfo, CheckboxWithInforProps, ChildFunction, ComboBoxGroupBase, Counter, CounterProps, CreateTeamIntegrationTile, CreateTeamIntegrationTileProps, DashedBox, DashedBoxProps, Details, DetailsProps, Drawer, DrawerContextValue, DrawerItem, DrawerProps, DrawerProvider, DrawerRenderer, DrawerRendererItemProps, DrawerRendererProps, EditTeamIntegrationTile, EditTeamIntegrationTileProps, ErrorMessage, ErrorMessageProps, Fieldset, FieldsetProps, Heading, HeadingProps, HexModalBackground, Icon, IconColor, IconName, IconProps, IconType, IconsProvider, InlineAlert, InlineAlertProps, Input, InputComboBox, InputComboBoxOption, InputComboBoxProps, InputInlineSelect, InputInlineSelectOption, InputInlineSelectProps, InputKeywordSearch, InputKeywordSearchProps, InputProps, InputSelect, InputSelectProps, InputToggle, InputToggleProps, IntegrationComingSoon, IntegrationComingSoonProps, IntegrationHeaderSection, IntegrationHeaderSectionProps, IntegrationLoadingTile, IntegrationLoadingTileProps, IntegrationModalHeader, IntegrationModalHeaderProps, IntegrationModalIcon, IntegrationModalIconProps, IntegrationTile, IntegrationTileProps, Label, LabelProps, Legend, LegendProps, LevelProps, LimitsBar, LimitsBarProps, Link, LinkColorProps, LinkList, LinkListProps, LinkManagerWithRefType, LinkProps, LinkWithRef, LoadingIcon, LoadingIconProps, LoadingIndicator, LoadingOverlay, LoadingOverlayProps, Menu, MenuContext, MenuItem, MenuItemProps, MenuItemSeparator, MenuItemTextThemeProps, MenuProps, PageHeaderSection, PageHeaderSectionProps, Paragraph, ParagraphProps, RegisterDrawerProps, ResolveIcon, ResolveIconProps, ScrollableItemProps, ScrollableList, ScrollableListInputItem, ScrollableListItem, ScrollableListItemProps, ScrollableListProps, ShortcutContext, ShortcutRevealer, StatusBullet, StatusBulletProps, StatusTypeProps, Switch, SwitchProps, TabButton, TabButtonGroup, TabButtonProps, TabContent, TabContentProps, Table, TableBody, TableBodyProps, TableCellData, TableCellDataProps, TableCellHead, TableCellHeadProps, TableFoot, TableFootProps, TableHead, TableHeadProps, TableProps, TableRow, TableRowProps, Tabs, TabsProps, TextAlignProps, Textarea, TextareaProps, Theme, ThemeProps, TileContainer, TileContainerProps, UniformBadge, UniformLogo, UniformLogoProps, UseShortcutOptions, WarningMessage, WarningMessageProps, breakpoints, button, buttonGhost, buttonPrimary, buttonRippleEffect, buttonSecondary, buttonSecondaryInvert, buttonTertiary, buttonUnimportant, fadeIn, fadeInBottom, fadeInLtr, fadeInRtl, fadeOutBottom, growSubtle, input, inputError, inputSelect, isMacLike, labelText, macifyShortcut, mq, ripple, scrollbarStyles, skeletonLoading, supports, useBreakpoint, useCurrentTab, useDrawer, useIconContext, useMenuContext, useOutsideClick, useShortcut };